@getpara/react-sdk 1.6.0 → 1.6.1-dev.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.
Files changed (142) hide show
  1. package/dist/index.js +6 -6367
  2. package/dist/modal/ParaModal.js +337 -0
  3. package/dist/modal/components/Account/Account.js +69 -0
  4. package/dist/modal/components/AddFunds/AddFunds.js +220 -0
  5. package/dist/modal/components/AddFunds/AddFundsAwaiting.js +72 -0
  6. package/dist/modal/components/AddFunds/AddFundsDone.js +43 -0
  7. package/dist/{MoonPayEmbed-Q2HP2BFI.js → modal/components/AddFunds/MoonPayEmbed.js} +1 -3
  8. package/dist/modal/components/AddFunds/index.js +4 -0
  9. package/dist/modal/components/AuthInput/AuthInput.js +283 -0
  10. package/dist/modal/components/AuthInput/countryCodes.js +42 -0
  11. package/dist/modal/components/AuthInput/hooks/useDropdownPosition.js +33 -0
  12. package/dist/modal/components/AuthInput/phoneMasks.js +253 -0
  13. package/dist/modal/components/AuthMainStep/AuthMainStep.js +37 -0
  14. package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +113 -0
  15. package/dist/modal/components/AuthOptions/AuthOptions.js +33 -0
  16. package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.js +18 -0
  17. package/dist/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.js +10 -0
  18. package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.js +18 -0
  19. package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +44 -0
  20. package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +52 -0
  21. package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +93 -0
  22. package/dist/modal/components/Body/AnimatedHeightWrapper.js +29 -0
  23. package/dist/modal/components/Body/Body.js +304 -0
  24. package/dist/modal/components/ChainSwitch/ChainSwitch.js +94 -0
  25. package/dist/modal/components/ChainSwitch/config.js +17 -0
  26. package/dist/modal/components/Controls/Controls.js +74 -0
  27. package/dist/modal/components/Controls/Selects.js +213 -0
  28. package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +151 -0
  29. package/dist/modal/components/ExternalWalletStep/config.js +17 -0
  30. package/dist/modal/components/ExternalWallets/ExternalWallets.js +172 -0
  31. package/dist/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.js +123 -0
  32. package/dist/modal/components/Footer/Footer.js +93 -0
  33. package/dist/modal/components/Header/Header.js +43 -0
  34. package/dist/modal/components/Header/hooks/useStepTitle.js +50 -0
  35. package/dist/modal/components/Hero/Hero.js +122 -0
  36. package/dist/modal/components/IFrameStep/IFrameStep.js +55 -0
  37. package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +28 -0
  38. package/dist/modal/components/ModalContent/ModalContent.js +310 -0
  39. package/dist/modal/components/OAuth/FarcasterOAuthStep.js +81 -0
  40. package/dist/modal/components/OAuth/OAuth.js +153 -0
  41. package/dist/modal/components/OAuth/TelegramOAuthStep.js +139 -0
  42. package/dist/modal/components/OnRampComponents/AddingFunds.js +23 -0
  43. package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +77 -0
  44. package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +101 -0
  45. package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +141 -0
  46. package/dist/modal/components/StripeComponents/StripeComponents.js +88 -0
  47. package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +24 -0
  48. package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +159 -0
  49. package/dist/modal/components/Waiting/Waiting.js +17 -0
  50. package/dist/modal/components/WalletCard/PartnerIcon.js +34 -0
  51. package/dist/modal/components/WalletCard/WalletCard.js +127 -0
  52. package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.js +52 -0
  53. package/dist/modal/components/common.js +83 -0
  54. package/dist/modal/components/index.js +2 -0
  55. package/dist/modal/constants/constants.js +111 -0
  56. package/dist/modal/constants/defaults.js +10 -0
  57. package/dist/modal/constants/oAuthLogos.js +24 -0
  58. package/dist/modal/hooks/useActiveWallet.js +15 -0
  59. package/dist/modal/hooks/useCreateAccount.js +72 -0
  60. package/dist/modal/hooks/useEmbeddedExternalConnection.js +39 -0
  61. package/dist/modal/hooks/useGoBack.js +35 -0
  62. package/dist/modal/hooks/useSetLoginURLs.d.ts +8 -0
  63. package/dist/modal/hooks/useSetLoginURLs.js +45 -0
  64. package/dist/modal/index.js +32 -0
  65. package/dist/modal/providers/CosmosExternalWalletContextStub.js +34 -0
  66. package/dist/modal/providers/EvmExternalWalletContextStub.js +38 -0
  67. package/dist/modal/providers/ExternalWalletContext.js +275 -0
  68. package/dist/modal/providers/SolanaExternalWalletContextStub.js +19 -0
  69. package/dist/modal/stores/externalWalletProvider/actions.js +10 -0
  70. package/dist/modal/stores/externalWalletProvider/useExternalWalletProviderStore.js +20 -0
  71. package/dist/modal/stores/index.js +4 -0
  72. package/dist/modal/stores/modal/actions.js +70 -0
  73. package/dist/modal/stores/modal/useModalStore.js +65 -0
  74. package/dist/modal/stores/theme/actions.js +28 -0
  75. package/dist/modal/stores/theme/useThemeStore.js +21 -0
  76. package/dist/modal/stores/userInfo/actions.js +30 -0
  77. package/dist/modal/stores/userInfo/useUserInfoStore.js +17 -0
  78. package/dist/modal/types/commonTypes.js +1 -0
  79. package/dist/modal/types/externalWallets.js +31 -0
  80. package/dist/modal/types/modalProps.js +12 -0
  81. package/dist/modal/utils/authLayoutHelpers.js +8 -0
  82. package/dist/modal/utils/getMailtoLink.js +10 -0
  83. package/dist/modal/utils/getTileButtonFlex.js +20 -0
  84. package/dist/modal/utils/openPopup.js +60 -0
  85. package/dist/modal/utils/routeMobileExternalWallet.js +31 -0
  86. package/dist/modal/utils/steps.js +228 -0
  87. package/dist/modal/utils/stringFormatters.js +14 -0
  88. package/dist/modal/utils/validateOnRampConfig.js +32 -0
  89. package/dist/provider/ParaProvider.js +22 -0
  90. package/dist/provider/actions/checkIfUserExists.js +21 -0
  91. package/dist/provider/actions/createUser.js +26 -0
  92. package/dist/provider/actions/getAccount.js +22 -0
  93. package/dist/provider/actions/getWallet.js +14 -0
  94. package/dist/provider/actions/initiateLogin.js +20 -0
  95. package/dist/provider/actions/keepSessionAlive.js +20 -0
  96. package/dist/provider/actions/logout.js +17 -0
  97. package/dist/provider/actions/signMessage.js +20 -0
  98. package/dist/provider/actions/signTransaction.js +20 -0
  99. package/dist/provider/actions/waitForAccountCreation.js +21 -0
  100. package/dist/provider/actions/waitForLoginAndSetup.js +24 -0
  101. package/dist/provider/actions/waitForPasskeyAndCreateWallet.js +21 -0
  102. package/dist/provider/hooks/index.js +4 -0
  103. package/dist/provider/hooks/mutations/index.js +24 -0
  104. package/dist/provider/hooks/mutations/useCheckIfUserExists.js +23 -0
  105. package/dist/provider/hooks/mutations/useCreateUser.js +20 -0
  106. package/dist/provider/hooks/mutations/useInitiateLogin.js +23 -0
  107. package/dist/provider/hooks/mutations/useKeepSessionAlive.js +20 -0
  108. package/dist/provider/hooks/mutations/useLogout.js +30 -0
  109. package/dist/provider/hooks/mutations/useSignMessage.js +33 -0
  110. package/dist/provider/hooks/mutations/useSignTransaction.js +33 -0
  111. package/dist/provider/hooks/mutations/useWaitForAccountCreation.js +30 -0
  112. package/dist/provider/hooks/mutations/useWaitForLoginAndSetup.js +30 -0
  113. package/dist/provider/hooks/mutations/useWaitForPasskeyAndCreateWallet.js +30 -0
  114. package/dist/provider/hooks/queries/index.js +8 -0
  115. package/dist/provider/hooks/queries/useAccount.js +21 -0
  116. package/dist/provider/hooks/queries/useWallet.js +22 -0
  117. package/dist/provider/hooks/utils/index.js +10 -0
  118. package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +74 -0
  119. package/dist/provider/hooks/utils/useClient.js +10 -0
  120. package/dist/provider/hooks/utils/useEventListeners.js +105 -0
  121. package/dist/provider/hooks/utils/useInternalClient.js +10 -0
  122. package/dist/provider/hooks/utils/useModal.js +17 -0
  123. package/dist/provider/hooks/utils/useWalletState.js +33 -0
  124. package/dist/provider/index.js +8 -0
  125. package/dist/provider/stores/getters.js +13 -0
  126. package/dist/provider/stores/slices/client.js +9 -0
  127. package/dist/provider/stores/slices/index.js +4 -0
  128. package/dist/provider/stores/slices/modal.js +9 -0
  129. package/dist/provider/stores/slices/wallet.js +11 -0
  130. package/dist/provider/stores/types.js +1 -0
  131. package/dist/provider/stores/useStore.js +27 -0
  132. package/dist/provider/types/provider.js +1 -0
  133. package/dist/provider/types/query.js +1 -0
  134. package/dist/provider/types/utils.js +1 -0
  135. package/dist/provider/utils/renameMutations.js +16 -0
  136. package/package.json +2 -2
  137. package/dist/MoonPayEmbed-Q2HP2BFI.js.br +0 -0
  138. package/dist/MoonPayEmbed-Q2HP2BFI.js.gz +0 -0
  139. package/dist/chunk-MMUBH76A.js.br +0 -0
  140. package/dist/chunk-MMUBH76A.js.gz +0 -0
  141. package/dist/index.js.br +0 -0
  142. package/dist/index.js.gz +0 -0
@@ -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
+ };
@@ -0,0 +1,37 @@
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
+ };
@@ -0,0 +1,113 @@
1
+ "use client";
2
+ import "../../../chunk-MMUBH76A.js";
3
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
+ import { Fragment as Fragment2, useMemo } from "react";
5
+ import { CpslButton, CpslDivider, CpslIconGroup } from "@getpara/react-components";
6
+ import styled from "styled-components";
7
+ import { useExternalWallets } from "../../providers/ExternalWalletContext.js";
8
+ import { ExternalWallets } from "../ExternalWallets/ExternalWallets.js";
9
+ import { useModalStore, useThemeStore } from "../../stores/index.js";
10
+ import { ModalStep } from "../../utils/steps.js";
11
+ import { AuthLayout } from "../../types/modalProps.js";
12
+ import { brandedOAuthLogos, oAuthLogos } from "../../constants/oAuthLogos.js";
13
+ import { AuthOptions } from "../AuthOptions/AuthOptions.js";
14
+ const AuthMainStepContent = ({ oAuthMethods, disableEmailLogin, disablePhoneLogin }) => {
15
+ const { wallets } = useExternalWallets();
16
+ const authLayout = useThemeStore((state) => state.authLayout);
17
+ const setStep = useModalStore((state) => state.setStep);
18
+ const oAuthLogoVariant = useThemeStore((state) => state.oAuthLogoVariant);
19
+ const isDark = useThemeStore((state) => state.isDark);
20
+ const useBrandedLogos = oAuthLogoVariant === "default";
21
+ const useDarkLogos = useBrandedLogos ? isDark : oAuthLogoVariant !== "dark";
22
+ const handleCondensedAuthClick = () => {
23
+ setStep(ModalStep.AUTH_MORE);
24
+ };
25
+ const handleCondensedExternalClick = () => {
26
+ setStep(ModalStep.EX_WALLET_MORE);
27
+ };
28
+ const Content = useMemo(() => {
29
+ const methods = [];
30
+ authLayout.forEach((layout) => {
31
+ switch (layout) {
32
+ case AuthLayout.AUTH_FULL: {
33
+ methods.push([
34
+ /* @__PURE__ */ jsx(
35
+ AuthOptions,
36
+ {
37
+ oAuthMethods,
38
+ disableEmailLogin,
39
+ disablePhoneLogin
40
+ },
41
+ "authFull"
42
+ ),
43
+ layout
44
+ ]);
45
+ break;
46
+ }
47
+ case AuthLayout.AUTH_CONDENSED: {
48
+ const icons = [];
49
+ oAuthMethods == null ? void 0 : oAuthMethods.forEach((method) => icons.push(useBrandedLogos ? brandedOAuthLogos[method] : oAuthLogos[method]));
50
+ methods.push([
51
+ /* @__PURE__ */ jsxs(CondensedButton, { onClick: handleCondensedAuthClick, variant: "tertiary", fullWidth: true, children: [
52
+ /* @__PURE__ */ jsx(IconGroupSpacer, { slot: "start", icons: [], $isDark: useDarkLogos }),
53
+ "Sign Up or Login",
54
+ /* @__PURE__ */ jsx(StyledIconGroup, { slot: "end", icons: icons.splice(0, 3), $isDark: useDarkLogos })
55
+ ] }, "authCondensed"),
56
+ layout
57
+ ]);
58
+ break;
59
+ }
60
+ case AuthLayout.EXTERNAL_FULL: {
61
+ if (!!wallets.length) {
62
+ methods.push([/* @__PURE__ */ jsx(ExternalWallets, {}, "externalWallets"), layout]);
63
+ }
64
+ break;
65
+ }
66
+ case AuthLayout.EXTERNAL_CONDENSED: {
67
+ const icons = [];
68
+ wallets == null ? void 0 : wallets.forEach((wallet) => icons.push(wallet.iconUrl));
69
+ methods.push([
70
+ /* @__PURE__ */ jsxs(CondensedButton, { onClick: handleCondensedExternalClick, variant: "tertiary", fullWidth: true, children: [
71
+ /* @__PURE__ */ jsx(IconGroupSpacer, { slot: "start", icons: [], $isDark: useDarkLogos }),
72
+ "Connect Wallet",
73
+ /* @__PURE__ */ jsx(StyledIconGroup, { slot: "end", icons: icons.splice(0, 3), $isDark: useDarkLogos })
74
+ ] }, "authCondensed"),
75
+ layout
76
+ ]);
77
+ break;
78
+ }
79
+ default: {
80
+ break;
81
+ }
82
+ }
83
+ });
84
+ return /* @__PURE__ */ jsx(Fragment, { children: methods.map(([reactNode, key], index) => /* @__PURE__ */ jsxs(Fragment2, { children: [
85
+ reactNode,
86
+ methods.length > 1 && index < methods.length - 1 && /* @__PURE__ */ jsx(CpslDivider, { children: "or" }, "or")
87
+ ] }, key)) });
88
+ }, [oAuthMethods, disableEmailLogin, disablePhoneLogin, wallets, authLayout]);
89
+ return /* @__PURE__ */ jsx(Container, { "data-testid": "main-auth-step-content", children: Content });
90
+ };
91
+ const Container = styled.div`
92
+ display: flex;
93
+ flex-direction: column;
94
+ gap: 8px;
95
+ `;
96
+ const StyledIconGroup = styled(CpslIconGroup)`
97
+ --icon-item-color: ${({ $isDark }) => $isDark ? "white" : "black"};
98
+ flex: 1;
99
+ justify-content: flex-end;
100
+ `;
101
+ const IconGroupSpacer = styled(StyledIconGroup)`
102
+ visibility: hidden;
103
+ `;
104
+ const CondensedButton = styled(CpslButton)`
105
+ --button-justify-content: space-between;
106
+
107
+ &::part(button-native) {
108
+ max-height: 50px;
109
+ }
110
+ `;
111
+ export {
112
+ AuthMainStepContent
113
+ };
@@ -0,0 +1,33 @@
1
+ "use client";
2
+ import "../../../chunk-MMUBH76A.js";
3
+ import { Fragment, jsx } from "react/jsx-runtime";
4
+ import { useMemo } from "react";
5
+ import styled from "styled-components";
6
+ import { OAuth } from "../OAuth/OAuth.js";
7
+ import { AuthInput } from "../AuthInput/AuthInput.js";
8
+ import { useExternalWallets } from "../../providers/ExternalWalletContext.js";
9
+ import { useModalStore } from "../../stores/index.js";
10
+ import { ModalStep } from "../../utils/steps.js";
11
+ const AuthOptions = ({ oAuthMethods, disableEmailLogin, disablePhoneLogin }) => {
12
+ const { wallets } = useExternalWallets();
13
+ const showAllOAuth = useModalStore((state) => state.step === ModalStep.AUTH_MORE);
14
+ const Content = useMemo(() => {
15
+ const Methods = [];
16
+ if (!!(oAuthMethods == null ? void 0 : oAuthMethods.length)) {
17
+ Methods.push(/* @__PURE__ */ jsx(OAuth, { methods: oAuthMethods }, "oAuth"));
18
+ }
19
+ if (!disableEmailLogin || !disablePhoneLogin) {
20
+ Methods.push(/* @__PURE__ */ jsx(AuthInput, { disableEmailLogin, disablePhoneLogin }, "input"));
21
+ }
22
+ return /* @__PURE__ */ jsx(Fragment, { children: Methods });
23
+ }, [showAllOAuth, oAuthMethods, disableEmailLogin, disablePhoneLogin, wallets]);
24
+ return /* @__PURE__ */ jsx(Container, { children: Content });
25
+ };
26
+ const Container = styled.div`
27
+ display: flex;
28
+ flex-direction: column;
29
+ gap: 8px;
30
+ `;
31
+ export {
32
+ AuthOptions
33
+ };
@@ -0,0 +1,18 @@
1
+ "use client";
2
+ import "../../../chunk-MMUBH76A.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { useModalStore } from "../../stores/index.js";
5
+ import { Waiting } from "../Waiting/Waiting.js";
6
+ const AwaitingBiometricsStep = () => {
7
+ const isLogin = useModalStore((state) => state.isLogin());
8
+ return /* @__PURE__ */ jsx(
9
+ Waiting,
10
+ {
11
+ heading: isLogin ? "Waiting for Passkey" : "Creating Passkey",
12
+ subheading: "Follow the prompts presented by your browser."
13
+ }
14
+ );
15
+ };
16
+ export {
17
+ AwaitingBiometricsStep
18
+ };
@@ -0,0 +1,10 @@
1
+ "use client";
2
+ import "../../../chunk-MMUBH76A.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { Waiting } from "../Waiting/Waiting.js";
5
+ const AwaitingOAuthStep = () => {
6
+ return /* @__PURE__ */ jsx(Waiting, { heading: "Complete Login", subheading: "Follow the prompts presented by your browser." });
7
+ };
8
+ export {
9
+ AwaitingOAuthStep
10
+ };
@@ -0,0 +1,18 @@
1
+ "use client";
2
+ import "../../../chunk-MMUBH76A.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { useModalStore } from "../../stores/index.js";
5
+ import { Waiting } from "../Waiting/Waiting.js";
6
+ const AwaitingPasswordStep = () => {
7
+ const isLogin = useModalStore((state) => state.isLogin());
8
+ return /* @__PURE__ */ jsx(
9
+ Waiting,
10
+ {
11
+ heading: isLogin ? "Waiting for Password" : "Creating Password",
12
+ subheading: "Follow the prompts presented by your browser."
13
+ }
14
+ );
15
+ };
16
+ export {
17
+ AwaitingPasswordStep
18
+ };
@@ -0,0 +1,44 @@
1
+ "use client";
2
+ import "../../../chunk-MMUBH76A.js";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ import { CpslIcon, CpslInfoBox, CpslText } from "@getpara/react-components";
5
+ import { InfoBoxContent, InfoBoxHeader, StepContainer } from "../common.js";
6
+ import { useEffect, useRef, useState } from "react";
7
+ import { Waiting } from "../Waiting/Waiting.js";
8
+ import { useThemeStore } from "../../stores/index.js";
9
+ const AwaitingWalletCreationStep = () => {
10
+ const hideWallets = useThemeStore((state) => state.hideWallets);
11
+ const [showInfoBox, setShowInfoBox] = useState(false);
12
+ const showInfoBoxTimeout = useRef();
13
+ useEffect(() => {
14
+ if (typeof window !== "undefined") {
15
+ showInfoBoxTimeout.current = window.setTimeout(() => {
16
+ setShowInfoBox(true);
17
+ }, 4e3);
18
+ }
19
+ return () => clearTimeout(showInfoBoxTimeout.current);
20
+ }, []);
21
+ return /* @__PURE__ */ jsxs(StepContainer, { $wide: true, children: [
22
+ /* @__PURE__ */ jsx(
23
+ Waiting,
24
+ {
25
+ heading: hideWallets ? "Creating Your Account" : "Creating Your Wallet",
26
+ subheading: "This should only take a couple of seconds."
27
+ }
28
+ ),
29
+ showInfoBox && /* @__PURE__ */ jsx(CpslInfoBox, { children: /* @__PURE__ */ jsxs(InfoBoxContent, { children: [
30
+ /* @__PURE__ */ jsxs(InfoBoxHeader, { children: [
31
+ /* @__PURE__ */ jsx(CpslIcon, { icon: "clock" }),
32
+ /* @__PURE__ */ jsx(CpslText, { weight: "medium", children: "Hang on" })
33
+ ] }),
34
+ /* @__PURE__ */ jsxs(CpslText, { variant: "bodyS", weight: "medium", color: "secondary", children: [
35
+ "Creating your ",
36
+ hideWallets ? "account" : "wallet",
37
+ " is taking a little longer than expected, but we're working on it!"
38
+ ] })
39
+ ] }) })
40
+ ] });
41
+ };
42
+ export {
43
+ AwaitingWalletCreationStep
44
+ };
@@ -0,0 +1,52 @@
1
+ "use client";
2
+ import {
3
+ __spreadValues
4
+ } from "../../../chunk-MMUBH76A.js";
5
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
+ import { CpslButton, CpslDivider, CpslIcon, CpslQrCode, CpslSpinner, CpslText } from "@getpara/react-components";
7
+ import { useModalStore, useUserInfoStore } from "../../stores/index.js";
8
+ import { InnerStepContainer, StepContainer, Heading, QRContainer } from "../common.js";
9
+ import { useCopyToClipboard, UserIdentifier } from "@getpara/react-common";
10
+ import { useCreateAccount } from "../../hooks/useCreateAccount.js";
11
+ const BiometricCreationStep = () => {
12
+ const createAccount = useCreateAccount();
13
+ const webAuthURLForCreate = useModalStore((state) => state.webAuthURLForCreate);
14
+ const iFrameUrl = useModalStore((state) => state.iFrameUrl);
15
+ const isPasskeySupported = useModalStore((state) => state.isPasskeySupported);
16
+ const authInfo = useUserInfoStore((state) => state.getAuthInfo());
17
+ const [isCopied, copy] = useCopyToClipboard();
18
+ const handleCopy = () => {
19
+ copy(webAuthURLForCreate);
20
+ };
21
+ const isBoth = !!webAuthURLForCreate && !!iFrameUrl;
22
+ return /* @__PURE__ */ jsxs(StepContainer, { $wide: true, children: [
23
+ /* @__PURE__ */ jsxs(InnerStepContainer, { children: [
24
+ /* @__PURE__ */ jsx(Heading, { variant: "headingS", weight: "bold", children: isBoth ? "Secure Your Account" : "Create Passkey" }),
25
+ /* @__PURE__ */ jsx(UserIdentifier, __spreadValues({}, authInfo)),
26
+ /* @__PURE__ */ jsx(CpslText, { variant: "bodyS", color: "secondary", weight: "medium", children: isBoth ? "Choose a password or set up a passkey" : "Your Passkey keeps your account safe." })
27
+ ] }),
28
+ /* @__PURE__ */ jsxs(InnerStepContainer, { children: [
29
+ isPasskeySupported ? /* @__PURE__ */ jsxs(CpslButton, { fullWidth: true, onClick: createAccount.withPasskey, children: [
30
+ /* @__PURE__ */ jsx(CpslIcon, { slot: "start", icon: "key" }),
31
+ isBoth ? "Create Passkey" : "Create"
32
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
33
+ /* @__PURE__ */ jsx(CpslText, { weight: "semiBold", children: "Scan with your mobile device" }),
34
+ /* @__PURE__ */ jsx(QRContainer, { children: !webAuthURLForCreate ? /* @__PURE__ */ jsx(CpslSpinner, { size: 100 }) : /* @__PURE__ */ jsx(CpslQrCode, { url: webAuthURLForCreate }) }),
35
+ /* @__PURE__ */ jsxs(CpslButton, { size: "small", variant: "ghost", onClick: handleCopy, children: [
36
+ /* @__PURE__ */ jsx(CpslIcon, { slot: "start", icon: isCopied ? "check" : "copy" }),
37
+ isCopied ? "Copied" : "Copy Link"
38
+ ] })
39
+ ] }),
40
+ isBoth && /* @__PURE__ */ jsxs(Fragment, { children: [
41
+ /* @__PURE__ */ jsx(CpslDivider, { children: "or" }),
42
+ /* @__PURE__ */ jsxs(CpslButton, { fullWidth: true, onClick: createAccount.withPassword, children: [
43
+ /* @__PURE__ */ jsx(CpslIcon, { slot: "start", icon: "passcode" }),
44
+ "Choose Password"
45
+ ] })
46
+ ] })
47
+ ] })
48
+ ] });
49
+ };
50
+ export {
51
+ BiometricCreationStep
52
+ };
@@ -0,0 +1,93 @@
1
+ "use client";
2
+ import {
3
+ __spreadValues
4
+ } from "../../../chunk-MMUBH76A.js";
5
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
+ import { CpslButton, CpslDivider, CpslIcon } from "@getpara/react-components";
7
+ import { useMemo } from "react";
8
+ import { useModalStore, useUserInfoStore } from "../../stores/index.js";
9
+ import { ModalStep } from "../../utils/steps.js";
10
+ import { Heading, StepContainer, InnerStepContainer } from "../common.js";
11
+ import { openPopup } from "../../utils/openPopup.js";
12
+ import styled from "styled-components";
13
+ import { AuthMethod } from "@getpara/web-sdk";
14
+ import { formatBiometricHints, KnownDevices, UserIdentifier } from "@getpara/react-common";
15
+ const BiometricLoginStep = () => {
16
+ const refs = useModalStore((state) => state.refs);
17
+ const supportedAuthMethods = useModalStore((state) => state.supportedAuthMethods);
18
+ const passwordUrlForLogin = useModalStore((state) => state.passwordUrlForLogin);
19
+ const webAuthURLForLogin = useModalStore((state) => state.webAuthURLForLogin);
20
+ const setStep = useModalStore((state) => state.setStep);
21
+ const biometricLocationHints = useModalStore((state) => state.biometricLocationHints);
22
+ const authInfo = useUserInfoStore((state) => state.getAuthInfo());
23
+ const passkeysSupported = useModalStore((state) => state.isPasskeySupported);
24
+ const formattedHints = useMemo(() => formatBiometricHints(biometricLocationHints), [biometricLocationHints]);
25
+ const handlePasskeyClick = () => {
26
+ refs.popupWindow.current = openPopup({
27
+ url: webAuthURLForLogin,
28
+ target: "ParaPasskey",
29
+ type: "LOGIN_PASSKEY",
30
+ current: refs.popupWindow.current
31
+ });
32
+ setStep(ModalStep.AWAITING_BIOMETRIC_LOGIN);
33
+ };
34
+ const handlePasswordClick = () => {
35
+ refs.popupWindow.current = openPopup({
36
+ url: passwordUrlForLogin,
37
+ target: "ParaPassword",
38
+ type: "LOGIN_PASSWORD",
39
+ current: refs.popupWindow.current
40
+ });
41
+ setStep(ModalStep.AWAITING_PASSWORD_LOGIN);
42
+ };
43
+ function shouldShowWelcomeBack() {
44
+ return !(biometricLocationHints == null ? void 0 : biometricLocationHints.length) || passkeysSupported && formattedHints.isOnKnownDevice || (supportedAuthMethods == null ? void 0 : supportedAuthMethods.has) && supportedAuthMethods.has(AuthMethod.PASSWORD);
45
+ }
46
+ return /* @__PURE__ */ jsxs(StepContainer, { $wide: true, children: [
47
+ /* @__PURE__ */ jsxs(InnerStepContainer, { children: [
48
+ shouldShowWelcomeBack() && /* @__PURE__ */ jsx(Heading, { variant: "headingS", weight: "bold", children: "Welcome back," }),
49
+ /* @__PURE__ */ jsx(UserIdentifier, __spreadValues({}, authInfo))
50
+ ] }),
51
+ /* @__PURE__ */ jsxs(MainContainer, { children: [
52
+ (supportedAuthMethods == null ? void 0 : supportedAuthMethods.has) && supportedAuthMethods.has(AuthMethod.PASSWORD) && passwordUrlForLogin && /* @__PURE__ */ jsx(PasswordOnly, { handlePasswordClick }),
53
+ (supportedAuthMethods == null ? void 0 : supportedAuthMethods.has) && supportedAuthMethods.has(AuthMethod.PASSKEY) && webAuthURLForLogin && /* @__PURE__ */ jsx(
54
+ BiometricOnly,
55
+ {
56
+ handlePasskeyClick,
57
+ formattedHints,
58
+ shortLoginLink: webAuthURLForLogin,
59
+ passkeysSupported,
60
+ biometricLocationHints
61
+ }
62
+ )
63
+ ] })
64
+ ] });
65
+ };
66
+ const PasswordOnly = ({ handlePasswordClick }) => {
67
+ return /* @__PURE__ */ jsx(CpslButton, { fullWidth: true, onClick: handlePasswordClick, children: "Login" });
68
+ };
69
+ const BiometricOnly = ({
70
+ handlePasskeyClick,
71
+ formattedHints,
72
+ shortLoginLink,
73
+ passkeysSupported,
74
+ biometricLocationHints = []
75
+ }) => {
76
+ const [hasHints, isOnKnownDevice] = [biometricLocationHints.length > 0, formattedHints.isOnKnownDevice];
77
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
78
+ (hasHints && !isOnKnownDevice || !passkeysSupported) && /* @__PURE__ */ jsx(KnownDevices, { hints: formattedHints, link: shortLoginLink }),
79
+ passkeysSupported && /* @__PURE__ */ jsxs(Fragment, { children: [
80
+ hasHints && !isOnKnownDevice && /* @__PURE__ */ jsx(CpslDivider, { children: "or" }),
81
+ /* @__PURE__ */ jsx(CpslButton, { fullWidth: true, onClick: handlePasskeyClick, children: !hasHints || isOnKnownDevice ? /* @__PURE__ */ jsxs(Fragment, { children: [
82
+ /* @__PURE__ */ jsx(CpslIcon, { slot: "start", icon: "key" }),
83
+ "Login with passkey"
84
+ ] }) : "Continue anyway" })
85
+ ] })
86
+ ] });
87
+ };
88
+ const MainContainer = styled(InnerStepContainer)`
89
+ gap: 16px;
90
+ `;
91
+ export {
92
+ BiometricLoginStep
93
+ };