@donotdev/auth 0.0.22 → 0.1.1
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.md +3 -3
- package/dist/AuthStore.d.ts +1 -1
- package/dist/AuthStore.d.ts.map +1 -1
- package/dist/AuthStore.js +1 -1
- package/dist/authHelpers.js +1 -1
- package/dist/components/AccountLinking.js +1 -1
- package/dist/components/AuthFallback.d.ts +3 -3
- package/dist/components/AuthFallback.js +1 -1
- package/dist/components/AuthPartnerButton.d.ts +1 -1
- package/dist/components/AuthPartnerButton.js +2 -2
- package/dist/components/DeleteAccountDialogs.d.ts +4 -4
- package/dist/components/DeleteAccountDialogs.js +1 -1
- package/dist/components/EmailLinkForm.d.ts +1 -1
- package/dist/components/EmailLinkForm.js +1 -1
- package/dist/components/EmailPasswordForm.d.ts +11 -4
- package/dist/components/EmailPasswordForm.d.ts.map +1 -1
- package/dist/components/EmailPasswordForm.js +2 -1
- package/dist/components/EmailVerification.d.ts +1 -1
- package/dist/components/EmailVerification.js +1 -1
- package/dist/components/Feature.d.ts +6 -6
- package/dist/components/Feature.js +1 -1
- package/dist/components/FeatureGuard.d.ts +3 -3
- package/dist/components/FeatureGuard.js +1 -1
- package/dist/components/FeaturePlaceholder.d.ts +3 -3
- package/dist/components/FeaturePlaceholder.js +1 -1
- package/dist/components/GoogleOneTap.d.ts +1 -1
- package/dist/components/GoogleOneTap.js +1 -1
- package/dist/components/LoginModal.js +1 -1
- package/dist/components/MultipleAuthProviders.d.ts +1 -1
- package/dist/components/MultipleAuthProviders.js +1 -1
- package/dist/components/NetworkStatusIndicator.d.ts +1 -1
- package/dist/components/NetworkStatusIndicator.js +1 -1
- package/dist/components/PasswordResetCallback.d.ts +12 -0
- package/dist/components/PasswordResetCallback.d.ts.map +1 -0
- package/dist/components/PasswordResetCallback.js +2 -0
- package/dist/components/PasswordStrengthIndicator.d.ts +1 -1
- package/dist/components/PasswordStrengthIndicator.js +1 -1
- package/dist/components/PasswordUpdateDialog.d.ts +1 -1
- package/dist/components/PasswordUpdateDialog.js +1 -1
- package/dist/components/RateLimitAlert.d.ts +1 -1
- package/dist/components/RateLimitAlert.js +1 -1
- package/dist/components/index.d.ts +2 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/constants.d.ts +42 -20
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +1 -1
- package/dist/hooks/useAccountLinking.d.ts +1 -1
- package/dist/hooks/useAccountLinking.js +1 -1
- package/dist/hooks/useAuthMethodToggle.d.ts +1 -1
- package/dist/hooks/useAuthMethodToggle.js +1 -1
- package/dist/hooks/useAuthPartner.d.ts +1 -1
- package/dist/hooks/useAuthPartner.js +1 -1
- package/dist/hooks/useDeleteAccount.d.ts +2 -2
- package/dist/hooks/useDeleteAccount.js +1 -1
- package/dist/hooks/useEmailLinkAuth.d.ts +1 -1
- package/dist/hooks/useEmailLinkAuth.js +1 -1
- package/dist/hooks/useEmailLinkForm.d.ts +3 -3
- package/dist/hooks/useEmailLinkForm.js +1 -1
- package/dist/hooks/useFedCM.js +1 -1
- package/dist/hooks/useGoogleOneTap.js +1 -1
- package/dist/hooks/useNetworkStatus.d.ts +1 -1
- package/dist/hooks/useNetworkStatus.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/symbol-index.json +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/useAuth.d.ts +1 -1
- package/dist/useAuth.d.ts.map +1 -1
- package/dist/useAuth.js +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PasswordResetCallback - Zero-config overlay
|
|
3
|
+
*
|
|
4
|
+
* Mount once at layout/provider level. Renders nothing until a password reset
|
|
5
|
+
* callback is detected (URL hash, store state, or query params).
|
|
6
|
+
* Then renders a full-screen Dialog with the appropriate UI.
|
|
7
|
+
*
|
|
8
|
+
* @component
|
|
9
|
+
* @version 0.2.0
|
|
10
|
+
*/
|
|
11
|
+
export declare function PasswordResetCallback(): import("react/jsx-runtime").JSX.Element | null;
|
|
12
|
+
//# sourceMappingURL=PasswordResetCallback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PasswordResetCallback.d.ts","sourceRoot":"","sources":["../../src/components/PasswordResetCallback.tsx"],"names":[],"mappings":"AA2IA;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,mDAgTpC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";import{jsx as s,jsxs as p}from"react/jsx-runtime";import{useCallback as L,useEffect as j,useState as f}from"react";import{useForm as M,Controller as N,useWatch as Y}from"react-hook-form";import{Alert as x,ALERT_VARIANT as C,Button as A,BUTTON_VARIANT as _,Dialog as z,PasswordInput as V,Spinner as H,Stack as h,Text as b}from"@donotdev/components";import{useTranslation as Z}from"@donotdev/core";import{useAuth as P}from"../useAuth";import{useAuthStore as W}from"../AuthStore";import{PasswordStrengthIndicator as $}from"./PasswordStrengthIndicator";function G(){if(typeof window>"u")return{type:null};const r=window.location.hash.slice(1);if(r){const n=new URLSearchParams(r),m=n.get("error_code");if(m){const l={type:"supabase_error",errorCode:m,errorDescription:n.get("error_description")?.replace(/\+/g," ")||void 0};return window.history.replaceState(null,"",window.location.pathname+window.location.search),l}if(n.get("type")==="recovery")return window.history.replaceState(null,"",window.location.pathname+window.location.search),{type:"supabase_recovery"}}const u=new URLSearchParams(window.location.search),d=u.get("oobCode");return d&&u.get("mode")==="resetPassword"?{type:"firebase",oobCode:d}:{type:null}}async function X(r){try{const d=new TextEncoder().encode(r),n=await crypto.subtle.digest("SHA-1",d),l=Array.from(new Uint8Array(n)).map(c=>c.toString(16).padStart(2,"0")).join("").toUpperCase(),t=l.slice(0,5),o=l.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(c=>{const[g]=c.split(":");return g?.trim()===o}):!1}catch{return!1}}function oe(){const{t:r}=Z("auth"),u=P("passwordResetPending"),d=P("verifyPasswordResetCode"),n=P("confirmPasswordReset"),m=P("updatePassword"),l=P("signInWithEmail"),[t,o]=f("idle"),[i,R]=f(null),[c,g]=f(null),[E,B]=f(!1),[D,k]=f(null),{control:v,handleSubmit:F,getValues:O,formState:{errors:a,isSubmitting:y},setError:q}=M({mode:"onChange",defaultValues:{password:"",confirmPassword:""}}),I=Y({control:v,name:"password"});j(()=>{if(t!=="idle")return;const e=G();if(e.type==="supabase_error"){e.errorCode==="otp_expired"?o("expired"):(k(e.errorDescription||null),o("invalid"));return}if(e.type==="firebase"&&e.oobCode){B(!0),g(e.oobCode),o("loading"),d(e.oobCode).then(w=>{w?(R(w),o("ready")):o("expired")});return}u&&o("ready")},[u,t,d]);const U=L(async e=>{try{if(E&&c){if(await n(c,e.password),i)try{await l(i,e.password)}catch{}}else await m(e.password),W.getState().setPasswordResetPending(!1);o("idle")}catch(w){const T=w instanceof Error?w.message:String(w);T.includes("expired")||T.includes("EXPIRED")?o("expired"):q("root",{message:r("resetPassword.error","Failed to reset password. Please try again.")})}},[E,c,i,n,m,l,q,r]),S=L(()=>{o("idle"),R(null),g(null),k(null),W.getState().setPasswordResetPending(!1),typeof window<"u"&&window.history.replaceState(null,"",window.location.pathname)},[]);return t==="idle"?null:p(z,{open:!0,onOpenChange:e=>{e||S()},style:{maxWidth:"min(28rem, 90vw)"},title:t==="success"?r("resetPassword.success_title","Password updated"):t==="expired"||t==="invalid"?r("resetPassword.expired_title","Link expired"):t==="loading"?r("resetPassword.verifying","Verifying..."):r("resetPassword.title","Set new password"),showClose:!0,children:[t==="loading"&&p(h,{align:"center",justify:"center",children:[s(H,{}),s(b,{level:"body",variant:"muted",children:r("resetPassword.verifying","Verifying reset link...")})]}),(t==="expired"||t==="invalid")&&p(h,{children:[s(x,{variant:C.WARNING,description:t==="expired"?r("resetPassword.expired_description","This password reset link has expired. Please request a new one."):D||r("resetPassword.invalid_description","This password reset link is invalid. Please request a new one.")}),s(A,{variant:_.PRIMARY,onClick:S,fullWidth:!0,children:r("resetPassword.back_to_signin","Back to Sign In")})]}),t==="success"&&p(h,{children:[s(x,{variant:C.SUCCESS,description:r("resetPassword.success_description","Your password has been reset successfully. You are now signed in.")}),s(A,{variant:_.PRIMARY,onClick:S,fullWidth:!0,children:r("resetPassword.continue","Continue")})]}),t==="ready"&&s("form",{onSubmit:F(U),noValidate:!0,children:p(h,{children:[i&&s(b,{level:"small",variant:"muted",children:r("resetPassword.for_email",`Enter a new password for ${i}`)}),a.root&&s(x,{variant:C.ERROR,description:a.root.message}),s(N,{name:"password",control:v,rules:{required:r("passwordRequired","Password is required"),minLength:{value:8,message:r("passwordMinLength","Password must be at least 8 characters")},validate:{uppercase:e=>!e||/[A-Z]/.test(e)||r("passwordRequirement.uppercase","One uppercase letter"),lowercase:e=>!e||/[a-z]/.test(e)||r("passwordRequirement.lowercase","One lowercase letter"),number:e=>!e||/[0-9]/.test(e)||r("passwordRequirement.number","One number"),special:e=>!e||/[^a-zA-Z0-9]/.test(e)||r("passwordRequirement.special","One special character"),breached:async e=>!e||e.length<8?!0:!await X(e)||r("errors.breached_password","This password has appeared in a data breach.")}},render:({field:e})=>p(h,{gap:"tight",children:[s(V,{...e,label:r("resetPassword.new_password","New password"),placeholder:r("passwordPlaceholder","Enter your password"),autoComplete:"new-password",disabled:y,"aria-invalid":!!a.password,"aria-describedby":a.password?"reset-password-error":void 0,className:"dndev-w-full","data-variant":a.password?"destructive":void 0}),a.password&&s(b,{as:"span",level:"caption",variant:"destructive",id:"reset-password-error",role:"alert",children:a.password.message})]})}),s(N,{name:"confirmPassword",control:v,rules:{required:r("confirmPasswordRequired","Please confirm your password"),validate:e=>e===O("password")||r("confirmPasswordMismatch","Passwords do not match")},render:({field:e})=>p(h,{gap:"tight",children:[s(V,{...e,label:r("confirmPassword","Confirm password"),placeholder:r("confirmPasswordPlaceholder","Re-enter your password"),autoComplete:"new-password",disabled:y,"aria-invalid":!!a.confirmPassword,"aria-describedby":a.confirmPassword?"reset-confirm-error":void 0,className:"dndev-w-full","data-variant":a.confirmPassword?"destructive":void 0}),a.confirmPassword&&s(b,{as:"span",level:"caption",variant:"destructive",id:"reset-confirm-error",role:"alert",children:a.confirmPassword.message})]})}),I&&s($,{password:I,minLength:8,showRequirements:!0}),s(A,{type:"submit",variant:_.PRIMARY,disabled:y,fullWidth:!0,children:y?r("loading","Loading..."):r("resetPassword.submit","Reset Password")})]})})]})}export{oe as PasswordResetCallback};
|
|
@@ -16,7 +16,7 @@ export type PasswordStrength = 'weak' | 'fair' | 'good' | 'strong';
|
|
|
16
16
|
* Uses Progress component for the strength bar and Text for labels.
|
|
17
17
|
*
|
|
18
18
|
* @component
|
|
19
|
-
* @version 0.0
|
|
19
|
+
* @version 0.1.0
|
|
20
20
|
*/
|
|
21
21
|
export declare function PasswordStrengthIndicator({ password, minLength, showRequirements, className, }: PasswordStrengthIndicatorProps): import("react/jsx-runtime").JSX.Element;
|
|
22
22
|
//# sourceMappingURL=PasswordStrengthIndicator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsxs as
|
|
1
|
+
"use client";import{jsxs as n,jsx as s}from"react/jsx-runtime";import{Check as v,Circle as w}from"lucide-react";import{useMemo as g}from"react";import{Progress as b,Stack as i,Text as l,cn as k}from"@donotdev/components";import{useTranslation as S}from"@donotdev/core";function q(e){if(!e)return"weak";let t=0;return e.length>=8&&(t+=1),e.length>=12&&(t+=1),/[a-z]/.test(e)&&(t+=1),/[A-Z]/.test(e)&&(t+=1),/[0-9]/.test(e)&&(t+=1),/[^a-zA-Z0-9]/.test(e)&&(t+=1),t<=2?"weak":t<=4?"fair":t<=5?"good":"strong"}function x(e,t,a){return[{label:a("passwordRequirement.length",`At least ${t} characters`),met:e.length>=t},{label:a("passwordRequirement.uppercase","One uppercase letter"),met:/[A-Z]/.test(e)},{label:a("passwordRequirement.lowercase","One lowercase letter"),met:/[a-z]/.test(e)},{label:a("passwordRequirement.number","One number"),met:/[0-9]/.test(e)},{label:a("passwordRequirement.special","One special character (!@#$%^&*)"),met:/[^a-zA-Z0-9]/.test(e)}]}const P={weak:25,fair:50,good:75,strong:100},u={weak:"destructive",fair:"warning",good:"accent",strong:"success"};function O({password:e,minLength:t=8,showRequirements:a=!0,className:m}){const{t:r}=S("auth"),c=g(()=>q(e),[e]),h=g(()=>x(e,t,(d,f)=>r(d,f||"")),[e,t,r]),p={weak:r("passwordStrength.weak","Weak"),fair:r("passwordStrength.fair","Fair"),good:r("passwordStrength.good","Good"),strong:r("passwordStrength.strong","Strong")};return n(i,{gap:"tight",className:k("dndev-password-strength",m),children:[n(i,{gap:"tight",children:[n(i,{direction:"row",align:"center",justify:"between",gap:"tight",children:[n(l,{as:"span",level:"caption",variant:"muted",children:[r("passwordStrength.label","Password strength"),":"]}),s(l,{as:"strong",level:"caption",variant:u[c],children:p[c]})]}),s(b,{value:P[c],variant:u[c],className:"dndev-password-strength-bar"})]}),a&&n(i,{gap:"tight",className:"dndev-password-requirements",children:[n(l,{as:"strong",level:"caption",variant:"muted",children:[r("passwordRequirements","Password requirements"),":"]}),s(i,{gap:"tight","data-inset":"true",children:h.map((o,d)=>n(i,{direction:"row",align:"center",gap:"tight",className:"dndev-password-requirement-item",children:[o.met?s(v,{className:"dndev-size-xs","data-variant":"success"}):s(w,{className:"dndev-size-xs","data-variant":"muted"}),s(l,{as:"span",level:"caption",variant:o.met?"success":"muted","data-opacity":o.met?void 0:"70",children:o.label})]},d))})]})]})}export{O as PasswordStrengthIndicator};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as e,jsxs as i,Fragment as P}from"react/jsx-runtime";import{useState as C}from"react";import{useForm as S,Controller as T,useWatch as E}from"react-hook-form";import{Alert as N,ALERT_VARIANT as x,Button as d,BUTTON_VARIANT as u,Dialog as A,PasswordInput as I,Stack as g,Text as L}from"@donotdev/components";import{useTranslation as O}from"@donotdev/core";import{PasswordStrengthIndicator as R}from"./PasswordStrengthIndicator";function U({updatePassword:m}){const{t:r}=O("profile"),[f,n]=C(!1),{control:l,handleSubmit:h,formState:{errors:s,isSubmitting:o},setError:y,reset:p}=S({mode:"onChange",defaultValues:{password:""}}),c=E({control:l,name:"password"}),b=async a=>{try{await m(a.password),n(!1),p()}catch(t){const v=t instanceof Error?t.message:String(t);y("root",{message:v||r("profile.security.password.dialog.error","Failed to update password")})}},w=a=>{n(a),a||p()};return e(A,{open:f,onOpenChange:w,trigger:e(d,{variant:u.OUTLINE,children:r("profile.security.password.change","Change Password")}),title:r("profile.security.password.dialog.title","Change Password"),description:r("profile.security.password.dialog.description","Enter your new password below"),footer:i(P,{children:[e(d,{variant:u.OUTLINE,onClick:()=>w(!1),disabled:o,children:r("profile.security.password.dialog.cancel","Cancel")}),e(d,{onClick:h(b),disabled:o||!c,children:o?r("profile.security.password.dialog.updating","Updating..."):r("profile.security.password.dialog.update","Update Password")})]}),children:i(g,{children:[s.root&&e(N,{variant:x.ERROR,description:s.root.message}),e(T,{name:"password",control:l,rules:{required:r("profile.security.password.dialog.required","Password is required"),minLength:{value:8,message:r("profile.security.password.dialog.minLength","Password must be at least 8 characters")}},render:({field:a})=>i(g,{gap:"tight",children:[e(I,{...a,label:r("profile.security.password.dialog.newPassword","New Password"),placeholder:r("profile.security.password.dialog.placeholder","Enter new password"),disabled:o,"aria-invalid":!!s.password,"aria-describedby":s.password?"password-update-error":void 0,className:"dndev-w-full","data-variant":s.password?"destructive":void 0}),s.password&&e(L,{as:"span",level:"caption",variant:"destructive",id:"password-update-error",role:"alert",children:s.password.message})]})}),e(R,{password:c||"",minLength:8})]})})}var q=U;export{q as default};
|
|
@@ -11,7 +11,7 @@ interface RateLimitAlertProps {
|
|
|
11
11
|
* Shows warnings when users are approaching or have exceeded rate limits.
|
|
12
12
|
* Currently not implemented in the new API but kept for future use.
|
|
13
13
|
*
|
|
14
|
-
* @version 0.0
|
|
14
|
+
* @version 0.1.0
|
|
15
15
|
* @since 0.0.1
|
|
16
16
|
* @author AMBROISE PARK Consulting
|
|
17
17
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useTranslation as t}from"@donotdev/core";const
|
|
1
|
+
"use client";import{useTranslation as t}from"@donotdev/core";const e=({identifier:i,className:n=""})=>{const{t:r}=t("auth");return null};var l=e;export{l as default};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @fileoverview Auth components
|
|
3
3
|
* @description Authentication UI components
|
|
4
4
|
*
|
|
5
|
-
* @version 0.0
|
|
5
|
+
* @version 0.1.0
|
|
6
6
|
* @since 0.0.1
|
|
7
7
|
* @author AMBROISE PARK Consulting
|
|
8
8
|
*/
|
|
@@ -18,6 +18,7 @@ export { default as LoginModal } from './LoginModal';
|
|
|
18
18
|
export { default as MultipleAuthProviders } from './MultipleAuthProviders';
|
|
19
19
|
export { default as NetworkStatusIndicator } from './NetworkStatusIndicator';
|
|
20
20
|
export { default as PasswordUpdateDialog } from './PasswordUpdateDialog';
|
|
21
|
+
export { PasswordResetCallback } from './PasswordResetCallback';
|
|
21
22
|
export { PasswordStrengthIndicator } from './PasswordStrengthIndicator';
|
|
22
23
|
export { default as RateLimitAlert } from './RateLimitAlert';
|
|
23
24
|
export * from './DeleteAccountDialogs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,cAAc,WAAW,CAA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B,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,cAAc,wBAAwB,CAAC"}
|
package/dist/components/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./AuthFallback";import{default as
|
|
1
|
+
export*from"./AuthFallback";import{default as e}from"./EmailPasswordForm";import{default as f}from"./AuthPartnerButton";import{default as s}from"./EmailVerification";export*from"./Feature";export*from"./FeatureGuard";export*from"./FeaturePlaceholder";import{default as u}from"./GoogleOneTap";import{default as n}from"./LoginModal";import{default as w}from"./MultipleAuthProviders";import{default as g}from"./NetworkStatusIndicator";import{default as A}from"./PasswordUpdateDialog";import{PasswordResetCallback as E}from"./PasswordResetCallback";import{PasswordStrengthIndicator as L}from"./PasswordStrengthIndicator";import{default as R}from"./RateLimitAlert";export*from"./DeleteAccountDialogs";export{f as AuthPartnerButton,e as EmailPasswordForm,s as EmailVerification,u as GoogleOneTap,n as LoginModal,w as MultipleAuthProviders,g as NetworkStatusIndicator,E as PasswordResetCallback,L as PasswordStrengthIndicator,A as PasswordUpdateDialog,R as RateLimitAlert};
|
package/dist/constants.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @fileoverview Authentication Constants
|
|
3
3
|
* @description Authentication constants - single source of truth for default behavior. Industry standard: redirect as default in production, popup in development. Defines auth method types and default configuration values.
|
|
4
4
|
*
|
|
5
|
-
* @version 0.0
|
|
5
|
+
* @version 0.1.0
|
|
6
6
|
* @since 0.0.1
|
|
7
7
|
* @author AMBROISE PARK Consulting
|
|
8
8
|
*/
|
|
@@ -14,7 +14,7 @@ export { AUTH_PARTNER_STATE as PARTNER_STATE, type AuthPartnerState as PartnerSt
|
|
|
14
14
|
/**
|
|
15
15
|
* Common size variants for UI components
|
|
16
16
|
*
|
|
17
|
-
* @version 0.0
|
|
17
|
+
* @version 0.1.0
|
|
18
18
|
* @since 0.0.1
|
|
19
19
|
* @author AMBROISE PARK Consulting
|
|
20
20
|
*/
|
|
@@ -22,7 +22,7 @@ export type ComponentSize = 'sm' | 'md' | 'lg' | 'icon';
|
|
|
22
22
|
/**
|
|
23
23
|
* Common form modes
|
|
24
24
|
*
|
|
25
|
-
* @version 0.0
|
|
25
|
+
* @version 0.1.0
|
|
26
26
|
* @since 0.0.1
|
|
27
27
|
* @author AMBROISE PARK Consulting
|
|
28
28
|
*/
|
|
@@ -30,7 +30,7 @@ export type FormMode = 'signin' | 'signup';
|
|
|
30
30
|
/**
|
|
31
31
|
* Common role types for access control
|
|
32
32
|
*
|
|
33
|
-
* @version 0.0
|
|
33
|
+
* @version 0.1.0
|
|
34
34
|
* @since 0.0.1
|
|
35
35
|
* @author AMBROISE PARK Consulting
|
|
36
36
|
*/
|
|
@@ -38,7 +38,7 @@ export type AccessRole = 'user' | 'admin';
|
|
|
38
38
|
/**
|
|
39
39
|
* Base props that most components share
|
|
40
40
|
*
|
|
41
|
-
* @version 0.0
|
|
41
|
+
* @version 0.1.0
|
|
42
42
|
* @since 0.0.1
|
|
43
43
|
* @author AMBROISE PARK Consulting
|
|
44
44
|
*/
|
|
@@ -51,7 +51,7 @@ export interface BaseComponentProps {
|
|
|
51
51
|
/**
|
|
52
52
|
* Props for components that handle authentication callbacks
|
|
53
53
|
*
|
|
54
|
-
* @version 0.0
|
|
54
|
+
* @version 0.1.0
|
|
55
55
|
* @since 0.0.1
|
|
56
56
|
* @author AMBROISE PARK Consulting
|
|
57
57
|
*/
|
|
@@ -64,7 +64,7 @@ export interface AuthCallbackProps {
|
|
|
64
64
|
/**
|
|
65
65
|
* Props for components that render children conditionally
|
|
66
66
|
*
|
|
67
|
-
* @version 0.0
|
|
67
|
+
* @version 0.1.0
|
|
68
68
|
* @since 0.0.1
|
|
69
69
|
* @author AMBROISE PARK Consulting
|
|
70
70
|
*/
|
|
@@ -77,7 +77,7 @@ export interface ConditionalRenderProps {
|
|
|
77
77
|
/**
|
|
78
78
|
* Props for network status indicator
|
|
79
79
|
*
|
|
80
|
-
* @version 0.0
|
|
80
|
+
* @version 0.1.0
|
|
81
81
|
* @since 0.0.1
|
|
82
82
|
* @author AMBROISE PARK Consulting
|
|
83
83
|
*/
|
|
@@ -87,7 +87,7 @@ export interface NetworkStatusIndicatorProps extends BaseComponentProps {
|
|
|
87
87
|
/**
|
|
88
88
|
* Props for login modal
|
|
89
89
|
*
|
|
90
|
-
* @version 0.0
|
|
90
|
+
* @version 0.1.0
|
|
91
91
|
* @since 0.0.1
|
|
92
92
|
* @author AMBROISE PARK Consulting
|
|
93
93
|
*/
|
|
@@ -98,7 +98,7 @@ export interface LoginModalProps {
|
|
|
98
98
|
/**
|
|
99
99
|
* Props for email verification component
|
|
100
100
|
*
|
|
101
|
-
* @version 0.0
|
|
101
|
+
* @version 0.1.0
|
|
102
102
|
* @since 0.0.1
|
|
103
103
|
* @author AMBROISE PARK Consulting
|
|
104
104
|
*/
|
|
@@ -119,7 +119,7 @@ export interface EmailVerificationProps extends BaseComponentProps {
|
|
|
119
119
|
/**
|
|
120
120
|
* Props for email/password form
|
|
121
121
|
*
|
|
122
|
-
* @version 0.0
|
|
122
|
+
* @version 0.1.0
|
|
123
123
|
* @since 0.0.1
|
|
124
124
|
* @author AMBROISE PARK Consulting
|
|
125
125
|
*/
|
|
@@ -127,11 +127,33 @@ export interface EmailPasswordFormProps extends BaseComponentProps, AuthCallback
|
|
|
127
127
|
/** Form mode - defaults to 'signin' */
|
|
128
128
|
mode?: FormMode;
|
|
129
129
|
compact?: boolean;
|
|
130
|
+
/**
|
|
131
|
+
* Terms of Service path or content (signup only - GDPR/French law).
|
|
132
|
+
* - Omit: auto-detects from app config legalLinks, falls back to '/legal/terms'
|
|
133
|
+
* - `string`: path opened in popup window
|
|
134
|
+
* - `ReactNode`: rendered inline in a Dialog modal
|
|
135
|
+
* - `false`: explicitly disable ToS requirement
|
|
136
|
+
*/
|
|
137
|
+
tos?: string | React.ReactNode | false;
|
|
138
|
+
/**
|
|
139
|
+
* Privacy Policy path or content (signup only - GDPR/French law).
|
|
140
|
+
* - Omit: auto-detects from app config legalLinks, falls back to '/legal/privacy'
|
|
141
|
+
* - `string`: path opened in popup window
|
|
142
|
+
* - `ReactNode`: rendered inline in a Dialog modal
|
|
143
|
+
* - `false`: explicitly disable Privacy requirement
|
|
144
|
+
*/
|
|
145
|
+
privacy?: string | React.ReactNode | false;
|
|
146
|
+
/**
|
|
147
|
+
* CAPTCHA token to include with auth requests.
|
|
148
|
+
* Consumer is responsible for rendering the CAPTCHA widget (e.g. Turnstile)
|
|
149
|
+
* and passing the token here. When provided, submit is blocked until token is truthy.
|
|
150
|
+
*/
|
|
151
|
+
captchaToken?: string;
|
|
130
152
|
}
|
|
131
153
|
/**
|
|
132
154
|
* Props for account linking component
|
|
133
155
|
*
|
|
134
|
-
* @version 0.0
|
|
156
|
+
* @version 0.1.0
|
|
135
157
|
* @since 0.0.1
|
|
136
158
|
* @author AMBROISE PARK Consulting
|
|
137
159
|
*/
|
|
@@ -140,7 +162,7 @@ export interface AccountLinkingProps extends BaseComponentProps {
|
|
|
140
162
|
/**
|
|
141
163
|
* Props for Google One Tap component
|
|
142
164
|
*
|
|
143
|
-
* @version 0.0
|
|
165
|
+
* @version 0.1.0
|
|
144
166
|
* @since 0.0.1
|
|
145
167
|
* @author AMBROISE PARK Consulting
|
|
146
168
|
*/
|
|
@@ -151,7 +173,7 @@ export interface GoogleOneTapProps extends AuthCallbackProps {
|
|
|
151
173
|
/**
|
|
152
174
|
* Props for rate limit alert
|
|
153
175
|
*
|
|
154
|
-
* @version 0.0
|
|
176
|
+
* @version 0.1.0
|
|
155
177
|
* @since 0.0.1
|
|
156
178
|
* @author AMBROISE PARK Consulting
|
|
157
179
|
*/
|
|
@@ -162,7 +184,7 @@ export interface RateLimitAlertProps extends BaseComponentProps {
|
|
|
162
184
|
/**
|
|
163
185
|
* Props for password update dialog
|
|
164
186
|
*
|
|
165
|
-
* @version 0.0
|
|
187
|
+
* @version 0.1.0
|
|
166
188
|
* @since 0.0.1
|
|
167
189
|
* @author AMBROISE PARK Consulting
|
|
168
190
|
*/
|
|
@@ -172,7 +194,7 @@ export interface PasswordUpdateDialogProps {
|
|
|
172
194
|
/**
|
|
173
195
|
* Props for auth partner button
|
|
174
196
|
*
|
|
175
|
-
* @version 0.0
|
|
197
|
+
* @version 0.1.0
|
|
176
198
|
* @since 0.0.1
|
|
177
199
|
* @author AMBROISE PARK Consulting
|
|
178
200
|
*/
|
|
@@ -193,7 +215,7 @@ export interface AuthPartnerButtonProps extends AuthCallbackProps, BaseComponent
|
|
|
193
215
|
/**
|
|
194
216
|
* Props for feature placeholder
|
|
195
217
|
*
|
|
196
|
-
* @version 0.0
|
|
218
|
+
* @version 0.1.0
|
|
197
219
|
* @since 0.0.1
|
|
198
220
|
* @author AMBROISE PARK Consulting
|
|
199
221
|
*/
|
|
@@ -206,7 +228,7 @@ export interface FeaturePlaceholderProps extends BaseComponentProps {
|
|
|
206
228
|
/**
|
|
207
229
|
* Props for tier placeholder
|
|
208
230
|
*
|
|
209
|
-
* @version 0.0
|
|
231
|
+
* @version 0.1.0
|
|
210
232
|
* @since 0.0.1
|
|
211
233
|
* @author AMBROISE PARK Consulting
|
|
212
234
|
*/
|
|
@@ -219,7 +241,7 @@ export interface TierPlaceholderProps extends BaseComponentProps {
|
|
|
219
241
|
/**
|
|
220
242
|
* Props for auth fallback
|
|
221
243
|
*
|
|
222
|
-
* @version 0.0
|
|
244
|
+
* @version 0.1.0
|
|
223
245
|
* @since 0.0.1
|
|
224
246
|
* @author AMBROISE PARK Consulting
|
|
225
247
|
*/
|
|
@@ -232,7 +254,7 @@ export interface AuthFallbackProps extends BaseComponentProps {
|
|
|
232
254
|
/**
|
|
233
255
|
* Props for multiple auth providers
|
|
234
256
|
*
|
|
235
|
-
* @version 0.0
|
|
257
|
+
* @version 0.1.0
|
|
236
258
|
* @since 0.0.1
|
|
237
259
|
* @author AMBROISE PARK Consulting
|
|
238
260
|
*/
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGhE,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAC1E,YAAY,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAC1E,OAAO,EACL,kBAAkB,IAAI,aAAa,EACnC,KAAK,gBAAgB,IAAI,YAAY,GACtC,MAAM,gBAAgB,CAAC;AAMxB;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;AAExD;;;;;;GAMG;AACH,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE3C;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,OAAO,CAAC;AAE1C;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IACjC,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6BAA6B;IAC7B,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC,4CAA4C;IAC5C,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC;IAClC,yCAAyC;IACzC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAClC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,sBAAsB;IACrC,+CAA+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IAAI,CAAC;IAC3B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,CAAC;CAClD;AAED;;;;;;GAMG;AACH,MAAM,WAAW,uBAAwB,SAAQ,kBAAkB;IACjE,0CAA0C;IAC1C,SAAS,EAAE,MAAM,CAAC;IAClB,kDAAkD;IAClD,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,oBAAqB,SAAQ,kBAAkB;IAC9D,kDAAkD;IAClD,WAAW,EAAE,MAAM,CAAC;IACpB,iCAAiC;IACjC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB;IAC3D,gCAAgC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wDAAwD;IACxD,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,0BAA2B,SAAQ,kBAAkB;IACpE,iEAAiE;IACjE,SAAS,CAAC,EAAE,aAAa,EAAE,CAAC;IAC5B,yCAAyC;IACzC,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B"}
|
package/dist/constants.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getAuthMethod as
|
|
1
|
+
import{getAuthMethod as E,EMAIL_VERIFICATION_STATUS as o}from"@donotdev/core";import{AUTH_PARTNER_STATE as R}from"@donotdev/core";export{o as EMAIL_VERIFICATION_STATUS,R as PARTNER_STATE,E as getAuthMethod};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useState as
|
|
1
|
+
"use client";import{useState as h,useEffect as v,useCallback as a}from"react";import{safeSessionStorage as e,handleError as I,isClient as t,isDev as r}from"@donotdev/core";import{getAuthMethod as L}from"../constants";import{useAuth as l}from"../useAuth";function S(){const o=l("signInWithPartner"),s=l("user"),[i,c]=h(null);v(()=>{if(t()){try{const n=e.getItem("accountLinkingInfo");if(n){const u=JSON.parse(n);c(u)}}catch{r()}return()=>{if(!t())return;const n=e.getItem("accountLinkingInfo");if(n)try{JSON.parse(n).isRequired||e.removeItem("accountLinkingInfo")}catch{}}}},[s]);const g=a(async()=>{if(!(!i||!i.isRequired))try{const{existingProvider:n}=i;if(n==="password"||n==="emailLink"){r();return}r(),await o(n,L())}catch(n){I(n)}},[i,o]),f=a(()=>{t()&&(e.removeItem("accountLinkingInfo"),c(null))},[]),d=i?.isRequired||!1,m=i?.email||null,k=i?.existingProvider||null,p=i?.newProvider||null;return{accountLinking:i,isRequired:d,email:m,existingProvider:k,newProvider:p,handleSignInWithExistingProvider:g,clearAccountLinking:f}}export{S as useAccountLinking};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useState as
|
|
1
|
+
"use client";import{useState as h,useCallback as t}from"react";function g({defaultValue:c="popup"}={}){const[o,e]=h(c),r=o==="redirect",d=o==="popup",s=t(()=>{e(p=>p==="redirect"?"popup":"redirect")},[]),u=t(()=>{e("redirect")},[]),n=t(()=>{e("popup")},[]),i=t(p=>{e(p?"redirect":"popup")},[]);return{isRedirectMode:r,isPopupMode:d,authMethod:o,toggleMode:s,setRedirectMode:u,setPopupMode:n,handleToggleChange:i}}export{g as useAuthMethodToggle};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useCallback as
|
|
1
|
+
"use client";import{useCallback as e}from"react";import"../constants";import{useAuth as s}from"../useAuth";function x(t,h={}){const f=s("getPartnerState"),r=s("setPartnerState"),g=s("signInWithPartner"),i=s("partnerError"),{onSuccess:c,onError:a}=h,l=f(t),P=l==="authenticated",S=l==="loading",n=i?.partnerId===t,m=n&&i?.error?new Error(i.error):null,u=e(()=>{n&&r(t,"idle")},[n,t,r]),E=e(()=>{r(t,"loading")},[t,r]),A=e(()=>{r(t,"idle")},[t,r]),w=e(async y=>{n&&u();try{r(t,"loading");const o=await g(t,y);if(o===null){r(t,"idle");return}o&&c&&c(o)}catch(o){r(t,"error",o),a&&a(o)}},[t,n,u,r,g,c,a]);return{partnerState:l,isAuthenticated:P,isAuthenticating:S,hasError:n,error:m,handleSignIn:w,clearError:u,setLoading:E,setIdle:A}}export{x as useAuthPartner};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Account deletion state and actions
|
|
3
3
|
*
|
|
4
|
-
* @version 0.0
|
|
4
|
+
* @version 0.1.0
|
|
5
5
|
* @since 0.0.1
|
|
6
6
|
* @author AMBROISE PARK Consulting
|
|
7
7
|
*/
|
|
@@ -54,7 +54,7 @@ export interface DeleteAccountState {
|
|
|
54
54
|
* />
|
|
55
55
|
* ```
|
|
56
56
|
*
|
|
57
|
-
* @version 0.0
|
|
57
|
+
* @version 0.1.0
|
|
58
58
|
* @since 0.0.1
|
|
59
59
|
* @author AMBROISE PARK Consulting
|
|
60
60
|
* @returns Account deletion state and actions
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useState as
|
|
1
|
+
"use client";import{useState as l}from"react";import{useAuth as m}from"../useAuth";function E(){const r=m("deleteAccount"),[c,e]=l(!1),[f,s]=l(!1),[i,a]=l(!1),[u,t]=l(null);return{showConfirmDialog:c,showPasswordDialog:f,isDeleting:i,error:u,startDeleteFlow:()=>{t(null),e(!0)},confirmDelete:async D=>{a(!0),t(null);try{await r(D),e(!1),s(!1)}catch(n){const o=n.message||n.message;o==="REQUIRES_PASSWORD"?(e(!1),s(!0)):o==="REAUTH_CANCELLED"?(e(!1),s(!1)):t(o||"Failed to delete account")}finally{a(!1)}},cancel:()=>{e(!1),s(!1),t(null)}}}export{E as useDeleteAccount};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useEffect as g,useState as
|
|
1
|
+
"use client";import{useEffect as g,useState as l,useCallback as E}from"react";import{handleError as k,isDev as o}from"@donotdev/core";import{useAuth as r}from"../useAuth";function p(){const a=r("isSignInWithEmailLink"),n=r("signInWithEmailLink"),[m,e]=l(!1),[c,t]=l(null),u=a();g(()=>{if(typeof window<"u"){const i=localStorage.getItem("emailForSignIn");i&&t(i)}},[]);const f=E(async i=>{if(!i){o();return}e(!0);try{o(),(await n(i))?.success&&(localStorage.removeItem("emailForSignIn"),t(null))}catch(s){k(s)}finally{e(!1)}},[n]);return{isEmailLink:u,isProcessing:m,email:c,completeEmailLinkSignIn:f}}export{p as useEmailLinkAuth};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Use email link form return interface
|
|
3
3
|
*
|
|
4
|
-
* @version 0.0
|
|
4
|
+
* @version 0.1.0
|
|
5
5
|
* @since 0.0.1
|
|
6
6
|
* @author AMBROISE PARK Consulting
|
|
7
7
|
*/
|
|
@@ -20,7 +20,7 @@ export interface UseEmailLinkFormReturn {
|
|
|
20
20
|
/**
|
|
21
21
|
* Use email link form options interface
|
|
22
22
|
*
|
|
23
|
-
* @version 0.0
|
|
23
|
+
* @version 0.1.0
|
|
24
24
|
* @since 0.0.1
|
|
25
25
|
* @author AMBROISE PARK Consulting
|
|
26
26
|
*/
|
|
@@ -42,7 +42,7 @@ export interface UseEmailLinkFormOptions {
|
|
|
42
42
|
* 4. Success/error handling
|
|
43
43
|
* 5. Resend functionality
|
|
44
44
|
*
|
|
45
|
-
* @version 0.0
|
|
45
|
+
* @version 0.1.0
|
|
46
46
|
* @since 0.0.1
|
|
47
47
|
* @author AMBROISE PARK Consulting
|
|
48
48
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useState as
|
|
1
|
+
"use client";import{useState as i,useCallback as r}from"react";import{handleError as w}from"@donotdev/core";import{useAuth as f}from"../useAuth";function T(g={}){const o=f("sendSignInLinkToEmail"),S=f("isAvailable"),{onSuccess:a,onError:l,actionCodeSettings:c}=g,[e,E]=i(""),[d,m]=i(!1),[h,u]=i(!1),[k,n]=i(null),s=e.trim().length>0&&e.includes("@"),p=s&&!d&&S,I=r(()=>{n(null)},[]),L=r(async v=>{if(v.preventDefault(),!s){n("Please enter a valid email address");return}m(!0),n(null);try{typeof window<"u"&&localStorage.setItem("emailForSignIn",e.trim()),await o(e.trim(),c),u(!0),a?.()}catch(t){const y=t instanceof Error?t.message:"Failed to send sign-in link";n(y),l?.(t),w(t)}finally{m(!1)}},[e,s,o,c,a,l]),b=r(()=>{u(!1),n(null)},[]);return{email:e,setEmail:E,isLoading:d,isSent:h,error:k,handleSendLink:L,handleResend:b,clearError:I,isValid:s,canSubmit:p}}export{T as useEmailLinkForm};
|
package/dist/hooks/useFedCM.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useState as
|
|
1
|
+
"use client";import{useState as i,useEffect as y,useMemo as E,useRef as S}from"react";import{handleError as I,isClient as l}from"@donotdev/core";function F({checkGoogleServices:a=!0,onError:d}={}){const[n,p]=i(!1),[m,u]=i(!1),[f,g]=i(null),c=S(d);c.current=d,y(()=>{if(!l())return;(async()=>{try{const t="IdentityCredential"in window;let e=!0;if(a){const h=new Promise(s=>setTimeout(s,2e3));await Promise.race([new Promise(s=>{const C=setInterval(()=>{window.google?.accounts?.id&&(clearInterval(C),s(!0))},100)}),h]),e=!!window.google?.accounts?.id}p(t&&e),u(!0)}catch(t){const e=I(t,{userMessage:"Failed to detect FedCM support",context:{operation:"fedcm_detection"},severity:"warning"});g(e),u(!0),c.current?.(e)}})()},[a]);const w=E(()=>{if(!l())return{name:"Unknown",isSupported:!1,recommendation:"Loading..."};const r=navigator.userAgent;let t="Unknown",e="Please update your browser";if(r.includes("Chrome/")){const o=parseInt(r.match(/Chrome\/(\d+)/)?.[1]||"0");t=`Chrome ${o}`,e=o>=116?"Supported":"Please update to Chrome 116 or later"}else if(r.includes("Edg/")){const o=parseInt(r.match(/Edg\/(\d+)/)?.[1]||"0");t=`Edge ${o}`,e=o>=116?"Supported":"Please update to Edge 116 or later"}else r.includes("Safari/")&&!r.includes("Chrome")?(t="Safari",e="Not supported yet. Please use Chrome or Edge"):r.includes("Firefox/")&&(t="Firefox",e="Not supported yet. Please use Chrome or Edge");return{name:t,isSupported:n,recommendation:e}},[n]);return{isSupported:n,isReady:m,error:f,browserInfo:w}}export{F as useFedCM};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useState as
|
|
1
|
+
"use client";import{useState as b,useEffect as k,useRef as _,useCallback as K,startTransition as y,useMemo as j}from"react";import{useIsDark as re}from"@donotdev/components";import{handleError as p,getOAuthClientId as oe,getEnabledAuthPartners as ne,isClient as ie,useTranslation as se,useScriptLoader as ae}from"@donotdev/core";import{useAuth as B}from"../useAuth";import{useFedCM as ce}from"./useFedCM";function me({clientId:J,autoSelect:v=!0,cancelOnTapOutside:x=!0,promptParentId:T,disabled:u=!1,onSuccess:O,onError:s,allowedParentOrigins:z,cspNonce:S,clientOnly:A=!1}={}){const{t:o}=se("auth"),E=B("user"),N=B("signInWithGoogleCredential"),L=re(),a=J||oe("google"),I=ne().includes("google"),{isSupported:r,isReady:d,error:U,browserInfo:Q}=ce({checkGoogleServices:!0,onError:e=>{const l=p(e,{userMessage:o("auth.fedcmNotSupported","Your browser does not support Google One Tap"),context:{operation:"fedcm_detection"},severity:"warning"});s?.(l)}}),{isLoading:V,isLoaded:D,error:F,isReady:P,load:X,loadTriggered:Z}=ae("https://accounts.google.com/gsi/client",{enabled:I&&!!a&&!u&&d&&r,nonce:S,checkExisting:!0,isLoaded:()=>!!window.google?.accounts?.id,onError:e=>{const l=p(e,{userMessage:o("auth.googleScriptLoadError","Failed to load Google Identity Services"),context:{operation:"google_script_load"},severity:"error"});s?.(l)}}),[M,$]=b(!1),[W,q]=b(null),ee=_(null),i=_(!1),c=_(null),C=_(0),[H,f]=b(!1),m="gsi_hide_until",h=600*1e3,G=j(()=>I&&!!a&&!u&&!E&&r&&(A?M:!0)&&!H,[I,a,u,E,r,A,M,H]),te=j(()=>!r&&d?new Error(o("auth.fedcmRequired","Google One Tap requires a modern browser (Chrome 116+ or Edge 116+)")):F||U||W,[F,U,W,r,d,o]),w=K(async e=>{try{if(!e||typeof e!="string")throw new Error("Invalid credential format");await N(e),y(()=>{O?.(e)})}catch(l){const n=p(l,{userMessage:o("auth.googleOneTapError","Google One Tap authentication failed"),context:{operation:"google_one_tap_signin",credentialLength:e?.length||0},severity:"error"});throw y(()=>{q(n)}),s?.(n),n}},[N,O,s,o]),R=K(()=>{if(!ie()||!P||!a||!window.google?.accounts?.id||!r||i.current)return;const e=Date.now();if(!(e-C.current<h&&C.current>0))try{i.current=!0,C.current=e;const n={client_id:a,callback:async t=>{try{await w(t.credential)}catch(Y){p(Y,{userMessage:"Google One Tap credential handling failed",context:{operation:"google_one_tap_callback"},severity:"error"})}},auto_select:v,cancel_on_tap_outside:x,context:"signin",ux_mode:"popup",itp_support:!0,state:L?"dark":"light",use_fedcm_for_prompt:!0,allowed_parent_origins:z,csp_nonce:S,moment_callback:t=>{const Y=t.getMomentType();if(t.isDisplayMoment?.()){if(!t.isDisplayed?.()){if(t.getNotDisplayedReason){i.current=!1;try{const g=Date.now()+h;localStorage.setItem(m,String(g)),f(!0)}catch{}}}}else if(t.isSkippedMoment?.()){i.current=!1;try{const g=Date.now()+h;localStorage.setItem(m,String(g)),f(!0)}catch{}}else if(t.isDismissedMoment?.()){i.current=!1;try{const g=Date.now()+h;localStorage.setItem(m,String(g)),f(!0)}catch{}}}};T&&(n.prompt_parent_id=T),window.google.accounts.id.initialize(n),c.current&&window.clearTimeout(c.current),c.current=window.setTimeout(()=>{window.google?.accounts?.id?.prompt(t=>{t?.credential&&w(t.credential)}),c.current=null},100)}catch(n){const t=p(n,{userMessage:o("auth.googleOneTapInitError","Failed to initialize Google One Tap"),context:{operation:"google_one_tap_initialize",fedcmSupported:r},severity:"error"});y(()=>{q(t)}),s?.(t),i.current=!1}},[P,a,r,v,x,T,L,w,s,z,S,o]);return k(()=>{if(typeof window<"u"){y(()=>{$(!0)});try{const e=Number(localStorage.getItem(m)||0);f(e>Date.now())}catch{}}},[]),k(()=>{D&&!u&&G&&d&&R()},[D,u,G,d,R]),k(()=>()=>{c.current&&window.clearTimeout(c.current),i.current=!1},[]),{isLoaded:D,isLoading:V,error:te,user:E,isDark:L,fedcmSupported:r,isHydrated:M,containerRef:ee,initialize:R,handleCredential:w,shouldShow:G,browserInfo:Q,triggerLoad:X,loadTriggered:Z}}export{me as useGoogleOneTap};
|
|
@@ -11,7 +11,7 @@ interface UseNetworkStatusReturn {
|
|
|
11
11
|
* **SSR Safe:** Returns safe defaults on server
|
|
12
12
|
* **CSR Safe:** Monitors real network status on client
|
|
13
13
|
*
|
|
14
|
-
* @version 0.0
|
|
14
|
+
* @version 0.1.0
|
|
15
15
|
* @since 0.0.1
|
|
16
16
|
* @author AMBROISE PARK Consulting
|
|
17
17
|
* **Usage:**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useState as
|
|
1
|
+
"use client";import{useState as s,useEffect as u}from"react";import{isClient as c}from"@donotdev/core";function O(){const[n,o]=s(()=>c()?navigator.onLine:!0),[e,r]=s("unknown");return u(()=>{if(!c())return;const t=()=>o(!0),i=()=>o(!1),f=()=>{if("connection"in navigator){const l=navigator.connection;r(l.effectiveType||"unknown")}};return window.addEventListener("online",t),window.addEventListener("offline",i),f(),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",i)}},[]),{online:n,connectionType:e,isSlowConnection:e==="slow-2g"||e==="2g",isOnline:n,isOffline:!n}}export{O as useNetworkStatus};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview Auth package
|
|
3
3
|
* @description Authentication package for DoNotDev framework. Provides authentication hooks, stores, components, and utilities for user authentication.
|
|
4
|
-
* @version 0.0
|
|
4
|
+
* @version 0.1.0
|
|
5
5
|
* @since 0.0.1
|
|
6
6
|
* @author AMBROISE PARK Consulting
|
|
7
7
|
*/
|
|
@@ -10,7 +10,7 @@ export { useDeleteAccount } from './hooks/useDeleteAccount';
|
|
|
10
10
|
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
|
-
ReauthDialog, } from './components';
|
|
13
|
+
PasswordResetCallback, ReauthDialog, } from './components';
|
|
14
14
|
export type { AuthError, // Explicitly import AuthError from core
|
|
15
15
|
AuthUser as User, // Rename AuthUser to User for public API simplicity
|
|
16
16
|
UserRole, SubscriptionTier, } from '@donotdev/core';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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,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,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|
-
import{useAuth as
|
|
1
|
+
import{useAuth as o}from"./useAuth";import{useDeleteAccount as u}from"./hooks/useDeleteAccount";import{getAuthState as A,subscribeToAuth as l}from"./authHelpers";import{AuthPartnerButton as s,ConfirmDeleteDialog as T,FeatureGuard as i,GoogleOneTap as p,LoginModal as f,MultipleAuthProviders as g,PasswordResetCallback as m,ReauthDialog as n}from"./components";import{getAuthMethod as x,PARTNER_STATE as R,EMAIL_VERIFICATION_STATUS as c}from"./constants";export{s as AuthPartnerButton,T as ConfirmDeleteDialog,c as EMAIL_VERIFICATION_STATUS,i as FeatureGuard,p as GoogleOneTap,f as LoginModal,g as MultipleAuthProviders,R as PARTNER_STATE,m as PasswordResetCallback,n as ReauthDialog,x as getAuthMethod,A as getAuthState,l as subscribeToAuth,o as useAuth,u as useDeleteAccount};
|