@donotdev/auth 0.0.14 → 0.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AuthStore.js +1 -1
- package/dist/authHelpers.js +1 -1
- package/dist/components/AccountLinking.js +1 -1
- package/dist/components/AuthFallback.js +1 -1
- package/dist/components/AuthPartnerButton.js +2 -2
- package/dist/components/DeleteAccountDialogs.js +1 -1
- package/dist/components/EmailLinkForm.js +1 -1
- package/dist/components/EmailPasswordForm.js +1 -1
- package/dist/components/EmailVerification.js +1 -1
- package/dist/components/Feature.js +1 -1
- package/dist/components/FeatureGuard.js +1 -1
- package/dist/components/FeaturePlaceholder.js +1 -1
- package/dist/components/GoogleOneTap.js +1 -1
- package/dist/components/LoginModal.js +1 -1
- package/dist/components/MultipleAuthProviders.js +1 -1
- package/dist/components/NetworkStatusIndicator.js +1 -1
- package/dist/components/PasswordStrengthIndicator.js +1 -1
- package/dist/components/PasswordUpdateDialog.js +1 -1
- package/dist/components/RateLimitAlert.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/constants.d.ts +3 -47
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +1 -1
- package/dist/hooks/useAccountLinking.js +1 -1
- package/dist/hooks/useAuthMethodToggle.js +1 -1
- package/dist/hooks/useAuthPartner.js +1 -1
- package/dist/hooks/useDeleteAccount.js +1 -1
- package/dist/hooks/useEmailLinkAuth.js +1 -1
- package/dist/hooks/useEmailLinkForm.js +1 -1
- package/dist/hooks/useFedCM.js +1 -1
- package/dist/hooks/useGoogleOneTap.js +1 -1
- package/dist/hooks/useNetworkStatus.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/useAuth.js +1 -1
- package/package.json +2 -2
- package/dist/FirebaseAccountLinking.d.ts +0 -29
- package/dist/FirebaseAccountLinking.d.ts.map +0 -1
- package/dist/FirebaseAccountLinking.js +0 -1
- package/dist/FirebaseAuth.d.ts +0 -607
- package/dist/FirebaseAuth.d.ts.map +0 -1
- package/dist/FirebaseAuth.js +0 -1
- package/dist/FirebaseSmartRecovery.d.ts +0 -52
- package/dist/FirebaseSmartRecovery.d.ts.map +0 -1
- package/dist/FirebaseSmartRecovery.js +0 -1
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { type AuthResult, type AuthPartnerId } from '@donotdev/core';
|
|
2
|
-
import { type AuthMethod } from './constants';
|
|
3
|
-
/**
|
|
4
|
-
* Context information for smart recovery
|
|
5
|
-
*
|
|
6
|
-
* @version 0.0.1
|
|
7
|
-
* @since 0.0.1
|
|
8
|
-
* @author AMBROISE PARK Consulting
|
|
9
|
-
*/
|
|
10
|
-
export interface SmartRecoveryContext {
|
|
11
|
-
email?: string;
|
|
12
|
-
partnerId?: AuthPartnerId;
|
|
13
|
-
method?: AuthMethod;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Dependencies required for smart recovery
|
|
17
|
-
*
|
|
18
|
-
* @version 0.0.1
|
|
19
|
-
* @since 0.0.1
|
|
20
|
-
* @author AMBROISE PARK Consulting
|
|
21
|
-
*/
|
|
22
|
-
export interface SmartRecoveryDependencies {
|
|
23
|
-
sdk: any;
|
|
24
|
-
handleAccountLinking: (error: any, attemptedProvider: AuthPartnerId, method: AuthMethod) => Promise<AuthResult | null>;
|
|
25
|
-
createAuthResult: (user: any, isNewUser?: boolean) => AuthResult;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Centralized smart recovery handler
|
|
29
|
-
*
|
|
30
|
-
* Handles all Firebase error scenarios with appropriate recovery strategies.
|
|
31
|
-
* Wraps unrecoverable errors with handleError() before throwing.
|
|
32
|
-
*
|
|
33
|
-
* **Recovery Strategies:**
|
|
34
|
-
* - Network issues: Linear backoff (1s, 2s, 3s)
|
|
35
|
-
* - Rate limiting: Exponential backoff (2s, 4s, 8s)
|
|
36
|
-
* - Internal errors: Simple retry with 2s delay
|
|
37
|
-
* - Account linking: Delegate to account linking handler
|
|
38
|
-
* - User cancellation: Return null (not an error)
|
|
39
|
-
*
|
|
40
|
-
* @param error - Firebase error object
|
|
41
|
-
* @param operation - Operation to retry
|
|
42
|
-
* @param context - Context information for recovery
|
|
43
|
-
* @param deps - Dependencies for recovery operations
|
|
44
|
-
* @returns Auth result or null if user cancelled
|
|
45
|
-
* @throws DoNotDevError if recovery fails
|
|
46
|
-
*
|
|
47
|
-
* @version 0.0.1
|
|
48
|
-
* @since 0.0.1
|
|
49
|
-
* @author AMBROISE PARK Consulting
|
|
50
|
-
*/
|
|
51
|
-
export declare function handleSmartRecovery(error: any, operation: () => Promise<any>, context: SmartRecoveryContext, deps: SmartRecoveryDependencies): Promise<AuthResult | null>;
|
|
52
|
-
//# sourceMappingURL=FirebaseSmartRecovery.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FirebaseSmartRecovery.d.ts","sourceRoot":"","sources":["../src/FirebaseSmartRecovery.ts"],"names":[],"mappings":"AAYA,OAAO,EAGL,KAAK,UAAU,EACf,KAAK,aAAa,EACnB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAE7D;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,yBAAyB;IACxC,GAAG,EAAE,GAAG,CAAC;IACT,oBAAoB,EAAE,CACpB,KAAK,EAAE,GAAG,EACV,iBAAiB,EAAE,aAAa,EAChC,MAAM,EAAE,UAAU,KACf,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;IAChC,gBAAgB,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,SAAS,CAAC,EAAE,OAAO,KAAK,UAAU,CAAC;CAClE;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,GAAG,EACV,SAAS,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,EAC7B,OAAO,EAAE,oBAAoB,EAC7B,IAAI,EAAE,yBAAyB,GAC9B,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAkF5B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{toast as c}from"@donotdev/components";import{handleError as s,isDev as u}from"@donotdev/core";import{getAuthMethod as d}from"./constants";async function l(e,o,r,a){if(e.code==="auth/network-request-failed"){c("info","Connection issue - retrying...");try{return await h(o,a)}catch(t){throw s(t,{userMessage:"Network connection failed. Please check your internet and try again.",context:{operation:"network-retry",originalError:e.code},showNotification:!0})}}if(e.code==="auth/too-many-requests"){c("info","Rate limited - retrying with backoff...");try{return await w(o,a)}catch(t){throw s(t,{userMessage:"Too many attempts. Please wait a moment and try again.",context:{operation:"rate-limit-retry",originalError:e.code},showNotification:!0})}}if(e.code==="auth/internal-error"){c("info","Temporary issue - retrying...");try{return await p(o,a)}catch(t){throw s(t,{userMessage:"A temporary error occurred. Please try again.",context:{operation:"internal-error-retry",originalError:e.code},showNotification:!0})}}if(e.code==="auth/account-exists-with-different-credential")try{return await a.handleAccountLinking(e,r.partnerId,r.method?d(r.method):d())}catch(t){throw s(t,{userMessage:"Failed to link accounts. Please try again.",context:{operation:"account-linking",originalError:e.code},showNotification:!0})}if(e.code==="auth/popup-closed-by-user"||e.code==="auth/cancelled-popup-request"||e.code==="auth/popup-blocked"||e.message?.includes("popup")||e.message?.includes("cancelled")||e.message?.includes("closed"))return null;throw s(e,{userMessage:f(e.code),context:{operation:"smart-recovery",errorCode:e.code},showNotification:!0})}async function h(e,o,r=3){for(let a=1;a<=r;a++)try{const t=await e();return o.createAuthResult(t.user)}catch(t){if(a===r||t.code!=="auth/network-request-failed")throw t;const i=a*1e3;u(),await new Promise(n=>setTimeout(n,i))}throw new Error("Max retries exceeded")}async function w(e,o,r=3){for(let a=1;a<=r;a++)try{const t=await e();return o.createAuthResult(t.user)}catch(t){if(a===r||t.code!=="auth/too-many-requests")throw t;const i=Math.pow(2,a)*1e3;u(),await new Promise(n=>setTimeout(n,i))}throw new Error("Max retries exceeded")}async function p(e,o,r=2){for(let a=1;a<=r;a++)try{const t=await e();return o.createAuthResult(t.user)}catch(t){if(a===r||t.code!=="auth/internal-error")throw t;const i=2e3;u(),await new Promise(n=>setTimeout(n,i))}throw new Error("Max retries exceeded")}function f(e){return{"auth/invalid-email":"Invalid email address","auth/user-disabled":"This account has been disabled","auth/user-not-found":"No account found with this email","auth/wrong-password":"Incorrect password","auth/email-already-in-use":"An account already exists with this email","auth/weak-password":"Password is too weak","auth/operation-not-allowed":"This sign-in method is not enabled","auth/invalid-credential":"Invalid credentials provided","auth/invalid-verification-code":"Invalid verification code","auth/invalid-verification-id":"Invalid verification ID","auth/expired-action-code":"This link has expired","auth/invalid-action-code":"Invalid or expired link","auth/credential-already-in-use":"This credential is already associated with another account","auth/requires-recent-login":"Please sign in again to continue","auth/popup-blocked":"Popup was blocked by your browser. Please allow popups and try again."}[e]||"An authentication error occurred"}export{l as handleSmartRecovery};
|