@getpara/react-sdk 1.8.0 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/modal/ParaModal.js +2 -0
  2. package/dist/modal/components/Account/Account.js +4 -1
  3. package/dist/modal/components/AddFunds/AddFunds.d.ts +0 -2
  4. package/dist/modal/components/AddFunds/AddFunds.js +32 -187
  5. package/dist/modal/components/AddFunds/AddFundsAsset.d.ts +1 -0
  6. package/dist/modal/components/AddFunds/AddFundsAsset.js +119 -0
  7. package/dist/modal/components/AddFunds/AddFundsContext.d.ts +31 -0
  8. package/dist/modal/components/AddFunds/AddFundsContext.js +154 -0
  9. package/dist/modal/components/AddFunds/AddFundsProvider.d.ts +1 -0
  10. package/dist/modal/components/AddFunds/AddFundsProvider.js +105 -0
  11. package/dist/modal/components/AddFunds/AddFundsReceive.d.ts +1 -0
  12. package/dist/modal/components/AddFunds/AddFundsReceive.js +66 -0
  13. package/dist/modal/components/AddFunds/AddFundsSettings.d.ts +1 -0
  14. package/dist/modal/components/AddFunds/AddFundsSettings.js +233 -0
  15. package/dist/modal/components/AddFunds/common.d.ts +19 -0
  16. package/dist/modal/components/AddFunds/common.js +24 -0
  17. package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.d.ts +3 -1
  18. package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +2 -2
  19. package/dist/modal/components/Body/Body.js +2 -2
  20. package/dist/modal/components/Controls/Selects.js +9 -59
  21. package/dist/modal/components/ModalContent/ModalContent.js +2 -2
  22. package/dist/modal/components/WalletCard/WalletCard.js +1 -1
  23. package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.js +2 -2
  24. package/dist/modal/components/common.d.ts +28 -9
  25. package/dist/modal/components/common.js +74 -1
  26. package/dist/modal/constants/constants.d.ts +9 -2
  27. package/dist/modal/constants/constants.js +35 -8
  28. package/dist/modal/hooks/useCreateAccount.d.ts +3 -1
  29. package/dist/modal/hooks/useCreateAccount.js +7 -2
  30. package/dist/modal/index.d.ts +1 -1
  31. package/dist/modal/index.js +2 -2
  32. package/dist/modal/stores/modal/actions.js +11 -1
  33. package/dist/modal/stores/modal/useModalStore.d.ts +7 -1
  34. package/dist/modal/stores/modal/useModalStore.js +7 -0
  35. package/package.json +6 -5
@@ -0,0 +1,105 @@
1
+ "use client";
2
+ import {
3
+ __async,
4
+ __spreadProps,
5
+ __spreadValues
6
+ } from "../../../chunk-MMUBH76A.js";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ import styled from "styled-components";
9
+ import { Heading, InnerStepContainer } from "../common.js";
10
+ import { CpslText } from "@getpara/react-components";
11
+ import { useAddFunds } from "./AddFundsContext.js";
12
+ import { useModalStore, useThemeStore } from "../../stores/index.js";
13
+ import { motion, AnimatePresence } from "framer-motion";
14
+ import { OnRampProviderButton } from "../OnRampComponents/OnRampProviderButton.js";
15
+ import { useActiveWallet } from "../../hooks/useActiveWallet.js";
16
+ import { EnabledFlow, OnRampProvider, OnRampPurchaseType } from "@getpara/web-sdk";
17
+ import { ModalStep } from "../../utils/steps.js";
18
+ import { contentMotionProps } from "./common.js";
19
+ import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
20
+ function AddFundsProvider() {
21
+ const para = useInternalClient();
22
+ const hideWallets = useThemeStore((state) => state.hideWallets);
23
+ const onRampConfig = useModalStore((state) => state.onRampConfig);
24
+ const setOnRampPurchase = useModalStore((state) => state.setOnRampPurchase);
25
+ const setModalStep = useModalStore((state) => state.setStep);
26
+ const { asset, network, fiatQuantity, isProviderAllowed, tab } = useAddFunds();
27
+ const activeWallet = useActiveWallet();
28
+ return /* @__PURE__ */ jsxs(Container, __spreadProps(__spreadValues({}, contentMotionProps), { children: [
29
+ /* @__PURE__ */ jsx(Heading, { variant: "headingS", weight: "bold", children: "Choose Provider" }),
30
+ /* @__PURE__ */ jsxs($InnerStepContainer, { children: [
31
+ /* @__PURE__ */ jsxs(NoProviders, { isHidden: Object.values(isProviderAllowed).some((v) => !!v), variant: "bodyM", children: [
32
+ "No providers are available for this ",
33
+ hideWallets ? "account" : "wallet"
34
+ ] }),
35
+ /* @__PURE__ */ jsx(AnimatePresence, { children: onRampConfig.providers.map((id, index) => {
36
+ return isProviderAllowed[id] ? /* @__PURE__ */ jsx(
37
+ motion.div,
38
+ {
39
+ style: { width: "100%" },
40
+ layout: true,
41
+ initial: { opacity: 0, transform: "translateX(25px)" },
42
+ animate: { opacity: 1, transform: "none" },
43
+ exit: { opacity: 0, transform: "translateX(-25px)" },
44
+ transition: { duration: 0.2 },
45
+ children: /* @__PURE__ */ jsx(
46
+ OnRampProviderButton,
47
+ {
48
+ config: onRampConfig,
49
+ index,
50
+ onClick: () => __async(this, null, function* () {
51
+ if (!(activeWallet == null ? void 0 : activeWallet.type)) return;
52
+ const isPopup = id !== OnRampProvider.RAMP;
53
+ const { onRampPurchase: newOnRampPurchase } = yield para.initiateOnRampTransaction({
54
+ walletId: activeWallet.isExternal ? void 0 : activeWallet.id,
55
+ externalWalletAddress: activeWallet.isExternal ? activeWallet.id : void 0,
56
+ shouldOpenPopup: isPopup,
57
+ params: {
58
+ type: tab === EnabledFlow.BUY ? OnRampPurchaseType.BUY : OnRampPurchaseType.SELL,
59
+ walletType: activeWallet.type,
60
+ provider: id,
61
+ network,
62
+ asset,
63
+ fiatQuantity,
64
+ testMode: onRampConfig.testMode
65
+ }
66
+ });
67
+ setOnRampPurchase(__spreadProps(__spreadValues({}, newOnRampPurchase), { fiat: "USD" }));
68
+ !isPopup && setModalStep(ModalStep.ADD_FUNDS_AWAITING);
69
+ })
70
+ },
71
+ id
72
+ )
73
+ },
74
+ id
75
+ ) : null;
76
+ }) })
77
+ ] })
78
+ ] }));
79
+ }
80
+ const Container = styled(motion.div)`
81
+ width: 100%;
82
+ height: 100%;
83
+ align-self: center;
84
+ display: flex;
85
+ flex-direction: column;
86
+ align-items: center;
87
+ gap: 8px;
88
+ height: 320px;
89
+ `;
90
+ const $InnerStepContainer = styled(InnerStepContainer)`
91
+ position: relative;
92
+ `;
93
+ const NoProviders = styled(CpslText)`
94
+ width: 100%;
95
+ text-align: center;
96
+ visibility: ${({ isHidden }) => isHidden ? "hidden" : "visible"};
97
+ position: absolute;
98
+ top: 0;
99
+ left: 0;
100
+ right: 0;
101
+ transition: visibility 0.2s;
102
+ `;
103
+ export {
104
+ AddFundsProvider
105
+ };
@@ -0,0 +1 @@
1
+ export declare function AddFundsReceive(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,66 @@
1
+ "use client";
2
+ import "../../../chunk-MMUBH76A.js";
3
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
+ import {
5
+ CpslButton,
6
+ CpslDivider,
7
+ CpslIcon,
8
+ CpslIdenticon,
9
+ CpslQrCode,
10
+ CpslSpinner,
11
+ CpslText
12
+ } from "@getpara/react-components";
13
+ import { CenteredText, FilledDisabledInput, InnerStepContainer, QRContainer } from "../common.js";
14
+ import { isMobile, WalletType } from "@getpara/web-sdk";
15
+ import { useModalStore, useThemeStore } from "../../stores/index.js";
16
+ import { useCopyToClipboard } from "@getpara/react-common";
17
+ import { useMemo } from "react";
18
+ import { useActiveWallet } from "../../hooks/useActiveWallet.js";
19
+ import { useAddFunds } from "./AddFundsContext.js";
20
+ import { formatNetworkList } from "../../utils/stringFormatters.js";
21
+ import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
22
+ const GENERIC_WALLET = {
23
+ [WalletType.EVM]: "Ethereum or EVM-based L2s",
24
+ [WalletType.SOLANA]: "Solana",
25
+ [WalletType.COSMOS]: "Cosmos"
26
+ };
27
+ function AddFundsReceive() {
28
+ const [isCopied, copy] = useCopyToClipboard();
29
+ const { networks } = useAddFunds();
30
+ const para = useInternalClient();
31
+ const appName = useThemeStore((state) => state.appName);
32
+ const hideWallets = useThemeStore((state) => state.hideWallets);
33
+ const onRampConfig = useModalStore((state) => state.onRampConfig);
34
+ const activeWallet = useActiveWallet();
35
+ const address = useMemo(
36
+ () => activeWallet ? para.getDisplayAddress(activeWallet.id, { addressType: activeWallet.type }) : "",
37
+ [para, activeWallet == null ? void 0 : activeWallet.id, activeWallet == null ? void 0 : activeWallet.type]
38
+ );
39
+ const onCopy = () => {
40
+ copy(address);
41
+ };
42
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
43
+ /* @__PURE__ */ jsx(InnerStepContainer, { children: /* @__PURE__ */ jsxs(FilledDisabledInput, { noAutoDisable: true, readonly: true, placeholder: address, children: [
44
+ /* @__PURE__ */ jsx(CpslIdenticon, { slot: "start", size: "32px", hash: para.getIdenticonHash(activeWallet.id, activeWallet.type) }),
45
+ /* @__PURE__ */ jsx(CpslButton, { slot: "end", variant: "ghost", onClick: onCopy, children: /* @__PURE__ */ jsx(CpslIcon, { icon: isCopied ? "check" : "copy" }) })
46
+ ] }, address) }),
47
+ !isMobile() && /* @__PURE__ */ jsxs(Fragment, { children: [
48
+ /* @__PURE__ */ jsx(CpslDivider, { children: "or" }),
49
+ /* @__PURE__ */ jsxs(InnerStepContainer, { children: [
50
+ /* @__PURE__ */ jsx(QRContainer, { children: !address ? /* @__PURE__ */ jsx(CpslSpinner, { size: 100 }) : /* @__PURE__ */ jsx(CpslQrCode, { url: address }, address) }),
51
+ /* @__PURE__ */ jsx(CpslText, { weight: "semiBold", color: "secondary", children: "Scan with your crypto wallet" })
52
+ ] })
53
+ ] }),
54
+ /* @__PURE__ */ jsxs(InnerStepContainer, { children: [
55
+ /* @__PURE__ */ jsxs(CenteredText, { weight: "semiBold", children: [
56
+ !!onRampConfig.allowedAssets && networks.length > 0 || hideWallets ? appName != null ? appName : "This App" : "This Wallet",
57
+ " ",
58
+ "Only Supports:"
59
+ ] }),
60
+ /* @__PURE__ */ jsx(CenteredText, { weight: "medium", color: "secondary", children: !!onRampConfig.allowedAssets && networks.length > 0 ? formatNetworkList(networks) : GENERIC_WALLET[activeWallet.type] })
61
+ ] })
62
+ ] });
63
+ }
64
+ export {
65
+ AddFundsReceive
66
+ };
@@ -0,0 +1 @@
1
+ export declare function AddFundsSettings(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,233 @@
1
+ "use client";
2
+ import {
3
+ __spreadProps,
4
+ __spreadValues
5
+ } from "../../../chunk-MMUBH76A.js";
6
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
+ import { useEffect, useMemo, useState } from "react";
8
+ import { useAddFunds } from "./AddFundsContext.js";
9
+ import { CpslButton, CpslIcon, CpslInput, CpslRow, CpslText } from "@getpara/react-components";
10
+ import { AssetIcon, HeaderSelect, HeaderSelectContainer, HeaderSelectItem, NetworkIcon } from "../common.js";
11
+ import { getAssetCode, getNetworkName } from "../../constants/constants.js";
12
+ import { EnabledFlow, getOnRampNetworks, OnRampPurchaseType } from "@getpara/web-sdk";
13
+ import { OnRampStep, useModalStore, useThemeStore } from "../../stores/index.js";
14
+ import styled from "styled-components";
15
+ import { contentMotionProps, NoProviders } from "./common.js";
16
+ import { AnimatePresence, motion, useIsPresent } from "framer-motion";
17
+ import { AddFundsAsset } from "./AddFundsAsset.js";
18
+ function NetworkPill({
19
+ network,
20
+ gap = "4px",
21
+ slot,
22
+ start,
23
+ fix = false
24
+ }) {
25
+ return /* @__PURE__ */ jsxs(CpslRow, __spreadProps(__spreadValues({ gap }, slot ? { slot } : {}), { children: [
26
+ start,
27
+ /* @__PURE__ */ jsx(NetworkIcon, { network, size: "24px" }),
28
+ /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "contrast", style: fix ? { marginRight: "8px" } : void 0, children: getNetworkName(network) })
29
+ ] }));
30
+ }
31
+ function AssetPill({ asset, gap = "4px", slot, fix }) {
32
+ if (!asset) {
33
+ return null;
34
+ }
35
+ return /* @__PURE__ */ jsxs(CpslRow, __spreadProps(__spreadValues({ gap }, slot ? { slot } : {}), { children: [
36
+ /* @__PURE__ */ jsx(AssetIcon, { asset, size: "24px" }),
37
+ /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "contrast", style: fix ? { marginRight: "8px" } : void 0, children: getAssetCode(asset) })
38
+ ] }));
39
+ }
40
+ const NetworkLabel = /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "secondary", style: { margin: "0 8px" }, children: "Network" });
41
+ function AddFundsSettings() {
42
+ const isPresent = useIsPresent();
43
+ const hideWallets = useThemeStore((state) => state.hideWallets);
44
+ const setOnRampStep = useModalStore((state) => state.setOnRampStep);
45
+ const {
46
+ assets,
47
+ networks,
48
+ asset,
49
+ setAsset,
50
+ network,
51
+ setNetwork,
52
+ fiatQuantity,
53
+ setFiatQuantity,
54
+ onRampConfig,
55
+ activeWallet,
56
+ isProviderAllowed,
57
+ tab
58
+ } = useAddFunds();
59
+ const [value, setValue] = useState(parseFloat(fiatQuantity).toFixed(2) || "25.00");
60
+ const narrowedNetworks = useMemo(() => {
61
+ return !asset ? networks : getOnRampNetworks(onRampConfig.assetInfo, {
62
+ walletType: activeWallet.type,
63
+ allowed: onRampConfig.allowedAssets ? Object.entries(onRampConfig.allowedAssets).filter(([_, value2]) => value2 === true || value2.includes(asset)).map(([key]) => key) : void 0,
64
+ assets: [asset],
65
+ providers: onRampConfig.providers,
66
+ action: tab === EnabledFlow.BUY ? OnRampPurchaseType.BUY : OnRampPurchaseType.SELL
67
+ });
68
+ }, [networks, network, asset, activeWallet.type, onRampConfig.providers, tab]);
69
+ const content = useMemo(() => {
70
+ if (!!asset && Object.values(isProviderAllowed).every((v) => !v) || assets.length === 0) {
71
+ return /* @__PURE__ */ jsx(Container, __spreadProps(__spreadValues({}, contentMotionProps), { isPresent, children: /* @__PURE__ */ jsxs(NoProviders, { isHidden: Object.values(isProviderAllowed).some((v) => !!v), variant: "bodyM", children: [
72
+ "No providers are available for this ",
73
+ hideWallets ? "account" : "wallet"
74
+ ] }) }), "noProviders");
75
+ }
76
+ return !!asset ? /* @__PURE__ */ jsx(Container, __spreadProps(__spreadValues({}, contentMotionProps), { isPresent, children: assets.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
77
+ /* @__PURE__ */ jsxs(CpslRow, { children: [
78
+ /* @__PURE__ */ jsx(HeaderSelectContainer, { children: assets.length > 1 ? /* @__PURE__ */ jsxs(
79
+ HeaderSelect,
80
+ {
81
+ selectedValue: asset,
82
+ onCpslSelectValueChange: (e) => {
83
+ setAsset(e.detail);
84
+ },
85
+ showFormattedSelectedItem: true,
86
+ placeholder: "Choose asset...",
87
+ anchorElId: "inputContainer",
88
+ $width: 160,
89
+ autoWidth: true,
90
+ selectedItemVariant: "bodyXS",
91
+ children: [
92
+ asset && /* @__PURE__ */ jsx(AssetPill, { asset, slot: "selected-item" }),
93
+ assets.map((a) => /* @__PURE__ */ jsx(HeaderSelectItem, { slot: "items", value: a, children: /* @__PURE__ */ jsx(AssetPill, { gap: "8px", asset: a }) }, a))
94
+ ]
95
+ }
96
+ ) : /* @__PURE__ */ jsx(AssetPill, { asset, fix: true }) }),
97
+ /* @__PURE__ */ jsx(HeaderSelectContainer, { children: narrowedNetworks.length > 1 ? /* @__PURE__ */ jsxs(
98
+ HeaderSelect,
99
+ {
100
+ selectedValue: network,
101
+ onCpslSelectValueChange: (e) => {
102
+ setNetwork(e.detail);
103
+ },
104
+ showFormattedSelectedItem: true,
105
+ placeholder: "Choose network...",
106
+ $width: 160,
107
+ autoWidth: true,
108
+ selectedItemVariant: "bodyXS",
109
+ children: [
110
+ network && /* @__PURE__ */ jsx(NetworkPill, { network, start: NetworkLabel, slot: "selected-item" }),
111
+ narrowedNetworks.map((n) => /* @__PURE__ */ jsx(HeaderSelectItem, { slot: "items", value: n, children: /* @__PURE__ */ jsx(NetworkPill, { gap: "8px", network: n }) }, n))
112
+ ]
113
+ }
114
+ ) : network ? /* @__PURE__ */ jsx(NetworkPill, { network, start: NetworkLabel, fix: true }) : null })
115
+ ] }),
116
+ /* @__PURE__ */ jsxs(CpslRow, { col: true, gap: "16px", children: [
117
+ /* @__PURE__ */ jsx(
118
+ Input,
119
+ {
120
+ value: value || "",
121
+ fitContent: true,
122
+ autoselect: true,
123
+ onKeyDown: (e) => {
124
+ if (!/^(\d|\.)$/.test(e.key) && !["Delete", "Backspace", "Tab", "Shift"].includes(e.key)) {
125
+ e.preventDefault();
126
+ }
127
+ },
128
+ onChange: (e) => {
129
+ var _a;
130
+ const numericValue = (((_a = e.currentTarget) == null ? void 0 : _a.value) || "").replace(/[^0-9.]/g, "");
131
+ if (numericValue !== "") {
132
+ const formattedValue = parseFloat(numericValue).toFixed(2);
133
+ setValue(formattedValue);
134
+ } else {
135
+ setValue(null);
136
+ }
137
+ },
138
+ onBlur: (e) => {
139
+ const numericValue = (e.currentTarget.value || "").replace(/[^0-9.]/g, "");
140
+ if (numericValue === "") {
141
+ setValue(null);
142
+ } else {
143
+ setValue(parseFloat(numericValue).toFixed(2));
144
+ }
145
+ },
146
+ placeholder: "0",
147
+ children: /* @__PURE__ */ jsx(CurrencySign, { slot: "start", children: "$" })
148
+ },
149
+ value || ""
150
+ ),
151
+ /* @__PURE__ */ jsx(CpslRow, { style: { width: "100%" }, children: ["25", "50", "100"].map((quantity) => {
152
+ return /* @__PURE__ */ jsxs(PresetButton, { fullWidth: true, variant: "secondary", onClick: () => setValue(`${quantity}.00`), children: [
153
+ "$",
154
+ quantity
155
+ ] }, quantity);
156
+ }) })
157
+ ] }),
158
+ /* @__PURE__ */ jsxs(
159
+ CpslButton,
160
+ {
161
+ fullWidth: true,
162
+ disabled: value === "",
163
+ onClick: () => {
164
+ setFiatQuantity(value);
165
+ setOnRampStep(OnRampStep.PROVIDER);
166
+ },
167
+ children: [
168
+ "Continue",
169
+ /* @__PURE__ */ jsx(CpslIcon, { icon: "arrow" })
170
+ ]
171
+ }
172
+ )
173
+ ] }) }), "quantity") : /* @__PURE__ */ jsx(AssetContainer, __spreadProps(__spreadValues({}, contentMotionProps), { isPresent, children: /* @__PURE__ */ jsx(AddFundsAsset, {}) }), "asset");
174
+ }, [asset, network, assets, narrowedNetworks, isProviderAllowed, isPresent, value]);
175
+ useEffect(() => {
176
+ if (!network || !narrowedNetworks.includes(network)) {
177
+ setNetwork(narrowedNetworks[0]);
178
+ }
179
+ }, [narrowedNetworks, network, tab]);
180
+ useEffect(() => {
181
+ if (!!asset && !assets.includes(asset)) {
182
+ setAsset(assets[0]);
183
+ }
184
+ }, [assets, asset, tab]);
185
+ return /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: content });
186
+ }
187
+ const Container = styled(motion.div)`
188
+ width: 100%;
189
+ height: 100%;
190
+ align-self: center;
191
+ display: flex;
192
+ flex-direction: column;
193
+ align-items: center;
194
+ gap: 32px;
195
+ position: relative;
196
+ height: 320px;
197
+ ${({ isPresent }) => isPresent ? "transform: none !important;" : ""};
198
+
199
+ & > * {
200
+ width: 100%;
201
+ }
202
+ `;
203
+ const AssetContainer = styled(Container)`
204
+ gap: 8px;
205
+ `;
206
+ const CurrencySign = styled.div`
207
+ font-size: 72px;
208
+ color: var(--cpsl-color-text-primary);
209
+ position: relative;
210
+ right: -16px;
211
+ `;
212
+ const PresetButton = styled(CpslButton)`
213
+ --button-color: var(--cpsl-color-text-contrast);
214
+ --button-font-size: 24px;
215
+ --button-secondary-background-color: var(--cpsl-color-background-8);
216
+ --button-secondary-border-color: var(--cpsl-color-background-8);
217
+ --button-secondary-hover-color: var(--cpsl-color-text-contrast);
218
+ --button-secondary-hover-background-color: var(--cpsl-color-background-16);
219
+ --button-secondary-hover-border-color: var(--cpsl-color-background-16);
220
+ flex: 1;
221
+ `;
222
+ const Input = styled(CpslInput)`
223
+ --container-background-color: transparent;
224
+ --container-height: 90px;
225
+ --container-border-width: 0;
226
+ --input-background-color: transparent;
227
+ --input-font-size: 72px;
228
+ --input-text-align: center;
229
+ --input-width: 100%;
230
+ `;
231
+ export {
232
+ AddFundsSettings
233
+ };
@@ -0,0 +1,19 @@
1
+ export declare const contentMotionProps: {
2
+ transition: {
3
+ duration: number;
4
+ };
5
+ initial: {
6
+ opacity: number;
7
+ };
8
+ animate: {
9
+ opacity: number;
10
+ };
11
+ exit: {
12
+ opacity: number;
13
+ };
14
+ };
15
+ export declare const NoProviders: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<Omit<any, "ref"> & import("react").RefAttributes<any>, "ref"> & {
16
+ ref?: import("react").Ref<any>;
17
+ }, {
18
+ isHidden?: boolean;
19
+ }>> & string & Omit<import("react").ForwardRefExoticComponent<Omit<any, "ref"> & import("react").RefAttributes<any>>, keyof import("react").Component<any, {}, any>>;
@@ -0,0 +1,24 @@
1
+ "use client";
2
+ import "../../../chunk-MMUBH76A.js";
3
+ import { CpslText } from "@getpara/react-components";
4
+ import styled from "styled-components";
5
+ const contentMotionProps = {
6
+ transition: { duration: 0.2 },
7
+ initial: { opacity: 0 },
8
+ animate: { opacity: 1 },
9
+ exit: { opacity: 0 }
10
+ };
11
+ const NoProviders = styled(CpslText)`
12
+ width: 100%;
13
+ text-align: center;
14
+ visibility: ${({ isHidden }) => isHidden ? "hidden" : "visible"};
15
+ position: absolute;
16
+ top: 0;
17
+ left: 0;
18
+ right: 0;
19
+ transition: visibility 0.2s;
20
+ `;
21
+ export {
22
+ NoProviders,
23
+ contentMotionProps
24
+ };
@@ -1 +1,3 @@
1
- export declare const BiometricCreationStep: () => import("react/jsx-runtime").JSX.Element;
1
+ export declare const BiometricCreationStep: ({ twoFactorAuthEnabled }: {
2
+ twoFactorAuthEnabled?: boolean;
3
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -9,8 +9,8 @@ import { InnerStepContainer, StepContainer, Heading, QRContainer } from "../comm
9
9
  import { useCopyToClipboard, UserIdentifier } from "@getpara/react-common";
10
10
  import { useCreateAccount } from "../../hooks/useCreateAccount.js";
11
11
  import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
12
- const BiometricCreationStep = () => {
13
- const createAccount = useCreateAccount();
12
+ const BiometricCreationStep = ({ twoFactorAuthEnabled = false }) => {
13
+ const createAccount = useCreateAccount({ twoFactorAuthEnabled });
14
14
  const para = useInternalClient();
15
15
  const appName = useThemeStore((state) => state.appName);
16
16
  const webAuthURLForCreate = useModalStore((state) => state.webAuthURLForCreate);
@@ -117,7 +117,7 @@ const Body = ({ oAuthMethods, twoFactorAuthEnabled, disableEmailLogin, disablePh
117
117
  return /* @__PURE__ */ jsx(TwoFactorDoneStep, { onClose });
118
118
  }
119
119
  case ModalStep.BIOMETRIC_CREATION: {
120
- return /* @__PURE__ */ jsx(BiometricCreationStep, {});
120
+ return /* @__PURE__ */ jsx(BiometricCreationStep, { twoFactorAuthEnabled });
121
121
  }
122
122
  case ModalStep.AWAITING_OAUTH: {
123
123
  return /* @__PURE__ */ jsx(AwaitingOAuthStep, {});
@@ -131,7 +131,7 @@ const Body = ({ oAuthMethods, twoFactorAuthEnabled, disableEmailLogin, disablePh
131
131
  case ModalStep.ADD_FUNDS_BUY:
132
132
  case ModalStep.ADD_FUNDS_RECEIVE:
133
133
  case ModalStep.ADD_FUNDS_WITHDRAW: {
134
- return /* @__PURE__ */ jsx(AddFunds, {});
134
+ return /* @__PURE__ */ jsx(AddFunds, { "data-testid": "add-funds" });
135
135
  }
136
136
  case ModalStep.ADD_FUNDS_AWAITING: {
137
137
  return /* @__PURE__ */ jsx(AddFundsAwaiting, {});
@@ -5,15 +5,15 @@ import {
5
5
  __spreadValues
6
6
  } from "../../../chunk-MMUBH76A.js";
7
7
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
- import { CpslButton, CpslIcon, CpslIdenticon, CpslSelect, CpslSelectItem, CpslText } from "@getpara/react-components";
8
+ import { CpslButton, CpslIcon, CpslIdenticon, CpslText } from "@getpara/react-components";
9
9
  import { useExternalWallets } from "../../providers/ExternalWalletContext.js";
10
10
  import styled from "styled-components";
11
11
  import { useThemeStore } from "../../stores/index.js";
12
12
  import { truncateAddress, WalletType } from "@getpara/web-sdk";
13
13
  import { useEffect, useRef } from "react";
14
14
  import { useDropdownPosition } from "../AuthInput/hooks/useDropdownPosition.js";
15
- import { MOBILE_SIZE } from "../../constants/constants.js";
16
15
  import { useActiveWallet } from "../../hooks/useActiveWallet.js";
16
+ import { HeaderSelect, HeaderSelectContainer, HeaderSelectItem } from "../common.js";
17
17
  import { useWalletState } from "../../../provider/index.js";
18
18
  import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
19
19
  import { useCopyToClipboard } from "@getpara/react-common";
@@ -44,8 +44,8 @@ const ChainSelect = () => {
44
44
  }
45
45
  const chainIdToUse = chainIdSwitchingTo != null ? chainIdSwitchingTo : chainId;
46
46
  const selectedChainName = (_a = chains.find((c) => c.id.toString() === chainIdToUse)) == null ? void 0 : _a.name;
47
- return /* @__PURE__ */ jsx(Container, { children: /* @__PURE__ */ jsx(SelectContainer, { ref: containerRef, id: "inputContainer", children: /* @__PURE__ */ jsxs(
48
- StyledSelect,
47
+ return /* @__PURE__ */ jsx(Container, { children: /* @__PURE__ */ jsx(HeaderSelectContainer, { ref: containerRef, id: "inputContainer", children: /* @__PURE__ */ jsxs(
48
+ HeaderSelect,
49
49
  {
50
50
  selectedValue: (_b = chainIdToUse == null ? void 0 : chainIdToUse.toString()) != null ? _b : "",
51
51
  onCpslSelectValueChange: (e) => {
@@ -61,7 +61,7 @@ const ChainSelect = () => {
61
61
  selectedItemVariant: "bodyXS",
62
62
  children: [
63
63
  chainIdToUse && /* @__PURE__ */ jsx(ChainName, { variant: "bodyXS", color: "contrast", slot: "selected-item", children: selectedChainName }),
64
- chains == null ? void 0 : chains.map((chain) => /* @__PURE__ */ jsx(StyledSelectItem, { slot: "items", value: chain.id.toString(), children: /* @__PURE__ */ jsx(ChainName, { variant: "bodyXS", color: "contrast", children: chain.name }) }, chain.id))
64
+ chains == null ? void 0 : chains.map((chain) => /* @__PURE__ */ jsx(HeaderSelectItem, { slot: "items", value: chain.id.toString(), children: /* @__PURE__ */ jsx(ChainName, { variant: "bodyXS", color: "contrast", children: chain.name }) }, chain.id))
65
65
  ]
66
66
  }
67
67
  ) }) });
@@ -91,7 +91,7 @@ const AccountSelect = () => {
91
91
  copy(activeWallet.address ? para.getDisplayAddress(activeWallet.id, { addressType: activeWallet.type }) : "");
92
92
  };
93
93
  const ActiveWalletNode = activeWallet ? /* @__PURE__ */ jsxs(FlexRow, { slot: "selected-item", children: [
94
- /* @__PURE__ */ jsx(CpslIdenticon, { variant: "avatar", size: "14px", hash: para.getIdenticonHash(activeWallet.id, activeWallet.type) }),
94
+ /* @__PURE__ */ jsx(CpslIdenticon, { variant: "avatar", size: "24px", hash: para.getIdenticonHash(activeWallet.id, activeWallet.type) }),
95
95
  /* @__PURE__ */ jsx(WalletName, { variant: "bodyXS", color: "contrast", children: getName(para, __spreadProps(__spreadValues({}, activeWallet), { hideWallets })) }),
96
96
  !hideWallets && /* @__PURE__ */ jsxs(Fragment, { children: [
97
97
  /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "secondary", children: (_a = activeWallet.ensName) != null ? _a : para.getDisplayAddress(activeWallet.id, { truncate: true, addressType: activeWallet.type }) }),
@@ -116,8 +116,8 @@ const AccountSelect = () => {
116
116
  resize();
117
117
  }
118
118
  }, [activeWallet, para.availableWallets, dropdownMaxHeight]);
119
- return /* @__PURE__ */ jsx(Container, { children: /* @__PURE__ */ jsx(SelectContainer, { ref: containerRef, id: "addressInputContainer", children: para.availableWallets.length > 1 ? /* @__PURE__ */ jsxs(
120
- StyledSelect,
119
+ return /* @__PURE__ */ jsx(Container, { children: /* @__PURE__ */ jsx(HeaderSelectContainer, { ref: containerRef, id: "addressInputContainer", children: para.availableWallets.length > 1 ? /* @__PURE__ */ jsxs(
120
+ HeaderSelect,
121
121
  {
122
122
  selectedValue: getValue(activeWallet == null ? void 0 : activeWallet.id, activeWallet == null ? void 0 : activeWallet.type),
123
123
  onCpslSelectValueChange: (e) => {
@@ -137,7 +137,7 @@ const AccountSelect = () => {
137
137
  para.availableWallets.map(({ address, name: _name, id, type, isExternal }) => {
138
138
  const key = getValue(id, type);
139
139
  const name = _name != null ? _name : getName(para, { type, isExternal, isMenu: true, hideWallets });
140
- return /* @__PURE__ */ jsx(StyledSelectItem, { slot: "items", value: key, children: /* @__PURE__ */ jsxs(FlexRow, { children: [
140
+ return /* @__PURE__ */ jsx(HeaderSelectItem, { slot: "items", value: key, children: /* @__PURE__ */ jsxs(FlexRow, { children: [
141
141
  /* @__PURE__ */ jsx(CpslIdenticon, { size: "40px", hash: para.getIdenticonHash(id, type) }),
142
142
  /* @__PURE__ */ jsxs(FlexCol, { children: [
143
143
  name && /* @__PURE__ */ jsx(CpslText, { variant: "bodyS", color: "contrast", children: name }),
@@ -168,15 +168,6 @@ const FlexCol = styled.div`
168
168
  const WalletName = styled(CpslText)`
169
169
  white-space: nowrap;
170
170
  `;
171
- const SelectContainer = styled.div`
172
- position: relative;
173
- display: flex;
174
- align-items: center;
175
- gap: 8px;
176
- border-radius: 1000px;
177
- background-color: var(--cpsl-color-background-8);
178
- padding: 8px;
179
- `;
180
171
  const ChainName = styled(CpslText)`
181
172
  max-width: 150px;
182
173
  text-transform: capitalize;
@@ -187,47 +178,6 @@ const ChainName = styled(CpslText)`
187
178
  overflow: hidden;
188
179
  }
189
180
  `;
190
- const StyledSelect = styled(CpslSelect)`
191
- --container-height: auto;
192
- --container-border-width: 0px;
193
- --container-padding-end: 0px;
194
- --container-padding-start: 0px;
195
- --container-background-color: transparent;
196
- --container-box-shadow: none;
197
- --container-gap: 2px;
198
- --icon-width: 16px;
199
- --icon-height: 16px;
200
-
201
- &::part(selected-text) {
202
- white-space: nowrap;
203
- }
204
-
205
- &::part(dropdown) {
206
- min-width: ${({ $width }) => `${$width - 2}px`};
207
- }
208
-
209
- &::part(popover) {
210
- /* Have to adjust the top of the popover here since we're using a transform on the modal which causes fixed position items to not be relative to the viewport */
211
- @media (max-width: ${MOBILE_SIZE}px) {
212
- top: ${({ $top }) => $top ? `${$top}px` : "0px"};
213
- bottom: 16px;
214
- }
215
- cpsl-auth-modal.force-mobile-media & {
216
- top: ${({ $top }) => $top ? `${$top}px` : "0px"};
217
- bottom: 16px;
218
- }
219
- }
220
-
221
- &::part(icon) {
222
- --icon-color: var(--cpsl-color-contrast);
223
- }
224
- `;
225
- const StyledSelectItem = styled(CpslSelectItem)`
226
- --outer-container-padding-start: 4px;
227
- --outer-container-padding-end: 4px;
228
- --outer-container-padding-top: 4px;
229
- --outer-container-padding-bottom: 4px;
230
- `;
231
181
  export {
232
182
  AccountSelect,
233
183
  ChainSelect
@@ -77,7 +77,7 @@ const ModalContent = forwardRef(
77
77
  const authStepRoute = useModalStore((state) => state.authStepRoute);
78
78
  const isIFrameReady = useModalStore((state) => state.isIFrameReady);
79
79
  const goBack = useGoBack();
80
- const createAccount = useCreateAccount();
80
+ const createAccount = useCreateAccount({ twoFactorAuthEnabled });
81
81
  const biometricLocationHints = useModalStore((state) => {
82
82
  var _a2;
83
83
  return (_a2 = state.biometricLocationHints) != null ? _a2 : [];
@@ -128,7 +128,7 @@ const ModalContent = forwardRef(
128
128
  setPasswordUrlForLogin("");
129
129
  setSupportedAuthMethods(/* @__PURE__ */ new Set());
130
130
  setBiometricLocationHints();
131
- if (needsWallet) {
131
+ if (needsWallet && !para.isNoWalletConfig) {
132
132
  setStep(ModalStep.AWAITING_WALLET_CREATION);
133
133
  } else {
134
134
  yield connectEmbeddedToExternalConnectors();
@@ -49,7 +49,7 @@ const SharedWalletCard = ({ address, name, identiconHash, showAddFunds, id, type
49
49
  const onRampConfig = useModalStore((state) => state.onRampConfig);
50
50
  const { setSelectedWallet } = useWalletState();
51
51
  const setStep = useModalStore((state) => state.setStep);
52
- const isAddFundsEnabled = onRampConfig.isBuyEnabled || onRampConfig.isReceiveEnabled;
52
+ const isAddFundsEnabled = (onRampConfig == null ? void 0 : onRampConfig.isBuyEnabled) || (onRampConfig == null ? void 0 : onRampConfig.isReceiveEnabled);
53
53
  const handleAddFundsClick = () => {
54
54
  if (id && type) {
55
55
  setSelectedWallet({ id, type });
@@ -23,8 +23,8 @@ const WalletCreationDoneStep = ({ twoFactorAuthEnabled, onClose }) => {
23
23
  setStep(ModalStep.LOGIN_DONE);
24
24
  return;
25
25
  }
26
- const is2FAComplete = yield para.check2FAStatus();
27
- setStep(is2FAComplete ? ModalStep.LOGIN_DONE : ModalStep.SETUP_2FA);
26
+ const { isSetup: is2faComplete } = yield para.check2FAStatus();
27
+ setStep(is2faComplete ? ModalStep.LOGIN_DONE : ModalStep.SETUP_2FA);
28
28
  } else {
29
29
  if (twoFactorAuthEnabled) {
30
30
  setStep(ModalStep.SETUP_2FA);