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