@swype-org/react-sdk 0.1.159 → 0.1.160

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
@@ -2107,6 +2107,18 @@ function maskAuthIdentifier(identifier) {
2107
2107
  const visibleSuffix = digits.slice(-4);
2108
2108
  return `***-***-${visibleSuffix}`;
2109
2109
  }
2110
+
2111
+ // src/walletFlow.ts
2112
+ var MOBILE_USER_AGENT_PATTERN = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i;
2113
+ function isMobileUserAgent(userAgent) {
2114
+ if (!userAgent) {
2115
+ return false;
2116
+ }
2117
+ return MOBILE_USER_AGENT_PATTERN.test(userAgent);
2118
+ }
2119
+ function shouldUseWalletConnector(options) {
2120
+ return options.useWalletConnector ?? !isMobileUserAgent(options.userAgent);
2121
+ }
2110
2122
  var ACCENT = "#28b67a";
2111
2123
  var BG_RING = "#d2e4ea";
2112
2124
  function SwypeLoadingScreen() {
@@ -3429,6 +3441,7 @@ function WalletPickerScreen({
3429
3441
  providers,
3430
3442
  pendingConnections,
3431
3443
  loading,
3444
+ useDeeplink,
3432
3445
  onPrepareProvider,
3433
3446
  onSelectProvider,
3434
3447
  onContinueConnection,
@@ -3482,7 +3495,7 @@ function WalletPickerScreen({
3482
3495
  {
3483
3496
  onClick: () => {
3484
3497
  const session = preparedSession?.providerId === selectedProvider.id ? preparedSession : void 0;
3485
- if (session) {
3498
+ if (session && useDeeplink) {
3486
3499
  const opened = window.open(session.uri, "_blank");
3487
3500
  if (!opened && window === window.parent) {
3488
3501
  window.location.href = session.uri;
@@ -4202,13 +4215,10 @@ function DepositScreen({
4202
4215
  remainingLimit.toFixed(2),
4203
4216
  ". Increase your limit to continue."
4204
4217
  ] })
4205
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
4206
- /* @__PURE__ */ jsxs(PrimaryButton, { onClick: () => onDeposit(amount), disabled: !canDeposit, loading: processing, children: [
4207
- "Deposit $",
4208
- amount.toFixed(2)
4209
- ] }),
4210
- /* @__PURE__ */ jsx("p", { style: noApprovalStyle(tokens.textMuted), children: "No approval needed \xB7 within your One-Tap limit" })
4211
- ] }),
4218
+ ] }) : /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(PrimaryButton, { onClick: () => onDeposit(amount), disabled: !canDeposit, loading: processing, children: [
4219
+ "Deposit $",
4220
+ amount.toFixed(2)
4221
+ ] }) }),
4212
4222
  /* @__PURE__ */ jsxs("p", { style: routeStyle(tokens.textMuted), children: [
4213
4223
  "From ",
4214
4224
  sourceName,
@@ -4266,22 +4276,13 @@ function DepositScreen({
4266
4276
  }
4267
4277
  )
4268
4278
  ] }),
4269
- /* @__PURE__ */ jsxs("div", { style: detailsStyle, children: [
4270
- /* @__PURE__ */ jsxs("div", { style: detailRowStyle(tokens.textMuted), children: [
4271
- "Remaining limit: ",
4272
- /* @__PURE__ */ jsxs("strong", { style: { color: tokens.text }, children: [
4273
- "$",
4274
- remainingLimit.toFixed(2)
4275
- ] })
4276
- ] }),
4277
- estimatedFeeUsd != null && estimatedFeePct != null ? /* @__PURE__ */ jsxs("div", { style: detailRowStyle(tokens.textMuted), children: [
4278
- "Fee: ~$",
4279
- estimatedFeeUsd.toFixed(2),
4280
- " (",
4281
- estimatedFeePct.toFixed(1),
4282
- "%)"
4283
- ] }) : /* @__PURE__ */ jsx("div", { style: detailRowStyle(tokens.textMuted), children: "Fees calculated at time of transfer" })
4284
- ] }),
4279
+ /* @__PURE__ */ jsx("div", { style: detailsStyle, children: /* @__PURE__ */ jsxs("div", { style: detailRowStyle(tokens.textMuted), children: [
4280
+ "Remaining limit: ",
4281
+ /* @__PURE__ */ jsxs("strong", { style: { color: tokens.text }, children: [
4282
+ "$",
4283
+ remainingLimit.toFixed(2)
4284
+ ] })
4285
+ ] }) }),
4285
4286
  error && /* @__PURE__ */ jsx("div", { style: errorBannerStyle5(tokens), children: error })
4286
4287
  ]
4287
4288
  }
@@ -4363,12 +4364,6 @@ var errorBannerStyle5 = (tokens) => ({
4363
4364
  marginTop: 8,
4364
4365
  lineHeight: 1.5
4365
4366
  });
4366
- var noApprovalStyle = (color) => ({
4367
- textAlign: "center",
4368
- fontSize: "0.78rem",
4369
- color,
4370
- margin: "12px 0 2px"
4371
- });
4372
4367
  var limitExceededHintStyle = (color) => ({
4373
4368
  textAlign: "center",
4374
4369
  fontSize: "0.78rem",
@@ -5593,6 +5588,9 @@ function StepRenderer({
5593
5588
  providers: state.providers,
5594
5589
  pendingConnections,
5595
5590
  loading: state.creatingTransfer,
5591
+ useDeeplink: !shouldUseWalletConnector({
5592
+ userAgent: typeof navigator === "undefined" ? void 0 : navigator.userAgent
5593
+ }),
5596
5594
  onPrepareProvider: handlers.onPrepareProvider,
5597
5595
  onSelectProvider: handlers.onSelectProvider,
5598
5596
  onContinueConnection: handlers.onContinueConnection,
@@ -6497,20 +6495,6 @@ function useMobileFlowHandlers(dispatch, polling, reloadAccounts, pollingTransfe
6497
6495
  handleRetryMobileStatus
6498
6496
  };
6499
6497
  }
6500
-
6501
- // src/walletFlow.ts
6502
- var MOBILE_USER_AGENT_PATTERN = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i;
6503
- function isMobileUserAgent(userAgent) {
6504
- if (!userAgent) {
6505
- return false;
6506
- }
6507
- return MOBILE_USER_AGENT_PATTERN.test(userAgent);
6508
- }
6509
- function shouldUseWalletConnector(options) {
6510
- return options.useWalletConnector ?? !isMobileUserAgent(options.userAgent);
6511
- }
6512
-
6513
- // src/hooks/useProviderHandlers.ts
6514
6498
  function useProviderHandlers(deps) {
6515
6499
  const {
6516
6500
  dispatch,
@@ -6615,9 +6599,7 @@ function useProviderHandlers(deps) {
6615
6599
  providerId,
6616
6600
  isSetup: true
6617
6601
  });
6618
- if (!preparedSession) {
6619
- triggerDeeplink(sessionUri);
6620
- }
6602
+ triggerDeeplink(sessionUri);
6621
6603
  dispatch({ type: "MOBILE_DEEPLINK_READY", deeplinkUri: sessionUri });
6622
6604
  } else {
6623
6605
  await authExecutor.executeSessionById(sessionId);