@contentgrowth/content-auth 0.2.4 → 0.2.5

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.
@@ -1083,18 +1083,6 @@ declare function getInvitationLink(data: any, baseUrl: string): {
1083
1083
  * @returns The session token or null if not found
1084
1084
  */
1085
1085
  declare function getSessionToken(req: Request): string | null;
1086
- /**
1087
- * Programmatically triggers a password reset email for a user.
1088
- * This bypasses the need for an HTTP call by using better-auth's internal API.
1089
- *
1090
- * @param auth The auth instance created by createAuth()
1091
- * @param email The user's email address
1092
- * @returns Promise that resolves when the reset email is triggered
1093
- */
1094
- declare function triggerPasswordReset(auth: any, email: string): Promise<{
1095
- success: boolean;
1096
- error?: string;
1097
- }>;
1098
1086
 
1099
1087
  interface AuthConfig {
1100
1088
  /**
@@ -1125,4 +1113,4 @@ declare const createAuthApp: (config: AuthConfig) => {
1125
1113
  auth: better_auth.Auth<any>;
1126
1114
  };
1127
1115
 
1128
- export { type AuthConfig, authMiddleware, createAuth, createAuthApp, getInvitationLink, getSessionToken, schema, triggerPasswordReset };
1116
+ export { type AuthConfig, authMiddleware, createAuth, createAuthApp, getInvitationLink, getSessionToken, schema };
@@ -5,9 +5,8 @@ import {
5
5
  createAuthApp,
6
6
  getInvitationLink,
7
7
  getSessionToken,
8
- schema_exports,
9
- triggerPasswordReset
10
- } from "../chunk-43OBL3NC.js";
8
+ schema_exports
9
+ } from "../chunk-6DFIEMYG.js";
11
10
  import "../chunk-R5U7XKVJ.js";
12
11
  export {
13
12
  Hono,
@@ -16,6 +15,5 @@ export {
16
15
  createAuthApp,
17
16
  getInvitationLink,
18
17
  getSessionToken,
19
- schema_exports as schema,
20
- triggerPasswordReset
18
+ schema_exports as schema
21
19
  };
@@ -191,17 +191,6 @@ function getSessionToken(req) {
191
191
  });
192
192
  return cookies["better-auth.session_token"] || cookies["session_token"] || cookies["__Secure-better-auth.session_token"] || null;
193
193
  }
194
- async function triggerPasswordReset(auth, email) {
195
- try {
196
- await auth.api.forgetPassword({
197
- body: { email }
198
- });
199
- return { success: true };
200
- } catch (e) {
201
- console.error("[triggerPasswordReset] Failed:", e);
202
- return { success: false, error: e.message || "Failed to trigger password reset" };
203
- }
204
- }
205
194
 
206
195
  // src/backend/index.ts
207
196
  var createAuth = (config) => {
@@ -263,7 +252,6 @@ export {
263
252
  schema_exports,
264
253
  getInvitationLink,
265
254
  getSessionToken,
266
- triggerPasswordReset,
267
255
  Hono,
268
256
  createAuth,
269
257
  authMiddleware,
@@ -18,7 +18,8 @@ var AuthForm = ({
18
18
  view,
19
19
  onSwitchMode,
20
20
  defaultEmail = "",
21
- lockEmail = false
21
+ lockEmail = false,
22
+ forgotPasswordUrl
22
23
  }) => {
23
24
  const [isLogin, setIsLogin] = useState(view !== "signup");
24
25
  const [email, setEmail] = useState(defaultEmail);
@@ -136,7 +137,10 @@ var AuthForm = ({
136
137
  )
137
138
  ] }),
138
139
  /* @__PURE__ */ jsxs("div", { className: "ca-input-group", children: [
139
- /* @__PURE__ */ jsx("label", { className: "ca-label", htmlFor: "password", children: "Password" }),
140
+ /* @__PURE__ */ jsxs("div", { className: "ca-label-row", children: [
141
+ /* @__PURE__ */ jsx("label", { className: "ca-label", htmlFor: "password", children: "Password" }),
142
+ isLogin && forgotPasswordUrl && /* @__PURE__ */ jsx("a", { href: forgotPasswordUrl, className: "ca-forgot-link", children: "Forgot password?" })
143
+ ] }),
140
144
  /* @__PURE__ */ jsx(
141
145
  "input",
142
146
  {
@@ -205,18 +209,218 @@ var AuthForm = ({
205
209
  ] });
206
210
  };
207
211
 
208
- // src/frontend/components/Organization.tsx
209
- import { useState as useState2, useEffect } from "react";
212
+ // src/frontend/components/ForgotPasswordForm.tsx
213
+ import { useState as useState2 } from "react";
210
214
  import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
215
+ var ForgotPasswordForm = ({
216
+ client = authClient,
217
+ onSuccess,
218
+ onBackToLogin,
219
+ className,
220
+ title,
221
+ width = "default"
222
+ }) => {
223
+ const [email, setEmail] = useState2("");
224
+ const [loading, setLoading] = useState2(false);
225
+ const [error, setError] = useState2(null);
226
+ const [success, setSuccess] = useState2(false);
227
+ let widthClass = "";
228
+ if (width === "compact") widthClass = "ca-width-compact";
229
+ else if (width === "wide") widthClass = "ca-width-wide";
230
+ else widthClass = "ca-width-default";
231
+ const handleSubmit = async (e) => {
232
+ e.preventDefault();
233
+ setLoading(true);
234
+ setError(null);
235
+ try {
236
+ const { error: error2 } = await client.requestPasswordReset({
237
+ email,
238
+ redirectTo: window.location.origin + "/auth/reset-password"
239
+ });
240
+ if (error2) throw error2;
241
+ setSuccess(true);
242
+ onSuccess?.();
243
+ } catch (err) {
244
+ setError(err.message || "Failed to send reset email");
245
+ } finally {
246
+ setLoading(false);
247
+ }
248
+ };
249
+ const titleContent = title ? typeof title === "string" ? /* @__PURE__ */ jsx2("h2", { className: "ca-title", children: title }) : title : /* @__PURE__ */ jsx2("h2", { className: "ca-title", children: "Reset Password" });
250
+ if (success) {
251
+ return /* @__PURE__ */ jsxs2("div", { className: `ca-container ${widthClass} ${className || ""}`, children: [
252
+ titleContent,
253
+ /* @__PURE__ */ jsxs2("div", { className: "ca-success-message", children: [
254
+ /* @__PURE__ */ jsxs2("svg", { className: "ca-success-icon", viewBox: "0 0 24 24", width: "48", height: "48", children: [
255
+ /* @__PURE__ */ jsx2("circle", { cx: "12", cy: "12", r: "10", fill: "#10B981" }),
256
+ /* @__PURE__ */ jsx2("path", { d: "M8 12l2.5 2.5L16 9", stroke: "white", strokeWidth: "2", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" })
257
+ ] }),
258
+ /* @__PURE__ */ jsx2("h3", { className: "ca-success-title", children: "Check your email" }),
259
+ /* @__PURE__ */ jsxs2("p", { className: "ca-success-text", children: [
260
+ "We've sent a password reset link to ",
261
+ /* @__PURE__ */ jsx2("strong", { children: email }),
262
+ ". Please check your inbox and click the link to reset your password."
263
+ ] })
264
+ ] }),
265
+ onBackToLogin && /* @__PURE__ */ jsx2("div", { className: "ca-footer", children: /* @__PURE__ */ jsx2("button", { className: "ca-link", onClick: onBackToLogin, type: "button", children: "Back to Sign In" }) })
266
+ ] });
267
+ }
268
+ return /* @__PURE__ */ jsxs2("div", { className: `ca-container ${widthClass} ${className || ""}`, children: [
269
+ titleContent,
270
+ /* @__PURE__ */ jsx2("p", { className: "ca-subtitle", children: "Enter your email address and we'll send you a link to reset your password." }),
271
+ /* @__PURE__ */ jsxs2("form", { onSubmit: handleSubmit, className: "ca-form", children: [
272
+ /* @__PURE__ */ jsxs2("div", { className: "ca-input-group", children: [
273
+ /* @__PURE__ */ jsx2("label", { className: "ca-label", htmlFor: "email", children: "Email" }),
274
+ /* @__PURE__ */ jsx2(
275
+ "input",
276
+ {
277
+ id: "email",
278
+ type: "email",
279
+ className: "ca-input",
280
+ value: email,
281
+ onChange: (e) => setEmail(e.target.value),
282
+ placeholder: "you@example.com",
283
+ required: true
284
+ }
285
+ )
286
+ ] }),
287
+ error && /* @__PURE__ */ jsx2("div", { className: "ca-error", children: error }),
288
+ /* @__PURE__ */ jsx2("button", { type: "submit", className: "ca-button", disabled: loading, children: loading ? "Sending..." : "Send Reset Link" })
289
+ ] }),
290
+ onBackToLogin && /* @__PURE__ */ jsx2("div", { className: "ca-footer", children: /* @__PURE__ */ jsx2("button", { className: "ca-link", onClick: onBackToLogin, type: "button", children: "Back to Sign In" }) })
291
+ ] });
292
+ };
293
+
294
+ // src/frontend/components/ResetPasswordForm.tsx
295
+ import { useState as useState3 } from "react";
296
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
297
+ var ResetPasswordForm = ({
298
+ token,
299
+ client = authClient,
300
+ onSuccess,
301
+ onBackToLogin,
302
+ className,
303
+ title,
304
+ width = "default"
305
+ }) => {
306
+ const [password, setPassword] = useState3("");
307
+ const [confirmPassword, setConfirmPassword] = useState3("");
308
+ const [loading, setLoading] = useState3(false);
309
+ const [error, setError] = useState3(null);
310
+ const [success, setSuccess] = useState3(false);
311
+ let widthClass = "";
312
+ if (width === "compact") widthClass = "ca-width-compact";
313
+ else if (width === "wide") widthClass = "ca-width-wide";
314
+ else widthClass = "ca-width-default";
315
+ const titleContent = title ? typeof title === "string" ? /* @__PURE__ */ jsx3("h2", { className: "ca-title", children: title }) : title : /* @__PURE__ */ jsx3("h2", { className: "ca-title", children: "Set New Password" });
316
+ if (!token) {
317
+ return /* @__PURE__ */ jsxs3("div", { className: `ca-container ${widthClass} ${className || ""}`, children: [
318
+ titleContent,
319
+ /* @__PURE__ */ jsxs3("div", { className: "ca-error-message", children: [
320
+ /* @__PURE__ */ jsxs3("svg", { className: "ca-error-icon", viewBox: "0 0 24 24", width: "48", height: "48", children: [
321
+ /* @__PURE__ */ jsx3("circle", { cx: "12", cy: "12", r: "10", fill: "#EF4444" }),
322
+ /* @__PURE__ */ jsx3("path", { d: "M12 8v4M12 16h.01", stroke: "white", strokeWidth: "2", strokeLinecap: "round" })
323
+ ] }),
324
+ /* @__PURE__ */ jsx3("h3", { className: "ca-error-title", children: "Invalid or Missing Token" }),
325
+ /* @__PURE__ */ jsx3("p", { className: "ca-error-text", children: "The password reset link is invalid or has expired. Please request a new password reset." })
326
+ ] }),
327
+ onBackToLogin && /* @__PURE__ */ jsx3("div", { className: "ca-footer", children: /* @__PURE__ */ jsx3("button", { className: "ca-link", onClick: onBackToLogin, type: "button", children: "Back to Sign In" }) })
328
+ ] });
329
+ }
330
+ const handleSubmit = async (e) => {
331
+ e.preventDefault();
332
+ if (password !== confirmPassword) {
333
+ setError("Passwords do not match");
334
+ return;
335
+ }
336
+ if (password.length < 8) {
337
+ setError("Password must be at least 8 characters");
338
+ return;
339
+ }
340
+ setLoading(true);
341
+ setError(null);
342
+ try {
343
+ const { error: error2 } = await client.resetPassword({
344
+ token,
345
+ newPassword: password
346
+ });
347
+ if (error2) throw error2;
348
+ setSuccess(true);
349
+ onSuccess?.();
350
+ } catch (err) {
351
+ setError(err.message || "Failed to reset password");
352
+ } finally {
353
+ setLoading(false);
354
+ }
355
+ };
356
+ if (success) {
357
+ return /* @__PURE__ */ jsxs3("div", { className: `ca-container ${widthClass} ${className || ""}`, children: [
358
+ titleContent,
359
+ /* @__PURE__ */ jsxs3("div", { className: "ca-success-message", children: [
360
+ /* @__PURE__ */ jsxs3("svg", { className: "ca-success-icon", viewBox: "0 0 24 24", width: "48", height: "48", children: [
361
+ /* @__PURE__ */ jsx3("circle", { cx: "12", cy: "12", r: "10", fill: "#10B981" }),
362
+ /* @__PURE__ */ jsx3("path", { d: "M8 12l2.5 2.5L16 9", stroke: "white", strokeWidth: "2", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" })
363
+ ] }),
364
+ /* @__PURE__ */ jsx3("h3", { className: "ca-success-title", children: "Password Reset Successful" }),
365
+ /* @__PURE__ */ jsx3("p", { className: "ca-success-text", children: "Your password has been successfully reset. You can now sign in with your new password." })
366
+ ] }),
367
+ onBackToLogin && /* @__PURE__ */ jsx3("div", { className: "ca-footer", children: /* @__PURE__ */ jsx3("button", { className: "ca-link", onClick: onBackToLogin, type: "button", children: "Sign In" }) })
368
+ ] });
369
+ }
370
+ return /* @__PURE__ */ jsxs3("div", { className: `ca-container ${widthClass} ${className || ""}`, children: [
371
+ titleContent,
372
+ /* @__PURE__ */ jsx3("p", { className: "ca-subtitle", children: "Enter your new password below." }),
373
+ /* @__PURE__ */ jsxs3("form", { onSubmit: handleSubmit, className: "ca-form", children: [
374
+ /* @__PURE__ */ jsxs3("div", { className: "ca-input-group", children: [
375
+ /* @__PURE__ */ jsx3("label", { className: "ca-label", htmlFor: "password", children: "New Password" }),
376
+ /* @__PURE__ */ jsx3(
377
+ "input",
378
+ {
379
+ id: "password",
380
+ type: "password",
381
+ className: "ca-input",
382
+ value: password,
383
+ onChange: (e) => setPassword(e.target.value),
384
+ placeholder: "At least 8 characters",
385
+ minLength: 8,
386
+ required: true
387
+ }
388
+ )
389
+ ] }),
390
+ /* @__PURE__ */ jsxs3("div", { className: "ca-input-group", children: [
391
+ /* @__PURE__ */ jsx3("label", { className: "ca-label", htmlFor: "confirmPassword", children: "Confirm Password" }),
392
+ /* @__PURE__ */ jsx3(
393
+ "input",
394
+ {
395
+ id: "confirmPassword",
396
+ type: "password",
397
+ className: "ca-input",
398
+ value: confirmPassword,
399
+ onChange: (e) => setConfirmPassword(e.target.value),
400
+ placeholder: "Confirm your password",
401
+ required: true
402
+ }
403
+ )
404
+ ] }),
405
+ error && /* @__PURE__ */ jsx3("div", { className: "ca-error", children: error }),
406
+ /* @__PURE__ */ jsx3("button", { type: "submit", className: "ca-button", disabled: loading, children: loading ? "Resetting..." : "Reset Password" })
407
+ ] }),
408
+ onBackToLogin && /* @__PURE__ */ jsx3("div", { className: "ca-footer", children: /* @__PURE__ */ jsx3("button", { className: "ca-link", onClick: onBackToLogin, type: "button", children: "Back to Sign In" }) })
409
+ ] });
410
+ };
411
+
412
+ // src/frontend/components/Organization.tsx
413
+ import { useState as useState4, useEffect } from "react";
414
+ import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
211
415
  var CreateOrganizationForm = ({
212
416
  client = authClient,
213
417
  className,
214
418
  onSuccess,
215
419
  onError
216
420
  }) => {
217
- const [name, setName] = useState2("");
218
- const [slug, setSlug] = useState2("");
219
- const [loading, setLoading] = useState2(false);
421
+ const [name, setName] = useState4("");
422
+ const [slug, setSlug] = useState4("");
423
+ const [loading, setLoading] = useState4(false);
220
424
  const handleSubmit = async (e) => {
221
425
  e.preventDefault();
222
426
  setLoading(true);
@@ -235,11 +439,11 @@ var CreateOrganizationForm = ({
235
439
  setLoading(false);
236
440
  }
237
441
  };
238
- return /* @__PURE__ */ jsxs2("form", { onSubmit: handleSubmit, className: `ca-form ${className || ""}`, children: [
239
- /* @__PURE__ */ jsx2("h3", { className: "ca-subtitle", children: "Create Organization" }),
240
- /* @__PURE__ */ jsxs2("div", { className: "ca-input-group", children: [
241
- /* @__PURE__ */ jsx2("label", { className: "ca-label", children: "Organization Name" }),
242
- /* @__PURE__ */ jsx2(
442
+ return /* @__PURE__ */ jsxs4("form", { onSubmit: handleSubmit, className: `ca-form ${className || ""}`, children: [
443
+ /* @__PURE__ */ jsx4("h3", { className: "ca-subtitle", children: "Create Organization" }),
444
+ /* @__PURE__ */ jsxs4("div", { className: "ca-input-group", children: [
445
+ /* @__PURE__ */ jsx4("label", { className: "ca-label", children: "Organization Name" }),
446
+ /* @__PURE__ */ jsx4(
243
447
  "input",
244
448
  {
245
449
  type: "text",
@@ -254,9 +458,9 @@ var CreateOrganizationForm = ({
254
458
  }
255
459
  )
256
460
  ] }),
257
- /* @__PURE__ */ jsxs2("div", { className: "ca-input-group", children: [
258
- /* @__PURE__ */ jsx2("label", { className: "ca-label", children: "Slug" }),
259
- /* @__PURE__ */ jsx2(
461
+ /* @__PURE__ */ jsxs4("div", { className: "ca-input-group", children: [
462
+ /* @__PURE__ */ jsx4("label", { className: "ca-label", children: "Slug" }),
463
+ /* @__PURE__ */ jsx4(
260
464
  "input",
261
465
  {
262
466
  type: "text",
@@ -268,7 +472,7 @@ var CreateOrganizationForm = ({
268
472
  }
269
473
  )
270
474
  ] }),
271
- /* @__PURE__ */ jsx2("button", { type: "submit", className: "ca-button", disabled: loading, children: loading ? "Creating..." : "Create Organization" })
475
+ /* @__PURE__ */ jsx4("button", { type: "submit", className: "ca-button", disabled: loading, children: loading ? "Creating..." : "Create Organization" })
272
476
  ] });
273
477
  };
274
478
  var OrganizationSwitcher = ({
@@ -277,8 +481,8 @@ var OrganizationSwitcher = ({
277
481
  currentOrgId,
278
482
  onSuccess
279
483
  }) => {
280
- const [orgs, setOrgs] = useState2([]);
281
- const [loading, setLoading] = useState2(true);
484
+ const [orgs, setOrgs] = useState4([]);
485
+ const [loading, setLoading] = useState4(true);
282
486
  useEffect(() => {
283
487
  const fetchOrgs = async () => {
284
488
  const { data } = await client.organization.list({});
@@ -291,18 +495,18 @@ var OrganizationSwitcher = ({
291
495
  await client.organization.setActive({ organizationId: orgId });
292
496
  onSuccess?.(orgId);
293
497
  };
294
- if (loading) return /* @__PURE__ */ jsx2("div", { className: "ca-loading", children: "Loading..." });
295
- return /* @__PURE__ */ jsxs2("div", { className: `ca-org-switcher ${className || ""}`, children: [
296
- /* @__PURE__ */ jsx2("label", { className: "ca-label", children: "Select Organization" }),
297
- /* @__PURE__ */ jsxs2(
498
+ if (loading) return /* @__PURE__ */ jsx4("div", { className: "ca-loading", children: "Loading..." });
499
+ return /* @__PURE__ */ jsxs4("div", { className: `ca-org-switcher ${className || ""}`, children: [
500
+ /* @__PURE__ */ jsx4("label", { className: "ca-label", children: "Select Organization" }),
501
+ /* @__PURE__ */ jsxs4(
298
502
  "select",
299
503
  {
300
504
  className: "ca-select",
301
505
  value: currentOrgId || "",
302
506
  onChange: (e) => handleSwitch(e.target.value),
303
507
  children: [
304
- /* @__PURE__ */ jsx2("option", { value: "", disabled: true, children: "Select an organization" }),
305
- orgs.map((org) => /* @__PURE__ */ jsx2("option", { value: org.id, children: org.name }, org.id))
508
+ /* @__PURE__ */ jsx4("option", { value: "", disabled: true, children: "Select an organization" }),
509
+ orgs.map((org) => /* @__PURE__ */ jsx4("option", { value: org.id, children: org.name }, org.id))
306
510
  ]
307
511
  }
308
512
  )
@@ -314,9 +518,9 @@ var InviteMemberForm = ({
314
518
  onSuccess,
315
519
  onError
316
520
  }) => {
317
- const [email, setEmail] = useState2("");
318
- const [role, setRole] = useState2("member");
319
- const [loading, setLoading] = useState2(false);
521
+ const [email, setEmail] = useState4("");
522
+ const [role, setRole] = useState4("member");
523
+ const [loading, setLoading] = useState4(false);
320
524
  const handleSubmit = async (e) => {
321
525
  e.preventDefault();
322
526
  setLoading(true);
@@ -334,11 +538,11 @@ var InviteMemberForm = ({
334
538
  setLoading(false);
335
539
  }
336
540
  };
337
- return /* @__PURE__ */ jsxs2("form", { onSubmit: handleSubmit, className: `ca-form ${className || ""}`, children: [
338
- /* @__PURE__ */ jsx2("h3", { className: "ca-subtitle", children: "Invite Member" }),
339
- /* @__PURE__ */ jsxs2("div", { className: "ca-input-group", children: [
340
- /* @__PURE__ */ jsx2("label", { className: "ca-label", children: "Email Address" }),
341
- /* @__PURE__ */ jsx2(
541
+ return /* @__PURE__ */ jsxs4("form", { onSubmit: handleSubmit, className: `ca-form ${className || ""}`, children: [
542
+ /* @__PURE__ */ jsx4("h3", { className: "ca-subtitle", children: "Invite Member" }),
543
+ /* @__PURE__ */ jsxs4("div", { className: "ca-input-group", children: [
544
+ /* @__PURE__ */ jsx4("label", { className: "ca-label", children: "Email Address" }),
545
+ /* @__PURE__ */ jsx4(
342
546
  "input",
343
547
  {
344
548
  type: "email",
@@ -350,28 +554,30 @@ var InviteMemberForm = ({
350
554
  }
351
555
  )
352
556
  ] }),
353
- /* @__PURE__ */ jsxs2("div", { className: "ca-input-group", children: [
354
- /* @__PURE__ */ jsx2("label", { className: "ca-label", children: "Role" }),
355
- /* @__PURE__ */ jsxs2(
557
+ /* @__PURE__ */ jsxs4("div", { className: "ca-input-group", children: [
558
+ /* @__PURE__ */ jsx4("label", { className: "ca-label", children: "Role" }),
559
+ /* @__PURE__ */ jsxs4(
356
560
  "select",
357
561
  {
358
562
  className: "ca-select",
359
563
  value: role,
360
564
  onChange: (e) => setRole(e.target.value),
361
565
  children: [
362
- /* @__PURE__ */ jsx2("option", { value: "member", children: "Member" }),
363
- /* @__PURE__ */ jsx2("option", { value: "admin", children: "Admin" }),
364
- /* @__PURE__ */ jsx2("option", { value: "owner", children: "Owner" })
566
+ /* @__PURE__ */ jsx4("option", { value: "member", children: "Member" }),
567
+ /* @__PURE__ */ jsx4("option", { value: "admin", children: "Admin" }),
568
+ /* @__PURE__ */ jsx4("option", { value: "owner", children: "Owner" })
365
569
  ]
366
570
  }
367
571
  )
368
572
  ] }),
369
- /* @__PURE__ */ jsx2("button", { type: "submit", className: "ca-button", disabled: loading, children: loading ? "Sending Invite..." : "Send Invite" })
573
+ /* @__PURE__ */ jsx4("button", { type: "submit", className: "ca-button", disabled: loading, children: loading ? "Sending Invite..." : "Send Invite" })
370
574
  ] });
371
575
  };
372
576
 
373
577
  export {
374
578
  AuthForm,
579
+ ForgotPasswordForm,
580
+ ResetPasswordForm,
375
581
  CreateOrganizationForm,
376
582
  OrganizationSwitcher,
377
583
  InviteMemberForm
@@ -628,7 +628,7 @@ declare const createClient: (baseUrl?: string) => {
628
628
  sortDirection?: "asc" | "desc" | undefined;
629
629
  filterField?: string | undefined;
630
630
  filterValue?: string | number | boolean | undefined;
631
- filterOperator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "contains" | undefined;
631
+ filterOperator?: "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "contains" | undefined;
632
632
  organizationId?: string | undefined;
633
633
  organizationSlug?: string | undefined;
634
634
  }> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth.Prettify<{
@@ -639,7 +639,7 @@ declare const createClient: (baseUrl?: string) => {
639
639
  sortDirection?: "asc" | "desc" | undefined;
640
640
  filterField?: string | undefined;
641
641
  filterValue?: string | number | boolean | undefined;
642
- filterOperator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "contains" | undefined;
642
+ filterOperator?: "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "contains" | undefined;
643
643
  organizationId?: string | undefined;
644
644
  organizationSlug?: string | undefined;
645
645
  } | undefined;
@@ -746,7 +746,7 @@ declare const createClient: (baseUrl?: string) => {
746
746
  } & {
747
747
  signIn: {
748
748
  social: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
749
- provider: (string & {}) | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel";
749
+ provider: (string & {}) | "linear" | "huggingface" | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel";
750
750
  callbackURL?: string | undefined;
751
751
  newUserCallbackURL?: string | undefined;
752
752
  errorCallbackURL?: string | undefined;
@@ -763,7 +763,7 @@ declare const createClient: (baseUrl?: string) => {
763
763
  loginHint?: string | undefined;
764
764
  additionalData?: Record<string, any> | undefined;
765
765
  }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
766
- provider: (string & {}) | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel";
766
+ provider: (string & {}) | "linear" | "huggingface" | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel";
767
767
  callbackURL?: string | undefined;
768
768
  newUserCallbackURL?: string | undefined;
769
769
  errorCallbackURL?: string | undefined;
@@ -2205,7 +2205,7 @@ declare const authClient: {
2205
2205
  sortDirection?: "asc" | "desc" | undefined;
2206
2206
  filterField?: string | undefined;
2207
2207
  filterValue?: string | number | boolean | undefined;
2208
- filterOperator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "contains" | undefined;
2208
+ filterOperator?: "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "contains" | undefined;
2209
2209
  organizationId?: string | undefined;
2210
2210
  organizationSlug?: string | undefined;
2211
2211
  }> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth.Prettify<{
@@ -2216,7 +2216,7 @@ declare const authClient: {
2216
2216
  sortDirection?: "asc" | "desc" | undefined;
2217
2217
  filterField?: string | undefined;
2218
2218
  filterValue?: string | number | boolean | undefined;
2219
- filterOperator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "contains" | undefined;
2219
+ filterOperator?: "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "contains" | undefined;
2220
2220
  organizationId?: string | undefined;
2221
2221
  organizationSlug?: string | undefined;
2222
2222
  } | undefined;
@@ -2323,7 +2323,7 @@ declare const authClient: {
2323
2323
  } & {
2324
2324
  signIn: {
2325
2325
  social: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
2326
- provider: (string & {}) | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel";
2326
+ provider: (string & {}) | "linear" | "huggingface" | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel";
2327
2327
  callbackURL?: string | undefined;
2328
2328
  newUserCallbackURL?: string | undefined;
2329
2329
  errorCallbackURL?: string | undefined;
@@ -2340,7 +2340,7 @@ declare const authClient: {
2340
2340
  loginHint?: string | undefined;
2341
2341
  additionalData?: Record<string, any> | undefined;
2342
2342
  }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
2343
- provider: (string & {}) | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel";
2343
+ provider: (string & {}) | "linear" | "huggingface" | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel";
2344
2344
  callbackURL?: string | undefined;
2345
2345
  newUserCallbackURL?: string | undefined;
2346
2346
  errorCallbackURL?: string | undefined;
@@ -22,9 +22,33 @@ interface AuthFormProps {
22
22
  defaultEmail?: string;
23
23
  /** Lock the email field (readonly) and hide social logins */
24
24
  lockEmail?: boolean;
25
+ /** URL for the forgot password page (shows link on login form if provided) */
26
+ forgotPasswordUrl?: string;
25
27
  }
26
28
  declare const AuthForm: React.FC<AuthFormProps>;
27
29
 
30
+ interface ForgotPasswordFormProps {
31
+ client?: typeof authClient;
32
+ onSuccess?: () => void;
33
+ onBackToLogin?: () => void;
34
+ className?: string;
35
+ title?: React.ReactNode;
36
+ width?: 'default' | 'compact' | 'wide';
37
+ }
38
+ declare const ForgotPasswordForm: React.FC<ForgotPasswordFormProps>;
39
+
40
+ interface ResetPasswordFormProps {
41
+ /** The reset token from the URL query parameter */
42
+ token: string | null;
43
+ client?: typeof authClient;
44
+ onSuccess?: () => void;
45
+ onBackToLogin?: () => void;
46
+ className?: string;
47
+ title?: React.ReactNode;
48
+ width?: 'default' | 'compact' | 'wide';
49
+ }
50
+ declare const ResetPasswordForm: React.FC<ResetPasswordFormProps>;
51
+
28
52
  interface BaseOrgProps {
29
53
  client?: typeof authClient;
30
54
  className?: string;
@@ -39,4 +63,4 @@ declare const InviteMemberForm: React.FC<BaseOrgProps & {
39
63
  organizationId?: string;
40
64
  }>;
41
65
 
42
- export { AuthForm, CreateOrganizationForm, InviteMemberForm, OrganizationSwitcher, authClient };
66
+ export { AuthForm, CreateOrganizationForm, ForgotPasswordForm, InviteMemberForm, OrganizationSwitcher, ResetPasswordForm, authClient };
@@ -1,9 +1,11 @@
1
1
  import {
2
2
  AuthForm,
3
3
  CreateOrganizationForm,
4
+ ForgotPasswordForm,
4
5
  InviteMemberForm,
5
- OrganizationSwitcher
6
- } from "../chunk-2TPT2QM4.js";
6
+ OrganizationSwitcher,
7
+ ResetPasswordForm
8
+ } from "../chunk-7JTB52CI.js";
7
9
  import {
8
10
  authClient,
9
11
  createClient
@@ -12,8 +14,10 @@ import "../chunk-R5U7XKVJ.js";
12
14
  export {
13
15
  AuthForm,
14
16
  CreateOrganizationForm,
17
+ ForgotPasswordForm,
15
18
  InviteMemberForm,
16
19
  OrganizationSwitcher,
20
+ ResetPasswordForm,
17
21
  authClient,
18
22
  createClient
19
23
  };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export { AuthConfig, authMiddleware, createAuth, createAuthApp, getInvitationLink, getSessionToken, schema, triggerPasswordReset } from './backend/index.js';
2
- export { AuthForm, CreateOrganizationForm, InviteMemberForm, OrganizationSwitcher } from './frontend/index.js';
1
+ export { AuthConfig, authMiddleware, createAuth, createAuthApp, getInvitationLink, getSessionToken, schema } from './backend/index.js';
2
+ export { AuthForm, CreateOrganizationForm, ForgotPasswordForm, InviteMemberForm, OrganizationSwitcher, ResetPasswordForm } from './frontend/index.js';
3
3
  export { authClient, createClient } from './frontend/client.js';
4
4
  export * from 'better-auth';
5
5
  export { Hono } from 'hono';
package/dist/index.js CHANGED
@@ -5,15 +5,16 @@ import {
5
5
  createAuthApp,
6
6
  getInvitationLink,
7
7
  getSessionToken,
8
- schema_exports,
9
- triggerPasswordReset
10
- } from "./chunk-43OBL3NC.js";
8
+ schema_exports
9
+ } from "./chunk-6DFIEMYG.js";
11
10
  import {
12
11
  AuthForm,
13
12
  CreateOrganizationForm,
13
+ ForgotPasswordForm,
14
14
  InviteMemberForm,
15
- OrganizationSwitcher
16
- } from "./chunk-2TPT2QM4.js";
15
+ OrganizationSwitcher,
16
+ ResetPasswordForm
17
+ } from "./chunk-7JTB52CI.js";
17
18
  import {
18
19
  authClient,
19
20
  createClient
@@ -22,9 +23,11 @@ import "./chunk-R5U7XKVJ.js";
22
23
  export {
23
24
  AuthForm,
24
25
  CreateOrganizationForm,
26
+ ForgotPasswordForm,
25
27
  Hono,
26
28
  InviteMemberForm,
27
29
  OrganizationSwitcher,
30
+ ResetPasswordForm,
28
31
  authClient,
29
32
  authMiddleware,
30
33
  createAuth,
@@ -32,6 +35,5 @@ export {
32
35
  createClient,
33
36
  getInvitationLink,
34
37
  getSessionToken,
35
- schema_exports as schema,
36
- triggerPasswordReset
38
+ schema_exports as schema
37
39
  };
package/dist/styles.css CHANGED
@@ -37,6 +37,24 @@
37
37
  color: #374151;
38
38
  }
39
39
 
40
+ .ca-label-row {
41
+ display: flex;
42
+ justify-content: space-between;
43
+ align-items: center;
44
+ }
45
+
46
+ .ca-forgot-link {
47
+ font-size: 0.8125rem;
48
+ color: #2563eb;
49
+ text-decoration: none;
50
+ font-weight: 500;
51
+ }
52
+
53
+ .ca-forgot-link:hover {
54
+ text-decoration: underline;
55
+ color: #1d4ed8;
56
+ }
57
+
40
58
  .ca-input {
41
59
  padding: 0.75rem 1rem;
42
60
  border-radius: 8px;
@@ -170,6 +188,64 @@ button[type="submit"]:disabled {
170
188
  color: #1d4ed8;
171
189
  }
172
190
 
191
+ /* Subtitle */
192
+ .ca-subtitle {
193
+ text-align: center;
194
+ color: #6b7280;
195
+ font-size: 0.9375rem;
196
+ margin-bottom: 1.5rem;
197
+ line-height: 1.5;
198
+ }
199
+
200
+ /* Success Message */
201
+ .ca-success-message {
202
+ text-align: center;
203
+ padding: 1.5rem 0;
204
+ }
205
+
206
+ .ca-success-icon {
207
+ margin: 0 auto 1rem;
208
+ display: block;
209
+ }
210
+
211
+ .ca-success-title {
212
+ font-size: 1.25rem;
213
+ font-weight: 600;
214
+ color: #111827;
215
+ margin-bottom: 0.75rem;
216
+ }
217
+
218
+ .ca-success-text {
219
+ color: #6b7280;
220
+ font-size: 0.9375rem;
221
+ line-height: 1.6;
222
+ }
223
+
224
+ /* Error Message Block */
225
+ .ca-error-message {
226
+ text-align: center;
227
+ padding: 1.5rem 0;
228
+ }
229
+
230
+ .ca-error-icon {
231
+ margin: 0 auto 1rem;
232
+ display: block;
233
+ }
234
+
235
+ .ca-error-title {
236
+ font-size: 1.25rem;
237
+ font-weight: 600;
238
+ color: #111827;
239
+ margin-bottom: 0.75rem;
240
+ }
241
+
242
+ .ca-error-text {
243
+ color: #6b7280;
244
+ font-size: 0.9375rem;
245
+ line-height: 1.6;
246
+ }
247
+
248
+ /* Inline Error */
173
249
  .ca-error {
174
250
  background-color: #fef2f2;
175
251
  color: #ef4444;
@@ -188,8 +264,17 @@ button[type="submit"]:disabled {
188
264
  margin-bottom: 1.5rem;
189
265
  }
190
266
 
191
- .ca-container-wide {
192
- max-width: 600px;
267
+ /* Width Modifiers */
268
+ .ca-width-wide {
269
+ max-width: 600px !important;
270
+ }
271
+
272
+ .ca-width-compact {
273
+ max-width: 360px !important;
274
+ }
275
+
276
+ .ca-width-default {
277
+ max-width: 420px !important;
193
278
  }
194
279
 
195
280
  /* Split Layout */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentgrowth/content-auth",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "Better Auth wrapper with UI components for Cloudflare Workers & Pages",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",