@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.
- package/dist/modal/ParaModal.js +8 -3
- package/dist/modal/components/Account/AccountHeader.js +2 -2
- package/dist/modal/components/Account/AccountProfile.d.ts +1 -1
- package/dist/modal/components/Account/AccountProfile.js +64 -38
- package/dist/modal/components/{WalletSelect/WalletSelect.d.ts → Account/AccountWalletSelect.d.ts} +1 -1
- package/dist/modal/components/{WalletSelect/WalletSelect.js → Account/AccountWalletSelect.js} +5 -4
- package/dist/modal/components/AddFunds/AddFundsAsset.js +1 -2
- package/dist/modal/components/AddFunds/AddFundsSettings.js +1 -2
- package/dist/modal/components/AuthInput/AuthInput.js +1 -2
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +5 -2
- package/dist/modal/components/Body/Body.js +5 -2
- package/dist/modal/components/ChainSwitch/ChainSwitch.js +1 -3
- package/dist/modal/components/Controls/ChainSelect.js +1 -2
- package/dist/modal/components/Footer/Footer.js +1 -2
- package/dist/modal/components/Header/Header.js +1 -2
- package/dist/modal/components/Hero/Hero.js +5 -3
- package/dist/modal/components/IFrameStep/IFrameStep.js +4 -5
- package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +4 -1
- package/dist/modal/components/OnRampComponents/AddingFunds.js +1 -1
- package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +1 -2
- package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +4 -1
- package/dist/modal/components/SwitchWalletsStep/SwitchWalletsStep.d.ts +1 -0
- package/dist/modal/components/SwitchWalletsStep/SwitchWalletsStep.js +10 -0
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +13 -2
- package/dist/modal/components/Waiting/Waiting.d.ts +1 -1
- package/dist/modal/components/Waiting/Waiting.js +7 -2
- package/dist/modal/components/WalletCard/WalletCard.js +1 -2
- package/dist/modal/components/WalletSelectOld/WalletSelectOld.js +2 -3
- package/dist/modal/components/common.d.ts +2 -8
- package/dist/modal/components/common.js +2 -38
- package/dist/modal/index.d.ts +1 -1
- package/dist/modal/index.js +1 -1
- package/dist/modal/utils/authInputHelpers.js +1 -1
- package/dist/modal/utils/countryCodes.js +39 -0
- package/dist/modal/utils/getWalletDisplayName.js +1 -1
- 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/modal/utils/stringFormatters.js +1 -1
- package/dist/provider/ParaProviderMin.js +5 -0
- package/dist/provider/actions/getEmbeddedAccount.d.ts +3 -2
- package/dist/provider/actions/getEmbeddedAccount.js +13 -4
- package/dist/provider/actions/index.d.ts +2 -0
- package/dist/provider/actions/index.js +4 -0
- package/dist/provider/hooks/mutations/index.d.ts +2 -0
- package/dist/provider/hooks/mutations/index.js +4 -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/useExportPrivateKey.d.ts +15 -0
- package/dist/provider/hooks/mutations/useExportPrivateKey.js +32 -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 +4 -3
- package/dist/provider/providers/AccountLinkProvider.js +1 -1
- package/dist/provider/providers/AuthProvider.d.ts +4 -0
- package/dist/provider/providers/AuthProvider.js +106 -6
- package/package.json +8 -8
- package/dist/modal/constants/constants.d.ts +0 -35
- package/dist/modal/constants/constants.js +0 -148
package/dist/modal/ParaModal.js
CHANGED
|
@@ -14,7 +14,7 @@ import { ModalStep, RESET_TO_ACCOUNT_STEPS, RESET_TO_AUTH_STEPS } from "./utils/
|
|
|
14
14
|
import { AuthLayout } from "./types/modalProps.js";
|
|
15
15
|
import { DEFAULTS } from "./constants/defaults.js";
|
|
16
16
|
import { useGoBack } from "./hooks/useGoBack.js";
|
|
17
|
-
import { safeStyled } from "@getpara/react-common";
|
|
17
|
+
import { safeStyled, SDK_VERSION } from "@getpara/react-common";
|
|
18
18
|
import { hasEmbeddedAuth, hasExternalWallet } from "./utils/authLayoutHelpers.js";
|
|
19
19
|
import { useAccount, useModal, useParaStatus, useWalletState } from "../provider/index.js";
|
|
20
20
|
import { useInternalClient } from "../provider/hooks/utils/useInternalClient.js";
|
|
@@ -23,7 +23,6 @@ import { useStore } from "../provider/stores/useStore.js";
|
|
|
23
23
|
import parsePhoneNumberFromString from "libphonenumber-js";
|
|
24
24
|
import { useAuthActions } from "../provider/providers/AuthProvider.js";
|
|
25
25
|
import { validateInput } from "./utils/authInputHelpers.js";
|
|
26
|
-
import { SDK_VERSION } from "./constants/constants.js";
|
|
27
26
|
defineCustomElements();
|
|
28
27
|
const ParaModal = forwardRef((props, ref) => {
|
|
29
28
|
const storedModalConfig = useStore((state) => state.modalConfig);
|
|
@@ -193,12 +192,18 @@ const ParaModal = forwardRef((props, ref) => {
|
|
|
193
192
|
initModal(isOpen);
|
|
194
193
|
isInitialized.current = true;
|
|
195
194
|
}
|
|
195
|
+
let timerId;
|
|
196
196
|
if (!bareModal && isReady && !isOpen && isInitialized.current) {
|
|
197
|
-
setTimeout(() => {
|
|
197
|
+
timerId = setTimeout(() => {
|
|
198
198
|
initModal();
|
|
199
199
|
isInitialized.current = false;
|
|
200
200
|
}, 250);
|
|
201
201
|
}
|
|
202
|
+
return () => {
|
|
203
|
+
if (timerId) {
|
|
204
|
+
clearTimeout(timerId);
|
|
205
|
+
}
|
|
206
|
+
};
|
|
202
207
|
}, [bareModal, isReady, isOpen, isAccountLoading]);
|
|
203
208
|
useEffect(() => {
|
|
204
209
|
let _authLayout = authLayout;
|
|
@@ -8,7 +8,7 @@ import { truncateAddress } from "@getpara/web-sdk";
|
|
|
8
8
|
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
9
9
|
import { useAssets } from "../../../provider/providers/AssetsProvider.js";
|
|
10
10
|
import { useAccount, useWallet } from "../../../provider/index.js";
|
|
11
|
-
import {
|
|
11
|
+
import { AccountWalletSelect } from "./AccountWalletSelect.js";
|
|
12
12
|
const AccountHeader = ({ withBalance = false } = {}) => {
|
|
13
13
|
const para = useInternalClient();
|
|
14
14
|
const { connectionType } = useAccount();
|
|
@@ -44,7 +44,7 @@ const AccountHeader = ({ withBalance = false } = {}) => {
|
|
|
44
44
|
src
|
|
45
45
|
}
|
|
46
46
|
),
|
|
47
|
-
connectionType === "both" ? /* @__PURE__ */ jsx(
|
|
47
|
+
connectionType === "both" ? /* @__PURE__ */ jsx(AccountWalletSelect, {}) : /* @__PURE__ */ jsx(CpslText, { variant: "headingXS", weight: "semiBold", color: "contrast", children: name }),
|
|
48
48
|
withBalance && typeof totalBalance === "string" && totalBalance !== "" && /* @__PURE__ */ jsx(CpslText, { variant: "bodyM", weight: "medium", style: { visibility: profileBalance ? "visible" : "hidden" }, children: totalBalance })
|
|
49
49
|
] });
|
|
50
50
|
};
|
|
@@ -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";
|
|
7
|
-
import { AccountTypeIcon, GradientScroll, StepContainer
|
|
6
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { AccountTypeIcon, GradientScroll, StepContainer } 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";
|
|
19
|
-
import { ACCOUNT_TYPES, safeStyled, useCopyToClipboard } from "@getpara/react-common";
|
|
17
|
+
import { useEffect, useMemo } from "react";
|
|
18
|
+
import { ACCOUNT_TYPES, safeStyled, useCopyToClipboard, WalletTypeIcon } 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
|
] })
|
package/dist/modal/components/{WalletSelect/WalletSelect.d.ts → Account/AccountWalletSelect.d.ts}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const AccountWalletSelect: () => import("react/jsx-runtime").JSX.Element;
|
|
2
2
|
export declare const Select: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components/dist/types.js").Substitute<Omit<Omit<any, "ref"> & import("react").RefAttributes<any>, "ref"> & {
|
|
3
3
|
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;
|
|
4
4
|
}, {
|
package/dist/modal/components/{WalletSelect/WalletSelect.js → Account/AccountWalletSelect.js}
RENAMED
|
@@ -62,7 +62,7 @@ const Wallet = ({
|
|
|
62
62
|
)
|
|
63
63
|
] });
|
|
64
64
|
};
|
|
65
|
-
const
|
|
65
|
+
const AccountWalletSelect = () => {
|
|
66
66
|
var _a, _b, _c;
|
|
67
67
|
const containerRef = useRef(null);
|
|
68
68
|
const { dropdownMaxHeight, dropdownWidth, mobileAnchor, resize } = useDropdownPosition(containerRef);
|
|
@@ -170,7 +170,8 @@ const SelectContainer = safeStyled.div`
|
|
|
170
170
|
border-radius: var(--cpsl-border-radius-tile-button);
|
|
171
171
|
background-color: transparent;
|
|
172
172
|
`;
|
|
173
|
-
const WalletIcon = safeStyled(CpslIcon)`
|
|
173
|
+
const WalletIcon = safeStyled(CpslIcon)`
|
|
174
|
+
--icon-border: 1px solid var(--cpsl-color-background-8);
|
|
174
175
|
--icon-background: var(--cpsl-color-background-0);
|
|
175
176
|
--icon-border-radius: 4px;
|
|
176
177
|
`;
|
|
@@ -181,8 +182,8 @@ const CopyButton = safeStyled(CpslButton)`
|
|
|
181
182
|
}
|
|
182
183
|
`;
|
|
183
184
|
export {
|
|
185
|
+
AccountWalletSelect,
|
|
184
186
|
Select,
|
|
185
187
|
SelectContainer,
|
|
186
|
-
SelectItem
|
|
187
|
-
WalletSelect
|
|
188
|
+
SelectItem
|
|
188
189
|
};
|
|
@@ -7,8 +7,7 @@ import {
|
|
|
7
7
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
import * as comp from "@getpara/react-components";
|
|
9
9
|
import { formatCurrency, getOnRampNetworks } from "@getpara/web-sdk";
|
|
10
|
-
import { safeStyled } from "@getpara/react-common";
|
|
11
|
-
import { getAssetCode, getAssetName, ON_RAMP_ASSETS } from "../../constants/constants.js";
|
|
10
|
+
import { safeStyled, getAssetCode, getAssetName, ON_RAMP_ASSETS } from "@getpara/react-common";
|
|
12
11
|
import { useModalStore } from "../../stores/index.js";
|
|
13
12
|
import { useState } from "react";
|
|
14
13
|
import { useAddFunds } from "./AddFundsContext.js";
|
|
@@ -8,11 +8,10 @@ import { useEffect, useMemo, useState } from "react";
|
|
|
8
8
|
import { useAddFunds } from "./AddFundsContext.js";
|
|
9
9
|
import { CpslButton, CpslIcon, CpslInput, CpslRow, CpslText } from "@getpara/react-components";
|
|
10
10
|
import { AssetIcon, HeaderSelect, HeaderSelectContainer, HeaderSelectItem, NetworkIcon } from "../common.js";
|
|
11
|
-
import { getAssetCode, getNetworkName } from "../../constants/constants.js";
|
|
12
11
|
import { EnabledFlow, getOnRampNetworks, OnRampPurchaseType } from "@getpara/web-sdk";
|
|
13
12
|
import { OnRampStep, useModalStore } from "../../stores/index.js";
|
|
14
13
|
import { useStore } from "../../../provider/stores/useStore.js";
|
|
15
|
-
import { safeStyled } from "@getpara/react-common";
|
|
14
|
+
import { safeStyled, getAssetCode, getNetworkName } from "@getpara/react-common";
|
|
16
15
|
import { contentMotionProps, NoProviders } from "./common.js";
|
|
17
16
|
import { AnimatePresence, motion, useIsPresent } from "framer-motion";
|
|
18
17
|
import { AddFundsAsset } from "./AddFundsAsset.js";
|
|
@@ -13,9 +13,8 @@ import {
|
|
|
13
13
|
CpslText
|
|
14
14
|
} from "@getpara/react-components";
|
|
15
15
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
16
|
-
import { safeStyled } from "@getpara/react-common";
|
|
16
|
+
import { safeStyled, MOBILE_SIZE } from "@getpara/react-common";
|
|
17
17
|
import countryCodes from "../../utils/countryCodes.js";
|
|
18
|
-
import { MOBILE_SIZE } from "../../constants/constants.js";
|
|
19
18
|
import { useDropdownPosition } from "./hooks/useDropdownPosition.js";
|
|
20
19
|
import { defaultPhoneMask, phoneMasks } from "./phoneMasks.js";
|
|
21
20
|
import { extractAuthInfo } from "@getpara/user-management-client";
|
|
@@ -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
|
] })
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../../../chunk-MMUBH76A.js";
|
|
3
3
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
import { safeStyled, WarningBanner } from "@getpara/react-common";
|
|
4
|
+
import { safeStyled, WarningBanner, BODY_MOTION_VARIANTS, BODY_TRANSITION, MOBILE_SIZE } from "@getpara/react-common";
|
|
5
5
|
import { IFrameSteps, ModalStep } from "../../utils/steps.js";
|
|
6
6
|
import { CpslAlert, CpslIcon } from "@getpara/react-components";
|
|
7
7
|
import { VerificationCodeStep } from "../VerificationCodeStep/VerificationCodeStep.js";
|
|
@@ -21,7 +21,6 @@ import { AddFundsAwaiting, AddFundsDone, AddFunds } from "../AddFunds/index.js";
|
|
|
21
21
|
import { FarcasterOAuthStep } from "../OAuth/FarcasterOAuthStep.js";
|
|
22
22
|
import { Header } from "../Header/Header.js";
|
|
23
23
|
import { AuthMainStep } from "../AuthMainStep/AuthMainStep.js";
|
|
24
|
-
import { BODY_MOTION_VARIANTS, BODY_TRANSITION, MOBILE_SIZE } from "../../constants/constants.js";
|
|
25
24
|
import { Account } from "../Account/Account.js";
|
|
26
25
|
import { AuthOptions } from "../AuthOptions/AuthOptions.js";
|
|
27
26
|
import { ExternalWallets } from "../ExternalWallets/ExternalWallets.js";
|
|
@@ -43,6 +42,7 @@ import { AccountProfileLink } from "../Account/AccountProfileLink.js";
|
|
|
43
42
|
import { AccountProfileUnlink } from "../Account/AccountProfileUnlink.js";
|
|
44
43
|
import { ExternalWalletNetworkSelectStep } from "../ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.js";
|
|
45
44
|
import { AwaitingAccountStep } from "../AwaitingAccountStep/AwaitingAccountStep.js";
|
|
45
|
+
import { SwitchWalletsStep } from "../SwitchWalletsStep/SwitchWalletsStep.js";
|
|
46
46
|
import { Footer } from "../Footer/Footer.js";
|
|
47
47
|
import { renderTextWithLinks } from "../../utils/renderTextWithLinks.js";
|
|
48
48
|
const MIN_HEIGHT = {
|
|
@@ -210,6 +210,9 @@ const Body = ({
|
|
|
210
210
|
case ModalStep.AWAITING_ACCOUNT: {
|
|
211
211
|
return /* @__PURE__ */ jsx(AwaitingAccountStep, {});
|
|
212
212
|
}
|
|
213
|
+
case ModalStep.SWITCH_WALLETS: {
|
|
214
|
+
return /* @__PURE__ */ jsx(SwitchWalletsStep, {});
|
|
215
|
+
}
|
|
213
216
|
default: {
|
|
214
217
|
if (IFrameSteps.includes(currentStep)) {
|
|
215
218
|
return null;
|
|
@@ -7,11 +7,9 @@ import { CpslButton, CpslIcon, CpslQrCode, CpslSpinner, CpslText } from "@getpar
|
|
|
7
7
|
import { HeroAccountTypeIcon, InnerStepContainer, QRContainer, StepContainer } from "../common.js";
|
|
8
8
|
import { useEffect, useMemo } from "react";
|
|
9
9
|
import { useModalStore } from "../../stores/index.js";
|
|
10
|
-
import { HeroSpinner, safeStyled } from "@getpara/react-common";
|
|
11
|
-
import { useCopyToClipboard } from "@getpara/react-common";
|
|
10
|
+
import { HeroSpinner, safeStyled, NETWORK_NOT_SUPPORTED_ERROR, useCopyToClipboard } from "@getpara/react-common";
|
|
12
11
|
import { ModalStep } from "../../utils/steps.js";
|
|
13
12
|
import { routeMobileExternalWallet } from "../../utils/routeMobileExternalWallet.js";
|
|
14
|
-
import { NETWORK_NOT_SUPPORTED_ERROR } from "../../constants/constants.js";
|
|
15
13
|
import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
|
|
16
14
|
const ChainSwitch = () => {
|
|
17
15
|
const [isCopied, copy] = useCopyToClipboard();
|
|
@@ -4,13 +4,12 @@ import {
|
|
|
4
4
|
} from "../../../chunk-MMUBH76A.js";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { CpslText } from "@getpara/react-components";
|
|
7
|
-
import { getNetworkFromChainId, safeStyled } from "@getpara/react-common";
|
|
7
|
+
import { getNetworkFromChainId, getNetworkName, safeStyled } from "@getpara/react-common";
|
|
8
8
|
import { useEffect, useRef } from "react";
|
|
9
9
|
import { useDropdownPosition } from "../AuthInput/hooks/useDropdownPosition.js";
|
|
10
10
|
import { useWallet } from "../../../provider/index.js";
|
|
11
11
|
import { HeaderSelect, HeaderSelectContainer, HeaderSelectItem, NetworkIcon } from "../common.js";
|
|
12
12
|
import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
|
|
13
|
-
import { getNetworkName } from "../../constants/constants.js";
|
|
14
13
|
const Chain = ({
|
|
15
14
|
chain: { id, name },
|
|
16
15
|
slot,
|
|
@@ -1,9 +1,8 @@
|
|
|
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, PARA_TERMS_AND_CONDITIONS } from "@getpara/react-common";
|
|
5
5
|
import { CpslIcon, CpslText } from "@getpara/react-components";
|
|
6
|
-
import { PARA_TERMS_AND_CONDITIONS } from "../../constants/constants.js";
|
|
7
6
|
import { useModalStore } from "../../stores/index.js";
|
|
8
7
|
import { ModalStep } from "../../utils/steps.js";
|
|
9
8
|
import { useAccountLinking } from "../../../provider/providers/AccountLinkProvider.js";
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../../../chunk-MMUBH76A.js";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
import { getAuthDisplay, safeStyled } from "@getpara/react-common";
|
|
4
|
+
import { getAuthDisplay, safeStyled, BODY_MOTION_VARIANTS, BODY_TRANSITION } from "@getpara/react-common";
|
|
5
5
|
import { useStepTitle } from "./hooks/useStepTitle.js";
|
|
6
6
|
import { CenteredText } from "../common.js";
|
|
7
7
|
import { AnimatePresence, motion } from "framer-motion";
|
|
8
8
|
import { useModalStore } from "../../stores/index.js";
|
|
9
|
-
import { BODY_MOTION_VARIANTS, BODY_TRANSITION } from "../../constants/constants.js";
|
|
10
9
|
import { useAccount } from "../../../provider/index.js";
|
|
11
10
|
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
12
11
|
import { CpslIcon, CpslText } from "@getpara/react-components";
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
import "../../../chunk-MMUBH76A.js";
|
|
3
3
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { CpslHero, CpslIcon, CpslIdenticon } from "@getpara/react-components";
|
|
5
|
-
import { safeStyled } from "@getpara/react-common";
|
|
5
|
+
import { safeStyled, NETWORK_NOT_SUPPORTED_ERROR } from "@getpara/react-common";
|
|
6
6
|
import { ModalStep } from "../../utils/steps.js";
|
|
7
7
|
import { useModalStore } from "../../stores/index.js";
|
|
8
|
-
import { NETWORK_NOT_SUPPORTED_ERROR } from "../../constants/constants.js";
|
|
9
8
|
import { useEffect, useState } from "react";
|
|
10
9
|
import { isMobile } from "@getpara/web-sdk";
|
|
11
10
|
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
@@ -54,9 +53,12 @@ const Hero = () => {
|
|
|
54
53
|
externalWalletError
|
|
55
54
|
})[step];
|
|
56
55
|
const delay = newStepConfig && prevStepConfig ? 0 : newStepConfig && !prevStepConfig ? 0 : 200;
|
|
57
|
-
setTimeout(() => {
|
|
56
|
+
const timerId = setTimeout(() => {
|
|
58
57
|
setCurrentStep(step);
|
|
59
58
|
}, delay);
|
|
59
|
+
return () => {
|
|
60
|
+
clearTimeout(timerId);
|
|
61
|
+
};
|
|
60
62
|
}, [step]);
|
|
61
63
|
const isExternalStep = currentStep === ModalStep.EX_WALLET_SELECTED;
|
|
62
64
|
const isChainSwitchStep = currentStep === ModalStep.CHAIN_SWITCH;
|
|
@@ -5,10 +5,9 @@ import { useEffect, useState } from "react";
|
|
|
5
5
|
import { useModalStore } from "../../stores/index.js";
|
|
6
6
|
import { IFrameSteps } from "../../utils/steps.js";
|
|
7
7
|
import { safeStyled } from "@getpara/react-common";
|
|
8
|
-
import { SpinnerContainer } from "@getpara/react-common";
|
|
8
|
+
import { SpinnerContainer, MOBILE_SIZE } from "@getpara/react-common";
|
|
9
9
|
import { CpslSpinner } from "@getpara/react-components";
|
|
10
10
|
import { getPortalBaseURL } from "@getpara/web-sdk";
|
|
11
|
-
import { MOBILE_SIZE } from "../../constants/constants.js";
|
|
12
11
|
import { useStore } from "../../../provider/stores/useStore.js";
|
|
13
12
|
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
14
13
|
const IFrameStep = () => {
|
|
@@ -37,9 +36,9 @@ const IFrameStep = () => {
|
|
|
37
36
|
return;
|
|
38
37
|
}
|
|
39
38
|
if (event.data) {
|
|
40
|
-
if (event.data.type === "HEIGHT") {
|
|
41
|
-
setHeight(event.data.height);
|
|
42
|
-
setIsReady(true);
|
|
39
|
+
if (event.data.type === "HEIGHT" && typeof event.data.height === "number") {
|
|
40
|
+
setHeight(Math.max(event.data.height, 200));
|
|
41
|
+
setIsReady(event.data.height > 0 ? true : false);
|
|
43
42
|
}
|
|
44
43
|
}
|
|
45
44
|
};
|
|
@@ -30,7 +30,7 @@ const LoginDoneStep = ({ onClose }) => {
|
|
|
30
30
|
return /* @__PURE__ */ jsx(WalletCard, { id, type, showAddFunds: false }, `${id}-${type}`);
|
|
31
31
|
}, [para.externalWalletConnectionType, para.externalWallets, para.wallets]);
|
|
32
32
|
useEffect(() => {
|
|
33
|
-
setTimeout(() => {
|
|
33
|
+
const timerId = setTimeout(() => {
|
|
34
34
|
if (bareModal) {
|
|
35
35
|
setFlow("account");
|
|
36
36
|
setStep(ModalStep.ACCOUNT_MAIN);
|
|
@@ -38,6 +38,9 @@ const LoginDoneStep = ({ onClose }) => {
|
|
|
38
38
|
onClose();
|
|
39
39
|
}
|
|
40
40
|
}, 1600);
|
|
41
|
+
return () => {
|
|
42
|
+
clearTimeout(timerId);
|
|
43
|
+
};
|
|
41
44
|
}, []);
|
|
42
45
|
return /* @__PURE__ */ jsxs(StepContainer, { children: [
|
|
43
46
|
/* @__PURE__ */ jsx(HeroIcon, { icon: "checkCircleFilled" }),
|
|
@@ -3,7 +3,7 @@ import "../../../chunk-MMUBH76A.js";
|
|
|
3
3
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { OnRampPurchaseStatus } from "@getpara/web-sdk";
|
|
5
5
|
import { SpinnerContainer } from "../common.js";
|
|
6
|
-
import { ON_RAMP_PROVIDERS } from "
|
|
6
|
+
import { ON_RAMP_PROVIDERS } from "@getpara/react-common";
|
|
7
7
|
import { useModalStore } from "../../stores/index.js";
|
|
8
8
|
import { CpslSpinner, CpslText } from "@getpara/react-components";
|
|
9
9
|
const AddingFunds = () => {
|
|
@@ -4,8 +4,7 @@ import {
|
|
|
4
4
|
} from "../../../chunk-MMUBH76A.js";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { useState } from "react";
|
|
7
|
-
import { ON_RAMP_PROVIDERS } from "
|
|
8
|
-
import { safeStyled } from "@getpara/react-common";
|
|
7
|
+
import { safeStyled, ON_RAMP_PROVIDERS } from "@getpara/react-common";
|
|
9
8
|
import { CpslButton, CpslIcon, CpslSpinner, CpslText } from "@getpara/react-components";
|
|
10
9
|
import { motion } from "framer-motion";
|
|
11
10
|
const OnRampProviderButton = ({ config, index, onClick: _onClick }) => {
|
|
@@ -32,10 +32,13 @@ const Setup2FAStep = ({ onClose }) => {
|
|
|
32
32
|
const params = (twoFactorStatus == null ? void 0 : twoFactorStatus.uri) ? new URL(twoFactorStatus.uri).searchParams : void 0;
|
|
33
33
|
const secret = params == null ? void 0 : params.get("secret");
|
|
34
34
|
useEffect(() => {
|
|
35
|
-
setTimeout(() => {
|
|
35
|
+
const timerId = setTimeout(() => {
|
|
36
36
|
var _a, _b, _c, _d;
|
|
37
37
|
(_d = (_c = (_b = (_a = inputRef == null ? void 0 : inputRef.current) == null ? void 0 : _a.shadowRoot) == null ? void 0 : _b.querySelectorAll("input")) == null ? void 0 : _c[0]) == null ? void 0 : _d.focus();
|
|
38
38
|
}, 10);
|
|
39
|
+
return () => {
|
|
40
|
+
clearTimeout(timerId);
|
|
41
|
+
};
|
|
39
42
|
}, [isVerifying]);
|
|
40
43
|
useEffect(() => {
|
|
41
44
|
if (code.length === 6) {
|
|
@@ -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
|
+
};
|
|
@@ -13,16 +13,20 @@ import { useResendVerificationCode } from "../../../provider/index.js";
|
|
|
13
13
|
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
14
14
|
const VerificationCode = ({ authInfo, onResend, onSubmit, status, error }) => {
|
|
15
15
|
const inputRef = useRef(null);
|
|
16
|
+
const resendTimerRef = useRef();
|
|
16
17
|
const [code, setCode] = useState("");
|
|
17
18
|
const [isPending, setIsPending] = useState(status === "pending");
|
|
18
19
|
const [codeError, setCodeError] = useState(null);
|
|
19
20
|
const [resendDisabled, setResendDisabled] = useState(false);
|
|
20
21
|
const isEmail = (authInfo == null ? void 0 : authInfo.authType) === "email";
|
|
21
22
|
useEffect(() => {
|
|
22
|
-
setTimeout(() => {
|
|
23
|
+
const timerId = setTimeout(() => {
|
|
23
24
|
var _a, _b, _c, _d;
|
|
24
25
|
(_d = (_c = (_b = (_a = inputRef.current) == null ? void 0 : _a.shadowRoot) == null ? void 0 : _b.querySelectorAll("input")) == null ? void 0 : _c[0]) == null ? void 0 : _d.focus();
|
|
25
26
|
}, 10);
|
|
27
|
+
return () => {
|
|
28
|
+
clearTimeout(timerId);
|
|
29
|
+
};
|
|
26
30
|
}, []);
|
|
27
31
|
useEffect(() => {
|
|
28
32
|
setCodeError(null);
|
|
@@ -41,12 +45,19 @@ const VerificationCode = ({ authInfo, onResend, onSubmit, status, error }) => {
|
|
|
41
45
|
try {
|
|
42
46
|
onResend();
|
|
43
47
|
} finally {
|
|
44
|
-
setTimeout(() => {
|
|
48
|
+
resendTimerRef.current = setTimeout(() => {
|
|
45
49
|
setResendDisabled(false);
|
|
46
50
|
}, 3e3);
|
|
47
51
|
}
|
|
48
52
|
}
|
|
49
53
|
});
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
return () => {
|
|
56
|
+
if (resendTimerRef.current) {
|
|
57
|
+
clearTimeout(resendTimerRef.current);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}, []);
|
|
50
61
|
const handleCodeInput = (e) => {
|
|
51
62
|
setCode(e.detail.value.trim());
|
|
52
63
|
};
|