space-react-client 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -14129,7 +14129,7 @@ declare namespace React {
|
|
|
14129
14129
|
*
|
|
14130
14130
|
* @param callback A synchronous, void callback that will execute as a single, complete React commit.
|
|
14131
14131
|
*
|
|
14132
|
-
* @see https://reactjs.org/blog/2019/02/06/react-v16.8.0.html#testing-hooks
|
|
14132
|
+
* @see {@link https://reactjs.org/blog/2019/02/06/react-v16.8.0.html#testing-hooks}
|
|
14133
14133
|
*/
|
|
14134
14134
|
// While act does always return Thenable, if a void function is passed, we pretend the return value is also void to not trigger dangling Promise lint rules.
|
|
14135
14135
|
export function act(callback: () => VoidOrUndefinedOnly): void;
|
package/dist/index.js
CHANGED
|
@@ -107,12 +107,14 @@ class TokenService {
|
|
|
107
107
|
class SpaceClient {
|
|
108
108
|
constructor(config) {
|
|
109
109
|
this.userId = null;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
110
|
+
const normalizedUrl = config.url.endsWith('/') ? config.url.slice(0, -1) : config.url;
|
|
111
|
+
const parsedUrl = new URL(normalizedUrl);
|
|
112
|
+
const basePath = parsedUrl.pathname === '/' ? '' : parsedUrl.pathname.replace(/\/+$/, '');
|
|
113
|
+
const socketPath = `${basePath}/events`;
|
|
114
|
+
this.httpUrl = `${normalizedUrl}/api/v1`;
|
|
115
|
+
this.wsUrl = `${parsedUrl.protocol === 'https:' ? 'wss:' : 'ws:'}//${parsedUrl.host}${basePath}`;
|
|
114
116
|
this.socketClient = io(this.wsUrl, {
|
|
115
|
-
path:
|
|
117
|
+
path: socketPath,
|
|
116
118
|
transports: ['websocket'],
|
|
117
119
|
});
|
|
118
120
|
this.pricingSocketNamespace = this.socketClient.io.socket('/pricings');
|