@donotdev/auth 0.0.4 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/FirebaseAuth.d.ts +0 -2
  2. package/dist/FirebaseAuth.d.ts.map +1 -1
  3. package/dist/FirebaseAuth.js +1 -1
  4. package/dist/components/AccountLinking.js +1 -1
  5. package/dist/components/AuthFallback.d.ts +1 -9
  6. package/dist/components/AuthFallback.d.ts.map +1 -1
  7. package/dist/components/AuthFallback.js +1 -1
  8. package/dist/components/AuthPartnerButton.d.ts +1 -1
  9. package/dist/components/AuthPartnerButton.d.ts.map +1 -1
  10. package/dist/components/AuthPartnerButton.js +2 -2
  11. package/dist/components/DeleteAccountDialogs.js +1 -1
  12. package/dist/components/EmailLinkForm.js +1 -1
  13. package/dist/components/EmailPasswordForm.d.ts +16 -1
  14. package/dist/components/EmailPasswordForm.d.ts.map +1 -1
  15. package/dist/components/EmailPasswordForm.js +1 -1
  16. package/dist/components/FeatureGuard.d.ts.map +1 -1
  17. package/dist/components/FeatureGuard.js +1 -1
  18. package/dist/components/FeaturePlaceholder.d.ts +1 -9
  19. package/dist/components/FeaturePlaceholder.d.ts.map +1 -1
  20. package/dist/components/FeaturePlaceholder.js +1 -1
  21. package/dist/components/GoogleOneTap.d.ts +1 -33
  22. package/dist/components/GoogleOneTap.d.ts.map +1 -1
  23. package/dist/components/GoogleOneTap.js +1 -1
  24. package/dist/components/LoginModal.js +1 -1
  25. package/dist/components/MultipleAuthProviders.d.ts +2 -2
  26. package/dist/components/MultipleAuthProviders.d.ts.map +1 -1
  27. package/dist/components/MultipleAuthProviders.js +1 -1
  28. package/dist/components/PasswordStrengthIndicator.d.ts +22 -0
  29. package/dist/components/PasswordStrengthIndicator.d.ts.map +1 -0
  30. package/dist/components/PasswordStrengthIndicator.js +1 -0
  31. package/dist/components/RateLimitAlert.d.ts +1 -9
  32. package/dist/components/RateLimitAlert.d.ts.map +1 -1
  33. package/dist/components/RateLimitAlert.js +1 -1
  34. package/dist/components/index.d.ts +1 -0
  35. package/dist/components/index.d.ts.map +1 -1
  36. package/dist/components/index.js +1 -1
  37. package/dist/constants.d.ts +2 -3
  38. package/dist/constants.d.ts.map +1 -1
  39. package/dist/hooks/useGoogleOneTap.d.ts.map +1 -1
  40. package/dist/hooks/useGoogleOneTap.js +1 -1
  41. package/dist/tsconfig.tsbuildinfo +1 -1
  42. package/dist/useAuth.d.ts.map +1 -1
  43. package/dist/useAuth.js +1 -1
  44. package/package.json +8 -8
@@ -106,7 +106,6 @@ export declare class FirebaseAuth {
106
106
  /**
107
107
  * Sign in with email and password
108
108
  *
109
- * Includes smart recovery for user-not-found (auto-signup).
110
109
  * Updates partner state (password) during operation.
111
110
  *
112
111
  * **Partner State Flow:**
@@ -115,7 +114,6 @@ export declare class FirebaseAuth {
115
114
  * - Error: ERROR
116
115
  *
117
116
  * **Smart Recovery:**
118
- * - User not found → Auto-signup with same credentials
119
117
  * - Network issues → Retry with backoff
120
118
  * - Rate limiting → Exponential backoff
121
119
  *
@@ -1 +1 @@
1
- {"version":3,"file":"FirebaseAuth.d.ts","sourceRoot":"","sources":["../src/FirebaseAuth.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,QAAQ,EACR,UAAU,EACV,aAAa,EAKb,SAAS,EACT,WAAW,EACZ,MAAM,gBAAgB,CAAC;AA2BxB,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAuE7D;;;;;;GAMG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,GAAG,CAAsB;IACjC,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,KAAK,CAA0C;IACvD,OAAO,CAAC,YAAY,CAA8C;IAClE,OAAO,CAAC,WAAW,CAA4B;;IAM/C;;;;;;;OAOG;IACH,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,WAAW,GAAG,IAAI;IAI9C;;;;;;;;OAQG;IACH,OAAO,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;;;OASG;IACG,0BAA0B,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBjE;;;;;;;;;;;;;;;;OAgBG;IACG,0BAA0B,CAC9B,SAAS,EAAE,aAAa,EACxB,MAAM,CAAC,EAAE,UAAU,GAClB,OAAO,CAAC,IAAI,CAAC;IAuChB;;;;;;;OAOG;IACH,OAAO,CAAC,kBAAkB;IAuB1B;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,aAAa,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA4FrD;;OAEG;IACG,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAMxC;;;OAGG;IACG,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAOjE;;OAEG;IACH,wBAAwB,IAAI,IAAI;IAIhC;;;;;OAKG;IACH,cAAc,IAAI,IAAI;IAetB;;;;;;;;OAQG;IACG,0BAA0B,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAgBlE;;;;;OAKG;IACH,OAAO,CAAC,oBAAoB;IAQ5B;;;;;OAKG;IACH,OAAO,CAAC,qBAAqB;IAS7B;;;;;;;;OAQG;YACW,oBAAoB;IAalC;;;;;;;;;;OAUG;IACH,OAAO,CAAC,wBAAwB;IAyChC;;;;;;;;OAQG;IACH,OAAO,CAAC,iBAAiB;IAsBzB;;;;;;;;;OASG;IACH,OAAO,CAAC,gBAAgB;IAaxB;;;;;;;;;OASG;IACH,OAAO,CAAC,8BAA8B;IAgDtC;;;;;;;OAOG;IACH,KAAK,IAAI,IAAI;CASd;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,eAAe,oBAA4C,CAAC"}
@@ -1 +1 @@
1
- import{toast as c}from"@donotdev/components";import{createSingleton as A,safeSessionStorage as d,handleError as a,isClient as p,ClaimsCache as I,getAuthPartnerIdByFirebaseId as y}from"@donotdev/core";import{AUTH_PARTNERS as w,SUBSCRIPTION_TIERS as S,createDefaultUserProfile as R}from"@donotdev/core";import{getFirebaseSDK as P,GoogleAuthProvider as v,GithubAuthProvider as T,FacebookAuthProvider as b,TwitterAuthProvider as L,OAuthProvider as m,EmailAuthProvider as N}from"@donotdev/firebase";import{getAuthMethod as k}from"./constants";import{PARTNER_STATE as o,EMAIL_VERIFICATION_STATUS as C}from"./constants";import{handleOAuthLinking as D,clearAccountLinkingState as F}from"./FirebaseAccountLinking";import{handleSmartRecovery as g}from"./FirebaseSmartRecovery";async function M(E,t,e){const i=m.credentialFromError(t),r=t.customData?._tokenResponse?.verifiedProvider?.[0]||i?.providerId||t.customData?.providerId;return r?y(r):null}class z{sdk;initialized=!1;store=null;popupTimeout=null;claimsCache=null;constructor(){this.sdk=P()}setStore(t){this.store=t}get storeState(){if(!this.store)throw new Error("[FirebaseAuth] Store not set. Call setStore() first.");return this.store}async initialize(){if(!this.initialized)try{await this.sdk.initialize();try{await this.processRedirectResult(!0)}catch(t){a(t,{userMessage:"Redirect processing failed",context:{operation:"processRedirectResult"},severity:"warning",showNotification:!1})}this.initialized=!0}catch(t){throw a(t,{userMessage:"Failed to initialize authentication",showNotification:!1})}}async processRedirectResult(t=!1){this.store&&this.store.setLoading(!0);try{const e=new Promise((r,s)=>setTimeout(()=>s(new Error("Redirect check timeout")),1e4)),i=await Promise.race([this.sdk.getRedirectResult(),e]).catch(r=>{if(r.message==="Redirect check timeout")return null;throw r});i?.user&&(await this.handleAuthStateChange(i.user),await this.checkPendingLinking(),d.removeItem("pendingAuthPartnerId"),c("success","Signed in successfully!"))}catch(e){if(e.code==="auth/account-exists-with-different-credential"){const i=m.credentialFromError(e)?.providerId||e.customData?._tokenResponse?.providerId,r=i?y(i):d.getItem("pendingAuthPartnerId");if(r)try{await g(e,()=>Promise.resolve(),{partnerId:r,method:"redirect"},this.getSmartRecoveryDeps());return}catch(s){a(s,{userMessage:"Failed to link accounts. Please try again.",showNotification:!t})}}if(a(e,{userMessage:"Authentication failed. Please try again.",showNotification:!t,context:{operation:"processRedirectResult"}}),e.code!=="auth/account-exists-with-different-credential")try{this.clearAccountLinkingState(),d.removeItem("pendingAuthPartnerId")}catch(i){a(i)}}finally{this.store&&this.store.setLoading(!1)}}ensureInitialized(){if(!this.initialized)throw new Error("FirebaseAuth not initialized. Call initialize() first.")}getAppConfig(){if(typeof globalThis<"u"){const t=globalThis._DNDEV_APP_CONFIG_;if(t)return t}return null}initializeClaimsCache(){if(this.claimsCache)return;const e=this.getAppConfig()?.features?.offlineTrustEnabled??!1;this.claimsCache=new I({offlineTrustEnabled:e,userId:this.storeState?.userId??null})}onAuthStateChanged(t){return this.sdk.onAuthStateChanged(async e=>{e?await this.handleAuthStateChange(e):this.handleSignOut(),e&&await this.checkPendingLinking();const i=e?this.convertToAuthUser(e):null;t(i)})}async handleAuthStateChange(t){if(!this.store)return;const e=this.convertToAuthUser(t);this.initializeClaimsCache(),this.claimsCache&&this.claimsCache.setUserId(e.id),this.storeState.clearAllPartnerStates();let i={userId:e.id,tier:S.FREE,status:"active",isActive:!0,features:[],subscriptionId:null,customerId:e.id,subscriptionEnd:null,cancelAtPeriodEnd:!1,updatedAt:new Date().toISOString()};try{const s=await this.sdk.getIdTokenResult(t,!0);if(s?.claims?.subscription){const n=s.claims.subscription;i={userId:e.id,tier:n.tier||S.FREE,status:n.status||"active",isActive:n.status==="active",features:n.features||[],subscriptionId:n.subscriptionId||null,customerId:n.customerId||e.id,subscriptionEnd:n.subscriptionEnd||null,cancelAtPeriodEnd:!!n.cancelAtPeriodEnd,updatedAt:n.updatedAt||new Date().toISOString()}}}catch(s){s?.code==="auth/network-request-failed"||s?.originalCode==="auth/network-request-failed"||s?.message?.includes("network")||a(s,{userMessage:"Failed to get custom claims",context:{operation:"getCustomClaims"},severity:"warning"})}const r=R(e.id);this.storeState.setAuthenticated(e,i,r)}handleSignOut(){this.store&&(this.claimsCache&&this.claimsCache.setUserId(null),this.storeState.clearAllPartnerStates(),this.storeState.setUnauthenticated())}async signInWithEmail(t,e){this.ensureInitialized(),this.storeState.setPartnerState("password",o.LOADING);try{const i=await this.sdk.signInWithEmail(t,e);return c("success","Signed in successfully!"),this.storeState.setPartnerState("password",o.IDLE),this.createAuthResult(i.user)}catch(i){if(i.code==="auth/user-not-found"){c("info","Creating your account...");try{const r=await this.sdk.createUserWithEmail(t,e);return c("success","Account created successfully!"),this.createAuthResult(r.user,!0)}catch(r){throw this.storeState.setPartnerState("password",o.ERROR),a(r,{userMessage:"Failed to create account",showNotification:!0})}}try{return await g(i,()=>this.sdk.signInWithEmail(t,e),{email:t,partnerId:"password"},this.getSmartRecoveryDeps())}catch(r){throw this.storeState.setPartnerState("password",o.ERROR),r}}}async createUserWithEmail(t,e){this.ensureInitialized(),this.storeState.setPartnerState("password",o.LOADING);try{const i=await this.sdk.createUserWithEmail(t,e);return c("success","Account created successfully!"),this.storeState.setPartnerState("password",o.IDLE),this.createAuthResult(i.user,!0)}catch(i){try{const r=await g(i,()=>this.sdk.createUserWithEmail(t,e),{email:t,partnerId:"password"},this.getSmartRecoveryDeps());if(!r)throw new Error("Account creation failed");return r}catch(r){throw this.storeState.setPartnerState("password",o.ERROR),r}}}async signInWithPartner(t,e){const i=k(e);this.ensureInitialized(),this.storeState.setPartnerState(t,o.LOADING);try{const r=this.createProviderFromConfig(t);let s;return i==="popup"?(s=await this.handlePopupAuth(t,async()=>await this.sdk.signInWithPopup(r)),s===null?(this.storeState.setPartnerState(t,o.IDLE),null):(c("success","Signed in successfully!"),this.storeState.setPartnerState(t,o.IDLE),this.createAuthResult(s.user))):(d.setItem("pendingAuthPartnerId",t),await this.sdk.signInWithRedirect(r),null)}catch(r){try{const s=await g(r,()=>{const n=this.createProviderFromConfig(t);return i==="popup"?this.sdk.signInWithPopup(n):this.sdk.signInWithRedirect(n)},{partnerId:t,method:i},this.getSmartRecoveryDeps());return s===null?(this.storeState.setPartnerState(t,o.IDLE),null):s}catch(s){throw this.storeState.setPartnerState(t,o.ERROR),s}}}async linkWithPartner(t,e){const i=k(e);this.ensureInitialized();const r=this.sdk.getCurrentUser();if(!r)throw a(new Error("No authenticated user"),{userMessage:"You must be signed in to link accounts",context:{operation:"linkWithPartner",partnerId:t},showNotification:!0});this.storeState.setPartnerState(t,o.LOADING);try{const s=this.createProviderFromConfig(t);if(i==="popup"){const n=await this.sdk.linkWithPopup(r,s);return c("success",`Successfully linked ${t} account!`),this.storeState.setPartnerState(t,o.IDLE),this.createAuthResult(n.user)}else return await this.sdk.linkWithRedirect(r,s),null}catch(s){const n=s;let u="Failed to link account",l={operation:"linkWithPartner",partnerId:t,errorCode:n.code};switch(n.code){case"auth/operation-not-allowed":u="Account linking is disabled. Contact support for assistance.";break;case"auth/provider-already-linked":u="This account is already linked to your profile.";break;case"auth/credential-already-in-use":u="This account is already linked to another profile.";break;case"auth/requires-recent-login":u="Please sign out and sign back in, then try linking again.";break;default:u=`Failed to link ${t} account. Please try again.`}throw this.storeState.setPartnerState(t,o.ERROR),a(s,{userMessage:u,context:l,showNotification:!0})}}async handlePopupAuth(t,e){this.clearPopupMonitoring(),this.popupTimeout=setTimeout(()=>{this.storeState.setPartnerState(t,o.IDLE),this.clearPopupMonitoring()},3e4);try{const i=await e();return this.clearPopupMonitoring(),i}catch(i){if(this.clearPopupMonitoring(),i.code==="auth/popup-closed-by-user"||i.code==="auth/cancelled-popup-request")return null;throw i}}clearPopupMonitoring(){this.popupTimeout&&(clearTimeout(this.popupTimeout),this.popupTimeout=null)}async signInWithGoogleCredential(t){this.ensureInitialized(),this.storeState.setPartnerState("google",o.LOADING);try{const e=await this.sdk.signInWithGoogleCredential(t);return c("success","Signed in with Google!"),this.storeState.setPartnerState("google",o.IDLE),this.createAuthResult(e.user)}catch(e){try{return await g(e,()=>this.sdk.signInWithGoogleCredential(t),{partnerId:"google",method:"redirect"},this.getSmartRecoveryDeps())}catch(i){throw this.storeState.setPartnerState("google",o.ERROR),i}}}async getRedirectResult(){this.ensureInitialized();try{const t=await this.sdk.getRedirectResult();return t?.user?(c("success","Signed in successfully!"),this.createAuthResult(t.user)):null}catch(t){try{return await g(t,()=>this.sdk.getRedirectResult(),{method:"redirect"},this.getSmartRecoveryDeps())}catch(e){throw e}}}async checkPendingLinking(){const t=d.getItem("accountLinkingInfo"),e=d.getItem("originalCredential");if(!(!t||!e))try{const i=JSON.parse(t),r=JSON.parse(e),s=await this.sdk.getCurrentUser();if(!s)return;const n=this.convertToAuthUser(s),u=w[i.newProvider];if(!u)return;if(n.providerData?.some(f=>f.providerId===u.firebaseProviderId)||!1){this.clearAccountLinkingState();return}const h=this.createCredentialFromStoredData(r);if(!h){this.clearAccountLinkingState();return}await this.sdk.linkWithCredential(s,h),this.clearAccountLinkingState(),c("success","Accounts linked successfully!")}catch(i){throw this.clearAccountLinkingState(),a(i,{userMessage:"Account linking failed",showNotification:!0})}}async sendSignInLinkToEmail(t,e){this.ensureInitialized();try{await this.sdk.sendSignInLinkToEmail(t,e||{url:"",handleCodeInApp:!1}),c("success","Sign-in link sent to your email!")}catch(i){throw a(i,{userMessage:"Failed to send sign-in link",showNotification:!0})}}async signInWithEmailLink(t,e){this.ensureInitialized(),this.storeState.setPartnerState("emailLink",o.LOADING);try{const i=await this.sdk.signInWithEmailLink(t,e);return c("success","Signed in successfully!"),this.storeState.setPartnerState("emailLink",o.IDLE),this.createAuthResult(i.user)}catch(i){try{return await g(i,()=>this.sdk.signInWithEmailLink(t,e),{email:t,partnerId:"emailLink"},this.getSmartRecoveryDeps())}catch(r){throw this.storeState.setPartnerState("emailLink",o.ERROR),r}}}isSignInWithEmailLink(t){if(!t&&!p())return!1;const e=t||(p()?window.location.href:"");return this.sdk.isSignInWithEmailLink(e)}async sendPasswordResetEmail(t){this.ensureInitialized();try{await this.sdk.sendPasswordResetEmail(t),c("success","Password reset email sent!")}catch(e){throw a(e,{userMessage:"Failed to send password reset email",showNotification:!0})}}async updatePassword(t){this.ensureInitialized();const e=await this.sdk.getCurrentUser();if(!e)throw a(new Error("No authenticated user"),{userMessage:"You must be signed in to update your password",showNotification:!0});try{await this.sdk.updatePassword(e,t),c("success","Password updated successfully!")}catch(i){throw a(i,{userMessage:"Failed to update password",showNotification:!0})}}async sendEmailVerification(){this.ensureInitialized();const t=await this.sdk.getCurrentUser();if(!t)throw a(new Error("No authenticated user"),{userMessage:"You must be signed in to verify your email",showNotification:!0});try{this.storeState.setEmailVerificationStatus(C.PENDING),await this.sdk.sendEmailVerification(t),c("success","Verification email sent!")}catch(e){throw this.storeState.setEmailVerificationStatus(C.PENDING),a(e,{userMessage:"Failed to send verification email",showNotification:!0})}}async getEmailVerificationStatus(){this.ensureInitialized();const t=await this.sdk.getCurrentUser();return t?{status:t.emailVerified?"verified":"pending"}:{status:"pending",error:"No authenticated user"}}async isEmailVerificationEnabled(){return!0}async getIdTokenResult(t=!1){this.ensureInitialized();const e=await this.sdk.getCurrentUser();if(!e)return null;try{return await this.sdk.getIdTokenResult(e,t)}catch(i){throw a(i,{userMessage:"Failed to get authentication token"})}}async getCustomClaims(){this.ensureInitialized(),this.initializeClaimsCache();const t=await this.sdk.getCurrentUser();if(!t)return{};if(!this.claimsCache)try{return(await this.sdk.getIdTokenResult(t,!0))?.claims||{}}catch(e){throw a(e,{userMessage:"Failed to get user permissions"})}return this.claimsCache.getClaims(async()=>(await this.sdk.getIdTokenResult(t,!0))?.claims||{})}async getCustomClaim(t){this.ensureInitialized();try{return(await this.getCustomClaims())[t]||null}catch(e){throw a(e,{userMessage:"Failed to get user permission"})}}async hasRole(t){this.ensureInitialized();try{const e=await this.getCustomClaim("role");if(this.store&&e){const i=this.storeState.userProfile;i&&this.storeState.setAuthenticated(this.storeState.user,this.storeState.userSubscription,{...i,role:e})}return e===t}catch(e){throw a(e,{userMessage:"Failed to verify user role"})}}async hasTier(t){this.ensureInitialized(),this.initializeClaimsCache();try{const i=(await this.getCustomClaims()).subscription?.tier;if(this.store&&i){const r=this.storeState.userSubscription;r&&this.storeState.setAuthenticated(this.storeState.user,{...r,tier:i},this.storeState.userProfile)}return i===t}catch(e){const r=this.getAppConfig()?.features?.offlineTrustEnabled??!0,s=p()?navigator.onLine:!1;if(!r&&!s)throw a(e,{userMessage:"Failed to verify subscription tier"});return!1}}async hasFeature(t){this.ensureInitialized(),this.initializeClaimsCache();const i=this.storeState.getCustomClaimsLocal()?.features||[],r=Array.isArray(i)&&i.includes(t);if(!this.claimsCache)try{const h=(await this.getCustomClaims()).features||[];return Array.isArray(h)&&h.includes(t)}catch(l){throw a(l,{userMessage:"Failed to verify feature access"})}const s=p()?navigator.onLine:!1,u=this.getAppConfig()?.features?.offlineTrustEnabled??!1;if(s)try{const h=(await this.getCustomClaims()).features||[],f=Array.isArray(h)&&h.includes(t);return f}catch{return r}else return u?r:!1}async getCurrentUser(){const t=await this.sdk.getCurrentUser();return t?this.convertToAuthUser(t):null}async signOut(){this.ensureInitialized(),this.clearPopupMonitoring();try{d.removeItem("accountLinkingInfo"),await this.clearCachedClaims(),await this.sdk.signOut(),c("info","Signed out successfully")}catch(t){throw a(t,{userMessage:"Failed to sign out",showNotification:!0})}}async reauthenticateWithPassword(t){this.ensureInitialized();const e=this.sdk.getCurrentUser();if(!e||!e.email)throw new Error("No authenticated user");try{const i=N.credential(e.email,t);await this.sdk.reauthenticateWithCredential(e,i)}catch(i){throw a(i,{userMessage:"Re-authentication failed. Please check your password.",showNotification:!0})}}async reauthenticateWithProvider(t,e){this.ensureInitialized();const i=this.sdk.getCurrentUser();if(!i)throw new Error("No authenticated user");const r=k(e);try{const s=this.createProviderFromConfig(t);if(r==="popup")await this.sdk.reauthenticateWithPopup(i,s);else{await this.sdk.reauthenticateWithRedirect(i,s);return}}catch(s){throw s.code==="auth/popup-closed-by-user"||s.code==="auth/cancelled-popup-request"||s.code==="auth/popup-blocked"?new Error("REAUTH_CANCELLED"):a(s,{userMessage:"Re-authentication failed. Please try again.",showNotification:!0})}}getPrimaryProvider(t){if(!t.providerData||t.providerData.length===0)return null;const e=t.providerData[0]?.providerId;return e?e==="password"||e==="emailLink"?"password":e.startsWith("google.com")?"google":e.startsWith("github.com")?"github":e.startsWith("microsoft.com")?"microsoft":e.startsWith("apple.com")?"apple":e.startsWith("facebook.com")?"facebook":e.startsWith("twitter.com")?"twitter":null:null}async deleteAccount(t){this.ensureInitialized();const e=this.sdk.getCurrentUser();if(!e)throw new Error("No authenticated user");const i=async()=>{const r=this.getAppConfig()?.auth,s=r&&typeof r=="object"?r.deleteUserFunction:void 0;if(s)try{await s(e.uid)}catch{}await this.sdk.deleteUser(e),c("success","Account deleted successfully")};try{await i()}catch(r){if(r.code==="auth/requires-recent-login"){const s=this.getPrimaryProvider(e);if(!s)throw a(r,{userMessage:"Unable to determine authentication provider",showNotification:!0});if(s!=="password")try{await this.reauthenticateWithProvider(s),await i();return}catch(n){throw n.message==="REAUTH_CANCELLED"?new Error("REAUTH_CANCELLED"):a(n,{userMessage:"Re-authentication failed. Please try again.",showNotification:!0})}if(!t)throw new Error("REQUIRES_PASSWORD");try{await this.reauthenticateWithPassword(t),await i();return}catch(n){throw a(n,{userMessage:"Re-authentication failed. Please check your password.",showNotification:!0})}}throw a(r,{userMessage:"Failed to delete account",showNotification:!0})}}async clearCachedClaims(){this.claimsCache&&await this.claimsCache.clearClaims()}async setCachedClaims(t){this.initializeClaimsCache(),this.claimsCache&&await this.claimsCache.setClaims(t)}clearAccountLinkingState(){F()}resetAuthState(){this.store&&(Object.keys(w).forEach(t=>{this.storeState.setPartnerState(t,o.IDLE)}),this.storeState.clearAuthError())}async fetchSignInMethodsForEmail(t){this.ensureInitialized();try{return await this.sdk.fetchSignInMethodsForEmail(t)}catch(e){throw a(e,{userMessage:"Failed to check sign-in methods"})}}getSmartRecoveryDeps(){return{sdk:this.sdk,handleAccountLinking:this.handleAccountLinking.bind(this),createAuthResult:this.createAuthResult.bind(this)}}getAccountLinkingDeps(){return{sdk:this.sdk,createProviderFromConfig:this.createProviderFromConfig.bind(this),createAuthResult:this.createAuthResult.bind(this),getExistingProvider:M}}async handleAccountLinking(t,e,i){return await D(t,e,i,this.getAccountLinkingDeps())}createProviderFromConfig(t){const e=w[t];if(!e||!e.firebaseProviderId)throw new Error(`Unsupported partner: ${t}`);let i;switch(t){case"google":i=this.sdk.createGoogleProvider();break;case"github":i=this.sdk.createGithubProvider();break;case"facebook":i=this.sdk.createFacebookProvider();break;case"twitter":i=this.sdk.createTwitterProvider();break;case"microsoft":i=this.sdk.createMicrosoftProvider();break;case"apple":i=this.sdk.createAppleProvider();break;default:i=this.sdk.createOAuthProvider(e.firebaseProviderId)}return e.customParameters&&i.setCustomParameters(e.customParameters),e.scopes&&e.scopes.length>0&&e.scopes.forEach(r=>i.addScope(r)),i}convertToAuthUser(t){return{id:t.uid,email:t.email||null,displayName:t.displayName||null,photoURL:t.photoURL||null,emailVerified:t.emailVerified||!1,lastLoginAt:t.metadata.lastSignInTime||new Date().toISOString(),providerData:t.providerData.map(e=>({providerId:e.providerId,uid:e.uid,displayName:e.displayName,email:e.email,photoURL:e.photoURL,phoneNumber:e.phoneNumber}))}}createAuthResult(t,e=!1){return{user:this.convertToAuthUser(t),success:!0,isNewUser:e}}createCredentialFromStoredData(t){try{if(!t||!t.providerId)return null;switch(t.providerId){case"google.com":return v.credential(t.idToken||null,t.accessToken||null);case"github.com":return T.credential(t.accessToken);case"facebook.com":return b.credential(t.accessToken);case"twitter.com":return L.credential(t.accessToken,t.secret||t.oauthTokenSecret);default:return t.idToken?new m(t.providerId).credential({idToken:t.idToken,accessToken:t.accessToken}):t.accessToken?new m(t.providerId).credential({accessToken:t.accessToken}):null}}catch(e){return a(e,{showNotification:!1,severity:"warning",context:{operation:"_getCredentialFromData"}}),null}}reset(){this.initialized=!1,this.sdk=P(),this.store=null,this.popupTimeout&&(clearTimeout(this.popupTimeout),this.popupTimeout=null)}}const Y=A(()=>new z);export{z as FirebaseAuth,Y as getFirebaseAuth};
1
+ import{toast as h}from"@donotdev/components";import{createSingleton as I,safeSessionStorage as d,handleError as a,isDev as m,isClient as p,ClaimsCache as R,getAuthPartnerIdByFirebaseId as y,getRoleFromClaims as v}from"@donotdev/core";import{AUTH_PARTNERS as k,SUBSCRIPTION_TIERS as P,USER_ROLES as b,createDefaultUserProfile as T}from"@donotdev/core";import{getFirebaseSDK as C,GoogleAuthProvider as L,GithubAuthProvider as N,FacebookAuthProvider as F,TwitterAuthProvider as D,OAuthProvider as w,EmailAuthProvider as M}from"@donotdev/firebase";import{getAuthMethod as S}from"./constants";import{PARTNER_STATE as n,EMAIL_VERIFICATION_STATUS as A}from"./constants";import{handleOAuthLinking as z,clearAccountLinkingState as W}from"./FirebaseAccountLinking";import{handleSmartRecovery as g}from"./FirebaseSmartRecovery";async function U(E,t,e){const i=w.credentialFromError(t),r=t.customData?._tokenResponse?.verifiedProvider?.[0]||i?.providerId||t.customData?.providerId;return r?y(r):null}class O{sdk;initialized=!1;store=null;popupTimeout=null;claimsCache=null;constructor(){this.sdk=C()}setStore(t){this.store=t}get storeState(){if(!this.store)throw new Error("[FirebaseAuth] Store not set. Call setStore() first.");return this.store}async initialize(){if(!this.initialized)try{await this.sdk.initialize();try{await this.processRedirectResult(!0)}catch(t){a(t,{userMessage:"Redirect processing failed",context:{operation:"processRedirectResult"},severity:"warning",showNotification:!1})}this.initialized=!0}catch(t){throw a(t,{userMessage:"Failed to initialize authentication",showNotification:!1})}}async processRedirectResult(t=!1){this.store&&this.store.setLoading(!0);try{const e=new Promise((r,s)=>setTimeout(()=>s(new Error("Redirect check timeout")),1e4)),i=await Promise.race([this.sdk.getRedirectResult(),e]).catch(r=>{if(r.message==="Redirect check timeout")return null;throw r});i?.user&&(await this.handleAuthStateChange(i.user),await this.checkPendingLinking(),d.removeItem("pendingAuthPartnerId"),h("success","Signed in successfully!"))}catch(e){if(e.code==="auth/account-exists-with-different-credential"){const i=w.credentialFromError(e)?.providerId||e.customData?._tokenResponse?.providerId,r=i?y(i):d.getItem("pendingAuthPartnerId");if(r)try{await g(e,()=>Promise.resolve(),{partnerId:r,method:"redirect"},this.getSmartRecoveryDeps());return}catch(s){a(s,{userMessage:"Failed to link accounts. Please try again.",showNotification:!t})}}if(a(e,{userMessage:"Authentication failed. Please try again.",showNotification:!t,context:{operation:"processRedirectResult"}}),e.code!=="auth/account-exists-with-different-credential")try{this.clearAccountLinkingState(),d.removeItem("pendingAuthPartnerId")}catch(i){a(i)}}finally{this.store&&this.store.setLoading(!1)}}ensureInitialized(){if(!this.initialized)throw new Error("FirebaseAuth not initialized. Call initialize() first.")}getAppConfig(){if(typeof globalThis<"u"){const t=globalThis._DNDEV_APP_CONFIG_;if(t)return t}return null}initializeClaimsCache(){if(this.claimsCache)return;const e=this.getAppConfig()?.features?.offlineTrustEnabled??!1;this.claimsCache=new R({offlineTrustEnabled:e,userId:this.storeState?.userId??null})}onAuthStateChanged(t){return this.sdk.onAuthStateChanged(async e=>{e?await this.handleAuthStateChange(e):this.handleSignOut(),e&&await this.checkPendingLinking();const i=e?this.convertToAuthUser(e):null;t(i)})}async handleAuthStateChange(t){if(!this.store)return;const e=this.convertToAuthUser(t);this.initializeClaimsCache(),this.claimsCache&&this.claimsCache.setUserId(e.id),this.storeState.clearAllPartnerStates();let i={userId:e.id,tier:P.FREE,status:"active",isActive:!0,features:[],subscriptionId:null,customerId:e.id,subscriptionEnd:null,cancelAtPeriodEnd:!1,updatedAt:new Date().toISOString()},r=b.USER;try{const u=(await this.sdk.getIdTokenResult(t,!0))?.claims||{};if(m(),u.subscription){const c=u.subscription;i={userId:e.id,tier:c.tier||P.FREE,status:c.status||"active",isActive:c.status==="active",features:c.features||[],subscriptionId:c.subscriptionId||null,customerId:c.customerId||e.id,subscriptionEnd:c.subscriptionEnd||null,cancelAtPeriodEnd:!!c.cancelAtPeriodEnd,updatedAt:c.updatedAt||new Date().toISOString()}}r=v(u),m()}catch(o){o?.code==="auth/network-request-failed"||o?.originalCode==="auth/network-request-failed"||o?.message?.includes("network")||a(o,{userMessage:"Failed to get custom claims",context:{operation:"getCustomClaims"},severity:"warning"})}e.role=r,m();const s={...T(e.id),role:r};m(),this.storeState.setAuthenticated(e,i,s)}handleSignOut(){this.store&&(this.claimsCache&&this.claimsCache.setUserId(null),this.storeState.clearAllPartnerStates(),this.storeState.setUnauthenticated())}async signInWithEmail(t,e){this.ensureInitialized(),this.storeState.setPartnerState("password",n.LOADING);try{const i=await this.sdk.signInWithEmail(t,e);return h("success","Signed in successfully!"),this.storeState.setPartnerState("password",n.IDLE),this.createAuthResult(i.user)}catch(i){try{return await g(i,()=>this.sdk.signInWithEmail(t,e),{email:t,partnerId:"password"},this.getSmartRecoveryDeps())}catch(r){throw this.storeState.setPartnerState("password",n.ERROR),r}}}async createUserWithEmail(t,e){this.ensureInitialized(),this.storeState.setPartnerState("password",n.LOADING);try{const i=await this.sdk.createUserWithEmail(t,e);return h("success","Account created successfully!"),this.storeState.setPartnerState("password",n.IDLE),this.createAuthResult(i.user,!0)}catch(i){try{const r=await g(i,()=>this.sdk.createUserWithEmail(t,e),{email:t,partnerId:"password"},this.getSmartRecoveryDeps());if(!r)throw new Error("Account creation failed");return r}catch(r){throw this.storeState.setPartnerState("password",n.ERROR),r}}}async signInWithPartner(t,e){const i=S(e);this.ensureInitialized(),this.storeState.setPartnerState(t,n.LOADING);try{const r=this.createProviderFromConfig(t);let s;return i==="popup"?(s=await this.handlePopupAuth(t,async()=>await this.sdk.signInWithPopup(r)),s===null?(this.storeState.setPartnerState(t,n.IDLE),null):(h("success","Signed in successfully!"),this.storeState.setPartnerState(t,n.IDLE),this.createAuthResult(s.user))):(d.setItem("pendingAuthPartnerId",t),await this.sdk.signInWithRedirect(r),null)}catch(r){try{const s=await g(r,()=>{const o=this.createProviderFromConfig(t);return i==="popup"?this.sdk.signInWithPopup(o):this.sdk.signInWithRedirect(o)},{partnerId:t,method:i},this.getSmartRecoveryDeps());return s===null?(this.storeState.setPartnerState(t,n.IDLE),null):s}catch(s){throw this.storeState.setPartnerState(t,n.ERROR),s}}}async linkWithPartner(t,e){const i=S(e);this.ensureInitialized();const r=this.sdk.getCurrentUser();if(!r)throw a(new Error("No authenticated user"),{userMessage:"You must be signed in to link accounts",context:{operation:"linkWithPartner",partnerId:t},showNotification:!0});this.storeState.setPartnerState(t,n.LOADING);try{const s=this.createProviderFromConfig(t);if(i==="popup"){const o=await this.sdk.linkWithPopup(r,s);return h("success",`Successfully linked ${t} account!`),this.storeState.setPartnerState(t,n.IDLE),this.createAuthResult(o.user)}else return await this.sdk.linkWithRedirect(r,s),null}catch(s){const o=s;let u="Failed to link account",c={operation:"linkWithPartner",partnerId:t,errorCode:o.code};switch(o.code){case"auth/operation-not-allowed":u="Account linking is disabled. Contact support for assistance.";break;case"auth/provider-already-linked":u="This account is already linked to your profile.";break;case"auth/credential-already-in-use":u="This account is already linked to another profile.";break;case"auth/requires-recent-login":u="Please sign out and sign back in, then try linking again.";break;default:u=`Failed to link ${t} account. Please try again.`}throw this.storeState.setPartnerState(t,n.ERROR),a(s,{userMessage:u,context:c,showNotification:!0})}}async handlePopupAuth(t,e){this.clearPopupMonitoring(),this.popupTimeout=setTimeout(()=>{this.storeState.setPartnerState(t,n.IDLE),this.clearPopupMonitoring()},3e4);try{const i=await e();return this.clearPopupMonitoring(),i}catch(i){if(this.clearPopupMonitoring(),i.code==="auth/popup-closed-by-user"||i.code==="auth/cancelled-popup-request")return null;throw i}}clearPopupMonitoring(){this.popupTimeout&&(clearTimeout(this.popupTimeout),this.popupTimeout=null)}async signInWithGoogleCredential(t){this.ensureInitialized(),this.storeState.setPartnerState("google",n.LOADING);try{const e=await this.sdk.signInWithGoogleCredential(t);return h("success","Signed in with Google!"),this.storeState.setPartnerState("google",n.IDLE),this.createAuthResult(e.user)}catch(e){try{return await g(e,()=>this.sdk.signInWithGoogleCredential(t),{partnerId:"google",method:"redirect"},this.getSmartRecoveryDeps())}catch(i){throw this.storeState.setPartnerState("google",n.ERROR),i}}}async getRedirectResult(){this.ensureInitialized();try{const t=await this.sdk.getRedirectResult();return t?.user?(h("success","Signed in successfully!"),this.createAuthResult(t.user)):null}catch(t){try{return await g(t,()=>this.sdk.getRedirectResult(),{method:"redirect"},this.getSmartRecoveryDeps())}catch(e){throw e}}}async checkPendingLinking(){const t=d.getItem("accountLinkingInfo"),e=d.getItem("originalCredential");if(!(!t||!e))try{const i=JSON.parse(t),r=JSON.parse(e),s=await this.sdk.getCurrentUser();if(!s)return;const o=this.convertToAuthUser(s),u=k[i.newProvider];if(!u)return;if(o.providerData?.some(f=>f.providerId===u.firebaseProviderId)||!1){this.clearAccountLinkingState();return}const l=this.createCredentialFromStoredData(r);if(!l){this.clearAccountLinkingState();return}await this.sdk.linkWithCredential(s,l),this.clearAccountLinkingState(),h("success","Accounts linked successfully!")}catch(i){throw this.clearAccountLinkingState(),a(i,{userMessage:"Account linking failed",showNotification:!0})}}async sendSignInLinkToEmail(t,e){this.ensureInitialized();try{await this.sdk.sendSignInLinkToEmail(t,e||{url:"",handleCodeInApp:!1}),h("success","Sign-in link sent to your email!")}catch(i){throw a(i,{userMessage:"Failed to send sign-in link",showNotification:!0})}}async signInWithEmailLink(t,e){this.ensureInitialized(),this.storeState.setPartnerState("emailLink",n.LOADING);try{const i=await this.sdk.signInWithEmailLink(t,e);return h("success","Signed in successfully!"),this.storeState.setPartnerState("emailLink",n.IDLE),this.createAuthResult(i.user)}catch(i){try{return await g(i,()=>this.sdk.signInWithEmailLink(t,e),{email:t,partnerId:"emailLink"},this.getSmartRecoveryDeps())}catch(r){throw this.storeState.setPartnerState("emailLink",n.ERROR),r}}}isSignInWithEmailLink(t){if(!t&&!p())return!1;const e=t||(p()?window.location.href:"");return this.sdk.isSignInWithEmailLink(e)}async sendPasswordResetEmail(t){this.ensureInitialized();try{await this.sdk.sendPasswordResetEmail(t),h("success","Password reset email sent!")}catch(e){throw a(e,{userMessage:"Failed to send password reset email",showNotification:!0})}}async updatePassword(t){this.ensureInitialized();const e=await this.sdk.getCurrentUser();if(!e)throw a(new Error("No authenticated user"),{userMessage:"You must be signed in to update your password",showNotification:!0});try{await this.sdk.updatePassword(e,t),h("success","Password updated successfully!")}catch(i){throw a(i,{userMessage:"Failed to update password",showNotification:!0})}}async sendEmailVerification(){this.ensureInitialized();const t=await this.sdk.getCurrentUser();if(!t)throw a(new Error("No authenticated user"),{userMessage:"You must be signed in to verify your email",showNotification:!0});try{this.storeState.setEmailVerificationStatus(A.PENDING),await this.sdk.sendEmailVerification(t),h("success","Verification email sent!")}catch(e){throw this.storeState.setEmailVerificationStatus(A.PENDING),a(e,{userMessage:"Failed to send verification email",showNotification:!0})}}async getEmailVerificationStatus(){this.ensureInitialized();const t=await this.sdk.getCurrentUser();return t?{status:t.emailVerified?"verified":"pending"}:{status:"pending",error:"No authenticated user"}}async isEmailVerificationEnabled(){return!0}async getIdTokenResult(t=!1){this.ensureInitialized();const e=await this.sdk.getCurrentUser();if(!e)return null;try{return await this.sdk.getIdTokenResult(e,t)}catch(i){throw a(i,{userMessage:"Failed to get authentication token"})}}async getCustomClaims(){this.ensureInitialized(),this.initializeClaimsCache();const t=await this.sdk.getCurrentUser();if(!t)return{};if(!this.claimsCache)try{return(await this.sdk.getIdTokenResult(t,!0))?.claims||{}}catch(e){throw a(e,{userMessage:"Failed to get user permissions"})}return this.claimsCache.getClaims(async()=>(await this.sdk.getIdTokenResult(t,!0))?.claims||{})}async getCustomClaim(t){this.ensureInitialized();try{return(await this.getCustomClaims())[t]||null}catch(e){throw a(e,{userMessage:"Failed to get user permission"})}}async hasRole(t){this.ensureInitialized();try{const e=await this.getCustomClaim("role");if(this.store&&e){const i=this.storeState.userProfile;i&&this.storeState.setAuthenticated(this.storeState.user,this.storeState.userSubscription,{...i,role:e})}return e===t}catch(e){throw a(e,{userMessage:"Failed to verify user role"})}}async hasTier(t){this.ensureInitialized(),this.initializeClaimsCache();try{const i=(await this.getCustomClaims()).subscription?.tier;if(this.store&&i){const r=this.storeState.userSubscription;r&&this.storeState.setAuthenticated(this.storeState.user,{...r,tier:i},this.storeState.userProfile)}return i===t}catch(e){const r=this.getAppConfig()?.features?.offlineTrustEnabled??!0,s=p()?navigator.onLine:!1;if(!r&&!s)throw a(e,{userMessage:"Failed to verify subscription tier"});return!1}}async hasFeature(t){this.ensureInitialized(),this.initializeClaimsCache();const i=this.storeState.getCustomClaimsLocal()?.features||[],r=Array.isArray(i)&&i.includes(t);if(!this.claimsCache)try{const l=(await this.getCustomClaims()).features||[];return Array.isArray(l)&&l.includes(t)}catch(c){throw a(c,{userMessage:"Failed to verify feature access"})}const s=p()?navigator.onLine:!1,u=this.getAppConfig()?.features?.offlineTrustEnabled??!1;if(s)try{const l=(await this.getCustomClaims()).features||[],f=Array.isArray(l)&&l.includes(t);return f}catch{return r}else return u?r:!1}async getCurrentUser(){const t=await this.sdk.getCurrentUser();return t?this.convertToAuthUser(t):null}async signOut(){this.ensureInitialized(),this.clearPopupMonitoring();try{d.removeItem("accountLinkingInfo"),await this.clearCachedClaims(),await this.sdk.signOut(),h("info","Signed out successfully")}catch(t){throw a(t,{userMessage:"Failed to sign out",showNotification:!0})}}async reauthenticateWithPassword(t){this.ensureInitialized();const e=this.sdk.getCurrentUser();if(!e||!e.email)throw new Error("No authenticated user");try{const i=M.credential(e.email,t);await this.sdk.reauthenticateWithCredential(e,i)}catch(i){throw a(i,{userMessage:"Re-authentication failed. Please check your password.",showNotification:!0})}}async reauthenticateWithProvider(t,e){this.ensureInitialized();const i=this.sdk.getCurrentUser();if(!i)throw new Error("No authenticated user");const r=S(e);try{const s=this.createProviderFromConfig(t);if(r==="popup")await this.sdk.reauthenticateWithPopup(i,s);else{await this.sdk.reauthenticateWithRedirect(i,s);return}}catch(s){throw s.code==="auth/popup-closed-by-user"||s.code==="auth/cancelled-popup-request"||s.code==="auth/popup-blocked"?new Error("REAUTH_CANCELLED"):a(s,{userMessage:"Re-authentication failed. Please try again.",showNotification:!0})}}getPrimaryProvider(t){if(!t.providerData||t.providerData.length===0)return null;const e=t.providerData[0]?.providerId;return e?e==="password"||e==="emailLink"?"password":e.startsWith("google.com")?"google":e.startsWith("github.com")?"github":e.startsWith("microsoft.com")?"microsoft":e.startsWith("apple.com")?"apple":e.startsWith("facebook.com")?"facebook":e.startsWith("twitter.com")?"twitter":null:null}async deleteAccount(t){this.ensureInitialized();const e=this.sdk.getCurrentUser();if(!e)throw new Error("No authenticated user");const i=async()=>{const r=this.getAppConfig()?.auth,s=r&&typeof r=="object"?r.deleteUserFunction:void 0;if(s)try{await s(e.uid)}catch{}await this.sdk.deleteUser(e),h("success","Account deleted successfully")};try{await i()}catch(r){if(r.code==="auth/requires-recent-login"){const s=this.getPrimaryProvider(e);if(!s)throw a(r,{userMessage:"Unable to determine authentication provider",showNotification:!0});if(s!=="password")try{await this.reauthenticateWithProvider(s),await i();return}catch(o){throw o.message==="REAUTH_CANCELLED"?new Error("REAUTH_CANCELLED"):a(o,{userMessage:"Re-authentication failed. Please try again.",showNotification:!0})}if(!t)throw new Error("REQUIRES_PASSWORD");try{await this.reauthenticateWithPassword(t),await i();return}catch(o){throw a(o,{userMessage:"Re-authentication failed. Please check your password.",showNotification:!0})}}throw a(r,{userMessage:"Failed to delete account",showNotification:!0})}}async clearCachedClaims(){this.claimsCache&&await this.claimsCache.clearClaims()}async setCachedClaims(t){this.initializeClaimsCache(),this.claimsCache&&await this.claimsCache.setClaims(t)}clearAccountLinkingState(){W()}resetAuthState(){this.store&&(Object.keys(k).forEach(t=>{this.storeState.setPartnerState(t,n.IDLE)}),this.storeState.clearAuthError())}async fetchSignInMethodsForEmail(t){this.ensureInitialized();try{return await this.sdk.fetchSignInMethodsForEmail(t)}catch(e){throw a(e,{userMessage:"Failed to check sign-in methods"})}}getSmartRecoveryDeps(){return{sdk:this.sdk,handleAccountLinking:this.handleAccountLinking.bind(this),createAuthResult:this.createAuthResult.bind(this)}}getAccountLinkingDeps(){return{sdk:this.sdk,createProviderFromConfig:this.createProviderFromConfig.bind(this),createAuthResult:this.createAuthResult.bind(this),getExistingProvider:U}}async handleAccountLinking(t,e,i){return await z(t,e,i,this.getAccountLinkingDeps())}createProviderFromConfig(t){const e=k[t];if(!e||!e.firebaseProviderId)throw new Error(`Unsupported partner: ${t}`);let i;switch(t){case"google":i=this.sdk.createGoogleProvider();break;case"github":i=this.sdk.createGithubProvider();break;case"facebook":i=this.sdk.createFacebookProvider();break;case"twitter":i=this.sdk.createTwitterProvider();break;case"microsoft":i=this.sdk.createMicrosoftProvider();break;case"apple":i=this.sdk.createAppleProvider();break;default:i=this.sdk.createOAuthProvider(e.firebaseProviderId)}return e.customParameters&&i.setCustomParameters(e.customParameters),e.scopes&&e.scopes.length>0&&e.scopes.forEach(r=>i.addScope(r)),i}convertToAuthUser(t){return{id:t.uid,email:t.email||null,displayName:t.displayName||null,photoURL:t.photoURL||null,emailVerified:t.emailVerified||!1,lastLoginAt:t.metadata.lastSignInTime||new Date().toISOString(),providerData:t.providerData.map(e=>({providerId:e.providerId,uid:e.uid,displayName:e.displayName,email:e.email,photoURL:e.photoURL,phoneNumber:e.phoneNumber}))}}createAuthResult(t,e=!1){return{user:this.convertToAuthUser(t),success:!0,isNewUser:e}}createCredentialFromStoredData(t){try{if(!t||!t.providerId)return null;switch(t.providerId){case"google.com":return L.credential(t.idToken||null,t.accessToken||null);case"github.com":return N.credential(t.accessToken);case"facebook.com":return F.credential(t.accessToken);case"twitter.com":return D.credential(t.accessToken,t.secret||t.oauthTokenSecret);default:return t.idToken?new w(t.providerId).credential({idToken:t.idToken,accessToken:t.accessToken}):t.accessToken?new w(t.providerId).credential({accessToken:t.accessToken}):null}}catch(e){return a(e,{showNotification:!1,severity:"warning",context:{operation:"_getCredentialFromData"}}),null}}reset(){this.initialized=!1,this.sdk=C(),this.store=null,this.popupTimeout&&(clearTimeout(this.popupTimeout),this.popupTimeout=null)}}const j=I(()=>new O);export{O as FirebaseAuth,j as getFirebaseAuth};
@@ -1 +1 @@
1
- "use client";import{jsx as i,jsxs as s}from"react/jsx-runtime";import{Suspense as A,lazy as w}from"react";import{Alert as h,ALERT_VARIANT as p,Button as a,BUTTON_VARIANT as c,Stack as r}from"@donotdev/components";import{useTranslation as I,safeSessionStorage as k,handleError as T}from"@donotdev/core";import{EmailLinkForm as x}from"./EmailLinkForm";import y from"./EmailPasswordForm";import{useAccountLinking as E}from"../hooks/useAccountLinking";const S=({className:o="",id:l})=>{const{t:e}=I("dndev"),{isRequired:v,email:d,existingProvider:n,newProvider:m,handleSignInWithExistingProvider:L}=E();if(!v)return null;if(n==="password"||n==="emailLink"){const t=()=>{k.removeItem("accountLinkingInfo")},u=()=>{},g=f=>{T(f)};return i("div",{className:o,id:l,children:i(h,{variant:p.WARNING,role:"alert","aria-live":"polite",title:e("accountLinking.title","Account Linking Required"),description:s(r,{gap:"medium",children:[i("p",{children:e("accountLinking.message",`An account with email ${d} already exists with ${n==="password"?"email/password":"email link"}. To link your ${m} 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(y,{mode:"signin",onSuccess:u,onError:g})}):i("div",{style:{marginTop:"var(--gap-md)"},children:i(x,{onSuccess:u,onError:g})}),i(r,{direction:"row",justify:"end",children:i(a,{onClick:t,variant:c.GHOST,children:e("accountLinking.dismiss","Dismiss")})})]})})})}else{const t=()=>{k.removeItem("accountLinkingInfo")};return i("div",{className:o,id:l,children:i(h,{variant:p.WARNING,role:"alert","aria-live":"polite",title:e("accountLinking.title","Account Linking Required"),description:s(r,{gap:"medium",children:[i("p",{children:e("accountLinking.message",`An account with email ${d} already exists with ${n}. To link your ${m} account, please sign in with ${n} first.`)}),s(r,{direction:"row",gap:"medium",children:[i(a,{onClick:L,variant:c.PRIMARY,children:e("accountLinking.signInWith",`Sign in with ${n}`)}),i(a,{onClick:t,variant:c.GHOST,children:e("accountLinking.dismiss","Dismiss")})]})]})})})}},$=w(()=>Promise.resolve({default:S}));function R(o){return i(A,{fallback:null,children:i($,{...o})})}var W=R;export{W as default};
1
+ "use client";import{jsx as i,jsxs as s}from"react/jsx-runtime";import{Suspense as A,lazy as w}from"react";import{Alert as h,ALERT_VARIANT as p,Button as a,BUTTON_VARIANT as c,Stack as r}from"@donotdev/components";import{useTranslation as I,safeSessionStorage as k,handleError as T}from"@donotdev/core";import{EmailLinkForm as x}from"./EmailLinkForm";import y from"./EmailPasswordForm";import{useAccountLinking as E}from"../hooks/useAccountLinking";const S=({className:o="",id:l})=>{const{t:e}=I("auth"),{isRequired:v,email:d,existingProvider:n,newProvider:m,handleSignInWithExistingProvider:L}=E();if(!v)return null;if(n==="password"||n==="emailLink"){const t=()=>{k.removeItem("accountLinkingInfo")},u=()=>{},g=f=>{T(f)};return i("div",{className:o,id:l,children:i(h,{variant:p.WARNING,role:"alert","aria-live":"polite",title:e("accountLinking.title","Account Linking Required"),description:s(r,{gap:"medium",children:[i("p",{children:e("accountLinking.message",`An account with email ${d} already exists with ${n==="password"?"email/password":"email link"}. To link your ${m} 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(y,{mode:"signin",onSuccess:u,onError:g})}):i("div",{style:{marginTop:"var(--gap-md)"},children:i(x,{onSuccess:u,onError:g})}),i(r,{direction:"row",justify:"end",children:i(a,{onClick:t,variant:c.GHOST,children:e("accountLinking.dismiss","Dismiss")})})]})})})}else{const t=()=>{k.removeItem("accountLinkingInfo")};return i("div",{className:o,id:l,children:i(h,{variant:p.WARNING,role:"alert","aria-live":"polite",title:e("accountLinking.title","Account Linking Required"),description:s(r,{gap:"medium",children:[i("p",{children:e("accountLinking.message",`An account with email ${d} already exists with ${n}. To link your ${m} account, please sign in with ${n} first.`)}),s(r,{direction:"row",gap:"medium",children:[i(a,{onClick:L,variant:c.PRIMARY,children:e("accountLinking.signInWith",`Sign in with ${n}`)}),i(a,{onClick:t,variant:c.GHOST,children:e("accountLinking.dismiss","Dismiss")})]})]})})})}},$=w(()=>Promise.resolve({default:S}));function R(o){return i(A,{fallback:null,children:i($,{...o})})}var W=R;export{W as default};
@@ -1,12 +1,4 @@
1
- /**
2
- * @fileoverview Auth Fallback Component
3
- * @description Graceful fallback when auth is not available or fails to load
4
- *
5
- * @version 0.0.1
6
- * @since 0.0.1
7
- * @author AMBROISE PARK Consulting
8
- */
9
- import { type ComponentType } from 'react';
1
+ import type { ComponentType } from 'react';
10
2
  interface AuthFallbackProps {
11
3
  /** Custom message to display */
12
4
  message?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"AuthFallback.d.ts","sourceRoot":"","sources":["../../src/components/AuthFallback.tsx"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAK3C,UAAU,iBAAiB;IACzB,gCAAgC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wDAAwD;IACxD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,uBAAuB;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,EAC3B,OAA2C,EAC3C,eAAuB,EACvB,SAAc,GACf,EAAE,iBAAiB,2CAYnB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,MAAM,EAC/C,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,EAC3B,aAAa,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,WAAW,CAAC,yDAcrD;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,aAAa,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,WAAW,CAAC;;;EAQrD"}
1
+ {"version":3,"file":"AuthFallback.d.ts","sourceRoot":"","sources":["../../src/components/AuthFallback.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,UAAU,iBAAiB;IACzB,gCAAgC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wDAAwD;IACxD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,uBAAuB;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,EAC3B,OAA2C,EAC3C,eAAuB,EACvB,SAAc,GACf,EAAE,iBAAiB,2CAYnB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,MAAM,EAC/C,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,EAC3B,aAAa,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,WAAW,CAAC,yDAcrD;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,aAAa,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,WAAW,CAAC;;;EAQrD"}
@@ -1 +1 @@
1
- import{jsx as a}from"react/jsx-runtime";import"react";import{FeatureFallback as u,withFeatureFallback as r}from"@donotdev/components";import{isFeatureAvailable as n,FRAMEWORK_FEATURES as i}from"@donotdev/core";function l({message:t="Authentication is not available",showLoginButton:e=!1,className:o=""}){return a(u,{featureName:"Authentication",message:t,icon:"\u{1F512}",showActionButton:e,actionButtonText:"Sign In (Unavailable)",className:o,helpText:"This feature requires authentication to be configured."})}function m(t,e){return r(t,"Authentication",()=>n(i.AUTH),{message:e?.message,showActionButton:e?.showLoginButton,actionButtonText:"Sign In (Unavailable)",icon:"\u{1F512}",helpText:"This feature requires authentication to be configured."})}function b(t){return{isAuthAvailable:n(i.AUTH),AuthFallbackComponent:()=>a(l,{...t})}}export{l as AuthFallback,b as useAuthComponent,m as withAuthFallback};
1
+ import{jsx as a}from"react/jsx-runtime";import{FeatureFallback as u,withFeatureFallback as r}from"@donotdev/components";import{isFeatureAvailable as n,FRAMEWORK_FEATURES as i}from"@donotdev/core";function l({message:t="Authentication is not available",showLoginButton:e=!1,className:o=""}){return a(u,{featureName:"Authentication",message:t,icon:"\u{1F512}",showActionButton:e,actionButtonText:"Sign In (Unavailable)",className:o,helpText:"This feature requires authentication to be configured."})}function A(t,e){return r(t,"Authentication",()=>n(i.AUTH),{message:e?.message,showActionButton:e?.showLoginButton,actionButtonText:"Sign In (Unavailable)",icon:"\u{1F512}",helpText:"This feature requires authentication to be configured."})}function m(t){return{isAuthAvailable:n(i.AUTH),AuthFallbackComponent:()=>a(l,{...t})}}export{l as AuthFallback,m as useAuthComponent,A as withAuthFallback};
@@ -14,6 +14,6 @@ interface AuthPartnerButtonComponentProps extends AuthPartnerButtonProps {
14
14
  * @since 0.0.1
15
15
  * @author AMBROISE PARK Consulting
16
16
  */
17
- declare function AuthPartnerButton({ partnerId, method, onSuccess, onError, className, children, disabled, emailMode, display, ...props }: AuthPartnerButtonComponentProps & Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onError' | 'onSuccess'>): import("react/jsx-runtime").JSX.Element;
17
+ declare function AuthPartnerButton({ partnerId, method, onSuccess, onError, className, children, disabled, display, style, ...props }: AuthPartnerButtonComponentProps & Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onError' | 'onSuccess'>): import("react/jsx-runtime").JSX.Element;
18
18
  export default AuthPartnerButton;
19
19
  //# sourceMappingURL=AuthPartnerButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AuthPartnerButton.d.ts","sourceRoot":"","sources":["../../src/components/AuthPartnerButton.tsx"],"names":[],"mappings":"AA0CA,OAAO,EAGL,KAAK,sBAAsB,EAC5B,MAAM,cAAc,CAAC;AAGtB,OAAO,KAAK,EAAE,oBAAoB,EAAiB,MAAM,OAAO,CAAC;AAEjE,UAAU,+BAAgC,SAAQ,sBAAsB;IACtE,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC;IAClC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAClC;AAED;;;;;;;;;GASG;AACH,iBAAS,iBAAiB,CAAC,EACzB,SAAS,EACT,MAAM,EACN,SAAS,EACT,OAAO,EACP,SAAc,EACd,QAAQ,EACR,QAAgB,EAChB,SAAoB,EACpB,OAAsB,EACtB,GAAG,KAAK,EACT,EAAE,+BAA+B,GAChC,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC,2CAoIvE;AAED,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"AuthPartnerButton.d.ts","sourceRoot":"","sources":["../../src/components/AuthPartnerButton.tsx"],"names":[],"mappings":"AA0CA,OAAO,EAGL,KAAK,sBAAsB,EAC5B,MAAM,cAAc,CAAC;AAGtB,OAAO,KAAK,EAAE,oBAAoB,EAAiB,MAAM,OAAO,CAAC;AAEjE,UAAU,+BAAgC,SAAQ,sBAAsB;IACtE,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC;IAClC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAClC;AAED;;;;;;;;;GASG;AACH,iBAAS,iBAAiB,CAAC,EACzB,SAAS,EACT,MAAM,EACN,SAAS,EACT,OAAO,EACP,SAAc,EACd,QAAQ,EACR,QAAgB,EAChB,OAAsB,EACtB,KAAK,EACL,GAAG,KAAK,EACT,EAAE,+BAA+B,GAChC,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC,2CAuIvE;AAED,eAAe,iBAAiB,CAAC"}
@@ -1,5 +1,5 @@
1
- "use client";import{jsx as i}from"react/jsx-runtime";import{useMemo as k,useState as O}from"react";if(typeof document<"u"&&!document.getElementById("auth-partner-button-styles")){const t=document.createElement("style");t.id="auth-partner-button-styles",t.textContent=`
1
+ "use client";import{jsx as i}from"react/jsx-runtime";import{useMemo as C,useState as D}from"react";if(typeof document<"u"&&!document.getElementById("auth-partner-button-styles")){const t=document.createElement("style");t.id="auth-partner-button-styles",t.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(t)}import{cn as D,DISPLAY as y,PROVIDER_ICONS as I,DefaultProviderIcon as R,Button as M,BUTTON_VARIANT as U,Spinner as W}from"@donotdev/components";import{AUTH_PARTNERS as _,useTranslation as $}from"@donotdev/core";import{EmailLinkForm as j}from"./EmailLinkForm";import F from"./EmailPasswordForm";import{getAuthMethod as C}from"../constants";import{useAuth as s}from"../useAuth";function K({partnerId:t,method:f,onSuccess:u,onError:l,className:c="",children:b,disabled:h=!1,emailMode:A="signin",display:g=y.AUTO,...V}){const{t:a}=$("auth"),p=s("user"),P=s("signInWithPartner"),S=s("linkWithPartner"),T=s("isAvailable"),[r,v]=O(!1),o=k(()=>_[t],[t]);if(t==="password")return i("div",{className:c,children:i(F,{mode:A,onSuccess:()=>u?.(null),onError:l,compact:!0})});if(t==="emailLink")return i("div",{className:c,children:i(j,{onSuccess:()=>u?.(null),onError:l})});const E=k(()=>I[t]||R,[t]),d=!!p?.providerData?.some(n=>n.providerId===t),m=p&&!d,L=async()=>{if(!(r||h)){v(!0);try{let n;if(m)n=await S(t,C(f));else{const N=C(f);n=await P(t,N)}n&&u?.(n)}catch(n){l?.(n instanceof Error?n:new Error(String(n)))}finally{v(!1)}}},e=o?.name,w=()=>{if(b)return b;if(m)return r?a("buttons.linking",{partner:e}):d?a("buttons.linked",{partner:e}):a("buttons.link",{partner:e});if(r)return a("buttons.signingIn",{partner:e});const n=o?.button?.textKey;return n?a(n):`Sign in with ${e}`},x=h||r||!T||m&&d||!1,B=o?.button?{backgroundColor:o.button.backgroundColor,color:o.button.textColor,borderColor:o.button.borderColor,"--partner-hover-bg":o.button.hoverBackgroundColor}:void 0;return i(M,{variant:U.OUTLINE,onClick:L,disabled:x,"aria-busy":r,display:g,"aria-label":r?`Signing in with ${e}...`:`Sign in with ${e}`,tooltip:void 0,style:B,className:D(o?.button&&"auth-partner-button-custom",c),icon:r?i(W,{"aria-label":"Loading"}):E,children:g!==y.COMPACT&&w()})}var Z=K;export{Z as default};
5
+ `,document.head.appendChild(t)}import{cn as I,DISPLAY as A,PROVIDER_ICONS as R,DefaultProviderIcon as M,Button as U,BUTTON_VARIANT as W,Spinner as _}from"@donotdev/components";import{AUTH_PARTNERS as $,useTranslation as j}from"@donotdev/core";import{EmailLinkForm as F}from"./EmailLinkForm";import K from"./EmailPasswordForm";import{getAuthMethod as P}from"../constants";import{useAuth as s}from"../useAuth";function V({partnerId:t,method:f,onSuccess:u,onError:l,className:c="",children:b,disabled:h=!1,display:g=A.AUTO,style:p,...H}){const{t:a}=j("auth"),v=s("user"),S=s("signInWithPartner"),T=s("linkWithPartner"),E=s("isAvailable"),[e,k]=D(!1),o=C(()=>$[t],[t]);if(t==="password")return i("div",{className:c,children:i(K,{mode:"signin",onSuccess:()=>u?.(null),onError:l,compact:!0})});if(t==="emailLink")return i("div",{className:c,children:i(F,{onSuccess:()=>u?.(null),onError:l})});const L=C(()=>R[t]||M,[t]),d=!!v?.providerData?.some(n=>n.providerId===t),m=v&&!d,w=async()=>{if(!(e||h)){k(!0);try{let n;if(m)n=await T(t,P(f));else{const O=P(f);n=await S(t,O)}n&&u?.(n)}catch(n){l?.(n instanceof Error?n:new Error(String(n)))}finally{k(!1)}}},r=o?.name,x=()=>{if(b)return b;if(m)return e?a("buttons.linking",{partner:r}):d?a("buttons.linked",{partner:r}):a("buttons.link",{partner:r});if(e)return a("buttons.signingIn",{partner:r});const n=o?.button?.textKey;return n?a(n):`Sign in with ${r}`},B=h||e||!E||m&&d||!1,y=o?.button?{backgroundColor:o.button.backgroundColor,color:o.button.textColor,borderColor:o.button.borderColor,"--partner-hover-bg":o.button.hoverBackgroundColor}:void 0,N=p?{...y,...p}:y;return i(U,{variant:W.OUTLINE,onClick:w,disabled:B,"aria-busy":e,display:g,"aria-label":e?`Signing in with ${r}...`:`Sign in with ${r}`,tooltip:void 0,style:N,className:I(o?.button&&"auth-partner-button-custom",c),icon:e?i(_,{"aria-label":"Loading"}):L,children:g!==A.COMPACT&&x()})}var tt=V;export{tt as default};
@@ -1 +1 @@
1
- "use client";import{jsx as t,jsxs as c,Fragment as f}from"react/jsx-runtime";import{Trash2 as x}from"lucide-react";import{useState as A}from"react";import{Dialog as g,Button as d,BUTTON_VARIANT as s,Input as R,Label as w,Checkbox as k,Alert as b,ALERT_VARIANT as v,Stack as r,Text as C,List as T}from"@donotdev/components";import{useTranslation as y}from"@donotdev/core";function N({open:u,isLoading:n,error:l,onReauth:h,onCancel:a}){const{t:e}=y("dndev"),[o,m]=A(""),p=async()=>{await h(o)};return t(g,{open:u,onOpenChange:i=>!i&&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:[t(d,{variant:s.OUTLINE,onClick:a,disabled:n,children:e("deleteAccount.reauth.cancel","Cancel")}),t(d,{variant:s.DEFAULT,onClick:p,disabled:n||!o,children:n?e("deleteAccount.reauth.verifying","Verifying..."):e("deleteAccount.reauth.continue","Continue")})]}),children:c(r,{gap:"medium",children:[c(r,{gap:"tight",children:[t(w,{htmlFor:"reauth-password",children:e("deleteAccount.reauth.password","Password")}),t(R,{id:"reauth-password",type:"password",value:o,onChange:i=>m(i.target.value),disabled:n,placeholder:e("deleteAccount.reauth.passwordPlaceholder","Enter your password"),required:!0})]}),l&&t(b,{variant:v.ERROR,description:l})]})})}function U({open:u,isLoading:n,error:l,onConfirm:h,onCancel:a}){const{t:e}=y("dndev"),[o,m]=A(!1),p=async()=>{o&&await h()};return t(g,{open:u,onOpenChange:i=>!i&&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:[t(d,{variant:s.OUTLINE,onClick:a,disabled:n,children:e("deleteAccount.confirm.cancel","Cancel")}),t(d,{variant:s.DESTRUCTIVE,icon:x,onClick:p,disabled:n||!o,children:n?e("deleteAccount.confirm.deleting","Deleting..."):e("deleteAccount.confirm.delete","Delete My Account")})]}),children:c(r,{gap:"large",children:[c(r,{gap:"medium",children:[t(C,{as:"h4",level:"h4",children:e("deleteAccount.confirm.whatDeleted","What will be deleted:")}),t(T,{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(r,{gap:"medium",children:[t(C,{as:"h4",level:"h4",children:e("deleteAccount.confirm.whatKept","What will be kept (anonymized):")}),t(T,{items:[e("deleteAccount.confirm.billing","Billing history for tax/accounting purposes"),e("deleteAccount.confirm.invoices","Past invoices and transaction records")]})]}),c(r,{direction:"row",align:"start",gap:"medium",children:[t(k,{id:"confirm-delete",checked:o,onCheckedChange:i=>m(i===!0)}),t(w,{htmlFor:"confirm-delete",children:e("deleteAccount.confirm.checkbox","I understand this action cannot be undone")})]}),l&&t(b,{variant:v.ERROR,description:l})]})})}export{U as ConfirmDeleteDialog,N as ReauthDialog};
1
+ "use client";import{jsx as t,jsxs as c,Fragment as f}from"react/jsx-runtime";import{Trash2 as x}from"lucide-react";import{useState as A}from"react";import{Dialog as g,Button as d,BUTTON_VARIANT as s,Input as R,Label as w,Checkbox as k,Alert as b,ALERT_VARIANT as C,Stack as r,Text as v,List as T}from"@donotdev/components";import{useTranslation as y}from"@donotdev/core";function N({open:u,isLoading:n,error:l,onReauth:h,onCancel:a}){const{t:e}=y("auth"),[o,m]=A(""),p=async()=>{await h(o)};return t(g,{open:u,onOpenChange:i=>!i&&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:[t(d,{variant:s.OUTLINE,onClick:a,disabled:n,children:e("deleteAccount.reauth.cancel","Cancel")}),t(d,{variant:s.DEFAULT,onClick:p,disabled:n||!o,children:n?e("deleteAccount.reauth.verifying","Verifying..."):e("deleteAccount.reauth.continue","Continue")})]}),children:c(r,{gap:"medium",children:[c(r,{gap:"tight",children:[t(w,{htmlFor:"reauth-password",children:e("deleteAccount.reauth.password","Password")}),t(R,{id:"reauth-password",type:"password",value:o,onChange:i=>m(i.target.value),disabled:n,placeholder:e("deleteAccount.reauth.passwordPlaceholder","Enter your password"),required:!0})]}),l&&t(b,{variant:C.ERROR,description:l})]})})}function U({open:u,isLoading:n,error:l,onConfirm:h,onCancel:a}){const{t:e}=y("auth"),[o,m]=A(!1),p=async()=>{o&&await h()};return t(g,{open:u,onOpenChange:i=>!i&&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:[t(d,{variant:s.OUTLINE,onClick:a,disabled:n,children:e("deleteAccount.confirm.cancel","Cancel")}),t(d,{variant:s.DESTRUCTIVE,icon:x,onClick:p,disabled:n||!o,children:n?e("deleteAccount.confirm.deleting","Deleting..."):e("deleteAccount.confirm.delete","Delete My Account")})]}),children:c(r,{gap:"large",children:[c(r,{gap:"medium",children:[t(v,{as:"h4",level:"h4",children:e("deleteAccount.confirm.whatDeleted","What will be deleted:")}),t(T,{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(r,{gap:"medium",children:[t(v,{as:"h4",level:"h4",children:e("deleteAccount.confirm.whatKept","What will be kept (anonymized):")}),t(T,{items:[e("deleteAccount.confirm.billing","Billing history for tax/accounting purposes"),e("deleteAccount.confirm.invoices","Past invoices and transaction records")]})]}),c(r,{direction:"row",align:"start",gap:"medium",children:[t(k,{id:"confirm-delete",checked:o,onCheckedChange:i=>m(i===!0)}),t(w,{htmlFor:"confirm-delete",children:e("deleteAccount.confirm.checkbox","I understand this action cannot be undone")})]}),l&&t(b,{variant:C.ERROR,description:l})]})})}export{U as ConfirmDeleteDialog,N as ReauthDialog};
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import{Mail as m,CheckCircle as v}from"lucide-react";import{Button as d,BUTTON_VARIANT as y,Input as E,Label as S,Alert as x,ALERT_VARIANT as A,Spinner as R,Stack as a}from"@donotdev/components";import{useTranslation as b}from"@donotdev/core";import{useEmailLinkForm as T}from"../hooks/useEmailLinkForm";function N({className:l="",onSuccess:s,onError:c,actionCodeSettings:u}){const{t:i}=b("dndev"),{email:t,setEmail:g,isLoading:r,isSent:h,error:o,handleSendLink:p,handleResend:k,canSubmit:f}=T({onSuccess:s,onError:c,actionCodeSettings:u});return h?n(a,{gap:"medium",className:l,children:[n("div",{style:{textAlign:"center"},children:[e(v,{style:{width:"var(--icon-touch)",height:"var(--icon-touch)",marginBottom:"var(--gap-md)",marginLeft:"auto",marginRight:"auto",color:"var(--primary)"}}),e("h3",{style:{marginBottom:"var(--gap-sm)",fontSize:"var(--font-size-lg)",fontWeight:600,color:"var(--foreground)"},children:i("emailLink.checkEmail","Check Your Email")}),e("p",{style:{marginBottom:"var(--gap-md)",color:"var(--muted-foreground)"},children:i("emailLink.sentMessage",`We've sent a sign-in link to ${t}. Click the link in your email to complete sign-in.`)})]}),e(a,{direction:"row",justify:"center",gap:"medium",children:e(d,{variant:y.OUTLINE,onClick:k,icon:m,iconEnd:!1,children:i("emailLink.resend","Resend Link")})})]}):e("form",{onSubmit:p,className:l,children:n(a,{gap:"medium",children:[n(a,{gap:"tight",children:[e(S,{htmlFor:"email",children:i("emailLink.emailLabel","Email Address")}),e(E,{id:"email",type:"email",value:t,onChange:L=>g(L.target.value),placeholder:i("emailLink.emailPlaceholder","Enter your email address"),required:!0,disabled:r,className:"dndev-w-full"})]}),o&&e(x,{variant:A.ERROR,description:o}),e(d,{type:"submit",disabled:!f,icon:r?e(R,{"aria-label":"Loading"}):m,iconEnd:!1,className:"dndev-w-full",children:r?i("emailLink.sending","Sending Link..."):i("emailLink.sendLink","Send Sign-In Link")}),e("p",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)",textAlign:"center"},children:i("emailLink.helpText","We'll send you a secure link to sign in without a password.")})]})})}var _=N;export{N as EmailLinkForm,_ as default};
1
+ "use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import{Mail as m,CheckCircle as v}from"lucide-react";import{Button as d,BUTTON_VARIANT as y,Input as E,Label as S,Alert as x,ALERT_VARIANT as A,Spinner as R,Stack as a}from"@donotdev/components";import{useTranslation as b}from"@donotdev/core";import{useEmailLinkForm as T}from"../hooks/useEmailLinkForm";function N({className:l="",onSuccess:s,onError:c,actionCodeSettings:u}){const{t:i}=b("auth"),{email:t,setEmail:h,isLoading:r,isSent:g,error:o,handleSendLink:p,handleResend:k,canSubmit:f}=T({onSuccess:s,onError:c,actionCodeSettings:u});return g?n(a,{gap:"medium",className:l,children:[n("div",{style:{textAlign:"center"},children:[e(v,{style:{width:"var(--icon-touch)",height:"var(--icon-touch)",marginBottom:"var(--gap-md)",marginLeft:"auto",marginRight:"auto",color:"var(--primary)"}}),e("h3",{style:{marginBottom:"var(--gap-sm)",fontSize:"var(--font-size-lg)",fontWeight:600,color:"var(--foreground)"},children:i("emailLink.checkEmail","Check Your Email")}),e("p",{style:{marginBottom:"var(--gap-md)",color:"var(--muted-foreground)"},children:i("emailLink.sentMessage",`We've sent a sign-in link to ${t}. Click the link in your email to complete sign-in.`)})]}),e(a,{direction:"row",justify:"center",gap:"medium",children:e(d,{variant:y.OUTLINE,onClick:k,icon:m,iconEnd:!1,children:i("emailLink.resend","Resend Link")})})]}):e("form",{onSubmit:p,className:l,children:n(a,{gap:"medium",children:[n(a,{gap:"tight",children:[e(S,{htmlFor:"email",children:i("emailLink.emailLabel","Email Address")}),e(E,{id:"email",type:"email",value:t,onChange:L=>h(L.target.value),placeholder:i("emailLink.emailPlaceholder","Enter your email address"),required:!0,disabled:r,className:"dndev-w-full"})]}),o&&e(x,{variant:A.ERROR,description:o}),e(d,{type:"submit",disabled:!f,icon:r?e(R,{"aria-label":"Loading"}):m,iconEnd:!1,className:"dndev-w-full",children:r?i("emailLink.sending","Sending Link..."):i("emailLink.sendLink","Send Sign-In Link")}),e("p",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)",textAlign:"center"},children:i("emailLink.helpText","We'll send you a secure link to sign in without a password.")})]})})}var _=N;export{N as EmailLinkForm,_ as default};
@@ -1,4 +1,19 @@
1
1
  import type { EmailPasswordFormProps } from '../constants';
2
- declare function EmailPasswordForm({ mode, onSuccess, onError, className, compact, }: EmailPasswordFormProps): import("react/jsx-runtime").JSX.Element;
2
+ /**
3
+ * EmailPasswordForm Component
4
+ *
5
+ * Best-in-class email/password authentication form with:
6
+ * - Real-time validation with react-hook-form
7
+ * - Password strength indicator
8
+ * - Remember me persistence
9
+ * - Forgot password flow
10
+ * - Sign in / Sign up mode switching
11
+ * - Full i18n support
12
+ * - Accessible with proper ARIA
13
+ *
14
+ * @component
15
+ * @version 0.0.4
16
+ */
17
+ declare function EmailPasswordForm({ mode, onSuccess, onError, className, }: EmailPasswordFormProps): import("react/jsx-runtime").JSX.Element;
3
18
  export default EmailPasswordForm;
4
19
  //# sourceMappingURL=EmailPasswordForm.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EmailPasswordForm.d.ts","sourceRoot":"","sources":["../../src/components/EmailPasswordForm.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAO3D,iBAAS,iBAAiB,CAAC,EACzB,IAAI,EACJ,SAAS,EACT,OAAO,EACP,SAAc,EACd,OAAe,GAChB,EAAE,sBAAsB,2CAsFxB;AAKD,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"EmailPasswordForm.d.ts","sourceRoot":"","sources":["../../src/components/EmailPasswordForm.tsx"],"names":[],"mappings":"AAsCA,OAAO,KAAK,EAAE,sBAAsB,EAAY,MAAM,cAAc,CAAC;AAQrE;;;;;;;;;;;;;;GAcG;AACH,iBAAS,iBAAiB,CAAC,EACzB,IAAe,EACf,SAAS,EACT,OAAO,EACP,SAAc,GACf,EAAE,sBAAsB,2CAmaxB;AAED,eAAe,iBAAiB,CAAC"}
@@ -1 +1 @@
1
- "use client";import{jsx as s}from"react/jsx-runtime";import{Alert as w}from"@donotdev/components";import{useTranslation as b}from"@donotdev/core";import{EntityFormRenderer as y}from"@donotdev/crud";import{useAuth as a}from"../useAuth";function E({mode:n,onSuccess:r,onError:o,className:l="",compact:S=!1}){const{t:e}=b("dndev"),u=a("signInWithEmail"),c=a("createUserWithEmail"),d=a("isAvailable"),p=a("loading"),m=n==="signup",h={email:{name:"email",type:"email",label:e("auth.email","Email"),required:!0,options:{placeholder:e("auth.emailPlaceholder","Enter your email")}},password:{name:"password",type:"password",label:e("auth.password","Password"),required:!0,options:{placeholder:e("auth.passwordPlaceholder","Enter your password")}}},f=async i=>{try{n==="signin"?await u(i.email,i.password):await c(i.email,i.password),r?.(void 0)}catch(t){o?.(t instanceof Error?t:new Error(String(t)))}},g=async i=>{try{n==="signin"?await c(i.email,i.password):await u(i.email,i.password),r?.(void 0)}catch(t){o?.(t instanceof Error?t:new Error(String(t)))}};return d?s(y,{entity:h,onSubmit:f,onSecondarySubmit:g,className:l,submitText:m?e("auth:actions.sign_up_submit",{defaultValue:"Sign Up"}):e("auth:actions.sign_in_submit",{defaultValue:"Sign In"}),secondaryButtonText:m?e("auth:actions.sign_in_submit",{defaultValue:"Sign In"}):e("auth:actions.sign_up_submit",{defaultValue:"Sign Up"}),isLoading:p}):s("div",{className:l,children:s(w,{title:"Authentication Unavailable",description:"Please accept cookies to enable authentication."})})}var A=E;export{A as default};
1
+ "use client";import{jsx as r,jsxs as o}from"react/jsx-runtime";import*as L from"firebase/auth";import{Info as D}from"lucide-react";import{useState as u}from"react";import{useForm as Y,Controller as v,useWatch as k}from"react-hook-form";import{Alert as P,ALERT_VARIANT as R,Button as p,BUTTON_VARIANT as w,Checkbox as Z,HoverCard as J,Input as Q,Label as X,PasswordInput as F,Stack as t,Text as l,cn as ee}from"@donotdev/components";import{useTranslation as re}from"@donotdev/core";import{getFirebaseSDK as se}from"@donotdev/firebase";import{useAuth as g}from"../useAuth";import{PasswordStrengthIndicator as ae}from"./PasswordStrengthIndicator";function ie({mode:M="signin",onSuccess:_,onError:x,className:q=""}){const{t:e}=re("auth"),T=g("signInWithEmail"),U=g("createUserWithEmail"),O=g("sendPasswordResetEmail"),W=g("isAvailable"),V=g("loading"),[y,E]=u(M),d=y==="signup",[S,j]=u(!1),[$,H]=u(""),[c,I]=u(!1),[h,A]=u(!1),{control:m,handleSubmit:K,formState:{errors:a,isSubmitting:z},setError:b}=Y({mode:"onChange",defaultValues:{email:"",password:"",confirmPassword:""}}),C=k({control:m,name:"password"}),f=k({control:m,name:"email"}),B=async s=>{try{y==="signin"?(await se().setPersistence(S?L.browserLocalPersistence:L.browserSessionPersistence),await T(s.email,s.password)):await U(s.email,s.password),_?.(void 0)}catch(i){const N=i instanceof Error?i.message:String(i);b("root",{message:N}),x?.(i instanceof Error?i:new Error(N))}},G=async()=>{if(!f||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(f)){b("email",{message:e("emailRequired","Email is required")});return}I(!0);try{await O(f),A(!0),H(f)}catch(s){const i=s instanceof Error?s.message:String(s);b("root",{message:i})}finally{I(!1)}};if(!W)return r("div",{className:q,children:r(P,{variant:R.WARNING,title:e("unavailable.title","Authentication Unavailable"),description:e("unavailable.description","Please accept cookies to enable authentication.")})});const n=V||z;return r("form",{onSubmit:K(B),className:ee("dndev-auth-form",q),noValidate:!0,children:o(t,{gap:"medium",children:[a.root&&r(P,{variant:R.ERROR,description:a.root.message}),h&&r(P,{variant:R.SUCCESS,title:e("forgotPassword.sent","Password reset email sent"),description:e("forgotPassword.checkEmail",`Check your email at ${$} for password reset instructions.`)}),r(v,{name:"email",control:m,rules:{required:e("emailRequired","Email is required"),pattern:{value:/^[^\s@]+@[^\s@]+\.[^\s@]+$/,message:e("emailInvalid","Invalid email address")}},render:({field:s})=>o(t,{gap:"tight",children:[r(Q,{...s,type:"email",label:e("email","Email"),placeholder:e("emailPlaceholder","Enter your email"),disabled:n||c,"aria-invalid":!!a.email,"aria-describedby":a.email?"email-error":void 0,className:"dndev-w-full","data-variant":a.email?"destructive":void 0,onChange:i=>{s.onChange(i),h&&A(!1)}}),a.email&&r(l,{as:"span",level:"caption",variant:"destructive",id:"email-error",role:"alert",children:a.email.message})]})}),r(v,{name:"password",control:m,rules:{required:e("passwordRequired","Password is required"),minLength:{value:8,message:e("passwordMinLength","Password must be at least 8 characters")},validate:s=>{if(!s)return!0;if(d){if(!/[A-Z]/.test(s))return e("passwordRequirement.uppercase","Password must contain at least one uppercase letter");if(!/[a-z]/.test(s))return e("passwordRequirement.lowercase","Password must contain at least one lowercase letter");if(!/[0-9]/.test(s))return e("passwordRequirement.number","Password must contain at least one number")}return!0}},render:({field:s})=>{const i=`password-${s.name}`;return o(t,{gap:"tight",children:[r(F,{...s,id:i,label:e("password","Password"),placeholder:e("passwordPlaceholder","Enter your password"),disabled:n||c,"aria-invalid":!!a.password,"aria-describedby":a.password?"password-error":void 0,className:"dndev-w-full","data-variant":a.password?"destructive":void 0}),a.password&&r(l,{as:"span",level:"caption",variant:"destructive",id:"password-error",role:"alert",children:a.password.message})]})}}),d&&r(v,{name:"confirmPassword",control:m,rules:{required:e("confirmPasswordRequired","Please confirm your password"),validate:s=>s!==C?e("confirmPasswordMismatch","Passwords do not match"):!0},render:({field:s})=>o(t,{gap:"tight",children:[r(F,{...s,label:e("confirmPassword","Confirm Password"),placeholder:e("confirmPasswordPlaceholder","Re-enter your password"),disabled:n,"aria-invalid":!!a.confirmPassword,"aria-describedby":a.confirmPassword?"confirm-password-error":void 0,className:"dndev-w-full","data-variant":a.confirmPassword?"destructive":void 0}),a.confirmPassword&&r(l,{as:"span",level:"caption",variant:"destructive",id:"confirm-password-error",role:"alert",children:a.confirmPassword.message})]})}),d&&r(ae,{password:C||"",minLength:8,showRequirements:!1}),d&&r(J,{trigger:r(p,{type:"button",variant:w.GHOST,className:"dndev-w-fit dndev-p-0 dndev-h-auto",style:{minHeight:"auto",padding:0},children:o(t,{direction:"row",align:"center",gap:"tight",children:[r(l,{as:"span",level:"caption",variant:"muted",children:e("passwordRequirements","Password requirements")}),r(D,{className:"dndev-size-xs"})]})}),side:"bottom",align:"start",children:o(t,{gap:"tight",className:"dndev-text-sm",children:[r(l,{as:"strong",level:"small",children:e("passwordRequirements.title","Password Requirements")}),o(t,{gap:"tight",as:"ul",className:"dndev-m-0 dndev-ps-md",children:[r("li",{children:e("passwordRequirement.length","At least 8 characters")}),r("li",{children:e("passwordRequirement.uppercase","One uppercase letter")}),r("li",{children:e("passwordRequirement.lowercase","One lowercase letter")}),r("li",{children:e("passwordRequirement.number","One number")}),r("li",{children:e("passwordRequirement.special","One special character (!@#$%^&*)")})]})]})}),!d&&!h&&o(t,{direction:"row",gap:"tight",align:"center",children:[r(Z,{id:"remember-me",checked:S,onCheckedChange:s=>j(s===!0),disabled:n||c}),r(X,{htmlFor:"remember-me",children:e("rememberMe","Remember me")})]}),r(p,{type:"submit",variant:w.PRIMARY,disabled:n,fullWidth:!0,children:n?e("loading","Loading..."):d?e("actions.sign_up_submit","Sign Up"):e("actions.sign_in_submit","Sign In")}),!d&&!h&&o(t,{direction:"row",gap:"tight",justify:"center",align:"center",children:[r(p,{type:"button",variant:w.LINK,disabled:n||c,onClick:G,children:c?e("loading","Loading..."):e("forgotPassword","Forgot password?")}),r(l,{as:"span",variant:"muted",children:"|"}),r(p,{type:"button",variant:w.LINK,disabled:n,onClick:()=>E("signup"),children:e("actions.sign_up_submit","Sign Up")})]}),d&&r(t,{align:"center",children:r(p,{type:"button",variant:w.LINK,disabled:n,onClick:()=>E("signin"),children:e("alreadyHaveAccount","Already have an account? Sign In")})})]})})}var we=ie;export{we as default};
@@ -1 +1 @@
1
- {"version":3,"file":"FeatureGuard.d.ts","sourceRoot":"","sources":["../../src/components/FeatureGuard.ts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;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,QAAQ,EACR,QAAQ,EAAE,cAAc,EACxB,OAAO,EACP,iBAAwB,EACxB,eAAsB,GACvB,EAAE,iBAAiB,kDA0GnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE;IAC1C,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,EAAE,CAAC;IAC7B,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,gBAAgB,KAAK,OAAO,CAAC;CAChE,GAAG,OAAO,CA6CV;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,MAAM,EAC/C,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,EAC3B,MAAM,EAAE,IAAI,CAAC,iBAAiB,EAAE,UAAU,CAAC,WAEV,CAAC,6CAOnC;AAGD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,mBAAmB,EAAE,CAAC"}
@@ -1 +1 @@
1
- "use client";import{jsx as r,jsxs as o,Fragment as q}from"react/jsx-runtime";import{Stack as p}from"@donotdev/components";import{useAuth as n}from"../useAuth";import{AuthFallback as x}from"./AuthFallback";function g({requiredTier:e,userTier:i}){return r("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:o(p,{direction:"row",align:"center",gap:"medium",children:[r("span",{style:{color:"var(--accent)"},children:"\u{1F512}"}),o("div",{children:[r("p",{style:{fontWeight:500,fontSize:"var(--font-size-base)",color:"var(--foreground)"},children:e==="pro"?"Pro Feature":"Premium Feature"}),o("p",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:["Upgrade to ",e," to access this feature",i&&` (current: ${i})`]})]})]})})}function v({requiredRole:e,userRole:i}){const s=Array.isArray(e)?e.join(" or "):e;return r("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:o(p,{direction:"row",align:"center",gap:"medium",children:[r("span",{style:{color:"var(--destructive)"},children:"\u{1F6AB}"}),o("div",{children:[r("p",{style:{fontWeight:500,fontSize:"var(--font-size-base)",color:"var(--destructive-foreground)"},children:"Access Denied"}),o("p",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:["This feature requires ",s," role",i&&` (current: ${i})`]})]})]})})}function R(){return r("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:o(p,{direction:"row",align:"center",gap:"medium",children:[r("span",{style:{color:"var(--accent)"},children:"\u23F0"}),o("div",{children:[r("p",{style:{fontWeight:500,fontSize:"var(--font-size-base)",color:"var(--foreground)"},children:"Subscription Required"}),r("p",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:"This feature requires an active subscription"})]})]})})}function z({children:e,role:i,tier:s,subscription:a,validate:d,fallback:t,message:h,showUpgradePrompt:m=!0,showLoginPrompt:l=!0}){const b=n("user"),y=n("loading"),A=n("userProfile"),f=n("userSubscription"),T=n("hasRole"),D=n("hasTier"),u=A?.role,c=f?.tier;return y?r("div",{style:{height:"2rem",borderRadius:"var(--radius)",backgroundColor:"var(--muted)",animation:"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite"}}):!b&&(i||s||a)?l?r(x,{message:h||"Please sign in to access this feature"}):null:i&&!(Array.isArray(i)?i:[i]).some(S=>u===S)?t?r(t,{requiredRole:i,userRole:u||void 0}):r(v,{requiredRole:i,userRole:u||void 0}):s&&c!==s?t?r(t,{requiredTier:s,userTier:c||"free"}):m?r(g,{requiredTier:s,userTier:c||"free"}):null:a&&!f?.isActive?t?r(t,{requiresSubscription:!0,hasSubscription:f?.isActive||!1}):r(R,{}):d&&u&&c&&!d(u,c)?t?r(t,{userRole:u,userTier:c}):r(v,{userRole:u}):r(q,{children:e})}function E(e){const i=n("user"),s=n("userProfile"),a=n("userSubscription"),d=s?.role,t=a?.tier;return!(!i&&(e.role||e.tier||e.subscription)||e.role&&!(Array.isArray(e.role)?e.role:[e.role]).some(l=>d===l)||e.tier&&t!==e.tier||e.subscription&&!a?.isActive||e.validate&&d&&t&&!e.validate(d,t))}function F(e,i){return a=>r(z,{...i,children:r(e,{...a})})}export{v as AccessDenied,z as FeatureGuard,R as SubscriptionExpired,g as UpgradePrompt,E as useCanAccessFeature,F as withFeatureGuard};
1
+ "use client";import{jsx as r,jsxs as o,Fragment as x}from"react/jsx-runtime";import{Stack as p}from"@donotdev/components";import{hasTierAccess as g}from"@donotdev/core";import{useAuth as n}from"../useAuth";import{AuthFallback as z}from"./AuthFallback";function R({requiredTier:e,userTier:i}){return r("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:o(p,{direction:"row",align:"center",gap:"medium",children:[r("span",{style:{color:"var(--accent)"},children:"\u{1F512}"}),o("div",{children:[r("p",{style:{fontWeight:500,fontSize:"var(--font-size-base)",color:"var(--foreground)"},children:e==="pro"?"Pro Feature":"Premium Feature"}),o("p",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:["Upgrade to ",e," to access this feature",i&&` (current: ${i})`]})]})]})})}function v({requiredRole:e,userRole:i}){const s=Array.isArray(e)?e.join(" or "):e;return r("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:o(p,{direction:"row",align:"center",gap:"medium",children:[r("span",{style:{color:"var(--destructive)"},children:"\u{1F6AB}"}),o("div",{children:[r("p",{style:{fontWeight:500,fontSize:"var(--font-size-base)",color:"var(--destructive-foreground)"},children:"Access Denied"}),o("p",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:["This feature requires ",s," role",i&&` (current: ${i})`]})]})]})})}function b(){return r("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:o(p,{direction:"row",align:"center",gap:"medium",children:[r("span",{style:{color:"var(--accent)"},children:"\u23F0"}),o("div",{children:[r("p",{style:{fontWeight:500,fontSize:"var(--font-size-base)",color:"var(--foreground)"},children:"Subscription Required"}),r("p",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:"This feature requires an active subscription"})]})]})})}function T({children:e,role:i,tier:s,subscription:a,validate:d,fallback:t,message:h,showUpgradePrompt:m=!0,showLoginPrompt:l=!0}){const y=n("user"),A=n("loading"),S=n("userProfile"),f=n("userSubscription"),D=n("hasRole"),P=n("hasTier"),u=S?.role,c=f?.tier;return A?r("div",{style:{height:"2rem",borderRadius:"var(--radius)",backgroundColor:"var(--muted)",animation:"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite"}}):!y&&(i||s||a)?l?r(z,{message:h||"Please sign in to access this feature"}):null:i&&!(Array.isArray(i)?i:[i]).some(q=>u===q)?t?r(t,{requiredRole:i,userRole:u||void 0}):r(v,{requiredRole:i,userRole:u||void 0}):s&&!g(c,s)?t?r(t,{requiredTier:s,userTier:c||"free"}):m?r(R,{requiredTier:s,userTier:c||"free"}):null:a&&!f?.isActive?t?r(t,{requiresSubscription:!0,hasSubscription:f?.isActive||!1}):r(b,{}):d&&u&&c&&!d(u,c)?t?r(t,{userRole:u,userTier:c}):r(v,{userRole:u}):r(x,{children:e})}function G(e){const i=n("user"),s=n("userProfile"),a=n("userSubscription"),d=s?.role,t=a?.tier;return!(!i&&(e.role||e.tier||e.subscription)||e.role&&!(Array.isArray(e.role)?e.role:[e.role]).some(l=>d===l)||e.tier&&!g(t,e.tier)||e.subscription&&!a?.isActive||e.validate&&d&&t&&!e.validate(d,t))}function U(e,i){return a=>r(T,{...i,children:r(e,{...a})})}export{v as AccessDenied,T as FeatureGuard,b as SubscriptionExpired,R as UpgradePrompt,G as useCanAccessFeature,U as withFeatureGuard};
@@ -1,12 +1,4 @@
1
- /**
2
- * @fileoverview Feature placeholder components for DoNotDev framework
3
- * @description Components for showing placeholders when features are not available
4
- *
5
- * @version 0.0.1
6
- * @since 0.0.1
7
- * @author AMBROISE PARK Consulting
8
- */
9
- import { type ReactNode } from 'react';
1
+ import type { ReactNode } from 'react';
10
2
  /**
11
3
  * Props for the FeaturePlaceholder component
12
4
  */
@@ -1 +1 @@
1
- {"version":3,"file":"FeaturePlaceholder.d.ts","sourceRoot":"","sources":["../../src/components/FeaturePlaceholder.tsx"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAMvC;;GAEG;AACH,UAAU,uBAAuB;IAC/B,0CAA0C;IAC1C,SAAS,EAAE,MAAM,CAAC;IAClB,kDAAkD;IAClD,WAAW,EAAE,MAAM,CAAC;IACpB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iCAAiC;IACjC,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;GAEG;AACH,UAAU,oBAAoB;IAC5B,kDAAkD;IAClD,WAAW,EAAE,MAAM,CAAC;IACpB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iCAAiC;IACjC,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,SAAS,EACT,WAAW,EACX,SAAc,EACd,QAAQ,GACT,EAAE,uBAAuB,4TAqCzB;AAsDD;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,0CA/C7B,oBAAoB,6TA+C+C,CAAC;AAEzE;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,0CAxDjC,oBAAoB,6TA2DxB,CAAC"}
1
+ {"version":3,"file":"FeaturePlaceholder.d.ts","sourceRoot":"","sources":["../../src/components/FeaturePlaceholder.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC;;GAEG;AACH,UAAU,uBAAuB;IAC/B,0CAA0C;IAC1C,SAAS,EAAE,MAAM,CAAC;IAClB,kDAAkD;IAClD,WAAW,EAAE,MAAM,CAAC;IACpB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iCAAiC;IACjC,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;GAEG;AACH,UAAU,oBAAoB;IAC5B,kDAAkD;IAClD,WAAW,EAAE,MAAM,CAAC;IACpB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iCAAiC;IACjC,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,SAAS,EACT,WAAW,EACX,SAAc,EACd,QAAQ,GACT,EAAE,uBAAuB,4TAqCzB;AAsDD;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,0CA/C7B,oBAAoB,6TA+C+C,CAAC;AAEzE;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,0CAxDjC,oBAAoB,6TA2DxB,CAAC"}
@@ -1 +1 @@
1
- "use client";import{jsxs as d,jsx as i}from"react/jsx-runtime";import"react";import{cn as c}from"@donotdev/components";import{useAuth as u}from"../useAuth";function g({featureId:e,featureName:r,className:t="",children:a}){if(u("userSubscription")?.features?.includes(e)||!1)return null;const n=i("div",{className:c("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:d("p",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)",textAlign:"center"},children:[r," is not available on your current plan."]})});return a||n}function l(e,r){return function({featureName:a,className:o="",children:s}){if(u("userSubscription")?.tier===e)return null;const m=i("div",{className:c("dndev-surface",o),"data-variant":"muted","data-shadow":"none","data-radius":"lg",style:{padding:"var(--gap-md)",border:"1px dashed var(--border)",backgroundColor:"var(--muted)"},children:d("p",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)",textAlign:"center"},children:[a," is only available on ",r," tier."]})});return s||m}}const x=l("pro","Pro"),P=l("premium","Premium");export{g as FeaturePlaceholder,P as PremiumFeaturePlaceholder,x as ProFeaturePlaceholder};
1
+ "use client";import{jsxs as d,jsx as c}from"react/jsx-runtime";import{cn as i}from"@donotdev/components";import{hasTierAccess as p}from"@donotdev/core";import{useAuth as u}from"../useAuth";function x({featureId:e,featureName:r,className:o="",children:a}){if(u("userSubscription")?.features?.includes(e)||!1)return null;const t=c("div",{className:i("dndev-surface",o),"data-variant":"muted","data-shadow":"none","data-radius":"lg",style:{padding:"var(--gap-md)",border:"1px dashed var(--border)",backgroundColor:"var(--muted)"},children:d("p",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)",textAlign:"center"},children:[r," is not available on your current plan."]})});return a||t}function l(e,r){return function({featureName:a,className:s="",children:n}){const t=u("userSubscription");if(p(t?.tier,e))return null;const m=c("div",{className:i("dndev-surface",s),"data-variant":"muted","data-shadow":"none","data-radius":"lg",style:{padding:"var(--gap-md)",border:"1px dashed var(--border)",backgroundColor:"var(--muted)"},children:d("p",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)",textAlign:"center"},children:[a," is only available on ",r," tier."]})});return n||m}}const P=l("pro","Pro"),A=l("premium","Premium");export{x as FeaturePlaceholder,A as PremiumFeaturePlaceholder,P as ProFeaturePlaceholder};
@@ -1,36 +1,4 @@
1
- /**
2
- * @fileoverview GoogleOneTap Component - October 2025 FedCM Mandatory
3
- *
4
- * @description
5
- * Modern Google One Tap component with mandatory FedCM compliance.
6
- * Shows browser compatibility message if FedCM not supported.
7
- *
8
- * **Key Features:**
9
- * - FedCM mandatory (no fallback)
10
- * - Clear browser compatibility messaging
11
- * - CSR/SSR safe with proper hydration
12
- * - Framework-native UI components
13
- * - Clean error states
14
- *
15
- * **Browser Support:**
16
- * - ✅ Chrome 116+
17
- * - ✅ Edge 116+
18
- * - ❌ Safari (not yet supported)
19
- * - ❌ Firefox (not yet supported)
20
- *
21
- * **Usage:**
22
- * ```tsx
23
- * <GoogleOneTap
24
- * onSuccess={(credential) => console.log('Signed in')}
25
- * onError={(error) => console.error(error)}
26
- * />
27
- * ```
28
- *
29
- * @version 0.0.1
30
- * @since 0.0.1
31
- * @author AMBROISE PARK Consulting
32
- */
33
- import { type ComponentType } from 'react';
1
+ import type { ComponentType } from 'react';
34
2
  /**
35
3
  * Component props
36
4
  */
@@ -1 +1 @@
1
- {"version":3,"file":"GoogleOneTap.d.ts","sourceRoot":"","sources":["../../src/components/GoogleOneTap.tsx"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAO3C;;GAEG;AACH,UAAU,iBAAiB;IACzB,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,uCAAuC;IACvC,SAAS,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAEzC,qBAAqB;IACrB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAEjC,6CAA6C;IAC7C,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,uCAAuC;IACvC,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B,SAAc,EACd,QAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,QAAQ,EACR,UAAkB,EAClB,gBAAwB,EACxB,gBAAgB,EAAE,gBAAgB,EAClC,cAAc,EAAE,cAAc,EAC9B,4BAA4B,EAAE,4BAA4B,GAC3D,EAAE,iBAAiB,kDA2GnB;AAED,eAAe,YAAY,CAAC"}
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as N}from"react/jsx-runtime";import"react";import{Card as i,Spinner as j,Stack as w}from"@donotdev/components";import{useTranslation as z}from"@donotdev/core";import{useGoogleOneTap as C}from"../hooks/useGoogleOneTap";function T({clientId:s,onSuccess:p,onError:l,autoSelect:m=!0,cancelOnTapOutside:c=!0,className:g="",disabled:o=!1,promptParentId:f,allowedParentOrigins:r,cspNonce:u,clientOnly:a=!1,showErrorDetails:I=!1,loadingComponent:t,errorComponent:G,browserNotSupportedComponent:L}){const{t:h}=z("dndev"),{shouldShow:v,isLoaded:E,isLoading:x,error:y,containerRef:S,fedcmSupported:d,isHydrated:n,browserInfo:_}=C({clientId:s,autoSelect:m,cancelOnTapOutside:c,promptParentId:f,disabled:o,onSuccess:p,onError:l,allowedParentOrigins:r,cspNonce:u,clientOnly:a});return o||!v||a&&!n?null:x?t?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(t,{})})}):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:N(w,{direction:"row",align:"center",gap:"medium",children:[e(j,{}),e("span",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:h("auth.googleOneTapLoading","Loading Google One Tap...")})]})})}):!d||y?null:e("div",{className:"dndev-fixed",style:{right:"var(--gap-md)",zIndex:50,top:"calc(1rem + var(--header-height, 0px))"},children:e("div",{ref:S,className:`google-one-tap-container ${g}`.trim(),"data-testid":"google-one-tap","data-fedcm-supported":d,"data-hydrated":n,...r&&{"data-allowed-parent-origins":r.join(",")}})})}var O=T;export{O as default};
1
+ "use client";import{jsx as e,jsxs as N}from"react/jsx-runtime";import{Card as i,Spinner as j,Stack as w}from"@donotdev/components";import{useTranslation as z}from"@donotdev/core";import{useGoogleOneTap as C}from"../hooks/useGoogleOneTap";function T({clientId:s,onSuccess:p,onError:l,autoSelect:m=!0,cancelOnTapOutside:c=!0,className:g="",disabled:o=!1,promptParentId:f,allowedParentOrigins:r,cspNonce:u,clientOnly:a=!1,showErrorDetails:I=!1,loadingComponent:t,errorComponent:G,browserNotSupportedComponent:L}){const{t:h}=z("auth"),{shouldShow:v,isLoaded:E,isLoading:x,error:y,containerRef:S,fedcmSupported:d,isHydrated:n,browserInfo:_}=C({clientId:s,autoSelect:m,cancelOnTapOutside:c,promptParentId:f,disabled:o,onSuccess:p,onError:l,allowedParentOrigins:r,cspNonce:u,clientOnly:a});return o||!v||a&&!n?null:x?t?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(t,{})})}):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:N(w,{direction:"row",align:"center",gap:"medium",children:[e(j,{}),e("span",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:h("googleOneTapLoading","Loading Google One Tap...")})]})})}):!d||y?null:e("div",{className:"dndev-fixed",style:{right:"var(--gap-md)",zIndex:50,top:"calc(1rem + var(--header-height, 0px))"},children:e("div",{ref:S,className:`google-one-tap-container ${g}`.trim(),"data-testid":"google-one-tap","data-fedcm-supported":d,"data-hydrated":n,...r&&{"data-allowed-parent-origins":r.join(",")}})})}var H=T;export{H as default};
@@ -1 +1 @@
1
- "use client";import{jsx as o}from"react/jsx-runtime";import{Dialog as e}from"@donotdev/components";import{useTranslation as r}from"@donotdev/core";import{withAuthFallback as a}from"./AuthFallback";import s from"./MultipleAuthProviders";function l({open:n,onOpenChange:i}){const{t}=r("dndev");return o(e,{open:n,onOpenChange:i,title:t("signIn","Sign In"),description:t("choosePlatform","Choose a platform to sign in with"),children:o("div",{style:{padding:"var(--gap-md)"},children:o(s,{layout:"vertical",showLabels:!0,method:"popup"})})})}const p=a(l,{message:"Authentication is not configured",showLoginButton:!0});var g=p;export{g as default};
1
+ "use client";import{jsx as o}from"react/jsx-runtime";import{Dialog as e}from"@donotdev/components";import{useTranslation as r}from"@donotdev/core";import{withAuthFallback as a}from"./AuthFallback";import s from"./MultipleAuthProviders";function l({open:i,onOpenChange:n}){const{t}=r("auth");return o(e,{open:i,onOpenChange:n,title:t("signIn","Sign In"),description:t("choosePlatform","Choose a platform to sign in with"),children:o("div",{style:{padding:"var(--gap-md)"},children:o(s,{layout:"vertical",showLabels:!0,method:"popup"})})})}const p=a(l,{message:"Authentication is not configured",showLoginButton:!0});var g=p;export{g as default};
@@ -26,8 +26,8 @@ export interface MultipleAuthProvidersProps {
26
26
  id?: string;
27
27
  /** Whether buttons should take full width of their container */
28
28
  fullWidth?: boolean;
29
- /** For email provider: whether to show signin or signup form */
30
- emailMode?: 'signin' | 'signup';
29
+ /** Callback when authentication succeeds */
30
+ onSuccess?: () => void;
31
31
  }
32
32
  /**
33
33
  * Multiple auth providers component with automatic fallback handling
@@ -1 +1 @@
1
- {"version":3,"file":"MultipleAuthProviders.d.ts","sourceRoot":"","sources":["../../src/components/MultipleAuthProviders.tsx"],"names":[],"mappings":"AAeA,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,gBAAgB,CAAC;AAKxB,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAK9D;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,iEAAiE;IACjE,SAAS,CAAC,EAAE,aAAa,EAAE,CAAC;IAC5B,0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AAI,CAAC;IAC3B,yBAAyB;IACzB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,qCAAqC;IACrC,MAAM,CAAC,EAAE,UAAU,GAAG,YAAY,GAAG,MAAM,CAAC;IAC5C,6CAA6C;IAC7C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,8BAA8B;IAC9B,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IAChD,qDAAqD;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4DAA4D;IAC5D,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,gEAAgE;IAChE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAyID;;;;;;GAMG;AACH,QAAA,MAAM,qBAAqB,gFAGzB,CAAC;AAGH,eAAe,qBAAqB,CAAC"}
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as z}from"react/jsx-runtime";import{Suspense as L,lazy as M}from"react";import{Alert as N,ALERT_VARIANT as T,Stack as $,Grid as j}from"@donotdev/components";import{useTranslation as E,getEnabledAuthPartners as S}from"@donotdev/core";import{useAuth as c}from"../useAuth";import{withAuthFallback as I}from"./AuthFallback";import _ from"./AuthPartnerButton";import{getAuthMethod as q}from"../constants";import{useAccountLinking as y}from"../hooks/useAccountLinking";const B=({providers:u,containerClassName:t="",providerClassName:m="",method:h,size:O="md",layout:r="vertical",showLabels:p=!0,spacing:o="medium",ariaLabel:g,id:f,fullWidth:v=!0,emailMode:A="signin"})=>{const{t:a}=E("dndev"),s=f||`auth-providers-${Math.random().toString(36).slice(2,9)}`,{isRequired:b}=y(),x=M(()=>import("./AccountLinking")),P=q(h),i=u||S();if(!i||i.length===0)return e("div",{className:t,children:e("p",{children:"No authentication providers are configured"})});const d=c("error"),R=c("isAvailable"),k=()=>{const l=i.map((n,w)=>e(_,{partnerId:n,method:P,className:`${m} ${v?"dndev-w-full":""}`,tabIndex:w===0?0:void 0,id:`${s}-${n}-button`,emailMode:A,children:p?void 0:null},n));return r==="grid"?e(j,{cols:2,gap:o,className:t,children:l}):e($,{direction:r==="horizontal"?"row":"column",wrap:r==="horizontal"?"wrap":void 0,gap:o,align:r==="horizontal"?"center":"stretch",className:t,children:l})};return z("div",{className:"dndev-mx-auto",id:s,role:"region","aria-label":g||a("aria.signInOptions","Sign in options"),children:[k(),d&&R&&e(N,{variant:T.ERROR,style:{marginTop:"var(--gap-md)"},description:d.message||a("auth.errorGeneric","Authentication failed. Please try again.")}),b&&e("div",{style:{marginTop:"var(--gap-md)"},children:e(L,{fallback:null,children:e(x,{})})})]})},G=I(B,{message:"Authentication providers are not configured",showLoginButton:!0});var X=G;export{X as default};
1
+ "use client";import{jsx as r,jsxs as z}from"react/jsx-runtime";import{Suspense as L,lazy as M}from"react";import{Alert as N,ALERT_VARIANT as S,Stack as T,Grid as $}from"@donotdev/components";import{useTranslation as j,getEnabledAuthPartners as E}from"@donotdev/core";import{useAuth as c}from"../useAuth";import{withAuthFallback as I}from"./AuthFallback";import _ from"./AuthPartnerButton";import{getAuthMethod as q}from"../constants";import{useAccountLinking as y}from"../hooks/useAccountLinking";const B=({providers:u,containerClassName:t="",providerClassName:m="",method:h,size:O="md",layout:e="vertical",showLabels:p=!0,spacing:o="medium",ariaLabel:g,id:f,fullWidth:v=!0,onSuccess:A})=>{const{t:a}=j("auth"),s=f||`auth-providers-${Math.random().toString(36).slice(2,9)}`,{isRequired:b}=y(),x=M(()=>import("./AccountLinking")),P=q(h),i=u||E();if(!i||i.length===0)return r("div",{className:t,children:r("p",{children:"No authentication providers are configured"})});const d=c("error"),R=c("isAvailable"),k=()=>{const l=i.map((n,w)=>r(_,{partnerId:n,method:P,className:`${m} ${v?"dndev-w-full":""}`,tabIndex:w===0?0:void 0,id:`${s}-${n}-button`,onSuccess:A,children:p?void 0:null},n));return e==="grid"?r($,{cols:2,gap:o,className:t,children:l}):r(T,{direction:e==="horizontal"?"row":"column",wrap:e==="horizontal"?"wrap":void 0,gap:o,align:e==="horizontal"?"center":"stretch",className:t,children:l})};return z("div",{className:"dndev-mx-auto",id:s,role:"region","aria-label":g||a("aria.signInOptions","Sign in options"),children:[k(),d&&R&&r(N,{variant:S.ERROR,style:{marginTop:"var(--gap-md)"},description:d.message||a("errorGeneric","Authentication failed. Please try again.")}),b&&r("div",{style:{marginTop:"var(--gap-md)"},children:r(L,{fallback:null,children:r(x,{})})})]})},G=I(B,{message:"Authentication providers are not configured",showLoginButton:!0});var X=G;export{X as default};
@@ -0,0 +1,22 @@
1
+ export interface PasswordStrengthIndicatorProps {
2
+ /** Current password value */
3
+ password: string;
4
+ /** Minimum password length */
5
+ minLength?: number;
6
+ /** Whether to show requirements checklist */
7
+ showRequirements?: boolean;
8
+ /** Custom className */
9
+ className?: string;
10
+ }
11
+ export type PasswordStrength = 'weak' | 'fair' | 'good' | 'strong';
12
+ /**
13
+ * PasswordStrengthIndicator Component
14
+ *
15
+ * Displays visual password strength indicator and optional requirements checklist.
16
+ * Uses Progress component for the strength bar and Text for labels.
17
+ *
18
+ * @component
19
+ * @version 0.0.2
20
+ */
21
+ export declare function PasswordStrengthIndicator({ password, minLength, showRequirements, className, }: PasswordStrengthIndicatorProps): import("react/jsx-runtime").JSX.Element;
22
+ //# sourceMappingURL=PasswordStrengthIndicator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PasswordStrengthIndicator.d.ts","sourceRoot":"","sources":["../../src/components/PasswordStrengthIndicator.tsx"],"names":[],"mappings":"AAkBA,MAAM,WAAW,8BAA8B;IAC7C,6BAA6B;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,8BAA8B;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6CAA6C;IAC7C,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,uBAAuB;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;AAwFnE;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CAAC,EACxC,QAAQ,EACR,SAAa,EACb,gBAAuB,EACvB,SAAS,GACV,EAAE,8BAA8B,2CA4EhC"}
@@ -0,0 +1 @@
1
+ "use client";import{jsxs as a,jsx as o}from"react/jsx-runtime";import{useMemo as u}from"react";import{Progress as w,Stack as i,Text as l,cn as v}from"@donotdev/components";import{useTranslation as b}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 k(e,t,n){return[{label:n("passwordRequirement.length",`At least ${t} characters`),met:e.length>=t},{label:n("passwordRequirement.uppercase","One uppercase letter"),met:/[A-Z]/.test(e)},{label:n("passwordRequirement.lowercase","One lowercase letter"),met:/[a-z]/.test(e)},{label:n("passwordRequirement.number","One number"),met:/[0-9]/.test(e)},{label:n("passwordRequirement.special","One special character (!@#$%^&*)"),met:/[^a-zA-Z0-9]/.test(e)}]}const P={weak:25,fair:50,good:75,strong:100},d={weak:"destructive",fair:"warning",good:"accent",strong:"success"};function A({password:e,minLength:t=8,showRequirements:n=!0,className:m}){const{t:r}=b("auth"),c=u(()=>S(e),[e]),h=u(()=>k(e,t,(g,f)=>r(g,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 a(i,{gap:"tight",className:v("dndev-password-strength",m),children:[a(i,{gap:"tight",children:[a(i,{direction:"row",align:"center",justify:"between",gap:"tight",children:[a(l,{as:"span",level:"caption",variant:"muted",children:[r("passwordStrength.label","Password strength"),":"]}),o(l,{as:"strong",level:"caption",variant:d[c],children:p[c]})]}),o(w,{value:P[c],variant:d[c],className:"dndev-password-strength-bar"})]}),n&&a(i,{gap:"tight",className:"dndev-password-requirements",children:[a(l,{as:"strong",level:"caption",variant:"muted",children:[r("passwordRequirements","Password requirements"),":"]}),o(i,{gap:"tight","data-inset":"true",children:h.map((s,g)=>a(i,{direction:"row",align:"center",gap:"tight",children:[o(l,{as:"span",level:"small",variant:s.met?"success":"muted",children:s.met?"\u2713":"\u25CB"}),o(l,{as:"span",level:"caption",variant:s.met?"success":"muted","data-opacity":s.met?void 0:"70",children:s.label})]},g))})]})]})}export{A as PasswordStrengthIndicator};
@@ -1,12 +1,4 @@
1
- /**
2
- * @fileoverview Rate limit alert component for DoNotDev framework
3
- * @description Shows rate limiting warnings and blocks to users
4
- *
5
- * @version 0.0.1
6
- * @since 0.0.1
7
- * @author AMBROISE PARK Consulting
8
- */
9
- import { type ComponentType } from 'react';
1
+ import type { ComponentType } from 'react';
10
2
  interface RateLimitAlertProps {
11
3
  /** Optional identifier for the rate limit context */
12
4
  identifier?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"RateLimitAlert.d.ts","sourceRoot":"","sources":["../../src/components/RateLimitAlert.tsx"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAG3C,UAAU,mBAAmB;IAC3B,qDAAqD;IACrD,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;GASG;AACH,QAAA,MAAM,cAAc,EAAE,aAAa,CAAC,mBAAmB,CAStD,CAAC;AAKF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"RateLimitAlert.d.ts","sourceRoot":"","sources":["../../src/components/RateLimitAlert.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,UAAU,mBAAmB;IAC3B,qDAAqD;IACrD,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;GASG;AACH,QAAA,MAAM,cAAc,EAAE,aAAa,CAAC,mBAAmB,CAStD,CAAC;AAKF,eAAe,cAAc,CAAC"}
@@ -1 +1 @@
1
- "use client";import"react";import{useTranslation as t}from"@donotdev/core";const e=({identifier:r,className:i=""})=>{const{t:n}=t("auth");return null};var l=e;export{l as default};
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};
@@ -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 { PasswordStrengthIndicator } from './PasswordStrengthIndicator';
21
22
  export { default as RateLimitAlert } from './RateLimitAlert';
22
23
  export * from './DeleteAccountDialogs';
23
24
  //# sourceMappingURL=index.d.ts.map