OZP-61: Migrate RPC API.

1. Clean up from original RPC commit.
2. Fixed intermittent RPC bug where Constants object was null due to not being defined properly in a require js enabled environment.
3. Removed unnecessary global variables in require js environment.