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