@swype-org/react-sdk 0.1.227 → 0.1.228

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
@@ -1964,7 +1964,8 @@ function createInitialState(config) {
1964
1964
  guestSessionToken: null,
1965
1965
  guestPreauthAccountId: null,
1966
1966
  activePublicKey: null,
1967
- userIntent: null
1967
+ userIntent: null,
1968
+ loginRequested: false
1968
1969
  };
1969
1970
  }
1970
1971
  function paymentReducer(state, action) {
@@ -1974,7 +1975,8 @@ function paymentReducer(state, action) {
1974
1975
  return {
1975
1976
  ...state,
1976
1977
  verificationTarget: action.target,
1977
- error: null
1978
+ error: null,
1979
+ loginRequested: false
1978
1980
  };
1979
1981
  case "BACK_TO_LOGIN":
1980
1982
  return {
@@ -2216,6 +2218,14 @@ function paymentReducer(state, action) {
2216
2218
  // ── User intent & error ──────────────────────────────────────
2217
2219
  case "SET_USER_INTENT":
2218
2220
  return { ...state, userIntent: action.intent };
2221
+ case "REQUEST_LOGIN":
2222
+ return {
2223
+ ...state,
2224
+ loginRequested: true,
2225
+ transfer: null,
2226
+ isGuestFlow: false,
2227
+ creatingTransfer: false
2228
+ };
2219
2229
  case "SET_ERROR":
2220
2230
  return { ...state, error: action.error };
2221
2231
  // ── Lifecycle ────────────────────────────────────────────────
@@ -2235,7 +2245,8 @@ function paymentReducer(state, action) {
2235
2245
  guestSessionToken: null,
2236
2246
  guestPreauthAccountId: null,
2237
2247
  activePublicKey: null,
2238
- userIntent: null
2248
+ userIntent: null,
2249
+ loginRequested: false
2239
2250
  };
2240
2251
  case "LOGOUT":
2241
2252
  return {
@@ -2328,7 +2339,7 @@ function resolveScreen(state) {
2328
2339
  if (state.authenticated && !state.activeCredentialId && !state.passkeyConfigLoaded) {
2329
2340
  return "loading";
2330
2341
  }
2331
- if (!state.authenticated && !state.verificationTarget && !state.isGuestFlow && (state.isReturningUser || state.guestPreauthRedirect)) {
2342
+ if (!state.authenticated && !state.verificationTarget && !state.isGuestFlow && (state.isReturningUser || state.guestPreauthRedirect || state.loginRequested)) {
2332
2343
  return "login";
2333
2344
  }
2334
2345
  if (!state.authenticated && state.verificationTarget != null) {
@@ -5900,6 +5911,7 @@ function StepRenderer(props) {
5900
5911
  isDesktop,
5901
5912
  isReturningUser,
5902
5913
  guestPreauthRedirect: props.state.guestPreauthAccountId != null,
5914
+ loginRequested: props.state.loginRequested,
5903
5915
  userIntent: props.state.userIntent,
5904
5916
  selectedAccount: props.selectedAccount,
5905
5917
  guestSettingSender: props.guestSettingSender
@@ -6033,7 +6045,7 @@ function StepRendererContent({
6033
6045
  useDeeplink: !isDesktop,
6034
6046
  error: state.error || (!isDesktop ? pollingError : authExecutorError),
6035
6047
  onRetryStatus: !isDesktop ? handlers.onRetryMobileStatus : void 0,
6036
- onBack: !isDesktop ? () => handlers.onSetUserIntent(null) : void 0,
6048
+ onBack: !isDesktop ? handlers.onBackFromOpenWallet : void 0,
6037
6049
  onLogout: handlers.onLogout
6038
6050
  }
6039
6051
  );
@@ -7419,6 +7431,7 @@ function useGuestTransferHandlers(deps) {
7419
7431
  if (!isGuestFlow || !guestTransferId || !guestSessionToken || !selectedGuestTokenRef.current) return;
7420
7432
  if (executingBridgeRef.current) return;
7421
7433
  executingBridgeRef.current = true;
7434
+ dispatch({ type: "PAY_STARTED" });
7422
7435
  const execute = async () => {
7423
7436
  try {
7424
7437
  let signPayload = null;
@@ -7515,6 +7528,7 @@ function useGuestTransferHandlers(deps) {
7515
7528
  onError?.(displayMsg);
7516
7529
  } finally {
7517
7530
  executingBridgeRef.current = false;
7531
+ dispatch({ type: "PAY_ENDED" });
7518
7532
  }
7519
7533
  };
7520
7534
  execute();
@@ -8519,6 +8533,7 @@ function BlinkPaymentInner({
8519
8533
  onIncreaseLimit: provider.handleIncreaseLimit,
8520
8534
  onConfirmSign: transfer.handleConfirmSign,
8521
8535
  onRetryMobileStatus: mobileFlow.handleRetryMobileStatus,
8536
+ onBackFromOpenWallet: () => dispatch({ type: "CLEAR_MOBILE_STATE" }),
8522
8537
  onLogout: handleLogout,
8523
8538
  onNewPayment: handleNewPayment,
8524
8539
  onSetUserIntent: (intent) => dispatch({ type: "SET_USER_INTENT", intent }),
@@ -8535,8 +8550,8 @@ function BlinkPaymentInner({
8535
8550
  onSelectAuthorizedToken: provider.handleSelectAuthorizedToken,
8536
8551
  onAuthorizeToken: provider.handleAuthorizeToken,
8537
8552
  onSelectGuestToken: guestTransfer.handleSelectGuestToken,
8538
- onLogin: () => dispatch({ type: "SET_USER_INTENT", intent: null }),
8539
- onPreauthorize: () => dispatch({ type: "SET_USER_INTENT", intent: null })
8553
+ onLogin: () => dispatch({ type: "REQUEST_LOGIN" }),
8554
+ onPreauthorize: () => dispatch({ type: "REQUEST_LOGIN" })
8540
8555
  }), [
8541
8556
  auth,
8542
8557
  passkey,