@getpara/react-sdk-lite 2.0.0-alpha.62 → 2.0.0-alpha.64
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/modal/ParaModal.js +3 -2
- package/dist/modal/components/Account/AccountProfile.d.ts +1 -1
- package/dist/modal/components/Account/AccountProfile.js +62 -36
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +5 -2
- package/dist/modal/components/Body/Body.js +4 -0
- package/dist/modal/components/Footer/Footer.js +3 -3
- package/dist/modal/components/IFrameStep/IFrameStep.js +3 -3
- package/dist/modal/components/SwitchWalletsStep/SwitchWalletsStep.d.ts +1 -0
- package/dist/modal/components/SwitchWalletsStep/SwitchWalletsStep.js +10 -0
- package/dist/modal/components/Waiting/Waiting.d.ts +1 -1
- package/dist/modal/components/Waiting/Waiting.js +7 -2
- package/dist/modal/constants/constants.d.ts +1 -1
- package/dist/modal/constants/constants.js +1 -1
- package/dist/modal/utils/countryCodes.js +39 -0
- package/dist/modal/utils/openPopup.d.ts +1 -1
- package/dist/modal/utils/openPopup.js +3 -1
- package/dist/modal/utils/steps.d.ts +6 -1
- package/dist/modal/utils/steps.js +17 -2
- package/dist/provider/actions/getEmbeddedAccount.d.ts +3 -2
- package/dist/provider/actions/getEmbeddedAccount.js +14 -4
- package/dist/provider/actions/index.d.ts +1 -0
- package/dist/provider/actions/index.js +2 -0
- package/dist/provider/hooks/mutations/index.d.ts +1 -0
- package/dist/provider/hooks/mutations/index.js +2 -0
- package/dist/provider/hooks/mutations/useAddAuthMethod.d.ts +42 -0
- package/dist/provider/hooks/mutations/useAddAuthMethod.js +59 -0
- package/dist/provider/hooks/mutations/useSwitchWallets.d.ts +57 -0
- package/dist/provider/hooks/mutations/useSwitchWallets.js +30 -0
- package/dist/provider/hooks/mutations/useVerifyExternalWallet.d.ts +3 -0
- package/dist/provider/hooks/mutations/useVerifyNewAccount.d.ts +3 -3
- package/dist/provider/hooks/queries/useAccount.js +5 -4
- package/dist/provider/providers/AccountLinkProvider.js +2 -3
- package/dist/provider/providers/AuthProvider.d.ts +4 -0
- package/dist/provider/providers/AuthProvider.js +100 -5
- package/package.json +8 -8
package/dist/modal/ParaModal.js
CHANGED
|
@@ -57,6 +57,7 @@ const ParaModal = forwardRef((props, ref) => {
|
|
|
57
57
|
const externalWallets = useStore((state) => state.externalWallets);
|
|
58
58
|
const providerProps = useStore((state) => state.providerProps);
|
|
59
59
|
const setAccountLinkOptions = useModalStore((state) => state.setAccountLinkOptions);
|
|
60
|
+
const selectedExternalWallet = useModalStore((state) => state.selectedExternalWallet);
|
|
60
61
|
const isInitialized = useRef(false);
|
|
61
62
|
const _a = __spreadValues(__spreadValues({}, storedModalConfig), props), {
|
|
62
63
|
isOpen: configIsOpen,
|
|
@@ -223,10 +224,10 @@ const ParaModal = forwardRef((props, ref) => {
|
|
|
223
224
|
updateSelectedWallet();
|
|
224
225
|
}, [para]);
|
|
225
226
|
useEffect(() => {
|
|
226
|
-
if (bareModal && !isAccountLoading && !isConnected && !["signup", "login"].includes(flow != null ? flow : "") && modalRefs.currentStep.current !== ModalStep.AUTH_MAIN) {
|
|
227
|
+
if (bareModal && !selectedExternalWallet && !isAccountLoading && !isConnected && !["signup", "login"].includes(flow != null ? flow : "") && modalRefs.currentStep.current !== ModalStep.AUTH_MAIN) {
|
|
227
228
|
setStep(ModalStep.AUTH_MAIN);
|
|
228
229
|
}
|
|
229
|
-
}, [bareModal, flow, isConnected, isAccountLoading]);
|
|
230
|
+
}, [bareModal, flow, isConnected, isAccountLoading, selectedExternalWallet]);
|
|
230
231
|
useEffect(() => {
|
|
231
232
|
setAccountLinkOptions(propsSupportedAccountLinks != null ? propsSupportedAccountLinks : para == null ? void 0 : para.supportedAccountLinks);
|
|
232
233
|
}, [propsSupportedAccountLinks, para == null ? void 0 : para.supportedAccountLinks]);
|
|
@@ -3,26 +3,27 @@ import {
|
|
|
3
3
|
__spreadProps,
|
|
4
4
|
__spreadValues
|
|
5
5
|
} from "../../../chunk-MMUBH76A.js";
|
|
6
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { AccountTypeIcon, GradientScroll, StepContainer, WalletTypeIcon } from "../common.js";
|
|
8
8
|
import { CpslButton, CpslIcon, CpslText } from "@getpara/react-components";
|
|
9
9
|
import { useAccount } from "../../../provider/index.js";
|
|
10
10
|
import { useLinkedAccounts } from "../../../provider/hooks/index.js";
|
|
11
|
-
import { getWalletDisplayName } from "../../utils/getWalletDisplayName.js";
|
|
12
11
|
import {
|
|
13
12
|
formatAssetQuantity,
|
|
14
13
|
formatCurrency,
|
|
15
14
|
truncateAddress
|
|
16
15
|
} from "@getpara/web-sdk";
|
|
17
16
|
import { useAccountLinking } from "../../../provider/providers/AccountLinkProvider.js";
|
|
18
|
-
import { useMemo } from "react";
|
|
17
|
+
import { useEffect, useMemo } from "react";
|
|
19
18
|
import { ACCOUNT_TYPES, safeStyled, useCopyToClipboard } from "@getpara/react-common";
|
|
20
19
|
import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
|
|
21
20
|
import { useStore } from "../../../provider/stores/useStore.js";
|
|
22
21
|
import { useAssets } from "../../../provider/providers/AssetsProvider.js";
|
|
22
|
+
import { useAuthActions } from "../../../provider/providers/AuthProvider.js";
|
|
23
23
|
import { useModalStore } from "../../stores/index.js";
|
|
24
24
|
import { ModalStep } from "../../utils/steps.js";
|
|
25
25
|
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
26
|
+
import { Waiting } from "../Waiting/Waiting.js";
|
|
26
27
|
const Entry = ({
|
|
27
28
|
identifier,
|
|
28
29
|
icon,
|
|
@@ -79,45 +80,70 @@ const AccountProfile = ({
|
|
|
79
80
|
isDisconnecting,
|
|
80
81
|
onDisconnect
|
|
81
82
|
}) => {
|
|
82
|
-
var _a;
|
|
83
83
|
const para = useInternalClient();
|
|
84
84
|
const { embedded } = useAccount();
|
|
85
85
|
const { data: linkedAccounts } = useLinkedAccounts();
|
|
86
86
|
const { wallets } = useExternalWallets();
|
|
87
|
-
const { isEnabled, linkAccount, unlinkAccount } = useAccountLinking();
|
|
87
|
+
const { isEnabled: isAccountLinkingEnabled, linkAccount, unlinkAccount } = useAccountLinking();
|
|
88
88
|
const hideWallets = useStore((state) => {
|
|
89
|
-
var
|
|
90
|
-
return (
|
|
89
|
+
var _a;
|
|
90
|
+
return (_a = state.modalConfig) == null ? void 0 : _a.hideWallets;
|
|
91
91
|
});
|
|
92
92
|
const { profileBalance } = useAssets();
|
|
93
|
+
const { switchWallets, switchWalletsUrl, setSwitchWalletsUrl, isSwitchWalletsPending } = useAuthActions();
|
|
93
94
|
const setStep = useModalStore((state) => state.setStep);
|
|
94
|
-
|
|
95
|
-
|
|
95
|
+
const partnerGroups = useMemo(() => {
|
|
96
|
+
var _a;
|
|
97
|
+
return (_a = embedded == null ? void 0 : embedded.wallets) == null ? void 0 : _a.reduce((acc, wallet) => {
|
|
98
|
+
if (!wallet.partner || !wallet.partner.id || !wallet.partner.displayName) return acc;
|
|
99
|
+
const partnerGroup = acc.find((group) => {
|
|
100
|
+
var _a2;
|
|
101
|
+
return group.partner.id === ((_a2 = wallet.partner) == null ? void 0 : _a2.id);
|
|
102
|
+
});
|
|
103
|
+
return !!partnerGroup ? acc.map(
|
|
104
|
+
(group) => group.partner.id === wallet.partner.id ? __spreadProps(__spreadValues({}, group), { wallets: [...group.wallets, wallet] }) : group
|
|
105
|
+
) : [...acc, { partner: wallet.partner, wallets: [wallet] }];
|
|
106
|
+
}, []);
|
|
107
|
+
}, [embedded == null ? void 0 : embedded.wallets]);
|
|
108
|
+
useEffect(() => {
|
|
109
|
+
if (para) {
|
|
110
|
+
para.getSwitchWalletsUrl().then((url) => {
|
|
111
|
+
setSwitchWalletsUrl(url);
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}, []);
|
|
115
|
+
if (!para || !switchWalletsUrl) {
|
|
116
|
+
return /* @__PURE__ */ jsx(Waiting, {});
|
|
96
117
|
}
|
|
97
|
-
const embeddedWallets = (_a = para == null ? void 0 : para.availableWallets) == null ? void 0 : _a.filter((wallet) => !wallet.isExternal);
|
|
98
118
|
return /* @__PURE__ */ jsxs(StepContainer, { children: [
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
119
|
+
partnerGroups && partnerGroups.length > 0 && /* @__PURE__ */ jsxs(Section, { children: [
|
|
120
|
+
partnerGroups.map(({ partner, wallets: wallets2 }) => {
|
|
121
|
+
return /* @__PURE__ */ jsxs(Section, { children: [
|
|
122
|
+
/* @__PURE__ */ jsxs(Title, { variant: "bodyS", color: "secondary", children: [
|
|
123
|
+
partner.displayName,
|
|
124
|
+
" Wallets"
|
|
125
|
+
] }),
|
|
126
|
+
/* @__PURE__ */ jsx(Content, { children: wallets2.map((wallet) => /* @__PURE__ */ jsx(
|
|
127
|
+
Entry,
|
|
128
|
+
{
|
|
129
|
+
icon: /* @__PURE__ */ jsx(WalletTypeIcon, { walletType: wallet.type, externalWallet: wallet.externalProviderId, size: "24px" }),
|
|
130
|
+
name: truncateAddress(wallet.address, wallet.type),
|
|
131
|
+
balance: profileBalance == null ? void 0 : profileBalance.wallets.find((w) => w.address === wallet.address)
|
|
132
|
+
},
|
|
133
|
+
`${wallet.address}-${wallet.type}`
|
|
134
|
+
)) })
|
|
135
|
+
] }, partner.id);
|
|
136
|
+
}),
|
|
137
|
+
!embedded.isGuestMode && /* @__PURE__ */ jsx(CpslButton, { fullWidth: true, variant: "tertiary", onClick: switchWallets, disabled: isSwitchWalletsPending, children: isSwitchWalletsPending ? "Please Wait..." : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
138
|
+
/* @__PURE__ */ jsx(CpslIcon, { icon: "shuffle", slot: "start", size: "16px" }),
|
|
139
|
+
para.isMultiWallet ? "Switch Wallets" : "Switch Wallet"
|
|
140
|
+
] }) })
|
|
115
141
|
] }),
|
|
116
|
-
/* @__PURE__ */ jsxs(Section, { children: [
|
|
117
|
-
/* @__PURE__ */ jsx(Title, { variant: "bodyS", color: "secondary", children: "
|
|
142
|
+
!embedded.isGuestMode && /* @__PURE__ */ jsxs(Section, { children: [
|
|
143
|
+
/* @__PURE__ */ jsx(Title, { variant: "bodyS", color: "secondary", children: "Connected Wallets" }),
|
|
118
144
|
/* @__PURE__ */ jsxs(Content, { children: [
|
|
119
145
|
Object.values((para == null ? void 0 : para.externalWallets) || {}).map((wallet) => {
|
|
120
|
-
var
|
|
146
|
+
var _a, _b;
|
|
121
147
|
const externalWallet = wallets.find((w) => w.name === wallet.name);
|
|
122
148
|
return /* @__PURE__ */ jsx(
|
|
123
149
|
Entry,
|
|
@@ -131,7 +157,7 @@ const AccountProfile = ({
|
|
|
131
157
|
inset: "0"
|
|
132
158
|
}
|
|
133
159
|
),
|
|
134
|
-
name: (_b = (
|
|
160
|
+
name: (_b = (_a = wallet.ensName) != null ? _a : wallet.name) != null ? _b : "",
|
|
135
161
|
address: wallet.address,
|
|
136
162
|
addressShort: wallet.address ? truncateAddress(wallet.address, wallet.type, {
|
|
137
163
|
prefix: para.cosmosPrefix
|
|
@@ -157,18 +183,18 @@ const AccountProfile = ({
|
|
|
157
183
|
)
|
|
158
184
|
] })
|
|
159
185
|
] }),
|
|
160
|
-
|
|
186
|
+
isAccountLinkingEnabled && /* @__PURE__ */ jsxs(Section, { children: [
|
|
161
187
|
/* @__PURE__ */ jsx(Title, { variant: "bodyS", color: "secondary", children: "Linked Accounts" }),
|
|
162
188
|
/* @__PURE__ */ jsxs(Content, { children: [
|
|
163
189
|
/* @__PURE__ */ jsx(GradientScroll, { gap: "12px", height: "360px", children: [...((linkedAccounts == null ? void 0 : linkedAccounts.primary) || []).map((p) => __spreadProps(__spreadValues({}, p), { isPrimary: true })), ...(linkedAccounts == null ? void 0 : linkedAccounts.linked) || []].filter(({ externalWallet }) => {
|
|
164
190
|
return !externalWallet || externalWallet.address !== (embedded == null ? void 0 : embedded.externalWalletAddress);
|
|
165
191
|
}).map((linkedAccount) => {
|
|
166
|
-
var
|
|
192
|
+
var _a, _b, _c, _d, _e;
|
|
167
193
|
const { identifier, displayName, type, isPrimary = false, externalWallet } = linkedAccount;
|
|
168
194
|
const externalWalletConnector = wallets.find(
|
|
169
195
|
(wallet) => {
|
|
170
|
-
var
|
|
171
|
-
return wallet.id === (externalWallet == null ? void 0 : externalWallet.providerId) || wallet.id.toLowerCase() === ((
|
|
196
|
+
var _a2, _b2;
|
|
197
|
+
return wallet.id === (externalWallet == null ? void 0 : externalWallet.providerId) || wallet.id.toLowerCase() === ((_a2 = externalWallet == null ? void 0 : externalWallet.providerId) == null ? void 0 : _a2.toLowerCase()) || wallet.name.toLowerCase() === ((_b2 = externalWallet == null ? void 0 : externalWallet.providerId) == null ? void 0 : _b2.toLowerCase());
|
|
172
198
|
}
|
|
173
199
|
);
|
|
174
200
|
let accountType = type;
|
|
@@ -189,7 +215,7 @@ const AccountProfile = ({
|
|
|
189
215
|
Entry,
|
|
190
216
|
{
|
|
191
217
|
icon: /* @__PURE__ */ jsx(AccountTypeIcon, { accountType, src, size: "24px" }),
|
|
192
|
-
name: externalWallet ? (_c = (_b = (
|
|
218
|
+
name: externalWallet ? (_c = (_b = (_a = externalWallet.ensName) != null ? _a : externalWalletConnector == null ? void 0 : externalWalletConnector.name) != null ? _b : externalWallet.provider) != null ? _c : "" : displayName != null ? displayName : identifier,
|
|
193
219
|
address: (_d = externalWallet == null ? void 0 : externalWallet.addressBech32) != null ? _d : externalWallet == null ? void 0 : externalWallet.address,
|
|
194
220
|
addressShort: externalWallet ? truncateAddress((_e = externalWallet.addressBech32) != null ? _e : externalWallet.address, externalWallet.type, {
|
|
195
221
|
prefix: para.cosmosPrefix
|
|
@@ -203,7 +229,7 @@ const AccountProfile = ({
|
|
|
203
229
|
);
|
|
204
230
|
}) }),
|
|
205
231
|
/* @__PURE__ */ jsxs(CpslButton, { fullWidth: true, variant: "tertiary", onClick: () => linkAccount(void 0), children: [
|
|
206
|
-
/* @__PURE__ */ jsx(CpslIcon, { icon: "userPlus", slot: "start" }),
|
|
232
|
+
/* @__PURE__ */ jsx(CpslIcon, { icon: "userPlus", slot: "start", size: "16px" }),
|
|
207
233
|
"Link an account"
|
|
208
234
|
] })
|
|
209
235
|
] })
|
|
@@ -26,7 +26,10 @@ const BiometricLoginStep = () => {
|
|
|
26
26
|
/* @__PURE__ */ jsx(UserIdentifier, { authInfo: para.authInfo })
|
|
27
27
|
] }),
|
|
28
28
|
/* @__PURE__ */ jsxs(MainContainer, { children: [
|
|
29
|
-
(isPassword || isPIN) && /* @__PURE__ */
|
|
29
|
+
(isPassword || isPIN) && /* @__PURE__ */ jsxs(CpslButton, { fullWidth: true, onClick: () => presentLoginUi(isPIN ? AuthMethod.PIN : AuthMethod.PASSWORD, loginState), children: [
|
|
30
|
+
/* @__PURE__ */ jsx(CpslIcon, { slot: "start", icon: "passcode" }),
|
|
31
|
+
isPIN && isPassword ? "Login" : isPIN ? "Login with PIN" : "Login with Password"
|
|
32
|
+
] }),
|
|
30
33
|
isPasskey && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
31
34
|
displayKnownDevices && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
32
35
|
/* @__PURE__ */ jsx(KnownDevices, { hints: biometricHints, link: passkeyKnownDeviceUrl }),
|
|
@@ -34,7 +37,7 @@ const BiometricLoginStep = () => {
|
|
|
34
37
|
] }),
|
|
35
38
|
/* @__PURE__ */ jsx(CpslButton, { fullWidth: true, onClick: () => presentLoginUi(AuthMethod.PASSKEY, loginState), children: isPasskeyUnavailable ? "Continue anyway" : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
36
39
|
/* @__PURE__ */ jsx(CpslIcon, { slot: "start", icon: "key" }),
|
|
37
|
-
"Login with
|
|
40
|
+
"Login with Passkey"
|
|
38
41
|
] }) })
|
|
39
42
|
] })
|
|
40
43
|
] })
|
|
@@ -43,6 +43,7 @@ import { AccountProfileLink } from "../Account/AccountProfileLink.js";
|
|
|
43
43
|
import { AccountProfileUnlink } from "../Account/AccountProfileUnlink.js";
|
|
44
44
|
import { ExternalWalletNetworkSelectStep } from "../ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.js";
|
|
45
45
|
import { AwaitingAccountStep } from "../AwaitingAccountStep/AwaitingAccountStep.js";
|
|
46
|
+
import { SwitchWalletsStep } from "../SwitchWalletsStep/SwitchWalletsStep.js";
|
|
46
47
|
import { Footer } from "../Footer/Footer.js";
|
|
47
48
|
import { renderTextWithLinks } from "../../utils/renderTextWithLinks.js";
|
|
48
49
|
const MIN_HEIGHT = {
|
|
@@ -210,6 +211,9 @@ const Body = ({
|
|
|
210
211
|
case ModalStep.AWAITING_ACCOUNT: {
|
|
211
212
|
return /* @__PURE__ */ jsx(AwaitingAccountStep, {});
|
|
212
213
|
}
|
|
214
|
+
case ModalStep.SWITCH_WALLETS: {
|
|
215
|
+
return /* @__PURE__ */ jsx(SwitchWalletsStep, {});
|
|
216
|
+
}
|
|
213
217
|
default: {
|
|
214
218
|
if (IFrameSteps.includes(currentStep)) {
|
|
215
219
|
return null;
|
|
@@ -6,11 +6,11 @@ import { CpslIcon, CpslText } from "@getpara/react-components";
|
|
|
6
6
|
import { PARA_TERMS_AND_CONDITIONS } from "../../constants/constants.js";
|
|
7
7
|
import { useModalStore } from "../../stores/index.js";
|
|
8
8
|
import { ModalStep } from "../../utils/steps.js";
|
|
9
|
-
import {
|
|
9
|
+
import { useAccountLinking } from "../../../provider/providers/AccountLinkProvider.js";
|
|
10
10
|
const Footer = () => {
|
|
11
|
-
const { isConnected } = useAccount();
|
|
12
11
|
const currentStep = useModalStore((state) => state.step);
|
|
13
|
-
const
|
|
12
|
+
const { accountLinkInProgress } = useAccountLinking();
|
|
13
|
+
const showFooter = !accountLinkInProgress && [
|
|
14
14
|
ModalStep.AUTH_MAIN,
|
|
15
15
|
ModalStep.AUTH_MORE,
|
|
16
16
|
ModalStep.EX_WALLET_NETWORK_SELECT,
|
|
@@ -37,9 +37,9 @@ const IFrameStep = () => {
|
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
if (event.data) {
|
|
40
|
-
if (event.data.type === "HEIGHT") {
|
|
41
|
-
setHeight(event.data.height);
|
|
42
|
-
setIsReady(true);
|
|
40
|
+
if (event.data.type === "HEIGHT" && typeof event.data.height === "number") {
|
|
41
|
+
setHeight(Math.max(event.data.height, 200));
|
|
42
|
+
setIsReady(event.data.height > 0 ? true : false);
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SwitchWalletsStep: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { Waiting } from "../Waiting/Waiting.js";
|
|
5
|
+
const SwitchWalletsStep = () => {
|
|
6
|
+
return /* @__PURE__ */ jsx(Waiting, { heading: "Switching Wallets", subheading: "Please complete the wallet selection in the popup window." });
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
SwitchWalletsStep
|
|
10
|
+
};
|
|
@@ -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(
|
|
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
|
};
|
|
@@ -25,7 +25,7 @@ export declare function getNetworkName(str: TNetwork | string): string;
|
|
|
25
25
|
export declare function getNetworkIcon(str: TNetwork | string): IconType;
|
|
26
26
|
export declare function getAssetCode(str: TOnRampAsset | string): string;
|
|
27
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";
|
|
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" | "shuffle" | "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
29
|
export declare const MOBILE_SIZE = 480;
|
|
30
30
|
export declare const NETWORK_NOT_SUPPORTED_ERROR = "network not supported";
|
|
31
31
|
export declare const EMAIL_REGEX: RegExp;
|
|
@@ -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
|
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 = [
|
|
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,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
|
|
3
|
-
|
|
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,13 @@ 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
|
+
console.error("Error getting supported auth methods:", error);
|
|
30
|
+
authMethods = /* @__PURE__ */ new Set();
|
|
31
|
+
}
|
|
23
32
|
const value = {
|
|
24
33
|
auth: authInfo == null ? void 0 : authInfo.auth,
|
|
25
34
|
authType: authInfo == null ? void 0 : authInfo.authType,
|
|
@@ -27,7 +36,8 @@ const getEmbeddedAccount = (para, isFullyLoggedIn) => {
|
|
|
27
36
|
userId: para.userId,
|
|
28
37
|
wallets: para.availableWallets,
|
|
29
38
|
isConnected: true,
|
|
30
|
-
isGuestMode: false
|
|
39
|
+
isGuestMode: false,
|
|
40
|
+
authMethods
|
|
31
41
|
};
|
|
32
42
|
if (authInfo) {
|
|
33
43
|
switch (authInfo.authType) {
|
|
@@ -51,7 +61,7 @@ const getEmbeddedAccount = (para, isFullyLoggedIn) => {
|
|
|
51
61
|
}
|
|
52
62
|
}
|
|
53
63
|
return value;
|
|
54
|
-
};
|
|
64
|
+
});
|
|
55
65
|
export {
|
|
56
66
|
getEmbeddedAccount
|
|
57
67
|
};
|
|
@@ -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
|
} | {
|
|
@@ -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");
|
|
@@ -40,6 +41,7 @@ const verifyOAuthLink = generateInternalAction("verifyOAuthLink");
|
|
|
40
41
|
const verifyExternalWalletLink = generateInternalAction("verifyExternalWalletLink");
|
|
41
42
|
export {
|
|
42
43
|
accountLinkInProgress,
|
|
44
|
+
addCredential,
|
|
43
45
|
claimPregenWallets,
|
|
44
46
|
createGuestWallets,
|
|
45
47
|
createPregenWallet,
|
|
@@ -26,4 +26,5 @@ 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';
|
|
29
30
|
export declare const useCreateGuestWalletsState: import("../../types/utils.js").CoreMethodMutationStateHook<"createGuestWallets">;
|
|
@@ -29,8 +29,10 @@ 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";
|
|
32
33
|
const useCreateGuestWalletsState = generateStateHook("createGuestWallets");
|
|
33
34
|
export {
|
|
35
|
+
useAddAuthMethod,
|
|
34
36
|
useClaimPregenWallets,
|
|
35
37
|
useCreateGuestWallets,
|
|
36
38
|
useCreateGuestWalletsState,
|
|
@@ -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,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").
|
|
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").
|
|
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").
|
|
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";
|
|
@@ -74,7 +75,7 @@ const useAccount = ({ cosmos } = {}) => {
|
|
|
74
75
|
connectionType = "external";
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
|
-
const isEmbeddedConnected =
|
|
78
|
+
const isEmbeddedConnected = connectionType === "embedded" || connectionType === "both";
|
|
78
79
|
const connectedNetworks = [];
|
|
79
80
|
if (evmAccount == null ? void 0 : evmAccount.isConnected) {
|
|
80
81
|
connectedNetworks.push("evm");
|
|
@@ -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,
|
|
@@ -70,7 +70,7 @@ const AccountLinkProvider = ({ children }) => {
|
|
|
70
70
|
var _a, _b, _c;
|
|
71
71
|
const para = useInternalClient();
|
|
72
72
|
const queryClient = useQueryClient();
|
|
73
|
-
const
|
|
73
|
+
const { embedded } = useAccount();
|
|
74
74
|
const { data: coreAccountLinkInProgress } = useAccountLinkInProgress();
|
|
75
75
|
const {
|
|
76
76
|
wallets,
|
|
@@ -112,8 +112,7 @@ const AccountLinkProvider = ({ children }) => {
|
|
|
112
112
|
status: statusVerifyExternalWalletLink,
|
|
113
113
|
reset: resetVerifyExternalWalletLink
|
|
114
114
|
} = useVerifyExternalWalletLink();
|
|
115
|
-
const
|
|
116
|
-
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));
|
|
117
116
|
const [accountLinkInProgress, setAccountLinkInProgress] = useState(
|
|
118
117
|
coreAccountLinkInProgress || void 0
|
|
119
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))) {
|
|
@@ -277,14 +289,17 @@ function AuthProvider({
|
|
|
277
289
|
ModalStep.AWAITING_ACCOUNT,
|
|
278
290
|
ModalStep.OTP,
|
|
279
291
|
ModalStep.FARCASTER_OAUTH,
|
|
280
|
-
ModalStep.TELEGRAM_OAUTH
|
|
292
|
+
ModalStep.TELEGRAM_OAUTH,
|
|
293
|
+
ModalStep.AWAITING_OAUTH,
|
|
294
|
+
ModalStep.SWITCH_WALLETS
|
|
281
295
|
]),
|
|
282
296
|
onPoll: () => {
|
|
283
297
|
goBackIfPopupClosedOnSteps([
|
|
284
298
|
ModalStep.AWAITING_BIOMETRIC_LOGIN,
|
|
285
299
|
ModalStep.AWAITING_PASSWORD_LOGIN,
|
|
286
300
|
ModalStep.EMBEDDED_PASSWORD_LOGIN,
|
|
287
|
-
ModalStep.OTP
|
|
301
|
+
ModalStep.OTP,
|
|
302
|
+
ModalStep.SWITCH_WALLETS
|
|
288
303
|
]);
|
|
289
304
|
}
|
|
290
305
|
},
|
|
@@ -556,6 +571,75 @@ function AuthProvider({
|
|
|
556
571
|
const logout = () => {
|
|
557
572
|
mutateLogout();
|
|
558
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
|
+
};
|
|
559
643
|
const isPasswordIFrameLoading = !!iFrameUrl && iFrameUrl === (signupState == null ? void 0 : signupState.passwordUrl) && !isIFrameReady;
|
|
560
644
|
const value = useMemo(
|
|
561
645
|
() => ({
|
|
@@ -576,6 +660,10 @@ function AuthProvider({
|
|
|
576
660
|
createGuestWallets,
|
|
577
661
|
isCreateGuestWalletsPending,
|
|
578
662
|
logout,
|
|
663
|
+
switchWallets,
|
|
664
|
+
switchWalletsUrl,
|
|
665
|
+
setSwitchWalletsUrl,
|
|
666
|
+
isSwitchWalletsPending,
|
|
579
667
|
biometricHints: biometricHints || void 0,
|
|
580
668
|
verifyFarcasterStatus
|
|
581
669
|
}),
|
|
@@ -598,6 +686,10 @@ function AuthProvider({
|
|
|
598
686
|
createGuestWallets,
|
|
599
687
|
isCreateGuestWalletsPending,
|
|
600
688
|
logout,
|
|
689
|
+
switchWallets,
|
|
690
|
+
switchWalletsUrl,
|
|
691
|
+
setSwitchWalletsUrl,
|
|
692
|
+
isSwitchWalletsPending,
|
|
601
693
|
biometricHints,
|
|
602
694
|
verifyFarcasterStatus
|
|
603
695
|
]
|
|
@@ -617,6 +709,9 @@ function AuthProvider({
|
|
|
617
709
|
setStep(ModalStep.ACCOUNT_MAIN);
|
|
618
710
|
}
|
|
619
711
|
}, [isCreateGuestWalletsPending]);
|
|
712
|
+
useEffect(() => {
|
|
713
|
+
setIsSwitchWalletsPending((prev) => !!prev ? mutateIsSwitchWalletsPending : prev);
|
|
714
|
+
}, [mutateIsSwitchWalletsPending]);
|
|
620
715
|
useEffect(() => {
|
|
621
716
|
return () => {
|
|
622
717
|
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.
|
|
3
|
+
"version": "2.0.0-alpha.64",
|
|
4
4
|
"bin": {
|
|
5
5
|
"setup-para": "dist/cli/cli.mjs"
|
|
6
6
|
},
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@getpara/react-common": "2.0.0-alpha.
|
|
9
|
-
"@getpara/react-components": "2.0.0-alpha.
|
|
10
|
-
"@getpara/web-sdk": "2.0.0-alpha.
|
|
8
|
+
"@getpara/react-common": "2.0.0-alpha.64",
|
|
9
|
+
"@getpara/react-components": "2.0.0-alpha.64",
|
|
10
|
+
"@getpara/web-sdk": "2.0.0-alpha.64",
|
|
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.
|
|
20
|
-
"@getpara/evm-wallet-connectors": "2.0.0-alpha.
|
|
21
|
-
"@getpara/solana-wallet-connectors": "2.0.0-alpha.
|
|
19
|
+
"@getpara/cosmos-wallet-connectors": "2.0.0-alpha.64",
|
|
20
|
+
"@getpara/evm-wallet-connectors": "2.0.0-alpha.64",
|
|
21
|
+
"@getpara/solana-wallet-connectors": "2.0.0-alpha.64",
|
|
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": "
|
|
41
|
+
"gitHead": "c55ecfbbd200053ddb78d88c93c597c0f781a6bb",
|
|
42
42
|
"main": "dist/index.js",
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"@tanstack/react-query": ">=5.0.0",
|