Skip to content

Commit c54483b

Browse files
committed
Merge branch '@invertase/v7-development' of https://github.com/firebase/firebaseui-web into @invertase/publish-artifacts
2 parents c7ddbed + 012709e commit c54483b

File tree

71 files changed

+1133
-193
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+1133
-193
lines changed

examples/react/src/routes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export const routes = [
6464
{
6565
name: "Forgot Password Screen",
6666
description: "A screen allowing a user to reset their password",
67-
path: "/screens/forgot-password-screen",
67+
path: "/screens/forgot-password-auth-screen",
6868
component: ForgotPasswordAuthScreenPage,
6969
},
7070
{

examples/react/src/screens/email-link-auth-screen-w-oauth.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default function EmailLinkAuthScreenWithOAuthPage() {
3333
return (
3434
<EmailLinkAuthScreen
3535
onEmailSent={() => {
36-
alert("Email has been sent");
36+
alert("Email has been sent - please check your email");
3737
}}
3838
onSignIn={(credential) => {
3939
console.log(credential);

examples/react/src/screens/sign-in-auth-screen-w-handlers.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ export default function SignInAuthScreenWithHandlersPage() {
2424
return (
2525
<SignInAuthScreen
2626
onForgotPasswordClick={() => {
27-
navigate("/screen/forgot-password-auth-screen");
27+
navigate("/screens/forgot-password-auth-screen");
2828
}}
29-
onRegisterClick={() => {
29+
onSignUpClick={() => {
3030
navigate("/screens/sign-up-auth-screen");
3131
}}
3232
/>

examples/shadcn/src/components/multi-factor-auth-assertion-form.tsx

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
"use client";
22

3-
import { PhoneMultiFactorGenerator, TotpMultiFactorGenerator, type MultiFactorInfo } from "firebase/auth";
3+
import {
4+
PhoneMultiFactorGenerator,
5+
TotpMultiFactorGenerator,
6+
type MultiFactorInfo,
7+
type UserCredential,
8+
} from "firebase/auth";
49
import { type ComponentProps, useState } from "react";
510
import { getTranslation } from "@invertase/firebaseui-core";
611
import { useUI } from "@invertase/firebaseui-react";
@@ -9,7 +14,11 @@ import { SmsMultiFactorAssertionForm } from "./sms-multi-factor-assertion-form";
914
import { TotpMultiFactorAssertionForm } from "./totp-multi-factor-assertion-form";
1015
import { Button } from "@/components/ui/button";
1116

12-
export function MultiFactorAuthAssertionForm() {
17+
export type MultiFactorAuthAssertionFormProps = {
18+
onSuccess?: (credential: UserCredential) => void;
19+
};
20+
21+
export function MultiFactorAuthAssertionForm(props: MultiFactorAuthAssertionFormProps) {
1322
const ui = useUI();
1423
const resolver = ui.multiFactorResolver;
1524

@@ -24,11 +33,25 @@ export function MultiFactorAuthAssertionForm() {
2433

2534
if (hint) {
2635
if (hint.factorId === PhoneMultiFactorGenerator.FACTOR_ID) {
27-
return <SmsMultiFactorAssertionForm hint={hint} />;
36+
return (
37+
<SmsMultiFactorAssertionForm
38+
hint={hint}
39+
onSuccess={(credential) => {
40+
props.onSuccess?.(credential);
41+
}}
42+
/>
43+
);
2844
}
2945

3046
if (hint.factorId === TotpMultiFactorGenerator.FACTOR_ID) {
31-
return <TotpMultiFactorAssertionForm hint={hint} />;
47+
return (
48+
<TotpMultiFactorAssertionForm
49+
hint={hint}
50+
onSuccess={(credential) => {
51+
props.onSuccess?.(credential);
52+
}}
53+
/>
54+
);
3255
}
3356
}
3457

examples/shadcn/src/components/sms-multi-factor-assertion-form.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use client";
22

33
import { useRef, useState } from "react";
4-
import { type MultiFactorInfo } from "firebase/auth";
4+
import { type MultiFactorInfo, type UserCredential } from "firebase/auth";
55

66
import { FirebaseUIError, getTranslation } from "@invertase/firebaseui-core";
77
import {
@@ -64,7 +64,7 @@ function SmsMultiFactorAssertionPhoneForm(props: SmsMultiFactorAssertionPhoneFor
6464

6565
type SmsMultiFactorAssertionVerifyFormProps = {
6666
verificationId: string;
67-
onSuccess: () => void;
67+
onSuccess: (credential: UserCredential) => void;
6868
};
6969

7070
function SmsMultiFactorAssertionVerifyForm(props: SmsMultiFactorAssertionVerifyFormProps) {
@@ -82,8 +82,11 @@ function SmsMultiFactorAssertionVerifyForm(props: SmsMultiFactorAssertionVerifyF
8282

8383
const onSubmit = async (values: { verificationId: string; verificationCode: string }) => {
8484
try {
85-
await action({ verificationId: values.verificationId, verificationCode: values.verificationCode });
86-
props.onSuccess();
85+
const credential = await action({
86+
verificationId: values.verificationId,
87+
verificationCode: values.verificationCode,
88+
});
89+
props.onSuccess(credential);
8790
} catch (error) {
8891
const message = error instanceof FirebaseUIError ? error.message : String(error);
8992
form.setError("root", { message });
@@ -126,7 +129,7 @@ function SmsMultiFactorAssertionVerifyForm(props: SmsMultiFactorAssertionVerifyF
126129

127130
export type SmsMultiFactorAssertionFormProps = {
128131
hint: MultiFactorInfo;
129-
onSuccess?: () => void;
132+
onSuccess?: (credential: UserCredential) => void;
130133
};
131134

132135
export function SmsMultiFactorAssertionForm(props: SmsMultiFactorAssertionFormProps) {
@@ -146,8 +149,8 @@ export function SmsMultiFactorAssertionForm(props: SmsMultiFactorAssertionFormPr
146149
return (
147150
<SmsMultiFactorAssertionVerifyForm
148151
verificationId={verification.verificationId}
149-
onSuccess={() => {
150-
props.onSuccess?.();
152+
onSuccess={(credential) => {
153+
props.onSuccess?.(credential);
151154
}}
152155
/>
153156
);

examples/shadcn/src/components/totp-multi-factor-assertion-form.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use client";
22

3-
import { type MultiFactorInfo } from "firebase/auth";
3+
import { type MultiFactorInfo, type UserCredential } from "firebase/auth";
44
import { FirebaseUIError, getTranslation } from "@invertase/firebaseui-core";
55
import {
66
useMultiFactorTotpAuthVerifyFormSchema,
@@ -16,7 +16,7 @@ import { InputOTP, InputOTPGroup, InputOTPSlot } from "@/components/ui/input-otp
1616

1717
type TotpMultiFactorAssertionFormProps = {
1818
hint: MultiFactorInfo;
19-
onSuccess?: () => void;
19+
onSuccess?: (credential: UserCredential) => void;
2020
};
2121

2222
export function TotpMultiFactorAssertionForm(props: TotpMultiFactorAssertionFormProps) {
@@ -33,8 +33,8 @@ export function TotpMultiFactorAssertionForm(props: TotpMultiFactorAssertionForm
3333

3434
const onSubmit = async (values: { verificationCode: string }) => {
3535
try {
36-
await action({ verificationCode: values.verificationCode, hint: props.hint });
37-
props.onSuccess?.();
36+
const credential = await action({ verificationCode: values.verificationCode, hint: props.hint });
37+
props.onSuccess?.(credential);
3838
} catch (error) {
3939
const message = error instanceof FirebaseUIError ? error.message : String(error);
4040
form.setError("root", { message });

packages/angular/src/lib/auth/forms/email-link-auth-form.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ export class EmailLinkAuthFormComponent {
9696
this.form.update({
9797
validators: {
9898
onBlur: this.formSchema(),
99-
onSubmit: this.formSchema(),
10099
onSubmitAsync: async ({ value }) => {
101100
try {
102101
await sendSignInLinkToEmail(this.ui(), value.email);

packages/angular/src/lib/auth/forms/forgot-password-auth-form.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ export class ForgotPasswordAuthFormComponent {
104104
this.form.update({
105105
validators: {
106106
onBlur: this.formSchema(),
107-
onSubmit: this.formSchema(),
108107
onSubmitAsync: async ({ value }) => {
109108
try {
110109
await sendPasswordResetEmail(this.ui(), value.email);

packages/angular/src/lib/auth/forms/mfa/sms-multi-factor-assertion-form.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe("<fui-sms-multi-factor-assertion-form>", () => {
3232
const {
3333
injectTranslation,
3434
injectUI,
35-
injectMultiFactorPhoneAuthNumberFormSchema,
35+
injectMultiFactorPhoneAuthAssertionFormSchema,
3636
injectMultiFactorPhoneAuthVerifyFormSchema,
3737
injectRecaptchaVerifier,
3838
} = require("../../../tests/test-helpers");
@@ -58,7 +58,7 @@ describe("<fui-sms-multi-factor-assertion-form>", () => {
5858
});
5959
});
6060

61-
injectMultiFactorPhoneAuthNumberFormSchema.mockReturnValue(() => {
61+
injectMultiFactorPhoneAuthAssertionFormSchema.mockReturnValue(() => {
6262
const { z } = require("zod");
6363
return z.object({
6464
phoneNumber: z.string().min(1, "Phone number is required"),
@@ -186,7 +186,7 @@ describe("<fui-sms-multi-factor-assertion-phone-form>", () => {
186186
const {
187187
injectTranslation,
188188
injectUI,
189-
injectMultiFactorPhoneAuthNumberFormSchema,
189+
injectMultiFactorPhoneAuthAssertionFormSchema,
190190
} = require("../../../tests/test-helpers");
191191

192192
injectTranslation.mockImplementation((category: string, key: string) => {
@@ -208,7 +208,7 @@ describe("<fui-sms-multi-factor-assertion-phone-form>", () => {
208208
});
209209
});
210210

211-
injectMultiFactorPhoneAuthNumberFormSchema.mockReturnValue(() => {
211+
injectMultiFactorPhoneAuthAssertionFormSchema.mockReturnValue(() => {
212212
const { z } = require("zod");
213213
return z.object({
214214
phoneNumber: z.string().min(1, "Phone number is required"),

packages/angular/src/lib/auth/forms/mfa/sms-multi-factor-assertion-form.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { Component, ElementRef, effect, input, signal, output, computed, viewChi
1717
import { CommonModule } from "@angular/common";
1818
import { injectForm, injectStore, TanStackAppField, TanStackField } from "@tanstack/angular-form";
1919
import {
20-
injectMultiFactorPhoneAuthNumberFormSchema,
20+
injectMultiFactorPhoneAuthAssertionFormSchema,
2121
injectMultiFactorPhoneAuthVerifyFormSchema,
2222
injectRecaptchaVerifier,
2323
injectTranslation,
@@ -67,7 +67,7 @@ type PhoneMultiFactorInfo = MultiFactorInfo & {
6767
})
6868
export class SmsMultiFactorAssertionPhoneFormComponent {
6969
private ui = injectUI();
70-
private formSchema = injectMultiFactorPhoneAuthNumberFormSchema();
70+
private formSchema = injectMultiFactorPhoneAuthAssertionFormSchema();
7171

7272
hint = input.required<MultiFactorInfo>();
7373
onSubmit = output<string>();

0 commit comments

Comments
 (0)