@getpara/react-sdk-lite 2.8.0 → 2.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.
- package/dist/modal/ParaModal.js +1 -1
- package/dist/modal/components/Account/Account.js +17 -7
- package/dist/modal/components/Account/AccountProfile.js +30 -9
- package/dist/modal/components/Account/AccountSend/AccountSendForm.js +7 -1
- package/dist/modal/components/Account/AccountWallet.js +2 -0
- package/dist/modal/components/AddFunds/AddFunds.js +1 -4
- package/dist/modal/components/AddFunds/AddFundsAsset.js +25 -88
- package/dist/modal/components/AddFunds/AddFundsContext.d.ts +8 -2
- package/dist/modal/components/AddFunds/AddFundsContext.js +116 -22
- package/dist/modal/components/AddFunds/AddFundsNetwork.d.ts +1 -0
- package/dist/modal/components/AddFunds/AddFundsNetwork.js +31 -0
- package/dist/modal/components/AddFunds/AddFundsProvider.js +50 -65
- package/dist/modal/components/AddFunds/AddFundsReceive.js +4 -1
- package/dist/modal/components/AddFunds/AddFundsSettings.js +126 -143
- package/dist/modal/components/AuthInput/AuthInput.js +12 -1
- package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +32 -11
- package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +17 -8
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +25 -9
- package/dist/modal/components/Body/Body.js +3 -51
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +25 -8
- package/dist/modal/components/ExternalWallets/ExternalWallets.js +33 -13
- package/dist/modal/components/IFrameStep/IFrameStep.js +1 -1
- package/dist/modal/components/OAuth/OAuth.js +5 -3
- package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +15 -24
- package/dist/modal/components/QuantityInput.js +62 -9
- package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +4 -4
- package/dist/modal/components/SearchableButtonList.d.ts +2 -1
- package/dist/modal/components/SearchableButtonList.js +3 -1
- package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +6 -5
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +4 -2
- package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.js +2 -2
- package/dist/modal/components/common.d.ts +1 -1
- package/dist/modal/stores/modal/actions.js +2 -1
- package/dist/modal/stores/modal/useModalStore.d.ts +2 -0
- package/dist/modal/stores/modal/useModalStore.js +2 -1
- package/dist/modal/types/modalProps.d.ts +3 -1
- package/dist/modal/utils/validatePortalOrigin.js +6 -0
- package/dist/provider/ParaProviderMin.js +3 -0
- package/dist/provider/hooks/queries/useProfileBalance.js +33 -6
- package/dist/provider/hooks/utils/index.d.ts +1 -0
- package/dist/provider/hooks/utils/index.js +2 -0
- package/dist/provider/hooks/utils/useSetBalanceOverrides.d.ts +34 -0
- package/dist/provider/hooks/utils/useSetBalanceOverrides.js +12 -0
- package/dist/provider/stores/slices/modal.js +11 -1
- package/dist/provider/stores/types.d.ts +8 -0
- package/package.json +8 -8
- package/dist/modal/components/AddFunds/common.d.ts +0 -5
- package/dist/modal/components/AddFunds/common.js +0 -17
|
@@ -7,73 +7,69 @@ import {
|
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
import { safeStyled } from "@getpara/react-common";
|
|
9
9
|
import { contentMotionProps, Heading, InnerStepContainer } from "../common.js";
|
|
10
|
-
import { CpslText } from "@getpara/react-components";
|
|
11
10
|
import { useAddFunds } from "./AddFundsContext.js";
|
|
12
|
-
import { useModalStore } from "../../stores/index.js";
|
|
13
|
-
import { useStore } from "../../../provider/stores/useStore.js";
|
|
11
|
+
import { OnRampStep, useModalStore } from "../../stores/index.js";
|
|
14
12
|
import { motion, AnimatePresence } from "framer-motion";
|
|
15
13
|
import { OnRampProviderButton } from "../OnRampComponents/OnRampProviderButton.js";
|
|
16
14
|
import { useWallet } from "../../../provider/index.js";
|
|
17
15
|
import { EnabledFlow, OnRampPurchaseType } from "@getpara/web-sdk";
|
|
18
16
|
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
17
|
+
import { useEffect } from "react";
|
|
19
18
|
function AddFundsProvider() {
|
|
20
19
|
const para = useInternalClient();
|
|
21
|
-
const
|
|
22
|
-
var _a;
|
|
23
|
-
return (_a = state.modalConfig) == null ? void 0 : _a.hideWallets;
|
|
24
|
-
});
|
|
20
|
+
const setOnRampStep = useModalStore((state) => state.setOnRampStep);
|
|
25
21
|
const onRampConfig = useModalStore((state) => state.onRampConfig);
|
|
26
22
|
const setOnRampPurchase = useModalStore((state) => state.setOnRampPurchase);
|
|
27
|
-
const { asset, network, fiatQuantity, isProviderAllowed, tab } = useAddFunds();
|
|
23
|
+
const { asset, network, fiatQuantity, isProviderAllowed, tab, TestModeAlert, isTestMode } = useAddFunds();
|
|
28
24
|
const { data: activeWallet } = useWallet();
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (Object.values(isProviderAllowed).every((v) => !v)) {
|
|
27
|
+
setOnRampStep(OnRampStep.SETTINGS);
|
|
28
|
+
}
|
|
29
|
+
}, [isProviderAllowed]);
|
|
29
30
|
return /* @__PURE__ */ jsxs(Container, __spreadProps(__spreadValues({}, contentMotionProps), { children: [
|
|
30
31
|
/* @__PURE__ */ jsx(Heading, { children: "Choose Provider" }),
|
|
31
|
-
/* @__PURE__ */
|
|
32
|
-
/* @__PURE__ */
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
{
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
},
|
|
73
|
-
id
|
|
74
|
-
) : null;
|
|
75
|
-
}) : null })
|
|
76
|
-
] })
|
|
32
|
+
/* @__PURE__ */ jsx($InnerStepContainer, { children: /* @__PURE__ */ jsx(AnimatePresence, { children: onRampConfig ? onRampConfig.providers.map((id, index) => {
|
|
33
|
+
return isProviderAllowed[id] ? /* @__PURE__ */ jsx(
|
|
34
|
+
motion.div,
|
|
35
|
+
{
|
|
36
|
+
style: { width: "100%" },
|
|
37
|
+
layout: true,
|
|
38
|
+
initial: { opacity: 0, transform: "translateX(25px)" },
|
|
39
|
+
animate: { opacity: 1, transform: "none" },
|
|
40
|
+
exit: { opacity: 0, transform: "translateX(-25px)" },
|
|
41
|
+
transition: { duration: 0.2 },
|
|
42
|
+
children: /* @__PURE__ */ jsx(
|
|
43
|
+
OnRampProviderButton,
|
|
44
|
+
{
|
|
45
|
+
config: onRampConfig,
|
|
46
|
+
index,
|
|
47
|
+
onClick: () => __async(this, null, function* () {
|
|
48
|
+
if (!(activeWallet == null ? void 0 : activeWallet.type)) return;
|
|
49
|
+
const { onRampPurchase: newOnRampPurchase } = yield para.initiateOnRampTransaction({
|
|
50
|
+
walletId: activeWallet.isExternal ? void 0 : activeWallet.id,
|
|
51
|
+
externalWalletAddress: activeWallet.isExternal ? activeWallet.id : void 0,
|
|
52
|
+
shouldOpenPopup: true,
|
|
53
|
+
params: {
|
|
54
|
+
type: tab === EnabledFlow.BUY ? OnRampPurchaseType.BUY : OnRampPurchaseType.SELL,
|
|
55
|
+
walletType: activeWallet.type,
|
|
56
|
+
provider: id,
|
|
57
|
+
network,
|
|
58
|
+
asset: asset || void 0,
|
|
59
|
+
fiatQuantity,
|
|
60
|
+
testMode: isTestMode
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
setOnRampPurchase(__spreadProps(__spreadValues({}, newOnRampPurchase), { fiat: "USD" }));
|
|
64
|
+
})
|
|
65
|
+
},
|
|
66
|
+
id
|
|
67
|
+
)
|
|
68
|
+
},
|
|
69
|
+
id
|
|
70
|
+
) : null;
|
|
71
|
+
}) : null }) }),
|
|
72
|
+
TestModeAlert
|
|
77
73
|
] }));
|
|
78
74
|
}
|
|
79
75
|
const Container = safeStyled(motion.div)`
|
|
@@ -84,21 +80,10 @@ const Container = safeStyled(motion.div)`
|
|
|
84
80
|
flex-direction: column;
|
|
85
81
|
align-items: center;
|
|
86
82
|
gap: 8px;
|
|
87
|
-
height: 320px;
|
|
88
83
|
`;
|
|
89
84
|
const $InnerStepContainer = safeStyled(InnerStepContainer)`
|
|
90
85
|
position: relative;
|
|
91
86
|
`;
|
|
92
|
-
const NoProviders = safeStyled(CpslText)`
|
|
93
|
-
width: 100%;
|
|
94
|
-
text-align: center;
|
|
95
|
-
visibility: ${({ isHidden }) => isHidden ? "hidden" : "visible"};
|
|
96
|
-
position: absolute;
|
|
97
|
-
top: 0;
|
|
98
|
-
left: 0;
|
|
99
|
-
right: 0;
|
|
100
|
-
transition: visibility 0.2s;
|
|
101
|
-
`;
|
|
102
87
|
export {
|
|
103
88
|
AddFundsProvider
|
|
104
89
|
};
|
|
@@ -6,10 +6,11 @@ import { CenteredText, InnerStepContainer, QRContainer } from "../common.js";
|
|
|
6
6
|
import { isMobile } from "@getpara/web-sdk";
|
|
7
7
|
import { useModalStore } from "../../stores/index.js";
|
|
8
8
|
import { useMemo } from "react";
|
|
9
|
-
import { useWallet } from "../../../provider/hooks/index.js";
|
|
9
|
+
import { useAccount, useWallet } from "../../../provider/hooks/index.js";
|
|
10
10
|
import { useAddFunds } from "./AddFundsContext.js";
|
|
11
11
|
import { formatNetworkList } from "../../utils/stringFormatters.js";
|
|
12
12
|
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
13
|
+
import { WalletSelectOld } from "../WalletSelectOld/WalletSelectOld.js";
|
|
13
14
|
const GENERIC_WALLET = {
|
|
14
15
|
EVM: "Ethereum or EVM-based networks",
|
|
15
16
|
SOLANA: "Solana or SVM-based networks",
|
|
@@ -20,11 +21,13 @@ function AddFundsReceive() {
|
|
|
20
21
|
const para = useInternalClient();
|
|
21
22
|
const onRampConfig = useModalStore((state) => state.onRampConfig);
|
|
22
23
|
const { data: activeWallet } = useWallet();
|
|
24
|
+
const { embedded } = useAccount();
|
|
23
25
|
const address = useMemo(
|
|
24
26
|
() => activeWallet ? para.getDisplayAddress(activeWallet.id, { addressType: activeWallet.type }) : "",
|
|
25
27
|
[para, activeWallet == null ? void 0 : activeWallet.id, activeWallet == null ? void 0 : activeWallet.type]
|
|
26
28
|
);
|
|
27
29
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
30
|
+
(embedded == null ? void 0 : embedded.wallets) && embedded.wallets.length > 1 && /* @__PURE__ */ jsx(WalletSelectOld, { noTitle: true, style: { width: "100%" } }),
|
|
28
31
|
!isMobile() && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(InnerStepContainer, { children: /* @__PURE__ */ jsx(QRContainer, { children: !address ? /* @__PURE__ */ jsx(CpslSpinner, { size: 100 }) : /* @__PURE__ */ jsx(CpslQrCode, { url: address }, address) }) }) }),
|
|
29
32
|
(activeWallet == null ? void 0 : activeWallet.type) && /* @__PURE__ */ jsx(InnerStepContainer, { children: /* @__PURE__ */ jsxs(CenteredText, { variant: "bodyS", weight: "semiBold", children: [
|
|
30
33
|
"Only send funds on",
|
|
@@ -4,163 +4,149 @@ import {
|
|
|
4
4
|
__spreadValues
|
|
5
5
|
} from "../../../chunk-MMUBH76A.js";
|
|
6
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
import {
|
|
7
|
+
import { useMemo, useState } from "react";
|
|
8
8
|
import { useAddFunds } from "./AddFundsContext.js";
|
|
9
9
|
import { CpslButton, CpslIcon, CpslRow, CpslText } from "@getpara/react-components";
|
|
10
|
-
import {
|
|
11
|
-
AssetIcon,
|
|
12
|
-
contentMotionProps,
|
|
13
|
-
HeaderSelect,
|
|
14
|
-
HeaderSelectContainer,
|
|
15
|
-
HeaderSelectItem,
|
|
16
|
-
NetworkIcon
|
|
17
|
-
} from "../common.js";
|
|
10
|
+
import { AssetIcon, contentMotionProps } from "../common.js";
|
|
18
11
|
import { QuantityInput } from "../QuantityInput.js";
|
|
19
|
-
import {
|
|
12
|
+
import { formatAssetQuantity } from "@getpara/web-sdk";
|
|
20
13
|
import { OnRampStep, useModalStore } from "../../stores/index.js";
|
|
21
|
-
import { useStore } from "../../../provider/stores/useStore.js";
|
|
22
14
|
import { safeStyled, getAssetCode, getNetworkName } from "@getpara/react-common";
|
|
23
|
-
import { NoProviders } from "./common.js";
|
|
24
15
|
import { AnimatePresence, motion, useIsPresent } from "framer-motion";
|
|
25
16
|
import { AddFundsAsset } from "./AddFundsAsset.js";
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}) {
|
|
33
|
-
return /* @__PURE__ */ jsxs(CpslRow, __spreadProps(__spreadValues({ gap }, slot ? { slot } : {}), { children: [
|
|
34
|
-
start,
|
|
35
|
-
/* @__PURE__ */ jsx(NetworkIcon, { network, size: "24px" }),
|
|
36
|
-
/* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "contrast", style: fix ? { marginRight: "8px" } : void 0, children: getNetworkName(network) })
|
|
37
|
-
] }));
|
|
38
|
-
}
|
|
39
|
-
function AssetPill({ asset, gap = "4px", slot, fix }) {
|
|
40
|
-
if (!asset) {
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
return /* @__PURE__ */ jsxs(CpslRow, __spreadProps(__spreadValues({ gap }, slot ? { slot } : {}), { children: [
|
|
44
|
-
/* @__PURE__ */ jsx(AssetIcon, { asset, size: "24px" }),
|
|
45
|
-
/* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "contrast", style: fix ? { marginRight: "8px" } : void 0, children: getAssetCode(asset) })
|
|
46
|
-
] }));
|
|
47
|
-
}
|
|
48
|
-
const NetworkLabel = /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "secondary", style: { margin: "0 8px" }, children: "Network" });
|
|
17
|
+
import { WalletSelectOld } from "../WalletSelectOld/WalletSelectOld.js";
|
|
18
|
+
import { useAccount } from "../../../provider/index.js";
|
|
19
|
+
import { useDebounce } from "../../hooks/useDebounce.js";
|
|
20
|
+
import { useAssetInfo } from "../../../provider/hooks/utils/useAssetInfo.js";
|
|
21
|
+
import { AddFundsNetwork } from "./AddFundsNetwork.js";
|
|
22
|
+
import { useStore } from "../../../provider/stores/useStore.js";
|
|
49
23
|
function AddFundsSettings() {
|
|
50
|
-
const isPresent = useIsPresent();
|
|
51
24
|
const hideWallets = useStore((state) => {
|
|
52
25
|
var _a;
|
|
53
26
|
return (_a = state.modalConfig) == null ? void 0 : _a.hideWallets;
|
|
54
27
|
});
|
|
28
|
+
const assetInfo = useAssetInfo();
|
|
29
|
+
const isPresent = useIsPresent();
|
|
55
30
|
const setOnRampStep = useModalStore((state) => state.setOnRampStep);
|
|
31
|
+
const { embedded } = useAccount();
|
|
56
32
|
const {
|
|
57
33
|
assets,
|
|
58
|
-
|
|
34
|
+
narrowedNetworks,
|
|
59
35
|
asset,
|
|
60
36
|
setAsset,
|
|
61
37
|
network,
|
|
62
38
|
setNetwork,
|
|
63
39
|
fiatQuantity,
|
|
64
40
|
setFiatQuantity,
|
|
65
|
-
onRampConfig,
|
|
66
|
-
activeWallet,
|
|
67
41
|
isProviderAllowed,
|
|
68
|
-
|
|
42
|
+
settingsStep,
|
|
43
|
+
TestModeAlert
|
|
69
44
|
} = useAddFunds();
|
|
70
45
|
const [value, setValue] = useState(parseFloat(fiatQuantity || "25.00").toFixed(2));
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
providers: onRampConfig.providers,
|
|
77
|
-
action: tab === EnabledFlow.BUY ? OnRampPurchaseType.BUY : OnRampPurchaseType.SELL
|
|
78
|
-
});
|
|
79
|
-
}, [networks, network, asset, activeWallet == null ? void 0 : activeWallet.type, onRampConfig.providers, tab]);
|
|
80
|
-
const content = useMemo(() => {
|
|
81
|
-
if (!!asset && Object.values(isProviderAllowed).every((v) => !v) || assets.length === 0) {
|
|
82
|
-
return /* @__PURE__ */ jsx(Container, __spreadProps(__spreadValues({}, contentMotionProps), { isPresent, children: /* @__PURE__ */ jsxs(NoProviders, { isHidden: Object.values(isProviderAllowed).some((v) => !!v), variant: "bodyM", children: [
|
|
83
|
-
"No providers are available for this ",
|
|
84
|
-
hideWallets ? "account" : "wallet"
|
|
85
|
-
] }) }), "noProviders");
|
|
46
|
+
const dbValue = useDebounce(value, 200);
|
|
47
|
+
const assetQuantity = useMemo(() => {
|
|
48
|
+
var _a, _b, _c;
|
|
49
|
+
if (!asset) {
|
|
50
|
+
return -1;
|
|
86
51
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
{
|
|
92
|
-
selectedValue: asset,
|
|
93
|
-
onCpslSelectValueChange: (e) => {
|
|
94
|
-
setAsset(e.detail);
|
|
95
|
-
},
|
|
96
|
-
showFormattedSelectedItem: true,
|
|
97
|
-
placeholder: "Choose asset...",
|
|
98
|
-
anchorElId: "inputContainer",
|
|
99
|
-
$width: 160,
|
|
100
|
-
autoWidth: true,
|
|
101
|
-
selectedItemVariant: "bodyXS",
|
|
102
|
-
children: [
|
|
103
|
-
asset && /* @__PURE__ */ jsx(AssetPill, { asset, slot: "selected-item" }),
|
|
104
|
-
assets.map((a) => /* @__PURE__ */ jsx(HeaderSelectItem, { slot: "items", value: a, children: /* @__PURE__ */ jsx(AssetPill, { gap: "8px", asset: a }) }, a))
|
|
105
|
-
]
|
|
106
|
-
}
|
|
107
|
-
) : /* @__PURE__ */ jsx(AssetPill, { asset, fix: true }) }),
|
|
108
|
-
/* @__PURE__ */ jsx(HeaderSelectContainer, { children: narrowedNetworks.length > 1 ? /* @__PURE__ */ jsxs(
|
|
109
|
-
HeaderSelect,
|
|
110
|
-
{
|
|
111
|
-
selectedValue: network,
|
|
112
|
-
onCpslSelectValueChange: (e) => {
|
|
113
|
-
setNetwork(e.detail);
|
|
114
|
-
},
|
|
115
|
-
showFormattedSelectedItem: true,
|
|
116
|
-
placeholder: "Choose network...",
|
|
117
|
-
$width: 160,
|
|
118
|
-
autoWidth: true,
|
|
119
|
-
selectedItemVariant: "bodyXS",
|
|
120
|
-
children: [
|
|
121
|
-
network && /* @__PURE__ */ jsx(NetworkPill, { network, start: NetworkLabel, slot: "selected-item" }),
|
|
122
|
-
narrowedNetworks.map((n) => /* @__PURE__ */ jsx(HeaderSelectItem, { slot: "items", value: n, children: /* @__PURE__ */ jsx(NetworkPill, { gap: "8px", network: n }) }, n))
|
|
123
|
-
]
|
|
124
|
-
}
|
|
125
|
-
) : network ? /* @__PURE__ */ jsx(NetworkPill, { network, start: NetworkLabel, fix: true }) : null })
|
|
126
|
-
] }),
|
|
127
|
-
/* @__PURE__ */ jsxs(CpslRow, { col: true, gap: "16px", children: [
|
|
128
|
-
/* @__PURE__ */ jsx(QuantityInput, { value, onChange: setValue, symbol: "$" }),
|
|
129
|
-
/* @__PURE__ */ jsx(CpslRow, { style: { width: "100%" }, children: ["25", "50", "100"].map((quantity) => {
|
|
130
|
-
return /* @__PURE__ */ jsxs(PresetButton, { fullWidth: true, variant: "secondary", onClick: () => setValue(`${quantity}.00`), children: [
|
|
131
|
-
"$",
|
|
132
|
-
quantity
|
|
133
|
-
] }, quantity);
|
|
134
|
-
}) })
|
|
135
|
-
] }),
|
|
136
|
-
/* @__PURE__ */ jsxs(
|
|
137
|
-
CpslButton,
|
|
138
|
-
{
|
|
139
|
-
fullWidth: true,
|
|
140
|
-
disabled: value === "",
|
|
141
|
-
onClick: () => {
|
|
142
|
-
setFiatQuantity(value != null ? value : void 0);
|
|
143
|
-
setOnRampStep(OnRampStep.PROVIDER);
|
|
144
|
-
},
|
|
145
|
-
children: [
|
|
146
|
-
"Continue",
|
|
147
|
-
/* @__PURE__ */ jsx(CpslIcon, { icon: "arrow" })
|
|
148
|
-
]
|
|
149
|
-
}
|
|
150
|
-
)
|
|
151
|
-
] }) }), "quantity") : /* @__PURE__ */ jsx(AssetContainer, __spreadProps(__spreadValues({}, contentMotionProps), { isPresent, children: /* @__PURE__ */ jsx(AddFundsAsset, {}) }), "asset");
|
|
152
|
-
}, [asset, network, assets, narrowedNetworks, isProviderAllowed, isPresent, value]);
|
|
153
|
-
useEffect(() => {
|
|
154
|
-
if (!network || !narrowedNetworks.includes(network)) {
|
|
155
|
-
setNetwork(narrowedNetworks[0]);
|
|
52
|
+
const assetValue = (_c = (_b = (_a = assetInfo.data) == null ? void 0 : _a[asset]) == null ? void 0 : _b.price) == null ? void 0 : _c.value;
|
|
53
|
+
const dbValueFloat = !dbValue || isNaN(parseFloat(dbValue)) ? null : parseFloat(dbValue);
|
|
54
|
+
if (!assetValue || !asset || !dbValueFloat) {
|
|
55
|
+
return -1;
|
|
156
56
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
if (!!asset && !assets.includes(asset)) {
|
|
160
|
-
setAsset(assets[0]);
|
|
57
|
+
if (["TETHER", "USDC", "CUSD"].includes(asset)) {
|
|
58
|
+
return dbValueFloat;
|
|
161
59
|
}
|
|
162
|
-
|
|
163
|
-
|
|
60
|
+
return dbValueFloat / assetValue;
|
|
61
|
+
}, [asset, assetInfo, dbValue]);
|
|
62
|
+
const { key, Content } = useMemo(() => {
|
|
63
|
+
switch (settingsStep) {
|
|
64
|
+
case "NO_PROVIDERS":
|
|
65
|
+
return {
|
|
66
|
+
key: "noProviders",
|
|
67
|
+
Content: /* @__PURE__ */ jsxs(CpslText, { variant: "bodyM", color: "contrast", align: "center", children: [
|
|
68
|
+
"No providers are available for this ",
|
|
69
|
+
hideWallets ? "account" : "wallet"
|
|
70
|
+
] })
|
|
71
|
+
};
|
|
72
|
+
case "FORM": {
|
|
73
|
+
return {
|
|
74
|
+
key: "form",
|
|
75
|
+
Content: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
76
|
+
/* @__PURE__ */ jsxs(CpslRow, { col: true, gap: "8px", children: [
|
|
77
|
+
/* @__PURE__ */ jsx(QuantityInput, { value, onChange: setValue, symbol: "$" }),
|
|
78
|
+
/* @__PURE__ */ jsxs(
|
|
79
|
+
AssetButton,
|
|
80
|
+
{
|
|
81
|
+
variant: "tertiary",
|
|
82
|
+
onClick: network && (assets.length > 1 || narrowedNetworks.length > 1) ? () => {
|
|
83
|
+
switch (true) {
|
|
84
|
+
case assets.length === 1:
|
|
85
|
+
setNetwork(null);
|
|
86
|
+
break;
|
|
87
|
+
default:
|
|
88
|
+
setNetwork(null);
|
|
89
|
+
setAsset(null);
|
|
90
|
+
}
|
|
91
|
+
} : void 0,
|
|
92
|
+
children: [
|
|
93
|
+
/* @__PURE__ */ jsx(AssetIcon, { asset, size: "24px" }),
|
|
94
|
+
/* @__PURE__ */ jsx(CpslText, { variant: "bodyS", color: "contrast", children: assetQuantity > 0 ? formatAssetQuantity({ quantity: assetQuantity, symbol: getAssetCode(asset) }) : getAssetCode(asset) }),
|
|
95
|
+
/* @__PURE__ */ jsx(CpslIcon, { icon: "chevronRight", size: "24px", color: "var(--cpsl-color-text-contrast)" })
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
),
|
|
99
|
+
/* @__PURE__ */ jsxs(CpslText, { variant: "bodyXS", color: "secondary", children: [
|
|
100
|
+
"Network: ",
|
|
101
|
+
getNetworkName(network)
|
|
102
|
+
] })
|
|
103
|
+
] }),
|
|
104
|
+
/* @__PURE__ */ jsxs(
|
|
105
|
+
CpslButton,
|
|
106
|
+
{
|
|
107
|
+
fullWidth: true,
|
|
108
|
+
disabled: value === "",
|
|
109
|
+
onClick: () => {
|
|
110
|
+
setFiatQuantity(value != null ? value : void 0);
|
|
111
|
+
setOnRampStep(OnRampStep.PROVIDER);
|
|
112
|
+
},
|
|
113
|
+
children: [
|
|
114
|
+
"Continue",
|
|
115
|
+
/* @__PURE__ */ jsx(CpslIcon, { icon: "arrow" })
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
)
|
|
119
|
+
] })
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
case "ASSETS":
|
|
123
|
+
return {
|
|
124
|
+
key: "assets",
|
|
125
|
+
Content: /* @__PURE__ */ jsx(AddFundsAsset, {})
|
|
126
|
+
};
|
|
127
|
+
case "NETWORKS":
|
|
128
|
+
return {
|
|
129
|
+
key: "networks",
|
|
130
|
+
Content: /* @__PURE__ */ jsx(AddFundsNetwork, {})
|
|
131
|
+
};
|
|
132
|
+
default: {
|
|
133
|
+
return {
|
|
134
|
+
key: "default",
|
|
135
|
+
Content: "empty"
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}, [asset, network, assets, narrowedNetworks, isProviderAllowed, assetQuantity, isPresent, value, hideWallets]);
|
|
140
|
+
const isWalletSelectVisible = useMemo(() => {
|
|
141
|
+
return settingsStep && ["FORM", "NO_PROVIDERS"].includes(settingsStep) && (embedded == null ? void 0 : embedded.wallets) && embedded.wallets.length > 1;
|
|
142
|
+
}, [embedded, settingsStep]);
|
|
143
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
144
|
+
/* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
145
|
+
isWalletSelectVisible && /* @__PURE__ */ jsx(WalletSelectOld, { noTitle: true, style: { width: "100%" } }),
|
|
146
|
+
/* @__PURE__ */ jsx(Container, __spreadProps(__spreadValues({}, contentMotionProps), { isPresent, children: Content }), key)
|
|
147
|
+
] }) }),
|
|
148
|
+
TestModeAlert
|
|
149
|
+
] });
|
|
164
150
|
}
|
|
165
151
|
const Container = safeStyled(motion.div)`
|
|
166
152
|
width: 100%;
|
|
@@ -171,25 +157,22 @@ const Container = safeStyled(motion.div)`
|
|
|
171
157
|
align-items: center;
|
|
172
158
|
gap: 32px;
|
|
173
159
|
position: relative;
|
|
174
|
-
height: 320px;
|
|
175
160
|
${({ isPresent }) => isPresent ? "transform: none !important;" : ""};
|
|
176
161
|
|
|
177
162
|
& > * {
|
|
178
163
|
width: 100%;
|
|
179
164
|
}
|
|
180
165
|
`;
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
--button-
|
|
186
|
-
--button-
|
|
187
|
-
--button-
|
|
188
|
-
--button-
|
|
189
|
-
--button-
|
|
190
|
-
--button-
|
|
191
|
-
--button-secondary-hover-border-color: var(--cpsl-color-background-16);
|
|
192
|
-
flex: 1;
|
|
166
|
+
const AssetButton = safeStyled(CpslButton)`
|
|
167
|
+
--button-border-radius-top-start: 48px;
|
|
168
|
+
--button-border-radius-top-end: 48px;
|
|
169
|
+
--button-border-radius-bottom-start: 48px;
|
|
170
|
+
--button-border-radius-bottom-end: 48px;
|
|
171
|
+
--button-padding-top: 8px;
|
|
172
|
+
--button-padding-bottom: 8px;
|
|
173
|
+
--button-padding-start: 8px;
|
|
174
|
+
--button-padding-end: 8px;
|
|
175
|
+
--button-gap: 4px;
|
|
193
176
|
`;
|
|
194
177
|
export {
|
|
195
178
|
AddFundsSettings
|
|
@@ -199,7 +199,18 @@ const AuthInput = ({
|
|
|
199
199
|
}
|
|
200
200
|
)
|
|
201
201
|
] }),
|
|
202
|
-
identifier && !disableSubmitButton && /* @__PURE__ */ jsx(
|
|
202
|
+
identifier && !disableSubmitButton && /* @__PURE__ */ jsx(
|
|
203
|
+
CpslButton,
|
|
204
|
+
{
|
|
205
|
+
slot: "end",
|
|
206
|
+
size: "small",
|
|
207
|
+
fullWidth: true,
|
|
208
|
+
disabled: isPending,
|
|
209
|
+
onClick: onSubmit,
|
|
210
|
+
"data-testid": "para-auth-submit",
|
|
211
|
+
children: isPending ? /* @__PURE__ */ jsx(CpslSpinner, { size: 16 }) : /* @__PURE__ */ jsx(CpslIcon, { icon: "arrowNarrow" })
|
|
212
|
+
}
|
|
213
|
+
)
|
|
203
214
|
]
|
|
204
215
|
},
|
|
205
216
|
"email"
|
|
@@ -44,7 +44,7 @@ const AuthMainStepContent = ({
|
|
|
44
44
|
const methods = [];
|
|
45
45
|
if (isFarcasterMiniApp) {
|
|
46
46
|
methods.push([
|
|
47
|
-
/* @__PURE__ */ jsxs(FarcasterButton, { variant: "primary", fullWidth: true, onClick: connectFarcasterMiniApp, children: [
|
|
47
|
+
/* @__PURE__ */ jsxs(FarcasterButton, { variant: "primary", fullWidth: true, onClick: connectFarcasterMiniApp, "data-testid": "para-farcaster-connect", children: [
|
|
48
48
|
/* @__PURE__ */ jsx(CpslIcon, { slot: "start", icon: "farcaster" }),
|
|
49
49
|
"Continue with Farcaster"
|
|
50
50
|
] }),
|
|
@@ -73,11 +73,21 @@ const AuthMainStepContent = ({
|
|
|
73
73
|
const icons = [];
|
|
74
74
|
oAuthMethods == null ? void 0 : oAuthMethods.forEach((method) => icons.push(ACCOUNT_TYPES[method][useBrandedLogos ? "iconBranded" : "icon"]));
|
|
75
75
|
methods.push([
|
|
76
|
-
/* @__PURE__ */ jsxs(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
/* @__PURE__ */ jsxs(
|
|
77
|
+
CondensedButton,
|
|
78
|
+
{
|
|
79
|
+
onClick: handleCondensedAuthClick,
|
|
80
|
+
variant: "tertiary",
|
|
81
|
+
fullWidth: true,
|
|
82
|
+
"data-testid": "para-auth-condensed",
|
|
83
|
+
children: [
|
|
84
|
+
/* @__PURE__ */ jsx(IconGroupSpacer, { slot: "start", icons: [], $isDark: useDarkLogos }),
|
|
85
|
+
signUpOrLogInTitle,
|
|
86
|
+
/* @__PURE__ */ jsx(StyledIconGroup, { slot: "end", icons: icons.splice(0, 3), $isDark: useDarkLogos })
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
"authCondensed"
|
|
90
|
+
),
|
|
81
91
|
layout
|
|
82
92
|
]);
|
|
83
93
|
break;
|
|
@@ -92,11 +102,21 @@ const AuthMainStepContent = ({
|
|
|
92
102
|
const icons = [];
|
|
93
103
|
wallets == null ? void 0 : wallets.forEach((wallet) => icons.push(wallet.iconUrl));
|
|
94
104
|
methods.push([
|
|
95
|
-
/* @__PURE__ */ jsxs(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
105
|
+
/* @__PURE__ */ jsxs(
|
|
106
|
+
CondensedButton,
|
|
107
|
+
{
|
|
108
|
+
onClick: handleCondensedExternalClick,
|
|
109
|
+
variant: "tertiary",
|
|
110
|
+
fullWidth: true,
|
|
111
|
+
"data-testid": "para-wallet-condensed",
|
|
112
|
+
children: [
|
|
113
|
+
/* @__PURE__ */ jsx(IconGroupSpacer, { slot: "start", icons: [], $isDark: useDarkLogos }),
|
|
114
|
+
connectWalletTitle,
|
|
115
|
+
/* @__PURE__ */ jsx(StyledIconGroup, { slot: "end", icons: icons.splice(0, 3), $isDark: useDarkLogos })
|
|
116
|
+
]
|
|
117
|
+
},
|
|
118
|
+
"authCondensed"
|
|
119
|
+
),
|
|
100
120
|
layout
|
|
101
121
|
]);
|
|
102
122
|
break;
|
|
@@ -122,6 +142,7 @@ const AuthMainStepContent = ({
|
|
|
122
142
|
e.preventDefault();
|
|
123
143
|
createGuestWallets();
|
|
124
144
|
},
|
|
145
|
+
"data-testid": "para-guest-continue",
|
|
125
146
|
children: "Continue as Guest"
|
|
126
147
|
}
|
|
127
148
|
)
|
|
@@ -37,24 +37,33 @@ const BiometricCreationStep = () => {
|
|
|
37
37
|
/* @__PURE__ */ jsx(CpslText, { variant: "bodyS", color: "secondary", weight: "medium", children: isBoth ? `Choose a ${isPIN ? "PIN" : "password"} or set up a passkey` : "Your Passkey keeps your account safe." })
|
|
38
38
|
] }),
|
|
39
39
|
/* @__PURE__ */ jsxs(InnerStepContainer, { children: [
|
|
40
|
-
(signupState == null ? void 0 : signupState.isPasskeySupported) ? /* @__PURE__ */ jsxs(CpslButton, { fullWidth: true, onClick: onClick(AuthMethod.PASSKEY), children: [
|
|
40
|
+
(signupState == null ? void 0 : signupState.isPasskeySupported) ? /* @__PURE__ */ jsxs(CpslButton, { fullWidth: true, onClick: onClick(AuthMethod.PASSKEY), "data-testid": "para-create-passkey", children: [
|
|
41
41
|
/* @__PURE__ */ jsx(CpslIcon, { slot: "start", icon: "key" }),
|
|
42
42
|
isBoth ? "Create Passkey" : "Create"
|
|
43
43
|
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
44
44
|
/* @__PURE__ */ jsx(CpslText, { weight: "semiBold", children: "Scan with your mobile device" }),
|
|
45
|
-
/* @__PURE__ */ jsx(QRContainer, { children: !(signupState == null ? void 0 : signupState.passkeyUrl) ? /* @__PURE__ */ jsx(CpslSpinner, { size: 100 }) : /* @__PURE__ */ jsx(CpslQrCode, { url: signupState.passkeyUrl }) }),
|
|
46
|
-
/* @__PURE__ */ jsxs(CpslButton, { size: "small", variant: "ghost", onClick: handleCopy, children: [
|
|
45
|
+
/* @__PURE__ */ jsx(QRContainer, { children: !(signupState == null ? void 0 : signupState.passkeyUrl) ? /* @__PURE__ */ jsx(CpslSpinner, { size: 100 }) : /* @__PURE__ */ jsx(CpslQrCode, { url: signupState.passkeyUrl, "data-testid": "para-passkey-qr" }) }),
|
|
46
|
+
/* @__PURE__ */ jsxs(CpslButton, { size: "small", variant: "ghost", onClick: handleCopy, "data-testid": "para-passkey-copy-link", children: [
|
|
47
47
|
/* @__PURE__ */ jsx(CpslIcon, { slot: "start", icon: isCopied ? "check" : "copy" }),
|
|
48
48
|
isCopied ? "Copied" : "Copy Link"
|
|
49
49
|
] })
|
|
50
50
|
] }),
|
|
51
51
|
isBoth && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
52
52
|
/* @__PURE__ */ jsx(CpslDivider, { children: "or" }),
|
|
53
|
-
/* @__PURE__ */ jsxs(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
/* @__PURE__ */ jsxs(
|
|
54
|
+
CpslButton,
|
|
55
|
+
{
|
|
56
|
+
fullWidth: true,
|
|
57
|
+
onClick: onClick(isPIN ? AuthMethod.PIN : AuthMethod.PASSWORD),
|
|
58
|
+
disabled: !!authStepRoute,
|
|
59
|
+
"data-testid": "para-choose-password",
|
|
60
|
+
children: [
|
|
61
|
+
/* @__PURE__ */ jsx(CpslIcon, { slot: "start", icon: "passcode" }),
|
|
62
|
+
"Choose ",
|
|
63
|
+
isPIN ? "PIN" : "Password"
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
)
|
|
58
67
|
] })
|
|
59
68
|
] })
|
|
60
69
|
] });
|