@getpara/react-sdk 2.0.0-alpha.20 → 2.0.0-alpha.22
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/index.d.ts +0 -1
- package/dist/index.js +0 -5
- package/dist/modal/ParaModal.js +15 -5
- package/dist/modal/components/Account/Account.js +14 -8
- package/dist/modal/components/Account/AccountProfile.d.ts +1 -0
- package/dist/modal/components/Account/AccountProfile.js +170 -0
- package/dist/modal/components/Account/AccountProfileLink.d.ts +1 -0
- package/dist/modal/components/Account/AccountProfileLink.js +206 -0
- package/dist/modal/components/Account/AccountProfileLinkOptions.d.ts +1 -0
- package/dist/modal/components/Account/AccountProfileLinkOptions.js +111 -0
- package/dist/modal/components/Account/AccountProfileUnlink.d.ts +1 -0
- package/dist/modal/components/Account/AccountProfileUnlink.js +47 -0
- package/dist/modal/components/AuthInput/AuthInput.d.ts +17 -3
- package/dist/modal/components/AuthInput/AuthInput.js +116 -101
- package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +2 -2
- package/dist/modal/components/AuthOptions/AuthOptions.js +26 -1
- package/dist/modal/components/Body/Body.js +25 -2
- package/dist/modal/components/Controls/Selects.js +3 -19
- package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.d.ts +1 -0
- package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.js +75 -0
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.d.ts +7 -0
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +70 -39
- package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.js +8 -3
- package/dist/modal/components/ExternalWallets/ExternalWallets.js +13 -4
- package/dist/modal/components/Header/hooks/useStepTitle.js +7 -1
- package/dist/modal/components/OAuth/FarcasterOAuthStep.d.ts +1 -0
- package/dist/modal/components/OAuth/FarcasterOAuthStep.js +6 -2
- package/dist/modal/components/OAuth/OAuth.js +2 -2
- package/dist/modal/components/OAuth/TelegramOAuthStep.d.ts +7 -0
- package/dist/modal/components/OAuth/TelegramOAuthStep.js +36 -52
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.d.ts +12 -1
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +40 -23
- package/dist/modal/components/common.d.ts +18 -1
- package/dist/modal/components/common.js +86 -0
- package/dist/modal/constants/constants.d.ts +1 -1
- package/dist/modal/constants/constants.js +1 -1
- package/dist/modal/constants/oAuthLogos.d.ts +15 -6
- package/dist/modal/constants/oAuthLogos.js +148 -19
- package/dist/modal/constants/walletTypeConfig.d.ts +6 -0
- package/dist/modal/constants/walletTypeConfig.js +13 -0
- package/dist/modal/hooks/useTelegramLogin.d.ts +12 -0
- package/dist/modal/hooks/useTelegramLogin.js +65 -0
- package/dist/modal/stores/modal/actions.js +6 -1
- package/dist/modal/stores/modal/useModalStore.d.ts +4 -3
- package/dist/modal/stores/modal/useModalStore.js +7 -2
- package/dist/modal/types/modalProps.d.ts +6 -1
- package/dist/modal/utils/authInputHelpers.d.ts +3 -5
- package/dist/modal/utils/authInputHelpers.js +23 -20
- package/dist/modal/utils/getWalletDisplayName.d.ts +5 -0
- package/dist/modal/utils/getWalletDisplayName.js +22 -0
- package/dist/modal/utils/steps.d.ts +13 -2
- package/dist/modal/utils/steps.js +24 -2
- package/dist/provider/ParaProvider.js +6 -5
- package/dist/provider/actions/index.d.ts +19 -0
- package/dist/provider/actions/index.js +47 -29
- package/dist/provider/actions/utils.d.ts +3 -2
- package/dist/provider/actions/utils.js +25 -6
- package/dist/provider/components/CosmosWalletWrapper.js +2 -2
- package/dist/provider/components/EvmWalletWrapper.js +2 -2
- package/dist/provider/components/ExternalWalletWrapper.js +2 -1
- package/dist/provider/components/SolanaWalletWrapper.js +2 -2
- package/dist/provider/external/stubs/CosmosExternalWalletContextStub.d.ts +0 -10
- package/dist/provider/external/stubs/CosmosExternalWalletContextStub.js +2 -12
- package/dist/provider/external/stubs/EvmExternalWalletContextStub.d.ts +0 -1
- package/dist/provider/external/stubs/EvmExternalWalletContextStub.js +2 -15
- package/dist/provider/external/stubs/SolanaExternalWalletContextStub.d.ts +0 -6
- package/dist/provider/external/stubs/SolanaExternalWalletContextStub.js +2 -8
- package/dist/provider/hooks/mutations/core.d.ts +27 -0
- package/dist/provider/hooks/mutations/core.js +66 -0
- package/dist/provider/hooks/mutations/index.d.ts +3 -28
- package/dist/provider/hooks/mutations/index.js +4 -60
- package/dist/provider/hooks/mutations/useLinkAccount.d.ts +9 -0
- package/dist/provider/hooks/mutations/useLinkAccount.js +18 -0
- package/dist/provider/hooks/mutations/utils.d.ts +11 -4
- package/dist/provider/hooks/mutations/utils.js +35 -4
- package/dist/provider/hooks/queries/core.d.ts +2 -0
- package/dist/provider/hooks/queries/core.js +13 -0
- package/dist/provider/hooks/queries/index.d.ts +1 -0
- package/dist/provider/hooks/queries/index.js +1 -0
- package/dist/provider/hooks/queries/utils.d.ts +4 -0
- package/dist/provider/hooks/queries/utils.js +24 -0
- package/dist/provider/hooks/utils/useModal.d.ts +4 -1
- package/dist/provider/hooks/utils/useModal.js +12 -2
- package/dist/provider/providers/AccountLinkProvider.d.ts +47 -0
- package/dist/provider/providers/AccountLinkProvider.js +451 -0
- package/dist/provider/providers/AuthProvider.d.ts +3 -1
- package/dist/provider/providers/AuthProvider.js +8 -5
- package/dist/provider/providers/ExternalWalletProvider.d.ts +20 -32
- package/dist/provider/providers/ExternalWalletProvider.js +180 -54
- package/dist/provider/stores/slices/modal.js +3 -1
- package/dist/provider/stores/types.d.ts +2 -1
- package/dist/provider/types/utils.d.ts +25 -6
- package/dist/provider/utils/renameMutations.d.ts +2 -2
- package/package.json +8 -8
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export * from './modal/index.js';
|
|
2
2
|
export * from './provider/index.js';
|
|
3
3
|
export * from '@getpara/web-sdk';
|
|
4
|
-
export { ExternalWallet, EvmWallet, SolanaWallet, CosmosWallet } from '@getpara/react-common';
|
|
5
4
|
export type { Theme } from '@getpara/react-components';
|
|
6
5
|
import ParaWeb from '@getpara/web-sdk';
|
|
7
6
|
export default ParaWeb;
|
package/dist/index.js
CHANGED
|
@@ -3,13 +3,8 @@ import "./chunk-MMUBH76A.js";
|
|
|
3
3
|
export * from "./modal/index.js";
|
|
4
4
|
export * from "./provider/index.js";
|
|
5
5
|
export * from "@getpara/web-sdk";
|
|
6
|
-
import { ExternalWallet, EvmWallet, SolanaWallet, CosmosWallet } from "@getpara/react-common";
|
|
7
6
|
import ParaWeb from "@getpara/web-sdk";
|
|
8
7
|
var src_default = ParaWeb;
|
|
9
8
|
export {
|
|
10
|
-
CosmosWallet,
|
|
11
|
-
EvmWallet,
|
|
12
|
-
ExternalWallet,
|
|
13
|
-
SolanaWallet,
|
|
14
9
|
src_default as default
|
|
15
10
|
};
|
package/dist/modal/ParaModal.js
CHANGED
|
@@ -22,11 +22,12 @@ import { useExternalWallets } from "../provider/providers/ExternalWalletProvider
|
|
|
22
22
|
import { useStore } from "../provider/stores/useStore.js";
|
|
23
23
|
import parsePhoneNumberFromString from "libphonenumber-js";
|
|
24
24
|
import { useAuthActions } from "../provider/providers/AuthProvider.js";
|
|
25
|
-
import {
|
|
25
|
+
import { validateInput } from "./utils/authInputHelpers.js";
|
|
26
26
|
import { SDK_VERSION } from "./constants/constants.js";
|
|
27
27
|
defineCustomElements();
|
|
28
28
|
const ParaModal = forwardRef((props, ref) => {
|
|
29
29
|
const storedModalConfig = useStore((state) => state.modalConfig);
|
|
30
|
+
const openedToStep = useStore((state) => state.openedToStep);
|
|
30
31
|
const modalContentRef = useRef(null);
|
|
31
32
|
const refs = useModalStore((state) => state.refs);
|
|
32
33
|
const flow = useModalStore((state) => state.flow);
|
|
@@ -52,6 +53,7 @@ const ParaModal = forwardRef((props, ref) => {
|
|
|
52
53
|
const [isInit, setIsInit] = useState(false);
|
|
53
54
|
const externalWallets = useStore((state) => state.externalWallets);
|
|
54
55
|
const providerProps = useStore((state) => state.providerProps);
|
|
56
|
+
const setAccountLinkOptions = useModalStore((state) => state.setAccountLinkOptions);
|
|
55
57
|
const _a = __spreadValues(__spreadValues({}, storedModalConfig), props), {
|
|
56
58
|
isOpen: configIsOpen,
|
|
57
59
|
theme,
|
|
@@ -66,7 +68,8 @@ const ParaModal = forwardRef((props, ref) => {
|
|
|
66
68
|
embeddedModal,
|
|
67
69
|
onModalStepChange,
|
|
68
70
|
onClose,
|
|
69
|
-
defaultAuthIdentifier
|
|
71
|
+
defaultAuthIdentifier,
|
|
72
|
+
supportedAccountLinks: propsSupportedAccountLinks
|
|
70
73
|
} = _a, rest = __objRest(_a, [
|
|
71
74
|
"isOpen",
|
|
72
75
|
"theme",
|
|
@@ -81,7 +84,8 @@ const ParaModal = forwardRef((props, ref) => {
|
|
|
81
84
|
"embeddedModal",
|
|
82
85
|
"onModalStepChange",
|
|
83
86
|
"onClose",
|
|
84
|
-
"defaultAuthIdentifier"
|
|
87
|
+
"defaultAuthIdentifier",
|
|
88
|
+
"supportedAccountLinks"
|
|
85
89
|
]);
|
|
86
90
|
useEffect(() => {
|
|
87
91
|
const trackAnalytics = () => __async(void 0, null, function* () {
|
|
@@ -140,7 +144,9 @@ const ParaModal = forwardRef((props, ref) => {
|
|
|
140
144
|
break;
|
|
141
145
|
case isAccount:
|
|
142
146
|
setFlow("account");
|
|
143
|
-
|
|
147
|
+
if (!openedToStep.current) {
|
|
148
|
+
setStep(ModalStep.ACCOUNT_MAIN);
|
|
149
|
+
}
|
|
144
150
|
break;
|
|
145
151
|
default:
|
|
146
152
|
if (currentStep !== ModalStep.AUTH_MAIN && currentStep !== ModalStep.SECRET) {
|
|
@@ -155,7 +161,7 @@ const ParaModal = forwardRef((props, ref) => {
|
|
|
155
161
|
if (defaultAuthIdentifier && ((_a2 = para.authInfo) == null ? void 0 : _a2.identifier) !== defaultAuthIdentifier) {
|
|
156
162
|
const number = parsePhoneNumberFromString(defaultAuthIdentifier);
|
|
157
163
|
try {
|
|
158
|
-
const auth =
|
|
164
|
+
const auth = validateInput(
|
|
159
165
|
number ? number.nationalNumber : defaultAuthIdentifier,
|
|
160
166
|
(number == null ? void 0 : number.countryCallingCode) ? `+${number == null ? void 0 : number.countryCallingCode}` : void 0,
|
|
161
167
|
number ? "phone" : "email"
|
|
@@ -211,6 +217,9 @@ const ParaModal = forwardRef((props, ref) => {
|
|
|
211
217
|
setStep(ModalStep.AUTH_MAIN);
|
|
212
218
|
}
|
|
213
219
|
}, [bareModal, flow, account]);
|
|
220
|
+
useEffect(() => {
|
|
221
|
+
setAccountLinkOptions(propsSupportedAccountLinks != null ? propsSupportedAccountLinks : para == null ? void 0 : para.supportedAccountLinks);
|
|
222
|
+
}, [propsSupportedAccountLinks, para == null ? void 0 : para.supportedAccountLinks]);
|
|
214
223
|
const handleClose = () => {
|
|
215
224
|
closeModal();
|
|
216
225
|
onClose == null ? void 0 : onClose();
|
|
@@ -219,6 +228,7 @@ const ParaModal = forwardRef((props, ref) => {
|
|
|
219
228
|
setIsModalMounted(true);
|
|
220
229
|
};
|
|
221
230
|
const handleModalExited = () => __async(void 0, null, function* () {
|
|
231
|
+
openedToStep.current = null;
|
|
222
232
|
setIsModalMounted(false);
|
|
223
233
|
if (RESET_TO_AUTH_STEPS.includes(currentStep)) {
|
|
224
234
|
resetModalState();
|
|
@@ -15,6 +15,7 @@ import { useStore } from "../../../provider/stores/useStore.js";
|
|
|
15
15
|
import { formatBalanceString } from "../../utils/stringFormatters.js";
|
|
16
16
|
import { useAccount, useWalletBalance } from "../../../provider/index.js";
|
|
17
17
|
import { EnabledFlow } from "@getpara/web-sdk";
|
|
18
|
+
import { useAccountLinking } from "../../../provider/providers/AccountLinkProvider.js";
|
|
18
19
|
const Account = ({ onClose }) => {
|
|
19
20
|
const onRampConfig = useModalStore((state) => state.onRampConfig);
|
|
20
21
|
const setStep = useModalStore((state) => state.setStep);
|
|
@@ -29,22 +30,24 @@ const Account = ({ onClose }) => {
|
|
|
29
30
|
const para = useInternalClient();
|
|
30
31
|
const { data: account } = useAccount();
|
|
31
32
|
const { data: balance, isLoading: isBalanceLoading } = useWalletBalance();
|
|
33
|
+
const { isEnabled } = useAccountLinking();
|
|
32
34
|
const [isDisconnecting, setIsDisconnecting] = useState(false);
|
|
33
35
|
const isGuestMode = (account == null ? void 0 : account.isConnected) && account.isGuestMode;
|
|
34
36
|
const cantBuyAndWithdraw = (para.externalWalletConnectionType === "CONNECTION_ONLY" || para.externalWalletConnectionType === "VERIFICATION") && !para.userId;
|
|
35
37
|
const isOnRampLoaded = !!onRampConfig;
|
|
36
38
|
const handleBuyClick = () => {
|
|
37
39
|
if (isGuestMode) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
if (onRampConfig == null ? void 0 : onRampConfig.isReceiveEnabled) {
|
|
41
|
+
setStep(ModalStep.ADD_FUNDS_RECEIVE);
|
|
42
|
+
} else {
|
|
43
|
+
setGuestAddFundsTab(EnabledFlow.BUY);
|
|
44
|
+
setStep(ModalStep.AUTH_GUEST_SIGNUP);
|
|
45
|
+
}
|
|
40
46
|
} else {
|
|
41
47
|
setOnRampStep(OnRampStep.SETTINGS);
|
|
42
48
|
setStep(ModalStep.ADD_FUNDS_BUY);
|
|
43
49
|
}
|
|
44
50
|
};
|
|
45
|
-
const handleReceiveClick = () => {
|
|
46
|
-
setStep(ModalStep.ADD_FUNDS_RECEIVE);
|
|
47
|
-
};
|
|
48
51
|
const handleSellClick = () => {
|
|
49
52
|
if (isGuestMode) {
|
|
50
53
|
setGuestAddFundsTab(EnabledFlow.WITHDRAW);
|
|
@@ -54,6 +57,9 @@ const Account = ({ onClose }) => {
|
|
|
54
57
|
setStep(ModalStep.ADD_FUNDS_WITHDRAW);
|
|
55
58
|
}
|
|
56
59
|
};
|
|
60
|
+
const handleProfileClick = () => {
|
|
61
|
+
setStep(ModalStep.ACCOUNT_PROFILE);
|
|
62
|
+
};
|
|
57
63
|
const handleDisconnectClick = () => __async(void 0, null, function* () {
|
|
58
64
|
setIsDisconnecting(true);
|
|
59
65
|
yield para.logout();
|
|
@@ -89,9 +95,9 @@ const Account = ({ onClose }) => {
|
|
|
89
95
|
)
|
|
90
96
|
] }),
|
|
91
97
|
/* @__PURE__ */ jsx(ButtonContainer, { children: isOnRampLoaded ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
92
|
-
onRampConfig.isBuyEnabled && !cantBuyAndWithdraw && /* @__PURE__ */ jsx(OptionButton, { icon: "creditCard", onClick: handleBuyClick, children: /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "secondary", weight: "medium", children: "
|
|
93
|
-
onRampConfig.
|
|
94
|
-
|
|
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" }) })
|
|
95
101
|
] }) : /* @__PURE__ */ jsx(CpslSpinner, {}) }),
|
|
96
102
|
!isGuestMode && /* @__PURE__ */ jsx(DisconnectButton, { variant: "destructive", fullWidth: true, onClick: handleDisconnectClick, disabled: isDisconnecting, children: isDisconnecting ? /* @__PURE__ */ jsx(CpslSpinner, { size: 16 }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
97
103
|
hideWallets ? "Logout" : "Disconnect Wallet",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const AccountProfile: () => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__spreadProps,
|
|
4
|
+
__spreadValues
|
|
5
|
+
} from "../../../chunk-MMUBH76A.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import styled from "styled-components";
|
|
8
|
+
import { AccountTypeIcon, GradientScroll, StepContainer } from "../common.js";
|
|
9
|
+
import { CpslButton, CpslIcon, CpslIdenticon, CpslText } from "@getpara/react-components";
|
|
10
|
+
import { useAccount, useClient } from "../../../provider/index.js";
|
|
11
|
+
import { useLinkedAccounts } from "../../../provider/hooks/index.js";
|
|
12
|
+
import { getWalletDisplayName } from "../../utils/getWalletDisplayName.js";
|
|
13
|
+
import { truncateAddress } from "@getpara/web-sdk";
|
|
14
|
+
import { useAccountLinking } from "../../../provider/providers/AccountLinkProvider.js";
|
|
15
|
+
import { safeStyled, useCopyToClipboard } from "@getpara/react-common";
|
|
16
|
+
import { getAccountTypeName } from "../../constants/oAuthLogos.js";
|
|
17
|
+
const Entry = ({
|
|
18
|
+
identifier,
|
|
19
|
+
icon,
|
|
20
|
+
name,
|
|
21
|
+
address,
|
|
22
|
+
addressShort,
|
|
23
|
+
onUnlink
|
|
24
|
+
}) => {
|
|
25
|
+
const [isCopied, copy] = useCopyToClipboard();
|
|
26
|
+
return /* @__PURE__ */ jsxs(EntryContainer, { children: [
|
|
27
|
+
icon,
|
|
28
|
+
/* @__PURE__ */ jsx(EntryDisplayName, { variant: "bodyM", color: "contrast", children: name }),
|
|
29
|
+
/* @__PURE__ */ jsx(EntryFlex, { children: address ? /* @__PURE__ */ jsxs(EntryAddress, { children: [
|
|
30
|
+
/* @__PURE__ */ jsx(CpslText, { variant: "bodyM", color: "secondary", children: addressShort != null ? addressShort : address }),
|
|
31
|
+
/* @__PURE__ */ jsx(
|
|
32
|
+
CpslButton,
|
|
33
|
+
{
|
|
34
|
+
size: "small",
|
|
35
|
+
variant: "ghost",
|
|
36
|
+
onClick: (e) => {
|
|
37
|
+
e.stopPropagation();
|
|
38
|
+
e.preventDefault();
|
|
39
|
+
copy(address);
|
|
40
|
+
},
|
|
41
|
+
children: /* @__PURE__ */ jsx(CopyIcon, { id: "ignore-click", slot: "start", isCopied, icon: isCopied ? "check" : "copy" })
|
|
42
|
+
}
|
|
43
|
+
)
|
|
44
|
+
] }) : null }),
|
|
45
|
+
onUnlink && /* @__PURE__ */ jsx(EntryUnlink, { href: "#", onClick: onUnlink, children: "Unlink" })
|
|
46
|
+
] }, address != null ? address : identifier);
|
|
47
|
+
};
|
|
48
|
+
const AccountProfile = () => {
|
|
49
|
+
var _a, _b, _c, _d, _e;
|
|
50
|
+
const para = useClient();
|
|
51
|
+
const { data: account } = useAccount();
|
|
52
|
+
const { data: linkedAccounts } = useLinkedAccounts();
|
|
53
|
+
const { isEnabled, linkAccount, unlinkAccount } = useAccountLinking();
|
|
54
|
+
if (!para) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
const externalWallet = account == null ? void 0 : account.externalWallet;
|
|
58
|
+
return /* @__PURE__ */ jsxs(StepContainer, { $wide: true, children: [
|
|
59
|
+
/* @__PURE__ */ jsxs(Section, { children: [
|
|
60
|
+
/* @__PURE__ */ jsx(Title, { variant: "bodyS", color: "secondary", children: "Connected Wallets" }),
|
|
61
|
+
/* @__PURE__ */ jsx(Content, { children: externalWallet ? /* @__PURE__ */ jsx(
|
|
62
|
+
Entry,
|
|
63
|
+
{
|
|
64
|
+
icon: /* @__PURE__ */ jsx(AccountTypeIcon, { accountType: externalWallet.providerId, size: "24px" }),
|
|
65
|
+
name: (_b = (_a = externalWallet.ensName) != null ? _a : getAccountTypeName(externalWallet.providerId)) != null ? _b : "",
|
|
66
|
+
address: (_c = externalWallet.addressBech32) != null ? _c : externalWallet.address,
|
|
67
|
+
addressShort: truncateAddress((_d = externalWallet.addressBech32) != null ? _d : externalWallet.address, externalWallet.type, {
|
|
68
|
+
prefix: para.cosmosPrefix
|
|
69
|
+
})
|
|
70
|
+
},
|
|
71
|
+
externalWallet.address
|
|
72
|
+
) : (_e = account == null ? void 0 : account.wallets) == null ? void 0 : _e.map((wallet) => {
|
|
73
|
+
var _a2;
|
|
74
|
+
return /* @__PURE__ */ jsx(
|
|
75
|
+
Entry,
|
|
76
|
+
{
|
|
77
|
+
icon: wallet.isExternal ? /* @__PURE__ */ jsx(AccountTypeIcon, { accountType: (_a2 = wallet.externalProviderId) != null ? _a2 : "EXTERNAL_WALLET", size: "24px" }) : /* @__PURE__ */ jsx(CpslIdenticon, { hash: para.getIdenticonHash(wallet.id, wallet.type), size: "24px", arcWidth: "40%" }),
|
|
78
|
+
name: getWalletDisplayName(para, wallet),
|
|
79
|
+
address: wallet.address,
|
|
80
|
+
addressShort: truncateAddress(wallet.address, wallet.type)
|
|
81
|
+
},
|
|
82
|
+
wallet.address
|
|
83
|
+
);
|
|
84
|
+
}) })
|
|
85
|
+
] }),
|
|
86
|
+
isEnabled && /* @__PURE__ */ jsxs(Section, { children: [
|
|
87
|
+
/* @__PURE__ */ jsx(Title, { variant: "bodyS", color: "secondary", children: "Linked Accounts" }),
|
|
88
|
+
/* @__PURE__ */ jsxs(Content, { children: [
|
|
89
|
+
/* @__PURE__ */ jsx(GradientScroll, { gap: "12px", height: "360px", children: [
|
|
90
|
+
...((linkedAccounts == null ? void 0 : linkedAccounts.primary) || []).map((p) => __spreadProps(__spreadValues({}, p), { isPrimary: true })),
|
|
91
|
+
...(linkedAccounts == null ? void 0 : linkedAccounts.linked) || []
|
|
92
|
+
].map((linkedAccount) => {
|
|
93
|
+
var _a2, _b2, _c2, _d2, _e2;
|
|
94
|
+
const { identifier, displayName, type, isPrimary = false, externalWallet: externalWallet2 } = linkedAccount;
|
|
95
|
+
return /* @__PURE__ */ jsx(
|
|
96
|
+
Entry,
|
|
97
|
+
{
|
|
98
|
+
icon: /* @__PURE__ */ jsx(AccountTypeIcon, { accountType: (_a2 = externalWallet2 == null ? void 0 : externalWallet2.providerId) != null ? _a2 : type, size: "24px" }),
|
|
99
|
+
name: externalWallet2 ? (_c2 = (_b2 = externalWallet2.ensName) != null ? _b2 : getAccountTypeName(externalWallet2.providerId)) != null ? _c2 : "" : displayName != null ? displayName : identifier,
|
|
100
|
+
address: (_d2 = externalWallet2 == null ? void 0 : externalWallet2.addressBech32) != null ? _d2 : externalWallet2 == null ? void 0 : externalWallet2.address,
|
|
101
|
+
addressShort: externalWallet2 ? truncateAddress((_e2 = externalWallet2.addressBech32) != null ? _e2 : externalWallet2.address, externalWallet2.type, {
|
|
102
|
+
prefix: para.cosmosPrefix
|
|
103
|
+
}) : void 0,
|
|
104
|
+
onUnlink: isPrimary ? void 0 : (e) => {
|
|
105
|
+
e.preventDefault();
|
|
106
|
+
unlinkAccount(linkedAccount);
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
identifier
|
|
110
|
+
);
|
|
111
|
+
}) }),
|
|
112
|
+
/* @__PURE__ */ jsxs(CpslButton, { fullWidth: true, variant: "tertiary", onClick: () => linkAccount(void 0), children: [
|
|
113
|
+
/* @__PURE__ */ jsx(CpslIcon, { icon: "userPlus", slot: "start" }),
|
|
114
|
+
"Link an account"
|
|
115
|
+
] })
|
|
116
|
+
] })
|
|
117
|
+
] })
|
|
118
|
+
] });
|
|
119
|
+
};
|
|
120
|
+
const Section = styled.div`
|
|
121
|
+
display: flex;
|
|
122
|
+
flex-direction: column;
|
|
123
|
+
align-items: flex-start;
|
|
124
|
+
justify-content: center;
|
|
125
|
+
gap: 16px;
|
|
126
|
+
width: 100%;
|
|
127
|
+
`;
|
|
128
|
+
const Content = styled(Section)``;
|
|
129
|
+
const Title = styled(CpslText)``;
|
|
130
|
+
const EntryContainer = safeStyled.div`
|
|
131
|
+
position: relative;
|
|
132
|
+
width: 100%;
|
|
133
|
+
display: flex;
|
|
134
|
+
gap: 8px;
|
|
135
|
+
align-items: center;
|
|
136
|
+
`;
|
|
137
|
+
const EntryDisplayName = safeStyled(CpslText)``;
|
|
138
|
+
const EntryFlex = safeStyled.div`
|
|
139
|
+
flex: 1;
|
|
140
|
+
`;
|
|
141
|
+
const EntryAddress = safeStyled.div`
|
|
142
|
+
display: flex;
|
|
143
|
+
gap: 8px;
|
|
144
|
+
align-items: center;
|
|
145
|
+
`;
|
|
146
|
+
const CopyIcon = safeStyled(CpslIcon)`
|
|
147
|
+
--width: 16px;
|
|
148
|
+
--height: 16px;
|
|
149
|
+
--icon-color: ${({ isCopied }) => isCopied ? "var(--cpsl-color-utility-green) !important" : "var(--cpsl-color-text-secondary)"};
|
|
150
|
+
|
|
151
|
+
&:hover {
|
|
152
|
+
--icon-color: var(--cpsl-color-text-contrast);
|
|
153
|
+
}
|
|
154
|
+
`;
|
|
155
|
+
const EntryUnlink = styled.a`
|
|
156
|
+
color: var(--cpsl-color-utility-red);
|
|
157
|
+
position: absolute;
|
|
158
|
+
right: 0;
|
|
159
|
+
text-decoration: none;
|
|
160
|
+
font-size: 14px;
|
|
161
|
+
font-weight: 500;
|
|
162
|
+
font-family: var(--cpsl-font-family);
|
|
163
|
+
|
|
164
|
+
&:hover {
|
|
165
|
+
text-decoration: underline;
|
|
166
|
+
}
|
|
167
|
+
`;
|
|
168
|
+
export {
|
|
169
|
+
AccountProfile
|
|
170
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function AccountProfileLink(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__async
|
|
4
|
+
} from "../../../chunk-MMUBH76A.js";
|
|
5
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { HeroSpinner } from "@getpara/react-common";
|
|
7
|
+
import { CpslButton, CpslIcon } from "@getpara/react-components";
|
|
8
|
+
import { useEffect, useMemo } from "react";
|
|
9
|
+
import { HeroAccountTypeIcon, HeroSuccessIcon } from "../common.js";
|
|
10
|
+
import { VerificationCode } from "../VerificationCodeStep/VerificationCodeStep.js";
|
|
11
|
+
import { extractAuthInfo } from "@getpara/user-management-client";
|
|
12
|
+
import { FarcasterConnectQR } from "../OAuth/FarcasterOAuthStep.js";
|
|
13
|
+
import { useTelegramLogin } from "../../hooks/useTelegramLogin.js";
|
|
14
|
+
import { TelegramIFrame } from "../OAuth/TelegramOAuthStep.js";
|
|
15
|
+
import { AuthInput } from "../AuthInput/AuthInput.js";
|
|
16
|
+
import { useAccountLinking } from "../../../provider/providers/AccountLinkProvider.js";
|
|
17
|
+
import { useWalletDisplayHelpers, useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
|
|
18
|
+
import { ExternalWalletMobileConnect } from "../ExternalWalletStep/ExternalWalletStep.js";
|
|
19
|
+
import { useResendVerificationCode } from "../../../provider/index.js";
|
|
20
|
+
import { AccountLinkError } from "@getpara/web-sdk";
|
|
21
|
+
function AccountProfileLink() {
|
|
22
|
+
var _a, _b, _c, _d;
|
|
23
|
+
const {
|
|
24
|
+
accountLinkInProgress,
|
|
25
|
+
verifyEmailOrPhoneLink,
|
|
26
|
+
linkAccountStatus,
|
|
27
|
+
linkAccountError,
|
|
28
|
+
verifyTelegramLink,
|
|
29
|
+
linkAccount,
|
|
30
|
+
isLinkAccountPending,
|
|
31
|
+
resetMutations
|
|
32
|
+
} = useAccountLinking(), { wallets } = useExternalWallets(), { mutate: resendVerificationCode } = useResendVerificationCode(), accountLinkType = accountLinkInProgress == null ? void 0 : accountLinkInProgress.type, externalWalletProvider = (_b = accountLinkInProgress == null ? void 0 : accountLinkInProgress.pendingWalletProvider) != null ? _b : (_a = accountLinkInProgress == null ? void 0 : accountLinkInProgress.externalWallet) == null ? void 0 : _a.providerId, externalWalletType = (_d = accountLinkInProgress == null ? void 0 : accountLinkInProgress.pendingWalletType) != null ? _d : (_c = accountLinkInProgress == null ? void 0 : accountLinkInProgress.externalWallet) == null ? void 0 : _c.type, accountLinkIcon = externalWalletProvider != null ? externalWalletProvider : accountLinkType, isTelegram = accountLinkType === "TELEGRAM", {
|
|
33
|
+
url,
|
|
34
|
+
status: telegramStatus,
|
|
35
|
+
isLoaded,
|
|
36
|
+
setIsLoaded
|
|
37
|
+
} = useTelegramLogin(
|
|
38
|
+
isTelegram ? { isActive: isTelegram, status: linkAccountStatus, onSubmit: verifyTelegramLink } : { isActive: false }
|
|
39
|
+
), status = (accountLinkInProgress == null ? void 0 : accountLinkInProgress.isComplete) ? "success" : isTelegram ? telegramStatus : linkAccountStatus, commonWallet = useMemo(() => {
|
|
40
|
+
const wallet = wallets.find((w) => w.internalId === externalWalletProvider && w.type === externalWalletType);
|
|
41
|
+
return wallet;
|
|
42
|
+
}, [wallets]), walletDisplayHelpers = useWalletDisplayHelpers(commonWallet);
|
|
43
|
+
const { upper, lower } = useMemo(() => {
|
|
44
|
+
let upper2 = null, lower2 = null;
|
|
45
|
+
let message;
|
|
46
|
+
switch (status) {
|
|
47
|
+
case "pending":
|
|
48
|
+
message = externalWalletType ? "Confirm wallet connection" : "Confirm login request";
|
|
49
|
+
break;
|
|
50
|
+
case "success":
|
|
51
|
+
message = "Account linked";
|
|
52
|
+
break;
|
|
53
|
+
case "error":
|
|
54
|
+
switch (linkAccountError) {
|
|
55
|
+
case AccountLinkError.Conflict:
|
|
56
|
+
message = "Account already linked";
|
|
57
|
+
break;
|
|
58
|
+
default:
|
|
59
|
+
message = (accountLinkInProgress == null ? void 0 : accountLinkInProgress.type) === "EXTERNAL_WALLET" ? "Connection failed" : "Login failed";
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
break;
|
|
63
|
+
default:
|
|
64
|
+
message = null;
|
|
65
|
+
}
|
|
66
|
+
const heroSpinner = /* @__PURE__ */ jsx(
|
|
67
|
+
HeroSpinner,
|
|
68
|
+
{
|
|
69
|
+
status,
|
|
70
|
+
icon: status === "success" ? /* @__PURE__ */ jsx(HeroSuccessIcon, {}) : /* @__PURE__ */ jsx(HeroAccountTypeIcon, { accountType: accountLinkIcon }),
|
|
71
|
+
text: message
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
``;
|
|
75
|
+
const onTryAgain = externalWalletProvider && externalWalletType ? () => linkAccount({ externalWallet: { internalId: externalWalletProvider, type: externalWalletType } }) : accountLinkType && accountLinkType !== "EXTERNAL_WALLET" ? () => linkAccount({ type: accountLinkType }) : void 0;
|
|
76
|
+
const tryAgain = onTryAgain ? /* @__PURE__ */ jsxs(CpslButton, { variant: "secondary", fullWidth: true, onClick: onTryAgain, children: [
|
|
77
|
+
/* @__PURE__ */ jsx(CpslIcon, { icon: "refresh", slot: "start" }),
|
|
78
|
+
"Try Again"
|
|
79
|
+
] }) : null;
|
|
80
|
+
if (!accountLinkInProgress) {
|
|
81
|
+
return { upper: upper2, lower: lower2 };
|
|
82
|
+
}
|
|
83
|
+
switch (true) {
|
|
84
|
+
// Email or phone input
|
|
85
|
+
case (!accountLinkInProgress.identifier && (accountLinkInProgress.type === "EMAIL" || accountLinkInProgress.type === "PHONE")):
|
|
86
|
+
upper2 = heroSpinner;
|
|
87
|
+
lower2 = /* @__PURE__ */ jsx(
|
|
88
|
+
AuthInput,
|
|
89
|
+
{
|
|
90
|
+
disableEmailLogin: accountLinkInProgress.type !== "EMAIL",
|
|
91
|
+
disablePhoneLogin: accountLinkInProgress.type !== "PHONE",
|
|
92
|
+
onSubmit: (auth) => {
|
|
93
|
+
try {
|
|
94
|
+
linkAccount({
|
|
95
|
+
auth
|
|
96
|
+
});
|
|
97
|
+
} catch (e) {
|
|
98
|
+
throw e;
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
error: linkAccountError === "CONFLICT" ? "Account already linked" : void 0,
|
|
102
|
+
isSubmitting: isLinkAccountPending,
|
|
103
|
+
disableSubmitButton: true,
|
|
104
|
+
children: ({ isSubmitting, onSubmit, isPending }) => {
|
|
105
|
+
return /* @__PURE__ */ jsxs(CpslButton, { variant: "primary", onClick: onSubmit, disabled: isPending || isSubmitting, fullWidth: true, children: [
|
|
106
|
+
"Link ",
|
|
107
|
+
accountLinkType === "EMAIL" ? "Email Address" : "Phone Number"
|
|
108
|
+
] });
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
break;
|
|
113
|
+
// Verify email or phone code
|
|
114
|
+
case ((accountLinkType === "EMAIL" || accountLinkType === "PHONE") && (accountLinkInProgress == null ? void 0 : accountLinkInProgress.identifier) && status !== "success"):
|
|
115
|
+
{
|
|
116
|
+
const authInfo = extractAuthInfo(
|
|
117
|
+
accountLinkType === "EMAIL" ? { email: accountLinkInProgress.identifier } : { phone: accountLinkInProgress.identifier },
|
|
118
|
+
{ isRequired: true }
|
|
119
|
+
);
|
|
120
|
+
lower2 = /* @__PURE__ */ jsx(
|
|
121
|
+
VerificationCode,
|
|
122
|
+
{
|
|
123
|
+
authInfo,
|
|
124
|
+
onSubmit: verifyEmailOrPhoneLink,
|
|
125
|
+
onResend: () => {
|
|
126
|
+
resendVerificationCode({ type: "LINK_ACCOUNT" });
|
|
127
|
+
},
|
|
128
|
+
status: linkAccountStatus,
|
|
129
|
+
error: linkAccountError
|
|
130
|
+
}
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
break;
|
|
134
|
+
// Farcaster Connect QR
|
|
135
|
+
case (accountLinkType === "FARCASTER" && status !== "success"):
|
|
136
|
+
lower2 = /* @__PURE__ */ jsx(FarcasterConnectQR, {});
|
|
137
|
+
break;
|
|
138
|
+
// OAuth, External Wallet, Telegram
|
|
139
|
+
default:
|
|
140
|
+
upper2 = heroSpinner;
|
|
141
|
+
switch (true) {
|
|
142
|
+
case accountLinkType === "EXTERNAL_WALLET":
|
|
143
|
+
{
|
|
144
|
+
if (commonWallet && walletDisplayHelpers.showMobile) {
|
|
145
|
+
upper2 = status === "success" || status === "error" ? heroSpinner : /* @__PURE__ */ jsx(
|
|
146
|
+
ExternalWalletMobileConnect,
|
|
147
|
+
{
|
|
148
|
+
wallet: commonWallet,
|
|
149
|
+
isSelfFetching: true,
|
|
150
|
+
onConnectWc: (w) => __async(this, null, function* () {
|
|
151
|
+
yield linkAccount({ externalWallet: { internalId: w.internalId, type: w.type } });
|
|
152
|
+
})
|
|
153
|
+
}
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
lower2 = linkAccountError ? tryAgain : null;
|
|
157
|
+
}
|
|
158
|
+
break;
|
|
159
|
+
case accountLinkType === "TELEGRAM":
|
|
160
|
+
lower2 = /* @__PURE__ */ jsx(
|
|
161
|
+
TelegramIFrame,
|
|
162
|
+
{
|
|
163
|
+
url,
|
|
164
|
+
isLoaded,
|
|
165
|
+
setIsLoaded,
|
|
166
|
+
isVisible: status === "error" || status === "idle"
|
|
167
|
+
}
|
|
168
|
+
);
|
|
169
|
+
break;
|
|
170
|
+
case (status === "error" && !!accountLinkInProgress):
|
|
171
|
+
lower2 = tryAgain;
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
return {
|
|
177
|
+
upper: upper2,
|
|
178
|
+
lower: lower2
|
|
179
|
+
};
|
|
180
|
+
}, [
|
|
181
|
+
linkAccountError,
|
|
182
|
+
accountLinkType,
|
|
183
|
+
accountLinkInProgress,
|
|
184
|
+
telegramStatus,
|
|
185
|
+
url,
|
|
186
|
+
isLoaded,
|
|
187
|
+
linkAccount,
|
|
188
|
+
status,
|
|
189
|
+
isTelegram,
|
|
190
|
+
externalWalletType,
|
|
191
|
+
commonWallet,
|
|
192
|
+
walletDisplayHelpers.showMobile
|
|
193
|
+
]);
|
|
194
|
+
useEffect(() => {
|
|
195
|
+
return () => {
|
|
196
|
+
resetMutations();
|
|
197
|
+
};
|
|
198
|
+
}, []);
|
|
199
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
200
|
+
upper,
|
|
201
|
+
lower
|
|
202
|
+
] });
|
|
203
|
+
}
|
|
204
|
+
export {
|
|
205
|
+
AccountProfileLink
|
|
206
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function AccountProfileLinkOptions(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { AuthInput } from "../AuthInput/AuthInput.js";
|
|
5
|
+
import { AccountTypeIcon, GradientScroll, StepContainer } from "../common.js";
|
|
6
|
+
import styled from "styled-components";
|
|
7
|
+
import { CpslButton, CpslDivider, CpslText } from "@getpara/react-components";
|
|
8
|
+
import { getAccountTypeName } from "../../constants/oAuthLogos.js";
|
|
9
|
+
import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
|
|
10
|
+
import { useAccountLinking } from "../../../provider/providers/AccountLinkProvider.js";
|
|
11
|
+
import { useEffect, useMemo } from "react";
|
|
12
|
+
import { EXTERNAL_WALLET_TYPES } from "@getpara/web-sdk";
|
|
13
|
+
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
14
|
+
function isExternalWallet(str) {
|
|
15
|
+
return EXTERNAL_WALLET_TYPES.includes(str);
|
|
16
|
+
}
|
|
17
|
+
function AccountProfileLinkOptions() {
|
|
18
|
+
const para = useInternalClient();
|
|
19
|
+
const { accountLinkOptions, linkAccount, isLinkAccountPending, linkAccountError, setLinkAccountError, resetMutations } = useAccountLinking();
|
|
20
|
+
const { wallet: connectedWallet, wallets } = useExternalWallets();
|
|
21
|
+
const [isEmail, isPhone, externalWalletIndex, isOptions] = [
|
|
22
|
+
accountLinkOptions.includes("EMAIL"),
|
|
23
|
+
accountLinkOptions.includes("PHONE"),
|
|
24
|
+
accountLinkOptions.indexOf("EXTERNAL_WALLET"),
|
|
25
|
+
(accountLinkOptions || []).filter((o) => o !== "EMAIL" && o !== "PHONE").length > 0
|
|
26
|
+
];
|
|
27
|
+
const options = useMemo(() => {
|
|
28
|
+
const baseOptions = externalWalletIndex >= 0 ? [
|
|
29
|
+
...accountLinkOptions.slice(0, externalWalletIndex),
|
|
30
|
+
...EXTERNAL_WALLET_TYPES,
|
|
31
|
+
...accountLinkOptions.slice(externalWalletIndex + 1)
|
|
32
|
+
] : accountLinkOptions;
|
|
33
|
+
return Array.from(
|
|
34
|
+
new Set(
|
|
35
|
+
baseOptions.filter((option) => {
|
|
36
|
+
if (!isExternalWallet(option) || (connectedWallet == null ? void 0 : connectedWallet.internalId) !== option && wallets.some(({ type, internalId, installed, isMobile }) => {
|
|
37
|
+
return (installed || isMobile) && (para == null ? void 0 : para.supportedWalletTypes.some((obj) => obj.type === type)) && internalId === option;
|
|
38
|
+
})) {
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
return false;
|
|
42
|
+
})
|
|
43
|
+
)
|
|
44
|
+
);
|
|
45
|
+
}, [accountLinkOptions, externalWalletIndex, wallets]);
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
resetMutations();
|
|
48
|
+
setLinkAccountError(null);
|
|
49
|
+
}, []);
|
|
50
|
+
const getExternalWalletType = (internalId) => {
|
|
51
|
+
const allWallets = wallets.filter((wallet) => wallet.internalId === internalId);
|
|
52
|
+
if (allWallets.length === 1) {
|
|
53
|
+
return allWallets[0].type;
|
|
54
|
+
}
|
|
55
|
+
return void 0;
|
|
56
|
+
};
|
|
57
|
+
return /* @__PURE__ */ jsx(StepContainer, { $wide: true, children: /* @__PURE__ */ jsxs(Content, { children: [
|
|
58
|
+
(isEmail || isPhone) && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
59
|
+
/* @__PURE__ */ jsx(
|
|
60
|
+
AuthInput,
|
|
61
|
+
{
|
|
62
|
+
disableEmailLogin: !isEmail,
|
|
63
|
+
disablePhoneLogin: !isPhone,
|
|
64
|
+
onSubmit: (auth) => {
|
|
65
|
+
linkAccount({
|
|
66
|
+
auth
|
|
67
|
+
});
|
|
68
|
+
},
|
|
69
|
+
error: linkAccountError ? linkAccountError === "CONFLICT" ? "Account already linked" : "An unknown error occurred" : void 0,
|
|
70
|
+
isSubmitting: isLinkAccountPending
|
|
71
|
+
}
|
|
72
|
+
),
|
|
73
|
+
isOptions && /* @__PURE__ */ jsx(CpslDivider, { children: "or" })
|
|
74
|
+
] }),
|
|
75
|
+
isOptions && /* @__PURE__ */ jsx(GradientScroll, { height: "320px", children: options.filter((option) => option !== "EMAIL" && option !== "PHONE").map((option) => {
|
|
76
|
+
const isWallet = isExternalWallet(option);
|
|
77
|
+
return /* @__PURE__ */ jsxs(
|
|
78
|
+
Option,
|
|
79
|
+
{
|
|
80
|
+
fullWidth: true,
|
|
81
|
+
variant: "tertiary",
|
|
82
|
+
onClick: () => linkAccount(
|
|
83
|
+
isWallet ? { externalWallet: { internalId: option, type: getExternalWalletType(option) } } : { type: option }
|
|
84
|
+
),
|
|
85
|
+
children: [
|
|
86
|
+
/* @__PURE__ */ jsx(AccountTypeIcon, { accountType: option, size: "24px" }),
|
|
87
|
+
/* @__PURE__ */ jsx(CpslText, { color: "contrast", variant: "bodyM", children: getAccountTypeName(option) })
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
option
|
|
91
|
+
);
|
|
92
|
+
}) })
|
|
93
|
+
] }) });
|
|
94
|
+
}
|
|
95
|
+
const Content = styled.div`
|
|
96
|
+
display: flex;
|
|
97
|
+
flex-direction: column;
|
|
98
|
+
align-items: flex-start;
|
|
99
|
+
gap: 8px;
|
|
100
|
+
width: 100%;
|
|
101
|
+
`;
|
|
102
|
+
const Option = styled(CpslButton)`
|
|
103
|
+
--button-justify-content: flex-start;
|
|
104
|
+
|
|
105
|
+
height: 48px;
|
|
106
|
+
display: flex;
|
|
107
|
+
align-items: flex-start;
|
|
108
|
+
`;
|
|
109
|
+
export {
|
|
110
|
+
AccountProfileLinkOptions
|
|
111
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function AccountProfileUnlink(): import("react/jsx-runtime").JSX.Element;
|