@fayz-ai/plugin-auth 0.8.0 → 0.9.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs DELETED
@@ -1,399 +0,0 @@
1
- 'use strict';
2
-
3
- var auth = require('@fayz-ai/auth');
4
- var React = require('react');
5
- var jsxRuntime = require('react/jsx-runtime');
6
-
7
- function _interopNamespace(e) {
8
- if (e && e.__esModule) return e;
9
- var n = Object.create(null);
10
- if (e) {
11
- Object.keys(e).forEach(function (k) {
12
- if (k !== 'default') {
13
- var d = Object.getOwnPropertyDescriptor(e, k);
14
- Object.defineProperty(n, k, d.get ? d : {
15
- enumerable: true,
16
- get: function () { return e[k]; }
17
- });
18
- }
19
- });
20
- }
21
- n.default = e;
22
- return Object.freeze(n);
23
- }
24
-
25
- var React__namespace = /*#__PURE__*/_interopNamespace(React);
26
-
27
- // src/runtime.ts
28
- function absoluteUrl(path) {
29
- if (typeof window === "undefined") return void 0;
30
- if (/^https?:\/\//.test(path)) return path;
31
- return `${window.location.origin}${path.startsWith("/") ? path : `/${path}`}`;
32
- }
33
- function resolveAuthAdapter(options = {}) {
34
- const configured = options.adapter ?? options.provider;
35
- if (configured && typeof configured === "object") return configured;
36
- const provider = configured ?? (options.supabase?.url ? "supabase" : "mock");
37
- if (provider === "supabase") {
38
- const url = options.supabase?.url;
39
- const anonKey = options.supabase?.anonKey;
40
- if (!url || !anonKey) {
41
- throw new Error('plugin-auth provider="supabase" requires supabase.url and supabase.anonKey.');
42
- }
43
- return auth.createSupabaseAuthAdapter({
44
- supabaseUrl: url,
45
- supabaseAnonKey: anonKey,
46
- supabaseClient: options.supabase?.client,
47
- callbackUrl: options.supabase?.callbackUrl ?? absoluteUrl(options.routes?.callback ?? "/auth/callback"),
48
- resetPasswordUrl: options.supabase?.resetPasswordUrl ?? absoluteUrl(options.routes?.resetPassword ?? "/auth/reset-password")
49
- });
50
- }
51
- return auth.createMockAuthAdapter();
52
- }
53
- function createAuthRuntime(options = {}) {
54
- return {
55
- kind: "auth",
56
- adapter: resolveAuthAdapter(options),
57
- requireAuth: options.requireAuth ?? true,
58
- layout: options.layout ?? "split",
59
- logo: options.logo,
60
- tagline: options.tagline,
61
- description: options.description,
62
- oauth: {
63
- enabled: options.oauth?.enabled ?? false,
64
- providers: options.oauth?.providers ?? ["google"]
65
- },
66
- routes: {
67
- login: options.routes?.login ?? "/login",
68
- callback: options.routes?.callback ?? "/auth/callback",
69
- resetPassword: options.routes?.resetPassword ?? "/auth/reset-password",
70
- afterSignIn: options.routes?.afterSignIn ?? "/"
71
- }
72
- };
73
- }
74
- function createAuthPlugin(options = {}) {
75
- return createAuthRuntime(options);
76
- }
77
- function providerLabel(provider) {
78
- return provider.charAt(0).toUpperCase() + provider.slice(1);
79
- }
80
- function fieldClass() {
81
- return "h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm outline-none focus:ring-2 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50";
82
- }
83
- function buttonClass(variant = "primary") {
84
- if (variant === "outline") {
85
- return "inline-flex h-10 w-full items-center justify-center rounded-md border border-input bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-muted disabled:pointer-events-none disabled:opacity-50";
86
- }
87
- if (variant === "ghost") return "text-sm font-medium text-primary hover:underline";
88
- return "inline-flex h-10 w-full items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90 disabled:pointer-events-none disabled:opacity-50";
89
- }
90
- function OAuthButtons({ providers = ["google"], disabled, onProviderClick }) {
91
- const { signInWithOAuth } = auth.useAuth();
92
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-2", children: providers.map((provider) => /* @__PURE__ */ jsxRuntime.jsxs(
93
- "button",
94
- {
95
- type: "button",
96
- className: buttonClass("outline"),
97
- disabled,
98
- onClick: () => {
99
- void (onProviderClick ? onProviderClick(provider) : signInWithOAuth(provider));
100
- },
101
- children: [
102
- "Continue with ",
103
- providerLabel(provider)
104
- ]
105
- },
106
- provider
107
- )) });
108
- }
109
- function LoginForm({ onSuccess, onForgotPassword, showOAuth, oauthProviders }) {
110
- const { signIn, error, isLoading } = auth.useAuth();
111
- const [email, setEmail] = React__namespace.useState("");
112
- const [password, setPassword] = React__namespace.useState("");
113
- const [busy, setBusy] = React__namespace.useState(false);
114
- const disabled = busy || isLoading;
115
- async function submit(event) {
116
- event.preventDefault();
117
- setBusy(true);
118
- try {
119
- await signIn(email, password);
120
- onSuccess?.();
121
- } finally {
122
- setBusy(false);
123
- }
124
- }
125
- return /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: submit, className: "space-y-4", children: [
126
- /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "block space-y-1.5 text-sm font-medium", children: [
127
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Email" }),
128
- /* @__PURE__ */ jsxRuntime.jsx("input", { className: fieldClass(), type: "email", autoComplete: "username", required: true, value: email, onChange: (e) => setEmail(e.target.value), disabled })
129
- ] }),
130
- /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "block space-y-1.5 text-sm font-medium", children: [
131
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Password" }),
132
- /* @__PURE__ */ jsxRuntime.jsx("input", { className: fieldClass(), type: "password", autoComplete: "current-password", required: true, value: password, onChange: (e) => setPassword(e.target.value), disabled })
133
- ] }),
134
- onForgotPassword && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "-mt-1 flex justify-end", children: /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: buttonClass("ghost"), onClick: onForgotPassword, children: "Forgot password?" }) }),
135
- error && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-destructive", children: error.message }),
136
- /* @__PURE__ */ jsxRuntime.jsx("button", { className: buttonClass(), type: "submit", disabled, children: disabled ? "Signing in..." : "Sign in" }),
137
- showOAuth && /* @__PURE__ */ jsxRuntime.jsx(OAuthButtons, { providers: oauthProviders, disabled })
138
- ] });
139
- }
140
- function SignupForm({ onSuccess }) {
141
- const { signUp, error, isLoading } = auth.useAuth();
142
- const [fullName, setFullName] = React__namespace.useState("");
143
- const [email, setEmail] = React__namespace.useState("");
144
- const [password, setPassword] = React__namespace.useState("");
145
- const [confirmPassword, setConfirmPassword] = React__namespace.useState("");
146
- const [localError, setLocalError] = React__namespace.useState(null);
147
- const [busy, setBusy] = React__namespace.useState(false);
148
- const disabled = busy || isLoading;
149
- async function submit(event) {
150
- event.preventDefault();
151
- setLocalError(null);
152
- if (password.length < 8) {
153
- setLocalError("Password must be at least 8 characters.");
154
- return;
155
- }
156
- if (password !== confirmPassword) {
157
- setLocalError("Passwords do not match.");
158
- return;
159
- }
160
- setBusy(true);
161
- try {
162
- await signUp(email, password, fullName);
163
- onSuccess?.();
164
- } finally {
165
- setBusy(false);
166
- }
167
- }
168
- return /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: submit, className: "space-y-4", children: [
169
- /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "block space-y-1.5 text-sm font-medium", children: [
170
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Full name" }),
171
- /* @__PURE__ */ jsxRuntime.jsx("input", { className: fieldClass(), required: true, value: fullName, onChange: (e) => setFullName(e.target.value), disabled })
172
- ] }),
173
- /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "block space-y-1.5 text-sm font-medium", children: [
174
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Email" }),
175
- /* @__PURE__ */ jsxRuntime.jsx("input", { className: fieldClass(), type: "email", autoComplete: "username", required: true, value: email, onChange: (e) => setEmail(e.target.value), disabled })
176
- ] }),
177
- /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "block space-y-1.5 text-sm font-medium", children: [
178
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Password" }),
179
- /* @__PURE__ */ jsxRuntime.jsx("input", { className: fieldClass(), type: "password", autoComplete: "new-password", required: true, value: password, onChange: (e) => setPassword(e.target.value), disabled })
180
- ] }),
181
- /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "block space-y-1.5 text-sm font-medium", children: [
182
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Confirm password" }),
183
- /* @__PURE__ */ jsxRuntime.jsx("input", { className: fieldClass(), type: "password", autoComplete: "new-password", required: true, value: confirmPassword, onChange: (e) => setConfirmPassword(e.target.value), disabled })
184
- ] }),
185
- (localError || error) && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-destructive", children: localError ?? error?.message }),
186
- /* @__PURE__ */ jsxRuntime.jsx("button", { className: buttonClass(), type: "submit", disabled, children: disabled ? "Creating account..." : "Create account" })
187
- ] });
188
- }
189
- function ForgotPasswordForm({ redirectTo, onSent, onBackToLogin }) {
190
- const { resetPassword, error, isLoading } = auth.useAuth();
191
- const [email, setEmail] = React__namespace.useState("");
192
- const [sent, setSent] = React__namespace.useState(false);
193
- const [busy, setBusy] = React__namespace.useState(false);
194
- const disabled = busy || isLoading;
195
- async function submit(event) {
196
- event.preventDefault();
197
- setBusy(true);
198
- try {
199
- await resetPassword(email, { redirectTo });
200
- setSent(true);
201
- onSent?.(email);
202
- } finally {
203
- setBusy(false);
204
- }
205
- }
206
- return /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: submit, className: "space-y-4", children: [
207
- /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "block space-y-1.5 text-sm font-medium", children: [
208
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Email" }),
209
- /* @__PURE__ */ jsxRuntime.jsx("input", { className: fieldClass(), type: "email", autoComplete: "username", required: true, value: email, onChange: (e) => setEmail(e.target.value), disabled })
210
- ] }),
211
- error && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-destructive", children: error.message }),
212
- sent && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-emerald-600", children: "Password reset instructions sent." }),
213
- /* @__PURE__ */ jsxRuntime.jsx("button", { className: buttonClass(), type: "submit", disabled, children: disabled ? "Sending..." : "Send reset link" }),
214
- onBackToLogin && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: buttonClass("ghost"), onClick: onBackToLogin, children: "Back to login" })
215
- ] });
216
- }
217
- function ResetPasswordForm({ onSuccess }) {
218
- const { updatePassword, error, isLoading } = auth.useAuth();
219
- const [password, setPassword] = React__namespace.useState("");
220
- const [confirmPassword, setConfirmPassword] = React__namespace.useState("");
221
- const [localError, setLocalError] = React__namespace.useState(null);
222
- const [busy, setBusy] = React__namespace.useState(false);
223
- const disabled = busy || isLoading;
224
- async function submit(event) {
225
- event.preventDefault();
226
- setLocalError(null);
227
- if (password.length < 8) {
228
- setLocalError("Password must be at least 8 characters.");
229
- return;
230
- }
231
- if (password !== confirmPassword) {
232
- setLocalError("Passwords do not match.");
233
- return;
234
- }
235
- setBusy(true);
236
- try {
237
- await updatePassword(password);
238
- onSuccess?.();
239
- } finally {
240
- setBusy(false);
241
- }
242
- }
243
- return /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: submit, className: "space-y-4", children: [
244
- /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "block space-y-1.5 text-sm font-medium", children: [
245
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "New password" }),
246
- /* @__PURE__ */ jsxRuntime.jsx("input", { className: fieldClass(), type: "password", autoComplete: "new-password", required: true, value: password, onChange: (e) => setPassword(e.target.value), disabled })
247
- ] }),
248
- /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "block space-y-1.5 text-sm font-medium", children: [
249
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Confirm password" }),
250
- /* @__PURE__ */ jsxRuntime.jsx("input", { className: fieldClass(), type: "password", autoComplete: "new-password", required: true, value: confirmPassword, onChange: (e) => setConfirmPassword(e.target.value), disabled })
251
- ] }),
252
- (localError || error) && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-destructive", children: localError ?? error?.message }),
253
- /* @__PURE__ */ jsxRuntime.jsx("button", { className: buttonClass(), type: "submit", disabled, children: disabled ? "Saving..." : "Update password" })
254
- ] });
255
- }
256
- function LoginPage({
257
- appName = "App",
258
- logo,
259
- loginLogo,
260
- layout = "split",
261
- tagline,
262
- description,
263
- showOAuth,
264
- oauthProviders,
265
- resetPasswordUrl,
266
- onSuccess
267
- }) {
268
- const [view, setView] = React__namespace.useState("login");
269
- const brandLogo = loginLogo ?? logo;
270
- const heading = view === "login" ? "Welcome back" : view === "signup" ? "Create account" : "Reset password";
271
- const subtitle = view === "login" ? "Enter your credentials to continue" : view === "signup" ? "Create your account to get started" : "Enter your email and we will send reset instructions";
272
- const form = view === "login" ? /* @__PURE__ */ jsxRuntime.jsx(
273
- LoginForm,
274
- {
275
- onSuccess,
276
- onForgotPassword: () => setView("recovery"),
277
- showOAuth,
278
- oauthProviders
279
- }
280
- ) : view === "signup" ? /* @__PURE__ */ jsxRuntime.jsx(SignupForm, { onSuccess }) : /* @__PURE__ */ jsxRuntime.jsx(ForgotPasswordForm, { redirectTo: resetPasswordUrl, onBackToLogin: () => setView("login") });
281
- const switcher = view === "login" ? /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-center text-sm text-muted-foreground", children: [
282
- "Do not have an account?",
283
- " ",
284
- /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "font-medium text-primary hover:underline", onClick: () => setView("signup"), children: "Sign up" })
285
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-center text-sm text-muted-foreground", children: [
286
- view === "signup" ? "Already have an account?" : "Remembered your password?",
287
- " ",
288
- /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "font-medium text-primary hover:underline", onClick: () => setView("login"), children: "Sign in" })
289
- ] });
290
- if (layout === "centered") {
291
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex min-h-screen items-center justify-center bg-sidebar p-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full max-w-md rounded-2xl border border-border/50 bg-card p-8 shadow-2xl sm:p-10", children: [
292
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-8 text-center", children: [
293
- brandLogo && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-4 flex justify-center", children: brandLogo }),
294
- /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-2xl font-bold text-foreground", children: heading }),
295
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: subtitle })
296
- ] }),
297
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-6", children: [
298
- form,
299
- switcher
300
- ] })
301
- ] }) });
302
- }
303
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-h-screen bg-sidebar", children: [
304
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative hidden w-1/2 overflow-hidden lg:block", children: [
305
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 bg-gradient-to-br from-sidebar-accent/50 via-transparent to-sidebar/80" }),
306
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative flex h-full flex-col justify-end p-12", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
307
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-sidebar-muted", children: appName }),
308
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-3xl font-bold text-sidebar-foreground", children: tagline ?? `Welcome to ${appName}` }),
309
- description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "max-w-md text-sm leading-relaxed text-sidebar-muted", children: description })
310
- ] }) })
311
- ] }),
312
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-1 flex-col lg:p-3 lg:pl-3", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-1 flex-col justify-center bg-background px-6 py-12 lg:rounded-[1.25rem] lg:px-16", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mx-auto w-full max-w-sm", children: [
313
- brandLogo && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-8", children: brandLogo }),
314
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-8", children: [
315
- /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-2xl font-bold text-foreground", children: heading }),
316
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: subtitle })
317
- ] }),
318
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-6", children: [
319
- form,
320
- switcher
321
- ] })
322
- ] }) }) })
323
- ] });
324
- }
325
- function AuthGate({ requireAuth = true, loadingFallback, children, ...loginProps }) {
326
- const { isAuthenticated, isLoading } = auth.useAuth();
327
- if (!requireAuth || isAuthenticated) return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
328
- if (isLoading) {
329
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: loadingFallback ?? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex min-h-screen items-center justify-center bg-background", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-muted-foreground", children: "Loading..." }) }) });
330
- }
331
- return /* @__PURE__ */ jsxRuntime.jsx(LoginPage, { ...loginProps });
332
- }
333
- function AuthCallbackPage({ onSuccess, onError }) {
334
- const { handleCallback } = auth.useAuth();
335
- const [error, setError] = React__namespace.useState(null);
336
- React__namespace.useEffect(() => {
337
- let cancelled = false;
338
- handleCallback(typeof window === "undefined" ? void 0 : window.location.href).then(() => {
339
- if (!cancelled) onSuccess?.();
340
- }).catch((err) => {
341
- const errorObject = err instanceof Error ? err : new Error(String(err));
342
- if (!cancelled) {
343
- setError(errorObject.message);
344
- onError?.(errorObject);
345
- }
346
- });
347
- return () => {
348
- cancelled = true;
349
- };
350
- }, [handleCallback, onError, onSuccess]);
351
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex min-h-screen items-center justify-center bg-background p-6 text-center", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
352
- /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-xl font-semibold text-foreground", children: error ? "Authentication failed" : "Completing sign in..." }),
353
- error && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-2 text-sm text-destructive", children: error })
354
- ] }) });
355
- }
356
- function ResetPasswordPage({ onSuccess }) {
357
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex min-h-screen items-center justify-center bg-background p-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full max-w-md rounded-2xl border bg-card p-8 shadow-xl", children: [
358
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-6", children: [
359
- /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-2xl font-bold text-foreground", children: "Update password" }),
360
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: "Choose a new password for your account." })
361
- ] }),
362
- /* @__PURE__ */ jsxRuntime.jsx(ResetPasswordForm, { onSuccess })
363
- ] }) });
364
- }
365
-
366
- Object.defineProperty(exports, "AuthProvider", {
367
- enumerable: true,
368
- get: function () { return auth.AuthProvider; }
369
- });
370
- Object.defineProperty(exports, "createMockAuthAdapter", {
371
- enumerable: true,
372
- get: function () { return auth.createMockAuthAdapter; }
373
- });
374
- Object.defineProperty(exports, "createSupabaseAuthAdapter", {
375
- enumerable: true,
376
- get: function () { return auth.createSupabaseAuthAdapter; }
377
- });
378
- Object.defineProperty(exports, "useAuth", {
379
- enumerable: true,
380
- get: function () { return auth.useAuth; }
381
- });
382
- Object.defineProperty(exports, "useAuthStore", {
383
- enumerable: true,
384
- get: function () { return auth.useAuthStore; }
385
- });
386
- exports.AuthCallbackPage = AuthCallbackPage;
387
- exports.AuthGate = AuthGate;
388
- exports.ForgotPasswordForm = ForgotPasswordForm;
389
- exports.LoginForm = LoginForm;
390
- exports.LoginPage = LoginPage;
391
- exports.OAuthButtons = OAuthButtons;
392
- exports.ResetPasswordForm = ResetPasswordForm;
393
- exports.ResetPasswordPage = ResetPasswordPage;
394
- exports.SignupForm = SignupForm;
395
- exports.createAuthPlugin = createAuthPlugin;
396
- exports.createAuthRuntime = createAuthRuntime;
397
- exports.resolveAuthAdapter = resolveAuthAdapter;
398
- //# sourceMappingURL=index.cjs.map
399
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/runtime.ts","../src/forms.tsx","../src/pages.tsx"],"names":["createSupabaseAuthAdapter","createMockAuthAdapter","useAuth","jsxs","React","jsx","React2","Fragment"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,SAAS,YAAY,IAAA,EAAkC;AACrD,EAAA,IAAI,OAAO,MAAA,KAAW,WAAA,EAAa,OAAO,MAAA;AAC1C,EAAA,IAAI,cAAA,CAAe,IAAA,CAAK,IAAI,CAAA,EAAG,OAAO,IAAA;AACtC,EAAA,OAAO,CAAA,EAAG,MAAA,CAAO,QAAA,CAAS,MAAM,CAAA,EAAG,IAAA,CAAK,UAAA,CAAW,GAAG,CAAA,GAAI,IAAA,GAAO,CAAA,CAAA,EAAI,IAAI,CAAA,CAAE,CAAA,CAAA;AAC7E;AAEO,SAAS,kBAAA,CAAmB,OAAA,GAA6B,EAAC,EAAgB;AAC/E,EAAA,MAAM,UAAA,GAAa,OAAA,CAAQ,OAAA,IAAW,OAAA,CAAQ,QAAA;AAC9C,EAAA,IAAI,UAAA,IAAc,OAAO,UAAA,KAAe,QAAA,EAAU,OAAO,UAAA;AAEzD,EAAA,MAAM,QAAA,GAAW,UAAA,KAAe,OAAA,CAAQ,QAAA,EAAU,MAAM,UAAA,GAAa,MAAA,CAAA;AACrE,EAAA,IAAI,aAAa,UAAA,EAAY;AAC3B,IAAA,MAAM,GAAA,GAAM,QAAQ,QAAA,EAAU,GAAA;AAC9B,IAAA,MAAM,OAAA,GAAU,QAAQ,QAAA,EAAU,OAAA;AAClC,IAAA,IAAI,CAAC,GAAA,IAAO,CAAC,OAAA,EAAS;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AG,CAAC,cAAA,EAAgB,OAAA,EAAS,SAAS,CAAC,CAAA;AAEvC,EAAA,uBACED,cAAAA,CAAC,KAAA,EAAA,EAAI,WAAU,6EAAA,EACb,QAAA,kBAAAF,gBAAC,KAAA,EAAA,EACC,QAAA,EAAA;AAAA,oBAAAE,eAAC,IAAA,EAAA,EAAG,SAAA,EAAU,uCAAA,EAAyC,QAAA,EAAA,KAAA,GAAQ,0BAA0B,uBAAA,EAAwB,CAAA;AAAA,IAChH,yBAASA,cAAAA,CAAC,GAAA,EAAA,EAAE,SAAA,EAAU,iCAAiC,QAAA,EAAA,KAAA,EAAM;AAAA,GAAA,EAChE,CAAA,EACF,CAAA;AAEJ;AAMO,SAAS,iBAAA,CAAkB,EAAE,SAAA,EAAU,EAA2B;AACvE,EAAA,uBACEA,eAAC,KAAA,EAAA,EAAI,SAAA,EAAU,mEACb,QAAA,kBAAAF,eAAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,0DAAA,EACb,QAAA,EAAA;AAAA,oBAAAA,eAAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,MAAA,EACb,QAAA,EAAA;AAAA,sBAAAE,cAAAA,CAAC,IAAA,EAAA,EAAG,SAAA,EAAU,oCAAA,EAAqC,QAAA,EAAA,iBAAA,EAAe,CAAA;AAAA,sBAClEA,cAAAA,CAAC,GAAA,EAAA,EAAE,SAAA,EAAU,sCAAqC,QAAA,EAAA,yCAAA,EAAuC;AAAA,KAAA,EAC3F,CAAA;AAAA,oBACAA,cAAAA,CAAC,iBAAA,EAAA,EAAkB,SAAA,EAAsB;AAAA,GAAA,EAC3C,CAAA,EACF,CAAA;AAEJ","file":"index.cjs","sourcesContent":["import type { AuthAdapter } from '@fayz-ai/core'\nimport { createMockAuthAdapter, createSupabaseAuthAdapter } from '@fayz-ai/auth'\nimport type { AuthPluginOptions, ResolvedAuthPlugin } from './types'\n\nfunction absoluteUrl(path: string): string | undefined {\n if (typeof window === 'undefined') return undefined\n if (/^https?:\\/\\//.test(path)) return path\n return `${window.location.origin}${path.startsWith('/') ? path : `/${path}`}`\n}\n\nexport function resolveAuthAdapter(options: AuthPluginOptions = {}): AuthAdapter {\n const configured = options.adapter ?? options.provider\n if (configured && typeof configured === 'object') return configured\n\n const provider = configured ?? (options.supabase?.url ? 'supabase' : 'mock')\n if (provider === 'supabase') {\n const url = options.supabase?.url\n const anonKey = options.supabase?.anonKey\n if (!url || !anonKey) {\n throw new Error('plugin-auth provider=\"supabase\" requires supabase.url and supabase.anonKey.')\n }\n return createSupabaseAuthAdapter({\n supabaseUrl: url,\n supabaseAnonKey: anonKey,\n supabaseClient: options.supabase?.client,\n callbackUrl: options.supabase?.callbackUrl ?? absoluteUrl(options.routes?.callback ?? '/auth/callback'),\n resetPasswordUrl:\n options.supabase?.resetPasswordUrl ?? absoluteUrl(options.routes?.resetPassword ?? '/auth/reset-password'),\n })\n }\n\n return createMockAuthAdapter()\n}\n\nexport function createAuthRuntime(options: AuthPluginOptions = {}): ResolvedAuthPlugin {\n return {\n kind: 'auth',\n adapter: resolveAuthAdapter(options),\n requireAuth: options.requireAuth ?? true,\n layout: options.layout ?? 'split',\n logo: options.logo,\n tagline: options.tagline,\n description: options.description,\n oauth: {\n enabled: options.oauth?.enabled ?? false,\n providers: options.oauth?.providers ?? ['google'],\n },\n routes: {\n login: options.routes?.login ?? '/login',\n callback: options.routes?.callback ?? '/auth/callback',\n resetPassword: options.routes?.resetPassword ?? '/auth/reset-password',\n afterSignIn: options.routes?.afterSignIn ?? '/',\n },\n }\n}\n\nexport function createAuthPlugin(options: AuthPluginOptions = {}): ResolvedAuthPlugin {\n return createAuthRuntime(options)\n}\n","import * as React from 'react'\nimport { useAuth } from '@fayz-ai/auth'\nimport type { AuthProvider } from '@fayz-ai/core'\n\nfunction providerLabel(provider: string): string {\n return provider.charAt(0).toUpperCase() + provider.slice(1)\n}\n\nfunction fieldClass() {\n return 'h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm outline-none focus:ring-2 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50'\n}\n\nfunction buttonClass(variant: 'primary' | 'outline' | 'ghost' = 'primary') {\n if (variant === 'outline') {\n return 'inline-flex h-10 w-full items-center justify-center rounded-md border border-input bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-muted disabled:pointer-events-none disabled:opacity-50'\n }\n if (variant === 'ghost') return 'text-sm font-medium text-primary hover:underline'\n return 'inline-flex h-10 w-full items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90 disabled:pointer-events-none disabled:opacity-50'\n}\n\nexport interface OAuthButtonsProps {\n providers?: Exclude<AuthProvider, 'email'>[]\n disabled?: boolean\n onProviderClick?: (provider: AuthProvider) => void | Promise<void>\n}\n\nexport function OAuthButtons({ providers = ['google'], disabled, onProviderClick }: OAuthButtonsProps) {\n const { signInWithOAuth } = useAuth()\n return (\n <div className=\"space-y-2\">\n {providers.map((provider) => (\n <button\n key={provider}\n type=\"button\"\n className={buttonClass('outline')}\n disabled={disabled}\n onClick={() => {\n void (onProviderClick ? onProviderClick(provider) : signInWithOAuth(provider))\n }}\n >\n Continue with {providerLabel(provider)}\n </button>\n ))}\n </div>\n )\n}\n\nexport interface LoginFormProps {\n onSuccess?: () => void\n onForgotPassword?: () => void\n showOAuth?: boolean\n oauthProviders?: Exclude<AuthProvider, 'email'>[]\n}\n\nexport function LoginForm({ onSuccess, onForgotPassword, showOAuth, oauthProviders }: LoginFormProps) {\n const { signIn, error, isLoading } = useAuth()\n const [email, setEmail] = React.useState('')\n const [password, setPassword] = React.useState('')\n const [busy, setBusy] = React.useState(false)\n const disabled = busy || isLoading\n\n async function submit(event: React.FormEvent) {\n event.preventDefault()\n setBusy(true)\n try {\n await signIn(email, password)\n onSuccess?.()\n } finally {\n setBusy(false)\n }\n }\n\n return (\n <form onSubmit={submit} className=\"space-y-4\">\n <label className=\"block space-y-1.5 text-sm font-medium\">\n <span>Email</span>\n <input className={fieldClass()} type=\"email\" autoComplete=\"username\" required value={email} onChange={(e) => setEmail(e.target.value)} disabled={disabled} />\n </label>\n <label className=\"block space-y-1.5 text-sm font-medium\">\n <span>Password</span>\n <input className={fieldClass()} type=\"password\" autoComplete=\"current-password\" required value={password} onChange={(e) => setPassword(e.target.value)} disabled={disabled} />\n </label>\n {onForgotPassword && (\n <div className=\"-mt-1 flex justify-end\">\n <button type=\"button\" className={buttonClass('ghost')} onClick={onForgotPassword}>\n Forgot password?\n </button>\n </div>\n )}\n {error && <p className=\"text-sm text-destructive\">{error.message}</p>}\n <button className={buttonClass()} type=\"submit\" disabled={disabled}>\n {disabled ? 'Signing in...' : 'Sign in'}\n </button>\n {showOAuth && <OAuthButtons providers={oauthProviders} disabled={disabled} />}\n </form>\n )\n}\n\nexport interface SignupFormProps {\n onSuccess?: () => void\n}\n\nexport function SignupForm({ onSuccess }: SignupFormProps) {\n const { signUp, error, isLoading } = useAuth()\n const [fullName, setFullName] = React.useState('')\n const [email, setEmail] = React.useState('')\n const [password, setPassword] = React.useState('')\n const [confirmPassword, setConfirmPassword] = React.useState('')\n const [localError, setLocalError] = React.useState<string | null>(null)\n const [busy, setBusy] = React.useState(false)\n const disabled = busy || isLoading\n\n async function submit(event: React.FormEvent) {\n event.preventDefault()\n setLocalError(null)\n if (password.length < 8) {\n setLocalError('Password must be at least 8 characters.')\n return\n }\n if (password !== confirmPassword) {\n setLocalError('Passwords do not match.')\n return\n }\n setBusy(true)\n try {\n await signUp(email, password, fullName)\n onSuccess?.()\n } finally {\n setBusy(false)\n }\n }\n\n return (\n <form onSubmit={submit} className=\"space-y-4\">\n <label className=\"block space-y-1.5 text-sm font-medium\">\n <span>Full name</span>\n <input className={fieldClass()} required value={fullName} onChange={(e) => setFullName(e.target.value)} disabled={disabled} />\n </label>\n <label className=\"block space-y-1.5 text-sm font-medium\">\n <span>Email</span>\n <input className={fieldClass()} type=\"email\" autoComplete=\"username\" required value={email} onChange={(e) => setEmail(e.target.value)} disabled={disabled} />\n </label>\n <label className=\"block space-y-1.5 text-sm font-medium\">\n <span>Password</span>\n <input className={fieldClass()} type=\"password\" autoComplete=\"new-password\" required value={password} onChange={(e) => setPassword(e.target.value)} disabled={disabled} />\n </label>\n <label className=\"block space-y-1.5 text-sm font-medium\">\n <span>Confirm password</span>\n <input className={fieldClass()} type=\"password\" autoComplete=\"new-password\" required value={confirmPassword} onChange={(e) => setConfirmPassword(e.target.value)} disabled={disabled} />\n </label>\n {(localError || error) && <p className=\"text-sm text-destructive\">{localError ?? error?.message}</p>}\n <button className={buttonClass()} type=\"submit\" disabled={disabled}>\n {disabled ? 'Creating account...' : 'Create account'}\n </button>\n </form>\n )\n}\n\nexport interface ForgotPasswordFormProps {\n redirectTo?: string\n onSent?: (email: string) => void\n onBackToLogin?: () => void\n}\n\nexport function ForgotPasswordForm({ redirectTo, onSent, onBackToLogin }: ForgotPasswordFormProps) {\n const { resetPassword, error, isLoading } = useAuth()\n const [email, setEmail] = React.useState('')\n const [sent, setSent] = React.useState(false)\n const [busy, setBusy] = React.useState(false)\n const disabled = busy || isLoading\n\n async function submit(event: React.FormEvent) {\n event.preventDefault()\n setBusy(true)\n try {\n await resetPassword(email, { redirectTo })\n setSent(true)\n onSent?.(email)\n } finally {\n setBusy(false)\n }\n }\n\n return (\n <form onSubmit={submit} className=\"space-y-4\">\n <label className=\"block space-y-1.5 text-sm font-medium\">\n <span>Email</span>\n <input className={fieldClass()} type=\"email\" autoComplete=\"username\" required value={email} onChange={(e) => setEmail(e.target.value)} disabled={disabled} />\n </label>\n {error && <p className=\"text-sm text-destructive\">{error.message}</p>}\n {sent && <p className=\"text-sm text-emerald-600\">Password reset instructions sent.</p>}\n <button className={buttonClass()} type=\"submit\" disabled={disabled}>\n {disabled ? 'Sending...' : 'Send reset link'}\n </button>\n {onBackToLogin && (\n <button type=\"button\" className={buttonClass('ghost')} onClick={onBackToLogin}>\n Back to login\n </button>\n )}\n </form>\n )\n}\n\nexport interface ResetPasswordFormProps {\n onSuccess?: () => void\n}\n\nexport function ResetPasswordForm({ onSuccess }: ResetPasswordFormProps) {\n const { updatePassword, error, isLoading } = useAuth()\n const [password, setPassword] = React.useState('')\n const [confirmPassword, setConfirmPassword] = React.useState('')\n const [localError, setLocalError] = React.useState<string | null>(null)\n const [busy, setBusy] = React.useState(false)\n const disabled = busy || isLoading\n\n async function submit(event: React.FormEvent) {\n event.preventDefault()\n setLocalError(null)\n if (password.length < 8) {\n setLocalError('Password must be at least 8 characters.')\n return\n }\n if (password !== confirmPassword) {\n setLocalError('Passwords do not match.')\n return\n }\n setBusy(true)\n try {\n await updatePassword(password)\n onSuccess?.()\n } finally {\n setBusy(false)\n }\n }\n\n return (\n <form onSubmit={submit} className=\"space-y-4\">\n <label className=\"block space-y-1.5 text-sm font-medium\">\n <span>New password</span>\n <input className={fieldClass()} type=\"password\" autoComplete=\"new-password\" required value={password} onChange={(e) => setPassword(e.target.value)} disabled={disabled} />\n </label>\n <label className=\"block space-y-1.5 text-sm font-medium\">\n <span>Confirm password</span>\n <input className={fieldClass()} type=\"password\" autoComplete=\"new-password\" required value={confirmPassword} onChange={(e) => setConfirmPassword(e.target.value)} disabled={disabled} />\n </label>\n {(localError || error) && <p className=\"text-sm text-destructive\">{localError ?? error?.message}</p>}\n <button className={buttonClass()} type=\"submit\" disabled={disabled}>\n {disabled ? 'Saving...' : 'Update password'}\n </button>\n </form>\n )\n}\n","import * as React from 'react'\nimport { useAuth } from '@fayz-ai/auth'\nimport type { AuthProvider } from '@fayz-ai/core'\nimport { ForgotPasswordForm, LoginForm, ResetPasswordForm, SignupForm } from './forms'\nimport type { AuthFormView, AuthLayout } from './types'\n\nexport interface LoginPageProps {\n appName?: string\n logo?: React.ReactNode\n loginLogo?: React.ReactNode\n layout?: AuthLayout\n tagline?: string\n description?: string\n showOAuth?: boolean\n oauthProviders?: Exclude<AuthProvider, 'email'>[]\n resetPasswordUrl?: string\n onSuccess?: () => void\n}\n\nexport function LoginPage({\n appName = 'App',\n logo,\n loginLogo,\n layout = 'split',\n tagline,\n description,\n showOAuth,\n oauthProviders,\n resetPasswordUrl,\n onSuccess,\n}: LoginPageProps) {\n const [view, setView] = React.useState<AuthFormView>('login')\n const brandLogo = loginLogo ?? logo\n const heading = view === 'login' ? 'Welcome back' : view === 'signup' ? 'Create account' : 'Reset password'\n const subtitle =\n view === 'login'\n ? 'Enter your credentials to continue'\n : view === 'signup'\n ? 'Create your account to get started'\n : 'Enter your email and we will send reset instructions'\n const form =\n view === 'login' ? (\n <LoginForm\n onSuccess={onSuccess}\n onForgotPassword={() => setView('recovery')}\n showOAuth={showOAuth}\n oauthProviders={oauthProviders}\n />\n ) : view === 'signup' ? (\n <SignupForm onSuccess={onSuccess} />\n ) : (\n <ForgotPasswordForm redirectTo={resetPasswordUrl} onBackToLogin={() => setView('login')} />\n )\n const switcher =\n view === 'login' ? (\n <p className=\"text-center text-sm text-muted-foreground\">\n Do not have an account?{' '}\n <button type=\"button\" className=\"font-medium text-primary hover:underline\" onClick={() => setView('signup')}>\n Sign up\n </button>\n </p>\n ) : (\n <p className=\"text-center text-sm text-muted-foreground\">\n {view === 'signup' ? 'Already have an account?' : 'Remembered your password?'}{' '}\n <button type=\"button\" className=\"font-medium text-primary hover:underline\" onClick={() => setView('login')}>\n Sign in\n </button>\n </p>\n )\n\n if (layout === 'centered') {\n return (\n <div className=\"flex min-h-screen items-center justify-center bg-sidebar p-4\">\n <div className=\"w-full max-w-md rounded-2xl border border-border/50 bg-card p-8 shadow-2xl sm:p-10\">\n <div className=\"mb-8 text-center\">\n {brandLogo && <div className=\"mb-4 flex justify-center\">{brandLogo}</div>}\n <h1 className=\"text-2xl font-bold text-foreground\">{heading}</h1>\n <p className=\"mt-1 text-sm text-muted-foreground\">{subtitle}</p>\n </div>\n <div className=\"space-y-6\">\n {form}\n {switcher}\n </div>\n </div>\n </div>\n )\n }\n\n return (\n <div className=\"flex min-h-screen bg-sidebar\">\n <div className=\"relative hidden w-1/2 overflow-hidden lg:block\">\n <div className=\"absolute inset-0 bg-gradient-to-br from-sidebar-accent/50 via-transparent to-sidebar/80\" />\n <div className=\"relative flex h-full flex-col justify-end p-12\">\n <div className=\"space-y-4\">\n <p className=\"text-sm font-medium text-sidebar-muted\">{appName}</p>\n <h2 className=\"text-3xl font-bold text-sidebar-foreground\">{tagline ?? `Welcome to ${appName}`}</h2>\n {description && <p className=\"max-w-md text-sm leading-relaxed text-sidebar-muted\">{description}</p>}\n </div>\n </div>\n </div>\n <div className=\"flex flex-1 flex-col lg:p-3 lg:pl-3\">\n <div className=\"flex flex-1 flex-col justify-center bg-background px-6 py-12 lg:rounded-[1.25rem] lg:px-16\">\n <div className=\"mx-auto w-full max-w-sm\">\n {brandLogo && <div className=\"mb-8\">{brandLogo}</div>}\n <div className=\"mb-8\">\n <h1 className=\"text-2xl font-bold text-foreground\">{heading}</h1>\n <p className=\"mt-1 text-sm text-muted-foreground\">{subtitle}</p>\n </div>\n <div className=\"space-y-6\">\n {form}\n {switcher}\n </div>\n </div>\n </div>\n </div>\n </div>\n )\n}\n\nexport interface AuthGateProps extends LoginPageProps {\n requireAuth?: boolean\n loadingFallback?: React.ReactNode\n children: React.ReactNode\n}\n\nexport function AuthGate({ requireAuth = true, loadingFallback, children, ...loginProps }: AuthGateProps) {\n const { isAuthenticated, isLoading } = useAuth()\n if (!requireAuth || isAuthenticated) return <>{children}</>\n if (isLoading) {\n return (\n <>\n {loadingFallback ?? (\n <div className=\"flex min-h-screen items-center justify-center bg-background\">\n <span className=\"text-sm text-muted-foreground\">Loading...</span>\n </div>\n )}\n </>\n )\n }\n return <LoginPage {...loginProps} />\n}\n\nexport interface AuthCallbackPageProps {\n onSuccess?: () => void\n onError?: (error: Error) => void\n}\n\nexport function AuthCallbackPage({ onSuccess, onError }: AuthCallbackPageProps) {\n const { handleCallback } = useAuth()\n const [error, setError] = React.useState<string | null>(null)\n\n React.useEffect(() => {\n let cancelled = false\n handleCallback(typeof window === 'undefined' ? undefined : window.location.href)\n .then(() => {\n if (!cancelled) onSuccess?.()\n })\n .catch((err: unknown) => {\n const errorObject = err instanceof Error ? err : new Error(String(err))\n if (!cancelled) {\n setError(errorObject.message)\n onError?.(errorObject)\n }\n })\n return () => {\n cancelled = true\n }\n }, [handleCallback, onError, onSuccess])\n\n return (\n <div className=\"flex min-h-screen items-center justify-center bg-background p-6 text-center\">\n <div>\n <h1 className=\"text-xl font-semibold text-foreground\">{error ? 'Authentication failed' : 'Completing sign in...'}</h1>\n {error && <p className=\"mt-2 text-sm text-destructive\">{error}</p>}\n </div>\n </div>\n )\n}\n\nexport interface ResetPasswordPageProps {\n onSuccess?: () => void\n}\n\nexport function ResetPasswordPage({ onSuccess }: ResetPasswordPageProps) {\n return (\n <div className=\"flex min-h-screen items-center justify-center bg-background p-4\">\n <div className=\"w-full max-w-md rounded-2xl border bg-card p-8 shadow-xl\">\n <div className=\"mb-6\">\n <h1 className=\"text-2xl font-bold text-foreground\">Update password</h1>\n <p className=\"mt-1 text-sm text-muted-foreground\">Choose a new password for your account.</p>\n </div>\n <ResetPasswordForm onSuccess={onSuccess} />\n </div>\n </div>\n )\n}\n"]}