@getpara/react-sdk-lite 2.0.0-alpha.39 → 2.0.0-alpha.41
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/css/modal.css +14 -1
- package/dist/modal/ParaModal.js +29 -6
- package/dist/modal/components/Account/Account.d.ts +1 -5
- package/dist/modal/components/Account/Account.js +53 -71
- package/dist/modal/components/Account/AccountHeader.d.ts +3 -0
- package/dist/modal/components/Account/AccountHeader.js +64 -0
- package/dist/modal/components/Account/AccountProfile.d.ts +4 -1
- package/dist/modal/components/Account/AccountProfile.js +114 -27
- package/dist/modal/components/AddFunds/AddFunds.js +11 -6
- package/dist/modal/components/AddFunds/AddFundsAsset.js +5 -32
- package/dist/modal/components/AddFunds/AddFundsDone.js +1 -1
- package/dist/modal/components/AddFunds/AddFundsProvider.js +1 -1
- package/dist/modal/components/AddFunds/AddFundsReceive.js +8 -53
- package/dist/modal/components/AuthMainStep/AuthMainStep.js +3 -5
- package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +4 -3
- package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.js +4 -1
- package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +7 -5
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +4 -4
- package/dist/modal/components/Body/AnimatedHeightWrapper.d.ts +1 -0
- package/dist/modal/components/Body/AnimatedHeightWrapper.js +2 -2
- package/dist/modal/components/Body/Body.d.ts +3 -1
- package/dist/modal/components/Body/Body.js +40 -47
- package/dist/modal/components/ChainSwitch/ChainSwitch.js +13 -21
- package/dist/modal/components/Controls/{Selects.d.ts → ChainSelect.d.ts} +0 -1
- package/dist/modal/components/Controls/ChainSelect.js +88 -0
- package/dist/modal/components/Controls/Controls.js +10 -20
- package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.js +1 -1
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +17 -12
- package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.js +1 -1
- package/dist/modal/components/Footer/Footer.js +26 -57
- package/dist/modal/components/Header/Header.js +46 -8
- package/dist/modal/components/Header/hooks/useStepTitle.d.ts +4 -0
- package/dist/modal/components/Header/hooks/useStepTitle.js +48 -15
- package/dist/modal/components/IFrameStep/IFrameStep.js +22 -10
- package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +16 -10
- package/dist/modal/components/ModalContent/ModalContent.d.ts +4 -3
- package/dist/modal/components/ModalContent/ModalContent.js +5 -1
- package/dist/modal/components/OAuth/FarcasterOAuthStep.js +1 -1
- package/dist/modal/components/OAuth/OAuth.js +1 -1
- package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +2 -2
- package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +3 -3
- package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +1 -1
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +1 -1
- package/dist/modal/components/Waiting/Waiting.js +1 -1
- package/dist/modal/components/WalletCard/WalletCard.d.ts +6 -3
- package/dist/modal/components/WalletCard/WalletCard.js +41 -15
- package/dist/modal/components/WalletSelect/WalletSelect.d.ts +11 -0
- package/dist/modal/components/WalletSelect/WalletSelect.js +153 -0
- package/dist/modal/components/common.d.ts +9 -4
- package/dist/modal/components/common.js +67 -13
- package/dist/modal/constants/constants.d.ts +7 -12
- package/dist/modal/constants/constants.js +7 -1
- package/dist/modal/constants/oAuthLogos.d.ts +2 -6
- package/dist/modal/constants/oAuthLogos.js +45 -43
- package/dist/modal/hooks/useGoBack.js +9 -0
- package/dist/modal/types/commonTypes.d.ts +9 -0
- package/dist/modal/utils/getWalletDisplayName.js +3 -6
- package/dist/modal/utils/icons.d.ts +5 -0
- package/dist/modal/utils/icons.js +17 -0
- package/dist/provider/ParaProvider.js +24 -129
- package/dist/provider/ParaProviderMin.d.ts +4 -0
- package/dist/provider/ParaProviderMin.js +140 -0
- package/dist/provider/components/CosmosWalletWrapper.d.ts +1 -1
- package/dist/provider/components/EvmWalletWrapper.d.ts +1 -1
- package/dist/provider/components/ExternalWalletWrapper.js +3 -36
- package/dist/provider/components/SolanaWalletWrapper.d.ts +1 -1
- package/dist/provider/hooks/mutations/useCreateWallet.d.ts +3 -3
- package/dist/provider/hooks/mutations/useCreateWallet.js +1 -1
- package/dist/provider/hooks/mutations/useCreateWalletPerType.d.ts +3 -3
- package/dist/provider/hooks/mutations/useCreateWalletPerType.js +1 -1
- package/dist/provider/hooks/mutations/useIssueJwt.d.ts +3 -3
- package/dist/provider/hooks/mutations/useIssueJwt.js +1 -1
- package/dist/provider/hooks/mutations/useResendVerificationCode.d.ts +6 -6
- package/dist/provider/hooks/mutations/useResendVerificationCode.js +1 -1
- package/dist/provider/hooks/mutations/useVerifyExternalWallet.d.ts +4 -42
- package/dist/provider/hooks/mutations/useVerifyFarcaster.d.ts +3 -3
- package/dist/provider/hooks/mutations/useVerifyFarcaster.js +1 -1
- package/dist/provider/hooks/mutations/useVerifyNewAccount.d.ts +6 -0
- package/dist/provider/hooks/mutations/useWaitForLogin.d.ts +3 -3
- package/dist/provider/hooks/mutations/useWaitForLogin.js +1 -1
- package/dist/provider/hooks/mutations/useWaitForSignup.d.ts +3 -3
- package/dist/provider/hooks/mutations/useWaitForSignup.js +1 -1
- package/dist/provider/hooks/mutations/useWaitForWalletCreation.d.ts +3 -3
- package/dist/provider/hooks/mutations/useWaitForWalletCreation.js +1 -1
- package/dist/provider/index.d.ts +1 -0
- package/dist/provider/index.js +3 -1
- package/dist/provider/providers/AccountLinkProvider.js +8 -4
- package/dist/provider/providers/AuthProvider.js +28 -14
- package/dist/provider/providers/CosmosExternalWalletProvider.d.ts +1 -1
- package/dist/provider/providers/CosmosExternalWalletProvider.js +3 -0
- package/dist/provider/providers/EvmExternalWalletProvider.d.ts +1 -1
- package/dist/provider/providers/EvmExternalWalletProvider.js +3 -0
- package/dist/provider/providers/ExternalWalletProvider.js +1 -1
- package/dist/provider/providers/SolanaExternalWalletProvider.d.ts +1 -1
- package/dist/provider/providers/SolanaExternalWalletProvider.js +3 -0
- package/dist/provider/stores/slices/modal.js +16 -12
- package/dist/provider/utils/constants.d.ts +5 -0
- package/dist/provider/utils/constants.js +64 -1
- package/dist/public/PPMori-Regular.woff2 +0 -0
- package/dist/public/PPMori-SemiBold.woff2 +0 -0
- package/package.json +8 -8
- package/dist/modal/components/Controls/Selects.js +0 -173
- package/dist/provider/utils/externalWalletDefaults.d.ts +0 -6
- package/dist/provider/utils/externalWalletDefaults.js +0 -33
package/dist/css/modal.css
CHANGED
|
@@ -5,9 +5,22 @@
|
|
|
5
5
|
src: url('../public/Inter-VariableFont_slnt,wght.ttf') format('truetype');
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
+
@font-face {
|
|
9
|
+
font-family: 'PP Mori';
|
|
10
|
+
src: url('../public/PPMori-Regular.woff2') format('woff2');
|
|
11
|
+
font-weight: 500;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@font-face {
|
|
15
|
+
font-family: 'PP Mori';
|
|
16
|
+
src: url('../public/PPMori-SemiBold.woff2') format('woff2');
|
|
17
|
+
font-weight: 600;
|
|
18
|
+
}
|
|
19
|
+
|
|
8
20
|
html {
|
|
9
21
|
--cpsl-default-font: 'Inter', sans-serif;
|
|
10
22
|
-webkit-overflow-scrolling: touch;
|
|
11
23
|
|
|
12
|
-
--wcm-z-index:
|
|
24
|
+
--wcm-z-index: 99999 !important;
|
|
25
|
+
--w3m-z-index: 99999 !important;
|
|
13
26
|
}
|
package/dist/modal/ParaModal.js
CHANGED
|
@@ -49,10 +49,11 @@ const ParaModal = forwardRef((props, ref) => {
|
|
|
49
49
|
const setAuthStepRoute = useModalStore((state) => state.setAuthStepRoute);
|
|
50
50
|
const { signUpOrLogIn, isCreateGuestWalletsPending } = useAuthActions();
|
|
51
51
|
const { isReady, isFarcasterMiniApp } = useParaStatus();
|
|
52
|
-
const { isLoading: isAccountLoading, isConnected } = useAccount();
|
|
52
|
+
const { isLoading: isAccountLoading, isConnected, embedded } = useAccount();
|
|
53
53
|
const setIFrameUrl = useModalStore((state) => state.setIFrameUrl);
|
|
54
54
|
const setIsIFrameReady = useModalStore((state) => state.setIsIFrameReady);
|
|
55
55
|
const [isModalMounted, setIsModalMounted] = useState(false);
|
|
56
|
+
const [isDisconnecting, setIsDisconnecting] = useState(false);
|
|
56
57
|
const externalWallets = useStore((state) => state.externalWallets);
|
|
57
58
|
const providerProps = useStore((state) => state.providerProps);
|
|
58
59
|
const setAccountLinkOptions = useModalStore((state) => state.setAccountLinkOptions);
|
|
@@ -191,11 +192,13 @@ const ParaModal = forwardRef((props, ref) => {
|
|
|
191
192
|
initModal(isOpen);
|
|
192
193
|
isInitialized.current = true;
|
|
193
194
|
}
|
|
194
|
-
if (isReady && !isOpen && isInitialized.current) {
|
|
195
|
-
|
|
196
|
-
|
|
195
|
+
if (!bareModal && isReady && !isOpen && isInitialized.current) {
|
|
196
|
+
setTimeout(() => {
|
|
197
|
+
initModal();
|
|
198
|
+
isInitialized.current = false;
|
|
199
|
+
}, 250);
|
|
197
200
|
}
|
|
198
|
-
}, [isReady, isOpen, isAccountLoading]);
|
|
201
|
+
}, [bareModal, isReady, isOpen, isAccountLoading]);
|
|
199
202
|
useEffect(() => {
|
|
200
203
|
let _authLayout = authLayout;
|
|
201
204
|
if (!(externalWallets == null ? void 0 : externalWallets.length) && hasExternalWallet(authLayout)) {
|
|
@@ -231,6 +234,24 @@ const ParaModal = forwardRef((props, ref) => {
|
|
|
231
234
|
closeModal();
|
|
232
235
|
onClose == null ? void 0 : onClose();
|
|
233
236
|
};
|
|
237
|
+
const handleDisconnect = () => __async(void 0, null, function* () {
|
|
238
|
+
setIsDisconnecting(true);
|
|
239
|
+
handleClose();
|
|
240
|
+
const reset = () => __async(void 0, null, function* () {
|
|
241
|
+
yield para.logout({ clearPregenWallets: embedded == null ? void 0 : embedded.isGuestMode });
|
|
242
|
+
yield disconnectExternalWallet();
|
|
243
|
+
setStep(ModalStep.AUTH_MAIN);
|
|
244
|
+
setFlow(void 0);
|
|
245
|
+
setIsDisconnecting(false);
|
|
246
|
+
});
|
|
247
|
+
if (bareModal) {
|
|
248
|
+
reset();
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
setTimeout(() => {
|
|
252
|
+
reset();
|
|
253
|
+
}, 250);
|
|
254
|
+
});
|
|
234
255
|
const handleModalEntering = () => {
|
|
235
256
|
setIsModalMounted(true);
|
|
236
257
|
};
|
|
@@ -285,7 +306,9 @@ const ParaModal = forwardRef((props, ref) => {
|
|
|
285
306
|
disableEmailLogin,
|
|
286
307
|
disablePhoneLogin,
|
|
287
308
|
isGuestModeEnabled,
|
|
288
|
-
onClose: handleClose
|
|
309
|
+
onClose: handleClose,
|
|
310
|
+
onDisconnect: handleDisconnect,
|
|
311
|
+
isDisconnecting
|
|
289
312
|
}, rest)
|
|
290
313
|
)
|
|
291
314
|
}
|
|
@@ -1,37 +1,26 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
__async
|
|
4
|
-
} from "../../../chunk-MMUBH76A.js";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
5
3
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
4
|
import { safeStyled } from "@getpara/react-common";
|
|
7
|
-
import { InnerStepContainer, StepContainer
|
|
8
|
-
import { CpslButton, CpslIcon, CpslSpinner, CpslText } from "@getpara/react-components";
|
|
5
|
+
import { InnerStepContainer, StepContainer } from "../common.js";
|
|
6
|
+
import { CpslButton, CpslIcon, CpslSpinner, CpslText, CpslTileButton } from "@getpara/react-components";
|
|
9
7
|
import { OnRampStep, useModalStore } from "../../stores/index.js";
|
|
10
|
-
import { useEffect
|
|
8
|
+
import { useEffect } from "react";
|
|
11
9
|
import { ModalStep } from "../../utils/steps.js";
|
|
12
10
|
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
13
|
-
import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
|
|
14
|
-
import { useStore } from "../../../provider/stores/useStore.js";
|
|
15
|
-
import { formatBalanceString } from "../../utils/stringFormatters.js";
|
|
16
11
|
import { useAccount, useWalletBalance } from "../../../provider/index.js";
|
|
17
12
|
import { EnabledFlow } from "@getpara/web-sdk";
|
|
18
13
|
import { useAccountLinking } from "../../../provider/providers/AccountLinkProvider.js";
|
|
19
|
-
|
|
14
|
+
import { AccountHeader } from "./AccountHeader.js";
|
|
15
|
+
const Account = () => {
|
|
20
16
|
const onRampConfig = useModalStore((state) => state.onRampConfig);
|
|
21
17
|
const setStep = useModalStore((state) => state.setStep);
|
|
22
|
-
const setFlow = useModalStore((state) => state.setFlow);
|
|
23
18
|
const setGuestAddFundsTab = useModalStore((state) => state.setGuestAddFundsTab);
|
|
24
19
|
const setOnRampStep = useModalStore((state) => state.setOnRampStep);
|
|
25
|
-
const hideWallets = useStore((state) => {
|
|
26
|
-
var _a;
|
|
27
|
-
return (_a = state.modalConfig) == null ? void 0 : _a.hideWallets;
|
|
28
|
-
});
|
|
29
|
-
const { disconnectExternalWallet } = useExternalWallets();
|
|
30
20
|
const para = useInternalClient();
|
|
31
21
|
const { embedded } = useAccount();
|
|
32
|
-
const { data: balance
|
|
22
|
+
const { data: balance } = useWalletBalance();
|
|
33
23
|
const { isEnabled } = useAccountLinking();
|
|
34
|
-
const [isDisconnecting, setIsDisconnecting] = useState(false);
|
|
35
24
|
const isGuestMode = embedded.isConnected && embedded.isGuestMode;
|
|
36
25
|
const cantBuyAndWithdraw = (para.externalWalletConnectionType === "CONNECTION_ONLY" || para.externalWalletConnectionType === "VERIFICATION") && !para.userId;
|
|
37
26
|
const isOnRampLoaded = !!onRampConfig;
|
|
@@ -60,49 +49,38 @@ const Account = ({ onClose }) => {
|
|
|
60
49
|
const handleProfileClick = () => {
|
|
61
50
|
setStep(ModalStep.ACCOUNT_PROFILE);
|
|
62
51
|
};
|
|
63
|
-
const handleDisconnectClick = () => __async(void 0, null, function* () {
|
|
64
|
-
setIsDisconnecting(true);
|
|
65
|
-
yield para.logout();
|
|
66
|
-
yield disconnectExternalWallet();
|
|
67
|
-
onClose();
|
|
68
|
-
setStep(ModalStep.AUTH_MAIN);
|
|
69
|
-
setFlow(void 0);
|
|
70
|
-
setIsDisconnecting(false);
|
|
71
|
-
});
|
|
72
52
|
useEffect(() => {
|
|
73
53
|
setGuestAddFundsTab();
|
|
74
54
|
}, []);
|
|
75
|
-
return /* @__PURE__ */ jsx(StepContainer, { $wide: true, children: /* @__PURE__ */ jsxs(InnerStepContainer, { children: [
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
/* @__PURE__ */
|
|
80
|
-
|
|
55
|
+
return /* @__PURE__ */ jsx(StepContainer, { $wide: true, children: /* @__PURE__ */ jsxs($InnerStepContainer, { children: [
|
|
56
|
+
/* @__PURE__ */ jsx(AccountHeader, { withBalance: true }),
|
|
57
|
+
/* @__PURE__ */ jsxs(LowerContainer, { children: [
|
|
58
|
+
isGuestMode && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
59
|
+
balance && parseFloat(balance) > 0 && /* @__PURE__ */ jsxs(Alert, { children: [
|
|
60
|
+
/* @__PURE__ */ jsx(CpslIcon, { icon: "alertTriangle", size: "24px", style: { color: "var(--cpsl-color-utility-yellow)" } }),
|
|
61
|
+
"You've funded this account - complete account setup to maintain access."
|
|
62
|
+
] }),
|
|
63
|
+
/* @__PURE__ */ jsxs(
|
|
64
|
+
CpslButton,
|
|
65
|
+
{
|
|
66
|
+
fullWidth: true,
|
|
67
|
+
variant: "primary",
|
|
68
|
+
onClick: () => {
|
|
69
|
+
setStep(ModalStep.AUTH_GUEST_SIGNUP);
|
|
70
|
+
},
|
|
71
|
+
children: [
|
|
72
|
+
/* @__PURE__ */ jsx(CpslIcon, { icon: "stars02" }),
|
|
73
|
+
"Complete Account Setup"
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
)
|
|
81
77
|
] }),
|
|
82
|
-
/* @__PURE__ */ jsxs(
|
|
83
|
-
|
|
84
|
-
{
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
setStep(ModalStep.AUTH_GUEST_SIGNUP);
|
|
89
|
-
},
|
|
90
|
-
children: [
|
|
91
|
-
/* @__PURE__ */ jsx(CpslIcon, { icon: "stars02" }),
|
|
92
|
-
"Complete Account Setup"
|
|
93
|
-
]
|
|
94
|
-
}
|
|
95
|
-
)
|
|
96
|
-
] }),
|
|
97
|
-
/* @__PURE__ */ jsx(ButtonContainer, { children: isOnRampLoaded ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
98
|
-
onRampConfig.isBuyEnabled && !cantBuyAndWithdraw && /* @__PURE__ */ jsx(OptionButton, { icon: "creditCard", onClick: handleBuyClick, children: /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "secondary", weight: "medium", children: "Receive" }) }),
|
|
99
|
-
onRampConfig.isWithdrawEnabled && !cantBuyAndWithdraw && /* @__PURE__ */ jsx(OptionButton, { icon: "arrowCircleBrokenDownLeft", onClick: handleSellClick, children: /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "secondary", weight: "medium", children: "Withdraw" }) }),
|
|
100
|
-
/* @__PURE__ */ jsx(OptionButton, { icon: "user", onClick: handleProfileClick, children: /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "secondary", weight: "medium", children: isEnabled ? "Profile" : "Settings" }) })
|
|
101
|
-
] }) : /* @__PURE__ */ jsx(CpslSpinner, {}) }),
|
|
102
|
-
!isGuestMode && /* @__PURE__ */ jsx(DisconnectButton, { variant: "destructive", fullWidth: true, onClick: handleDisconnectClick, disabled: isDisconnecting, children: isDisconnecting ? /* @__PURE__ */ jsx(CpslSpinner, { size: 16 }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
103
|
-
hideWallets ? "Logout" : "Disconnect Wallet",
|
|
104
|
-
/* @__PURE__ */ jsx(CpslIcon, { icon: "logOut", slot: "end" })
|
|
105
|
-
] }) })
|
|
78
|
+
/* @__PURE__ */ jsx(ButtonContainer, { children: isOnRampLoaded ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
79
|
+
onRampConfig.isBuyEnabled && !cantBuyAndWithdraw && /* @__PURE__ */ jsx(OptionButton, { icon: "plusCircle", onClick: handleBuyClick, children: /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "secondary", weight: "medium", children: "Add Funds" }) }),
|
|
80
|
+
onRampConfig.isWithdrawEnabled && !cantBuyAndWithdraw && /* @__PURE__ */ jsx(OptionButton, { icon: "arrowCircleDown", onClick: handleSellClick, children: /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "secondary", weight: "medium", children: "Withdraw" }) }),
|
|
81
|
+
/* @__PURE__ */ jsx(OptionButton, { icon: "user01", onClick: handleProfileClick, children: /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "secondary", weight: "medium", children: isEnabled ? "Profile" : "Settings" }) })
|
|
82
|
+
] }) : /* @__PURE__ */ jsx(CpslSpinner, {}) })
|
|
83
|
+
] })
|
|
106
84
|
] }) });
|
|
107
85
|
};
|
|
108
86
|
const ButtonContainer = safeStyled.div`
|
|
@@ -111,23 +89,21 @@ const ButtonContainer = safeStyled.div`
|
|
|
111
89
|
justify-content: center;
|
|
112
90
|
gap: 8px;
|
|
113
91
|
width: 100%;
|
|
114
|
-
height: 88px;
|
|
115
92
|
`;
|
|
116
|
-
const OptionButton = safeStyled(
|
|
93
|
+
const OptionButton = safeStyled(CpslTileButton)`
|
|
94
|
+
--button-gap: 4px;
|
|
95
|
+
--button-width: 100%;
|
|
96
|
+
--button-icon-height: 24px;
|
|
97
|
+
--button-icon-width: 24px;
|
|
98
|
+
--button-padding-top: 12px;
|
|
99
|
+
--button-padding-bottom: 12px;
|
|
100
|
+
--button-icon-color: var(--cpsl-color-text-contrast);
|
|
101
|
+
--button-height: auto;
|
|
117
102
|
flex: 1;
|
|
118
|
-
|
|
119
|
-
--button-icon-color: var(--cpsl-color-text-primary);
|
|
120
|
-
`;
|
|
121
|
-
const DisconnectButton = safeStyled(CpslButton)`
|
|
122
|
-
--button-border-width: 0px;
|
|
123
|
-
`;
|
|
124
|
-
const BalanceContainer = safeStyled.div`
|
|
125
|
-
display: flex;
|
|
126
|
-
justify-content: center;
|
|
127
|
-
align-items: center;
|
|
128
|
-
padding-top: 8px;
|
|
129
|
-
padding-bottom: 24px;
|
|
130
103
|
`;
|
|
104
|
+
const $InnerStepContainer = safeStyled(InnerStepContainer)`
|
|
105
|
+
gap: 24px;
|
|
106
|
+
`;
|
|
131
107
|
const Alert = safeStyled.div`
|
|
132
108
|
--icon-color: var(--cpsl-color-utility-yellow);
|
|
133
109
|
--icon-stroke-color: var(--cpsl-color-utility-yellow);
|
|
@@ -143,6 +119,12 @@ const Alert = safeStyled.div`
|
|
|
143
119
|
background: var(--cpsl-color-utility-yellow-light);
|
|
144
120
|
font-size: 14px;
|
|
145
121
|
`;
|
|
122
|
+
const LowerContainer = safeStyled.div`
|
|
123
|
+
display: flex;
|
|
124
|
+
flex-direction: column;
|
|
125
|
+
gap: 8px;
|
|
126
|
+
width: 100%;
|
|
127
|
+
`;
|
|
146
128
|
export {
|
|
147
129
|
Account
|
|
148
130
|
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { safeStyled } from "@getpara/react-common";
|
|
5
|
+
import { formatBalanceString } from "../../utils/stringFormatters.js";
|
|
6
|
+
import { CpslIcon, CpslText } from "@getpara/react-components";
|
|
7
|
+
import { useMemo } from "react";
|
|
8
|
+
import { truncateAddress } from "@getpara/web-sdk";
|
|
9
|
+
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
10
|
+
import { getExternalWalletIcon } from "../../utils/icons.js";
|
|
11
|
+
import { useWalletBalance } from "../../../provider/index.js";
|
|
12
|
+
const Balance = () => {
|
|
13
|
+
const { data: balance } = useWalletBalance();
|
|
14
|
+
return /* @__PURE__ */ jsx(CpslText, { variant: "bodyM", weight: "medium", style: { visibility: !!balance ? "visible" : "hidden" }, children: balance ? formatBalanceString(balance) : "0" });
|
|
15
|
+
};
|
|
16
|
+
const AccountHeader = ({ withBalance = false } = {}) => {
|
|
17
|
+
const para = useInternalClient();
|
|
18
|
+
const { name, icon, src } = useMemo(() => {
|
|
19
|
+
var _a;
|
|
20
|
+
let name2, icon2, src2;
|
|
21
|
+
switch (true) {
|
|
22
|
+
case Object.keys(para == null ? void 0 : para.externalWallets).length > 0:
|
|
23
|
+
{
|
|
24
|
+
const wallet = Object.values(para.externalWallets)[0];
|
|
25
|
+
name2 = (_a = wallet.ensName) != null ? _a : truncateAddress(wallet.address, wallet.type, { prefix: para.cosmosPrefix });
|
|
26
|
+
src2 = wallet.ensAvatar;
|
|
27
|
+
icon2 = getExternalWalletIcon(wallet.externalProviderId);
|
|
28
|
+
}
|
|
29
|
+
break;
|
|
30
|
+
default:
|
|
31
|
+
name2 = `${para.partnerName} Wallet`;
|
|
32
|
+
src2 = para.partnerLogo;
|
|
33
|
+
icon2 = "wallet02";
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
return { name: name2, icon: icon2, src: src2 };
|
|
37
|
+
}, [para.partnerName, para.partnerLogo, para.externalWallets]);
|
|
38
|
+
return /* @__PURE__ */ jsxs(AccountContainer, { children: [
|
|
39
|
+
/* @__PURE__ */ jsx(
|
|
40
|
+
CpslIcon,
|
|
41
|
+
{
|
|
42
|
+
size: "48px",
|
|
43
|
+
inset: "8px",
|
|
44
|
+
border: "1px solid var(--cpsl-color-background-8)",
|
|
45
|
+
color: "var(--cpsl-color-foreground-0)",
|
|
46
|
+
radius: "theme",
|
|
47
|
+
icon,
|
|
48
|
+
src
|
|
49
|
+
}
|
|
50
|
+
),
|
|
51
|
+
/* @__PURE__ */ jsx(CpslText, { variant: "headingXS", weight: "semiBold", color: "contrast", children: name }),
|
|
52
|
+
withBalance && /* @__PURE__ */ jsx(Balance, {})
|
|
53
|
+
] });
|
|
54
|
+
};
|
|
55
|
+
const AccountContainer = safeStyled.div`
|
|
56
|
+
width: 100%;
|
|
57
|
+
display: flex;
|
|
58
|
+
flex-direction: column;
|
|
59
|
+
gap: 8px;
|
|
60
|
+
align-items: center;
|
|
61
|
+
`;
|
|
62
|
+
export {
|
|
63
|
+
AccountHeader
|
|
64
|
+
};
|
|
@@ -1 +1,4 @@
|
|
|
1
|
-
export declare const AccountProfile: (
|
|
1
|
+
export declare const AccountProfile: ({ isDisconnecting, onDisconnect, }: {
|
|
2
|
+
isDisconnecting: boolean;
|
|
3
|
+
onDisconnect: () => void;
|
|
4
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -4,9 +4,9 @@ import {
|
|
|
4
4
|
__spreadValues
|
|
5
5
|
} from "../../../chunk-MMUBH76A.js";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
import { AccountTypeIcon, GradientScroll, StepContainer } from "../common.js";
|
|
8
|
-
import { CpslButton, CpslIcon,
|
|
9
|
-
import { useClient } from "../../../provider/index.js";
|
|
7
|
+
import { AccountTypeIcon, GradientScroll, StepContainer, WalletTypeIcon } from "../common.js";
|
|
8
|
+
import { CpslButton, CpslIcon, CpslText } from "@getpara/react-components";
|
|
9
|
+
import { useAccount, useClient } from "../../../provider/index.js";
|
|
10
10
|
import { useLinkedAccounts } from "../../../provider/hooks/index.js";
|
|
11
11
|
import { getWalletDisplayName } from "../../utils/getWalletDisplayName.js";
|
|
12
12
|
import { truncateAddress } from "@getpara/web-sdk";
|
|
@@ -14,6 +14,8 @@ import { useAccountLinking } from "../../../provider/providers/AccountLinkProvid
|
|
|
14
14
|
import { safeStyled, useCopyToClipboard } from "@getpara/react-common";
|
|
15
15
|
import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
|
|
16
16
|
import { ACCOUNT_TYPES } from "../../constants/oAuthLogos.js";
|
|
17
|
+
import { useStore } from "../../../provider/stores/useStore.js";
|
|
18
|
+
import { AccountHeader } from "./AccountHeader.js";
|
|
17
19
|
const Entry = ({
|
|
18
20
|
identifier,
|
|
19
21
|
icon,
|
|
@@ -45,23 +47,53 @@ const Entry = ({
|
|
|
45
47
|
onUnlink && /* @__PURE__ */ jsx(EntryUnlink, { href: "#", onClick: onUnlink, children: "Unlink" })
|
|
46
48
|
] }, address != null ? address : identifier);
|
|
47
49
|
};
|
|
48
|
-
const AccountProfile = (
|
|
50
|
+
const AccountProfile = ({
|
|
51
|
+
isDisconnecting,
|
|
52
|
+
onDisconnect
|
|
53
|
+
}) => {
|
|
49
54
|
var _a, _b, _c, _d, _e, _f;
|
|
50
55
|
const para = useClient();
|
|
56
|
+
const { connectionType, embedded } = useAccount();
|
|
51
57
|
const { data: linkedAccounts } = useLinkedAccounts();
|
|
52
58
|
const { wallets } = useExternalWallets();
|
|
53
59
|
const { isEnabled, linkAccount, unlinkAccount } = useAccountLinking();
|
|
60
|
+
const hideWallets = useStore((state) => {
|
|
61
|
+
var _a2;
|
|
62
|
+
return (_a2 = state.modalConfig) == null ? void 0 : _a2.hideWallets;
|
|
63
|
+
});
|
|
54
64
|
if (!para) {
|
|
55
65
|
return null;
|
|
56
66
|
}
|
|
57
67
|
const externalWallet = (_a = para.authInfo) == null ? void 0 : _a.externalWallet;
|
|
58
|
-
return /* @__PURE__ */ jsxs(StepContainer, {
|
|
68
|
+
return /* @__PURE__ */ jsxs(StepContainer, { children: [
|
|
69
|
+
/* @__PURE__ */ jsx(AccountHeader, {}),
|
|
70
|
+
/* @__PURE__ */ jsxs(ParaConnect, { target: "_blank", href: "https://connect.getpara.com", rel: "noreferrer noopener", children: [
|
|
71
|
+
/* @__PURE__ */ jsx(ParaIcon, { icon: "paraIconBrand", size: "40px", inset: "8px", background: "white" }),
|
|
72
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
73
|
+
"Do even more with your wallet",
|
|
74
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
75
|
+
"at ",
|
|
76
|
+
/* @__PURE__ */ jsx("span", { style: { fontWeight: "600" }, children: "Para Connect" })
|
|
77
|
+
] }),
|
|
78
|
+
/* @__PURE__ */ jsxs(Dots, { children: [
|
|
79
|
+
new Array(6).fill(0).map((_, index) => /* @__PURE__ */ jsx(DotsIcon, { index, icon: "dotsSquare", size: "27.5px" }, index)),
|
|
80
|
+
/* @__PURE__ */ jsx(ParaArrow, { icon: "paraArrow", size: "31px", color: "white" })
|
|
81
|
+
] })
|
|
82
|
+
] }),
|
|
59
83
|
/* @__PURE__ */ jsxs(Section, { children: [
|
|
60
84
|
/* @__PURE__ */ jsx(Title, { variant: "bodyS", color: "secondary", children: "Connected Wallets" }),
|
|
61
|
-
/* @__PURE__ */ jsx(Content, { children: externalWallet ? /* @__PURE__ */ jsx(
|
|
85
|
+
/* @__PURE__ */ jsx(Content, { children: externalWallet && connectionType === "external" ? /* @__PURE__ */ jsx(
|
|
62
86
|
Entry,
|
|
63
87
|
{
|
|
64
|
-
icon: /* @__PURE__ */ jsx(
|
|
88
|
+
icon: /* @__PURE__ */ jsx(
|
|
89
|
+
WalletTypeIcon,
|
|
90
|
+
{
|
|
91
|
+
walletType: externalWallet.type,
|
|
92
|
+
externalWallet: externalWallet.providerId,
|
|
93
|
+
size: "24px",
|
|
94
|
+
inset: "0"
|
|
95
|
+
}
|
|
96
|
+
),
|
|
65
97
|
name: (_c = (_b = externalWallet.ensName) != null ? _b : externalWallet.provider) != null ? _c : "",
|
|
66
98
|
address: (_d = externalWallet.addressBech32) != null ? _d : externalWallet.address,
|
|
67
99
|
addressShort: truncateAddress((_e = externalWallet.addressBech32) != null ? _e : externalWallet.address, externalWallet.type, {
|
|
@@ -69,27 +101,23 @@ const AccountProfile = () => {
|
|
|
69
101
|
})
|
|
70
102
|
},
|
|
71
103
|
externalWallet.address
|
|
72
|
-
) : (_f = para == null ? void 0 : para.availableWallets) == null ? void 0 : _f.map((wallet) =>
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
wallet.address
|
|
83
|
-
);
|
|
84
|
-
}) })
|
|
104
|
+
) : (_f = para == null ? void 0 : para.availableWallets) == null ? void 0 : _f.map((wallet) => /* @__PURE__ */ jsx(
|
|
105
|
+
Entry,
|
|
106
|
+
{
|
|
107
|
+
icon: /* @__PURE__ */ jsx(WalletTypeIcon, { walletType: wallet.type, externalWallet: wallet.externalProviderId, size: "24px" }),
|
|
108
|
+
name: getWalletDisplayName(para, wallet),
|
|
109
|
+
address: wallet.address,
|
|
110
|
+
addressShort: truncateAddress(wallet.address, wallet.type)
|
|
111
|
+
},
|
|
112
|
+
wallet.address
|
|
113
|
+
)) })
|
|
85
114
|
] }),
|
|
86
115
|
isEnabled && /* @__PURE__ */ jsxs(Section, { children: [
|
|
87
116
|
/* @__PURE__ */ jsx(Title, { variant: "bodyS", color: "secondary", children: "Linked Accounts" }),
|
|
88
117
|
/* @__PURE__ */ jsxs(Content, { children: [
|
|
89
|
-
/* @__PURE__ */ jsx(GradientScroll, { gap: "12px", height: "360px", children: [
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
].map((linkedAccount) => {
|
|
118
|
+
/* @__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: externalWallet2 }) => {
|
|
119
|
+
return !externalWallet2 || externalWallet2.address !== (embedded == null ? void 0 : embedded.externalWalletAddress);
|
|
120
|
+
}).map((linkedAccount) => {
|
|
93
121
|
var _a2, _b2, _c2, _d2, _e2;
|
|
94
122
|
const { identifier, displayName, type, isPrimary = false, externalWallet: externalWallet2 } = linkedAccount;
|
|
95
123
|
const externalWalletConnector = wallets.find((wallet) => wallet.id === (externalWallet2 == null ? void 0 : externalWallet2.providerId));
|
|
@@ -129,6 +157,10 @@ const AccountProfile = () => {
|
|
|
129
157
|
"Link an account"
|
|
130
158
|
] })
|
|
131
159
|
] })
|
|
160
|
+
] }),
|
|
161
|
+
/* @__PURE__ */ jsxs(DisconnectButton, { variant: "destructive", fullWidth: true, onClick: onDisconnect, disabled: isDisconnecting, children: [
|
|
162
|
+
hideWallets ? "Logout" : "Disconnect Wallet",
|
|
163
|
+
/* @__PURE__ */ jsx(CpslIcon, { icon: "logOut", slot: "end" })
|
|
132
164
|
] })
|
|
133
165
|
] });
|
|
134
166
|
};
|
|
@@ -137,11 +169,15 @@ const Section = safeStyled.div`
|
|
|
137
169
|
flex-direction: column;
|
|
138
170
|
align-items: flex-start;
|
|
139
171
|
justify-content: center;
|
|
140
|
-
gap:
|
|
172
|
+
gap: 8px;
|
|
141
173
|
width: 100%;
|
|
142
174
|
`;
|
|
143
|
-
const Content = safeStyled(Section)
|
|
144
|
-
|
|
175
|
+
const Content = safeStyled(Section)`
|
|
176
|
+
gap: 12px;
|
|
177
|
+
`;
|
|
178
|
+
const Title = safeStyled(CpslText)`
|
|
179
|
+
font-weight: 600;
|
|
180
|
+
`;
|
|
145
181
|
const EntryContainer = safeStyled.div`
|
|
146
182
|
overflow: hidden;
|
|
147
183
|
position: relative;
|
|
@@ -181,6 +217,57 @@ const EntryUnlink = safeStyled.a`
|
|
|
181
217
|
text-decoration: underline;
|
|
182
218
|
}
|
|
183
219
|
`;
|
|
220
|
+
const DisconnectButton = safeStyled(CpslButton)`
|
|
221
|
+
--button-border-width: 0px;
|
|
222
|
+
--button-destructive-hover-background-color: rgba(255, 0, 0, 0.2);
|
|
223
|
+
--button-destructive-active-background-color: rgba(255, 0, 0, 0.1);
|
|
224
|
+
|
|
225
|
+
`;
|
|
226
|
+
const ParaConnect = safeStyled.a`
|
|
227
|
+
position: relative;
|
|
228
|
+
box-sizing: border-box;
|
|
229
|
+
width: 100%;
|
|
230
|
+
text-decoration: none;
|
|
231
|
+
color: white !important;
|
|
232
|
+
font-family: 'PP Mori', sans-serif;
|
|
233
|
+
font-weight: 500;
|
|
234
|
+
font-size: 15px;
|
|
235
|
+
padding: 16px;
|
|
236
|
+
height: 69px;
|
|
237
|
+
display: flex;
|
|
238
|
+
align-items: center;
|
|
239
|
+
justify-content: flex-start;
|
|
240
|
+
gap: 8px;
|
|
241
|
+
border-radius: 8px;
|
|
242
|
+
border: 1px solid #FF4E00;
|
|
243
|
+
background: #FF4E00;
|
|
244
|
+
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.05), 0 0 20px 8px rgba(251, 188, 4, 0.20) inset;
|
|
245
|
+
|
|
246
|
+
&:hover, &:active {
|
|
247
|
+
background: #FF6A2B;
|
|
248
|
+
border: 1px solid #FF6A2B;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
`;
|
|
252
|
+
const ParaIcon = safeStyled(CpslIcon)`
|
|
253
|
+
--border-radius: 4px;
|
|
254
|
+
`;
|
|
255
|
+
const Dots = safeStyled.div`
|
|
256
|
+
width: 75px;
|
|
257
|
+
position: absolute;
|
|
258
|
+
right: 14px;
|
|
259
|
+
top: 7px;
|
|
260
|
+
`;
|
|
261
|
+
const DotsIcon = safeStyled(CpslIcon)`
|
|
262
|
+
position: absolute;
|
|
263
|
+
left: ${({ index }) => `${index % 3 * 27.5}px`};
|
|
264
|
+
top: ${({ index }) => `${Math.floor(index / 3) * 27.5}px`};
|
|
265
|
+
`;
|
|
266
|
+
const ParaArrow = safeStyled(CpslIcon)`
|
|
267
|
+
position: absolute;
|
|
268
|
+
top: 12px;
|
|
269
|
+
right: 4px;
|
|
270
|
+
`;
|
|
184
271
|
export {
|
|
185
272
|
AccountProfile
|
|
186
273
|
};
|
|
@@ -7,7 +7,7 @@ import { CpslIcon, CpslSpinner, CpslTab, CpslTabs } from "@getpara/react-compone
|
|
|
7
7
|
import { OnRampStep } from "../../stores/index.js";
|
|
8
8
|
import { useModalStore } from "../../stores/modal/useModalStore.js";
|
|
9
9
|
import { useEffect, useMemo } from "react";
|
|
10
|
-
import { getAddFundsStep } from "../../utils/steps.js";
|
|
10
|
+
import { getAddFundsStep, ModalStep } from "../../utils/steps.js";
|
|
11
11
|
import { safeStyled } from "@getpara/react-common";
|
|
12
12
|
import { useAccount, useWallet } from "../../../provider/index.js";
|
|
13
13
|
import { AddFundsProvider } from "./AddFundsProvider.js";
|
|
@@ -15,7 +15,9 @@ import { AddFundsReceive } from "./AddFundsReceive.js";
|
|
|
15
15
|
import { AddFundsContextProvider, TABS } from "./AddFundsContext.js";
|
|
16
16
|
import { AnimatePresence } from "framer-motion";
|
|
17
17
|
import { AddFundsSettings } from "./AddFundsSettings.js";
|
|
18
|
+
import { WalletSelect } from "../WalletSelect/WalletSelect.js";
|
|
18
19
|
const AddFunds = () => {
|
|
20
|
+
const step = useModalStore((state) => state.step);
|
|
19
21
|
const onRampConfig = useModalStore((state) => state.onRampConfig);
|
|
20
22
|
const onRampStep = useModalStore((state) => state.onRampStep);
|
|
21
23
|
const storedTab = useModalStore((state) => state.accountAddFundTab);
|
|
@@ -28,7 +30,7 @@ const AddFunds = () => {
|
|
|
28
30
|
([enabledFlow, key]) => !!(onRampConfig == null ? void 0 : onRampConfig[key]) && (!isGuestMode || enabledFlow === EnabledFlow.RECEIVE)
|
|
29
31
|
);
|
|
30
32
|
const tab = storedTab != null ? storedTab : tabs[0][0];
|
|
31
|
-
const isMultiFlow = tabs.length > 1;
|
|
33
|
+
const isMultiFlow = (tab === EnabledFlow.BUY || tab === EnabledFlow.RECEIVE) && tabs.length > 1;
|
|
32
34
|
const onSetTab = (event) => {
|
|
33
35
|
setModalStep(getAddFundsStep(event.detail.tab));
|
|
34
36
|
};
|
|
@@ -54,10 +56,13 @@ const AddFunds = () => {
|
|
|
54
56
|
return /* @__PURE__ */ jsx(SpinnerContainer, { children: /* @__PURE__ */ jsx(CpslSpinner, {}) });
|
|
55
57
|
}
|
|
56
58
|
return /* @__PURE__ */ jsxs(StepContainer, { children: [
|
|
57
|
-
isMultiFlow && /* @__PURE__ */ jsx(InnerStepContainer, { children: /* @__PURE__ */ jsx(CpslTabs, { selectedTab: tab, onCpslTabsChanged: onSetTab, children: TABS.
|
|
58
|
-
/* @__PURE__ */
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
isMultiFlow && /* @__PURE__ */ jsx(InnerStepContainer, { children: /* @__PURE__ */ jsx(CpslTabs, { selectedTab: tab, onCpslTabsChanged: onSetTab, children: TABS.filter(([enabledFlow]) => enabledFlow === EnabledFlow.BUY || enabledFlow === EnabledFlow.WITHDRAW).map(
|
|
60
|
+
([tab2, _, icon, title]) => /* @__PURE__ */ jsxs(CpslTab, { tab: tab2, children: [
|
|
61
|
+
/* @__PURE__ */ jsx(CpslIcon, { slot: "start", icon }),
|
|
62
|
+
title
|
|
63
|
+
] }, tab2)
|
|
64
|
+
) }) }),
|
|
65
|
+
(step === ModalStep.ADD_FUNDS_RECEIVE || (embedded == null ? void 0 : embedded.wallets) && embedded.wallets.length > 1) && /* @__PURE__ */ jsx(WalletSelect, {}),
|
|
61
66
|
/* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: /* @__PURE__ */ jsx(AddFundsContextProvider, { "data-testid": "add-funds", tab, children: Content }) })
|
|
62
67
|
] });
|
|
63
68
|
};
|