@getpara/react-sdk 2.0.0-alpha.3 → 2.0.0-alpha.6

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.
Files changed (183) hide show
  1. package/dist/cli/cli.mjs +1 -6
  2. package/dist/index.js +11 -6499
  3. package/dist/modal/ParaModal.js +262 -0
  4. package/dist/modal/components/Account/Account.js +139 -0
  5. package/dist/modal/components/AddFunds/AddFunds.d.ts +0 -2
  6. package/dist/modal/components/AddFunds/AddFunds.js +69 -0
  7. package/dist/modal/components/AddFunds/AddFundsAsset.d.ts +1 -0
  8. package/dist/modal/components/AddFunds/AddFundsAsset.js +125 -0
  9. package/dist/modal/components/AddFunds/AddFundsAwaiting.js +78 -0
  10. package/dist/modal/components/AddFunds/AddFundsContext.d.ts +31 -0
  11. package/dist/modal/components/AddFunds/AddFundsContext.js +160 -0
  12. package/dist/modal/components/AddFunds/AddFundsDone.js +49 -0
  13. package/dist/modal/components/AddFunds/AddFundsProvider.d.ts +1 -0
  14. package/dist/modal/components/AddFunds/AddFundsProvider.js +109 -0
  15. package/dist/modal/components/AddFunds/AddFundsReceive.d.ts +1 -0
  16. package/dist/modal/components/AddFunds/AddFundsReceive.js +83 -0
  17. package/dist/modal/components/AddFunds/AddFundsSettings.d.ts +1 -0
  18. package/dist/modal/components/AddFunds/AddFundsSettings.js +237 -0
  19. package/dist/{MoonPayEmbed-Q2HP2BFI.js → modal/components/AddFunds/MoonPayEmbed.js} +1 -3
  20. package/dist/modal/components/AddFunds/common.d.ts +19 -0
  21. package/dist/modal/components/AddFunds/common.js +24 -0
  22. package/dist/modal/components/AddFunds/index.js +4 -0
  23. package/dist/modal/components/AuthInput/AuthInput.js +262 -0
  24. package/dist/modal/components/AuthInput/hooks/useDropdownPosition.js +33 -0
  25. package/dist/modal/components/AuthInput/phoneMasks.js +253 -0
  26. package/dist/modal/components/AuthMainStep/AuthMainStep.d.ts +4 -3
  27. package/dist/modal/components/AuthMainStep/AuthMainStep.js +50 -0
  28. package/dist/modal/components/AuthMainStep/AuthMainStepContent.d.ts +4 -3
  29. package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +157 -0
  30. package/dist/modal/components/AuthOptions/AuthOptions.d.ts +4 -3
  31. package/dist/modal/components/AuthOptions/AuthOptions.js +67 -0
  32. package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.js +18 -0
  33. package/dist/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.js +10 -0
  34. package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.js +18 -0
  35. package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.d.ts +5 -1
  36. package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +49 -0
  37. package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +63 -0
  38. package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +55 -0
  39. package/dist/modal/components/Body/AnimatedHeightWrapper.js +29 -0
  40. package/dist/modal/components/Body/Body.d.ts +4 -3
  41. package/dist/modal/components/Body/Body.js +327 -0
  42. package/dist/modal/components/ChainSwitch/ChainSwitch.js +95 -0
  43. package/dist/modal/components/ChainSwitch/config.js +17 -0
  44. package/dist/modal/components/Controls/Controls.js +77 -0
  45. package/dist/modal/components/Controls/Selects.js +189 -0
  46. package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +144 -0
  47. package/dist/modal/components/ExternalWalletStep/config.js +17 -0
  48. package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.js +34 -0
  49. package/dist/modal/components/ExternalWallets/ExternalWallets.js +173 -0
  50. package/dist/modal/components/Footer/Footer.js +95 -0
  51. package/dist/modal/components/Header/Header.js +43 -0
  52. package/dist/modal/components/Header/hooks/useStepTitle.js +54 -0
  53. package/dist/modal/components/Hero/Hero.js +116 -0
  54. package/dist/modal/components/IFrameStep/IFrameStep.js +59 -0
  55. package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +31 -0
  56. package/dist/modal/components/ModalContent/ModalContent.js +95 -0
  57. package/dist/modal/components/OAuth/FarcasterOAuthStep.js +27 -0
  58. package/dist/modal/components/OAuth/OAuth.d.ts +2 -2
  59. package/dist/modal/components/OAuth/OAuth.js +79 -0
  60. package/dist/modal/components/OAuth/TelegramOAuthStep.js +90 -0
  61. package/dist/modal/components/OnRampComponents/AddingFunds.js +23 -0
  62. package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +77 -0
  63. package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +107 -0
  64. package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +132 -0
  65. package/dist/modal/components/StripeComponents/StripeComponents.js +88 -0
  66. package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +27 -0
  67. package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +143 -0
  68. package/dist/modal/components/Waiting/Waiting.js +17 -0
  69. package/dist/modal/components/WalletCard/PartnerIcon.js +34 -0
  70. package/dist/modal/components/WalletCard/WalletCard.d.ts +3 -3
  71. package/dist/modal/components/WalletCard/WalletCard.js +128 -0
  72. package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.js +73 -0
  73. package/dist/modal/components/common.d.ts +32 -13
  74. package/dist/modal/components/common.js +175 -0
  75. package/dist/modal/components/index.js +2 -0
  76. package/dist/modal/constants/constants.d.ts +9 -2
  77. package/dist/modal/constants/constants.js +138 -0
  78. package/dist/modal/constants/defaults.js +10 -0
  79. package/dist/modal/constants/oAuthLogos.d.ts +3 -3
  80. package/dist/modal/constants/oAuthLogos.js +24 -0
  81. package/dist/modal/hooks/useGoBack.js +43 -0
  82. package/dist/modal/index.d.ts +1 -2
  83. package/dist/modal/index.js +29 -0
  84. package/dist/modal/stores/index.js +2 -0
  85. package/dist/modal/stores/modal/actions.js +133 -0
  86. package/dist/modal/stores/modal/useModalStore.d.ts +12 -4
  87. package/dist/modal/stores/modal/useModalStore.js +68 -0
  88. package/dist/modal/types/commonTypes.d.ts +0 -47
  89. package/dist/modal/types/commonTypes.js +1 -0
  90. package/dist/modal/types/externalWallets.d.ts +2 -0
  91. package/dist/modal/types/externalWallets.js +32 -0
  92. package/dist/modal/types/modalProps.d.ts +10 -2
  93. package/dist/modal/types/modalProps.js +12 -0
  94. package/dist/modal/utils/authInputHelpers.d.ts +7 -0
  95. package/dist/modal/utils/authInputHelpers.js +38 -0
  96. package/dist/modal/utils/authLayoutHelpers.js +8 -0
  97. package/dist/modal/utils/countryCodes.js +45 -0
  98. package/dist/modal/utils/getMailtoLink.js +10 -0
  99. package/dist/modal/utils/getTileButtonFlex.js +20 -0
  100. package/dist/modal/utils/isPasskeySupported.js +15 -0
  101. package/dist/modal/utils/openPopup.js +60 -0
  102. package/dist/modal/utils/routeMobileExternalWallet.js +31 -0
  103. package/dist/modal/utils/steps.d.ts +6 -0
  104. package/dist/modal/utils/steps.js +247 -0
  105. package/dist/modal/utils/stringFormatters.d.ts +1 -0
  106. package/dist/modal/utils/stringFormatters.js +19 -0
  107. package/dist/modal/utils/validateOnRampConfig.js +32 -0
  108. package/dist/package.json +6 -0
  109. package/dist/provider/ParaProvider.js +83 -0
  110. package/dist/provider/actions/getAccount.d.ts +8 -1
  111. package/dist/provider/actions/getAccount.js +51 -0
  112. package/dist/provider/actions/getWallet.d.ts +2 -2
  113. package/dist/provider/actions/getWallet.js +14 -0
  114. package/dist/provider/actions/index.d.ts +2 -0
  115. package/dist/provider/actions/index.js +59 -0
  116. package/dist/provider/actions/utils.js +15 -0
  117. package/dist/provider/components/CosmosWalletWrapper.js +34 -0
  118. package/dist/provider/components/EvmWalletWrapper.js +34 -0
  119. package/dist/provider/components/ExternalWalletWrapper.js +139 -0
  120. package/dist/provider/components/SolanaWalletWrapper.js +36 -0
  121. package/dist/provider/external/getParaCosmosConnector.js +22 -0
  122. package/dist/provider/external/getParaEvmConnector.js +22 -0
  123. package/dist/provider/external/getParaSolanaConnector.js +22 -0
  124. package/dist/provider/external/stubs/CosmosExternalWalletContextStub.js +18 -0
  125. package/dist/provider/external/stubs/EvmExternalWalletContextStub.js +21 -0
  126. package/dist/provider/external/stubs/SolanaExternalWalletContextStub.js +14 -0
  127. package/dist/provider/hooks/index.js +4 -0
  128. package/dist/provider/hooks/mutations/index.d.ts +1 -0
  129. package/dist/provider/hooks/mutations/index.js +61 -0
  130. package/dist/provider/hooks/mutations/utils.js +22 -0
  131. package/dist/provider/hooks/queries/index.d.ts +1 -0
  132. package/dist/provider/hooks/queries/index.js +10 -0
  133. package/dist/provider/hooks/queries/useAccount.js +21 -0
  134. package/dist/provider/hooks/queries/useWallet.js +22 -0
  135. package/dist/provider/hooks/queries/useWalletBalance.d.ts +6 -0
  136. package/dist/provider/hooks/queries/useWalletBalance.js +55 -0
  137. package/dist/provider/hooks/utils/index.js +10 -0
  138. package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +74 -0
  139. package/dist/provider/hooks/utils/useClient.js +10 -0
  140. package/dist/provider/hooks/utils/useEventListeners.d.ts +1 -1
  141. package/dist/provider/hooks/utils/useEventListeners.js +147 -0
  142. package/dist/provider/hooks/utils/useInternalClient.js +10 -0
  143. package/dist/provider/hooks/utils/useModal.js +17 -0
  144. package/dist/provider/hooks/utils/useWalletState.d.ts +3 -3
  145. package/dist/provider/hooks/utils/useWalletState.js +48 -0
  146. package/dist/provider/index.js +9 -0
  147. package/dist/provider/providers/AuthProvider.d.ts +10 -6
  148. package/dist/provider/providers/AuthProvider.js +498 -0
  149. package/dist/provider/providers/CosmosExternalWalletProvider.js +66 -0
  150. package/dist/provider/providers/EvmExternalWalletProvider.js +74 -0
  151. package/dist/provider/providers/ExternalWalletProvider.d.ts +5 -2
  152. package/dist/provider/providers/ExternalWalletProvider.js +428 -0
  153. package/dist/provider/providers/SolanaExternalWalletProvider.js +66 -0
  154. package/dist/provider/stores/getters.d.ts +1 -1
  155. package/dist/provider/stores/getters.js +13 -0
  156. package/dist/provider/stores/setters.js +7 -0
  157. package/dist/provider/stores/slices/client.js +9 -0
  158. package/dist/provider/stores/slices/config.js +9 -0
  159. package/dist/provider/stores/slices/externalWallets.js +40 -0
  160. package/dist/provider/stores/slices/index.js +5 -0
  161. package/dist/provider/stores/slices/modal.js +16 -0
  162. package/dist/provider/stores/slices/wallet.js +13 -0
  163. package/dist/provider/stores/types.d.ts +7 -4
  164. package/dist/provider/stores/types.js +1 -0
  165. package/dist/provider/stores/useStore.js +28 -0
  166. package/dist/provider/types/externalWalletProviders.d.ts +2 -2
  167. package/dist/provider/types/externalWalletProviders.js +1 -0
  168. package/dist/provider/types/provider.d.ts +9 -3
  169. package/dist/provider/types/provider.js +1 -0
  170. package/dist/provider/types/query.js +1 -0
  171. package/dist/provider/types/utils.js +1 -0
  172. package/dist/provider/utils/constants.d.ts +5 -0
  173. package/dist/provider/utils/constants.js +10 -0
  174. package/dist/provider/utils/paraConfigTypeGuards.js +13 -0
  175. package/dist/provider/utils/renameMutations.js +18 -0
  176. package/package.json +18 -16
  177. package/dist/MoonPayEmbed-Q2HP2BFI.js.br +0 -0
  178. package/dist/MoonPayEmbed-Q2HP2BFI.js.gz +0 -0
  179. package/dist/chunk-MMUBH76A.js.br +0 -0
  180. package/dist/chunk-MMUBH76A.js.gz +0 -0
  181. package/dist/index.js.br +0 -0
  182. package/dist/index.js.gz +0 -0
  183. /package/dist/modal/{components/AuthInput → utils}/countryCodes.d.ts +0 -0
@@ -1,7 +1,5 @@
1
1
  "use client";
2
- import "./chunk-MMUBH76A.js";
3
-
4
- // src/modal/components/AddFunds/MoonPayEmbed.tsx
2
+ import "../../../chunk-MMUBH76A.js";
5
3
  import { MoonPayEmbed } from "@getpara/react-common";
6
4
  var MoonPayEmbed_default = MoonPayEmbed;
7
5
  export {
@@ -0,0 +1,19 @@
1
+ export declare const contentMotionProps: {
2
+ transition: {
3
+ duration: number;
4
+ };
5
+ initial: {
6
+ opacity: number;
7
+ };
8
+ animate: {
9
+ opacity: number;
10
+ };
11
+ exit: {
12
+ opacity: number;
13
+ };
14
+ };
15
+ export declare const NoProviders: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<Omit<any, "ref"> & import("react").RefAttributes<any>, "ref"> & {
16
+ 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;
17
+ }, {
18
+ isHidden?: boolean;
19
+ }>> & string & Omit<import("react").ForwardRefExoticComponent<Omit<any, "ref"> & import("react").RefAttributes<any>>, keyof import("react").Component<any, {}, any>>;
@@ -0,0 +1,24 @@
1
+ "use client";
2
+ import "../../../chunk-MMUBH76A.js";
3
+ import { CpslText } from "@getpara/react-components";
4
+ import styled from "styled-components";
5
+ const contentMotionProps = {
6
+ transition: { duration: 0.2 },
7
+ initial: { opacity: 0 },
8
+ animate: { opacity: 1 },
9
+ exit: { opacity: 0 }
10
+ };
11
+ const NoProviders = styled(CpslText)`
12
+ width: 100%;
13
+ text-align: center;
14
+ visibility: ${({ isHidden }) => isHidden ? "hidden" : "visible"};
15
+ position: absolute;
16
+ top: 0;
17
+ left: 0;
18
+ right: 0;
19
+ transition: visibility 0.2s;
20
+ `;
21
+ export {
22
+ NoProviders,
23
+ contentMotionProps
24
+ };
@@ -0,0 +1,4 @@
1
+ "use client";
2
+ export * from "./AddFunds.js";
3
+ export * from "./AddFundsAwaiting.js";
4
+ export * from "./AddFundsDone.js";
@@ -0,0 +1,262 @@
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 { useEffect, useMemo, useRef, useState } from "react";
16
+ import styled from "styled-components";
17
+ import countryCodes from "../../utils/countryCodes.js";
18
+ import { MOBILE_SIZE } from "../../constants/constants.js";
19
+ import { useDropdownPosition } from "./hooks/useDropdownPosition.js";
20
+ import { defaultPhoneMask, phoneMasks } from "./phoneMasks.js";
21
+ import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
22
+ import parsePhoneNumberFromString from "libphonenumber-js";
23
+ import { useAuthActions } from "../../../provider/providers/AuthProvider.js";
24
+ import { useStore } from "../../../provider/stores/useStore.js";
25
+ import { isCcMatch, validateAuth } from "../../utils/authInputHelpers.js";
26
+ const DEFAULT_COUNTRY = { label: "United States", value: "+1", selectedLabel: "US", icon: "US" };
27
+ const AuthInput = ({ disableEmailLogin, disablePhoneLogin }) => {
28
+ var _a, _b, _c;
29
+ const inputRef = useRef(null);
30
+ const { dropdownMaxHeight, dropdownWidth } = useDropdownPosition(inputRef);
31
+ const defaultAuthIdentifier = useStore((state) => {
32
+ var _a2;
33
+ return (_a2 = state.modalConfig) == null ? void 0 : _a2.defaultAuthIdentifier;
34
+ });
35
+ const para = useInternalClient();
36
+ const { signUpOrLogIn, isSignUpOrLogInPending } = useAuthActions();
37
+ const authInfo = para.authInfo;
38
+ const [storedNationalNumber, storedCountryCode] = useMemo(() => {
39
+ if ((authInfo == null ? void 0 : authInfo.authType) !== "phone") {
40
+ return [void 0, void 0];
41
+ }
42
+ const parsed = parsePhoneNumberFromString(authInfo.identifier);
43
+ return [parsed == null ? void 0 : parsed.nationalNumber, parsed == null ? void 0 : parsed.countryCallingCode];
44
+ }, [authInfo == null ? void 0 : authInfo.authType, authInfo == null ? void 0 : authInfo.identifier]);
45
+ const [countryCode, setCountryCode] = useState(storedCountryCode != null ? storedCountryCode : "+1");
46
+ const [identifier, setIdentifier] = useState(
47
+ (() => {
48
+ if (!(authInfo == null ? void 0 : authInfo.authType) || ["telegram", "farcaster", "externalWallet"].includes(authInfo == null ? void 0 : authInfo.authType)) {
49
+ return "";
50
+ }
51
+ if (authInfo.authType !== "phone") {
52
+ return authInfo.identifier;
53
+ }
54
+ return storedNationalNumber != null ? storedNationalNumber : "";
55
+ })()
56
+ );
57
+ const [identifierType, setIdentifierType] = useState(
58
+ authInfo && (authInfo.authType === "email" || authInfo.authType === "phone") ? authInfo.authType : void 0
59
+ );
60
+ const [matchedCountryCode, setMatchedCountryCode] = useState(
61
+ (_a = countryCodes.find((option) => isCcMatch(countryCode, option))) != null ? _a : DEFAULT_COUNTRY
62
+ );
63
+ const [error, setError] = useState("");
64
+ const [isPending, setIsPending] = useState(isSignUpOrLogInPending);
65
+ const [search, setSearch] = useState("");
66
+ const setCountryCodes = (countyCodeInput) => {
67
+ setCountryCode(countyCodeInput.value);
68
+ setMatchedCountryCode(countyCodeInput);
69
+ };
70
+ useEffect(() => {
71
+ if (defaultAuthIdentifier && !authInfo) {
72
+ const number = parsePhoneNumberFromString(defaultAuthIdentifier);
73
+ if (number) {
74
+ const countryCode2 = `+${number.countryCallingCode}`;
75
+ const countryCodeInputMatch = countryCodes.find((option) => isCcMatch(countryCode2, option));
76
+ if (countryCodeInputMatch) {
77
+ setCountryCodes(countryCodeInputMatch);
78
+ }
79
+ }
80
+ handleIdentifierInput({
81
+ detail: { value: number ? number.nationalNumber : defaultAuthIdentifier }
82
+ });
83
+ }
84
+ }, [authInfo]);
85
+ const isEmail = identifierType === "email";
86
+ const isPhone = identifierType === "phone";
87
+ const isUnknown = !identifierType;
88
+ const filteredCountryCodes = search ? countryCodes.filter(
89
+ (cc) => cc.selectedLabel.toLowerCase().includes(search.toLowerCase()) || cc.label.toLowerCase().includes(search.toLowerCase()) || cc.value.toLowerCase().includes(search.toLowerCase())
90
+ ) : countryCodes;
91
+ const handleSearchInput = (ev) => {
92
+ setSearch(ev.detail);
93
+ };
94
+ const handleIdentifierInput = (ev) => {
95
+ var _a2;
96
+ const newIdentifier = (_a2 = ev.detail.value) != null ? _a2 : "";
97
+ let isNewPhone = false, isNewEmail = false;
98
+ if (!disablePhoneLogin) {
99
+ const countryCodeInputMatch = countryCodes.find((option) => isCcMatch(newIdentifier, option));
100
+ if (countryCodeInputMatch) {
101
+ setCountryCodes(countryCodeInputMatch);
102
+ setIdentifierType("phone");
103
+ setIdentifier("");
104
+ return;
105
+ }
106
+ isNewPhone = !isEmail && isPhone ? /\d+$/.test(newIdentifier) : /\d\d\d+$/.test(newIdentifier);
107
+ }
108
+ if (!disableEmailLogin) {
109
+ isNewEmail = /\D.*$/.test(newIdentifier);
110
+ }
111
+ setIdentifierType(isNewEmail ? "email" : isNewPhone ? "phone" : void 0);
112
+ setIdentifier(newIdentifier);
113
+ };
114
+ const handleCountryCodeInput = (ev) => {
115
+ const matchedCountryCode2 = countryCodes.find((code) => code.selectedLabel === ev.detail);
116
+ if (matchedCountryCode2) {
117
+ setCountryCodes(matchedCountryCode2);
118
+ }
119
+ };
120
+ const onSubmit = () => __async(void 0, null, function* () {
121
+ setError("");
122
+ let auth;
123
+ try {
124
+ auth = validateAuth(identifier, countryCode, identifierType);
125
+ signUpOrLogIn(auth);
126
+ } catch (err) {
127
+ setError(err.message);
128
+ }
129
+ });
130
+ useEffect(() => {
131
+ if (isSignUpOrLogInPending) {
132
+ setIsPending(true);
133
+ }
134
+ }, [isSignUpOrLogInPending]);
135
+ useEffect(() => {
136
+ setIsPending(false);
137
+ }, [error]);
138
+ if (disableEmailLogin && disablePhoneLogin) {
139
+ return null;
140
+ }
141
+ return /* @__PURE__ */ jsx(
142
+ "form",
143
+ {
144
+ onSubmit: (e) => __async(void 0, null, function* () {
145
+ e.preventDefault();
146
+ onSubmit();
147
+ }),
148
+ children: /* @__PURE__ */ jsxs(
149
+ StyledInput,
150
+ {
151
+ ref: inputRef,
152
+ id: "authInput",
153
+ placeholder: isEmail || disablePhoneLogin ? "Enter email" : isPhone || disableEmailLogin ? "Enter phone" : "Enter email or phone",
154
+ onCpslInput: handleIdentifierInput,
155
+ value: identifier,
156
+ errorText: error,
157
+ autofocus: true,
158
+ inputMode: "email",
159
+ onKeyDown: (e) => __async(void 0, null, function* () {
160
+ return e.key === "Enter" && onSubmit();
161
+ }),
162
+ contrastText: true,
163
+ isPhone,
164
+ mask: identifierType === "phone" ? (_c = phoneMasks[(_b = matchedCountryCode.selectedLabel) != null ? _b : ""]) != null ? _c : defaultPhoneMask : void 0,
165
+ enterkeyhint: "go",
166
+ noAutoDisable: true,
167
+ disabled: isPending,
168
+ "data-testid": "auth-input",
169
+ children: [
170
+ /* @__PURE__ */ jsxs(IconContainer, { slot: "start", children: [
171
+ !disableEmailLogin && (isUnknown || isEmail) && /* @__PURE__ */ jsx(CpslIcon, { "aria-label": "email", icon: "mail" }),
172
+ !disablePhoneLogin && isUnknown && /* @__PURE__ */ jsx(CpslIcon, { "aria-label": "phone", icon: "phone" }),
173
+ isPhone && /* @__PURE__ */ jsxs(
174
+ CountryCodeSelect,
175
+ {
176
+ selectedValue: matchedCountryCode.selectedLabel,
177
+ onCpslSelectValueChange: handleCountryCodeInput,
178
+ showFormattedSelectedItem: true,
179
+ autoWidth: true,
180
+ dropdownMaxHeight,
181
+ anchorElId: "authInput",
182
+ $width: dropdownWidth != null ? dropdownWidth : 0,
183
+ showSearch: true,
184
+ searchPlaceholder: "Search Countries",
185
+ onCpslSearchChange: handleSearchInput,
186
+ "data-testid": "country-code-select",
187
+ children: [
188
+ matchedCountryCode && /* @__PURE__ */ jsxs(SelectedItem, { slot: "selected-item", children: [
189
+ /* @__PURE__ */ jsx(CpslText, { children: matchedCountryCode.selectedLabel }),
190
+ /* @__PURE__ */ jsx(CpslText, { children: matchedCountryCode.value })
191
+ ] }),
192
+ filteredCountryCodes.map((cc) => /* @__PURE__ */ jsxs(StyledSelectItem, { slot: "items", value: cc.selectedLabel, children: [
193
+ /* @__PURE__ */ jsx(CpslText, { children: cc.label }),
194
+ /* @__PURE__ */ jsx(CpslText, { children: cc.value })
195
+ ] }, cc.selectedLabel))
196
+ ]
197
+ }
198
+ )
199
+ ] }),
200
+ identifier && /* @__PURE__ */ jsx(CpslButton, { slot: "end", size: "small", fullWidth: true, disabled: isPending, onClick: onSubmit, children: isPending ? /* @__PURE__ */ jsx(CpslSpinner, { size: 16 }) : /* @__PURE__ */ jsx(CpslIcon, { icon: "arrowNarrow" }) })
201
+ ]
202
+ },
203
+ "email"
204
+ )
205
+ }
206
+ );
207
+ };
208
+ const IconContainer = styled.div`
209
+ height: 100%;
210
+ display: flex;
211
+ align-items: center;
212
+ gap: 8px;
213
+ padding-right: 12px;
214
+ border-right: 1px solid var(--cpsl-color-background-16);
215
+
216
+ & cpsl-icon {
217
+ --icon-color: var(--cpsl-color-contrast);
218
+ }
219
+ `;
220
+ const CountryCodeSelect = styled(CpslSelect)`
221
+ --container-height: 100%;
222
+ --container-padding-start: 0px;
223
+ --container-padding-end: 0px;
224
+ --container-border-width: 0px;
225
+ --container-gap: 4px;
226
+ --container-background-color: transparent;
227
+ --container-box-shadow: none;
228
+
229
+ &::part(dropdown) {
230
+ width: ${({ $width }) => `${$width - 2}px`};
231
+ }
232
+
233
+ &::part(popover) {
234
+ @media (max-width: ${MOBILE_SIZE}px) {
235
+ top: unset !important;
236
+ bottom: 16px;
237
+ }
238
+
239
+ cpsl-auth-modal.force-mobile-media & {
240
+ top: unset !important;
241
+ bottom: 16px;
242
+ }
243
+ }
244
+ `;
245
+ const StyledSelectItem = styled(CpslSelectItem)`
246
+ &::part(inner-container) {
247
+ justify-content: space-between;
248
+ }
249
+ `;
250
+ const SelectedItem = styled.div`
251
+ display: flex;
252
+ gap: 4px;
253
+ align-items: center;
254
+ `;
255
+ const StyledInput = styled(CpslInput)`
256
+ --container-background-color: var(--cpsl-color-background-8);
257
+ --input-background-color: var(--cpsl-color-background-8);
258
+ --container-padding-end: 8px;
259
+ `;
260
+ export {
261
+ AuthInput
262
+ };
@@ -0,0 +1,33 @@
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, _d;
10
+ if (typeof window !== "undefined") {
11
+ const newMaxHeight = Math.max(
12
+ window.innerHeight - ((_b = (_a = inputRef == null ? void 0 : inputRef.current) == null ? void 0 : _a.getBoundingClientRect().bottom) != null ? _b : 0) - 20,
13
+ window.innerHeight * 0.25
14
+ );
15
+ setDropdownMaxHeight(newMaxHeight);
16
+ setDropdownWidth((_c = inputRef == null ? void 0 : inputRef.current) == null ? void 0 : _c.getBoundingClientRect().width);
17
+ setMobileAnchor((_d = inputRef == null ? void 0 : inputRef.current) == null ? void 0 : _d.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
+ };
@@ -0,0 +1,253 @@
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,8 +1,9 @@
1
- import { OAuthMethod } from '@getpara/web-sdk';
1
+ import { TOAuthMethod } from '@getpara/web-sdk';
2
2
  interface AuthMainStepProps {
3
- oAuthMethods?: OAuthMethod[];
3
+ oAuthMethods?: TOAuthMethod[];
4
4
  disableEmailLogin: boolean;
5
5
  disablePhoneLogin: boolean;
6
+ isGuestModeEnabled?: boolean;
6
7
  }
7
- export declare const AuthMainStep: ({ oAuthMethods, disableEmailLogin, disablePhoneLogin }: AuthMainStepProps) => import("react/jsx-runtime").JSX.Element;
8
+ export declare const AuthMainStep: ({ oAuthMethods, disableEmailLogin, disablePhoneLogin, isGuestModeEnabled, }: AuthMainStepProps) => import("react/jsx-runtime").JSX.Element;
8
9
  export {};
@@ -0,0 +1,50 @@
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 { AuthMainStepContent } from "./AuthMainStepContent.js";
6
+ import { CenteredText } from "../common.js";
7
+ import { useStore } from "../../../provider/stores/useStore.js";
8
+ import { useModalStore } from "../../stores/index.js";
9
+ const AuthMainStep = ({
10
+ oAuthMethods,
11
+ disableEmailLogin,
12
+ disablePhoneLogin,
13
+ isGuestModeEnabled = false
14
+ }) => {
15
+ const authLayout = useModalStore((state) => state.authLayout);
16
+ const embeddedModal = useStore((state) => {
17
+ var _a;
18
+ return (_a = state.modalConfig) == null ? void 0 : _a.embeddedModal;
19
+ });
20
+ const logo = useStore((state) => {
21
+ var _a;
22
+ return (_a = state.modalConfig) == null ? void 0 : _a.logo;
23
+ });
24
+ const appName = useStore((state) => state.appName);
25
+ const firstLayoutType = authLayout == null ? void 0 : authLayout[0].split(":")[0];
26
+ const heading = firstLayoutType === "AUTH" ? "Sign Up or Login" : "Connect Wallet";
27
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
28
+ logo && /* @__PURE__ */ jsx(Logo, { src: logo, alt: `${appName ? `${appName} -` : ""}logo` }),
29
+ !embeddedModal && /* @__PURE__ */ jsx(CenteredText, { variant: logo ? "bodyM" : "headingS", weight: "semiBold", children: heading }),
30
+ /* @__PURE__ */ jsx(
31
+ AuthMainStepContent,
32
+ {
33
+ disableEmailLogin,
34
+ disablePhoneLogin,
35
+ isGuestModeEnabled,
36
+ oAuthMethods
37
+ }
38
+ )
39
+ ] });
40
+ };
41
+ const Logo = styled.img`
42
+ height: 100px;
43
+ max-width: 260px;
44
+ object-fit: contain;
45
+ box-sizing: content-box;
46
+ align-self: center;
47
+ `;
48
+ export {
49
+ AuthMainStep
50
+ };
@@ -1,8 +1,9 @@
1
- import { OAuthMethod } from '@getpara/web-sdk';
1
+ import { TOAuthMethod } from '@getpara/web-sdk';
2
2
  interface AuthMainStepContentProps {
3
- oAuthMethods?: OAuthMethod[];
3
+ oAuthMethods?: TOAuthMethod[];
4
4
  disableEmailLogin: boolean;
5
5
  disablePhoneLogin: boolean;
6
+ isGuestModeEnabled?: boolean;
6
7
  }
7
- export declare const AuthMainStepContent: ({ oAuthMethods, disableEmailLogin, disablePhoneLogin }: AuthMainStepContentProps) => import("react/jsx-runtime").JSX.Element;
8
+ export declare const AuthMainStepContent: ({ oAuthMethods, disableEmailLogin, disablePhoneLogin, isGuestModeEnabled, }: AuthMainStepContentProps) => import("react/jsx-runtime").JSX.Element;
8
9
  export {};