@swype-org/react-sdk 0.1.75 → 0.1.76

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 CHANGED
@@ -1601,6 +1601,28 @@ function shouldUseWalletConnector(options) {
1601
1601
  return options.useWalletConnector ?? !isMobileUserAgent(options.userAgent);
1602
1602
  }
1603
1603
 
1604
+ // src/deeplink.ts
1605
+ var IFRAME_CLEANUP_DELAY_MS = 3e3;
1606
+ var LOCATION_FALLBACK_DELAY_MS = 100;
1607
+ function triggerDeeplink(uri) {
1608
+ try {
1609
+ const iframe = document.createElement("iframe");
1610
+ iframe.style.display = "none";
1611
+ iframe.src = uri;
1612
+ document.body.appendChild(iframe);
1613
+ setTimeout(() => {
1614
+ try {
1615
+ document.body.removeChild(iframe);
1616
+ } catch {
1617
+ }
1618
+ }, IFRAME_CLEANUP_DELAY_MS);
1619
+ } catch {
1620
+ }
1621
+ setTimeout(() => {
1622
+ window.location.href = uri;
1623
+ }, LOCATION_FALLBACK_DELAY_MS);
1624
+ }
1625
+
1604
1626
  // src/mobileFlow.ts
1605
1627
  function hasActiveWallet(accounts) {
1606
1628
  return accounts.some((account) => account.wallets.some((wallet) => wallet.status === "ACTIVE"));
@@ -4109,7 +4131,7 @@ function OpenWalletScreen({
4109
4131
  useEffect(() => {
4110
4132
  if (loading || !deeplinkUri || autoOpenedRef.current === deeplinkUri) return;
4111
4133
  autoOpenedRef.current = deeplinkUri;
4112
- window.location.href = deeplinkUri;
4134
+ triggerDeeplink(deeplinkUri);
4113
4135
  }, [loading, deeplinkUri]);
4114
4136
  const handleOpen = useCallback(() => {
4115
4137
  const opened = window.open(deeplinkUri, "_blank");
@@ -5133,7 +5155,7 @@ function SwypePaymentInner({
5133
5155
  providerId: sourceOverrides?.sourceType === "providerId" ? sourceOverrides.sourceId : selectedProviderId,
5134
5156
  isSetup: mobileSetupFlowRef.current
5135
5157
  });
5136
- window.location.href = uri;
5158
+ triggerDeeplink(uri);
5137
5159
  return;
5138
5160
  } else {
5139
5161
  await authExecutor.executeSession(t);