@getpara/react-sdk 0.1.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/index.d.ts +5 -0
- package/dist/index.js +4 -0
- package/dist/modal/ParaModal.d.ts +2 -0
- package/dist/modal/ParaModal.js +250 -0
- package/dist/modal/components/Account/Account.d.ts +5 -0
- package/dist/modal/components/Account/Account.js +59 -0
- package/dist/modal/components/AddFunds/AddFunds.d.ts +3 -0
- package/dist/modal/components/AddFunds/AddFunds.js +146 -0
- package/dist/modal/components/AddFunds/AddFundsAwaiting.d.ts +1 -0
- package/dist/modal/components/AddFunds/AddFundsAwaiting.js +64 -0
- package/dist/modal/components/AddFunds/AddFundsDone.d.ts +6 -0
- package/dist/modal/components/AddFunds/AddFundsDone.js +26 -0
- package/dist/modal/components/AddFunds/MoonPayEmbed.d.ts +2 -0
- package/dist/modal/components/AddFunds/MoonPayEmbed.js +2 -0
- package/dist/modal/components/AddFunds/index.d.ts +3 -0
- package/dist/modal/components/AddFunds/index.js +3 -0
- package/dist/modal/components/AuthInput/AuthInput.d.ts +6 -0
- package/dist/modal/components/AuthInput/AuthInput.js +214 -0
- package/dist/modal/components/AuthInput/countryCodes.d.ts +8 -0
- package/dist/modal/components/AuthInput/countryCodes.js +40 -0
- package/dist/modal/components/AuthInput/hooks/useDropdownPosition.d.ts +7 -0
- package/dist/modal/components/AuthInput/hooks/useDropdownPosition.js +23 -0
- package/dist/modal/components/AuthInput/phoneMasks.d.ts +247 -0
- package/dist/modal/components/AuthInput/phoneMasks.js +247 -0
- package/dist/modal/components/AuthMainStep/AuthMainStep.d.ts +8 -0
- package/dist/modal/components/AuthMainStep/AuthMainStep.js +21 -0
- package/dist/modal/components/AuthMainStep/AuthMainStepContent.d.ts +8 -0
- package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +89 -0
- package/dist/modal/components/AuthOptions/AuthOptions.d.ts +8 -0
- package/dist/modal/components/AuthOptions/AuthOptions.js +28 -0
- package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.d.ts +1 -0
- package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.js +7 -0
- package/dist/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.d.ts +1 -0
- package/dist/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.js +5 -0
- package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.d.ts +1 -0
- package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.js +7 -0
- package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.d.ts +1 -0
- package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +18 -0
- package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.d.ts +4 -0
- package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +17 -0
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.d.ts +1 -0
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +127 -0
- package/dist/modal/components/Body/AnimatedHeightWrapper.d.ts +6 -0
- package/dist/modal/components/Body/AnimatedHeightWrapper.js +26 -0
- package/dist/modal/components/Body/Body.d.ts +12 -0
- package/dist/modal/components/Body/Body.js +232 -0
- package/dist/modal/components/ChainSwitch/ChainSwitch.d.ts +1 -0
- package/dist/modal/components/ChainSwitch/ChainSwitch.js +77 -0
- package/dist/modal/components/ChainSwitch/config.d.ts +7 -0
- package/dist/modal/components/ChainSwitch/config.js +11 -0
- package/dist/modal/components/Controls/Controls.d.ts +5 -0
- package/dist/modal/components/Controls/Controls.js +54 -0
- package/dist/modal/components/Controls/Selects.d.ts +2 -0
- package/dist/modal/components/Controls/Selects.js +157 -0
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.d.ts +1 -0
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +116 -0
- package/dist/modal/components/ExternalWalletStep/config.d.ts +7 -0
- package/dist/modal/components/ExternalWalletStep/config.js +11 -0
- package/dist/modal/components/ExternalWallets/ExternalWallets.d.ts +1 -0
- package/dist/modal/components/ExternalWallets/ExternalWallets.js +142 -0
- package/dist/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.d.ts +7 -0
- package/dist/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.js +118 -0
- package/dist/modal/components/Footer/Footer.d.ts +1 -0
- package/dist/modal/components/Footer/Footer.js +71 -0
- package/dist/modal/components/Header/Header.d.ts +1 -0
- package/dist/modal/components/Header/Header.js +24 -0
- package/dist/modal/components/Header/hooks/useStepTitle.d.ts +3 -0
- package/dist/modal/components/Header/hooks/useStepTitle.js +42 -0
- package/dist/modal/components/Hero/Hero.d.ts +1 -0
- package/dist/modal/components/Hero/Hero.js +118 -0
- package/dist/modal/components/IFrameStep/IFrameStep.d.ts +1 -0
- package/dist/modal/components/IFrameStep/IFrameStep.js +41 -0
- package/dist/modal/components/LoginDoneStep/LoginDoneStep.d.ts +1 -0
- package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +18 -0
- package/dist/modal/components/ModalContent/ModalContent.d.ts +10 -0
- package/dist/modal/components/ModalContent/ModalContent.js +276 -0
- package/dist/modal/components/OAuth/FarcasterOAuthStep.d.ts +2 -0
- package/dist/modal/components/OAuth/FarcasterOAuthStep.js +81 -0
- package/dist/modal/components/OAuth/OAuth.d.ts +6 -0
- package/dist/modal/components/OAuth/OAuth.js +124 -0
- package/dist/modal/components/OAuth/TelegramOAuthStep.d.ts +1 -0
- package/dist/modal/components/OAuth/TelegramOAuthStep.js +132 -0
- package/dist/modal/components/OnRampComponents/AddingFunds.d.ts +1 -0
- package/dist/modal/components/OnRampComponents/AddingFunds.js +10 -0
- package/dist/modal/components/OnRampComponents/OnRampProviderButton.d.ts +9 -0
- package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +72 -0
- package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.d.ts +6 -0
- package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +67 -0
- package/dist/modal/components/Setup2FAStep/Setup2FAStep.d.ts +5 -0
- package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +104 -0
- package/dist/modal/components/StripeComponents/StripeComponents.d.ts +16 -0
- package/dist/modal/components/StripeComponents/StripeComponents.js +78 -0
- package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.d.ts +5 -0
- package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +8 -0
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.d.ts +1 -0
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +130 -0
- package/dist/modal/components/Waiting/Waiting.d.ts +6 -0
- package/dist/modal/components/Waiting/Waiting.js +6 -0
- package/dist/modal/components/WalletCard/PartnerIcon.d.ts +6 -0
- package/dist/modal/components/WalletCard/PartnerIcon.js +29 -0
- package/dist/modal/components/WalletCard/WalletCard.d.ts +18 -0
- package/dist/modal/components/WalletCard/WalletCard.js +91 -0
- package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.d.ts +6 -0
- package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.js +49 -0
- package/dist/modal/components/common.d.ts +19 -0
- package/dist/modal/components/common.js +67 -0
- package/dist/modal/components/index.d.ts +1 -0
- package/dist/modal/components/index.js +1 -0
- package/dist/modal/constants/constants.d.ts +32 -0
- package/dist/modal/constants/constants.js +93 -0
- package/dist/modal/constants/defaults.d.ts +5 -0
- package/dist/modal/constants/defaults.js +5 -0
- package/dist/modal/constants/oAuthLogos.d.ts +8 -0
- package/dist/modal/constants/oAuthLogos.js +18 -0
- package/dist/modal/css/modal.css +13 -0
- package/dist/modal/hooks/useActiveWallet.d.ts +1 -0
- package/dist/modal/hooks/useActiveWallet.js +9 -0
- package/dist/modal/hooks/useEmbeddedExternalConnection.d.ts +1 -0
- package/dist/modal/hooks/useEmbeddedExternalConnection.js +46 -0
- package/dist/modal/hooks/useGoBack.d.ts +1 -0
- package/dist/modal/hooks/useGoBack.js +34 -0
- package/dist/modal/index.d.ts +10 -0
- package/dist/modal/index.js +9 -0
- package/dist/modal/providers/CosmosExternalWalletContextStub.d.ts +29 -0
- package/dist/modal/providers/CosmosExternalWalletContextStub.js +18 -0
- package/dist/modal/providers/EvmExternalWalletContextStub.d.ts +33 -0
- package/dist/modal/providers/EvmExternalWalletContextStub.js +22 -0
- package/dist/modal/providers/ExternalWalletContext.d.ts +75 -0
- package/dist/modal/providers/ExternalWalletContext.js +252 -0
- package/dist/modal/providers/SolanaExternalWalletContextStub.d.ts +21 -0
- package/dist/modal/providers/SolanaExternalWalletContextStub.js +12 -0
- package/dist/modal/public/Inter-VariableFont_slnt,wght.ttf +0 -0
- package/dist/modal/stores/externalWalletProvider/actions.d.ts +3 -0
- package/dist/modal/stores/externalWalletProvider/actions.js +5 -0
- package/dist/modal/stores/externalWalletProvider/useExternalWalletProviderStore.d.ts +20 -0
- package/dist/modal/stores/externalWalletProvider/useExternalWalletProviderStore.js +13 -0
- package/dist/modal/stores/index.d.ts +4 -0
- package/dist/modal/stores/index.js +4 -0
- package/dist/modal/stores/modal/actions.d.ts +3 -0
- package/dist/modal/stores/modal/actions.js +65 -0
- package/dist/modal/stores/modal/useModalStore.d.ts +82 -0
- package/dist/modal/stores/modal/useModalStore.js +41 -0
- package/dist/modal/stores/para/actions.d.ts +3 -0
- package/dist/modal/stores/para/actions.js +5 -0
- package/dist/modal/stores/para/useParaStore.d.ts +10 -0
- package/dist/modal/stores/para/useParaStore.js +3 -0
- package/dist/modal/stores/theme/actions.d.ts +3 -0
- package/dist/modal/stores/theme/actions.js +24 -0
- package/dist/modal/stores/theme/useThemeStore.d.ts +20 -0
- package/dist/modal/stores/theme/useThemeStore.js +14 -0
- package/dist/modal/stores/userInfo/actions.d.ts +3 -0
- package/dist/modal/stores/userInfo/actions.js +28 -0
- package/dist/modal/stores/userInfo/useUserInfoStore.d.ts +19 -0
- package/dist/modal/stores/userInfo/useUserInfoStore.js +9 -0
- package/dist/modal/types/commonTypes.d.ts +48 -0
- package/dist/modal/types/commonTypes.js +1 -0
- package/dist/modal/types/externalWallets.d.ts +31 -0
- package/dist/modal/types/externalWallets.js +21 -0
- package/dist/modal/types/modalProps.d.ts +138 -0
- package/dist/modal/types/modalProps.js +7 -0
- package/dist/modal/utils/authLayoutHelpers.d.ts +3 -0
- package/dist/modal/utils/authLayoutHelpers.js +2 -0
- package/dist/modal/utils/getMailtoLink.d.ts +1 -0
- package/dist/modal/utils/getMailtoLink.js +5 -0
- package/dist/modal/utils/getTileButtonFlex.d.ts +1 -0
- package/dist/modal/utils/getTileButtonFlex.js +15 -0
- package/dist/modal/utils/isPasskeySupported.d.ts +1 -0
- package/dist/modal/utils/isPasskeySupported.js +10 -0
- package/dist/modal/utils/openPopup.d.ts +1 -0
- package/dist/modal/utils/openPopup.js +55 -0
- package/dist/modal/utils/routeMobileExternalWallet.d.ts +1 -0
- package/dist/modal/utils/routeMobileExternalWallet.js +35 -0
- package/dist/modal/utils/steps.d.ts +112 -0
- package/dist/modal/utils/steps.js +215 -0
- package/dist/modal/utils/stringFormatters.d.ts +4 -0
- package/dist/modal/utils/stringFormatters.js +12 -0
- package/dist/modal/utils/validateOnRampConfig.d.ts +5 -0
- package/dist/modal/utils/validateOnRampConfig.js +26 -0
- package/package.json +51 -0
- package/styles.css/package.json +3 -0
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
export const defaultPhoneMask = '#################';
|
|
2
|
+
export const phoneMasks = {
|
|
3
|
+
AF: '### ### ####',
|
|
4
|
+
AX: '## ### ####',
|
|
5
|
+
AL: '(###) ### ###',
|
|
6
|
+
DZ: '(###) ### ###',
|
|
7
|
+
AS: '(###) ###-####',
|
|
8
|
+
AD: '### ###',
|
|
9
|
+
AO: '(###) ### ###',
|
|
10
|
+
AI: '(###) ###-####',
|
|
11
|
+
AG: '(###) ###-####',
|
|
12
|
+
AR: '(###) ###-####',
|
|
13
|
+
AM: '## ### ###',
|
|
14
|
+
AW: '### ####',
|
|
15
|
+
AU: '# #### ####',
|
|
16
|
+
AT: '(###) ### ####',
|
|
17
|
+
AZ: '(###) ### ## ##',
|
|
18
|
+
BS: '(###) ###-####',
|
|
19
|
+
BH: '#### ####',
|
|
20
|
+
BD: '# ### ###',
|
|
21
|
+
BB: '(###) ###-####',
|
|
22
|
+
BY: '(##) ###-##-##',
|
|
23
|
+
BE: '(###) ### ###',
|
|
24
|
+
BZ: '###-####',
|
|
25
|
+
BJ: '##-##-####',
|
|
26
|
+
BM: '(###) ###-####',
|
|
27
|
+
BT: '# ### ###',
|
|
28
|
+
BO: '# ### ####',
|
|
29
|
+
BA: '## ###-###',
|
|
30
|
+
BW: '## ### ###',
|
|
31
|
+
BR: '(##) ####-####',
|
|
32
|
+
IO: '### ####',
|
|
33
|
+
BN: '### ####',
|
|
34
|
+
BG: '(###) ### ###',
|
|
35
|
+
BF: '## ## ####',
|
|
36
|
+
BI: '## ## ####',
|
|
37
|
+
KH: '## ### ###',
|
|
38
|
+
CM: '#### ####',
|
|
39
|
+
CA: '(###) ###-####',
|
|
40
|
+
CV: '(###) ## ##',
|
|
41
|
+
KY: '(###) ###-####',
|
|
42
|
+
CF: '## ## ####',
|
|
43
|
+
TD: '## ## ## ##',
|
|
44
|
+
CL: '# #### ####',
|
|
45
|
+
CN: '(###) #### ####',
|
|
46
|
+
CX: '# ## ## ##',
|
|
47
|
+
CC: '# ## ## ##',
|
|
48
|
+
CO: '(###) ### ####',
|
|
49
|
+
KM: '## ## ## ##',
|
|
50
|
+
CG: '## ### ####',
|
|
51
|
+
CK: '## ###',
|
|
52
|
+
CR: '#### ####',
|
|
53
|
+
HR: '## #### ###',
|
|
54
|
+
CU: '# ### ####',
|
|
55
|
+
CY: '## ### ###',
|
|
56
|
+
CZ: '### ### ###',
|
|
57
|
+
CD: '### ### ###',
|
|
58
|
+
DK: '## ## ## ##',
|
|
59
|
+
DJ: '## ## ## ##',
|
|
60
|
+
DM: '(###) ###-####',
|
|
61
|
+
DO: '(###) ###-####',
|
|
62
|
+
EC: '## ### ####',
|
|
63
|
+
EG: '# #### ####',
|
|
64
|
+
SV: '#### ####',
|
|
65
|
+
GQ: '## ### ####',
|
|
66
|
+
ER: '# ### ###',
|
|
67
|
+
EE: '#### ####',
|
|
68
|
+
SZ: '#### ####',
|
|
69
|
+
ET: '## ### ####',
|
|
70
|
+
FK: '#####',
|
|
71
|
+
FO: '######',
|
|
72
|
+
FJ: '### ####',
|
|
73
|
+
FI: '## ### ####',
|
|
74
|
+
FR: '## ## ## ## ##',
|
|
75
|
+
GF: '### ## ## ##',
|
|
76
|
+
PF: '## ## ##',
|
|
77
|
+
GA: '# ## ## ##',
|
|
78
|
+
GM: '### ####',
|
|
79
|
+
GE: '(###) ## ## ##',
|
|
80
|
+
DE: '(###) ### ####',
|
|
81
|
+
GH: '## ### ####',
|
|
82
|
+
GI: '### #####',
|
|
83
|
+
GR: '(###) ### ####',
|
|
84
|
+
GL: '## ## ##',
|
|
85
|
+
GD: '(###) ###-####',
|
|
86
|
+
GP: '### ## ## ##',
|
|
87
|
+
GU: '(###) ###-####',
|
|
88
|
+
GT: '# ### ####',
|
|
89
|
+
GG: '(####) ### ###',
|
|
90
|
+
GN: '## ### ###',
|
|
91
|
+
GW: '# #######',
|
|
92
|
+
GY: '### ####',
|
|
93
|
+
HT: '## ## ####',
|
|
94
|
+
VA: '### ####',
|
|
95
|
+
HN: '####-####',
|
|
96
|
+
HK: '#### ####',
|
|
97
|
+
HU: '(##) ### ####',
|
|
98
|
+
IS: '### ####',
|
|
99
|
+
IN: '####### ###',
|
|
100
|
+
ID: '(###) ###-####',
|
|
101
|
+
IR: '(###) ### ####',
|
|
102
|
+
IQ: '(###) ### ####',
|
|
103
|
+
IE: '(###) ### ###',
|
|
104
|
+
IM: '(####) ### ###',
|
|
105
|
+
IL: '#-###-####',
|
|
106
|
+
IT: '(###) #### ###',
|
|
107
|
+
CI: '## ## ## ##',
|
|
108
|
+
JM: '(###) ###-####',
|
|
109
|
+
JP: '(###) ###-####',
|
|
110
|
+
JE: '(####) ### ###',
|
|
111
|
+
JO: '# #### ####',
|
|
112
|
+
KZ: '(###) ###-##-##',
|
|
113
|
+
KE: '### ######',
|
|
114
|
+
KI: '## ###',
|
|
115
|
+
KP: '###-###-####',
|
|
116
|
+
KR: '(###) ####-####',
|
|
117
|
+
XK: '## ### ###',
|
|
118
|
+
KW: '#### ####',
|
|
119
|
+
KG: '(###) ###-###',
|
|
120
|
+
LA: '## ## ####',
|
|
121
|
+
LV: '## ### ###',
|
|
122
|
+
LB: '## ### ###',
|
|
123
|
+
LS: '# ### ####',
|
|
124
|
+
LR: '## ### ###',
|
|
125
|
+
LY: '##-#######',
|
|
126
|
+
LI: '(###) ###-####',
|
|
127
|
+
LT: '(###) ## ###',
|
|
128
|
+
LU: '### ### ###',
|
|
129
|
+
MO: '#### ####',
|
|
130
|
+
MG: '## ## ### ##',
|
|
131
|
+
MW: '# #### ####',
|
|
132
|
+
MY: '(###) ###-###',
|
|
133
|
+
MV: '###-####',
|
|
134
|
+
ML: '## ## ####',
|
|
135
|
+
MT: '#### ####',
|
|
136
|
+
MH: '###-####',
|
|
137
|
+
MQ: '### ## ## ##',
|
|
138
|
+
MR: '## ## ####',
|
|
139
|
+
MU: '### ####',
|
|
140
|
+
YT: '### ## ## ##',
|
|
141
|
+
MX: '(###) ###-####',
|
|
142
|
+
FM: '### ####',
|
|
143
|
+
MD: '#### ####',
|
|
144
|
+
MC: '(###) ###-###',
|
|
145
|
+
MN: '## ## ####',
|
|
146
|
+
ME: '## ### ###',
|
|
147
|
+
MS: '(###) ###-####',
|
|
148
|
+
MA: '#-####-####',
|
|
149
|
+
MZ: '## ### ####',
|
|
150
|
+
MM: '# ### ####',
|
|
151
|
+
NA: '## ### ####',
|
|
152
|
+
NR: '### ####',
|
|
153
|
+
NP: '#-######',
|
|
154
|
+
NL: '## ### ####',
|
|
155
|
+
NC: '##.##.##',
|
|
156
|
+
NZ: '## ### ###',
|
|
157
|
+
NI: '#### ####',
|
|
158
|
+
NE: '## ## ## ##',
|
|
159
|
+
NG: '## ### ####',
|
|
160
|
+
NU: '####',
|
|
161
|
+
NF: '### ###',
|
|
162
|
+
MK: '## ### ###',
|
|
163
|
+
MP: '(###) ###-####',
|
|
164
|
+
NO: '### ## ###',
|
|
165
|
+
OM: '#### ####',
|
|
166
|
+
PK: '(###) #######',
|
|
167
|
+
PW: '### ####',
|
|
168
|
+
PS: '## ### ####',
|
|
169
|
+
PA: '####-####',
|
|
170
|
+
PG: '(###) ## ###',
|
|
171
|
+
PY: '## ### ####',
|
|
172
|
+
PE: '(###) ### ###',
|
|
173
|
+
PH: '(###) ###-####',
|
|
174
|
+
PN: '### ####',
|
|
175
|
+
PL: '### ### ###',
|
|
176
|
+
PT: '## ### ####',
|
|
177
|
+
PR: '(###) ###-####',
|
|
178
|
+
QA: '#### ####',
|
|
179
|
+
RE: '##### ####',
|
|
180
|
+
RO: '## ### ####',
|
|
181
|
+
RU: '(###) ###-##-##',
|
|
182
|
+
RW: '(###) ### ###',
|
|
183
|
+
BL: '### ## ## ##',
|
|
184
|
+
SH: '####',
|
|
185
|
+
KN: '(###) ###-####',
|
|
186
|
+
LC: '(###) ###-####',
|
|
187
|
+
MF: '### ## ## ##',
|
|
188
|
+
PM: '## ## ##',
|
|
189
|
+
VC: '(###) ###-####',
|
|
190
|
+
WS: '####',
|
|
191
|
+
SM: '(####) ######',
|
|
192
|
+
ST: '## ####',
|
|
193
|
+
SA: '# ### ####',
|
|
194
|
+
SN: '## ### ####',
|
|
195
|
+
RS: '## ### ####',
|
|
196
|
+
SC: '# ### ###',
|
|
197
|
+
SL: '## ######',
|
|
198
|
+
SG: '#### ####',
|
|
199
|
+
SX: '(###) ###-####',
|
|
200
|
+
SK: '(###) ### ###',
|
|
201
|
+
SI: '## ### ###',
|
|
202
|
+
SB: '### ####',
|
|
203
|
+
SO: '# ### ###',
|
|
204
|
+
ZA: '## ### ####',
|
|
205
|
+
GS: '####',
|
|
206
|
+
SS: '# ### ####',
|
|
207
|
+
ES: '### ### ###',
|
|
208
|
+
LK: '## ### ####',
|
|
209
|
+
SD: '## ### ####',
|
|
210
|
+
SR: '###-####',
|
|
211
|
+
SJ: '### ## ###',
|
|
212
|
+
SE: '## ### ####',
|
|
213
|
+
CH: '## ### ####',
|
|
214
|
+
SY: '## #### ###',
|
|
215
|
+
TW: '#### ####',
|
|
216
|
+
TJ: '## ### ####',
|
|
217
|
+
TZ: '## ### ####',
|
|
218
|
+
TH: '# #### ####',
|
|
219
|
+
TL: '#### ####',
|
|
220
|
+
TG: '## ## ## ##',
|
|
221
|
+
TK: '####',
|
|
222
|
+
TO: '####',
|
|
223
|
+
TT: '(###) ###-####',
|
|
224
|
+
TN: '## ### ###',
|
|
225
|
+
TR: '(###) ### ####',
|
|
226
|
+
TM: '# ### ###',
|
|
227
|
+
TC: '(###) ###-####',
|
|
228
|
+
TV: '####',
|
|
229
|
+
UG: '## ### ####',
|
|
230
|
+
UA: '## ### ####',
|
|
231
|
+
AE: '# ### ####',
|
|
232
|
+
GB: '#### ### ###',
|
|
233
|
+
US: '(###) ###-####',
|
|
234
|
+
UM: '(###) ###-####',
|
|
235
|
+
UY: '# ### ## ##',
|
|
236
|
+
UZ: '## ### ####',
|
|
237
|
+
VU: '## ####',
|
|
238
|
+
VE: '###-###-####',
|
|
239
|
+
VN: '## #### ###',
|
|
240
|
+
VG: '(###) ###-####',
|
|
241
|
+
VI: '(###) ###-####',
|
|
242
|
+
WF: '## ####',
|
|
243
|
+
EH: '###-###-###',
|
|
244
|
+
YE: '# ### ###',
|
|
245
|
+
ZM: '## ### ####',
|
|
246
|
+
ZW: '# #######',
|
|
247
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { OAuthMethod } from '@getpara/web-sdk';
|
|
2
|
+
interface AuthMainStepProps {
|
|
3
|
+
oAuthMethods?: OAuthMethod[];
|
|
4
|
+
disableEmailLogin: boolean;
|
|
5
|
+
disablePhoneLogin: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const AuthMainStep: ({ oAuthMethods, disableEmailLogin, disablePhoneLogin }: AuthMainStepProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { useThemeStore } from '../../stores/theme/useThemeStore.js';
|
|
4
|
+
import { AuthMainStepContent } from './AuthMainStepContent.js';
|
|
5
|
+
import { CenteredText } from '../common.js';
|
|
6
|
+
export const AuthMainStep = ({ oAuthMethods, disableEmailLogin, disablePhoneLogin }) => {
|
|
7
|
+
const logo = useThemeStore(state => state.getLogo());
|
|
8
|
+
const appName = useThemeStore(state => state.appName);
|
|
9
|
+
const authLayout = useThemeStore(state => state.authLayout);
|
|
10
|
+
const embeddedModal = useThemeStore(state => state.embeddedModal);
|
|
11
|
+
const firstLayoutType = authLayout[0].split(':')[0];
|
|
12
|
+
const heading = firstLayoutType === 'AUTH' ? 'Sign Up or Login' : 'Connect Wallet';
|
|
13
|
+
return (_jsxs(_Fragment, { children: [logo && _jsx(Logo, { src: logo, alt: `${appName ? `${appName} -` : ''}logo` }), !embeddedModal && (_jsx(CenteredText, { variant: logo ? 'bodyM' : 'headingS', weight: "semiBold", children: heading })), _jsx(AuthMainStepContent, { disableEmailLogin: disableEmailLogin, disablePhoneLogin: disablePhoneLogin, oAuthMethods: oAuthMethods })] }));
|
|
14
|
+
};
|
|
15
|
+
const Logo = styled.img `
|
|
16
|
+
height: 100px;
|
|
17
|
+
max-width: 260px;
|
|
18
|
+
object-fit: contain;
|
|
19
|
+
box-sizing: content-box;
|
|
20
|
+
align-self: center;
|
|
21
|
+
`;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { OAuthMethod } from '@getpara/web-sdk';
|
|
2
|
+
interface AuthMainStepContentProps {
|
|
3
|
+
oAuthMethods?: OAuthMethod[];
|
|
4
|
+
disableEmailLogin: boolean;
|
|
5
|
+
disablePhoneLogin: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const AuthMainStepContent: ({ oAuthMethods, disableEmailLogin, disablePhoneLogin }: AuthMainStepContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment, useMemo } from 'react';
|
|
3
|
+
import { CpslButton, CpslDivider, CpslIconGroup } from '@getpara/react-components';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
import { useExternalWallets } from '../../providers/ExternalWalletContext.js';
|
|
6
|
+
import { ExternalWallets } from '../ExternalWallets/ExternalWallets.js';
|
|
7
|
+
import { useModalStore, useThemeStore } from '../../stores/index.js';
|
|
8
|
+
import { ModalStep } from '../../utils/steps.js';
|
|
9
|
+
import { AuthLayout } from '../../types/modalProps.js';
|
|
10
|
+
import { brandedOAuthLogos, oAuthLogos } from '../../constants/oAuthLogos.js';
|
|
11
|
+
import { AuthOptions } from '../AuthOptions/AuthOptions.js';
|
|
12
|
+
export const AuthMainStepContent = ({ oAuthMethods, disableEmailLogin, disablePhoneLogin }) => {
|
|
13
|
+
const { wallets } = useExternalWallets();
|
|
14
|
+
const authLayout = useThemeStore(state => state.authLayout);
|
|
15
|
+
const setStep = useModalStore(state => state.setStep);
|
|
16
|
+
const oAuthLogoVariant = useThemeStore(state => state.oAuthLogoVariant);
|
|
17
|
+
const isDark = useThemeStore(state => state.isDark);
|
|
18
|
+
const useBrandedLogos = oAuthLogoVariant === 'default';
|
|
19
|
+
const useDarkLogos = useBrandedLogos ? isDark : oAuthLogoVariant !== 'dark';
|
|
20
|
+
const handleCondensedAuthClick = () => {
|
|
21
|
+
setStep(ModalStep.AUTH_MORE);
|
|
22
|
+
};
|
|
23
|
+
const handleCondensedExternalClick = () => {
|
|
24
|
+
setStep(ModalStep.EX_WALLET_MORE);
|
|
25
|
+
};
|
|
26
|
+
const Content = useMemo(() => {
|
|
27
|
+
const methods = [];
|
|
28
|
+
authLayout.forEach(layout => {
|
|
29
|
+
switch (layout) {
|
|
30
|
+
case AuthLayout.AUTH_FULL: {
|
|
31
|
+
methods.push([
|
|
32
|
+
_jsx(AuthOptions, { oAuthMethods: oAuthMethods, disableEmailLogin: disableEmailLogin, disablePhoneLogin: disablePhoneLogin }, "authFull"),
|
|
33
|
+
layout,
|
|
34
|
+
]);
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
case AuthLayout.AUTH_CONDENSED: {
|
|
38
|
+
const icons = [];
|
|
39
|
+
oAuthMethods === null || oAuthMethods === void 0 ? void 0 : oAuthMethods.forEach(method => icons.push(useBrandedLogos ? brandedOAuthLogos[method] : oAuthLogos[method]));
|
|
40
|
+
methods.push([
|
|
41
|
+
_jsxs(CondensedButton, { onClick: handleCondensedAuthClick, variant: "tertiary", fullWidth: true, children: [_jsx(IconGroupSpacer, { slot: "start", icons: [], "$isDark": useDarkLogos }), "Sign Up or Login", _jsx(StyledIconGroup, { slot: "end", icons: icons.splice(0, 3), "$isDark": useDarkLogos })] }, "authCondensed"),
|
|
42
|
+
layout,
|
|
43
|
+
]);
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
case AuthLayout.EXTERNAL_FULL: {
|
|
47
|
+
if (!!wallets.length) {
|
|
48
|
+
methods.push([_jsx(ExternalWallets, {}, "externalWallets"), layout]);
|
|
49
|
+
}
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
case AuthLayout.EXTERNAL_CONDENSED: {
|
|
53
|
+
const icons = [];
|
|
54
|
+
wallets === null || wallets === void 0 ? void 0 : wallets.forEach(wallet => icons.push(wallet.iconUrl));
|
|
55
|
+
methods.push([
|
|
56
|
+
_jsxs(CondensedButton, { onClick: handleCondensedExternalClick, variant: "tertiary", fullWidth: true, children: [_jsx(IconGroupSpacer, { slot: "start", icons: [], "$isDark": useDarkLogos }), "Connect Wallet", _jsx(StyledIconGroup, { slot: "end", icons: icons.splice(0, 3), "$isDark": useDarkLogos })] }, "authCondensed"),
|
|
57
|
+
layout,
|
|
58
|
+
]);
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
default: {
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
return (_jsx(_Fragment, { children: methods.map(([reactNode, key], index) => (_jsxs(Fragment, { children: [reactNode, methods.length > 1 && index < methods.length - 1 && _jsx(CpslDivider, { children: "or" }, "or")] }, key))) }));
|
|
67
|
+
}, [oAuthMethods, disableEmailLogin, disablePhoneLogin, wallets, authLayout]);
|
|
68
|
+
return _jsx(Container, { "data-testid": "main-auth-step-content", children: Content });
|
|
69
|
+
};
|
|
70
|
+
const Container = styled.div `
|
|
71
|
+
display: flex;
|
|
72
|
+
flex-direction: column;
|
|
73
|
+
gap: 8px;
|
|
74
|
+
`;
|
|
75
|
+
const StyledIconGroup = styled(CpslIconGroup) `
|
|
76
|
+
--icon-item-color: ${({ $isDark }) => ($isDark ? 'white' : 'black')};
|
|
77
|
+
flex: 1;
|
|
78
|
+
justify-content: flex-end;
|
|
79
|
+
`;
|
|
80
|
+
const IconGroupSpacer = styled(StyledIconGroup) `
|
|
81
|
+
visibility: hidden;
|
|
82
|
+
`;
|
|
83
|
+
const CondensedButton = styled(CpslButton) `
|
|
84
|
+
--button-justify-content: space-between;
|
|
85
|
+
|
|
86
|
+
&::part(button-native) {
|
|
87
|
+
max-height: 50px;
|
|
88
|
+
}
|
|
89
|
+
`;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { OAuthMethod } from '@getpara/web-sdk';
|
|
2
|
+
interface AuthOptionsProps {
|
|
3
|
+
oAuthMethods?: OAuthMethod[];
|
|
4
|
+
disableEmailLogin: boolean;
|
|
5
|
+
disablePhoneLogin: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const AuthOptions: ({ oAuthMethods, disableEmailLogin, disablePhoneLogin }: AuthOptionsProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { OAuth } from '../OAuth/OAuth.js';
|
|
5
|
+
import { AuthInput } from '../AuthInput/AuthInput.js';
|
|
6
|
+
import { useExternalWallets } from '../../providers/ExternalWalletContext.js';
|
|
7
|
+
import { useModalStore } from '../../stores/index.js';
|
|
8
|
+
import { ModalStep } from '../../utils/steps.js';
|
|
9
|
+
export const AuthOptions = ({ oAuthMethods, disableEmailLogin, disablePhoneLogin }) => {
|
|
10
|
+
const { wallets } = useExternalWallets();
|
|
11
|
+
const showAllOAuth = useModalStore(state => state.step === ModalStep.AUTH_MORE);
|
|
12
|
+
const Content = useMemo(() => {
|
|
13
|
+
const Methods = [];
|
|
14
|
+
if (!!(oAuthMethods === null || oAuthMethods === void 0 ? void 0 : oAuthMethods.length)) {
|
|
15
|
+
Methods.push(_jsx(OAuth, { methods: oAuthMethods }, "oAuth"));
|
|
16
|
+
}
|
|
17
|
+
if (!disableEmailLogin || !disablePhoneLogin) {
|
|
18
|
+
Methods.push(_jsx(AuthInput, { disableEmailLogin: disableEmailLogin, disablePhoneLogin: disablePhoneLogin }, "input"));
|
|
19
|
+
}
|
|
20
|
+
return _jsx(_Fragment, { children: Methods });
|
|
21
|
+
}, [showAllOAuth, oAuthMethods, disableEmailLogin, disablePhoneLogin, wallets]);
|
|
22
|
+
return _jsx(Container, { children: Content });
|
|
23
|
+
};
|
|
24
|
+
const Container = styled.div `
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
gap: 8px;
|
|
28
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const AwaitingBiometricsStep: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useModalStore } from '../../stores/index.js';
|
|
3
|
+
import { Waiting } from '../Waiting/Waiting.js';
|
|
4
|
+
export const AwaitingBiometricsStep = () => {
|
|
5
|
+
const isLogin = useModalStore(state => state.isLogin());
|
|
6
|
+
return (_jsx(Waiting, { heading: isLogin ? 'Waiting for Passkey' : 'Creating Passkey', subheading: "Follow the prompts presented by your browser." }));
|
|
7
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const AwaitingOAuthStep: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const AwaitingPasswordStep: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useModalStore } from '../../stores/index.js';
|
|
3
|
+
import { Waiting } from '../Waiting/Waiting.js';
|
|
4
|
+
export const AwaitingPasswordStep = () => {
|
|
5
|
+
const isLogin = useModalStore(state => state.isLogin());
|
|
6
|
+
return (_jsx(Waiting, { heading: isLogin ? 'Waiting for Password' : 'Creating Password', subheading: "Follow the prompts presented by your browser." }));
|
|
7
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const AwaitingWalletCreationStep: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { CpslIcon, CpslInfoBox, CpslText } from '@getpara/react-components';
|
|
3
|
+
import { InfoBoxContent, InfoBoxHeader, StepContainer } from '../common.js';
|
|
4
|
+
import { useEffect, useRef, useState } from 'react';
|
|
5
|
+
import { Waiting } from '../Waiting/Waiting.js';
|
|
6
|
+
import { useThemeStore } from '../../stores/index.js';
|
|
7
|
+
export const AwaitingWalletCreationStep = () => {
|
|
8
|
+
const hideWallets = useThemeStore(state => state.hideWallets);
|
|
9
|
+
const [showInfoBox, setShowInfoBox] = useState(false);
|
|
10
|
+
const showInfoBoxTimeout = useRef();
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
showInfoBoxTimeout.current = window.setTimeout(() => {
|
|
13
|
+
setShowInfoBox(true);
|
|
14
|
+
}, 4000);
|
|
15
|
+
return () => clearTimeout(showInfoBoxTimeout.current);
|
|
16
|
+
}, []);
|
|
17
|
+
return (_jsxs(StepContainer, { "$wide": true, children: [_jsx(Waiting, { heading: hideWallets ? 'Creating Your Account' : 'Creating Your Wallet', subheading: "This should only take a couple of seconds." }), showInfoBox && (_jsx(CpslInfoBox, { children: _jsxs(InfoBoxContent, { children: [_jsxs(InfoBoxHeader, { children: [_jsx(CpslIcon, { icon: "clock" }), _jsx(CpslText, { weight: "medium", children: "Hang on" })] }), _jsxs(CpslText, { variant: "bodyS", weight: "medium", color: "secondary", children: ["Creating your ", hideWallets ? 'account' : 'wallet', " is taking a little longer than expected, but we're working on it!"] })] }) }))] }));
|
|
18
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { CpslButton, CpslDivider, CpslIcon, CpslQrCode, CpslSpinner, CpslText } from '@getpara/react-components';
|
|
3
|
+
import { useModalStore, useUserInfoStore } from '../../stores/index.js';
|
|
4
|
+
import { InnerStepContainer, StepContainer, Heading, QRContainer } from '../common.js';
|
|
5
|
+
import { isPasskeySupported } from '../../utils/isPasskeySupported.js';
|
|
6
|
+
import { useCopyToClipboard, UserIdentifier } from '@getpara/react-common';
|
|
7
|
+
export const BiometricCreationStep = ({ handlePasswordClick, handlePasskeyClick, }) => {
|
|
8
|
+
const webAuthURLForCreate = useModalStore(state => state.webAuthURLForCreate);
|
|
9
|
+
const iFrameUrl = useModalStore(state => state.iFrameUrl);
|
|
10
|
+
const authInfo = useUserInfoStore(state => state.getAuthInfo());
|
|
11
|
+
const [isCopied, copy] = useCopyToClipboard();
|
|
12
|
+
const handleCopy = () => {
|
|
13
|
+
copy(webAuthURLForCreate);
|
|
14
|
+
};
|
|
15
|
+
const isBoth = !!webAuthURLForCreate && !!iFrameUrl;
|
|
16
|
+
return (_jsxs(StepContainer, { "$wide": true, children: [_jsxs(InnerStepContainer, { children: [_jsx(Heading, { variant: "headingS", weight: "bold", children: isBoth ? 'Secure Your Account' : 'Create Passkey' }), _jsx(UserIdentifier, Object.assign({}, authInfo)), _jsx(CpslText, { variant: "bodyS", color: "secondary", weight: "medium", children: isBoth ? 'Choose a password or set up a passkey' : 'Your Passkey keeps your account safe.' })] }), _jsxs(InnerStepContainer, { children: [isPasskeySupported() ? (_jsxs(CpslButton, { fullWidth: true, onClick: handlePasskeyClick, children: [_jsx(CpslIcon, { slot: "start", icon: "key" }), isBoth ? 'Create Passkey' : 'Create'] })) : (_jsxs(_Fragment, { children: [_jsx(CpslText, { weight: "semiBold", children: "Scan with your mobile device" }), _jsx(QRContainer, { children: !webAuthURLForCreate ? _jsx(CpslSpinner, { size: 100 }) : _jsx(CpslQrCode, { url: webAuthURLForCreate }) }), _jsxs(CpslButton, { size: "small", variant: "ghost", onClick: handleCopy, children: [_jsx(CpslIcon, { slot: "start", icon: isCopied ? 'check' : 'copy' }), isCopied ? 'Copied' : 'Copy Link'] })] })), isBoth && (_jsxs(_Fragment, { children: [_jsx(CpslDivider, { children: "or" }), _jsxs(CpslButton, { fullWidth: true, onClick: handlePasswordClick, children: [_jsx(CpslIcon, { slot: "start", icon: "passcode" }), "Choose Password"] })] }))] })] }));
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const BiometricLoginStep: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
|
+
import { CpslButton, CpslDivider, CpslIcon } from '@getpara/react-components';
|
|
12
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
13
|
+
import { useParaStore, useModalStore, useUserInfoStore } from '../../stores/index.js';
|
|
14
|
+
import { ModalStep } from '../../utils/steps.js';
|
|
15
|
+
import { Heading, StepContainer, InnerStepContainer } from '../common.js';
|
|
16
|
+
import { openPopup } from '../../utils/openPopup.js';
|
|
17
|
+
import styled from 'styled-components';
|
|
18
|
+
import { AuthMethod, getPublicKeyHex } from '@getpara/web-sdk';
|
|
19
|
+
import { isPasskeySupported } from '../../utils/isPasskeySupported.js';
|
|
20
|
+
import { formatBiometricHints, KnownDevices, UserIdentifier } from '@getpara/react-common';
|
|
21
|
+
export const BiometricLoginStep = () => {
|
|
22
|
+
const popupWindow = useModalStore(state => state.popupWindow);
|
|
23
|
+
const supportedAuthMethods = useModalStore(state => state.supportedAuthMethods);
|
|
24
|
+
const passwordUrlForLogin = useModalStore(state => state.passwordUrlForLogin);
|
|
25
|
+
const webAuthURLForLogin = useModalStore(state => state.webAuthURLForLogin);
|
|
26
|
+
const setStep = useModalStore(state => state.setStep);
|
|
27
|
+
const setPopupWindow = useModalStore(state => state.setPopupWindow);
|
|
28
|
+
const biometricLocationHints = useModalStore(state => state.biometricLocationHints);
|
|
29
|
+
const para = useParaStore(state => state.para);
|
|
30
|
+
const authInfo = useUserInfoStore(state => state.getAuthInfo());
|
|
31
|
+
const setWebAuthURLForLogin = useModalStore(state => state.setWebAuthURLForLogin);
|
|
32
|
+
const setPasswordUrlForLogin = useModalStore(state => state.setPasswordUrlForLogin);
|
|
33
|
+
const passkeysSupported = isPasskeySupported();
|
|
34
|
+
const formattedHints = useMemo(() => formatBiometricHints(biometricLocationHints), [biometricLocationHints]);
|
|
35
|
+
const setSupportedAuthMethods = useModalStore(state => state.setSupportedAuthMethods);
|
|
36
|
+
const [webAuthURLForKnownDeviceLogin, setWebAuthURLForKnownDeviceLogin] = useState();
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
function setLinks() {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
if (!(supportedAuthMethods === null || supportedAuthMethods === void 0 ? void 0 : supportedAuthMethods.size) && para.getUserId()) {
|
|
41
|
+
const fetchedSupportedAuthMethods = yield para.supportedAuthMethods({ userId: para.getUserId() });
|
|
42
|
+
if (fetchedSupportedAuthMethods === null || fetchedSupportedAuthMethods === void 0 ? void 0 : fetchedSupportedAuthMethods.size) {
|
|
43
|
+
setSupportedAuthMethods(fetchedSupportedAuthMethods);
|
|
44
|
+
}
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (!para.isEmail && !para.isPhone && !para.isFarcaster && !para.isTelegram) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const authType = para.isEmail ? 'email' : para.isPhone ? 'phone' : para.isFarcaster ? 'farcaster' : 'telegram';
|
|
51
|
+
const res = yield para.touchSession();
|
|
52
|
+
const webAuthUrlForLogin = (supportedAuthMethods === null || supportedAuthMethods === void 0 ? void 0 : supportedAuthMethods.has) && supportedAuthMethods.has(AuthMethod.PASSKEY)
|
|
53
|
+
? yield para.getWebAuthURLForLogin({
|
|
54
|
+
sessionId: res.data.sessionId,
|
|
55
|
+
loginEncryptionPublicKey: getPublicKeyHex(para.loginEncryptionKeyPair),
|
|
56
|
+
partnerId: res.data.partnerId,
|
|
57
|
+
authType,
|
|
58
|
+
displayName: authInfo.displayName,
|
|
59
|
+
pfpUrl: authInfo.pfpUrl,
|
|
60
|
+
})
|
|
61
|
+
: undefined;
|
|
62
|
+
const _webAuthURLForKnownDeviceLogin = (supportedAuthMethods === null || supportedAuthMethods === void 0 ? void 0 : supportedAuthMethods.has) && supportedAuthMethods.has(AuthMethod.PASSKEY)
|
|
63
|
+
? yield para.getWebAuthURLForLogin({
|
|
64
|
+
sessionId: res.data.sessionId,
|
|
65
|
+
loginEncryptionPublicKey: getPublicKeyHex(para.loginEncryptionKeyPair),
|
|
66
|
+
partnerId: res.data.partnerId,
|
|
67
|
+
newDeviceSessionId: res.data.sessionLookupId,
|
|
68
|
+
newDeviceEncryptionKey: getPublicKeyHex(para.loginEncryptionKeyPair),
|
|
69
|
+
authType,
|
|
70
|
+
displayName: authInfo.displayName,
|
|
71
|
+
pfpUrl: authInfo.pfpUrl,
|
|
72
|
+
})
|
|
73
|
+
: undefined;
|
|
74
|
+
const passwordAuthUrlForLogin = (supportedAuthMethods === null || supportedAuthMethods === void 0 ? void 0 : supportedAuthMethods.has) && supportedAuthMethods.has(AuthMethod.PASSWORD)
|
|
75
|
+
? yield para.getPasswordURLForLogin({
|
|
76
|
+
sessionId: res.data.sessionId,
|
|
77
|
+
loginEncryptionPublicKey: getPublicKeyHex(para.loginEncryptionKeyPair),
|
|
78
|
+
partnerId: res.data.partnerId,
|
|
79
|
+
authType,
|
|
80
|
+
displayName: authInfo.displayName,
|
|
81
|
+
pfpUrl: authInfo.pfpUrl,
|
|
82
|
+
})
|
|
83
|
+
: undefined;
|
|
84
|
+
const shortWebAuthLoginLink = webAuthUrlForLogin ? yield para.shortenLoginLink(webAuthUrlForLogin) : undefined;
|
|
85
|
+
const shortWebAuthForKnownDeviceLoginLink = _webAuthURLForKnownDeviceLogin
|
|
86
|
+
? yield para.shortenLoginLink(_webAuthURLForKnownDeviceLogin)
|
|
87
|
+
: undefined;
|
|
88
|
+
setWebAuthURLForKnownDeviceLogin(shortWebAuthForKnownDeviceLoginLink);
|
|
89
|
+
setWebAuthURLForLogin(shortWebAuthLoginLink);
|
|
90
|
+
setPasswordUrlForLogin(passwordAuthUrlForLogin);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
setLinks();
|
|
94
|
+
}, [supportedAuthMethods]);
|
|
95
|
+
const handlePasskeyClick = () => {
|
|
96
|
+
if (!!popupWindow) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const loginWindow = openPopup(webAuthURLForLogin, 'ParaPasskey', 'LOGIN_PASSKEY');
|
|
100
|
+
setPopupWindow(loginWindow);
|
|
101
|
+
setStep(ModalStep.AWAITING_BIOMETRIC_LOGIN);
|
|
102
|
+
};
|
|
103
|
+
const handlePasswordClick = () => {
|
|
104
|
+
const loginWindow = openPopup(passwordUrlForLogin, 'ParaPassword', 'LOGIN_PASSWORD');
|
|
105
|
+
setPopupWindow(loginWindow);
|
|
106
|
+
setStep(ModalStep.AWAITING_PASSWORD_LOGIN);
|
|
107
|
+
};
|
|
108
|
+
function shouldShowWelcomeBack() {
|
|
109
|
+
return (!(biometricLocationHints === null || biometricLocationHints === void 0 ? void 0 : biometricLocationHints.length) ||
|
|
110
|
+
(passkeysSupported && formattedHints.isOnKnownDevice) ||
|
|
111
|
+
((supportedAuthMethods === null || supportedAuthMethods === void 0 ? void 0 : supportedAuthMethods.has) && supportedAuthMethods.has(AuthMethod.PASSWORD)));
|
|
112
|
+
}
|
|
113
|
+
return (_jsxs(StepContainer, { "$wide": true, children: [_jsxs(InnerStepContainer, { children: [shouldShowWelcomeBack() && (_jsx(Heading, { variant: "headingS", weight: "bold", children: "Welcome back," })), _jsx(UserIdentifier, Object.assign({}, authInfo))] }), _jsxs(MainContainer, { children: [(supportedAuthMethods === null || supportedAuthMethods === void 0 ? void 0 : supportedAuthMethods.has) && supportedAuthMethods.has(AuthMethod.PASSWORD) && passwordUrlForLogin && (_jsx(PasswordOnly, { handlePasswordClick: handlePasswordClick })), (supportedAuthMethods === null || supportedAuthMethods === void 0 ? void 0 : supportedAuthMethods.has) &&
|
|
114
|
+
supportedAuthMethods.has(AuthMethod.PASSKEY) &&
|
|
115
|
+
webAuthURLForLogin &&
|
|
116
|
+
webAuthURLForKnownDeviceLogin && (_jsx(BiometricOnly, { handlePasskeyClick: handlePasskeyClick, formattedHints: formattedHints, shortLoginLink: webAuthURLForKnownDeviceLogin, passkeysSupported: passkeysSupported, biometricLocationHints: biometricLocationHints }))] })] }));
|
|
117
|
+
};
|
|
118
|
+
const PasswordOnly = ({ handlePasswordClick }) => {
|
|
119
|
+
return (_jsx(CpslButton, { fullWidth: true, onClick: handlePasswordClick, children: "Login" }));
|
|
120
|
+
};
|
|
121
|
+
const BiometricOnly = ({ handlePasskeyClick, formattedHints, shortLoginLink, passkeysSupported, biometricLocationHints = [], }) => {
|
|
122
|
+
const [hasHints, isOnKnownDevice] = [biometricLocationHints.length > 0, formattedHints.isOnKnownDevice];
|
|
123
|
+
return (_jsxs(_Fragment, { children: [((hasHints && !isOnKnownDevice) || !passkeysSupported) && (_jsx(KnownDevices, { hints: formattedHints, link: shortLoginLink })), passkeysSupported && (_jsxs(_Fragment, { children: [hasHints && !isOnKnownDevice && _jsx(CpslDivider, { children: "or" }), _jsx(CpslButton, { fullWidth: true, onClick: handlePasskeyClick, children: !hasHints || isOnKnownDevice ? (_jsxs(_Fragment, { children: [_jsx(CpslIcon, { slot: "start", icon: "key" }), "Login with passkey"] })) : ('Continue anyway') })] }))] }));
|
|
124
|
+
};
|
|
125
|
+
const MainContainer = styled(InnerStepContainer) `
|
|
126
|
+
gap: 16px;
|
|
127
|
+
`;
|