@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
@@ -3,15 +3,20 @@ import "../../../chunk-MMUBH76A.js";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
4
  import { CpslSpinner, CpslText } from "@getpara/react-components";
5
5
  import { Heading, SpinnerContainer, StepContainer, InnerStepContainer } from "../common.js";
6
+ import { safeStyled } from "@getpara/react-common";
6
7
  const Waiting = ({ heading, subheading }) => {
7
- return /* @__PURE__ */ jsxs(StepContainer, { $wide: true, children: [
8
+ return /* @__PURE__ */ jsxs(Container, { $wide: true, children: [
8
9
  /* @__PURE__ */ jsx(SpinnerContainer, { children: /* @__PURE__ */ jsx(CpslSpinner, { size: 100 }) }),
9
- /* @__PURE__ */ jsxs(InnerStepContainer, { children: [
10
+ heading && /* @__PURE__ */ jsxs(InnerStepContainer, { children: [
10
11
  /* @__PURE__ */ jsx(Heading, { children: heading }),
11
12
  subheading && /* @__PURE__ */ jsx(CpslText, { variant: "bodyS", color: "secondary", weight: "medium", children: subheading })
12
13
  ] })
13
14
  ] });
14
15
  };
16
+ const Container = safeStyled(StepContainer)`
17
+ flex: 1;
18
+ justify-content: space-between;
19
+ `;
15
20
  export {
16
21
  Waiting
17
22
  };
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import "../../../chunk-MMUBH76A.js";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
- import { safeStyled } from "@getpara/react-common";
4
+ import { safeStyled, WalletTypeIcon } from "@getpara/react-common";
5
5
  import { useModalStore } from "../../stores/index.js";
6
6
  import { CpslButton, CpslIcon, CpslText } from "@getpara/react-components";
7
7
  import { truncateAddress } from "@getpara/web-sdk";
@@ -9,7 +9,6 @@ import { ModalStep } from "../../utils/steps.js";
9
9
  import { useWalletState } from "../../../provider/index.js";
10
10
  import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
11
11
  import { useStore } from "../../../provider/stores/useStore.js";
12
- import { WalletTypeIcon } from "../common.js";
13
12
  const ExternalWalletCard = ({
14
13
  address,
15
14
  showAddFunds
@@ -4,10 +4,9 @@ import { jsx, jsxs } from "react/jsx-runtime";
4
4
  import { useEffect, useRef } from "react";
5
5
  import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
6
6
  import { useDropdownPosition } from "../AuthInput/hooks/useDropdownPosition.js";
7
- import { safeStyled, useCopyToClipboard } from "@getpara/react-common";
7
+ import { safeStyled, useCopyToClipboard, WalletTypeIcon as WalletTypeIconBase } from "@getpara/react-common";
8
8
  import { useAccount, useWallet, useWalletState } from "../../../provider/index.js";
9
9
  import { CpslButton, CpslIcon, CpslSelect, CpslSelectItem, CpslText } from "@getpara/react-components";
10
- import * as common from "../common.js";
11
10
  const getValue = (id, type) => {
12
11
  return id && type ? `${id}~${type}` : void 0;
13
12
  };
@@ -139,7 +138,7 @@ const SelectContainer = safeStyled.div`
139
138
  border-radius: var(--cpsl-border-radius-tile-button);
140
139
  background-color: var(--cpsl-color-background-4);
141
140
  `;
142
- const WalletTypeIcon = safeStyled(common.WalletTypeIcon)`
141
+ const WalletTypeIcon = safeStyled(WalletTypeIconBase)`
143
142
  --border: 1px solid var(--cpsl-color-background-8);
144
143
  --background: var(--cpsl-color-background-0);
145
144
  --border-radius: 4px;
@@ -1,6 +1,5 @@
1
- import { CpslIcon, CpslInput, CpslText, CpslTileButton } from '@getpara/react-components';
2
- import { CommonWallet } from '@getpara/react-common';
3
- import { TExternalWallet, TLinkedAccountType, TNetwork, TOnRampAsset, TWalletType } from '@getpara/web-sdk';
1
+ import { CpslInput, CpslText, CpslTileButton } from '@getpara/react-components';
2
+ import { TLinkedAccountType, TNetwork, TOnRampAsset } from '@getpara/web-sdk';
4
3
  import { ComponentProps, PropsWithChildren } from 'react';
5
4
  export declare const SpinnerContainer: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
6
5
  export declare const QRContainer: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
@@ -38,11 +37,6 @@ export declare function NetworkIcon({ network, size }: {
38
37
  network?: TNetwork;
39
38
  size?: string;
40
39
  }): import("react/jsx-runtime").JSX.Element;
41
- export declare function WalletTypeIcon({ className, walletType, externalWallet, ...props }: {
42
- className?: string;
43
- walletType: TWalletType;
44
- externalWallet?: TExternalWallet | CommonWallet | string;
45
- } & Parameters<typeof CpslIcon>[0]): import("react/jsx-runtime").JSX.Element;
46
40
  export declare const ErrorContainer: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
47
41
  export declare const ErrorIcon: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<any, "ref"> & import("react").RefAttributes<any>, "ref"> & {
48
42
  ref?: ((instance: any) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<any> | null | undefined;
@@ -6,8 +6,7 @@ import {
6
6
  } from "../../chunk-MMUBH76A.js";
7
7
  import { jsx } from "react/jsx-runtime";
8
8
  import { CpslIcon, CpslInput, CpslSelect, CpslSelectItem, CpslText, CpslTileButton } from "@getpara/react-components";
9
- import { ACCOUNT_TYPES, safeStyled } from "@getpara/react-common";
10
- import { MOBILE_SIZE, NETWORKS, ON_RAMP_ASSETS, WALLET_TYPES_METADATA } from "../constants/constants.js";
9
+ import { ACCOUNT_TYPES, safeStyled, MOBILE_SIZE, NETWORKS, ON_RAMP_ASSETS } from "@getpara/react-common";
11
10
  import { useStore } from "../../provider/stores/useStore.js";
12
11
  import { useEffect, useRef, useState } from "react";
13
12
  const SpinnerContainer = safeStyled.div`
@@ -167,40 +166,6 @@ function NetworkIcon({ network, size }) {
167
166
  }
168
167
  );
169
168
  }
170
- function WalletTypeIcon(_c) {
171
- var _d = _c, {
172
- className,
173
- walletType,
174
- externalWallet
175
- } = _d, props = __objRest(_d, [
176
- "className",
177
- "walletType",
178
- "externalWallet"
179
- ]);
180
- var _a, _b;
181
- const isDark = useStore((state) => {
182
- var _a2, _b2;
183
- return ((_b2 = (_a2 = state.modalConfig) == null ? void 0 : _a2.theme) == null ? void 0 : _b2.mode) === "dark";
184
- });
185
- if (typeof externalWallet === "object" && "iconUrl" in externalWallet) {
186
- return /* @__PURE__ */ jsx(CpslIcon, __spreadProps(__spreadValues({ className, src: externalWallet.iconUrl }, props), { inset: (_a = props.inset) != null ? _a : "10%" }));
187
- }
188
- const data = (externalWallet ? ACCOUNT_TYPES[externalWallet] : WALLET_TYPES_METADATA[walletType]) || {
189
- icon: "wallet02",
190
- isDark: true
191
- };
192
- props.size;
193
- return /* @__PURE__ */ jsx(
194
- CpslIcon,
195
- __spreadProps(__spreadValues({
196
- className,
197
- icon: data.icon,
198
- invert: isDark && data.isDark
199
- }, props), {
200
- inset: (_b = props.inset) != null ? _b : "10%"
201
- })
202
- );
203
- }
204
169
  const ErrorContainer = safeStyled.div`
205
170
  display: flex;
206
171
  align-items: center;
@@ -326,6 +291,5 @@ export {
326
291
  QRContainer,
327
292
  SpinnerContainer,
328
293
  StepContainer,
329
- StyledCpslTileButton,
330
- WalletTypeIcon
294
+ StyledCpslTileButton
331
295
  };
@@ -3,6 +3,6 @@ export type { ParaModalProps, ParaModalHandle, ParaModalTheme } from './types/mo
3
3
  export { ModalStep, type ModalStepProp } from './utils/steps.js';
4
4
  export { AuthLayout } from './types/modalProps.js';
5
5
  export * from './utils/openPopup.js';
6
- export { ON_RAMP_PROVIDERS, ON_RAMP_ASSETS, NETWORKS, getAssetIcon, getAssetCode, getNetworkIcon, getNetworkName, } from './constants/constants.js';
6
+ export { ON_RAMP_PROVIDERS, ON_RAMP_ASSETS, NETWORKS, getAssetIcon, getAssetCode, getNetworkIcon, getNetworkName, } from '@getpara/react-common';
7
7
  export { SaveRecoverySecret } from './components/RecoverySecretStep/RecoverySecretStep.js';
8
8
  export * from './utils/validateOnRampConfig.js';
@@ -12,7 +12,7 @@ import {
12
12
  getAssetCode,
13
13
  getNetworkIcon,
14
14
  getNetworkName
15
- } from "./constants/constants.js";
15
+ } from "@getpara/react-common";
16
16
  import { SaveRecoverySecret } from "./components/RecoverySecretStep/RecoverySecretStep.js";
17
17
  export * from "./utils/validateOnRampConfig.js";
18
18
  export {
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import "../../chunk-MMUBH76A.js";
3
- import { EMAIL_REGEX } from "../constants/constants.js";
3
+ import { EMAIL_REGEX } from "@getpara/react-common";
4
4
  import { formatPhoneNumber } from "@getpara/web-sdk";
5
5
  function isCcMatch(countryCode, option) {
6
6
  return countryCode === "+1" ? option.selectedLabel === "US" : option.value === countryCode;
@@ -3,22 +3,61 @@ import "../../chunk-MMUBH76A.js";
3
3
  import { getCountries, getCountryCallingCode } from "libphonenumber-js";
4
4
  const excludedCountries = [
5
5
  "AC",
6
+ "AF",
7
+ "AO",
8
+ "AZ",
9
+ "BD",
10
+ "BO",
6
11
  "CG",
7
12
  "CI",
8
13
  "CV",
14
+ "DZ",
15
+ "ER",
16
+ "ET",
17
+ "GE",
9
18
  "GF",
19
+ "GG",
20
+ "GH",
10
21
  "GP",
22
+ "ID",
23
+ "IQ",
24
+ "JE",
25
+ "JO",
26
+ "KG",
27
+ "KH",
28
+ "KZ",
29
+ "LA",
30
+ "LK",
31
+ "LS",
32
+ "LY",
33
+ "MA",
11
34
  "MF",
35
+ "MG",
36
+ "MM",
12
37
  "NC",
38
+ "NG",
39
+ "NP",
40
+ "OM",
41
+ "PK",
13
42
  "PM",
43
+ "PS",
14
44
  "RE",
45
+ "RU",
46
+ "RW",
15
47
  "SD",
16
48
  "SH",
17
49
  "SJ",
18
50
  "TA",
51
+ "TJ",
52
+ "TM",
53
+ "TN",
54
+ "UG",
55
+ "UZ",
19
56
  "VA",
57
+ "VN",
20
58
  "WF",
21
59
  "XK",
60
+ "YE",
22
61
  "YT"
23
62
  ];
24
63
  const generateCountryCodes = () => {
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import "../../chunk-MMUBH76A.js";
3
- import { WALLET_TYPES_METADATA } from "../constants/constants.js";
3
+ import { WALLET_TYPES_METADATA } from "@getpara/react-common";
4
4
  function getWalletDisplayName(para, {
5
5
  type,
6
6
  isExternal,
@@ -1,6 +1,6 @@
1
1
  export declare function openPopup({ url, target, type, current, }: {
2
2
  url: string;
3
3
  target: string;
4
- type: 'OAUTH' | 'LOGIN_PASSKEY' | 'CREATE_PASSKEY' | 'TRANSACTION_REVIEW' | 'CREATE_PASSWORD' | 'LOGIN_PASSWORD';
4
+ type: 'OAUTH' | 'LOGIN_PASSKEY' | 'CREATE_PASSKEY' | 'TRANSACTION_REVIEW' | 'CREATE_PASSWORD' | 'LOGIN_PASSWORD' | 'SWITCH_WALLETS' | 'ADD_CREDENTIAL';
5
5
  current?: Window | null;
6
6
  }): Window | null;
@@ -17,7 +17,8 @@ function openPopup({
17
17
  popUpHeight = 798;
18
18
  break;
19
19
  }
20
- case "LOGIN_PASSKEY": {
20
+ case "LOGIN_PASSKEY":
21
+ case "SWITCH_WALLETS": {
21
22
  popUpHeight = 798;
22
23
  break;
23
24
  }
@@ -34,6 +35,7 @@ function openPopup({
34
35
  break;
35
36
  }
36
37
  case "OAUTH":
38
+ case "ADD_CREDENTIAL":
37
39
  default: {
38
40
  popUpHeight = 768;
39
41
  break;
@@ -40,6 +40,8 @@ export declare enum ModalStep {
40
40
  ACCOUNT_PROFILE_LIST = "ACCOUNT_PROFILE_LIST",
41
41
  ACCOUNT_PROFILE_REMOVE = "ACCOUNT_PROFILE_REMOVE",
42
42
  AWAITING_ACCOUNT = "AWAITING_ACCOUNT",
43
+ SWITCH_WALLETS = "SWITCH_WALLETS",
44
+ SWITCH_WALLETS_IFRAME = "SWITCH_WALLETS_IFRAME",
43
45
  OTP = "OTP",
44
46
  ADD_EX_WALLET_MORE = "ADD_EX_WALLET_MORE",
45
47
  ADD_EX_WALLET_SELECTED = "ADD_EX_WALLET_SELECTED",
@@ -63,10 +65,13 @@ declare enum AccountStep {
63
65
  ACCOUNT_PROFILE_ADD = "ACCOUNT_PROFILE_ADD",
64
66
  ACCOUNT_PROFILE_LIST = "ACCOUNT_PROFILE_LIST",
65
67
  ACCOUNT_PROFILE_REMOVE = "ACCOUNT_PROFILE_REMOVE",
68
+ SWITCH_WALLETS = "SWITCH_WALLETS",
69
+ SWITCH_WALLETS_IFRAME = "SWITCH_WALLETS_IFRAME",
66
70
  EXTERNAL_WALLET_VERIFICATION = "EXTERNAL_WALLET_VERIFICATION",
67
71
  ADD_EX_WALLET_MORE = "ADD_EX_WALLET_MORE",
68
72
  ADD_EX_WALLET_SELECTED = "ADD_EX_WALLET_SELECTED",
69
- ADD_EX_WALLET_NETWORK_SELECT = "ADD_EX_WALLET_NETWORK_SELECT"
73
+ ADD_EX_WALLET_NETWORK_SELECT = "ADD_EX_WALLET_NETWORK_SELECT",
74
+ LINK_EX_WALLET_NETWORK_SELECT = "LINK_EX_WALLET_NETWORK_SELECT"
70
75
  }
71
76
  export declare const RESET_TO_AUTH_STEPS: ModalStep[];
72
77
  export declare const RESET_TO_ACCOUNT_STEPS: ModalStep[];
@@ -41,6 +41,8 @@ var ModalStep = /* @__PURE__ */ ((ModalStep2) => {
41
41
  ModalStep2["ACCOUNT_PROFILE_LIST"] = "ACCOUNT_PROFILE_LIST";
42
42
  ModalStep2["ACCOUNT_PROFILE_REMOVE"] = "ACCOUNT_PROFILE_REMOVE";
43
43
  ModalStep2["AWAITING_ACCOUNT"] = "AWAITING_ACCOUNT";
44
+ ModalStep2["SWITCH_WALLETS"] = "SWITCH_WALLETS";
45
+ ModalStep2["SWITCH_WALLETS_IFRAME"] = "SWITCH_WALLETS_IFRAME";
44
46
  ModalStep2["OTP"] = "OTP";
45
47
  ModalStep2["ADD_EX_WALLET_MORE"] = "ADD_EX_WALLET_MORE";
46
48
  ModalStep2["ADD_EX_WALLET_SELECTED"] = "ADD_EX_WALLET_SELECTED";
@@ -62,10 +64,13 @@ var AccountStep = /* @__PURE__ */ ((AccountStep2) => {
62
64
  AccountStep2["ACCOUNT_PROFILE_ADD"] = "ACCOUNT_PROFILE_ADD";
63
65
  AccountStep2["ACCOUNT_PROFILE_LIST"] = "ACCOUNT_PROFILE_LIST";
64
66
  AccountStep2["ACCOUNT_PROFILE_REMOVE"] = "ACCOUNT_PROFILE_REMOVE";
67
+ AccountStep2["SWITCH_WALLETS"] = "SWITCH_WALLETS";
68
+ AccountStep2["SWITCH_WALLETS_IFRAME"] = "SWITCH_WALLETS_IFRAME";
65
69
  AccountStep2["EXTERNAL_WALLET_VERIFICATION"] = "EXTERNAL_WALLET_VERIFICATION";
66
70
  AccountStep2["ADD_EX_WALLET_MORE"] = "ADD_EX_WALLET_MORE";
67
71
  AccountStep2["ADD_EX_WALLET_SELECTED"] = "ADD_EX_WALLET_SELECTED";
68
72
  AccountStep2["ADD_EX_WALLET_NETWORK_SELECT"] = "ADD_EX_WALLET_NETWORK_SELECT";
73
+ AccountStep2["LINK_EX_WALLET_NETWORK_SELECT"] = "LINK_EX_WALLET_NETWORK_SELECT";
69
74
  return AccountStep2;
70
75
  })(AccountStep || {});
71
76
  const RESET_TO_AUTH_STEPS = [
@@ -106,6 +111,8 @@ const RESET_TO_ACCOUNT_STEPS = [
106
111
  "ACCOUNT_PROFILE_ADD" /* ACCOUNT_PROFILE_ADD */,
107
112
  "ACCOUNT_PROFILE_LIST" /* ACCOUNT_PROFILE_LIST */,
108
113
  "ACCOUNT_PROFILE_REMOVE" /* ACCOUNT_PROFILE_REMOVE */,
114
+ "SWITCH_WALLETS" /* SWITCH_WALLETS */,
115
+ "SWITCH_WALLETS_IFRAME" /* SWITCH_WALLETS_IFRAME */,
109
116
  "ADD_EX_WALLET_MORE" /* ADD_EX_WALLET_MORE */,
110
117
  "ADD_EX_WALLET_SELECTED" /* ADD_EX_WALLET_SELECTED */,
111
118
  "ADD_EX_WALLET_NETWORK_SELECT" /* ADD_EX_WALLET_NETWORK_SELECT */,
@@ -126,10 +133,13 @@ const AccountPreviousStep = {
126
133
  ["ACCOUNT_PROFILE_LIST" /* ACCOUNT_PROFILE_LIST */]: "ACCOUNT_PROFILE" /* ACCOUNT_PROFILE */,
127
134
  ["ACCOUNT_PROFILE_ADD" /* ACCOUNT_PROFILE_ADD */]: "ACCOUNT_PROFILE_LIST" /* ACCOUNT_PROFILE_LIST */,
128
135
  ["ACCOUNT_PROFILE_REMOVE" /* ACCOUNT_PROFILE_REMOVE */]: "ACCOUNT_PROFILE" /* ACCOUNT_PROFILE */,
136
+ ["SWITCH_WALLETS" /* SWITCH_WALLETS */]: "ACCOUNT_PROFILE" /* ACCOUNT_PROFILE */,
137
+ ["SWITCH_WALLETS_IFRAME" /* SWITCH_WALLETS_IFRAME */]: "ACCOUNT_PROFILE" /* ACCOUNT_PROFILE */,
129
138
  ["EXTERNAL_WALLET_VERIFICATION" /* EXTERNAL_WALLET_VERIFICATION */]: "EX_WALLET_SELECTED" /* EX_WALLET_SELECTED */,
130
139
  ["ADD_EX_WALLET_MORE" /* ADD_EX_WALLET_MORE */]: "ACCOUNT_PROFILE" /* ACCOUNT_PROFILE */,
131
140
  ["ADD_EX_WALLET_SELECTED" /* ADD_EX_WALLET_SELECTED */]: "ADD_EX_WALLET_MORE" /* ADD_EX_WALLET_MORE */,
132
- ["ADD_EX_WALLET_NETWORK_SELECT" /* ADD_EX_WALLET_NETWORK_SELECT */]: "ADD_EX_WALLET_MORE" /* ADD_EX_WALLET_MORE */
141
+ ["ADD_EX_WALLET_NETWORK_SELECT" /* ADD_EX_WALLET_NETWORK_SELECT */]: "ADD_EX_WALLET_MORE" /* ADD_EX_WALLET_MORE */,
142
+ ["LINK_EX_WALLET_NETWORK_SELECT" /* LINK_EX_WALLET_NETWORK_SELECT */]: "ACCOUNT_PROFILE_LIST" /* ACCOUNT_PROFILE_LIST */
133
143
  };
134
144
  var SignUpModalStep = /* @__PURE__ */ ((SignUpModalStep2) => {
135
145
  SignUpModalStep2["AUTH_MAIN"] = "AUTH_MAIN";
@@ -285,7 +295,12 @@ function getAddFundsStep(currentTab) {
285
295
  return "ADD_FUNDS_WITHDRAW" /* ADD_FUNDS_WITHDRAW */;
286
296
  }
287
297
  }
288
- const IFrameSteps = ["PASSWORD_CREATION" /* PASSWORD_CREATION */, "EMBEDDED_PASSWORD_LOGIN" /* EMBEDDED_PASSWORD_LOGIN */, "OTP" /* OTP */];
298
+ const IFrameSteps = [
299
+ "PASSWORD_CREATION" /* PASSWORD_CREATION */,
300
+ "EMBEDDED_PASSWORD_LOGIN" /* EMBEDDED_PASSWORD_LOGIN */,
301
+ "OTP" /* OTP */,
302
+ "SWITCH_WALLETS_IFRAME" /* SWITCH_WALLETS_IFRAME */
303
+ ];
289
304
  export {
290
305
  AccountPreviousStep,
291
306
  GuestPreviousStep,
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import "../../chunk-MMUBH76A.js";
3
- import { getNetworkName } from "../constants/constants.js";
3
+ import { getNetworkName } from "@getpara/react-common";
4
4
  import { format } from "date-fns";
5
5
  const formatNetworkList = (networks) => {
6
6
  return networks.length === 1 ? getNetworkName(networks[0]) : `${networks.map((id) => getNetworkName(id)).slice(0, -1).join(", ")}${networks.length > 2 ? "," : ""} and ${getNetworkName(networks[networks.length - 1])}`;
@@ -109,6 +109,11 @@ const ParaProviderMin = forwardRef(({ children, paraClientConfig, callbacks, con
109
109
  }
110
110
  setClient(newClient);
111
111
  }, [paraClientConfig]);
112
+ useEffect(() => {
113
+ if (client) {
114
+ client.portalTheme = paraModalConfig == null ? void 0 : paraModalConfig.theme;
115
+ }
116
+ }, [paraModalConfig == null ? void 0 : paraModalConfig.theme, client]);
112
117
  useEffect(() => {
113
118
  if (client && !client.isReady) {
114
119
  client.ready().then(() => {
@@ -1,4 +1,4 @@
1
- import ParaWeb, { PrimaryAuthInfo } from '@getpara/web-sdk';
1
+ import ParaWeb, { AuthMethod, PrimaryAuthInfo } from '@getpara/web-sdk';
2
2
  type AccountValue = PrimaryAuthInfo & {
3
3
  email?: string;
4
4
  phone?: `+${number}`;
@@ -7,6 +7,7 @@ type AccountValue = PrimaryAuthInfo & {
7
7
  externalWalletAddress?: string;
8
8
  wallets: (typeof ParaWeb.prototype)['availableWallets'];
9
9
  userId?: string;
10
+ authMethods?: Set<AuthMethod>;
10
11
  };
11
12
  export type Account = ({
12
13
  isConnected: false;
@@ -22,5 +23,5 @@ export type Account = ({
22
23
  isConnected: true;
23
24
  isGuestMode: false;
24
25
  } & AccountValue);
25
- export declare const getEmbeddedAccount: (para: ParaWeb | undefined, isFullyLoggedIn: boolean | undefined) => Account;
26
+ export declare const getEmbeddedAccount: (para: ParaWeb | undefined, isFullyLoggedIn: boolean | undefined) => Promise<Account>;
26
27
  export {};
@@ -1,6 +1,8 @@
1
1
  "use client";
2
- import "../../chunk-MMUBH76A.js";
3
- const getEmbeddedAccount = (para, isFullyLoggedIn) => {
2
+ import {
3
+ __async
4
+ } from "../../chunk-MMUBH76A.js";
5
+ const getEmbeddedAccount = (para, isFullyLoggedIn) => __async(void 0, null, function* () {
4
6
  switch (true) {
5
7
  case !para:
6
8
  case !(para == null ? void 0 : para.isReady):
@@ -20,6 +22,12 @@ const getEmbeddedAccount = (para, isFullyLoggedIn) => {
20
22
  };
21
23
  }
22
24
  const authInfo = para.authInfo;
25
+ let authMethods;
26
+ try {
27
+ authMethods = yield para.supportedUserAuthMethods();
28
+ } catch (error) {
29
+ authMethods = /* @__PURE__ */ new Set();
30
+ }
23
31
  const value = {
24
32
  auth: authInfo == null ? void 0 : authInfo.auth,
25
33
  authType: authInfo == null ? void 0 : authInfo.authType,
@@ -27,7 +35,8 @@ const getEmbeddedAccount = (para, isFullyLoggedIn) => {
27
35
  userId: para.userId,
28
36
  wallets: para.availableWallets,
29
37
  isConnected: true,
30
- isGuestMode: false
38
+ isGuestMode: false,
39
+ authMethods
31
40
  };
32
41
  if (authInfo) {
33
42
  switch (authInfo.authType) {
@@ -51,7 +60,7 @@ const getEmbeddedAccount = (para, isFullyLoggedIn) => {
51
60
  }
52
61
  }
53
62
  return value;
54
- };
63
+ });
55
64
  export {
56
65
  getEmbeddedAccount
57
66
  };
@@ -28,6 +28,7 @@ export declare const getWalletBalance: import("./utils.js").CoreAction<"getWalle
28
28
  export declare const issueJwt: import("./utils.js").CoreAction<"issueJwt">;
29
29
  export declare const getLinkedAccounts: import("./utils.js").CoreAction<"getLinkedAccounts">;
30
30
  export declare const accountLinkInProgress: import("./utils.js").CoreAction<"accountLinkInProgress">;
31
+ export declare const addCredential: import("./utils.js").CoreAction<"addCredential">;
31
32
  export declare const linkAccount: (_?: import("@getpara/core-sdk").default, __?: {
32
33
  auth: import("@getpara/shared").VerifiedAuth;
33
34
  } | {
@@ -45,3 +46,4 @@ export declare const verifyFarcasterLink: (_?: import("@getpara/core-sdk").defau
45
46
  export declare const verifyTelegramLink: (_?: import("@getpara/core-sdk").default, __?: import("@getpara/core-sdk/dist/types/types/methods.js").TelegramParams | undefined) => Promise<import("@getpara/shared").LinkedAccounts>;
46
47
  export declare const verifyOAuthLink: (_?: import("@getpara/core-sdk").default, __?: import("@getpara/core-sdk/dist/types/types/methods.js").OAuthParams | undefined) => Promise<import("@getpara/shared").LinkedAccounts>;
47
48
  export declare const verifyExternalWalletLink: (_?: import("@getpara/core-sdk").default, __?: Omit<import("@getpara/shared").VerifyExternalWalletParams, "externalWallet"> | undefined) => Promise<import("@getpara/shared").LinkedAccounts>;
49
+ export declare const exportPrivateKey: import("./utils.js").CoreAction<"exportPrivateKey">;
@@ -31,6 +31,7 @@ const getWalletBalance = generateCoreAction("getWalletBalance");
31
31
  const issueJwt = generateCoreAction("issueJwt");
32
32
  const getLinkedAccounts = generateCoreAction("getLinkedAccounts");
33
33
  const accountLinkInProgress = generateCoreAction("accountLinkInProgress");
34
+ const addCredential = generateCoreAction("addCredential");
34
35
  const linkAccount = generateInternalAction("linkAccount");
35
36
  const unlinkAccount = generateInternalAction("unlinkAccount");
36
37
  const verifyEmailOrPhoneLink = generateInternalAction("verifyEmailOrPhoneLink");
@@ -38,8 +39,10 @@ const verifyFarcasterLink = generateInternalAction("verifyFarcasterLink");
38
39
  const verifyTelegramLink = generateInternalAction("verifyTelegramLink");
39
40
  const verifyOAuthLink = generateInternalAction("verifyOAuthLink");
40
41
  const verifyExternalWalletLink = generateInternalAction("verifyExternalWalletLink");
42
+ const exportPrivateKey = generateCoreAction("exportPrivateKey");
41
43
  export {
42
44
  accountLinkInProgress,
45
+ addCredential,
43
46
  claimPregenWallets,
44
47
  createGuestWallets,
45
48
  createPregenWallet,
@@ -47,6 +50,7 @@ export {
47
50
  createWallet,
48
51
  createWalletPerType,
49
52
  enable2fa,
53
+ exportPrivateKey,
50
54
  getLinkedAccounts,
51
55
  getWalletBalance,
52
56
  hasPregenWallet,
@@ -26,4 +26,6 @@ export { useCreateGuestWallets } from './useCreateGuestWallets.js';
26
26
  export { useSignMessage } from './useSignMessage.js';
27
27
  export { useSignTransaction } from './useSignTransaction.js';
28
28
  export { useIssueJwt } from './useIssueJwt.js';
29
+ export { useAddAuthMethod } from './useAddAuthMethod.js';
30
+ export { useExportPrivateKey } from './useExportPrivateKey.js';
29
31
  export declare const useCreateGuestWalletsState: import("../../types/utils.js").CoreMethodMutationStateHook<"createGuestWallets">;
@@ -29,8 +29,11 @@ import { useCreateGuestWallets } from "./useCreateGuestWallets.js";
29
29
  import { useSignMessage } from "./useSignMessage.js";
30
30
  import { useSignTransaction } from "./useSignTransaction.js";
31
31
  import { useIssueJwt } from "./useIssueJwt.js";
32
+ import { useAddAuthMethod } from "./useAddAuthMethod.js";
33
+ import { useExportPrivateKey } from "./useExportPrivateKey.js";
32
34
  const useCreateGuestWalletsState = generateStateHook("createGuestWallets");
33
35
  export {
36
+ useAddAuthMethod,
34
37
  useClaimPregenWallets,
35
38
  useCreateGuestWallets,
36
39
  useCreateGuestWalletsState,
@@ -39,6 +42,7 @@ export {
39
42
  useCreateWallet,
40
43
  useCreateWalletPerType,
41
44
  useEnable2fa,
45
+ useExportPrivateKey,
42
46
  useHasPregenWallet,
43
47
  useIssueJwt,
44
48
  useKeepSessionAlive,
@@ -0,0 +1,42 @@
1
+ export declare const ADD_CREDENTIAL_KEY = "ADD_CREDENTIAL";
2
+ /**
3
+ * React hook to add a new auth method to a user's account. Useful for move a user's account away from basic login.
4
+ *
5
+ * Returns a mutation result object with all standard fields from `useMutation`, except:
6
+ * - `mutate` and `mutateAsync` are replaced by:
7
+ * - `addAuthMethod`: function to trigger the mutation (same as `mutate`)
8
+ * - `addAuthMethodAsync`: async function to trigger the mutation (same as `mutateAsync`)
9
+ *
10
+ * @example
11
+ * const { addAuthMethod, addAuthMethodAsync } = useAddAuthMethod();
12
+ * // sync and with defined auth method to add
13
+ * addAuthMethod({ authMethod: 'PASSKEY' });
14
+ * // or async and without defined auth method to add (gives the user the option to choose)
15
+ * await addAuthMethodAsync();
16
+ */
17
+ export declare const useAddAuthMethod: ({ openPopup }?: {
18
+ openPopup: boolean;
19
+ }) => {
20
+ status: "error" | "idle" | "pending" | "success";
21
+ data: string | undefined;
22
+ isSuccess: boolean;
23
+ variables: void | {
24
+ authMethod?: Exclude<import("@getpara/web-sdk").TAuthMethod, "BASIC_LOGIN"> | undefined;
25
+ } | undefined;
26
+ error: Error | null;
27
+ isError: boolean;
28
+ isIdle: boolean;
29
+ isPending: boolean;
30
+ reset: () => void;
31
+ context: unknown;
32
+ failureCount: number;
33
+ failureReason: Error | null;
34
+ isPaused: boolean;
35
+ submittedAt: number;
36
+ addAuthMethod: import("@tanstack/react-query").UseMutateFunction<string, Error, void | {
37
+ authMethod?: Exclude<import("@getpara/web-sdk").TAuthMethod, "BASIC_LOGIN"> | undefined;
38
+ }, unknown>;
39
+ addAuthMethodAsync: import("@tanstack/react-query").UseMutateAsyncFunction<string, Error, void | {
40
+ authMethod?: Exclude<import("@getpara/web-sdk").TAuthMethod, "BASIC_LOGIN"> | undefined;
41
+ }, unknown>;
42
+ };
@@ -0,0 +1,59 @@
1
+ "use client";
2
+ import {
3
+ __async
4
+ } from "../../../chunk-MMUBH76A.js";
5
+ import { useMutation, useQueryClient } from "@tanstack/react-query";
6
+ import { useClient } from "../utils/index.js";
7
+ import { getPortalBaseURL } from "@getpara/web-sdk";
8
+ import { renameMutations } from "../../utils/renameMutations.js";
9
+ import { addCredential } from "../../actions/index.js";
10
+ import { openPopup as openPopupFn } from "../../../modal/index.js";
11
+ import { ACCOUNT_BASE_KEY } from "../queries/useAccount.js";
12
+ const ADD_CREDENTIAL_KEY = "ADD_CREDENTIAL";
13
+ const useAddAuthMethod = ({ openPopup } = { openPopup: true }) => {
14
+ const para = useClient();
15
+ const queryClient = useQueryClient();
16
+ const mutation = useMutation({
17
+ mutationKey: [ADD_CREDENTIAL_KEY],
18
+ mutationFn: (..._0) => __async(void 0, [..._0], function* (args = {}) {
19
+ try {
20
+ const result = yield addCredential(para, args);
21
+ if (result && openPopup) {
22
+ openPopupFn({ url: result, target: "ParaAddAuthCredential", type: "ADD_CREDENTIAL" });
23
+ if (typeof window !== "undefined" && para) {
24
+ const handleMessage = (event) => {
25
+ var _a;
26
+ const portalBase = getPortalBaseURL(para.ctx);
27
+ const portalLocalBase = getPortalBaseURL(para.ctx, true);
28
+ if (!event.origin.startsWith(portalBase) && !event.origin.startsWith(portalLocalBase)) {
29
+ return;
30
+ }
31
+ if (((_a = event.data) == null ? void 0 : _a.type) === "CLOSE_WINDOW") {
32
+ if (event.data.success) {
33
+ queryClient.refetchQueries({ queryKey: [ACCOUNT_BASE_KEY] });
34
+ }
35
+ window.removeEventListener("message", handleMessage);
36
+ clearTimeout(timeoutId);
37
+ }
38
+ };
39
+ const timeoutId = setTimeout(
40
+ () => {
41
+ window.removeEventListener("message", handleMessage);
42
+ },
43
+ 1e3 * 60 * 3
44
+ );
45
+ window.addEventListener("message", handleMessage);
46
+ }
47
+ }
48
+ return result;
49
+ } catch (error) {
50
+ throw error;
51
+ }
52
+ })
53
+ });
54
+ return renameMutations(mutation, "addAuthMethod");
55
+ };
56
+ export {
57
+ ADD_CREDENTIAL_KEY,
58
+ useAddAuthMethod
59
+ };
@@ -0,0 +1,15 @@
1
+ export declare const EXPORT_PRIVATE_KEY_KEY = "EXPORT_PRIVATE_KEY";
2
+ /**
3
+ * React hook for the `exportPrivateKey` mutation.
4
+ *
5
+ * @example
6
+ * const { mutateAsync: exportPrivateKeyAsync } = useExportPrivateKey();
7
+ * await exportPrivateKeyAsync({ walletId: '...' });
8
+ */
9
+ export declare const useExportPrivateKey: () => import("@tanstack/react-query").UseMutationResult<{
10
+ popupWindow?: Window;
11
+ url: string;
12
+ }, Error, {
13
+ walletId?: string;
14
+ shouldOpenPopup?: boolean;
15
+ } | undefined, unknown>;