@ezcoder.dev/sdk 1.0.0

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/analytics/index.d.ts +18 -0
  2. package/dist/analytics/index.js +76 -0
  3. package/dist/analytics/index.js.map +1 -0
  4. package/dist/animation/index.d.ts +172 -0
  5. package/dist/animation/index.js +81 -0
  6. package/dist/animation/index.js.map +1 -0
  7. package/dist/auth/index.d.ts +80 -0
  8. package/dist/auth/index.js +463 -0
  9. package/dist/auth/index.js.map +1 -0
  10. package/dist/chunk-5XIZHBKE.js +372 -0
  11. package/dist/chunk-5XIZHBKE.js.map +1 -0
  12. package/dist/chunk-G7XDUN3Z.js +141 -0
  13. package/dist/chunk-G7XDUN3Z.js.map +1 -0
  14. package/dist/chunk-YNDCD53D.js +212 -0
  15. package/dist/chunk-YNDCD53D.js.map +1 -0
  16. package/dist/cms/index.d.ts +44 -0
  17. package/dist/cms/index.js +106 -0
  18. package/dist/cms/index.js.map +1 -0
  19. package/dist/errors/index.d.ts +20 -0
  20. package/dist/errors/index.js +61 -0
  21. package/dist/errors/index.js.map +1 -0
  22. package/dist/index.d.ts +30 -0
  23. package/dist/index.js +21 -0
  24. package/dist/index.js.map +1 -0
  25. package/dist/notifications/index.d.ts +30 -0
  26. package/dist/notifications/index.js +191 -0
  27. package/dist/notifications/index.js.map +1 -0
  28. package/dist/payments/index.d.ts +89 -0
  29. package/dist/payments/index.js +408 -0
  30. package/dist/payments/index.js.map +1 -0
  31. package/dist/roles/index.d.ts +37 -0
  32. package/dist/roles/index.js +120 -0
  33. package/dist/roles/index.js.map +1 -0
  34. package/dist/seo/index.d.ts +39 -0
  35. package/dist/seo/index.js +89 -0
  36. package/dist/seo/index.js.map +1 -0
  37. package/dist/server/index.d.ts +72 -0
  38. package/dist/server/index.js +191 -0
  39. package/dist/server/index.js.map +1 -0
  40. package/dist/storage/index.d.ts +52 -0
  41. package/dist/storage/index.js +212 -0
  42. package/dist/storage/index.js.map +1 -0
  43. package/dist/types-DtY5lp3P.d.ts +90 -0
  44. package/package.json +105 -0
@@ -0,0 +1,463 @@
1
+ import {
2
+ AuthContext,
3
+ AuthProvider,
4
+ useAuth
5
+ } from "../chunk-YNDCD53D.js";
6
+ import "../chunk-5XIZHBKE.js";
7
+ import {
8
+ supabase
9
+ } from "../chunk-G7XDUN3Z.js";
10
+
11
+ // src/auth/ProtectedRoute.tsx
12
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
13
+ var TIER_LEVELS = {
14
+ free: 0,
15
+ starter: 1,
16
+ creator: 2,
17
+ pro: 3,
18
+ business: 4,
19
+ enterprise: 5
20
+ };
21
+ function DefaultLoadingSpinner() {
22
+ return /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", minHeight: "200px" }, children: [
23
+ /* @__PURE__ */ jsx("div", { style: {
24
+ width: "32px",
25
+ height: "32px",
26
+ border: "3px solid #e5e7eb",
27
+ borderTopColor: "#3b82f6",
28
+ borderRadius: "50%",
29
+ animation: "spin 0.6s linear infinite"
30
+ } }),
31
+ /* @__PURE__ */ jsx("style", { children: `@keyframes spin { to { transform: rotate(360deg); } }` })
32
+ ] });
33
+ }
34
+ function ProtectedRoute({
35
+ children,
36
+ requiredTier,
37
+ fallback,
38
+ loadingComponent,
39
+ allowUnconfigured = false,
40
+ loginPath = "/login"
41
+ }) {
42
+ const { user, profile, loading, isConfigured } = useAuth();
43
+ if (loading) {
44
+ return /* @__PURE__ */ jsx(Fragment, { children: loadingComponent || /* @__PURE__ */ jsx(DefaultLoadingSpinner, {}) });
45
+ }
46
+ if (!isConfigured && allowUnconfigured) {
47
+ return /* @__PURE__ */ jsx(Fragment, { children });
48
+ }
49
+ if (!user) {
50
+ if (fallback) return /* @__PURE__ */ jsx(Fragment, { children: fallback });
51
+ if (typeof window !== "undefined") {
52
+ window.location.href = loginPath;
53
+ }
54
+ return null;
55
+ }
56
+ if (requiredTier) {
57
+ const userTier = profile?.subscription_tier || "free";
58
+ const userLevel = TIER_LEVELS[userTier] ?? 0;
59
+ const requiredLevel = TIER_LEVELS[requiredTier] ?? 0;
60
+ if (userLevel < requiredLevel) {
61
+ return /* @__PURE__ */ jsxs("div", { style: { textAlign: "center", padding: "40px" }, children: [
62
+ /* @__PURE__ */ jsx("h2", { style: { fontSize: "1.5rem", fontWeight: 600, marginBottom: "8px" }, children: "Upgrade Required" }),
63
+ /* @__PURE__ */ jsxs("p", { style: { color: "#6b7280" }, children: [
64
+ "This feature requires the ",
65
+ requiredTier,
66
+ " plan or higher."
67
+ ] })
68
+ ] });
69
+ }
70
+ }
71
+ return /* @__PURE__ */ jsx(Fragment, { children });
72
+ }
73
+
74
+ // src/auth/LoginForm.tsx
75
+ import { useState } from "react";
76
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
77
+ function LoginForm({
78
+ onSuccess,
79
+ onForgotPassword,
80
+ onSignupClick,
81
+ showOAuth = true,
82
+ className = ""
83
+ }) {
84
+ const { signIn, signInWithProvider, isConfigured } = useAuth();
85
+ const [email, setEmail] = useState("");
86
+ const [password, setPassword] = useState("");
87
+ const [error, setError] = useState(null);
88
+ const [loading, setLoading] = useState(false);
89
+ const handleSubmit = async (e) => {
90
+ e.preventDefault();
91
+ setError(null);
92
+ setLoading(true);
93
+ const result = await signIn(email, password);
94
+ setLoading(false);
95
+ if (result.error) {
96
+ setError(result.error.message);
97
+ } else {
98
+ onSuccess?.();
99
+ }
100
+ };
101
+ const handleOAuth = async (provider) => {
102
+ setError(null);
103
+ const result = await signInWithProvider(provider);
104
+ if (result.error) {
105
+ setError(result.error.message);
106
+ }
107
+ };
108
+ if (!isConfigured) {
109
+ return /* @__PURE__ */ jsx2("div", { style: { padding: "20px", textAlign: "center", color: "#6b7280" }, children: "Authentication is not configured. Connect a database to enable login." });
110
+ }
111
+ return /* @__PURE__ */ jsxs2("div", { className, style: { maxWidth: "400px", margin: "0 auto" }, children: [
112
+ /* @__PURE__ */ jsx2("h2", { style: { fontSize: "1.5rem", fontWeight: 600, marginBottom: "24px", textAlign: "center" }, children: "Sign In" }),
113
+ error && /* @__PURE__ */ jsx2("div", { style: { padding: "12px", marginBottom: "16px", backgroundColor: "#fef2f2", color: "#dc2626", borderRadius: "8px", fontSize: "14px" }, children: error }),
114
+ /* @__PURE__ */ jsxs2("form", { onSubmit: handleSubmit, children: [
115
+ /* @__PURE__ */ jsxs2("div", { style: { marginBottom: "16px" }, children: [
116
+ /* @__PURE__ */ jsx2("label", { style: { display: "block", marginBottom: "4px", fontSize: "14px", fontWeight: 500 }, children: "Email" }),
117
+ /* @__PURE__ */ jsx2(
118
+ "input",
119
+ {
120
+ type: "email",
121
+ value: email,
122
+ onChange: (e) => setEmail(e.target.value),
123
+ required: true,
124
+ style: { width: "100%", padding: "8px 12px", border: "1px solid #d1d5db", borderRadius: "6px", fontSize: "14px" }
125
+ }
126
+ )
127
+ ] }),
128
+ /* @__PURE__ */ jsxs2("div", { style: { marginBottom: "16px" }, children: [
129
+ /* @__PURE__ */ jsx2("label", { style: { display: "block", marginBottom: "4px", fontSize: "14px", fontWeight: 500 }, children: "Password" }),
130
+ /* @__PURE__ */ jsx2(
131
+ "input",
132
+ {
133
+ type: "password",
134
+ value: password,
135
+ onChange: (e) => setPassword(e.target.value),
136
+ required: true,
137
+ style: { width: "100%", padding: "8px 12px", border: "1px solid #d1d5db", borderRadius: "6px", fontSize: "14px" }
138
+ }
139
+ )
140
+ ] }),
141
+ onForgotPassword && /* @__PURE__ */ jsx2("div", { style: { marginBottom: "16px", textAlign: "right" }, children: /* @__PURE__ */ jsx2("button", { type: "button", onClick: onForgotPassword, style: { background: "none", border: "none", color: "#3b82f6", cursor: "pointer", fontSize: "14px" }, children: "Forgot password?" }) }),
142
+ /* @__PURE__ */ jsx2(
143
+ "button",
144
+ {
145
+ type: "submit",
146
+ disabled: loading,
147
+ style: {
148
+ width: "100%",
149
+ padding: "10px",
150
+ backgroundColor: "#3b82f6",
151
+ color: "white",
152
+ border: "none",
153
+ borderRadius: "6px",
154
+ fontSize: "14px",
155
+ fontWeight: 500,
156
+ cursor: loading ? "not-allowed" : "pointer",
157
+ opacity: loading ? 0.7 : 1
158
+ },
159
+ children: loading ? "Signing in..." : "Sign In"
160
+ }
161
+ )
162
+ ] }),
163
+ showOAuth && /* @__PURE__ */ jsxs2("div", { style: { marginTop: "24px" }, children: [
164
+ /* @__PURE__ */ jsx2("div", { style: { textAlign: "center", color: "#9ca3af", fontSize: "14px", marginBottom: "16px" }, children: "or continue with" }),
165
+ /* @__PURE__ */ jsxs2("div", { style: { display: "flex", gap: "12px" }, children: [
166
+ /* @__PURE__ */ jsx2(
167
+ "button",
168
+ {
169
+ onClick: () => handleOAuth("google"),
170
+ style: { flex: 1, padding: "10px", border: "1px solid #d1d5db", borderRadius: "6px", background: "white", cursor: "pointer", fontSize: "14px" },
171
+ children: "Google"
172
+ }
173
+ ),
174
+ /* @__PURE__ */ jsx2(
175
+ "button",
176
+ {
177
+ onClick: () => handleOAuth("github"),
178
+ style: { flex: 1, padding: "10px", border: "1px solid #d1d5db", borderRadius: "6px", background: "white", cursor: "pointer", fontSize: "14px" },
179
+ children: "GitHub"
180
+ }
181
+ )
182
+ ] })
183
+ ] }),
184
+ onSignupClick && /* @__PURE__ */ jsxs2("div", { style: { marginTop: "24px", textAlign: "center", fontSize: "14px" }, children: [
185
+ "Don't have an account?",
186
+ " ",
187
+ /* @__PURE__ */ jsx2("button", { type: "button", onClick: onSignupClick, style: { background: "none", border: "none", color: "#3b82f6", cursor: "pointer", fontWeight: 500 }, children: "Sign up" })
188
+ ] })
189
+ ] });
190
+ }
191
+
192
+ // src/auth/SignupForm.tsx
193
+ import { useState as useState2 } from "react";
194
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
195
+ function SignupForm({
196
+ onSuccess,
197
+ onLoginClick,
198
+ showOAuth = true,
199
+ className = ""
200
+ }) {
201
+ const { signUp, signInWithProvider, isConfigured } = useAuth();
202
+ const [name, setName] = useState2("");
203
+ const [email, setEmail] = useState2("");
204
+ const [password, setPassword] = useState2("");
205
+ const [agreed, setAgreed] = useState2(false);
206
+ const [error, setError] = useState2(null);
207
+ const [success, setSuccess] = useState2(false);
208
+ const [loading, setLoading] = useState2(false);
209
+ const handleSubmit = async (e) => {
210
+ e.preventDefault();
211
+ if (!agreed) {
212
+ setError("Please agree to the Terms of Service");
213
+ return;
214
+ }
215
+ if (password.length < 8) {
216
+ setError("Password must be at least 8 characters");
217
+ return;
218
+ }
219
+ setError(null);
220
+ setLoading(true);
221
+ const result = await signUp(email, password, {
222
+ metadata: { display_name: name }
223
+ });
224
+ setLoading(false);
225
+ if (result.error) {
226
+ setError(result.error.message);
227
+ } else {
228
+ setSuccess(true);
229
+ onSuccess?.();
230
+ }
231
+ };
232
+ const handleOAuth = async (provider) => {
233
+ setError(null);
234
+ const result = await signInWithProvider(provider);
235
+ if (result.error) {
236
+ setError(result.error.message);
237
+ }
238
+ };
239
+ if (!isConfigured) {
240
+ return /* @__PURE__ */ jsx3("div", { style: { padding: "20px", textAlign: "center", color: "#6b7280" }, children: "Authentication is not configured. Connect a database to enable signup." });
241
+ }
242
+ if (success) {
243
+ return /* @__PURE__ */ jsxs3("div", { style: { padding: "20px", textAlign: "center" }, children: [
244
+ /* @__PURE__ */ jsx3("h3", { style: { fontSize: "1.25rem", fontWeight: 600, marginBottom: "8px", color: "#059669" }, children: "Check your email" }),
245
+ /* @__PURE__ */ jsxs3("p", { style: { color: "#6b7280" }, children: [
246
+ "We sent a confirmation link to ",
247
+ email
248
+ ] })
249
+ ] });
250
+ }
251
+ return /* @__PURE__ */ jsxs3("div", { className, style: { maxWidth: "400px", margin: "0 auto" }, children: [
252
+ /* @__PURE__ */ jsx3("h2", { style: { fontSize: "1.5rem", fontWeight: 600, marginBottom: "24px", textAlign: "center" }, children: "Create Account" }),
253
+ error && /* @__PURE__ */ jsx3("div", { style: { padding: "12px", marginBottom: "16px", backgroundColor: "#fef2f2", color: "#dc2626", borderRadius: "8px", fontSize: "14px" }, children: error }),
254
+ /* @__PURE__ */ jsxs3("form", { onSubmit: handleSubmit, children: [
255
+ /* @__PURE__ */ jsxs3("div", { style: { marginBottom: "16px" }, children: [
256
+ /* @__PURE__ */ jsx3("label", { style: { display: "block", marginBottom: "4px", fontSize: "14px", fontWeight: 500 }, children: "Name" }),
257
+ /* @__PURE__ */ jsx3(
258
+ "input",
259
+ {
260
+ type: "text",
261
+ value: name,
262
+ onChange: (e) => setName(e.target.value),
263
+ required: true,
264
+ style: { width: "100%", padding: "8px 12px", border: "1px solid #d1d5db", borderRadius: "6px", fontSize: "14px" }
265
+ }
266
+ )
267
+ ] }),
268
+ /* @__PURE__ */ jsxs3("div", { style: { marginBottom: "16px" }, children: [
269
+ /* @__PURE__ */ jsx3("label", { style: { display: "block", marginBottom: "4px", fontSize: "14px", fontWeight: 500 }, children: "Email" }),
270
+ /* @__PURE__ */ jsx3(
271
+ "input",
272
+ {
273
+ type: "email",
274
+ value: email,
275
+ onChange: (e) => setEmail(e.target.value),
276
+ required: true,
277
+ style: { width: "100%", padding: "8px 12px", border: "1px solid #d1d5db", borderRadius: "6px", fontSize: "14px" }
278
+ }
279
+ )
280
+ ] }),
281
+ /* @__PURE__ */ jsxs3("div", { style: { marginBottom: "16px" }, children: [
282
+ /* @__PURE__ */ jsx3("label", { style: { display: "block", marginBottom: "4px", fontSize: "14px", fontWeight: 500 }, children: "Password" }),
283
+ /* @__PURE__ */ jsx3(
284
+ "input",
285
+ {
286
+ type: "password",
287
+ value: password,
288
+ onChange: (e) => setPassword(e.target.value),
289
+ required: true,
290
+ minLength: 8,
291
+ style: { width: "100%", padding: "8px 12px", border: "1px solid #d1d5db", borderRadius: "6px", fontSize: "14px" }
292
+ }
293
+ ),
294
+ /* @__PURE__ */ jsx3("span", { style: { fontSize: "12px", color: "#9ca3af" }, children: "Minimum 8 characters" })
295
+ ] }),
296
+ /* @__PURE__ */ jsx3("div", { style: { marginBottom: "16px" }, children: /* @__PURE__ */ jsxs3("label", { style: { display: "flex", alignItems: "center", gap: "8px", fontSize: "14px", cursor: "pointer" }, children: [
297
+ /* @__PURE__ */ jsx3("input", { type: "checkbox", checked: agreed, onChange: (e) => setAgreed(e.target.checked) }),
298
+ "I agree to the Terms of Service and Privacy Policy"
299
+ ] }) }),
300
+ /* @__PURE__ */ jsx3(
301
+ "button",
302
+ {
303
+ type: "submit",
304
+ disabled: loading,
305
+ style: {
306
+ width: "100%",
307
+ padding: "10px",
308
+ backgroundColor: "#3b82f6",
309
+ color: "white",
310
+ border: "none",
311
+ borderRadius: "6px",
312
+ fontSize: "14px",
313
+ fontWeight: 500,
314
+ cursor: loading ? "not-allowed" : "pointer",
315
+ opacity: loading ? 0.7 : 1
316
+ },
317
+ children: loading ? "Creating account..." : "Create Account"
318
+ }
319
+ )
320
+ ] }),
321
+ showOAuth && /* @__PURE__ */ jsxs3("div", { style: { marginTop: "24px" }, children: [
322
+ /* @__PURE__ */ jsx3("div", { style: { textAlign: "center", color: "#9ca3af", fontSize: "14px", marginBottom: "16px" }, children: "or continue with" }),
323
+ /* @__PURE__ */ jsxs3("div", { style: { display: "flex", gap: "12px" }, children: [
324
+ /* @__PURE__ */ jsx3(
325
+ "button",
326
+ {
327
+ onClick: () => handleOAuth("google"),
328
+ style: { flex: 1, padding: "10px", border: "1px solid #d1d5db", borderRadius: "6px", background: "white", cursor: "pointer", fontSize: "14px" },
329
+ children: "Google"
330
+ }
331
+ ),
332
+ /* @__PURE__ */ jsx3(
333
+ "button",
334
+ {
335
+ onClick: () => handleOAuth("github"),
336
+ style: { flex: 1, padding: "10px", border: "1px solid #d1d5db", borderRadius: "6px", background: "white", cursor: "pointer", fontSize: "14px" },
337
+ children: "GitHub"
338
+ }
339
+ )
340
+ ] })
341
+ ] }),
342
+ onLoginClick && /* @__PURE__ */ jsxs3("div", { style: { marginTop: "24px", textAlign: "center", fontSize: "14px" }, children: [
343
+ "Already have an account?",
344
+ " ",
345
+ /* @__PURE__ */ jsx3("button", { type: "button", onClick: onLoginClick, style: { background: "none", border: "none", color: "#3b82f6", cursor: "pointer", fontWeight: 500 }, children: "Sign in" })
346
+ ] })
347
+ ] });
348
+ }
349
+
350
+ // src/auth/ForgotPasswordForm.tsx
351
+ import { useState as useState3 } from "react";
352
+ import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
353
+ function ForgotPasswordForm({ onBack, className = "" }) {
354
+ const { resetPassword } = useAuth();
355
+ const [email, setEmail] = useState3("");
356
+ const [error, setError] = useState3(null);
357
+ const [success, setSuccess] = useState3(false);
358
+ const [loading, setLoading] = useState3(false);
359
+ const handleSubmit = async (e) => {
360
+ e.preventDefault();
361
+ setError(null);
362
+ setLoading(true);
363
+ const result = await resetPassword(email);
364
+ setLoading(false);
365
+ if (result.error) {
366
+ setError(result.error.message);
367
+ } else {
368
+ setSuccess(true);
369
+ }
370
+ };
371
+ if (success) {
372
+ return /* @__PURE__ */ jsxs4("div", { className, style: { maxWidth: "400px", margin: "0 auto", textAlign: "center", padding: "20px" }, children: [
373
+ /* @__PURE__ */ jsx4("h3", { style: { fontSize: "1.25rem", fontWeight: 600, marginBottom: "8px", color: "#059669" }, children: "Check your email" }),
374
+ /* @__PURE__ */ jsxs4("p", { style: { color: "#6b7280", marginBottom: "16px" }, children: [
375
+ "We sent a password reset link to ",
376
+ email
377
+ ] }),
378
+ onBack && /* @__PURE__ */ jsx4("button", { type: "button", onClick: onBack, style: { background: "none", border: "none", color: "#3b82f6", cursor: "pointer", fontSize: "14px" }, children: "Back to login" })
379
+ ] });
380
+ }
381
+ return /* @__PURE__ */ jsxs4("div", { className, style: { maxWidth: "400px", margin: "0 auto" }, children: [
382
+ /* @__PURE__ */ jsx4("h2", { style: { fontSize: "1.5rem", fontWeight: 600, marginBottom: "8px", textAlign: "center" }, children: "Reset Password" }),
383
+ /* @__PURE__ */ jsx4("p", { style: { color: "#6b7280", textAlign: "center", marginBottom: "24px", fontSize: "14px" }, children: "Enter your email and we'll send you a reset link" }),
384
+ error && /* @__PURE__ */ jsx4("div", { style: { padding: "12px", marginBottom: "16px", backgroundColor: "#fef2f2", color: "#dc2626", borderRadius: "8px", fontSize: "14px" }, children: error }),
385
+ /* @__PURE__ */ jsxs4("form", { onSubmit: handleSubmit, children: [
386
+ /* @__PURE__ */ jsxs4("div", { style: { marginBottom: "16px" }, children: [
387
+ /* @__PURE__ */ jsx4("label", { style: { display: "block", marginBottom: "4px", fontSize: "14px", fontWeight: 500 }, children: "Email" }),
388
+ /* @__PURE__ */ jsx4(
389
+ "input",
390
+ {
391
+ type: "email",
392
+ value: email,
393
+ onChange: (e) => setEmail(e.target.value),
394
+ required: true,
395
+ style: { width: "100%", padding: "8px 12px", border: "1px solid #d1d5db", borderRadius: "6px", fontSize: "14px" }
396
+ }
397
+ )
398
+ ] }),
399
+ /* @__PURE__ */ jsx4(
400
+ "button",
401
+ {
402
+ type: "submit",
403
+ disabled: loading,
404
+ style: {
405
+ width: "100%",
406
+ padding: "10px",
407
+ backgroundColor: "#3b82f6",
408
+ color: "white",
409
+ border: "none",
410
+ borderRadius: "6px",
411
+ fontSize: "14px",
412
+ fontWeight: 500,
413
+ cursor: loading ? "not-allowed" : "pointer",
414
+ opacity: loading ? 0.7 : 1
415
+ },
416
+ children: loading ? "Sending..." : "Send Reset Link"
417
+ }
418
+ )
419
+ ] }),
420
+ onBack && /* @__PURE__ */ jsx4("div", { style: { marginTop: "16px", textAlign: "center" }, children: /* @__PURE__ */ jsx4("button", { type: "button", onClick: onBack, style: { background: "none", border: "none", color: "#3b82f6", cursor: "pointer", fontSize: "14px" }, children: "Back to login" }) })
421
+ ] });
422
+ }
423
+
424
+ // src/auth/AuthCallback.tsx
425
+ import { useEffect, useState as useState4 } from "react";
426
+ import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
427
+ function AuthCallback({ redirectTo = "/", loadingComponent }) {
428
+ const [error, setError] = useState4(null);
429
+ useEffect(() => {
430
+ const handleCallback = async () => {
431
+ try {
432
+ const { error: error2 } = await supabase.auth.getSession();
433
+ if (error2) {
434
+ setError(error2.message);
435
+ return;
436
+ }
437
+ window.location.href = redirectTo;
438
+ } catch (err) {
439
+ setError(err instanceof Error ? err.message : "Authentication callback failed");
440
+ }
441
+ };
442
+ handleCallback();
443
+ }, [redirectTo]);
444
+ if (error) {
445
+ return /* @__PURE__ */ jsxs5("div", { style: { textAlign: "center", padding: "40px" }, children: [
446
+ /* @__PURE__ */ jsx5("h2", { style: { color: "#dc2626", marginBottom: "8px" }, children: "Authentication Error" }),
447
+ /* @__PURE__ */ jsx5("p", { style: { color: "#6b7280" }, children: error }),
448
+ /* @__PURE__ */ jsx5("a", { href: "/login", style: { color: "#3b82f6", marginTop: "16px", display: "inline-block" }, children: "Back to login" })
449
+ ] });
450
+ }
451
+ return /* @__PURE__ */ jsx5(Fragment2, { children: loadingComponent || /* @__PURE__ */ jsx5("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", minHeight: "200px" }, children: /* @__PURE__ */ jsx5("p", { style: { color: "#6b7280" }, children: "Completing authentication..." }) }) });
452
+ }
453
+ export {
454
+ AuthCallback,
455
+ AuthContext,
456
+ AuthProvider,
457
+ ForgotPasswordForm,
458
+ LoginForm,
459
+ ProtectedRoute,
460
+ SignupForm,
461
+ useAuth
462
+ };
463
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/auth/ProtectedRoute.tsx","../../src/auth/LoginForm.tsx","../../src/auth/SignupForm.tsx","../../src/auth/ForgotPasswordForm.tsx","../../src/auth/AuthCallback.tsx"],"sourcesContent":["import { useAuth } from './AuthProvider';\nimport type { SubscriptionTier } from '../core/types';\n\ninterface ProtectedRouteProps {\n children: React.ReactNode;\n requiredRoles?: string[];\n requiredTier?: SubscriptionTier;\n fallback?: React.ReactNode;\n unauthorizedFallback?: React.ReactNode;\n allowUnconfigured?: boolean;\n loadingComponent?: React.ReactNode;\n loginPath?: string;\n}\n\nconst TIER_LEVELS: Record<string, number> = {\n free: 0,\n starter: 1,\n creator: 2,\n pro: 3,\n business: 4,\n enterprise: 5,\n};\n\nfunction DefaultLoadingSpinner() {\n return (\n <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', minHeight: '200px' }}>\n <div style={{\n width: '32px', height: '32px',\n border: '3px solid #e5e7eb', borderTopColor: '#3b82f6',\n borderRadius: '50%',\n animation: 'spin 0.6s linear infinite',\n }} />\n <style>{`@keyframes spin { to { transform: rotate(360deg); } }`}</style>\n </div>\n );\n}\n\nexport function ProtectedRoute({\n children,\n requiredTier,\n fallback,\n loadingComponent,\n allowUnconfigured = false,\n loginPath = '/login',\n}: ProtectedRouteProps) {\n const { user, profile, loading, isConfigured } = useAuth();\n\n if (loading) {\n return <>{loadingComponent || <DefaultLoadingSpinner />}</>;\n }\n\n if (!isConfigured && allowUnconfigured) {\n return <>{children}</>;\n }\n\n if (!user) {\n if (fallback) return <>{fallback}</>;\n if (typeof window !== 'undefined') {\n window.location.href = loginPath;\n }\n return null;\n }\n\n if (requiredTier) {\n const userTier = profile?.subscription_tier || 'free';\n const userLevel = TIER_LEVELS[userTier] ?? 0;\n const requiredLevel = TIER_LEVELS[requiredTier] ?? 0;\n\n if (userLevel < requiredLevel) {\n return (\n <div style={{ textAlign: 'center', padding: '40px' }}>\n <h2 style={{ fontSize: '1.5rem', fontWeight: 600, marginBottom: '8px' }}>Upgrade Required</h2>\n <p style={{ color: '#6b7280' }}>\n This feature requires the {requiredTier} plan or higher.\n </p>\n </div>\n );\n }\n }\n\n return <>{children}</>;\n}\n","import { useState } from 'react';\nimport { useAuth } from './AuthProvider';\n\ninterface LoginFormProps {\n onSuccess?: () => void;\n onForgotPassword?: () => void;\n onSignupClick?: () => void;\n showOAuth?: boolean;\n className?: string;\n}\n\nexport function LoginForm({\n onSuccess,\n onForgotPassword,\n onSignupClick,\n showOAuth = true,\n className = '',\n}: LoginFormProps) {\n const { signIn, signInWithProvider, isConfigured } = useAuth();\n const [email, setEmail] = useState('');\n const [password, setPassword] = useState('');\n const [error, setError] = useState<string | null>(null);\n const [loading, setLoading] = useState(false);\n\n const handleSubmit = async (e: React.FormEvent) => {\n e.preventDefault();\n setError(null);\n setLoading(true);\n\n const result = await signIn(email, password);\n setLoading(false);\n\n if (result.error) {\n setError(result.error.message);\n } else {\n onSuccess?.();\n }\n };\n\n const handleOAuth = async (provider: string) => {\n setError(null);\n const result = await signInWithProvider(provider);\n if (result.error) {\n setError(result.error.message);\n }\n };\n\n if (!isConfigured) {\n return (\n <div style={{ padding: '20px', textAlign: 'center', color: '#6b7280' }}>\n Authentication is not configured. Connect a database to enable login.\n </div>\n );\n }\n\n return (\n <div className={className} style={{ maxWidth: '400px', margin: '0 auto' }}>\n <h2 style={{ fontSize: '1.5rem', fontWeight: 600, marginBottom: '24px', textAlign: 'center' }}>\n Sign In\n </h2>\n\n {error && (\n <div style={{ padding: '12px', marginBottom: '16px', backgroundColor: '#fef2f2', color: '#dc2626', borderRadius: '8px', fontSize: '14px' }}>\n {error}\n </div>\n )}\n\n <form onSubmit={handleSubmit}>\n <div style={{ marginBottom: '16px' }}>\n <label style={{ display: 'block', marginBottom: '4px', fontSize: '14px', fontWeight: 500 }}>Email</label>\n <input\n type=\"email\"\n value={email}\n onChange={(e) => setEmail(e.target.value)}\n required\n style={{ width: '100%', padding: '8px 12px', border: '1px solid #d1d5db', borderRadius: '6px', fontSize: '14px' }}\n />\n </div>\n\n <div style={{ marginBottom: '16px' }}>\n <label style={{ display: 'block', marginBottom: '4px', fontSize: '14px', fontWeight: 500 }}>Password</label>\n <input\n type=\"password\"\n value={password}\n onChange={(e) => setPassword(e.target.value)}\n required\n style={{ width: '100%', padding: '8px 12px', border: '1px solid #d1d5db', borderRadius: '6px', fontSize: '14px' }}\n />\n </div>\n\n {onForgotPassword && (\n <div style={{ marginBottom: '16px', textAlign: 'right' }}>\n <button type=\"button\" onClick={onForgotPassword} style={{ background: 'none', border: 'none', color: '#3b82f6', cursor: 'pointer', fontSize: '14px' }}>\n Forgot password?\n </button>\n </div>\n )}\n\n <button\n type=\"submit\"\n disabled={loading}\n style={{\n width: '100%', padding: '10px', backgroundColor: '#3b82f6', color: 'white',\n border: 'none', borderRadius: '6px', fontSize: '14px', fontWeight: 500,\n cursor: loading ? 'not-allowed' : 'pointer', opacity: loading ? 0.7 : 1,\n }}\n >\n {loading ? 'Signing in...' : 'Sign In'}\n </button>\n </form>\n\n {showOAuth && (\n <div style={{ marginTop: '24px' }}>\n <div style={{ textAlign: 'center', color: '#9ca3af', fontSize: '14px', marginBottom: '16px' }}>or continue with</div>\n <div style={{ display: 'flex', gap: '12px' }}>\n <button\n onClick={() => handleOAuth('google')}\n style={{ flex: 1, padding: '10px', border: '1px solid #d1d5db', borderRadius: '6px', background: 'white', cursor: 'pointer', fontSize: '14px' }}\n >\n Google\n </button>\n <button\n onClick={() => handleOAuth('github')}\n style={{ flex: 1, padding: '10px', border: '1px solid #d1d5db', borderRadius: '6px', background: 'white', cursor: 'pointer', fontSize: '14px' }}\n >\n GitHub\n </button>\n </div>\n </div>\n )}\n\n {onSignupClick && (\n <div style={{ marginTop: '24px', textAlign: 'center', fontSize: '14px' }}>\n Don&apos;t have an account?{' '}\n <button type=\"button\" onClick={onSignupClick} style={{ background: 'none', border: 'none', color: '#3b82f6', cursor: 'pointer', fontWeight: 500 }}>\n Sign up\n </button>\n </div>\n )}\n </div>\n );\n}\n","import { useState } from 'react';\nimport { useAuth } from './AuthProvider';\n\ninterface SignupFormProps {\n onSuccess?: () => void;\n onLoginClick?: () => void;\n showOAuth?: boolean;\n className?: string;\n}\n\nexport function SignupForm({\n onSuccess,\n onLoginClick,\n showOAuth = true,\n className = '',\n}: SignupFormProps) {\n const { signUp, signInWithProvider, isConfigured } = useAuth();\n const [name, setName] = useState('');\n const [email, setEmail] = useState('');\n const [password, setPassword] = useState('');\n const [agreed, setAgreed] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const [success, setSuccess] = useState(false);\n const [loading, setLoading] = useState(false);\n\n const handleSubmit = async (e: React.FormEvent) => {\n e.preventDefault();\n if (!agreed) {\n setError('Please agree to the Terms of Service');\n return;\n }\n if (password.length < 8) {\n setError('Password must be at least 8 characters');\n return;\n }\n\n setError(null);\n setLoading(true);\n\n const result = await signUp(email, password, {\n metadata: { display_name: name },\n });\n setLoading(false);\n\n if (result.error) {\n setError(result.error.message);\n } else {\n setSuccess(true);\n onSuccess?.();\n }\n };\n\n const handleOAuth = async (provider: string) => {\n setError(null);\n const result = await signInWithProvider(provider);\n if (result.error) {\n setError(result.error.message);\n }\n };\n\n if (!isConfigured) {\n return (\n <div style={{ padding: '20px', textAlign: 'center', color: '#6b7280' }}>\n Authentication is not configured. Connect a database to enable signup.\n </div>\n );\n }\n\n if (success) {\n return (\n <div style={{ padding: '20px', textAlign: 'center' }}>\n <h3 style={{ fontSize: '1.25rem', fontWeight: 600, marginBottom: '8px', color: '#059669' }}>Check your email</h3>\n <p style={{ color: '#6b7280' }}>We sent a confirmation link to {email}</p>\n </div>\n );\n }\n\n return (\n <div className={className} style={{ maxWidth: '400px', margin: '0 auto' }}>\n <h2 style={{ fontSize: '1.5rem', fontWeight: 600, marginBottom: '24px', textAlign: 'center' }}>\n Create Account\n </h2>\n\n {error && (\n <div style={{ padding: '12px', marginBottom: '16px', backgroundColor: '#fef2f2', color: '#dc2626', borderRadius: '8px', fontSize: '14px' }}>\n {error}\n </div>\n )}\n\n <form onSubmit={handleSubmit}>\n <div style={{ marginBottom: '16px' }}>\n <label style={{ display: 'block', marginBottom: '4px', fontSize: '14px', fontWeight: 500 }}>Name</label>\n <input type=\"text\" value={name} onChange={(e) => setName(e.target.value)} required\n style={{ width: '100%', padding: '8px 12px', border: '1px solid #d1d5db', borderRadius: '6px', fontSize: '14px' }} />\n </div>\n\n <div style={{ marginBottom: '16px' }}>\n <label style={{ display: 'block', marginBottom: '4px', fontSize: '14px', fontWeight: 500 }}>Email</label>\n <input type=\"email\" value={email} onChange={(e) => setEmail(e.target.value)} required\n style={{ width: '100%', padding: '8px 12px', border: '1px solid #d1d5db', borderRadius: '6px', fontSize: '14px' }} />\n </div>\n\n <div style={{ marginBottom: '16px' }}>\n <label style={{ display: 'block', marginBottom: '4px', fontSize: '14px', fontWeight: 500 }}>Password</label>\n <input type=\"password\" value={password} onChange={(e) => setPassword(e.target.value)} required minLength={8}\n style={{ width: '100%', padding: '8px 12px', border: '1px solid #d1d5db', borderRadius: '6px', fontSize: '14px' }} />\n <span style={{ fontSize: '12px', color: '#9ca3af' }}>Minimum 8 characters</span>\n </div>\n\n <div style={{ marginBottom: '16px' }}>\n <label style={{ display: 'flex', alignItems: 'center', gap: '8px', fontSize: '14px', cursor: 'pointer' }}>\n <input type=\"checkbox\" checked={agreed} onChange={(e) => setAgreed(e.target.checked)} />\n I agree to the Terms of Service and Privacy Policy\n </label>\n </div>\n\n <button type=\"submit\" disabled={loading}\n style={{\n width: '100%', padding: '10px', backgroundColor: '#3b82f6', color: 'white',\n border: 'none', borderRadius: '6px', fontSize: '14px', fontWeight: 500,\n cursor: loading ? 'not-allowed' : 'pointer', opacity: loading ? 0.7 : 1,\n }}>\n {loading ? 'Creating account...' : 'Create Account'}\n </button>\n </form>\n\n {showOAuth && (\n <div style={{ marginTop: '24px' }}>\n <div style={{ textAlign: 'center', color: '#9ca3af', fontSize: '14px', marginBottom: '16px' }}>or continue with</div>\n <div style={{ display: 'flex', gap: '12px' }}>\n <button onClick={() => handleOAuth('google')}\n style={{ flex: 1, padding: '10px', border: '1px solid #d1d5db', borderRadius: '6px', background: 'white', cursor: 'pointer', fontSize: '14px' }}>\n Google\n </button>\n <button onClick={() => handleOAuth('github')}\n style={{ flex: 1, padding: '10px', border: '1px solid #d1d5db', borderRadius: '6px', background: 'white', cursor: 'pointer', fontSize: '14px' }}>\n GitHub\n </button>\n </div>\n </div>\n )}\n\n {onLoginClick && (\n <div style={{ marginTop: '24px', textAlign: 'center', fontSize: '14px' }}>\n Already have an account?{' '}\n <button type=\"button\" onClick={onLoginClick} style={{ background: 'none', border: 'none', color: '#3b82f6', cursor: 'pointer', fontWeight: 500 }}>\n Sign in\n </button>\n </div>\n )}\n </div>\n );\n}\n","import { useState } from 'react';\nimport { useAuth } from './AuthProvider';\n\ninterface ForgotPasswordFormProps {\n onBack?: () => void;\n className?: string;\n}\n\nexport function ForgotPasswordForm({ onBack, className = '' }: ForgotPasswordFormProps) {\n const { resetPassword } = useAuth();\n const [email, setEmail] = useState('');\n const [error, setError] = useState<string | null>(null);\n const [success, setSuccess] = useState(false);\n const [loading, setLoading] = useState(false);\n\n const handleSubmit = async (e: React.FormEvent) => {\n e.preventDefault();\n setError(null);\n setLoading(true);\n\n const result = await resetPassword(email);\n setLoading(false);\n\n if (result.error) {\n setError(result.error.message);\n } else {\n setSuccess(true);\n }\n };\n\n if (success) {\n return (\n <div className={className} style={{ maxWidth: '400px', margin: '0 auto', textAlign: 'center', padding: '20px' }}>\n <h3 style={{ fontSize: '1.25rem', fontWeight: 600, marginBottom: '8px', color: '#059669' }}>Check your email</h3>\n <p style={{ color: '#6b7280', marginBottom: '16px' }}>We sent a password reset link to {email}</p>\n {onBack && (\n <button type=\"button\" onClick={onBack} style={{ background: 'none', border: 'none', color: '#3b82f6', cursor: 'pointer', fontSize: '14px' }}>\n Back to login\n </button>\n )}\n </div>\n );\n }\n\n return (\n <div className={className} style={{ maxWidth: '400px', margin: '0 auto' }}>\n <h2 style={{ fontSize: '1.5rem', fontWeight: 600, marginBottom: '8px', textAlign: 'center' }}>Reset Password</h2>\n <p style={{ color: '#6b7280', textAlign: 'center', marginBottom: '24px', fontSize: '14px' }}>\n Enter your email and we&apos;ll send you a reset link\n </p>\n\n {error && (\n <div style={{ padding: '12px', marginBottom: '16px', backgroundColor: '#fef2f2', color: '#dc2626', borderRadius: '8px', fontSize: '14px' }}>\n {error}\n </div>\n )}\n\n <form onSubmit={handleSubmit}>\n <div style={{ marginBottom: '16px' }}>\n <label style={{ display: 'block', marginBottom: '4px', fontSize: '14px', fontWeight: 500 }}>Email</label>\n <input type=\"email\" value={email} onChange={(e) => setEmail(e.target.value)} required\n style={{ width: '100%', padding: '8px 12px', border: '1px solid #d1d5db', borderRadius: '6px', fontSize: '14px' }} />\n </div>\n\n <button type=\"submit\" disabled={loading}\n style={{\n width: '100%', padding: '10px', backgroundColor: '#3b82f6', color: 'white',\n border: 'none', borderRadius: '6px', fontSize: '14px', fontWeight: 500,\n cursor: loading ? 'not-allowed' : 'pointer', opacity: loading ? 0.7 : 1,\n }}>\n {loading ? 'Sending...' : 'Send Reset Link'}\n </button>\n </form>\n\n {onBack && (\n <div style={{ marginTop: '16px', textAlign: 'center' }}>\n <button type=\"button\" onClick={onBack} style={{ background: 'none', border: 'none', color: '#3b82f6', cursor: 'pointer', fontSize: '14px' }}>\n Back to login\n </button>\n </div>\n )}\n </div>\n );\n}\n","import { useEffect, useState } from 'react';\nimport { supabase } from '../core/supabase';\n\ninterface AuthCallbackProps {\n redirectTo?: string;\n loadingComponent?: React.ReactNode;\n}\n\nexport function AuthCallback({ redirectTo = '/', loadingComponent }: AuthCallbackProps) {\n const [error, setError] = useState<string | null>(null);\n\n useEffect(() => {\n const handleCallback = async () => {\n try {\n const { error } = await supabase.auth.getSession();\n if (error) {\n setError(error.message);\n return;\n }\n window.location.href = redirectTo;\n } catch (err: unknown) {\n setError(err instanceof Error ? err.message : 'Authentication callback failed');\n }\n };\n\n handleCallback();\n }, [redirectTo]);\n\n if (error) {\n return (\n <div style={{ textAlign: 'center', padding: '40px' }}>\n <h2 style={{ color: '#dc2626', marginBottom: '8px' }}>Authentication Error</h2>\n <p style={{ color: '#6b7280' }}>{error}</p>\n <a href=\"/login\" style={{ color: '#3b82f6', marginTop: '16px', display: 'inline-block' }}>\n Back to login\n </a>\n </div>\n );\n }\n\n return (\n <>\n {loadingComponent || (\n <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', minHeight: '200px' }}>\n <p style={{ color: '#6b7280' }}>Completing authentication...</p>\n </div>\n )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