@swype-org/react-sdk 0.1.126 → 0.1.128

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
@@ -1979,7 +1979,8 @@ function createInitialState(config) {
1979
1979
  oneTapLimit: 100,
1980
1980
  mobileFlow: false,
1981
1981
  deeplinkUri: null,
1982
- increasingLimit: false
1982
+ increasingLimit: false,
1983
+ previousStep: null
1983
1984
  };
1984
1985
  }
1985
1986
  function paymentReducer(state, action) {
@@ -2203,7 +2204,7 @@ function paymentReducer(state, action) {
2203
2204
  };
2204
2205
  // ── Navigation & error ───────────────────────────────────────
2205
2206
  case "NAVIGATE":
2206
- return { ...state, step: action.step, error: null };
2207
+ return { ...state, step: action.step, previousStep: state.step, error: null };
2207
2208
  case "SET_ERROR":
2208
2209
  return { ...state, error: action.error };
2209
2210
  // ── Lifecycle ────────────────────────────────────────────────
@@ -5625,6 +5626,8 @@ function StepRenderer({
5625
5626
  handlers
5626
5627
  }) {
5627
5628
  const { step } = state;
5629
+ const selectedWallet = selectedAccount?.wallets.find((w) => w.id === state.selectedWalletId);
5630
+ const selectedSourceLabel = selectedSource && selectedWallet ? `${selectedSource.token.symbol} on ${selectedWallet.chain.name}` : void 0;
5628
5631
  if (!ready) {
5629
5632
  return /* @__PURE__ */ jsxRuntime.jsx(SwypeLoadingScreen, {});
5630
5633
  }
@@ -5740,6 +5743,8 @@ function StepRenderer({
5740
5743
  onSetupOneTap: handlers.onSetupOneTap,
5741
5744
  onBack: () => handlers.onNavigate("deposit"),
5742
5745
  onLogout: handlers.onLogout,
5746
+ onAdvanced: handlers.onSelectToken,
5747
+ selectedSourceLabel,
5743
5748
  loading: savingOneTapLimit,
5744
5749
  error: state.error
5745
5750
  }
@@ -5802,7 +5807,7 @@ function StepRenderer({
5802
5807
  chains: state.chains,
5803
5808
  onSelectAuthorized: handlers.onSelectAuthorizedToken,
5804
5809
  onAuthorizeToken: handlers.onAuthorizeToken,
5805
- onBack: () => handlers.onNavigate("deposit")
5810
+ onBack: () => handlers.onNavigate(state.previousStep === "setup" ? "setup" : "deposit")
5806
5811
  }
5807
5812
  );
5808
5813
  }
@@ -7173,13 +7178,22 @@ function SwypePaymentInner({
7173
7178
  }, [pendingSelectSourceAction, selectSourceChoices, selectSourceRecommended]);
7174
7179
  react.useEffect(() => {
7175
7180
  if (pendingSelectSourceAction && (state.step === "processing" || state.step === "open-wallet" || state.step === "setup-status")) {
7176
- preSelectSourceStepRef.current = state.step;
7177
- dispatch({ type: "NAVIGATE", step: "select-source" });
7181
+ if (state.step === "setup-status") {
7182
+ const recommended = selectSourceRecommended;
7183
+ if (recommended) {
7184
+ authExecutor.resolveSelectSource(recommended);
7185
+ } else {
7186
+ authExecutor.resolveSelectSource({ chainName: "Base", tokenSymbol: "USDC" });
7187
+ }
7188
+ } else {
7189
+ preSelectSourceStepRef.current = state.step;
7190
+ dispatch({ type: "NAVIGATE", step: "select-source" });
7191
+ }
7178
7192
  } else if (!pendingSelectSourceAction && state.step === "select-source") {
7179
7193
  dispatch({ type: "NAVIGATE", step: preSelectSourceStepRef.current ?? "processing" });
7180
7194
  preSelectSourceStepRef.current = null;
7181
7195
  }
7182
- }, [pendingSelectSourceAction, state.step]);
7196
+ }, [pendingSelectSourceAction, state.step, selectSourceRecommended, authExecutor]);
7183
7197
  react.useEffect(() => {
7184
7198
  if (!pendingSelectSourceAction || !pendingTokenAuthRef.current) return;
7185
7199
  const { tokenAddress, chainId } = pendingTokenAuthRef.current;