@getpara/react-sdk-lite 2.0.0-alpha.63 → 2.0.0-alpha.65

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.
Files changed (62) hide show
  1. package/dist/modal/ParaModal.js +8 -3
  2. package/dist/modal/components/Account/AccountHeader.js +2 -2
  3. package/dist/modal/components/Account/AccountProfile.d.ts +1 -1
  4. package/dist/modal/components/Account/AccountProfile.js +64 -38
  5. package/dist/modal/components/{WalletSelect/WalletSelect.d.ts → Account/AccountWalletSelect.d.ts} +1 -1
  6. package/dist/modal/components/{WalletSelect/WalletSelect.js → Account/AccountWalletSelect.js} +5 -4
  7. package/dist/modal/components/AddFunds/AddFundsAsset.js +1 -2
  8. package/dist/modal/components/AddFunds/AddFundsSettings.js +1 -2
  9. package/dist/modal/components/AuthInput/AuthInput.js +1 -2
  10. package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +5 -2
  11. package/dist/modal/components/Body/Body.js +5 -2
  12. package/dist/modal/components/ChainSwitch/ChainSwitch.js +1 -3
  13. package/dist/modal/components/Controls/ChainSelect.js +1 -2
  14. package/dist/modal/components/Footer/Footer.js +1 -2
  15. package/dist/modal/components/Header/Header.js +1 -2
  16. package/dist/modal/components/Hero/Hero.js +5 -3
  17. package/dist/modal/components/IFrameStep/IFrameStep.js +4 -5
  18. package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +4 -1
  19. package/dist/modal/components/OnRampComponents/AddingFunds.js +1 -1
  20. package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +1 -2
  21. package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +4 -1
  22. package/dist/modal/components/SwitchWalletsStep/SwitchWalletsStep.d.ts +1 -0
  23. package/dist/modal/components/SwitchWalletsStep/SwitchWalletsStep.js +10 -0
  24. package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +13 -2
  25. package/dist/modal/components/Waiting/Waiting.d.ts +1 -1
  26. package/dist/modal/components/Waiting/Waiting.js +7 -2
  27. package/dist/modal/components/WalletCard/WalletCard.js +1 -2
  28. package/dist/modal/components/WalletSelectOld/WalletSelectOld.js +2 -3
  29. package/dist/modal/components/common.d.ts +2 -8
  30. package/dist/modal/components/common.js +2 -38
  31. package/dist/modal/index.d.ts +1 -1
  32. package/dist/modal/index.js +1 -1
  33. package/dist/modal/utils/authInputHelpers.js +1 -1
  34. package/dist/modal/utils/countryCodes.js +39 -0
  35. package/dist/modal/utils/getWalletDisplayName.js +1 -1
  36. package/dist/modal/utils/openPopup.d.ts +1 -1
  37. package/dist/modal/utils/openPopup.js +3 -1
  38. package/dist/modal/utils/steps.d.ts +6 -1
  39. package/dist/modal/utils/steps.js +17 -2
  40. package/dist/modal/utils/stringFormatters.js +1 -1
  41. package/dist/provider/ParaProviderMin.js +5 -0
  42. package/dist/provider/actions/getEmbeddedAccount.d.ts +3 -2
  43. package/dist/provider/actions/getEmbeddedAccount.js +13 -4
  44. package/dist/provider/actions/index.d.ts +2 -0
  45. package/dist/provider/actions/index.js +4 -0
  46. package/dist/provider/hooks/mutations/index.d.ts +2 -0
  47. package/dist/provider/hooks/mutations/index.js +4 -0
  48. package/dist/provider/hooks/mutations/useAddAuthMethod.d.ts +42 -0
  49. package/dist/provider/hooks/mutations/useAddAuthMethod.js +59 -0
  50. package/dist/provider/hooks/mutations/useExportPrivateKey.d.ts +15 -0
  51. package/dist/provider/hooks/mutations/useExportPrivateKey.js +32 -0
  52. package/dist/provider/hooks/mutations/useSwitchWallets.d.ts +57 -0
  53. package/dist/provider/hooks/mutations/useSwitchWallets.js +30 -0
  54. package/dist/provider/hooks/mutations/useVerifyExternalWallet.d.ts +3 -0
  55. package/dist/provider/hooks/mutations/useVerifyNewAccount.d.ts +3 -3
  56. package/dist/provider/hooks/queries/useAccount.js +4 -3
  57. package/dist/provider/providers/AccountLinkProvider.js +1 -1
  58. package/dist/provider/providers/AuthProvider.d.ts +4 -0
  59. package/dist/provider/providers/AuthProvider.js +106 -6
  60. package/package.json +8 -8
  61. package/dist/modal/constants/constants.d.ts +0 -35
  62. package/dist/modal/constants/constants.js +0 -148
@@ -0,0 +1,32 @@
1
+ "use client";
2
+ import {
3
+ __async,
4
+ __spreadValues
5
+ } from "../../../chunk-MMUBH76A.js";
6
+ import { useMutation } from "@tanstack/react-query";
7
+ import { useClient } from "../utils/index.js";
8
+ import { exportPrivateKey } from "../../actions/index.js";
9
+ import { useWallet } from "../queries/useWallet.js";
10
+ const EXPORT_PRIVATE_KEY_KEY = "EXPORT_PRIVATE_KEY";
11
+ const useExportPrivateKey = () => {
12
+ const para = useClient();
13
+ const { data: activeWallet } = useWallet();
14
+ return useMutation({
15
+ mutationKey: [EXPORT_PRIVATE_KEY_KEY],
16
+ mutationFn: (args) => __async(void 0, null, function* () {
17
+ try {
18
+ const result = yield exportPrivateKey(para, __spreadValues({
19
+ walletId: activeWallet == null ? void 0 : activeWallet.id,
20
+ shouldOpenPopup: true
21
+ }, args));
22
+ return result;
23
+ } catch (error) {
24
+ throw error;
25
+ }
26
+ })
27
+ });
28
+ };
29
+ export {
30
+ EXPORT_PRIVATE_KEY_KEY,
31
+ useExportPrivateKey
32
+ };
@@ -0,0 +1,57 @@
1
+ export declare const SWITCH_WALLETS_KEY = "SWITCH_WALLETS";
2
+ /**
3
+ * React hook for the `switchWallets` mutation.
4
+ *
5
+ * Returns a mutation result object with all standard fields from `useMutation`, except:
6
+ * - `mutate` and `mutateAsync` are replaced by:
7
+ * - `switchWallets`: function to trigger the mutation (same as `mutate`)
8
+ * - `switchWalletsAsync`: async function to trigger the mutation (same as `mutateAsync`)
9
+ *
10
+ * @example
11
+ * const { switchWallets, switchWalletsAsync } = useSwitchWallets();
12
+ * switchWallets({ authMethod: 'PASSKEY' });
13
+ * // or
14
+ * await switchWalletsAsync({ authMethod: 'PASSKEY' });
15
+ */
16
+ export declare const useSwitchWallets: () => {
17
+ status: "error" | "idle" | "pending" | "success";
18
+ data: {
19
+ needsWallet?: boolean | undefined;
20
+ partnerId?: string | undefined;
21
+ } | undefined;
22
+ isSuccess: boolean;
23
+ variables: void | {
24
+ onPoll?: (() => void) | undefined;
25
+ onCancel?: (() => void) | undefined;
26
+ skipSessionRefresh?: boolean | undefined;
27
+ isCanceled?: (() => boolean) | undefined;
28
+ } | undefined;
29
+ error: Error | null;
30
+ isError: boolean;
31
+ isIdle: boolean;
32
+ isPending: boolean;
33
+ reset: () => void;
34
+ context: unknown;
35
+ failureCount: number;
36
+ failureReason: Error | null;
37
+ isPaused: boolean;
38
+ submittedAt: number;
39
+ switchWallets: import("@tanstack/react-query").UseMutateFunction<{
40
+ needsWallet?: boolean | undefined;
41
+ partnerId?: string | undefined;
42
+ }, Error, void | {
43
+ onPoll?: (() => void) | undefined;
44
+ onCancel?: (() => void) | undefined;
45
+ skipSessionRefresh?: boolean | undefined;
46
+ isCanceled?: (() => boolean) | undefined;
47
+ }, unknown>;
48
+ switchWalletsAsync: import("@tanstack/react-query").UseMutateAsyncFunction<{
49
+ needsWallet?: boolean | undefined;
50
+ partnerId?: string | undefined;
51
+ }, Error, void | {
52
+ onPoll?: (() => void) | undefined;
53
+ onCancel?: (() => void) | undefined;
54
+ skipSessionRefresh?: boolean | undefined;
55
+ isCanceled?: (() => boolean) | undefined;
56
+ }, unknown>;
57
+ };
@@ -0,0 +1,30 @@
1
+ "use client";
2
+ import {
3
+ __async
4
+ } from "../../../chunk-MMUBH76A.js";
5
+ import { useMutation } from "@tanstack/react-query";
6
+ import { useInternalClient } from "../utils/useInternalClient.js";
7
+ import { renameMutations } from "../../utils/renameMutations.js";
8
+ const SWITCH_WALLETS_KEY = "SWITCH_WALLETS";
9
+ const useSwitchWallets = () => {
10
+ const para = useInternalClient();
11
+ const mutation = useMutation({
12
+ mutationKey: [SWITCH_WALLETS_KEY],
13
+ mutationFn: (..._0) => __async(void 0, [..._0], function* (args = {}) {
14
+ if (!para) {
15
+ throw new Error("Para client not available");
16
+ }
17
+ try {
18
+ const result = yield para.waitForWalletSwitching(args);
19
+ return result;
20
+ } catch (error) {
21
+ throw error;
22
+ }
23
+ })
24
+ });
25
+ return renameMutations(mutation, "switchWallets");
26
+ };
27
+ export {
28
+ SWITCH_WALLETS_KEY,
29
+ useSwitchWallets
30
+ };
@@ -25,6 +25,7 @@ export declare const useVerifyExternalWallet: () => {
25
25
  signedMessage: string;
26
26
  cosmosPublicKeyHex?: string | undefined;
27
27
  cosmosSigner?: string | undefined;
28
+ sessionLookupId?: string | undefined;
28
29
  } | undefined;
29
30
  error: Error | null;
30
31
  isError: boolean;
@@ -43,6 +44,7 @@ export declare const useVerifyExternalWallet: () => {
43
44
  signedMessage: string;
44
45
  cosmosPublicKeyHex?: string | undefined;
45
46
  cosmosSigner?: string | undefined;
47
+ sessionLookupId?: string | undefined;
46
48
  }, unknown>;
47
49
  verifyExternalWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Compute<import("@getpara/web-sdk").AuthStateSignup | import("@getpara/web-sdk").AuthStateLogin>, Error, {
48
50
  portalTheme?: import("@getpara/web-sdk").Theme | undefined;
@@ -51,5 +53,6 @@ export declare const useVerifyExternalWallet: () => {
51
53
  signedMessage: string;
52
54
  cosmosPublicKeyHex?: string | undefined;
53
55
  cosmosSigner?: string | undefined;
56
+ sessionLookupId?: string | undefined;
54
57
  }, unknown>;
55
58
  };
@@ -30,7 +30,7 @@ export declare const useVerifyNewAccount: () => {
30
30
  passkeyId?: string | undefined;
31
31
  passwordId?: string | undefined;
32
32
  pinId?: string | undefined;
33
- signupAuthMethods?: import("@getpara/web-sdk").AuthMethod[] | undefined;
33
+ signupAuthMethods?: import("@getpara/web-sdk").TAuthMethod[] | undefined;
34
34
  } | undefined;
35
35
  isSuccess: boolean;
36
36
  variables: {
@@ -63,7 +63,7 @@ export declare const useVerifyNewAccount: () => {
63
63
  passkeyId?: string | undefined;
64
64
  passwordId?: string | undefined;
65
65
  pinId?: string | undefined;
66
- signupAuthMethods?: import("@getpara/web-sdk").AuthMethod[] | undefined;
66
+ signupAuthMethods?: import("@getpara/web-sdk").TAuthMethod[] | undefined;
67
67
  }, Error, {
68
68
  portalTheme?: import("@getpara/web-sdk").Theme | undefined;
69
69
  useShortUrls?: boolean | undefined;
@@ -84,7 +84,7 @@ export declare const useVerifyNewAccount: () => {
84
84
  passkeyId?: string | undefined;
85
85
  passwordId?: string | undefined;
86
86
  pinId?: string | undefined;
87
- signupAuthMethods?: import("@getpara/web-sdk").AuthMethod[] | undefined;
87
+ signupAuthMethods?: import("@getpara/web-sdk").TAuthMethod[] | undefined;
88
88
  }, Error, {
89
89
  portalTheme?: import("@getpara/web-sdk").Theme | undefined;
90
90
  useShortUrls?: boolean | undefined;
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import {
3
+ __async,
3
4
  __objRest,
4
5
  __spreadProps,
5
6
  __spreadValues
@@ -62,8 +63,8 @@ const useAccount = ({ cosmos } = {}) => {
62
63
  cosmosQueryKeys,
63
64
  solanaQueryKeys
64
65
  ],
65
- queryFn: () => {
66
- const paraAccount = getEmbeddedAccount(client, isFullyLoggedIn);
66
+ queryFn: () => __async(void 0, null, function* () {
67
+ const paraAccount = yield getEmbeddedAccount(client, isFullyLoggedIn);
67
68
  let connectionType = "none";
68
69
  if (paraAccount.isConnected) {
69
70
  connectionType = "embedded";
@@ -107,7 +108,7 @@ const useAccount = ({ cosmos } = {}) => {
107
108
  solana: pickSolanaAdapter(solanaAdapter)
108
109
  }
109
110
  };
110
- }
111
+ })
111
112
  });
112
113
  const defaultResp = {
113
114
  isConnected: false,
@@ -112,7 +112,7 @@ const AccountLinkProvider = ({ children }) => {
112
112
  status: statusVerifyExternalWalletLink,
113
113
  reset: resetVerifyExternalWalletLink
114
114
  } = useVerifyExternalWalletLink();
115
- const isEnabled = (embedded == null ? void 0 : embedded.isConnected) || !(embedded == null ? void 0 : embedded.isGuestMode) && (!((_a = para.authInfo) == null ? void 0 : _a.externalWallet) || includeWalletVerification || externalWalletsWithFullAuth === "ALL" || externalWalletsWithFullAuth.includes((_c = (_b = para.authInfo) == null ? void 0 : _b.externalWallet) == null ? void 0 : _c.providerId));
115
+ const isEnabled = !(embedded == null ? void 0 : embedded.isGuestMode) && (embedded == null ? void 0 : embedded.isConnected) && (!((_a = para.authInfo) == null ? void 0 : _a.externalWallet) || includeWalletVerification || externalWalletsWithFullAuth === "ALL" || externalWalletsWithFullAuth.includes((_c = (_b = para.authInfo) == null ? void 0 : _b.externalWallet) == null ? void 0 : _c.providerId));
116
116
  const [accountLinkInProgress, setAccountLinkInProgress] = useState(
117
117
  coreAccountLinkInProgress || void 0
118
118
  );
@@ -23,6 +23,10 @@ type Value = {
23
23
  createGuestWallets: () => void;
24
24
  isCreateGuestWalletsPending: boolean;
25
25
  logout: () => void;
26
+ switchWallets: (authMethod?: string) => void;
27
+ switchWalletsUrl: string | undefined;
28
+ setSwitchWalletsUrl: (_: string) => void;
29
+ isSwitchWalletsPending: boolean;
26
30
  biometricHints?: BiometricHints;
27
31
  };
28
32
  type Props = PropsWithChildren<{
@@ -6,7 +6,7 @@ import {
6
6
  } from "../../chunk-MMUBH76A.js";
7
7
  import { jsx } from "react/jsx-runtime";
8
8
  import { useUserAgent } from "@getpara/react-common";
9
- import { createContext, useCallback, useContext, useEffect, useMemo } from "react";
9
+ import { createContext, useCallback, useContext, useEffect, useMemo, useState } from "react";
10
10
  import { useModalStore } from "../../modal/stores/index.js";
11
11
  import { ModalStep } from "../../modal/utils/steps.js";
12
12
  import {
@@ -20,8 +20,10 @@ import {
20
20
  useVerifyTelegram,
21
21
  useSetup2fa,
22
22
  useLogout,
23
- useCreateGuestWallets
23
+ useCreateGuestWallets,
24
+ useWalletState
24
25
  } from "../index.js";
26
+ import { useSwitchWallets } from "../hooks/mutations/useSwitchWallets.js";
25
27
  import { DEFAULTS } from "../../modal/constants/defaults.js";
26
28
  import { openPopup } from "../../modal/utils/openPopup.js";
27
29
  import {
@@ -65,7 +67,13 @@ const AuthContext = createContext({
65
67
  },
66
68
  isCreateGuestWalletsPending: false,
67
69
  logout: () => {
68
- }
70
+ },
71
+ switchWallets: () => {
72
+ },
73
+ switchWalletsUrl: void 0,
74
+ setSwitchWalletsUrl: () => {
75
+ },
76
+ isSwitchWalletsPending: false
69
77
  });
70
78
  function AuthProvider({
71
79
  children,
@@ -111,10 +119,14 @@ function AuthProvider({
111
119
  const { waitForLogin: mutateWaitForLogin } = useWaitForLogin();
112
120
  const { waitForSignup: mutateWaitForSignup } = useWaitForSignup();
113
121
  const { waitForWalletCreationAsync: mutateAsyncWaitForWalletCreation } = useWaitForWalletCreation();
122
+ const { switchWallets: mutateSwitchWallets, isPending: mutateIsSwitchWalletsPending } = useSwitchWallets();
114
123
  const { setup2fa: mutateSetup2fa, isPending: isSetup2faPending } = useSetup2fa();
115
124
  const { createGuestWallets: mutateCreateGuestWallets, isPending: isCreateGuestWalletsPending } = useCreateGuestWallets();
116
125
  const { logout: mutateLogout } = useLogout();
126
+ const { updateSelectedWallet } = useWalletState();
117
127
  const { data: biometricHints } = useFormattedBiometricHints();
128
+ const [switchWalletsUrl, setSwitchWalletsUrl] = useState(void 0);
129
+ const [isSwitchWalletsPending, setIsSwitchWalletsPending] = useState(mutateIsSwitchWalletsPending);
118
130
  const goBackIfPopupClosedOnSteps = (steps) => {
119
131
  var _a;
120
132
  if (((_a = refs.popupWindow.current) == null ? void 0 : _a.closed) && (!refs.currentStep.current || steps.includes(refs.currentStep.current))) {
@@ -278,14 +290,16 @@ function AuthProvider({
278
290
  ModalStep.OTP,
279
291
  ModalStep.FARCASTER_OAUTH,
280
292
  ModalStep.TELEGRAM_OAUTH,
281
- ModalStep.AWAITING_OAUTH
293
+ ModalStep.AWAITING_OAUTH,
294
+ ModalStep.SWITCH_WALLETS
282
295
  ]),
283
296
  onPoll: () => {
284
297
  goBackIfPopupClosedOnSteps([
285
298
  ModalStep.AWAITING_BIOMETRIC_LOGIN,
286
299
  ModalStep.AWAITING_PASSWORD_LOGIN,
287
300
  ModalStep.EMBEDDED_PASSWORD_LOGIN,
288
- ModalStep.OTP
301
+ ModalStep.OTP,
302
+ ModalStep.SWITCH_WALLETS
289
303
  ]);
290
304
  }
291
305
  },
@@ -557,6 +571,75 @@ function AuthProvider({
557
571
  const logout = () => {
558
572
  mutateLogout();
559
573
  };
574
+ const switchWallets = () => {
575
+ if (!switchWalletsUrl) {
576
+ return;
577
+ }
578
+ setIsSwitchWalletsPending(true);
579
+ try {
580
+ setStep(ModalStep.SWITCH_WALLETS);
581
+ refs.popupWindow.current = openPopup({
582
+ url: switchWalletsUrl,
583
+ target: "ParaSwitchWallets",
584
+ type: "SWITCH_WALLETS",
585
+ current: refs.popupWindow.current
586
+ });
587
+ pollSwitchWallets();
588
+ } catch (error) {
589
+ console.error("Failed to open wallet switching popup:", error);
590
+ }
591
+ };
592
+ const pollSwitchWallets = () => {
593
+ if (typeof window !== "undefined") {
594
+ refs.poll.current = {
595
+ action: "login",
596
+ timeout: window == null ? void 0 : window.setTimeout(() => __async(this, null, function* () {
597
+ mutateSwitchWallets(
598
+ {
599
+ isCanceled: () => {
600
+ var _a, _b;
601
+ const exitedSteps = cancelIfExitedSteps([ModalStep.SWITCH_WALLETS, ModalStep.SWITCH_WALLETS_IFRAME]);
602
+ const popupClosed = (_b = (_a = refs.popupWindow.current) == null ? void 0 : _a.closed) != null ? _b : false;
603
+ const isCanceled = exitedSteps || popupClosed;
604
+ if (isCanceled) {
605
+ if (popupClosed && (refs.currentStep.current === ModalStep.SWITCH_WALLETS || refs.currentStep.current === ModalStep.SWITCH_WALLETS_IFRAME)) {
606
+ goBack();
607
+ }
608
+ }
609
+ return isCanceled;
610
+ },
611
+ onPoll: () => {
612
+ if (refs.currentStep.current === ModalStep.SWITCH_WALLETS || refs.currentStep.current === ModalStep.SWITCH_WALLETS_IFRAME) {
613
+ goBackIfPopupClosedOnSteps([ModalStep.SWITCH_WALLETS, ModalStep.SWITCH_WALLETS_IFRAME]);
614
+ }
615
+ }
616
+ },
617
+ {
618
+ onSuccess: () => {
619
+ updateSelectedWallet();
620
+ setTimeout(() => {
621
+ setStep(ModalStep.ACCOUNT_PROFILE);
622
+ refs.popupWindow.current = null;
623
+ }, 500);
624
+ },
625
+ onError: () => {
626
+ if (refs.currentStep.current === ModalStep.SWITCH_WALLETS) {
627
+ goBack();
628
+ }
629
+ },
630
+ onSettled: () => {
631
+ var _a;
632
+ setIsSwitchWalletsPending(false);
633
+ window == null ? void 0 : window.clearTimeout((_a = refs.poll.current) == null ? void 0 : _a.timeout);
634
+ refs.poll.current = null;
635
+ refs.popupWindow.current = null;
636
+ }
637
+ }
638
+ );
639
+ }), DEFAULTS.LOGGIN_POLLING_DELAY_MS)
640
+ };
641
+ }
642
+ };
560
643
  const isPasswordIFrameLoading = !!iFrameUrl && iFrameUrl === (signupState == null ? void 0 : signupState.passwordUrl) && !isIFrameReady;
561
644
  const value = useMemo(
562
645
  () => ({
@@ -577,6 +660,10 @@ function AuthProvider({
577
660
  createGuestWallets,
578
661
  isCreateGuestWalletsPending,
579
662
  logout,
663
+ switchWallets,
664
+ switchWalletsUrl,
665
+ setSwitchWalletsUrl,
666
+ isSwitchWalletsPending,
580
667
  biometricHints: biometricHints || void 0,
581
668
  verifyFarcasterStatus
582
669
  }),
@@ -599,16 +686,26 @@ function AuthProvider({
599
686
  createGuestWallets,
600
687
  isCreateGuestWalletsPending,
601
688
  logout,
689
+ switchWallets,
690
+ switchWalletsUrl,
691
+ setSwitchWalletsUrl,
692
+ isSwitchWalletsPending,
602
693
  biometricHints,
603
694
  verifyFarcasterStatus
604
695
  ]
605
696
  );
606
697
  useEffect(() => {
698
+ let timerId;
607
699
  if (!!authStepRoute && refs.currentStep.current !== authStepRoute) {
608
- setTimeout(() => {
700
+ timerId = setTimeout(() => {
609
701
  setStep(authStepRoute);
610
702
  }, 200);
611
703
  }
704
+ return () => {
705
+ if (timerId) {
706
+ clearTimeout(timerId);
707
+ }
708
+ };
612
709
  }, [authStepRoute]);
613
710
  useEffect(() => {
614
711
  refs.currentStep.current = currentStep;
@@ -618,6 +715,9 @@ function AuthProvider({
618
715
  setStep(ModalStep.ACCOUNT_MAIN);
619
716
  }
620
717
  }, [isCreateGuestWalletsPending]);
718
+ useEffect(() => {
719
+ setIsSwitchWalletsPending((prev) => !!prev ? mutateIsSwitchWalletsPending : prev);
720
+ }, [mutateIsSwitchWalletsPending]);
621
721
  useEffect(() => {
622
722
  return () => {
623
723
  var _a;
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@getpara/react-sdk-lite",
3
- "version": "2.0.0-alpha.63",
3
+ "version": "2.0.0-alpha.65",
4
4
  "bin": {
5
5
  "setup-para": "dist/cli/cli.mjs"
6
6
  },
7
7
  "dependencies": {
8
- "@getpara/react-common": "2.0.0-alpha.63",
9
- "@getpara/react-components": "2.0.0-alpha.63",
10
- "@getpara/web-sdk": "2.0.0-alpha.63",
8
+ "@getpara/react-common": "2.0.0-alpha.65",
9
+ "@getpara/react-components": "2.0.0-alpha.65",
10
+ "@getpara/web-sdk": "2.0.0-alpha.65",
11
11
  "date-fns": "^3.6.0",
12
12
  "framer-motion": "^11.3.31",
13
13
  "libphonenumber-js": "^1.11.7",
@@ -16,9 +16,9 @@
16
16
  "zustand-sync-tabs": "^0.2.2"
17
17
  },
18
18
  "devDependencies": {
19
- "@getpara/cosmos-wallet-connectors": "2.0.0-alpha.63",
20
- "@getpara/evm-wallet-connectors": "2.0.0-alpha.63",
21
- "@getpara/solana-wallet-connectors": "2.0.0-alpha.63",
19
+ "@getpara/cosmos-wallet-connectors": "2.0.0-alpha.65",
20
+ "@getpara/evm-wallet-connectors": "2.0.0-alpha.65",
21
+ "@getpara/solana-wallet-connectors": "2.0.0-alpha.65",
22
22
  "@tanstack/react-query": "^5.74.0",
23
23
  "@testing-library/dom": "^10.4.0",
24
24
  "@testing-library/react": "^16.3.0",
@@ -38,7 +38,7 @@
38
38
  "package.json",
39
39
  "styles.css"
40
40
  ],
41
- "gitHead": "440300efa66a6bc808504e2771b21e92bdee4c9b",
41
+ "gitHead": "9945ab14944c22851eb81c5bbb831b23bf7eaf2a",
42
42
  "main": "dist/index.js",
43
43
  "peerDependencies": {
44
44
  "@tanstack/react-query": ">=5.0.0",
@@ -1,35 +0,0 @@
1
- import { TNetwork, TOnRampAsset, OnRampMethod, OnRampProvider, TWalletType } from '@getpara/core-sdk';
2
- import { IconType } from '@getpara/react-components';
3
- import { Transition, Variants } from 'framer-motion';
4
- import { DisplayMetadata } from '@getpara/react-common';
5
- export declare const PARA_CONNECT = "https://connect.getpara.com/";
6
- export declare const PARA_TERMS_AND_CONDITIONS = "https://getpara.com/terms";
7
- export type OnRampProviderConfig = DisplayMetadata & {
8
- feeLower: number;
9
- feeUpper?: number;
10
- methods: OnRampMethod[];
11
- backgroundColors: string[];
12
- };
13
- export declare const ON_RAMP_PROVIDERS: Record<OnRampProvider, OnRampProviderConfig>;
14
- type Networks = Record<TNetwork, DisplayMetadata>;
15
- export declare const WALLET_TYPES_METADATA: Record<TWalletType, DisplayMetadata>;
16
- export declare const NETWORKS: Networks;
17
- export declare const ON_RAMP_ASSETS: Record<TOnRampAsset, {
18
- name: string;
19
- code: string;
20
- icon: IconType;
21
- isCircular?: boolean;
22
- isDark?: boolean;
23
- }>;
24
- export declare function getNetworkName(str: TNetwork | string): string;
25
- export declare function getNetworkIcon(str: TNetwork | string): IconType;
26
- export declare function getAssetCode(str: TOnRampAsset | string): string;
27
- export declare function getAssetName(str: TOnRampAsset | string): string;
28
- export declare function getAssetIcon(str: TOnRampAsset | string): "key" | "phone" | "farcaster" | "telegram" | "discord" | "x" | "search" | "wallet" | "cosmos" | "solana" | "para" | "walletConnect" | "close" | "copy" | "safe" | "stripeBrand" | "alertCircle" | "alertTriangle" | "alignVerticalCenter" | "angelListBrand" | "angelList" | "appleBrand" | "apple" | "arbitrumBrand" | "arrowCircleBrokenDownLeft" | "arrowCircleDownFilled" | "arrowCircleDown" | "arrowNarrow" | "arrow" | "asterisk" | "backpack" | "backupKit" | "bank" | "baseBrand" | "beraBrand" | "brush" | "celoBrand" | "checkCircleFilled" | "checkCircle" | "checkSquare" | "check" | "chevronDown" | "chevronRight" | "chevronSelectorVertical" | "chevronUp" | "clock" | "clubhouseBrand" | "clubhouse" | "code" | "coinbase" | "copy07" | "cosmosCircle" | "cosmostation" | "creditCard02" | "creditCard" | "cube03" | "cubeOutline" | "cube" | "currencyDollar" | "decentBrand" | "decent" | "dell" | "discordBrand" | "dot" | "dotsSquare" | "dots" | "downloadCloud" | "download" | "dribbbleBrand" | "dribbble" | "earth" | "edit02" | "emptyCircle" | "ethCircle" | "ethereum" | "eyeOff" | "eye" | "facebookBrand" | "facebook" | "farcasterBrand" | "figmaBrand" | "figma" | "file" | "folder" | "githubBrand" | "github" | "globe" | "glow" | "googleBrand" | "google" | "gridDots" | "haha" | "helpCircle" | "heroAlertCircle" | "heroCheckmarkCapsule" | "heroCheckmark" | "heroEmail" | "heroExternalConnection" | "heroLock" | "heroPasskey" | "heroPhone" | "heroPlusCircleCapsule" | "heroPlusCircle" | "heroWallet" | "home" | "hp" | "image" | "infoCircle" | "instagramBrand" | "instagram" | "keplr" | "laptop" | "leap" | "lenovo" | "lg" | "lightning01" | "lightning" | "linkExternal" | "linkedinBrand" | "linkedin" | "lockKeyholeCircle" | "logOut" | "mail" | "menu" | "metamask" | "monitor" | "moonpayBrand" | "moreLoginOptions" | "motorola" | "nobleBrand" | "okx" | "optimismBrand" | "paraArrow" | "paraBlackBg" | "paraBrand" | "paraIconBrand" | "paraIconQr" | "paraIcon" | "paraLogo" | "paraRingsDark" | "paraRings" | "passcode" | "phantom" | "pintrestBrand" | "pintrest" | "plusCircle" | "plus" | "polygonBrand" | "polygon" | "puzzlePiece" | "qrCode02" | "qrCode" | "rabby" | "rainbow" | "rampNetworkBrand" | "rampNetwork" | "redditBrand" | "reddit" | "refresh" | "samsung" | "send" | "settings" | "share" | "shield" | "signalBrand" | "signal" | "sliders" | "snapchatBrand" | "snapchat" | "solanaCircle" | "solflare" | "spacingHeight" | "star04Filled" | "star05" | "stars01Filled" | "stars02" | "stars" | "stopSquare" | "telegramBrand" | "tetherBrand" | "tikTokBrand" | "tikTok" | "trash" | "tumblrBrand" | "tumblr" | "twitterBrand" | "twitter" | "usdcBrand" | "user01" | "userCircle" | "userPlus" | "user" | "valora" | "wallet02" | "youtubeBrand" | "youtube" | "zerion" | "AD" | "AE" | "AF" | "AG" | "AI" | "AL" | "AM" | "AO" | "AR" | "AS" | "AT" | "AU" | "AW" | "AX" | "AZ" | "BA" | "BB" | "BD" | "BE" | "BF" | "BG" | "BH" | "BI" | "BJ" | "BL" | "BM" | "BN" | "BO" | "BQ" | "BQ2" | "BQ3" | "BR" | "BS" | "BT" | "BW" | "BY" | "BZ" | "CA" | "CC" | "CD" | "CD2" | "CF" | "CH" | "CK" | "CL" | "CM" | "CN" | "CO" | "CR" | "CU" | "CW" | "CX" | "CY" | "CZ" | "DE" | "DJ" | "DK" | "DM" | "DO" | "DS" | "DZ" | "EC" | "EE" | "EG" | "EH" | "ER" | "ES" | "ET" | "FI" | "FJ" | "FK" | "FM" | "FO" | "FR" | "GA" | "GB2" | "GB" | "GD" | "GE" | "GG" | "GH" | "GI" | "GL" | "GM" | "GN" | "GQ" | "GR" | "GT" | "GU" | "GW" | "GY" | "HK" | "HN" | "HR" | "HT" | "HU" | "ID" | "IE" | "IL" | "IM" | "IN" | "IO" | "IQ" | "IR" | "IS" | "IT" | "JE" | "JM" | "JO" | "JP" | "KE" | "KG" | "KH" | "KI" | "KM" | "KN" | "KP" | "KR" | "KW" | "KY" | "KZ" | "LA" | "LB" | "LC" | "LI" | "LK" | "LR" | "LS" | "LT" | "LU" | "LV" | "LY" | "MA" | "MC" | "MD" | "ME" | "MG" | "MH" | "MK" | "ML" | "MM" | "MN" | "MO" | "MP" | "MQ" | "MR" | "MS" | "MT" | "MU" | "MV" | "MW" | "MX" | "MY" | "MZ" | "NA" | "NE" | "NF" | "NG" | "NI" | "NL" | "NO" | "NP" | "NR" | "NU" | "NZ" | "OM" | "PA" | "PE" | "PF" | "PG" | "PH" | "PK" | "PL" | "PN" | "PR" | "PS" | "PT" | "PW" | "PY" | "QA" | "RO" | "RS" | "RU" | "RW" | "SA" | "SB" | "SC" | "SE" | "SG" | "SI" | "SK" | "SL" | "SM" | "SN" | "SO" | "SR" | "SS" | "ST" | "SV" | "SX" | "SY" | "SZ" | "TC" | "TD" | "TG" | "TH" | "TJ" | "TK" | "TL" | "TM" | "TN" | "TO" | "TR" | "TT" | "TV" | "TW" | "TZ" | "UA" | "UG" | "US" | "UY" | "UZ" | "VC" | "VE" | "VG" | "VI" | "VN" | "VU" | "WS" | "YE" | "ZA" | "ZM" | "ZW";
29
- export declare const MOBILE_SIZE = 480;
30
- export declare const NETWORK_NOT_SUPPORTED_ERROR = "network not supported";
31
- export declare const EMAIL_REGEX: RegExp;
32
- export declare const BODY_MOTION_VARIANTS: Variants;
33
- export declare const BODY_TRANSITION: Transition;
34
- export declare const SDK_VERSION: string;
35
- export {};
@@ -1,148 +0,0 @@
1
- "use client";
2
- import {
3
- __spreadProps,
4
- __spreadValues
5
- } from "../../chunk-MMUBH76A.js";
6
- import { OnRampMethod, OnRampProvider } from "@getpara/core-sdk";
7
- const PARA_CONNECT = "https://connect.getpara.com/";
8
- const PARA_TERMS_AND_CONDITIONS = "https://getpara.com/terms";
9
- const ON_RAMP_PROVIDERS = {
10
- [OnRampProvider.STRIPE]: {
11
- name: "Stripe",
12
- feeLower: 0.99,
13
- feeUpper: 4.49,
14
- methods: [OnRampMethod.ACH, OnRampMethod.DEBIT, OnRampMethod.CREDIT],
15
- icon: "stripeBrand",
16
- backgroundColors: ["#6772E5", "#808AF4"]
17
- },
18
- [OnRampProvider.RAMP]: {
19
- name: "Ramp",
20
- feeLower: 0.99,
21
- feeUpper: 4.49,
22
- methods: [OnRampMethod.ACH, OnRampMethod.DEBIT, OnRampMethod.CREDIT],
23
- icon: "rampNetworkBrand",
24
- backgroundColors: ["#21BF73", "#3AE492"]
25
- },
26
- [OnRampProvider.MOONPAY]: {
27
- name: "MoonPay",
28
- feeLower: 1,
29
- feeUpper: 4.5,
30
- methods: [OnRampMethod.ACH, OnRampMethod.DEBIT, OnRampMethod.CREDIT],
31
- icon: "moonpayBrand",
32
- backgroundColors: ["#7715F5", "#9647fd"]
33
- }
34
- };
35
- const ICON_TYPES = {
36
- ethereum: { isDark: true },
37
- usdcBrand: { isCircular: true },
38
- arbitrumBrand: { isCircular: true },
39
- baseBrand: { isCircular: true },
40
- optimismBrand: { isCircular: true },
41
- cosmos: { isCircular: true, isDark: true },
42
- celoBrand: { isCircular: true },
43
- tetherBrand: { isCircular: true }
44
- };
45
- const WALLET_TYPES_METADATA = {
46
- EVM: { name: "EVM", icon: "ethereum", isDark: true },
47
- SOLANA: { name: "Solana", icon: "solana" },
48
- COSMOS: { name: "Cosmos", icon: "cosmos", isCircular: true, isDark: true }
49
- };
50
- const NETWORKS = Object.entries({
51
- ["ETHEREUM"]: { name: "Ethereum", icon: "ethereum" },
52
- ["SEPOLIA"]: { name: "Sepolia", icon: "ethereum" },
53
- ["ARBITRUM"]: { name: "Arbitrum", icon: "arbitrumBrand" },
54
- ["BASE"]: { name: "Base", icon: "baseBrand" },
55
- ["OPTIMISM"]: { name: "Optimism", icon: "optimismBrand" },
56
- ["POLYGON"]: { name: "Polygon", icon: "polygonBrand" },
57
- ["SOLANA"]: { name: "Solana", icon: "solana" },
58
- ["COSMOS"]: { name: "Cosmos", icon: "cosmos" },
59
- ["CELO"]: { name: "Celo", icon: "celoBrand" },
60
- ["SOLANA_DEVNET"]: { name: "Solana Devnet", icon: "solana" },
61
- ["NOBLE"]: { name: "Noble", icon: "nobleBrand" },
62
- ["BERACHAIN"]: { name: "Berachain", icon: "beraBrand" }
63
- }).reduce((acc, [key, entry]) => {
64
- return __spreadProps(__spreadValues({}, acc), {
65
- [key]: __spreadValues(__spreadValues({}, entry), ICON_TYPES[entry.icon])
66
- });
67
- }, {});
68
- const ON_RAMP_ASSETS = Object.entries({
69
- ["ETHEREUM"]: { name: "Ethereum", code: "ETH", icon: "ethereum" },
70
- ["USDC"]: { name: "USD Coin", code: "USDC", icon: "usdcBrand" },
71
- ["POLYGON"]: { name: "Polygon", code: "POL", icon: "polygonBrand" },
72
- ["SOLANA"]: { name: "Solana", code: "SOL", icon: "solana" },
73
- ["ATOM"]: { name: "Atom", code: "ATOM", icon: "cosmos" },
74
- ["CELO"]: { name: "Celo", code: "CELO", icon: "celoBrand" },
75
- ["TETHER"]: { name: "Tether", code: "USDT", icon: "tetherBrand" },
76
- ["CUSD"]: { name: "Celo Dollar", code: "CUSD", icon: "celoBrand" },
77
- ["CEUR"]: { name: "Celo Euro", code: "CEUR", icon: "celoBrand" },
78
- ["CREAL"]: { name: "Celo Real", code: "CREAL", icon: "celoBrand" },
79
- ["BERA"]: { name: "Berachain", code: "BERA", icon: "beraBrand" }
80
- }).reduce((acc, [key, entry]) => {
81
- return __spreadProps(__spreadValues({}, acc), {
82
- [key]: __spreadValues(__spreadValues({}, entry), ICON_TYPES[entry.icon])
83
- });
84
- }, {});
85
- function getNetworkName(str) {
86
- var _a, _b;
87
- return (_b = (_a = NETWORKS[str]) == null ? void 0 : _a.name) != null ? _b : `${str[0]}${str.slice(1).toLowerCase()}`;
88
- }
89
- function getNetworkIcon(str) {
90
- var _a, _b;
91
- return (_b = (_a = NETWORKS[str]) == null ? void 0 : _a.icon) != null ? _b : "globe";
92
- }
93
- function getAssetCode(str) {
94
- var _a, _b;
95
- return (_b = (_a = ON_RAMP_ASSETS[str]) == null ? void 0 : _a.code) != null ? _b : str;
96
- }
97
- function getAssetName(str) {
98
- var _a, _b;
99
- return (_b = (_a = ON_RAMP_ASSETS[str]) == null ? void 0 : _a.name) != null ? _b : str;
100
- }
101
- function getAssetIcon(str) {
102
- var _a, _b;
103
- return (_b = (_a = ON_RAMP_ASSETS[str]) == null ? void 0 : _a.icon) != null ? _b : "emptyCircle";
104
- }
105
- const MOBILE_SIZE = 480;
106
- const NETWORK_NOT_SUPPORTED_ERROR = "network not supported";
107
- const EMAIL_REGEX = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|.(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
108
- const BODY_MOTION_VARIANTS = {
109
- enter: (direction) => {
110
- return {
111
- scale: direction > 0 ? 0.9 : 1.1,
112
- opacity: 0
113
- };
114
- },
115
- center: {
116
- scale: 1,
117
- opacity: 1
118
- },
119
- exit: (direction) => {
120
- return {
121
- scale: direction < 0 ? 0.9 : 1.1,
122
- opacity: 0
123
- };
124
- }
125
- };
126
- const BODY_TRANSITION = {
127
- duration: 0.2
128
- };
129
- const SDK_VERSION = "2.0.0-alpha.63";
130
- export {
131
- BODY_MOTION_VARIANTS,
132
- BODY_TRANSITION,
133
- EMAIL_REGEX,
134
- MOBILE_SIZE,
135
- NETWORKS,
136
- NETWORK_NOT_SUPPORTED_ERROR,
137
- ON_RAMP_ASSETS,
138
- ON_RAMP_PROVIDERS,
139
- PARA_CONNECT,
140
- PARA_TERMS_AND_CONDITIONS,
141
- SDK_VERSION,
142
- WALLET_TYPES_METADATA,
143
- getAssetCode,
144
- getAssetIcon,
145
- getAssetName,
146
- getNetworkIcon,
147
- getNetworkName
148
- };