@donotdev/auth 0.3.1 → 0.3.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.
- package/README.md +6 -1
- package/dist/AuthStore.js +1 -1
- package/dist/authHelpers.js +1 -1
- package/dist/components/AccountLinking.js +1 -1
- package/dist/components/AuthFallback.js +1 -1
- package/dist/components/AuthPartnerButton.js +2 -2
- package/dist/components/DeleteAccountDialogs.js +1 -1
- package/dist/components/EmailLinkForm.js +1 -1
- package/dist/components/EmailPasswordForm.d.ts +4 -2
- package/dist/components/EmailPasswordForm.d.ts.map +1 -1
- package/dist/components/EmailPasswordForm.js +1 -1
- package/dist/components/EmailVerification.js +1 -1
- package/dist/components/Feature.js +1 -1
- 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.js +1 -1
- package/dist/components/LoginModal.js +1 -1
- package/dist/components/MultipleAuthProviders.js +1 -1
- package/dist/components/NetworkStatusIndicator.js +1 -1
- package/dist/components/PasswordResetCallback.js +1 -1
- package/dist/components/PasswordStrengthIndicator.js +1 -1
- package/dist/components/PasswordUpdateDialog.js +1 -1
- package/dist/components/RateLimitAlert.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/constants.d.ts +9 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +1 -1
- package/dist/emailAuth/fields.d.ts +65 -2
- package/dist/emailAuth/fields.d.ts.map +1 -1
- package/dist/emailAuth/fields.js +1 -1
- package/dist/emailAuth/flows.d.ts +182 -15
- package/dist/emailAuth/flows.d.ts.map +1 -1
- package/dist/emailAuth/flows.js +1 -1
- package/dist/emailAuth/rules.d.ts +33 -4
- package/dist/emailAuth/rules.d.ts.map +1 -1
- package/dist/emailAuth/rules.js +2 -2
- package/dist/hooks/useAccountLinking.js +1 -1
- package/dist/hooks/useAuthMethodToggle.js +1 -1
- package/dist/hooks/useAuthPartner.js +1 -1
- package/dist/hooks/useAuthUsers.d.ts +34 -0
- package/dist/hooks/useAuthUsers.d.ts.map +1 -0
- package/dist/hooks/useAuthUsers.js +1 -0
- package/dist/hooks/useDeleteAccount.js +1 -1
- package/dist/hooks/useEmailLinkAuth.js +1 -1
- 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.js +1 -1
- package/dist/index.d.ts +9 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/symbol-index.json +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/useAuth.d.ts.map +1 -1
- package/dist/useAuth.js +1 -1
- package/guidelines/AUTH.md +68 -2
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -63,7 +63,12 @@ TypeScript autocomplete shows you everything available.
|
|
|
63
63
|
- **`signInWithPartner(partnerId, method?)`** - OAuth sign in
|
|
64
64
|
- **`signOut()`** - Sign out
|
|
65
65
|
- **`sendPasswordResetEmail(email)`** - Reset password
|
|
66
|
-
- **`sendEmailVerification()`** -
|
|
66
|
+
- **`sendEmailVerification(email?)`** - Send (again) the confirmation email or code
|
|
67
|
+
- **`verifyEmailCode(email, code)`** - Confirm a sign-up address with the emailed code; signs the user in (providers implementing it: Supabase)
|
|
68
|
+
|
|
69
|
+
**Admin:**
|
|
70
|
+
|
|
71
|
+
- **`listUsers()`** - Every auth account (`AuthUserSummary[]`); needs the admin-only `listAuthUsers` server function deployed (Supabase, Firebase). `useAuthUsers()` wraps it: `{ users, loading, error, reload }`
|
|
67
72
|
|
|
68
73
|
**Security (Firebase-verified):**
|
|
69
74
|
|
package/dist/AuthStore.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createDoNotDevStore as c,FEATURE_STATUS as l,syncQueryCacheIdentity as
|
|
1
|
+
import{createDoNotDevStore as c,FEATURE_STATUS as l,syncQueryCacheIdentity as o}from"@donotdev/core";import{PARTNER_STATE as n}from"./constants";const i={user:null,authenticated:!1,userId:null,loading:!1,error:null,userProfile:null,userSubscription:null,partnerStates:{},partnerError:null,authService:null,emailVerification:{status:"pending"},passwordResetPending:!1,status:l.INITIALIZING},d=c({name:"auth-store",createStore:(t,a)=>({...i,setStatus:e=>{t({status:e})},setPartnerState:(e,r,s)=>{t(u=>({partnerStates:{...u.partnerStates,[e]:r},partnerError:r==="error"&&s?{partnerId:e,error:s}:u.partnerError?.partnerId===e?null:u.partnerError}))},getPartnerState:e=>a().partnerStates[e]||n.IDLE,clearAllPartnerStates:()=>t(e=>({partnerStates:Object.keys(e.partnerStates).reduce((r,s)=>(r[s]=n.IDLE,r),{}),partnerError:null})),setAuthenticated:(e,r,s)=>{o(e.id),t({user:e,authenticated:!0,userId:e.id,loading:!1,error:null,status:l.READY,userSubscription:r,userProfile:s})},setUnauthenticated:()=>{o(null),t({user:null,authenticated:!1,userId:null,loading:!1,error:null,status:l.READY,userSubscription:null,userProfile:null})},setAuthLoading:e=>{t({loading:e})},setAuthError:e=>{t({error:e,loading:!1})},clearAuthError:()=>{t({error:null})},getCustomClaim:e=>a().getCustomClaimLocal(e),getCustomClaims:()=>a().getCustomClaimsLocal(),setAuthService:e=>t({authService:e}),getCustomClaimLocal:e=>{const r=a(),s=r.userProfile;return s?.claims&&typeof s.claims=="object"&&e in s.claims?s.claims[e]:s&&typeof s=="object"&&e in s?s[e]:r.user&&typeof r.user=="object"&&e in r.user?r.user[e]:null},getCustomClaimsLocal:()=>{const e=a(),r={};return e.userProfile?.claims&&Object.assign(r,e.userProfile.claims),Object.freeze({...r})},setPasswordResetPending:e=>t({passwordResetPending:e}),setEmailVerificationStatus:(e,r)=>t({emailVerification:{status:e,error:r}}),setUserProfile:e=>t({userProfile:e}),setUserSubscription:e=>t({userSubscription:e}),setLoading:e=>t({loading:e}),setError:e=>t({error:e}),clearError:()=>t({error:null}),reset:()=>t(i)})});export{d as useAuthStore};
|
package/dist/authHelpers.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isClient as
|
|
1
|
+
import{isClient as r}from"@donotdev/core";import{useAuthStore as t}from"./AuthStore";function s(){return t.getState()}function u(e){return r()?t.subscribe(e):()=>{}}export{s as getAuthState,u as subscribeToAuth};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as i,jsxs as
|
|
1
|
+
"use client";import{jsx as i,jsxs as t}from"react/jsx-runtime";import{Suspense as A,lazy as T}from"react";import{Alert as h,ALERT_VARIANT as k,Button as o,BUTTON_VARIANT as c,Stack as a}from"@donotdev/components";import{useTranslation as I,safeSessionStorage as v,handleError as N,isDev as l}from"@donotdev/core";import{EmailLinkForm as R}from"./EmailLinkForm";import S from"./EmailPasswordForm";import{useAccountLinking as y}from"../hooks/useAccountLinking";const $=({className:r="",id:d})=>{const{t:e}=I("auth"),{isRequired:f,email:m,existingProvider:n,newProvider:u,handleSignInWithExistingProvider:w}=y();if(!f)return null;if(n==="password"||n==="emailLink"){l();const s=()=>{v.removeItem("accountLinkingInfo")},g=()=>{l()},p=L=>{N(L)};return i("div",{className:r,id:d,children:i(h,{variant:k.WARNING,role:"alert","aria-live":"polite",title:e("accountLinking.title","Account Linking Required"),description:t(a,{children:[i("p",{children:e("accountLinking.message",`An account with email ${m} already exists with ${n==="password"?"email/password":"email link"}. To link your ${u} account, please sign in with your ${n==="password"?"email and password":"email link"} first.`)}),n==="password"?i("div",{style:{marginTop:"var(--gap-md)"},children:i(S,{mode:"signin",onSuccess:g,onError:p})}):i("div",{style:{marginTop:"var(--gap-md)"},children:i(R,{onSuccess:g,onError:p})}),i(a,{direction:"row",justify:"end",children:i(o,{onClick:s,variant:c.GHOST,children:e("accountLinking.dismiss","Dismiss")})})]})})})}else{l();const s=()=>{v.removeItem("accountLinkingInfo")};return i("div",{className:r,id:d,children:i(h,{variant:k.WARNING,role:"alert","aria-live":"polite",title:e("accountLinking.title","Account Linking Required"),description:t(a,{children:[i("p",{children:e("accountLinking.message",`An account with email ${m} already exists with ${n}. To link your ${u} account, please sign in with ${n} first.`)}),t(a,{direction:"row",children:[i(o,{onClick:w,variant:c.PRIMARY,children:e("accountLinking.signInWith",`Sign in with ${n}`)}),i(o,{onClick:s,variant:c.GHOST,children:e("accountLinking.dismiss","Dismiss")})]})]})})})}},x=T(()=>Promise.resolve({default:$}));function E(r){return i(A,{fallback:null,children:i(x,{...r})})}var P=E;export{P as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{FeatureFallback as s,withFeatureFallback as r}from"@donotdev/components";import{isFeatureAvailable as n,FRAMEWORK_FEATURES as i}from"@donotdev/core";function o({message:t="Authentication is not available",showLoginButton:a=!1,className:u=""}){return e(s,{featureName:"Authentication",message:t,icon:"\u{1F512}",showActionButton:a,actionButtonText:"Sign In (Unavailable)",className:u,helpText:"This feature requires authentication to be configured."})}function l(t,a){return r(t,"Authentication",()=>n(i.AUTH),{message:a?.message,showActionButton:a?.showLoginButton,actionButtonText:"Sign In (Unavailable)",icon:"\u{1F512}",helpText:"This feature requires authentication to be configured."})}function c(t){return{isAuthAvailable:n(i.AUTH),AuthFallbackComponent:()=>e(o,{...t})}}export{o as AuthFallback,c as useAuthComponent,l as withAuthFallback};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as a}from"react/jsx-runtime";import{useMemo as I,useState as B}from"react";if(typeof document<"u"&&!document.getElementById("auth-partner-button-styles")){const r=document.createElement("style");r.id="auth-partner-button-styles",r.textContent=`
|
|
2
2
|
.dndev-interactive.auth-partner-button-custom[data-variant='outline']:hover {
|
|
3
3
|
background-color: var(--partner-hover-bg);
|
|
4
4
|
}
|
|
5
|
-
`,document.head.appendChild(
|
|
5
|
+
`,document.head.appendChild(r)}import{cn as D,DISPLAY as S,PROVIDER_ICONS as U,DefaultProviderIcon as M,Button as _,BUTTON_VARIANT as $,Spinner as V}from"@donotdev/components";import{AUTH_PARTNERS as W,useTranslation as j}from"@donotdev/core";import{EmailLinkForm as F}from"./EmailLinkForm";import H from"./EmailPasswordForm";import{getAuthMethod as k}from"../constants";import{useAuth as s}from"../useAuth";function K({partnerId:r,method:p,onSuccess:u,onError:l,className:d="",children:b,disabled:h=!1,display:f=S.AUTO,style:v,...q}){const{t:i}=j("auth"),g=s("user"),E=s("signInWithPartner"),A=s("linkWithPartner"),N=s("isAvailable"),[o,y]=B(!1),n=I(()=>W[r],[r]);if(r==="password")return a("div",{className:d,children:a(H,{mode:"signin",onSuccess:()=>u?.(null),onError:l,compact:!0})});if(r==="emailLink")return a("div",{className:d,children:a(F,{onSuccess:()=>u?.(null),onError:l})});const T=I(()=>U[r]||M,[r]),P=n?.firebaseProviderId,c=!!g?.providerData?.some(t=>t.providerId===P),m=g&&!c,w=async()=>{if(!(o||h)){y(!0);try{let t;if(m)t=await A(r,k(p));else{const R=k(p);t=await E(r,R)}t&&u?.(t)}catch(t){l?.(t instanceof Error?t:new Error(String(t)))}finally{y(!1)}}},e=n?.name,O=()=>{if(b)return b;if(m)return o?i("buttons.linking",{partner:e}):c?i("buttons.linked",{partner:e}):i("buttons.link",{partner:e});if(o)return i("buttons.signingIn",{partner:e});const t=n?.button?.textKey;return t?i(t):`Sign in with ${e}`},x=h||o||!N||m&&c||!1,C=n?.button?{backgroundColor:n.button.backgroundColor,color:n.button.textColor,borderColor:n.button.borderColor,"--partner-hover-bg":n.button.hoverBackgroundColor}:void 0,L=v?{...C,...v}:C;return a(_,{variant:$.OUTLINE,onClick:w,disabled:x,"aria-busy":o,display:f,"aria-label":o?`Signing in with ${e}...`:`Sign in with ${e}`,tooltip:void 0,style:L,className:D(n?.button&&"auth-partner-button-custom",d),icon:o?a(V,{"aria-label":"Loading"}):T,children:f!==S.COMPACT&&O()})}var Y=K;export{Y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as n,jsxs as c,Fragment as f}from"react/jsx-runtime";import{Trash2 as y}from"lucide-react";import{useState as A}from"react";import{Dialog as g,Button as s,BUTTON_VARIANT as u,PasswordInput as R,Label as D,Checkbox as k,Alert as C,ALERT_VARIANT as b,Stack as l,Text as v,List as w}from"@donotdev/components";import{useTranslation as T}from"@donotdev/core";function E({open:h,isLoading:o,error:r,onReauth:m,onCancel:a}){const{t:e}=T("auth"),[i,p]=A(""),d=async()=>{await m(i)};return n(g,{open:h,onOpenChange:t=>!t&&a(),title:e("deleteAccount.reauth.title","Confirm Your Identity"),description:e("deleteAccount.reauth.description","For security, please re-enter your password to continue."),footer:c(f,{children:[n(s,{variant:u.OUTLINE,onClick:a,disabled:o,children:e("deleteAccount.reauth.cancel","Cancel")}),n(s,{variant:u.DEFAULT,onClick:d,disabled:o||!i,children:o?e("deleteAccount.reauth.verifying","Verifying..."):e("deleteAccount.reauth.continue","Continue")})]}),children:n("form",{onSubmit:t=>{t.preventDefault(),d()},children:c(l,{children:[n(R,{value:i,onChange:t=>p(t.target.value),label:e("deleteAccount.reauth.password","Password"),disabled:o,placeholder:e("deleteAccount.reauth.passwordPlaceholder","Enter your password"),required:!0,className:"dndev-w-full"}),r&&n(C,{variant:b.ERROR,description:r})]})})})}function x({open:h,isLoading:o,error:r,onConfirm:m,onCancel:a}){const{t:e}=T("auth"),[i,p]=A(!1),d=async()=>{i&&await m()};return n(g,{open:h,onOpenChange:t=>!t&&a(),"data-content-size":"text",title:e("deleteAccount.confirm.title","Delete Your Account?"),description:e("deleteAccount.confirm.description","This action cannot be undone. This will permanently delete your account."),footer:c(f,{children:[n(s,{variant:u.OUTLINE,onClick:a,disabled:o,children:e("deleteAccount.confirm.cancel","Cancel")}),n(s,{variant:u.DESTRUCTIVE,icon:y,onClick:d,disabled:o||!i,children:o?e("deleteAccount.confirm.deleting","Deleting..."):e("deleteAccount.confirm.delete","Delete My Account")})]}),children:c(l,{gap:"large",children:[c(l,{children:[n(v,{as:"h4",level:"h4",children:e("deleteAccount.confirm.whatDeleted","What will be deleted:")}),n(w,{items:[e("deleteAccount.confirm.credentials","Your account and authentication credentials"),e("deleteAccount.confirm.profile","Your profile information"),e("deleteAccount.confirm.oauth","All connected OAuth providers"),e("deleteAccount.confirm.subscriptions","Active subscriptions (will be canceled)")]})]}),c(l,{children:[n(v,{as:"h4",level:"h4",children:e("deleteAccount.confirm.whatKept","What will be kept (anonymized):")}),n(w,{items:[e("deleteAccount.confirm.billing","Billing history for tax/accounting purposes"),e("deleteAccount.confirm.invoices","Past invoices and transaction records")]})]}),c(l,{direction:"row",align:"start",children:[n(k,{id:"confirm-delete",checked:i,onCheckedChange:t=>p(t===!0)}),n(D,{htmlFor:"confirm-delete",children:e("deleteAccount.confirm.checkbox","I understand this action cannot be undone")})]}),r&&n(C,{variant:b.ERROR,description:r})]})})}export{x as ConfirmDeleteDialog,E as ReauthDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as
|
|
1
|
+
"use client";import{jsx as e,jsxs as l}from"react/jsx-runtime";import{Mail as o,CheckCircle as f}from"lucide-react";import{Button as c,BUTTON_VARIANT as N,Input as T,Alert as b,ALERT_VARIANT as C,Spinner as R,Stack as n,Text as s}from"@donotdev/components";import{useTranslation as x}from"@donotdev/core";import{useEmailLinkForm as A}from"../hooks/useEmailLinkForm";function m({className:r="",onSuccess:u,onError:h,actionCodeSettings:k}){const{t:i}=x("auth"),{email:t,setEmail:L,isLoading:a,isSent:v,error:d,handleSendLink:p,handleResend:g,canSubmit:E}=A({onSuccess:u,onError:h,actionCodeSettings:k});return v?l(n,{className:r,children:[l(n,{align:"center",children:[e(f,{className:"dndev-size-touch"}),e(s,{as:"h3",level:"h3",children:i("emailLink.checkEmail","Check Your Email")}),e(s,{level:"small",variant:"muted",className:"dndev-text-center",children:i("emailLink.sentMessage",`We've sent a sign-in link to ${t}. Click the link in your email to complete sign-in.`)})]}),e(n,{direction:"row",justify:"center",children:e(c,{variant:N.OUTLINE,onClick:g,icon:o,iconEnd:!1,children:i("emailLink.resend","Resend Link")})})]}):e("form",{onSubmit:p,className:r,children:l(n,{children:[e(T,{type:"email",label:i("emailLink.emailLabel","Email Address"),value:t,onChange:S=>L(S.target.value),placeholder:i("emailLink.emailPlaceholder","Enter your email address"),required:!0,disabled:a,className:"dndev-w-full"}),d&&e(b,{variant:C.ERROR,description:d}),e(c,{type:"submit",disabled:!E,icon:a?e(R,{"aria-label":"Loading"}):o,iconEnd:!1,className:"dndev-w-full",children:a?i("emailLink.sending","Sending Link..."):i("emailLink.sendLink","Send Sign-In Link")}),e(s,{level:"small",variant:"muted",className:"dndev-text-center",children:i("emailLink.helpText","We'll send you a secure link to sign in without a password.")})]})})}var y=m;export{m as EmailLinkForm,y as default};
|
|
@@ -3,7 +3,9 @@ import type { EmailPasswordFormProps } from '../constants';
|
|
|
3
3
|
* Email/password form with three views: sign in (remember me, forgot password),
|
|
4
4
|
* sign up (password policy + strength, breached-password check, confirmation,
|
|
5
5
|
* consent) and forgot password. Success calls `onSuccess` at once; what the user must
|
|
6
|
-
* still do arrives as a toast that stays until dismissed.
|
|
6
|
+
* still do arrives as a toast that stays until dismissed. With `confirmation="code"`,
|
|
7
|
+
* a sign-up (or a sign-in of an unconfirmed address) shows the code step instead, and
|
|
8
|
+
* `onSuccess` runs once the code signed the user in.
|
|
7
9
|
*
|
|
8
10
|
* @component
|
|
9
11
|
* @example
|
|
@@ -11,6 +13,6 @@ import type { EmailPasswordFormProps } from '../constants';
|
|
|
11
13
|
* <EmailPasswordForm onSuccess={() => setOpen(false)} />
|
|
12
14
|
* ```
|
|
13
15
|
*/
|
|
14
|
-
declare function EmailPasswordForm({ mode, onSuccess, onError, className, tos, privacy, captchaToken, }: EmailPasswordFormProps): import("react").JSX.Element;
|
|
16
|
+
declare function EmailPasswordForm({ mode, onSuccess, onError, className, tos, privacy, captchaToken, confirmation, }: EmailPasswordFormProps): import("react").JSX.Element;
|
|
15
17
|
export default EmailPasswordForm;
|
|
16
18
|
//# sourceMappingURL=EmailPasswordForm.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmailPasswordForm.d.ts","sourceRoot":"","sources":["../../src/components/EmailPasswordForm.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EmailPasswordForm.d.ts","sourceRoot":"","sources":["../../src/components/EmailPasswordForm.tsx"],"names":[],"mappings":"AAsCA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAQ3D;;;;;;;;;;;;;GAaG;AACH,iBAAS,iBAAiB,CAAC,EACzB,IAAe,EACf,SAAS,EACT,OAAO,EACP,SAAS,EACT,GAAG,EACH,OAAO,EACP,YAAY,EACZ,YAAsB,GACvB,EAAE,sBAAsB,+BA0GxB;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as
|
|
1
|
+
"use client";import{jsx as e,jsxs as i}from"react/jsx-runtime";import{useState as g}from"react";import{Button as L,BUTTON_VARIANT as R,Stack as r,Text as T}from"@donotdev/components";import{useTranslation as V}from"@donotdev/core";import{AuthCodeStep as _,AuthConfirmPasswordField as j,AuthConsentField as H,AuthEmailField as p,AuthForm as A,AuthFormAlerts as w,AuthPasswordField as F,AuthRememberMeField as M,AuthSubmitButton as v}from"../emailAuth/fields";import{AUTH_FIELD as U,useEmailSignIn as q,useEmailSignUp as D,usePasswordResetRequest as K}from"../emailAuth/flows";const O=c=>{const a=c.currentTarget.form?.elements.namedItem(U.EMAIL);return a instanceof HTMLInputElement?a.value:""};function z({mode:c="signin",onSuccess:a,onError:k,className:s,tos:y,privacy:C,captchaToken:I,confirmation:l="toast"}){const{t}=V("auth"),[S,N]=g(c),[u,E]=g(""),[m,d]=g(null),f={onSuccess:()=>a?.(void 0),onError:k,captchaToken:I},b=q({...f,confirmation:l,onCodeSent:d}),P=D({...f,confirmation:l,onSuccess:n=>{l==="code"&&n.awaitingConfirmation?d(n.email):a?.(void 0)}}),x=K(f);if(m!==null)return e(r,{className:s,children:e(_,{email:m,onSuccess:()=>a?.(void 0),onChangeEmail:()=>{E(m),d(null)}})});const B=n=>h=>{E(O(h)),N(n)},o=(n,h)=>e(L,{type:"button",variant:R.LINK,onClick:B(h),children:n});return S==="reset"?i(A,{flow:x,className:s,children:[e(T,{variant:"muted",children:t("forgotPassword.intro","Enter your email and we will send you a reset link.")}),e(p,{defaultValue:u}),e(w,{}),e(v,{}),e(r,{align:"center",children:o(t("back","Back"),"signin")})]},"reset"):S==="signup"?i(A,{flow:P,className:s,children:[e(p,{defaultValue:u}),e(F,{}),e(j,{}),e(H,{tos:y,privacy:C}),e(w,{}),e(v,{}),e(r,{align:"center",children:o(t("alreadyHaveAccount","Already have an account? Sign In"),"signin")})]},"signup"):i(A,{flow:b,className:s,children:[e(p,{defaultValue:u}),e(F,{}),e(M,{}),e(w,{}),e(v,{}),i(r,{direction:"row",gap:"tight",justify:"center",align:"center",children:[o(t("forgotPassword","Forgot password?"),"reset"),e(T,{as:"span",variant:"muted",children:"|"}),o(t("actions.sign_up_submit","Create account"),"signup")]})]},"signin")}var Z=z;export{Z as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as r,jsxs as o}from"react/jsx-runtime";import{useId as h}from"react";import{Card as
|
|
1
|
+
"use client";import{jsx as r,jsxs as o}from"react/jsx-runtime";import{useId as h}from"react";import{Card as y,Button as V,BUTTON_VARIANT as A,Alert as b,Spinner as M,Stack as d,Text as T}from"@donotdev/components";import{useTranslation as x,handleError as w}from"@donotdev/core";import{useAuth as n}from"../useAuth";function I({verifyButtonText:j,successMessage:k,sendingMessage:B,alreadyVerifiedMessage:E,notSignedInMessage:R,errorMessage:$,id:l}){const{t:e}=x("auth"),t=n("user"),i=n("emailVerification"),u=n("sendEmailVerification"),s=t?.id,c=h(),a=l||`email-verification-${c}`,f=`${a}-heading`,m=`${a}-button`,g=async()=>{if(!(!t||!s))try{await u()}catch(v){w(v)}};if(!t||!s)return null;const p=()=>{if(i.status!=="pending"&&i.status==="error")return"error"};return r(y,{id:a,title:r("span",{id:f,children:e("emailVerification.title")}),children:o(d,{children:[o(d,{direction:"row",justify:"between",align:"center",children:[r(T,{level:"small",variant:"muted",children:e("emailVerification.status.unknown")}),r(V,{id:m,onClick:g,disabled:i.status==="pending","aria-busy":i.status==="pending",variant:A.PRIMARY,icon:i.status==="pending"?r(M,{"aria-label":"Loading"}):void 0,iconEnd:!1,children:i.status==="pending"?e("status.verifying"):e("buttons.verify","Verify")})]}),i.status!=="verified"&&r(b,{variant:p(),title:i.status==="error"?e("aria.errorAlert"):e("status.verifying"),description:i.status==="error"?("error"in i?i.error:void 0)||e("emailVerification.error","An error occurred"):e("emailVerification.sending","Sending verification email...")})]})})}var S=I;export{S as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{Fragment as
|
|
1
|
+
"use client";import{Fragment as t,jsx as a}from"react/jsx-runtime";import{useImperativeHandle as o,forwardRef as i}from"react";import{hasTierAccess as f}from"@donotdev/core";import{useAuth as c}from"../useAuth";const p=i(({featureId:r,fallback:e=null,children:l},n)=>{const s=c("userSubscription")?.features?.includes(r)||!1;return o(n,()=>({enabled:s}),[s]),s?a(t,{children:l}):e?a(t,{children:e}):null}),m=i(({tier:r,fallback:e=null,children:l},n)=>{const s=c("userSubscription"),d=r||"pro",u=f(s?.tier,d);return o(n,()=>({enabled:u}),[u]),u?a(t,{children:l}):e?a(t,{children:e}):null}),h=i((r,e)=>a(m,{ref:e,tier:"pro",...r})),b=i((r,e)=>a(m,{ref:e,tier:"premium",...r}));export{p as Feature,b as PremiumFeature,h as ProFeature};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as e,jsxs as s,Fragment as w}from"react/jsx-runtime";import{Stack as f}from"@donotdev/components";import{hasRoleAccess as h,hasTierAccess as m}from"@donotdev/core";import{useAuth as t}from"../useAuth";import{AuthFallback as T}from"./AuthFallback";function g({requiredTier:r,userTier:i}){return e("div",{className:"dndev-surface","data-variant":"default","data-shadow":"sm","data-radius":"lg",style:{padding:"var(--gap-md)",border:"1px solid var(--border)",backgroundColor:"var(--muted)"},children:s(f,{direction:"row",align:"center",children:[e("span",{style:{color:"var(--accent)"},children:"\u{1F512}"}),s("div",{children:[e("p",{style:{fontWeight:500,fontSize:"var(--font-size-base)",color:"var(--foreground)"},children:r==="pro"?"Pro Feature":"Premium Feature"}),s("p",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:["Upgrade to ",r," to access this feature",i&&` (current: ${i})`]})]})]})})}function p({requiredRole:r,userRole:i}){const o=Array.isArray(r)?r.join(" or "):r;return e("div",{className:"dndev-surface","data-variant":"destructive","data-shadow":"sm","data-radius":"lg",style:{padding:"var(--gap-md)",border:"1px solid var(--destructive)",backgroundColor:"var(--muted)"},children:s(f,{direction:"row",align:"center",children:[e("span",{style:{color:"var(--destructive)"},children:"\u{1F6AB}"}),s("div",{children:[e("p",{style:{fontWeight:500,fontSize:"var(--font-size-base)",color:"var(--destructive)"},children:"Access Denied"}),s("p",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:["This feature requires ",o," role",i&&` (current: ${i})`]})]})]})})}function b(){return e("div",{className:"dndev-surface","data-variant":"default","data-shadow":"sm","data-radius":"lg",style:{padding:"var(--gap-md)",border:"1px solid var(--border)",backgroundColor:"var(--muted)"},children:s(f,{direction:"row",align:"center",children:[e("span",{style:{color:"var(--accent)"},children:"\u23F0"}),s("div",{children:[e("p",{style:{fontWeight:500,fontSize:"var(--font-size-base)",color:"var(--foreground)"},children:"Subscription Required"}),e("p",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:"This feature requires an active subscription"})]})]})})}function y({children:r,role:i,tier:o,subscription:u,validate:n,fallback:a,message:l,showUpgradePrompt:A=!0,showLoginPrompt:z=!0}){const S=t("user"),R=t("loading"),q=t("userProfile"),v=t("userSubscription"),d=q?.role,c=v?.tier;return R?e("div",{style:{height:"2rem",borderRadius:"var(--radius)",backgroundColor:"var(--muted)",animation:"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite"}}):!S&&(i||o||u)?z?e(T,{message:l||"Please sign in to access this feature"}):null:i&&!(Array.isArray(i)?i:[i]).some(F=>h(d,F))?a?e(a,{requiredRole:i,userRole:d||void 0}):e(p,{requiredRole:i,userRole:d||void 0}):o&&!m(c,o)?a?e(a,{requiredTier:o,userTier:c||"free"}):A?e(g,{requiredTier:o,userTier:c||"free"}):null:u&&!v?.isActive?a?e(a,{requiresSubscription:!0,hasSubscription:v?.isActive||!1}):e(b,{}):n&&!n(d,c)?a?e(a,{userRole:d,userTier:c}):e(p,{userRole:d}):e(w,{children:r})}function P(r){const i=t("user"),o=t("userProfile"),u=t("userSubscription"),n=o?.role,a=u?.tier;return!(!i&&(r.role||r.tier||r.subscription)||r.role&&!(Array.isArray(r.role)?r.role:[r.role]).some(l=>h(n,l))||r.tier&&!m(a,r.tier)||r.subscription&&!u?.isActive||r.validate&&n&&a&&!r.validate(n,a))}function k(r,i){return o=>e(y,{...i,children:e(r,{...o})})}export{p as AccessDenied,y as FeatureGuard,b as SubscriptionExpired,g as UpgradePrompt,P as useCanAccessFeature,k as withFeatureGuard};
|
|
@@ -47,7 +47,7 @@ interface TierPlaceholderProps {
|
|
|
47
47
|
* @since 0.0.1
|
|
48
48
|
* @author AMBROISE PARK Consulting
|
|
49
49
|
*/
|
|
50
|
-
export declare function FeaturePlaceholder({ featureId, featureName, className, children, }: FeaturePlaceholderProps): string | number | bigint | true | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> |
|
|
50
|
+
export declare function FeaturePlaceholder({ featureId, featureName, className, children, }: FeaturePlaceholderProps): string | number | bigint | true | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null;
|
|
51
51
|
/**
|
|
52
52
|
* Placeholder for Pro tier features
|
|
53
53
|
*
|
|
@@ -55,7 +55,7 @@ export declare function FeaturePlaceholder({ featureId, featureName, className,
|
|
|
55
55
|
* @since 0.0.1
|
|
56
56
|
* @author AMBROISE PARK Consulting
|
|
57
57
|
*/
|
|
58
|
-
export declare const ProFeaturePlaceholder: ({ featureName, className, children, }: TierPlaceholderProps) => string | number | bigint | true | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> |
|
|
58
|
+
export declare const ProFeaturePlaceholder: ({ featureName, className, children, }: TierPlaceholderProps) => string | number | bigint | true | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null;
|
|
59
59
|
/**
|
|
60
60
|
* Placeholder for Premium tier features
|
|
61
61
|
*
|
|
@@ -63,6 +63,6 @@ export declare const ProFeaturePlaceholder: ({ featureName, className, children,
|
|
|
63
63
|
* @since 0.0.1
|
|
64
64
|
* @author AMBROISE PARK Consulting
|
|
65
65
|
*/
|
|
66
|
-
export declare const PremiumFeaturePlaceholder: ({ featureName, className, children, }: TierPlaceholderProps) => string | number | bigint | true | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> |
|
|
66
|
+
export declare const PremiumFeaturePlaceholder: ({ featureName, className, children, }: TierPlaceholderProps) => string | number | bigint | true | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null;
|
|
67
67
|
export {};
|
|
68
68
|
//# sourceMappingURL=FeaturePlaceholder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsxs as
|
|
1
|
+
"use client";import{jsxs as o,jsx as s}from"react/jsx-runtime";import{cn as d}from"@donotdev/components";import{hasTierAccess as m}from"@donotdev/core";import{useAuth as i}from"../useAuth";function f({featureId:e,featureName:r,className:a="",children:t}){if(i("userSubscription")?.features?.includes(e))return null;const n=s("div",{className:d("dndev-surface",a),"data-variant":"muted","data-shadow":"none","data-radius":"lg",style:{padding:"var(--gap-md)",border:"1px dashed var(--border)",backgroundColor:"var(--muted)"},children:o("p",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)",textAlign:"center"},children:[r," is not available on your current plan."]})});return t||n}function u(e,r){return function({featureName:a,className:t="",children:n}){const l=i("userSubscription");if(m(l?.tier,e))return null;const c=s("div",{className:d("dndev-surface",t),"data-variant":"muted","data-shadow":"none","data-radius":"lg",style:{padding:"var(--gap-md)",border:"1px dashed var(--border)",backgroundColor:"var(--muted)"},children:o("p",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)",textAlign:"center"},children:[a," is only available on ",r," tier."]})});return n||c}}const p=u("pro","Pro"),v=u("premium","Premium");export{f as FeaturePlaceholder,v as PremiumFeaturePlaceholder,p as ProFeaturePlaceholder};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as
|
|
1
|
+
"use client";import{jsx as e,jsxs as S}from"react/jsx-runtime";import{Card as i,Spinner as w,Stack as I}from"@donotdev/components";import{useTranslation as N}from"@donotdev/core";import{useGoogleOneTap as T}from"../hooks/useGoogleOneTap";function z({clientId:s,onSuccess:l,onError:c,autoSelect:p=!0,cancelOnTapOutside:m=!0,className:g="",disabled:r=!1,promptParentId:h,allowedParentOrigins:a,cspNonce:u,clientOnly:n=!1,showErrorDetails:C=!1,loadingComponent:o,errorComponent:L,browserNotSupportedComponent:P}){const{t:v}=N("auth"),{shouldShow:f,isLoaded:j,isLoading:x,error:O,containerRef:y,fedcmSupported:d,isHydrated:t,browserInfo:E}=T({clientId:s,autoSelect:p,cancelOnTapOutside:m,promptParentId:h,disabled:r,onSuccess:l,onError:c,allowedParentOrigins:a,cspNonce:u,clientOnly:n});return r||!f||n&&!t?null:x?o?e("div",{className:"dndev-fixed",style:{right:"var(--gap-md)",zIndex:50,top:"calc(1rem + var(--header-height, 0px))"},children:e(i,{style:{padding:"var(--gap-md)"},children:e(o,{})})}):e("div",{className:"dndev-fixed",style:{right:"var(--gap-md)",zIndex:50,top:"calc(1rem + var(--header-height, 0px))"},children:e(i,{style:{padding:"var(--gap-md)"},children:S(I,{direction:"row",align:"center",children:[e(w,{}),e("span",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:v("googleOneTapLoading","Loading Google One Tap...")})]})})}):!d||O?null:e("div",{className:"dndev-fixed",style:{right:"var(--gap-md)",zIndex:50,top:"calc(1rem + var(--header-height, 0px))"},children:e("div",{ref:y,className:`google-one-tap-container ${g}`.trim(),"data-testid":"google-one-tap","data-fedcm-supported":d,"data-hydrated":t,...a&&{"data-allowed-parent-origins":a.join(",")}})})}var b=z;export{b as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t}from"react/jsx-runtime";import{Dialog as
|
|
1
|
+
"use client";import{jsx as t}from"react/jsx-runtime";import{Dialog as i}from"@donotdev/components";import{useTranslation as a}from"@donotdev/core";import{withAuthFallback as s}from"./AuthFallback";import r from"./MultipleAuthProviders";function p({open:n,onOpenChange:e}){const{t:o}=a("auth");return t(i,{open:n,onOpenChange:e,title:o("signIn","Sign In"),description:o("choosePlatform","Choose a platform to sign in with"),children:t(r,{layout:"vertical",showLabels:!0,method:"popup"})})}const m=s(p,{message:"Authentication is not configured",showLoginButton:!0});var l=m;export{l as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as a,jsxs as k}from"react/jsx-runtime";import{Suspense as L,lazy as $,useId as y}from"react";import{Alert as E,ALERT_VARIANT as P,Stack as c,Grid as T}from"@donotdev/components";import{useTranslation as j,getEnabledAuthPartners as C}from"@donotdev/core";import{useAuth as m}from"../useAuth";import{withAuthFallback as G}from"./AuthFallback";import M from"./AuthPartnerButton";import{getAuthMethod as O}from"../constants";import{useAccountLinking as q}from"../hooks/useAccountLinking";const B=$(()=>import("./AccountLinking")),F=({providers:h,containerClassName:r="",providerClassName:p="",method:g,size:_="md",layout:e="vertical",showLabels:f=!0,spacing:o="medium",ariaLabel:v,id:A,fullWidth:b=!0,onSuccess:N})=>{const{t}=j("auth"),w=y(),n=A||w,{isRequired:R}=q(),l=m("error"),x=m("isAvailable"),z=O(g),i=h||C();if(!i||i.length===0)return a("div",{className:r,children:a("p",{children:"No authentication providers are configured"})});const I=()=>{const d=i.map((s,S)=>a(M,{partnerId:s,method:z,className:`${p} ${b?"dndev-w-full":""}`,tabIndex:S===0?0:void 0,id:`${n}-${s}-button`,onSuccess:N,children:f?void 0:null},s));return e==="grid"?a(T,{cols:2,gap:o,className:r,children:d}):a(c,{direction:e==="horizontal"?"row":"column",wrap:e==="horizontal"?"wrap":void 0,gap:o,align:e==="horizontal"?"center":"stretch",className:r,children:d})};return k(c,{className:"dndev-mx-auto",id:n,role:"region","aria-label":v||t("aria.signInOptions","Sign in options"),children:[I(),l&&x&&a(E,{variant:P.ERROR,description:l.message||t("errorGeneric","Authentication failed. Please try again.")}),R&&a(L,{fallback:null,children:a(B,{})})]})},u=G(F,{message:"Authentication providers are not configured",showLoginButton:!0});var V=u;export{u as MultipleAuthProviders,V as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,jsxs as r}from"react/jsx-runtime";import{Alert as s,Button as l,BUTTON_VARIANT as u,Stack as c}from"@donotdev/components";import{useTranslation as f}from"@donotdev/core";import{useNetworkStatus as d}from"../hooks/useNetworkStatus";function
|
|
1
|
+
"use client";import{jsx as t,jsxs as r}from"react/jsx-runtime";import{Alert as s,Button as l,BUTTON_VARIANT as u,Stack as c}from"@donotdev/components";import{useTranslation as f}from"@donotdev/core";import{useNetworkStatus as d}from"../hooks/useNetworkStatus";function w({showWhenOnline:a=!1,className:i=""}){const{t:e}=f("auth"),{online:n,connectionType:o,isSlowConnection:h}=d();return n&&!a?null:t(s,{variant:n?void 0:"error",className:i,role:"status","aria-live":n?"polite":"assertive",title:n?e("networkStatus.online",{defaultValue:"You are online"}):e("networkStatus.offline",{defaultValue:"You are offline"}),description:n?t("span",{children:e("networkStatus.connectedVia",{connectionType:o||"unknown",defaultValue:`Connected via ${o||"unknown"}`})}):r(c,{children:[t("p",{children:e("networkStatus.offlineMessage",{defaultValue:"Authentication requires an internet connection. Please check your network settings."})}),t(l,{variant:u.GHOST,onClick:()=>{typeof window<"u"&&window.location.reload()},style:{fontSize:"var(--font-size-sm)",textDecoration:"underline",fontWeight:500},children:e("networkStatus.checkAgain",{defaultValue:"Check again"})})]})})}var k=w;export{k as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as s,jsxs as
|
|
1
|
+
"use client";import{jsx as s,jsxs as i}from"react/jsx-runtime";import{useCallback as L,useEffect as U,useState as m}from"react";import{useForm as j,Controller as N,useWatch as z}from"react-hook-form";import{Alert as R,ALERT_VARIANT as C,Button as S,BUTTON_VARIANT as _,Dialog as F,PasswordInput as V,Spinner as Z,Stack as l,Text as g}from"@donotdev/components";import{useTranslation as G}from"@donotdev/core";import{useAuthStore as O}from"../AuthStore";import{isBreachedPassword as X}from"../emailAuth/rules";import{useAuth as h}from"../useAuth";import{PasswordStrengthIndicator as $}from"./PasswordStrengthIndicator";function H(){if(typeof window>"u")return{type:null};const r=window.location.hash.slice(1);if(r){const n=new URLSearchParams(r),p=n.get("error_code");if(p){const f={type:"supabase_error",errorCode:p,errorDescription:n.get("error_description")?.replace(/\+/g," ")||void 0};return window.history.replaceState(null,"",window.location.pathname+window.location.search),f}if(n.get("type")==="recovery")return window.history.replaceState(null,"",window.location.pathname+window.location.search),{type:"supabase_recovery"}}const c=new URLSearchParams(window.location.search),w=c.get("oobCode");return w&&c.get("mode")==="resetPassword"?{type:"firebase",oobCode:w}:{type:null}}function J(){const{t:r}=G("auth"),c=h("passwordResetPending"),w=h("verifyPasswordResetCode"),n=h("confirmPasswordReset"),p=h("updatePassword"),f=h("signInWithEmail"),[a,t]=m("idle"),[u,x]=m(null),[v,A]=m(null),[q,W]=m(!1),[M,k]=m(null),{control:y,handleSubmit:Y,getValues:B,formState:{errors:o,isSubmitting:P},setError:E}=j({mode:"onChange",defaultValues:{password:"",confirmPassword:""}}),I=z({control:y,name:"password"});U(()=>{if(a!=="idle")return;const e=H();if(e.type==="supabase_error"){e.errorCode==="otp_expired"?t("expired"):(k(e.errorDescription||null),t("invalid"));return}if(e.type==="firebase"&&e.oobCode){W(!0),A(e.oobCode),t("loading"),w(e.oobCode).then(d=>{d?(x(d),t("ready")):t("expired")});return}c&&t("ready")},[c,a,w]);const D=L(async e=>{try{if(q&&v){if(await n(v,e.password),u)try{await f(u,e.password)}catch{}}else await p(e.password),O.getState().setPasswordResetPending(!1);t("idle")}catch(d){const T=d instanceof Error?d.message:String(d);T.includes("expired")||T.includes("EXPIRED")?t("expired"):E("root",{message:r("resetPassword.error","Failed to reset password. Please try again.")})}},[q,v,u,n,p,f,E,r]),b=L(()=>{t("idle"),x(null),A(null),k(null),O.getState().setPasswordResetPending(!1),typeof window<"u"&&window.history.replaceState(null,"",window.location.pathname)},[]);return a==="idle"?null:i(F,{open:!0,onOpenChange:e=>{e||b()},style:{maxWidth:"min(28rem, 90vw)"},title:a==="success"?r("resetPassword.success_title","Password updated"):a==="expired"||a==="invalid"?r("resetPassword.expired_title","Link expired"):a==="loading"?r("resetPassword.verifying","Verifying..."):r("resetPassword.title","Set new password"),showClose:!0,children:[a==="loading"&&i(l,{align:"center",justify:"center",children:[s(Z,{}),s(g,{level:"body",variant:"muted",children:r("resetPassword.verifying","Verifying reset link...")})]}),(a==="expired"||a==="invalid")&&i(l,{children:[s(R,{variant:C.WARNING,description:a==="expired"?r("resetPassword.expired_description","This password reset link has expired. Please request a new one."):M||r("resetPassword.invalid_description","This password reset link is invalid. Please request a new one.")}),s(S,{variant:_.PRIMARY,onClick:b,fullWidth:!0,children:r("resetPassword.back_to_signin","Back to Sign In")})]}),a==="success"&&i(l,{children:[s(R,{variant:C.SUCCESS,description:r("resetPassword.success_description","Your password has been reset successfully. You are now signed in.")}),s(S,{variant:_.PRIMARY,onClick:b,fullWidth:!0,children:r("resetPassword.continue","Continue")})]}),a==="ready"&&s("form",{onSubmit:Y(D),noValidate:!0,children:i(l,{children:[u&&s(g,{level:"small",variant:"muted",children:r("resetPassword.for_email",`Enter a new password for ${u}`)}),o.root&&s(R,{variant:C.ERROR,description:o.root.message}),s(N,{name:"password",control:y,rules:{required:r("passwordRequired","Password is required"),minLength:{value:8,message:r("passwordMinLength",{defaultValue:"Password must be at least 8 characters",count:8})},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})=>i(l,{gap:"tight",children:[s(V,{...e,label:r("resetPassword.new_password","New password"),placeholder:r("passwordPlaceholder","Enter your password"),autoComplete:"new-password",disabled:P,"aria-invalid":!!o.password,"aria-describedby":o.password?"reset-password-error":void 0,className:"dndev-w-full","data-variant":o.password?"destructive":void 0}),o.password&&s(g,{as:"span",level:"caption",variant:"destructive",id:"reset-password-error",role:"alert",children:o.password.message})]})}),s(N,{name:"confirmPassword",control:y,rules:{required:r("confirmPasswordRequired","Please confirm your password"),validate:e=>e===B("password")||r("confirmPasswordMismatch","Passwords do not match")},render:({field:e})=>i(l,{gap:"tight",children:[s(V,{...e,label:r("confirmPassword","Confirm password"),placeholder:r("confirmPasswordPlaceholder","Re-enter your password"),autoComplete:"new-password",disabled:P,"aria-invalid":!!o.confirmPassword,"aria-describedby":o.confirmPassword?"reset-confirm-error":void 0,className:"dndev-w-full","data-variant":o.confirmPassword?"destructive":void 0}),o.confirmPassword&&s(g,{as:"span",level:"caption",variant:"destructive",id:"reset-confirm-error",role:"alert",children:o.confirmPassword.message})]})}),I&&s($,{password:I,minLength:8,showRequirements:!0}),s(S,{type:"submit",variant:_.PRIMARY,disabled:P,fullWidth:!0,children:P?r("loading","Loading..."):r("resetPassword.submit","Reset Password")})]})})]})}export{J as PasswordResetCallback};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsxs as
|
|
1
|
+
"use client";import{jsxs as r,jsx as i}from"react/jsx-runtime";import{Check as v,Circle as f}from"lucide-react";import{useMemo as m}from"react";import{Progress as b,Stack as o,Text as l,cn as q}from"@donotdev/components";import{useTranslation as k}from"@donotdev/core";function S(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 N(e,t,s){return[{label:s("passwordRequirement.length",`At least ${t} characters`,{count:t}),met:e.length>=t},{label:s("passwordRequirement.uppercase","One uppercase letter"),met:/[A-Z]/.test(e)},{label:s("passwordRequirement.lowercase","One lowercase letter"),met:/[a-z]/.test(e)},{label:s("passwordRequirement.number","One number"),met:/[0-9]/.test(e)},{label:s("passwordRequirement.special","One special character (!@#$%^&*)"),met:/[^a-zA-Z0-9]/.test(e)}]}const R={weak:25,fair:50,good:75,strong:100},g={weak:"destructive",fair:"warning",good:"accent",strong:"success"};function x({password:e,minLength:t=8,showRequirements:s=!0,className:p}){const{t:a}=k("auth"),d=m(()=>S(e),[e]),u=m(()=>N(e,t,(n,c,w)=>a(n,{defaultValue:c||"",...w})),[e,t,a]),h={weak:a("passwordStrength.weak","Weak"),fair:a("passwordStrength.fair","Fair"),good:a("passwordStrength.good","Good"),strong:a("passwordStrength.strong","Strong")};return r(o,{gap:"tight",className:q("dndev-password-strength",p),children:[r(o,{gap:"tight",children:[r(o,{direction:"row",align:"center",justify:"between",gap:"tight",children:[r(l,{as:"span",level:"caption",variant:"muted",children:[a("passwordStrength.label","Password strength"),":"]}),i(l,{as:"strong",level:"caption",variant:g[d],children:h[d]})]}),i(b,{value:R[d],variant:g[d],className:"dndev-password-strength-bar"})]}),s&&r(o,{gap:"tight",className:"dndev-password-requirements",children:[r(l,{as:"strong",level:"caption",variant:"muted",children:[a("passwordRequirements","Password requirements"),":"]}),i(o,{gap:"tight","data-inset":"true",children:u.map((n,c)=>r(o,{direction:"row",align:"center",gap:"tight",className:"dndev-password-requirement-item",children:[n.met?i(v,{className:"dndev-size-xs","data-variant":"success"}):i(f,{className:"dndev-size-xs","data-variant":"muted"}),i(l,{as:"span",level:"caption",variant:n.met?"success":"muted","data-opacity":n.met?void 0:"70",children:n.label})]},c))})]})]})}export{x as PasswordStrengthIndicator};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as s,jsxs as t,Fragment as P}from"react/jsx-runtime";import{useState as T}from"react";import{useForm as C,Controller as E,useWatch as N}from"react-hook-form";import{Alert as S,ALERT_VARIANT as A,Button as d,BUTTON_VARIANT as u,Dialog as I,PasswordInput as L,Stack as g,Text as R}from"@donotdev/components";import{useTranslation as O}from"@donotdev/core";import{PasswordStrengthIndicator as U}from"./PasswordStrengthIndicator";function x({updatePassword:m}){const{t:r}=O("profile"),[f,l]=T(!1),{control:n,handleSubmit:h,formState:{errors:a,isSubmitting:o},setError:y,reset:p}=C({mode:"onChange",defaultValues:{password:""}}),c=N({control:n,name:"password"}),v=async e=>{try{await m(e.password),l(!1),p()}catch(i){const b=i instanceof Error?i.message:String(i);y("root",{message:b||r("profile.security.password.dialog.error","Failed to update password")})}},w=e=>{l(e),e||p()};return s(I,{open:f,onOpenChange:w,trigger:s(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:t(P,{children:[s(d,{variant:u.OUTLINE,onClick:()=>w(!1),disabled:o,children:r("profile.security.password.dialog.cancel","Cancel")}),s(d,{onClick:h(v),disabled:o||!c,children:o?r("profile.security.password.dialog.updating","Updating..."):r("profile.security.password.dialog.update","Update Password")})]}),children:t(g,{children:[a.root&&s(S,{variant:A.ERROR,description:a.root.message}),s(E,{name:"password",control:n,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:e})=>t(g,{gap:"tight",children:[s(L,{...e,label:r("profile.security.password.dialog.newPassword","New Password"),placeholder:r("profile.security.password.dialog.placeholder","Enter new password"),disabled:o,"aria-invalid":!!a.password,"aria-describedby":a.password?"password-update-error":void 0,className:"dndev-w-full","data-variant":a.password?"destructive":void 0}),a.password&&s(R,{as:"span",level:"caption",variant:"destructive",id:"password-update-error",role:"alert",children:a.password.message})]})}),s(U,{password:c||"",minLength:8})]})})}var q=x;export{q as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useTranslation as t}from"@donotdev/core";const
|
|
1
|
+
"use client";import{useTranslation as t}from"@donotdev/core";const a=({identifier:s,className:n=""})=>{const{t:r}=t("auth");return null};var e=a;export{e as default};
|
package/dist/components/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./AuthFallback";import{default as
|
|
1
|
+
export*from"./AuthFallback";import{default as a}from"./EmailPasswordForm";import{default as o}from"./AuthPartnerButton";import{default as r}from"./EmailVerification";export*from"./Feature";export*from"./FeatureGuard";export*from"./FeaturePlaceholder";import{default as t}from"./GoogleOneTap";import{default as s}from"./LoginModal";import{default as e}from"./MultipleAuthProviders";import{default as m}from"./NetworkStatusIndicator";import{default as f}from"./PasswordUpdateDialog";import{PasswordResetCallback as i}from"./PasswordResetCallback";import{PasswordStrengthIndicator as d}from"./PasswordStrengthIndicator";import{default as l}from"./RateLimitAlert";export*from"./DeleteAccountDialogs";export{o as AuthPartnerButton,a as EmailPasswordForm,r as EmailVerification,t as GoogleOneTap,s as LoginModal,e as MultipleAuthProviders,m as NetworkStatusIndicator,i as PasswordResetCallback,d as PasswordStrengthIndicator,f as PasswordUpdateDialog,l as RateLimitAlert};
|
package/dist/constants.d.ts
CHANGED
|
@@ -149,6 +149,15 @@ export interface EmailPasswordFormProps extends BaseComponentProps, AuthCallback
|
|
|
149
149
|
* and passing the token here. When provided, submit is blocked until token is truthy.
|
|
150
150
|
*/
|
|
151
151
|
captchaToken?: string;
|
|
152
|
+
/**
|
|
153
|
+
* How a sign-up (or a sign-in of an unconfirmed address) confirms the email
|
|
154
|
+
* (default `'toast'`: the "check your email" toast with Resend). `'code'`: the form
|
|
155
|
+
* shows `AuthCodeStep` (a 6-character emailed code), then calls `onSuccess` once
|
|
156
|
+
* signed in. Needs a provider with `verifyEmailCode` (Supabase) and a code email
|
|
157
|
+
* template.
|
|
158
|
+
* @default 'toast'
|
|
159
|
+
*/
|
|
160
|
+
confirmation?: 'toast' | 'code';
|
|
152
161
|
}
|
|
153
162
|
/**
|
|
154
163
|
* Props for account linking component
|
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,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AC;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 A,EMAIL_VERIFICATION_STATUS as T}from"@donotdev/core";import{AUTH_PARTNER_STATE as t}from"@donotdev/core";export{T as EMAIL_VERIFICATION_STATUS,t as PARTNER_STATE,A as getAuthMethod};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { AuthUser } from '@donotdev/core';
|
|
3
|
+
import type { EmailAuthFlow, EmailCodeConfirmation } from './flows';
|
|
3
4
|
/** Props of {@link AuthForm}. */
|
|
4
5
|
export interface AuthFormProps {
|
|
5
6
|
/** The flow this form runs (`useEmailSignIn()`, `useEmailSignUp()`, ...) */
|
|
@@ -34,9 +35,24 @@ export interface AuthTextFieldProps {
|
|
|
34
35
|
* @returns The field
|
|
35
36
|
*/
|
|
36
37
|
export declare function AuthEmailField({ label, placeholder, defaultValue, }: AuthTextFieldProps): import("react").JSX.Element;
|
|
38
|
+
/** Props of {@link AuthNameField}. */
|
|
39
|
+
export interface AuthNameFieldProps extends AuthTextFieldProps {
|
|
40
|
+
/** Help text: an (i) after the label shows it on hover, focus or tap */
|
|
41
|
+
info?: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Name field (`name="displayName"`, `autocomplete="name"`): the name the user wants in
|
|
45
|
+
* emails. Optional, never validated: sign-up stores it trimmed as the display name
|
|
46
|
+
* (metadata `full_name`) when filled, nothing when empty.
|
|
47
|
+
*
|
|
48
|
+
* @param props - AuthNameFieldProps
|
|
49
|
+
* @returns The field
|
|
50
|
+
*/
|
|
51
|
+
export declare function AuthNameField({ label, placeholder, defaultValue, info, }: AuthNameFieldProps): import("react").JSX.Element;
|
|
37
52
|
/**
|
|
38
53
|
* Password field. Sign-in: `current-password`. Sign-up: `new-password` and a strength
|
|
39
|
-
* meter with the policy requirements
|
|
54
|
+
* meter, with the policy requirements unless the flow's `passwordComposition` is
|
|
55
|
+
* `false`.
|
|
40
56
|
*
|
|
41
57
|
* @param props - AuthTextFieldProps
|
|
42
58
|
* @returns The field
|
|
@@ -105,4 +121,51 @@ export interface AuthSubmitButtonProps {
|
|
|
105
121
|
* @returns The button
|
|
106
122
|
*/
|
|
107
123
|
export declare function AuthSubmitButton({ children }: AuthSubmitButtonProps): import("react").JSX.Element;
|
|
124
|
+
/** Props of {@link AuthCodeField}. */
|
|
125
|
+
export interface AuthCodeFieldProps {
|
|
126
|
+
/** The code step (`useEmailCodeConfirmation(...)`) */
|
|
127
|
+
confirmation: EmailCodeConfirmation;
|
|
128
|
+
/** Label (default: translated "Confirmation code") */
|
|
129
|
+
label?: string;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* The sign-up code step: one box per character (`autocomplete="one-time-code"`,
|
|
133
|
+
* paste of the whole code), submitted as soon as the last character is typed, the
|
|
134
|
+
* error under it, "A new code has been sent." under it after a resend (no toast), and
|
|
135
|
+
* a Resend button with its countdown; after a resend the code input has focus again.
|
|
136
|
+
* Render it outside the
|
|
137
|
+
* sign-up `AuthForm` (it is not a form field).
|
|
138
|
+
*
|
|
139
|
+
* @param props - AuthCodeFieldProps
|
|
140
|
+
* @returns The code field
|
|
141
|
+
*/
|
|
142
|
+
export declare function AuthCodeField({ confirmation, label }: AuthCodeFieldProps): import("react").JSX.Element;
|
|
143
|
+
/** Props of {@link AuthCodeStep}. */
|
|
144
|
+
export interface AuthCodeStepProps {
|
|
145
|
+
/** The address the code was sent to */
|
|
146
|
+
email: string;
|
|
147
|
+
/**
|
|
148
|
+
* Characters of the code: match the provider (Supabase: `mailer_otp_length`).
|
|
149
|
+
* @default 6
|
|
150
|
+
*/
|
|
151
|
+
length?: number;
|
|
152
|
+
/** Called with the signed-in user once the code is confirmed */
|
|
153
|
+
onSuccess?: (user: AuthUser) => void;
|
|
154
|
+
/** Shows a "Change address" link that calls this (back to the form) */
|
|
155
|
+
onChangeEmail?: () => void;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* The whole code step of a `confirmation: 'code'` sign-up or sign-in: "Enter the code
|
|
159
|
+
* sent to {email}", the code field (auto-submit, error, inline "new code sent",
|
|
160
|
+
* Resend with countdown) and, with `onChangeEmail`, a "Change address" link. No toast.
|
|
161
|
+
*
|
|
162
|
+
* @param props - AuthCodeStepProps
|
|
163
|
+
* @returns The code step
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* ```tsx
|
|
167
|
+
* <AuthCodeStep email={email} onSuccess={next} onChangeEmail={() => setEmail(null)} />
|
|
168
|
+
* ```
|
|
169
|
+
*/
|
|
170
|
+
export declare function AuthCodeStep({ email, length, onSuccess, onChangeEmail, }: AuthCodeStepProps): import("react").JSX.Element;
|
|
108
171
|
//# sourceMappingURL=fields.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../src/emailAuth/fields.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../src/emailAuth/fields.tsx"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAkBvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAK/C,OAAO,KAAK,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAWpE,iCAAiC;AACjC,MAAM,WAAW,aAAa;IAC5B,4EAA4E;IAC5E,IAAI,EAAE,aAAa,CAAC;IACpB,iDAAiD;IACjD,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,aAAa,+BAyBpE;AAYD,uCAAuC;AACvC,MAAM,WAAW,kBAAkB;IACjC,uDAAuD;IACvD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wCAAwC;IACxC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oBAAoB;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,WAAW,EACX,YAAY,GACb,EAAE,kBAAkB,+BAyBpB;AAED,sCAAsC;AACtC,MAAM,WAAW,kBAAmB,SAAQ,kBAAkB;IAC5D,wEAAwE;IACxE,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC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