@firebase-oss/ui-react 0.0.2-exp.c228b3f → 0.0.2-exp.cfc61d6
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/LICENSE +202 -0
- package/README.md +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -1
- package/dist/index.d.ts +23 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +37 -38
package/dist/index.d.cts
CHANGED
|
@@ -1238,6 +1238,28 @@ declare function TwitterSignInButton({ provider, ...props }: TwitterSignInButton
|
|
|
1238
1238
|
*/
|
|
1239
1239
|
declare function TwitterLogo({ className, ...props }: React.SVGProps<SVGSVGElement>): react_jsx_runtime.JSX.Element;
|
|
1240
1240
|
|
|
1241
|
+
/** Props for the YahooSignInButton component. */
|
|
1242
|
+
type YahooSignInButtonProps = {
|
|
1243
|
+
/** Optional OAuth provider instance. Defaults to Yahoo provider. */
|
|
1244
|
+
provider?: OAuthProvider;
|
|
1245
|
+
/** Whether to apply themed styling. */
|
|
1246
|
+
themed?: boolean;
|
|
1247
|
+
/** Callback function called when sign-in is successful. */
|
|
1248
|
+
onSignIn?: (credential: UserCredential) => void;
|
|
1249
|
+
};
|
|
1250
|
+
/**
|
|
1251
|
+
* A button component for signing in with Yahoo.
|
|
1252
|
+
*
|
|
1253
|
+
* @returns The Yahoo sign-in button component.
|
|
1254
|
+
*/
|
|
1255
|
+
declare function YahooSignInButton({ provider, ...props }: YahooSignInButtonProps): react_jsx_runtime.JSX.Element;
|
|
1256
|
+
/**
|
|
1257
|
+
* The Yahoo logo SVG component.
|
|
1258
|
+
*
|
|
1259
|
+
* @returns The Yahoo logo component.
|
|
1260
|
+
*/
|
|
1261
|
+
declare function YahooLogo({ className, ...props }: React.SVGProps<SVGSVGElement>): react_jsx_runtime.JSX.Element;
|
|
1262
|
+
|
|
1241
1263
|
/** Props for the OAuthButton component. */
|
|
1242
1264
|
type OAuthButtonProps = PropsWithChildren<{
|
|
1243
1265
|
/** The authentication provider to sign in with. */
|
|
@@ -4070,4 +4092,4 @@ declare function useMultiFactorTotpAuthVerifyFormSchema(): zod.ZodObject<{
|
|
|
4070
4092
|
*/
|
|
4071
4093
|
declare function useRecaptchaVerifier(ref: React.RefObject<HTMLDivElement | null>): RecaptchaVerifier | null;
|
|
4072
4094
|
|
|
4073
|
-
export { AppleLogo, AppleSignInButton, type AppleSignInButtonProps, Button, type ButtonProps, Card, CardContent, CardHeader, type CardProps, CardSubtitle, CardTitle, CountrySelector, type CountrySelectorProps, type CountrySelectorRef, Divider, type DividerProps, EmailLinkAuthForm, type EmailLinkAuthFormProps, EmailLinkAuthScreen, type EmailLinkAuthScreenProps, FacebookLogo, FacebookSignInButton, type FacebookSignInButtonProps, FirebaseUIProvider, type FirebaseUIProviderProps, ForgotPasswordAuthForm, type ForgotPasswordAuthFormProps, ForgotPasswordAuthScreen, type ForgotPasswordAuthScreenProps, GitHubLogo, GitHubSignInButton, type GitHubSignInButtonProps, GoogleLogo, GoogleSignInButton, type GoogleSignInButtonProps, MicrosoftLogo, MicrosoftSignInButton, type MicrosoftSignInButtonProps, MultiFactorAuthAssertionForm, type MultiFactorAuthAssertionFormProps, MultiFactorAuthAssertionScreen, type MultiFactorAuthAssertionScreenProps, MultiFactorAuthEnrollmentForm, type MultiFactorAuthEnrollmentFormProps, MultiFactorAuthEnrollmentScreen, type MultiFactorAuthEnrollmentScreenProps, MultiFactorEnrollmentVerifyPhoneNumberForm, MultiFactorEnrollmentVerifyTotpForm, OAuthButton, type OAuthButtonProps, OAuthScreen, type OAuthScreenProps, PhoneAuthForm, type PhoneAuthFormProps, PhoneAuthScreen, type PhoneAuthScreenProps, Policies, PolicyContext, type PolicyProps, type PolicyURL, RedirectError, SignInAuthForm, type SignInAuthFormProps, SignInAuthScreen, type SignInAuthScreenProps, SignUpAuthForm, type SignUpAuthFormProps, SignUpAuthScreen, type SignUpAuthScreenProps, SmsMultiFactorAssertionForm, type SmsMultiFactorAssertionFormProps, SmsMultiFactorEnrollmentForm, type SmsMultiFactorEnrollmentFormProps, TotpMultiFactorAssertionForm, type TotpMultiFactorAssertionFormProps, TotpMultiFactorEnrollmentForm, type TotpMultiFactorEnrollmentFormProps, TwitterLogo, TwitterSignInButton, type TwitterSignInButtonProps, type UseSmsMultiFactorEnrollmentPhoneNumberForm, type UseTotpMultiFactorAssertionForm, type UseTotpMultiFactorEnrollmentForm, form, useCountries, useDefaultCountry, useEmailLinkAuthForm, useEmailLinkAuthFormAction, useEmailLinkAuthFormCompleteSignIn, useEmailLinkAuthFormSchema, useForgotPasswordAuthForm, useForgotPasswordAuthFormAction, useForgotPasswordAuthFormSchema, useMultiFactorAssertionCleanup, useMultiFactorEnrollmentVerifyPhoneNumberForm, useMultiFactorEnrollmentVerifyPhoneNumberFormAction, useMultiFactorEnrollmentVerifyTotpForm, useMultiFactorEnrollmentVerifyTotpFormAction, useMultiFactorPhoneAuthNumberFormSchema, useMultiFactorPhoneAuthVerifyFormSchema, useMultiFactorTotpAuthNumberFormSchema, useMultiFactorTotpAuthVerifyFormSchema, useOnUserAuthenticated, usePhoneAuthNumberFormSchema, usePhoneAuthVerifyFormSchema, usePhoneNumberForm, usePhoneNumberFormAction, useRecaptchaVerifier, useRedirectError, useRequireDisplayName, useSignInAuthForm, useSignInAuthFormAction, useSignInAuthFormSchema, useSignInWithProvider, useSignUpAuthForm, useSignUpAuthFormAction, useSignUpAuthFormSchema, useSmsMultiFactorAssertionPhoneFormAction, useSmsMultiFactorAssertionVerifyFormAction, useSmsMultiFactorEnrollmentPhoneAuthFormAction, useSmsMultiFactorEnrollmentPhoneNumberForm, useTotpMultiFactorAssertionForm, useTotpMultiFactorAssertionFormAction, useTotpMultiFactorSecretGenerationForm, useTotpMultiFactorSecretGenerationFormAction, useUI, useVerifyPhoneNumberForm, useVerifyPhoneNumberFormAction };
|
|
4095
|
+
export { AppleLogo, AppleSignInButton, type AppleSignInButtonProps, Button, type ButtonProps, Card, CardContent, CardHeader, type CardProps, CardSubtitle, CardTitle, CountrySelector, type CountrySelectorProps, type CountrySelectorRef, Divider, type DividerProps, EmailLinkAuthForm, type EmailLinkAuthFormProps, EmailLinkAuthScreen, type EmailLinkAuthScreenProps, FacebookLogo, FacebookSignInButton, type FacebookSignInButtonProps, FirebaseUIProvider, type FirebaseUIProviderProps, ForgotPasswordAuthForm, type ForgotPasswordAuthFormProps, ForgotPasswordAuthScreen, type ForgotPasswordAuthScreenProps, GitHubLogo, GitHubSignInButton, type GitHubSignInButtonProps, GoogleLogo, GoogleSignInButton, type GoogleSignInButtonProps, MicrosoftLogo, MicrosoftSignInButton, type MicrosoftSignInButtonProps, MultiFactorAuthAssertionForm, type MultiFactorAuthAssertionFormProps, MultiFactorAuthAssertionScreen, type MultiFactorAuthAssertionScreenProps, MultiFactorAuthEnrollmentForm, type MultiFactorAuthEnrollmentFormProps, MultiFactorAuthEnrollmentScreen, type MultiFactorAuthEnrollmentScreenProps, MultiFactorEnrollmentVerifyPhoneNumberForm, MultiFactorEnrollmentVerifyTotpForm, OAuthButton, type OAuthButtonProps, OAuthScreen, type OAuthScreenProps, PhoneAuthForm, type PhoneAuthFormProps, PhoneAuthScreen, type PhoneAuthScreenProps, Policies, PolicyContext, type PolicyProps, type PolicyURL, RedirectError, SignInAuthForm, type SignInAuthFormProps, SignInAuthScreen, type SignInAuthScreenProps, SignUpAuthForm, type SignUpAuthFormProps, SignUpAuthScreen, type SignUpAuthScreenProps, SmsMultiFactorAssertionForm, type SmsMultiFactorAssertionFormProps, SmsMultiFactorEnrollmentForm, type SmsMultiFactorEnrollmentFormProps, TotpMultiFactorAssertionForm, type TotpMultiFactorAssertionFormProps, TotpMultiFactorEnrollmentForm, type TotpMultiFactorEnrollmentFormProps, TwitterLogo, TwitterSignInButton, type TwitterSignInButtonProps, type UseSmsMultiFactorEnrollmentPhoneNumberForm, type UseTotpMultiFactorAssertionForm, type UseTotpMultiFactorEnrollmentForm, YahooLogo, YahooSignInButton, type YahooSignInButtonProps, form, useCountries, useDefaultCountry, useEmailLinkAuthForm, useEmailLinkAuthFormAction, useEmailLinkAuthFormCompleteSignIn, useEmailLinkAuthFormSchema, useForgotPasswordAuthForm, useForgotPasswordAuthFormAction, useForgotPasswordAuthFormSchema, useMultiFactorAssertionCleanup, useMultiFactorEnrollmentVerifyPhoneNumberForm, useMultiFactorEnrollmentVerifyPhoneNumberFormAction, useMultiFactorEnrollmentVerifyTotpForm, useMultiFactorEnrollmentVerifyTotpFormAction, useMultiFactorPhoneAuthNumberFormSchema, useMultiFactorPhoneAuthVerifyFormSchema, useMultiFactorTotpAuthNumberFormSchema, useMultiFactorTotpAuthVerifyFormSchema, useOnUserAuthenticated, usePhoneAuthNumberFormSchema, usePhoneAuthVerifyFormSchema, usePhoneNumberForm, usePhoneNumberFormAction, useRecaptchaVerifier, useRedirectError, useRequireDisplayName, useSignInAuthForm, useSignInAuthFormAction, useSignInAuthFormSchema, useSignInWithProvider, useSignUpAuthForm, useSignUpAuthFormAction, useSignUpAuthFormSchema, useSmsMultiFactorAssertionPhoneFormAction, useSmsMultiFactorAssertionVerifyFormAction, useSmsMultiFactorEnrollmentPhoneAuthFormAction, useSmsMultiFactorEnrollmentPhoneNumberForm, useTotpMultiFactorAssertionForm, useTotpMultiFactorAssertionFormAction, useTotpMultiFactorSecretGenerationForm, useTotpMultiFactorSecretGenerationFormAction, useUI, useVerifyPhoneNumberForm, useVerifyPhoneNumberFormAction };
|
package/dist/index.d.ts
CHANGED
|
@@ -1238,6 +1238,28 @@ declare function TwitterSignInButton({ provider, ...props }: TwitterSignInButton
|
|
|
1238
1238
|
*/
|
|
1239
1239
|
declare function TwitterLogo({ className, ...props }: React.SVGProps<SVGSVGElement>): react_jsx_runtime.JSX.Element;
|
|
1240
1240
|
|
|
1241
|
+
/** Props for the YahooSignInButton component. */
|
|
1242
|
+
type YahooSignInButtonProps = {
|
|
1243
|
+
/** Optional OAuth provider instance. Defaults to Yahoo provider. */
|
|
1244
|
+
provider?: OAuthProvider;
|
|
1245
|
+
/** Whether to apply themed styling. */
|
|
1246
|
+
themed?: boolean;
|
|
1247
|
+
/** Callback function called when sign-in is successful. */
|
|
1248
|
+
onSignIn?: (credential: UserCredential) => void;
|
|
1249
|
+
};
|
|
1250
|
+
/**
|
|
1251
|
+
* A button component for signing in with Yahoo.
|
|
1252
|
+
*
|
|
1253
|
+
* @returns The Yahoo sign-in button component.
|
|
1254
|
+
*/
|
|
1255
|
+
declare function YahooSignInButton({ provider, ...props }: YahooSignInButtonProps): react_jsx_runtime.JSX.Element;
|
|
1256
|
+
/**
|
|
1257
|
+
* The Yahoo logo SVG component.
|
|
1258
|
+
*
|
|
1259
|
+
* @returns The Yahoo logo component.
|
|
1260
|
+
*/
|
|
1261
|
+
declare function YahooLogo({ className, ...props }: React.SVGProps<SVGSVGElement>): react_jsx_runtime.JSX.Element;
|
|
1262
|
+
|
|
1241
1263
|
/** Props for the OAuthButton component. */
|
|
1242
1264
|
type OAuthButtonProps = PropsWithChildren<{
|
|
1243
1265
|
/** The authentication provider to sign in with. */
|
|
@@ -4070,4 +4092,4 @@ declare function useMultiFactorTotpAuthVerifyFormSchema(): zod.ZodObject<{
|
|
|
4070
4092
|
*/
|
|
4071
4093
|
declare function useRecaptchaVerifier(ref: React.RefObject<HTMLDivElement | null>): RecaptchaVerifier | null;
|
|
4072
4094
|
|
|
4073
|
-
export { AppleLogo, AppleSignInButton, type AppleSignInButtonProps, Button, type ButtonProps, Card, CardContent, CardHeader, type CardProps, CardSubtitle, CardTitle, CountrySelector, type CountrySelectorProps, type CountrySelectorRef, Divider, type DividerProps, EmailLinkAuthForm, type EmailLinkAuthFormProps, EmailLinkAuthScreen, type EmailLinkAuthScreenProps, FacebookLogo, FacebookSignInButton, type FacebookSignInButtonProps, FirebaseUIProvider, type FirebaseUIProviderProps, ForgotPasswordAuthForm, type ForgotPasswordAuthFormProps, ForgotPasswordAuthScreen, type ForgotPasswordAuthScreenProps, GitHubLogo, GitHubSignInButton, type GitHubSignInButtonProps, GoogleLogo, GoogleSignInButton, type GoogleSignInButtonProps, MicrosoftLogo, MicrosoftSignInButton, type MicrosoftSignInButtonProps, MultiFactorAuthAssertionForm, type MultiFactorAuthAssertionFormProps, MultiFactorAuthAssertionScreen, type MultiFactorAuthAssertionScreenProps, MultiFactorAuthEnrollmentForm, type MultiFactorAuthEnrollmentFormProps, MultiFactorAuthEnrollmentScreen, type MultiFactorAuthEnrollmentScreenProps, MultiFactorEnrollmentVerifyPhoneNumberForm, MultiFactorEnrollmentVerifyTotpForm, OAuthButton, type OAuthButtonProps, OAuthScreen, type OAuthScreenProps, PhoneAuthForm, type PhoneAuthFormProps, PhoneAuthScreen, type PhoneAuthScreenProps, Policies, PolicyContext, type PolicyProps, type PolicyURL, RedirectError, SignInAuthForm, type SignInAuthFormProps, SignInAuthScreen, type SignInAuthScreenProps, SignUpAuthForm, type SignUpAuthFormProps, SignUpAuthScreen, type SignUpAuthScreenProps, SmsMultiFactorAssertionForm, type SmsMultiFactorAssertionFormProps, SmsMultiFactorEnrollmentForm, type SmsMultiFactorEnrollmentFormProps, TotpMultiFactorAssertionForm, type TotpMultiFactorAssertionFormProps, TotpMultiFactorEnrollmentForm, type TotpMultiFactorEnrollmentFormProps, TwitterLogo, TwitterSignInButton, type TwitterSignInButtonProps, type UseSmsMultiFactorEnrollmentPhoneNumberForm, type UseTotpMultiFactorAssertionForm, type UseTotpMultiFactorEnrollmentForm, form, useCountries, useDefaultCountry, useEmailLinkAuthForm, useEmailLinkAuthFormAction, useEmailLinkAuthFormCompleteSignIn, useEmailLinkAuthFormSchema, useForgotPasswordAuthForm, useForgotPasswordAuthFormAction, useForgotPasswordAuthFormSchema, useMultiFactorAssertionCleanup, useMultiFactorEnrollmentVerifyPhoneNumberForm, useMultiFactorEnrollmentVerifyPhoneNumberFormAction, useMultiFactorEnrollmentVerifyTotpForm, useMultiFactorEnrollmentVerifyTotpFormAction, useMultiFactorPhoneAuthNumberFormSchema, useMultiFactorPhoneAuthVerifyFormSchema, useMultiFactorTotpAuthNumberFormSchema, useMultiFactorTotpAuthVerifyFormSchema, useOnUserAuthenticated, usePhoneAuthNumberFormSchema, usePhoneAuthVerifyFormSchema, usePhoneNumberForm, usePhoneNumberFormAction, useRecaptchaVerifier, useRedirectError, useRequireDisplayName, useSignInAuthForm, useSignInAuthFormAction, useSignInAuthFormSchema, useSignInWithProvider, useSignUpAuthForm, useSignUpAuthFormAction, useSignUpAuthFormSchema, useSmsMultiFactorAssertionPhoneFormAction, useSmsMultiFactorAssertionVerifyFormAction, useSmsMultiFactorEnrollmentPhoneAuthFormAction, useSmsMultiFactorEnrollmentPhoneNumberForm, useTotpMultiFactorAssertionForm, useTotpMultiFactorAssertionFormAction, useTotpMultiFactorSecretGenerationForm, useTotpMultiFactorSecretGenerationFormAction, useUI, useVerifyPhoneNumberForm, useVerifyPhoneNumberFormAction };
|
|
4095
|
+
export { AppleLogo, AppleSignInButton, type AppleSignInButtonProps, Button, type ButtonProps, Card, CardContent, CardHeader, type CardProps, CardSubtitle, CardTitle, CountrySelector, type CountrySelectorProps, type CountrySelectorRef, Divider, type DividerProps, EmailLinkAuthForm, type EmailLinkAuthFormProps, EmailLinkAuthScreen, type EmailLinkAuthScreenProps, FacebookLogo, FacebookSignInButton, type FacebookSignInButtonProps, FirebaseUIProvider, type FirebaseUIProviderProps, ForgotPasswordAuthForm, type ForgotPasswordAuthFormProps, ForgotPasswordAuthScreen, type ForgotPasswordAuthScreenProps, GitHubLogo, GitHubSignInButton, type GitHubSignInButtonProps, GoogleLogo, GoogleSignInButton, type GoogleSignInButtonProps, MicrosoftLogo, MicrosoftSignInButton, type MicrosoftSignInButtonProps, MultiFactorAuthAssertionForm, type MultiFactorAuthAssertionFormProps, MultiFactorAuthAssertionScreen, type MultiFactorAuthAssertionScreenProps, MultiFactorAuthEnrollmentForm, type MultiFactorAuthEnrollmentFormProps, MultiFactorAuthEnrollmentScreen, type MultiFactorAuthEnrollmentScreenProps, MultiFactorEnrollmentVerifyPhoneNumberForm, MultiFactorEnrollmentVerifyTotpForm, OAuthButton, type OAuthButtonProps, OAuthScreen, type OAuthScreenProps, PhoneAuthForm, type PhoneAuthFormProps, PhoneAuthScreen, type PhoneAuthScreenProps, Policies, PolicyContext, type PolicyProps, type PolicyURL, RedirectError, SignInAuthForm, type SignInAuthFormProps, SignInAuthScreen, type SignInAuthScreenProps, SignUpAuthForm, type SignUpAuthFormProps, SignUpAuthScreen, type SignUpAuthScreenProps, SmsMultiFactorAssertionForm, type SmsMultiFactorAssertionFormProps, SmsMultiFactorEnrollmentForm, type SmsMultiFactorEnrollmentFormProps, TotpMultiFactorAssertionForm, type TotpMultiFactorAssertionFormProps, TotpMultiFactorEnrollmentForm, type TotpMultiFactorEnrollmentFormProps, TwitterLogo, TwitterSignInButton, type TwitterSignInButtonProps, type UseSmsMultiFactorEnrollmentPhoneNumberForm, type UseTotpMultiFactorAssertionForm, type UseTotpMultiFactorEnrollmentForm, YahooLogo, YahooSignInButton, type YahooSignInButtonProps, form, useCountries, useDefaultCountry, useEmailLinkAuthForm, useEmailLinkAuthFormAction, useEmailLinkAuthFormCompleteSignIn, useEmailLinkAuthFormSchema, useForgotPasswordAuthForm, useForgotPasswordAuthFormAction, useForgotPasswordAuthFormSchema, useMultiFactorAssertionCleanup, useMultiFactorEnrollmentVerifyPhoneNumberForm, useMultiFactorEnrollmentVerifyPhoneNumberFormAction, useMultiFactorEnrollmentVerifyTotpForm, useMultiFactorEnrollmentVerifyTotpFormAction, useMultiFactorPhoneAuthNumberFormSchema, useMultiFactorPhoneAuthVerifyFormSchema, useMultiFactorTotpAuthNumberFormSchema, useMultiFactorTotpAuthVerifyFormSchema, useOnUserAuthenticated, usePhoneAuthNumberFormSchema, usePhoneAuthVerifyFormSchema, usePhoneNumberForm, usePhoneNumberFormAction, useRecaptchaVerifier, useRedirectError, useRequireDisplayName, useSignInAuthForm, useSignInAuthFormAction, useSignInAuthFormSchema, useSignInWithProvider, useSignUpAuthForm, useSignUpAuthFormAction, useSignUpAuthFormSchema, useSmsMultiFactorAssertionPhoneFormAction, useSmsMultiFactorAssertionVerifyFormAction, useSmsMultiFactorEnrollmentPhoneAuthFormAction, useSmsMultiFactorEnrollmentPhoneNumberForm, useTotpMultiFactorAssertionForm, useTotpMultiFactorAssertionFormAction, useTotpMultiFactorSecretGenerationForm, useTotpMultiFactorSecretGenerationFormAction, useUI, useVerifyPhoneNumberForm, useVerifyPhoneNumberFormAction };
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {registerFramework,getBehavior,getTranslation,createSignInAuthFormSchema,createSignUpAuthFormSchema,createForgotPasswordAuthFormSchema,createEmailLinkAuthFormSchema,createPhoneAuthNumberFormSchema,createPhoneAuthVerifyFormSchema,createMultiFactorPhoneAuthNumberFormSchema,createMultiFactorPhoneAuthVerifyFormSchema,createMultiFactorTotpAuthNumberFormSchema,createMultiFactorTotpAuthVerifyFormSchema,sendSignInLinkToEmail,FirebaseUIError,completeEmailLinkSignIn,sendPasswordResetEmail,signInWithMultiFactorAssertion,verifyPhoneNumber,enrollWithMultiFactorAssertion,generateTotpSecret,generateTotpQrCode,confirmPhoneNumber,signInWithEmailAndPassword,hasBehavior,createUserWithEmailAndPassword,signInWithProvider,formatPhoneNumber}from'@firebase-oss/ui-core';import {createContext,forwardRef,useState,useCallback,useImperativeHandle,useContext,cloneElement,useEffect,useMemo,useRef}from'react';import {useStore}from'@nanostores/react';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {createFormHookContexts,createFormHook}from'@tanstack/react-form';import {Slot}from'@radix-ui/react-slot';import {buttonVariant}from'@firebase-oss/ui-styles';import {twMerge}from'tailwind-merge';import {clsx}from'clsx';import {FactorId,TotpMultiFactorGenerator,PhoneAuthProvider,PhoneMultiFactorGenerator,multiFactor,OAuthProvider,FacebookAuthProvider,GithubAuthProvider,GoogleAuthProvider,TwitterAuthProvider}from'firebase/auth';var
|
|
1
|
+
import {registerFramework,getBehavior,getTranslation,createSignInAuthFormSchema,createSignUpAuthFormSchema,createForgotPasswordAuthFormSchema,createEmailLinkAuthFormSchema,createPhoneAuthNumberFormSchema,createPhoneAuthVerifyFormSchema,createMultiFactorPhoneAuthNumberFormSchema,createMultiFactorPhoneAuthVerifyFormSchema,createMultiFactorTotpAuthNumberFormSchema,createMultiFactorTotpAuthVerifyFormSchema,sendSignInLinkToEmail,FirebaseUIError,completeEmailLinkSignIn,sendPasswordResetEmail,signInWithMultiFactorAssertion,verifyPhoneNumber,enrollWithMultiFactorAssertion,generateTotpSecret,generateTotpQrCode,confirmPhoneNumber,signInWithEmailAndPassword,hasBehavior,createUserWithEmailAndPassword,signInWithProvider,formatPhoneNumber}from'@firebase-oss/ui-core';import {createContext,forwardRef,useState,useCallback,useImperativeHandle,useContext,cloneElement,useEffect,useMemo,useRef}from'react';import {useStore}from'@nanostores/react';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {createFormHookContexts,createFormHook}from'@tanstack/react-form';import {Slot}from'@radix-ui/react-slot';import {buttonVariant}from'@firebase-oss/ui-styles';import {twMerge}from'tailwind-merge';import {clsx}from'clsx';import {FactorId,TotpMultiFactorGenerator,PhoneAuthProvider,PhoneMultiFactorGenerator,multiFactor,OAuthProvider,FacebookAuthProvider,GithubAuthProvider,GoogleAuthProvider,TwitterAuthProvider}from'firebase/auth';var rr={version:"0.0.2-exp.cfc61d6"};var At=createContext(void 0);function or({children:t,policies:e}){return jsx(At.Provider,{value:e,children:t})}function A(){let t=s(),e=useContext(At);if(!e)return null;let{termsOfServiceUrl:r,privacyPolicyUrl:o,onNavigate:n}=e,a=getTranslation(t,"messages","termsAndPrivacy").split(/(\{tos\}|\{privacy\})/),C=n?jsx("button",{}):jsx("a",{target:"_blank",rel:"noopener noreferrer"});return jsx("div",{className:"fui-policies",children:a.map((v,T)=>v==="{tos}"?cloneElement(C,{key:T,onClick:n?()=>n(r):void 0,href:n?void 0:r,children:getTranslation(t,"labels","termsOfService")}):v==="{privacy}"?cloneElement(C,{key:T,onClick:n?()=>n(o):void 0,href:n?void 0:o,children:getTranslation(t,"labels","privacyPolicy")}):jsx("span",{children:v},T))})}var Pt=createContext(null);function De({children:t,ui:e,policies:r}){let o=useStore(e);return jsx(Pt.Provider,{value:o,children:jsx(or,{policies:r,children:t})})}function s(){let t=useContext(Pt);if(!t)throw new Error(`No FirebaseUI context found. Your application must be wrapped in a FirebaseUIProvider:
|
|
2
2
|
|
|
3
3
|
const ui = initializeUI(...);
|
|
4
4
|
|
|
5
5
|
<FirebaseUIProvider ui={ui}>
|
|
6
6
|
<App />
|
|
7
7
|
</FirebaseUIProvider>
|
|
8
|
-
`);return t}function N(t){let r=s().auth;useEffect(()=>r.onAuthStateChanged(o=>{o&&!o.isAnonymous&&t?.(o);}),[r,t]);}function ir(){let t=s();return useMemo(()=>{if(t.redirectError)return t.redirectError instanceof Error?t.redirectError.message:String(t.redirectError)},[t.redirectError])}function sr(){let t=s();return useMemo(()=>createSignInAuthFormSchema(t),[t])}function ar(){let t=s();return useMemo(()=>createSignUpAuthFormSchema(t),[t])}function ur(){let t=s();return useMemo(()=>createForgotPasswordAuthFormSchema(t),[t])}function mr(){let t=s();return useMemo(()=>createEmailLinkAuthFormSchema(t),[t])}function cr(){let t=s();return useMemo(()=>createPhoneAuthNumberFormSchema(t),[t])}function lr(){let t=s();return useMemo(()=>createPhoneAuthVerifyFormSchema(t),[t])}function pr(){let t=s();return useMemo(()=>createMultiFactorPhoneAuthNumberFormSchema(t),[t])}function ct(){let t=s();return useMemo(()=>createMultiFactorPhoneAuthVerifyFormSchema(t),[t])}function fr(){let t=s();return useMemo(()=>createMultiFactorTotpAuthNumberFormSchema(t),[t])}function lt(){let t=s();return useMemo(()=>createMultiFactorTotpAuthVerifyFormSchema(t),[t])}function W(t){let e=s(),r=useRef(null),o=useRef(e),n=useRef(null);return o.current=e,useEffect(()=>{let i=t.current,a=o.current;i!==n.current&&(n.current=i,i?(r.current=getBehavior(a,"recaptchaVerification")(a,i),r.current.render()):r.current=null);},[t]),r.current}function u(...t){return twMerge(clsx(...t))}function x({className:t,variant:e="primary",asChild:r,...o}){return jsx(r?Slot:"button",{className:u(buttonVariant({variant:e}),t),...o})}var{fieldContext:oo,useFieldContext:no,formContext:io,useFormContext:dr}=createFormHookContexts();function so({className:t,...e}){return !e.field.state.meta.isTouched||!e.field.state.meta.errors.length?null:jsx("div",{children:jsx("div",{role:"alert","aria-live":"polite",className:u("fui-error",t),...e,children:e.field.state.meta.errors.map(r=>r.message).join(", ")})})}function ao({children:t,before:e,label:r,action:o,description:n,...i}){let a=no();return jsxs("label",{htmlFor:a.name,children:[jsxs("div",{"data-input-label":true,children:[jsx("div",{children:r}),o?jsx("div",{children:o}):null]}),n?jsx("div",{"data-input-description":true,children:n}):null,jsxs("div",{"data-input-group":true,children:[e,jsx("input",{...i,"aria-invalid":a.state.meta.isTouched&&a.state.meta.errors.length>0,id:a.name,name:a.name,value:a.state.value,onBlur:()=>{a.handleBlur();},onChange:C=>{a.handleChange(C.target.value);}})]}),t?jsx(Fragment,{children:t}):null,jsx(so,{field:a})]})}function uo({className:t,...e}){return jsx("button",{type:"button",...e,className:u("fui-form__action",t)})}function mo(t){let e=dr();return jsx(e.Subscribe,{selector:r=>r.isSubmitting,children:r=>jsx(x,{...t,type:"submit",disabled:r})})}function co(){let t=dr();return jsx(t.Subscribe,{selector:e=>[e.errorMap],children:([e])=>e?.onSubmit&&typeof e.onSubmit=="string"?jsx("div",{className:"fui-error",children:e.onSubmit}):null})}var m=createFormHook({fieldComponents:{Input:ao},formComponents:{SubmitButton:mo,ErrorMessage:co,Action:uo},fieldContext:oo,formContext:io});function Fr(){let t=s();return useCallback(async({email:e})=>{try{return await sendSignInLinkToEmail(t,e)}catch(r){throw r instanceof FirebaseUIError?new Error(r.message):(console.error(r),new Error(getTranslation(t,"errors","unknownError")))}},[t])}function Sr(t){let e=mr(),r=Fr();return m.useAppForm({defaultValues:{email:""},validators:{onBlur:e,onSubmitAsync:async({value:o})=>{try{return await r(o),t?.()}catch(n){return n instanceof Error?n.message:String(n)}}}})}function gr(t){let e=s();useEffect(()=>{(async()=>{let o=await completeEmailLinkSignIn(e,window.location.href);o&&t?.(o);})();},[t]);}function It({onEmailSent:t,onSignIn:e}){let r=s(),[o,n]=useState(false),i=Sr(()=>{n(!0),t?.();});return gr(e),o?jsx("div",{className:"fui-success",children:getTranslation(r,"messages","signInLinkSent")}):jsx("form",{className:"fui-form",onSubmit:async a=>{a.preventDefault(),a.stopPropagation(),await i.handleSubmit();},children:jsxs(i.AppForm,{children:[jsx("fieldset",{children:jsx(i.AppField,{name:"email",children:a=>jsx(a.Input,{label:getTranslation(r,"labels","emailAddress"),type:"email"})})}),jsx(A,{}),jsxs("fieldset",{children:[jsx(i.SubmitButton,{children:getTranslation(r,"labels","sendSignInLink")}),jsx(i.ErrorMessage,{})]})]})})}function yr(){let t=s();return useCallback(async({email:e})=>{try{return await sendPasswordResetEmail(t,e)}catch(r){throw r instanceof FirebaseUIError?new Error(r.message):(console.error(r),new Error(getTranslation(t,"errors","unknownError")))}},[t])}function Ar(t){let e=ur(),r=yr();return m.useAppForm({defaultValues:{email:""},validators:{onBlur:e,onSubmitAsync:async({value:o})=>{try{return await r(o),t?.()}catch(n){return n instanceof Error?n.message:String(n)}}}})}function Mt({onBackToSignInClick:t,onPasswordSent:e}){let r=s(),[o,n]=useState(false),i=Ar(()=>{n(!0),e?.();});return o?jsx("div",{className:"fui-success",children:getTranslation(r,"messages","checkEmailForReset")}):jsx("form",{className:"fui-form",onSubmit:async a=>{a.preventDefault(),a.stopPropagation(),await i.handleSubmit();},children:jsxs(i.AppForm,{children:[jsx("fieldset",{children:jsx(i.AppField,{name:"email",children:a=>jsx(a.Input,{label:getTranslation(r,"labels","emailAddress"),type:"email"})})}),jsx(A,{}),jsxs("fieldset",{children:[jsx(i.SubmitButton,{children:getTranslation(r,"labels","resetPassword")}),jsx(i.ErrorMessage,{})]}),t?jsxs(i.Action,{onClick:t,children:["\u2190 ",getTranslation(r,"labels","backToSignIn")]}):null]})})}function Pr(){let t=s();return useCallback(async({verificationCode:e,hint:r})=>{let o=TotpMultiFactorGenerator.assertionForSignIn(r.uid,e);return await signInWithMultiFactorAssertion(t,o)},[t])}function br({hint:t,onSuccess:e}){let r=Pr(),o=lt();return m.useAppForm({defaultValues:{verificationCode:""},validators:{onBlur:o,onSubmitAsync:async({value:n})=>{try{let i=await r({verificationCode:n.verificationCode,hint:t});return e(i)}catch(i){return i instanceof FirebaseUIError?i.message:String(i)}}}})}function wt(t){let e=s(),r=br({hint:t.hint,onSuccess:o=>{t.onSuccess?.(o);}});return jsx("form",{className:"fui-form",onSubmit:async o=>{o.preventDefault(),o.stopPropagation(),await r.handleSubmit();},children:jsxs(r.AppForm,{children:[jsx("fieldset",{children:jsx(r.AppField,{name:"verificationCode",children:o=>jsx(o.Input,{description:getTranslation(e,"prompts","enterVerificationCode"),label:getTranslation(e,"labels","verificationCode"),type:"text",placeholder:"123456",maxLength:6})})}),jsxs("fieldset",{children:[jsx(r.SubmitButton,{children:getTranslation(e,"labels","verifyCode")}),jsx(r.ErrorMessage,{})]})]})})}function xr(){let t=s();return useCallback(async({hint:e,recaptchaVerifier:r})=>await verifyPhoneNumber(t,"",r,void 0,e),[t])}function Vo({hint:t,recaptchaVerifier:e,onSuccess:r}){let o=xr();return m.useAppForm({validators:{onSubmitAsync:async()=>{try{let n=await o({hint:t,recaptchaVerifier:e});return r(n)}catch(n){return n instanceof FirebaseUIError?n.message:String(n)}}}})}function Bo(t){let e=s(),r=useRef(null),o=W(r),n=Vo({hint:t.hint,recaptchaVerifier:o,onSuccess:t.onSubmit});return jsx("form",{className:"fui-form",onSubmit:async i=>{i.preventDefault(),i.stopPropagation(),await n.handleSubmit();},children:jsxs(n.AppForm,{children:[jsx("fieldset",{children:jsx("label",{children:jsx("div",{"data-input-description":true,children:getTranslation(e,"messages","mfaSmsAssertionPrompt",{phoneNumber:t.hint.phoneNumber||""})})})}),jsx("fieldset",{children:jsx("div",{className:"fui-recaptcha-container",ref:r})}),jsxs("fieldset",{children:[jsx(n.SubmitButton,{children:getTranslation(e,"labels","sendCode")}),jsx(n.ErrorMessage,{})]})]})})}function Mr(){let t=s();return useCallback(async({verificationId:e,verificationCode:r})=>{let o=PhoneAuthProvider.credential(e,r),n=PhoneMultiFactorGenerator.assertion(o);return await signInWithMultiFactorAssertion(t,n)},[t])}function ko({verificationId:t,onSuccess:e}){let r=Mr(),o=ct();return m.useAppForm({defaultValues:{verificationId:t,verificationCode:""},validators:{onBlur:o,onSubmitAsync:async({value:n})=>{try{let i=await r(n);return e(i)}catch(i){return i instanceof FirebaseUIError?i.message:String(i)}}}})}function Ro(t){let e=s(),r=ko({verificationId:t.verificationId,onSuccess:t.onSuccess});return jsx("form",{className:"fui-form",onSubmit:async o=>{o.preventDefault(),o.stopPropagation(),await r.handleSubmit();},children:jsxs(r.AppForm,{children:[jsx("fieldset",{children:jsx(r.AppField,{name:"verificationCode",children:o=>jsx(o.Input,{label:getTranslation(e,"labels","verificationCode"),type:"text",description:getTranslation(e,"prompts","smsVerificationPrompt")})})}),jsxs("fieldset",{children:[jsx(r.SubmitButton,{children:getTranslation(e,"labels","verifyCode")}),jsx(r.ErrorMessage,{})]})]})})}function Nt(t){let[e,r]=useState(null);return e?jsx(Ro,{verificationId:e.verificationId,onSuccess:o=>{t.onSuccess?.(o);}}):jsx(Bo,{hint:t.hint,onSubmit:o=>r({verificationId:o})})}function Nr(){let t=s();useEffect(()=>()=>{t.setMultiFactorResolver();},[]);}function Tt(t){let e=s(),r=e.multiFactorResolver,o=getTranslation(e,"prompts","mfaAssertionFactorPrompt");if(Nr(),!r)throw new Error("MultiFactorAuthAssertionForm requires a multi-factor resolver");let[n,i]=useState(r.hints.length===1?r.hints[0]:void 0);if(n){if(n.factorId===PhoneMultiFactorGenerator.FACTOR_ID)return jsx(Nt,{hint:n,onSuccess:a=>{t.onSuccess?.(a);}});if(n.factorId===TotpMultiFactorGenerator.FACTOR_ID)return jsx(wt,{hint:n,onSuccess:a=>{t.onSuccess?.(a);}})}return jsxs("div",{className:"fui-content",children:[jsx("p",{children:o}),r.hints.map(a=>a.factorId===TotpMultiFactorGenerator.FACTOR_ID?jsx(_o,{onClick:()=>i(a)},a.factorId):a.factorId===PhoneMultiFactorGenerator.FACTOR_ID?jsx(Do,{onClick:()=>i(a)},a.factorId):null)]})}function _o(t){let e=s(),r=getTranslation(e,"labels","mfaTotpVerification");return jsx(x,{...t,children:r})}function Do(t){let e=s(),r=getTranslation(e,"labels","mfaSmsVerification");return jsx(x,{...t,children:r})}function Tr(){let t=s();return getBehavior(t,"countryCodes")().allowedCountries}function Vr(){let t=s();return getBehavior(t,"countryCodes")().defaultCountry}var q=forwardRef(({className:t,...e},r)=>{let o=Tr(),n=Vr(),[i,a]=useState(n),C=useCallback(y=>{let T=o.find(yt=>yt.code===y);a(T);},[o]);return useImperativeHandle(r,()=>({getCountry:()=>i,setCountry:C}),[i,C]),jsx("div",{className:u("fui-country-selector",t),...e,children:jsxs("div",{className:"fui-country-selector__wrapper",children:[jsx("span",{className:"fui-country-selector__flag",children:i.emoji}),jsxs("div",{className:"fui-country-selector__select-wrapper",children:[jsx("span",{className:"fui-country-selector__dial-code",children:i.dialCode}),jsx("select",{className:"fui-country-selector__select",value:i.code,onChange:y=>{let T=o.find(yt=>yt.code===y.target.value);T&&a(T);},children:o.map(y=>jsxs("option",{value:y.code,children:[y.dialCode," (",y.name,")"]},`${y.code}-${y.dialCode}`))})]})]})})});q.displayName="CountrySelector";function Gr(){let t=s();return useCallback(async({phoneNumber:e,recaptchaVerifier:r})=>{let o=multiFactor(t.auth.currentUser);return await verifyPhoneNumber(t,e,r,o)},[t])}function Lr({recaptchaVerifier:t,onSuccess:e,formatPhoneNumber:r}){let o=Gr(),n=pr();return m.useAppForm({defaultValues:{displayName:"",phoneNumber:""},validators:{onBlur:n,onSubmitAsync:async({value:i})=>{try{let a=r?r(i.phoneNumber):i.phoneNumber,C=await o({phoneNumber:a,recaptchaVerifier:t});return e(C,i.displayName)}catch(a){return a instanceof FirebaseUIError?a.message:String(a)}}}})}function jo(t){let e=s(),r=useRef(null),o=W(r),n=useRef(null),i=Lr({recaptchaVerifier:o,onSuccess:t.onSubmit,formatPhoneNumber:a=>formatPhoneNumber(a,n.current.getCountry())});return jsx("form",{className:"fui-form",onSubmit:async a=>{a.preventDefault(),a.stopPropagation(),await i.handleSubmit();},children:jsxs(i.AppForm,{children:[jsx("fieldset",{children:jsx(i.AppField,{name:"displayName",children:a=>jsx(a.Input,{label:getTranslation(e,"labels","displayName"),type:"text"})})}),jsx("fieldset",{children:jsx(i.AppField,{name:"phoneNumber",children:a=>jsx(a.Input,{label:getTranslation(e,"labels","phoneNumber"),type:"tel",before:jsx(q,{ref:n})})})}),jsx("fieldset",{children:jsx("div",{className:"fui-recaptcha-container",ref:r})}),jsxs("fieldset",{children:[jsx(i.SubmitButton,{children:getTranslation(e,"labels","sendCode")}),jsx(i.ErrorMessage,{})]})]})})}function _r(){let t=s();return useCallback(async({verificationId:e,verificationCode:r,displayName:o})=>{let n=PhoneAuthProvider.credential(e,r),i=PhoneMultiFactorGenerator.assertion(n);return await enrollWithMultiFactorAssertion(t,i,o)},[t])}function Dr({verificationId:t,displayName:e,onSuccess:r}){let o=ct(),n=_r();return m.useAppForm({defaultValues:{verificationId:t,verificationCode:""},validators:{onBlur:o,onSubmitAsync:async({value:i})=>{try{return await n({...i,displayName:e}),r()}catch(a){return a instanceof FirebaseUIError?a.message:String(a)}}}})}function Or(t){let e=s(),r=Dr({...t,onSuccess:t.onSuccess});return jsx("form",{className:"fui-form",onSubmit:async o=>{o.preventDefault(),o.stopPropagation(),await r.handleSubmit();},children:jsxs(r.AppForm,{children:[jsx("fieldset",{children:jsx(r.AppField,{name:"verificationCode",children:o=>jsx(o.Input,{description:getTranslation(e,"prompts","smsVerificationPrompt"),label:getTranslation(e,"labels","verificationCode"),type:"text"})})}),jsxs("fieldset",{children:[jsx(r.SubmitButton,{children:getTranslation(e,"labels","verifyCode")}),jsx(r.ErrorMessage,{})]})]})})}function Bt(t){let e=s(),[r,o]=useState(null);if(!e.auth.currentUser)throw new Error("User must be authenticated to enroll with multi-factor authentication");return r?jsx(Or,{...r,onSuccess:()=>{t.onSuccess?.();}}):jsx(jo,{onSubmit:(n,i)=>o({verificationId:n,displayName:i})})}function zr(){let t=s();return useCallback(async()=>await generateTotpSecret(t),[t])}function qr({onSuccess:t}){let e=zr(),r=fr();return m.useAppForm({defaultValues:{displayName:""},validators:{onBlur:r,onSubmitAsync:async({value:o})=>{try{let n=await e();return t(n,o.displayName)}catch(n){return n instanceof FirebaseUIError?n.message:String(n)}}}})}function sn(t){let e=s(),r=qr({onSuccess:t.onSubmit});return jsx("form",{className:"fui-form",onSubmit:async o=>{o.preventDefault(),o.stopPropagation(),await r.handleSubmit();},children:jsxs(r.AppForm,{children:[jsx("fieldset",{children:jsx(r.AppField,{name:"displayName",children:o=>jsx(o.Input,{label:getTranslation(e,"labels","displayName"),type:"text"})})}),jsxs("fieldset",{children:[jsx(r.SubmitButton,{children:getTranslation(e,"labels","generateQrCode")}),jsx(r.ErrorMessage,{})]})]})})}function $r(){let t=s();return useCallback(async({secret:e,verificationCode:r,displayName:o})=>{let n=TotpMultiFactorGenerator.assertionForEnrollment(e,r);return await enrollWithMultiFactorAssertion(t,n,o)},[t])}function Qr({secret:t,displayName:e,onSuccess:r}){let o=lt(),n=$r();return m.useAppForm({defaultValues:{verificationCode:""},validators:{onBlur:o,onSubmitAsync:async({value:i})=>{try{return await n({secret:t,verificationCode:i.verificationCode,displayName:e}),r()}catch(a){return a instanceof FirebaseUIError?a.message:String(a)}}}})}function Jr(t){let e=s(),r=Qr({...t,onSuccess:t.onSuccess}),o=generateTotpQrCode(e,t.secret,t.displayName);return jsxs("form",{className:"fui-form",onSubmit:async n=>{n.preventDefault(),n.stopPropagation(),await r.handleSubmit();},children:[jsxs("div",{className:"fui-qr-code-container",children:[jsx("img",{src:o,alt:"TOTP QR Code"}),jsx("code",{children:t.secret.secretKey.toString()}),jsx("p",{children:getTranslation(e,"prompts","mfaTotpQrCodePrompt")})]}),jsxs(r.AppForm,{children:[jsx("fieldset",{children:jsx(r.AppField,{name:"verificationCode",children:n=>jsx(n.Input,{label:getTranslation(e,"labels","verificationCode"),type:"text",description:getTranslation(e,"prompts","mfaTotpEnrollmentVerificationPrompt")})})}),jsxs("fieldset",{children:[jsx(r.SubmitButton,{children:getTranslation(e,"labels","verifyCode")}),jsx(r.ErrorMessage,{})]})]})]})}function kt(t){let e=s(),[r,o]=useState(null);if(!e.auth.currentUser)throw new Error("User must be authenticated to enroll with multi-factor authentication");return r?jsx(Jr,{...r,onSuccess:()=>{t.onSuccess?.();}}):jsx(sn,{onSubmit:(n,i)=>o({secret:n,displayName:i})})}var un=[FactorId.TOTP,FactorId.PHONE];function Rt(t){let e=t.hints??un;if(e.length===0)throw new Error("MultiFactorAuthEnrollmentForm must have at least one hint");let[r,o]=useState(e.length===1?e[0]:void 0);if(r){if(r===FactorId.TOTP)return jsx(kt,{onSuccess:t.onEnrollment});if(r===FactorId.PHONE)return jsx(Bt,{onSuccess:t.onEnrollment});throw new Error(`Unknown multi-factor enrollment type: ${r}`)}return jsx("div",{className:"fui-content",children:e.map(n=>n===FactorId.TOTP?jsx(mn,{onClick:()=>o(n)},n):n===FactorId.PHONE?jsx(cn,{onClick:()=>o(n)},n):null)})}function mn(t){let e=s(),r=getTranslation(e,"labels","mfaTotpVerification");return jsx(x,{variant:"secondary",...t,children:r})}function cn(t){let e=s(),r=getTranslation(e,"labels","mfaSmsVerification");return jsx(x,{variant:"secondary",...t,children:r})}function jr(){let t=s();return useCallback(async({phoneNumber:e,recaptchaVerifier:r})=>await verifyPhoneNumber(t,e,r),[t])}function te({recaptchaVerifier:t,onSuccess:e,formatPhoneNumber:r}){let o=jr(),n=cr();return m.useAppForm({defaultValues:{phoneNumber:""},validators:{onBlur:n,onSubmitAsync:async({value:i})=>{try{let a=r?r(i.phoneNumber):i.phoneNumber,C=await o({phoneNumber:a,recaptchaVerifier:t});return e(C)}catch(a){return a instanceof FirebaseUIError?a.message:String(a)}}}})}function hn(t){let e=s(),r=useRef(null),o=W(r),n=useRef(null),i=te({recaptchaVerifier:o,onSuccess:t.onSubmit,formatPhoneNumber:a=>formatPhoneNumber(a,n.current.getCountry())});return jsx("form",{className:"fui-form",onSubmit:async a=>{a.preventDefault(),a.stopPropagation(),await i.handleSubmit();},children:jsxs(i.AppForm,{children:[jsx("fieldset",{children:jsx(i.AppField,{name:"phoneNumber",children:a=>jsx(a.Input,{label:getTranslation(e,"labels","phoneNumber"),type:"tel",before:jsx(q,{ref:n})})})}),jsx("fieldset",{children:jsx("div",{className:"fui-recaptcha-container",ref:r})}),jsx(A,{}),jsxs("fieldset",{children:[jsx(i.SubmitButton,{children:getTranslation(e,"labels","sendCode")}),jsx(i.ErrorMessage,{})]})]})})}function re(){let t=s();return useCallback(async({verificationId:e,verificationCode:r})=>await confirmPhoneNumber(t,e,r),[t])}function ee({verificationId:t,onSuccess:e}){let r=lr(),o=re();return m.useAppForm({defaultValues:{verificationId:t,verificationCode:""},validators:{onBlur:r,onSubmitAsync:async({value:n})=>{try{let i=await o(n);return e(i)}catch(i){return i instanceof FirebaseUIError?i.message:String(i)}}}})}function Fn(t){let e=s(),r=ee({verificationId:t.verificationId,onSuccess:t.onSuccess});return jsx("form",{className:"fui-form",onSubmit:async o=>{o.preventDefault(),o.stopPropagation(),await r.handleSubmit();},children:jsxs(r.AppForm,{children:[jsx("fieldset",{children:jsx(r.AppField,{name:"verificationCode",children:o=>jsx(o.Input,{label:getTranslation(e,"labels","verificationCode"),description:getTranslation(e,"prompts","smsVerificationPrompt"),type:"text"})})}),jsxs("fieldset",{children:[jsx(r.SubmitButton,{children:getTranslation(e,"labels","verifyCode")}),jsx(r.ErrorMessage,{})]})]})})}function Gt(t){let[e,r]=useState(null);return e?jsx(Fn,{verificationId:e,onSuccess:o=>{t.onSignIn?.(o);}}):jsx(hn,{onSubmit:r})}function oe(){let t=s();return useCallback(async({email:e,password:r})=>{try{return await signInWithEmailAndPassword(t,e,r)}catch(o){throw o instanceof FirebaseUIError?new Error(o.message):(console.error(o),new Error(getTranslation(t,"errors","unknownError")))}},[t])}function ne(t){let e=sr(),r=oe();return m.useAppForm({defaultValues:{email:"",password:""},validators:{onBlur:e,onSubmitAsync:async({value:o})=>{try{let n=await r(o);return t?.(n)}catch(n){return n instanceof Error?n.message:String(n)}}}})}function _t({onSignIn:t,onForgotPasswordClick:e,onSignUpClick:r}){let o=s(),n=ne(t);return jsx("form",{className:"fui-form",onSubmit:async i=>{i.preventDefault(),i.stopPropagation(),await n.handleSubmit();},children:jsxs(n.AppForm,{children:[jsx("fieldset",{children:jsx(n.AppField,{name:"email",children:i=>jsx(i.Input,{label:getTranslation(o,"labels","emailAddress"),type:"email"})})}),jsx("fieldset",{children:jsx(n.AppField,{name:"password",children:i=>jsx(i.Input,{label:getTranslation(o,"labels","password"),type:"password",action:e?jsx(n.Action,{onClick:e,children:getTranslation(o,"labels","forgotPassword")}):null})})}),jsx(A,{}),jsxs("fieldset",{children:[jsx(n.SubmitButton,{children:getTranslation(o,"labels","signIn")}),jsx(n.ErrorMessage,{})]}),r?jsxs(n.Action,{onClick:r,children:[getTranslation(o,"prompts","noAccount")," ",getTranslation(o,"labels","signUp")]}):null]})})}function Ot(){let t=s();return hasBehavior(t,"requireDisplayName")}function ie(){let t=s();return useCallback(async({email:e,password:r,displayName:o})=>{try{return await createUserWithEmailAndPassword(t,e,r,o)}catch(n){throw n instanceof FirebaseUIError?new Error(n.message):(console.error(n),new Error(getTranslation(t,"errors","unknownError")))}},[t])}function se(t){let e=ar(),r=ie(),o=Ot();return m.useAppForm({defaultValues:{email:"",password:"",displayName:o?"":void 0},validators:{onBlur:e,onSubmitAsync:async({value:n})=>{try{let i=await r(n);return t?.(i)}catch(i){return i instanceof Error?i.message:String(i)}}}})}function Ht({onSignInClick:t,onSignUp:e}){let r=s(),o=se(e),n=Ot();return jsx("form",{className:"fui-form",onSubmit:async i=>{i.preventDefault(),i.stopPropagation(),await o.handleSubmit();},children:jsxs(o.AppForm,{children:[n?jsx("fieldset",{children:jsx(o.AppField,{name:"displayName",children:i=>jsx(i.Input,{label:getTranslation(r,"labels","displayName")})})}):null,jsx("fieldset",{children:jsx(o.AppField,{name:"email",children:i=>jsx(i.Input,{label:getTranslation(r,"labels","emailAddress"),type:"email"})})}),jsx("fieldset",{children:jsx(o.AppField,{name:"password",children:i=>jsx(i.Input,{label:getTranslation(r,"labels","password"),type:"password"})})}),jsx(A,{}),jsxs("fieldset",{children:[jsx(o.SubmitButton,{children:getTranslation(r,"labels","createAccount")}),jsx(o.ErrorMessage,{})]}),t?jsxs(o.Action,{onClick:t,children:[getTranslation(r,"prompts","haveAccount")," ",getTranslation(r,"labels","signIn")]}):null]})})}function U({className:t,children:e,...r}){return e?jsxs("div",{className:u("fui-divider",t),...r,children:[jsx("div",{className:"fui-divider__line"}),jsx("div",{className:"fui-divider__text",children:e}),jsx("div",{className:"fui-divider__line"})]}):jsx("div",{className:u("fui-divider",t),...r,children:jsx("div",{className:"fui-divider__line"})})}function p({children:t,className:e,...r}){return jsx("div",{className:u("fui-card",e),...r,children:t})}function f({children:t,className:e,...r}){return jsx("div",{className:u("fui-card__header",e),...r,children:t})}function d({children:t,className:e,...r}){return jsx("h2",{className:u("fui-card__title",e),...r,children:t})}function h({children:t,className:e,...r}){return jsx("p",{className:u("fui-card__subtitle",e),...r,children:t})}function F({children:t,className:e,...r}){return jsx("div",{className:u("fui-card__content",e),...r,children:t})}function E(){let t=ir();return t?jsx("div",{className:"fui-error",children:t}):null}function w(t){let e=s(),r=getTranslation(e,"labels","multiFactorAssertion"),o=getTranslation(e,"prompts","mfaAssertionPrompt");return jsx("div",{className:"fui-screen",children:jsxs(p,{children:[jsxs(f,{children:[jsx(d,{children:r}),jsx(h,{children:o})]}),jsx(F,{children:jsx(Tt,{...t})})]})})}function xn({children:t,onEmailSent:e,onSignIn:r}){let o=s(),n=getTranslation(o,"labels","signIn"),i=getTranslation(o,"prompts","signInToAccount"),a=o.multiFactorResolver;return N(r),a?jsx(w,{}):jsx("div",{className:"fui-screen",children:jsxs(p,{children:[jsxs(f,{children:[jsx(d,{children:n}),jsx(h,{children:i})]}),jsxs(F,{children:[jsx(It,{onEmailSent:e}),t?jsxs(Fragment,{children:[jsx(U,{children:getTranslation(o,"messages","dividerOr")}),jsxs("div",{className:"fui-screen__children",children:[t,jsx(E,{})]})]}):null]})]})})}function En(t){let e=s(),r=getTranslation(e,"labels","resetPassword"),o=getTranslation(e,"prompts","enterEmailToReset");return jsx("div",{className:"fui-screen",children:jsxs(p,{children:[jsxs(f,{children:[jsx(d,{children:r}),jsx(h,{children:o})]}),jsx(F,{children:jsx(Mt,{...t})})]})})}function wn(t){let e=s(),r=getTranslation(e,"labels","multiFactorEnrollment"),o=getTranslation(e,"prompts","mfaEnrollmentPrompt");return jsx("div",{className:"fui-screen",children:jsxs(p,{children:[jsxs(f,{children:[jsx(d,{children:r}),jsx(h,{children:o})]}),jsx(F,{children:jsx(Rt,{...t})})]})})}function Nn({children:t,onSignIn:e}){let r=s(),o=getTranslation(r,"labels","signIn"),n=getTranslation(r,"prompts","signInToAccount"),i=r.multiFactorResolver;return N(e),i?jsx(w,{}):jsx("div",{className:"fui-screen",children:jsxs(p,{children:[jsxs(f,{children:[jsx(d,{children:o}),jsx(h,{children:n})]}),jsxs(F,{className:"fui-screen__children",children:[t,jsx(E,{}),jsx(A,{})]})]})})}function Un({children:t,...e}){let r=s(),o=getTranslation(r,"labels","signIn"),n=getTranslation(r,"prompts","signInToAccount"),i=r.multiFactorResolver;return N(e.onSignIn),i?jsx(w,{}):jsx("div",{className:"fui-screen",children:jsxs(p,{children:[jsxs(f,{children:[jsx(d,{children:o}),jsx(h,{children:n})]}),jsxs(F,{children:[jsx(Gt,{}),t?jsxs(Fragment,{children:[jsx(U,{children:getTranslation(r,"messages","dividerOr")}),jsxs("div",{className:"fui-screen__children",children:[t,jsx(E,{})]})]}):null]})]})})}function Vn({children:t,onSignIn:e,...r}){let o=s(),n=getTranslation(o,"labels","signIn"),i=getTranslation(o,"prompts","signInToAccount");return N(e),o.multiFactorResolver?jsx(w,{}):jsx("div",{className:"fui-screen",children:jsxs(p,{children:[jsxs(f,{children:[jsx(d,{children:n}),jsx(h,{children:i})]}),jsxs(F,{children:[jsx(_t,{...r}),t?jsxs(Fragment,{children:[jsx(U,{children:getTranslation(o,"messages","dividerOr")}),jsxs("div",{className:"fui-screen__children",children:[t,jsx(E,{})]})]}):null]})]})})}function kn({children:t,onSignUp:e,...r}){let o=s(),n=getTranslation(o,"labels","signUp"),i=getTranslation(o,"prompts","enterDetailsToCreate");return N(e),o.multiFactorResolver?jsx(w,{}):jsx("div",{className:"fui-screen",children:jsxs(p,{children:[jsxs(f,{children:[jsx(d,{children:n}),jsx(h,{children:i})]}),jsxs(F,{children:[jsx(Ht,{...r}),t?jsxs(Fragment,{children:[jsx(U,{children:getTranslation(o,"messages","dividerOr")}),jsxs("div",{className:"fui-screen__children",children:[t,jsx(E,{})]})]}):null]})]})})}function he(t,e){let r=s(),[o,n]=useState(null),i=useCallback(async()=>{n(null);try{let a=await signInWithProvider(r,t);e?.(a);}catch(a){if(a instanceof FirebaseUIError){n(a.message);return}console.error(a),n(getTranslation(r,"errors","unknownError"));}},[r,t,n,e]);return {error:o,callback:i}}function b({provider:t,children:e,themed:r,onSignIn:o}){let n=s(),{error:i,callback:a}=he(t,o);return jsxs("div",{children:[jsx(x,{type:"button",variant:r?"primary":"secondary","data-themed":r,"data-provider":t.providerId,disabled:n.state!=="idle",onClick:a,className:"fui-provider__button",children:e}),i&&jsx("div",{className:"fui-error",children:i})]})}var Wn=t=>jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 50 50",...t,children:jsx("path",{fill:"currentColor",d:"M44.527 34.75c-1.078 2.395-1.597 3.465-2.984 5.578-1.941 2.953-4.68 6.64-8.063 6.664-3.011.028-3.789-1.965-7.878-1.93-4.086.02-4.938 1.97-7.954 1.938-3.386-.031-5.976-3.352-7.918-6.3-5.43-8.27-6.003-17.966-2.648-23.122 2.375-3.656 6.129-5.805 9.656-5.805 3.594 0 5.852 1.973 8.82 1.973 2.883 0 4.637-1.976 8.794-1.976 3.14 0 6.46 1.71 8.836 4.664-7.766 4.257-6.504 15.347 1.34 18.316M31.195 8.469c1.512-1.942 2.66-4.68 2.242-7.469-2.464.168-5.347 1.742-7.03 3.781-1.528 1.86-2.794 4.617-2.302 7.285 2.692.086 5.477-1.52 7.09-3.597"})}),Se=Wn;function $n({provider:t,...e}){let r=s();return jsxs(b,{...e,provider:t||new OAuthProvider("apple.com"),children:[jsx(ge,{}),jsx("span",{children:getTranslation(r,"labels","signInWithApple")})]})}function ge({className:t,...e}){return jsx(Se,{className:u("fui-provider__icon",t),...e})}var Jn=t=>jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 50 50",...t,children:jsx("path",{fill:"currentColor",d:"M25 3C12.85 3 3 12.85 3 25c0 11.03 8.125 20.137 18.712 21.728V30.831h-5.443v-5.783h5.443V21.2c0-6.371 3.104-9.168 8.399-9.168 2.536 0 3.877.188 4.512.274v5.048h-3.612c-2.248 0-3.033 2.131-3.033 4.533v3.161h6.588l-.894 5.783h-5.694v15.944C38.716 45.318 47 36.137 47 25c0-12.15-9.85-22-22-22"})}),Ae=Jn;function Xn({provider:t,...e}){let r=s();return jsxs(b,{...e,provider:t||new FacebookAuthProvider,children:[jsx(ve,{}),jsx("span",{children:getTranslation(r,"labels","signInWithFacebook")})]})}function ve({className:t,...e}){return jsx(Ae,{className:u("fui-provider__icon",t),...e})}var jn=t=>jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 30 30",...t,children:jsx("path",{d:"M15 3C8.373 3 3 8.373 3 15c0 5.623 3.872 10.328 9.092 11.63a1.8 1.8 0 0 1-.092-.583v-2.051h-1.508c-.821 0-1.551-.353-1.905-1.009-.393-.729-.461-1.844-1.435-2.526-.289-.227-.069-.486.264-.451.615.174 1.125.596 1.605 1.222.478.627.703.769 1.596.769.433 0 1.081-.025 1.691-.121.328-.833.895-1.6 1.588-1.962-3.996-.411-5.903-2.399-5.903-5.098 0-1.162.495-2.286 1.336-3.233-.276-.94-.623-2.857.106-3.587 1.798 0 2.885 1.166 3.146 1.481A9 9 0 0 1 15.495 9c1.036 0 2.024.174 2.922.483C18.675 9.17 19.763 8 21.565 8c.732.731.381 2.656.102 3.594.836.945 1.328 2.066 1.328 3.226 0 2.697-1.904 4.684-5.894 5.097C18.199 20.49 19 22.1 19 23.313v2.734c0 .104-.023.179-.035.268C23.641 24.676 27 20.236 27 15c0-6.627-5.373-12-12-12"})}),be=jn;function ei({provider:t,...e}){let r=s();return jsxs(b,{...e,provider:t||new GithubAuthProvider,children:[jsx(Ce,{}),jsx("span",{children:getTranslation(r,"labels","signInWithGitHub")})]})}function Ce({className:t,...e}){return jsx(be,{className:u("fui-provider__icon",t),...e})}var ni=t=>jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 48 48",...t,children:[jsx("path",{fill:"#FFC107",d:"M43.611 20.083H42V20H24v8h11.303c-1.649 4.657-6.08 8-11.303 8-6.627 0-12-5.373-12-12s5.373-12 12-12c3.059 0 5.842 1.154 7.961 3.039l5.657-5.657C34.046 6.053 29.268 4 24 4 12.955 4 4 12.955 4 24s8.955 20 20 20 20-8.955 20-20c0-1.341-.138-2.65-.389-3.917"}),jsx("path",{fill:"#FF3D00",d:"m6.306 14.691 6.571 4.819C14.655 15.108 18.961 12 24 12c3.059 0 5.842 1.154 7.961 3.039l5.657-5.657C34.046 6.053 29.268 4 24 4 16.318 4 9.656 8.337 6.306 14.691"}),jsx("path",{fill:"#4CAF50",d:"M24 44c5.166 0 9.86-1.977 13.409-5.192l-6.19-5.238A11.9 11.9 0 0 1 24 36c-5.202 0-9.619-3.317-11.283-7.946l-6.522 5.025C9.505 39.556 16.227 44 24 44"}),jsx("path",{fill:"#1976D2",d:"M43.611 20.083H42V20H24v8h11.303a12.04 12.04 0 0 1-4.087 5.571l.003-.002 6.19 5.238C36.971 39.205 44 34 44 24c0-1.341-.138-2.65-.389-3.917"})]}),Ie=ni;function ui({provider:t,...e}){let r=s();return jsxs(b,{...e,provider:t||new GoogleAuthProvider,children:[jsx(xe,{}),jsx("span",{children:getTranslation(r,"labels","signInWithGoogle")})]})}function xe({className:t,...e}){return jsx(Ie,{className:u("fui-provider__icon",t),...e})}var ci=t=>jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 48 48",...t,children:[jsx("path",{fill:"#ff5722",d:"M22 22H6V6h16z"}),jsx("path",{fill:"#4caf50",d:"M42 22H26V6h16z"}),jsx("path",{fill:"#ffc107",d:"M42 42H26V26h16z"}),jsx("path",{fill:"#03a9f4",d:"M22 42H6V26h16z"})]}),Me=ci;function di({provider:t,...e}){let r=s();return jsxs(b,{...e,provider:t||new OAuthProvider("microsoft.com"),children:[jsx(Ee,{}),jsx("span",{children:getTranslation(r,"labels","signInWithMicrosoft")})]})}function Ee({className:t,...e}){return jsx(Me,{className:u("fui-provider__icon",t),...e})}var Fi=t=>jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 30 30",...t,children:jsx("path",{d:"m26.37 26-8.795-12.822.015.012L25.52 4h-2.65l-6.46 7.48L11.28 4H4.33l8.211 11.971-.001-.001L3.88 26h2.65l7.182-8.322L19.42 26zM10.23 6l12.34 18h-2.1L8.12 6z"})}),Ne=Fi;function yi({provider:t,...e}){let r=s();return jsxs(b,{...e,provider:t||new TwitterAuthProvider,children:[jsx(Ue,{}),jsx("span",{children:getTranslation(r,"labels","signInWithTwitter")})]})}function Ue({className:t,...e}){return jsx(Ne,{className:u("fui-provider__icon",t),...e})}registerFramework("react",tr.version);
|
|
9
|
-
export{
|
|
8
|
+
`);return t}function N(t){let r=s().auth;useEffect(()=>r.onAuthStateChanged(o=>{o&&!o.isAnonymous&&t?.(o);}),[r,t]);}function sr(){let t=s();return useMemo(()=>{if(t.redirectError)return t.redirectError instanceof Error?t.redirectError.message:String(t.redirectError)},[t.redirectError])}function ar(){let t=s();return useMemo(()=>createSignInAuthFormSchema(t),[t])}function ur(){let t=s();return useMemo(()=>createSignUpAuthFormSchema(t),[t])}function mr(){let t=s();return useMemo(()=>createForgotPasswordAuthFormSchema(t),[t])}function cr(){let t=s();return useMemo(()=>createEmailLinkAuthFormSchema(t),[t])}function lr(){let t=s();return useMemo(()=>createPhoneAuthNumberFormSchema(t),[t])}function pr(){let t=s();return useMemo(()=>createPhoneAuthVerifyFormSchema(t),[t])}function fr(){let t=s();return useMemo(()=>createMultiFactorPhoneAuthNumberFormSchema(t),[t])}function ct(){let t=s();return useMemo(()=>createMultiFactorPhoneAuthVerifyFormSchema(t),[t])}function dr(){let t=s();return useMemo(()=>createMultiFactorTotpAuthNumberFormSchema(t),[t])}function lt(){let t=s();return useMemo(()=>createMultiFactorTotpAuthVerifyFormSchema(t),[t])}function W(t){let e=s(),r=useRef(null),o=useRef(e),n=useRef(null);return o.current=e,useEffect(()=>{let i=t.current,a=o.current;i!==n.current&&(n.current=i,i?(r.current=getBehavior(a,"recaptchaVerification")(a,i),r.current.render()):r.current=null);},[t]),r.current}function u(...t){return twMerge(clsx(...t))}function x({className:t,variant:e="primary",asChild:r,...o}){return jsx(r?Slot:"button",{className:u(buttonVariant({variant:e}),t),...o})}var{fieldContext:ao,useFieldContext:uo,formContext:mo,useFormContext:hr}=createFormHookContexts();function co({className:t,...e}){return !e.field.state.meta.isTouched||!e.field.state.meta.errors.length?null:jsx("div",{children:jsx("div",{role:"alert","aria-live":"polite",className:u("fui-error",t),...e,children:e.field.state.meta.errors.map(r=>r.message).join(", ")})})}function lo({children:t,before:e,label:r,action:o,description:n,...i}){let a=uo();return jsxs("label",{htmlFor:a.name,children:[jsxs("div",{"data-input-label":true,children:[jsx("div",{children:r}),o?jsx("div",{children:o}):null]}),n?jsx("div",{"data-input-description":true,children:n}):null,jsxs("div",{"data-input-group":true,children:[e,jsx("input",{...i,"aria-invalid":a.state.meta.isTouched&&a.state.meta.errors.length>0,id:a.name,name:a.name,value:a.state.value,onBlur:()=>{a.handleBlur();},onChange:C=>{a.handleChange(C.target.value);}})]}),t?jsx(Fragment,{children:t}):null,jsx(co,{field:a})]})}function po({className:t,...e}){return jsx("button",{type:"button",...e,className:u("fui-form__action",t)})}function fo(t){let e=hr();return jsx(e.Subscribe,{selector:r=>r.isSubmitting,children:r=>jsx(x,{...t,type:"submit",disabled:r})})}function ho(){let t=hr();return jsx(t.Subscribe,{selector:e=>[e.errorMap],children:([e])=>e?.onSubmit&&typeof e.onSubmit=="string"?jsx("div",{className:"fui-error",children:e.onSubmit}):null})}var m=createFormHook({fieldComponents:{Input:lo},formComponents:{SubmitButton:fo,ErrorMessage:ho,Action:po},fieldContext:ao,formContext:mo});function Sr(){let t=s();return useCallback(async({email:e})=>{try{return await sendSignInLinkToEmail(t,e)}catch(r){throw r instanceof FirebaseUIError?new Error(r.message):(console.error(r),new Error(getTranslation(t,"errors","unknownError")))}},[t])}function gr(t){let e=cr(),r=Sr();return m.useAppForm({defaultValues:{email:""},validators:{onBlur:e,onSubmitAsync:async({value:o})=>{try{return await r(o),t?.()}catch(n){return n instanceof Error?n.message:String(n)}}}})}function yr(t){let e=s();useEffect(()=>{(async()=>{let o=await completeEmailLinkSignIn(e,window.location.href);o&&t?.(o);})();},[t]);}function It({onEmailSent:t,onSignIn:e}){let r=s(),[o,n]=useState(false),i=gr(()=>{n(!0),t?.();});return yr(e),o?jsx("div",{className:"fui-success",children:getTranslation(r,"messages","signInLinkSent")}):jsx("form",{className:"fui-form",onSubmit:async a=>{a.preventDefault(),a.stopPropagation(),await i.handleSubmit();},children:jsxs(i.AppForm,{children:[jsx("fieldset",{children:jsx(i.AppField,{name:"email",children:a=>jsx(a.Input,{label:getTranslation(r,"labels","emailAddress"),type:"email"})})}),jsx(A,{}),jsxs("fieldset",{children:[jsx(i.SubmitButton,{children:getTranslation(r,"labels","sendSignInLink")}),jsx(i.ErrorMessage,{})]})]})})}function vr(){let t=s();return useCallback(async({email:e})=>{try{return await sendPasswordResetEmail(t,e)}catch(r){throw r instanceof FirebaseUIError?new Error(r.message):(console.error(r),new Error(getTranslation(t,"errors","unknownError")))}},[t])}function Ar(t){let e=mr(),r=vr();return m.useAppForm({defaultValues:{email:""},validators:{onBlur:e,onSubmitAsync:async({value:o})=>{try{return await r(o),t?.()}catch(n){return n instanceof Error?n.message:String(n)}}}})}function Mt({onBackToSignInClick:t,onPasswordSent:e}){let r=s(),[o,n]=useState(false),i=Ar(()=>{n(!0),e?.();});return o?jsx("div",{className:"fui-success",children:getTranslation(r,"messages","checkEmailForReset")}):jsx("form",{className:"fui-form",onSubmit:async a=>{a.preventDefault(),a.stopPropagation(),await i.handleSubmit();},children:jsxs(i.AppForm,{children:[jsx("fieldset",{children:jsx(i.AppField,{name:"email",children:a=>jsx(a.Input,{label:getTranslation(r,"labels","emailAddress"),type:"email"})})}),jsx(A,{}),jsxs("fieldset",{children:[jsx(i.SubmitButton,{children:getTranslation(r,"labels","resetPassword")}),jsx(i.ErrorMessage,{})]}),t?jsxs(i.Action,{onClick:t,children:["\u2190 ",getTranslation(r,"labels","backToSignIn")]}):null]})})}function br(){let t=s();return useCallback(async({verificationCode:e,hint:r})=>{let o=TotpMultiFactorGenerator.assertionForSignIn(r.uid,e);return await signInWithMultiFactorAssertion(t,o)},[t])}function Cr({hint:t,onSuccess:e}){let r=br(),o=lt();return m.useAppForm({defaultValues:{verificationCode:""},validators:{onBlur:o,onSubmitAsync:async({value:n})=>{try{let i=await r({verificationCode:n.verificationCode,hint:t});return e(i)}catch(i){return i instanceof FirebaseUIError?i.message:String(i)}}}})}function wt(t){let e=s(),r=Cr({hint:t.hint,onSuccess:o=>{t.onSuccess?.(o);}});return jsx("form",{className:"fui-form",onSubmit:async o=>{o.preventDefault(),o.stopPropagation(),await r.handleSubmit();},children:jsxs(r.AppForm,{children:[jsx("fieldset",{children:jsx(r.AppField,{name:"verificationCode",children:o=>jsx(o.Input,{description:getTranslation(e,"prompts","enterVerificationCode"),label:getTranslation(e,"labels","verificationCode"),type:"text",placeholder:"123456",maxLength:6})})}),jsxs("fieldset",{children:[jsx(r.SubmitButton,{children:getTranslation(e,"labels","verifyCode")}),jsx(r.ErrorMessage,{})]})]})})}function Mr(){let t=s();return useCallback(async({hint:e,recaptchaVerifier:r})=>await verifyPhoneNumber(t,"",r,void 0,e),[t])}function Go({hint:t,recaptchaVerifier:e,onSuccess:r}){let o=Mr();return m.useAppForm({validators:{onSubmitAsync:async()=>{try{let n=await o({hint:t,recaptchaVerifier:e});return r(n)}catch(n){return n instanceof FirebaseUIError?n.message:String(n)}}}})}function Lo(t){let e=s(),r=useRef(null),o=W(r),n=Go({hint:t.hint,recaptchaVerifier:o,onSuccess:t.onSubmit});return jsx("form",{className:"fui-form",onSubmit:async i=>{i.preventDefault(),i.stopPropagation(),await n.handleSubmit();},children:jsxs(n.AppForm,{children:[jsx("fieldset",{children:jsx("label",{children:jsx("div",{"data-input-description":true,children:getTranslation(e,"messages","mfaSmsAssertionPrompt",{phoneNumber:t.hint.phoneNumber||""})})})}),jsx("fieldset",{children:jsx("div",{className:"fui-recaptcha-container",ref:r})}),jsxs("fieldset",{children:[jsx(n.SubmitButton,{children:getTranslation(e,"labels","sendCode")}),jsx(n.ErrorMessage,{})]})]})})}function Er(){let t=s();return useCallback(async({verificationId:e,verificationCode:r})=>{let o=PhoneAuthProvider.credential(e,r),n=PhoneMultiFactorGenerator.assertion(o);return await signInWithMultiFactorAssertion(t,n)},[t])}function _o({verificationId:t,onSuccess:e}){let r=Er(),o=ct();return m.useAppForm({defaultValues:{verificationId:t,verificationCode:""},validators:{onBlur:o,onSubmitAsync:async({value:n})=>{try{let i=await r(n);return e(i)}catch(i){return i instanceof FirebaseUIError?i.message:String(i)}}}})}function Oo(t){let e=s(),r=_o({verificationId:t.verificationId,onSuccess:t.onSuccess});return jsx("form",{className:"fui-form",onSubmit:async o=>{o.preventDefault(),o.stopPropagation(),await r.handleSubmit();},children:jsxs(r.AppForm,{children:[jsx("fieldset",{children:jsx(r.AppField,{name:"verificationCode",children:o=>jsx(o.Input,{label:getTranslation(e,"labels","verificationCode"),type:"text",description:getTranslation(e,"prompts","smsVerificationPrompt")})})}),jsxs("fieldset",{children:[jsx(r.SubmitButton,{children:getTranslation(e,"labels","verifyCode")}),jsx(r.ErrorMessage,{})]})]})})}function Nt(t){let[e,r]=useState(null);return e?jsx(Oo,{verificationId:e.verificationId,onSuccess:o=>{t.onSuccess?.(o);}}):jsx(Lo,{hint:t.hint,onSubmit:o=>r({verificationId:o})})}function Ur(){let t=s();useEffect(()=>()=>{t.setMultiFactorResolver();},[]);}function Tt(t){let e=s(),r=e.multiFactorResolver,o=getTranslation(e,"prompts","mfaAssertionFactorPrompt");if(Ur(),!r)throw new Error("MultiFactorAuthAssertionForm requires a multi-factor resolver");let[n,i]=useState(r.hints.length===1?r.hints[0]:void 0);if(n){if(n.factorId===PhoneMultiFactorGenerator.FACTOR_ID)return jsx(Nt,{hint:n,onSuccess:a=>{t.onSuccess?.(a);}});if(n.factorId===TotpMultiFactorGenerator.FACTOR_ID)return jsx(wt,{hint:n,onSuccess:a=>{t.onSuccess?.(a);}})}return jsxs("div",{className:"fui-content",children:[jsx("p",{children:o}),r.hints.map(a=>a.factorId===TotpMultiFactorGenerator.FACTOR_ID?jsx(Wo,{onClick:()=>i(a)},a.factorId):a.factorId===PhoneMultiFactorGenerator.FACTOR_ID?jsx(zo,{onClick:()=>i(a)},a.factorId):null)]})}function Wo(t){let e=s(),r=getTranslation(e,"labels","mfaTotpVerification");return jsx(x,{...t,children:r})}function zo(t){let e=s(),r=getTranslation(e,"labels","mfaSmsVerification");return jsx(x,{...t,children:r})}function Vr(){let t=s();return getBehavior(t,"countryCodes")().allowedCountries}function Br(){let t=s();return getBehavior(t,"countryCodes")().defaultCountry}var Y=forwardRef(({className:t,...e},r)=>{let o=Vr(),n=Br(),[i,a]=useState(n),C=useCallback(v=>{let T=o.find(yt=>yt.code===v);a(T);},[o]);return useImperativeHandle(r,()=>({getCountry:()=>i,setCountry:C}),[i,C]),jsx("div",{className:u("fui-country-selector",t),...e,children:jsxs("div",{className:"fui-country-selector__wrapper",children:[jsx("span",{className:"fui-country-selector__flag",children:i.emoji}),jsxs("div",{className:"fui-country-selector__select-wrapper",children:[jsx("span",{className:"fui-country-selector__dial-code",children:i.dialCode}),jsx("select",{className:"fui-country-selector__select",value:i.code,onChange:v=>{let T=o.find(yt=>yt.code===v.target.value);T&&a(T);},children:o.map(v=>jsxs("option",{value:v.code,children:[v.dialCode," (",v.name,")"]},`${v.code}-${v.dialCode}`))})]})]})})});Y.displayName="CountrySelector";function Lr(){let t=s();return useCallback(async({phoneNumber:e,recaptchaVerifier:r})=>{let o=multiFactor(t.auth.currentUser);return await verifyPhoneNumber(t,e,r,o)},[t])}function _r({recaptchaVerifier:t,onSuccess:e,formatPhoneNumber:r}){let o=Lr(),n=fr();return m.useAppForm({defaultValues:{displayName:"",phoneNumber:""},validators:{onBlur:n,onSubmitAsync:async({value:i})=>{try{let a=r?r(i.phoneNumber):i.phoneNumber,C=await o({phoneNumber:a,recaptchaVerifier:t});return e(C,i.displayName)}catch(a){return a instanceof FirebaseUIError?a.message:String(a)}}}})}function on(t){let e=s(),r=useRef(null),o=W(r),n=useRef(null),i=_r({recaptchaVerifier:o,onSuccess:t.onSubmit,formatPhoneNumber:a=>formatPhoneNumber(a,n.current.getCountry())});return jsx("form",{className:"fui-form",onSubmit:async a=>{a.preventDefault(),a.stopPropagation(),await i.handleSubmit();},children:jsxs(i.AppForm,{children:[jsx("fieldset",{children:jsx(i.AppField,{name:"displayName",children:a=>jsx(a.Input,{label:getTranslation(e,"labels","displayName"),type:"text"})})}),jsx("fieldset",{children:jsx(i.AppField,{name:"phoneNumber",children:a=>jsx(a.Input,{label:getTranslation(e,"labels","phoneNumber"),type:"tel",before:jsx(Y,{ref:n})})})}),jsx("fieldset",{children:jsx("div",{className:"fui-recaptcha-container",ref:r})}),jsxs("fieldset",{children:[jsx(i.SubmitButton,{children:getTranslation(e,"labels","sendCode")}),jsx(i.ErrorMessage,{})]})]})})}function Or(){let t=s();return useCallback(async({verificationId:e,verificationCode:r,displayName:o})=>{let n=PhoneAuthProvider.credential(e,r),i=PhoneMultiFactorGenerator.assertion(n);return await enrollWithMultiFactorAssertion(t,i,o)},[t])}function Dr({verificationId:t,displayName:e,onSuccess:r}){let o=ct(),n=Or();return m.useAppForm({defaultValues:{verificationId:t,verificationCode:""},validators:{onBlur:o,onSubmitAsync:async({value:i})=>{try{return await n({...i,displayName:e}),r()}catch(a){return a instanceof FirebaseUIError?a.message:String(a)}}}})}function Hr(t){let e=s(),r=Dr({...t,onSuccess:t.onSuccess});return jsx("form",{className:"fui-form",onSubmit:async o=>{o.preventDefault(),o.stopPropagation(),await r.handleSubmit();},children:jsxs(r.AppForm,{children:[jsx("fieldset",{children:jsx(r.AppField,{name:"verificationCode",children:o=>jsx(o.Input,{description:getTranslation(e,"prompts","smsVerificationPrompt"),label:getTranslation(e,"labels","verificationCode"),type:"text"})})}),jsxs("fieldset",{children:[jsx(r.SubmitButton,{children:getTranslation(e,"labels","verifyCode")}),jsx(r.ErrorMessage,{})]})]})})}function Bt(t){let e=s(),[r,o]=useState(null);if(!e.auth.currentUser)throw new Error("User must be authenticated to enroll with multi-factor authentication");return r?jsx(Hr,{...r,onSuccess:()=>{t.onSuccess?.();}}):jsx(on,{onSubmit:(n,i)=>o({verificationId:n,displayName:i})})}function Yr(){let t=s();return useCallback(async()=>await generateTotpSecret(t),[t])}function qr({onSuccess:t}){let e=Yr(),r=dr();return m.useAppForm({defaultValues:{displayName:""},validators:{onBlur:r,onSubmitAsync:async({value:o})=>{try{let n=await e();return t(n,o.displayName)}catch(n){return n instanceof FirebaseUIError?n.message:String(n)}}}})}function cn(t){let e=s(),r=qr({onSuccess:t.onSubmit});return jsx("form",{className:"fui-form",onSubmit:async o=>{o.preventDefault(),o.stopPropagation(),await r.handleSubmit();},children:jsxs(r.AppForm,{children:[jsx("fieldset",{children:jsx(r.AppField,{name:"displayName",children:o=>jsx(o.Input,{label:getTranslation(e,"labels","displayName"),type:"text"})})}),jsxs("fieldset",{children:[jsx(r.SubmitButton,{children:getTranslation(e,"labels","generateQrCode")}),jsx(r.ErrorMessage,{})]})]})})}function $r(){let t=s();return useCallback(async({secret:e,verificationCode:r,displayName:o})=>{let n=TotpMultiFactorGenerator.assertionForEnrollment(e,r);return await enrollWithMultiFactorAssertion(t,n,o)},[t])}function Qr({secret:t,displayName:e,onSuccess:r}){let o=lt(),n=$r();return m.useAppForm({defaultValues:{verificationCode:""},validators:{onBlur:o,onSubmitAsync:async({value:i})=>{try{return await n({secret:t,verificationCode:i.verificationCode,displayName:e}),r()}catch(a){return a instanceof FirebaseUIError?a.message:String(a)}}}})}function Jr(t){let e=s(),r=Qr({...t,onSuccess:t.onSuccess}),o=generateTotpQrCode(e,t.secret,t.displayName);return jsxs("form",{className:"fui-form",onSubmit:async n=>{n.preventDefault(),n.stopPropagation(),await r.handleSubmit();},children:[jsxs("div",{className:"fui-qr-code-container",children:[jsx("img",{src:o,alt:"TOTP QR Code"}),jsx("code",{children:t.secret.secretKey.toString()}),jsx("p",{children:getTranslation(e,"prompts","mfaTotpQrCodePrompt")})]}),jsxs(r.AppForm,{children:[jsx("fieldset",{children:jsx(r.AppField,{name:"verificationCode",children:n=>jsx(n.Input,{label:getTranslation(e,"labels","verificationCode"),type:"text",description:getTranslation(e,"prompts","mfaTotpEnrollmentVerificationPrompt")})})}),jsxs("fieldset",{children:[jsx(r.SubmitButton,{children:getTranslation(e,"labels","verifyCode")}),jsx(r.ErrorMessage,{})]})]})]})}function kt(t){let e=s(),[r,o]=useState(null);if(!e.auth.currentUser)throw new Error("User must be authenticated to enroll with multi-factor authentication");return r?jsx(Jr,{...r,onSuccess:()=>{t.onSuccess?.();}}):jsx(cn,{onSubmit:(n,i)=>o({secret:n,displayName:i})})}var pn=[FactorId.TOTP,FactorId.PHONE];function Rt(t){let e=t.hints??pn;if(e.length===0)throw new Error("MultiFactorAuthEnrollmentForm must have at least one hint");let[r,o]=useState(e.length===1?e[0]:void 0);if(r){if(r===FactorId.TOTP)return jsx(kt,{onSuccess:t.onEnrollment});if(r===FactorId.PHONE)return jsx(Bt,{onSuccess:t.onEnrollment});throw new Error(`Unknown multi-factor enrollment type: ${r}`)}return jsx("div",{className:"fui-content",children:e.map(n=>n===FactorId.TOTP?jsx(fn,{onClick:()=>o(n)},n):n===FactorId.PHONE?jsx(dn,{onClick:()=>o(n)},n):null)})}function fn(t){let e=s(),r=getTranslation(e,"labels","mfaTotpVerification");return jsx(x,{variant:"secondary",...t,children:r})}function dn(t){let e=s(),r=getTranslation(e,"labels","mfaSmsVerification");return jsx(x,{variant:"secondary",...t,children:r})}function te(){let t=s();return useCallback(async({phoneNumber:e,recaptchaVerifier:r})=>await verifyPhoneNumber(t,e,r),[t])}function re({recaptchaVerifier:t,onSuccess:e,formatPhoneNumber:r}){let o=te(),n=lr();return m.useAppForm({defaultValues:{phoneNumber:""},validators:{onBlur:n,onSubmitAsync:async({value:i})=>{try{let a=r?r(i.phoneNumber):i.phoneNumber,C=await o({phoneNumber:a,recaptchaVerifier:t});return e(C)}catch(a){return a instanceof FirebaseUIError?a.message:String(a)}}}})}function yn(t){let e=s(),r=useRef(null),o=W(r),n=useRef(null),i=re({recaptchaVerifier:o,onSuccess:t.onSubmit,formatPhoneNumber:a=>formatPhoneNumber(a,n.current.getCountry())});return jsx("form",{className:"fui-form",onSubmit:async a=>{a.preventDefault(),a.stopPropagation(),await i.handleSubmit();},children:jsxs(i.AppForm,{children:[jsx("fieldset",{children:jsx(i.AppField,{name:"phoneNumber",children:a=>jsx(a.Input,{label:getTranslation(e,"labels","phoneNumber"),type:"tel",before:jsx(Y,{ref:n})})})}),jsx("fieldset",{children:jsx("div",{className:"fui-recaptcha-container",ref:r})}),jsx(A,{}),jsxs("fieldset",{children:[jsx(i.SubmitButton,{children:getTranslation(e,"labels","sendCode")}),jsx(i.ErrorMessage,{})]})]})})}function ee(){let t=s();return useCallback(async({verificationId:e,verificationCode:r})=>await confirmPhoneNumber(t,e,r),[t])}function oe({verificationId:t,onSuccess:e}){let r=pr(),o=ee();return m.useAppForm({defaultValues:{verificationId:t,verificationCode:""},validators:{onBlur:r,onSubmitAsync:async({value:n})=>{try{let i=await o(n);return e(i)}catch(i){return i instanceof FirebaseUIError?i.message:String(i)}}}})}function vn(t){let e=s(),r=oe({verificationId:t.verificationId,onSuccess:t.onSuccess});return jsx("form",{className:"fui-form",onSubmit:async o=>{o.preventDefault(),o.stopPropagation(),await r.handleSubmit();},children:jsxs(r.AppForm,{children:[jsx("fieldset",{children:jsx(r.AppField,{name:"verificationCode",children:o=>jsx(o.Input,{label:getTranslation(e,"labels","verificationCode"),description:getTranslation(e,"prompts","smsVerificationPrompt"),type:"text"})})}),jsxs("fieldset",{children:[jsx(r.SubmitButton,{children:getTranslation(e,"labels","verifyCode")}),jsx(r.ErrorMessage,{})]})]})})}function Gt(t){let[e,r]=useState(null);return e?jsx(vn,{verificationId:e,onSuccess:o=>{t.onSignIn?.(o);}}):jsx(yn,{onSubmit:r})}function ne(){let t=s();return useCallback(async({email:e,password:r})=>{try{return await signInWithEmailAndPassword(t,e,r)}catch(o){throw o instanceof FirebaseUIError?new Error(o.message):(console.error(o),new Error(getTranslation(t,"errors","unknownError")))}},[t])}function ie(t){let e=ar(),r=ne();return m.useAppForm({defaultValues:{email:"",password:""},validators:{onBlur:e,onSubmitAsync:async({value:o})=>{try{let n=await r(o);return t?.(n)}catch(n){return n instanceof Error?n.message:String(n)}}}})}function _t({onSignIn:t,onForgotPasswordClick:e,onSignUpClick:r}){let o=s(),n=ie(t);return jsx("form",{className:"fui-form",onSubmit:async i=>{i.preventDefault(),i.stopPropagation(),await n.handleSubmit();},children:jsxs(n.AppForm,{children:[jsx("fieldset",{children:jsx(n.AppField,{name:"email",children:i=>jsx(i.Input,{label:getTranslation(o,"labels","emailAddress"),type:"email"})})}),jsx("fieldset",{children:jsx(n.AppField,{name:"password",children:i=>jsx(i.Input,{label:getTranslation(o,"labels","password"),type:"password",action:e?jsx(n.Action,{onClick:e,children:getTranslation(o,"labels","forgotPassword")}):null})})}),jsx(A,{}),jsxs("fieldset",{children:[jsx(n.SubmitButton,{children:getTranslation(o,"labels","signIn")}),jsx(n.ErrorMessage,{})]}),r?jsxs(n.Action,{onClick:r,children:[getTranslation(o,"prompts","noAccount")," ",getTranslation(o,"labels","signUp")]}):null]})})}function Dt(){let t=s();return hasBehavior(t,"requireDisplayName")}function se(){let t=s();return useCallback(async({email:e,password:r,displayName:o})=>{try{return await createUserWithEmailAndPassword(t,e,r,o)}catch(n){throw n instanceof FirebaseUIError?new Error(n.message):(console.error(n),new Error(getTranslation(t,"errors","unknownError")))}},[t])}function ae(t){let e=ur(),r=se(),o=Dt();return m.useAppForm({defaultValues:{email:"",password:"",displayName:o?"":void 0},validators:{onBlur:e,onSubmitAsync:async({value:n})=>{try{let i=await r(n);return t?.(i)}catch(i){return i instanceof Error?i.message:String(i)}}}})}function Ht({onSignInClick:t,onSignUp:e}){let r=s(),o=ae(e),n=Dt();return jsx("form",{className:"fui-form",onSubmit:async i=>{i.preventDefault(),i.stopPropagation(),await o.handleSubmit();},children:jsxs(o.AppForm,{children:[n?jsx("fieldset",{children:jsx(o.AppField,{name:"displayName",children:i=>jsx(i.Input,{label:getTranslation(r,"labels","displayName")})})}):null,jsx("fieldset",{children:jsx(o.AppField,{name:"email",children:i=>jsx(i.Input,{label:getTranslation(r,"labels","emailAddress"),type:"email"})})}),jsx("fieldset",{children:jsx(o.AppField,{name:"password",children:i=>jsx(i.Input,{label:getTranslation(r,"labels","password"),type:"password"})})}),jsx(A,{}),jsxs("fieldset",{children:[jsx(o.SubmitButton,{children:getTranslation(r,"labels","createAccount")}),jsx(o.ErrorMessage,{})]}),t?jsxs(o.Action,{onClick:t,children:[getTranslation(r,"prompts","haveAccount")," ",getTranslation(r,"labels","signIn")]}):null]})})}function U({className:t,children:e,...r}){return e?jsxs("div",{className:u("fui-divider",t),...r,children:[jsx("div",{className:"fui-divider__line"}),jsx("div",{className:"fui-divider__text",children:e}),jsx("div",{className:"fui-divider__line"})]}):jsx("div",{className:u("fui-divider",t),...r,children:jsx("div",{className:"fui-divider__line"})})}function p({children:t,className:e,...r}){return jsx("div",{className:u("fui-card",e),...r,children:t})}function f({children:t,className:e,...r}){return jsx("div",{className:u("fui-card__header",e),...r,children:t})}function d({children:t,className:e,...r}){return jsx("h2",{className:u("fui-card__title",e),...r,children:t})}function h({children:t,className:e,...r}){return jsx("p",{className:u("fui-card__subtitle",e),...r,children:t})}function F({children:t,className:e,...r}){return jsx("div",{className:u("fui-card__content",e),...r,children:t})}function E(){let t=sr();return t?jsx("div",{className:"fui-error",children:t}):null}function w(t){let e=s(),r=getTranslation(e,"labels","multiFactorAssertion"),o=getTranslation(e,"prompts","mfaAssertionPrompt");return jsx("div",{className:"fui-screen",children:jsxs(p,{children:[jsxs(f,{children:[jsx(d,{children:r}),jsx(h,{children:o})]}),jsx(F,{children:jsx(Tt,{...t})})]})})}function Nn({children:t,onEmailSent:e,onSignIn:r}){let o=s(),n=getTranslation(o,"labels","signIn"),i=getTranslation(o,"prompts","signInToAccount"),a=o.multiFactorResolver;return N(r),a?jsx(w,{}):jsx("div",{className:"fui-screen",children:jsxs(p,{children:[jsxs(f,{children:[jsx(d,{children:n}),jsx(h,{children:i})]}),jsxs(F,{children:[jsx(It,{onEmailSent:e}),t?jsxs(Fragment,{children:[jsx(U,{children:getTranslation(o,"messages","dividerOr")}),jsxs("div",{className:"fui-screen__children",children:[t,jsx(E,{})]})]}):null]})]})})}function Tn(t){let e=s(),r=getTranslation(e,"labels","resetPassword"),o=getTranslation(e,"prompts","enterEmailToReset");return jsx("div",{className:"fui-screen",children:jsxs(p,{children:[jsxs(f,{children:[jsx(d,{children:r}),jsx(h,{children:o})]}),jsx(F,{children:jsx(Mt,{...t})})]})})}function Vn(t){let e=s(),r=getTranslation(e,"labels","multiFactorEnrollment"),o=getTranslation(e,"prompts","mfaEnrollmentPrompt");return jsx("div",{className:"fui-screen",children:jsxs(p,{children:[jsxs(f,{children:[jsx(d,{children:r}),jsx(h,{children:o})]}),jsx(F,{children:jsx(Rt,{...t})})]})})}function Bn({children:t,onSignIn:e}){let r=s(),o=getTranslation(r,"labels","signIn"),n=getTranslation(r,"prompts","signInToAccount"),i=r.multiFactorResolver;return N(e),i?jsx(w,{}):jsx("div",{className:"fui-screen",children:jsxs(p,{children:[jsxs(f,{children:[jsx(d,{children:o}),jsx(h,{children:n})]}),jsxs(F,{className:"fui-screen__children",children:[t,jsx(E,{}),jsx(A,{})]})]})})}function kn({children:t,...e}){let r=s(),o=getTranslation(r,"labels","signIn"),n=getTranslation(r,"prompts","signInToAccount"),i=r.multiFactorResolver;return N(e.onSignIn),i?jsx(w,{}):jsx("div",{className:"fui-screen",children:jsxs(p,{children:[jsxs(f,{children:[jsx(d,{children:o}),jsx(h,{children:n})]}),jsxs(F,{children:[jsx(Gt,{}),t?jsxs(Fragment,{children:[jsx(U,{children:getTranslation(r,"messages","dividerOr")}),jsxs("div",{className:"fui-screen__children",children:[t,jsx(E,{})]})]}):null]})]})})}function Gn({children:t,onSignIn:e,...r}){let o=s(),n=getTranslation(o,"labels","signIn"),i=getTranslation(o,"prompts","signInToAccount");return N(e),o.multiFactorResolver?jsx(w,{}):jsx("div",{className:"fui-screen",children:jsxs(p,{children:[jsxs(f,{children:[jsx(d,{children:n}),jsx(h,{children:i})]}),jsxs(F,{children:[jsx(_t,{...r}),t?jsxs(Fragment,{children:[jsx(U,{children:getTranslation(o,"messages","dividerOr")}),jsxs("div",{className:"fui-screen__children",children:[t,jsx(E,{})]})]}):null]})]})})}function _n({children:t,onSignUp:e,...r}){let o=s(),n=getTranslation(o,"labels","signUp"),i=getTranslation(o,"prompts","enterDetailsToCreate");return N(e),o.multiFactorResolver?jsx(w,{}):jsx("div",{className:"fui-screen",children:jsxs(p,{children:[jsxs(f,{children:[jsx(d,{children:n}),jsx(h,{children:i})]}),jsxs(F,{children:[jsx(Ht,{...r}),t?jsxs(Fragment,{children:[jsx(U,{children:getTranslation(o,"messages","dividerOr")}),jsxs("div",{className:"fui-screen__children",children:[t,jsx(E,{})]})]}):null]})]})})}function Fe(t,e){let r=s(),[o,n]=useState(null),i=useCallback(async()=>{n(null);try{let a=await signInWithProvider(r,t);e?.(a);}catch(a){if(a instanceof FirebaseUIError){n(a.message);return}console.error(a),n(getTranslation(r,"errors","unknownError"));}},[r,t,n,e]);return {error:o,callback:i}}function y({provider:t,children:e,themed:r,onSignIn:o}){let n=s(),{error:i,callback:a}=Fe(t,o);return jsxs("div",{children:[jsx(x,{type:"button",variant:r?"primary":"secondary","data-themed":r,"data-provider":t.providerId,disabled:n.state!=="idle",onClick:a,className:"fui-provider__button",children:e}),i&&jsx("div",{className:"fui-error",children:i})]})}var $n=t=>jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 50 50",...t,children:jsx("path",{fill:"currentColor",d:"M44.527 34.75c-1.078 2.395-1.597 3.465-2.984 5.578-1.941 2.953-4.68 6.64-8.063 6.664-3.011.028-3.789-1.965-7.878-1.93-4.086.02-4.938 1.97-7.954 1.938-3.386-.031-5.976-3.352-7.918-6.3-5.43-8.27-6.003-17.966-2.648-23.122 2.375-3.656 6.129-5.805 9.656-5.805 3.594 0 5.852 1.973 8.82 1.973 2.883 0 4.637-1.976 8.794-1.976 3.14 0 6.46 1.71 8.836 4.664-7.766 4.257-6.504 15.347 1.34 18.316M31.195 8.469c1.512-1.942 2.66-4.68 2.242-7.469-2.464.168-5.347 1.742-7.03 3.781-1.528 1.86-2.794 4.617-2.302 7.285 2.692.086 5.477-1.52 7.09-3.597"})}),ge=$n;function Kn({provider:t,...e}){let r=s();return jsxs(y,{...e,provider:t||new OAuthProvider("apple.com"),children:[jsx(ye,{}),jsx("span",{children:getTranslation(r,"labels","signInWithApple")})]})}function ye({className:t,...e}){return jsx(ge,{className:u("fui-provider__icon",t),...e})}var Zn=t=>jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 50 50",...t,children:jsx("path",{fill:"currentColor",d:"M25 3C12.85 3 3 12.85 3 25c0 11.03 8.125 20.137 18.712 21.728V30.831h-5.443v-5.783h5.443V21.2c0-6.371 3.104-9.168 8.399-9.168 2.536 0 3.877.188 4.512.274v5.048h-3.612c-2.248 0-3.033 2.131-3.033 4.533v3.161h6.588l-.894 5.783h-5.694v15.944C38.716 45.318 47 36.137 47 25c0-12.15-9.85-22-22-22"})}),Ae=Zn;function ri({provider:t,...e}){let r=s();return jsxs(y,{...e,provider:t||new FacebookAuthProvider,children:[jsx(Pe,{}),jsx("span",{children:getTranslation(r,"labels","signInWithFacebook")})]})}function Pe({className:t,...e}){return jsx(Ae,{className:u("fui-provider__icon",t),...e})}var oi=t=>jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 30 30",...t,children:jsx("path",{d:"M15 3C8.373 3 3 8.373 3 15c0 5.623 3.872 10.328 9.092 11.63a1.8 1.8 0 0 1-.092-.583v-2.051h-1.508c-.821 0-1.551-.353-1.905-1.009-.393-.729-.461-1.844-1.435-2.526-.289-.227-.069-.486.264-.451.615.174 1.125.596 1.605 1.222.478.627.703.769 1.596.769.433 0 1.081-.025 1.691-.121.328-.833.895-1.6 1.588-1.962-3.996-.411-5.903-2.399-5.903-5.098 0-1.162.495-2.286 1.336-3.233-.276-.94-.623-2.857.106-3.587 1.798 0 2.885 1.166 3.146 1.481A9 9 0 0 1 15.495 9c1.036 0 2.024.174 2.922.483C18.675 9.17 19.763 8 21.565 8c.732.731.381 2.656.102 3.594.836.945 1.328 2.066 1.328 3.226 0 2.697-1.904 4.684-5.894 5.097C18.199 20.49 19 22.1 19 23.313v2.734c0 .104-.023.179-.035.268C23.641 24.676 27 20.236 27 15c0-6.627-5.373-12-12-12"})}),Ce=oi;function si({provider:t,...e}){let r=s();return jsxs(y,{...e,provider:t||new GithubAuthProvider,children:[jsx(Ie,{}),jsx("span",{children:getTranslation(r,"labels","signInWithGitHub")})]})}function Ie({className:t,...e}){return jsx(Ce,{className:u("fui-provider__icon",t),...e})}var ui=t=>jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 48 48",...t,children:[jsx("path",{fill:"#FFC107",d:"M43.611 20.083H42V20H24v8h11.303c-1.649 4.657-6.08 8-11.303 8-6.627 0-12-5.373-12-12s5.373-12 12-12c3.059 0 5.842 1.154 7.961 3.039l5.657-5.657C34.046 6.053 29.268 4 24 4 12.955 4 4 12.955 4 24s8.955 20 20 20 20-8.955 20-20c0-1.341-.138-2.65-.389-3.917"}),jsx("path",{fill:"#FF3D00",d:"m6.306 14.691 6.571 4.819C14.655 15.108 18.961 12 24 12c3.059 0 5.842 1.154 7.961 3.039l5.657-5.657C34.046 6.053 29.268 4 24 4 16.318 4 9.656 8.337 6.306 14.691"}),jsx("path",{fill:"#4CAF50",d:"M24 44c5.166 0 9.86-1.977 13.409-5.192l-6.19-5.238A11.9 11.9 0 0 1 24 36c-5.202 0-9.619-3.317-11.283-7.946l-6.522 5.025C9.505 39.556 16.227 44 24 44"}),jsx("path",{fill:"#1976D2",d:"M43.611 20.083H42V20H24v8h11.303a12.04 12.04 0 0 1-4.087 5.571l.003-.002 6.19 5.238C36.971 39.205 44 34 44 24c0-1.341-.138-2.65-.389-3.917"})]}),xe=ui;function pi({provider:t,...e}){let r=s();return jsxs(y,{...e,provider:t||new GoogleAuthProvider,children:[jsx(Me,{}),jsx("span",{children:getTranslation(r,"labels","signInWithGoogle")})]})}function Me({className:t,...e}){return jsx(xe,{className:u("fui-provider__icon",t),...e})}var di=t=>jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 48 48",...t,children:[jsx("path",{fill:"#ff5722",d:"M22 22H6V6h16z"}),jsx("path",{fill:"#4caf50",d:"M42 22H26V6h16z"}),jsx("path",{fill:"#ffc107",d:"M42 42H26V26h16z"}),jsx("path",{fill:"#03a9f4",d:"M22 42H6V26h16z"})]}),Ee=di;function gi({provider:t,...e}){let r=s();return jsxs(y,{...e,provider:t||new OAuthProvider("microsoft.com"),children:[jsx(we,{}),jsx("span",{children:getTranslation(r,"labels","signInWithMicrosoft")})]})}function we({className:t,...e}){return jsx(Ee,{className:u("fui-provider__icon",t),...e})}var vi=t=>jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 30 30",...t,children:jsx("path",{d:"m26.37 26-8.795-12.822.015.012L25.52 4h-2.65l-6.46 7.48L11.28 4H4.33l8.211 11.971-.001-.001L3.88 26h2.65l7.182-8.322L19.42 26zM10.23 6l12.34 18h-2.1L8.12 6z"})}),Ue=vi;function bi({provider:t,...e}){let r=s();return jsxs(y,{...e,provider:t||new TwitterAuthProvider,children:[jsx(Te,{}),jsx("span",{children:getTranslation(r,"labels","signInWithTwitter")})]})}function Te({className:t,...e}){return jsx(Ue,{className:u("fui-provider__icon",t),...e})}var Ii=t=>jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",width:"1em",height:"1em",fill:"currentColor",viewBox:"-271 324 256 153",...t,children:[jsx("path",{d:"M-37.5 356.3h.2l7.1-10.3h-.4l.7-1.1h-99.9l3.9 15.7h27.3l-46 41.5c-9.4-13-31.4-39.9-46.7-62.3h34.4v-12l.4-2.6c-.1 0-.3-.1-.4-.1V324H-271v15.8h33.8c13.1 10.3 63.4 73 65.4 79.2.8 5.9 1.6 40.4-.9 43-4.9 5.2-27.5 3.8-32.9 4.2l-1.9 10.7c9.9.3 42.2-.8 52.2-.8 19.8 0 54.4-.1 59.3.3l.6-11.2c-5-.8-32.3-.1-36-1-.8-5.4-1.7-41.8-.9-45.6 3.9-10.9 61.2-55.1 67.5-56.8 1.4-.3 3.5-.8 5.9-1.3h18.5z"}),jsx("path",{d:"m-48.2 447.8 15.3 1.2 17.9-69c-3-.1-30.1-2.7-33.6-3.3zM-50.8 458.9l.1 16.8 7.7.7 8.4.6 2.5-16.5-8.9-.4z"})]}),Be=Ii;function wi({provider:t,...e}){let r=s();return jsxs(y,{...e,provider:t||new OAuthProvider("yahoo.com"),children:[jsx(ke,{}),jsx("span",{children:getTranslation(r,"labels","signInWithYahoo")})]})}function ke({className:t,...e}){return jsx(Be,{className:u("fui-provider__icon",t),...e})}registerFramework("react",rr.version);
|
|
9
|
+
export{ye as AppleLogo,Kn as AppleSignInButton,x as Button,p as Card,F as CardContent,f as CardHeader,h as CardSubtitle,d as CardTitle,Y as CountrySelector,U as Divider,It as EmailLinkAuthForm,Nn as EmailLinkAuthScreen,Pe as FacebookLogo,ri as FacebookSignInButton,De as FirebaseUIProvider,Mt as ForgotPasswordAuthForm,Tn as ForgotPasswordAuthScreen,Ie as GitHubLogo,si as GitHubSignInButton,Me as GoogleLogo,pi as GoogleSignInButton,we as MicrosoftLogo,gi as MicrosoftSignInButton,Tt as MultiFactorAuthAssertionForm,w as MultiFactorAuthAssertionScreen,Rt as MultiFactorAuthEnrollmentForm,Vn as MultiFactorAuthEnrollmentScreen,Hr as MultiFactorEnrollmentVerifyPhoneNumberForm,Jr as MultiFactorEnrollmentVerifyTotpForm,y as OAuthButton,Bn as OAuthScreen,Gt as PhoneAuthForm,kn as PhoneAuthScreen,A as Policies,At as PolicyContext,E as RedirectError,_t as SignInAuthForm,Gn as SignInAuthScreen,Ht as SignUpAuthForm,_n as SignUpAuthScreen,Nt as SmsMultiFactorAssertionForm,Bt as SmsMultiFactorEnrollmentForm,wt as TotpMultiFactorAssertionForm,kt as TotpMultiFactorEnrollmentForm,Te as TwitterLogo,bi as TwitterSignInButton,ke as YahooLogo,wi as YahooSignInButton,m as form,Vr as useCountries,Br as useDefaultCountry,gr as useEmailLinkAuthForm,Sr as useEmailLinkAuthFormAction,yr as useEmailLinkAuthFormCompleteSignIn,cr as useEmailLinkAuthFormSchema,Ar as useForgotPasswordAuthForm,vr as useForgotPasswordAuthFormAction,mr as useForgotPasswordAuthFormSchema,Ur as useMultiFactorAssertionCleanup,Dr as useMultiFactorEnrollmentVerifyPhoneNumberForm,Or as useMultiFactorEnrollmentVerifyPhoneNumberFormAction,Qr as useMultiFactorEnrollmentVerifyTotpForm,$r as useMultiFactorEnrollmentVerifyTotpFormAction,fr as useMultiFactorPhoneAuthNumberFormSchema,ct as useMultiFactorPhoneAuthVerifyFormSchema,dr as useMultiFactorTotpAuthNumberFormSchema,lt as useMultiFactorTotpAuthVerifyFormSchema,N as useOnUserAuthenticated,lr as usePhoneAuthNumberFormSchema,pr as usePhoneAuthVerifyFormSchema,re as usePhoneNumberForm,te as usePhoneNumberFormAction,W as useRecaptchaVerifier,sr as useRedirectError,Dt as useRequireDisplayName,ie as useSignInAuthForm,ne as useSignInAuthFormAction,ar as useSignInAuthFormSchema,Fe as useSignInWithProvider,ae as useSignUpAuthForm,se as useSignUpAuthFormAction,ur as useSignUpAuthFormSchema,Mr as useSmsMultiFactorAssertionPhoneFormAction,Er as useSmsMultiFactorAssertionVerifyFormAction,Lr as useSmsMultiFactorEnrollmentPhoneAuthFormAction,_r as useSmsMultiFactorEnrollmentPhoneNumberForm,Cr as useTotpMultiFactorAssertionForm,br as useTotpMultiFactorAssertionFormAction,qr as useTotpMultiFactorSecretGenerationForm,Yr as useTotpMultiFactorSecretGenerationFormAction,s as useUI,oe as useVerifyPhoneNumberForm,ee as useVerifyPhoneNumberFormAction};//# sourceMappingURL=index.js.map
|
|
10
10
|
//# sourceMappingURL=index.js.map
|