@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 +20 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +20 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1976,7 +1976,8 @@ function createInitialState(config) {
|
|
|
1976
1976
|
oneTapLimit: 100,
|
|
1977
1977
|
mobileFlow: false,
|
|
1978
1978
|
deeplinkUri: null,
|
|
1979
|
-
increasingLimit: false
|
|
1979
|
+
increasingLimit: false,
|
|
1980
|
+
previousStep: null
|
|
1980
1981
|
};
|
|
1981
1982
|
}
|
|
1982
1983
|
function paymentReducer(state, action) {
|
|
@@ -2200,7 +2201,7 @@ function paymentReducer(state, action) {
|
|
|
2200
2201
|
};
|
|
2201
2202
|
// ── Navigation & error ───────────────────────────────────────
|
|
2202
2203
|
case "NAVIGATE":
|
|
2203
|
-
return { ...state, step: action.step, error: null };
|
|
2204
|
+
return { ...state, step: action.step, previousStep: state.step, error: null };
|
|
2204
2205
|
case "SET_ERROR":
|
|
2205
2206
|
return { ...state, error: action.error };
|
|
2206
2207
|
// ── Lifecycle ────────────────────────────────────────────────
|
|
@@ -5622,6 +5623,8 @@ function StepRenderer({
|
|
|
5622
5623
|
handlers
|
|
5623
5624
|
}) {
|
|
5624
5625
|
const { step } = state;
|
|
5626
|
+
const selectedWallet = selectedAccount?.wallets.find((w) => w.id === state.selectedWalletId);
|
|
5627
|
+
const selectedSourceLabel = selectedSource && selectedWallet ? `${selectedSource.token.symbol} on ${selectedWallet.chain.name}` : void 0;
|
|
5625
5628
|
if (!ready) {
|
|
5626
5629
|
return /* @__PURE__ */ jsx(SwypeLoadingScreen, {});
|
|
5627
5630
|
}
|
|
@@ -5737,6 +5740,8 @@ function StepRenderer({
|
|
|
5737
5740
|
onSetupOneTap: handlers.onSetupOneTap,
|
|
5738
5741
|
onBack: () => handlers.onNavigate("deposit"),
|
|
5739
5742
|
onLogout: handlers.onLogout,
|
|
5743
|
+
onAdvanced: handlers.onSelectToken,
|
|
5744
|
+
selectedSourceLabel,
|
|
5740
5745
|
loading: savingOneTapLimit,
|
|
5741
5746
|
error: state.error
|
|
5742
5747
|
}
|
|
@@ -5799,7 +5804,7 @@ function StepRenderer({
|
|
|
5799
5804
|
chains: state.chains,
|
|
5800
5805
|
onSelectAuthorized: handlers.onSelectAuthorizedToken,
|
|
5801
5806
|
onAuthorizeToken: handlers.onAuthorizeToken,
|
|
5802
|
-
onBack: () => handlers.onNavigate("deposit")
|
|
5807
|
+
onBack: () => handlers.onNavigate(state.previousStep === "setup" ? "setup" : "deposit")
|
|
5803
5808
|
}
|
|
5804
5809
|
);
|
|
5805
5810
|
}
|
|
@@ -7170,13 +7175,22 @@ function SwypePaymentInner({
|
|
|
7170
7175
|
}, [pendingSelectSourceAction, selectSourceChoices, selectSourceRecommended]);
|
|
7171
7176
|
useEffect(() => {
|
|
7172
7177
|
if (pendingSelectSourceAction && (state.step === "processing" || state.step === "open-wallet" || state.step === "setup-status")) {
|
|
7173
|
-
|
|
7174
|
-
|
|
7178
|
+
if (state.step === "setup-status") {
|
|
7179
|
+
const recommended = selectSourceRecommended;
|
|
7180
|
+
if (recommended) {
|
|
7181
|
+
authExecutor.resolveSelectSource(recommended);
|
|
7182
|
+
} else {
|
|
7183
|
+
authExecutor.resolveSelectSource({ chainName: "Base", tokenSymbol: "USDC" });
|
|
7184
|
+
}
|
|
7185
|
+
} else {
|
|
7186
|
+
preSelectSourceStepRef.current = state.step;
|
|
7187
|
+
dispatch({ type: "NAVIGATE", step: "select-source" });
|
|
7188
|
+
}
|
|
7175
7189
|
} else if (!pendingSelectSourceAction && state.step === "select-source") {
|
|
7176
7190
|
dispatch({ type: "NAVIGATE", step: preSelectSourceStepRef.current ?? "processing" });
|
|
7177
7191
|
preSelectSourceStepRef.current = null;
|
|
7178
7192
|
}
|
|
7179
|
-
}, [pendingSelectSourceAction, state.step]);
|
|
7193
|
+
}, [pendingSelectSourceAction, state.step, selectSourceRecommended, authExecutor]);
|
|
7180
7194
|
useEffect(() => {
|
|
7181
7195
|
if (!pendingSelectSourceAction || !pendingTokenAuthRef.current) return;
|
|
7182
7196
|
const { tokenAddress, chainId } = pendingTokenAuthRef.current;
|