Skip to content

Commit 3c1e51f

Browse files
committed
Merge branch '@invertase/align-core' of https://github.com/firebase/firebaseui-web into @invertase/align-react
2 parents d9d6d97 + fbf457b commit 3c1e51f

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

packages/core/src/schemas.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,26 +23,33 @@ export const LoginTypes = ["email", "phone", "anonymous", "emailLink", "google"]
2323
export type LoginType = (typeof LoginTypes)[number];
2424
export type AuthMode = "signIn" | "signUp";
2525

26-
export function createEmailFormSchema(ui: FirebaseUIConfiguration) {
26+
export function createSignInAuthFormSchema(ui: FirebaseUIConfiguration) {
2727
return z.object({
2828
email: z.string().email({ message: getTranslation(ui, "errors", "invalidEmail") }),
2929
password: z.string().min(8, { message: getTranslation(ui, "errors", "weakPassword") }),
3030
});
3131
}
3232

33-
export function createForgotPasswordFormSchema(ui: FirebaseUIConfiguration) {
33+
export function createSignUpAuthFormSchema(ui: FirebaseUIConfiguration) {
34+
return z.object({
35+
email: z.string().email({ message: getTranslation(ui, "errors", "invalidEmail") }),
36+
password: z.string().min(8, { message: getTranslation(ui, "errors", "weakPassword") }),
37+
});
38+
}
39+
40+
export function createForgotPasswordAuthFormSchema(ui: FirebaseUIConfiguration) {
3441
return z.object({
3542
email: z.string().email({ message: getTranslation(ui, "errors", "invalidEmail") }),
3643
});
3744
}
3845

39-
export function createEmailLinkFormSchema(ui: FirebaseUIConfiguration) {
46+
export function createEmailLinkAuthFormSchema(ui: FirebaseUIConfiguration) {
4047
return z.object({
4148
email: z.string().email({ message: getTranslation(ui, "errors", "invalidEmail") }),
4249
});
4350
}
4451

45-
export function createPhoneFormSchema(ui: FirebaseUIConfiguration) {
52+
export function createPhoneAuthFormSchema(ui: FirebaseUIConfiguration) {
4653
return z.object({
4754
phoneNumber: z
4855
.string()
@@ -55,7 +62,8 @@ export function createPhoneFormSchema(ui: FirebaseUIConfiguration) {
5562
});
5663
}
5764

58-
export type EmailFormSchema = z.infer<ReturnType<typeof createEmailFormSchema>>;
59-
export type ForgotPasswordFormSchema = z.infer<ReturnType<typeof createForgotPasswordFormSchema>>;
60-
export type EmailLinkFormSchema = z.infer<ReturnType<typeof createEmailLinkFormSchema>>;
61-
export type PhoneFormSchema = z.infer<ReturnType<typeof createPhoneFormSchema>>;
65+
export type SignInAuthFormSchema = z.infer<ReturnType<typeof createSignInAuthFormSchema>>;
66+
export type SignUpAuthFormSchema = z.infer<ReturnType<typeof createSignUpAuthFormSchema>>;
67+
export type ForgotPasswordAuthFormSchema = z.infer<ReturnType<typeof createForgotPasswordAuthFormSchema>>;
68+
export type EmailLinkAuthFormSchema = z.infer<ReturnType<typeof createEmailLinkAuthFormSchema>>;
69+
export type PhoneAuthFormSchema = z.infer<ReturnType<typeof createPhoneAuthFormSchema>>;

0 commit comments

Comments
 (0)