@getpara/react-sdk 1.6.1-dev.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{modal/components/AddFunds/MoonPayEmbed.js → MoonPayEmbed-Q2HP2BFI.js} +3 -1
- package/dist/MoonPayEmbed-Q2HP2BFI.js.br +0 -0
- package/dist/MoonPayEmbed-Q2HP2BFI.js.gz +0 -0
- package/dist/chunk-MMUBH76A.js.br +0 -0
- package/dist/chunk-MMUBH76A.js.gz +0 -0
- package/dist/index.js +6657 -6
- package/dist/index.js.br +0 -0
- package/dist/index.js.gz +0 -0
- package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.d.ts +1 -0
- package/dist/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.d.ts +2 -1
- package/dist/modal/components/common.d.ts +4 -0
- package/dist/modal/index.d.ts +1 -0
- package/dist/modal/providers/CosmosExternalWalletContextStub.d.ts +13 -0
- package/dist/modal/providers/EvmExternalWalletContextStub.d.ts +11 -0
- package/dist/modal/providers/ExternalWalletContext.d.ts +15 -1
- package/dist/modal/providers/SolanaExternalWalletContextStub.d.ts +11 -0
- package/dist/modal/stores/externalWalletProvider/useExternalWalletProviderStore.d.ts +2 -0
- package/dist/modal/types/commonTypes.d.ts +12 -2
- package/dist/modal/types/externalWallets.d.ts +2 -0
- package/dist/modal/types/modalProps.d.ts +6 -0
- package/dist/modal/utils/steps.d.ts +2 -0
- package/dist/provider/utils/constants.d.ts +5 -0
- package/package.json +5 -5
- package/dist/modal/ParaModal.js +0 -337
- package/dist/modal/components/Account/Account.js +0 -69
- package/dist/modal/components/AddFunds/AddFunds.js +0 -220
- package/dist/modal/components/AddFunds/AddFundsAwaiting.js +0 -72
- package/dist/modal/components/AddFunds/AddFundsDone.js +0 -43
- package/dist/modal/components/AddFunds/index.js +0 -4
- package/dist/modal/components/AuthInput/AuthInput.js +0 -283
- package/dist/modal/components/AuthInput/countryCodes.js +0 -42
- package/dist/modal/components/AuthInput/hooks/useDropdownPosition.js +0 -33
- package/dist/modal/components/AuthInput/phoneMasks.js +0 -253
- package/dist/modal/components/AuthMainStep/AuthMainStep.js +0 -37
- package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +0 -113
- package/dist/modal/components/AuthOptions/AuthOptions.js +0 -33
- package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.js +0 -18
- package/dist/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.js +0 -10
- package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.js +0 -18
- package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +0 -44
- package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +0 -52
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +0 -93
- package/dist/modal/components/Body/AnimatedHeightWrapper.js +0 -29
- package/dist/modal/components/Body/Body.js +0 -304
- package/dist/modal/components/ChainSwitch/ChainSwitch.js +0 -94
- package/dist/modal/components/ChainSwitch/config.js +0 -17
- package/dist/modal/components/Controls/Controls.js +0 -74
- package/dist/modal/components/Controls/Selects.js +0 -213
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +0 -151
- package/dist/modal/components/ExternalWalletStep/config.js +0 -17
- package/dist/modal/components/ExternalWallets/ExternalWallets.js +0 -172
- package/dist/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.js +0 -123
- package/dist/modal/components/Footer/Footer.js +0 -93
- package/dist/modal/components/Header/Header.js +0 -43
- package/dist/modal/components/Header/hooks/useStepTitle.js +0 -50
- package/dist/modal/components/Hero/Hero.js +0 -122
- package/dist/modal/components/IFrameStep/IFrameStep.js +0 -55
- package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +0 -28
- package/dist/modal/components/ModalContent/ModalContent.js +0 -310
- package/dist/modal/components/OAuth/FarcasterOAuthStep.js +0 -81
- package/dist/modal/components/OAuth/OAuth.js +0 -153
- package/dist/modal/components/OAuth/TelegramOAuthStep.js +0 -139
- package/dist/modal/components/OnRampComponents/AddingFunds.js +0 -23
- package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +0 -77
- package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +0 -101
- package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +0 -141
- package/dist/modal/components/StripeComponents/StripeComponents.js +0 -88
- package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +0 -24
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +0 -159
- package/dist/modal/components/Waiting/Waiting.js +0 -17
- package/dist/modal/components/WalletCard/PartnerIcon.js +0 -34
- package/dist/modal/components/WalletCard/WalletCard.js +0 -127
- package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.js +0 -52
- package/dist/modal/components/common.js +0 -83
- package/dist/modal/components/index.js +0 -2
- package/dist/modal/constants/constants.js +0 -111
- package/dist/modal/constants/defaults.js +0 -10
- package/dist/modal/constants/oAuthLogos.js +0 -24
- package/dist/modal/hooks/useActiveWallet.js +0 -15
- package/dist/modal/hooks/useCreateAccount.js +0 -72
- package/dist/modal/hooks/useEmbeddedExternalConnection.js +0 -39
- package/dist/modal/hooks/useGoBack.js +0 -35
- package/dist/modal/hooks/useSetLoginURLs.js +0 -45
- package/dist/modal/index.js +0 -32
- package/dist/modal/providers/CosmosExternalWalletContextStub.js +0 -34
- package/dist/modal/providers/EvmExternalWalletContextStub.js +0 -38
- package/dist/modal/providers/ExternalWalletContext.js +0 -275
- package/dist/modal/providers/SolanaExternalWalletContextStub.js +0 -19
- package/dist/modal/stores/externalWalletProvider/actions.js +0 -10
- package/dist/modal/stores/externalWalletProvider/useExternalWalletProviderStore.js +0 -20
- package/dist/modal/stores/index.js +0 -4
- package/dist/modal/stores/modal/actions.js +0 -70
- package/dist/modal/stores/modal/useModalStore.js +0 -65
- package/dist/modal/stores/theme/actions.js +0 -28
- package/dist/modal/stores/theme/useThemeStore.js +0 -21
- package/dist/modal/stores/userInfo/actions.js +0 -30
- package/dist/modal/stores/userInfo/useUserInfoStore.js +0 -17
- package/dist/modal/types/commonTypes.js +0 -1
- package/dist/modal/types/externalWallets.js +0 -31
- package/dist/modal/types/modalProps.js +0 -12
- package/dist/modal/utils/authLayoutHelpers.js +0 -8
- package/dist/modal/utils/getMailtoLink.js +0 -10
- package/dist/modal/utils/getTileButtonFlex.js +0 -20
- package/dist/modal/utils/openPopup.js +0 -60
- package/dist/modal/utils/routeMobileExternalWallet.js +0 -31
- package/dist/modal/utils/steps.js +0 -228
- package/dist/modal/utils/stringFormatters.js +0 -14
- package/dist/modal/utils/validateOnRampConfig.js +0 -32
- package/dist/provider/ParaProvider.js +0 -22
- package/dist/provider/actions/checkIfUserExists.js +0 -21
- package/dist/provider/actions/createUser.js +0 -26
- package/dist/provider/actions/getAccount.js +0 -22
- package/dist/provider/actions/getWallet.js +0 -14
- package/dist/provider/actions/initiateLogin.js +0 -20
- package/dist/provider/actions/keepSessionAlive.js +0 -20
- package/dist/provider/actions/logout.js +0 -17
- package/dist/provider/actions/signMessage.js +0 -20
- package/dist/provider/actions/signTransaction.js +0 -20
- package/dist/provider/actions/waitForAccountCreation.js +0 -21
- package/dist/provider/actions/waitForLoginAndSetup.js +0 -24
- package/dist/provider/actions/waitForPasskeyAndCreateWallet.js +0 -21
- package/dist/provider/hooks/index.js +0 -4
- package/dist/provider/hooks/mutations/index.js +0 -24
- package/dist/provider/hooks/mutations/useCheckIfUserExists.js +0 -23
- package/dist/provider/hooks/mutations/useCreateUser.js +0 -20
- package/dist/provider/hooks/mutations/useInitiateLogin.js +0 -23
- package/dist/provider/hooks/mutations/useKeepSessionAlive.js +0 -20
- package/dist/provider/hooks/mutations/useLogout.js +0 -30
- package/dist/provider/hooks/mutations/useSignMessage.js +0 -33
- package/dist/provider/hooks/mutations/useSignTransaction.js +0 -33
- package/dist/provider/hooks/mutations/useWaitForAccountCreation.js +0 -30
- package/dist/provider/hooks/mutations/useWaitForLoginAndSetup.js +0 -30
- package/dist/provider/hooks/mutations/useWaitForPasskeyAndCreateWallet.js +0 -30
- package/dist/provider/hooks/queries/index.js +0 -8
- package/dist/provider/hooks/queries/useAccount.js +0 -21
- package/dist/provider/hooks/queries/useWallet.js +0 -22
- package/dist/provider/hooks/utils/index.js +0 -10
- package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +0 -74
- package/dist/provider/hooks/utils/useClient.js +0 -10
- package/dist/provider/hooks/utils/useEventListeners.js +0 -105
- package/dist/provider/hooks/utils/useInternalClient.js +0 -10
- package/dist/provider/hooks/utils/useModal.js +0 -17
- package/dist/provider/hooks/utils/useWalletState.js +0 -33
- package/dist/provider/index.js +0 -8
- package/dist/provider/stores/getters.js +0 -13
- package/dist/provider/stores/slices/client.js +0 -9
- package/dist/provider/stores/slices/index.js +0 -4
- package/dist/provider/stores/slices/modal.js +0 -9
- package/dist/provider/stores/slices/wallet.js +0 -11
- package/dist/provider/stores/types.js +0 -1
- package/dist/provider/stores/useStore.js +0 -27
- package/dist/provider/types/provider.js +0 -1
- package/dist/provider/types/query.js +0 -1
- package/dist/provider/types/utils.js +0 -1
- package/dist/provider/utils/renameMutations.js +0 -16
|
@@ -1,283 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async
|
|
4
|
-
} from "../../../chunk-MMUBH76A.js";
|
|
5
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
import {
|
|
7
|
-
CpslButton,
|
|
8
|
-
CpslIcon,
|
|
9
|
-
CpslInput,
|
|
10
|
-
CpslSelect,
|
|
11
|
-
CpslSelectItem,
|
|
12
|
-
CpslSpinner,
|
|
13
|
-
CpslText
|
|
14
|
-
} from "@getpara/react-components";
|
|
15
|
-
import { useRef, useState } from "react";
|
|
16
|
-
import styled from "styled-components";
|
|
17
|
-
import countryCodes from "./countryCodes.js";
|
|
18
|
-
import { useModalStore, useUserInfoStore } from "../../stores/index.js";
|
|
19
|
-
import { EMAIL_REGEX, MOBILE_SIZE } from "../../constants/constants.js";
|
|
20
|
-
import { useDropdownPosition } from "./hooks/useDropdownPosition.js";
|
|
21
|
-
import { ModalStep } from "../../utils/steps.js";
|
|
22
|
-
import { defaultPhoneMask, phoneMasks } from "./phoneMasks.js";
|
|
23
|
-
import { AuthMethod } from "@getpara/web-sdk";
|
|
24
|
-
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
25
|
-
import { useSetLoginURLs } from "../../hooks/useSetLoginURLs.js";
|
|
26
|
-
const DEFAULT_COUNTRY = { label: "United States", value: "+1", selectedLabel: "US", icon: "US" };
|
|
27
|
-
function isCcMatch(countryCode, option) {
|
|
28
|
-
return countryCode === "+1" ? option.selectedLabel === "US" : option.value === countryCode;
|
|
29
|
-
}
|
|
30
|
-
const AuthInput = ({ disableEmailLogin, disablePhoneLogin }) => {
|
|
31
|
-
var _a, _b;
|
|
32
|
-
const inputRef = useRef(null);
|
|
33
|
-
const { dropdownMaxHeight, dropdownWidth } = useDropdownPosition(inputRef);
|
|
34
|
-
const para = useInternalClient();
|
|
35
|
-
const setAuthInfo = useUserInfoStore((state) => state.setAuthInfo);
|
|
36
|
-
const authInfo = useUserInfoStore((state) => state.getAuthInfo());
|
|
37
|
-
const setFlow = useModalStore((state) => state.setFlow);
|
|
38
|
-
const setStep = useModalStore((state) => state.setStep);
|
|
39
|
-
const setBiometricLocationHints = useModalStore((state) => state.setBiometricLocationHints);
|
|
40
|
-
const setLoginURLs = useSetLoginURLs();
|
|
41
|
-
const [countryCode, setCountryCode] = useState(
|
|
42
|
-
(authInfo == null ? void 0 : authInfo.authType) === "phone" ? authInfo.auth.countryCode || "+1" : "+1"
|
|
43
|
-
);
|
|
44
|
-
const [identifier, setIdentifier] = useState(
|
|
45
|
-
(() => {
|
|
46
|
-
if (!authInfo || ["telegram", "farcaster"].includes(authInfo.authType)) {
|
|
47
|
-
return "";
|
|
48
|
-
}
|
|
49
|
-
if (authInfo.authType !== "phone") {
|
|
50
|
-
return authInfo.identifier;
|
|
51
|
-
}
|
|
52
|
-
return authInfo.auth.phone;
|
|
53
|
-
})()
|
|
54
|
-
);
|
|
55
|
-
const [identifierType, setIdentifierType] = useState(
|
|
56
|
-
authInfo && (authInfo.authType === "email" || authInfo.authType === "phone") ? authInfo.authType : void 0
|
|
57
|
-
);
|
|
58
|
-
const [matchedCountryCode, setMatchedCountryCode] = useState(
|
|
59
|
-
(_a = countryCodes.find((option) => isCcMatch(countryCode, option))) != null ? _a : DEFAULT_COUNTRY
|
|
60
|
-
);
|
|
61
|
-
const [isLoggingIn, setIsLoggingIn] = useState(false);
|
|
62
|
-
const [error, setError] = useState("");
|
|
63
|
-
const [search, setSearch] = useState("");
|
|
64
|
-
const isEmail = identifierType === "email";
|
|
65
|
-
const isPhone = identifierType === "phone";
|
|
66
|
-
const isUnknown = !identifierType;
|
|
67
|
-
const filteredCountryCodes = search ? countryCodes.filter(
|
|
68
|
-
(cc) => cc.selectedLabel.toLowerCase().includes(search.toLowerCase()) || cc.label.toLowerCase().includes(search.toLowerCase()) || cc.value.toLowerCase().includes(search.toLowerCase())
|
|
69
|
-
) : countryCodes;
|
|
70
|
-
const handleSearchInput = (ev) => {
|
|
71
|
-
setSearch(ev.detail);
|
|
72
|
-
};
|
|
73
|
-
const handleIdentifierInput = (ev) => {
|
|
74
|
-
const newIdentifier = ev.detail.value;
|
|
75
|
-
let isNewPhone = false, isNewEmail = false;
|
|
76
|
-
if (!disablePhoneLogin) {
|
|
77
|
-
const countryCodeInputMatch = countryCodes.find((option) => isCcMatch(newIdentifier, option));
|
|
78
|
-
if (countryCodeInputMatch) {
|
|
79
|
-
setCountryCode(countryCodeInputMatch.value);
|
|
80
|
-
setMatchedCountryCode(countryCodeInputMatch);
|
|
81
|
-
setIdentifierType("phone");
|
|
82
|
-
setIdentifier("");
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
isNewPhone = !isEmail && isPhone ? /\d+$/.test(newIdentifier) : /\d\d\d+$/.test(newIdentifier);
|
|
86
|
-
}
|
|
87
|
-
if (!disableEmailLogin) {
|
|
88
|
-
isNewEmail = /\D.*$/.test(newIdentifier);
|
|
89
|
-
}
|
|
90
|
-
setIdentifierType(isNewEmail ? "email" : isNewPhone ? "phone" : void 0);
|
|
91
|
-
setIdentifier(newIdentifier);
|
|
92
|
-
};
|
|
93
|
-
const handleCountryCodeInput = (ev) => {
|
|
94
|
-
const matchedCountryCode2 = countryCodes.find((code) => code.selectedLabel === ev.detail);
|
|
95
|
-
setCountryCode(matchedCountryCode2.value);
|
|
96
|
-
setMatchedCountryCode(matchedCountryCode2);
|
|
97
|
-
};
|
|
98
|
-
const login = () => __async(void 0, null, function* () {
|
|
99
|
-
setError("");
|
|
100
|
-
if (isUnknown) {
|
|
101
|
-
setError("Please enter a valid email or phone number!");
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
let auth;
|
|
105
|
-
if (isEmail) {
|
|
106
|
-
if (!EMAIL_REGEX.test(identifier)) {
|
|
107
|
-
setError("Please enter a valid email!");
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
yield para.logout();
|
|
111
|
-
auth = { email: identifier };
|
|
112
|
-
setAuthInfo(auth);
|
|
113
|
-
const userExists = yield para.checkIfUserExists({ email: identifier });
|
|
114
|
-
if (userExists) {
|
|
115
|
-
const supportedAuthMethods = yield para.initiateUserLoginV2(auth);
|
|
116
|
-
const biometricLocationHints = supportedAuthMethods.has(AuthMethod.PASSKEY) ? yield para.getUserBiometricLocationHints() : [];
|
|
117
|
-
yield setLoginURLs({ supportedAuthMethods, authType: "email" });
|
|
118
|
-
setFlow("login");
|
|
119
|
-
setStep(ModalStep.BIOMETRIC_LOGIN);
|
|
120
|
-
setBiometricLocationHints(biometricLocationHints);
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
yield para.createUser(auth);
|
|
124
|
-
setFlow("signUp");
|
|
125
|
-
setStep(ModalStep.VERIFICATIONS);
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
if (isPhone) {
|
|
129
|
-
yield para.logout();
|
|
130
|
-
let userExists = false;
|
|
131
|
-
try {
|
|
132
|
-
userExists = yield para.checkIfUserExistsByPhone({ phone: identifier, countryCode });
|
|
133
|
-
} catch (error2) {
|
|
134
|
-
setError("Please enter a valid phone number!");
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
auth = { phone: identifier, countryCode };
|
|
138
|
-
setAuthInfo(auth);
|
|
139
|
-
if (userExists) {
|
|
140
|
-
const supportedAuthMethods = yield para.initiateUserLoginV2(auth);
|
|
141
|
-
const biometricLocationHints = supportedAuthMethods.has(AuthMethod.PASSKEY) ? yield para.getUserBiometricLocationHints() : [];
|
|
142
|
-
yield setLoginURLs({ supportedAuthMethods, authType: "phone" });
|
|
143
|
-
setFlow("login");
|
|
144
|
-
setStep(ModalStep.BIOMETRIC_LOGIN);
|
|
145
|
-
setBiometricLocationHints(biometricLocationHints);
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
yield para.createUserByPhone(auth);
|
|
149
|
-
setFlow("signUp");
|
|
150
|
-
setStep(ModalStep.VERIFICATIONS);
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
const handleSubmit = () => __async(void 0, null, function* () {
|
|
155
|
-
setIsLoggingIn(true);
|
|
156
|
-
yield login();
|
|
157
|
-
setIsLoggingIn(false);
|
|
158
|
-
});
|
|
159
|
-
if (disableEmailLogin && disablePhoneLogin) {
|
|
160
|
-
return null;
|
|
161
|
-
}
|
|
162
|
-
return /* @__PURE__ */ jsx(
|
|
163
|
-
"form",
|
|
164
|
-
{
|
|
165
|
-
onSubmit: (e) => __async(void 0, null, function* () {
|
|
166
|
-
e.preventDefault();
|
|
167
|
-
yield handleSubmit();
|
|
168
|
-
}),
|
|
169
|
-
children: /* @__PURE__ */ jsxs(
|
|
170
|
-
StyledInput,
|
|
171
|
-
{
|
|
172
|
-
ref: inputRef,
|
|
173
|
-
id: "authInput",
|
|
174
|
-
placeholder: isEmail || disablePhoneLogin ? "Enter email" : isPhone || disableEmailLogin ? "Enter phone" : "Enter email or phone",
|
|
175
|
-
onCpslInput: handleIdentifierInput,
|
|
176
|
-
value: identifier,
|
|
177
|
-
errorText: error,
|
|
178
|
-
autofocus: true,
|
|
179
|
-
inputMode: "email",
|
|
180
|
-
onKeyDown: (e) => __async(void 0, null, function* () {
|
|
181
|
-
return e.key === "Enter" && handleSubmit();
|
|
182
|
-
}),
|
|
183
|
-
contrastText: true,
|
|
184
|
-
isPhone,
|
|
185
|
-
mask: identifierType === "phone" ? (_b = phoneMasks[matchedCountryCode.selectedLabel]) != null ? _b : defaultPhoneMask : void 0,
|
|
186
|
-
enterkeyhint: "go",
|
|
187
|
-
noAutoDisable: true,
|
|
188
|
-
disabled: isLoggingIn,
|
|
189
|
-
"data-testid": "auth-input",
|
|
190
|
-
children: [
|
|
191
|
-
/* @__PURE__ */ jsxs(IconContainer, { slot: "start", children: [
|
|
192
|
-
!disableEmailLogin && (isUnknown || isEmail) && /* @__PURE__ */ jsx(CpslIcon, { "aria-label": "email", icon: "mail" }),
|
|
193
|
-
!disablePhoneLogin && isUnknown && /* @__PURE__ */ jsx(CpslIcon, { "aria-label": "phone", icon: "phone" }),
|
|
194
|
-
isPhone && /* @__PURE__ */ jsxs(
|
|
195
|
-
CountryCodeSelect,
|
|
196
|
-
{
|
|
197
|
-
selectedValue: matchedCountryCode.selectedLabel,
|
|
198
|
-
onCpslSelectValueChange: handleCountryCodeInput,
|
|
199
|
-
showFormattedSelectedItem: true,
|
|
200
|
-
autoWidth: true,
|
|
201
|
-
dropdownMaxHeight,
|
|
202
|
-
anchorElId: "authInput",
|
|
203
|
-
$width: dropdownWidth,
|
|
204
|
-
showSearch: true,
|
|
205
|
-
searchPlaceholder: "Search Countries",
|
|
206
|
-
onCpslSearchChange: handleSearchInput,
|
|
207
|
-
"data-testid": "country-code-select",
|
|
208
|
-
children: [
|
|
209
|
-
matchedCountryCode && /* @__PURE__ */ jsxs(SelectedItem, { slot: "selected-item", children: [
|
|
210
|
-
/* @__PURE__ */ jsx(CpslText, { children: matchedCountryCode.selectedLabel }),
|
|
211
|
-
/* @__PURE__ */ jsx(CpslText, { children: matchedCountryCode.value })
|
|
212
|
-
] }),
|
|
213
|
-
filteredCountryCodes.map((cc) => /* @__PURE__ */ jsxs(StyledSelectItem, { slot: "items", value: cc.selectedLabel, children: [
|
|
214
|
-
/* @__PURE__ */ jsx(CpslText, { children: cc.label }),
|
|
215
|
-
/* @__PURE__ */ jsx(CpslText, { children: cc.value })
|
|
216
|
-
] }, cc.selectedLabel))
|
|
217
|
-
]
|
|
218
|
-
}
|
|
219
|
-
)
|
|
220
|
-
] }),
|
|
221
|
-
identifier && /* @__PURE__ */ jsx(CpslButton, { slot: "end", size: "small", fullWidth: true, disabled: isLoggingIn, onClick: handleSubmit, children: isLoggingIn ? /* @__PURE__ */ jsx(CpslSpinner, { size: 16 }) : /* @__PURE__ */ jsx(CpslIcon, { icon: "arrowNarrow" }) })
|
|
222
|
-
]
|
|
223
|
-
},
|
|
224
|
-
"email"
|
|
225
|
-
)
|
|
226
|
-
}
|
|
227
|
-
);
|
|
228
|
-
};
|
|
229
|
-
const IconContainer = styled.div`
|
|
230
|
-
height: 100%;
|
|
231
|
-
display: flex;
|
|
232
|
-
align-items: center;
|
|
233
|
-
gap: 8px;
|
|
234
|
-
padding-right: 12px;
|
|
235
|
-
border-right: 1px solid var(--cpsl-color-background-16);
|
|
236
|
-
|
|
237
|
-
& cpsl-icon {
|
|
238
|
-
--icon-color: var(--cpsl-color-contrast);
|
|
239
|
-
}
|
|
240
|
-
`;
|
|
241
|
-
const CountryCodeSelect = styled(CpslSelect)`
|
|
242
|
-
--container-height: 100%;
|
|
243
|
-
--container-padding-start: 0px;
|
|
244
|
-
--container-padding-end: 0px;
|
|
245
|
-
--container-border-width: 0px;
|
|
246
|
-
--container-gap: 4px;
|
|
247
|
-
--container-background-color: transparent;
|
|
248
|
-
--container-box-shadow: none;
|
|
249
|
-
|
|
250
|
-
&::part(dropdown) {
|
|
251
|
-
width: ${({ $width }) => `${$width - 2}px`};
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
&::part(popover) {
|
|
255
|
-
@media (max-width: ${MOBILE_SIZE}px) {
|
|
256
|
-
top: unset !important;
|
|
257
|
-
bottom: 16px;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
cpsl-auth-modal.force-mobile-media & {
|
|
261
|
-
top: unset !important;
|
|
262
|
-
bottom: 16px;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
`;
|
|
266
|
-
const StyledSelectItem = styled(CpslSelectItem)`
|
|
267
|
-
&::part(inner-container) {
|
|
268
|
-
justify-content: space-between;
|
|
269
|
-
}
|
|
270
|
-
`;
|
|
271
|
-
const SelectedItem = styled.div`
|
|
272
|
-
display: flex;
|
|
273
|
-
gap: 4px;
|
|
274
|
-
align-items: center;
|
|
275
|
-
`;
|
|
276
|
-
const StyledInput = styled(CpslInput)`
|
|
277
|
-
--container-background-color: var(--cpsl-color-background-8);
|
|
278
|
-
--input-background-color: var(--cpsl-color-background-8);
|
|
279
|
-
--container-padding-end: 8px;
|
|
280
|
-
`;
|
|
281
|
-
export {
|
|
282
|
-
AuthInput
|
|
283
|
-
};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import "../../../chunk-MMUBH76A.js";
|
|
3
|
-
import { getCountries, getCountryCallingCode } from "libphonenumber-js";
|
|
4
|
-
const excludedCountries = [
|
|
5
|
-
"AC",
|
|
6
|
-
"CG",
|
|
7
|
-
"CI",
|
|
8
|
-
"CV",
|
|
9
|
-
"GF",
|
|
10
|
-
"GP",
|
|
11
|
-
"MF",
|
|
12
|
-
"NC",
|
|
13
|
-
"PM",
|
|
14
|
-
"RE",
|
|
15
|
-
"SD",
|
|
16
|
-
"SH",
|
|
17
|
-
"SJ",
|
|
18
|
-
"TA",
|
|
19
|
-
"VA",
|
|
20
|
-
"WF",
|
|
21
|
-
"XK",
|
|
22
|
-
"YT"
|
|
23
|
-
];
|
|
24
|
-
const generateCountryCodes = () => {
|
|
25
|
-
const countries = getCountries();
|
|
26
|
-
const countryList = countries.filter((country) => !excludedCountries.includes(country)).map((country) => {
|
|
27
|
-
const countryCode = getCountryCallingCode(country);
|
|
28
|
-
const countryName = new Intl.DisplayNames(["en"], { type: "region" }).of(country);
|
|
29
|
-
return {
|
|
30
|
-
label: countryName,
|
|
31
|
-
value: `+${countryCode}`,
|
|
32
|
-
selectedLabel: country,
|
|
33
|
-
icon: country
|
|
34
|
-
};
|
|
35
|
-
}).sort((a, b) => a.label.localeCompare(b.label));
|
|
36
|
-
return countryList;
|
|
37
|
-
};
|
|
38
|
-
const countryCodes = generateCountryCodes();
|
|
39
|
-
var countryCodes_default = countryCodes;
|
|
40
|
-
export {
|
|
41
|
-
countryCodes_default as default
|
|
42
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import "../../../../chunk-MMUBH76A.js";
|
|
3
|
-
import { useEffect, useState } from "react";
|
|
4
|
-
const useDropdownPosition = (inputRef) => {
|
|
5
|
-
const [dropdownMaxHeight, setDropdownMaxHeight] = useState();
|
|
6
|
-
const [dropdownWidth, setDropdownWidth] = useState();
|
|
7
|
-
const [mobileAnchor, setMobileAnchor] = useState();
|
|
8
|
-
const resize = () => {
|
|
9
|
-
var _a, _b, _c;
|
|
10
|
-
if (typeof window !== "undefined") {
|
|
11
|
-
const newMaxHeight = Math.max(
|
|
12
|
-
window.innerHeight - ((_a = inputRef == null ? void 0 : inputRef.current) == null ? void 0 : _a.getBoundingClientRect().bottom) - 20,
|
|
13
|
-
window.innerHeight * 0.25
|
|
14
|
-
);
|
|
15
|
-
setDropdownMaxHeight(newMaxHeight);
|
|
16
|
-
setDropdownWidth((_b = inputRef == null ? void 0 : inputRef.current) == null ? void 0 : _b.getBoundingClientRect().width);
|
|
17
|
-
setMobileAnchor((_c = inputRef == null ? void 0 : inputRef.current) == null ? void 0 : _c.getBoundingClientRect().height);
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
if (inputRef.current && !dropdownMaxHeight) {
|
|
21
|
-
resize();
|
|
22
|
-
}
|
|
23
|
-
useEffect(() => {
|
|
24
|
-
typeof window !== "undefined" && window.addEventListener("resize", resize);
|
|
25
|
-
return () => {
|
|
26
|
-
typeof window !== "undefined" && window.removeEventListener("resize", resize);
|
|
27
|
-
};
|
|
28
|
-
}, []);
|
|
29
|
-
return { dropdownMaxHeight, dropdownWidth, mobileAnchor, resize };
|
|
30
|
-
};
|
|
31
|
-
export {
|
|
32
|
-
useDropdownPosition
|
|
33
|
-
};
|
|
@@ -1,253 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import "../../../chunk-MMUBH76A.js";
|
|
3
|
-
const defaultPhoneMask = "#################";
|
|
4
|
-
const phoneMasks = {
|
|
5
|
-
AF: "### ### ####",
|
|
6
|
-
AX: "## ### ####",
|
|
7
|
-
AL: "(###) ### ###",
|
|
8
|
-
DZ: "(###) ### ###",
|
|
9
|
-
AS: "(###) ###-####",
|
|
10
|
-
AD: "### ###",
|
|
11
|
-
AO: "(###) ### ###",
|
|
12
|
-
AI: "(###) ###-####",
|
|
13
|
-
AG: "(###) ###-####",
|
|
14
|
-
AR: "(###) ###-####",
|
|
15
|
-
AM: "## ### ###",
|
|
16
|
-
AW: "### ####",
|
|
17
|
-
AU: "# #### ####",
|
|
18
|
-
AT: "(###) ### ####",
|
|
19
|
-
AZ: "(###) ### ## ##",
|
|
20
|
-
BS: "(###) ###-####",
|
|
21
|
-
BH: "#### ####",
|
|
22
|
-
BD: "# ### ###",
|
|
23
|
-
BB: "(###) ###-####",
|
|
24
|
-
BY: "(##) ###-##-##",
|
|
25
|
-
BE: "(###) ### ###",
|
|
26
|
-
BZ: "###-####",
|
|
27
|
-
BJ: "##-##-####",
|
|
28
|
-
BM: "(###) ###-####",
|
|
29
|
-
BT: "# ### ###",
|
|
30
|
-
BO: "# ### ####",
|
|
31
|
-
BA: "## ###-###",
|
|
32
|
-
BW: "## ### ###",
|
|
33
|
-
BR: "(##) ####-####",
|
|
34
|
-
IO: "### ####",
|
|
35
|
-
BN: "### ####",
|
|
36
|
-
BG: "(###) ### ###",
|
|
37
|
-
BF: "## ## ####",
|
|
38
|
-
BI: "## ## ####",
|
|
39
|
-
KH: "## ### ###",
|
|
40
|
-
CM: "#### ####",
|
|
41
|
-
CA: "(###) ###-####",
|
|
42
|
-
CV: "(###) ## ##",
|
|
43
|
-
KY: "(###) ###-####",
|
|
44
|
-
CF: "## ## ####",
|
|
45
|
-
TD: "## ## ## ##",
|
|
46
|
-
CL: "# #### ####",
|
|
47
|
-
CN: "(###) #### ####",
|
|
48
|
-
CX: "# ## ## ##",
|
|
49
|
-
CC: "# ## ## ##",
|
|
50
|
-
CO: "(###) ### ####",
|
|
51
|
-
KM: "## ## ## ##",
|
|
52
|
-
CG: "## ### ####",
|
|
53
|
-
CK: "## ###",
|
|
54
|
-
CR: "#### ####",
|
|
55
|
-
HR: "## #### ###",
|
|
56
|
-
CU: "# ### ####",
|
|
57
|
-
CY: "## ### ###",
|
|
58
|
-
CZ: "### ### ###",
|
|
59
|
-
CD: "### ### ###",
|
|
60
|
-
DK: "## ## ## ##",
|
|
61
|
-
DJ: "## ## ## ##",
|
|
62
|
-
DM: "(###) ###-####",
|
|
63
|
-
DO: "(###) ###-####",
|
|
64
|
-
EC: "## ### ####",
|
|
65
|
-
EG: "# #### ####",
|
|
66
|
-
SV: "#### ####",
|
|
67
|
-
GQ: "## ### ####",
|
|
68
|
-
ER: "# ### ###",
|
|
69
|
-
EE: "#### ####",
|
|
70
|
-
SZ: "#### ####",
|
|
71
|
-
ET: "## ### ####",
|
|
72
|
-
FK: "#####",
|
|
73
|
-
FO: "######",
|
|
74
|
-
FJ: "### ####",
|
|
75
|
-
FI: "## ### ####",
|
|
76
|
-
FR: "## ## ## ## ##",
|
|
77
|
-
GF: "### ## ## ##",
|
|
78
|
-
PF: "## ## ##",
|
|
79
|
-
GA: "# ## ## ##",
|
|
80
|
-
GM: "### ####",
|
|
81
|
-
GE: "(###) ## ## ##",
|
|
82
|
-
DE: "###########",
|
|
83
|
-
GH: "## ### ####",
|
|
84
|
-
GI: "### #####",
|
|
85
|
-
GR: "(###) ### ####",
|
|
86
|
-
GL: "## ## ##",
|
|
87
|
-
GD: "(###) ###-####",
|
|
88
|
-
GP: "### ## ## ##",
|
|
89
|
-
GU: "(###) ###-####",
|
|
90
|
-
GT: "# ### ####",
|
|
91
|
-
GG: "(####) ### ###",
|
|
92
|
-
GN: "## ### ###",
|
|
93
|
-
GW: "# #######",
|
|
94
|
-
GY: "### ####",
|
|
95
|
-
HT: "## ## ####",
|
|
96
|
-
VA: "### ####",
|
|
97
|
-
HN: "####-####",
|
|
98
|
-
HK: "#### ####",
|
|
99
|
-
HU: "(##) ### ####",
|
|
100
|
-
IS: "### ####",
|
|
101
|
-
IN: "####### ###",
|
|
102
|
-
ID: "(###) ###-####",
|
|
103
|
-
IR: "(###) ### ####",
|
|
104
|
-
IQ: "(###) ### ####",
|
|
105
|
-
IE: "(###) ### ###",
|
|
106
|
-
IM: "(####) ### ###",
|
|
107
|
-
IL: "#-###-####",
|
|
108
|
-
IT: "(###) #### ###",
|
|
109
|
-
CI: "## ## ## ##",
|
|
110
|
-
JM: "(###) ###-####",
|
|
111
|
-
JP: "(###) ###-####",
|
|
112
|
-
JE: "(####) ### ###",
|
|
113
|
-
JO: "# #### ####",
|
|
114
|
-
KZ: "(###) ###-##-##",
|
|
115
|
-
KE: "### ######",
|
|
116
|
-
KI: "## ###",
|
|
117
|
-
KP: "###-###-####",
|
|
118
|
-
KR: "(###) ####-####",
|
|
119
|
-
XK: "## ### ###",
|
|
120
|
-
KW: "#### ####",
|
|
121
|
-
KG: "(###) ###-###",
|
|
122
|
-
LA: "## ## ####",
|
|
123
|
-
LV: "## ### ###",
|
|
124
|
-
LB: "## ### ###",
|
|
125
|
-
LS: "# ### ####",
|
|
126
|
-
LR: "## ### ###",
|
|
127
|
-
LY: "##-#######",
|
|
128
|
-
LI: "(###) ###-####",
|
|
129
|
-
LT: "(###) ## ###",
|
|
130
|
-
LU: "### ### ###",
|
|
131
|
-
MO: "#### ####",
|
|
132
|
-
MG: "## ## ### ##",
|
|
133
|
-
MW: "# #### ####",
|
|
134
|
-
MY: "(###) ###-###",
|
|
135
|
-
MV: "###-####",
|
|
136
|
-
ML: "## ## ####",
|
|
137
|
-
MT: "#### ####",
|
|
138
|
-
MH: "###-####",
|
|
139
|
-
MQ: "### ## ## ##",
|
|
140
|
-
MR: "## ## ####",
|
|
141
|
-
MU: "### ####",
|
|
142
|
-
YT: "### ## ## ##",
|
|
143
|
-
MX: "(###) ###-####",
|
|
144
|
-
FM: "### ####",
|
|
145
|
-
MD: "#### ####",
|
|
146
|
-
MC: "(###) ###-###",
|
|
147
|
-
MN: "## ## ####",
|
|
148
|
-
ME: "## ### ###",
|
|
149
|
-
MS: "(###) ###-####",
|
|
150
|
-
MA: "#-####-####",
|
|
151
|
-
MZ: "## ### ####",
|
|
152
|
-
MM: "# ### ####",
|
|
153
|
-
NA: "## ### ####",
|
|
154
|
-
NR: "### ####",
|
|
155
|
-
NP: "#-######",
|
|
156
|
-
NL: "## ### ####",
|
|
157
|
-
NC: "##.##.##",
|
|
158
|
-
NZ: "## ### ###",
|
|
159
|
-
NI: "#### ####",
|
|
160
|
-
NE: "## ## ## ##",
|
|
161
|
-
NG: "## ### ####",
|
|
162
|
-
NU: "####",
|
|
163
|
-
NF: "### ###",
|
|
164
|
-
MK: "## ### ###",
|
|
165
|
-
MP: "(###) ###-####",
|
|
166
|
-
NO: "### ## ###",
|
|
167
|
-
OM: "#### ####",
|
|
168
|
-
PK: "(###) #######",
|
|
169
|
-
PW: "### ####",
|
|
170
|
-
PS: "## ### ####",
|
|
171
|
-
PA: "####-####",
|
|
172
|
-
PG: "(###) ## ###",
|
|
173
|
-
PY: "## ### ####",
|
|
174
|
-
PE: "(###) ### ###",
|
|
175
|
-
PH: "(###) ###-####",
|
|
176
|
-
PN: "### ####",
|
|
177
|
-
PL: "### ### ###",
|
|
178
|
-
PT: "## ### ####",
|
|
179
|
-
PR: "(###) ###-####",
|
|
180
|
-
QA: "#### ####",
|
|
181
|
-
RE: "##### ####",
|
|
182
|
-
RO: "## ### ####",
|
|
183
|
-
RU: "(###) ###-##-##",
|
|
184
|
-
RW: "(###) ### ###",
|
|
185
|
-
BL: "### ## ## ##",
|
|
186
|
-
SH: "####",
|
|
187
|
-
KN: "(###) ###-####",
|
|
188
|
-
LC: "(###) ###-####",
|
|
189
|
-
MF: "### ## ## ##",
|
|
190
|
-
PM: "## ## ##",
|
|
191
|
-
VC: "(###) ###-####",
|
|
192
|
-
WS: "####",
|
|
193
|
-
SM: "(####) ######",
|
|
194
|
-
ST: "## ####",
|
|
195
|
-
SA: "# ### ####",
|
|
196
|
-
SN: "## ### ####",
|
|
197
|
-
RS: "## ### ####",
|
|
198
|
-
SC: "# ### ###",
|
|
199
|
-
SL: "## ######",
|
|
200
|
-
SG: "#### ####",
|
|
201
|
-
SX: "(###) ###-####",
|
|
202
|
-
SK: "(###) ### ###",
|
|
203
|
-
SI: "## ### ###",
|
|
204
|
-
SB: "### ####",
|
|
205
|
-
SO: "# ### ###",
|
|
206
|
-
ZA: "## ### ####",
|
|
207
|
-
GS: "####",
|
|
208
|
-
SS: "# ### ####",
|
|
209
|
-
ES: "### ### ###",
|
|
210
|
-
LK: "## ### ####",
|
|
211
|
-
SD: "## ### ####",
|
|
212
|
-
SR: "###-####",
|
|
213
|
-
SJ: "### ## ###",
|
|
214
|
-
SE: "## ### ####",
|
|
215
|
-
CH: "## ### ####",
|
|
216
|
-
SY: "## #### ###",
|
|
217
|
-
TW: "#### ####",
|
|
218
|
-
TJ: "## ### ####",
|
|
219
|
-
TZ: "## ### ####",
|
|
220
|
-
TH: "# #### ####",
|
|
221
|
-
TL: "#### ####",
|
|
222
|
-
TG: "## ## ## ##",
|
|
223
|
-
TK: "####",
|
|
224
|
-
TO: "####",
|
|
225
|
-
TT: "(###) ###-####",
|
|
226
|
-
TN: "## ### ###",
|
|
227
|
-
TR: "(###) ### ####",
|
|
228
|
-
TM: "# ### ###",
|
|
229
|
-
TC: "(###) ###-####",
|
|
230
|
-
TV: "####",
|
|
231
|
-
UG: "## ### ####",
|
|
232
|
-
UA: "## ### ####",
|
|
233
|
-
AE: "# ### ####",
|
|
234
|
-
GB: "#### ### ###",
|
|
235
|
-
US: "(###) ###-####",
|
|
236
|
-
UM: "(###) ###-####",
|
|
237
|
-
UY: "# ### ## ##",
|
|
238
|
-
UZ: "## ### ####",
|
|
239
|
-
VU: "## ####",
|
|
240
|
-
VE: "###-###-####",
|
|
241
|
-
VN: "## #### ###",
|
|
242
|
-
VG: "(###) ###-####",
|
|
243
|
-
VI: "(###) ###-####",
|
|
244
|
-
WF: "## ####",
|
|
245
|
-
EH: "###-###-###",
|
|
246
|
-
YE: "# ### ###",
|
|
247
|
-
ZM: "## ### ####",
|
|
248
|
-
ZW: "# #######"
|
|
249
|
-
};
|
|
250
|
-
export {
|
|
251
|
-
defaultPhoneMask,
|
|
252
|
-
phoneMasks
|
|
253
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import "../../../chunk-MMUBH76A.js";
|
|
3
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
import styled from "styled-components";
|
|
5
|
-
import { useThemeStore } from "../../stores/theme/useThemeStore.js";
|
|
6
|
-
import { AuthMainStepContent } from "./AuthMainStepContent.js";
|
|
7
|
-
import { CenteredText } from "../common.js";
|
|
8
|
-
const AuthMainStep = ({ oAuthMethods, disableEmailLogin, disablePhoneLogin }) => {
|
|
9
|
-
const logo = useThemeStore((state) => state.getLogo());
|
|
10
|
-
const appName = useThemeStore((state) => state.appName);
|
|
11
|
-
const authLayout = useThemeStore((state) => state.authLayout);
|
|
12
|
-
const embeddedModal = useThemeStore((state) => state.embeddedModal);
|
|
13
|
-
const firstLayoutType = authLayout[0].split(":")[0];
|
|
14
|
-
const heading = firstLayoutType === "AUTH" ? "Sign Up or Login" : "Connect Wallet";
|
|
15
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
16
|
-
logo && /* @__PURE__ */ jsx(Logo, { src: logo, alt: `${appName ? `${appName} -` : ""}logo` }),
|
|
17
|
-
!embeddedModal && /* @__PURE__ */ jsx(CenteredText, { variant: logo ? "bodyM" : "headingS", weight: "semiBold", children: heading }),
|
|
18
|
-
/* @__PURE__ */ jsx(
|
|
19
|
-
AuthMainStepContent,
|
|
20
|
-
{
|
|
21
|
-
disableEmailLogin,
|
|
22
|
-
disablePhoneLogin,
|
|
23
|
-
oAuthMethods
|
|
24
|
-
}
|
|
25
|
-
)
|
|
26
|
-
] });
|
|
27
|
-
};
|
|
28
|
-
const Logo = styled.img`
|
|
29
|
-
height: 100px;
|
|
30
|
-
max-width: 260px;
|
|
31
|
-
object-fit: contain;
|
|
32
|
-
box-sizing: content-box;
|
|
33
|
-
align-self: center;
|
|
34
|
-
`;
|
|
35
|
-
export {
|
|
36
|
-
AuthMainStep
|
|
37
|
-
};
|