@vaultix.ai/react 0.3.5 → 0.3.6
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.js +12 -4
- package/dist/index.mjs +12 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -332,7 +332,11 @@ function usePlatformConnect(provider, defaultOptions) {
|
|
|
332
332
|
);
|
|
333
333
|
(0, import_react2.useEffect)(() => {
|
|
334
334
|
if (typeof window === "undefined") return;
|
|
335
|
-
const
|
|
335
|
+
const hashStr = window.location.hash.startsWith("#") ? window.location.hash.slice(1) : "";
|
|
336
|
+
const hashParams = new URLSearchParams(hashStr);
|
|
337
|
+
const queryParams = new URLSearchParams(window.location.search);
|
|
338
|
+
const usingHash = hashParams.has("__vaultix_connect");
|
|
339
|
+
const params = usingHash ? hashParams : queryParams;
|
|
336
340
|
const connectToken = params.get("__vaultix_connect");
|
|
337
341
|
const returnedProvider = params.get("provider");
|
|
338
342
|
if (!connectToken || returnedProvider !== provider) return;
|
|
@@ -351,9 +355,13 @@ function usePlatformConnect(provider, defaultOptions) {
|
|
|
351
355
|
};
|
|
352
356
|
setConnectedAccount(result);
|
|
353
357
|
const clean = new URL(window.location.href);
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
358
|
+
if (usingHash) {
|
|
359
|
+
clean.hash = "";
|
|
360
|
+
} else {
|
|
361
|
+
clean.searchParams.delete("__vaultix_connect");
|
|
362
|
+
clean.searchParams.delete("provider");
|
|
363
|
+
}
|
|
364
|
+
window.history.replaceState({}, "", clean.href.replace(/#$/, ""));
|
|
357
365
|
} catch {
|
|
358
366
|
}
|
|
359
367
|
}, [provider]);
|
package/dist/index.mjs
CHANGED
|
@@ -297,7 +297,11 @@ function usePlatformConnect(provider, defaultOptions) {
|
|
|
297
297
|
);
|
|
298
298
|
useEffect2(() => {
|
|
299
299
|
if (typeof window === "undefined") return;
|
|
300
|
-
const
|
|
300
|
+
const hashStr = window.location.hash.startsWith("#") ? window.location.hash.slice(1) : "";
|
|
301
|
+
const hashParams = new URLSearchParams(hashStr);
|
|
302
|
+
const queryParams = new URLSearchParams(window.location.search);
|
|
303
|
+
const usingHash = hashParams.has("__vaultix_connect");
|
|
304
|
+
const params = usingHash ? hashParams : queryParams;
|
|
301
305
|
const connectToken = params.get("__vaultix_connect");
|
|
302
306
|
const returnedProvider = params.get("provider");
|
|
303
307
|
if (!connectToken || returnedProvider !== provider) return;
|
|
@@ -316,9 +320,13 @@ function usePlatformConnect(provider, defaultOptions) {
|
|
|
316
320
|
};
|
|
317
321
|
setConnectedAccount(result);
|
|
318
322
|
const clean = new URL(window.location.href);
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
323
|
+
if (usingHash) {
|
|
324
|
+
clean.hash = "";
|
|
325
|
+
} else {
|
|
326
|
+
clean.searchParams.delete("__vaultix_connect");
|
|
327
|
+
clean.searchParams.delete("provider");
|
|
328
|
+
}
|
|
329
|
+
window.history.replaceState({}, "", clean.href.replace(/#$/, ""));
|
|
322
330
|
} catch {
|
|
323
331
|
}
|
|
324
332
|
}, [provider]);
|