@swype-org/react-sdk 0.1.128 → 0.1.129
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 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -27
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7158,6 +7158,20 @@ function SwypePaymentInner({
|
|
|
7158
7158
|
return;
|
|
7159
7159
|
}
|
|
7160
7160
|
if (initializedSelectSourceActionRef.current === pendingSelectSourceAction.id) return;
|
|
7161
|
+
const options = pendingSelectSourceAction.metadata?.options ?? [];
|
|
7162
|
+
if (pendingTokenAuthRef.current) {
|
|
7163
|
+
const { tokenAddress, chainId } = pendingTokenAuthRef.current;
|
|
7164
|
+
const chainIdHex = `0x${chainId.toString(16)}`;
|
|
7165
|
+
const match = options.find(
|
|
7166
|
+
(opt) => opt.tokenAddress.toLowerCase() === tokenAddress.toLowerCase() && opt.chainId.toLowerCase() === chainIdHex.toLowerCase()
|
|
7167
|
+
);
|
|
7168
|
+
if (match) {
|
|
7169
|
+
setSelectSourceChainName(match.chainName);
|
|
7170
|
+
setSelectSourceTokenSymbol(match.tokenSymbol);
|
|
7171
|
+
initializedSelectSourceActionRef.current = pendingSelectSourceAction.id;
|
|
7172
|
+
return;
|
|
7173
|
+
}
|
|
7174
|
+
}
|
|
7161
7175
|
const hasRecommended = !!selectSourceRecommended && selectSourceChoices.some(
|
|
7162
7176
|
(chain) => chain.chainName === selectSourceRecommended.chainName && chain.tokens.some((t) => t.tokenSymbol === selectSourceRecommended.tokenSymbol)
|
|
7163
7177
|
);
|
|
@@ -7175,37 +7189,13 @@ function SwypePaymentInner({
|
|
|
7175
7189
|
}, [pendingSelectSourceAction, selectSourceChoices, selectSourceRecommended]);
|
|
7176
7190
|
useEffect(() => {
|
|
7177
7191
|
if (pendingSelectSourceAction && (state.step === "processing" || state.step === "open-wallet" || state.step === "setup-status")) {
|
|
7178
|
-
|
|
7179
|
-
|
|
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
|
-
}
|
|
7192
|
+
preSelectSourceStepRef.current = state.step;
|
|
7193
|
+
dispatch({ type: "NAVIGATE", step: "select-source" });
|
|
7189
7194
|
} else if (!pendingSelectSourceAction && state.step === "select-source") {
|
|
7190
7195
|
dispatch({ type: "NAVIGATE", step: preSelectSourceStepRef.current ?? "processing" });
|
|
7191
7196
|
preSelectSourceStepRef.current = null;
|
|
7192
7197
|
}
|
|
7193
|
-
}, [pendingSelectSourceAction, state.step,
|
|
7194
|
-
useEffect(() => {
|
|
7195
|
-
if (!pendingSelectSourceAction || !pendingTokenAuthRef.current) return;
|
|
7196
|
-
const { tokenAddress, chainId } = pendingTokenAuthRef.current;
|
|
7197
|
-
const chainIdHex = `0x${chainId.toString(16)}`;
|
|
7198
|
-
const options = pendingSelectSourceAction.metadata?.options ?? [];
|
|
7199
|
-
const match = options.find(
|
|
7200
|
-
(opt) => opt.tokenAddress.toLowerCase() === tokenAddress.toLowerCase() && opt.chainId.toLowerCase() === chainIdHex.toLowerCase()
|
|
7201
|
-
);
|
|
7202
|
-
if (match) {
|
|
7203
|
-
authExecutor.resolveSelectSource({
|
|
7204
|
-
chainName: match.chainName,
|
|
7205
|
-
tokenSymbol: match.tokenSymbol
|
|
7206
|
-
});
|
|
7207
|
-
}
|
|
7208
|
-
}, [pendingSelectSourceAction, authExecutor]);
|
|
7198
|
+
}, [pendingSelectSourceAction, state.step, authExecutor]);
|
|
7209
7199
|
const pendingOneTapSetupAction = authExecutor.pendingOneTapSetup;
|
|
7210
7200
|
const preOneTapSetupStepRef = useRef(null);
|
|
7211
7201
|
useEffect(() => {
|