@donotdev/auth 0.2.1 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/AuthStore.d.ts.map +1 -1
  2. package/dist/AuthStore.js +1 -1
  3. package/dist/authHelpers.js +1 -1
  4. package/dist/components/AccountLinking.js +1 -1
  5. package/dist/components/AuthFallback.js +1 -1
  6. package/dist/components/AuthPartnerButton.d.ts.map +1 -1
  7. package/dist/components/AuthPartnerButton.js +1 -1
  8. package/dist/components/DeleteAccountDialogs.js +1 -1
  9. package/dist/components/EmailLinkForm.js +1 -1
  10. package/dist/components/EmailPasswordForm.d.ts +8 -18
  11. package/dist/components/EmailPasswordForm.d.ts.map +1 -1
  12. package/dist/components/EmailPasswordForm.js +1 -2
  13. package/dist/components/EmailVerification.js +1 -1
  14. package/dist/components/Feature.js +1 -1
  15. package/dist/components/FeatureGuard.js +1 -1
  16. package/dist/components/LoginModal.js +1 -1
  17. package/dist/components/MultipleAuthProviders.js +1 -1
  18. package/dist/components/PasswordResetCallback.d.ts.map +1 -1
  19. package/dist/components/PasswordResetCallback.js +1 -2
  20. package/dist/components/PasswordStrengthIndicator.d.ts.map +1 -1
  21. package/dist/components/PasswordStrengthIndicator.js +1 -1
  22. package/dist/constants.d.ts.map +1 -1
  23. package/dist/emailAuth/fields.d.ts +108 -0
  24. package/dist/emailAuth/fields.d.ts.map +1 -0
  25. package/dist/emailAuth/fields.js +1 -0
  26. package/dist/emailAuth/flows.d.ts +120 -0
  27. package/dist/emailAuth/flows.d.ts.map +1 -0
  28. package/dist/emailAuth/flows.js +1 -0
  29. package/dist/emailAuth/rules.d.ts +36 -0
  30. package/dist/emailAuth/rules.d.ts.map +1 -0
  31. package/dist/emailAuth/rules.js +2 -0
  32. package/dist/hooks/useAuthMethodToggle.js +1 -1
  33. package/dist/hooks/useAuthPartner.d.ts.map +1 -1
  34. package/dist/hooks/useAuthPartner.js +1 -1
  35. package/dist/hooks/useDeleteAccount.d.ts +15 -1
  36. package/dist/hooks/useDeleteAccount.d.ts.map +1 -1
  37. package/dist/hooks/useDeleteAccount.js +1 -1
  38. package/dist/hooks/useEmailLinkForm.js +1 -1
  39. package/dist/hooks/useGoogleOneTap.d.ts +2 -1
  40. package/dist/hooks/useGoogleOneTap.d.ts.map +1 -1
  41. package/dist/hooks/useGoogleOneTap.js +1 -1
  42. package/dist/hooks/useNetworkStatus.d.ts.map +1 -1
  43. package/dist/index.d.ts +6 -1
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +1 -1
  46. package/dist/symbol-index.json +1 -1
  47. package/dist/tsconfig.tsbuildinfo +1 -1
  48. package/dist/useAuth.d.ts.map +1 -1
  49. package/dist/useAuth.js +1 -1
  50. package/guidelines/AUTH.md +14 -0
  51. package/package.json +5 -5
@@ -0,0 +1,120 @@
1
+ import type { FormEvent } from 'react';
2
+ import type { SignUpMetadata } from '@donotdev/core';
3
+ /** Field names the flows read from the submitted form. */
4
+ export declare const AUTH_FIELD: {
5
+ readonly EMAIL: "email";
6
+ readonly PASSWORD: "password";
7
+ readonly CONFIRM_PASSWORD: "confirmPassword";
8
+ readonly REMEMBER_ME: "rememberMe";
9
+ readonly CONSENT: "consent";
10
+ };
11
+ /** Which flow a form runs. */
12
+ export type EmailAuthMode = 'signin' | 'signup' | 'reset';
13
+ /** Per-field validation messages, keyed by field name. */
14
+ export interface AuthFieldErrors {
15
+ email?: string;
16
+ password?: string;
17
+ confirmPassword?: string;
18
+ consent?: string;
19
+ }
20
+ /** Options shared by every flow. */
21
+ export interface EmailAuthFlowOptions {
22
+ /** Called once the flow succeeded: close the dialog / sheet here */
23
+ onSuccess?: () => void;
24
+ /** Called with the provider error after a failed attempt */
25
+ onError?: (error: Error) => void;
26
+ /**
27
+ * CAPTCHA token. `undefined` = no CAPTCHA; while it is `null` / empty the submit is
28
+ * blocked. The app renders the widget.
29
+ */
30
+ captchaToken?: string | null;
31
+ }
32
+ /** Outcome of a successful sign-up. */
33
+ export interface EmailSignUpOutcome {
34
+ /**
35
+ * The address must be confirmed before the user can sign in (no session yet). The
36
+ * flow already showed the "check your email" toast with Resend.
37
+ */
38
+ awaitingConfirmation: boolean;
39
+ }
40
+ /** Options of {@link useEmailSignUp}. */
41
+ export interface EmailSignUpOptions extends Omit<EmailAuthFlowOptions, 'onSuccess'> {
42
+ /** Called once sign-up succeeded: close the dialog / sheet here */
43
+ onSuccess?: (outcome: EmailSignUpOutcome) => void;
44
+ /** Minimum length of the new password (default 8) */
45
+ passwordMinLength?: number;
46
+ /** Extra sign-up metadata stored with the user (consent metadata is added for you) */
47
+ metadata?: SignUpMetadata;
48
+ /** The app's wording of the "check your email" toast (default: framework text) */
49
+ checkEmailMessage?: {
50
+ title: string;
51
+ description?: string;
52
+ };
53
+ }
54
+ /** What a form needs from a flow: pass it to `AuthForm`. */
55
+ export interface EmailAuthFlow {
56
+ /** The flow this is */
57
+ mode: EmailAuthMode;
58
+ /** Form submit handler */
59
+ onSubmit: (event: FormEvent<HTMLFormElement>) => void;
60
+ /** A submit is in progress */
61
+ busy: boolean;
62
+ /** The provider is ready (submit disabled until then) */
63
+ ready: boolean;
64
+ /** The provider failed to start: show an "unavailable" notice instead of the form */
65
+ unavailable: boolean;
66
+ /** Submit is blocked (CAPTCHA token missing, throttled) */
67
+ blocked: boolean;
68
+ /** Form-level error (provider error, throttle) */
69
+ error: string | null;
70
+ /** Per-field validation errors */
71
+ fieldErrors: AuthFieldErrors;
72
+ /** Address whose sign-in failed because it was never confirmed (offer a resend) */
73
+ unconfirmedEmail: string | null;
74
+ /** Resend the confirmation email to `email` and confirm with a toast */
75
+ resendVerification: (email: string) => Promise<void>;
76
+ /** Minimum new-password length (sign-up) */
77
+ passwordMinLength: number;
78
+ }
79
+ /**
80
+ * Email + password sign-in. Remember me is applied when the form renders
81
+ * `AuthRememberMeField`; an unconfirmed address offers a resend.
82
+ *
83
+ * @param options - Callbacks and CAPTCHA token
84
+ * @returns The flow, for `AuthForm`
85
+ *
86
+ * @example
87
+ * ```tsx
88
+ * const flow = useEmailSignIn({ onSuccess: close });
89
+ * <AuthForm flow={flow}>
90
+ * <AuthEmailField />
91
+ * <AuthPasswordField />
92
+ * <AuthRememberMeField />
93
+ * <AuthFormAlerts />
94
+ * <AuthSubmitButton />
95
+ * </AuthForm>
96
+ * ```
97
+ */
98
+ export declare function useEmailSignIn(options?: EmailAuthFlowOptions): EmailAuthFlow;
99
+ /**
100
+ * Email + password sign-up. Password policy and breached-password check apply; the
101
+ * confirmation field and consent are required when the form renders them.
102
+ *
103
+ * Anti-enumeration: an address that already has an account ends exactly like a new
104
+ * one ("check your email"). When the provider asks for confirmation, `onSuccess` runs
105
+ * and a toast that stays until dismissed tells the user to confirm, with Resend.
106
+ *
107
+ * @param options - Callbacks, CAPTCHA token, password minimum, extra metadata
108
+ * @returns The flow, for `AuthForm`
109
+ */
110
+ export declare function useEmailSignUp(options?: EmailSignUpOptions): EmailAuthFlow;
111
+ /**
112
+ * Password-reset request. Anti-enumeration: the same outcome whether or not the address
113
+ * has an account; `onSuccess` runs and a toast that stays until dismissed says to check
114
+ * the inbox.
115
+ *
116
+ * @param options - Callbacks and CAPTCHA token
117
+ * @returns The flow, for `AuthForm`
118
+ */
119
+ export declare function usePasswordResetRequest(options?: EmailAuthFlowOptions): EmailAuthFlow;
120
+ //# sourceMappingURL=flows.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flows.d.ts","sourceRoot":"","sources":["../../src/emailAuth/flows.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAgBrD,0DAA0D;AAC1D,eAAO,MAAM,UAAU;;;;;;CAMb,CAAC;AAEX,8BAA8B;AAC9B,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE1D,0DAA0D;AAC1D,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,oCAAoC;AACpC,MAAM,WAAW,oBAAoB;IACnC,oEAAoE;IACpE,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,4DAA4D;IAC5D,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,uCAAuC;AACvC,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,oBAAoB,EAAE,OAAO,CAAC;CAC/B;AAED,yCAAyC;AACzC,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAC9C,oBAAoB,EACpB,WAAW,CACZ;IACC,mEAAmE;IACnE,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAClD,qDAAqD;IACrD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,sFAAsF;IACtF,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,kFAAkF;IAClF,iBAAiB,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC7D;AAED,4DAA4D;AAC5D,MAAM,WAAW,aAAa;IAC5B,uBAAuB;IACvB,IAAI,EAAE,aAAa,CAAC;IACpB,0BAA0B;IAC1B,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,eAAe,CAAC,KAAK,IAAI,CAAC;IACtD,8BAA8B;IAC9B,IAAI,EAAE,OAAO,CAAC;IACd,yDAAyD;IACzD,KAAK,EAAE,OAAO,CAAC;IACf,qFAAqF;IACrF,WAAW,EAAE,OAAO,CAAC;IACrB,2DAA2D;IAC3D,OAAO,EAAE,OAAO,CAAC;IACjB,kDAAkD;IAClD,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,kCAAkC;IAClC,WAAW,EAAE,eAAe,CAAC;IAC7B,mFAAmF;IACnF,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,wEAAwE;IACxE,kBAAkB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACrD,4CAA4C;IAC5C,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAoLD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,cAAc,CAC5B,OAAO,GAAE,oBAAyB,GACjC,aAAa,CA+Bf;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,OAAO,GAAE,kBAAuB,GAAG,aAAa,CAoF9E;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,GAAE,oBAAyB,GACjC,aAAa,CAiCf"}
@@ -0,0 +1 @@
1
+ "use client";import{jsx as C}from"react/jsx-runtime";import{useEffect as F,useRef as V,useState as g}from"react";import{Button as q,ToastAction as x,toast as R}from"@donotdev/components";import{useTranslation as U}from"@donotdev/core";import{useAuth as E}from"../useAuth";import{DEFAULT_PASSWORD_MIN_LENGTH as O,authErrorMessage as W,isAlreadyRegisteredError as j,isBreachedPassword as B,isEmail as H,isRateLimitError as G,isUnconfirmedError as $,newPasswordError as z}from"./rules";const a={EMAIL:"email",PASSWORD:"password",CONFIRM_PASSWORD:"confirmPassword",REMEMBER_ME:"rememberMe",CONSENT:"consent"},J=6e4,K=5,Q=3e4;function X(){const e=V([]),[t,r]=g(null);return F(()=>{if(t===null)return;const s=setTimeout(()=>r(null),Math.max(0,t-Date.now()));return()=>clearTimeout(s)},[t]),{attempt:()=>{const s=Date.now();return t!==null&&s<t?Math.ceil((t-s)/1e3):(e.current=e.current.filter(u=>s-u<J),e.current.push(s),e.current.length>=K&&(e.current=[],r(s+Q)),0)},throttled:t!==null}}const Y=e=>e instanceof Error?e:new Error(String(e)),l=(e,t)=>{const r=e.get(t);return typeof r=="string"?r:""},T=(e,t)=>{const r=e.elements.namedItem(t);return r instanceof HTMLInputElement?r:void 0};function Z(){const{t:e}=U("auth");return(t,r,s)=>e(t,{defaultValue:r,...s})}function b(e,t){const r=Z(),s=E("isAvailable"),u=E("status"),m=E("sendEmailVerification"),f=X(),[c,o]=g(!1),[n,i]=g(null),[d,h]=g({}),[w,S]=g(null),v=t.captchaToken!==void 0&&!t.captchaToken,L=async p=>{try{await m(p),R("success",r("verificationSent","Verification email sent."))}catch(M){R("error",W(M,r))}};return{t:r,submit:async(p,M,N)=>{if(p.preventDefault(),c||v||!s)return;const P=p.currentTarget,A=new FormData(P),k=M(P,A);if(h(k),S(null),Object.keys(k).length>0){i(null);return}const I=f.attempt();if(I>0){i(r("errors.rate_limit_cooldown",`Too many attempts. Please wait ${I} seconds.`,{seconds:I}));return}i(null),o(!0);try{await N(P,A)}catch(y){e==="signin"&&$(y)&&S(l(A,a.EMAIL).trim()),i(W(y,r)),t.onError?.(Y(y))}finally{o(!1)}},flow:(p,M)=>({mode:e,onSubmit:p,busy:c,ready:s,unavailable:u==="degraded"||u==="error",blocked:v||f.throttled,error:n,fieldErrors:d,unconfirmedEmail:w,resendVerification:L,passwordMinLength:M}),resendVerification:L,setFieldErrors:h}}const _=(e,t)=>{if(t==="")return e("emailRequired","Email is required");if(!H(t))return e("emailInvalid","Invalid email address")},D=e=>Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0));function ee(e={}){const t=b("signin",e),{t:r}=t,s=E("signInWithEmail"),u=E("setRememberMe"),m=E("canRememberMe"),f=c=>{t.submit(c,(o,n)=>D({email:_(r,l(n,a.EMAIL).trim()),password:l(n,a.PASSWORD)===""?r("passwordRequired","Password is required"):void 0}),async(o,n)=>{const i=T(o,a.REMEMBER_ME);i&&m()&&await u(i.checked);const d=await s(l(n,a.EMAIL).trim(),l(n,a.PASSWORD));if(!d?.success)throw new Error(d?.error??"Sign in failed");e.onSuccess?.()})};return t.flow(f,O)}function te(e={}){const t=b("signup",e),{t:r}=t,s=E("createUserWithEmail"),u=e.passwordMinLength??O,m=c=>{R({title:e.checkEmailMessage?.title??r("signup.success_title","Check your email"),description:e.checkEmailMessage?.description??r("signup.check_email","If an account was created, you will receive a confirmation email. Check your inbox and spam folder."),toastType:"success",duration:0,action:C(x,{asChild:!0,altText:r("resendEmail","Resend email"),children:C(q,{onClick:()=>{t.resendVerification(c)},children:r("resendEmail","Resend email")})})})},f=c=>{t.submit(c,(o,n)=>{const i=l(n,a.PASSWORD),d=o.elements.namedItem(a.CONFIRM_PASSWORD),h=T(o,a.CONSENT);return D({email:_(r,l(n,a.EMAIL).trim()),password:z(i,u,r)??void 0,confirmPassword:d&&l(n,a.CONFIRM_PASSWORD)!==i?r("confirmPasswordMismatch","Passwords do not match"):void 0,consent:h&&!h.checked?r("terms.required","Please accept the terms to continue"):void 0})},async(o,n)=>{const i=l(n,a.EMAIL).trim(),d=l(n,a.PASSWORD);if(await B(d)){t.setFieldErrors({password:r("errors.breached_password","This password has appeared in a data breach. Please choose a different password.")});return}const h=T(o,a.CONSENT)?.checked?{...e.metadata,gdpr_consent_at:new Date().toISOString()}:e.metadata;try{const w=await s(i,d,h);if(!w?.success)throw new Error(w?.error??"Sign up failed");const S=!w.user?.emailVerified;e.onSuccess?.({awaitingConfirmation:S}),S&&m(i)}catch(w){if(!j(w))throw w;e.onSuccess?.({awaitingConfirmation:!0}),m(i)}})};return t.flow(f,u)}function re(e={}){const t=b("reset",e),{t:r}=t,s=E("sendPasswordResetEmail"),u=m=>{t.submit(m,(f,c)=>D({email:_(r,l(c,a.EMAIL).trim())}),async(f,c)=>{try{await s(l(c,a.EMAIL).trim())}catch(o){if(G(o))throw o}e.onSuccess?.(),R({title:r("forgotPassword.sent","Password reset email sent"),description:r("forgotPassword.check_email_safe","If an account exists with this email, you will receive password reset instructions."),toastType:"success",duration:0})})};return t.flow(u,O)}export{a as AUTH_FIELD,ee as useEmailSignIn,te as useEmailSignUp,re as usePasswordResetRequest};
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @fileoverview Email auth rules
3
+ * @description The rules every email/password flow shares, framework form or app form:
4
+ * provider error -> user message, email format, new-password policy, breached-password
5
+ * check (HaveIBeenPwned k-anonymity, NIST 800-63B).
6
+ *
7
+ * @version 0.1.0
8
+ * @since 0.2.3
9
+ * @author AMBROISE PARK Consulting
10
+ */
11
+ /** Translate function of the `auth` namespace (key, fallback, interpolation). */
12
+ export type AuthT = (key: string, fallback: string, values?: Record<string, unknown>) => string;
13
+ /** Default minimum length of a new password. */
14
+ export declare const DEFAULT_PASSWORD_MIN_LENGTH = 8;
15
+ /** Whether `email` looks like an address (the provider validates for real). */
16
+ export declare function isEmail(email: string): boolean;
17
+ /** Provider error: too many requests (provider-side rate limit). */
18
+ export declare function isRateLimitError(error: unknown): boolean;
19
+ /** Provider error: the address exists but was never confirmed. */
20
+ export declare function isUnconfirmedError(error: unknown): boolean;
21
+ /** Provider error: sign-up with an address that already has an account. */
22
+ export declare function isAlreadyRegisteredError(error: unknown): boolean;
23
+ /** User-facing message for a provider error (rate limit, credentials, network...). */
24
+ export declare function authErrorMessage(error: unknown, t: AuthT): string;
25
+ /**
26
+ * First rule a new password breaks, or `null`. Policy: minimum length (8 by default),
27
+ * one uppercase letter, one lowercase letter, one digit, one special character.
28
+ */
29
+ export declare function newPasswordError(password: string, minLength: number, t: AuthT): string | null;
30
+ /**
31
+ * Whether the password appears in a known breach (HaveIBeenPwned range API: only the
32
+ * first 5 hex chars of the SHA-1 leave the browser). Fails open: an unreachable API
33
+ * never blocks a sign-up.
34
+ */
35
+ export declare function isBreachedPassword(password: string): Promise<boolean>;
36
+ //# sourceMappingURL=rules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../src/emailAuth/rules.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,iFAAiF;AACjF,MAAM,MAAM,KAAK,GAAG,CAClB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC7B,MAAM,CAAC;AAEZ,gDAAgD;AAChD,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAI7C,+EAA+E;AAC/E,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE9C;AAKD,oEAAoE;AACpE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAOxD;AAED,kEAAkE;AAClE,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAO1D;AAED,2EAA2E;AAC3E,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAQhE;AA8CD,sFAAsF;AACtF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,GAAG,MAAM,CAMjE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,CAAC,EAAE,KAAK,GACP,MAAM,GAAG,IAAI,CAkCf;AAED;;;;GAIG;AACH,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAsB3E"}
@@ -0,0 +1,2 @@
1
+ const l=8,d=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function u(e){return d.test(e)}const r=e=>(e instanceof Error?e.message:String(e)).toLowerCase();function o(e){const s=r(e);return s.includes("429")||s.includes("rate")||s.includes("too_many_requests")}function w(e){const s=r(e);return s.includes("email_not_confirmed")||s.includes("email not confirmed")||s.includes("auth/unverified-email")}function m(e){const s=r(e);return s.includes("already")||s.includes("exists")||s.includes("user_already_exists")||s.includes("auth/email-already-in-use")}const f=[{test:o,key:"errors.rate_limit",fallback:"Too many attempts. Please wait a moment and try again."},{test:e=>e.includes("email_not_confirmed")||e.includes("email not confirmed")||e.includes("auth/unverified-email"),key:"errors.email_not_confirmed",fallback:"Please verify your email before signing in."},{test:e=>e.includes("invalid_credentials")||e.includes("invalid login credentials")||e.includes("invalid-credential")||e.includes("auth/wrong-password")||e.includes("auth/user-not-found")||e.includes("invalid")&&e.includes("credential"),key:"errors.invalid_credentials",fallback:"Invalid email or password."},{test:e=>e.includes("weak_password")||e.includes("weak password")||e.includes("auth/weak-password"),key:"errors.weak_password",fallback:"Password is too weak. Please choose a stronger password."},{test:e=>e.includes("network")||e.includes("fetch"),key:"networkError",fallback:"Network error. Please check your connection and try again."}];function p(e,s){const a=r(e);for(const t of f)if(t.test(a))return s(t.key,t.fallback);return s("errorGeneric","Authentication failed. Please try again.")}function y(e,s,a){return e===""?a("passwordRequired","Password is required"):e.length<s?a("passwordMinLength",`Password must be at least ${s} characters`,{count:s}):/[A-Z]/.test(e)?/[a-z]/.test(e)?/[0-9]/.test(e)?/[^a-zA-Z0-9]/.test(e)?null:a("passwordRequirement.special","Password must contain at least one special character"):a("passwordRequirement.number","Password must contain at least one number"):a("passwordRequirement.lowercase","Password must contain at least one lowercase letter"):a("passwordRequirement.uppercase","Password must contain at least one uppercase letter")}async function k(e){try{const s=await crypto.subtle.digest("SHA-1",new TextEncoder().encode(e)),a=Array.from(new Uint8Array(s)).map(n=>n.toString(16).padStart(2,"0")).join("").toUpperCase(),t=a.slice(0,5),c=a.slice(5),i=await fetch(`https://api.pwnedpasswords.com/range/${t}`,{headers:{"Add-Padding":"true"},credentials:"omit"});return i.ok?(await i.text()).split(`
2
+ `).some(n=>n.split(":")[0]?.trim()===c):!1}catch{return!1}}export{l as DEFAULT_PASSWORD_MIN_LENGTH,p as authErrorMessage,m as isAlreadyRegisteredError,k as isBreachedPassword,u as isEmail,o as isRateLimitError,w as isUnconfirmedError,y as newPasswordError};
@@ -1 +1 @@
1
- "use client";import{useState as l,useCallback as t}from"react";function g({defaultValue:r="popup"}={}){const[o,e]=l(r),d=o==="redirect",u=o==="popup",i=t(()=>{e(p=>p==="redirect"?"popup":"redirect")},[]),s=t(()=>{e("redirect")},[]),a=t(()=>{e("popup")},[]),c=t(p=>{e(p?"redirect":"popup")},[]);return{isRedirectMode:d,isPopupMode:u,authMethod:o,toggleMode:i,setRedirectMode:s,setPopupMode:a,handleToggleChange:c}}export{g as useAuthMethodToggle};
1
+ "use client";import{useState as l,useCallback as t}from"react";function g({defaultValue:u="popup"}={}){const[o,e]=l(u),d=o==="redirect",r=o==="popup",i=t(()=>{e(p=>p==="redirect"?"popup":"redirect")},[]),s=t(()=>{e("redirect")},[]),a=t(()=>{e("popup")},[]),c=t(p=>{e(p?"redirect":"popup")},[]);return{isRedirectMode:d,isPopupMode:r,authMethod:o,toggleMode:i,setRedirectMode:s,setPopupMode:a,handleToggleChange:c}}export{g as useAuthMethodToggle};
@@ -1 +1 @@
1
- {"version":3,"file":"useAuthPartner.d.ts","sourceRoot":"","sources":["../../src/hooks/useAuthPartner.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEhE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG/C,UAAU,qBAAqB;IAC7B,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IACzC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAClC;AAED,UAAU,oBAAoB;IAE5B,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,OAAO,CAAC;IACzB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAGpB,YAAY,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,cAAc,CAC5B,SAAS,EAAE,aAAa,EACxB,OAAO,GAAE,qBAA0B,GAClC,oBAAoB,CA4FtB"}
1
+ {"version":3,"file":"useAuthPartner.d.ts","sourceRoot":"","sources":["../../src/hooks/useAuthPartner.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEhE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG/C,UAAU,qBAAqB;IAC7B,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IACzC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAClC;AAED,UAAU,oBAAoB;IAE5B,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,OAAO,CAAC;IACzB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAGpB,YAAY,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,cAAc,CAC5B,SAAS,EAAE,aAAa,EACxB,OAAO,GAAE,qBAA0B,GAClC,oBAAoB,CA+FtB"}
@@ -1 +1 @@
1
- "use client";import{useCallback as t}from"react";import{useAuth as o}from"../useAuth";function I(r,g={}){const h=o("getPartnerState"),e=o("setPartnerState"),d=o("signInWithPartner"),i=o("partnerError"),{onSuccess:s,onError:l}=g,u=h(r),p=u==="authenticated",E=u==="loading",n=i?.partnerId===r,S=n&&i?.error?new Error(i.error):null,c=t(()=>{n&&e(r,"idle")},[n,r,e]),f=t(()=>{e(r,"loading")},[r,e]),m=t(()=>{e(r,"idle")},[r,e]),A=t(async P=>{n&&c();try{e(r,"loading");const a=await d(r,P);if(a===null){e(r,"idle");return}a&&s&&s(a)}catch(a){e(r,"error",a),l&&l(a)}},[r,n,c,e,d,s,l]);return{partnerState:u,isAuthenticated:p,isAuthenticating:E,hasError:n,error:S,handleSignIn:A,clearError:c,setLoading:f,setIdle:m}}export{I as useAuthPartner};
1
+ "use client";import{useCallback as a}from"react";import{useAuth as o}from"../useAuth";function w(t,g={}){const p=o("getPartnerState"),e=o("setPartnerState"),d=o("signInWithPartner"),i=o("partnerError"),{onSuccess:s,onError:l}=g,c=p(t),E=c==="authenticated",S=c==="loading",r=i?.partnerId===t,f=r&&i?.error?new Error(i.error):null,u=a(()=>{r&&e(t,"idle")},[r,t,e]),m=a(()=>{e(t,"loading")},[t,e]),A=a(()=>{e(t,"idle")},[t,e]),P=a(async I=>{r&&u();try{e(t,"loading");const n=await d(t,I);if(n===null){e(t,"idle");return}n&&s&&s(n)}catch(n){const h=n;e(t,"error",h),l&&l(h)}},[t,r,u,e,d,s,l]);return{partnerState:c,isAuthenticated:E,isAuthenticating:S,hasError:r,error:f,handleSignIn:P,clearError:u,setLoading:m,setIdle:A}}export{w as useAuthPartner};
@@ -34,6 +34,20 @@ export interface DeleteAccountState {
34
34
  * - OAuth providers: Automatically triggers popup
35
35
  * - Password providers: Requires password parameter
36
36
  *
37
+ * **Server refusals**: when the server refuses the deletion (e.g. a
38
+ * `createDeleteAccount({ beforeDelete })` that throws `open_orders`), `error` is the
39
+ * translation of `deleteAccount.errors.<code>` in the `auth` namespace when that key
40
+ * exists. The code is looked up as the server's `code`, then its `error` message, then
41
+ * the client error message; only `[A-Za-z0-9_-]+` values are tried. Without a matching
42
+ * key, `error` is the raw error message (unchanged behaviour). Consumers add the keys
43
+ * in their `auth` locale override, e.g. `src/locales/auth_fr.json`:
44
+ *
45
+ * ```json
46
+ * { "deleteAccount": { "errors": {
47
+ * "open_orders": "Vous avez une commande en cours. Réessayez après sa livraison."
48
+ * } } }
49
+ * ```
50
+ *
37
51
  * @example
38
52
  * ```tsx
39
53
  * const deletion = useDeleteAccount();
@@ -54,7 +68,7 @@ export interface DeleteAccountState {
54
68
  * />
55
69
  * ```
56
70
  *
57
- * @version 0.1.0
71
+ * @version 0.2.0
58
72
  * @since 0.0.1
59
73
  * @author AMBROISE PARK Consulting
60
74
  * @returns Account deletion state and actions
@@ -1 +1 @@
1
- {"version":3,"file":"useDeleteAccount.d.ts","sourceRoot":"","sources":["../../src/hooks/useDeleteAccount.tsx"],"names":[],"mappings":"AAgBA;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IACjC,6CAA6C;IAC7C,iBAAiB,EAAE,OAAO,CAAC;IAE3B,8CAA8C;IAC9C,UAAU,EAAE,OAAO,CAAC;IAEpB,2DAA2D;IAC3D,kBAAkB,EAAE,OAAO,CAAC;IAE5B,2BAA2B;IAC3B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAErB,0DAA0D;IAC1D,eAAe,EAAE,MAAM,IAAI,CAAC;IAE5B,uFAAuF;IACvF,aAAa,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpD,4CAA4C;IAC5C,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,gBAAgB,IAAI,kBAAkB,CAwDrD"}
1
+ {"version":3,"file":"useDeleteAccount.d.ts","sourceRoot":"","sources":["../../src/hooks/useDeleteAccount.tsx"],"names":[],"mappings":"AA4CA;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IACjC,6CAA6C;IAC7C,iBAAiB,EAAE,OAAO,CAAC;IAE3B,8CAA8C;IAC9C,UAAU,EAAE,OAAO,CAAC;IAEpB,2DAA2D;IAC3D,kBAAkB,EAAE,OAAO,CAAC;IAE5B,2BAA2B;IAC3B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAErB,0DAA0D;IAC1D,eAAe,EAAE,MAAM,IAAI,CAAC;IAE5B,uFAAuF;IACvF,aAAa,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpD,4CAA4C;IAC5C,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,wBAAgB,gBAAgB,IAAI,kBAAkB,CA8DrD"}
@@ -1 +1 @@
1
- "use client";import{useState as o}from"react";import{useAuth as f}from"../useAuth";function A(){const c=f("deleteAccount"),[r,e]=o(!1),[u,t]=o(!1),[i,n]=o(!1),[m,l]=o(null);return{showConfirmDialog:r,showPasswordDialog:u,isDeleting:i,error:m,startDeleteFlow:()=>{l(null),e(!0)},confirmDelete:async D=>{n(!0),l(null);try{await c(D),e(!1),t(!1)}catch(a){const s=a.message||a.message;s==="REQUIRES_PASSWORD"?(e(!1),t(!0)):s==="REAUTH_CANCELLED"?(e(!1),t(!1)):l(s||"Failed to delete account")}finally{n(!1)}},cancel:()=>{e(!1),t(!1),l(null)}}}export{A as useDeleteAccount};
1
+ "use client";import{useState as l}from"react";import{useTranslation as D}from"@donotdev/core";import{useAuth as h}from"../useAuth";const f="deleteAccount.errors.",E=/^[A-Za-z0-9_-]+$/;function w(e){const s=typeof e=="object"&&e!==null&&"details"in e?e.details:void 0;return[s?.serverCode,s?.serverMessage,e instanceof Error?e.message:void 0].filter(o=>typeof o=="string"&&E.test(o))}function y(){const e=h("deleteAccount"),{t:s}=D("auth"),[o,t]=l(!1),[d,n]=l(!1),[m,c]=l(!1),[A,r]=l(null);return{showConfirmDialog:o,showPasswordDialog:d,isDeleting:m,error:A,startDeleteFlow:()=>{r(null),t(!0)},confirmDelete:async g=>{c(!0),r(null);try{await e(g),t(!1),n(!1)}catch(u){const a=u.message;if(a==="REQUIRES_PASSWORD")t(!1),n(!0);else if(a==="REAUTH_CANCELLED")t(!1),n(!1);else{const p=w(u).map(i=>s(`${f}${i}`)).find(i=>!i.startsWith(f));r(p??(a||"Failed to delete account"))}}finally{c(!1)}},cancel:()=>{t(!1),n(!1),r(null)}}}export{y as useDeleteAccount};
@@ -1 +1 @@
1
- "use client";import{useState as r,useCallback as l}from"react";import{handleError as I}from"@donotdev/core";import{useAuth as f}from"../useAuth";function v(S={}){const t=f("sendSignInLinkToEmail"),g=f("isAvailable"),{onSuccess:s,onError:o,actionCodeSettings:m}=S,[e,E]=r(""),[u,c]=r(!1),[h,d]=r(!1),[p,n]=r(null),i=e.trim().length>0&&e.includes("@"),k=i&&!u&&g,y=l(()=>{n(null)},[]),L=l(async w=>{if(w.preventDefault(),!i){n("Please enter a valid email address");return}c(!0),n(null);try{typeof window<"u"&&localStorage.setItem("emailForSignIn",e.trim()),await t(e.trim(),m),d(!0),s?.()}catch(a){const F=a instanceof Error?a.message:"Failed to send sign-in link";n(F),o?.(a),I(a)}finally{c(!1)}},[e,i,t,m,s,o]),b=l(()=>{d(!1),n(null)},[]);return{email:e,setEmail:E,isLoading:u,isSent:h,error:p,handleSendLink:L,handleResend:b,clearError:y,isValid:i,canSubmit:k}}export{v as useEmailLinkForm};
1
+ "use client";import{useState as r,useCallback as l}from"react";import{handleError as I}from"@donotdev/core";import{useAuth as f}from"../useAuth";function w(g={}){const t=f("sendSignInLinkToEmail"),S=f("isAvailable"),{onSuccess:s,onError:o,actionCodeSettings:m}=g,[e,E]=r(""),[u,c]=r(!1),[h,d]=r(!1),[p,n]=r(null),i=e.trim().length>0&&e.includes("@"),k=i&&!u&&S,y=l(()=>{n(null)},[]),L=l(async v=>{if(v.preventDefault(),!i){n("Please enter a valid email address");return}c(!0),n(null);try{typeof window<"u"&&localStorage.setItem("emailForSignIn",e.trim()),await t(e.trim(),m),d(!0),s?.()}catch(a){const F=a instanceof Error?a.message:"Failed to send sign-in link";n(F),o?.(a),I(a)}finally{c(!1)}},[e,i,t,m,s,o]),b=l(()=>{d(!1),n(null)},[]);return{email:e,setEmail:E,isLoading:u,isSent:h,error:p,handleSendLink:L,handleResend:b,clearError:y,isValid:i,canSubmit:k}}export{w as useEmailLinkForm};
@@ -1,3 +1,4 @@
1
+ import type { AuthAPI } from '@donotdev/core';
1
2
  /**
2
3
  * Hook options
3
4
  */
@@ -34,7 +35,7 @@ interface UseGoogleOneTapReturn {
34
35
  /** Any error during initialization */
35
36
  error: Error | null;
36
37
  /** Current authenticated user */
37
- user: any;
38
+ user: AuthAPI['user'];
38
39
  /** Whether dark mode is active */
39
40
  isDark: boolean;
40
41
  /** Whether browser supports FedCM */
@@ -1 +1 @@
1
- {"version":3,"file":"useGoogleOneTap.d.ts","sourceRoot":"","sources":["../../src/hooks/useGoogleOneTap.ts"],"names":[],"mappings":"AA6IA;;GAEG;AACH,UAAU,sBAAsB;IAC9B,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,6CAA6C;IAC7C,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,uCAAuC;IACvC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B,4CAA4C;IAC5C,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,uBAAuB;IACvB,SAAS,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAEzC,qBAAqB;IACrB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAEjC,sCAAsC;IACtC,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAEhC,yBAAyB;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,uDAAuD;IACvD,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,UAAU,qBAAqB;IAC7B,0CAA0C;IAC1C,QAAQ,EAAE,OAAO,CAAC;IAElB,2CAA2C;IAC3C,SAAS,EAAE,OAAO,CAAC;IAEnB,sCAAsC;IACtC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAEpB,iCAAiC;IACjC,IAAI,EAAE,GAAG,CAAC;IAEV,kCAAkC;IAClC,MAAM,EAAE,OAAO,CAAC;IAEhB,qCAAqC;IACrC,cAAc,EAAE,OAAO,CAAC;IAExB,kDAAkD;IAClD,UAAU,EAAE,OAAO,CAAC;IAEpB,8CAA8C;IAC9C,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAErD,gCAAgC;IAChC,UAAU,EAAE,MAAM,IAAI,CAAC;IAEvB,oCAAoC;IACpC,gBAAgB,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAExD,iCAAiC;IACjC,UAAU,EAAE,OAAO,CAAC;IAEpB,6CAA6C;IAC7C,WAAW,EAAE;QACX,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,OAAO,CAAC;QACrB,cAAc,EAAE,MAAM,CAAC;KACxB,CAAC;IAEF,+DAA+D;IAC/D,WAAW,EAAE,MAAM,IAAI,CAAC;IAExB,6CAA6C;IAC7C,aAAa,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,UAAiB,EACjB,kBAAyB,EACzB,cAAc,EACd,QAAgB,EAChB,SAAS,EACT,OAAO,EACP,oBAAoB,EACpB,QAAQ,EACR,UAAkB,GACnB,GAAE,sBAA2B,GAAG,qBAAqB,CAkWrD"}
1
+ {"version":3,"file":"useGoogleOneTap.d.ts","sourceRoot":"","sources":["../../src/hooks/useGoogleOneTap.ts"],"names":[],"mappings":"AAyCA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAqG9C;;GAEG;AACH,UAAU,sBAAsB;IAC9B,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,6CAA6C;IAC7C,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,uCAAuC;IACvC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B,4CAA4C;IAC5C,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,uBAAuB;IACvB,SAAS,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAEzC,qBAAqB;IACrB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAEjC,sCAAsC;IACtC,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAEhC,yBAAyB;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,uDAAuD;IACvD,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,UAAU,qBAAqB;IAC7B,0CAA0C;IAC1C,QAAQ,EAAE,OAAO,CAAC;IAElB,2CAA2C;IAC3C,SAAS,EAAE,OAAO,CAAC;IAEnB,sCAAsC;IACtC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAEpB,iCAAiC;IACjC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAEtB,kCAAkC;IAClC,MAAM,EAAE,OAAO,CAAC;IAEhB,qCAAqC;IACrC,cAAc,EAAE,OAAO,CAAC;IAExB,kDAAkD;IAClD,UAAU,EAAE,OAAO,CAAC;IAEpB,8CAA8C;IAC9C,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAErD,gCAAgC;IAChC,UAAU,EAAE,MAAM,IAAI,CAAC;IAEvB,oCAAoC;IACpC,gBAAgB,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAExD,iCAAiC;IACjC,UAAU,EAAE,OAAO,CAAC;IAEpB,6CAA6C;IAC7C,WAAW,EAAE;QACX,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,OAAO,CAAC;QACrB,cAAc,EAAE,MAAM,CAAC;KACxB,CAAC;IAEF,+DAA+D;IAC/D,WAAW,EAAE,MAAM,IAAI,CAAC;IAExB,6CAA6C;IAC7C,aAAa,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,UAAiB,EACjB,kBAAyB,EACzB,cAAc,EACd,QAAgB,EAChB,SAAS,EACT,OAAO,EACP,oBAAoB,EACpB,QAAQ,EACR,UAAkB,GACnB,GAAE,sBAA2B,GAAG,qBAAqB,CAkWrD"}
@@ -1 +1 @@
1
- "use client";import{useState as G,useEffect as L,useRef as f,useCallback as j,startTransition as _,useMemo as B}from"react";import{useIsDark as oe}from"@donotdev/components";import{handleError as g,getOAuthClientId as te,getEnabledAuthPartners as re,isClient as ne,useTranslation as ae,useScriptLoader as ie}from"@donotdev/core";import{useAuth as J}from"../useAuth";import{useFedCM as se}from"./useFedCM";function ce({clientId:Q,autoSelect:x=!0,cancelOnTapOutside:v=!0,promptParentId:y,disabled:l=!1,onSuccess:C,onError:i,allowedParentOrigins:N,cspNonce:S,clientOnly:R=!1}={}){const{t:n}=ae("auth"),T=J("user"),A=J("signInWithGoogleCredential"),I=oe(),s=Q||te("google"),E=re().includes("google"),{isSupported:r,isReady:d,error:F,browserInfo:U}=se({checkGoogleServices:!0,onError:o=>{const t=g(o,{userMessage:n("auth.fedcmNotSupported","Your browser does not support Google One Tap"),context:{operation:"fedcm_detection"},severity:"warning"});i?.(t)}}),{isLoading:V,isLoaded:O,error:P,isReady:q,load:X,loadTriggered:Z}=ie("https://accounts.google.com/gsi/client",{enabled:E&&!!s&&!l&&d&&r,nonce:S,checkExisting:!0,isLoaded:()=>!!window.google?.accounts?.id,onError:o=>{const t=g(o,{userMessage:n("auth.googleScriptLoadError","Failed to load Google Identity Services"),context:{operation:"google_script_load"},severity:"error"});i?.(t)}}),[b,$]=G(!1),[z,Y]=G(null),K=f(null),a=f(!1),c=f(null),D=f(0),[H,p]=G(!1),m="gsi_hide_until",w=600*1e3,M=B(()=>E&&!!s&&!l&&!T&&r&&(R?b:!0)&&!H,[E,s,l,T,r,R,b,H]),ee=B(()=>!r&&d?new Error(n("auth.fedcmRequired","Google One Tap requires a modern browser (Chrome 116+ or Edge 116+)")):P||F||z,[P,F,z,r,d,n]),h=j(async o=>{try{if(!o||typeof o!="string")throw new Error("Invalid credential format");await A(o),_(()=>{C?.(o)})}catch(t){const e=g(t,{userMessage:n("auth.googleOneTapError","Google One Tap authentication failed"),context:{operation:"google_one_tap_signin",credentialLength:o?.length||0},severity:"error"});throw _(()=>{Y(e)}),i?.(e),e}},[A,C,i,n]),k=j(()=>{if(!ne()||!q||!s||!window.google?.accounts?.id||!r||a.current)return;const o=Date.now();if(!(o-D.current<w&&D.current>0))try{a.current=!0,D.current=o;const t={client_id:s,callback:async e=>{try{await h(e.credential)}catch(W){g(W,{userMessage:"Google One Tap credential handling failed",context:{operation:"google_one_tap_callback"},severity:"error"})}},auto_select:x,cancel_on_tap_outside:v,context:"signin",ux_mode:"popup",itp_support:!0,state:I?"dark":"light",use_fedcm_for_prompt:!0,allowed_parent_origins:N,csp_nonce:S,moment_callback:e=>{const W=e.getMomentType();if(e.isDisplayMoment?.()){if(!e.isDisplayed?.()&&e.getNotDisplayedReason){a.current=!1;try{const u=Date.now()+w;localStorage.setItem(m,String(u)),p(!0)}catch{}}}else if(e.isSkippedMoment?.()){a.current=!1;try{const u=Date.now()+w;localStorage.setItem(m,String(u)),p(!0)}catch{}}else if(e.isDismissedMoment?.()){a.current=!1;try{const u=Date.now()+w;localStorage.setItem(m,String(u)),p(!0)}catch{}}}};y&&(t.prompt_parent_id=y),window.google.accounts.id.initialize(t),c.current&&window.clearTimeout(c.current),c.current=window.setTimeout(()=>{window.google?.accounts?.id?.prompt(e=>{e?.credential&&h(e.credential)}),c.current=null},100)}catch(t){const e=g(t,{userMessage:n("auth.googleOneTapInitError","Failed to initialize Google One Tap"),context:{operation:"google_one_tap_initialize",fedcmSupported:r},severity:"error"});_(()=>{Y(e)}),i?.(e),a.current=!1}},[q,s,r,x,v,y,I,h,i,N,S,n]);return L(()=>{if(typeof window<"u"){_(()=>{$(!0)});try{const o=Number(localStorage.getItem(m)||0);p(o>Date.now())}catch{}}},[]),L(()=>{O&&!l&&M&&d&&k()},[O,l,M,d,k]),L(()=>()=>{c.current&&window.clearTimeout(c.current),a.current=!1},[]),{isLoaded:O,isLoading:V,error:ee,user:T,isDark:I,fedcmSupported:r,isHydrated:b,containerRef:K,initialize:k,handleCredential:h,shouldShow:M,browserInfo:U,triggerLoad:X,loadTriggered:Z}}export{ce as useGoogleOneTap};
1
+ "use client";import{useState as G,useEffect as L,useRef as f,useCallback as j,startTransition as _,useMemo as B}from"react";import{useIsDark as te}from"@donotdev/components";import{handleError as g,getOAuthClientId as oe,getEnabledAuthPartners as re,isClient as ne,useTranslation as ae,useScriptLoader as ie}from"@donotdev/core";import{useAuth as J}from"../useAuth";import{useFedCM as se}from"./useFedCM";function ce({clientId:K,autoSelect:x=!0,cancelOnTapOutside:v=!0,promptParentId:y,disabled:l=!1,onSuccess:C,onError:i,allowedParentOrigins:z,cspNonce:S,clientOnly:R=!1}={}){const{t:n}=ae("auth"),T=J("user"),A=J("signInWithGoogleCredential"),I=te(),s=K||oe("google"),E=re().includes("google"),{isSupported:r,isReady:d,error:F,browserInfo:U}=se({checkGoogleServices:!0,onError:t=>{const o=g(t,{userMessage:n("auth.fedcmNotSupported","Your browser does not support Google One Tap"),context:{operation:"fedcm_detection"},severity:"warning"});i?.(o)}}),{isLoading:V,isLoaded:O,error:P,isReady:q,load:X,loadTriggered:Z}=ie("https://accounts.google.com/gsi/client",{enabled:E&&!!s&&!l&&d&&r,nonce:S,checkExisting:!0,isLoaded:()=>!!window.google?.accounts?.id,onError:t=>{const o=g(t,{userMessage:n("auth.googleScriptLoadError","Failed to load Google Identity Services"),context:{operation:"google_script_load"},severity:"error"});i?.(o)}}),[b,$]=G(!1),[N,W]=G(null),Q=f(null),a=f(!1),c=f(null),D=f(0),[H,p]=G(!1),m="gsi_hide_until",w=600*1e3,M=B(()=>E&&!!s&&!l&&!T&&r&&(R?b:!0)&&!H,[E,s,l,T,r,R,b,H]),ee=B(()=>!r&&d?new Error(n("auth.fedcmRequired","Google One Tap requires a modern browser (Chrome 116+ or Edge 116+)")):P||F||N,[P,F,N,r,d,n]),h=j(async t=>{try{if(!t||typeof t!="string")throw new Error("Invalid credential format");await A(t),_(()=>{C?.(t)})}catch(o){const e=g(o,{userMessage:n("auth.googleOneTapError","Google One Tap authentication failed"),context:{operation:"google_one_tap_signin",credentialLength:t?.length||0},severity:"error"});throw _(()=>{W(e)}),i?.(e),e}},[A,C,i,n]),k=j(()=>{if(!ne()||!q||!s||!window.google?.accounts?.id||!r||a.current)return;const t=Date.now();if(!(t-D.current<w&&D.current>0))try{a.current=!0,D.current=t;const o={client_id:s,callback:async e=>{try{await h(e.credential)}catch(Y){g(Y,{userMessage:"Google One Tap credential handling failed",context:{operation:"google_one_tap_callback"},severity:"error"})}},auto_select:x,cancel_on_tap_outside:v,context:"signin",ux_mode:"popup",itp_support:!0,state:I?"dark":"light",use_fedcm_for_prompt:!0,allowed_parent_origins:z,csp_nonce:S,moment_callback:e=>{const Y=e.getMomentType();if(e.isDisplayMoment?.()){if(!e.isDisplayed?.()&&e.getNotDisplayedReason){a.current=!1;try{const u=Date.now()+w;localStorage.setItem(m,String(u)),p(!0)}catch{}}}else if(e.isSkippedMoment?.()){a.current=!1;try{const u=Date.now()+w;localStorage.setItem(m,String(u)),p(!0)}catch{}}else if(e.isDismissedMoment?.()){a.current=!1;try{const u=Date.now()+w;localStorage.setItem(m,String(u)),p(!0)}catch{}}}};y&&(o.prompt_parent_id=y),window.google.accounts.id.initialize(o),c.current&&window.clearTimeout(c.current),c.current=window.setTimeout(()=>{window.google?.accounts?.id?.prompt(e=>{e?.credential&&h(e.credential)}),c.current=null},100)}catch(o){const e=g(o,{userMessage:n("auth.googleOneTapInitError","Failed to initialize Google One Tap"),context:{operation:"google_one_tap_initialize",fedcmSupported:r},severity:"error"});_(()=>{W(e)}),i?.(e),a.current=!1}},[q,s,r,x,v,y,I,h,i,z,S,n]);return L(()=>{if(typeof window<"u"){_(()=>{$(!0)});try{const t=Number(localStorage.getItem(m)||0);p(t>Date.now())}catch{}}},[]),L(()=>{O&&!l&&M&&d&&k()},[O,l,M,d,k]),L(()=>()=>{c.current&&window.clearTimeout(c.current),a.current=!1},[]),{isLoaded:O,isLoading:V,error:ee,user:T,isDark:I,fedcmSupported:r,isHydrated:b,containerRef:Q,initialize:k,handleCredential:h,shouldShow:M,browserInfo:U,triggerLoad:X,loadTriggered:Z}}export{ce as useGoogleOneTap};
@@ -1 +1 @@
1
- {"version":3,"file":"useNetworkStatus.d.ts","sourceRoot":"","sources":["../../src/hooks/useNetworkStatus.ts"],"names":[],"mappings":"AAsBA,UAAU,sBAAsB;IAC9B,MAAM,EAAE,OAAO,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,gBAAgB,IAAI,sBAAsB,CAiDzD"}
1
+ {"version":3,"file":"useNetworkStatus.d.ts","sourceRoot":"","sources":["../../src/hooks/useNetworkStatus.ts"],"names":[],"mappings":"AAsBA,UAAU,sBAAsB;IAC9B,MAAM,EAAE,OAAO,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,gBAAgB,IAAI,sBAAsB,CAoDzD"}
package/dist/index.d.ts CHANGED
@@ -11,12 +11,17 @@ export type { DeleteAccountState } from './hooks/useDeleteAccount';
11
11
  export { getAuthState, subscribeToAuth } from './authHelpers';
12
12
  export { AuthPartnerButton, ConfirmDeleteDialog, FeatureGuard, GoogleOneTap, LoginModal, MultipleAuthProviders, // Added for AuthHeader and future LoginTemplate
13
13
  PasswordResetCallback, ReauthDialog, } from './components';
14
+ export { default as EmailPasswordForm } from './components/EmailPasswordForm';
15
+ export { AUTH_FIELD, useEmailSignIn, useEmailSignUp, usePasswordResetRequest, } from './emailAuth/flows';
16
+ export type { AuthFieldErrors, EmailAuthFlow, EmailAuthFlowOptions, EmailAuthMode, EmailSignUpOptions, EmailSignUpOutcome, } from './emailAuth/flows';
17
+ export { AuthConfirmPasswordField, AuthConsentField, AuthEmailField, AuthForm, AuthFormAlerts, AuthPasswordField, AuthRememberMeField, AuthSubmitButton, } from './emailAuth/fields';
18
+ export type { AuthConsentFieldProps, AuthFormProps, AuthLegalDocument, AuthRememberMeFieldProps, AuthSubmitButtonProps, AuthTextFieldProps, } from './emailAuth/fields';
14
19
  export type { AuthError, // Explicitly import AuthError from core
15
20
  AuthUser as User, // Rename AuthUser to User for public API simplicity
16
21
  UserRole, SubscriptionTier, } from '@donotdev/core';
17
22
  export { getAuthMethod, PARTNER_STATE, EMAIL_VERIFICATION_STATUS, } from './constants';
18
23
  export type { AuthMethod } from './constants';
19
- export type { AuthPartnerButtonProps, GoogleOneTapProps, LoginModalProps, } from './constants';
24
+ export type { AuthPartnerButtonProps, EmailPasswordFormProps, GoogleOneTapProps, LoginModalProps, } from './constants';
20
25
  export type { MultipleAuthProvidersProps } from './components/MultipleAuthProviders';
21
26
  export type { FeatureGuardProps } from './components/FeatureGuard';
22
27
  export type { ConfirmDeleteDialogProps, ReauthDialogProps, } from './components/DeleteAccountDialogs';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,YAAY,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAGnE,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAG9D,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,qBAAqB,EAAE,gDAAgD;AACvE,qBAAqB,EACrB,YAAY,GACb,MAAM,cAAc,CAAC;AAGtB,YAAY,EACV,SAAS,EAAE,wCAAwC;AACnD,QAAQ,IAAI,IAAI,EAAE,oDAAoD;AACtE,QAAQ,EACR,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,aAAa,EACb,aAAa,EACb,yBAAyB,GAC1B,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C,YAAY,EACV,sBAAsB,EACtB,iBAAiB,EACjB,eAAe,GAChB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AACrF,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,YAAY,EACV,wBAAwB,EACxB,iBAAiB,GAClB,MAAM,mCAAmC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,YAAY,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAGnE,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAG9D,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,qBAAqB,EAAE,gDAAgD;AACvE,qBAAqB,EACrB,YAAY,GACb,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EACL,UAAU,EACV,cAAc,EACd,cAAc,EACd,uBAAuB,GACxB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,eAAe,EACf,aAAa,EACb,oBAAoB,EACpB,aAAa,EACb,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,wBAAwB,EACxB,gBAAgB,EAChB,cAAc,EACd,QAAQ,EACR,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,qBAAqB,EACrB,aAAa,EACb,iBAAiB,EACjB,wBAAwB,EACxB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,oBAAoB,CAAC;AAG5B,YAAY,EACV,SAAS,EAAE,wCAAwC;AACnD,QAAQ,IAAI,IAAI,EAAE,oDAAoD;AACtE,QAAQ,EACR,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,aAAa,EACb,aAAa,EACb,yBAAyB,GAC1B,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C,YAAY,EACV,sBAAsB,EACtB,sBAAsB,EACtB,iBAAiB,EACjB,eAAe,GAChB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AACrF,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,YAAY,EACV,wBAAwB,EACxB,iBAAiB,GAClB,MAAM,mCAAmC,CAAC"}
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{useAuth as a}from"./useAuth";import{useDeleteAccount as t}from"./hooks/useDeleteAccount";import{getAuthState as e,subscribeToAuth as s}from"./authHelpers";import{AuthPartnerButton as o,ConfirmDeleteDialog as u,FeatureGuard as r,GoogleOneTap as A,LoginModal as l,MultipleAuthProviders as i,PasswordResetCallback as h,ReauthDialog as T}from"./components";import{getAuthMethod as g,PARTNER_STATE as m,EMAIL_VERIFICATION_STATUS as n}from"./constants";export{o as AuthPartnerButton,u as ConfirmDeleteDialog,n as EMAIL_VERIFICATION_STATUS,r as FeatureGuard,A as GoogleOneTap,l as LoginModal,i as MultipleAuthProviders,m as PARTNER_STATE,h as PasswordResetCallback,T as ReauthDialog,g as getAuthMethod,e as getAuthState,s as subscribeToAuth,a as useAuth,t as useDeleteAccount};
1
+ import{useAuth as s}from"./useAuth";import{useDeleteAccount as a}from"./hooks/useDeleteAccount";import{getAuthState as e,subscribeToAuth as t}from"./authHelpers";import{AuthPartnerButton as o,ConfirmDeleteDialog as u,FeatureGuard as r,GoogleOneTap as i,LoginModal as A,MultipleAuthProviders as l,PasswordResetCallback as m,ReauthDialog as h}from"./components";import{default as d}from"./components/EmailPasswordForm";import{AUTH_FIELD as n,useEmailSignIn as F,useEmailSignUp as T,usePasswordResetRequest as E}from"./emailAuth/flows";import{AuthConfirmPasswordField as g,AuthConsentField as R,AuthEmailField as p,AuthForm as P,AuthFormAlerts as S,AuthPasswordField as f,AuthRememberMeField as I,AuthSubmitButton as b}from"./emailAuth/fields";import{getAuthMethod as C,PARTNER_STATE as D,EMAIL_VERIFICATION_STATUS as M}from"./constants";export{n as AUTH_FIELD,g as AuthConfirmPasswordField,R as AuthConsentField,p as AuthEmailField,P as AuthForm,S as AuthFormAlerts,o as AuthPartnerButton,f as AuthPasswordField,I as AuthRememberMeField,b as AuthSubmitButton,u as ConfirmDeleteDialog,M as EMAIL_VERIFICATION_STATUS,d as EmailPasswordForm,r as FeatureGuard,i as GoogleOneTap,A as LoginModal,l as MultipleAuthProviders,D as PARTNER_STATE,m as PasswordResetCallback,h as ReauthDialog,C as getAuthMethod,e as getAuthState,t as subscribeToAuth,s as useAuth,a as useDeleteAccount,F as useEmailSignIn,T as useEmailSignUp,E as usePasswordResetRequest};
@@ -1 +1 @@
1
- {"useAuth":"/**\n * React hook for authentication with property-based access\n *\n * Single entry point for all authentication operations.\n * Lazy loads FirebaseAuth on first call and connects to store.\n * Uses unified FeatureStatus enum for lifecycle management.\n *\n * **Property-based access (clean and simple):**\n * ```typescript\n * // ✅ State from store (reactive, re-renders on change)\n * const user = useAuth('user');\n * const status = useAuth('status'); // 'initializing' | 'ready' | 'degraded' | 'error'\n * const loading = useAuth('loading');\n * const error = useAuth('error');\n *\n * // ✅ Methods from instance (stable, never re-renders)\n * const signIn = useAuth('signInWithEmail');\n * const signOut = useAuth('signOut');\n * ```\n *\n * **How it works:**\n * - Store properties (user, status, loading, etc.) → Subscribe via Zustand (reactive)\n * - Methods (signInWithEmail, etc.) → Get from FirebaseAuth instance (stable)\n *\n * **Status-based behavior:**\n * - `initializing`: Auth is loading (returns degraded API until ready)\n * - `ready`: Auth fully operational (returns real API)\n * - `degraded`: Auth unavailable (returns degraded API)\n * - `error`: Auth encountered error (returns degraded API)\n *\n * **Error Handling:**\n * All async methods throw DoNotDevError (already wrapped by FirebaseAuth/SmartRecovery).\n *\n * @template K - The property key from AuthAPI\n * @param key - Property name to access\n * @returns The value of the specified property\n *\n * @example\n * ```typescript\n * // Get status (re-renders when status changes)\n * const status = useAuth('status');\n * if (status === 'initializing') return <Spinner overlay />;\n * if (status === 'degraded') return <Error>Auth unavailable</Error>;\n *\n * // Get user (re-renders when user changes)\n * const user = useAuth('user');\n * if (!user) return <LoginButton />;\n *\n * // Get sign-in method (stable, never re-renders)\n * const signIn = useAuth('signInWithEmail');\n * await signIn(email, password);\n * ```\n *\n * @version 0.1.0\n * @since 0.0.1\n * @author AMBROISE PARK Consulting\n */\nexport declare function useAuth<K extends keyof AuthAPI>(key: K): AuthAPI[K];","useDeleteAccount":"/**\n * Hook for managing account deletion flow\n *\n * Handles:\n * - Confirmation dialog\n * - Password dialog (when password is required for reauthentication)\n * - Error states\n * - Loading states\n *\n * Reauthentication is handled internally by FirebaseAuth.deleteAccount():\n * - OAuth providers: Automatically triggers popup\n * - Password providers: Requires password parameter\n *\n * @example\n * ```tsx\n * const deletion = useDeleteAccount();\n *\n * // Start flow\n * <Button onClick={deletion.startDeleteFlow}>Delete Account</Button>\n *\n * // Dialogs\n * <ReauthDialog\n * open={deletion.showPasswordDialog}\n * onReauth={(password) => deletion.confirmDelete(password)}\n * onCancel={deletion.cancel}\n * />\n * <ConfirmDeleteDialog\n * open={deletion.showConfirmDialog}\n * onConfirm={() => deletion.confirmDelete()}\n * onCancel={deletion.cancel}\n * />\n * ```\n *\n * @version 0.1.0\n * @since 0.0.1\n * @author AMBROISE PARK Consulting\n * @returns Account deletion state and actions\n */\nexport declare function useDeleteAccount(): DeleteAccountState;","DeleteAccountState":"/**\n * Account deletion state and actions\n *\n * @version 0.1.0\n * @since 0.0.1\n * @author AMBROISE PARK Consulting\n */\nexport interface DeleteAccountState {\n /** Whether confirmation dialog is visible */\n showConfirmDialog: boolean;\n /** Whether account deletion is in progress */\n isDeleting: boolean;\n /** Whether password re-authentication dialog is visible */\n showPasswordDialog: boolean;\n /** Error message if any */\n error: string | null;\n /** Start the deletion flow (shows confirmation dialog) */\n startDeleteFlow: () => void;\n /** Confirm deletion (executes actual deletion, handles reauthentication internally) */\n confirmDelete: (password?: string) => Promise<void>;\n /** Cancel deletion flow (closes dialogs) */\n cancel: () => void;\n}","getAuthState":"/**\n * Get current auth state synchronously\n * Use this in Zustand stores or other non-React contexts\n *\n * **Behavior:**\n * - Always returns valid state (never throws)\n * - Returns initial state if auth is not initialized: `{ user: null, initialized: false, ... }`\n * - Works in both client and server contexts (server returns initial state)\n * - No graceful degradation needed - store always exists with valid initial state\n *\n * @returns Current auth state (or initial state if not initialized)\n *\n * @example\n * ```typescript\n * const authState = getAuthState();\n * const userId = authState.userId; // null if not authenticated\n * const user = authState.user; // null if not authenticated\n * const isInitialized = authState.initialized; // false until auth initializes\n * ```\n */\nexport declare function getAuthState(): AuthState & AuthActions;","subscribeToAuth":"/**\n * Subscribe to auth state changes\n * Use this in Zustand stores or other non-React contexts\n *\n * **Behavior:**\n * - Always returns unsubscribe function (never throws)\n * - Subscriptions work even if auth is not initialized\n * - On server, subscription is a no-op (returns empty unsubscribe function)\n * - Listener receives initial state immediately, then updates as auth state changes\n *\n * **Important:** Always call the returned unsubscribe function to prevent memory leaks.\n *\n * @param listener - Callback function that receives (state, prevState)\n * @returns Unsubscribe function (call to remove listener)\n *\n * @example\n * ```typescript\n * const unsubscribe = subscribeToAuth((state, prevState) => {\n * if (state.user?.id !== prevState.user?.id) {\n * // User changed - handle accordingly\n * if (state.user) {\n * console.log('User signed in:', state.user.id);\n * } else {\n * console.log('User signed out');\n * }\n * }\n * });\n *\n * // Later, cleanup\n * unsubscribe();\n * ```\n */\nexport declare function subscribeToAuth(listener: (state: AuthState & AuthActions, prevState: AuthState & AuthActions) => void): () => void;","AuthPartnerButton":"/**\n * AuthPartnerButton - Authentication button component\n *\n * Provides a unified button interface for authentication with various partners\n * (Google, Facebook, etc.) and methods (OAuth, email/password, email link).\n *\n * @version 0.1.0\n * @since 0.0.1\n * @author AMBROISE PARK Consulting\n */\ndeclare function AuthPartnerButton({ partnerId, method, onSuccess, onError, className, children, disabled, display, style, ...props }","ConfirmDeleteDialog":"/**\n * Confirmation dialog for account deletion\n *\n * Shows warning, lists what will be deleted, and requires explicit confirmation.\n *\n * @example\n * ```tsx\n * <ConfirmDeleteDialog\n * open={showConfirmDialog}\n * isLoading={isDeleting}\n * error={error}\n * onConfirm={confirmDelete}\n * onCancel={cancel}\n * />\n * ```\n *\n * @version 0.1.0\n * @since 0.0.1\n * @author AMBROISE PARK Consulting\n */\nexport declare function ConfirmDeleteDialog({ open, isLoading, error, onConfirm, onCancel, }","FeatureGuard":"/**\n * FeatureGuard component that protects individual components based on user permissions\n *\n * Provides granular feature access control within pages, allowing developers to show/hide\n * features based on user permissions without manual hook management. This complements\n * the route-level AuthGuard by providing component-level protection within pages.\n *\n * **Key Features:**\n * - Role-based access control (user, admin)\n * - Subscription tier validation (free, pro, premium)\n * - Active subscription requirement checking\n * - Custom validation functions\n * - Automatic fallback components with context\n * - Graceful degradation when auth unavailable\n * - Loading state handling\n *\n * **Fallback Behavior:**\n * - Shows loading skeleton while auth state loads\n * - Displays AuthFallback for unauthenticated users (if showLoginPrompt=true)\n * - Shows UpgradePrompt for tier restrictions (if showUpgradePrompt=true)\n * - Displays AccessDenied for role restrictions\n * - Shows SubscriptionExpired for subscription requirements\n * - Renders custom fallback if provided\n * - Returns null if no fallback should be shown\n *\n * **Performance:**\n * - Uses useAuth() hook for reactive updates\n * - Memoizes permission checks\n * - Minimal re-renders on auth state changes\n * - Lazy loading compatible\n *\n * @param props - FeatureGuard configuration\n * @returns Protected component or fallback component\n *\n * @version 0.1.0\n * @since 0.0.1\n * @author AMBROISE PARK Consulting\n */\nexport declare function FeatureGuard({ children, role, tier, subscription, validate, fallback: CustomFallback, message, showUpgradePrompt, showLoginPrompt, }","GoogleOneTap":"/**\n * Google One Tap authentication component\n *\n * @description\n * Displays Google One Tap prompt for seamless authentication.\n * As of October 2024, FedCM is mandatory - shows clear browser\n * compatibility message if not supported.\n *\n * **Positioning:**\n * Fixed to top-right, below header/breadcrumbs automatically.\n *\n * **States:**\n * - Loading: Shows spinner while initializing\n * - Error: Shows error message with details\n * - Not Supported: Shows browser upgrade message\n * - Ready: Invisible container for Google prompt\n *\n * @param props - Component configuration\n *\n * @version 0.1.0\n * @since 0.0.1\n * @author AMBROISE PARK Consulting\n */\ndeclare function GoogleOneTap({ clientId, onSuccess, onError, autoSelect, cancelOnTapOutside, className, disabled, promptParentId, allowedParentOrigins, cspNonce, clientOnly, showErrorDetails, loadingComponent: LoadingComponent, errorComponent: ErrorComponent, browserNotSupportedComponent: BrowserNotSupportedComponent, }","LoginModal":"declare const LoginModal: (props: LoginModalProps) => import(\"react\").JSX.Element;","MultipleAuthProviders":"/**\n * Multiple auth providers component with automatic fallback handling\n *\n * @version 0.1.0\n * @since 0.0.1\n * @author AMBROISE PARK Consulting\n */\ndeclare const MultipleAuthProviders: (props: MultipleAuthProvidersProps) => import(\"react\").JSX.Element;","ReauthDialog":"/**\n * Re-authentication dialog for account deletion\n *\n * Prompts user to re-enter password for security before account deletion.\n *\n * @example\n * ```tsx\n * <ReauthDialog\n * open={showReauthDialog}\n * isLoading={isReauthenticating}\n * error={error}\n * onReauth={reauthenticate}\n * onCancel={cancel}\n * />\n * ```\n *\n * @version 0.1.0\n * @since 0.0.1\n * @author AMBROISE PARK Consulting\n */\nexport declare function ReauthDialog({ open, isLoading, error, onReauth, onCancel, }","AuthMethod":"type AuthMethod } from '../constants';","AuthPartnerButtonProps":"/**\n * Props for auth partner button\n *\n * @version 0.1.0\n * @since 0.0.1\n * @author AMBROISE PARK Consulting\n */\nexport interface AuthPartnerButtonProps extends AuthCallbackProps, BaseComponentProps {\n partnerId: AuthPartnerId;\n method?: AuthMethod | null;\n children?: React.ReactNode;\n disabled?: boolean;\n /**\n * Display - controls button presentation in preset layouts\n * - 'compact': Icon-only\n * - 'full': Icon + label\n * - 'auto': Responsive (default)\n * @default 'auto'\n */\n display?: (typeof DISPLAY)[keyof typeof DISPLAY];\n}","GoogleOneTapProps":"/**\n * Props for Google One Tap component\n *\n * @version 0.1.0\n * @since 0.0.1\n * @author AMBROISE PARK Consulting\n */\nexport interface GoogleOneTapProps extends AuthCallbackProps {\n /** Custom client ID (defaults to env variable) */\n clientId?: string;\n}","LoginModalProps":"/**\n * Props for login modal\n *\n * @version 0.1.0\n * @since 0.0.1\n * @author AMBROISE PARK Consulting\n */\nexport interface LoginModalProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n}","MultipleAuthProvidersProps":"/**\n * Props for multiple auth providers\n *\n * @version 0.1.0\n * @since 0.0.1\n * @author AMBROISE PARK Consulting\n */\nexport interface MultipleAuthProvidersProps extends BaseComponentProps {\n /** Providers to display (defaults to all available providers) */\n providers?: AuthPartnerId[];\n /** CSS class for each provider button */\n buttonClassName?: string;\n}","FeatureGuardProps":"/**\n * Props for FeatureGuard component\n */\nexport interface FeatureGuardProps {\n /** Children to render if access is granted */\n children: ReactNode;\n /** Required role(s) - user must have at least one */\n role?: UserRole | UserRole[];\n /** Required subscription tier */\n tier?: SubscriptionTier;\n /** Whether active subscription is required */\n subscription?: boolean;\n /** Custom validation function */\n validate?: (role: UserRole | undefined, tier: SubscriptionTier | undefined) => boolean;\n /** Fallback component to show when access is denied */\n fallback?: ComponentType<{\n requiredRole?: UserRole | UserRole[];\n requiredTier?: SubscriptionTier;\n requiresSubscription?: boolean;\n userRole?: UserRole;\n userTier?: SubscriptionTier;\n hasSubscription?: boolean;\n }>;\n /** Custom message for fallback */\n message?: string;\n /** Whether to show upgrade prompt for tier restrictions */\n showUpgradePrompt?: boolean;\n /** Whether to show login prompt for auth restrictions */\n showLoginPrompt?: boolean;\n}","ConfirmDeleteDialogProps":"/**\n * Confirmation dialog props\n *\n * @version 0.1.0\n * @since 0.0.1\n * @author AMBROISE PARK Consulting\n */\nexport interface ConfirmDeleteDialogProps {\n /** Whether dialog is open */\n open: boolean;\n /** Whether deletion is in progress */\n isLoading: boolean;\n /** Error message if any */\n error: string | null;\n /** Confirm deletion handler */\n onConfirm: () => Promise<void>;\n /** Cancel handler */\n onCancel: () => void;\n}","ReauthDialogProps":"/**\n * Re-authentication dialog props\n *\n * @version 0.1.0\n * @since 0.0.1\n * @author AMBROISE PARK Consulting\n */\nexport interface ReauthDialogProps {\n /** Whether dialog is open */\n open: boolean;\n /** Whether re-authentication is in progress */\n isLoading: boolean;\n /** Error message if any */\n error: string | null;\n /** Re-authentication handler */\n onReauth: (password: string) => Promise<void>;\n /** Cancel handler */\n onCancel: () => void;\n}"}
1
+ {"useAuth":"/**\n * React hook for authentication with property-based access\n *\n * Single entry point for all authentication operations.\n * Lazy loads FirebaseAuth on first call and connects to store.\n * Uses unified FeatureStatus enum for lifecycle management.\n *\n * **Property-based access (clean and simple):**\n * ```typescript\n * // ✅ State from store (reactive, re-renders on change)\n * const user = useAuth('user');\n * const status = useAuth('status'); // 'initializing' | 'ready' | 'degraded' | 'error'\n * const loading = useAuth('loading');\n * const error = useAuth('error');\n *\n * // ✅ Methods from instance (stable, never re-renders)\n * const signIn = useAuth('signInWithEmail');\n * const signOut = useAuth('signOut');\n * ```\n *\n * **How it works:**\n * - Store properties (user, status, loading, etc.) → Subscribe via Zustand (reactive)\n * - Methods (signInWithEmail, etc.) → Get from FirebaseAuth instance (stable)\n *\n * **Status-based behavior:**\n * - `initializing`: Auth is loading (returns degraded API until ready)\n * - `ready`: Auth fully operational (returns real API)\n * - `degraded`: Auth unavailable (returns degraded API)\n * - `error`: Auth encountered error (returns degraded API)\n *\n * **Error Handling:**\n * All async methods throw DoNotDevError (already wrapped by FirebaseAuth/SmartRecovery).\n *\n * @template K - The property key from AuthAPI\n * @param key - Property name to access\n * @returns The value of the specified property\n *\n * @example\n * ```typescript\n * // Get status (re-renders when status changes)\n * const status = useAuth('status');\n * if (status === 'initializing') return <Spinner overlay />;\n * if (status === 'degraded') return <Error>Auth unavailable</Error>;\n *\n * // Get user (re-renders when user changes)\n * const user = useAuth('user');\n * if (!user) return <LoginButton />;\n *\n * // Get sign-in method (stable, never re-renders)\n * const signIn = useAuth('signInWithEmail');\n * await signIn(email, password);\n * ```\n *\n * @version 0.1.0\n * @since 0.0.1\n * @author AMBROISE PARK Consulting\n */\nexport declare function useAuth<K extends keyof AuthAPI>(key: K): AuthAPI[K];","useDeleteAccount":"/**\n * Hook for managing account deletion flow\n *\n * Handles:\n * - Confirmation dialog\n * - Password dialog (when password is required for reauthentication)\n * - Error states\n * - Loading states\n *\n * Reauthentication is handled internally by FirebaseAuth.deleteAccount():\n * - OAuth providers: Automatically triggers popup\n * - Password providers: Requires password parameter\n *\n * **Server refusals**: when the server refuses the deletion (e.g. a\n * `createDeleteAccount({ beforeDelete })` that throws `open_orders`), `error` is the\n * translation of `deleteAccount.errors.<code>` in the `auth` namespace when that key\n * exists. The code is looked up as the server's `code`, then its `error` message, then\n * the client error message; only `[A-Za-z0-9_-]+` values are tried. Without a matching\n * key, `error` is the raw error message (unchanged behaviour). Consumers add the keys\n * in their `auth` locale override, e.g. `src/locales/auth_fr.json`:\n *\n * ```json\n * { \"deleteAccount\": { \"errors\": {\n * \"open_orders\": \"Vous avez une commande en cours. Réessayez après sa livraison.\"\n * } } }\n * ```\n *\n * @example\n * ```tsx\n * const deletion = useDeleteAccount();\n *\n * // Start flow\n * <Button onClick={deletion.startDeleteFlow}>Delete Account</Button>\n *\n * // Dialogs\n * <ReauthDialog\n * open={deletion.showPasswordDialog}\n * onReauth={(password) => deletion.confirmDelete(password)}\n * onCancel={deletion.cancel}\n * />\n * <ConfirmDeleteDialog\n * open={deletion.showConfirmDialog}\n * onConfirm={() => deletion.confirmDelete()}\n * onCancel={deletion.cancel}\n * />\n * ```\n *\n * @version 0.2.0\n * @since 0.0.1\n * @author AMBROISE PARK Consulting\n * @returns Account deletion state and actions\n */\nexport declare function useDeleteAccount(): DeleteAccountState;","DeleteAccountState":"/**\n * Account deletion state and actions\n *\n * @version 0.1.0\n * @since 0.0.1\n * @author AMBROISE PARK Consulting\n */\nexport interface DeleteAccountState {\n /** Whether confirmation dialog is visible */\n showConfirmDialog: boolean;\n /** Whether account deletion is in progress */\n isDeleting: boolean;\n /** Whether password re-authentication dialog is visible */\n showPasswordDialog: boolean;\n /** Error message if any */\n error: string | null;\n /** Start the deletion flow (shows confirmation dialog) */\n startDeleteFlow: () => void;\n /** Confirm deletion (executes actual deletion, handles reauthentication internally) */\n confirmDelete: (password?: string) => Promise<void>;\n /** Cancel deletion flow (closes dialogs) */\n cancel: () => void;\n}","getAuthState":"/**\n * Get current auth state synchronously\n * Use this in Zustand stores or other non-React contexts\n *\n * **Behavior:**\n * - Always returns valid state (never throws)\n * - Returns initial state if auth is not initialized: `{ user: null, initialized: false, ... }`\n * - Works in both client and server contexts (server returns initial state)\n * - No graceful degradation needed - store always exists with valid initial state\n *\n * @returns Current auth state (or initial state if not initialized)\n *\n * @example\n * ```typescript\n * const authState = getAuthState();\n * const userId = authState.userId; // null if not authenticated\n * const user = authState.user; // null if not authenticated\n * const isInitialized = authState.initialized; // false until auth initializes\n * ```\n */\nexport declare function getAuthState(): AuthState & AuthActions;","subscribeToAuth":"/**\n * Subscribe to auth state changes\n * Use this in Zustand stores or other non-React contexts\n *\n * **Behavior:**\n * - Always returns unsubscribe function (never throws)\n * - Subscriptions work even if auth is not initialized\n * - On server, subscription is a no-op (returns empty unsubscribe function)\n * - Listener receives initial state immediately, then updates as auth state changes\n *\n * **Important:** Always call the returned unsubscribe function to prevent memory leaks.\n *\n * @param listener - Callback function that receives (state, prevState)\n * @returns Unsubscribe function (call to remove listener)\n *\n * @example\n * ```typescript\n * const unsubscribe = subscribeToAuth((state, prevState) => {\n * if (state.user?.id !== prevState.user?.id) {\n * // User changed - handle accordingly\n * if (state.user) {\n * console.log('User signed in:', state.user.id);\n * } else {\n * console.log('User signed out');\n * }\n * }\n * });\n *\n * // Later, cleanup\n * unsubscribe();\n * ```\n */\nexport declare function subscribeToAuth(listener: (state: AuthState & AuthActions, prevState: AuthState & AuthActions) => void): () => void;","AuthPartnerButton":"/**\n * AuthPartnerButton - Authentication button component\n *\n * Provides a unified button interface for authentication with various partners\n * (Google, Facebook, etc.) and methods (OAuth, email/password, email link).\n *\n * @version 0.1.0\n * @since 0.0.1\n * @author AMBROISE PARK Consulting\n */\ndeclare function AuthPartnerButton({ partnerId, method, onSuccess, onError, className, children, disabled, display, style, ...props }","ConfirmDeleteDialog":"/**\n * Confirmation dialog for account deletion\n *\n * Shows warning, lists what will be deleted, and requires explicit confirmation.\n *\n * @example\n * ```tsx\n * <ConfirmDeleteDialog\n * open={showConfirmDialog}\n * isLoading={isDeleting}\n * error={error}\n * onConfirm={confirmDelete}\n * onCancel={cancel}\n * />\n * ```\n *\n * @version 0.1.0\n * @since 0.0.1\n * @author AMBROISE PARK Consulting\n */\nexport declare function ConfirmDeleteDialog({ open, isLoading, error, onConfirm, onCancel, }","FeatureGuard":"/**\n * FeatureGuard component that protects individual components based on user permissions\n *\n * Provides granular feature access control within pages, allowing developers to show/hide\n * features based on user permissions without manual hook management. This complements\n * the route-level AuthGuard by providing component-level protection within pages.\n *\n * **Key Features:**\n * - Role-based access control (user, admin)\n * - Subscription tier validation (free, pro, premium)\n * - Active subscription requirement checking\n * - Custom validation functions\n * - Automatic fallback components with context\n * - Graceful degradation when auth unavailable\n * - Loading state handling\n *\n * **Fallback Behavior:**\n * - Shows loading skeleton while auth state loads\n * - Displays AuthFallback for unauthenticated users (if showLoginPrompt=true)\n * - Shows UpgradePrompt for tier restrictions (if showUpgradePrompt=true)\n * - Displays AccessDenied for role restrictions\n * - Shows SubscriptionExpired for subscription requirements\n * - Renders custom fallback if provided\n * - Returns null if no fallback should be shown\n *\n * **Performance:**\n * - Uses useAuth() hook for reactive updates\n * - Memoizes permission checks\n * - Minimal re-renders on auth state changes\n * - Lazy loading compatible\n *\n * @param props - FeatureGuard configuration\n * @returns Protected component or fallback component\n *\n * @version 0.1.0\n * @since 0.0.1\n * @author AMBROISE PARK Consulting\n */\nexport declare function FeatureGuard({ children, role, tier, subscription, validate, fallback: CustomFallback, message, showUpgradePrompt, showLoginPrompt, }","GoogleOneTap":"/**\n * Google One Tap authentication component\n *\n * @description\n * Displays Google One Tap prompt for seamless authentication.\n * As of October 2024, FedCM is mandatory - shows clear browser\n * compatibility message if not supported.\n *\n * **Positioning:**\n * Fixed to top-right, below header/breadcrumbs automatically.\n *\n * **States:**\n * - Loading: Shows spinner while initializing\n * - Error: Shows error message with details\n * - Not Supported: Shows browser upgrade message\n * - Ready: Invisible container for Google prompt\n *\n * @param props - Component configuration\n *\n * @version 0.1.0\n * @since 0.0.1\n * @author AMBROISE PARK Consulting\n */\ndeclare function GoogleOneTap({ clientId, onSuccess, onError, autoSelect, cancelOnTapOutside, className, disabled, promptParentId, allowedParentOrigins, cspNonce, clientOnly, showErrorDetails, loadingComponent: LoadingComponent, errorComponent: ErrorComponent, browserNotSupportedComponent: BrowserNotSupportedComponent, }","LoginModal":"declare const LoginModal: (props: LoginModalProps) => import(\"react\").JSX.Element;","MultipleAuthProviders":"/**\n * Multiple auth providers component with automatic fallback handling\n *\n * @version 0.1.0\n * @since 0.0.1\n * @author AMBROISE PARK Consulting\n */\ndeclare const MultipleAuthProviders: (props: MultipleAuthProvidersProps) => import(\"react\").JSX.Element;","ReauthDialog":"/**\n * Re-authentication dialog for account deletion\n *\n * Prompts user to re-enter password for security before account deletion.\n *\n * @example\n * ```tsx\n * <ReauthDialog\n * open={showReauthDialog}\n * isLoading={isReauthenticating}\n * error={error}\n * onReauth={reauthenticate}\n * onCancel={cancel}\n * />\n * ```\n *\n * @version 0.1.0\n * @since 0.0.1\n * @author AMBROISE PARK Consulting\n */\nexport declare function ReauthDialog({ open, isLoading, error, onReauth, onCancel, }","EmailPasswordForm":"/**\n * Email/password form with three views: sign in (remember me, forgot password),\n * sign up (password policy + strength, breached-password check, confirmation,\n * consent) and forgot password. Success calls `onSuccess` at once; what the user must\n * still do arrives as a toast that stays until dismissed.\n *\n * @component\n * @example\n * ```tsx\n * <EmailPasswordForm onSuccess={() => setOpen(false)} />\n * ```\n */\ndeclare function EmailPasswordForm({ mode, onSuccess, onError, className, tos, privacy, captchaToken, }","AUTH_FIELD":"/** Field names the flows read from the submitted form. */\nexport declare const AUTH_FIELD: {\n readonly EMAIL: \"email\";\n readonly PASSWORD: \"password\";\n readonly CONFIRM_PASSWORD: \"confirmPassword\";\n readonly REMEMBER_ME: \"rememberMe\";\n readonly CONSENT: \"consent\";\n}","useEmailSignIn":"/**\n * Email + password sign-in. Remember me is applied when the form renders\n * `AuthRememberMeField`; an unconfirmed address offers a resend.\n *\n * @param options - Callbacks and CAPTCHA token\n * @returns The flow, for `AuthForm`\n *\n * @example\n * ```tsx\n * const flow = useEmailSignIn({ onSuccess: close });\n * <AuthForm flow={flow}>\n * <AuthEmailField />\n * <AuthPasswordField />\n * <AuthRememberMeField />\n * <AuthFormAlerts />\n * <AuthSubmitButton />\n * </AuthForm>\n * ```\n */\nexport declare function useEmailSignIn(options?: EmailAuthFlowOptions): EmailAuthFlow;","useEmailSignUp":"/**\n * Email + password sign-up. Password policy and breached-password check apply; the\n * confirmation field and consent are required when the form renders them.\n *\n * Anti-enumeration: an address that already has an account ends exactly like a new\n * one (\"check your email\"). When the provider asks for confirmation, `onSuccess` runs\n * and a toast that stays until dismissed tells the user to confirm, with Resend.\n *\n * @param options - Callbacks, CAPTCHA token, password minimum, extra metadata\n * @returns The flow, for `AuthForm`\n */\nexport declare function useEmailSignUp(options?: EmailSignUpOptions): EmailAuthFlow;","usePasswordResetRequest":"/**\n * Password-reset request. Anti-enumeration: the same outcome whether or not the address\n * has an account; `onSuccess` runs and a toast that stays until dismissed says to check\n * the inbox.\n *\n * @param options - Callbacks and CAPTCHA token\n * @returns The flow, for `AuthForm`\n */\nexport declare function usePasswordResetRequest(options?: EmailAuthFlowOptions): EmailAuthFlow;","AuthFieldErrors":"/** Per-field validation messages, keyed by field name. */\nexport interface AuthFieldErrors {\n email?: string;\n password?: string;\n confirmPassword?: string;\n consent?: string;\n}","EmailAuthFlow":"/** What a form needs from a flow: pass it to `AuthForm`. */\nexport interface EmailAuthFlow {\n /** The flow this is */\n mode: EmailAuthMode;\n /** Form submit handler */\n onSubmit: (event: FormEvent<HTMLFormElement>) => void;\n /** A submit is in progress */\n busy: boolean;\n /** The provider is ready (submit disabled until then) */\n ready: boolean;\n /** The provider failed to start: show an \"unavailable\" notice instead of the form */\n unavailable: boolean;\n /** Submit is blocked (CAPTCHA token missing, throttled) */\n blocked: boolean;\n /** Form-level error (provider error, throttle) */\n error: string | null;\n /** Per-field validation errors */\n fieldErrors: AuthFieldErrors;\n /** Address whose sign-in failed because it was never confirmed (offer a resend) */\n unconfirmedEmail: string | null;\n /** Resend the confirmation email to `email` and confirm with a toast */\n resendVerification: (email: string) => Promise<void>;\n /** Minimum new-password length (sign-up) */\n passwordMinLength: number;\n}","EmailAuthFlowOptions":"/** Options shared by every flow. */\nexport interface EmailAuthFlowOptions {\n /** Called once the flow succeeded: close the dialog / sheet here */\n onSuccess?: () => void;\n /** Called with the provider error after a failed attempt */\n onError?: (error: Error) => void;\n /**\n * CAPTCHA token. `undefined` = no CAPTCHA; while it is `null` / empty the submit is\n * blocked. The app renders the widget.\n */\n captchaToken?: string | null;\n}","EmailAuthMode":"/** Which flow a form runs. */\nexport type EmailAuthMode = 'signin' | 'signup' | 'reset';","EmailSignUpOptions":"/** Options of {@link useEmailSignUp}. */\nexport interface EmailSignUpOptions extends Omit<EmailAuthFlowOptions, 'onSuccess'> {\n /** Called once sign-up succeeded: close the dialog / sheet here */\n onSuccess?: (outcome: EmailSignUpOutcome) => void;\n /** Minimum length of the new password (default 8) */\n passwordMinLength?: number;\n /** Extra sign-up metadata stored with the user (consent metadata is added for you) */\n metadata?: SignUpMetadata;\n /** The app's wording of the \"check your email\" toast (default: framework text) */\n checkEmailMessage?: {\n title: string;\n description?: string;\n };\n}","EmailSignUpOutcome":"/** Outcome of a successful sign-up. */\nexport interface EmailSignUpOutcome {\n /**\n * The address must be confirmed before the user can sign in (no session yet). The\n * flow already showed the \"check your email\" toast with Resend.\n */\n awaitingConfirmation: boolean;\n}","AuthConfirmPasswordField":"/**\n * Second password entry (sign-up, `name=\"confirmPassword\"`). Rendering it makes the\n * flow require a match.\n *\n * @param props - AuthTextFieldProps\n * @returns The field\n */\nexport declare function AuthConfirmPasswordField({ label, placeholder, }","AuthConsentField":"/**\n * Terms / privacy consent (sign-up, `name=\"consent\"`, GDPR). Rendering it makes the\n * flow require it and record `gdpr_consent_at`.\n *\n * @param props - AuthConsentFieldProps\n * @returns The checkbox and links, or nothing when both documents are `false`\n */\nexport declare function AuthConsentField({ tos, privacy }","AuthEmailField":"/**\n * Email field (`name=\"email\"`, `autocomplete=\"username\"`: the identifier password\n * managers pair with the password).\n *\n * @param props - AuthTextFieldProps\n * @returns The field\n */\nexport declare function AuthEmailField({ label, placeholder, defaultValue, }","AuthForm":"/**\n * The `<form>` of an email auth flow. A real form, so password managers pair the\n * fields and Enter submits. Shows an \"unavailable\" notice instead when the auth\n * provider failed to start.\n *\n * @param props - AuthFormProps\n * @returns The form\n */\nexport declare function AuthForm({ flow, children, className }","AuthFormAlerts":"/**\n * Form-level messages: provider error / throttle, and a resend action when sign-in\n * failed on an unconfirmed address.\n *\n * @returns The alerts, or nothing\n */\nexport declare function AuthFormAlerts(): import(\"react\").JSX.Element | null;","AuthPasswordField":"/**\n * Password field. Sign-in: `current-password`. Sign-up: `new-password` and a strength\n * meter with the policy requirements.\n *\n * @param props - AuthTextFieldProps\n * @returns The field\n */\nexport declare function AuthPasswordField({ label, placeholder }","AuthRememberMeField":"/**\n * \"Remember me\" (sign-in, `name=\"rememberMe\"`). Rendered only when the auth provider\n * can honour it; unticked = the session ends with the browser session.\n *\n * @param props - AuthRememberMeFieldProps\n * @returns The checkbox, or nothing when the provider cannot do it\n */\nexport declare function AuthRememberMeField({ label, defaultChecked, }","AuthSubmitButton":"/**\n * Submit button: full width, loading while the flow runs, disabled until the provider\n * is ready and while CAPTCHA / throttle block.\n *\n * @param props - AuthSubmitButtonProps\n * @returns The button\n */\nexport declare function AuthSubmitButton({ children }","AuthConsentFieldProps":"/** Props of {@link AuthConsentField}. */\nexport interface AuthConsentFieldProps {\n /** Terms of Service. Omit: from app config legal links, else `/legal/terms`. `false`: none */\n tos?: AuthLegalDocument | false;\n /** Privacy policy. Omit: from app config legal links, else `/legal/privacy`. `false`: none */\n privacy?: AuthLegalDocument | false;\n}","AuthFormProps":"/** Props of {@link AuthForm}. */\nexport interface AuthFormProps {\n /** The flow this form runs (`useEmailSignIn()`, `useEmailSignUp()`, ...) */\n flow: EmailAuthFlow;\n /** Fields, app content, alerts, submit button */\n children: ReactNode;\n className?: string;\n}","AuthLegalDocument":"/** Legal document: a path (opened in a new tab) or content (shown in a dialog). */\nexport type AuthLegalDocument = string | ReactNode;","AuthRememberMeFieldProps":"/** Props of {@link AuthRememberMeField}. */\nexport interface AuthRememberMeFieldProps {\n /** Label (default: translated \"Remember me\") */\n label?: string;\n /**\n * Initial state.\n * @default true (sessions persist unless the user opts out)\n */\n defaultChecked?: boolean;\n}","AuthSubmitButtonProps":"/** Props of {@link AuthSubmitButton}. */\nexport interface AuthSubmitButtonProps {\n /** Label (default: translated per flow) */\n children?: ReactNode;\n}","AuthTextFieldProps":"/** Props shared by the text fields. */\nexport interface AuthTextFieldProps {\n /** Label (default: translated \"Email\" / \"Password\") */\n label?: string;\n /** Placeholder (default: translated) */\n placeholder?: string;\n /** Initial value */\n defaultValue?: string;\n}","AuthMethod":"type AuthMethod } from '../constants';","AuthPartnerButtonProps":"/**\n * Props for auth partner button\n *\n * @version 0.1.0\n * @since 0.0.1\n * @author AMBROISE PARK Consulting\n */\nexport interface AuthPartnerButtonProps extends AuthCallbackProps, BaseComponentProps {\n partnerId: AuthPartnerId;\n method?: AuthMethod | null;\n children?: React.ReactNode;\n disabled?: boolean;\n /**\n * Display - controls button presentation in preset layouts\n * - 'compact': Icon-only\n * - 'full': Icon + label\n * - 'auto': Responsive (default)\n * @default 'auto'\n */\n display?: (typeof DISPLAY)[keyof typeof DISPLAY];\n}","EmailPasswordFormProps":"/**\n * Props for email/password form\n *\n * @version 0.1.0\n * @since 0.0.1\n * @author AMBROISE PARK Consulting\n */\nexport interface EmailPasswordFormProps extends BaseComponentProps, AuthCallbackProps {\n /** Form mode - defaults to 'signin' */\n mode?: FormMode;\n compact?: boolean;\n /**\n * Terms of Service path or content (signup only - GDPR/French law).\n * - Omit: auto-detects from app config legalLinks, falls back to '/legal/terms'\n * - `string`: path opened in popup window\n * - `ReactNode`: rendered inline in a Dialog modal\n * - `false`: explicitly disable ToS requirement\n */\n tos?: string | React.ReactNode | false;\n /**\n * Privacy Policy path or content (signup only - GDPR/French law).\n * - Omit: auto-detects from app config legalLinks, falls back to '/legal/privacy'\n * - `string`: path opened in popup window\n * - `ReactNode`: rendered inline in a Dialog modal\n * - `false`: explicitly disable Privacy requirement\n */\n privacy?: string | React.ReactNode | false;\n /**\n * CAPTCHA token to include with auth requests.\n * Consumer is responsible for rendering the CAPTCHA widget (e.g. Turnstile)\n * and passing the token here. When provided, submit is blocked until token is truthy.\n */\n captchaToken?: string;\n}","GoogleOneTapProps":"/**\n * Props for Google One Tap component\n *\n * @version 0.1.0\n * @since 0.0.1\n * @author AMBROISE PARK Consulting\n */\nexport interface GoogleOneTapProps extends AuthCallbackProps {\n /** Custom client ID (defaults to env variable) */\n clientId?: string;\n}","LoginModalProps":"/**\n * Props for login modal\n *\n * @version 0.1.0\n * @since 0.0.1\n * @author AMBROISE PARK Consulting\n */\nexport interface LoginModalProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n}","MultipleAuthProvidersProps":"/**\n * Props for multiple auth providers\n *\n * @version 0.1.0\n * @since 0.0.1\n * @author AMBROISE PARK Consulting\n */\nexport interface MultipleAuthProvidersProps extends BaseComponentProps {\n /** Providers to display (defaults to all available providers) */\n providers?: AuthPartnerId[];\n /** CSS class for each provider button */\n buttonClassName?: string;\n}","FeatureGuardProps":"/**\n * Props for FeatureGuard component\n */\nexport interface FeatureGuardProps {\n /** Children to render if access is granted */\n children: ReactNode;\n /** Required role(s) - user must have at least one */\n role?: UserRole | UserRole[];\n /** Required subscription tier */\n tier?: SubscriptionTier;\n /** Whether active subscription is required */\n subscription?: boolean;\n /** Custom validation function */\n validate?: (role: UserRole | undefined, tier: SubscriptionTier | undefined) => boolean;\n /** Fallback component to show when access is denied */\n fallback?: ComponentType<{\n requiredRole?: UserRole | UserRole[];\n requiredTier?: SubscriptionTier;\n requiresSubscription?: boolean;\n userRole?: UserRole;\n userTier?: SubscriptionTier;\n hasSubscription?: boolean;\n }>;\n /** Custom message for fallback */\n message?: string;\n /** Whether to show upgrade prompt for tier restrictions */\n showUpgradePrompt?: boolean;\n /** Whether to show login prompt for auth restrictions */\n showLoginPrompt?: boolean;\n}","ConfirmDeleteDialogProps":"/**\n * Confirmation dialog props\n *\n * @version 0.1.0\n * @since 0.0.1\n * @author AMBROISE PARK Consulting\n */\nexport interface ConfirmDeleteDialogProps {\n /** Whether dialog is open */\n open: boolean;\n /** Whether deletion is in progress */\n isLoading: boolean;\n /** Error message if any */\n error: string | null;\n /** Confirm deletion handler */\n onConfirm: () => Promise<void>;\n /** Cancel handler */\n onCancel: () => void;\n}","ReauthDialogProps":"/**\n * Re-authentication dialog props\n *\n * @version 0.1.0\n * @since 0.0.1\n * @author AMBROISE PARK Consulting\n */\nexport interface ReauthDialogProps {\n /** Whether dialog is open */\n open: boolean;\n /** Whether re-authentication is in progress */\n isLoading: boolean;\n /** Error message if any */\n error: string | null;\n /** Re-authentication handler */\n onReauth: (password: string) => Promise<void>;\n /** Cancel handler */\n onCancel: () => void;\n}"}