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