@swype-org/react-sdk 0.1.29 → 0.1.30

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
@@ -2153,14 +2153,20 @@ function hasProcessingTimedOut(processingStartedAtMs, nowMs) {
2153
2153
  function buildProcessingTimeoutMessage(status) {
2154
2154
  return `Payment is taking longer than expected (status: ${status}). Please try again.`;
2155
2155
  }
2156
+
2157
+ // src/walletFlow.ts
2158
+ var MOBILE_USER_AGENT_PATTERN = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i;
2159
+ function isMobileUserAgent(userAgent) {
2160
+ if (!userAgent) {
2161
+ return false;
2162
+ }
2163
+ return MOBILE_USER_AGENT_PATTERN.test(userAgent);
2164
+ }
2165
+ function shouldUseWalletConnector(options) {
2166
+ return options.useWalletConnector ?? !isMobileUserAgent(options.userAgent);
2167
+ }
2156
2168
  var ACTIVE_CREDENTIAL_STORAGE_KEY = "swype_active_credential_id";
2157
2169
  var MIN_SEND_AMOUNT_USD = 0.25;
2158
- function isMobile() {
2159
- if (typeof navigator === "undefined") return false;
2160
- return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
2161
- navigator.userAgent
2162
- );
2163
- }
2164
2170
  function computeSmartDefaults(accts, transferAmount) {
2165
2171
  if (accts.length === 0) return null;
2166
2172
  for (const acct of accts) {
@@ -2656,8 +2662,11 @@ function SwypePayment({
2656
2662
  });
2657
2663
  setTransfer(t);
2658
2664
  if (t.authorizationSessions && t.authorizationSessions.length > 0) {
2659
- const shouldUseWalletConnector = useWalletConnector ?? !isMobile();
2660
- if (!shouldUseWalletConnector) {
2665
+ const shouldUseConnector = shouldUseWalletConnector({
2666
+ useWalletConnector,
2667
+ userAgent: typeof navigator === "undefined" ? void 0 : navigator.userAgent
2668
+ });
2669
+ if (!shouldUseConnector) {
2661
2670
  setMobileFlow(true);
2662
2671
  pollingTransferIdRef.current = t.id;
2663
2672
  polling.startPolling(t.id);