@donotdev/auth 0.1.1 → 0.1.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -242
- package/README.md +0 -0
- package/dist/AuthStore.d.ts.map +1 -1
- package/dist/AuthStore.js +1 -1
- package/dist/authHelpers.js +1 -1
- package/dist/components/AccountLinking.js +1 -1
- package/dist/components/AuthFallback.js +1 -1
- package/dist/components/AuthPartnerButton.js +2 -2
- package/dist/components/DeleteAccountDialogs.js +1 -1
- package/dist/components/EmailLinkForm.js +1 -1
- package/dist/components/EmailPasswordForm.d.ts.map +1 -1
- package/dist/components/EmailPasswordForm.js +2 -2
- 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/PasswordResetCallback.d.ts.map +1 -1
- package/dist/components/PasswordResetCallback.js +2 -2
- 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.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.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/useAuth.d.ts.map +1 -1
- package/dist/useAuth.js +1 -1
- package/package.json +6 -6
package/LICENSE.md
CHANGED
|
@@ -1,242 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
- Hosted applications operated on behalf of a paying client, regardless of code access
|
|
23
|
-
|
|
24
|
-
**1.6 "Internal Use"** means software applications built using the Framework for your own use or your employer's internal use, including SaaS products you own and operate where end-users have no access to Framework code.
|
|
25
|
-
|
|
26
|
-
---
|
|
27
|
-
|
|
28
|
-
## 2. LICENSE GRANT
|
|
29
|
-
|
|
30
|
-
**2.1 Developer License**
|
|
31
|
-
|
|
32
|
-
Subject to payment of applicable fees and compliance with this Agreement, Ambroise Park Consulting grants you a non-exclusive, non-transferable, perpetual license to:
|
|
33
|
-
|
|
34
|
-
(a) Install Framework packages from npm
|
|
35
|
-
(b) Use the Framework to develop software applications
|
|
36
|
-
(c) Deploy applications for Internal Use without additional fees
|
|
37
|
-
(d) Incorporate the Framework into applications as compiled/minified code
|
|
38
|
-
|
|
39
|
-
**2.2 Project Deployment License**
|
|
40
|
-
|
|
41
|
-
For each Client Project, you must obtain a Project Deployment License prior to delivery. Each Project Deployment License grants you the right to deliver one Client Project containing the Framework.
|
|
42
|
-
|
|
43
|
-
**2.3 Multi-Developer Projects**
|
|
44
|
-
|
|
45
|
-
When multiple developers collaborate on a project:
|
|
46
|
-
- Each developer must hold a Developer License with their own License Key
|
|
47
|
-
- Only one Project Deployment License is required per Client Project (regardless of team size)
|
|
48
|
-
|
|
49
|
-
---
|
|
50
|
-
|
|
51
|
-
## 3. LICENSE KEY REQUIREMENT
|
|
52
|
-
|
|
53
|
-
**3.1 License Key Activation**
|
|
54
|
-
|
|
55
|
-
Upon purchasing a Developer License or Project Deployment License, you will receive a License Key. You must configure your applications with this key:
|
|
56
|
-
|
|
57
|
-
```javascript
|
|
58
|
-
// Environment variable (recommended)
|
|
59
|
-
DONOTDEV_LICENSE_KEY=your-license-key-here
|
|
60
|
-
|
|
61
|
-
// Or in code
|
|
62
|
-
globalThis.__DONOTDEV_LICENSE_KEY__ = 'your-license-key-here';
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
**3.2 Watermark Enforcement**
|
|
66
|
-
|
|
67
|
-
Applications running without a valid License Key will display a watermark:
|
|
68
|
-
- "⚠️ Unlicensed DoNotDev Framework - Visit donotdev.com"
|
|
69
|
-
- Console warnings in development mode
|
|
70
|
-
|
|
71
|
-
**3.3 License Key Types**
|
|
72
|
-
|
|
73
|
-
- **Developer License Key:** For Internal Use and development
|
|
74
|
-
- **Project Deployment License Key:** For Client Project deployment (suppresses watermark in production)
|
|
75
|
-
|
|
76
|
-
**3.4 Key Management**
|
|
77
|
-
|
|
78
|
-
- Do not commit License Keys to public repositories
|
|
79
|
-
- Use environment variables or secure secret management for production deployments
|
|
80
|
-
- Each developer uses their own Developer License Key for development
|
|
81
|
-
- Project Deployment Keys are provisioned per client project
|
|
82
|
-
|
|
83
|
-
---
|
|
84
|
-
|
|
85
|
-
## 4. PERMITTED USES
|
|
86
|
-
|
|
87
|
-
You may:
|
|
88
|
-
|
|
89
|
-
(a) Build unlimited applications for Internal Use with a Developer License
|
|
90
|
-
(b) Develop SaaS products you own and operate (no Project Deployment License required if clients cannot access Framework code)
|
|
91
|
-
(c) Create internal tools for your organization
|
|
92
|
-
(d) Build applications that include the Framework as compiled dependencies
|
|
93
|
-
(e) Open-source applications built on top of the Framework (provided end-users obtain their own licenses to suppress watermarks)
|
|
94
|
-
|
|
95
|
-
---
|
|
96
|
-
|
|
97
|
-
## 5. RESTRICTIONS
|
|
98
|
-
|
|
99
|
-
You may not:
|
|
100
|
-
|
|
101
|
-
(a) Redistribute Framework packages independently of your applications
|
|
102
|
-
(b) Share, publish, or transfer your License Key to unlicensed parties
|
|
103
|
-
(c) Decompile, reverse engineer, or attempt to extract source code from minified files
|
|
104
|
-
(d) Remove or obscure copyright notices or watermarks from Framework code
|
|
105
|
-
(e) Sublicense, resell, or transfer your Developer License to another individual
|
|
106
|
-
(f) Deliver Client Projects without obtaining a Project Deployment License
|
|
107
|
-
(g) Modify Framework code to bypass license validation or watermark enforcement
|
|
108
|
-
(h) Create derivative frameworks intended for redistribution
|
|
109
|
-
(i) Use a single Project Deployment License for multiple client projects
|
|
110
|
-
|
|
111
|
-
---
|
|
112
|
-
|
|
113
|
-
## 6. LICENSE TYPES & FEES
|
|
114
|
-
|
|
115
|
-
**6.1 Developer License**
|
|
116
|
-
- **Scope:** Per individual developer
|
|
117
|
-
- **Term:** Perpetual (lifetime access)
|
|
118
|
-
- **Fee:** Set forth in purchase agreement or donotdev.com pricing
|
|
119
|
-
- **Entitlements:** Unlimited Internal Use projects; Client Projects require additional Project Deployment Licenses
|
|
120
|
-
- **License Key:** One Developer License Key provided
|
|
121
|
-
|
|
122
|
-
**6.2 Project Deployment License**
|
|
123
|
-
- **Scope:** Per Client Project delivered
|
|
124
|
-
- **Term:** Perpetual for the specific project
|
|
125
|
-
- **Fee:** Set forth in purchase agreement or donotdev.com pricing
|
|
126
|
-
- **Purchaser:** Typically purchased by the developer/agency; client payment arrangements are permitted
|
|
127
|
-
- **License Key:** One Project Deployment Key provided per project
|
|
128
|
-
|
|
129
|
-
**6.3 Volume Licensing**
|
|
130
|
-
|
|
131
|
-
Organizations requiring multiple Developer Licenses may contact Ambroise Park Consulting for volume pricing and enterprise key management.
|
|
132
|
-
|
|
133
|
-
---
|
|
134
|
-
|
|
135
|
-
## 7. PAYMENT & VERIFICATION
|
|
136
|
-
|
|
137
|
-
**7.1 Payment**
|
|
138
|
-
|
|
139
|
-
All fees must be paid in full before License Key issuance. Payment terms and pricing are specified at donotdev.com or in separate purchase agreements.
|
|
140
|
-
|
|
141
|
-
**7.2 Compliance Verification**
|
|
142
|
-
|
|
143
|
-
Ambroise Park Consulting may request reasonable verification of Project Deployment License compliance. You agree to cooperate with such verification requests in good faith.
|
|
144
|
-
|
|
145
|
-
**7.3 Enforcement**
|
|
146
|
-
|
|
147
|
-
License compliance is primarily honor-based. Watermarks serve as technical reminders. Ambroise Park Consulting reserves the right to audit usage and pursue legal remedies for material breaches.
|
|
148
|
-
|
|
149
|
-
---
|
|
150
|
-
|
|
151
|
-
## 8. TERM & TERMINATION
|
|
152
|
-
|
|
153
|
-
**8.1 Perpetual Term**
|
|
154
|
-
|
|
155
|
-
Developer Licenses and Project Deployment Licenses are perpetual and do not expire, subject to Section 8.2.
|
|
156
|
-
|
|
157
|
-
**8.2 Termination for Breach**
|
|
158
|
-
|
|
159
|
-
Ambroise Park Consulting may terminate your license(s) and revoke your License Key(s) if you:
|
|
160
|
-
- Breach any material term of this Agreement
|
|
161
|
-
- Fail to pay applicable fees
|
|
162
|
-
- Engage in unauthorized redistribution or License Key sharing
|
|
163
|
-
- Attempt to bypass license validation mechanisms
|
|
164
|
-
|
|
165
|
-
**8.3 Effect of Termination**
|
|
166
|
-
|
|
167
|
-
Upon termination:
|
|
168
|
-
- Your License Key(s) will be revoked and watermarks will reappear
|
|
169
|
-
- Your right to use the Framework ceases
|
|
170
|
-
- Previously deployed applications may continue to function but will display watermarks
|
|
171
|
-
- You must cease distribution of any Client Projects in development
|
|
172
|
-
- You must remove the Framework from any ongoing projects
|
|
173
|
-
|
|
174
|
-
**8.4 Survival**
|
|
175
|
-
|
|
176
|
-
Sections 5 (Restrictions), 9 (Warranty Disclaimer), 10 (Limitation of Liability), and 11 (General Provisions) survive termination.
|
|
177
|
-
|
|
178
|
-
---
|
|
179
|
-
|
|
180
|
-
## 9. WARRANTY DISCLAIMER
|
|
181
|
-
|
|
182
|
-
THE FRAMEWORK IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
|
183
|
-
|
|
184
|
-
Ambroise Park Consulting does not warrant that the Framework will be error-free, uninterrupted, or meet your specific requirements.
|
|
185
|
-
|
|
186
|
-
---
|
|
187
|
-
|
|
188
|
-
## 10. LIMITATION OF LIABILITY
|
|
189
|
-
|
|
190
|
-
TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL AMBROISE PARK CONSULTING BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, OR PUNITIVE DAMAGES (INCLUDING LOSS OF PROFITS, DATA, OR BUSINESS OPPORTUNITIES) ARISING OUT OF OR RELATED TO THIS AGREEMENT OR USE OF THE FRAMEWORK, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
|
191
|
-
|
|
192
|
-
Ambroise Park Consulting's total cumulative liability under this Agreement shall not exceed the fees you paid for the specific license giving rise to the claim.
|
|
193
|
-
|
|
194
|
-
---
|
|
195
|
-
|
|
196
|
-
## 11. GENERAL PROVISIONS
|
|
197
|
-
|
|
198
|
-
**11.1 Governing Law**
|
|
199
|
-
|
|
200
|
-
This Agreement is governed by the laws of Quebec, Canada, without regard to conflict of law principles. Any disputes arising under this Agreement shall be resolved exclusively in the courts of Quebec, Canada.
|
|
201
|
-
|
|
202
|
-
**11.2 Severability**
|
|
203
|
-
|
|
204
|
-
If any provision of this Agreement is found unenforceable, the remaining provisions continue in full force and effect.
|
|
205
|
-
|
|
206
|
-
**11.3 Assignment**
|
|
207
|
-
|
|
208
|
-
You may not assign or transfer this Agreement or any licenses granted hereunder without prior written consent of Ambroise Park Consulting. Ambroise Park Consulting may assign this Agreement without restriction.
|
|
209
|
-
|
|
210
|
-
**11.4 Entire Agreement**
|
|
211
|
-
|
|
212
|
-
This Agreement, together with any applicable purchase agreements or order forms, constitutes the entire agreement between you and Ambroise Park Consulting regarding the Framework and supersedes all prior agreements and understandings.
|
|
213
|
-
|
|
214
|
-
**11.5 Amendments**
|
|
215
|
-
|
|
216
|
-
Ambroise Park Consulting may update this Agreement from time to time. Updates apply to licenses purchased after the effective date of the update. Existing licenses remain governed by the version in effect at the time of purchase unless you opt-in to updated terms.
|
|
217
|
-
|
|
218
|
-
**11.6 Export Compliance**
|
|
219
|
-
|
|
220
|
-
You agree to comply with all applicable export and import laws and regulations in your use of the Framework.
|
|
221
|
-
|
|
222
|
-
**11.7 Force Majeure**
|
|
223
|
-
|
|
224
|
-
Neither party is liable for failure to perform due to causes beyond reasonable control, including but not limited to acts of God, war, strikes, or third-party service outages.
|
|
225
|
-
|
|
226
|
-
**11.8 No Support Obligation**
|
|
227
|
-
|
|
228
|
-
Ambroise Park Consulting has no obligation to provide support, updates, or maintenance. Any support provided is at sole discretion and may be discontinued without notice.
|
|
229
|
-
|
|
230
|
-
**11.9 Contact**
|
|
231
|
-
|
|
232
|
-
Questions about licensing or compliance:
|
|
233
|
-
|
|
234
|
-
**Email:** contact@donotdev.com
|
|
235
|
-
**Website:** donotdev.com
|
|
236
|
-
|
|
237
|
-
---
|
|
238
|
-
|
|
239
|
-
**END OF LICENSE AGREEMENT**
|
|
240
|
-
|
|
241
|
-
**DoNotDev Framework License v1.0**
|
|
242
|
-
Ambroise Park Consulting – 2025
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AMBROISE PARK Consulting
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
File without changes
|
package/dist/AuthStore.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthStore.d.ts","sourceRoot":"","sources":["../src/AuthStore.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAEH,OAAO,EAKL,KAAK,SAAS,EACd,KAAK,WAAW,EAEjB,MAAM,gBAAgB,CAAC;AA2BxB,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"AuthStore.d.ts","sourceRoot":"","sources":["../src/AuthStore.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAEH,OAAO,EAKL,KAAK,SAAS,EACd,KAAK,WAAW,EAEjB,MAAM,gBAAgB,CAAC;AA2BxB,eAAO,MAAM,YAAY,iIAiMvB,CAAC"}
|
package/dist/AuthStore.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createDoNotDevStore as i,FEATURE_STATUS as
|
|
1
|
+
import{createDoNotDevStore as i,FEATURE_STATUS as l}from"@donotdev/core";import{PARTNER_STATE as n}from"./constants";const o={user:null,authenticated:!1,userId:null,loading:!1,error:null,userProfile:null,userSubscription:null,partnerStates:{},partnerError:null,authService:null,emailVerification:{status:"pending"},passwordResetPending:!1,status:l.INITIALIZING},c=i({name:"auth-store",createStore:(t,a)=>({...o,setStatus:r=>{t({status:r})},setPartnerState:(r,e,s)=>{t(u=>({partnerStates:{...u.partnerStates,[r]:e},partnerError:e==="error"&&s?{partnerId:r,error:s}:u.partnerError?.partnerId===r?null:u.partnerError}))},getPartnerState:r=>a().partnerStates[r]||n.IDLE,clearAllPartnerStates:()=>t(r=>({partnerStates:Object.keys(r.partnerStates).reduce((e,s)=>(e[s]=n.IDLE,e),{}),partnerError:null})),setAuthenticated:(r,e,s)=>{t({user:r,authenticated:!0,userId:r.id,loading:!1,error:null,status:l.READY,userSubscription:e,userProfile:s})},setUnauthenticated:()=>{t({user:null,authenticated:!1,userId:null,loading:!1,error:null,status:l.READY,userSubscription:null,userProfile:null})},setAuthLoading:r=>{t({loading:r})},setAuthError:r=>{t({error:r,loading:!1})},clearAuthError:()=>{t({error:null})},getCustomClaim:r=>a().getCustomClaimLocal(r),getCustomClaims:()=>a().getCustomClaimsLocal(),setAuthService:r=>t({authService:r}),getCustomClaimLocal:r=>{const e=a(),s=e.userProfile;return s?.claims&&typeof s.claims=="object"&&r in s.claims?s.claims[r]:s&&typeof s=="object"&&r in s?s[r]:e.user&&typeof e.user=="object"&&r in e.user?e.user[r]:null},getCustomClaimsLocal:()=>{const r=a(),e={};return r.userProfile?.claims&&Object.assign(e,r.userProfile.claims),Object.freeze({...e})},setPasswordResetPending:r=>t({passwordResetPending:r}),setEmailVerificationStatus:(r,e)=>t({emailVerification:{status:r,error:e}}),setUserProfile:r=>t({userProfile:r}),setUserSubscription:r=>t({userSubscription:r}),setLoading:r=>t({loading:r}),setError:r=>t({error:r}),clearError:()=>t({error:null}),reset:()=>t(o)})});export{c as useAuthStore};
|
package/dist/authHelpers.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isClient as e}from"@donotdev/core";import{useAuthStore as t}from"./AuthStore";function
|
|
1
|
+
import{isClient as e}from"@donotdev/core";import{useAuthStore as t}from"./AuthStore";function s(){return t.getState()}function u(r){return e()?t.subscribe(r):()=>{}}export{s as getAuthState,u as subscribeToAuth};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as i,jsxs as
|
|
1
|
+
"use client";import{jsx as i,jsxs as t}from"react/jsx-runtime";import{Suspense as L,lazy as T}from"react";import{Alert as h,ALERT_VARIANT as k,Button as o,BUTTON_VARIANT as c,Stack as a}from"@donotdev/components";import{useTranslation as I,safeSessionStorage as v,handleError as N,isDev as l}from"@donotdev/core";import{EmailLinkForm as R}from"./EmailLinkForm";import S from"./EmailPasswordForm";import{useAccountLinking as y}from"../hooks/useAccountLinking";const $=({className:r="",id:d})=>{const{t:e}=I("auth"),{isRequired:f,email:m,existingProvider:n,newProvider:u,handleSignInWithExistingProvider:w}=y();if(!f)return null;if(n==="password"||n==="emailLink"){l();const s=()=>{v.removeItem("accountLinkingInfo")},g=()=>{l()},p=A=>{N(A)};return i("div",{className:r,id:d,children:i(h,{variant:k.WARNING,role:"alert","aria-live":"polite",title:e("accountLinking.title","Account Linking Required"),description:t(a,{children:[i("p",{children:e("accountLinking.message",`An account with email ${m} already exists with ${n==="password"?"email/password":"email link"}. To link your ${u} account, please sign in with your ${n==="password"?"email and password":"email link"} first.`)}),n==="password"?i("div",{style:{marginTop:"var(--gap-md)"},children:i(S,{mode:"signin",onSuccess:g,onError:p})}):i("div",{style:{marginTop:"var(--gap-md)"},children:i(R,{onSuccess:g,onError:p})}),i(a,{direction:"row",justify:"end",children:i(o,{onClick:s,variant:c.GHOST,children:e("accountLinking.dismiss","Dismiss")})})]})})})}else{l();const s=()=>{v.removeItem("accountLinkingInfo")};return i("div",{className:r,id:d,children:i(h,{variant:k.WARNING,role:"alert","aria-live":"polite",title:e("accountLinking.title","Account Linking Required"),description:t(a,{children:[i("p",{children:e("accountLinking.message",`An account with email ${m} already exists with ${n}. To link your ${u} account, please sign in with ${n} first.`)}),t(a,{direction:"row",children:[i(o,{onClick:w,variant:c.PRIMARY,children:e("accountLinking.signInWith",`Sign in with ${n}`)}),i(o,{onClick:s,variant:c.GHOST,children:e("accountLinking.dismiss","Dismiss")})]})]})})})}},x=T(()=>Promise.resolve({default:$}));function E(r){return i(L,{fallback:null,children:i(x,{...r})})}var P=E;export{P as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as a}from"react/jsx-runtime";import{FeatureFallback as
|
|
1
|
+
import{jsx as a}from"react/jsx-runtime";import{FeatureFallback as s,withFeatureFallback as r}from"@donotdev/components";import{isFeatureAvailable as n,FRAMEWORK_FEATURES as i}from"@donotdev/core";function o({message:t="Authentication is not available",showLoginButton:e=!1,className:u=""}){return a(s,{featureName:"Authentication",message:t,icon:"\u{1F512}",showActionButton:e,actionButtonText:"Sign In (Unavailable)",className:u,helpText:"This feature requires authentication to be configured."})}function l(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 c(t){return{isAuthAvailable:n(i.AUTH),AuthFallbackComponent:()=>a(o,{...t})}}export{o as AuthFallback,c as useAuthComponent,l as withAuthFallback};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as a}from"react/jsx-runtime";import{useMemo as I,useState as B}from"react";if(typeof document<"u"&&!document.getElementById("auth-partner-button-styles")){const r=document.createElement("style");r.id="auth-partner-button-styles",r.textContent=`
|
|
2
2
|
.dndev-interactive.auth-partner-button-custom[data-variant='outline']:hover {
|
|
3
3
|
background-color: var(--partner-hover-bg);
|
|
4
4
|
}
|
|
5
|
-
`,document.head.appendChild(
|
|
5
|
+
`,document.head.appendChild(r)}import{cn as D,DISPLAY as S,PROVIDER_ICONS as U,DefaultProviderIcon as M,Button as _,BUTTON_VARIANT as $,Spinner as V}from"@donotdev/components";import{AUTH_PARTNERS as W,useTranslation as j}from"@donotdev/core";import{EmailLinkForm as F}from"./EmailLinkForm";import H from"./EmailPasswordForm";import{getAuthMethod as k}from"../constants";import{useAuth as s}from"../useAuth";function K({partnerId:r,method:p,onSuccess:u,onError:l,className:c="",children:b,disabled:h=!1,display:f=S.AUTO,style:g,...q}){const{t:i}=j("auth"),v=s("user"),E=s("signInWithPartner"),A=s("linkWithPartner"),N=s("isAvailable"),[o,y]=B(!1),n=I(()=>W[r],[r]);if(r==="password")return a("div",{className:c,children:a(H,{mode:"signin",onSuccess:()=>u?.(null),onError:l,compact:!0})});if(r==="emailLink")return a("div",{className:c,children:a(F,{onSuccess:()=>u?.(null),onError:l})});const T=I(()=>U[r]||M,[r]),P=n?.firebaseProviderId,d=!!v?.providerData?.some(t=>t.providerId===P),m=v&&!d,w=async()=>{if(!(o||h)){y(!0);try{let t;if(m)t=await A(r,k(p));else{const R=k(p);t=await E(r,R)}t&&u?.(t)}catch(t){l?.(t instanceof Error?t:new Error(String(t)))}finally{y(!1)}}},e=n?.name,O=()=>{if(b)return b;if(m)return o?i("buttons.linking",{partner:e}):d?i("buttons.linked",{partner:e}):i("buttons.link",{partner:e});if(o)return i("buttons.signingIn",{partner:e});const t=n?.button?.textKey;return t?i(t):`Sign in with ${e}`},x=h||o||!N||m&&d||!1,C=n?.button?{backgroundColor:n.button.backgroundColor,color:n.button.textColor,borderColor:n.button.borderColor,"--partner-hover-bg":n.button.hoverBackgroundColor}:void 0,L=g?{...C,...g}:C;return a(_,{variant:$.OUTLINE,onClick:w,disabled:x,"aria-busy":o,display:f,"aria-label":o?`Signing in with ${e}...`:`Sign in with ${e}`,tooltip:void 0,style:L,className:D(n?.button&&"auth-partner-button-custom",c),icon:o?a(V,{"aria-label":"Loading"}):T,children:f!==S.COMPACT&&O()})}var Y=K;export{Y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as n,jsxs as o,Fragment as f}from"react/jsx-runtime";import{Trash2 as y}from"lucide-react";import{useState as A}from"react";import{Dialog as g,Button as s,BUTTON_VARIANT as u,PasswordInput as R,Label as D,Checkbox as k,Alert as C,ALERT_VARIANT as b,Stack as l,Text as v,List as w}from"@donotdev/components";import{useTranslation as T}from"@donotdev/core";function E({open:h,isLoading:c,error:r,onReauth:m,onCancel:a}){const{t:e}=T("auth"),[i,p]=A(""),d=async()=>{await m(i)};return n(g,{open:h,onOpenChange:t=>!t&&a(),title:e("deleteAccount.reauth.title","Confirm Your Identity"),description:e("deleteAccount.reauth.description","For security, please re-enter your password to continue."),footer:o(f,{children:[n(s,{variant:u.OUTLINE,onClick:a,disabled:c,children:e("deleteAccount.reauth.cancel","Cancel")}),n(s,{variant:u.DEFAULT,onClick:d,disabled:c||!i,children:c?e("deleteAccount.reauth.verifying","Verifying..."):e("deleteAccount.reauth.continue","Continue")})]}),children:n("form",{onSubmit:t=>{t.preventDefault(),d()},children:o(l,{children:[n(R,{value:i,onChange:t=>p(t.target.value),label:e("deleteAccount.reauth.password","Password"),disabled:c,placeholder:e("deleteAccount.reauth.passwordPlaceholder","Enter your password"),required:!0,className:"dndev-w-full"}),r&&n(C,{variant:b.ERROR,description:r})]})})})}function x({open:h,isLoading:c,error:r,onConfirm:m,onCancel:a}){const{t:e}=T("auth"),[i,p]=A(!1),d=async()=>{i&&await m()};return n(g,{open:h,onOpenChange:t=>!t&&a(),"data-content-size":"text",title:e("deleteAccount.confirm.title","Delete Your Account?"),description:e("deleteAccount.confirm.description","This action cannot be undone. This will permanently delete your account."),footer:o(f,{children:[n(s,{variant:u.OUTLINE,onClick:a,disabled:c,children:e("deleteAccount.confirm.cancel","Cancel")}),n(s,{variant:u.DESTRUCTIVE,icon:y,onClick:d,disabled:c||!i,children:c?e("deleteAccount.confirm.deleting","Deleting..."):e("deleteAccount.confirm.delete","Delete My Account")})]}),children:o(l,{gap:"large",children:[o(l,{children:[n(v,{as:"h4",level:"h4",children:e("deleteAccount.confirm.whatDeleted","What will be deleted:")}),n(w,{items:[e("deleteAccount.confirm.credentials","Your account and authentication credentials"),e("deleteAccount.confirm.profile","Your profile information"),e("deleteAccount.confirm.oauth","All connected OAuth providers"),e("deleteAccount.confirm.subscriptions","Active subscriptions (will be canceled)")]})]}),o(l,{children:[n(v,{as:"h4",level:"h4",children:e("deleteAccount.confirm.whatKept","What will be kept (anonymized):")}),n(w,{items:[e("deleteAccount.confirm.billing","Billing history for tax/accounting purposes"),e("deleteAccount.confirm.invoices","Past invoices and transaction records")]})]}),o(l,{direction:"row",align:"start",children:[n(k,{id:"confirm-delete",checked:i,onCheckedChange:t=>p(t===!0)}),n(D,{htmlFor:"confirm-delete",children:e("deleteAccount.confirm.checkbox","I understand this action cannot be undone")})]}),r&&n(C,{variant:b.ERROR,description:r})]})})}export{x as ConfirmDeleteDialog,E as ReauthDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as
|
|
1
|
+
"use client";import{jsx as e,jsxs as l}from"react/jsx-runtime";import{Mail as o,CheckCircle as S}from"lucide-react";import{Button as c,BUTTON_VARIANT as f,Input as T,Alert as b,ALERT_VARIANT as C,Spinner as R,Stack as n,Text as s}from"@donotdev/components";import{useTranslation as x}from"@donotdev/core";import{useEmailLinkForm as A}from"../hooks/useEmailLinkForm";function m({className:r="",onSuccess:u,onError:h,actionCodeSettings:k}){const{t:i}=x("auth"),{email:t,setEmail:L,isLoading:a,isSent:v,error:d,handleSendLink:p,handleResend:g,canSubmit:E}=A({onSuccess:u,onError:h,actionCodeSettings:k});return v?l(n,{className:r,children:[l(n,{align:"center",children:[e(S,{className:"dndev-size-touch"}),e(s,{as:"h3",level:"h3",children:i("emailLink.checkEmail","Check Your Email")}),e(s,{level:"small",variant:"muted",className:"dndev-text-center",children:i("emailLink.sentMessage",`We've sent a sign-in link to ${t}. Click the link in your email to complete sign-in.`)})]}),e(n,{direction:"row",justify:"center",children:e(c,{variant:f.OUTLINE,onClick:g,icon:o,iconEnd:!1,children:i("emailLink.resend","Resend Link")})})]}):e("form",{onSubmit:p,className:r,children:l(n,{children:[e(T,{type:"email",label:i("emailLink.emailLabel","Email Address"),value:t,onChange:N=>L(N.target.value),placeholder:i("emailLink.emailPlaceholder","Enter your email address"),required:!0,disabled:a,className:"dndev-w-full"}),d&&e(b,{variant:C.ERROR,description:d}),e(c,{type:"submit",disabled:!E,icon:a?e(R,{"aria-label":"Loading"}):o,iconEnd:!1,className:"dndev-w-full",children:a?i("emailLink.sending","Sending Link..."):i("emailLink.sendLink","Send Sign-In Link")}),e(s,{level:"small",variant:"muted",className:"dndev-text-center",children:i("emailLink.helpText","We'll send you a secure link to sign in without a password.")})]})})}var y=m;export{m as EmailLinkForm,y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmailPasswordForm.d.ts","sourceRoot":"","sources":["../../src/components/EmailPasswordForm.tsx"],"names":[],"mappings":"AAsCA,OAAO,KAAK,EAAE,sBAAsB,EAAY,MAAM,cAAc,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;AA8KrE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,iBAAS,iBAAiB,CAAC,EACzB,IAAe,EACf,SAAS,EACT,OAAO,EACP,SAAc,EACd,GAAG,EACH,OAAO,EACP,YAAY,GACb,EAAE,sBAAsB,2CAuqBxB;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
2
|
-
`).some(k=>{const[N]=k.split(":");return N?.trim()===e}):!1}catch{return!1}}const $e=[{test:r=>r.includes("429")||r.includes("rate")||r.includes("too_many_requests"),key:"errors.rate_limit",fallback:"Too many attempts. Please wait a moment and try again."},{test:r=>r.includes("email_not_confirmed")||r.includes("email not confirmed")||r.includes("auth/unverified-email"),key:"errors.email_not_confirmed",fallback:"Please verify your email before signing in."},{test:r=>r.includes("invalid_credentials")||r.includes("invalid login credentials")||r.includes("invalid-credential")||r.includes("auth/wrong-password")||r.includes("auth/user-not-found")||r.includes("invalid")&&r.includes("credential"),key:"errors.invalid_credentials",fallback:"Invalid email or password."},{test:r=>r.includes("already")||r.includes("exists")||r.includes("user_already_exists")||r.includes("user already registered")||r.includes("auth/email-already-in-use"),key:"signup.check_email",fallback:"Check your email to confirm your account."},{test:r=>r.includes("weak_password")||r.includes("weak password")||r.includes("auth/weak-password"),key:"errors.weak_password",fallback:"Password is too weak. Please choose a stronger password."},{test:r=>r.includes("network")||r.includes("fetch"),key:"networkError",fallback:"Network error. Please check your connection and try again."}];function Ge(r,n){const g=(r instanceof Error?r.message:String(r)).toLowerCase();for(const u of $e)if(u.test(g))return n(u.key,u.fallback);return n("errorGeneric","Authentication failed. Please try again.")}function ze({mode:r="signin",onSuccess:n,onError:w,className:g="",tos:u,privacy:l,captchaToken:y}){const{t:e}=De("auth"),P=We("app"),j=b("signInWithEmail"),k=b("createUserWithEmail"),N=b("sendPasswordResetEmail"),fe=b("sendEmailVerification"),he=b("setRememberMe"),we=b("isAvailable"),ge=b("loading"),[x,ye]=p(r),m=x==="signup",[q,be]=p(!1),[K,O]=p(!1),[_,H]=p(!1),[$,U]=p(!1),[G,z]=p(!1),[ve,Z]=p(!1),[Pe,X]=p(!1),C=u!==void 0?u:P?.footer?.legalLinks?.find(t=>t.path.includes("terms"))?.path??"/legal/terms",S=l!==void 0?l:P?.footer?.legalLinks?.find(t=>t.path.includes("privacy"))?.path??"/legal/privacy",R=C!==!1,E=S!==!1,Y=R&&typeof C!="string",J=E&&typeof S!="string",Q=R&&typeof C=="string"?C:null,ee=E&&typeof S=="string"?S:null,{isRateLimited:D,recordAttempt:ke,cooldownUntil:re}=Ke(),{control:A,handleSubmit:_e,getValues:Ce,reset:te,formState:{errors:s,isSubmitting:Se},setError:W,clearErrors:ae}=qe({mode:"onChange",defaultValues:{email:"",password:"",confirmPassword:""}}),se=ce({control:A,name:"password"}),I=ce({control:A,name:"email"}),F=V(t=>{te({email:I||"",password:"",confirmPassword:""}),ae(),U(!1),O(!1),z(!1),ye(t)},[te,ae,I]),Re=async t=>{if(D()){W("root",{message:e("errors.rate_limit","Too many attempts. Please wait a moment and try again.")});return}ke();try{x==="signin"?(q!==void 0&&await he(q),await j(t.email,t.password),n?.(void 0)):(await k(t.email,t.password),U(!0),n?.(void 0))}catch(c){const Te=x==="signup",oe=c instanceof Error?c.message:String(c),M=oe.toLowerCase();if(Te&&(M.includes("already")||M.includes("exists")||M.includes("user_already_exists")||M.includes("auth/email-already-in-use"))){U(!0);return}const Me=Ge(c,e);W("root",{message:Me}),w?.(c instanceof Error?c:new Error(oe))}},Ee=async()=>{if(!I||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(I)){W("email",{message:e("emailRequired","Email is required")});return}H(!0);try{await N(I)}catch{}finally{O(!0),H(!1)}},Ae=async()=>{try{await fe()}catch{}};if(!we)return a(o,{className:g,children:a(L,{variant:T.WARNING,title:e("unavailable.title","Authentication Unavailable"),description:e("unavailable.description","Please accept cookies to enable authentication.")})});const d=ge||Se,ne=m&&(R||E),Ie=y!==void 0&&!y,Le=d||D()||Ie||ne&&!G,ie=re?Math.max(0,Math.ceil((re-Date.now())/1e3)):0;return a("form",{onSubmit:_e(Re),className:Ue("dndev-auth-form",g),noValidate:!0,children:i(o,{children:[s.root&&a(L,{variant:T.ERROR,description:s.root.message}),D()&&ie>0&&a(L,{variant:T.WARNING,description:e("errors.rate_limit_cooldown",`Too many attempts. Please wait ${ie} seconds.`)}),$&&i(o,{children:[a(L,{variant:T.SUCCESS,title:e("signup.success_title","Check your email"),description:e("signup.check_email","If an account was created, you will receive a confirmation email. Check your inbox and spam folder.")}),i(o,{direction:"row",gap:"tight",justify:"center",align:"center",children:[a(f,{type:"button",variant:h.GHOST,onClick:Ae,children:e("signup.resend_verification","Resend verification email")}),a(v,{as:"span",variant:"muted",children:"|"}),a(f,{type:"button",variant:h.LINK,onClick:()=>F("signin"),children:e("actions.sign_in_submit","Sign In")})]})]}),K&&i(o,{children:[a(L,{variant:T.SUCCESS,title:e("forgotPassword.sent","Password reset email sent"),description:e("forgotPassword.check_email_safe","If an account exists with this email, you will receive password reset instructions.")}),a(o,{align:"center",children:a(f,{type:"button",variant:h.LINK,onClick:()=>{O(!1)},children:e("back","Back")})})]}),!$&&!K&&i(o,{children:[a(B,{name:"email",control:A,rules:{required:e("emailRequired","Email is required"),pattern:{value:/^[^\s@]+@[^\s@]+\.[^\s@]+$/,message:e("emailInvalid","Invalid email address")}},render:({field:t})=>i(o,{gap:"tight",children:[a(Oe,{...t,type:"email",label:e("email","Email"),placeholder:e("emailPlaceholder","Enter your email"),autoComplete:"email webauthn",disabled:d||_,"aria-invalid":!!s.email,"aria-describedby":s.email?"email-error":void 0,className:"dndev-w-full","data-variant":s.email?"destructive":void 0}),s.email&&a(v,{as:"span",level:"caption",variant:"destructive",id:"email-error",role:"alert",children:s.email.message})]})}),a(B,{name:"password",control:A,rules:{required:e("passwordRequired","Password is required"),minLength:{value:8,message:e("passwordMinLength","Password must be at least 8 characters")},validate:m?{uppercase:t=>t?/[A-Z]/.test(t)?!0:e("passwordRequirement.uppercase","Password must contain at least one uppercase letter"):!0,lowercase:t=>t?/[a-z]/.test(t)?!0:e("passwordRequirement.lowercase","Password must contain at least one lowercase letter"):!0,number:t=>t?/[0-9]/.test(t)?!0:e("passwordRequirement.number","Password must contain at least one number"):!0,special:t=>t?/[^a-zA-Z0-9]/.test(t)?!0:e("passwordRequirement.special","Password must contain at least one special character"):!0,breached:async t=>!t||t.length<8?!0:await He(t)?e("errors.breached_password","This password has appeared in a data breach. Please choose a different password."):!0}:void 0},render:({field:t})=>{const c=`password-${t.name}`;return i(o,{gap:"tight",children:[a(pe,{...t,id:c,label:e("password","Password"),placeholder:e("passwordPlaceholder","Enter your password"),autoComplete:m?"new-password":"current-password",disabled:d||_,"aria-invalid":!!s.password,"aria-describedby":s.password?"password-error":void 0,className:"dndev-w-full","data-variant":s.password?"destructive":void 0}),s.password&&a(v,{as:"span",level:"caption",variant:"destructive",id:"password-error",role:"alert",children:s.password.message})]})}}),m&&a(B,{name:"confirmPassword",control:A,rules:{required:e("confirmPasswordRequired","Please confirm your password"),validate:t=>{const c=Ce("password");return t!==c?e("confirmPasswordMismatch","Passwords do not match"):!0}},render:({field:t})=>i(o,{gap:"tight",children:[a(pe,{...t,label:e("confirmPassword","Confirm Password"),placeholder:e("confirmPasswordPlaceholder","Re-enter your password"),autoComplete:"new-password",disabled:d,"aria-invalid":!!s.confirmPassword,"aria-describedby":s.confirmPassword?"confirm-password-error":void 0,className:"dndev-w-full","data-variant":s.confirmPassword?"destructive":void 0}),s.confirmPassword&&a(v,{as:"span",level:"caption",variant:"destructive",id:"confirm-password-error",role:"alert",children:s.confirmPassword.message})]})}),m&&se&&a(Fe,{password:se,minLength:8,showRequirements:!0}),ne&&i(le,{children:[i(o,{direction:"row",gap:"tight",align:"start",children:[a(de,{id:"tos-accept",checked:G,onCheckedChange:t=>z(t===!0),disabled:d}),a(me,{htmlFor:"tos-accept",children:i(v,{as:"span",level:"caption",children:[e("terms.accept_prefix","I accept the")," ",R&&a(f,{type:"button",variant:h.LINK,onClick:()=>{Y?Z(!0):Q&&window.open(Q,"_blank","noopener,noreferrer")},className:"dndev-p-0 dndev-h-auto",style:{minHeight:"auto",padding:0,display:"inline"},children:e("terms.tos","Terms of Service")}),R&&E&&i(le,{children:[" ",e("terms.and","and")," "]}),E&&a(f,{type:"button",variant:h.LINK,onClick:()=>{J?X(!0):ee&&window.open(ee,"_blank","noopener,noreferrer")},className:"dndev-p-0 dndev-h-auto",style:{minHeight:"auto",padding:0,display:"inline"},children:e("terms.privacy","Privacy Policy")})]})})]}),Y&&a(ue,{open:ve,onOpenChange:Z,title:e("terms.tos","Terms of Service"),showClose:!0,children:C}),J&&a(ue,{open:Pe,onOpenChange:X,title:e("terms.privacy","Privacy Policy"),showClose:!0,children:S})]}),!m&&i(o,{direction:"row",gap:"tight",align:"center",children:[a(de,{id:"remember-me",checked:q,onCheckedChange:t=>be(t===!0),disabled:d||_}),a(me,{htmlFor:"remember-me",children:e("rememberMe","Remember me")})]}),a(f,{type:"submit",variant:h.PRIMARY,disabled:Le,fullWidth:!0,children:d?e("loading","Loading..."):m?e("actions.sign_up_submit","Sign Up"):e("actions.sign_in_submit","Sign In")}),!m&&i(o,{direction:"row",gap:"tight",justify:"center",align:"center",children:[a(f,{type:"button",variant:h.LINK,disabled:d||_,onClick:Ee,children:_?e("loading","Loading..."):e("forgotPassword","Forgot password?")}),a(v,{as:"span",variant:"muted",children:"|"}),a(f,{type:"button",variant:h.LINK,disabled:d,onClick:()=>F("signup"),children:e("actions.sign_up_submit","Sign Up")})]}),m&&a(o,{align:"center",children:a(f,{type:"button",variant:h.LINK,disabled:d,onClick:()=>F("signin"),children:e("alreadyHaveAccount","Already have an account? Sign In")})})]})]})})}var tr=ze;export{tr as default};
|
|
1
|
+
"use client";import{jsx as i,jsxs as n,Fragment as te}from"react/jsx-runtime";import{useCallback as V,useEffect as qe,useRef as xe,useState as h}from"react";import{useForm as Ue,Controller as W,useWatch as ne}from"react-hook-form";import{Alert as A,ALERT_VARIANT as E,Button as g,BUTTON_VARIANT as f,Checkbox as oe,Dialog as le,Input as Ke,Label as de,PasswordInput as ce,Stack as o,Text as b,cn as Me}from"@donotdev/components";import{useTranslation as De,useAppConfig as Oe}from"@donotdev/core";import{useAuth as v}from"../useAuth";import{PasswordStrengthIndicator as Ve}from"./PasswordStrengthIndicator";const We=6e4,je=5,Fe=3e4;function He(){const a=xe([]),[t,m]=h(null),l=V(()=>!!(t&&Date.now()<t),[t]),y=V(()=>{const d=Date.now();a.current=a.current.filter(p=>d-p<We),a.current.push(d),a.current.length>=je&&(m(d+Fe),a.current=[])},[]);return qe(()=>{if(!t)return;const d=t-Date.now();if(d<=0){m(null);return}const p=setTimeout(()=>m(null),d);return()=>clearTimeout(p)},[t]),{isRateLimited:l,recordAttempt:y,cooldownUntil:t}}async function $e(a){try{const t=new TextEncoder().encode(a),m=await crypto.subtle.digest("SHA-1",t),l=Array.from(new Uint8Array(m)).map(e=>e.toString(16).padStart(2,"0")).join("").toUpperCase(),y=l.slice(0,5),d=l.slice(5),p=await fetch(`https://api.pwnedpasswords.com/range/${y}`,{headers:{"Add-Padding":"true"},credentials:"omit"});return p.ok?(await p.text()).split(`
|
|
2
|
+
`).some(e=>{const[N]=e.split(":");return N?.trim()===d}):!1}catch{return!1}}const Ge=[{test:a=>a.includes("429")||a.includes("rate")||a.includes("too_many_requests"),key:"errors.rate_limit",fallback:"Too many attempts. Please wait a moment and try again."},{test:a=>a.includes("email_not_confirmed")||a.includes("email not confirmed")||a.includes("auth/unverified-email"),key:"errors.email_not_confirmed",fallback:"Please verify your email before signing in."},{test:a=>a.includes("invalid_credentials")||a.includes("invalid login credentials")||a.includes("invalid-credential")||a.includes("auth/wrong-password")||a.includes("auth/user-not-found")||a.includes("invalid")&&a.includes("credential"),key:"errors.invalid_credentials",fallback:"Invalid email or password."},{test:a=>a.includes("already")||a.includes("exists")||a.includes("user_already_exists")||a.includes("user already registered")||a.includes("auth/email-already-in-use"),key:"signup.check_email",fallback:"Check your email to confirm your account."},{test:a=>a.includes("weak_password")||a.includes("weak password")||a.includes("auth/weak-password"),key:"errors.weak_password",fallback:"Password is too weak. Please choose a stronger password."},{test:a=>a.includes("network")||a.includes("fetch"),key:"networkError",fallback:"Network error. Please check your connection and try again."}];function Be(a,t){const m=(a instanceof Error?a.message:String(a)).toLowerCase();for(const l of Ge)if(l.test(m))return t(l.key,l.fallback);return t("errorGeneric","Authentication failed. Please try again.")}function ze({mode:a="signin",onSuccess:t,onError:m,className:l="",tos:y,privacy:d,captchaToken:p}){const{t:e}=De("auth"),N=Oe("app"),ue=v("signInWithEmail"),me=v("createUserWithEmail"),pe=v("sendPasswordResetEmail"),we=v("sendEmailVerification"),he=v("setRememberMe"),ge=v("isAvailable"),fe=v("loading"),[T,ve]=h(a),w=T==="signup",[q,ye]=h(!1),[j,x]=h(!1),[k,F]=h(!1),[H,U]=h(!1),[K,$]=h(!1),[be,G]=h(!1),[ke,B]=h(!1),P=y!==void 0?y:N?.footer?.legalLinks?.find(r=>r.path.includes("terms"))?.path??"/legal/terms",_=d!==void 0?d:N?.footer?.legalLinks?.find(r=>r.path.includes("privacy"))?.path??"/legal/privacy",C=P!==!1,S=_!==!1,z=C&&typeof P!="string",Z=S&&typeof _!="string",Y=C&&typeof P=="string"?P:null,J=S&&typeof _=="string"?_:null,{isRateLimited:M,recordAttempt:Pe,cooldownUntil:Q}=He(),{control:R,handleSubmit:_e,getValues:Ce,reset:X,formState:{errors:s,isSubmitting:Se},setError:D,clearErrors:ee}=Ue({mode:"onChange",defaultValues:{email:"",password:"",confirmPassword:""}}),ae=ne({control:R,name:"password"}),I=ne({control:R,name:"email"}),O=V(r=>{X({email:I||"",password:"",confirmPassword:""}),ee(),U(!1),x(!1),$(!1),ve(r)},[X,ee,I]),Re=async r=>{if(M()){D("root",{message:e("errors.rate_limit","Too many attempts. Please wait a moment and try again.")});return}Pe();try{T==="signin"?(q!==void 0&&await he(q),await ue(r.email,r.password),t?.(void 0)):(await me(r.email,r.password,K?{gdpr_consent_at:new Date().toISOString()}:void 0),U(!0),t?.(void 0))}catch(u){const Le=T==="signup",se=u instanceof Error?u.message:String(u),L=se.toLowerCase();if(Le&&(L.includes("already")||L.includes("exists")||L.includes("user_already_exists")||L.includes("auth/email-already-in-use"))){U(!0);return}const Te=Be(u,e);D("root",{message:Te}),m?.(u instanceof Error?u:new Error(se))}},Ie=async()=>{if(!I||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(I)){D("email",{message:e("emailRequired","Email is required")});return}F(!0);try{await pe(I)}catch{}finally{x(!0),F(!1)}},Ae=async()=>{try{await we()}catch{}};if(!ge)return i(o,{className:l,children:i(A,{variant:E.WARNING,title:e("unavailable.title","Authentication Unavailable"),description:e("unavailable.description","Please accept cookies to enable authentication.")})});const c=fe||Se,re=w&&(C||S),Ee=p!==void 0&&!p,Ne=c||M()||Ee||re&&!K,ie=Q?Math.max(0,Math.ceil((Q-Date.now())/1e3)):0;return i("form",{onSubmit:_e(Re),className:Me("dndev-auth-form",l),noValidate:!0,children:n(o,{children:[s.root&&i(A,{variant:E.ERROR,description:s.root.message}),M()&&ie>0&&i(A,{variant:E.WARNING,description:e("errors.rate_limit_cooldown",`Too many attempts. Please wait ${ie} seconds.`)}),H&&n(o,{children:[i(A,{variant:E.SUCCESS,title:e("signup.success_title","Check your email"),description:e("signup.check_email","If an account was created, you will receive a confirmation email. Check your inbox and spam folder.")}),n(o,{direction:"row",gap:"tight",justify:"center",align:"center",children:[i(g,{type:"button",variant:f.GHOST,onClick:Ae,children:e("signup.resend_verification","Resend verification email")}),i(b,{as:"span",variant:"muted",children:"|"}),i(g,{type:"button",variant:f.LINK,onClick:()=>O("signin"),children:e("actions.sign_in_submit","Sign In")})]})]}),j&&n(o,{children:[i(A,{variant:E.SUCCESS,title:e("forgotPassword.sent","Password reset email sent"),description:e("forgotPassword.check_email_safe","If an account exists with this email, you will receive password reset instructions.")}),i(o,{align:"center",children:i(g,{type:"button",variant:f.LINK,onClick:()=>{x(!1)},children:e("back","Back")})})]}),!H&&!j&&n(o,{children:[i(W,{name:"email",control:R,rules:{required:e("emailRequired","Email is required"),pattern:{value:/^[^\s@]+@[^\s@]+\.[^\s@]+$/,message:e("emailInvalid","Invalid email address")}},render:({field:r})=>n(o,{gap:"tight",children:[i(Ke,{...r,type:"email",label:e("email","Email"),placeholder:e("emailPlaceholder","Enter your email"),autoComplete:"email webauthn",disabled:c||k,"aria-invalid":!!s.email,"aria-describedby":s.email?"email-error":void 0,className:"dndev-w-full","data-variant":s.email?"destructive":void 0}),s.email&&i(b,{as:"span",level:"caption",variant:"destructive",id:"email-error",role:"alert",children:s.email.message})]})}),i(W,{name:"password",control:R,rules:{required:e("passwordRequired","Password is required"),minLength:{value:8,message:e("passwordMinLength","Password must be at least 8 characters")},validate:w?{uppercase:r=>r?/[A-Z]/.test(r)?!0:e("passwordRequirement.uppercase","Password must contain at least one uppercase letter"):!0,lowercase:r=>r?/[a-z]/.test(r)?!0:e("passwordRequirement.lowercase","Password must contain at least one lowercase letter"):!0,number:r=>r?/[0-9]/.test(r)?!0:e("passwordRequirement.number","Password must contain at least one number"):!0,special:r=>r?/[^a-zA-Z0-9]/.test(r)?!0:e("passwordRequirement.special","Password must contain at least one special character"):!0,breached:async r=>!r||r.length<8?!0:await $e(r)?e("errors.breached_password","This password has appeared in a data breach. Please choose a different password."):!0}:void 0},render:({field:r})=>{const u=`password-${r.name}`;return n(o,{gap:"tight",children:[i(ce,{...r,id:u,label:e("password","Password"),placeholder:e("passwordPlaceholder","Enter your password"),autoComplete:w?"new-password":"current-password",disabled:c||k,"aria-invalid":!!s.password,"aria-describedby":s.password?"password-error":void 0,className:"dndev-w-full","data-variant":s.password?"destructive":void 0}),s.password&&i(b,{as:"span",level:"caption",variant:"destructive",id:"password-error",role:"alert",children:s.password.message})]})}}),w&&i(W,{name:"confirmPassword",control:R,rules:{required:e("confirmPasswordRequired","Please confirm your password"),validate:r=>{const u=Ce("password");return r!==u?e("confirmPasswordMismatch","Passwords do not match"):!0}},render:({field:r})=>n(o,{gap:"tight",children:[i(ce,{...r,label:e("confirmPassword","Confirm Password"),placeholder:e("confirmPasswordPlaceholder","Re-enter your password"),autoComplete:"new-password",disabled:c,"aria-invalid":!!s.confirmPassword,"aria-describedby":s.confirmPassword?"confirm-password-error":void 0,className:"dndev-w-full","data-variant":s.confirmPassword?"destructive":void 0}),s.confirmPassword&&i(b,{as:"span",level:"caption",variant:"destructive",id:"confirm-password-error",role:"alert",children:s.confirmPassword.message})]})}),w&&ae&&i(Ve,{password:ae,minLength:8,showRequirements:!0}),re&&n(te,{children:[n(o,{direction:"row",gap:"tight",align:"start",children:[i(oe,{id:"tos-accept",checked:K,onCheckedChange:r=>$(r===!0),disabled:c}),i(de,{htmlFor:"tos-accept",children:n(b,{as:"span",level:"caption",children:[e("terms.accept_prefix","I accept the")," ",C&&i(g,{type:"button",variant:f.LINK,onClick:()=>{z?G(!0):Y&&window.open(Y,"_blank","noopener,noreferrer")},className:"dndev-p-0 dndev-h-auto",style:{minHeight:"auto",padding:0,display:"inline"},children:e("terms.tos","Terms of Service")}),C&&S&&n(te,{children:[" ",e("terms.and","and")," "]}),S&&i(g,{type:"button",variant:f.LINK,onClick:()=>{Z?B(!0):J&&window.open(J,"_blank","noopener,noreferrer")},className:"dndev-p-0 dndev-h-auto",style:{minHeight:"auto",padding:0,display:"inline"},children:e("terms.privacy","Privacy Policy")})]})})]}),z&&i(le,{open:be,onOpenChange:G,title:e("terms.tos","Terms of Service"),showClose:!0,children:P}),Z&&i(le,{open:ke,onOpenChange:B,title:e("terms.privacy","Privacy Policy"),showClose:!0,children:_})]}),!w&&n(o,{direction:"row",gap:"tight",align:"center",children:[i(oe,{id:"remember-me",checked:q,onCheckedChange:r=>ye(r===!0),disabled:c||k}),i(de,{htmlFor:"remember-me",children:e("rememberMe","Remember me")})]}),i(g,{type:"submit",variant:f.PRIMARY,disabled:Ne,fullWidth:!0,children:c?e("loading","Loading..."):w?e("actions.sign_up_submit","Sign Up"):e("actions.sign_in_submit","Sign In")}),!w&&n(o,{direction:"row",gap:"tight",justify:"center",align:"center",children:[i(g,{type:"button",variant:f.LINK,disabled:c||k,onClick:Ie,children:k?e("loading","Loading..."):e("forgotPassword","Forgot password?")}),i(b,{as:"span",variant:"muted",children:"|"}),i(g,{type:"button",variant:f.LINK,disabled:c,onClick:()=>O("signup"),children:e("actions.sign_up_submit","Sign Up")})]}),w&&i(o,{align:"center",children:i(g,{type:"button",variant:f.LINK,disabled:c,onClick:()=>O("signin"),children:e("alreadyHaveAccount","Already have an account? Sign In")})})]})]})})}var Ze=ze;export{Ze as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as r,jsxs as o}from"react/jsx-runtime";import{useId as h}from"react";import{Card as
|
|
1
|
+
"use client";import{jsx as r,jsxs as o}from"react/jsx-runtime";import{useId as h}from"react";import{Card as y,Button as V,BUTTON_VARIANT as A,Alert as b,Spinner as M,Stack as d,Text as T}from"@donotdev/components";import{useTranslation as x,handleError as w}from"@donotdev/core";import{useAuth as n}from"../useAuth";function I({verifyButtonText:j,successMessage:k,sendingMessage:B,alreadyVerifiedMessage:E,notSignedInMessage:R,errorMessage:$,id:u}){const{t:e}=x("auth"),t=n("user"),i=n("emailVerification"),l=n("sendEmailVerification"),s=t?.id,c=h(),a=u||`email-verification-${c}`,f=`${a}-heading`,m=`${a}-button`,g=async()=>{if(!(!t||!s))try{await l()}catch(v){w(v)}};if(!t||!s)return null;const p=()=>{if(i.status!=="pending"&&i.status==="error")return"error"};return r(y,{id:a,title:r("span",{id:f,children:e("emailVerification.title")}),children:o(d,{children:[o(d,{direction:"row",justify:"between",align:"center",children:[r(T,{level:"small",variant:"muted",children:e("emailVerification.status.unknown")}),r(V,{id:m,onClick:g,disabled:i.status==="pending","aria-busy":i.status==="pending",variant:A.PRIMARY,icon:i.status==="pending"?r(M,{"aria-label":"Loading"}):void 0,iconEnd:!1,children:i.status==="pending"?e("status.verifying"):e("buttons.verify","Verify")})]}),i.status!=="verified"&&r(b,{variant:p(),title:i.status==="error"?e("aria.errorAlert"):e("status.verifying"),description:i.status==="error"?("error"in i?i.error:void 0)||e("emailVerification.error","An error occurred"):e("emailVerification.sending","Sending verification email...")})]})})}var S=I;export{S as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{Fragment as
|
|
1
|
+
"use client";import{Fragment as t,jsx as s}from"react/jsx-runtime";import{useImperativeHandle as o,forwardRef as i}from"react";import{hasTierAccess as f}from"@donotdev/core";import{useAuth as c}from"../useAuth";const p=i(({featureId:e,fallback:r=null,children:l},n)=>{const a=c("userSubscription")?.features?.includes(e)||!1;return o(n,()=>({enabled:a}),[a]),a?s(t,{children:l}):r?s(t,{children:r}):null}),m=i(({tier:e,fallback:r=null,children:l},n)=>{const a=c("userSubscription"),d=e||"pro",u=f(a?.tier,d);return o(n,()=>({enabled:u}),[u]),u?s(t,{children:l}):r?s(t,{children:r}):null}),h=i((e,r)=>s(m,{ref:r,tier:"pro",...e})),b=i((e,r)=>s(m,{ref:r,tier:"premium",...e}));export{p as Feature,b as PremiumFeature,h as ProFeature};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as r,jsxs as
|
|
1
|
+
"use client";import{jsx as r,jsxs as a,Fragment as w}from"react/jsx-runtime";import{Stack as f}from"@donotdev/components";import{hasRoleAccess as h,hasTierAccess as m}from"@donotdev/core";import{useAuth as t}from"../useAuth";import{AuthFallback as F}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:a(f,{direction:"row",align:"center",children:[r("span",{style:{color:"var(--accent)"},children:"\u{1F512}"}),a("div",{children:[r("p",{style:{fontWeight:500,fontSize:"var(--font-size-base)",color:"var(--foreground)"},children:e==="pro"?"Pro Feature":"Premium Feature"}),a("p",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:["Upgrade to ",e," to access this feature",i&&` (current: ${i})`]})]})]})})}function p({requiredRole:e,userRole:i}){const o=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:a(f,{direction:"row",align:"center",children:[r("span",{style:{color:"var(--destructive)"},children:"\u{1F6AB}"}),a("div",{children:[r("p",{style:{fontWeight:500,fontSize:"var(--font-size-base)",color:"var(--destructive-foreground)"},children:"Access Denied"}),a("p",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:["This feature requires ",o," 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:a(f,{direction:"row",align:"center",children:[r("span",{style:{color:"var(--accent)"},children:"\u23F0"}),a("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 y({children:e,role:i,tier:o,subscription:u,validate:n,fallback:s,message:l,showUpgradePrompt:A=!0,showLoginPrompt:S=!0}){const z=t("user"),R=t("loading"),q=t("userProfile"),v=t("userSubscription"),d=q?.role,c=v?.tier;return R?r("div",{style:{height:"2rem",borderRadius:"var(--radius)",backgroundColor:"var(--muted)",animation:"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite"}}):!z&&(i||o||u)?S?r(F,{message:l||"Please sign in to access this feature"}):null:i&&!(Array.isArray(i)?i:[i]).some(T=>h(d,T))?s?r(s,{requiredRole:i,userRole:d||void 0}):r(p,{requiredRole:i,userRole:d||void 0}):o&&!m(c,o)?s?r(s,{requiredTier:o,userTier:c||"free"}):A?r(g,{requiredTier:o,userTier:c||"free"}):null:u&&!v?.isActive?s?r(s,{requiresSubscription:!0,hasSubscription:v?.isActive||!1}):r(b,{}):n&&!n(d,c)?s?r(s,{userRole:d,userTier:c}):r(p,{userRole:d}):r(w,{children:e})}function P(e){const i=t("user"),o=t("userProfile"),u=t("userSubscription"),n=o?.role,s=u?.tier;return!(!i&&(e.role||e.tier||e.subscription)||e.role&&!(Array.isArray(e.role)?e.role:[e.role]).some(l=>h(n,l))||e.tier&&!m(s,e.tier)||e.subscription&&!u?.isActive||e.validate&&n&&s&&!e.validate(n,s))}function k(e,i){return o=>r(y,{...i,children:r(e,{...o})})}export{p as AccessDenied,y as FeatureGuard,b as SubscriptionExpired,g as UpgradePrompt,P as useCanAccessFeature,k as withFeatureGuard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsxs as
|
|
1
|
+
"use client";import{jsxs as o,jsx as s}from"react/jsx-runtime";import{cn as d}from"@donotdev/components";import{hasTierAccess as m}from"@donotdev/core";import{useAuth as i}from"../useAuth";function f({featureId:e,featureName:r,className:a="",children:t}){if(i("userSubscription")?.features?.includes(e))return null;const n=s("div",{className:d("dndev-surface",a),"data-variant":"muted","data-shadow":"none","data-radius":"lg",style:{padding:"var(--gap-md)",border:"1px dashed var(--border)",backgroundColor:"var(--muted)"},children:o("p",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)",textAlign:"center"},children:[r," is not available on your current plan."]})});return t||n}function u(e,r){return function({featureName:a,className:t="",children:n}){const l=i("userSubscription");if(m(l?.tier,e))return null;const c=s("div",{className:d("dndev-surface",t),"data-variant":"muted","data-shadow":"none","data-radius":"lg",style:{padding:"var(--gap-md)",border:"1px dashed var(--border)",backgroundColor:"var(--muted)"},children:o("p",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)",textAlign:"center"},children:[a," is only available on ",r," tier."]})});return n||c}}const p=u("pro","Pro"),v=u("premium","Premium");export{f as FeaturePlaceholder,v as PremiumFeaturePlaceholder,p as ProFeaturePlaceholder};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as
|
|
1
|
+
"use client";import{jsx as e,jsxs as S}from"react/jsx-runtime";import{Card as i,Spinner as w,Stack as I}from"@donotdev/components";import{useTranslation as N}from"@donotdev/core";import{useGoogleOneTap as T}from"../hooks/useGoogleOneTap";function z({clientId:s,onSuccess:l,onError:c,autoSelect:p=!0,cancelOnTapOutside:m=!0,className:g="",disabled:r=!1,promptParentId:h,allowedParentOrigins:a,cspNonce:u,clientOnly:n=!1,showErrorDetails:C=!1,loadingComponent:o,errorComponent:L,browserNotSupportedComponent:P}){const{t:v}=N("auth"),{shouldShow:f,isLoaded:j,isLoading:x,error:O,containerRef:y,fedcmSupported:d,isHydrated:t,browserInfo:E}=T({clientId:s,autoSelect:p,cancelOnTapOutside:m,promptParentId:h,disabled:r,onSuccess:l,onError:c,allowedParentOrigins:a,cspNonce:u,clientOnly:n});return r||!f||n&&!t?null:x?o?e("div",{className:"dndev-fixed",style:{right:"var(--gap-md)",zIndex:50,top:"calc(1rem + var(--header-height, 0px))"},children:e(i,{style:{padding:"var(--gap-md)"},children:e(o,{})})}):e("div",{className:"dndev-fixed",style:{right:"var(--gap-md)",zIndex:50,top:"calc(1rem + var(--header-height, 0px))"},children:e(i,{style:{padding:"var(--gap-md)"},children:S(I,{direction:"row",align:"center",children:[e(w,{}),e("span",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:v("googleOneTapLoading","Loading Google One Tap...")})]})})}):!d||O?null:e("div",{className:"dndev-fixed",style:{right:"var(--gap-md)",zIndex:50,top:"calc(1rem + var(--header-height, 0px))"},children:e("div",{ref:y,className:`google-one-tap-container ${g}`.trim(),"data-testid":"google-one-tap","data-fedcm-supported":d,"data-hydrated":t,...a&&{"data-allowed-parent-origins":a.join(",")}})})}var b=z;export{b as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t}from"react/jsx-runtime";import{Dialog as
|
|
1
|
+
"use client";import{jsx as t}from"react/jsx-runtime";import{Dialog as a}from"@donotdev/components";import{useTranslation as e}from"@donotdev/core";import{withAuthFallback as s}from"./AuthFallback";import r from"./MultipleAuthProviders";function p({open:n,onOpenChange:i}){const{t:o}=e("auth");return t(a,{open:n,onOpenChange:i,title:o("signIn","Sign In"),description:o("choosePlatform","Choose a platform to sign in with"),children:t(r,{layout:"vertical",showLabels:!0,method:"popup"})})}const m=s(p,{message:"Authentication is not configured",showLoginButton:!0});var l=m;export{l as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as a,jsxs as k}from"react/jsx-runtime";import{Suspense as S,lazy as $,useId as y}from"react";import{Alert as E,ALERT_VARIANT as P,Stack as c,Grid as T}from"@donotdev/components";import{useTranslation as j,getEnabledAuthPartners as C}from"@donotdev/core";import{useAuth as m}from"../useAuth";import{withAuthFallback as G}from"./AuthFallback";import M from"./AuthPartnerButton";import{getAuthMethod as O}from"../constants";import{useAccountLinking as q}from"../hooks/useAccountLinking";const B=$(()=>import("./AccountLinking")),F=({providers:h,containerClassName:e="",providerClassName:p="",method:g,size:_="md",layout:r="vertical",showLabels:f=!0,spacing:o="medium",ariaLabel:v,id:A,fullWidth:b=!0,onSuccess:N})=>{const{t:s}=j("auth"),w=y(),n=A||w,{isRequired:R}=q(),l=m("error"),x=m("isAvailable"),z=O(g),i=h||C();if(!i||i.length===0)return a("div",{className:e,children:a("p",{children:"No authentication providers are configured"})});const I=()=>{const d=i.map((t,L)=>a(M,{partnerId:t,method:z,className:`${p} ${b?"dndev-w-full":""}`,tabIndex:L===0?0:void 0,id:`${n}-${t}-button`,onSuccess:N,children:f?void 0:null},t));return r==="grid"?a(T,{cols:2,gap:o,className:e,children:d}):a(c,{direction:r==="horizontal"?"row":"column",wrap:r==="horizontal"?"wrap":void 0,gap:o,align:r==="horizontal"?"center":"stretch",className:e,children:d})};return k(c,{className:"dndev-mx-auto",id:n,role:"region","aria-label":v||s("aria.signInOptions","Sign in options"),children:[I(),l&&x&&a(E,{variant:P.ERROR,description:l.message||s("errorGeneric","Authentication failed. Please try again.")}),R&&a(S,{fallback:null,children:a(B,{})})]})},u=G(F,{message:"Authentication providers are not configured",showLoginButton:!0});var V=u;export{u as MultipleAuthProviders,V as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,jsxs as r}from"react/jsx-runtime";import{Alert as s,Button as l,BUTTON_VARIANT as u,Stack as c}from"@donotdev/components";import{useTranslation as f}from"@donotdev/core";import{useNetworkStatus as d}from"../hooks/useNetworkStatus";function
|
|
1
|
+
"use client";import{jsx as t,jsxs as r}from"react/jsx-runtime";import{Alert as s,Button as l,BUTTON_VARIANT as u,Stack as c}from"@donotdev/components";import{useTranslation as f}from"@donotdev/core";import{useNetworkStatus as d}from"../hooks/useNetworkStatus";function w({showWhenOnline:a=!1,className:i=""}){const{t:e}=f("auth"),{online:n,connectionType:o,isSlowConnection:h}=d();return n&&!a?null:t(s,{variant:n?void 0:"error",className:i,role:"status","aria-live":n?"polite":"assertive",title:n?e("networkStatus.online",{defaultValue:"You are online"}):e("networkStatus.offline",{defaultValue:"You are offline"}),description:n?t("span",{children:e("networkStatus.connectedVia",{connectionType:o||"unknown",defaultValue:`Connected via ${o||"unknown"}`})}):r(c,{children:[t("p",{children:e("networkStatus.offlineMessage",{defaultValue:"Authentication requires an internet connection. Please check your network settings."})}),t(l,{variant:u.GHOST,onClick:()=>{typeof window<"u"&&window.location.reload()},style:{fontSize:"var(--font-size-sm)",textDecoration:"underline",fontWeight:500},children:e("networkStatus.checkAgain",{defaultValue:"Check again"})})]})})}var k=w;export{k as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PasswordResetCallback.d.ts","sourceRoot":"","sources":["../../src/components/PasswordResetCallback.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PasswordResetCallback.d.ts","sourceRoot":"","sources":["../../src/components/PasswordResetCallback.tsx"],"names":[],"mappings":"AAoJA;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,mDAgXpC"}
|