@nextsparkjs/core 0.1.0-beta.190 → 0.1.0-beta.191

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 (176) hide show
  1. package/dist/components/dashboard/block-editor/dynamic-form.d.ts.map +1 -1
  2. package/dist/components/dashboard/block-editor/dynamic-form.js +2 -2
  3. package/dist/components/dashboard/layouts/TopNavbar.js +1 -1
  4. package/dist/components/dashboard/mobile/MobileTopBar.js +3 -2
  5. package/dist/emails/otp-verification.d.ts.map +1 -1
  6. package/dist/emails/otp-verification.js +1 -1
  7. package/dist/emails/reset-password.d.ts.map +1 -1
  8. package/dist/emails/reset-password.js +1 -1
  9. package/dist/emails/team-invitation.d.ts.map +1 -1
  10. package/dist/emails/team-invitation.js +1 -1
  11. package/dist/emails/verify-email.d.ts.map +1 -1
  12. package/dist/emails/verify-email.js +1 -1
  13. package/dist/lib/actions/entity.actions.js +8 -8
  14. package/dist/lib/actions/team.actions.js +7 -7
  15. package/dist/lib/api/entity/generic-handler.js +5 -5
  16. package/dist/lib/api/permission-middleware.js +1 -1
  17. package/dist/lib/auth/registration-guard-plugin.d.ts.map +1 -1
  18. package/dist/lib/auth/registration-guard-plugin.js +2 -2
  19. package/dist/lib/auth-email-callbacks.d.ts +3 -1
  20. package/dist/lib/auth-email-callbacks.d.ts.map +1 -1
  21. package/dist/lib/auth-email-callbacks.js +8 -2
  22. package/dist/lib/auth.d.ts.map +1 -1
  23. package/dist/lib/auth.js +4 -3
  24. package/dist/lib/billing/gateways/stripe.js +1 -1
  25. package/dist/lib/entities/hooks.js +1 -1
  26. package/dist/templates/app/(auth)/accept-invite/[token]/page.tsx +1 -1
  27. package/dist/templates/app/(auth)/auth-error/page.tsx +1 -1
  28. package/dist/templates/app/(auth)/forgot-password/page.tsx +1 -1
  29. package/dist/templates/app/(auth)/layout.tsx +1 -1
  30. package/dist/templates/app/(auth)/login/page.tsx +1 -1
  31. package/dist/templates/app/(auth)/reset-password/page.tsx +1 -1
  32. package/dist/templates/app/(auth)/signup/page.tsx +1 -1
  33. package/dist/templates/app/(auth)/verify-email/page.tsx +1 -1
  34. package/dist/templates/app/(public)/[...slug]/page.tsx +3 -3
  35. package/dist/templates/app/(public)/layout.tsx +1 -1
  36. package/dist/templates/app/(public)/page.tsx +1 -1
  37. package/dist/templates/app/403/page.tsx +1 -1
  38. package/dist/templates/app/dashboard/(main)/[entity]/[id]/edit/page.tsx +1 -1
  39. package/dist/templates/app/dashboard/(main)/[entity]/[id]/page.tsx +4 -4
  40. package/dist/templates/app/dashboard/(main)/[entity]/create/page.tsx +1 -1
  41. package/dist/templates/app/dashboard/(main)/[entity]/loading.tsx +1 -1
  42. package/dist/templates/app/dashboard/(main)/[entity]/page.tsx +1 -1
  43. package/dist/templates/app/dashboard/(main)/layout.tsx +1 -1
  44. package/dist/templates/app/dashboard/(main)/loading.tsx +1 -1
  45. package/dist/templates/app/dashboard/(main)/media/page.tsx +1 -1
  46. package/dist/templates/app/dashboard/(main)/page.tsx +1 -1
  47. package/dist/templates/app/dashboard/(main)/patterns/[id]/edit/page.tsx +1 -1
  48. package/dist/templates/app/dashboard/(main)/patterns/[id]/page.tsx +1 -1
  49. package/dist/templates/app/dashboard/(main)/patterns/[id]/reports/page.tsx +1 -1
  50. package/dist/templates/app/dashboard/(main)/patterns/create/page.tsx +1 -1
  51. package/dist/templates/app/dashboard/(main)/patterns/page.tsx +1 -1
  52. package/dist/templates/app/dashboard/features/analytics/page.tsx +1 -1
  53. package/dist/templates/app/dashboard/features/automation/page.tsx +1 -1
  54. package/dist/templates/app/dashboard/features/layout.tsx +1 -1
  55. package/dist/templates/app/dashboard/features/loading.tsx +1 -1
  56. package/dist/templates/app/dashboard/features/webhooks/page.tsx +1 -1
  57. package/dist/templates/app/dashboard/layout.tsx +1 -1
  58. package/dist/templates/app/dashboard/permission-denied/page.tsx +1 -1
  59. package/dist/templates/app/dashboard/settings/api-keys/loading.tsx +1 -1
  60. package/dist/templates/app/dashboard/settings/api-keys/page.tsx +1 -1
  61. package/dist/templates/app/dashboard/settings/billing/loading.tsx +1 -1
  62. package/dist/templates/app/dashboard/settings/billing/page.tsx +1 -1
  63. package/dist/templates/app/dashboard/settings/invoices/[invoiceNumber]/page.tsx +1 -1
  64. package/dist/templates/app/dashboard/settings/invoices/loading.tsx +1 -1
  65. package/dist/templates/app/dashboard/settings/invoices/page.tsx +1 -1
  66. package/dist/templates/app/dashboard/settings/layout.tsx +1 -1
  67. package/dist/templates/app/dashboard/settings/loading.tsx +1 -1
  68. package/dist/templates/app/dashboard/settings/notifications/loading.tsx +1 -1
  69. package/dist/templates/app/dashboard/settings/notifications/page.tsx +1 -1
  70. package/dist/templates/app/dashboard/settings/page.tsx +1 -1
  71. package/dist/templates/app/dashboard/settings/password/loading.tsx +1 -1
  72. package/dist/templates/app/dashboard/settings/password/page.tsx +1 -1
  73. package/dist/templates/app/dashboard/settings/plans/loading.tsx +1 -1
  74. package/dist/templates/app/dashboard/settings/plans/page.tsx +1 -1
  75. package/dist/templates/app/dashboard/settings/profile/loading.tsx +1 -1
  76. package/dist/templates/app/dashboard/settings/profile/page.tsx +1 -1
  77. package/dist/templates/app/dashboard/settings/security/loading.tsx +1 -1
  78. package/dist/templates/app/dashboard/settings/security/page.tsx +1 -1
  79. package/dist/templates/app/dashboard/settings/teams/loading.tsx +1 -1
  80. package/dist/templates/app/dashboard/settings/teams/page.tsx +1 -1
  81. package/dist/templates/app/dashboard/settings/teams/permissions/page.tsx +1 -1
  82. package/dist/templates/app/devtools/api/[[...endpoint]]/page.tsx +1 -1
  83. package/dist/templates/app/devtools/config/page.tsx +1 -1
  84. package/dist/templates/app/devtools/layout.tsx +3 -2
  85. package/dist/templates/app/devtools/tests/[[...path]]/page.tsx +1 -1
  86. package/dist/templates/app/layout.ppr.tsx +1 -1
  87. package/dist/templates/app/layout.tsx +1 -1
  88. package/dist/templates/app/public/page.tsx +1 -1
  89. package/dist/templates/app/superadmin/layout.tsx +1 -1
  90. package/dist/templates/app/superadmin/page.tsx +1 -1
  91. package/dist/templates/app/superadmin/subscriptions/page.tsx +1 -1
  92. package/dist/templates/app/superadmin/team-roles/page.tsx +1 -1
  93. package/dist/templates/app/superadmin/teams/[teamId]/page.tsx +1 -1
  94. package/dist/templates/app/superadmin/teams/page.tsx +1 -1
  95. package/dist/templates/app/superadmin/users/[userId]/page.tsx +1 -1
  96. package/dist/templates/app/superadmin/users/page.tsx +1 -1
  97. package/package.json +11 -3
  98. package/scripts/build/registry/__tests__/template-registry.test.mjs +336 -2
  99. package/scripts/build/registry/__tests__/write-places.test.mjs +26 -0
  100. package/scripts/build/registry/generators/template-registry.mjs +202 -9
  101. package/scripts/build/registry/write-places.mjs +19 -5
  102. package/scripts/build/registry.mjs +53 -1
  103. package/templates/app/(auth)/accept-invite/[token]/page.tsx +1 -1
  104. package/templates/app/(auth)/auth-error/page.tsx +1 -1
  105. package/templates/app/(auth)/forgot-password/page.tsx +1 -1
  106. package/templates/app/(auth)/layout.tsx +1 -1
  107. package/templates/app/(auth)/login/page.tsx +1 -1
  108. package/templates/app/(auth)/reset-password/page.tsx +1 -1
  109. package/templates/app/(auth)/signup/page.tsx +1 -1
  110. package/templates/app/(auth)/verify-email/page.tsx +1 -1
  111. package/templates/app/(public)/[...slug]/page.tsx +3 -3
  112. package/templates/app/(public)/layout.tsx +1 -1
  113. package/templates/app/(public)/page.tsx +1 -1
  114. package/templates/app/403/page.tsx +1 -1
  115. package/templates/app/dashboard/(main)/[entity]/[id]/edit/page.tsx +1 -1
  116. package/templates/app/dashboard/(main)/[entity]/[id]/page.tsx +4 -4
  117. package/templates/app/dashboard/(main)/[entity]/create/page.tsx +1 -1
  118. package/templates/app/dashboard/(main)/[entity]/loading.tsx +1 -1
  119. package/templates/app/dashboard/(main)/[entity]/page.tsx +1 -1
  120. package/templates/app/dashboard/(main)/layout.tsx +1 -1
  121. package/templates/app/dashboard/(main)/loading.tsx +1 -1
  122. package/templates/app/dashboard/(main)/media/page.tsx +1 -1
  123. package/templates/app/dashboard/(main)/page.tsx +1 -1
  124. package/templates/app/dashboard/(main)/patterns/[id]/edit/page.tsx +1 -1
  125. package/templates/app/dashboard/(main)/patterns/[id]/page.tsx +1 -1
  126. package/templates/app/dashboard/(main)/patterns/[id]/reports/page.tsx +1 -1
  127. package/templates/app/dashboard/(main)/patterns/create/page.tsx +1 -1
  128. package/templates/app/dashboard/(main)/patterns/page.tsx +1 -1
  129. package/templates/app/dashboard/features/analytics/page.tsx +1 -1
  130. package/templates/app/dashboard/features/automation/page.tsx +1 -1
  131. package/templates/app/dashboard/features/layout.tsx +1 -1
  132. package/templates/app/dashboard/features/loading.tsx +1 -1
  133. package/templates/app/dashboard/features/webhooks/page.tsx +1 -1
  134. package/templates/app/dashboard/layout.tsx +1 -1
  135. package/templates/app/dashboard/permission-denied/page.tsx +1 -1
  136. package/templates/app/dashboard/settings/api-keys/loading.tsx +1 -1
  137. package/templates/app/dashboard/settings/api-keys/page.tsx +1 -1
  138. package/templates/app/dashboard/settings/billing/loading.tsx +1 -1
  139. package/templates/app/dashboard/settings/billing/page.tsx +1 -1
  140. package/templates/app/dashboard/settings/invoices/[invoiceNumber]/page.tsx +1 -1
  141. package/templates/app/dashboard/settings/invoices/loading.tsx +1 -1
  142. package/templates/app/dashboard/settings/invoices/page.tsx +1 -1
  143. package/templates/app/dashboard/settings/layout.tsx +1 -1
  144. package/templates/app/dashboard/settings/loading.tsx +1 -1
  145. package/templates/app/dashboard/settings/notifications/loading.tsx +1 -1
  146. package/templates/app/dashboard/settings/notifications/page.tsx +1 -1
  147. package/templates/app/dashboard/settings/page.tsx +1 -1
  148. package/templates/app/dashboard/settings/password/loading.tsx +1 -1
  149. package/templates/app/dashboard/settings/password/page.tsx +1 -1
  150. package/templates/app/dashboard/settings/plans/loading.tsx +1 -1
  151. package/templates/app/dashboard/settings/plans/page.tsx +1 -1
  152. package/templates/app/dashboard/settings/profile/loading.tsx +1 -1
  153. package/templates/app/dashboard/settings/profile/page.tsx +1 -1
  154. package/templates/app/dashboard/settings/security/loading.tsx +1 -1
  155. package/templates/app/dashboard/settings/security/page.tsx +1 -1
  156. package/templates/app/dashboard/settings/teams/loading.tsx +1 -1
  157. package/templates/app/dashboard/settings/teams/page.tsx +1 -1
  158. package/templates/app/dashboard/settings/teams/permissions/page.tsx +1 -1
  159. package/templates/app/devtools/api/[[...endpoint]]/page.tsx +1 -1
  160. package/templates/app/devtools/config/page.tsx +1 -1
  161. package/templates/app/devtools/layout.tsx +3 -2
  162. package/templates/app/devtools/tests/[[...path]]/page.tsx +1 -1
  163. package/templates/app/layout.ppr.tsx +1 -1
  164. package/templates/app/layout.tsx +1 -1
  165. package/templates/app/public/page.tsx +1 -1
  166. package/templates/app/superadmin/layout.tsx +1 -1
  167. package/templates/app/superadmin/page.tsx +1 -1
  168. package/templates/app/superadmin/subscriptions/page.tsx +1 -1
  169. package/templates/app/superadmin/team-roles/page.tsx +1 -1
  170. package/templates/app/superadmin/teams/[teamId]/page.tsx +1 -1
  171. package/templates/app/superadmin/teams/page.tsx +1 -1
  172. package/templates/app/superadmin/users/[userId]/page.tsx +1 -1
  173. package/templates/app/superadmin/users/page.tsx +1 -1
  174. package/tests/jest/__mocks__/@nextsparkjs/registries/template-scopes/client.ts +21 -0
  175. package/tests/jest/__mocks__/@nextsparkjs/registries/template-scopes/server.ts +23 -0
  176. package/tests/jest/__mocks__/next-intl-server.js +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"dynamic-form.d.ts","sourceRoot":"","sources":["../../../../src/components/dashboard/block-editor/dynamic-form.tsx"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,eAAe,EAAY,MAAM,uBAAuB,CAAA;AAKtE,UAAU,gBAAgB;IACxB,gBAAgB,EAAE,eAAe,EAAE,CAAA;IACnC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC/B,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAA;CACpD;AA+RD;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,EAAE,gBAAgB,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,gBAAgB,2CAodnF"}
1
+ {"version":3,"file":"dynamic-form.d.ts","sourceRoot":"","sources":["../../../../src/components/dashboard/block-editor/dynamic-form.tsx"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,eAAe,EAAY,MAAM,uBAAuB,CAAA;AAKtE,UAAU,gBAAgB;IACxB,gBAAgB,EAAE,eAAe,EAAE,CAAA;IACnC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC/B,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAA;CACpD;AA6RD;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,EAAE,gBAAgB,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,gBAAgB,2CAodnF"}
@@ -164,11 +164,11 @@ function RelationshipField({
164
164
  if (isLoading) {
165
165
  return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground h-9", children: [
166
166
  /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }),
167
- /* @__PURE__ */ jsx("span", { children: t("loadingEntity", { entity: field.targetEntity }) })
167
+ /* @__PURE__ */ jsx("span", { children: t("loadingEntity", { entity: field.targetEntity ?? "" }) })
168
168
  ] });
169
169
  }
170
170
  if (isError || !field.targetEntity) {
171
- return /* @__PURE__ */ jsx("div", { className: "text-sm text-destructive h-9 flex items-center", children: t("failedToLoad", { entity: field.targetEntity }) });
171
+ return /* @__PURE__ */ jsx("div", { className: "text-sm text-destructive h-9 flex items-center", children: t("failedToLoad", { entity: field.targetEntity ?? "" }) });
172
172
  }
173
173
  const items = data || [];
174
174
  if (isMulti) {
@@ -75,7 +75,7 @@ function TopNavbar({ entities, className }) {
75
75
  "bg-indigo-500",
76
76
  "bg-orange-500"
77
77
  ];
78
- const index = email.charCodeAt(0) % colors.length;
78
+ const index = ((email == null ? void 0 : email.charCodeAt(0)) ?? 0) % colors.length;
79
79
  return colors[index];
80
80
  };
81
81
  const handleMenuToggle = useCallback(() => {
@@ -10,6 +10,7 @@ import { isTopbarFeatureEnabled } from "../../../lib/config/index.js";
10
10
  import { withBasePathIfInApp } from "../../../lib/base-path.js";
11
11
  import { useTranslations } from "next-intl";
12
12
  function MobileTopBar({ prefetch } = {}) {
13
+ var _a;
13
14
  const { user } = useAuth();
14
15
  const t = useTranslations();
15
16
  if (!user) return null;
@@ -36,7 +37,7 @@ function MobileTopBar({ prefetch } = {}) {
36
37
  "bg-indigo-500",
37
38
  "bg-orange-500"
38
39
  ];
39
- const index = email.charCodeAt(0) % colors.length;
40
+ const index = ((email == null ? void 0 : email.charCodeAt(0)) ?? 0) % colors.length;
40
41
  return colors[index];
41
42
  };
42
43
  return /* @__PURE__ */ jsx(
@@ -75,7 +76,7 @@ function MobileTopBar({ prefetch } = {}) {
75
76
  }
76
77
  ),
77
78
  /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: /* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-foreground", children: t("common.mobileNav.greeting", {
78
- name: user.firstName || user.email.split("@")[0]
79
+ name: user.firstName || ((_a = user.email) == null ? void 0 : _a.split("@")[0]) || user.name || user.id
79
80
  }) }) })
80
81
  ]
81
82
  }
@@ -1 +1 @@
1
- {"version":3,"file":"otp-verification.d.ts","sourceRoot":"","sources":["../../src/emails/otp-verification.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAKjF,wBAA8B,eAAe,CAC3C,IAAI,EAAE,wBAAwB,EAC9B,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,YAAY,CAAC,CAsEvB"}
1
+ {"version":3,"file":"otp-verification.d.ts","sourceRoot":"","sources":["../../src/emails/otp-verification.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAKjF,wBAA8B,eAAe,CAC3C,IAAI,EAAE,wBAAwB,EAC9B,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,YAAY,CAAC,CAuEvB"}
@@ -2,7 +2,7 @@ import { getTranslations } from "next-intl/server";
2
2
  import { DEFAULT_OTP_CONFIG } from "../lib/auth/otp-config.js";
3
3
  const APP_NAME_FALLBACK = process.env.NEXT_PUBLIC_APP_NAME || "Your App";
4
4
  async function otpVerification(data, locale) {
5
- const t = await getTranslations({ locale, namespace: "email.otpVerification" });
5
+ const t = locale ? await getTranslations({ locale, namespace: "email.otpVerification" }) : await getTranslations("email.otpVerification");
6
6
  const appName = data.appName || APP_NAME_FALLBACK;
7
7
  const year = (/* @__PURE__ */ new Date()).getFullYear();
8
8
  const expiresInMinutes = Math.floor((data.expiresIn ?? DEFAULT_OTP_CONFIG.expiresIn) / 60);
@@ -1 +1 @@
1
- {"version":3,"file":"reset-password.d.ts","sourceRoot":"","sources":["../../src/emails/reset-password.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAI/E,wBAA8B,aAAa,CACzC,IAAI,EAAE,sBAAsB,EAC5B,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,YAAY,CAAC,CA2FvB"}
1
+ {"version":3,"file":"reset-password.d.ts","sourceRoot":"","sources":["../../src/emails/reset-password.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAI/E,wBAA8B,aAAa,CACzC,IAAI,EAAE,sBAAsB,EAC5B,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,YAAY,CAAC,CA4FvB"}
@@ -1,7 +1,7 @@
1
1
  import { getTranslations } from "next-intl/server";
2
2
  const APP_NAME_FALLBACK = process.env.NEXT_PUBLIC_APP_NAME || "Your App";
3
3
  async function resetPassword(data, locale) {
4
- const t = await getTranslations({ locale, namespace: "email.resetPassword" });
4
+ const t = locale ? await getTranslations({ locale, namespace: "email.resetPassword" }) : await getTranslations("email.resetPassword");
5
5
  const appName = data.appName || APP_NAME_FALLBACK;
6
6
  const year = (/* @__PURE__ */ new Date()).getFullYear();
7
7
  const greeting = `${t("greetingPrefix")}${data.userName ? ` ${data.userName}` : ""},`;
@@ -1 +1 @@
1
- {"version":3,"file":"team-invitation.d.ts","sourceRoot":"","sources":["../../src/emails/team-invitation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAKhF,wBAA8B,cAAc,CAC1C,IAAI,EAAE,uBAAuB,EAC7B,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,YAAY,CAAC,CAyFvB"}
1
+ {"version":3,"file":"team-invitation.d.ts","sourceRoot":"","sources":["../../src/emails/team-invitation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAKhF,wBAA8B,cAAc,CAC1C,IAAI,EAAE,uBAAuB,EAC7B,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,YAAY,CAAC,CA0FvB"}
@@ -2,7 +2,7 @@ import { getTranslations } from "next-intl/server";
2
2
  import { escapeHtml } from "../lib/auth/security-notifications/templates/shared.js";
3
3
  const APP_NAME_FALLBACK = process.env.NEXT_PUBLIC_APP_NAME || "Your App";
4
4
  async function teamInvitation(data, locale) {
5
- const t = await getTranslations({ locale, namespace: "email.teamInvitation" });
5
+ const t = locale ? await getTranslations({ locale, namespace: "email.teamInvitation" }) : await getTranslations("email.teamInvitation");
6
6
  const appName = data.appName || APP_NAME_FALLBACK;
7
7
  const year = (/* @__PURE__ */ new Date()).getFullYear();
8
8
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"verify-email.d.ts","sourceRoot":"","sources":["../../src/emails/verify-email.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAI9E,wBAA8B,WAAW,CACvC,IAAI,EAAE,qBAAqB,EAC3B,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,YAAY,CAAC,CAgFvB"}
1
+ {"version":3,"file":"verify-email.d.ts","sourceRoot":"","sources":["../../src/emails/verify-email.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAI9E,wBAA8B,WAAW,CACvC,IAAI,EAAE,qBAAqB,EAC3B,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,YAAY,CAAC,CAiFvB"}
@@ -1,7 +1,7 @@
1
1
  import { getTranslations } from "next-intl/server";
2
2
  const APP_NAME_FALLBACK = process.env.NEXT_PUBLIC_APP_NAME || "Your App";
3
3
  async function verifyEmail(data, locale) {
4
- const t = await getTranslations({ locale, namespace: "email.verifyEmail" });
4
+ const t = locale ? await getTranslations({ locale, namespace: "email.verifyEmail" }) : await getTranslations("email.verifyEmail");
5
5
  const appName = data.appName || APP_NAME_FALLBACK;
6
6
  const year = (/* @__PURE__ */ new Date()).getFullYear();
7
7
  const greeting = `${t("greetingPrefix")}${data.userName ? ` ${data.userName}` : ""},`;
@@ -32,7 +32,7 @@ async function createEntity(entitySlug, data, config) {
32
32
  };
33
33
  }
34
34
  const authContext = await getAuthContext();
35
- if (!authContext.success) {
35
+ if (authContext.success === false) {
36
36
  return { success: false, error: authContext.error };
37
37
  }
38
38
  const { userId, teamId } = authContext;
@@ -78,7 +78,7 @@ async function updateEntity(entitySlug, id, data, config) {
78
78
  };
79
79
  }
80
80
  const authContext = await getAuthContext();
81
- if (!authContext.success) {
81
+ if (authContext.success === false) {
82
82
  return { success: false, error: authContext.error };
83
83
  }
84
84
  const { userId, teamId } = authContext;
@@ -126,7 +126,7 @@ async function deleteEntity(entitySlug, id, config) {
126
126
  };
127
127
  }
128
128
  const authContext = await getAuthContext();
129
- if (!authContext.success) {
129
+ if (authContext.success === false) {
130
130
  return { success: false, error: authContext.error };
131
131
  }
132
132
  const { userId, teamId } = authContext;
@@ -170,7 +170,7 @@ async function getEntity(entitySlug, id) {
170
170
  };
171
171
  }
172
172
  const authContext = await getAuthContext();
173
- if (!authContext.success) {
173
+ if (authContext.success === false) {
174
174
  return { success: false, error: authContext.error };
175
175
  }
176
176
  const { userId, teamId } = authContext;
@@ -198,7 +198,7 @@ async function listEntities(entitySlug, options) {
198
198
  };
199
199
  }
200
200
  const authContext = await getAuthContext();
201
- if (!authContext.success) {
201
+ if (authContext.success === false) {
202
202
  return { success: false, error: authContext.error };
203
203
  }
204
204
  const { userId, teamId } = authContext;
@@ -232,7 +232,7 @@ async function deleteEntities(entitySlug, ids, config) {
232
232
  };
233
233
  }
234
234
  const authContext = await getAuthContext();
235
- if (!authContext.success) {
235
+ if (authContext.success === false) {
236
236
  return { success: false, error: authContext.error };
237
237
  }
238
238
  const { userId, teamId } = authContext;
@@ -278,7 +278,7 @@ async function entityExists(entitySlug, id) {
278
278
  };
279
279
  }
280
280
  const authContext = await getAuthContext();
281
- if (!authContext.success) {
281
+ if (authContext.success === false) {
282
282
  return { success: false, error: authContext.error };
283
283
  }
284
284
  const { userId, teamId } = authContext;
@@ -306,7 +306,7 @@ async function countEntities(entitySlug, where) {
306
306
  };
307
307
  }
308
308
  const authContext = await getAuthContext();
309
- if (!authContext.success) {
309
+ if (authContext.success === false) {
310
310
  return { success: false, error: authContext.error };
311
311
  }
312
312
  const { userId, teamId } = authContext;
@@ -35,12 +35,12 @@ async function updateTeam(teamId, data) {
35
35
  return { success: false, error: "No fields provided for update" };
36
36
  }
37
37
  const authResult = await getAuthUser();
38
- if (!authResult.success) {
38
+ if (authResult.success === false) {
39
39
  return { success: false, error: authResult.error };
40
40
  }
41
41
  const { userId } = authResult;
42
42
  const permResult = await verifyTeamPermission(userId, teamId, ["owner", "admin"]);
43
- if (!permResult.success) {
43
+ if (permResult.success === false) {
44
44
  return { success: false, error: permResult.error };
45
45
  }
46
46
  const updatePayload = {};
@@ -83,12 +83,12 @@ async function inviteMember(teamId, email, role = APP_CONFIG_MERGED.teams.roles.
83
83
  return { success: false, error: `Invalid role. Must be one of: ${validRoles.join(", ")}` };
84
84
  }
85
85
  const authResult = await getAuthUser();
86
- if (!authResult.success) {
86
+ if (authResult.success === false) {
87
87
  return { success: false, error: authResult.error };
88
88
  }
89
89
  const { userId } = authResult;
90
90
  const permResult = await verifyTeamPermission(userId, teamId, ["owner", "admin"]);
91
- if (!permResult.success) {
91
+ if (permResult.success === false) {
92
92
  return { success: false, error: permResult.error };
93
93
  }
94
94
  const { UserService } = await import("../services/user.service.js");
@@ -131,12 +131,12 @@ async function removeMember(teamId, memberId) {
131
131
  return { success: false, error: "Member ID is required" };
132
132
  }
133
133
  const authResult = await getAuthUser();
134
- if (!authResult.success) {
134
+ if (authResult.success === false) {
135
135
  return { success: false, error: authResult.error };
136
136
  }
137
137
  const { userId } = authResult;
138
138
  const permResult = await verifyTeamPermission(userId, teamId, ["owner", "admin"]);
139
- if (!permResult.success) {
139
+ if (permResult.success === false) {
140
140
  return { success: false, error: permResult.error };
141
141
  }
142
142
  const targetUserId = memberId;
@@ -179,7 +179,7 @@ async function updateMemberRole(teamId, memberId, role) {
179
179
  return { success: false, error: `Invalid role. Must be one of: ${validRoles.join(", ")}. Use transferOwnership for owner.` };
180
180
  }
181
181
  const authResult = await getAuthUser();
182
- if (!authResult.success) {
182
+ if (authResult.success === false) {
183
183
  return { success: false, error: authResult.error };
184
184
  }
185
185
  const { userId } = authResult;
@@ -435,7 +435,7 @@ async function handleGenericListImpl(request, audit) {
435
435
  }
436
436
  userId = authResult.user.id;
437
437
  const teamValidation = await validateTeamContextWithBypass(request, authResult, userId);
438
- if (!teamValidation.valid) {
438
+ if (teamValidation.valid === false) {
439
439
  return teamValidation.error;
440
440
  }
441
441
  teamId = teamValidation.teamId;
@@ -862,7 +862,7 @@ async function handleGenericCreateImpl(request, audit) {
862
862
  }
863
863
  }
864
864
  const teamValidation = await validateTeamContextWithBypass(request, authResult, authResult.user.id);
865
- if (!teamValidation.valid) {
865
+ if (teamValidation.valid === false) {
866
866
  return teamValidation.error;
867
867
  }
868
868
  const teamId = teamValidation.teamId;
@@ -1098,7 +1098,7 @@ async function handleGenericReadImpl(request, audit, { params }) {
1098
1098
  }
1099
1099
  userId = authResult.user.id;
1100
1100
  const teamValidation = await validateTeamContextWithBypass(request, authResult, userId);
1101
- if (!teamValidation.valid) {
1101
+ if (teamValidation.valid === false) {
1102
1102
  return teamValidation.error;
1103
1103
  }
1104
1104
  teamId = teamValidation.teamId;
@@ -1239,7 +1239,7 @@ async function handleGenericUpdateImpl(request, audit, { params }) {
1239
1239
  return authResult.rateLimitResponse;
1240
1240
  }
1241
1241
  const teamValidation = await validateTeamContextWithBypass(request, authResult, authResult.user.id);
1242
- if (!teamValidation.valid) {
1242
+ if (teamValidation.valid === false) {
1243
1243
  return teamValidation.error;
1244
1244
  }
1245
1245
  const teamId = teamValidation.teamId;
@@ -1518,7 +1518,7 @@ async function handleGenericDeleteImpl(request, audit, { params }) {
1518
1518
  return authResult.rateLimitResponse;
1519
1519
  }
1520
1520
  const teamValidation = await validateTeamContextWithBypass(request, authResult, authResult.user.id);
1521
- if (!teamValidation.valid) {
1521
+ if (teamValidation.valid === false) {
1522
1522
  return teamValidation.error;
1523
1523
  }
1524
1524
  const teamId = teamValidation.teamId;
@@ -52,7 +52,7 @@ async function checkEntityPermission(userId, teamId, entitySlug, action) {
52
52
  async function checkEntityPermissionOrFail(userId, teamId, entitySlug, method, isCollection) {
53
53
  const action = getActionFromMethod(method, isCollection);
54
54
  const result = await checkEntityPermission(userId, teamId, entitySlug, action);
55
- return result.allowed ? null : result.error;
55
+ return result.allowed === true ? null : result.error;
56
56
  }
57
57
  export {
58
58
  LIST_ACTION,
@@ -1 +1 @@
1
- {"version":3,"file":"registration-guard-plugin.d.ts","sourceRoot":"","sources":["../../../src/lib/auth/registration-guard-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,eAAO,MAAM,uBAAuB,QAAO,gBA6C1C,CAAC"}
1
+ {"version":3,"file":"registration-guard-plugin.d.ts","sourceRoot":"","sources":["../../../src/lib/auth/registration-guard-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,eAAO,MAAM,uBAAuB,QAAO,gBA2C1C,CAAC"}
@@ -16,8 +16,8 @@ const registrationGuardPlugin = () => {
16
16
  const registrationMode = ((_b = (_a = AUTH_CONFIG) == null ? void 0 : _a.registration) == null ? void 0 : _b.mode) ?? "open";
17
17
  if (registrationMode === "invitation-only") {
18
18
  const request = ctx.request;
19
- const url = new URL(request.url);
20
- const hasInviteToken = request.headers.get("x-invite-token") || url.searchParams.get("inviteToken");
19
+ const url = request ? new URL(request.url) : null;
20
+ const hasInviteToken = (request == null ? void 0 : request.headers.get("x-invite-token")) || (url == null ? void 0 : url.searchParams.get("inviteToken"));
21
21
  if (!hasInviteToken) {
22
22
  const teamExists = await TeamService.hasGlobal();
23
23
  if (teamExists) {
@@ -1,7 +1,9 @@
1
1
  import type { EmailProvider } from './email';
2
2
  import type { UserWithEmail } from './auth';
3
3
  interface EmailCallbackParams {
4
- user: UserWithEmail;
4
+ user: Omit<UserWithEmail, 'email'> & {
5
+ email?: string;
6
+ };
5
7
  url: string;
6
8
  token: string;
7
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"auth-email-callbacks.d.ts","sourceRoot":"","sources":["../../src/lib/auth-email-callbacks.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAE5C,UAAU,mBAAmB;IAC3B,IAAI,EAAE,aAAa,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;GAQG;AACH,wBAAsB,yBAAyB,CAC7C,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,mBAAmB,EACjD,YAAY,EAAE,aAAa,GAC1B,OAAO,CAAC,IAAI,CAAC,CAsBf;AAED;;;;;GAKG;AACH,wBAAsB,6BAA6B,CACjD,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,mBAAmB,EACjD,YAAY,EAAE,aAAa,GAC1B,OAAO,CAAC,IAAI,CAAC,CAqBf"}
1
+ {"version":3,"file":"auth-email-callbacks.d.ts","sourceRoot":"","sources":["../../src/lib/auth-email-callbacks.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAE5C,UAAU,mBAAmB;IAC3B,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC,GAAG;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACxD,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAOD;;;;;;;;GAQG;AACH,wBAAsB,yBAAyB,CAC7C,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,mBAAmB,EACjD,YAAY,EAAE,aAAa,GAC1B,OAAO,CAAC,IAAI,CAAC,CAuBf;AAED;;;;;GAKG;AACH,wBAAsB,6BAA6B,CACjD,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,mBAAmB,EACjD,YAAY,EAAE,aAAa,GAC1B,OAAO,CAAC,IAAI,CAAC,CAsBf"}
@@ -1,7 +1,12 @@
1
1
  import { sendResetPasswordEmail, sendVerifyEmail } from "./email/send.js";
2
2
  import { I18N_CONFIG } from "./config/index.js";
3
+ function requireEmail(user) {
4
+ if (!user.email) throw new Error("Cannot send an auth email without an email address");
5
+ return user.email;
6
+ }
3
7
  async function sendResetPasswordCallback({ user, url, token: _token }, emailService) {
4
8
  try {
9
+ const email = requireEmail(user);
5
10
  const template = await sendResetPasswordEmail({
6
11
  userName: user.firstName || "",
7
12
  resetUrl: url,
@@ -9,7 +14,7 @@ async function sendResetPasswordCallback({ user, url, token: _token }, emailServ
9
14
  expiresIn: "1 hour"
10
15
  }, I18N_CONFIG.defaultLocale);
11
16
  const response = await emailService.send({
12
- to: user.email,
17
+ to: email,
13
18
  ...template
14
19
  });
15
20
  if (!response.success) {
@@ -23,13 +28,14 @@ async function sendResetPasswordCallback({ user, url, token: _token }, emailServ
23
28
  }
24
29
  async function sendVerificationEmailCallback({ user, url, token: _token }, emailService) {
25
30
  try {
31
+ const email = requireEmail(user);
26
32
  const template = await sendVerifyEmail({
27
33
  userName: user.firstName || "",
28
34
  verificationUrl: url,
29
35
  appName: process.env.NEXT_PUBLIC_APP_NAME || "Your App"
30
36
  }, I18N_CONFIG.defaultLocale);
31
37
  const response = await emailService.send({
32
- to: user.email,
38
+ to: email,
33
39
  ...template
34
40
  });
35
41
  if (!response.success) {
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/lib/auth.ts"],"names":[],"mappings":"AAUA,OAAO,EAAgF,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AAiBvH;;;;;;;;;;;;;GAaG;AACH,wBAAsB,4BAA4B,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAQlF;AAED;;;;;;;;;GASG;AACH,wBAAsB,6BAA6B,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAEnF;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAoHD,eAAO,MAAM,IAAI,qEA4Wf,CAAC;AAEH,MAAM,MAAM,OAAO,GAAG,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;AACjD,MAAM,MAAM,WAAW,GAAG,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,GAAG;IAC1D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,kBAAkB,EAAE,QAAQ,EAAE,CAAC;CAC/C,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC5B,IAAI,EAAE,WAAW,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAO9B"}
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/lib/auth.ts"],"names":[],"mappings":"AAUA,OAAO,EAAgF,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AAiBvH;;;;;;;;;;;;;GAaG;AACH,wBAAsB,4BAA4B,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAQlF;AAED;;;;;;;;;GASG;AACH,wBAAsB,6BAA6B,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAEnF;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAoHD,eAAO,MAAM,IAAI,qEA2Wf,CAAC;AAEH,MAAM,MAAM,OAAO,GAAG,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;AACjD,MAAM,MAAM,WAAW,GAAG,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,GAAG;IAC1D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,kBAAkB,EAAE,QAAQ,EAAE,CAAC;CAC/C,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC5B,IAAI,EAAE,WAAW,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAO9B"}
package/dist/lib/auth.js CHANGED
@@ -153,9 +153,10 @@ const auth = betterAuth({
153
153
  // means (OTP, invitation token, claim-account flow, etc.).
154
154
  sendOnSignUp: AUTH_CONFIG.sendVerificationEmailOnSignup ?? true,
155
155
  sendVerificationEmail: (params) => sendVerificationEmailCallback(params, emailService),
156
- // @ts-expect-error — pre-existing type error, tracked in https://github.com/NextSpark-js/nextspark/issues/131
157
- verifyTokenExpiresIn: 60 * 60 * 24
158
- // 24 hours
156
+ // Better Auth defaults this to 1 hour; state the valid option explicitly so
157
+ // the effective verification-link lifetime remains unchanged.
158
+ expiresIn: 60 * 60
159
+ // 1 hour
159
160
  },
160
161
  socialProviders: {
161
162
  google: {
@@ -88,7 +88,7 @@ class StripeGateway {
88
88
  }
89
89
  async getCustomer(customerId) {
90
90
  const customer = await getStripeInstance().customers.retrieve(customerId);
91
- if ("deleted" in customer && customer.deleted) {
91
+ if ("deleted" in customer) {
92
92
  throw new Error(`Customer ${customerId} has been deleted`);
93
93
  }
94
94
  return {
@@ -61,7 +61,7 @@ class EntityHookManager {
61
61
  this.updateStats(key, Date.now() - startTime);
62
62
  return result;
63
63
  }
64
- if ((result == null ? void 0 : result.data) !== void 0) {
64
+ if (result && result.data !== void 0) {
65
65
  modifiedData = result.data;
66
66
  }
67
67
  } catch (error) {
@@ -9,7 +9,7 @@ import { Loader2, CheckCircle, XCircle, Users, LogIn, UserPlus } from 'lucide-re
9
9
  import { toast } from 'sonner'
10
10
  import Link from 'next/link'
11
11
  import { sel } from '@nextsparkjs/core/selectors'
12
- import { getTemplateOrDefaultClient } from '@nextsparkjs/registries/template-registry.client'
12
+ import { getTemplateOrDefaultClient } from '@nextsparkjs/registries/template-scopes/client/(auth)/accept-invite/[token]/page'
13
13
  import { withBasePath } from '@nextsparkjs/core/lib/base-path'
14
14
 
15
15
  type InvitationStatus = 'loading' | 'valid' | 'accepting' | 'accepted' | 'error' | 'expired' | 'not_found' | 'email_mismatch' | 'already_member' | 'requires_auth'
@@ -1,7 +1,7 @@
1
1
  import type { Metadata } from 'next'
2
2
  import { Suspense } from 'react'
3
3
  import { AuthErrorPage } from '@nextsparkjs/core/components/auth/pages/AuthErrorPage'
4
- import { getTemplateOrDefault, getMetadataOrDefault } from '@nextsparkjs/core/lib/template-resolver'
4
+ import { getTemplateOrDefault, getMetadataOrDefault } from '@nextsparkjs/registries/template-scopes/server/(auth)/auth-error/page'
5
5
 
6
6
  const defaultMetadata: Metadata = {
7
7
  title: 'Authentication Error',
@@ -14,7 +14,7 @@ import { Input } from '@nextsparkjs/core/components/ui/input';
14
14
  import { Label } from '@nextsparkjs/core/components/ui/label';
15
15
  import { Alert, AlertDescription } from '@nextsparkjs/core/components/ui/alert';
16
16
  import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@nextsparkjs/core/components/ui/card';
17
- import { getTemplateOrDefaultClient } from '@nextsparkjs/registries/template-registry.client'
17
+ import { getTemplateOrDefaultClient } from '@nextsparkjs/registries/template-scopes/client/(auth)/forgot-password/page'
18
18
 
19
19
 
20
20
  function ForgotPasswordPage() {
@@ -1,7 +1,7 @@
1
1
  import { Suspense } from 'react'
2
2
  import type { Metadata } from 'next'
3
3
  import { AuthWrapper } from '@nextsparkjs/core/components/auth/layouts/AuthWrapper'
4
- import { getTemplateOrDefault, getMetadataOrDefault } from '@nextsparkjs/core/lib/template-resolver'
4
+ import { getTemplateOrDefault, getMetadataOrDefault } from '@nextsparkjs/registries/template-scopes/server/(auth)/layout'
5
5
 
6
6
  const defaultMetadata: Metadata = {
7
7
  title: {
@@ -1,6 +1,6 @@
1
1
  import type { Metadata } from 'next'
2
2
  import { LoginForm } from '@nextsparkjs/core/components/auth/forms/LoginForm'
3
- import { getTemplateOrDefault, getMetadataOrDefault } from '@nextsparkjs/core/lib/template-resolver'
3
+ import { getTemplateOrDefault, getMetadataOrDefault } from '@nextsparkjs/registries/template-scopes/server/(auth)/login/page'
4
4
 
5
5
  export const dynamic = 'force-dynamic'
6
6
 
@@ -18,7 +18,7 @@ import { Label } from "@nextsparkjs/core/components/ui/label";
18
18
  import { PasswordInput } from "@nextsparkjs/core/components/ui/password-input";
19
19
  import { Alert, AlertDescription } from "@nextsparkjs/core/components/ui/alert";
20
20
  import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@nextsparkjs/core/components/ui/card";
21
- import { getTemplateOrDefaultClient } from '@nextsparkjs/registries/template-registry.client'
21
+ import { getTemplateOrDefaultClient } from '@nextsparkjs/registries/template-scopes/client/(auth)/reset-password/page'
22
22
  import { sel } from '@nextsparkjs/core/selectors'
23
23
 
24
24
  function ResetPasswordContent() {
@@ -2,7 +2,7 @@ import { Suspense } from 'react'
2
2
  import type { Metadata } from 'next'
3
3
  import { redirect } from 'next/navigation'
4
4
  import { SignupForm } from '@nextsparkjs/core/components/auth/forms/SignupForm'
5
- import { getTemplateOrDefault, getMetadataOrDefault } from '@nextsparkjs/core/lib/template-resolver'
5
+ import { getTemplateOrDefault, getMetadataOrDefault } from '@nextsparkjs/registries/template-scopes/server/(auth)/signup/page'
6
6
  import { AUTH_CONFIG } from '@nextsparkjs/core/lib/config'
7
7
  import { resolveAuthMethods } from '@nextsparkjs/core/lib/auth/auth-methods'
8
8
  import { TeamService } from '@nextsparkjs/core/lib/services'
@@ -5,7 +5,7 @@ import { useSearchParams, useRouter } from "next/navigation";
5
5
  import { Suspense, useEffect, useState } from "react";
6
6
  import { Button } from '@nextsparkjs/core/components/ui/button';
7
7
  import { Alert, AlertDescription } from '@nextsparkjs/core/components/ui/alert';
8
- import { getTemplateOrDefaultClient } from '@nextsparkjs/registries/template-registry.client'
8
+ import { getTemplateOrDefaultClient } from '@nextsparkjs/registries/template-scopes/client/(auth)/verify-email/page'
9
9
  import { sel } from '@nextsparkjs/core/selectors'
10
10
  import { withBasePath } from '@nextsparkjs/core/lib/base-path'
11
11
 
@@ -21,7 +21,7 @@ import {
21
21
  getEntityBasePath,
22
22
  } from '@nextsparkjs/core/lib/entities/schema-generator'
23
23
  import { getEntityRegistry, setEntityRegistry } from '@nextsparkjs/core/lib/entities/queries'
24
- import { TemplateService } from '@nextsparkjs/core/lib/services/template.service'
24
+ import { hasTemplateOverride, getTemplateComponent } from '@nextsparkjs/registries/template-scopes/server/(public)/[...slug]/page'
25
25
  import { resolvePublicEntityFromUrl } from '@nextsparkjs/core/lib/api/entity/public-resolver'
26
26
  import { PublicEntityGrid } from '@nextsparkjs/core/components/public/entities/PublicEntityGrid'
27
27
  import type { EntityConfig } from '@nextsparkjs/core/lib/entities/types'
@@ -307,8 +307,8 @@ export default async function DynamicPublicPage({
307
307
  // === SINGLE ITEM PAGE ===
308
308
  // Check for theme template override first
309
309
  const templatePath = buildTemplatePath(entity)
310
- if (TemplateService.hasOverride(templatePath)) {
311
- const Template = TemplateService.getComponent(templatePath)
310
+ if (hasTemplateOverride(templatePath)) {
311
+ const Template = getTemplateComponent(templatePath)
312
312
  if (Template) {
313
313
  // Template handles its own data fetching and rendering
314
314
  // Pass params in the format expected by the template
@@ -2,7 +2,7 @@ import { Suspense } from "react"
2
2
  import type { Metadata } from "next"
3
3
  import { PublicNavbar } from '@nextsparkjs/core/components/app/layouts/PublicNavbar'
4
4
  import { PublicFooter } from '@nextsparkjs/core/components/app/layouts/PublicFooter'
5
- import { getTemplateOrDefault, getMetadataOrDefault } from "@nextsparkjs/core/lib/template-resolver"
5
+ import { getTemplateOrDefault, getMetadataOrDefault } from "@nextsparkjs/registries/template-scopes/server/(public)/layout"
6
6
 
7
7
  // ✅ MINIMAL GENERIC METADATA (cliente puede override con template)
8
8
  const defaultMetadata: Metadata = {
@@ -1,5 +1,5 @@
1
1
  import { redirect } from 'next/navigation'
2
- import { getTemplateOrDefault } from "@nextsparkjs/core/lib/template-resolver"
2
+ import { getTemplateOrDefault } from "@nextsparkjs/registries/template-scopes/server/(public)/page"
3
3
 
4
4
  /**
5
5
  * Default Public Home Page (CORE)
@@ -6,7 +6,7 @@ import { useSearchParams } from 'next/navigation'
6
6
  import { Suspense } from 'react'
7
7
  import { Button } from '@nextsparkjs/core/components/ui/button'
8
8
  import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@nextsparkjs/core/components/ui/card'
9
- import { getTemplateOrDefaultClient } from '@nextsparkjs/registries/template-registry.client'
9
+ import { getTemplateOrDefaultClient } from '@nextsparkjs/registries/template-scopes/client/403/page'
10
10
 
11
11
  function ForbiddenContent() {
12
12
  const searchParams = useSearchParams()!
@@ -6,7 +6,7 @@ import { useEffect, useState } from 'react'
6
6
  import { clientEntityRegistry, ensureClientInitialized, type ClientEntityConfig } from '@nextsparkjs/registries/entity-registry.client'
7
7
  import { EntityFormWrapper } from '@nextsparkjs/core/components/entities/wrappers/EntityFormWrapper'
8
8
  import { BuilderEditorView } from '@nextsparkjs/core/components/dashboard/block-editor/builder-editor-view'
9
- import { getTemplateOrDefaultClient } from '@nextsparkjs/registries/template-registry.client'
9
+ import { getTemplateOrDefaultClient } from '@nextsparkjs/registries/template-scopes/client/dashboard/(main)/[entity]/[id]/edit/page'
10
10
  import { getEntityData } from '@nextsparkjs/core/lib/api/entities'
11
11
 
12
12
  function EntityEditPage() {
@@ -2,7 +2,7 @@ import { notFound, redirect } from 'next/navigation'
2
2
  import { getEntity, getEntityRegistry, getChildEntities, setEntityRegistry } from '@nextsparkjs/core/lib/entities/queries'
3
3
  import { EntityDetailWrapper } from '@nextsparkjs/core/components/entities/wrappers/EntityDetailWrapper'
4
4
  import type { Metadata } from 'next'
5
- import { TemplateService } from '@nextsparkjs/core/lib/services/template.service'
5
+ import { hasTemplateOverride, getTemplateComponent } from '@nextsparkjs/registries/template-scopes/server/dashboard/(main)/[entity]/[id]/page'
6
6
  import type { EntityConfig, ChildEntityDefinition } from '@nextsparkjs/core/lib/entities/types'
7
7
  // Import registry directly - webpack resolves @nextsparkjs/registries alias at compile time
8
8
  import { ENTITY_REGISTRY, ENTITY_METADATA } from '@nextsparkjs/registries/entity-registry'
@@ -29,8 +29,8 @@ async function EntityDetailPage({ params }: PageProps) {
29
29
  // Check if there's a specific template override for this entity
30
30
  // e.g., app/dashboard/(main)/boards/[id]/page.tsx for boards
31
31
  const specificTemplatePath = `app/dashboard/(main)/${entitySlug}/[id]/page.tsx`
32
- if (TemplateService.hasOverride(specificTemplatePath)) {
33
- const OverrideComponent = TemplateService.getComponent(specificTemplatePath)
32
+ if (hasTemplateOverride(specificTemplatePath)) {
33
+ const OverrideComponent = getTemplateComponent(specificTemplatePath)
34
34
  if (OverrideComponent) {
35
35
  console.log(`🎨 Entity-specific template override applied for ${specificTemplatePath}`)
36
36
  return <OverrideComponent params={params} />
@@ -82,4 +82,4 @@ export const metadata: Metadata = {
82
82
  description: 'View entity details'
83
83
  }
84
84
 
85
- export default EntityDetailPage
85
+ export default EntityDetailPage
@@ -6,7 +6,7 @@ import { useEffect, useState } from 'react'
6
6
  import { clientEntityRegistry, ensureClientInitialized, type ClientEntityConfig } from '@nextsparkjs/registries/entity-registry.client'
7
7
  import { EntityFormWrapper } from '@nextsparkjs/core/components/entities/wrappers/EntityFormWrapper'
8
8
  import { BuilderEditorView } from '@nextsparkjs/core/components/dashboard/block-editor/builder-editor-view'
9
- import { getTemplateOrDefaultClient } from '@nextsparkjs/registries/template-registry.client'
9
+ import { getTemplateOrDefaultClient } from '@nextsparkjs/registries/template-scopes/client/dashboard/(main)/[entity]/create/page'
10
10
 
11
11
  function EntityCreatePage() {
12
12
  const params = useParams()!
@@ -1,5 +1,5 @@
1
1
  import { Skeleton } from '@nextsparkjs/core/components/ui/skeleton'
2
- import { getTemplateOrDefault } from '@nextsparkjs/core/lib/template-resolver'
2
+ import { getTemplateOrDefault } from '@nextsparkjs/registries/template-scopes/server/dashboard/(main)/[entity]/loading'
3
3
 
4
4
  function EntityLoading() {
5
5
  return (