@alore/auth-react-ui 1.2.0-alpha.14 → 1.2.0-alpha.16

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 (51) hide show
  1. package/dist/cjs/auth/ForgotPassword.d.ts +15 -0
  2. package/dist/cjs/auth/ForgotPassword.js +263 -0
  3. package/dist/cjs/auth/ForgotPassword.js.map +1 -0
  4. package/dist/cjs/auth/Login.d.ts +19 -1
  5. package/dist/cjs/auth/Login.js +81 -11
  6. package/dist/cjs/auth/Login.js.map +1 -1
  7. package/dist/cjs/components/Auth.d.ts +19 -1
  8. package/dist/cjs/components/Auth.js +44 -5
  9. package/dist/cjs/components/Auth.js.map +1 -1
  10. package/dist/cjs/components/AuthProvider.d.ts +16 -2
  11. package/dist/cjs/components/FormRules/helpers/index.js +1 -1
  12. package/dist/cjs/components/FormRules/helpers/index.js.map +1 -1
  13. package/dist/cjs/components/InputForm.d.ts +2 -1
  14. package/dist/cjs/components/InputForm.js +2 -2
  15. package/dist/cjs/components/InputForm.js.map +1 -1
  16. package/dist/cjs/dictionaries/en.json +19 -0
  17. package/dist/cjs/dictionaries/pt.json +19 -0
  18. package/dist/cjs/get-dictionary.d.ts +57 -0
  19. package/dist/cjs/hooks/useAuthService.d.ts +48 -6
  20. package/dist/cjs/hooks/useAuthServiceInstance.d.ts +16 -2
  21. package/dist/cjs/hooks/useDictionary.d.ts +19 -0
  22. package/dist/cjs/machine/index.d.ts +32 -4
  23. package/dist/cjs/machine/index.js +76 -5
  24. package/dist/cjs/machine/index.js.map +1 -1
  25. package/dist/cjs/machine/types.d.ts +12 -1
  26. package/dist/mjs/auth/ForgotPassword.d.ts +15 -0
  27. package/dist/mjs/auth/ForgotPassword.js +224 -0
  28. package/dist/mjs/auth/ForgotPassword.js.map +1 -0
  29. package/dist/mjs/auth/Login.d.ts +19 -1
  30. package/dist/mjs/auth/Login.js +81 -11
  31. package/dist/mjs/auth/Login.js.map +1 -1
  32. package/dist/mjs/components/Auth.d.ts +19 -1
  33. package/dist/mjs/components/Auth.js +44 -5
  34. package/dist/mjs/components/Auth.js.map +1 -1
  35. package/dist/mjs/components/AuthProvider.d.ts +16 -2
  36. package/dist/mjs/components/FormRules/helpers/index.js +1 -1
  37. package/dist/mjs/components/FormRules/helpers/index.js.map +1 -1
  38. package/dist/mjs/components/InputForm.d.ts +2 -1
  39. package/dist/mjs/components/InputForm.js +2 -2
  40. package/dist/mjs/components/InputForm.js.map +1 -1
  41. package/dist/mjs/dictionaries/en.json +19 -0
  42. package/dist/mjs/dictionaries/pt.json +19 -0
  43. package/dist/mjs/get-dictionary.d.ts +57 -0
  44. package/dist/mjs/hooks/useAuthService.d.ts +48 -6
  45. package/dist/mjs/hooks/useAuthServiceInstance.d.ts +16 -2
  46. package/dist/mjs/hooks/useDictionary.d.ts +19 -0
  47. package/dist/mjs/machine/index.d.ts +32 -4
  48. package/dist/mjs/machine/index.js +71 -5
  49. package/dist/mjs/machine/index.js.map +1 -1
  50. package/dist/mjs/machine/types.d.ts +12 -1
  51. package/package.json +2 -2
@@ -52,6 +52,10 @@ export interface AuthMachineContext {
52
52
  mediation?: CredentialMediationRequirement;
53
53
  };
54
54
  credentialEmail?: string;
55
+ forgotPasswordSession?: {
56
+ salt: string;
57
+ token: string;
58
+ };
55
59
  }
56
60
  export type AuthMachineEvents = {
57
61
  type: 'INITIALIZE';
@@ -256,15 +260,22 @@ export type AuthMachineEvents = {
256
260
  type: 'SEND_CODE';
257
261
  payload: {
258
262
  email: string;
263
+ locale?: string;
259
264
  };
260
265
  } | {
261
266
  type: 'CONFIRM_PASSWORD';
262
267
  payload: {
263
- email: string;
268
+ salt: string;
269
+ token: string;
264
270
  passwordHash: string;
271
+ device?: string;
265
272
  };
266
273
  } | {
267
274
  type: 'RESET_PASSWORD';
275
+ payload: {
276
+ salt: string;
277
+ token: string;
278
+ };
268
279
  } | {
269
280
  type: 'LOGIN';
270
281
  } | {
@@ -0,0 +1,15 @@
1
+ import { Locale } from 'get-dictionary';
2
+ import React from 'react';
3
+ import { AuthInstance } from '../machine/types';
4
+ export interface ForgotPasswordProps {
5
+ locale?: Locale;
6
+ authServiceInstance: AuthInstance;
7
+ forgeId?: string;
8
+ logoImage?: React.ReactNode;
9
+ cryptoUtils: {
10
+ hashUserInfo: (_userInfo: string) => string;
11
+ generateSecureHash: (_data: string, _salt: string, _keyDerivationFunction: 'argon2d' | 'pbkdf2') => Promise<string>;
12
+ };
13
+ }
14
+ declare const ForgotPassword: ({ locale, authServiceInstance, forgeId, logoImage, cryptoUtils, }: ForgotPasswordProps) => React.JSX.Element;
15
+ export default ForgotPassword;
@@ -0,0 +1,224 @@
1
+ 'use client';
2
+ /* eslint-disable @next/next/no-img-element */
3
+ import { EnvelopeIcon, LockClosedIcon } from '@heroicons/react/20/solid';
4
+ import { yupResolver } from '@hookform/resolvers/yup';
5
+ import { useActor } from '@xstate/react';
6
+ import { Button, Card, Spinner } from 'flowbite-react';
7
+ import React, { useMemo } from 'react';
8
+ import { useForm, useWatch } from 'react-hook-form';
9
+ import { twMerge } from 'tailwind-merge';
10
+ import * as yup from 'yup';
11
+ import { passwordRules, ruleValidation } from '../components/FormRules/helpers';
12
+ import { verifyEmptyValues } from '../helpers';
13
+ import useDictionary from '../hooks/useDictionary';
14
+ import { aloreLogoBlack, authErrorImage } from '../utils';
15
+ const InputForm = React.lazy(() => import('../components/InputForm'));
16
+ const BackButton = React.lazy(() => import('../components/BackButton'));
17
+ const FormRules = React.lazy(() => import('../components/FormRules'));
18
+ const envelopIcon = () => React.createElement(EnvelopeIcon, { className: "size-4 text-gray-500" });
19
+ const lockClosedIcon = () => React.createElement(LockClosedIcon, { className: "size-4 text-gray-500" });
20
+ const ForgotPassword = ({ locale = 'pt', authServiceInstance, forgeId, logoImage, cryptoUtils, }) => {
21
+ const { hashUserInfo, generateSecureHash } = cryptoUtils;
22
+ const dictionary = useDictionary(locale);
23
+ const forgotPasswordDictionary = dictionary?.auth.forgotPassword;
24
+ const [authState, sendAuth] = useActor(authServiceInstance);
25
+ const { error: errorObj, forgotPasswordSession } = authState.context;
26
+ const displayError = errorObj?.message || '';
27
+ const hasDisplayError = !!displayError;
28
+ const emailFormSchema = yup
29
+ .object({
30
+ email: yup
31
+ .string()
32
+ .required(dictionary?.formValidation.required)
33
+ .email(dictionary?.formValidation.invalidEmail),
34
+ })
35
+ .required();
36
+ const passwordFormSchema = yup
37
+ .object({
38
+ password: yup.string().required(dictionary?.formValidation.required),
39
+ confirmPassword: yup.string().required(dictionary?.formValidation.required),
40
+ })
41
+ .required();
42
+ const emailDefaultValues = {
43
+ email: '',
44
+ };
45
+ const { control: emailControl, formState: { errors: emailErrors }, handleSubmit: handleSubmitEmail, getValues: getValuesEmail, } = useForm({
46
+ resolver: yupResolver(emailFormSchema),
47
+ mode: 'onSubmit',
48
+ reValidateMode: 'onSubmit',
49
+ defaultValues: emailDefaultValues,
50
+ });
51
+ useWatch({ control: emailControl, name: ['email'] });
52
+ const passwordDefaultValues = {
53
+ password: '',
54
+ confirmPassword: '',
55
+ };
56
+ const { control: passwordControl, formState: { errors: passwordErrors, dirtyFields: passwordDirtyFields }, handleSubmit: handleSubmitPassword, getValues: getValuesPassword, } = useForm({
57
+ resolver: yupResolver(passwordFormSchema),
58
+ defaultValues: passwordDefaultValues,
59
+ });
60
+ useWatch({ control: passwordControl, name: ['password'] });
61
+ useWatch({ control: passwordControl, name: ['confirmPassword'] });
62
+ const isLoading = useMemo(() => authState.matches('active.forgotPassword.sendingCode') ||
63
+ authState.matches('active.forgotPassword.savingPassword'), [authState.value]);
64
+ const onSubmitEmail = async (data) => {
65
+ const { email } = data;
66
+ sendAuth({
67
+ type: 'SEND_CODE',
68
+ payload: {
69
+ email,
70
+ locale,
71
+ },
72
+ });
73
+ };
74
+ const onSubmitPassword = async (data) => {
75
+ const { password } = data;
76
+ const salt = forgotPasswordSession?.salt;
77
+ const token = forgotPasswordSession?.token;
78
+ const { userAgent } = window.navigator;
79
+ const device = hashUserInfo(userAgent);
80
+ if (salt && token) {
81
+ const secureHashArgon2d = await generateSecureHash(password, salt, 'argon2d');
82
+ sendAuth({
83
+ type: 'CONFIRM_PASSWORD',
84
+ payload: {
85
+ salt,
86
+ token,
87
+ passwordHash: secureHashArgon2d,
88
+ device,
89
+ },
90
+ });
91
+ }
92
+ };
93
+ const isPasswordSubmitDisabled = useMemo(() => {
94
+ const passwordValues = getValuesPassword();
95
+ const userInfoValues = { email: getValuesEmail('email') };
96
+ let isValid = true;
97
+ passwordRules.forEach((rule) => {
98
+ if (!ruleValidation(rule, passwordValues, userInfoValues)) {
99
+ isValid = false;
100
+ }
101
+ });
102
+ return !isValid;
103
+ }, [getValuesPassword(), passwordDirtyFields]);
104
+ const getAuthError = () => {
105
+ let authErrorTitle = dictionary?.auth.login?.somethingWrong;
106
+ let authErrorDescription = dictionary?.auth.login?.defaultError;
107
+ // Check for error code first
108
+ if (errorObj?.message) {
109
+ switch (errorObj.message) {
110
+ case 'INVALID_SESSION':
111
+ case 'EXPIRED_SESSION':
112
+ authErrorTitle = forgotPasswordDictionary?.expiredSessionTitle;
113
+ authErrorDescription = forgotPasswordDictionary?.expiredSessionDescription;
114
+ return { authErrorTitle, authErrorDescription };
115
+ case 'EMAIL_NOT_ALLOWED':
116
+ authErrorTitle = dictionary?.auth?.emailDomainNotAllowed;
117
+ return { authErrorTitle, authErrorDescription };
118
+ default:
119
+ break;
120
+ }
121
+ }
122
+ // Fallback to checking the message string
123
+ const lower = displayError.toLowerCase?.();
124
+ if (displayError === 'EMAIL_NOT_ALLOWED') {
125
+ authErrorTitle = dictionary?.auth?.emailDomainNotAllowed;
126
+ return { authErrorTitle, authErrorDescription };
127
+ }
128
+ if (lower?.includes('invalid') || lower?.includes('expired')) {
129
+ authErrorTitle = forgotPasswordDictionary?.invalidLink;
130
+ authErrorDescription = forgotPasswordDictionary?.invalidLinkDescription;
131
+ }
132
+ return { authErrorTitle, authErrorDescription };
133
+ };
134
+ const EmailInputStep = useMemo(() => {
135
+ const { authErrorTitle, authErrorDescription } = getAuthError();
136
+ return (React.createElement("div", { "data-testid": "forgot-password-email-step" },
137
+ React.createElement(BackButton, { className: "mb-4", disabled: isLoading, onClick: () => {
138
+ sendAuth('BACK');
139
+ window.history.replaceState({}, '', window.location.pathname);
140
+ } }, dictionary?.back),
141
+ hasDisplayError ? (React.createElement("div", { className: "flex flex-col items-center justify-center gap-5" },
142
+ React.createElement("img", { src: authErrorImage, alt: "error", width: 70 }),
143
+ React.createElement("div", { className: "flex flex-col items-center justify-center gap-2" },
144
+ React.createElement("span", { className: "font-poppins text-alr-red text-center text-xl font-bold" }, authErrorTitle),
145
+ React.createElement("span", { className: "text-alr-grey text-center font-medium" }, authErrorDescription),
146
+ errorObj?.code && (React.createElement("span", { className: "mt-1 text-center text-xs text-gray-500" }, `Error code: ${errorObj.code}`))))) : (React.createElement("div", { className: "flex flex-col items-center" },
147
+ React.createElement("span", { className: "font-poppins text-alr-grey mb-5 mt-6 font-bold" }, forgotPasswordDictionary?.resetPassword),
148
+ React.createElement("span", { className: "text-alr-grey mb-3 text-center font-medium" }, forgotPasswordDictionary?.resetPasswordDescription))),
149
+ React.createElement("div", { className: "mt-4 flex flex-col gap-y-5" },
150
+ React.createElement("form", { className: "flex flex-col gap-y-5", onSubmit: handleSubmitEmail((data) => onSubmitEmail(data)) },
151
+ React.createElement(InputForm, { className: "my-1", control: emailControl, errors: emailErrors, name: "email", type: "text", placeholder: dictionary?.auth.login?.enterEmail, "data-testid": "forgot-password-email-input", icon: envelopIcon, autoFocus: true }),
152
+ React.createElement(Button, { type: "submit", "data-testid": "forgot-password-send-button", disabled: verifyEmptyValues(getValuesEmail('email')) },
153
+ isLoading && React.createElement(Spinner, { className: "mr-3 !h-5 w-full !fill-gray-300" }),
154
+ forgotPasswordDictionary?.sendCode)),
155
+ React.createElement("div", { className: "h-[0.5px] w-full bg-gray-300" }),
156
+ React.createElement("span", { className: "text-center text-sm font-medium" },
157
+ dictionary?.auth.login?.dontHaveAccount,
158
+ React.createElement("div", { "data-testid": "sign-up-button", className: "cursor-pointer text-[var(--primary-color)] hover:text-[var(--primary-hover)]", onClick: () => {
159
+ sendAuth(['RESET', { type: 'INITIALIZE', forgeId }, 'SIGN_UP']);
160
+ } }, dictionary?.auth.login?.signUp)))));
161
+ }, [getValuesEmail(), emailErrors, emailControl, isLoading, displayError]);
162
+ const EmailSentStep = useMemo(() => (React.createElement("div", { "data-testid": "forgot-password-email-sent-step" },
163
+ React.createElement(BackButton, { className: "mb-4", disabled: isLoading, onClick: () => {
164
+ sendAuth('BACK');
165
+ window.history.replaceState({}, '', window.location.pathname);
166
+ } }, dictionary?.back),
167
+ React.createElement("div", { className: "flex flex-col items-center justify-center" },
168
+ React.createElement("span", { className: "font-poppins text-alr-grey mb-5 mt-14 text-center text-xl font-bold" }, forgotPasswordDictionary?.emailSentTitle),
169
+ React.createElement("span", { className: "text-alr-grey mb-6 w-full text-center font-medium" }, forgotPasswordDictionary?.emailSentDescription),
170
+ React.createElement(Button, { className: "flex w-full items-center justify-center", onClick: () => {
171
+ sendAuth('BACK');
172
+ window.history.replaceState({}, '', window.location.pathname);
173
+ }, "data-testid": "back-to-login-button" }, forgotPasswordDictionary?.backToLogin)))), [forgotPasswordDictionary]);
174
+ const NewPasswordStep = useMemo(() => {
175
+ const { authErrorTitle, authErrorDescription } = getAuthError();
176
+ return (React.createElement("div", { "data-testid": "forgot-password-new-password-step" },
177
+ React.createElement(BackButton, { className: "mb-4", disabled: isLoading, onClick: () => sendAuth('BACK') }, dictionary?.back),
178
+ hasDisplayError && (React.createElement("div", { className: "mb-4 flex flex-col items-center justify-center gap-2" },
179
+ React.createElement("img", { src: authErrorImage, alt: "error", width: 70 }),
180
+ React.createElement("span", { className: "font-poppins text-alr-red text-center text-xl font-bold" }, authErrorTitle),
181
+ React.createElement("span", { className: "text-alr-grey text-center font-medium" }, authErrorDescription),
182
+ errorObj?.code && (React.createElement("span", { className: "text-center text-xs text-gray-500" }, `Error code: ${errorObj.code}`)))),
183
+ React.createElement("div", { className: "flex w-full flex-col" },
184
+ React.createElement("span", { className: "font-poppins text-alr-grey mb-5 text-center text-xl font-bold" }, forgotPasswordDictionary?.newPasswordTitle),
185
+ React.createElement("span", { className: "text-alr-grey mb-5 text-center text-sm font-medium" }, forgotPasswordDictionary?.newPasswordDescription),
186
+ React.createElement("form", { onSubmit: handleSubmitPassword((data) => onSubmitPassword(data)), className: "flex flex-col gap-y-4" },
187
+ React.createElement(InputForm, { control: passwordControl, errors: passwordErrors, name: "password", autoFocus: true, icon: lockClosedIcon, placeholder: forgotPasswordDictionary?.passwordLabel, label: forgotPasswordDictionary?.passwordLabel, type: "password", "data-testid": "forgot-password-password-input", disabled: isLoading }),
188
+ React.createElement(InputForm, { control: passwordControl, errors: passwordErrors, name: "confirmPassword", placeholder: forgotPasswordDictionary?.confirmPasswordLabel, label: forgotPasswordDictionary?.confirmPasswordLabel, icon: lockClosedIcon, type: "password", "data-testid": "forgot-password-confirm-password-input", disabled: isLoading }),
189
+ React.createElement(FormRules, { locale: locale, className: "!gap-y-1 md:!gap-y-2", passwordValues: getValuesPassword(), userValues: { email: getValuesEmail('email') } }),
190
+ React.createElement(Button, { "data-testid": "forgot-password-submit-button", type: "submit", disabled: isPasswordSubmitDisabled || isLoading },
191
+ isLoading && React.createElement(Spinner, { className: "mr-3 !h-5 w-full !fill-gray-300" }),
192
+ forgotPasswordDictionary?.confirmButton)))));
193
+ }, [
194
+ isPasswordSubmitDisabled,
195
+ passwordControl,
196
+ passwordErrors,
197
+ getValuesPassword(),
198
+ passwordDirtyFields,
199
+ isLoading,
200
+ displayError,
201
+ ]);
202
+ const SuccessStep = useMemo(() => (React.createElement("div", { "data-testid": "forgot-password-success-step", className: "flex flex-col items-center justify-center" },
203
+ React.createElement("span", { className: "font-poppins text-alr-grey mb-5 mt-14 text-center text-2xl font-semibold" }, forgotPasswordDictionary?.successTitle),
204
+ React.createElement("span", { className: "text-alr-grey mb-6 w-full text-center font-medium" }, forgotPasswordDictionary?.successDescription),
205
+ React.createElement(Button, { className: "flex w-full items-center justify-center", onClick: () => {
206
+ sendAuth('BACK');
207
+ window.history.replaceState({}, '', window.location.pathname);
208
+ }, "data-testid": "back-to-login-success-button" }, forgotPasswordDictionary?.backToLogin))), [forgotPasswordDictionary]);
209
+ return (React.createElement("div", { className: "flex size-full min-h-screen flex-col items-center justify-center gap-y-2 sm:gap-y-7", "data-testid": "forgot-password-page" },
210
+ forgeId ? (React.createElement("div", { className: "flex flex-col" },
211
+ React.createElement("span", { className: "font-poppins text-alr-grey text-center text-2xl font-black" }, "Tardezinha com Thiaguinho"),
212
+ React.createElement("div", { className: "flex w-full flex-row items-center justify-center gap-2" },
213
+ React.createElement("span", { className: "font-inter text-sm font-medium text-gray-900" }, dictionary?.auth.poweredBy),
214
+ React.createElement("img", { src: aloreLogoBlack, alt: "alore logo", width: "60" })))) : (logoImage || (React.createElement("img", { src: aloreLogoBlack, alt: "alore logo", width: 201 }))),
215
+ React.createElement(Card, { className: twMerge(`md:child:!px-9 mx-5 flex min-w-[20rem] !rounded-2xl border-gray-200 px-2 py-4 md:mx-7 md:w-96`, isLoading ? 'pointer-events-none opacity-50' : '') }, isLoading ? (React.createElement(Spinner, { className: "my-20 !h-14 w-full !fill-[var(--primary-color)]" })) : (React.createElement(React.Fragment, null,
216
+ authState.matches('active.forgotPassword.idle') && EmailInputStep,
217
+ authState.matches('active.forgotPassword.codeSent') && EmailSentStep,
218
+ (authState.matches('active.forgotPassword.newPassword') ||
219
+ authState.matches('active.forgotPassword.savingPassword')) &&
220
+ NewPasswordStep,
221
+ authState.matches('active.forgotPassword.passwordSaved') && SuccessStep)))));
222
+ };
223
+ export default ForgotPassword;
224
+ //# sourceMappingURL=ForgotPassword.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ForgotPassword.js","sourceRoot":"","sources":["../../../src/auth/ForgotPassword.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,8CAA8C;AAC9C,OAAO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/F,SAAS,CAAC,CAAC,CAAC,gCAAgC,CAAC,CAAC,CAAC,EAAE,CAClD,IAEA,SAAS,CAAC,CAAC,CAAC,CACX,oBAAC,OAAO,IAAC,SAAS,EAAC,iDAAiD,GAAG,CACxE,CAAC,CAAC,CAAC,CACF;YACG,SAAS,CAAC,OAAO,CAAC,4BAA4B,CAAC,IAAI,cAAc;YACjE,SAAS,CAAC,OAAO,CAAC,gCAAgC,CAAC,IAAI,aAAa;YACpE,CAAC,SAAS,CAAC,OAAO,CAAC,mCAAmC,CAAC;gBACtD,SAAS,CAAC,OAAO,CAAC,sCAAsC,CAAC,CAAC;gBAC1D,eAAe;YAChB,SAAS,CAAC,OAAO,CAAC,qCAAqC,CAAC,IAAI,WAAW,CACvE,CACJ,CACI,CACH,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -11,6 +11,24 @@ export interface LoginProps {
11
11
  hashUserInfo: (_userInfo: string) => string;
12
12
  generateSecureHash: (_data: string, _salt: string, _keyDerivationFunction: 'argon2d' | 'pbkdf2') => Promise<string>;
13
13
  };
14
+ customStyles?: {
15
+ borderRadius?: string;
16
+ borderWidth?: string;
17
+ borderColor?: string;
18
+ backgroundColor?: string;
19
+ padding?: string;
20
+ boxShadow?: string;
21
+ };
22
+ title?: string;
23
+ titleClassName?: string;
24
+ loginTitle?: string;
25
+ loginTitleClassName?: string;
26
+ emailInputLabel?: string;
27
+ inputClassName?: string;
28
+ contentAlignment?: 'left' | 'center' | 'right';
29
+ customClassName?: string;
30
+ titleSpacing?: string;
31
+ logoContainerClassName?: string;
14
32
  }
15
- declare const Login: ({ locale, authServiceInstance, forgeId, logoImage, keyshareWorker, cryptoUtils, }: LoginProps) => React.JSX.Element | null;
33
+ declare const Login: ({ locale, authServiceInstance, forgeId, logoImage, keyshareWorker, cryptoUtils, customStyles, title, titleClassName, loginTitle, loginTitleClassName, emailInputLabel, inputClassName, contentAlignment, customClassName, titleSpacing, logoContainerClassName, }: LoginProps) => React.JSX.Element | null;
16
34
  export default Login;
@@ -22,7 +22,7 @@ const lockClosedIcon = () => React.createElement(LockClosedIcon, { className: "s
22
22
  const HARDWARE = 1;
23
23
  const SOFTWARE = 2;
24
24
  const ABORT_CONDITIONAL_UI = 'abort-conditional-ui';
25
- const Login = ({ locale = 'pt', authServiceInstance, forgeId, logoImage, keyshareWorker, cryptoUtils, }) => {
25
+ const Login = ({ locale = 'pt', authServiceInstance, forgeId, logoImage, keyshareWorker, cryptoUtils, customStyles, title, titleClassName, loginTitle, loginTitleClassName, emailInputLabel, inputClassName, contentAlignment = 'center', customClassName, titleSpacing = 'gap-y-2 sm:gap-y-7', logoContainerClassName, }) => {
26
26
  const { hashUserInfo, generateSecureHash } = cryptoUtils;
27
27
  const dictionary = useDictionary(locale);
28
28
  const loginDictionary = dictionary?.auth.login;
@@ -565,12 +565,13 @@ const Login = ({ locale = 'pt', authServiceInstance, forgeId, logoImage, keyshar
565
565
  displayError?.includes('beta') ? (React.createElement("span", { className: "font-poppins text-alr-red text-center text-xl font-bold" }, displayError)) : (React.createElement(React.Fragment, null,
566
566
  React.createElement("span", { className: "font-poppins text-alr-red text-center text-xl font-bold" }, authErrorTitle),
567
567
  React.createElement("span", { className: "text-alr-grey text-center font-medium" }, authErrorDescription),
568
- errorObj?.code && (React.createElement("span", { className: "mt-1 text-center text-xs text-gray-500" }, `Error code: ${errorObj.code}`)))))) : (React.createElement("h1", { className: "font-inter text-center text-xl font-bold text-gray-700" }, forgeId ? loginDictionary?.forgeLogin : loginDictionary?.loginAccount)),
568
+ errorObj?.code && (React.createElement("span", { className: "mt-1 text-center text-xs text-gray-500" }, `Error code: ${errorObj.code}`)))))) : (React.createElement("h1", { className: loginTitleClassName || 'font-inter text-center text-xl font-bold text-gray-700' }, loginTitle || (forgeId ? loginDictionary?.forgeLogin : loginDictionary?.loginAccount))),
569
569
  React.createElement("div", { className: "mt-4 flex flex-col gap-y-5" },
570
570
  !onlyPasskeyLogin && requireEmailVerification && (React.createElement("form", { className: "flex flex-col gap-y-5", onSubmit: handleSubmitEmail((data) => onSubmitEmail(data)) },
571
- React.createElement(InputForm, { className: "my-1", control: emailControl, errors: emailErrors, name: "email", type: "text", placeholder: loginDictionary?.enterEmail, "data-testid": "login-email-input", icon: envelopIcon, autoComplete: authAbortController && isConditionalMediationAvailable
571
+ React.createElement(InputForm, { className: "my-1", inputClassName: inputClassName, control: emailControl, errors: emailErrors, name: "email", type: "text", placeholder: emailInputLabel || loginDictionary?.enterEmail, "data-testid": "login-email-input", icon: envelopIcon, autoComplete: authAbortController && isConditionalMediationAvailable
572
572
  ? 'username webauthn'
573
573
  : undefined, autoFocus: true }),
574
+ React.createElement("span", { onClick: () => sendAuth('FORGOT_PASSWORD'), className: "cursor-pointer text-xs font-medium text-[var(--primary-color)] hover:text-[var(--primary-hover)]" }, "Forgot your password?"),
574
575
  React.createElement(Button, { type: "submit", "data-testid": "login-button", disabled: verifyEmptyValues(getValuesEmail('email')) },
575
576
  isLoading && React.createElement(Spinner, { className: "mr-3 !h-5 w-full !fill-gray-300" }),
576
577
  onlyPasskeyLogin ? loginDictionary?.passkeyLogin : loginDictionary?.login))),
@@ -598,7 +599,33 @@ const Login = ({ locale = 'pt', authServiceInstance, forgeId, logoImage, keyshar
598
599
  React.createElement("div", { "data-testid": "sign-up-button", className: "cursor-pointer text-[var(--primary-color)] hover:text-[var(--primary-hover)]", onClick: () => {
599
600
  sendAuth(['RESET', { type: 'INITIALIZE', forgeId }, 'SIGN_UP']);
600
601
  } }, loginDictionary?.signUp)))));
601
- }, [getValuesEmail(), isLoginSubmitDisabled, emailErrors, emailControl, isLoading, displayError]);
602
+ }, [
603
+ getValuesEmail,
604
+ emailErrors,
605
+ emailControl,
606
+ isLoading,
607
+ displayError,
608
+ loginTitleClassName,
609
+ loginTitle,
610
+ inputClassName,
611
+ emailInputLabel,
612
+ forgeId,
613
+ loginDictionary,
614
+ authAbortController,
615
+ isConditionalMediationAvailable,
616
+ sendAuth,
617
+ socialProviders,
618
+ dictionary,
619
+ handleSubmitEmail,
620
+ onSubmitEmail,
621
+ handlePasskeyButton,
622
+ handleGoogleLogin,
623
+ handleMicrosoftLogin,
624
+ onlyPasskeyLogin,
625
+ requireEmailVerification,
626
+ errorObj,
627
+ hasDisplayError,
628
+ ]);
602
629
  const SelectLoginMethod = useMemo(() => {
603
630
  const { authErrorTitle, authErrorDescription } = getAuthError();
604
631
  return (React.createElement("div", null,
@@ -636,8 +663,9 @@ const Login = ({ locale = 'pt', authServiceInstance, forgeId, logoImage, keyshar
636
663
  React.createElement("span", { className: "text-alr-grey text-center font-medium" }, authErrorDescription),
637
664
  errorObj?.code && (React.createElement("span", { className: "text-center text-xs text-gray-500" }, `Error code: ${errorObj.code}`))))),
638
665
  React.createElement("form", { onSubmit: handleSubmitPassword((data) => onSubmitLogin(data)), className: "flex flex-col gap-y-5", "data-testid": "login-password-step" },
639
- React.createElement(InputForm, { control: passwordControl, errors: passwordErrors, name: "password", placeholder: loginDictionary?.enterPassword, icon: lockClosedIcon, type: "password", label: dictionary?.password, "data-testid": "login-password" }),
640
- React.createElement(Button, { type: "submit", "data-testid": "login-submit", disabled: verifyEmptyValues(getValuesPassword('password')) },
666
+ React.createElement(InputForm, { inputClassName: inputClassName, control: passwordControl, errors: passwordErrors, name: "password", placeholder: loginDictionary?.enterPassword, icon: lockClosedIcon, type: "password", label: dictionary?.password, "data-testid": "login-password" }),
667
+ React.createElement("span", { onClick: () => sendAuth('FORGOT_PASSWORD'), className: "cursor-pointer text-xs font-medium text-[var(--primary-color)] hover:text-[var(--primary-hover)]" }, "Forgot your password?"),
668
+ React.createElement(Button, { type: "submit", "data-testid": "login-submit", disabled: isLoginSubmitDisabled },
641
669
  isLoading && React.createElement(Spinner, { className: "mr-3 !h-5 w-full !fill-gray-300" }),
642
670
  loginDictionary?.login),
643
671
  React.createElement("span", { className: "text-center text-sm font-medium" },
@@ -646,12 +674,24 @@ const Login = ({ locale = 'pt', authServiceInstance, forgeId, logoImage, keyshar
646
674
  sendAuth(['RESET', { type: 'INITIALIZE', forgeId }, 'SIGN_UP']);
647
675
  } }, loginDictionary?.signUp)))));
648
676
  }, [
649
- getValuesPassword(),
650
- isLoginSubmitDisabled,
677
+ getValuesPassword,
678
+ getValuesEmail,
679
+ googleUser?.email,
680
+ credentialEmail,
651
681
  passwordErrors,
652
682
  passwordControl,
653
683
  isLoading,
654
684
  displayError,
685
+ hasDisplayError,
686
+ errorObj,
687
+ inputClassName,
688
+ loginDictionary,
689
+ dictionary,
690
+ sendAuth,
691
+ handleSubmitPassword,
692
+ onSubmitLogin,
693
+ forgeId,
694
+ isLoginSubmitDisabled,
655
695
  ]);
656
696
  const VerifyEmail = useMemo(() => (React.createElement("div", { "data-testid": "login-verify-email-step" },
657
697
  React.createElement(BackButton, { className: "mb-4", disabled: isLoading, onClick: () => sendAuth('BACK') }, dictionary?.back),
@@ -712,15 +752,45 @@ const Login = ({ locale = 'pt', authServiceInstance, forgeId, logoImage, keyshar
712
752
  React.createElement("span", { onClick: () => resendSecureCode(), className: twMerge(`text-base font-medium duration-300`, sendEmailCooldown > 0
713
753
  ? 'pointer-events-none opacity-50'
714
754
  : 'hover:text-alr-red cursor-pointer opacity-100') }, `${loginDictionary?.resendCode}${sendEmailCooldown ? ` (${sendEmailCooldown}s)` : ''}`)))), [secureCodeEmail, sendEmailCooldown, isLoading, newDeviceInfo, displayError]);
755
+ // Create custom styles object for the Card component
756
+ const cardCustomStyles = useMemo(() => {
757
+ if (!customStyles)
758
+ return {};
759
+ const styles = {};
760
+ if (customStyles.borderRadius)
761
+ styles.borderRadius = customStyles.borderRadius;
762
+ if (customStyles.borderWidth)
763
+ styles.borderWidth = customStyles.borderWidth;
764
+ if (customStyles.borderColor)
765
+ styles.borderColor = customStyles.borderColor;
766
+ if (customStyles.backgroundColor)
767
+ styles.backgroundColor = customStyles.backgroundColor;
768
+ if (customStyles.padding)
769
+ styles.padding = customStyles.padding;
770
+ if (customStyles.boxShadow)
771
+ styles.boxShadow = customStyles.boxShadow;
772
+ return styles;
773
+ }, [customStyles]);
774
+ // Get alignment classes based on contentAlignment prop
775
+ const getAlignmentClasses = useMemo(() => {
776
+ const alignmentMap = {
777
+ left: 'items-start text-left',
778
+ center: 'items-center text-center',
779
+ right: 'items-end text-right',
780
+ };
781
+ return alignmentMap[contentAlignment];
782
+ }, [contentAlignment]);
715
783
  if (authState.matches('active.login.successfulLogin'))
716
784
  return null;
717
- return (React.createElement("div", { className: "flex size-full min-h-screen flex-col items-center justify-center gap-y-2 sm:gap-y-7", "data-testid": "login-page" },
785
+ return (React.createElement("div", { className: `flex size-full min-h-screen flex-col items-center justify-center ${titleSpacing}`, "data-testid": "login-page" },
718
786
  forgeId ? (React.createElement("div", { className: "flex flex-col" },
719
787
  React.createElement("span", { className: "font-poppins text-alr-grey text-center text-2xl font-black" }, "Tardezinha com Thiaguinho"),
720
788
  React.createElement("div", { className: "flex w-full flex-row items-center justify-center gap-2" },
721
789
  React.createElement("span", { className: "font-inter text-sm font-medium text-gray-900" }, dictionary?.auth.poweredBy),
722
- React.createElement("img", { src: aloreLogoBlack, alt: "alore logo", width: "60" })))) : (logoImage || (React.createElement("img", { src: aloreLogoBlack, alt: "alore logo", width: authState.matches('active.login.newDevice') ? 153 : 201 }))),
723
- React.createElement(Card, { className: twMerge(`md:child:!px-9 mx-5 flex min-w-[20rem] !rounded-2xl border-gray-200 px-2 py-4 md:mx-7 md:w-96`, isLoading ? 'pointer-events-none opacity-50' : '') }, isLoading ? (React.createElement(Spinner, { className: "my-20 !h-14 w-full !fill-[var(--primary-color)]" })) : (React.createElement(React.Fragment, null,
790
+ React.createElement("img", { src: aloreLogoBlack, alt: "alore logo", width: "60" })))) : (React.createElement("div", { className: `mx-5 flex min-w-80 flex-col gap-3 px-6 md:mx-7 md:w-96 ${getAlignmentClasses} ${logoContainerClassName || ''}` },
791
+ logoImage || (React.createElement("img", { src: aloreLogoBlack, alt: "alore logo", width: authState.matches('active.login.newDevice') ? 153 : 201 })),
792
+ title && React.createElement("h2", { className: titleClassName }, title))),
793
+ React.createElement(Card, { className: twMerge(`md:child:!px-9 mx-5 flex min-w-[20rem] !rounded-2xl border-gray-200 px-2 py-4 md:mx-7 md:w-96`, isLoading ? 'pointer-events-none opacity-50' : '', customClassName), style: cardCustomStyles }, isLoading ? (React.createElement(Spinner, { className: "my-20 !h-14 w-full !fill-[var(--primary-color)]" })) : (React.createElement(React.Fragment, null,
724
794
  forgeId && authState.matches('active.web3Connector') && 'TODO',
725
795
  (authState.matches('active.login.idle') ||
726
796
  authState.matches('active.login.googleLogin') ||