@swype-org/react-sdk 0.1.129 → 0.1.130
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 +26 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +26 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -7192,13 +7192,38 @@ function SwypePaymentInner({
|
|
|
7192
7192
|
}, [pendingSelectSourceAction, selectSourceChoices, selectSourceRecommended]);
|
|
7193
7193
|
react.useEffect(() => {
|
|
7194
7194
|
if (pendingSelectSourceAction && (state.step === "processing" || state.step === "open-wallet" || state.step === "setup-status")) {
|
|
7195
|
+
const isDesktop = shouldUseWalletConnector({
|
|
7196
|
+
useWalletConnector: useWalletConnectorProp,
|
|
7197
|
+
userAgent: typeof navigator === "undefined" ? void 0 : navigator.userAgent
|
|
7198
|
+
});
|
|
7199
|
+
if (isDesktop && state.step === "setup-status") {
|
|
7200
|
+
const recommended = pendingSelectSourceAction.metadata?.recommended;
|
|
7201
|
+
const options = pendingSelectSourceAction.metadata?.options ?? [];
|
|
7202
|
+
let chainName;
|
|
7203
|
+
let tokenSymbol;
|
|
7204
|
+
if (pendingTokenAuthRef.current) {
|
|
7205
|
+
const { tokenAddress, chainId } = pendingTokenAuthRef.current;
|
|
7206
|
+
const chainIdHex = `0x${chainId.toString(16)}`;
|
|
7207
|
+
const match = options.find(
|
|
7208
|
+
(opt) => opt.tokenAddress.toLowerCase() === tokenAddress.toLowerCase() && opt.chainId.toLowerCase() === chainIdHex.toLowerCase()
|
|
7209
|
+
);
|
|
7210
|
+
chainName = match?.chainName ?? recommended?.chainName ?? "Base";
|
|
7211
|
+
tokenSymbol = match?.tokenSymbol ?? recommended?.tokenSymbol ?? "USDC";
|
|
7212
|
+
} else {
|
|
7213
|
+
const choices = buildSelectSourceChoices(options);
|
|
7214
|
+
chainName = recommended?.chainName ?? choices[0]?.chainName ?? "Base";
|
|
7215
|
+
tokenSymbol = recommended?.tokenSymbol ?? choices[0]?.tokens[0]?.tokenSymbol ?? "USDC";
|
|
7216
|
+
}
|
|
7217
|
+
authExecutor.resolveSelectSource({ chainName, tokenSymbol });
|
|
7218
|
+
return;
|
|
7219
|
+
}
|
|
7195
7220
|
preSelectSourceStepRef.current = state.step;
|
|
7196
7221
|
dispatch({ type: "NAVIGATE", step: "select-source" });
|
|
7197
7222
|
} else if (!pendingSelectSourceAction && state.step === "select-source") {
|
|
7198
7223
|
dispatch({ type: "NAVIGATE", step: preSelectSourceStepRef.current ?? "processing" });
|
|
7199
7224
|
preSelectSourceStepRef.current = null;
|
|
7200
7225
|
}
|
|
7201
|
-
}, [pendingSelectSourceAction, state.step, authExecutor]);
|
|
7226
|
+
}, [pendingSelectSourceAction, state.step, authExecutor, useWalletConnectorProp]);
|
|
7202
7227
|
const pendingOneTapSetupAction = authExecutor.pendingOneTapSetup;
|
|
7203
7228
|
const preOneTapSetupStepRef = react.useRef(null);
|
|
7204
7229
|
react.useEffect(() => {
|