strapi-plugin-navigation 3.0.0-beta.2 → 3.0.0-beta.4

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 (33) hide show
  1. package/README.md +7 -7
  2. package/dist/_chunks/{ca-DIZHA0OL.mjs → ca-Catou0wg.mjs} +4 -0
  3. package/dist/_chunks/{ca-Bjfh0w36.js → ca-DtaqQvTI.js} +4 -0
  4. package/dist/admin/index.js +486 -308
  5. package/dist/admin/index.mjs +487 -309
  6. package/dist/admin/src/api/client.d.ts +4 -2
  7. package/dist/admin/src/api/validators.d.ts +10 -10
  8. package/dist/admin/src/pages/HomePage/components/NavigationItemForm/index.d.ts +1 -1
  9. package/dist/admin/src/pages/HomePage/components/NavigationItemForm/utils/form.d.ts +78 -0
  10. package/dist/admin/src/pages/HomePage/components/NavigationItemPopup/index.d.ts +1 -1
  11. package/dist/admin/src/pages/HomePage/components/NavigationManager/types.d.ts +1 -1
  12. package/dist/admin/src/pages/HomePage/hooks/index.d.ts +4 -4
  13. package/dist/admin/src/pages/HomePage/utils/parsers.d.ts +2 -2
  14. package/dist/admin/src/pages/SettingsPage/hooks/index.d.ts +1 -1
  15. package/dist/admin/src/translations/ca.d.ts +4 -0
  16. package/dist/server/index.js +113 -101
  17. package/dist/server/index.mjs +113 -101
  18. package/dist/server/src/content-types/index.d.ts +0 -4
  19. package/dist/server/src/content-types/navigation/index.d.ts +0 -4
  20. package/dist/server/src/content-types/navigation/schema.d.ts +0 -4
  21. package/dist/server/src/controllers/admin.d.ts +10 -10
  22. package/dist/server/src/controllers/client.d.ts +2 -2
  23. package/dist/server/src/controllers/validators.d.ts +2 -2
  24. package/dist/server/src/index.d.ts +7 -11
  25. package/dist/server/src/repositories/navigation-item.d.ts +8 -4
  26. package/dist/server/src/repositories/navigation.d.ts +12 -8
  27. package/dist/server/src/schemas/navigation.d.ts +8 -8
  28. package/dist/server/src/services/admin/admin.d.ts +2 -2
  29. package/dist/server/src/services/admin/types.d.ts +2 -2
  30. package/dist/server/src/services/admin/utils.d.ts +1 -1
  31. package/dist/server/src/services/client/client.d.ts +1 -1
  32. package/dist/server/src/services/index.d.ts +7 -7
  33. package/package.json +7 -8
@@ -9,7 +9,7 @@ import { Routes, Route } from "react-router-dom";
9
9
  import * as ReactDOM from "react-dom";
10
10
  import ReactDOM__default, { flushSync, createPortal } from "react-dom";
11
11
  import { useQuery, useQueryClient, useMutation, QueryClient, QueryClientProvider } from "@tanstack/react-query";
12
- import { once, orderBy, capitalize, get, isEmpty, first, isObject, isNil, isString, set, sortBy, isNumber, isBoolean, isArray, pick } from "lodash";
12
+ import { once, orderBy, capitalize, get, isEmpty, first, isObject, isNil, isString, set, sortBy, isNumber, isBoolean, isArray, pick, isNaN as isNaN$1 } from "lodash";
13
13
  import { useIntl } from "react-intl";
14
14
  import * as z from "zod";
15
15
  import { z as z$1 } from "zod";
@@ -8548,7 +8548,8 @@ const SvgCog = ({
8548
8548
  const stroke = strokeProp && strokeProp in colors ? colors[strokeProp] : strokeProp;
8549
8549
  return /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 32 32", width: 16, height: 16, fill, stroke, ref, ...props, children: /* @__PURE__ */ jsx("path", { d: "M29.743 13.401a1 1 0 0 0-.487-.675l-3.729-2.125-.015-4.202a1 1 0 0 0-.353-.76 14 14 0 0 0-4.59-2.584 1 1 0 0 0-.808.074L16 5.23l-3.765-2.106a1 1 0 0 0-.809-.075 14 14 0 0 0-4.585 2.594 1 1 0 0 0-.354.758L6.47 10.61 2.74 12.734a1 1 0 0 0-.486.675 13.3 13.3 0 0 0 0 5.195 1 1 0 0 0 .486.675l3.729 2.125.015 4.204a1 1 0 0 0 .353.76 14 14 0 0 0 4.59 2.583 1 1 0 0 0 .808-.073L16 26.768l3.765 2.107a1.013 1.013 0 0 0 .809.073 14 14 0 0 0 4.585-2.592 1 1 0 0 0 .354-.759l.018-4.206 3.729-2.125a1 1 0 0 0 .486-.675c.34-1.713.338-3.477-.003-5.19M16 21a5 5 0 1 1 0-10 5 5 0 0 1 0 10" }) });
8550
8550
  };
8551
- forwardRef$1(SvgCog);
8551
+ const ForwardRef$40 = forwardRef$1(SvgCog);
8552
+ const ForwardRef$41 = ForwardRef$40;
8552
8553
  const SvgCollapse = ({
8553
8554
  fill: fillProp = "currentColor",
8554
8555
  stroke: strokeProp,
@@ -13795,7 +13796,7 @@ class TreeCursor {
13795
13796
  return this.move(1, enter);
13796
13797
  }
13797
13798
  /**
13798
- Move to the next node in a last-to-first pre-order traveral. A
13799
+ Move to the next node in a last-to-first pre-order traversal. A
13799
13800
  node is followed by its last child or, if it has none, its
13800
13801
  previous sibling or the previous sibling of the first parent
13801
13802
  node that has one.
@@ -13870,10 +13871,10 @@ class TreeCursor {
13870
13871
  if (mustLeave && leave)
13871
13872
  leave(this);
13872
13873
  mustLeave = this.type.isAnonymous;
13873
- if (this.nextSibling())
13874
- break;
13875
13874
  if (!depth)
13876
13875
  return;
13876
+ if (this.nextSibling())
13877
+ break;
13877
13878
  this.parent();
13878
13879
  depth--;
13879
13880
  mustLeave = true;
@@ -31902,6 +31903,8 @@ function selectedLineRanges(state) {
31902
31903
  for (let r of state.selection.ranges) {
31903
31904
  let fromLine = state.doc.lineAt(r.from);
31904
31905
  let toLine = r.to <= fromLine.to ? fromLine : state.doc.lineAt(r.to);
31906
+ if (toLine.from > fromLine.from && toLine.from == r.to)
31907
+ toLine = r.to == fromLine.to + 1 ? fromLine : state.doc.lineAt(r.to - 1);
31905
31908
  let last = ranges.length - 1;
31906
31909
  if (last >= 0 && ranges[last].to > fromLine.from)
31907
31910
  ranges[last].to = toLine.to;
@@ -50352,9 +50355,13 @@ const prefixPluginTranslations = (trad, pluginId) => {
50352
50355
  }, {});
50353
50356
  };
50354
50357
  const usePluginTheme = () => {
50358
+ const getSystemTheme = () => window.matchMedia("(prefers-color-scheme: dark)").matches;
50355
50359
  const [theme2, setTheme] = useState();
50356
50360
  useEffect(() => {
50357
- setTheme(window.localStorage?.STRAPI_THEME);
50361
+ const isDarkSystemTheme = getSystemTheme();
50362
+ const systemTheme = isDarkSystemTheme ? "dark" : "light";
50363
+ const strapiTheme = window.localStorage?.STRAPI_THEME;
50364
+ setTheme(strapiTheme === "system" ? systemTheme : strapiTheme);
50358
50365
  }, []);
50359
50366
  return {
50360
50367
  theme: theme2 === "dark" ? darkTheme : lightTheme,
@@ -50383,7 +50390,7 @@ const Field = ({ children, name: name2, hint, label, error, required }) => {
50383
50390
  const trads = {
50384
50391
  en: () => import("../_chunks/en-BPYZYsnc.mjs"),
50385
50392
  fr: () => import("../_chunks/fr-BTVWPkax.mjs"),
50386
- ca: () => import("../_chunks/ca-DIZHA0OL.mjs")
50393
+ ca: () => import("../_chunks/ca-Catou0wg.mjs")
50387
50394
  };
50388
50395
  const getTradId = (msg) => `${PLUGIN_ID}.${msg}`;
50389
50396
  const getTrad = (msg, defaultMessage) => ({
@@ -50474,7 +50481,7 @@ const audienceDBSchema = z.object({
50474
50481
  name: z.string(),
50475
50482
  key: z.string()
50476
50483
  });
50477
- const navigationItemTypeSchema = z.enum(["INTERNAL", "EXTERNAL"]);
50484
+ const navigationItemTypeSchema = z.enum(["INTERNAL", "EXTERNAL", "WRAPPER"]);
50478
50485
  const navigationItemBaseSchema = z.object({
50479
50486
  id: z.number(),
50480
50487
  documentId: z.string(),
@@ -50505,7 +50512,7 @@ const navigationSchema = z.object({
50505
50512
  documentId: z.string(),
50506
50513
  name: z.string(),
50507
50514
  slug: z.string(),
50508
- localeCode: z.string(),
50515
+ locale: z.string(),
50509
50516
  visible: z.boolean(),
50510
50517
  items: z.array(navigationItemSchema)
50511
50518
  });
@@ -50746,6 +50753,12 @@ const getApiClient = once((fetch) => ({
50746
50753
  readConfigIndex() {
50747
50754
  return [URL_PREFIX, "config"];
50748
50755
  },
50756
+ healthCheck() {
50757
+ return fetch.get(`/_health`);
50758
+ },
50759
+ healthCheckIndex() {
50760
+ return ["health"];
50761
+ },
50749
50762
  readNavigationItemFromLocale({
50750
50763
  source,
50751
50764
  structureId,
@@ -51083,7 +51096,7 @@ const toNavigationItem = (payload, config2) => {
51083
51096
  structureId: payload.structureId,
51084
51097
  removed: payload.removed,
51085
51098
  updated: payload.updated
51086
- } : {
51099
+ } : payload.type === "EXTERNAL" ? {
51087
51100
  type: "EXTERNAL",
51088
51101
  collapsed: !!payload.collapsed,
51089
51102
  id: payload.id,
@@ -51105,6 +51118,27 @@ const toNavigationItem = (payload, config2) => {
51105
51118
  audience: payload.audience?.map(
51106
51119
  (documentId) => config2.availableAudience.find((audience) => audience.documentId === documentId)
51107
51120
  ) ?? []
51121
+ } : {
51122
+ type: "WRAPPER",
51123
+ collapsed: !!payload.collapsed,
51124
+ id: payload.id,
51125
+ documentId: payload.documentId,
51126
+ menuAttached: !!payload.menuAttached,
51127
+ order: payload.order ?? 0,
51128
+ path: payload.path ?? "",
51129
+ title: payload.title,
51130
+ uiRouterKey: payload.uiRouterKey,
51131
+ additionalFields: payload.additionalFields,
51132
+ audience: payload.audience?.map(
51133
+ (documentId) => config2.availableAudience.find((audience) => audience.documentId === documentId)
51134
+ ) ?? [],
51135
+ autoSync: payload.autoSync,
51136
+ items: payload.items?.length ? transformItemToViewPayload(payload, payload.items, config2) : payload.items,
51137
+ viewId: payload.viewId,
51138
+ viewParentId: payload.viewParentId,
51139
+ structureId: payload.structureId,
51140
+ removed: payload.removed,
51141
+ updated: payload.updated
51108
51142
  };
51109
51143
  };
51110
51144
  const transformItemToViewPayload = (payload, items = [], config2) => {
@@ -51166,8 +51200,15 @@ const extractRelatedItemLabel = (item, config2) => {
51166
51200
  if (contentType2?.isSingle) {
51167
51201
  return contentType2.labelSingular;
51168
51202
  }
51169
- const defaultFieldsWithCapitalizedOptions = [...defaultFields, ...defaultFields.map((_) => capitalize(_))];
51170
- const labelFields = get(fields, `${contentType2 ? contentType2.uid : __collectionUid}`, defaultFieldsWithCapitalizedOptions);
51203
+ const defaultFieldsWithCapitalizedOptions = [
51204
+ ...defaultFields,
51205
+ ...defaultFields.map((_) => capitalize(_))
51206
+ ];
51207
+ const labelFields = get(
51208
+ fields,
51209
+ `${contentType2 ? contentType2.uid : __collectionUid}`,
51210
+ defaultFieldsWithCapitalizedOptions
51211
+ );
51171
51212
  const itemLabels = (isEmpty(labelFields) ? defaultFieldsWithCapitalizedOptions : labelFields).map((_) => item[_]).filter((_) => _);
51172
51213
  return first(itemLabels) || "";
51173
51214
  };
@@ -51211,7 +51252,7 @@ const mapServerNavigationItem = (item, stopAtFirstLevel = false) => {
51211
51252
  removed: item.removed,
51212
51253
  updated: item.updated,
51213
51254
  isSearchActive: item.isSearchActive
51214
- } : {
51255
+ } : item.type === "EXTERNAL" ? {
51215
51256
  type: "EXTERNAL",
51216
51257
  id: item.id,
51217
51258
  documentId: item.documentId,
@@ -51229,6 +51270,24 @@ const mapServerNavigationItem = (item, stopAtFirstLevel = false) => {
51229
51270
  removed: item.removed,
51230
51271
  updated: item.updated,
51231
51272
  isSearchActive: item.isSearchActive
51273
+ } : {
51274
+ type: "WRAPPER",
51275
+ id: item.id,
51276
+ documentId: item.documentId,
51277
+ additionalFields: item.additionalFields ?? {},
51278
+ title: item.title,
51279
+ uiRouterKey: item.uiRouterKey,
51280
+ autoSync: item.autoSync ?? void 0,
51281
+ collapsed: item.collapsed,
51282
+ order: item.order ?? 0,
51283
+ menuAttached: item.menuAttached,
51284
+ viewId: item.viewId,
51285
+ viewParentId: item.viewParentId,
51286
+ items: stopAtFirstLevel ? item.items : item.items?.map((_) => mapServerNavigationItem(_)) ?? void 0,
51287
+ removed: item.removed,
51288
+ updated: item.updated,
51289
+ isSearchActive: item.isSearchActive,
51290
+ path: item.path ?? ""
51232
51291
  };
51233
51292
  };
51234
51293
  const getPendingAction = (actions) => actions.find(({ isPending }) => isPending);
@@ -51489,7 +51548,7 @@ const AllNavigations = ({ navigations, selected, setState }) => {
51489
51548
  const purgeSelected = useCallback(purgeCache(selected), [purgeCache]);
51490
51549
  const getLocalizations = (focused) => [focused].concat(
51491
51550
  navigations.filter(
51492
- (navigation2) => navigation2.documentId === focused.documentId && navigation2.localeCode !== focused.localeCode
51551
+ (navigation2) => navigation2.documentId === focused.documentId && navigation2.locale !== focused.locale
51493
51552
  )
51494
51553
  );
51495
51554
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [
@@ -51517,7 +51576,7 @@ const AllNavigations = ({ navigations, selected, setState }) => {
51517
51576
  }
51518
51577
  ) }) }) : null })
51519
51578
  ] }) }),
51520
- /* @__PURE__ */ jsx(Tbody, { children: navigations.filter(({ localeCode }) => localeCode === localeQuery.data?.defaultLocale).map((navigation2) => /* @__PURE__ */ jsxs(Tr, { children: [
51579
+ /* @__PURE__ */ jsx(Tbody, { children: navigations.filter(({ locale }) => locale === localeQuery.data?.defaultLocale).map((navigation2) => /* @__PURE__ */ jsxs(Tr, { children: [
51521
51580
  /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(
51522
51581
  CheckboxImpl,
51523
51582
  {
@@ -51530,7 +51589,7 @@ const AllNavigations = ({ navigations, selected, setState }) => {
51530
51589
  ) }),
51531
51590
  /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: navigation2.documentId }) }),
51532
51591
  /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: navigation2.name }) }),
51533
- /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: getLocalizations(navigation2).map(prop("localeCode")).join(", ") }) }),
51592
+ /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: getLocalizations(navigation2).map(prop("locale")).join(", ") }) }),
51534
51593
  /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: navigation2.visible ? formatMessage(getTrad("popup.navigation.manage.navigation.visible")) : formatMessage(getTrad("popup.navigation.manage.navigation.hidden")) }) }),
51535
51594
  /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsxs(Flex, { width: "100%", direction: "row", alignItems: "center", justifyContent: "flex-end", children: [
51536
51595
  /* @__PURE__ */ jsx(Box, { paddingLeft: 1, children: /* @__PURE__ */ jsx(
@@ -52050,7 +52109,7 @@ const NavigationHeader = ({
52050
52109
  value: activeNavigation?.documentId,
52051
52110
  size: "S",
52052
52111
  style: null,
52053
- children: availableNavigations.filter(({ localeCode }) => localeCode === currentLocale).map(({ documentId, name: name2 }) => /* @__PURE__ */ jsx(SingleSelectOption, { value: documentId, children: name2 }, documentId))
52112
+ children: availableNavigations.filter(({ locale: locale2 }) => locale2 === currentLocale).map(({ documentId, name: name2 }) => /* @__PURE__ */ jsx(SingleSelectOption, { value: documentId, children: name2 }, documentId))
52054
52113
  }
52055
52114
  ) }) }),
52056
52115
  hasLocalizations ? /* @__PURE__ */ jsx(Grid.Item, { col: 2, children: /* @__PURE__ */ jsx(
@@ -52361,34 +52420,28 @@ const Item = ({
52361
52420
  viewParentId,
52362
52421
  locale
52363
52422
  }) => {
52364
- const {
52365
- viewId,
52366
- type,
52367
- path,
52368
- removed,
52369
- externalPath,
52370
- menuAttached,
52371
- collapsed,
52372
- items = [],
52373
- isSearchActive,
52374
- related,
52375
- relatedType
52376
- } = mapServerNavigationItem(item, true);
52423
+ const mappedItem = mapServerNavigationItem(item, true);
52377
52424
  const { formatMessage } = useIntl();
52378
52425
  const configQuery = useConfig$1();
52379
- const isExternal = type === "EXTERNAL";
52426
+ const isExternal = mappedItem.type === "EXTERNAL";
52427
+ const isWrapper = mappedItem.type === "WRAPPER";
52380
52428
  const isNextMenuAllowedLevel = isNumber(configQuery.data?.allowedLevels) ? level < configQuery.data.allowedLevels - 1 : true;
52381
52429
  const isMenuAllowedLevel = isNumber(configQuery.data?.allowedLevels) ? level < configQuery.data.allowedLevels : true;
52382
52430
  const hasChildren = !isEmpty(item.items) && !isExternal && !displayChildren;
52383
- const absolutePath = isExternal ? void 0 : `${levelPath === "/" ? "" : levelPath}/${path === "/" ? "" : path}`.replace("//", "/");
52431
+ const absolutePath = isExternal ? void 0 : `${levelPath === "/" ? "" : levelPath}/${mappedItem.path === "/" ? "" : mappedItem.path}`.replace(
52432
+ "//",
52433
+ "/"
52434
+ );
52384
52435
  const contentTypeItemsQuery = useContentTypeItems({
52385
- uid: relatedType ?? "",
52436
+ uid: mappedItem.type === "INTERNAL" ? mappedItem.relatedType ?? "" : "",
52386
52437
  locale
52387
52438
  });
52388
52439
  const contentTypesQuery = useContentTypes$1();
52389
- const contentType2 = contentTypesQuery.data?.find((_) => _.uid === relatedType);
52440
+ const contentType2 = contentTypesQuery.data?.find(
52441
+ (_) => mappedItem.type === "INTERNAL" ? _.uid === mappedItem.relatedType : false
52442
+ );
52390
52443
  const relatedItem = contentTypeItemsQuery.data?.find(
52391
- (contentTypeItem) => contentTypeItem.documentId === related
52444
+ (contentTypeItem) => mappedItem.type === "INTERNAL" ? contentTypeItem.documentId === mappedItem.related : false
52392
52445
  ) ?? { documentId: "", id: 0 };
52393
52446
  const isPublished = !!relatedItem?.publishedAt;
52394
52447
  const relatedItemLabel = !isExternal ? extractRelatedItemLabel(relatedItem, configQuery.data) : "";
@@ -52450,24 +52503,32 @@ const Item = ({
52450
52503
  const onNewItemClick = useCallback(
52451
52504
  (event) => canUpdate && onItemLevelAdd(
52452
52505
  event,
52453
- viewId,
52506
+ mappedItem.viewId,
52454
52507
  isNextMenuAllowedLevel,
52455
52508
  absolutePath,
52456
- menuAttached,
52457
- `${structureId}.${items.length}`,
52458
- Math.max(...items.map(({ order }) => order))
52509
+ mappedItem.menuAttached,
52510
+ `${structureId}.${mappedItem.items?.length ?? 0}`,
52511
+ Math.max(...mappedItem.items?.map(({ order }) => order) ?? [])
52459
52512
  ),
52460
- [viewId, isNextMenuAllowedLevel, absolutePath, menuAttached, structureId, items, canUpdate]
52513
+ [
52514
+ mappedItem.viewId,
52515
+ isNextMenuAllowedLevel,
52516
+ absolutePath,
52517
+ mappedItem.menuAttached,
52518
+ structureId,
52519
+ mappedItem.items,
52520
+ canUpdate
52521
+ ]
52461
52522
  );
52462
52523
  useEffect(() => {
52463
- if (isSearchActive) {
52524
+ if (mappedItem.isSearchActive) {
52464
52525
  refs.dropRef?.current?.scrollIntoView?.({
52465
52526
  behavior: "smooth",
52466
52527
  block: "center",
52467
52528
  inline: "center"
52468
52529
  });
52469
52530
  }
52470
- }, [isSearchActive, refs.dropRef.current]);
52531
+ }, [mappedItem.isSearchActive, refs.dropRef.current]);
52471
52532
  const theme2 = useTheme();
52472
52533
  return /* @__PURE__ */ jsxs(
52473
52534
  Wrapper$1,
@@ -52485,23 +52546,23 @@ const Item = ({
52485
52546
  zIndex: 1,
52486
52547
  position: "relative",
52487
52548
  overflow: "hidden",
52488
- backgroundColor: isSearchActive ? theme2.colors.secondary100 : void 0,
52489
- borderColor: isSearchActive ? theme2.colors.secondary200 : void 0,
52549
+ backgroundColor: mappedItem.isSearchActive ? theme2.colors.secondary100 : void 0,
52550
+ borderColor: mappedItem.isSearchActive ? theme2.colors.secondary200 : void 0,
52490
52551
  transition: "background-color 0.3s ease-in"
52491
52552
  },
52492
52553
  children: [
52493
- removed && /* @__PURE__ */ jsx(ItemCardRemovedOverlay, {}),
52554
+ mappedItem.removed && /* @__PURE__ */ jsx(ItemCardRemovedOverlay, {}),
52494
52555
  /* @__PURE__ */ jsxs("div", { ref: refs.previewRef, children: [
52495
52556
  /* @__PURE__ */ jsx(CardBody, { children: /* @__PURE__ */ jsx(
52496
52557
  ItemCardHeader,
52497
52558
  {
52498
52559
  title: item.title ?? "",
52499
- path: isExternal ? externalPath : absolutePath,
52500
- icon: isExternal ? /* @__PURE__ */ jsx(ForwardRef$3D, {}) : /* @__PURE__ */ jsx(ForwardRef$2l, {}),
52560
+ path: isExternal ? mappedItem.externalPath : absolutePath,
52561
+ icon: isExternal ? /* @__PURE__ */ jsx(ForwardRef$3D, {}) : isWrapper ? /* @__PURE__ */ jsx(ForwardRef$41, {}) : /* @__PURE__ */ jsx(ForwardRef$2l, {}),
52501
52562
  onItemRemove: () => onItemRemove({ ...item, viewParentId }),
52502
52563
  onItemEdit: () => {
52503
- const [relatedType2, related2] = item.related?.split(RELATED_ITEM_SEPARATOR) ?? [];
52504
- if (item.type !== "EXTERNAL" && item.type !== "INTERNAL") {
52564
+ const [relatedType, related] = item.related?.split(RELATED_ITEM_SEPARATOR) ?? [];
52565
+ if (item.type !== "EXTERNAL" && item.type !== "INTERNAL" && item.type !== "WRAPPER") {
52505
52566
  return;
52506
52567
  }
52507
52568
  onItemEdit({
@@ -52511,15 +52572,15 @@ const Item = ({
52511
52572
  isMenuAllowedLevel,
52512
52573
  isParentAttachedToMenu,
52513
52574
  isSearchActive: false,
52514
- relatedType: relatedType2,
52515
- related: related2,
52575
+ relatedType,
52576
+ related,
52516
52577
  additionalFields: item.additionalFields ?? {},
52517
52578
  items: item.items ?? [],
52518
52579
  autoSync: item.autoSync ?? true,
52519
52580
  externalPath: void 0,
52520
52581
  viewParentId,
52521
52582
  audience: item.audience?.map(({ documentId }) => documentId) ?? []
52522
- } : {
52583
+ } : item.type === "EXTERNAL" ? {
52523
52584
  ...item,
52524
52585
  type: "EXTERNAL",
52525
52586
  isMenuAllowedLevel,
@@ -52533,6 +52594,17 @@ const Item = ({
52533
52594
  externalPath: item.externalPath ?? "",
52534
52595
  viewParentId,
52535
52596
  audience: item.audience?.map(({ documentId }) => documentId) ?? []
52597
+ } : {
52598
+ ...item,
52599
+ type: "WRAPPER",
52600
+ isMenuAllowedLevel,
52601
+ isParentAttachedToMenu,
52602
+ isSearchActive: false,
52603
+ additionalFields: item.additionalFields ?? {},
52604
+ items: item.items ?? [],
52605
+ autoSync: item.autoSync ?? true,
52606
+ viewParentId,
52607
+ audience: item.audience?.map(({ documentId }) => documentId) ?? []
52536
52608
  },
52537
52609
  levelPath,
52538
52610
  isParentAttachedToMenu
@@ -52540,9 +52612,9 @@ const Item = ({
52540
52612
  },
52541
52613
  onItemRestore: () => onItemRestore({ ...item, viewParentId }),
52542
52614
  dragRef: refs.dragRef,
52543
- removed,
52615
+ removed: mappedItem.removed,
52544
52616
  canUpdate,
52545
- isSearchActive
52617
+ isSearchActive: mappedItem.isSearchActive
52546
52618
  }
52547
52619
  ) }),
52548
52620
  /* @__PURE__ */ jsx(Divider, {}),
@@ -52559,21 +52631,29 @@ const Item = ({
52559
52631
  CollapseButton,
52560
52632
  {
52561
52633
  toggle: () => onItemToggleCollapse({ ...item, viewParentId }),
52562
- collapsed,
52634
+ collapsed: mappedItem.collapsed,
52563
52635
  itemsCount: item.items?.length ?? 0
52564
52636
  }
52565
52637
  ),
52566
- canUpdate && isNextMenuAllowedLevel && /* @__PURE__ */ jsx(TextButton, { disabled: removed, startIcon: /* @__PURE__ */ jsx(ForwardRef$1d, {}), onClick: onNewItemClick, children: /* @__PURE__ */ jsx(
52567
- Typography,
52638
+ canUpdate && isNextMenuAllowedLevel && /* @__PURE__ */ jsx(
52639
+ TextButton,
52568
52640
  {
52569
- variant: "pi",
52570
- fontWeight: "bold",
52571
- textColor: removed ? "neutral600" : "primary600",
52572
- children: formatMessage(getTrad("components.navigationItem.action.newItem"))
52641
+ disabled: mappedItem.removed,
52642
+ startIcon: /* @__PURE__ */ jsx(ForwardRef$1d, {}),
52643
+ onClick: onNewItemClick,
52644
+ children: /* @__PURE__ */ jsx(
52645
+ Typography,
52646
+ {
52647
+ variant: "pi",
52648
+ fontWeight: "bold",
52649
+ textColor: mappedItem.removed ? "neutral600" : "primary600",
52650
+ children: formatMessage(getTrad("components.navigationItem.action.newItem"))
52651
+ }
52652
+ )
52573
52653
  }
52574
- ) })
52654
+ )
52575
52655
  ] }),
52576
- related && !relatedItem.id ? /* @__PURE__ */ jsxs(Flex, { justifyContent: "center", alignItems: "center", children: [
52656
+ mappedItem.type === "INTERNAL" && mappedItem.related && !relatedItem.id ? /* @__PURE__ */ jsxs(Flex, { justifyContent: "center", alignItems: "center", children: [
52577
52657
  /* @__PURE__ */ jsxs(Typography, { variant: "omega", textColor: "neutral600", children: [
52578
52658
  relatedTypeLabel,
52579
52659
  " / "
@@ -52617,7 +52697,7 @@ const Item = ({
52617
52697
  ]
52618
52698
  }
52619
52699
  ),
52620
- hasChildren && !removed && !collapsed && /* @__PURE__ */ jsx(
52700
+ hasChildren && !mappedItem.removed && !mappedItem.collapsed && /* @__PURE__ */ jsx(
52621
52701
  List,
52622
52702
  {
52623
52703
  onItemLevelAdd,
@@ -52626,13 +52706,13 @@ const Item = ({
52626
52706
  onItemRestore,
52627
52707
  onItemReOrder,
52628
52708
  onItemToggleCollapse,
52629
- isParentAttachedToMenu: menuAttached,
52709
+ isParentAttachedToMenu: mappedItem.menuAttached,
52630
52710
  items: item.items ?? [],
52631
52711
  level: level + 1,
52632
52712
  levelPath: absolutePath,
52633
52713
  permissions,
52634
52714
  structurePrefix: structureId,
52635
- viewParentId: viewId,
52715
+ viewParentId: mappedItem.viewId,
52636
52716
  locale
52637
52717
  }
52638
52718
  )
@@ -52890,9 +52970,20 @@ const navigationExternalItemFormSchema = ({
52890
52970
  relatedType: z$1.string().optional(),
52891
52971
  related: z$1.string().optional()
52892
52972
  });
52973
+ const navigationWrapperItemFormSchema = ({
52974
+ isSingleSelected,
52975
+ additionalFields
52976
+ }) => navigationItemCommon({
52977
+ additionalFields,
52978
+ isSingleSelected
52979
+ }).extend({
52980
+ type: z$1.literal("WRAPPER"),
52981
+ path: z$1.string().or(z$1.null()).optional()
52982
+ });
52893
52983
  const navigationItemFormSchema = (input) => z$1.discriminatedUnion("type", [
52894
52984
  navigationExternalItemFormSchema(input),
52895
- navigationInternalItemFormSchema(input)
52985
+ navigationInternalItemFormSchema(input),
52986
+ navigationWrapperItemFormSchema(input)
52896
52987
  ]);
52897
52988
  const fallbackDefaultValues = {
52898
52989
  autoSync: true,
@@ -53003,7 +53094,9 @@ const NavigationItemForm = ({
53003
53094
  const { canUpdate } = permissions;
53004
53095
  const [isSingleSelected, setIsSingleSelected] = useState(false);
53005
53096
  const [itemLocaleCopyValue, setItemLocaleCopyValue] = useState();
53006
- const [formValue, setFormValue] = useState({});
53097
+ const [formValue, setFormValue] = useState(
53098
+ {}
53099
+ );
53007
53100
  const [formError, setFormError] = useState();
53008
53101
  const configQuery = useConfig$1();
53009
53102
  const availableAudiences = configQuery.data?.availableAudience ?? [];
@@ -53027,13 +53120,19 @@ const NavigationItemForm = ({
53027
53120
  }
53028
53121
  };
53029
53122
  const setFormValueItem = (path, value) => {
53030
- setFormValue(set({
53031
- ...formValue,
53032
- additionalFields: {
53033
- ...formValue.additionalFields
53034
- },
53035
- updated: true
53036
- }, path, value));
53123
+ setFormValue(
53124
+ set(
53125
+ {
53126
+ ...formValue,
53127
+ additionalFields: {
53128
+ ...formValue.additionalFields
53129
+ },
53130
+ updated: true
53131
+ },
53132
+ path,
53133
+ value
53134
+ )
53135
+ );
53037
53136
  };
53038
53137
  const encodePayload = (values) => {
53039
53138
  return {
@@ -53086,19 +53185,25 @@ const NavigationItemForm = ({
53086
53185
  const submit = async (e, values) => {
53087
53186
  e.preventDefault();
53088
53187
  const sanitizedValues = encodePayload(values);
53089
- const { success, data: payload, error } = navigationItemFormSchema({
53188
+ const {
53189
+ success,
53190
+ data: payload,
53191
+ error
53192
+ } = navigationItemFormSchema({
53090
53193
  isSingleSelected,
53091
53194
  additionalFields: configQuery.data?.additionalFields ?? FALLBACK_ADDITIONAL_FIELDS
53092
53195
  }).safeParse(sanitizedValues);
53093
53196
  if (success) {
53094
- const title = !!payload.title.trim() ? payload.title : getDefaultTitle(payload?.related?.toString(), payload.relatedType, isSingleSelected);
53197
+ const title = !!payload.title.trim() ? payload.title.trim() : payload.type === "INTERNAL" ? getDefaultTitle(payload?.related?.toString(), payload.relatedType, isSingleSelected) : "";
53095
53198
  setIsLoading(true);
53096
- const uiRouterKey = await generateUiRouterKey({
53097
- slugify: slugifyMutation.mutateAsync,
53098
- title,
53099
- related: payload.related,
53100
- relatedType: payload.relatedType
53101
- });
53199
+ const uiRouterKey = await generateUiRouterKey(
53200
+ payload.type === "INTERNAL" ? {
53201
+ slugify: slugifyMutation.mutateAsync,
53202
+ title,
53203
+ related: payload.related,
53204
+ relatedType: payload.relatedType
53205
+ } : { slugify: slugifyMutation.mutateAsync, title }
53206
+ );
53102
53207
  slugifyMutation.reset();
53103
53208
  setIsLoading(false);
53104
53209
  if (!uiRouterKey) {
@@ -53120,12 +53225,14 @@ const NavigationItemForm = ({
53120
53225
  }
53121
53226
  );
53122
53227
  } else if (error) {
53123
- setFormError(error.issues.reduce((acc, err) => {
53124
- return {
53125
- ...acc,
53126
- [err.path.join(".")]: err.message
53127
- };
53128
- }, {}));
53228
+ setFormError(
53229
+ error.issues.reduce((acc, err) => {
53230
+ return {
53231
+ ...acc,
53232
+ [err.path.join(".")]: err.message
53233
+ };
53234
+ }, {})
53235
+ );
53129
53236
  }
53130
53237
  };
53131
53238
  const renderError = (error) => {
@@ -53135,18 +53242,21 @@ const NavigationItemForm = ({
53135
53242
  }
53136
53243
  return void 0;
53137
53244
  };
53138
- const initialRelatedTypeSelected = current.relatedType;
53245
+ const initialRelatedTypeSelected = current.type === "INTERNAL" ? current.relatedType : void 0;
53139
53246
  const {
53140
- relatedType: currentRelatedType,
53141
- related: currentRelated,
53142
53247
  path: currentPath,
53143
53248
  type: currentType,
53144
53249
  title: currentTitle,
53145
53250
  autoSync: autoSyncEnabled
53146
53251
  } = formValue;
53252
+ const { relatedType: currentRelatedType, related: currentRelated } = formValue.type === "INTERNAL" ? formValue : {
53253
+ related: void 0,
53254
+ relatedType: void 0
53255
+ };
53147
53256
  const isExternal = currentType === "EXTERNAL";
53257
+ const isInternal = currentType === "INTERNAL";
53148
53258
  const pathSourceName = isExternal ? "externalPath" : "path";
53149
- const submitDisabled = !isExternal && !isSingleSelected && isNil(currentRelated) || isLoading;
53259
+ const submitDisabled = isInternal && !isSingleSelected && isNil(currentRelated) || isLoading;
53150
53260
  const contentTypeItemsQuery = useContentTypeItems({
53151
53261
  uid: currentRelatedType ?? "",
53152
53262
  locale
@@ -53190,7 +53300,7 @@ const NavigationItemForm = ({
53190
53300
  },
53191
53301
  [contentTypeItemsQuery.data, configQuery.data, contentTypes]
53192
53302
  );
53193
- const navigationItemTypeOptions = ["INTERNAL", "EXTERNAL"].map((key) => {
53303
+ const navigationItemTypeOptions = ["INTERNAL", "EXTERNAL", "WRAPPER"].map((key) => {
53194
53304
  return {
53195
53305
  key,
53196
53306
  value: key,
@@ -53241,9 +53351,7 @@ const NavigationItemForm = ({
53241
53351
  async (event) => {
53242
53352
  event.preventDefault();
53243
53353
  event.stopPropagation();
53244
- const source = navigationsQuery.data?.find(
53245
- ({ localeCode }) => localeCode === itemLocaleCopyValue
53246
- );
53354
+ const source = navigationsQuery.data?.find(({ locale: locale2 }) => locale2 === itemLocaleCopyValue);
53247
53355
  if (source) {
53248
53356
  setIsLoading(true);
53249
53357
  copyItemFromLocaleMutation.mutate(
@@ -53277,10 +53385,12 @@ const NavigationItemForm = ({
53277
53385
  [setIsLoading, copyItemFromLocaleMutation, navigationsQuery]
53278
53386
  );
53279
53387
  useEffect(() => {
53280
- setFormValue(decodePayload({
53281
- ...fallbackDefaultValues,
53282
- ...current
53283
- }));
53388
+ setFormValue(
53389
+ decodePayload({
53390
+ ...fallbackDefaultValues,
53391
+ ...current
53392
+ })
53393
+ );
53284
53394
  }, [current]);
53285
53395
  useEffect(() => {
53286
53396
  if (currentRelatedType) {
@@ -53339,51 +53449,60 @@ const NavigationItemForm = ({
53339
53449
  contentTypeItemsQuery.data
53340
53450
  ]);
53341
53451
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [
53342
- /* @__PURE__ */ jsx(Modal.Body, { children: /* @__PURE__ */ jsx(
53343
- Form$1,
53344
- {
53345
- method: "POST",
53346
- initialValues: formValue,
53347
- children: ({ values, onChange }) => {
53348
- const pathDefault = generatePreviewPath({
53349
- currentPath: values.path,
53350
- isExternal: values.type === "EXTERNAL",
53351
- current,
53352
- currentType: values.type,
53353
- config: configQuery.data,
53354
- contentTypeItems: contentTypeItemsQuery.data,
53355
- currentRelated: values.related,
53356
- currentRelatedType: values.relatedType,
53357
- isSingleSelected
53358
- });
53359
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [
53360
- /* @__PURE__ */ jsxs(Grid.Root, { gap: 5, children: [
53361
- /* @__PURE__ */ jsx(Grid.Item, { alignItems: "flex-start", col: 12, children: /* @__PURE__ */ jsx(
53362
- Field,
53452
+ /* @__PURE__ */ jsx(Modal.Body, { children: /* @__PURE__ */ jsx(Form$1, { method: "POST", initialValues: formValue, children: ({ values, onChange }) => {
53453
+ const internalValues = values.type === "INTERNAL" ? values : {
53454
+ related: void 0,
53455
+ relatedType: void 0
53456
+ };
53457
+ const pathDefault = generatePreviewPath({
53458
+ currentPath: values.path,
53459
+ isExternal: values.type === "EXTERNAL",
53460
+ current,
53461
+ currentType: values.type,
53462
+ config: configQuery.data,
53463
+ contentTypeItems: contentTypeItemsQuery.data,
53464
+ currentRelated: internalValues.related,
53465
+ currentRelatedType: internalValues.relatedType,
53466
+ isSingleSelected
53467
+ });
53468
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
53469
+ /* @__PURE__ */ jsxs(Grid.Root, { gap: 5, children: [
53470
+ /* @__PURE__ */ jsx(Grid.Item, { alignItems: "flex-start", col: 12, children: /* @__PURE__ */ jsx(
53471
+ Field,
53472
+ {
53473
+ name: "title",
53474
+ label: formatMessage(getTrad("popup.item.form.title.label", "Title")),
53475
+ error: renderError("title"),
53476
+ hint: formatMessage(
53477
+ getTrad("popup.item.form.title.placeholder", "e.g. Blog")
53478
+ ),
53479
+ children: /* @__PURE__ */ jsx(
53480
+ TextInput,
53363
53481
  {
53482
+ type: "string",
53483
+ disabled: !canUpdate || values.autoSync && values.type === "INTERNAL",
53364
53484
  name: "title",
53365
- label: formatMessage(getTrad("popup.item.form.title.label", "Title")),
53366
- error: renderError("title"),
53367
- hint: formatMessage(getTrad("popup.item.form.title.placeholder", "e.g. Blog")),
53368
- children: /* @__PURE__ */ jsx(
53369
- TextInput,
53370
- {
53371
- type: "string",
53372
- disabled: !canUpdate || values.autoSync && values.type === "INTERNAL",
53373
- name: "title",
53374
- onChange: (eventOrPath, value) => handleChange(eventOrPath, value, onChange),
53375
- value: values.title
53376
- }
53377
- )
53485
+ onChange: (eventOrPath, value) => handleChange(eventOrPath, value, onChange),
53486
+ value: values.title
53378
53487
  }
53379
- ) }, "title"),
53380
- /* @__PURE__ */ jsx(Grid.Item, { alignItems: "flex-start", col: values.type === "INTERNAL" ? 4 : 7, lg: 12, children: /* @__PURE__ */ jsx(
53488
+ )
53489
+ }
53490
+ ) }, "title"),
53491
+ /* @__PURE__ */ jsx(
53492
+ Grid.Item,
53493
+ {
53494
+ alignItems: "flex-start",
53495
+ col: values.type === "INTERNAL" ? 4 : 7,
53496
+ lg: 12,
53497
+ children: /* @__PURE__ */ jsx(
53381
53498
  Field,
53382
53499
  {
53383
53500
  name: "type",
53384
53501
  label: formatMessage(getTrad("popup.item.form.type.label", "Internal link")),
53385
53502
  error: renderError("type"),
53386
- hint: formatMessage(getTrad("popup.item.form.title.placeholder", "e.g. Blog")),
53503
+ hint: formatMessage(
53504
+ getTrad("popup.item.form.title.placeholder", "e.g. Blog")
53505
+ ),
53387
53506
  children: /* @__PURE__ */ jsx(
53388
53507
  SingleSelect,
53389
53508
  {
@@ -53396,12 +53515,23 @@ const NavigationItemForm = ({
53396
53515
  }
53397
53516
  )
53398
53517
  }
53399
- ) }, "type"),
53400
- /* @__PURE__ */ jsx(Grid.Item, { alignItems: "flex-start", col: values.type === "INTERNAL" ? 4 : 5, lg: 12, children: /* @__PURE__ */ jsx(
53518
+ )
53519
+ },
53520
+ "type"
53521
+ ),
53522
+ /* @__PURE__ */ jsx(
53523
+ Grid.Item,
53524
+ {
53525
+ alignItems: "flex-start",
53526
+ col: values.type === "INTERNAL" ? 4 : 5,
53527
+ lg: 12,
53528
+ children: /* @__PURE__ */ jsx(
53401
53529
  Field,
53402
53530
  {
53403
53531
  name: "menuAttached",
53404
- label: formatMessage(getTrad("popup.item.form.menuAttached.label", "MenuAttached")),
53532
+ label: formatMessage(
53533
+ getTrad("popup.item.form.menuAttached.label", "MenuAttached")
53534
+ ),
53405
53535
  error: renderError("menuAttached"),
53406
53536
  hint: formatMessage(
53407
53537
  getTrad(
@@ -53423,134 +53553,149 @@ const NavigationItemForm = ({
53423
53553
  }
53424
53554
  )
53425
53555
  }
53426
- ) }, "menuAttached"),
53427
- values.type === "INTERNAL" && /* @__PURE__ */ jsx(Grid.Item, { alignItems: "flex-start", col: 4, lg: 12, children: /* @__PURE__ */ jsx(
53428
- Field,
53556
+ )
53557
+ },
53558
+ "menuAttached"
53559
+ ),
53560
+ values.type === "INTERNAL" && /* @__PURE__ */ jsx(Grid.Item, { alignItems: "flex-start", col: 4, lg: 12, children: /* @__PURE__ */ jsx(
53561
+ Field,
53562
+ {
53563
+ name: "autoSync",
53564
+ label: formatMessage(
53565
+ getTrad("popup.item.form.autoSync.label", "Read fields from related")
53566
+ ),
53567
+ error: renderError("autoSync"),
53568
+ children: /* @__PURE__ */ jsx(
53569
+ Toggle,
53429
53570
  {
53430
53571
  name: "autoSync",
53431
- label: formatMessage(
53432
- getTrad("popup.item.form.autoSync.label", "Read fields from related")
53433
- ),
53434
- error: renderError("autoSync"),
53435
- children: /* @__PURE__ */ jsx(
53436
- Toggle,
53437
- {
53438
- name: "autoSync",
53439
- checked: values.autoSync,
53440
- onChange: (eventOrPath) => handleChange(eventOrPath, !values.autoSync, onChange),
53441
- onLabel: "Enabled",
53442
- offLabel: "Disabled"
53443
- }
53444
- )
53572
+ checked: values.autoSync,
53573
+ onChange: (eventOrPath) => handleChange(eventOrPath, !values.autoSync, onChange),
53574
+ onLabel: "Enabled",
53575
+ offLabel: "Disabled"
53445
53576
  }
53446
- ) }, "autoSync"),
53447
- /* @__PURE__ */ jsx(Grid.Item, { alignItems: "flex-start", col: 12, children: /* @__PURE__ */ jsx(
53448
- Field,
53577
+ )
53578
+ }
53579
+ ) }, "autoSync"),
53580
+ /* @__PURE__ */ jsx(Grid.Item, { alignItems: "flex-start", col: 12, children: /* @__PURE__ */ jsx(
53581
+ Field,
53582
+ {
53583
+ name: pathSourceName,
53584
+ label: formatMessage(
53585
+ getTrad(`popup.item.form.${pathSourceName}.label`, "Path")
53586
+ ),
53587
+ error: renderError(pathSourceName),
53588
+ hint: [
53589
+ formatMessage(
53590
+ getTrad(`popup.item.form.${pathSourceName}.placeholder`, "e.g. Blog")
53591
+ ),
53592
+ pathDefault ? formatMessage(getTrad("popup.item.form.type.external.description"), {
53593
+ value: pathDefault
53594
+ }) : ""
53595
+ ].join(" "),
53596
+ children: /* @__PURE__ */ jsx(
53597
+ TextInput,
53449
53598
  {
53599
+ disabled: !canUpdate,
53450
53600
  name: pathSourceName,
53451
- label: formatMessage(getTrad(`popup.item.form.${pathSourceName}.label`, "Path")),
53452
- error: renderError(pathSourceName),
53453
- hint: [
53454
- formatMessage(
53455
- getTrad(`popup.item.form.${pathSourceName}.placeholder`, "e.g. Blog")
53456
- ),
53457
- pathDefault ? formatMessage(getTrad("popup.item.form.type.external.description"), {
53458
- value: pathDefault
53459
- }) : ""
53460
- ].join(" "),
53461
- children: /* @__PURE__ */ jsx(
53462
- TextInput,
53463
- {
53464
- disabled: !canUpdate,
53465
- name: pathSourceName,
53466
- onChange: (eventOrPath, value) => handleChange(eventOrPath, value, onChange),
53467
- value: values[pathSourceName],
53468
- width: "100%"
53469
- }
53470
- )
53601
+ onChange: (eventOrPath, value) => handleChange(eventOrPath, value, onChange),
53602
+ value: values[pathSourceName],
53603
+ width: "100%"
53471
53604
  }
53472
- ) }, pathSourceName),
53473
- values.type === "INTERNAL" && /* @__PURE__ */ jsxs(Fragment$1, { children: [
53474
- /* @__PURE__ */ jsx(Grid.Item, { alignItems: "flex-start", col: 6, lg: 12, children: /* @__PURE__ */ jsx(
53475
- Field,
53605
+ )
53606
+ }
53607
+ ) }, pathSourceName),
53608
+ values.type === "INTERNAL" && /* @__PURE__ */ jsxs(Fragment$1, { children: [
53609
+ /* @__PURE__ */ jsx(Grid.Item, { alignItems: "flex-start", col: 6, lg: 12, children: /* @__PURE__ */ jsx(
53610
+ Field,
53611
+ {
53612
+ name: "relatedType",
53613
+ label: formatMessage(
53614
+ getTrad("popup.item.form.relatedType.label", "Related Type")
53615
+ ),
53616
+ error: renderError("relatedType"),
53617
+ hint: !isLoading && isEmpty(relatedTypeSelectOptions) ? formatMessage(
53618
+ getTrad(
53619
+ "popup.item.form.relatedType.empty",
53620
+ "There are no more content types"
53621
+ )
53622
+ ) : void 0,
53623
+ children: /* @__PURE__ */ jsx(
53624
+ SingleSelect,
53476
53625
  {
53477
53626
  name: "relatedType",
53478
- label: formatMessage(getTrad("popup.item.form.relatedType.label", "Related Type")),
53479
- error: renderError("relatedType"),
53480
- hint: !isLoading && isEmpty(relatedTypeSelectOptions) ? formatMessage(
53481
- getTrad(
53482
- "popup.item.form.relatedType.empty",
53483
- "There are no more content types"
53484
- )
53485
- ) : void 0,
53486
- children: /* @__PURE__ */ jsx(
53487
- SingleSelect,
53488
- {
53489
- name: "relatedType",
53490
- onChange: (eventOrPath) => handleChange("relatedType", eventOrPath, onChange),
53491
- value: values.relatedType,
53492
- disabled: !configQuery.data?.contentTypes.length || !canUpdate,
53493
- width: "100%",
53494
- children: configQuery.data?.contentTypes.map((contentType2) => /* @__PURE__ */ jsx(SingleSelectOption, { value: contentType2.uid, children: contentType2.contentTypeName }, contentType2.uid))
53495
- }
53496
- )
53627
+ onChange: (eventOrPath) => handleChange("relatedType", eventOrPath, onChange),
53628
+ value: values.relatedType,
53629
+ disabled: !configQuery.data?.contentTypes.length || !canUpdate,
53630
+ width: "100%",
53631
+ children: configQuery.data?.contentTypes.map((contentType2) => /* @__PURE__ */ jsx(SingleSelectOption, { value: contentType2.uid, children: contentType2.contentTypeName }, contentType2.uid))
53497
53632
  }
53498
- ) }),
53499
- values.relatedType && !isSingleSelected && /* @__PURE__ */ jsx(Grid.Item, { alignItems: "flex-start", col: 6, lg: 12, children: /* @__PURE__ */ jsx(
53500
- Field,
53633
+ )
53634
+ }
53635
+ ) }),
53636
+ values.relatedType && !isSingleSelected && /* @__PURE__ */ jsx(Grid.Item, { alignItems: "flex-start", col: 6, lg: 12, children: /* @__PURE__ */ jsx(
53637
+ Field,
53638
+ {
53639
+ name: "related",
53640
+ label: formatMessage(
53641
+ getTrad("popup.item.form.related.label", "Related")
53642
+ ),
53643
+ error: renderError("related"),
53644
+ hint: !isLoading && thereAreNoMoreContentTypes ? formatMessage(
53645
+ getTrad(
53646
+ "popup.item.form.related.empty",
53647
+ "There are no more entities"
53648
+ ),
53649
+ { contentTypeName: values.relatedType }
53650
+ ) : void 0,
53651
+ children: /* @__PURE__ */ jsx(
53652
+ SingleSelect,
53501
53653
  {
53502
53654
  name: "related",
53503
- label: formatMessage(getTrad("popup.item.form.related.label", "Related")),
53504
- error: renderError("related"),
53505
- hint: !isLoading && thereAreNoMoreContentTypes ? formatMessage(
53506
- getTrad(
53507
- "popup.item.form.related.empty",
53508
- "There are no more entities"
53509
- ),
53510
- { contentTypeName: values.relatedType }
53655
+ onChange: (eventOrPath) => handleChange("related", eventOrPath, onChange),
53656
+ value: values.related,
53657
+ options: relatedSelectOptions,
53658
+ disabled: isLoading || thereAreNoMoreContentTypes || !canUpdate,
53659
+ width: "100%",
53660
+ children: relatedSelectOptions.map(({ key, label, value }) => /* @__PURE__ */ jsx(SingleSelectOption, { value, children: label }, key))
53661
+ }
53662
+ )
53663
+ }
53664
+ ) })
53665
+ ] }),
53666
+ !isEmpty(configQuery.data?.additionalFields) && /* @__PURE__ */ jsx(Grid.Item, { col: 12, lg: 12, children: /* @__PURE__ */ jsx(Divider, { width: "100%" }) }),
53667
+ configQuery.data?.additionalFields.map(
53668
+ (additionalField, index2) => {
53669
+ if (additionalField === "audience") {
53670
+ return /* @__PURE__ */ jsx(Grid.Item, { alignItems: "flex-start", col: 6, lg: 12, children: /* @__PURE__ */ jsx(
53671
+ Field,
53672
+ {
53673
+ name: "audience",
53674
+ label: formatMessage(getTrad("popup.item.form.audience.label")),
53675
+ error: renderError("audience"),
53676
+ hint: !isLoading && isEmpty(audienceOptions) ? formatMessage(
53677
+ getTrad("popup.item.form.title.placeholder", "e.g. Blog")
53511
53678
  ) : void 0,
53512
53679
  children: /* @__PURE__ */ jsx(
53513
- SingleSelect,
53680
+ MultiSelect,
53514
53681
  {
53515
- name: "related",
53516
- onChange: (eventOrPath) => handleChange("related", eventOrPath, onChange),
53517
- value: values.related,
53518
- options: relatedSelectOptions,
53519
- disabled: isLoading || thereAreNoMoreContentTypes || !canUpdate,
53682
+ name: "audience",
53683
+ value: values.audience,
53684
+ onChange: (eventOrPath) => handleChange("audience", eventOrPath, onChange),
53520
53685
  width: "100%",
53521
- children: relatedSelectOptions.map(({ key, label, value }) => /* @__PURE__ */ jsx(SingleSelectOption, { value, children: label }, key))
53686
+ children: audienceOptions.map(({ value, label }) => /* @__PURE__ */ jsx(MultiSelectOption, { value, children: label }, value))
53522
53687
  }
53523
53688
  )
53524
53689
  }
53525
- ) })
53526
- ] }),
53527
- !isEmpty(configQuery.data?.additionalFields) && /* @__PURE__ */ jsx(Grid.Item, { col: 12, lg: 12, children: /* @__PURE__ */ jsx(Divider, { width: "100%" }) }),
53528
- configQuery.data?.additionalFields.map(
53529
- (additionalField, index2) => {
53530
- if (additionalField === "audience") {
53531
- return /* @__PURE__ */ jsx(Grid.Item, { alignItems: "flex-start", col: 6, lg: 12, children: /* @__PURE__ */ jsx(
53532
- Field,
53533
- {
53534
- name: "audience",
53535
- label: formatMessage(getTrad("popup.item.form.audience.label")),
53536
- error: renderError("audience"),
53537
- hint: !isLoading && isEmpty(audienceOptions) ? formatMessage(
53538
- getTrad("popup.item.form.title.placeholder", "e.g. Blog")
53539
- ) : void 0,
53540
- children: /* @__PURE__ */ jsx(
53541
- MultiSelect,
53542
- {
53543
- name: "audience",
53544
- value: values.audience,
53545
- onChange: (eventOrPath) => handleChange("audience", eventOrPath, onChange),
53546
- width: "100%",
53547
- children: audienceOptions.map(({ value, label }) => /* @__PURE__ */ jsx(MultiSelectOption, { value, children: label }, value))
53548
- }
53549
- )
53550
- }
53551
- ) }, "audience");
53552
- } else {
53553
- return /* @__PURE__ */ jsx(Grid.Item, { alignItems: "flex-start", col: 6, lg: 12, children: /* @__PURE__ */ jsx(
53690
+ ) }, "audience");
53691
+ } else {
53692
+ return /* @__PURE__ */ jsx(
53693
+ Grid.Item,
53694
+ {
53695
+ alignItems: "flex-start",
53696
+ col: 6,
53697
+ lg: 12,
53698
+ children: /* @__PURE__ */ jsx(
53554
53699
  Field,
53555
53700
  {
53556
53701
  name: `additionalFields.${additionalField.name}`,
@@ -53569,49 +53714,52 @@ const NavigationItemForm = ({
53569
53714
  }
53570
53715
  )
53571
53716
  }
53572
- ) }, additionalField.name);
53573
- }
53574
- }
53575
- )
53576
- ] }),
53577
- availableLocaleOptions && availableLocaleOptions.length > 1 && /* @__PURE__ */ jsxs(Fragment$1, { children: [
53578
- /* @__PURE__ */ jsx(Divider, { marginTop: 5, marginBottom: 5 }),
53579
- /* @__PURE__ */ jsxs(Grid.Root, { gap: 5, children: [
53580
- /* @__PURE__ */ jsx(Grid.Item, { alignItems: "flex-start", col: 6, lg: 12, children: /* @__PURE__ */ jsx(
53581
- Field,
53582
- {
53583
- name: "i18n.locale",
53584
- label: formatMessage(getTrad("popup.item.form.i18n.locale.label", "Copy details from")),
53585
- children: /* @__PURE__ */ jsx(
53586
- SingleSelect,
53587
- {
53588
- name: "i18n.locale",
53589
- onChange: setItemLocaleCopyValue,
53590
- value: itemLocaleCopyValue,
53591
- disabled: isLoading || !canUpdate,
53592
- placeholder: formatMessage(
53593
- getTrad("popup.item.form.i18n.locale.placeholder", "locale")
53594
- ),
53595
- children: availableLocaleOptions.map(({ key, label, value }) => /* @__PURE__ */ jsx(SingleSelectOption, { value, children: label }, key))
53596
- }
53597
53717
  )
53598
- }
53599
- ) }),
53600
- canUpdate && /* @__PURE__ */ jsx(Grid.Item, { alignItems: "flex-start", col: 6, lg: 12, paddingTop: 6, children: /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
53601
- Button,
53718
+ },
53719
+ additionalField.name
53720
+ );
53721
+ }
53722
+ }
53723
+ )
53724
+ ] }),
53725
+ availableLocaleOptions && availableLocaleOptions.length > 1 && /* @__PURE__ */ jsxs(Fragment$1, { children: [
53726
+ /* @__PURE__ */ jsx(Divider, { marginTop: 5, marginBottom: 5 }),
53727
+ /* @__PURE__ */ jsxs(Grid.Root, { gap: 5, children: [
53728
+ /* @__PURE__ */ jsx(Grid.Item, { alignItems: "flex-start", col: 6, lg: 12, children: /* @__PURE__ */ jsx(
53729
+ Field,
53730
+ {
53731
+ name: "i18n.locale",
53732
+ label: formatMessage(
53733
+ getTrad("popup.item.form.i18n.locale.label", "Copy details from")
53734
+ ),
53735
+ children: /* @__PURE__ */ jsx(
53736
+ SingleSelect,
53602
53737
  {
53603
- variant: "tertiary",
53604
- onClick: onCopyFromLocale,
53605
- disabled: isLoading || !itemLocaleCopyValue,
53606
- children: formatMessage(getTrad("popup.item.form.i18n.locale.button"))
53738
+ name: "i18n.locale",
53739
+ onChange: setItemLocaleCopyValue,
53740
+ value: itemLocaleCopyValue,
53741
+ disabled: isLoading || !canUpdate,
53742
+ placeholder: formatMessage(
53743
+ getTrad("popup.item.form.i18n.locale.placeholder", "locale")
53744
+ ),
53745
+ children: availableLocaleOptions.map(({ key, label, value }) => /* @__PURE__ */ jsx(SingleSelectOption, { value, children: label }, key))
53607
53746
  }
53608
- ) }) })
53609
- ] })
53610
- ] })
53611
- ] });
53612
- }
53613
- }
53614
- ) }),
53747
+ )
53748
+ }
53749
+ ) }),
53750
+ canUpdate && /* @__PURE__ */ jsx(Grid.Item, { alignItems: "flex-start", col: 6, lg: 12, paddingTop: 6, children: /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
53751
+ Button,
53752
+ {
53753
+ variant: "tertiary",
53754
+ onClick: onCopyFromLocale,
53755
+ disabled: isLoading || !itemLocaleCopyValue,
53756
+ children: formatMessage(getTrad("popup.item.form.i18n.locale.button"))
53757
+ }
53758
+ ) }) })
53759
+ ] })
53760
+ ] })
53761
+ ] });
53762
+ } }) }),
53615
53763
  /* @__PURE__ */ jsx(
53616
53764
  NavigationItemPopupFooter,
53617
53765
  {
@@ -53791,6 +53939,7 @@ const queryClient$1 = new QueryClient();
53791
53939
  const Inner$1 = () => {
53792
53940
  const { formatMessage } = useIntl();
53793
53941
  const localeQuery = useLocale();
53942
+ const [recentNavigation, setRecentNavigation] = useState();
53794
53943
  const [currentNavigation, setCurrentNavigation] = useState();
53795
53944
  const [activeNavigationItem, setActiveNavigationItemState] = useState();
53796
53945
  const [isItemPopupVisible, setIsItemPopupVisible] = useState(false);
@@ -53878,14 +54027,14 @@ const Inner$1 = () => {
53878
54027
  useCallback(
53879
54028
  (sourceLocale) => {
53880
54029
  const source = navigationsQuery.data?.find(
53881
- ({ localeCode, documentId }) => localeCode === sourceLocale && documentId === currentNavigation?.documentId
54030
+ ({ locale, documentId }) => locale === sourceLocale && documentId === currentNavigation?.documentId
53882
54031
  );
53883
54032
  if (source) {
53884
54033
  if (source.documentId && currentNavigation?.documentId) {
53885
54034
  copyNavigationI18nMutation.mutate(
53886
54035
  {
53887
- source: source.localeCode,
53888
- target: currentNavigation.localeCode,
54036
+ source: source.locale,
54037
+ target: currentNavigation.locale,
53889
54038
  documentId: source.documentId
53890
54039
  },
53891
54040
  {
@@ -53905,6 +54054,10 @@ const Inner$1 = () => {
53905
54054
  i18nCopySourceLocale && setI18nCopyModalOpened(true);
53906
54055
  }, [setI18nCopyModalOpened, i18nCopySourceLocale]);
53907
54056
  const updateNavigationMutation = useUpdateNavigation(() => {
54057
+ setRecentNavigation({
54058
+ documentId: currentNavigation?.documentId,
54059
+ id: currentNavigation?.id
54060
+ });
53908
54061
  setCurrentNavigation(void 0);
53909
54062
  });
53910
54063
  const submit = () => {
@@ -54034,7 +54187,14 @@ const Inner$1 = () => {
54034
54187
  }
54035
54188
  useEffect(() => {
54036
54189
  if (!currentNavigation && navigationsQuery.data?.[0]) {
54037
- setCurrentNavigation(navigationsQuery.data[0]);
54190
+ let navigation2;
54191
+ if (recentNavigation?.documentId) {
54192
+ navigation2 = navigationsQuery.data.find(
54193
+ (nav2) => nav2.documentId === recentNavigation.documentId && nav2.id === recentNavigation.id
54194
+ );
54195
+ }
54196
+ setRecentNavigation(void 0);
54197
+ setCurrentNavigation(navigation2 ? navigation2 : first(navigationsQuery.data));
54038
54198
  }
54039
54199
  }, [navigationsQuery.data]);
54040
54200
  useEffect(() => {
@@ -54043,11 +54203,12 @@ const Inner$1 = () => {
54043
54203
  }
54044
54204
  }, [navigationsQuery.data]);
54045
54205
  useEffect(() => {
54046
- if (currentNavigation && currentLocale !== currentNavigation.localeCode) {
54206
+ if (currentNavigation && currentLocale !== currentNavigation.locale) {
54207
+ setRecentNavigation(void 0);
54047
54208
  const nextNavigation = navigationsQuery.data?.find(
54048
- (navigation2) => navigation2.documentId === currentNavigation.documentId && navigation2.localeCode === currentLocale
54209
+ (navigation2) => navigation2.documentId === currentNavigation.documentId && navigation2.locale === currentLocale
54049
54210
  );
54050
- if (nextNavigation && nextNavigation.documentId === currentNavigation.documentId && nextNavigation.localeCode !== currentNavigation.localeCode) {
54211
+ if (nextNavigation && nextNavigation.documentId === currentNavigation.documentId && nextNavigation.locale !== currentNavigation.locale) {
54051
54212
  setCurrentNavigation(nextNavigation);
54052
54213
  }
54053
54214
  }
@@ -54612,8 +54773,17 @@ const useConfig = () => {
54612
54773
  const useRestart = () => {
54613
54774
  const fetch = getFetchClient();
54614
54775
  const apiClient = getApiClient(fetch);
54776
+ const healthCheck = useQuery({
54777
+ queryKey: apiClient.healthCheckIndex(),
54778
+ queryFn: () => apiClient.healthCheck(),
54779
+ retry: true,
54780
+ retryDelay: 1e3 * 5,
54781
+ enabled: false
54782
+ });
54615
54783
  return useMutation({
54616
- mutationFn: () => apiClient.restart()
54784
+ mutationFn: () => {
54785
+ return apiClient.restart().then(() => healthCheck.refetch());
54786
+ }
54617
54787
  });
54618
54788
  };
54619
54789
  const useRestoreConfig = () => {
@@ -54825,12 +54995,13 @@ const Inner = () => {
54825
54995
  restartMutation.mutate(void 0, {
54826
54996
  onSuccess() {
54827
54997
  setRestartStatus({ required: false });
54998
+ window.location.reload();
54828
54999
  },
54829
55000
  onError() {
54830
55001
  setRestartStatus({ required: false });
55002
+ window.location.reload();
54831
55003
  }
54832
55004
  });
54833
- window.location.reload();
54834
55005
  };
54835
55006
  const handleRestartDiscard = () => setRestartStatus({ required: false });
54836
55007
  useEffect(() => {
@@ -54931,8 +55102,8 @@ const Inner = () => {
54931
55102
  name: "preferCustomContentTypes",
54932
55103
  checked: values.preferCustomContentTypes,
54933
55104
  onChange: (eventOrPath) => handleChange(eventOrPath, !values.preferCustomContentTypes, onChange),
54934
- onLabel: formatMessage(getTrad("component.toggle.enabled")),
54935
- offLabel: formatMessage(getTrad("component.toggle.disabled")),
55105
+ onLabel: formatMessage(getTrad("components.toggle.enabled")),
55106
+ offLabel: formatMessage(getTrad("components.toggle.disabled")),
54936
55107
  disabled: restartStatus.required,
54937
55108
  width: "100%"
54938
55109
  }
@@ -55193,10 +55364,17 @@ const Inner = () => {
55193
55364
  {
55194
55365
  width: "100%",
55195
55366
  name: "allowedLevels",
55367
+ type: "number",
55196
55368
  placeholder: formatMessage(
55197
55369
  getTrad("pages.settings.form.allowedLevels.placeholder")
55198
55370
  ),
55199
- onChange: (eventOrPath, value) => handleChange(eventOrPath, value, onChange),
55371
+ onChange: (eventOrPath, value) => {
55372
+ if (isObject(eventOrPath)) {
55373
+ const parsedVal = parseInt(eventOrPath.target.value);
55374
+ return handleChange(eventOrPath.target.name, isNaN$1(parsedVal) ? 0 : parsedVal, onChange);
55375
+ }
55376
+ return handleChange(eventOrPath, value, onChange);
55377
+ },
55200
55378
  value: values.allowedLevels,
55201
55379
  disabled: restartStatus.required
55202
55380
  }
@@ -55218,8 +55396,8 @@ const Inner = () => {
55218
55396
  name: "cascadeMenuAttached",
55219
55397
  checked: values.cascadeMenuAttached,
55220
55398
  onChange: (eventOrPath) => handleChange(eventOrPath, !values.cascadeMenuAttached, onChange),
55221
- onLabel: formatMessage(getTrad("component.toggle.enabled")),
55222
- offLabel: formatMessage(getTrad("component.toggle.disabled")),
55399
+ onLabel: formatMessage(getTrad("components.toggle.enabled")),
55400
+ offLabel: formatMessage(getTrad("components.toggle.disabled")),
55223
55401
  disabled: restartStatus.required
55224
55402
  }
55225
55403
  )
@@ -55237,8 +55415,8 @@ const Inner = () => {
55237
55415
  name: "audienceFieldChecked",
55238
55416
  checked: values.audienceFieldChecked,
55239
55417
  onChange: (eventOrPath) => handleChange(eventOrPath, !values.audienceFieldChecked, onChange),
55240
- onLabel: formatMessage(getTrad("component.toggle.enabled")),
55241
- offLabel: formatMessage(getTrad("component.toggle.disabled")),
55418
+ onLabel: formatMessage(getTrad("components.toggle.enabled")),
55419
+ offLabel: formatMessage(getTrad("components.toggle.disabled")),
55242
55420
  disabled: restartStatus.required,
55243
55421
  width: "100%"
55244
55422
  }
@@ -55257,8 +55435,8 @@ const Inner = () => {
55257
55435
  name: "isCacheEnabled",
55258
55436
  checked: values.isCacheEnabled,
55259
55437
  onChange: (eventOrPath) => handleChange(eventOrPath, !values.isCacheEnabled, onChange),
55260
- onLabel: formatMessage(getTrad("component.toggle.enabled")),
55261
- offLabel: formatMessage(getTrad("component.toggle.disabled")),
55438
+ onLabel: formatMessage(getTrad("components.toggle.enabled")),
55439
+ offLabel: formatMessage(getTrad("components.toggle.disabled")),
55262
55440
  disabled: restartStatus.required,
55263
55441
  width: "100%"
55264
55442
  }