@getpara/react-sdk-lite 2.0.0-alpha.33 → 2.0.0-alpha.35
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/components/Account/AccountProfile.js +22 -4
- package/dist/modal/components/Account/AccountProfileLink.js +10 -5
- package/dist/modal/components/Account/AccountProfileLinkOptions.js +21 -13
- package/dist/modal/components/Account/AccountProfileUnlink.js +6 -4
- package/dist/modal/components/AddFunds/AddFundsAwaiting.d.ts +1 -1
- package/dist/modal/components/AddFunds/AddFundsAwaiting.js +3 -54
- package/dist/modal/components/AddFunds/AddFundsProvider.js +2 -6
- package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +2 -2
- package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.js +6 -6
- package/dist/modal/components/ExternalWallets/ExternalWallets.js +5 -5
- package/dist/modal/components/OAuth/OAuth.js +3 -5
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +2 -2
- package/dist/modal/components/common.d.ts +7 -5
- package/dist/modal/components/common.js +5 -4
- package/dist/modal/constants/constants.js +1 -1
- package/dist/modal/constants/oAuthLogos.d.ts +2 -3
- package/dist/modal/constants/oAuthLogos.js +28 -28
- package/dist/modal/stores/modal/actions.js +2 -2
- package/dist/modal/stores/modal/useModalStore.d.ts +8 -2
- package/dist/modal/stores/modal/useModalStore.js +1 -1
- package/dist/provider/components/ExternalWalletWrapper.js +3 -26
- package/dist/provider/hooks/mutations/index.d.ts +28 -2
- package/dist/provider/hooks/mutations/index.js +57 -3
- package/dist/provider/hooks/mutations/useClaimPregenWallets.d.ts +40 -0
- package/dist/provider/hooks/mutations/useClaimPregenWallets.js +28 -0
- package/dist/provider/hooks/mutations/useCreateGuestWallets.d.ts +33 -0
- package/dist/provider/hooks/mutations/useCreateGuestWallets.js +28 -0
- package/dist/provider/hooks/mutations/useCreatePregenWallet.d.ts +120 -0
- package/dist/provider/hooks/mutations/useCreatePregenWallet.js +28 -0
- package/dist/provider/hooks/mutations/useCreatePregenWalletPerType.d.ts +42 -0
- package/dist/provider/hooks/mutations/useCreatePregenWalletPerType.js +28 -0
- package/dist/provider/hooks/mutations/useCreateWallet.d.ts +42 -0
- package/dist/provider/hooks/mutations/useCreateWallet.js +28 -0
- package/dist/provider/hooks/mutations/useCreateWalletPerType.d.ts +54 -0
- package/dist/provider/hooks/mutations/useCreateWalletPerType.js +28 -0
- package/dist/provider/hooks/mutations/useEnable2fa.d.ts +39 -0
- package/dist/provider/hooks/mutations/useEnable2fa.js +28 -0
- package/dist/provider/hooks/mutations/useHasPregenWallet.d.ts +40 -0
- package/dist/provider/hooks/mutations/useHasPregenWallet.js +28 -0
- package/dist/provider/hooks/mutations/useIssueJwt.d.ts +48 -0
- package/dist/provider/hooks/mutations/useIssueJwt.js +28 -0
- package/dist/provider/hooks/mutations/useKeepSessionAlive.d.ts +34 -0
- package/dist/provider/hooks/mutations/useKeepSessionAlive.js +28 -0
- package/dist/provider/hooks/mutations/useLinkAccount.d.ts +30 -1
- package/dist/provider/hooks/mutations/useLinkAccount.js +3 -1
- package/dist/provider/hooks/mutations/useLoginExternalWallet.d.ts +46 -0
- package/dist/provider/hooks/mutations/useLoginExternalWallet.js +28 -0
- package/dist/provider/hooks/mutations/useLogout.d.ts +39 -0
- package/dist/provider/hooks/mutations/useLogout.js +28 -0
- package/dist/provider/hooks/mutations/useResendVerificationCode.d.ts +40 -0
- package/dist/provider/hooks/mutations/useResendVerificationCode.js +28 -0
- package/dist/provider/hooks/mutations/useSetup2fa.d.ts +34 -0
- package/dist/provider/hooks/mutations/useSetup2fa.js +28 -0
- package/dist/provider/hooks/mutations/useSignMessage.d.ts +58 -0
- package/dist/provider/hooks/mutations/useSignMessage.js +28 -0
- package/dist/provider/hooks/mutations/useSignTransaction.d.ts +58 -0
- package/dist/provider/hooks/mutations/useSignTransaction.js +28 -0
- package/dist/provider/hooks/mutations/useSignUpOrLogIn.d.ts +46 -0
- package/dist/provider/hooks/mutations/useSignUpOrLogIn.js +28 -0
- package/dist/provider/hooks/mutations/useUpdatePregenWalletIdentifier.d.ts +42 -0
- package/dist/provider/hooks/mutations/useUpdatePregenWalletIdentifier.js +28 -0
- package/dist/provider/hooks/mutations/useVerify2fa.d.ts +57 -0
- package/dist/provider/hooks/mutations/useVerify2fa.js +28 -0
- package/dist/provider/hooks/mutations/useVerifyExternalWallet.d.ts +93 -0
- package/dist/provider/hooks/mutations/useVerifyExternalWallet.js +28 -0
- package/dist/provider/hooks/mutations/useVerifyFarcaster.d.ts +55 -0
- package/dist/provider/hooks/mutations/useVerifyFarcaster.js +28 -0
- package/dist/provider/hooks/mutations/useVerifyNewAccount.d.ts +84 -0
- package/dist/provider/hooks/mutations/useVerifyNewAccount.js +28 -0
- package/dist/provider/hooks/mutations/useVerifyOAuth.d.ts +64 -0
- package/dist/provider/hooks/mutations/useVerifyOAuth.js +28 -0
- package/dist/provider/hooks/mutations/useVerifyTelegram.d.ts +46 -0
- package/dist/provider/hooks/mutations/useVerifyTelegram.js +28 -0
- package/dist/provider/hooks/mutations/useWaitForLogin.d.ts +57 -0
- package/dist/provider/hooks/mutations/useWaitForLogin.js +28 -0
- package/dist/provider/hooks/mutations/useWaitForSignup.d.ts +45 -0
- package/dist/provider/hooks/mutations/useWaitForSignup.js +28 -0
- package/dist/provider/hooks/mutations/useWaitForWalletCreation.d.ts +54 -0
- package/dist/provider/hooks/mutations/useWaitForWalletCreation.js +28 -0
- package/dist/provider/hooks/mutations/utils.d.ts +2 -7
- package/dist/provider/hooks/mutations/utils.js +0 -24
- package/dist/provider/hooks/queries/index.d.ts +2 -1
- package/dist/provider/hooks/queries/index.js +4 -1
- package/dist/provider/hooks/queries/useAccountLinkInProgress.d.ts +6 -0
- package/dist/provider/hooks/queries/useAccountLinkInProgress.js +24 -0
- package/dist/provider/hooks/queries/useLinkedAccounts.d.ts +11 -0
- package/dist/provider/hooks/queries/useLinkedAccounts.js +24 -0
- package/dist/provider/providers/AccountLinkProvider.d.ts +4 -4
- package/dist/provider/providers/AccountLinkProvider.js +17 -13
- package/dist/provider/providers/AuthProvider.d.ts +0 -1
- package/dist/provider/providers/AuthProvider.js +18 -45
- package/dist/provider/providers/ExternalWalletProvider.d.ts +6 -5
- package/dist/provider/providers/ExternalWalletProvider.js +21 -26
- package/dist/provider/utils/externalWalletDefaults.d.ts +6 -0
- package/dist/provider/utils/externalWalletDefaults.js +33 -0
- package/dist/provider/utils/renameMutations.d.ts +9 -5
- package/dist/provider/utils/renameMutations.js +3 -5
- package/package.json +8 -8
- package/dist/provider/hooks/mutations/core.d.ts +0 -27
- package/dist/provider/hooks/mutations/core.js +0 -66
- package/dist/provider/hooks/queries/core.d.ts +0 -4
- package/dist/provider/hooks/queries/core.js +0 -16
- package/dist/provider/hooks/queries/utils.d.ts +0 -7
- package/dist/provider/hooks/queries/utils.js +0 -25
|
@@ -12,7 +12,8 @@ import { getWalletDisplayName } from "../../utils/getWalletDisplayName.js";
|
|
|
12
12
|
import { truncateAddress } from "@getpara/web-sdk";
|
|
13
13
|
import { useAccountLinking } from "../../../provider/providers/AccountLinkProvider.js";
|
|
14
14
|
import { safeStyled, useCopyToClipboard } from "@getpara/react-common";
|
|
15
|
-
import {
|
|
15
|
+
import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
|
|
16
|
+
import { ACCOUNT_TYPES } from "../../constants/oAuthLogos.js";
|
|
16
17
|
const Entry = ({
|
|
17
18
|
identifier,
|
|
18
19
|
icon,
|
|
@@ -48,6 +49,7 @@ const AccountProfile = () => {
|
|
|
48
49
|
var _a, _b, _c, _d, _e, _f;
|
|
49
50
|
const para = useClient();
|
|
50
51
|
const { data: linkedAccounts } = useLinkedAccounts();
|
|
52
|
+
const { wallets } = useExternalWallets();
|
|
51
53
|
const { isEnabled, linkAccount, unlinkAccount } = useAccountLinking();
|
|
52
54
|
if (!para) {
|
|
53
55
|
return null;
|
|
@@ -60,7 +62,7 @@ const AccountProfile = () => {
|
|
|
60
62
|
Entry,
|
|
61
63
|
{
|
|
62
64
|
icon: /* @__PURE__ */ jsx(AccountTypeIcon, { accountType: externalWallet.providerId, size: "24px" }),
|
|
63
|
-
name: (_c = (_b = externalWallet.ensName) != null ? _b :
|
|
65
|
+
name: (_c = (_b = externalWallet.ensName) != null ? _b : externalWallet.provider) != null ? _c : "",
|
|
64
66
|
address: (_d = externalWallet.addressBech32) != null ? _d : externalWallet.address,
|
|
65
67
|
addressShort: truncateAddress((_e = externalWallet.addressBech32) != null ? _e : externalWallet.address, externalWallet.type, {
|
|
66
68
|
prefix: para.cosmosPrefix
|
|
@@ -90,11 +92,26 @@ const AccountProfile = () => {
|
|
|
90
92
|
].map((linkedAccount) => {
|
|
91
93
|
var _a2, _b2, _c2, _d2, _e2;
|
|
92
94
|
const { identifier, displayName, type, isPrimary = false, externalWallet: externalWallet2 } = linkedAccount;
|
|
95
|
+
const externalWalletConnector = wallets.find((wallet) => wallet.id === (externalWallet2 == null ? void 0 : externalWallet2.providerId));
|
|
96
|
+
let accountType = type;
|
|
97
|
+
let src = void 0;
|
|
98
|
+
if (externalWallet2) {
|
|
99
|
+
if (externalWalletConnector) {
|
|
100
|
+
accountType = void 0;
|
|
101
|
+
src = externalWalletConnector.iconUrl;
|
|
102
|
+
} else if (externalWallet2.providerId && ACCOUNT_TYPES[externalWallet2.providerId]) {
|
|
103
|
+
accountType = externalWallet2.providerId;
|
|
104
|
+
src = void 0;
|
|
105
|
+
} else {
|
|
106
|
+
accountType = "EXTERNAL_WALLET";
|
|
107
|
+
src = void 0;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
93
110
|
return /* @__PURE__ */ jsx(
|
|
94
111
|
Entry,
|
|
95
112
|
{
|
|
96
|
-
icon: /* @__PURE__ */ jsx(AccountTypeIcon, { accountType
|
|
97
|
-
name: externalWallet2 ? (_c2 = (_b2 = externalWallet2.ensName) != null ? _b2 :
|
|
113
|
+
icon: /* @__PURE__ */ jsx(AccountTypeIcon, { accountType, src, size: "24px" }),
|
|
114
|
+
name: externalWallet2 ? (_c2 = (_b2 = (_a2 = externalWallet2.ensName) != null ? _a2 : externalWalletConnector == null ? void 0 : externalWalletConnector.name) != null ? _b2 : externalWallet2.provider) != null ? _c2 : "" : displayName != null ? displayName : identifier,
|
|
98
115
|
address: (_d2 = externalWallet2 == null ? void 0 : externalWallet2.addressBech32) != null ? _d2 : externalWallet2 == null ? void 0 : externalWallet2.address,
|
|
99
116
|
addressShort: externalWallet2 ? truncateAddress((_e2 = externalWallet2.addressBech32) != null ? _e2 : externalWallet2.address, externalWallet2.type, {
|
|
100
117
|
prefix: para.cosmosPrefix
|
|
@@ -126,6 +143,7 @@ const Section = safeStyled.div`
|
|
|
126
143
|
const Content = safeStyled(Section)``;
|
|
127
144
|
const Title = safeStyled(CpslText)``;
|
|
128
145
|
const EntryContainer = safeStyled.div`
|
|
146
|
+
overflow: hidden;
|
|
129
147
|
position: relative;
|
|
130
148
|
width: 100%;
|
|
131
149
|
display: flex;
|
|
@@ -29,7 +29,7 @@ function AccountProfileLink() {
|
|
|
29
29
|
linkAccount,
|
|
30
30
|
isLinkAccountPending,
|
|
31
31
|
resetMutations
|
|
32
|
-
} = useAccountLinking(), { wallets } = useExternalWallets(), {
|
|
32
|
+
} = useAccountLinking(), { wallets } = useExternalWallets(), { 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, externalWallet = wallets.find((w) => w.id === externalWalletProvider), isTelegram = accountLinkType === "TELEGRAM", {
|
|
33
33
|
url,
|
|
34
34
|
status: telegramStatus,
|
|
35
35
|
isLoaded,
|
|
@@ -67,12 +67,17 @@ function AccountProfileLink() {
|
|
|
67
67
|
HeroSpinner,
|
|
68
68
|
{
|
|
69
69
|
status,
|
|
70
|
-
icon: status === "success" ? /* @__PURE__ */ jsx(HeroSuccessIcon, {}) : /* @__PURE__ */ jsx(
|
|
70
|
+
icon: status === "success" ? /* @__PURE__ */ jsx(HeroSuccessIcon, {}) : /* @__PURE__ */ jsx(
|
|
71
|
+
HeroAccountTypeIcon,
|
|
72
|
+
{
|
|
73
|
+
accountType: externalWallet ? void 0 : accountLinkType,
|
|
74
|
+
src: externalWallet ? externalWallet.iconUrl : void 0
|
|
75
|
+
}
|
|
76
|
+
),
|
|
71
77
|
text: message
|
|
72
78
|
}
|
|
73
79
|
);
|
|
74
|
-
|
|
75
|
-
const onTryAgain = externalWalletProvider && externalWalletType ? () => linkAccount({ externalWallet: { internalId: externalWalletProvider, type: externalWalletType } }) : accountLinkType && accountLinkType !== "EXTERNAL_WALLET" ? () => linkAccount({ type: accountLinkType }) : void 0;
|
|
80
|
+
const onTryAgain = externalWalletProvider && externalWalletType ? () => linkAccount({ externalWallet: { provider: externalWalletProvider, type: externalWalletType } }) : accountLinkType && accountLinkType !== "EXTERNAL_WALLET" ? () => linkAccount({ type: accountLinkType }) : void 0;
|
|
76
81
|
const tryAgain = onTryAgain ? /* @__PURE__ */ jsxs(CpslButton, { variant: "secondary", fullWidth: true, onClick: onTryAgain, children: [
|
|
77
82
|
/* @__PURE__ */ jsx(CpslIcon, { icon: "refresh", slot: "start" }),
|
|
78
83
|
"Try Again"
|
|
@@ -148,7 +153,7 @@ function AccountProfileLink() {
|
|
|
148
153
|
wallet: commonWallet,
|
|
149
154
|
isSelfFetching: true,
|
|
150
155
|
onConnectWc: (w) => __async(this, null, function* () {
|
|
151
|
-
yield linkAccount({ externalWallet: {
|
|
156
|
+
yield linkAccount({ externalWallet: { provider: w.id, type: w.type } });
|
|
152
157
|
})
|
|
153
158
|
}
|
|
154
159
|
);
|
|
@@ -8,12 +8,8 @@ import { getAccountTypeName } from "../../constants/oAuthLogos.js";
|
|
|
8
8
|
import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
|
|
9
9
|
import { useAccountLinking } from "../../../provider/providers/AccountLinkProvider.js";
|
|
10
10
|
import { useEffect, useMemo } from "react";
|
|
11
|
-
import { EXTERNAL_WALLET_TYPES } from "@getpara/web-sdk";
|
|
12
11
|
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
13
12
|
import { safeStyled } from "@getpara/react-common";
|
|
14
|
-
function isExternalWallet(str) {
|
|
15
|
-
return EXTERNAL_WALLET_TYPES.includes(str);
|
|
16
|
-
}
|
|
17
13
|
function AccountProfileLinkOptions() {
|
|
18
14
|
const para = useInternalClient();
|
|
19
15
|
const { accountLinkOptions, linkAccount, isLinkAccountPending, linkAccountError, setLinkAccountError, resetMutations } = useAccountLinking();
|
|
@@ -27,14 +23,14 @@ function AccountProfileLinkOptions() {
|
|
|
27
23
|
const options = useMemo(() => {
|
|
28
24
|
const baseOptions = externalWalletIndex >= 0 ? [
|
|
29
25
|
...accountLinkOptions.slice(0, externalWalletIndex),
|
|
30
|
-
...
|
|
26
|
+
...wallets.map((wallet) => wallet.id),
|
|
31
27
|
...accountLinkOptions.slice(externalWalletIndex + 1)
|
|
32
28
|
] : accountLinkOptions;
|
|
33
29
|
return Array.from(
|
|
34
30
|
new Set(
|
|
35
31
|
baseOptions.filter((option) => {
|
|
36
|
-
if (!
|
|
37
|
-
return (installed || isMobile) && (para == null ? void 0 : para.supportedWalletTypes.some((obj) => obj.type === type)) &&
|
|
32
|
+
if (!wallets.some((wallet) => wallet.id === option) || (connectedWallet == null ? void 0 : connectedWallet.id) !== option && wallets.some(({ type, id, installed, isMobile }) => {
|
|
33
|
+
return (installed || isMobile) && (para == null ? void 0 : para.supportedWalletTypes.some((obj) => obj.type === type)) && id === option;
|
|
38
34
|
})) {
|
|
39
35
|
return true;
|
|
40
36
|
}
|
|
@@ -47,8 +43,8 @@ function AccountProfileLinkOptions() {
|
|
|
47
43
|
resetMutations();
|
|
48
44
|
setLinkAccountError(null);
|
|
49
45
|
}, []);
|
|
50
|
-
const getExternalWalletType = (
|
|
51
|
-
const allWallets = wallets.filter((wallet) => wallet.
|
|
46
|
+
const getExternalWalletType = (id) => {
|
|
47
|
+
const allWallets = wallets.filter((wallet) => wallet.id === id);
|
|
52
48
|
if (allWallets.length === 1) {
|
|
53
49
|
return allWallets[0].type;
|
|
54
50
|
}
|
|
@@ -73,18 +69,30 @@ function AccountProfileLinkOptions() {
|
|
|
73
69
|
isOptions && /* @__PURE__ */ jsx(CpslDivider, { children: "or" })
|
|
74
70
|
] }),
|
|
75
71
|
isOptions && /* @__PURE__ */ jsx(GradientScroll, { height: "320px", children: options.filter((option) => option !== "EMAIL" && option !== "PHONE").map((option) => {
|
|
76
|
-
const
|
|
72
|
+
const externalWallet = wallets.find((wallet) => wallet.id === option);
|
|
77
73
|
return /* @__PURE__ */ jsxs(
|
|
78
74
|
Option,
|
|
79
75
|
{
|
|
80
76
|
fullWidth: true,
|
|
81
77
|
variant: "tertiary",
|
|
82
78
|
onClick: () => linkAccount(
|
|
83
|
-
|
|
79
|
+
!!externalWallet ? {
|
|
80
|
+
externalWallet: {
|
|
81
|
+
provider: externalWallet.id,
|
|
82
|
+
type: getExternalWalletType(externalWallet.id)
|
|
83
|
+
}
|
|
84
|
+
} : { type: option }
|
|
84
85
|
),
|
|
85
86
|
children: [
|
|
86
|
-
/* @__PURE__ */ jsx(
|
|
87
|
-
|
|
87
|
+
/* @__PURE__ */ jsx(
|
|
88
|
+
AccountTypeIcon,
|
|
89
|
+
{
|
|
90
|
+
accountType: externalWallet ? void 0 : option,
|
|
91
|
+
src: externalWallet ? externalWallet.iconUrl : void 0,
|
|
92
|
+
size: "24px"
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
/* @__PURE__ */ jsx(CpslText, { color: "contrast", variant: "bodyM", children: externalWallet ? externalWallet.name : getAccountTypeName(option) })
|
|
88
96
|
]
|
|
89
97
|
},
|
|
90
98
|
option
|
|
@@ -9,19 +9,21 @@ import { useAccountLinking } from "../../../provider/providers/AccountLinkProvid
|
|
|
9
9
|
import { safeStyled } from "@getpara/react-common";
|
|
10
10
|
function AccountProfileUnlink() {
|
|
11
11
|
var _a, _b;
|
|
12
|
-
const { unlinkingAccount, unlinkAccountConfirm, isUnlinkAccountPending } = useAccountLinking(), [accountType, setAccountType] = useState((_b = (_a = unlinkingAccount == null ? void 0 : unlinkingAccount.externalWallet) == null ? void 0 : _a.providerId) != null ? _b : unlinkingAccount == null ? void 0 : unlinkingAccount.type);
|
|
12
|
+
const { unlinkingAccount, unlinkAccountConfirm, isUnlinkAccountPending } = useAccountLinking(), [accountType, setAccountType] = useState((_b = (_a = unlinkingAccount == null ? void 0 : unlinkingAccount.externalWallet) == null ? void 0 : _a.providerId) != null ? _b : unlinkingAccount == null ? void 0 : unlinkingAccount.type), [isUnlinkingExternalWallet, setIsUnlinkingExternalWallet] = useState(false);
|
|
13
13
|
useEffect(() => {
|
|
14
14
|
var _a2, _b2;
|
|
15
15
|
if (unlinkingAccount) {
|
|
16
|
-
setAccountType((_b2 = (_a2 = unlinkingAccount == null ? void 0 : unlinkingAccount.externalWallet) == null ? void 0 : _a2.
|
|
16
|
+
setAccountType((_b2 = (_a2 = unlinkingAccount == null ? void 0 : unlinkingAccount.externalWallet) == null ? void 0 : _a2.provider) != null ? _b2 : unlinkingAccount == null ? void 0 : unlinkingAccount.type);
|
|
17
|
+
setIsUnlinkingExternalWallet(!!(unlinkingAccount == null ? void 0 : unlinkingAccount.externalWallet));
|
|
17
18
|
}
|
|
18
19
|
}, [unlinkingAccount]);
|
|
19
20
|
return /* @__PURE__ */ jsxs(Content, { children: [
|
|
20
21
|
/* @__PURE__ */ jsxs(Upper, { children: [
|
|
21
22
|
/* @__PURE__ */ jsx(AccountTypeIcon, { accountType, size: "80px", inset: "5px" }),
|
|
22
23
|
/* @__PURE__ */ jsxs(Message, { variant: "bodyM", weight: "semiBold", color: "contrast", children: [
|
|
23
|
-
"Are you sure you want to unlink your
|
|
24
|
-
|
|
24
|
+
"Are you sure you want to unlink your",
|
|
25
|
+
" ",
|
|
26
|
+
isUnlinkingExternalWallet ? accountType : getAccountTypeName(accountType, { inline: true }),
|
|
25
27
|
"?"
|
|
26
28
|
] })
|
|
27
29
|
] }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const AddFundsAwaiting: () =>
|
|
1
|
+
export declare const AddFundsAwaiting: () => null;
|
|
@@ -1,63 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
__spreadProps,
|
|
4
|
-
__spreadValues
|
|
5
|
-
} from "../../../chunk-MMUBH76A.js";
|
|
6
|
-
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
import { StepContainer } from "../common.js";
|
|
8
|
-
import { OnRampProvider } from "@getpara/web-sdk";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
9
3
|
import { useModalStore } from "../../stores/index.js";
|
|
10
|
-
import {
|
|
4
|
+
import { useEffect } from "react";
|
|
11
5
|
import { ModalStep } from "../../utils/steps.js";
|
|
12
|
-
import { RampEmbed } from "@getpara/react-common";
|
|
13
|
-
import { safeStyled } from "@getpara/react-common";
|
|
14
|
-
import { useGoBack } from "../../hooks/useGoBack.js";
|
|
15
|
-
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
16
|
-
import { useStore } from "../../../provider/stores/useStore.js";
|
|
17
6
|
const STEPS = {
|
|
18
7
|
CANCELLED: ModalStep.ADD_FUNDS_FAILURE,
|
|
19
8
|
FINISHED: ModalStep.ADD_FUNDS_SUCCESS
|
|
20
9
|
};
|
|
21
10
|
const AddFundsAwaiting = () => {
|
|
22
11
|
const setStep = useModalStore((state) => state.setStep);
|
|
23
|
-
const goBack = useGoBack();
|
|
24
|
-
const onRampConfig = useModalStore((state) => state.onRampConfig);
|
|
25
12
|
const onRampPurchase = useModalStore((state) => state.onRampPurchase);
|
|
26
|
-
const setOnRampPurchase = useModalStore((state) => state.setOnRampPurchase);
|
|
27
|
-
const para = useInternalClient();
|
|
28
|
-
const appName = useStore((state) => state.appName);
|
|
29
|
-
const isDark = useStore((state) => state.isDarkTheme);
|
|
30
|
-
const [MoonPayEmbed, setMoonPayEmbed] = useState();
|
|
31
|
-
const props = {
|
|
32
|
-
para,
|
|
33
|
-
appName,
|
|
34
|
-
onRampConfig,
|
|
35
|
-
onRampPurchase,
|
|
36
|
-
isDark,
|
|
37
|
-
isEmbedded: true,
|
|
38
|
-
setOnRampPurchase,
|
|
39
|
-
onClose: goBack
|
|
40
|
-
};
|
|
41
|
-
useEffect(() => {
|
|
42
|
-
const _MoonPayEmbed = lazy(() => import("./MoonPayEmbed.js"));
|
|
43
|
-
if (_MoonPayEmbed) {
|
|
44
|
-
setMoonPayEmbed(_MoonPayEmbed);
|
|
45
|
-
}
|
|
46
|
-
}, []);
|
|
47
|
-
const onRampEmbed = useMemo(() => {
|
|
48
|
-
var _a, _b;
|
|
49
|
-
if (!(onRampPurchase == null ? void 0 : onRampPurchase.id) || !props.onRampConfig) {
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
switch (onRampPurchase == null ? void 0 : onRampPurchase.provider) {
|
|
53
|
-
case OnRampProvider.MOONPAY:
|
|
54
|
-
return !MoonPayEmbed || typeof window === "undefined" ? null : /* @__PURE__ */ jsx(MoonPayEmbed, __spreadProps(__spreadValues({}, props), { onRampConfig: props.onRampConfig }));
|
|
55
|
-
case OnRampProvider.RAMP:
|
|
56
|
-
return /* @__PURE__ */ jsx(RampEmbed, __spreadProps(__spreadValues({}, props), { apiKey: (_b = (_a = props.onRampConfig) == null ? void 0 : _a.rampApiKey) != null ? _b : "", onRampConfig: props.onRampConfig }));
|
|
57
|
-
default:
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
}, [onRampPurchase == null ? void 0 : onRampPurchase.provider, MoonPayEmbed]);
|
|
61
13
|
useEffect(() => {
|
|
62
14
|
let timeoutId;
|
|
63
15
|
if ((onRampPurchase == null ? void 0 : onRampPurchase.status) && ["CANCELLED", "FINISHED"].includes(onRampPurchase.status)) {
|
|
@@ -68,11 +20,8 @@ const AddFundsAwaiting = () => {
|
|
|
68
20
|
}
|
|
69
21
|
return () => clearTimeout(timeoutId);
|
|
70
22
|
}, [onRampPurchase == null ? void 0 : onRampPurchase.status]);
|
|
71
|
-
return
|
|
23
|
+
return null;
|
|
72
24
|
};
|
|
73
|
-
const Container = safeStyled(StepContainer)`
|
|
74
|
-
flex: 1;
|
|
75
|
-
`;
|
|
76
25
|
export {
|
|
77
26
|
AddFundsAwaiting
|
|
78
27
|
};
|
|
@@ -14,8 +14,7 @@ import { useStore } from "../../../provider/stores/useStore.js";
|
|
|
14
14
|
import { motion, AnimatePresence } from "framer-motion";
|
|
15
15
|
import { OnRampProviderButton } from "../OnRampComponents/OnRampProviderButton.js";
|
|
16
16
|
import { useWallet } from "../../../provider/index.js";
|
|
17
|
-
import { EnabledFlow,
|
|
18
|
-
import { ModalStep } from "../../utils/steps.js";
|
|
17
|
+
import { EnabledFlow, OnRampPurchaseType } from "@getpara/web-sdk";
|
|
19
18
|
import { contentMotionProps } from "./common.js";
|
|
20
19
|
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
21
20
|
function AddFundsProvider() {
|
|
@@ -26,7 +25,6 @@ function AddFundsProvider() {
|
|
|
26
25
|
});
|
|
27
26
|
const onRampConfig = useModalStore((state) => state.onRampConfig);
|
|
28
27
|
const setOnRampPurchase = useModalStore((state) => state.setOnRampPurchase);
|
|
29
|
-
const setModalStep = useModalStore((state) => state.setStep);
|
|
30
28
|
const { asset, network, fiatQuantity, isProviderAllowed, tab } = useAddFunds();
|
|
31
29
|
const { data: activeWallet } = useWallet();
|
|
32
30
|
return /* @__PURE__ */ jsxs(Container, __spreadProps(__spreadValues({}, contentMotionProps), { children: [
|
|
@@ -53,11 +51,10 @@ function AddFundsProvider() {
|
|
|
53
51
|
index,
|
|
54
52
|
onClick: () => __async(this, null, function* () {
|
|
55
53
|
if (!(activeWallet == null ? void 0 : activeWallet.type)) return;
|
|
56
|
-
const isPopup = id !== OnRampProvider.RAMP;
|
|
57
54
|
const { onRampPurchase: newOnRampPurchase } = yield para.initiateOnRampTransaction({
|
|
58
55
|
walletId: activeWallet.isExternal ? void 0 : activeWallet.id,
|
|
59
56
|
externalWalletAddress: activeWallet.isExternal ? activeWallet.id : void 0,
|
|
60
|
-
shouldOpenPopup:
|
|
57
|
+
shouldOpenPopup: true,
|
|
61
58
|
params: {
|
|
62
59
|
type: tab === EnabledFlow.BUY ? OnRampPurchaseType.BUY : OnRampPurchaseType.SELL,
|
|
63
60
|
walletType: activeWallet.type,
|
|
@@ -69,7 +66,6 @@ function AddFundsProvider() {
|
|
|
69
66
|
}
|
|
70
67
|
});
|
|
71
68
|
setOnRampPurchase(__spreadProps(__spreadValues({}, newOnRampPurchase), { fiat: "USD" }));
|
|
72
|
-
!isPopup && setModalStep(ModalStep.ADD_FUNDS_AWAITING);
|
|
73
69
|
})
|
|
74
70
|
},
|
|
75
71
|
id
|
|
@@ -117,7 +117,7 @@ const AuthMainStepContent = ({
|
|
|
117
117
|
GuestMode,
|
|
118
118
|
{
|
|
119
119
|
href: "#",
|
|
120
|
-
isDark,
|
|
120
|
+
$isDark: isDark,
|
|
121
121
|
onClick: (e) => {
|
|
122
122
|
e.preventDefault();
|
|
123
123
|
createGuestWallets();
|
|
@@ -153,7 +153,7 @@ const GuestMode = safeStyled.a`
|
|
|
153
153
|
align-items: center;
|
|
154
154
|
width: 100%;
|
|
155
155
|
height: 50px;
|
|
156
|
-
color: ${({ isDark }) => isDark ? "white" : "black"};
|
|
156
|
+
color: ${({ $isDark }) => $isDark ? "white" : "black"};
|
|
157
157
|
text-decoration: none;
|
|
158
158
|
font-size: 16px;
|
|
159
159
|
font-weight: 500;
|
package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.js
CHANGED
|
@@ -11,23 +11,23 @@ import { useAccountLinking } from "../../../provider/providers/AccountLinkProvid
|
|
|
11
11
|
const ExternalWalletNetworkSelectStep = () => {
|
|
12
12
|
var _a, _b;
|
|
13
13
|
const setStep = useModalStore((state) => state.setStep);
|
|
14
|
-
const
|
|
15
|
-
const
|
|
14
|
+
const selectedExternalWallet = useModalStore((state) => state.selectedExternalWallet);
|
|
15
|
+
const setSelectedExternalWallet = useModalStore((state) => state.setSelectedExternalWallet);
|
|
16
16
|
const { wallets, connectExternalWallet } = useExternalWallets();
|
|
17
17
|
const { accountLinkInProgress, linkAccount } = useAccountLinking();
|
|
18
18
|
const externalWalletProvider = (_b = accountLinkInProgress == null ? void 0 : accountLinkInProgress.pendingWalletProvider) != null ? _b : (_a = accountLinkInProgress == null ? void 0 : accountLinkInProgress.externalWallet) == null ? void 0 : _a.providerId;
|
|
19
|
-
if (!accountLinkInProgress && !
|
|
19
|
+
if (!accountLinkInProgress && !selectedExternalWallet) {
|
|
20
20
|
setStep(ModalStep.ACCOUNT_MAIN);
|
|
21
21
|
return null;
|
|
22
22
|
}
|
|
23
|
-
const availableWallets = wallets.filter((w) => w.
|
|
23
|
+
const availableWallets = wallets.filter((w) => w.id === (externalWalletProvider != null ? externalWalletProvider : selectedExternalWallet == null ? void 0 : selectedExternalWallet.id));
|
|
24
24
|
const firstWallet = availableWallets[0];
|
|
25
25
|
const handleWalletClick = (wallet) => () => {
|
|
26
26
|
if (accountLinkInProgress) {
|
|
27
|
-
linkAccount({ externalWallet: wallet });
|
|
27
|
+
linkAccount({ externalWallet: { provider: wallet.id } });
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
|
-
|
|
30
|
+
setSelectedExternalWallet({ id: wallet.id, type: wallet.type });
|
|
31
31
|
setStep(ModalStep.EX_WALLET_SELECTED);
|
|
32
32
|
if (wallet.installed || wallet.internalId === "FARCASTER") {
|
|
33
33
|
connectExternalWallet(wallet);
|
|
@@ -14,7 +14,7 @@ import { useExternalWallets } from "../../../provider/providers/ExternalWalletPr
|
|
|
14
14
|
const HAS_MORE_LENGTH = 3;
|
|
15
15
|
const ExternalWallets = () => {
|
|
16
16
|
const { wallets: allWallets, connectExternalWallet } = useExternalWallets();
|
|
17
|
-
const
|
|
17
|
+
const setSelectedExternalWallet = useModalStore((state) => state.setSelectedExternalWallet);
|
|
18
18
|
const setStep = useModalStore((state) => state.setStep);
|
|
19
19
|
const showAll = useModalStore((state) => state.step === ModalStep.EX_WALLET_MORE);
|
|
20
20
|
const authLayout = useModalStore((state) => state.authLayout);
|
|
@@ -34,11 +34,11 @@ const ExternalWallets = () => {
|
|
|
34
34
|
const handleWalletClick = (wallet) => () => {
|
|
35
35
|
const shouldShowNetworkSelection = allWallets.filter((w) => w.id === wallet.id).length > 1;
|
|
36
36
|
if (shouldShowNetworkSelection) {
|
|
37
|
-
|
|
37
|
+
setSelectedExternalWallet({ id: wallet.id, type: wallet.type });
|
|
38
38
|
setStep(ModalStep.EX_WALLET_NETWORK_SELECT);
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
setSelectedExternalWallet({ id: wallet.id, type: wallet.type });
|
|
42
42
|
setStep(ModalStep.EX_WALLET_SELECTED);
|
|
43
43
|
if (wallet.installed) {
|
|
44
44
|
connectExternalWallet(wallet);
|
|
@@ -141,8 +141,8 @@ const Badge = safeStyled.div`
|
|
|
141
141
|
}
|
|
142
142
|
`;
|
|
143
143
|
const InstalledIndicator = safeStyled.span`
|
|
144
|
-
width:
|
|
145
|
-
height:
|
|
144
|
+
width: 4px;
|
|
145
|
+
height: 4px;
|
|
146
146
|
border-radius: 100%;
|
|
147
147
|
background-color: var(--cpsl-color-utility-green);
|
|
148
148
|
`;
|
|
@@ -17,7 +17,7 @@ const OAuth = ({ methods }) => {
|
|
|
17
17
|
const isDark = useStore((state) => state.isDarkTheme);
|
|
18
18
|
const setStep = useModalStore((state) => state.setStep);
|
|
19
19
|
const showAll = useModalStore((state) => state.step === ModalStep.AUTH_MORE || state.step === ModalStep.AUTH_GUEST_SIGNUP);
|
|
20
|
-
const { verifyFarcaster, verifyOAuth
|
|
20
|
+
const { verifyFarcaster, verifyOAuth } = useAuthActions();
|
|
21
21
|
const hasMore = methods.length > HAS_MORE_LENGTH;
|
|
22
22
|
const methodsToShow = showAll || !hasMore ? methods : methods.slice(0, HAS_MORE_LENGTH - 1);
|
|
23
23
|
const handleShowAll = () => {
|
|
@@ -47,8 +47,7 @@ const OAuth = ({ methods }) => {
|
|
|
47
47
|
icon: ACCOUNT_TYPES[method][useBrandedLogos ? "logoBranded" : "logo"],
|
|
48
48
|
onClick: handleMethodClick(method),
|
|
49
49
|
$index: index,
|
|
50
|
-
$totalItems: showMoreButton ? HAS_MORE_LENGTH : methodsToShow.length
|
|
51
|
-
disabled: !isOAuthReady
|
|
50
|
+
$totalItems: showMoreButton ? HAS_MORE_LENGTH : methodsToShow.length
|
|
52
51
|
},
|
|
53
52
|
method
|
|
54
53
|
)),
|
|
@@ -59,8 +58,7 @@ const OAuth = ({ methods }) => {
|
|
|
59
58
|
icon: "moreLoginOptions",
|
|
60
59
|
onClick: handleShowAll,
|
|
61
60
|
$index: HAS_MORE_LENGTH - 1,
|
|
62
|
-
$totalItems: HAS_MORE_LENGTH
|
|
63
|
-
disabled: !isOAuthReady
|
|
61
|
+
$totalItems: HAS_MORE_LENGTH
|
|
64
62
|
}
|
|
65
63
|
)
|
|
66
64
|
] });
|
|
@@ -125,7 +125,7 @@ const VerificationCode = ({ authInfo, onResend, onSubmit, status, error }) => {
|
|
|
125
125
|
};
|
|
126
126
|
const VerificationCodeStep = () => {
|
|
127
127
|
const { verifyNewAccount, verifyNewAccountStatus, verifyNewAccountError } = useAuthActions();
|
|
128
|
-
const {
|
|
128
|
+
const { resendVerificationCodeAsync } = useResendVerificationCode();
|
|
129
129
|
const para = useInternalClient();
|
|
130
130
|
if (!para.authInfo) {
|
|
131
131
|
return null;
|
|
@@ -136,7 +136,7 @@ const VerificationCodeStep = () => {
|
|
|
136
136
|
authInfo: para.authInfo,
|
|
137
137
|
onSubmit: verifyNewAccount,
|
|
138
138
|
onResend: () => {
|
|
139
|
-
|
|
139
|
+
resendVerificationCodeAsync({ type: "SIGNUP" });
|
|
140
140
|
},
|
|
141
141
|
status: verifyNewAccountStatus,
|
|
142
142
|
error: verifyNewAccountError
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CpslInput, CpslText, CpslTileButton } from '@getpara/react-components';
|
|
2
|
-
import { Network, OnRampAsset,
|
|
2
|
+
import { Network, OnRampAsset, TLinkedAccountType } from '@getpara/web-sdk';
|
|
3
3
|
import { PropsWithChildren } from 'react';
|
|
4
4
|
export declare const SpinnerContainer: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
5
5
|
export declare const QRContainer: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -41,13 +41,15 @@ export declare const ErrorContainer: import("styled-components/dist/types.js").I
|
|
|
41
41
|
export declare const ErrorIcon: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<any, "ref"> & import("react").RefAttributes<any>, "ref"> & {
|
|
42
42
|
ref?: ((instance: any) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<any> | null | undefined;
|
|
43
43
|
}, never>> & string & Omit<import("react").ForwardRefExoticComponent<Omit<any, "ref"> & import("react").RefAttributes<any>>, keyof import("react").Component<any, {}, any>>;
|
|
44
|
-
export declare function AccountTypeIcon({ accountType, size, inset, }: {
|
|
45
|
-
accountType?: TLinkedAccountType |
|
|
44
|
+
export declare function AccountTypeIcon({ accountType, size, inset, src, }: {
|
|
45
|
+
accountType?: TLinkedAccountType | string;
|
|
46
46
|
size?: string;
|
|
47
47
|
inset?: string;
|
|
48
|
+
src?: string;
|
|
48
49
|
}): import("react/jsx-runtime").JSX.Element | null;
|
|
49
|
-
export declare function HeroAccountTypeIcon({ accountType }: {
|
|
50
|
-
accountType
|
|
50
|
+
export declare function HeroAccountTypeIcon({ accountType, src }: {
|
|
51
|
+
accountType?: TLinkedAccountType | string;
|
|
52
|
+
src?: string;
|
|
51
53
|
}): import("react/jsx-runtime").JSX.Element;
|
|
52
54
|
export declare function HeroSuccessIcon(): import("react/jsx-runtime").JSX.Element;
|
|
53
55
|
export declare function GradientScroll({ height, gap, children }: PropsWithChildren<{
|
|
@@ -157,7 +157,8 @@ const ErrorIcon = safeStyled(CpslIcon)`
|
|
|
157
157
|
function AccountTypeIcon({
|
|
158
158
|
accountType,
|
|
159
159
|
size,
|
|
160
|
-
inset
|
|
160
|
+
inset,
|
|
161
|
+
src
|
|
161
162
|
}) {
|
|
162
163
|
var _a;
|
|
163
164
|
const isDark = useStore((state) => {
|
|
@@ -165,13 +166,13 @@ function AccountTypeIcon({
|
|
|
165
166
|
return ((_b = (_a2 = state.modalConfig) == null ? void 0 : _a2.theme) == null ? void 0 : _b.mode) === "dark";
|
|
166
167
|
});
|
|
167
168
|
const data = accountType ? ACCOUNT_TYPES[accountType] : null;
|
|
168
|
-
return data ? /* @__PURE__ */ jsx(CpslIcon, { size, inset, icon: (_a = data.logoBranded) != null ? _a : data.logo, invert: isDark && data.isDark }) : null;
|
|
169
|
+
return data || src ? /* @__PURE__ */ jsx(CpslIcon, { size, inset, icon: (_a = data == null ? void 0 : data.logoBranded) != null ? _a : data == null ? void 0 : data.logo, src, invert: isDark && (data == null ? void 0 : data.isDark) }) : null;
|
|
169
170
|
}
|
|
170
|
-
function HeroAccountTypeIcon({ accountType }) {
|
|
171
|
+
function HeroAccountTypeIcon({ accountType, src }) {
|
|
171
172
|
if (accountType === "EMAIL" || accountType === "PHONE") {
|
|
172
173
|
return /* @__PURE__ */ jsx(HeroGenericIcon, { accountType });
|
|
173
174
|
}
|
|
174
|
-
return /* @__PURE__ */ jsx(AccountTypeIcon, { accountType, size: "60px" });
|
|
175
|
+
return /* @__PURE__ */ jsx(AccountTypeIcon, { accountType, size: "60px", src });
|
|
175
176
|
}
|
|
176
177
|
function HeroSuccessIcon() {
|
|
177
178
|
return /* @__PURE__ */ jsx(CpslIcon, { icon: "checkCircleFilled", size: "80px", style: { ["--icon-color"]: "var(--cpsl-color-utility-green" } });
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { TExternalWallet } from '@getpara/web-sdk';
|
|
2
1
|
import { IconType } from '@getpara/react-components';
|
|
3
2
|
import { TLinkedAccountType } from '@getpara/web-sdk';
|
|
4
3
|
export declare const ACCOUNT_TYPES: {
|
|
5
|
-
[key in TLinkedAccountType |
|
|
4
|
+
[key in TLinkedAccountType | string]: {
|
|
6
5
|
logo: IconType;
|
|
7
6
|
logoBranded?: IconType;
|
|
8
7
|
name: string;
|
|
@@ -11,7 +10,7 @@ export declare const ACCOUNT_TYPES: {
|
|
|
11
10
|
isExternalWallet?: boolean;
|
|
12
11
|
};
|
|
13
12
|
};
|
|
14
|
-
export declare function getAccountTypeName(type: TLinkedAccountType |
|
|
13
|
+
export declare function getAccountTypeName(type: TLinkedAccountType | string | undefined, { inline }?: {
|
|
15
14
|
inline?: boolean;
|
|
16
15
|
}): string | undefined;
|
|
17
16
|
export declare function getAccountTypeLogo(type: TLinkedAccountType | undefined): IconType | undefined;
|