@carlonicora/nextjs-jsonapi 6.30.0 → 6.31.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 (88) hide show
  1. package/dist/{BlockNoteEditor-FTRTY4YJ.js → BlockNoteEditor-ICGGCW6N.js} +24 -24
  2. package/dist/{BlockNoteEditor-FTRTY4YJ.js.map → BlockNoteEditor-ICGGCW6N.js.map} +1 -1
  3. package/dist/{BlockNoteEditor-SQQF7OCY.mjs → BlockNoteEditor-O4E67ECL.mjs} +4 -4
  4. package/dist/{BlockNoteViewer-76CKL6W5.mjs → BlockNoteViewer-BNZEXGVT.mjs} +2 -2
  5. package/dist/{BlockNoteViewer-B25WKYQP.js → BlockNoteViewer-YONLBNXW.js} +3 -3
  6. package/dist/{BlockNoteViewer-B25WKYQP.js.map → BlockNoteViewer-YONLBNXW.js.map} +1 -1
  7. package/dist/billing/index.js +465 -465
  8. package/dist/billing/index.mjs +3 -3
  9. package/dist/{chunk-77JC2UCF.js → chunk-5XP5G45B.js} +23 -10
  10. package/dist/chunk-5XP5G45B.js.map +1 -0
  11. package/dist/{chunk-MNN6MTEN.mjs → chunk-BT3VFB3I.mjs} +154 -125
  12. package/dist/chunk-BT3VFB3I.mjs.map +1 -0
  13. package/dist/{chunk-7MGXQIEP.mjs → chunk-FDKAVSZ6.mjs} +2 -2
  14. package/dist/{chunk-FJUKLVVX.mjs → chunk-HNK2O6YE.mjs} +23 -10
  15. package/dist/chunk-HNK2O6YE.mjs.map +1 -0
  16. package/dist/{chunk-M7YK5CCE.mjs → chunk-JL6XL5NK.mjs} +9 -2
  17. package/dist/chunk-JL6XL5NK.mjs.map +1 -0
  18. package/dist/{chunk-S4FSGMKX.js → chunk-M7FA63QE.js} +796 -767
  19. package/dist/chunk-M7FA63QE.js.map +1 -0
  20. package/dist/{chunk-F3EVYBMA.js → chunk-NQL2NDKH.js} +4 -4
  21. package/dist/{chunk-F3EVYBMA.js.map → chunk-NQL2NDKH.js.map} +1 -1
  22. package/dist/{chunk-ONU4WCDG.js → chunk-Q5SMFSE4.js} +11 -4
  23. package/dist/chunk-Q5SMFSE4.js.map +1 -0
  24. package/dist/client/index.js +4 -4
  25. package/dist/client/index.mjs +3 -3
  26. package/dist/components/index.js +4 -4
  27. package/dist/components/index.mjs +3 -3
  28. package/dist/contexts/index.js +4 -4
  29. package/dist/contexts/index.mjs +3 -3
  30. package/dist/core/index.js +2 -2
  31. package/dist/core/index.mjs +1 -1
  32. package/dist/email-automations/index.js +105 -105
  33. package/dist/email-automations/index.mjs +3 -3
  34. package/dist/features/analytics/index.js +114 -114
  35. package/dist/features/analytics/index.mjs +3 -3
  36. package/dist/features/analytics/server.js +4 -4
  37. package/dist/features/analytics/server.mjs +2 -2
  38. package/dist/features/auth/components/GdprConsentSection.d.ts +2 -1
  39. package/dist/features/auth/components/GdprConsentSection.d.ts.map +1 -1
  40. package/dist/features/auth/components/forms/Login.d.ts.map +1 -1
  41. package/dist/features/auth/components/forms/Register.d.ts.map +1 -1
  42. package/dist/features/auth/data/auth.service.d.ts +8 -3
  43. package/dist/features/auth/data/auth.service.d.ts.map +1 -1
  44. package/dist/features/auth/data/pending-registration.d.ts +2 -0
  45. package/dist/features/auth/data/pending-registration.d.ts.map +1 -1
  46. package/dist/features/auth/data/pending-registration.interface.d.ts +1 -0
  47. package/dist/features/auth/data/pending-registration.interface.d.ts.map +1 -1
  48. package/dist/features/auth/hooks/useCompleteLogin.d.ts +9 -0
  49. package/dist/features/auth/hooks/useCompleteLogin.d.ts.map +1 -0
  50. package/dist/features/blog/index.js +129 -129
  51. package/dist/features/blog/index.mjs +3 -3
  52. package/dist/features/blog/server.js +7 -7
  53. package/dist/features/blog/server.mjs +1 -1
  54. package/dist/features/help/index.js +37 -37
  55. package/dist/features/help/index.mjs +3 -3
  56. package/dist/features/tokenusage/index.js +114 -114
  57. package/dist/features/tokenusage/index.mjs +3 -3
  58. package/dist/index.js +3 -3
  59. package/dist/index.mjs +2 -2
  60. package/dist/login/config.d.ts +3 -0
  61. package/dist/login/config.d.ts.map +1 -1
  62. package/dist/login/index.d.ts +1 -1
  63. package/dist/login/index.d.ts.map +1 -1
  64. package/dist/server/index.js +3 -3
  65. package/dist/server/index.mjs +2 -2
  66. package/package.json +1 -1
  67. package/src/features/auth/components/GdprConsentSection.tsx +3 -1
  68. package/src/features/auth/components/forms/Login.tsx +4 -32
  69. package/src/features/auth/components/forms/Register.tsx +66 -36
  70. package/src/features/auth/data/__tests__/auth.oauth-completion.spec.ts +44 -0
  71. package/src/features/auth/data/__tests__/pending-registration.spec.ts +8 -0
  72. package/src/features/auth/data/auth.service.ts +21 -15
  73. package/src/features/auth/data/pending-registration.interface.ts +1 -0
  74. package/src/features/auth/data/pending-registration.ts +6 -0
  75. package/src/features/auth/hooks/__tests__/useCompleteLogin.spec.tsx +85 -0
  76. package/src/features/auth/hooks/useCompleteLogin.ts +47 -0
  77. package/src/login/__tests__/config.spec.ts +21 -0
  78. package/src/login/config.ts +8 -0
  79. package/src/login/index.ts +1 -0
  80. package/dist/chunk-77JC2UCF.js.map +0 -1
  81. package/dist/chunk-FJUKLVVX.mjs.map +0 -1
  82. package/dist/chunk-M7YK5CCE.mjs.map +0 -1
  83. package/dist/chunk-MNN6MTEN.mjs.map +0 -1
  84. package/dist/chunk-ONU4WCDG.js.map +0 -1
  85. package/dist/chunk-S4FSGMKX.js.map +0 -1
  86. /package/dist/{BlockNoteEditor-SQQF7OCY.mjs.map → BlockNoteEditor-O4E67ECL.mjs.map} +0 -0
  87. /package/dist/{BlockNoteViewer-76CKL6W5.mjs.map → BlockNoteViewer-BNZEXGVT.mjs.map} +0 -0
  88. /package/dist/{chunk-7MGXQIEP.mjs.map → chunk-FDKAVSZ6.mjs.map} +0 -0
@@ -21,13 +21,14 @@ import {
21
21
  getStripePublishableKey,
22
22
  getTrackablePages,
23
23
  getWaitlistConfig,
24
+ isCompanyNameRequired,
24
25
  isDiscordAuthEnabled,
25
26
  isGoogleAuthEnabled,
26
27
  isInternalAuthEnabled,
27
28
  isReferralEnabled,
28
29
  isRegistrationAllowed,
29
30
  useWaitlistText
30
- } from "./chunk-M7YK5CCE.mjs";
31
+ } from "./chunk-JL6XL5NK.mjs";
31
32
  import {
32
33
  getRoleId,
33
34
  isRolesConfigured
@@ -102,7 +103,7 @@ import {
102
103
  useIsMobile,
103
104
  validateItalianTaxCode,
104
105
  validatePartitaIva
105
- } from "./chunk-FJUKLVVX.mjs";
106
+ } from "./chunk-HNK2O6YE.mjs";
106
107
  import {
107
108
  dateFormatLocale,
108
109
  formatDate
@@ -10882,7 +10883,7 @@ import { useRef as useRef18 } from "react";
10882
10883
  import dynamic from "next/dynamic";
10883
10884
  import React18 from "react";
10884
10885
  import { jsx as jsx91 } from "react/jsx-runtime";
10885
- var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-SQQF7OCY.mjs"), {
10886
+ var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-O4E67ECL.mjs"), {
10886
10887
  ssr: false
10887
10888
  });
10888
10889
  var BlockNoteEditorContainer = React18.memo(/* @__PURE__ */ __name(function EditorContainer(props) {
@@ -17316,7 +17317,7 @@ __name(removeTrailingEmptyBlocks, "removeTrailingEmptyBlocks");
17316
17317
  import dynamic2 from "next/dynamic";
17317
17318
  import React29 from "react";
17318
17319
  import { jsx as jsx178 } from "react/jsx-runtime";
17319
- var BlockNoteViewer = dynamic2(() => import("./BlockNoteViewer-76CKL6W5.mjs").then((m) => m.BlockNoteViewer), { ssr: false });
17320
+ var BlockNoteViewer = dynamic2(() => import("./BlockNoteViewer-BNZEXGVT.mjs").then((m) => m.BlockNoteViewer), { ssr: false });
17320
17321
  var BlockNoteViewerContainer = React29.memo(/* @__PURE__ */ __name(function ViewerContainer(props) {
17321
17322
  return /* @__PURE__ */ jsx178(BlockNoteViewer, { ...props });
17322
17323
  }, "ViewerContainer"));
@@ -20455,19 +20456,50 @@ import { zodResolver as zodResolver6 } from "@hookform/resolvers/zod";
20455
20456
  import { Loader2 as Loader26 } from "lucide-react";
20456
20457
  import { useTranslations as useTranslations90 } from "next-intl";
20457
20458
  import Image7 from "next/image";
20458
- import { useSearchParams as useSearchParams2 } from "next/navigation";
20459
+ import { useSearchParams as useSearchParams3 } from "next/navigation";
20459
20460
  import { useEffect as useEffect59, useState as useState76 } from "react";
20460
20461
  import { useForm as useForm6 } from "react-hook-form";
20461
20462
  import { v4 as v46 } from "uuid";
20462
20463
  import { z as z7 } from "zod";
20463
20464
 
20465
+ // src/features/auth/hooks/useCompleteLogin.ts
20466
+ import { useRouter, useSearchParams as useSearchParams2 } from "next/navigation";
20467
+ import { useCallback as useCallback41 } from "react";
20468
+ function useCompleteLogin() {
20469
+ const { setUser } = useCurrentUserContext();
20470
+ const { setComponentType, setPendingTwoFactor } = useAuthContext();
20471
+ const generateUrl = usePageUrlGenerator();
20472
+ const i18nRouter = useI18nRouter();
20473
+ const nativeRouter = useRouter();
20474
+ const searchParams = useSearchParams2();
20475
+ const callbackUrl = searchParams.get("callbackUrl");
20476
+ return useCallback41(
20477
+ (response) => {
20478
+ if ("pendingToken" in response) {
20479
+ setPendingTwoFactor(response);
20480
+ setComponentType("2fa_challenge" /* TwoFactorChallenge */);
20481
+ return;
20482
+ }
20483
+ setUser(response);
20484
+ if (callbackUrl) {
20485
+ nativeRouter.replace(callbackUrl);
20486
+ } else {
20487
+ i18nRouter.replace(generateUrl({ page: `/` }));
20488
+ }
20489
+ },
20490
+ [setUser, setComponentType, setPendingTwoFactor, generateUrl, i18nRouter, nativeRouter, callbackUrl]
20491
+ );
20492
+ }
20493
+ __name(useCompleteLogin, "useCompleteLogin");
20494
+
20464
20495
  // src/features/auth/components/GdprConsentSection.tsx
20465
20496
  import { useTranslations as useTranslations89 } from "next-intl";
20466
20497
  import { Fragment as Fragment35, jsx as jsx212, jsxs as jsxs118 } from "react/jsx-runtime";
20467
20498
  function GdprConsentSection({
20468
20499
  form,
20469
20500
  termsCheckboxId = "termsAccepted",
20470
- marketingCheckboxId = "marketingConsent"
20501
+ marketingCheckboxId = "marketingConsent",
20502
+ testId
20471
20503
  }) {
20472
20504
  const t = useTranslations89("auth.gdpr");
20473
20505
  const termsLabel = /* @__PURE__ */ jsxs118(Fragment35, { children: [
@@ -20479,7 +20511,7 @@ function GdprConsentSection({
20479
20511
  " ",
20480
20512
  /* @__PURE__ */ jsx212(Link, { href: "/privacy", target: "_blank", rel: "noopener", children: t("privacy_policy") })
20481
20513
  ] });
20482
- return /* @__PURE__ */ jsxs118("div", { className: "space-y-4 py-4", children: [
20514
+ return /* @__PURE__ */ jsxs118("div", { className: "space-y-4 py-4", "data-testid": testId, children: [
20483
20515
  /* @__PURE__ */ jsx212(GdprConsentCheckbox, { form, id: termsCheckboxId, label: termsLabel, required: true }),
20484
20516
  /* @__PURE__ */ jsx212(
20485
20517
  GdprConsentCheckbox,
@@ -20525,9 +20557,11 @@ __name(buildOAuthQueryParams, "buildOAuthQueryParams");
20525
20557
  function Register() {
20526
20558
  const t = useTranslations90();
20527
20559
  const { setComponentType } = useAuthContext();
20528
- const searchParams = useSearchParams2();
20560
+ const searchParams = useSearchParams3();
20529
20561
  const inviteCode = searchParams.get("invite");
20530
20562
  const registrationMode = getRegistrationMode();
20563
+ const showCompanyField = isCompanyNameRequired();
20564
+ const completeLogin = useCompleteLogin();
20531
20565
  const [showConfirmation, setShowConfirmation] = useState76(false);
20532
20566
  const [inviteValidated, setInviteValidated] = useState76(false);
20533
20567
  const [inviteError, setInviteError] = useState76("");
@@ -20542,9 +20576,7 @@ function Register() {
20542
20576
  setSignupSource(getSignupSource());
20543
20577
  }, []);
20544
20578
  const formSchema = z7.object({
20545
- company: z7.string().min(1, {
20546
- message: t(`common.errors.missing_company_name`)
20547
- }),
20579
+ company: z7.string(),
20548
20580
  name: z7.string().min(1, {
20549
20581
  message: t("common.errors.missing_name")
20550
20582
  }),
@@ -20554,10 +20586,15 @@ function Register() {
20554
20586
  password: z7.string().min(8, t(`auth.errors.password_too_short`)).regex(/^(?=.*[0-9])(?=.*[^a-zA-Z0-9]).*$/, {
20555
20587
  message: t(`auth.errors.password_invalid_format`)
20556
20588
  }),
20557
- termsAccepted: z7.literal(true, {
20558
- message: t("auth.gdpr.terms_required")
20559
- }),
20589
+ termsAccepted: z7.boolean(),
20560
20590
  marketingConsent: z7.boolean().optional()
20591
+ }).superRefine((values, ctx) => {
20592
+ if (showCompanyField && values.company.length < 1) {
20593
+ ctx.addIssue({ code: "custom", path: ["company"], message: t(`common.errors.missing_company_name`) });
20594
+ }
20595
+ if (!inviteValidated && values.termsAccepted !== true) {
20596
+ ctx.addIssue({ code: "custom", path: ["termsAccepted"], message: t("auth.gdpr.terms_required") });
20597
+ }
20561
20598
  });
20562
20599
  const form = useForm6({
20563
20600
  resolver: zodResolver6(formSchema),
@@ -20598,19 +20635,25 @@ function Register() {
20598
20635
  try {
20599
20636
  const payload = {
20600
20637
  id: v46(),
20601
- companyName: values.company,
20638
+ // Hidden company field: the server names the company after the user
20639
+ companyName: showCompanyField ? values.company : void 0,
20602
20640
  name: values.name,
20603
20641
  email: values.email,
20604
20642
  password: values.password,
20605
- termsAcceptedAt: (/* @__PURE__ */ new Date()).toISOString(),
20606
- marketingConsent: values.marketingConsent ?? false,
20607
- marketingConsentAt: values.marketingConsent ? (/* @__PURE__ */ new Date()).toISOString() : null,
20643
+ // An invite sign-up takes Terms and marketing consent from the waitlist entry on the server
20644
+ termsAcceptedAt: inviteValidated ? void 0 : (/* @__PURE__ */ new Date()).toISOString(),
20645
+ marketingConsent: inviteValidated ? void 0 : values.marketingConsent ?? false,
20646
+ marketingConsentAt: inviteValidated ? void 0 : values.marketingConsent ? (/* @__PURE__ */ new Date()).toISOString() : null,
20608
20647
  inviteCode: inviteCode ?? void 0,
20609
20648
  referralCode: referralCode ?? void 0,
20610
20649
  source: getSignupSource()
20611
20650
  };
20612
20651
  await AuthService.register(payload);
20613
20652
  clearReferralCode();
20653
+ if (inviteValidated) {
20654
+ completeLogin(await AuthService.login({ email: values.email, password: values.password }));
20655
+ return;
20656
+ }
20614
20657
  setShowConfirmation(true);
20615
20658
  } catch (e) {
20616
20659
  errorToast({ title: t("common.errors.error"), error: e });
@@ -20656,7 +20699,7 @@ function Register() {
20656
20699
  ] });
20657
20700
  }
20658
20701
  return /* @__PURE__ */ jsxs119(Fragment36, { children: [
20659
- /* @__PURE__ */ jsxs119(CardHeader, { children: [
20702
+ /* @__PURE__ */ jsxs119(CardHeader, { "data-testid": "page-register-container", children: [
20660
20703
  /* @__PURE__ */ jsxs119(CardTitle, { className: "text-primary flex flex-col items-center pb-10 text-4xl", children: [
20661
20704
  /* @__PURE__ */ jsx213(Image7, { src: "/logo.webp", alt: "Logo", width: 100, height: 100, priority: true }),
20662
20705
  t(`auth.buttons.register`)
@@ -20665,14 +20708,15 @@ function Register() {
20665
20708
  ] }),
20666
20709
  showConfirmation ? /* @__PURE__ */ jsx213(CardContent, { children: /* @__PURE__ */ jsx213(CardDescription, { className: "text-center text-xl", children: t("auth.register_confirmation") }) }) : /* @__PURE__ */ jsx213(Form, { ...form, children: /* @__PURE__ */ jsxs119("form", { onSubmit: form.handleSubmit(onSubmit), children: [
20667
20710
  /* @__PURE__ */ jsxs119(CardContent, { children: [
20668
- /* @__PURE__ */ jsx213(
20711
+ showCompanyField && /* @__PURE__ */ jsx213(
20669
20712
  FormInput,
20670
20713
  {
20671
20714
  isRequired: true,
20672
20715
  form,
20673
20716
  id: "company",
20674
20717
  name: t(`company.fields.name.label`),
20675
- placeholder: t(`company.fields.name.placeholder`)
20718
+ placeholder: t(`company.fields.name.placeholder`),
20719
+ testId: "form-register-input-company"
20676
20720
  }
20677
20721
  ),
20678
20722
  /* @__PURE__ */ jsx213(
@@ -20682,7 +20726,8 @@ function Register() {
20682
20726
  form,
20683
20727
  id: "name",
20684
20728
  name: t(`user.fields.name.label`),
20685
- placeholder: t(`user.fields.name.placeholder`)
20729
+ placeholder: t(`user.fields.name.placeholder`),
20730
+ testId: "form-register-input-name"
20686
20731
  }
20687
20732
  ),
20688
20733
  /* @__PURE__ */ jsx213(
@@ -20694,7 +20739,8 @@ function Register() {
20694
20739
  name: t(`common.fields.email.label`),
20695
20740
  placeholder: t(`common.fields.email.placeholder`),
20696
20741
  disabled: inviteValidated,
20697
- description: inviteValidated ? t("waitlist.invite.email_locked_hint") : void 0
20742
+ description: inviteValidated ? t("waitlist.invite.email_locked_hint") : void 0,
20743
+ testId: "form-register-input-email"
20698
20744
  }
20699
20745
  ),
20700
20746
  /* @__PURE__ */ jsx213(
@@ -20704,11 +20750,12 @@ function Register() {
20704
20750
  form,
20705
20751
  id: "password",
20706
20752
  name: t(`user.fields.password.label`),
20707
- placeholder: t(`user.fields.password.placeholder`)
20753
+ placeholder: t(`user.fields.password.placeholder`),
20754
+ testId: "form-register-input-password"
20708
20755
  }
20709
20756
  ),
20710
- /* @__PURE__ */ jsx213(GdprConsentSection, { form }),
20711
- /* @__PURE__ */ jsx213(Button, { className: "mt-4 w-full", type: "submit", children: t(`auth.buttons.register`) }),
20757
+ !inviteValidated && /* @__PURE__ */ jsx213(GdprConsentSection, { form, testId: "form-register-consent" }),
20758
+ /* @__PURE__ */ jsx213(Button, { className: "mt-4 w-full", type: "submit", "data-testid": "form-register-button-submit", children: t(`auth.buttons.register`) }),
20712
20759
  (registrationMode !== "waitlist" || inviteValidated) && (isGoogleAuthEnabled() || isDiscordAuthEnabled()) && /* @__PURE__ */ jsxs119("div", { className: "space-y-4 pt-4", children: [
20713
20760
  /* @__PURE__ */ jsxs119("div", { className: "relative", children: [
20714
20761
  /* @__PURE__ */ jsx213("div", { className: "absolute inset-0 flex items-center", children: /* @__PURE__ */ jsx213("span", { className: "w-full border-t" }) }),
@@ -20874,7 +20921,7 @@ __name(InnerAuthContainer, "InnerAuthContainer");
20874
20921
  // src/features/auth/components/two-factor/TwoFactorSettings.tsx
20875
20922
  import { ShieldAlert, ShieldCheck } from "lucide-react";
20876
20923
  import { useTranslations as useTranslations97 } from "next-intl";
20877
- import { useCallback as useCallback41, useEffect as useEffect61, useState as useState85 } from "react";
20924
+ import { useCallback as useCallback42, useEffect as useEffect61, useState as useState85 } from "react";
20878
20925
  import { v4 as v49 } from "uuid";
20879
20926
 
20880
20927
  // src/features/auth/components/two-factor/BackupCodesDialog.tsx
@@ -21480,7 +21527,7 @@ function TwoFactorSettings() {
21480
21527
  const [isLoading, setIsLoading] = useState85(true);
21481
21528
  const [isEnabling, setIsEnabling] = useState85(false);
21482
21529
  const [passkeyDialogOpen, setPasskeyDialogOpen] = useState85(false);
21483
- const loadStatus = useCallback41(async () => {
21530
+ const loadStatus = useCallback42(async () => {
21484
21531
  try {
21485
21532
  const [statusData, authenticatorsList, passkeysList] = await Promise.all([
21486
21533
  TwoFactorService.getStatus(),
@@ -21940,20 +21987,14 @@ __name(ForgotPassword, "ForgotPassword");
21940
21987
  import { zodResolver as zodResolver9 } from "@hookform/resolvers/zod";
21941
21988
  import { useTranslations as useTranslations103 } from "next-intl";
21942
21989
  import Image13 from "next/image";
21943
- import { useRouter, useSearchParams as useSearchParams3 } from "next/navigation";
21944
21990
  import { useEffect as useEffect65, useState as useState90 } from "react";
21945
21991
  import { useForm as useForm9 } from "react-hook-form";
21946
21992
  import { z as z10 } from "zod";
21947
21993
  import { Fragment as Fragment43, jsx as jsx230, jsxs as jsxs133 } from "react/jsx-runtime";
21948
21994
  function Login() {
21949
21995
  const t = useTranslations103();
21950
- const { setUser } = useCurrentUserContext();
21951
- const { setComponentType, setPendingTwoFactor } = useAuthContext();
21952
- const generateUrl = usePageUrlGenerator();
21953
- const i18nRouter = useI18nRouter();
21954
- const nativeRouter = useRouter();
21955
- const searchParams = useSearchParams3();
21956
- const callbackUrl = searchParams.get("callbackUrl");
21996
+ const { setComponentType } = useAuthContext();
21997
+ const completeLogin = useCompleteLogin();
21957
21998
  const [referralCode, setReferralCode2] = useState90(null);
21958
21999
  useEffect65(() => {
21959
22000
  const cookies = document.cookie.split("; ");
@@ -21989,19 +22030,7 @@ function Login() {
21989
22030
  email: values.email,
21990
22031
  password: values.password
21991
22032
  });
21992
- if ("pendingToken" in response) {
21993
- const challenge = response;
21994
- setPendingTwoFactor(challenge);
21995
- setComponentType("2fa_challenge" /* TwoFactorChallenge */);
21996
- return;
21997
- }
21998
- const user = response;
21999
- setUser(user);
22000
- if (callbackUrl) {
22001
- nativeRouter.replace(callbackUrl);
22002
- } else {
22003
- i18nRouter.replace(generateUrl({ page: `/` }));
22004
- }
22033
+ completeLogin(response);
22005
22034
  } catch (e) {
22006
22035
  console.error("[Login] Login error:", e);
22007
22036
  errorToast({
@@ -22588,7 +22617,7 @@ var AI_CONNECTIONS_I18N_KEYS = [
22588
22617
 
22589
22618
  // src/features/ai-connection/contexts/AiConnectionsContext.tsx
22590
22619
  import { useTranslations as useTranslations108 } from "next-intl";
22591
- import { createContext as createContext30, useCallback as useCallback42, useContext as useContext30, useEffect as useEffect69, useMemo as useMemo41, useState as useState94 } from "react";
22620
+ import { createContext as createContext30, useCallback as useCallback43, useContext as useContext30, useEffect as useEffect69, useMemo as useMemo41, useState as useState94 } from "react";
22592
22621
  import { jsx as jsx236 } from "react/jsx-runtime";
22593
22622
  var defaultContextValue4 = {
22594
22623
  connections: [],
@@ -22609,7 +22638,7 @@ var AiConnectionsProvider = /* @__PURE__ */ __name(({ children }) => {
22609
22638
  const [envDefaults, setEnvDefaults] = useState94({});
22610
22639
  const [scopeCompanyId, setScopeCompanyId] = useState94(null);
22611
22640
  const [isLoading, setIsLoading] = useState94(true);
22612
- const refresh = useCallback42(async () => {
22641
+ const refresh = useCallback43(async () => {
22613
22642
  setIsLoading(true);
22614
22643
  try {
22615
22644
  const response = await AiConnectionService.listConnections();
@@ -22698,7 +22727,7 @@ __name(AiConnectionDeleter, "AiConnectionDeleter");
22698
22727
  // src/features/ai-connection/components/forms/AiConnectionEditor.tsx
22699
22728
  import { zodResolver as zodResolver11 } from "@hookform/resolvers/zod";
22700
22729
  import { useTranslations as useTranslations110 } from "next-intl";
22701
- import { useCallback as useCallback43, useEffect as useEffect70, useMemo as useMemo42 } from "react";
22730
+ import { useCallback as useCallback44, useEffect as useEffect70, useMemo as useMemo42 } from "react";
22702
22731
  import { useForm as useForm11 } from "react-hook-form";
22703
22732
  import { v4 as v412 } from "uuid";
22704
22733
  import { z as z12 } from "zod";
@@ -22725,11 +22754,11 @@ function AiConnectionEditor({
22725
22754
  const isEdit = !!connection;
22726
22755
  const registryRows = useMemo42(() => providerRegistry[connectionType] ?? [], [providerRegistry, connectionType]);
22727
22756
  const providers = useMemo42(() => registryRows.map((row) => row.provider), [registryRows]);
22728
- const fieldsFor = useCallback43(
22757
+ const fieldsFor = useCallback44(
22729
22758
  (provider) => registryRows.find((row) => row.provider === provider)?.fields ?? [],
22730
22759
  [registryRows]
22731
22760
  );
22732
- const defaultsFor = useCallback43(
22761
+ const defaultsFor = useCallback44(
22733
22762
  (provider) => {
22734
22763
  const stored = connection;
22735
22764
  const seeded = {};
@@ -22751,7 +22780,7 @@ function AiConnectionEditor({
22751
22780
  },
22752
22781
  [connection, fieldsFor]
22753
22782
  );
22754
- const hasStoredSecret = useCallback43(
22783
+ const hasStoredSecret = useCallback44(
22755
22784
  (field) => {
22756
22785
  if (!connection) return false;
22757
22786
  if (field === "apiKey") return connection.hasApiKey;
@@ -22781,7 +22810,7 @@ function AiConnectionEditor({
22781
22810
  }),
22782
22811
  [t, fieldsFor, hasStoredSecret]
22783
22812
  );
22784
- const getDefaultValues = useCallback43(
22813
+ const getDefaultValues = useCallback44(
22785
22814
  () => ({
22786
22815
  id: connection?.id ?? v412(),
22787
22816
  name: connection?.name ?? "",
@@ -23405,7 +23434,7 @@ registerTableGenerator("email-blasts", useEmailBlastTableStructure);
23405
23434
  // src/features/email-blast/components/forms/EmailBlastEditor.tsx
23406
23435
  import { zodResolver as zodResolver12 } from "@hookform/resolvers/zod";
23407
23436
  import { useTranslations as useTranslations118 } from "next-intl";
23408
- import { useCallback as useCallback44, useMemo as useMemo46 } from "react";
23437
+ import { useCallback as useCallback45, useMemo as useMemo46 } from "react";
23409
23438
  import { useForm as useForm12 } from "react-hook-form";
23410
23439
  import { v4 as v413 } from "uuid";
23411
23440
  import { z as z13 } from "zod";
@@ -23437,7 +23466,7 @@ function EmailBlastEditorInternal({
23437
23466
  }),
23438
23467
  [t]
23439
23468
  );
23440
- const getDefaultValues = useCallback44(
23469
+ const getDefaultValues = useCallback45(
23441
23470
  () => ({
23442
23471
  id: blast?.id ?? v413(),
23443
23472
  subject: blast?.subject ?? "",
@@ -23579,7 +23608,7 @@ __name(EmailBlastsListContainer, "EmailBlastsListContainer");
23579
23608
  // src/features/email-blast/components/containers/EmailBlastContainer.tsx
23580
23609
  import { LoaderCircleIcon as LoaderCircleIcon5, MailCheckIcon } from "lucide-react";
23581
23610
  import { useTranslations as useTranslations122 } from "next-intl";
23582
- import { useCallback as useCallback45, useEffect as useEffect73, useState as useState99 } from "react";
23611
+ import { useCallback as useCallback46, useEffect as useEffect73, useState as useState99 } from "react";
23583
23612
 
23584
23613
  // src/features/email-blast/components/forms/EmailBlastSendDialog.tsx
23585
23614
  import { LoaderCircleIcon as LoaderCircleIcon4, SendIcon as SendIcon2 } from "lucide-react";
@@ -23672,7 +23701,7 @@ function EmailBlastContainer({ blastId }) {
23672
23701
  const dates = useDateFormatter();
23673
23702
  const generateUrl = usePageUrlGenerator();
23674
23703
  const [blast, setBlast] = useState99(void 0);
23675
- const reload = useCallback45(async () => {
23704
+ const reload = useCallback46(async () => {
23676
23705
  setBlast(await EmailBlastService.findOne({ id: blastId }));
23677
23706
  }, [blastId]);
23678
23707
  useEffect73(() => {
@@ -23766,7 +23795,7 @@ __name(EmailBlastContainer, "EmailBlastContainer");
23766
23795
  // src/features/how-to/components/containers/HowToCommand.tsx
23767
23796
  import { ArrowRight, LifeBuoyIcon } from "lucide-react";
23768
23797
  import { useTranslations as useTranslations124 } from "next-intl";
23769
- import { useCallback as useCallback46, useEffect as useEffect74, useMemo as useMemo48, useRef as useRef41, useState as useState100 } from "react";
23798
+ import { useCallback as useCallback47, useEffect as useEffect74, useMemo as useMemo48, useRef as useRef41, useState as useState100 } from "react";
23770
23799
 
23771
23800
  // src/features/how-to/components/containers/HowToCommandViewer.tsx
23772
23801
  import { ArrowLeft, BookOpen, MessageSquare } from "lucide-react";
@@ -23917,7 +23946,7 @@ function HowToCommand({ pathname, contextKeys, extraGroups, onStartChat }) {
23917
23946
  });
23918
23947
  return { relevantHowTos: relevant, otherHowTos: other };
23919
23948
  }, [data.data, pathname, contextKeys]);
23920
- const search = useCallback46(
23949
+ const search = useCallback47(
23921
23950
  async (searchedTerm) => {
23922
23951
  if (searchedTerm === searchTermRef.current) return;
23923
23952
  searchTermRef.current = searchedTerm;
@@ -24248,7 +24277,7 @@ __name(HowToListContainer, "HowToListContainer");
24248
24277
  // src/features/how-to/components/forms/HowToSelector.tsx
24249
24278
  import { CircleX as CircleX3, RefreshCwIcon as RefreshCwIcon5, SearchIcon as SearchIcon7, XIcon as XIcon13 } from "lucide-react";
24250
24279
  import { useTranslations as useTranslations129 } from "next-intl";
24251
- import { useCallback as useCallback47, useEffect as useEffect75, useRef as useRef42, useState as useState102 } from "react";
24280
+ import { useCallback as useCallback48, useEffect as useEffect75, useRef as useRef42, useState as useState102 } from "react";
24252
24281
  import { Fragment as Fragment53, jsx as jsx260, jsxs as jsxs149 } from "react/jsx-runtime";
24253
24282
  function HowToSelector({
24254
24283
  id,
@@ -24270,7 +24299,7 @@ function HowToSelector({
24270
24299
  retrieverParams: {},
24271
24300
  module: Modules.HowTo
24272
24301
  });
24273
- const search = useCallback47(
24302
+ const search = useCallback48(
24274
24303
  async (searchedTerm) => {
24275
24304
  try {
24276
24305
  if (searchedTerm === searchTermRef.current) return;
@@ -24353,7 +24382,7 @@ __name(HowToSelector, "HowToSelector");
24353
24382
 
24354
24383
  // src/features/handbook/components/lists/HandbookContents.tsx
24355
24384
  import { useTranslations as useTranslations145 } from "next-intl";
24356
- import { useCallback as useCallback51, useEffect as useEffect79, useMemo as useMemo55, useState as useState110 } from "react";
24385
+ import { useCallback as useCallback52, useEffect as useEffect79, useMemo as useMemo55, useState as useState110 } from "react";
24357
24386
 
24358
24387
  // src/features/handbook/contexts/HandbookContext.tsx
24359
24388
  import { useTranslations as useTranslations130 } from "next-intl";
@@ -24408,7 +24437,7 @@ var HandbookProvider = /* @__PURE__ */ __name(({ children, page, section, functi
24408
24437
  import { MessagesSquareIcon, Sparkles as Sparkles2 } from "lucide-react";
24409
24438
  import { useTranslations as useTranslations142 } from "next-intl";
24410
24439
  import Link5 from "next/link";
24411
- import { useCallback as useCallback50, useState as useState108 } from "react";
24440
+ import { useCallback as useCallback51, useState as useState108 } from "react";
24412
24441
 
24413
24442
  // src/features/assistant/components/parts/AssistantComposer.tsx
24414
24443
  import { useState as useState103 } from "react";
@@ -24497,10 +24526,10 @@ import { useTranslations as useTranslations133 } from "next-intl";
24497
24526
 
24498
24527
  // src/features/assistant-message/components/parts/tabs/useEntityLabel.ts
24499
24528
  import { useTranslations as useTranslations132 } from "next-intl";
24500
- import { useCallback as useCallback48 } from "react";
24529
+ import { useCallback as useCallback49 } from "react";
24501
24530
  function useEntityLabel() {
24502
24531
  const t = useTranslations132();
24503
- return useCallback48(
24532
+ return useCallback49(
24504
24533
  (type) => {
24505
24534
  const key = `entities.${type}`;
24506
24535
  if (typeof t.has === "function" && !t.has(key)) return type;
@@ -25156,7 +25185,7 @@ __name(AssistantThread, "AssistantThread");
25156
25185
 
25157
25186
  // src/features/handbook/hooks/useHandbookAsk.ts
25158
25187
  import { useTranslations as useTranslations141 } from "next-intl";
25159
- import { useCallback as useCallback49, useEffect as useEffect78, useState as useState107 } from "react";
25188
+ import { useCallback as useCallback50, useEffect as useEffect78, useState as useState107 } from "react";
25160
25189
  import { v4 as v414 } from "uuid";
25161
25190
  function withSources(messages, label) {
25162
25191
  return messages.map((message) => withSourcesInContent(message, label));
@@ -25212,7 +25241,7 @@ function useHandbookAsk(params) {
25212
25241
  cancelled = true;
25213
25242
  };
25214
25243
  }, [handbookThreadId]);
25215
- const syncUrl = useCallback49(
25244
+ const syncUrl = useCallback50(
25216
25245
  (id) => {
25217
25246
  if (!shouldSyncUrl) return;
25218
25247
  const base = `${generateUrl({ page: Modules.HandbookPage })}/chat`;
@@ -25220,7 +25249,7 @@ function useHandbookAsk(params) {
25220
25249
  },
25221
25250
  [generateUrl, shouldSyncUrl]
25222
25251
  );
25223
- const selectThread = useCallback49(
25252
+ const selectThread = useCallback50(
25224
25253
  async (id) => {
25225
25254
  const selected = await HandbookThreadService.findOne({ id });
25226
25255
  setThread(selected);
@@ -25229,12 +25258,12 @@ function useHandbookAsk(params) {
25229
25258
  },
25230
25259
  [syncUrl]
25231
25260
  );
25232
- const startNew = useCallback49(() => {
25261
+ const startNew = useCallback50(() => {
25233
25262
  setThread(void 0);
25234
25263
  setMessages([]);
25235
25264
  syncUrl(void 0);
25236
25265
  }, [syncUrl]);
25237
- const ask = useCallback49(
25266
+ const ask = useCallback50(
25238
25267
  async (question, options) => {
25239
25268
  const trimmed = question.trim();
25240
25269
  if (!trimmed || sending) return;
@@ -25295,7 +25324,7 @@ function HandbookAskSheet({ handbookPageId } = {}) {
25295
25324
  const [scoped, setScoped] = useState108(false);
25296
25325
  const chatUrl = `${generateUrl({ page: Modules.HandbookPage })}/chat`;
25297
25326
  const showThread = !!thread || sending || messages.length > 0;
25298
- const send = useCallback50(
25327
+ const send = useCallback51(
25299
25328
  async (question) => {
25300
25329
  await ask(question, { handbookPageId: scoped ? handbookPageId : void 0 });
25301
25330
  },
@@ -25500,7 +25529,7 @@ function HandbookContents() {
25500
25529
  cancelled = true;
25501
25530
  };
25502
25531
  }, [reloadToken]);
25503
- const refresh = useCallback51(async () => {
25532
+ const refresh = useCallback52(async () => {
25504
25533
  setReloadToken((token) => token + 1);
25505
25534
  }, []);
25506
25535
  const renderedSections = useMemo55(
@@ -25624,7 +25653,7 @@ __name(HandbookPageNeighbours, "HandbookPageNeighbours");
25624
25653
  // src/features/handbook/components/details/HandbookPageToc.tsx
25625
25654
  import { List } from "lucide-react";
25626
25655
  import { useTranslations as useTranslations147 } from "next-intl";
25627
- import { useCallback as useCallback52, useEffect as useEffect80, useState as useState111 } from "react";
25656
+ import { useCallback as useCallback53, useEffect as useEffect80, useState as useState111 } from "react";
25628
25657
  import { jsx as jsx283, jsxs as jsxs165 } from "react/jsx-runtime";
25629
25658
  function HandbookPageToc({ containerId }) {
25630
25659
  const t = useTranslations147();
@@ -25683,7 +25712,7 @@ function HandbookPageToc({ containerId }) {
25683
25712
  });
25684
25713
  return () => observer.disconnect();
25685
25714
  }, [containerId, headingsWithIds]);
25686
- const handleClick = useCallback52(
25715
+ const handleClick = useCallback53(
25687
25716
  (event, id) => {
25688
25717
  const element = headingsWithIds.get(id);
25689
25718
  if (!element) return;
@@ -26244,7 +26273,7 @@ import { useTranslations as useTranslations156 } from "next-intl";
26244
26273
  // src/features/assistant/components/parts/AssistantBlockNoteComposer.tsx
26245
26274
  import { ArrowUp as ArrowUp2 } from "lucide-react";
26246
26275
  import { useTranslations as useTranslations155 } from "next-intl";
26247
- import { useCallback as useCallback53, useId as useId5, useState as useState115 } from "react";
26276
+ import { useCallback as useCallback54, useId as useId5, useState as useState115 } from "react";
26248
26277
  import { jsx as jsx292, jsxs as jsxs173 } from "react/jsx-runtime";
26249
26278
  function flattenBlocks(blocks) {
26250
26279
  const lines = [];
@@ -26286,7 +26315,7 @@ function AssistantBlockNoteComposer({
26286
26315
  const [isEmpty, setIsEmpty] = useState115(true);
26287
26316
  const [resetKey, setResetKey] = useState115(0);
26288
26317
  const canSend = !isEmpty && !disabled;
26289
- const submit = useCallback53(async () => {
26318
+ const submit = useCallback54(async () => {
26290
26319
  if (isEmpty || disabled) return;
26291
26320
  const payload = blocks;
26292
26321
  const plainText = flattenBlocks(payload);
@@ -26295,7 +26324,7 @@ function AssistantBlockNoteComposer({
26295
26324
  setResetKey((previous) => previous + 1);
26296
26325
  await onSend(plainText, { contentBlocks: payload });
26297
26326
  }, [blocks, disabled, isEmpty, onSend]);
26298
- const handleKeyDownCapture = useCallback53(
26327
+ const handleKeyDownCapture = useCallback54(
26299
26328
  (event) => {
26300
26329
  if (event.key !== "Enter" || event.shiftKey) return;
26301
26330
  if (typeof document !== "undefined" && document.querySelector(".bn-suggestion-menu")) return;
@@ -27030,7 +27059,7 @@ __name(NotificationsListContainer, "NotificationsListContainer");
27030
27059
  // src/features/notification/components/modals/NotificationModal.tsx
27031
27060
  import { BellIcon as BellIcon2, ExternalLinkIcon } from "lucide-react";
27032
27061
  import { useTranslations as useTranslations163 } from "next-intl";
27033
- import { Fragment as Fragment63, useCallback as useCallback54, useEffect as useEffect85, useMemo as useMemo63, useRef as useRef46, useState as useState118 } from "react";
27062
+ import { Fragment as Fragment63, useCallback as useCallback55, useEffect as useEffect85, useMemo as useMemo63, useRef as useRef46, useState as useState118 } from "react";
27034
27063
  import { jsx as jsx301, jsxs as jsxs179 } from "react/jsx-runtime";
27035
27064
  function NotificationModalContent({ isOpen, setIsOpen }) {
27036
27065
  const _instanceId = useRef46(Math.random().toString(36).substr(2, 9));
@@ -27059,7 +27088,7 @@ function NotificationModalContent({ isOpen, setIsOpen }) {
27059
27088
  resetTime: 0,
27060
27089
  isOpen: false
27061
27090
  });
27062
- const checkCircuitBreaker = useCallback54(() => {
27091
+ const checkCircuitBreaker = useCallback55(() => {
27063
27092
  const now = Date.now();
27064
27093
  const breaker = circuitBreakerRef.current;
27065
27094
  if (now > breaker.resetTime) {
@@ -27084,7 +27113,7 @@ function NotificationModalContent({ isOpen, setIsOpen }) {
27084
27113
  useEffect85(() => {
27085
27114
  setNewNotifications(unreadCount > 0);
27086
27115
  }, [unreadCount]);
27087
- const processSocketNotifications = useCallback54(() => {
27116
+ const processSocketNotifications = useCallback55(() => {
27088
27117
  if (socketNotifications.length === 0) {
27089
27118
  return;
27090
27119
  }
@@ -27294,7 +27323,7 @@ import { useTranslations as useTranslations165 } from "next-intl";
27294
27323
  // src/features/referral/components/ReferralWidget.tsx
27295
27324
  import { Copy as Copy2, Loader2 as Loader28, Mail, Users } from "lucide-react";
27296
27325
  import { useTranslations as useTranslations164 } from "next-intl";
27297
- import { useCallback as useCallback55, useRef as useRef47, useState as useState121 } from "react";
27326
+ import { useCallback as useCallback56, useRef as useRef47, useState as useState121 } from "react";
27298
27327
 
27299
27328
  // src/features/referral/hooks/useReferralInvite.ts
27300
27329
  import { useState as useState119 } from "react";
@@ -27414,7 +27443,7 @@ function ReferralWidget({
27414
27443
  if (!isReferralEnabled()) {
27415
27444
  return null;
27416
27445
  }
27417
- const handleCopyLink = useCallback55(async () => {
27446
+ const handleCopyLink = useCallback56(async () => {
27418
27447
  if (!referralUrl) return;
27419
27448
  const success = await copyToClipboard(referralUrl);
27420
27449
  if (success) {
@@ -27426,7 +27455,7 @@ function ReferralWidget({
27426
27455
  showError(text.copyError);
27427
27456
  }
27428
27457
  }, [referralUrl, text.copiedMessage, text.copyError, onLinkCopied]);
27429
- const handleSendInvite = useCallback55(async () => {
27458
+ const handleSendInvite = useCallback56(async () => {
27430
27459
  if (!email || !email.includes("@")) {
27431
27460
  showError(text.invalidEmail);
27432
27461
  return;
@@ -27454,7 +27483,7 @@ function ReferralWidget({
27454
27483
  onInviteSent,
27455
27484
  onInviteError
27456
27485
  ]);
27457
- const handleEmailKeyDown = useCallback55(
27486
+ const handleEmailKeyDown = useCallback56(
27458
27487
  (e) => {
27459
27488
  if (e.key === "Enter" && !sending) {
27460
27489
  e.preventDefault();
@@ -28359,7 +28388,7 @@ __name(RemoveUserFromRole, "RemoveUserFromRole");
28359
28388
  // src/features/role/components/forms/UserRoleAdd.tsx
28360
28389
  import { PlusCircle as PlusCircle2 } from "lucide-react";
28361
28390
  import { useTranslations as useTranslations174 } from "next-intl";
28362
- import { useCallback as useCallback56, useEffect as useEffect91, useRef as useRef49, useState as useState124 } from "react";
28391
+ import { useCallback as useCallback57, useEffect as useEffect91, useRef as useRef49, useState as useState124 } from "react";
28363
28392
  import { Fragment as Fragment67, jsx as jsx314, jsxs as jsxs190 } from "react/jsx-runtime";
28364
28393
  function UserRoleAdd({ user, refresh }) {
28365
28394
  const [open, setOpen] = useState124(false);
@@ -28389,7 +28418,7 @@ function UserRoleAdd({ user, refresh }) {
28389
28418
  );
28390
28419
  refresh();
28391
28420
  }, "addUserToRole");
28392
- const searchRoles = useCallback56(
28421
+ const searchRoles = useCallback57(
28393
28422
  async (term) => {
28394
28423
  setRoles(
28395
28424
  await RoleService.findAllRolesUserNotIn({
@@ -28501,7 +28530,7 @@ __name(UserRolesList, "UserRolesList");
28501
28530
 
28502
28531
  // src/features/oauth/components/OAuthRedirectUriInput.tsx
28503
28532
  import { useTranslations as useTranslations177 } from "next-intl";
28504
- import { useCallback as useCallback57 } from "react";
28533
+ import { useCallback as useCallback58 } from "react";
28505
28534
  import { Plus as Plus3, Trash2 as Trash23 } from "lucide-react";
28506
28535
  import { jsx as jsx317, jsxs as jsxs191 } from "react/jsx-runtime";
28507
28536
  function isValidRedirectUri(uri) {
@@ -28533,17 +28562,17 @@ function OAuthRedirectUriInput({
28533
28562
  }) {
28534
28563
  const t = useTranslations177();
28535
28564
  const label = labelProp ?? t("oauth.ui.redirect_uris.label");
28536
- const handleAdd = useCallback57(() => {
28565
+ const handleAdd = useCallback58(() => {
28537
28566
  onChange([...value, ""]);
28538
28567
  }, [value, onChange]);
28539
- const handleRemove = useCallback57(
28568
+ const handleRemove = useCallback58(
28540
28569
  (index) => {
28541
28570
  const newUris = value.filter((_, i) => i !== index);
28542
28571
  onChange(newUris.length > 0 ? newUris : [""]);
28543
28572
  },
28544
28573
  [value, onChange]
28545
28574
  );
28546
- const handleChange = useCallback57(
28575
+ const handleChange = useCallback58(
28547
28576
  (index, newValue) => {
28548
28577
  const newUris = [...value];
28549
28578
  newUris[index] = newValue;
@@ -28598,7 +28627,7 @@ __name(OAuthRedirectUriInput, "OAuthRedirectUriInput");
28598
28627
 
28599
28628
  // src/features/oauth/components/OAuthScopeSelector.tsx
28600
28629
  import { useTranslations as useTranslations178 } from "next-intl";
28601
- import { useCallback as useCallback58 } from "react";
28630
+ import { useCallback as useCallback59 } from "react";
28602
28631
  import { jsx as jsx318, jsxs as jsxs192 } from "react/jsx-runtime";
28603
28632
  function OAuthScopeSelector({
28604
28633
  value,
@@ -28611,7 +28640,7 @@ function OAuthScopeSelector({
28611
28640
  const t = useTranslations178();
28612
28641
  const scopeText = useOAuthScopeText();
28613
28642
  const label = labelProp ?? t("oauth.ui.scope_selector.label");
28614
- const handleToggle = useCallback58(
28643
+ const handleToggle = useCallback59(
28615
28644
  (scope, checked) => {
28616
28645
  if (checked) {
28617
28646
  onChange([...value, scope]);
@@ -28680,13 +28709,13 @@ __name(OAuthScopeSelector, "OAuthScopeSelector");
28680
28709
 
28681
28710
  // src/features/oauth/components/OAuthClientSecretDisplay.tsx
28682
28711
  import { useTranslations as useTranslations179 } from "next-intl";
28683
- import { useState as useState125, useCallback as useCallback59 } from "react";
28712
+ import { useState as useState125, useCallback as useCallback60 } from "react";
28684
28713
  import { Copy as Copy3, Check, AlertTriangle } from "lucide-react";
28685
28714
  import { jsx as jsx319, jsxs as jsxs193 } from "react/jsx-runtime";
28686
28715
  function OAuthClientSecretDisplay({ secret, onDismiss, open, clientName }) {
28687
28716
  const t = useTranslations179();
28688
28717
  const [copied, setCopied] = useState125(false);
28689
- const handleCopy = useCallback59(async () => {
28718
+ const handleCopy = useCallback60(async () => {
28690
28719
  try {
28691
28720
  await navigator.clipboard.writeText(secret);
28692
28721
  setCopied(true);
@@ -28695,7 +28724,7 @@ function OAuthClientSecretDisplay({ secret, onDismiss, open, clientName }) {
28695
28724
  console.error("Failed to copy to clipboard:", err);
28696
28725
  }
28697
28726
  }, [secret]);
28698
- const handleDismiss = useCallback59(() => {
28727
+ const handleDismiss = useCallback60(() => {
28699
28728
  setCopied(false);
28700
28729
  onDismiss();
28701
28730
  }, [onDismiss]);
@@ -28883,7 +28912,7 @@ __name(OAuthClientList, "OAuthClientList");
28883
28912
 
28884
28913
  // src/features/oauth/components/OAuthClientForm.tsx
28885
28914
  import { useTranslations as useTranslations182 } from "next-intl";
28886
- import { useState as useState126, useCallback as useCallback60 } from "react";
28915
+ import { useState as useState126, useCallback as useCallback61 } from "react";
28887
28916
  import { jsx as jsx322, jsxs as jsxs196 } from "react/jsx-runtime";
28888
28917
  function OAuthClientForm({
28889
28918
  client,
@@ -28903,7 +28932,7 @@ function OAuthClientForm({
28903
28932
  isConfidential: client?.isConfidential ?? true
28904
28933
  });
28905
28934
  const [errors, setErrors] = useState126({});
28906
- const validate = useCallback60(() => {
28935
+ const validate = useCallback61(() => {
28907
28936
  const newErrors = {};
28908
28937
  if (!formState.name.trim()) {
28909
28938
  newErrors.name = t("oauth.ui.form.errors.name_required");
@@ -28918,7 +28947,7 @@ function OAuthClientForm({
28918
28947
  setErrors(newErrors);
28919
28948
  return Object.keys(newErrors).length === 0;
28920
28949
  }, [formState, t]);
28921
- const handleSubmit = useCallback60(
28950
+ const handleSubmit = useCallback61(
28922
28951
  async (e) => {
28923
28952
  e.preventDefault();
28924
28953
  if (!validate()) return;
@@ -29030,7 +29059,7 @@ __name(OAuthClientForm, "OAuthClientForm");
29030
29059
 
29031
29060
  // src/features/oauth/components/OAuthClientDetail.tsx
29032
29061
  import { useTranslations as useTranslations183 } from "next-intl";
29033
- import { useState as useState127, useCallback as useCallback61 } from "react";
29062
+ import { useState as useState127, useCallback as useCallback62 } from "react";
29034
29063
  import { Copy as Copy4, Check as Check2, RefreshCw as RefreshCw3, Pencil as Pencil2, Trash2 as Trash25, ExternalLink } from "lucide-react";
29035
29064
  import { Fragment as Fragment68, jsx as jsx323, jsxs as jsxs197 } from "react/jsx-runtime";
29036
29065
  function OAuthClientDetail({
@@ -29048,7 +29077,7 @@ function OAuthClientDetail({
29048
29077
  const [showRegenerateConfirm, setShowRegenerateConfirm] = useState127(false);
29049
29078
  const [isDeleting, setIsDeleting] = useState127(false);
29050
29079
  const [isRegenerating, setIsRegenerating] = useState127(false);
29051
- const copyToClipboard2 = useCallback61(async (text, field) => {
29080
+ const copyToClipboard2 = useCallback62(async (text, field) => {
29052
29081
  try {
29053
29082
  await navigator.clipboard.writeText(text);
29054
29083
  setCopiedField(field);
@@ -29057,7 +29086,7 @@ function OAuthClientDetail({
29057
29086
  console.error("Failed to copy:", err);
29058
29087
  }
29059
29088
  }, []);
29060
- const handleDelete = useCallback61(async () => {
29089
+ const handleDelete = useCallback62(async () => {
29061
29090
  if (!onDelete) return;
29062
29091
  setIsDeleting(true);
29063
29092
  try {
@@ -29067,7 +29096,7 @@ function OAuthClientDetail({
29067
29096
  setShowDeleteConfirm(false);
29068
29097
  }
29069
29098
  }, [onDelete]);
29070
- const handleRegenerateSecret = useCallback61(async () => {
29099
+ const handleRegenerateSecret = useCallback62(async () => {
29071
29100
  if (!onRegenerateSecret) return;
29072
29101
  setIsRegenerating(true);
29073
29102
  try {
@@ -29681,7 +29710,7 @@ __name(WaitlistConfirmation, "WaitlistConfirmation");
29681
29710
  // src/features/waitlist/components/lists/WaitlistList.tsx
29682
29711
  import { RefreshCw as RefreshCw4 } from "lucide-react";
29683
29712
  import { useTranslations as useTranslations192 } from "next-intl";
29684
- import { useCallback as useCallback62, useEffect as useEffect93, useMemo as useMemo69, useState as useState130 } from "react";
29713
+ import { useCallback as useCallback63, useEffect as useEffect93, useMemo as useMemo69, useState as useState130 } from "react";
29685
29714
  import { jsx as jsx334, jsxs as jsxs208 } from "react/jsx-runtime";
29686
29715
  function WaitlistList({ fullWidth } = {}) {
29687
29716
  const t = useTranslations192();
@@ -29692,7 +29721,7 @@ function WaitlistList({ fullWidth } = {}) {
29692
29721
  retrieverParams: {},
29693
29722
  module: Modules.Waitlist
29694
29723
  });
29695
- const loadStats = useCallback62(async () => {
29724
+ const loadStats = useCallback63(async () => {
29696
29725
  try {
29697
29726
  setStats(await WaitlistService.getStats());
29698
29727
  } catch (error) {
@@ -29783,7 +29812,7 @@ __name(WaitlistList, "WaitlistList");
29783
29812
  // src/features/rbac/components/RbacContainer.tsx
29784
29813
  import { Loader2Icon as Loader2Icon4 } from "lucide-react";
29785
29814
  import { useTranslations as useTranslations194 } from "next-intl";
29786
- import { memo as memo2, useCallback as useCallback64, useEffect as useEffect95, useMemo as useMemo70, useRef as useRef50, useState as useState132 } from "react";
29815
+ import { memo as memo2, useCallback as useCallback65, useEffect as useEffect95, useMemo as useMemo70, useRef as useRef50, useState as useState132 } from "react";
29787
29816
 
29788
29817
  // src/features/rbac/components/RbacPermissionCell.tsx
29789
29818
  import { CheckIcon as CheckIcon9, MinusIcon as MinusIcon2, XIcon as XIcon14 } from "lucide-react";
@@ -29864,7 +29893,7 @@ __name(RbacPermissionCell, "RbacPermissionCell");
29864
29893
  import { Popover as PopoverPrimitive2 } from "@base-ui/react/popover";
29865
29894
  import { CheckIcon as CheckIcon10, MinusIcon as MinusIcon3, XIcon as XIcon15 } from "lucide-react";
29866
29895
  import { useTranslations as useTranslations193 } from "next-intl";
29867
- import { useCallback as useCallback63, useEffect as useEffect94, useState as useState131 } from "react";
29896
+ import { useCallback as useCallback64, useEffect as useEffect94, useState as useState131 } from "react";
29868
29897
  import { Fragment as Fragment71, jsx as jsx336, jsxs as jsxs210 } from "react/jsx-runtime";
29869
29898
  function RbacPermissionPicker({
29870
29899
  open,
@@ -29882,7 +29911,7 @@ function RbacPermissionPicker({
29882
29911
  if (!open) setCustomSegment("");
29883
29912
  }, [open]);
29884
29913
  const currentSegments = typeof value === "string" ? value.split("|").filter(Boolean) : [];
29885
- const toggleSegment = useCallback63(
29914
+ const toggleSegment = useCallback64(
29886
29915
  (segment) => {
29887
29916
  const next = currentSegments.includes(segment) ? currentSegments.filter((s) => s !== segment) : [...currentSegments, segment];
29888
29917
  if (next.length === 0) onSetValue(false);
@@ -29890,7 +29919,7 @@ function RbacPermissionPicker({
29890
29919
  },
29891
29920
  [currentSegments, onSetValue]
29892
29921
  );
29893
- const addCustomSegment = useCallback63(() => {
29922
+ const addCustomSegment = useCallback64(() => {
29894
29923
  const segment = customSegment.trim();
29895
29924
  if (!segment) return;
29896
29925
  if (!currentSegments.includes(segment)) {
@@ -30054,7 +30083,7 @@ var CellButton = memo2(/* @__PURE__ */ __name(function CellButton2({
30054
30083
  }) {
30055
30084
  const ref = useRef50(null);
30056
30085
  const value = cellValue(tokens, action);
30057
- const handleClick = useCallback64(() => {
30086
+ const handleClick = useCallback65(() => {
30058
30087
  if (!ref.current) return;
30059
30088
  onOpen({ moduleId, rowKey, action, isRoleColumn, anchor: ref.current });
30060
30089
  }, [onOpen, moduleId, rowKey, action, isRoleColumn]);
@@ -30128,13 +30157,13 @@ function RbacContainer() {
30128
30157
  const { matrix, modulePaths, loading, error, roleNames, moduleNames, updateCell, clearCell } = useRbacContext();
30129
30158
  const [selectedModuleId, setSelectedModuleId] = useState132(null);
30130
30159
  const [activePicker, setActivePicker] = useState132(null);
30131
- const openPicker = useCallback64((picker) => {
30160
+ const openPicker = useCallback65((picker) => {
30132
30161
  setActivePicker(picker);
30133
30162
  }, []);
30134
- const closePicker = useCallback64(() => {
30163
+ const closePicker = useCallback65(() => {
30135
30164
  setActivePicker(null);
30136
30165
  }, []);
30137
- const handleSelectModule = useCallback64((id) => {
30166
+ const handleSelectModule = useCallback65((id) => {
30138
30167
  setSelectedModuleId(id);
30139
30168
  setActivePicker(null);
30140
30169
  }, []);
@@ -30171,14 +30200,14 @@ function RbacContainer() {
30171
30200
  if (!activePicker) return [];
30172
30201
  return modulePaths[activePicker.moduleId] ?? [];
30173
30202
  }, [activePicker, modulePaths]);
30174
- const handleSetValue = useCallback64(
30203
+ const handleSetValue = useCallback65(
30175
30204
  (value) => {
30176
30205
  if (!activePicker) return;
30177
30206
  updateCell(activePicker.moduleId, activePicker.rowKey, activePicker.action, value);
30178
30207
  },
30179
30208
  [activePicker, updateCell]
30180
30209
  );
30181
- const handleClear = useCallback64(() => {
30210
+ const handleClear = useCallback65(() => {
30182
30211
  if (!activePicker || !activePicker.isRoleColumn) return;
30183
30212
  clearCell(activePicker.moduleId, activePicker.rowKey, activePicker.action);
30184
30213
  }, [activePicker, clearCell]);
@@ -30238,7 +30267,7 @@ __name(RbacContainer, "RbacContainer");
30238
30267
  // src/features/rbac/components/RbacByRoleContainer.tsx
30239
30268
  import { Loader2Icon as Loader2Icon5 } from "lucide-react";
30240
30269
  import { useTranslations as useTranslations195 } from "next-intl";
30241
- import { Fragment as Fragment72, memo as memo3, useCallback as useCallback65, useEffect as useEffect96, useMemo as useMemo71, useRef as useRef51, useState as useState133 } from "react";
30270
+ import { Fragment as Fragment72, memo as memo3, useCallback as useCallback66, useEffect as useEffect96, useMemo as useMemo71, useRef as useRef51, useState as useState133 } from "react";
30242
30271
  import { jsx as jsx338, jsxs as jsxs212 } from "react/jsx-runtime";
30243
30272
  function findToken2(tokens, action) {
30244
30273
  if (!tokens) return void 0;
@@ -30261,7 +30290,7 @@ var CellButton3 = memo3(/* @__PURE__ */ __name(function CellButton4({
30261
30290
  }) {
30262
30291
  const ref = useRef51(null);
30263
30292
  const value = cellValue2(tokens, action);
30264
- const handleClick = useCallback65(() => {
30293
+ const handleClick = useCallback66(() => {
30265
30294
  if (!ref.current) return;
30266
30295
  onOpen({ moduleId, rowKey, action, isRoleColumn, anchor: ref.current });
30267
30296
  }, [onOpen, moduleId, rowKey, action, isRoleColumn]);
@@ -30278,13 +30307,13 @@ function RbacByRoleContainer() {
30278
30307
  const { matrix, modulePaths, loading, error, roleNames, moduleNames, updateCell, clearCell } = useRbacContext();
30279
30308
  const [selectedRoleId, setSelectedRoleId] = useState133(null);
30280
30309
  const [activePicker, setActivePicker] = useState133(null);
30281
- const openPicker = useCallback65((picker) => {
30310
+ const openPicker = useCallback66((picker) => {
30282
30311
  setActivePicker(picker);
30283
30312
  }, []);
30284
- const closePicker = useCallback65(() => {
30313
+ const closePicker = useCallback66(() => {
30285
30314
  setActivePicker(null);
30286
30315
  }, []);
30287
- const handleSelectRole = useCallback65((id) => {
30316
+ const handleSelectRole = useCallback66((id) => {
30288
30317
  setSelectedRoleId(id);
30289
30318
  setActivePicker(null);
30290
30319
  }, []);
@@ -30312,14 +30341,14 @@ function RbacByRoleContainer() {
30312
30341
  if (!activePicker) return [];
30313
30342
  return modulePaths[activePicker.moduleId] ?? [];
30314
30343
  }, [activePicker, modulePaths]);
30315
- const handleSetValue = useCallback65(
30344
+ const handleSetValue = useCallback66(
30316
30345
  (value) => {
30317
30346
  if (!activePicker) return;
30318
30347
  updateCell(activePicker.moduleId, activePicker.rowKey, activePicker.action, value);
30319
30348
  },
30320
30349
  [activePicker, updateCell]
30321
30350
  );
30322
- const handleClear = useCallback65(() => {
30351
+ const handleClear = useCallback66(() => {
30323
30352
  if (!activePicker || !activePicker.isRoleColumn) return;
30324
30353
  clearCell(activePicker.moduleId, activePicker.rowKey, activePicker.action);
30325
30354
  }, [activePicker, clearCell]);
@@ -31068,4 +31097,4 @@ export {
31068
31097
  useOAuthClients,
31069
31098
  useOAuthClient
31070
31099
  };
31071
- //# sourceMappingURL=chunk-MNN6MTEN.mjs.map
31100
+ //# sourceMappingURL=chunk-BT3VFB3I.mjs.map