nextjs-cms 0.6.1 → 0.6.3

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 (37) hide show
  1. package/dist/api/lib/serverActions.d.ts.map +1 -1
  2. package/dist/api/lib/serverActions.js +18 -12
  3. package/dist/api/trpc/server.d.ts +2 -2
  4. package/dist/api/trpc/server.d.ts.map +1 -1
  5. package/dist/api/trpc.d.ts.map +1 -1
  6. package/dist/api/trpc.js +5 -0
  7. package/dist/auth/react.d.ts.map +1 -1
  8. package/dist/auth/react.js +9 -0
  9. package/dist/core/config/config-loader.d.ts +18 -0
  10. package/dist/core/config/config-loader.d.ts.map +1 -1
  11. package/dist/core/config/config-loader.js +32 -0
  12. package/dist/core/fields/photo.d.ts +6 -6
  13. package/dist/core/fields/richText.d.ts +9 -9
  14. package/dist/core/fields/select.d.ts +1 -1
  15. package/dist/core/sections/category.d.ts +38 -38
  16. package/dist/core/sections/hasItems.d.ts +44 -44
  17. package/dist/core/sections/section.d.ts +19 -19
  18. package/dist/core/sections/simple.d.ts +8 -8
  19. package/dist/plugins/index.d.ts +1 -1
  20. package/dist/plugins/index.d.ts.map +1 -1
  21. package/dist/plugins/index.js +0 -1
  22. package/dist/plugins/loader.d.ts +20 -3
  23. package/dist/plugins/loader.d.ts.map +1 -1
  24. package/dist/plugins/loader.js +38 -3
  25. package/dist/translations/dictionaries/ar.d.ts +11 -0
  26. package/dist/translations/dictionaries/ar.d.ts.map +1 -1
  27. package/dist/translations/dictionaries/ar.js +361 -350
  28. package/dist/translations/dictionaries/en.d.ts +11 -0
  29. package/dist/translations/dictionaries/en.d.ts.map +1 -1
  30. package/dist/translations/dictionaries/en.js +361 -350
  31. package/dist/translations/index.d.ts +1 -1
  32. package/dist/translations/index.d.ts.map +1 -1
  33. package/dist/translations/index.js +1 -1
  34. package/dist/translations/locale-cookie.d.ts +13 -0
  35. package/dist/translations/locale-cookie.d.ts.map +1 -1
  36. package/dist/translations/locale-cookie.js +29 -0
  37. package/package.json +7 -7
@@ -1 +1 @@
1
- {"version":3,"file":"serverActions.d.ts","sourceRoot":"","sources":["../../../src/api/lib/serverActions.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAQlD,OAAO,EAAa,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAKxE,eAAO,MAAM,eAAe,GAAU,gCAInC;IACC,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAA;IACtB,MAAM,EAAE,MAAM,CAAA;CACjB,qBAmBA,CAAA;AACD,eAAO,MAAM,WAAW,GACpB,SAAS,OAAO,EAChB,OAAO;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE;;;EA8GlE,CAAA;AA8BD,eAAO,MAAM,QAAQ,GAAU,OAAO;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,oBAgDxF,CAAA;AAED,wBAAsB,WAAW,CAAC,KAAK,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,wDAyB3F;AAED,eAAO,MAAM,QAAQ,GAAU,OAAO;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,mBAE7F,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAU,SAAS,MAAM,yBAOvD,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAU,SAAS,OAAO;WASxC,MAAM;WACN,MAAM;iBACA,MAAM;iBACN,MAAM;IA2C1B,CAAA;AAED,eAAO,MAAM,aAAa;QAcd,MAAM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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoFxE,CAAA;AAED,eAAO,MAAM,0BAA0B,GAAU,sCAK9C;IACC,OAAO,EAAE,OAAO,CAAA;IAChB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;CAChB;;;;;;;;;;;;;;;;;;;;EA2DA,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAU,SAAS,OAAO,EAAE,aAAa,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA6D/C,MAAM,GAAG,MAAM,GAAG,SAAS;;;;;;;EAgBzD,CAAA;AAED,eAAO,MAAM,aAAa,GAAU,SAAS,OAAO,EAAE,aAAa,MAAM,EAAE,OAAM,MAAU,EAAE,IAAI,MAAM;;;;;;;;;;;;;;YA+GnF,MAAM,GAAG,MAAM;sBACL,MAAM;oBACR,MAAM,GAAG,IAAI;mBACd,MAAM;mBACN,MAAM;oBACL,MAAM;;;;EAKjC,CAAA;AAED,eAAO,MAAM,UAAU,GAAU,SAAS,OAAO;;;;;;;;;;;;;;;;;;;;;EAiFhD,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GACnB,MAAM,MAAM,EACZ,UAAU;IACN,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,GAAG,CAAC,EAAE,MAAM,CAAA;CACf,KACF,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAcpC,CAAA"}
@@ -262,7 +262,7 @@ export const getAllPrivileges = async (session) => {
262
262
  if (pluginPrivileges.has(route.pluginName))
263
263
  return;
264
264
  pluginPrivileges.set(route.pluginName, {
265
- title: route.pluginTitle,
265
+ title: resolveLocalizedString(route.title, locale, cmsConfig.i18n.fallbackLanguage),
266
266
  });
267
267
  });
268
268
  Array.from(pluginPrivileges.entries()).forEach(([pluginName, meta], index) => {
@@ -371,13 +371,13 @@ export const deleteSectionItem = async (session, sectionName, sectionItemId, rec
371
371
  */
372
372
  sectionItemId = sectionItemId.toString();
373
373
  try {
374
- const _s = await SectionFactory.getSectionForAdmin({
374
+ const _s = (await SectionFactory.getSectionForAdmin({
375
375
  name: sectionName,
376
376
  admin: {
377
377
  id: session.user.id,
378
378
  requiredRole: 'D',
379
379
  },
380
- });
380
+ }));
381
381
  const section = _s?.build();
382
382
  if (!section) {
383
383
  return {
@@ -530,8 +530,8 @@ export const deleteSectionItem = async (session, sectionName, sectionItemId, rec
530
530
  }
531
531
  const headingFieldName = section.headingField.name;
532
532
  const entityLabel = headingFieldName && sectionItemRow
533
- // @ts-ignore
534
- ? String(sectionItemRow[headingFieldName] ?? '')
533
+ ? // @ts-ignore
534
+ String(sectionItemRow[headingFieldName] ?? '')
535
535
  : null;
536
536
  await recordLog({
537
537
  eventType: 'section.item.delete',
@@ -954,9 +954,12 @@ export const getSidebar = async (session) => {
954
954
  });
955
955
  const pluginRoutes = await getPluginRoutes();
956
956
  const privilegeSet = await getAdminPrivileges(session.user.id);
957
- const allowedPluginRoutes = pluginRoutes.filter(({ pluginName }) => privilegeSet.has(pluginName));
958
- // Get the locale for resolving localized titles
957
+ // Get config and check for dashboard override
959
958
  const cmsConfig = await getCMSConfig();
959
+ const dashboardOverridePath = cmsConfig.dashboard?.override;
960
+ // Include dashboard override plugin even without explicit privilege
961
+ const allowedPluginRoutes = pluginRoutes.filter(({ pluginName, path }) => privilegeSet.has(pluginName) || path === dashboardOverridePath);
962
+ // Get the locale for resolving localized titles
960
963
  const locale = resolveLocale(session.user.locale, cmsConfig.i18n.supportedLanguages, cmsConfig.i18n.fallbackLanguage);
961
964
  // Let's loop through the sections and add path, icon and title to each section item
962
965
  const simpleSectionItems = simple.map((section) => {
@@ -980,22 +983,25 @@ export const getSidebar = async (session) => {
980
983
  icon: section.icon,
981
984
  };
982
985
  });
983
- const pluginSections = allowedPluginRoutes.map((route) => ({
984
- title: route.title,
986
+ // Filter out dashboard override from plugin sections (it becomes the dashboard entry)
987
+ const pluginSections = allowedPluginRoutes
988
+ .filter((route) => route.path !== dashboardOverridePath)
989
+ .map((route) => ({
990
+ title: resolveLocalizedString(route.title, locale, cmsConfig.i18n.fallbackLanguage),
985
991
  path: route.path,
986
992
  icon: route.icon ?? '',
987
993
  }));
988
994
  const fixedSections = [
989
995
  /**
990
- * Add the default dashboard section
996
+ * Add the dashboard section (points to override if configured)
991
997
  */
992
998
  {
993
999
  title: getString('dashboard', session.user.locale),
994
- path: '/dashboard',
1000
+ path: dashboardOverridePath ?? '/dashboard',
995
1001
  icon: 'home',
996
1002
  },
997
1003
  /**
998
- * Add the plugin sections
1004
+ * Add the plugin sections (excluding dashboard override)
999
1005
  */
1000
1006
  ...pluginSections,
1001
1007
  ...fixed.map((section) => ({ title: getString(section, session.user.locale), path: `/${section}`, icon: '' })),
@@ -3,6 +3,6 @@ import { createHydrationHelpers } from '@trpc/react-query/rsc';
3
3
  import { type AppRouter } from '../root.js';
4
4
  export declare const api: ReturnType<typeof createHydrationHelpers<AppRouter>>["trpc"];
5
5
  export declare const HydrateClient: (props: {
6
- children: import("react").ReactNode;
7
- }) => import("react").JSX.Element;
6
+ children: React.ReactNode;
7
+ }) => React.JSX.Element;
8
8
  //# sourceMappingURL=server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/api/trpc/server.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAEpB,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAI9D,OAAO,EAAgB,KAAK,SAAS,EAAE,MAAM,YAAY,CAAA;AA8DzD,eAAO,MAAM,GAAG,EAAc,UAAU,CAAC,OAAO,sBAAsB,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;AAC1F,eAAO,MAAM,aAAa;;iCAAmB,CAAA"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/api/trpc/server.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAA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ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,WAAW,CAAA;AASjC;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAU,MAAM;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE;aAAT,OAAO;;;;;EAQ/D,CAAA;AAED,KAAK,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC,CAAA;AAC5D,MAAM,MAAM,WAAW,GAAG,OAAO,CAAA;AAEjC,eAAO,MAAM,WAAW;;;CAGvB,CAAA;AAkBD;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;iBAtCyB,OAAO;;;;;;;;;;;;;;;;;;;EAsCR,CAAA;AAiBxD;;;GAGG;AACH,eAAO,MAAM,MAAM;;iBA3DsC,OAAO;;;;;;;;;;;;;;;;;;;EA2DlC,CAAA;AAE9B;;GAEG;AACH,eAAO,MAAM,eAAe;aAhE6B,OAAO;;;;;yLAgEtB,CAAA;AAE1C;;;GAGG;AACH,eAAO,MAAM,gBAAgB;aAtE4B,OAAO;;;;;;;;;yKAsEG,CAAA;AAEnE,KAAK,kBAAkB,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAA;AAoCzC,eAAO,MAAM,eAAe,GAAI,aAAa,MAAM,EAAE,eAAe,kBAAkB;aA5G7B,OAAO;;;;;;;;;yKA6GO,CAAA"}
package/dist/api/trpc.js CHANGED
@@ -6,6 +6,7 @@ import { db } from '../db/client.js';
6
6
  import { and, eq } from 'drizzle-orm';
7
7
  import { AdminPrivilegesTable } from '../db/schema.js';
8
8
  import getString from '../translations/index.js';
9
+ import { isDashboardOverridePlugin } from '../plugins/loader.js';
9
10
  /**
10
11
  * Creates context for an incoming request
11
12
  * @link https://trpc.io/docs/v11/context
@@ -71,6 +72,10 @@ export const publicProcedure = t.procedure;
71
72
  */
72
73
  export const privateProcedure = t.procedure.use(isAuthedMiddleware);
73
74
  const accessControlMiddleware = (sectionName, requiredRole) => isAuthedMiddleware.unstable_pipe(async ({ ctx, next }) => {
75
+ // Bypass privilege check for dashboard override plugin
76
+ if (await isDashboardOverridePlugin(sectionName)) {
77
+ return next();
78
+ }
74
79
  const privilege = await db
75
80
  .select()
76
81
  .from(AdminPrivilegesTable)
@@ -1 +1 @@
1
- {"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/auth/react.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAEzC,OAAO,eAAe,MAAM,4BAA4B,CAAA;AACxD,OAAO,eAAe,MAAM,4BAA4B,CAAA;AAExD,MAAM,MAAM,aAAa,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,KAAK,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAAA;AACnE,MAAM,WAAW,oBAAoB;IACjC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;IACxB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,KAAK,CAAA;CAC7B;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,OAAO;IAChD,QAAQ,EAAE,CAAC,CAAA;IACX,2BAA2B;IAC3B,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAA;CACjC;AAED,MAAM,WAAW,gBAAgB;IAC7B,KAAK,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAA;IAC/C,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,SAAS,CAAC,EAAE,OAAO,CAAA;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC7B,QAAQ,CAAC,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,CAAA;IACrC,wDAAwD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AAE,GAExD;IAAE,MAAM,EAAE,aAAa,CAAC;IAAC,IAAI,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,eAAe,CAAA;CAAE,GACjE;IACI,MAAM,EAAE,aAAa,CAAA;IACrB,IAAI,EAAE,IAAI,CAAA;IACV,MAAM,EAAE,iBAAiB,GAAG,SAAS,CAAA;CACxC,CAAA;AAEb,eAAO,MAAM,cAAc;YAPL,aAAa;UAAQ,OAAO;YAAU,eAAe;;YAEnD,aAAa;UACf,IAAI;YACF,iBAAiB,GAAG,SAAS;cAG0C,CAAA;AAE/F,wBAAgB,UAAU,CAAC,CAAC,SAAS,OAAO,EAAE,OAAO,CAAC,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,mBAAmB,CAAC,CAAC,CAAC,CA6BpG;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,qBAuO1D;AAED,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,CAAA;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAA"}
@@ -7,6 +7,7 @@ import { fetchData, now, useOnline } from './lib/client.js';
7
7
  import { useRouter } from 'next/navigation';
8
8
  import useAxiosPrivate from './hooks/useAxiosPrivate.js';
9
9
  import useRefreshToken from './hooks/useRefreshToken.js';
10
+ import { setLoginPageLocaleCookie, clearLocaleChangedOnLogin } from '../translations/locale-cookie.js';
10
11
  export const __AUTH = {
11
12
  _lastSync: 0,
12
13
  _session: undefined,
@@ -56,6 +57,14 @@ export async function login({ username, password, locale, }) {
56
57
  throw new Error(error.error);
57
58
  }
58
59
  const data = await response.json();
60
+ /**
61
+ * Clear the locale changed flag and sync cookie with session locale.
62
+ * This ensures the cookie matches the user's effective locale after login.
63
+ */
64
+ clearLocaleChangedOnLogin();
65
+ if (data.session?.user?.locale) {
66
+ setLoginPageLocaleCookie(data.session.user.locale);
67
+ }
59
68
  /**
60
69
  * Broadcast a message to all other tabs/windows to tell them the user has logged in.
61
70
  * This is to ensure all tabs/windows trigger a session update.
@@ -1,4 +1,5 @@
1
1
  import * as z from 'zod';
2
+ import type { LocalizedString } from '../../translations/localization.js';
2
3
  /** Locale codes for which we ship dictionaries. Config i18n.supportedLanguages keys must use these. */
3
4
  export declare const AVAILABLE_I18N_LOCALES: readonly ["en", "ar"];
4
5
  export type AvailableLocale = (typeof AVAILABLE_I18N_LOCALES)[number];
@@ -53,6 +54,10 @@ declare const cmsConfigSchema: z.ZodObject<{
53
54
  }, z.core.$strip>>;
54
55
  plugins: z.ZodOptional<z.ZodArray<z.ZodObject<{
55
56
  package: z.ZodString;
57
+ title: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
58
+ routes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
59
+ title: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
60
+ }, z.core.$strip>>>;
56
61
  }, z.core.$strip>>>;
57
62
  i18n: z.ZodOptional<z.ZodObject<{
58
63
  supportedLanguages: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
@@ -64,11 +69,21 @@ declare const cmsConfigSchema: z.ZodObject<{
64
69
  ar: "ar";
65
70
  }>>;
66
71
  }, z.core.$strip>>;
72
+ dashboard: z.ZodOptional<z.ZodObject<{
73
+ override: z.ZodOptional<z.ZodString>;
74
+ }, z.core.$strip>>;
67
75
  }, z.core.$strip>;
68
76
  export type CMSConfig = z.infer<typeof cmsConfigSchema>;
77
+ export interface PluginRouteOverride {
78
+ title?: LocalizedString;
79
+ }
69
80
  export interface PluginConfigEntry {
70
81
  package: string;
71
82
  options?: Record<string, unknown>;
83
+ /** Override the plugin's default title with localized strings */
84
+ title?: LocalizedString;
85
+ /** Override individual route titles by path */
86
+ routes?: Record<string, PluginRouteOverride>;
72
87
  }
73
88
  export interface ComputedCMSConfig {
74
89
  ui: {
@@ -116,6 +131,9 @@ export interface ComputedCMSConfig {
116
131
  supportedLanguages: readonly string[];
117
132
  fallbackLanguage: string;
118
133
  };
134
+ dashboard: {
135
+ override: string | null;
136
+ };
119
137
  }
120
138
  /**
121
139
  * Gets the CMS configuration, loading it lazily on first access.
@@ -1 +1 @@
1
- {"version":3,"file":"config-loader.d.ts","sourceRoot":"","sources":["../../../src/core/config/config-loader.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAIxB,uGAAuG;AACvG,eAAO,MAAM,sBAAsB,uBAAwB,CAAA;AAE3D,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAA;AAGrE,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiMnB,CAAA;AAGF,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAA;AAEvD,MAAM,WAAW,iBAAiB;IAC9B,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACpC;AAGD,MAAM,WAAW,iBAAiB;IAC9B,EAAE,EAAE;QACA,KAAK,EAAE,MAAM,CAAA;QACb,YAAY,EAAE,MAAM,CAAA;QACpB,IAAI,EAAE,MAAM,CAAA;QACZ,QAAQ,EAAE,MAAM,CAAA;KACnB,CAAA;IACD,KAAK,EAAE,OAAO,CAAA;IACd,QAAQ,EAAE;QACN,IAAI,EAAE,MAAM,CAAA;QACZ,MAAM,EAAE,OAAO,CAAA;QACf,QAAQ,EAAE;YACN,oBAAoB,EAAE,OAAO,CAAA;SAChC,CAAA;KACJ,CAAA;IACD,KAAK,EAAE;QACH,MAAM,EAAE;YACJ,IAAI,EAAE,MAAM,CAAA;YACZ,iBAAiB,EAAE,OAAO,CAAA;SAC7B,CAAA;QACD,MAAM,EAAE;YACJ,SAA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,CAAA;gBAChD,OAAO,EAAE,WAAW,GAAG,WAAW,GAAG,YAAY,CAAA;aACpD,CAAA;SACJ,CAAA;KACJ,CAAA;IACD,OAAO,EAAE,iBAAiB,EAAE,CAAA;IAC5B,IAAI,EAAE;QACF,kBAAkB,EAAE,SAAS,MAAM,EAAE,CAAA;QACrC,gBAAgB,EAAE,MAAM,CAAA;KAC3B,CAAA;IACD,SAAS,EAAE;QACP,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;KAC1B,CAAA;CACJ;AA2KD;;;;;;GAMG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAazE"}
@@ -163,6 +163,18 @@ const cmsConfigSchema = z.object({
163
163
  * Arbitrary options passed to the plugin factory
164
164
  */
165
165
  // options: z.record(z.unknown()).optional(),
166
+ /**
167
+ * Override the plugin's default title with localized strings
168
+ */
169
+ title: z.union([z.string(), z.record(z.string(), z.string())]).optional(),
170
+ /**
171
+ * Override individual route titles by path
172
+ */
173
+ routes: z
174
+ .record(z.string(), z.object({
175
+ title: z.union([z.string(), z.record(z.string(), z.string())]).optional(),
176
+ }))
177
+ .optional(),
166
178
  }))
167
179
  .optional(),
168
180
  /**
@@ -189,6 +201,20 @@ const cmsConfigSchema = z.object({
189
201
  fallbackLanguage: z.enum(AVAILABLE_I18N_LOCALES).optional(),
190
202
  })
191
203
  .optional(),
204
+ /**
205
+ * Dashboard configuration
206
+ */
207
+ dashboard: z
208
+ .object({
209
+ /**
210
+ * Override the default dashboard with a plugin route.
211
+ * The plugin at this route will be rendered as the main dashboard
212
+ * and will be accessible to ALL authenticated users (no privilege check).
213
+ * @example '/cpanel-dashboard'
214
+ */
215
+ override: z.string().optional(),
216
+ })
217
+ .optional(),
192
218
  });
193
219
  function normalizeI18n(userConfig) {
194
220
  const available = new Set(AVAILABLE_I18N_LOCALES);
@@ -260,6 +286,9 @@ function mergeConfig(defaults, userConfig) {
260
286
  },
261
287
  plugins: userConfig.plugins ?? defaults.plugins,
262
288
  i18n,
289
+ dashboard: {
290
+ override: userConfig.dashboard?.override ?? defaults.dashboard.override,
291
+ },
263
292
  };
264
293
  }
265
294
  // Default configuration values
@@ -309,6 +338,9 @@ const defaultConfig = {
309
338
  supportedLanguages: ['en'],
310
339
  fallbackLanguage: 'en',
311
340
  },
341
+ dashboard: {
342
+ override: null,
343
+ },
312
344
  };
313
345
  /*const error = (error: string, greyMsg = ''): string => {
314
346
  return `${chalk.bgRed.bold(' Error ')} ${error} ${greyMsg ? chalk.grey(greyMsg) : ''}`.trim()
@@ -54,10 +54,10 @@ declare const configSchema: z.ZodObject<{
54
54
  * @hint 'jpg' is an alias for 'jpeg'
55
55
  */
56
56
  fileType: z.ZodOptional<z.ZodArray<z.ZodEnum<{
57
- jpeg: "jpeg";
57
+ webp: "webp";
58
58
  jpg: "jpg";
59
+ jpeg: "jpeg";
59
60
  png: "png";
60
- webp: "webp";
61
61
  }>>>;
62
62
  /**
63
63
  * Remove the extension from the file name
@@ -201,10 +201,10 @@ declare const optionsSchema: z.ZodObject<{
201
201
  * @hint 'jpg' is an alias for 'jpeg'
202
202
  */
203
203
  fileType: z.ZodOptional<z.ZodArray<z.ZodEnum<{
204
- jpeg: "jpeg";
204
+ webp: "webp";
205
205
  jpg: "jpg";
206
+ jpeg: "jpeg";
206
207
  png: "png";
207
- webp: "webp";
208
208
  }>>>;
209
209
  /**
210
210
  * Remove the extension from the file name
@@ -273,10 +273,10 @@ declare const photoFieldConfigSchema: z.ZodObject<{
273
273
  * @hint 'jpg' is an alias for 'jpeg'
274
274
  */
275
275
  fileType: z.ZodOptional<z.ZodArray<z.ZodEnum<{
276
- jpeg: "jpeg";
276
+ webp: "webp";
277
277
  jpg: "jpg";
278
+ jpeg: "jpeg";
278
279
  png: "png";
279
- webp: "webp";
280
280
  }>>>;
281
281
  /**
282
282
  * Remove the extension from the file name
@@ -31,10 +31,10 @@ declare const allowImageUploadsSchema: z.ZodObject<{
31
31
  */
32
32
  omitExtension: z.ZodOptional<z.ZodBoolean>;
33
33
  format: z.ZodOptional<z.ZodEnum<{
34
- jpeg: "jpeg";
34
+ webp: "webp";
35
35
  jpg: "jpg";
36
+ jpeg: "jpeg";
36
37
  png: "png";
37
- webp: "webp";
38
38
  }>>;
39
39
  }, z.core.$strict>;
40
40
  declare const configSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -72,10 +72,10 @@ declare const configSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
72
72
  */
73
73
  omitExtension: z.ZodOptional<z.ZodBoolean>;
74
74
  format: z.ZodOptional<z.ZodEnum<{
75
- jpeg: "jpeg";
75
+ webp: "webp";
76
76
  jpg: "jpg";
77
+ jpeg: "jpeg";
77
78
  png: "png";
78
- webp: "webp";
79
79
  }>>;
80
80
  }, z.core.$strict>>;
81
81
  }, z.core.$strict>, z.ZodObject<{
@@ -118,7 +118,7 @@ export declare class RichTextField extends Field<'rich_text', Config> {
118
118
  } | undefined;
119
119
  handleMethod?: "base64" | "tempSave" | undefined;
120
120
  omitExtension?: boolean | undefined;
121
- format?: "jpeg" | "jpg" | "png" | "webp" | undefined;
121
+ format?: "webp" | "jpg" | "jpeg" | "png" | undefined;
122
122
  };
123
123
  sanitize: boolean;
124
124
  type: "rich_text";
@@ -186,10 +186,10 @@ declare const optionsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
186
186
  */
187
187
  omitExtension: z.ZodOptional<z.ZodBoolean>;
188
188
  format: z.ZodOptional<z.ZodEnum<{
189
- jpeg: "jpeg";
189
+ webp: "webp";
190
190
  jpg: "jpg";
191
+ jpeg: "jpeg";
191
192
  png: "png";
192
- webp: "webp";
193
193
  }>>;
194
194
  }, z.core.$strict>>;
195
195
  name: z.ZodString;
@@ -248,10 +248,10 @@ declare const richTextFieldConfigSchema: z.ZodIntersection<z.ZodDiscriminatedUni
248
248
  */
249
249
  omitExtension: z.ZodOptional<z.ZodBoolean>;
250
250
  format: z.ZodOptional<z.ZodEnum<{
251
- jpeg: "jpeg";
251
+ webp: "webp";
252
252
  jpg: "jpg";
253
+ jpeg: "jpeg";
253
254
  png: "png";
254
- webp: "webp";
255
255
  }>>;
256
256
  }, z.core.$strict>>;
257
257
  name: z.ZodString;
@@ -346,8 +346,8 @@ declare const selectFieldConfigSchema: z.ZodIntersection<z.ZodUnion<readonly [z.
346
346
  }, z.core.$strict>]>, z.ZodObject<{
347
347
  type: z.ZodLiteral<"select">;
348
348
  optionsType: z.ZodEnum<{
349
- db: "db";
350
349
  section: "section";
350
+ db: "db";
351
351
  static: "static";
352
352
  }>;
353
353
  build: z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodCustom<SelectField, SelectField>>;
@@ -118,10 +118,24 @@ declare const optionsSchema: z.ZodObject<{
118
118
  */
119
119
  allowRecursiveDelete: z.ZodOptional<z.ZodBoolean>;
120
120
  fields: z.ZodUnion<[z.ZodArray<z.ZodCustom<FieldConfig, FieldConfig>>, z.ZodArray<z.ZodCustom<FieldGroupConfig, FieldGroupConfig>>]>;
121
- readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
122
121
  name: z.ZodString;
123
- order: z.ZodNumber;
124
- variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
122
+ gallery: z.ZodOptional<z.ZodObject<{
123
+ db: z.ZodObject<{
124
+ tableName: z.ZodString;
125
+ identifierField: z.ZodOptional<z.ZodString>;
126
+ photoNameField: z.ZodOptional<z.ZodString>;
127
+ metaField: z.ZodOptional<z.ZodString>;
128
+ }, z.core.$strict>;
129
+ watermark: z.ZodOptional<z.ZodBoolean>;
130
+ thumbnail: z.ZodOptional<z.ZodObject<{
131
+ width: z.ZodNumber;
132
+ height: z.ZodNumber;
133
+ crop: z.ZodBoolean;
134
+ quality: z.ZodNumber;
135
+ }, z.core.$strict>>;
136
+ }, z.core.$strict>>;
137
+ readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
138
+ icon: z.ZodOptional<z.ZodString>;
125
139
  db: z.ZodObject<{
126
140
  table: z.ZodString;
127
141
  identifier: z.ZodOptional<z.ZodCustom<FieldConfig, FieldConfig>>;
@@ -145,22 +159,8 @@ declare const optionsSchema: z.ZodObject<{
145
159
  name: z.ZodOptional<z.ZodString>;
146
160
  }, z.core.$strict>>>;
147
161
  }, z.core.$strict>;
148
- icon: z.ZodOptional<z.ZodString>;
149
- gallery: z.ZodOptional<z.ZodObject<{
150
- db: z.ZodObject<{
151
- tableName: z.ZodString;
152
- identifierField: z.ZodOptional<z.ZodString>;
153
- photoNameField: z.ZodOptional<z.ZodString>;
154
- metaField: z.ZodOptional<z.ZodString>;
155
- }, z.core.$strict>;
156
- watermark: z.ZodOptional<z.ZodBoolean>;
157
- thumbnail: z.ZodOptional<z.ZodObject<{
158
- width: z.ZodNumber;
159
- height: z.ZodNumber;
160
- crop: z.ZodBoolean;
161
- quality: z.ZodNumber;
162
- }, z.core.$strict>>;
163
- }, z.core.$strict>>;
162
+ variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
163
+ order: z.ZodNumber;
164
164
  hooks: z.ZodOptional<z.ZodCustom<import("./section.js").Hooks, import("./section.js").Hooks>>;
165
165
  }, z.core.$strict>;
166
166
  export declare const categorySectionConfigSchema: z.ZodObject<{
@@ -215,10 +215,24 @@ export declare const categorySectionConfigSchema: z.ZodObject<{
215
215
  * @default false
216
216
  */
217
217
  allowRecursiveDelete: z.ZodOptional<z.ZodBoolean>;
218
- readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
219
218
  name: z.ZodString;
220
- order: z.ZodNumber;
221
- variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
219
+ gallery: z.ZodOptional<z.ZodObject<{
220
+ db: z.ZodObject<{
221
+ tableName: z.ZodString;
222
+ identifierField: z.ZodOptional<z.ZodString>;
223
+ photoNameField: z.ZodOptional<z.ZodString>;
224
+ metaField: z.ZodOptional<z.ZodString>;
225
+ }, z.core.$strict>;
226
+ watermark: z.ZodOptional<z.ZodBoolean>;
227
+ thumbnail: z.ZodOptional<z.ZodObject<{
228
+ width: z.ZodNumber;
229
+ height: z.ZodNumber;
230
+ crop: z.ZodBoolean;
231
+ quality: z.ZodNumber;
232
+ }, z.core.$strict>>;
233
+ }, z.core.$strict>>;
234
+ readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
235
+ icon: z.ZodOptional<z.ZodString>;
222
236
  db: z.ZodObject<{
223
237
  table: z.ZodString;
224
238
  identifier: z.ZodOptional<z.ZodCustom<FieldConfig, FieldConfig>>;
@@ -242,22 +256,8 @@ export declare const categorySectionConfigSchema: z.ZodObject<{
242
256
  name: z.ZodOptional<z.ZodString>;
243
257
  }, z.core.$strict>>>;
244
258
  }, z.core.$strict>;
245
- icon: z.ZodOptional<z.ZodString>;
246
- gallery: z.ZodOptional<z.ZodObject<{
247
- db: z.ZodObject<{
248
- tableName: z.ZodString;
249
- identifierField: z.ZodOptional<z.ZodString>;
250
- photoNameField: z.ZodOptional<z.ZodString>;
251
- metaField: z.ZodOptional<z.ZodString>;
252
- }, z.core.$strict>;
253
- watermark: z.ZodOptional<z.ZodBoolean>;
254
- thumbnail: z.ZodOptional<z.ZodObject<{
255
- width: z.ZodNumber;
256
- height: z.ZodNumber;
257
- crop: z.ZodBoolean;
258
- quality: z.ZodNumber;
259
- }, z.core.$strict>>;
260
- }, z.core.$strict>>;
259
+ variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
260
+ order: z.ZodNumber;
261
261
  hooks: z.ZodOptional<z.ZodCustom<import("./section.js").Hooks, import("./section.js").Hooks>>;
262
262
  }, z.core.$strict>;
263
263
  export type CategorySectionOptions = z.infer<typeof optionsSchema>;