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
@@ -8568,7 +8568,8 @@ const SvgCog = ({
8568
8568
  const stroke = strokeProp && strokeProp in colors ? colors[strokeProp] : strokeProp;
8569
8569
  return /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 32 32", width: 16, height: 16, fill, stroke, ref, ...props, children: /* @__PURE__ */ jsxRuntime.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" }) });
8570
8570
  };
8571
- React.forwardRef(SvgCog);
8571
+ const ForwardRef$40 = React.forwardRef(SvgCog);
8572
+ const ForwardRef$41 = ForwardRef$40;
8572
8573
  const SvgCollapse = ({
8573
8574
  fill: fillProp = "currentColor",
8574
8575
  stroke: strokeProp,
@@ -13815,7 +13816,7 @@ class TreeCursor {
13815
13816
  return this.move(1, enter);
13816
13817
  }
13817
13818
  /**
13818
- Move to the next node in a last-to-first pre-order traveral. A
13819
+ Move to the next node in a last-to-first pre-order traversal. A
13819
13820
  node is followed by its last child or, if it has none, its
13820
13821
  previous sibling or the previous sibling of the first parent
13821
13822
  node that has one.
@@ -13890,10 +13891,10 @@ class TreeCursor {
13890
13891
  if (mustLeave && leave)
13891
13892
  leave(this);
13892
13893
  mustLeave = this.type.isAnonymous;
13893
- if (this.nextSibling())
13894
- break;
13895
13894
  if (!depth)
13896
13895
  return;
13896
+ if (this.nextSibling())
13897
+ break;
13897
13898
  this.parent();
13898
13899
  depth--;
13899
13900
  mustLeave = true;
@@ -31922,6 +31923,8 @@ function selectedLineRanges(state) {
31922
31923
  for (let r of state.selection.ranges) {
31923
31924
  let fromLine = state.doc.lineAt(r.from);
31924
31925
  let toLine = r.to <= fromLine.to ? fromLine : state.doc.lineAt(r.to);
31926
+ if (toLine.from > fromLine.from && toLine.from == r.to)
31927
+ toLine = r.to == fromLine.to + 1 ? fromLine : state.doc.lineAt(r.to - 1);
31925
31928
  let last = ranges.length - 1;
31926
31929
  if (last >= 0 && ranges[last].to > fromLine.from)
31927
31930
  ranges[last].to = toLine.to;
@@ -50372,9 +50375,13 @@ const prefixPluginTranslations = (trad, pluginId) => {
50372
50375
  }, {});
50373
50376
  };
50374
50377
  const usePluginTheme = () => {
50378
+ const getSystemTheme = () => window.matchMedia("(prefers-color-scheme: dark)").matches;
50375
50379
  const [theme2, setTheme] = React.useState();
50376
50380
  React.useEffect(() => {
50377
- setTheme(window.localStorage?.STRAPI_THEME);
50381
+ const isDarkSystemTheme = getSystemTheme();
50382
+ const systemTheme = isDarkSystemTheme ? "dark" : "light";
50383
+ const strapiTheme = window.localStorage?.STRAPI_THEME;
50384
+ setTheme(strapiTheme === "system" ? systemTheme : strapiTheme);
50378
50385
  }, []);
50379
50386
  return {
50380
50387
  theme: theme2 === "dark" ? darkTheme : lightTheme,
@@ -50403,7 +50410,7 @@ const Field = ({ children, name: name2, hint, label, error, required }) => {
50403
50410
  const trads = {
50404
50411
  en: () => Promise.resolve().then(() => require("../_chunks/en-CT7eKHZS.js")),
50405
50412
  fr: () => Promise.resolve().then(() => require("../_chunks/fr-ybbSdjZO.js")),
50406
- ca: () => Promise.resolve().then(() => require("../_chunks/ca-Bjfh0w36.js"))
50413
+ ca: () => Promise.resolve().then(() => require("../_chunks/ca-DtaqQvTI.js"))
50407
50414
  };
50408
50415
  const getTradId = (msg) => `${PLUGIN_ID}.${msg}`;
50409
50416
  const getTrad = (msg, defaultMessage) => ({
@@ -50494,7 +50501,7 @@ const audienceDBSchema = z__namespace.object({
50494
50501
  name: z__namespace.string(),
50495
50502
  key: z__namespace.string()
50496
50503
  });
50497
- const navigationItemTypeSchema = z__namespace.enum(["INTERNAL", "EXTERNAL"]);
50504
+ const navigationItemTypeSchema = z__namespace.enum(["INTERNAL", "EXTERNAL", "WRAPPER"]);
50498
50505
  const navigationItemBaseSchema = z__namespace.object({
50499
50506
  id: z__namespace.number(),
50500
50507
  documentId: z__namespace.string(),
@@ -50525,7 +50532,7 @@ const navigationSchema = z__namespace.object({
50525
50532
  documentId: z__namespace.string(),
50526
50533
  name: z__namespace.string(),
50527
50534
  slug: z__namespace.string(),
50528
- localeCode: z__namespace.string(),
50535
+ locale: z__namespace.string(),
50529
50536
  visible: z__namespace.boolean(),
50530
50537
  items: z__namespace.array(navigationItemSchema)
50531
50538
  });
@@ -50766,6 +50773,12 @@ const getApiClient = lodash$1.once((fetch) => ({
50766
50773
  readConfigIndex() {
50767
50774
  return [URL_PREFIX, "config"];
50768
50775
  },
50776
+ healthCheck() {
50777
+ return fetch.get(`/_health`);
50778
+ },
50779
+ healthCheckIndex() {
50780
+ return ["health"];
50781
+ },
50769
50782
  readNavigationItemFromLocale({
50770
50783
  source,
50771
50784
  structureId,
@@ -51103,7 +51116,7 @@ const toNavigationItem = (payload, config2) => {
51103
51116
  structureId: payload.structureId,
51104
51117
  removed: payload.removed,
51105
51118
  updated: payload.updated
51106
- } : {
51119
+ } : payload.type === "EXTERNAL" ? {
51107
51120
  type: "EXTERNAL",
51108
51121
  collapsed: !!payload.collapsed,
51109
51122
  id: payload.id,
@@ -51125,6 +51138,27 @@ const toNavigationItem = (payload, config2) => {
51125
51138
  audience: payload.audience?.map(
51126
51139
  (documentId) => config2.availableAudience.find((audience) => audience.documentId === documentId)
51127
51140
  ) ?? []
51141
+ } : {
51142
+ type: "WRAPPER",
51143
+ collapsed: !!payload.collapsed,
51144
+ id: payload.id,
51145
+ documentId: payload.documentId,
51146
+ menuAttached: !!payload.menuAttached,
51147
+ order: payload.order ?? 0,
51148
+ path: payload.path ?? "",
51149
+ title: payload.title,
51150
+ uiRouterKey: payload.uiRouterKey,
51151
+ additionalFields: payload.additionalFields,
51152
+ audience: payload.audience?.map(
51153
+ (documentId) => config2.availableAudience.find((audience) => audience.documentId === documentId)
51154
+ ) ?? [],
51155
+ autoSync: payload.autoSync,
51156
+ items: payload.items?.length ? transformItemToViewPayload(payload, payload.items, config2) : payload.items,
51157
+ viewId: payload.viewId,
51158
+ viewParentId: payload.viewParentId,
51159
+ structureId: payload.structureId,
51160
+ removed: payload.removed,
51161
+ updated: payload.updated
51128
51162
  };
51129
51163
  };
51130
51164
  const transformItemToViewPayload = (payload, items = [], config2) => {
@@ -51186,8 +51220,15 @@ const extractRelatedItemLabel = (item, config2) => {
51186
51220
  if (contentType2?.isSingle) {
51187
51221
  return contentType2.labelSingular;
51188
51222
  }
51189
- const defaultFieldsWithCapitalizedOptions = [...defaultFields, ...defaultFields.map((_) => lodash$1.capitalize(_))];
51190
- const labelFields = lodash$1.get(fields, `${contentType2 ? contentType2.uid : __collectionUid}`, defaultFieldsWithCapitalizedOptions);
51223
+ const defaultFieldsWithCapitalizedOptions = [
51224
+ ...defaultFields,
51225
+ ...defaultFields.map((_) => lodash$1.capitalize(_))
51226
+ ];
51227
+ const labelFields = lodash$1.get(
51228
+ fields,
51229
+ `${contentType2 ? contentType2.uid : __collectionUid}`,
51230
+ defaultFieldsWithCapitalizedOptions
51231
+ );
51191
51232
  const itemLabels = (lodash$1.isEmpty(labelFields) ? defaultFieldsWithCapitalizedOptions : labelFields).map((_) => item[_]).filter((_) => _);
51192
51233
  return lodash$1.first(itemLabels) || "";
51193
51234
  };
@@ -51231,7 +51272,7 @@ const mapServerNavigationItem = (item, stopAtFirstLevel = false) => {
51231
51272
  removed: item.removed,
51232
51273
  updated: item.updated,
51233
51274
  isSearchActive: item.isSearchActive
51234
- } : {
51275
+ } : item.type === "EXTERNAL" ? {
51235
51276
  type: "EXTERNAL",
51236
51277
  id: item.id,
51237
51278
  documentId: item.documentId,
@@ -51249,6 +51290,24 @@ const mapServerNavigationItem = (item, stopAtFirstLevel = false) => {
51249
51290
  removed: item.removed,
51250
51291
  updated: item.updated,
51251
51292
  isSearchActive: item.isSearchActive
51293
+ } : {
51294
+ type: "WRAPPER",
51295
+ id: item.id,
51296
+ documentId: item.documentId,
51297
+ additionalFields: item.additionalFields ?? {},
51298
+ title: item.title,
51299
+ uiRouterKey: item.uiRouterKey,
51300
+ autoSync: item.autoSync ?? void 0,
51301
+ collapsed: item.collapsed,
51302
+ order: item.order ?? 0,
51303
+ menuAttached: item.menuAttached,
51304
+ viewId: item.viewId,
51305
+ viewParentId: item.viewParentId,
51306
+ items: stopAtFirstLevel ? item.items : item.items?.map((_) => mapServerNavigationItem(_)) ?? void 0,
51307
+ removed: item.removed,
51308
+ updated: item.updated,
51309
+ isSearchActive: item.isSearchActive,
51310
+ path: item.path ?? ""
51252
51311
  };
51253
51312
  };
51254
51313
  const getPendingAction = (actions) => actions.find(({ isPending }) => isPending);
@@ -51509,7 +51568,7 @@ const AllNavigations = ({ navigations, selected, setState }) => {
51509
51568
  const purgeSelected = React.useCallback(purgeCache(selected), [purgeCache]);
51510
51569
  const getLocalizations = (focused) => [focused].concat(
51511
51570
  navigations.filter(
51512
- (navigation2) => navigation2.documentId === focused.documentId && navigation2.localeCode !== focused.localeCode
51571
+ (navigation2) => navigation2.documentId === focused.documentId && navigation2.locale !== focused.locale
51513
51572
  )
51514
51573
  );
51515
51574
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
@@ -51537,7 +51596,7 @@ const AllNavigations = ({ navigations, selected, setState }) => {
51537
51596
  }
51538
51597
  ) }) }) : null })
51539
51598
  ] }) }),
51540
- /* @__PURE__ */ jsxRuntime.jsx(Tbody, { children: navigations.filter(({ localeCode }) => localeCode === localeQuery.data?.defaultLocale).map((navigation2) => /* @__PURE__ */ jsxRuntime.jsxs(Tr, { children: [
51599
+ /* @__PURE__ */ jsxRuntime.jsx(Tbody, { children: navigations.filter(({ locale }) => locale === localeQuery.data?.defaultLocale).map((navigation2) => /* @__PURE__ */ jsxRuntime.jsxs(Tr, { children: [
51541
51600
  /* @__PURE__ */ jsxRuntime.jsx(Td, { children: /* @__PURE__ */ jsxRuntime.jsx(
51542
51601
  CheckboxImpl,
51543
51602
  {
@@ -51550,7 +51609,7 @@ const AllNavigations = ({ navigations, selected, setState }) => {
51550
51609
  ) }),
51551
51610
  /* @__PURE__ */ jsxRuntime.jsx(Td, { children: /* @__PURE__ */ jsxRuntime.jsx(Typography, { textColor: "neutral800", children: navigation2.documentId }) }),
51552
51611
  /* @__PURE__ */ jsxRuntime.jsx(Td, { children: /* @__PURE__ */ jsxRuntime.jsx(Typography, { textColor: "neutral800", children: navigation2.name }) }),
51553
- /* @__PURE__ */ jsxRuntime.jsx(Td, { children: /* @__PURE__ */ jsxRuntime.jsx(Typography, { textColor: "neutral800", children: getLocalizations(navigation2).map(fp.prop("localeCode")).join(", ") }) }),
51612
+ /* @__PURE__ */ jsxRuntime.jsx(Td, { children: /* @__PURE__ */ jsxRuntime.jsx(Typography, { textColor: "neutral800", children: getLocalizations(navigation2).map(fp.prop("locale")).join(", ") }) }),
51554
51613
  /* @__PURE__ */ jsxRuntime.jsx(Td, { children: /* @__PURE__ */ jsxRuntime.jsx(Typography, { textColor: "neutral800", children: navigation2.visible ? formatMessage(getTrad("popup.navigation.manage.navigation.visible")) : formatMessage(getTrad("popup.navigation.manage.navigation.hidden")) }) }),
51555
51614
  /* @__PURE__ */ jsxRuntime.jsx(Td, { children: /* @__PURE__ */ jsxRuntime.jsxs(Flex, { width: "100%", direction: "row", alignItems: "center", justifyContent: "flex-end", children: [
51556
51615
  /* @__PURE__ */ jsxRuntime.jsx(Box, { paddingLeft: 1, children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -52070,7 +52129,7 @@ const NavigationHeader = ({
52070
52129
  value: activeNavigation?.documentId,
52071
52130
  size: "S",
52072
52131
  style: null,
52073
- children: availableNavigations.filter(({ localeCode }) => localeCode === currentLocale).map(({ documentId, name: name2 }) => /* @__PURE__ */ jsxRuntime.jsx(SingleSelectOption, { value: documentId, children: name2 }, documentId))
52132
+ children: availableNavigations.filter(({ locale: locale2 }) => locale2 === currentLocale).map(({ documentId, name: name2 }) => /* @__PURE__ */ jsxRuntime.jsx(SingleSelectOption, { value: documentId, children: name2 }, documentId))
52074
52133
  }
52075
52134
  ) }) }),
52076
52135
  hasLocalizations ? /* @__PURE__ */ jsxRuntime.jsx(Grid.Item, { col: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -52381,34 +52440,28 @@ const Item = ({
52381
52440
  viewParentId,
52382
52441
  locale
52383
52442
  }) => {
52384
- const {
52385
- viewId,
52386
- type,
52387
- path,
52388
- removed,
52389
- externalPath,
52390
- menuAttached,
52391
- collapsed,
52392
- items = [],
52393
- isSearchActive,
52394
- related,
52395
- relatedType
52396
- } = mapServerNavigationItem(item, true);
52443
+ const mappedItem = mapServerNavigationItem(item, true);
52397
52444
  const { formatMessage } = reactIntl.useIntl();
52398
52445
  const configQuery = useConfig$1();
52399
- const isExternal = type === "EXTERNAL";
52446
+ const isExternal = mappedItem.type === "EXTERNAL";
52447
+ const isWrapper = mappedItem.type === "WRAPPER";
52400
52448
  const isNextMenuAllowedLevel = lodash$1.isNumber(configQuery.data?.allowedLevels) ? level < configQuery.data.allowedLevels - 1 : true;
52401
52449
  const isMenuAllowedLevel = lodash$1.isNumber(configQuery.data?.allowedLevels) ? level < configQuery.data.allowedLevels : true;
52402
52450
  const hasChildren = !lodash$1.isEmpty(item.items) && !isExternal && !displayChildren;
52403
- const absolutePath = isExternal ? void 0 : `${levelPath === "/" ? "" : levelPath}/${path === "/" ? "" : path}`.replace("//", "/");
52451
+ const absolutePath = isExternal ? void 0 : `${levelPath === "/" ? "" : levelPath}/${mappedItem.path === "/" ? "" : mappedItem.path}`.replace(
52452
+ "//",
52453
+ "/"
52454
+ );
52404
52455
  const contentTypeItemsQuery = useContentTypeItems({
52405
- uid: relatedType ?? "",
52456
+ uid: mappedItem.type === "INTERNAL" ? mappedItem.relatedType ?? "" : "",
52406
52457
  locale
52407
52458
  });
52408
52459
  const contentTypesQuery = useContentTypes$1();
52409
- const contentType2 = contentTypesQuery.data?.find((_) => _.uid === relatedType);
52460
+ const contentType2 = contentTypesQuery.data?.find(
52461
+ (_) => mappedItem.type === "INTERNAL" ? _.uid === mappedItem.relatedType : false
52462
+ );
52410
52463
  const relatedItem = contentTypeItemsQuery.data?.find(
52411
- (contentTypeItem) => contentTypeItem.documentId === related
52464
+ (contentTypeItem) => mappedItem.type === "INTERNAL" ? contentTypeItem.documentId === mappedItem.related : false
52412
52465
  ) ?? { documentId: "", id: 0 };
52413
52466
  const isPublished = !!relatedItem?.publishedAt;
52414
52467
  const relatedItemLabel = !isExternal ? extractRelatedItemLabel(relatedItem, configQuery.data) : "";
@@ -52470,24 +52523,32 @@ const Item = ({
52470
52523
  const onNewItemClick = React.useCallback(
52471
52524
  (event) => canUpdate && onItemLevelAdd(
52472
52525
  event,
52473
- viewId,
52526
+ mappedItem.viewId,
52474
52527
  isNextMenuAllowedLevel,
52475
52528
  absolutePath,
52476
- menuAttached,
52477
- `${structureId}.${items.length}`,
52478
- Math.max(...items.map(({ order }) => order))
52529
+ mappedItem.menuAttached,
52530
+ `${structureId}.${mappedItem.items?.length ?? 0}`,
52531
+ Math.max(...mappedItem.items?.map(({ order }) => order) ?? [])
52479
52532
  ),
52480
- [viewId, isNextMenuAllowedLevel, absolutePath, menuAttached, structureId, items, canUpdate]
52533
+ [
52534
+ mappedItem.viewId,
52535
+ isNextMenuAllowedLevel,
52536
+ absolutePath,
52537
+ mappedItem.menuAttached,
52538
+ structureId,
52539
+ mappedItem.items,
52540
+ canUpdate
52541
+ ]
52481
52542
  );
52482
52543
  React.useEffect(() => {
52483
- if (isSearchActive) {
52544
+ if (mappedItem.isSearchActive) {
52484
52545
  refs.dropRef?.current?.scrollIntoView?.({
52485
52546
  behavior: "smooth",
52486
52547
  block: "center",
52487
52548
  inline: "center"
52488
52549
  });
52489
52550
  }
52490
- }, [isSearchActive, refs.dropRef.current]);
52551
+ }, [mappedItem.isSearchActive, refs.dropRef.current]);
52491
52552
  const theme2 = styled.useTheme();
52492
52553
  return /* @__PURE__ */ jsxRuntime.jsxs(
52493
52554
  Wrapper$1,
@@ -52505,23 +52566,23 @@ const Item = ({
52505
52566
  zIndex: 1,
52506
52567
  position: "relative",
52507
52568
  overflow: "hidden",
52508
- backgroundColor: isSearchActive ? theme2.colors.secondary100 : void 0,
52509
- borderColor: isSearchActive ? theme2.colors.secondary200 : void 0,
52569
+ backgroundColor: mappedItem.isSearchActive ? theme2.colors.secondary100 : void 0,
52570
+ borderColor: mappedItem.isSearchActive ? theme2.colors.secondary200 : void 0,
52510
52571
  transition: "background-color 0.3s ease-in"
52511
52572
  },
52512
52573
  children: [
52513
- removed && /* @__PURE__ */ jsxRuntime.jsx(ItemCardRemovedOverlay, {}),
52574
+ mappedItem.removed && /* @__PURE__ */ jsxRuntime.jsx(ItemCardRemovedOverlay, {}),
52514
52575
  /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: refs.previewRef, children: [
52515
52576
  /* @__PURE__ */ jsxRuntime.jsx(CardBody, { children: /* @__PURE__ */ jsxRuntime.jsx(
52516
52577
  ItemCardHeader,
52517
52578
  {
52518
52579
  title: item.title ?? "",
52519
- path: isExternal ? externalPath : absolutePath,
52520
- icon: isExternal ? /* @__PURE__ */ jsxRuntime.jsx(ForwardRef$3D, {}) : /* @__PURE__ */ jsxRuntime.jsx(ForwardRef$2l, {}),
52580
+ path: isExternal ? mappedItem.externalPath : absolutePath,
52581
+ icon: isExternal ? /* @__PURE__ */ jsxRuntime.jsx(ForwardRef$3D, {}) : isWrapper ? /* @__PURE__ */ jsxRuntime.jsx(ForwardRef$41, {}) : /* @__PURE__ */ jsxRuntime.jsx(ForwardRef$2l, {}),
52521
52582
  onItemRemove: () => onItemRemove({ ...item, viewParentId }),
52522
52583
  onItemEdit: () => {
52523
- const [relatedType2, related2] = item.related?.split(RELATED_ITEM_SEPARATOR) ?? [];
52524
- if (item.type !== "EXTERNAL" && item.type !== "INTERNAL") {
52584
+ const [relatedType, related] = item.related?.split(RELATED_ITEM_SEPARATOR) ?? [];
52585
+ if (item.type !== "EXTERNAL" && item.type !== "INTERNAL" && item.type !== "WRAPPER") {
52525
52586
  return;
52526
52587
  }
52527
52588
  onItemEdit({
@@ -52531,15 +52592,15 @@ const Item = ({
52531
52592
  isMenuAllowedLevel,
52532
52593
  isParentAttachedToMenu,
52533
52594
  isSearchActive: false,
52534
- relatedType: relatedType2,
52535
- related: related2,
52595
+ relatedType,
52596
+ related,
52536
52597
  additionalFields: item.additionalFields ?? {},
52537
52598
  items: item.items ?? [],
52538
52599
  autoSync: item.autoSync ?? true,
52539
52600
  externalPath: void 0,
52540
52601
  viewParentId,
52541
52602
  audience: item.audience?.map(({ documentId }) => documentId) ?? []
52542
- } : {
52603
+ } : item.type === "EXTERNAL" ? {
52543
52604
  ...item,
52544
52605
  type: "EXTERNAL",
52545
52606
  isMenuAllowedLevel,
@@ -52553,6 +52614,17 @@ const Item = ({
52553
52614
  externalPath: item.externalPath ?? "",
52554
52615
  viewParentId,
52555
52616
  audience: item.audience?.map(({ documentId }) => documentId) ?? []
52617
+ } : {
52618
+ ...item,
52619
+ type: "WRAPPER",
52620
+ isMenuAllowedLevel,
52621
+ isParentAttachedToMenu,
52622
+ isSearchActive: false,
52623
+ additionalFields: item.additionalFields ?? {},
52624
+ items: item.items ?? [],
52625
+ autoSync: item.autoSync ?? true,
52626
+ viewParentId,
52627
+ audience: item.audience?.map(({ documentId }) => documentId) ?? []
52556
52628
  },
52557
52629
  levelPath,
52558
52630
  isParentAttachedToMenu
@@ -52560,9 +52632,9 @@ const Item = ({
52560
52632
  },
52561
52633
  onItemRestore: () => onItemRestore({ ...item, viewParentId }),
52562
52634
  dragRef: refs.dragRef,
52563
- removed,
52635
+ removed: mappedItem.removed,
52564
52636
  canUpdate,
52565
- isSearchActive
52637
+ isSearchActive: mappedItem.isSearchActive
52566
52638
  }
52567
52639
  ) }),
52568
52640
  /* @__PURE__ */ jsxRuntime.jsx(Divider, {}),
@@ -52579,21 +52651,29 @@ const Item = ({
52579
52651
  CollapseButton,
52580
52652
  {
52581
52653
  toggle: () => onItemToggleCollapse({ ...item, viewParentId }),
52582
- collapsed,
52654
+ collapsed: mappedItem.collapsed,
52583
52655
  itemsCount: item.items?.length ?? 0
52584
52656
  }
52585
52657
  ),
52586
- canUpdate && isNextMenuAllowedLevel && /* @__PURE__ */ jsxRuntime.jsx(TextButton, { disabled: removed, startIcon: /* @__PURE__ */ jsxRuntime.jsx(ForwardRef$1d, {}), onClick: onNewItemClick, children: /* @__PURE__ */ jsxRuntime.jsx(
52587
- Typography,
52658
+ canUpdate && isNextMenuAllowedLevel && /* @__PURE__ */ jsxRuntime.jsx(
52659
+ TextButton,
52588
52660
  {
52589
- variant: "pi",
52590
- fontWeight: "bold",
52591
- textColor: removed ? "neutral600" : "primary600",
52592
- children: formatMessage(getTrad("components.navigationItem.action.newItem"))
52661
+ disabled: mappedItem.removed,
52662
+ startIcon: /* @__PURE__ */ jsxRuntime.jsx(ForwardRef$1d, {}),
52663
+ onClick: onNewItemClick,
52664
+ children: /* @__PURE__ */ jsxRuntime.jsx(
52665
+ Typography,
52666
+ {
52667
+ variant: "pi",
52668
+ fontWeight: "bold",
52669
+ textColor: mappedItem.removed ? "neutral600" : "primary600",
52670
+ children: formatMessage(getTrad("components.navigationItem.action.newItem"))
52671
+ }
52672
+ )
52593
52673
  }
52594
- ) })
52674
+ )
52595
52675
  ] }),
52596
- related && !relatedItem.id ? /* @__PURE__ */ jsxRuntime.jsxs(Flex, { justifyContent: "center", alignItems: "center", children: [
52676
+ mappedItem.type === "INTERNAL" && mappedItem.related && !relatedItem.id ? /* @__PURE__ */ jsxRuntime.jsxs(Flex, { justifyContent: "center", alignItems: "center", children: [
52597
52677
  /* @__PURE__ */ jsxRuntime.jsxs(Typography, { variant: "omega", textColor: "neutral600", children: [
52598
52678
  relatedTypeLabel,
52599
52679
  " / "
@@ -52637,7 +52717,7 @@ const Item = ({
52637
52717
  ]
52638
52718
  }
52639
52719
  ),
52640
- hasChildren && !removed && !collapsed && /* @__PURE__ */ jsxRuntime.jsx(
52720
+ hasChildren && !mappedItem.removed && !mappedItem.collapsed && /* @__PURE__ */ jsxRuntime.jsx(
52641
52721
  List,
52642
52722
  {
52643
52723
  onItemLevelAdd,
@@ -52646,13 +52726,13 @@ const Item = ({
52646
52726
  onItemRestore,
52647
52727
  onItemReOrder,
52648
52728
  onItemToggleCollapse,
52649
- isParentAttachedToMenu: menuAttached,
52729
+ isParentAttachedToMenu: mappedItem.menuAttached,
52650
52730
  items: item.items ?? [],
52651
52731
  level: level + 1,
52652
52732
  levelPath: absolutePath,
52653
52733
  permissions,
52654
52734
  structurePrefix: structureId,
52655
- viewParentId: viewId,
52735
+ viewParentId: mappedItem.viewId,
52656
52736
  locale
52657
52737
  }
52658
52738
  )
@@ -52910,9 +52990,20 @@ const navigationExternalItemFormSchema = ({
52910
52990
  relatedType: z.z.string().optional(),
52911
52991
  related: z.z.string().optional()
52912
52992
  });
52993
+ const navigationWrapperItemFormSchema = ({
52994
+ isSingleSelected,
52995
+ additionalFields
52996
+ }) => navigationItemCommon({
52997
+ additionalFields,
52998
+ isSingleSelected
52999
+ }).extend({
53000
+ type: z.z.literal("WRAPPER"),
53001
+ path: z.z.string().or(z.z.null()).optional()
53002
+ });
52913
53003
  const navigationItemFormSchema = (input) => z.z.discriminatedUnion("type", [
52914
53004
  navigationExternalItemFormSchema(input),
52915
- navigationInternalItemFormSchema(input)
53005
+ navigationInternalItemFormSchema(input),
53006
+ navigationWrapperItemFormSchema(input)
52916
53007
  ]);
52917
53008
  const fallbackDefaultValues = {
52918
53009
  autoSync: true,
@@ -53023,7 +53114,9 @@ const NavigationItemForm = ({
53023
53114
  const { canUpdate } = permissions;
53024
53115
  const [isSingleSelected, setIsSingleSelected] = React.useState(false);
53025
53116
  const [itemLocaleCopyValue, setItemLocaleCopyValue] = React.useState();
53026
- const [formValue, setFormValue] = React.useState({});
53117
+ const [formValue, setFormValue] = React.useState(
53118
+ {}
53119
+ );
53027
53120
  const [formError, setFormError] = React.useState();
53028
53121
  const configQuery = useConfig$1();
53029
53122
  const availableAudiences = configQuery.data?.availableAudience ?? [];
@@ -53047,13 +53140,19 @@ const NavigationItemForm = ({
53047
53140
  }
53048
53141
  };
53049
53142
  const setFormValueItem = (path, value) => {
53050
- setFormValue(lodash$1.set({
53051
- ...formValue,
53052
- additionalFields: {
53053
- ...formValue.additionalFields
53054
- },
53055
- updated: true
53056
- }, path, value));
53143
+ setFormValue(
53144
+ lodash$1.set(
53145
+ {
53146
+ ...formValue,
53147
+ additionalFields: {
53148
+ ...formValue.additionalFields
53149
+ },
53150
+ updated: true
53151
+ },
53152
+ path,
53153
+ value
53154
+ )
53155
+ );
53057
53156
  };
53058
53157
  const encodePayload = (values) => {
53059
53158
  return {
@@ -53106,19 +53205,25 @@ const NavigationItemForm = ({
53106
53205
  const submit = async (e, values) => {
53107
53206
  e.preventDefault();
53108
53207
  const sanitizedValues = encodePayload(values);
53109
- const { success, data: payload, error } = navigationItemFormSchema({
53208
+ const {
53209
+ success,
53210
+ data: payload,
53211
+ error
53212
+ } = navigationItemFormSchema({
53110
53213
  isSingleSelected,
53111
53214
  additionalFields: configQuery.data?.additionalFields ?? FALLBACK_ADDITIONAL_FIELDS
53112
53215
  }).safeParse(sanitizedValues);
53113
53216
  if (success) {
53114
- const title = !!payload.title.trim() ? payload.title : getDefaultTitle(payload?.related?.toString(), payload.relatedType, isSingleSelected);
53217
+ const title = !!payload.title.trim() ? payload.title.trim() : payload.type === "INTERNAL" ? getDefaultTitle(payload?.related?.toString(), payload.relatedType, isSingleSelected) : "";
53115
53218
  setIsLoading(true);
53116
- const uiRouterKey = await generateUiRouterKey({
53117
- slugify: slugifyMutation.mutateAsync,
53118
- title,
53119
- related: payload.related,
53120
- relatedType: payload.relatedType
53121
- });
53219
+ const uiRouterKey = await generateUiRouterKey(
53220
+ payload.type === "INTERNAL" ? {
53221
+ slugify: slugifyMutation.mutateAsync,
53222
+ title,
53223
+ related: payload.related,
53224
+ relatedType: payload.relatedType
53225
+ } : { slugify: slugifyMutation.mutateAsync, title }
53226
+ );
53122
53227
  slugifyMutation.reset();
53123
53228
  setIsLoading(false);
53124
53229
  if (!uiRouterKey) {
@@ -53140,12 +53245,14 @@ const NavigationItemForm = ({
53140
53245
  }
53141
53246
  );
53142
53247
  } else if (error) {
53143
- setFormError(error.issues.reduce((acc, err) => {
53144
- return {
53145
- ...acc,
53146
- [err.path.join(".")]: err.message
53147
- };
53148
- }, {}));
53248
+ setFormError(
53249
+ error.issues.reduce((acc, err) => {
53250
+ return {
53251
+ ...acc,
53252
+ [err.path.join(".")]: err.message
53253
+ };
53254
+ }, {})
53255
+ );
53149
53256
  }
53150
53257
  };
53151
53258
  const renderError = (error) => {
@@ -53155,18 +53262,21 @@ const NavigationItemForm = ({
53155
53262
  }
53156
53263
  return void 0;
53157
53264
  };
53158
- const initialRelatedTypeSelected = current.relatedType;
53265
+ const initialRelatedTypeSelected = current.type === "INTERNAL" ? current.relatedType : void 0;
53159
53266
  const {
53160
- relatedType: currentRelatedType,
53161
- related: currentRelated,
53162
53267
  path: currentPath,
53163
53268
  type: currentType,
53164
53269
  title: currentTitle,
53165
53270
  autoSync: autoSyncEnabled
53166
53271
  } = formValue;
53272
+ const { relatedType: currentRelatedType, related: currentRelated } = formValue.type === "INTERNAL" ? formValue : {
53273
+ related: void 0,
53274
+ relatedType: void 0
53275
+ };
53167
53276
  const isExternal = currentType === "EXTERNAL";
53277
+ const isInternal = currentType === "INTERNAL";
53168
53278
  const pathSourceName = isExternal ? "externalPath" : "path";
53169
- const submitDisabled = !isExternal && !isSingleSelected && lodash$1.isNil(currentRelated) || isLoading;
53279
+ const submitDisabled = isInternal && !isSingleSelected && lodash$1.isNil(currentRelated) || isLoading;
53170
53280
  const contentTypeItemsQuery = useContentTypeItems({
53171
53281
  uid: currentRelatedType ?? "",
53172
53282
  locale
@@ -53210,7 +53320,7 @@ const NavigationItemForm = ({
53210
53320
  },
53211
53321
  [contentTypeItemsQuery.data, configQuery.data, contentTypes]
53212
53322
  );
53213
- const navigationItemTypeOptions = ["INTERNAL", "EXTERNAL"].map((key) => {
53323
+ const navigationItemTypeOptions = ["INTERNAL", "EXTERNAL", "WRAPPER"].map((key) => {
53214
53324
  return {
53215
53325
  key,
53216
53326
  value: key,
@@ -53261,9 +53371,7 @@ const NavigationItemForm = ({
53261
53371
  async (event) => {
53262
53372
  event.preventDefault();
53263
53373
  event.stopPropagation();
53264
- const source = navigationsQuery.data?.find(
53265
- ({ localeCode }) => localeCode === itemLocaleCopyValue
53266
- );
53374
+ const source = navigationsQuery.data?.find(({ locale: locale2 }) => locale2 === itemLocaleCopyValue);
53267
53375
  if (source) {
53268
53376
  setIsLoading(true);
53269
53377
  copyItemFromLocaleMutation.mutate(
@@ -53297,10 +53405,12 @@ const NavigationItemForm = ({
53297
53405
  [setIsLoading, copyItemFromLocaleMutation, navigationsQuery]
53298
53406
  );
53299
53407
  React.useEffect(() => {
53300
- setFormValue(decodePayload({
53301
- ...fallbackDefaultValues,
53302
- ...current
53303
- }));
53408
+ setFormValue(
53409
+ decodePayload({
53410
+ ...fallbackDefaultValues,
53411
+ ...current
53412
+ })
53413
+ );
53304
53414
  }, [current]);
53305
53415
  React.useEffect(() => {
53306
53416
  if (currentRelatedType) {
@@ -53359,51 +53469,60 @@ const NavigationItemForm = ({
53359
53469
  contentTypeItemsQuery.data
53360
53470
  ]);
53361
53471
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
53362
- /* @__PURE__ */ jsxRuntime.jsx(Modal.Body, { children: /* @__PURE__ */ jsxRuntime.jsx(
53363
- admin.Form,
53364
- {
53365
- method: "POST",
53366
- initialValues: formValue,
53367
- children: ({ values, onChange }) => {
53368
- const pathDefault = generatePreviewPath({
53369
- currentPath: values.path,
53370
- isExternal: values.type === "EXTERNAL",
53371
- current,
53372
- currentType: values.type,
53373
- config: configQuery.data,
53374
- contentTypeItems: contentTypeItemsQuery.data,
53375
- currentRelated: values.related,
53376
- currentRelatedType: values.relatedType,
53377
- isSingleSelected
53378
- });
53379
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
53380
- /* @__PURE__ */ jsxRuntime.jsxs(Grid.Root, { gap: 5, children: [
53381
- /* @__PURE__ */ jsxRuntime.jsx(Grid.Item, { alignItems: "flex-start", col: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
53382
- Field,
53472
+ /* @__PURE__ */ jsxRuntime.jsx(Modal.Body, { children: /* @__PURE__ */ jsxRuntime.jsx(admin.Form, { method: "POST", initialValues: formValue, children: ({ values, onChange }) => {
53473
+ const internalValues = values.type === "INTERNAL" ? values : {
53474
+ related: void 0,
53475
+ relatedType: void 0
53476
+ };
53477
+ const pathDefault = generatePreviewPath({
53478
+ currentPath: values.path,
53479
+ isExternal: values.type === "EXTERNAL",
53480
+ current,
53481
+ currentType: values.type,
53482
+ config: configQuery.data,
53483
+ contentTypeItems: contentTypeItemsQuery.data,
53484
+ currentRelated: internalValues.related,
53485
+ currentRelatedType: internalValues.relatedType,
53486
+ isSingleSelected
53487
+ });
53488
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
53489
+ /* @__PURE__ */ jsxRuntime.jsxs(Grid.Root, { gap: 5, children: [
53490
+ /* @__PURE__ */ jsxRuntime.jsx(Grid.Item, { alignItems: "flex-start", col: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
53491
+ Field,
53492
+ {
53493
+ name: "title",
53494
+ label: formatMessage(getTrad("popup.item.form.title.label", "Title")),
53495
+ error: renderError("title"),
53496
+ hint: formatMessage(
53497
+ getTrad("popup.item.form.title.placeholder", "e.g. Blog")
53498
+ ),
53499
+ children: /* @__PURE__ */ jsxRuntime.jsx(
53500
+ TextInput,
53383
53501
  {
53502
+ type: "string",
53503
+ disabled: !canUpdate || values.autoSync && values.type === "INTERNAL",
53384
53504
  name: "title",
53385
- label: formatMessage(getTrad("popup.item.form.title.label", "Title")),
53386
- error: renderError("title"),
53387
- hint: formatMessage(getTrad("popup.item.form.title.placeholder", "e.g. Blog")),
53388
- children: /* @__PURE__ */ jsxRuntime.jsx(
53389
- TextInput,
53390
- {
53391
- type: "string",
53392
- disabled: !canUpdate || values.autoSync && values.type === "INTERNAL",
53393
- name: "title",
53394
- onChange: (eventOrPath, value) => handleChange(eventOrPath, value, onChange),
53395
- value: values.title
53396
- }
53397
- )
53505
+ onChange: (eventOrPath, value) => handleChange(eventOrPath, value, onChange),
53506
+ value: values.title
53398
53507
  }
53399
- ) }, "title"),
53400
- /* @__PURE__ */ jsxRuntime.jsx(Grid.Item, { alignItems: "flex-start", col: values.type === "INTERNAL" ? 4 : 7, lg: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
53508
+ )
53509
+ }
53510
+ ) }, "title"),
53511
+ /* @__PURE__ */ jsxRuntime.jsx(
53512
+ Grid.Item,
53513
+ {
53514
+ alignItems: "flex-start",
53515
+ col: values.type === "INTERNAL" ? 4 : 7,
53516
+ lg: 12,
53517
+ children: /* @__PURE__ */ jsxRuntime.jsx(
53401
53518
  Field,
53402
53519
  {
53403
53520
  name: "type",
53404
53521
  label: formatMessage(getTrad("popup.item.form.type.label", "Internal link")),
53405
53522
  error: renderError("type"),
53406
- hint: formatMessage(getTrad("popup.item.form.title.placeholder", "e.g. Blog")),
53523
+ hint: formatMessage(
53524
+ getTrad("popup.item.form.title.placeholder", "e.g. Blog")
53525
+ ),
53407
53526
  children: /* @__PURE__ */ jsxRuntime.jsx(
53408
53527
  SingleSelect,
53409
53528
  {
@@ -53416,12 +53535,23 @@ const NavigationItemForm = ({
53416
53535
  }
53417
53536
  )
53418
53537
  }
53419
- ) }, "type"),
53420
- /* @__PURE__ */ jsxRuntime.jsx(Grid.Item, { alignItems: "flex-start", col: values.type === "INTERNAL" ? 4 : 5, lg: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
53538
+ )
53539
+ },
53540
+ "type"
53541
+ ),
53542
+ /* @__PURE__ */ jsxRuntime.jsx(
53543
+ Grid.Item,
53544
+ {
53545
+ alignItems: "flex-start",
53546
+ col: values.type === "INTERNAL" ? 4 : 5,
53547
+ lg: 12,
53548
+ children: /* @__PURE__ */ jsxRuntime.jsx(
53421
53549
  Field,
53422
53550
  {
53423
53551
  name: "menuAttached",
53424
- label: formatMessage(getTrad("popup.item.form.menuAttached.label", "MenuAttached")),
53552
+ label: formatMessage(
53553
+ getTrad("popup.item.form.menuAttached.label", "MenuAttached")
53554
+ ),
53425
53555
  error: renderError("menuAttached"),
53426
53556
  hint: formatMessage(
53427
53557
  getTrad(
@@ -53443,134 +53573,149 @@ const NavigationItemForm = ({
53443
53573
  }
53444
53574
  )
53445
53575
  }
53446
- ) }, "menuAttached"),
53447
- values.type === "INTERNAL" && /* @__PURE__ */ jsxRuntime.jsx(Grid.Item, { alignItems: "flex-start", col: 4, lg: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
53448
- Field,
53576
+ )
53577
+ },
53578
+ "menuAttached"
53579
+ ),
53580
+ values.type === "INTERNAL" && /* @__PURE__ */ jsxRuntime.jsx(Grid.Item, { alignItems: "flex-start", col: 4, lg: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
53581
+ Field,
53582
+ {
53583
+ name: "autoSync",
53584
+ label: formatMessage(
53585
+ getTrad("popup.item.form.autoSync.label", "Read fields from related")
53586
+ ),
53587
+ error: renderError("autoSync"),
53588
+ children: /* @__PURE__ */ jsxRuntime.jsx(
53589
+ Toggle,
53449
53590
  {
53450
53591
  name: "autoSync",
53451
- label: formatMessage(
53452
- getTrad("popup.item.form.autoSync.label", "Read fields from related")
53453
- ),
53454
- error: renderError("autoSync"),
53455
- children: /* @__PURE__ */ jsxRuntime.jsx(
53456
- Toggle,
53457
- {
53458
- name: "autoSync",
53459
- checked: values.autoSync,
53460
- onChange: (eventOrPath) => handleChange(eventOrPath, !values.autoSync, onChange),
53461
- onLabel: "Enabled",
53462
- offLabel: "Disabled"
53463
- }
53464
- )
53592
+ checked: values.autoSync,
53593
+ onChange: (eventOrPath) => handleChange(eventOrPath, !values.autoSync, onChange),
53594
+ onLabel: "Enabled",
53595
+ offLabel: "Disabled"
53465
53596
  }
53466
- ) }, "autoSync"),
53467
- /* @__PURE__ */ jsxRuntime.jsx(Grid.Item, { alignItems: "flex-start", col: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
53468
- Field,
53597
+ )
53598
+ }
53599
+ ) }, "autoSync"),
53600
+ /* @__PURE__ */ jsxRuntime.jsx(Grid.Item, { alignItems: "flex-start", col: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
53601
+ Field,
53602
+ {
53603
+ name: pathSourceName,
53604
+ label: formatMessage(
53605
+ getTrad(`popup.item.form.${pathSourceName}.label`, "Path")
53606
+ ),
53607
+ error: renderError(pathSourceName),
53608
+ hint: [
53609
+ formatMessage(
53610
+ getTrad(`popup.item.form.${pathSourceName}.placeholder`, "e.g. Blog")
53611
+ ),
53612
+ pathDefault ? formatMessage(getTrad("popup.item.form.type.external.description"), {
53613
+ value: pathDefault
53614
+ }) : ""
53615
+ ].join(" "),
53616
+ children: /* @__PURE__ */ jsxRuntime.jsx(
53617
+ TextInput,
53469
53618
  {
53619
+ disabled: !canUpdate,
53470
53620
  name: pathSourceName,
53471
- label: formatMessage(getTrad(`popup.item.form.${pathSourceName}.label`, "Path")),
53472
- error: renderError(pathSourceName),
53473
- hint: [
53474
- formatMessage(
53475
- getTrad(`popup.item.form.${pathSourceName}.placeholder`, "e.g. Blog")
53476
- ),
53477
- pathDefault ? formatMessage(getTrad("popup.item.form.type.external.description"), {
53478
- value: pathDefault
53479
- }) : ""
53480
- ].join(" "),
53481
- children: /* @__PURE__ */ jsxRuntime.jsx(
53482
- TextInput,
53483
- {
53484
- disabled: !canUpdate,
53485
- name: pathSourceName,
53486
- onChange: (eventOrPath, value) => handleChange(eventOrPath, value, onChange),
53487
- value: values[pathSourceName],
53488
- width: "100%"
53489
- }
53490
- )
53621
+ onChange: (eventOrPath, value) => handleChange(eventOrPath, value, onChange),
53622
+ value: values[pathSourceName],
53623
+ width: "100%"
53491
53624
  }
53492
- ) }, pathSourceName),
53493
- values.type === "INTERNAL" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
53494
- /* @__PURE__ */ jsxRuntime.jsx(Grid.Item, { alignItems: "flex-start", col: 6, lg: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
53495
- Field,
53625
+ )
53626
+ }
53627
+ ) }, pathSourceName),
53628
+ values.type === "INTERNAL" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
53629
+ /* @__PURE__ */ jsxRuntime.jsx(Grid.Item, { alignItems: "flex-start", col: 6, lg: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
53630
+ Field,
53631
+ {
53632
+ name: "relatedType",
53633
+ label: formatMessage(
53634
+ getTrad("popup.item.form.relatedType.label", "Related Type")
53635
+ ),
53636
+ error: renderError("relatedType"),
53637
+ hint: !isLoading && lodash$1.isEmpty(relatedTypeSelectOptions) ? formatMessage(
53638
+ getTrad(
53639
+ "popup.item.form.relatedType.empty",
53640
+ "There are no more content types"
53641
+ )
53642
+ ) : void 0,
53643
+ children: /* @__PURE__ */ jsxRuntime.jsx(
53644
+ SingleSelect,
53496
53645
  {
53497
53646
  name: "relatedType",
53498
- label: formatMessage(getTrad("popup.item.form.relatedType.label", "Related Type")),
53499
- error: renderError("relatedType"),
53500
- hint: !isLoading && lodash$1.isEmpty(relatedTypeSelectOptions) ? formatMessage(
53501
- getTrad(
53502
- "popup.item.form.relatedType.empty",
53503
- "There are no more content types"
53504
- )
53505
- ) : void 0,
53506
- children: /* @__PURE__ */ jsxRuntime.jsx(
53507
- SingleSelect,
53508
- {
53509
- name: "relatedType",
53510
- onChange: (eventOrPath) => handleChange("relatedType", eventOrPath, onChange),
53511
- value: values.relatedType,
53512
- disabled: !configQuery.data?.contentTypes.length || !canUpdate,
53513
- width: "100%",
53514
- children: configQuery.data?.contentTypes.map((contentType2) => /* @__PURE__ */ jsxRuntime.jsx(SingleSelectOption, { value: contentType2.uid, children: contentType2.contentTypeName }, contentType2.uid))
53515
- }
53516
- )
53647
+ onChange: (eventOrPath) => handleChange("relatedType", eventOrPath, onChange),
53648
+ value: values.relatedType,
53649
+ disabled: !configQuery.data?.contentTypes.length || !canUpdate,
53650
+ width: "100%",
53651
+ children: configQuery.data?.contentTypes.map((contentType2) => /* @__PURE__ */ jsxRuntime.jsx(SingleSelectOption, { value: contentType2.uid, children: contentType2.contentTypeName }, contentType2.uid))
53517
53652
  }
53518
- ) }),
53519
- values.relatedType && !isSingleSelected && /* @__PURE__ */ jsxRuntime.jsx(Grid.Item, { alignItems: "flex-start", col: 6, lg: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
53520
- Field,
53653
+ )
53654
+ }
53655
+ ) }),
53656
+ values.relatedType && !isSingleSelected && /* @__PURE__ */ jsxRuntime.jsx(Grid.Item, { alignItems: "flex-start", col: 6, lg: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
53657
+ Field,
53658
+ {
53659
+ name: "related",
53660
+ label: formatMessage(
53661
+ getTrad("popup.item.form.related.label", "Related")
53662
+ ),
53663
+ error: renderError("related"),
53664
+ hint: !isLoading && thereAreNoMoreContentTypes ? formatMessage(
53665
+ getTrad(
53666
+ "popup.item.form.related.empty",
53667
+ "There are no more entities"
53668
+ ),
53669
+ { contentTypeName: values.relatedType }
53670
+ ) : void 0,
53671
+ children: /* @__PURE__ */ jsxRuntime.jsx(
53672
+ SingleSelect,
53521
53673
  {
53522
53674
  name: "related",
53523
- label: formatMessage(getTrad("popup.item.form.related.label", "Related")),
53524
- error: renderError("related"),
53525
- hint: !isLoading && thereAreNoMoreContentTypes ? formatMessage(
53526
- getTrad(
53527
- "popup.item.form.related.empty",
53528
- "There are no more entities"
53529
- ),
53530
- { contentTypeName: values.relatedType }
53675
+ onChange: (eventOrPath) => handleChange("related", eventOrPath, onChange),
53676
+ value: values.related,
53677
+ options: relatedSelectOptions,
53678
+ disabled: isLoading || thereAreNoMoreContentTypes || !canUpdate,
53679
+ width: "100%",
53680
+ children: relatedSelectOptions.map(({ key, label, value }) => /* @__PURE__ */ jsxRuntime.jsx(SingleSelectOption, { value, children: label }, key))
53681
+ }
53682
+ )
53683
+ }
53684
+ ) })
53685
+ ] }),
53686
+ !lodash$1.isEmpty(configQuery.data?.additionalFields) && /* @__PURE__ */ jsxRuntime.jsx(Grid.Item, { col: 12, lg: 12, children: /* @__PURE__ */ jsxRuntime.jsx(Divider, { width: "100%" }) }),
53687
+ configQuery.data?.additionalFields.map(
53688
+ (additionalField, index2) => {
53689
+ if (additionalField === "audience") {
53690
+ return /* @__PURE__ */ jsxRuntime.jsx(Grid.Item, { alignItems: "flex-start", col: 6, lg: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
53691
+ Field,
53692
+ {
53693
+ name: "audience",
53694
+ label: formatMessage(getTrad("popup.item.form.audience.label")),
53695
+ error: renderError("audience"),
53696
+ hint: !isLoading && lodash$1.isEmpty(audienceOptions) ? formatMessage(
53697
+ getTrad("popup.item.form.title.placeholder", "e.g. Blog")
53531
53698
  ) : void 0,
53532
53699
  children: /* @__PURE__ */ jsxRuntime.jsx(
53533
- SingleSelect,
53700
+ MultiSelect,
53534
53701
  {
53535
- name: "related",
53536
- onChange: (eventOrPath) => handleChange("related", eventOrPath, onChange),
53537
- value: values.related,
53538
- options: relatedSelectOptions,
53539
- disabled: isLoading || thereAreNoMoreContentTypes || !canUpdate,
53702
+ name: "audience",
53703
+ value: values.audience,
53704
+ onChange: (eventOrPath) => handleChange("audience", eventOrPath, onChange),
53540
53705
  width: "100%",
53541
- children: relatedSelectOptions.map(({ key, label, value }) => /* @__PURE__ */ jsxRuntime.jsx(SingleSelectOption, { value, children: label }, key))
53706
+ children: audienceOptions.map(({ value, label }) => /* @__PURE__ */ jsxRuntime.jsx(MultiSelectOption, { value, children: label }, value))
53542
53707
  }
53543
53708
  )
53544
53709
  }
53545
- ) })
53546
- ] }),
53547
- !lodash$1.isEmpty(configQuery.data?.additionalFields) && /* @__PURE__ */ jsxRuntime.jsx(Grid.Item, { col: 12, lg: 12, children: /* @__PURE__ */ jsxRuntime.jsx(Divider, { width: "100%" }) }),
53548
- configQuery.data?.additionalFields.map(
53549
- (additionalField, index2) => {
53550
- if (additionalField === "audience") {
53551
- return /* @__PURE__ */ jsxRuntime.jsx(Grid.Item, { alignItems: "flex-start", col: 6, lg: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
53552
- Field,
53553
- {
53554
- name: "audience",
53555
- label: formatMessage(getTrad("popup.item.form.audience.label")),
53556
- error: renderError("audience"),
53557
- hint: !isLoading && lodash$1.isEmpty(audienceOptions) ? formatMessage(
53558
- getTrad("popup.item.form.title.placeholder", "e.g. Blog")
53559
- ) : void 0,
53560
- children: /* @__PURE__ */ jsxRuntime.jsx(
53561
- MultiSelect,
53562
- {
53563
- name: "audience",
53564
- value: values.audience,
53565
- onChange: (eventOrPath) => handleChange("audience", eventOrPath, onChange),
53566
- width: "100%",
53567
- children: audienceOptions.map(({ value, label }) => /* @__PURE__ */ jsxRuntime.jsx(MultiSelectOption, { value, children: label }, value))
53568
- }
53569
- )
53570
- }
53571
- ) }, "audience");
53572
- } else {
53573
- return /* @__PURE__ */ jsxRuntime.jsx(Grid.Item, { alignItems: "flex-start", col: 6, lg: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
53710
+ ) }, "audience");
53711
+ } else {
53712
+ return /* @__PURE__ */ jsxRuntime.jsx(
53713
+ Grid.Item,
53714
+ {
53715
+ alignItems: "flex-start",
53716
+ col: 6,
53717
+ lg: 12,
53718
+ children: /* @__PURE__ */ jsxRuntime.jsx(
53574
53719
  Field,
53575
53720
  {
53576
53721
  name: `additionalFields.${additionalField.name}`,
@@ -53589,49 +53734,52 @@ const NavigationItemForm = ({
53589
53734
  }
53590
53735
  )
53591
53736
  }
53592
- ) }, additionalField.name);
53593
- }
53594
- }
53595
- )
53596
- ] }),
53597
- availableLocaleOptions && availableLocaleOptions.length > 1 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
53598
- /* @__PURE__ */ jsxRuntime.jsx(Divider, { marginTop: 5, marginBottom: 5 }),
53599
- /* @__PURE__ */ jsxRuntime.jsxs(Grid.Root, { gap: 5, children: [
53600
- /* @__PURE__ */ jsxRuntime.jsx(Grid.Item, { alignItems: "flex-start", col: 6, lg: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
53601
- Field,
53602
- {
53603
- name: "i18n.locale",
53604
- label: formatMessage(getTrad("popup.item.form.i18n.locale.label", "Copy details from")),
53605
- children: /* @__PURE__ */ jsxRuntime.jsx(
53606
- SingleSelect,
53607
- {
53608
- name: "i18n.locale",
53609
- onChange: setItemLocaleCopyValue,
53610
- value: itemLocaleCopyValue,
53611
- disabled: isLoading || !canUpdate,
53612
- placeholder: formatMessage(
53613
- getTrad("popup.item.form.i18n.locale.placeholder", "locale")
53614
- ),
53615
- children: availableLocaleOptions.map(({ key, label, value }) => /* @__PURE__ */ jsxRuntime.jsx(SingleSelectOption, { value, children: label }, key))
53616
- }
53617
53737
  )
53618
- }
53619
- ) }),
53620
- canUpdate && /* @__PURE__ */ jsxRuntime.jsx(Grid.Item, { alignItems: "flex-start", col: 6, lg: 12, paddingTop: 6, children: /* @__PURE__ */ jsxRuntime.jsx(Box, { children: /* @__PURE__ */ jsxRuntime.jsx(
53621
- Button,
53738
+ },
53739
+ additionalField.name
53740
+ );
53741
+ }
53742
+ }
53743
+ )
53744
+ ] }),
53745
+ availableLocaleOptions && availableLocaleOptions.length > 1 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
53746
+ /* @__PURE__ */ jsxRuntime.jsx(Divider, { marginTop: 5, marginBottom: 5 }),
53747
+ /* @__PURE__ */ jsxRuntime.jsxs(Grid.Root, { gap: 5, children: [
53748
+ /* @__PURE__ */ jsxRuntime.jsx(Grid.Item, { alignItems: "flex-start", col: 6, lg: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
53749
+ Field,
53750
+ {
53751
+ name: "i18n.locale",
53752
+ label: formatMessage(
53753
+ getTrad("popup.item.form.i18n.locale.label", "Copy details from")
53754
+ ),
53755
+ children: /* @__PURE__ */ jsxRuntime.jsx(
53756
+ SingleSelect,
53622
53757
  {
53623
- variant: "tertiary",
53624
- onClick: onCopyFromLocale,
53625
- disabled: isLoading || !itemLocaleCopyValue,
53626
- children: formatMessage(getTrad("popup.item.form.i18n.locale.button"))
53758
+ name: "i18n.locale",
53759
+ onChange: setItemLocaleCopyValue,
53760
+ value: itemLocaleCopyValue,
53761
+ disabled: isLoading || !canUpdate,
53762
+ placeholder: formatMessage(
53763
+ getTrad("popup.item.form.i18n.locale.placeholder", "locale")
53764
+ ),
53765
+ children: availableLocaleOptions.map(({ key, label, value }) => /* @__PURE__ */ jsxRuntime.jsx(SingleSelectOption, { value, children: label }, key))
53627
53766
  }
53628
- ) }) })
53629
- ] })
53630
- ] })
53631
- ] });
53632
- }
53633
- }
53634
- ) }),
53767
+ )
53768
+ }
53769
+ ) }),
53770
+ canUpdate && /* @__PURE__ */ jsxRuntime.jsx(Grid.Item, { alignItems: "flex-start", col: 6, lg: 12, paddingTop: 6, children: /* @__PURE__ */ jsxRuntime.jsx(Box, { children: /* @__PURE__ */ jsxRuntime.jsx(
53771
+ Button,
53772
+ {
53773
+ variant: "tertiary",
53774
+ onClick: onCopyFromLocale,
53775
+ disabled: isLoading || !itemLocaleCopyValue,
53776
+ children: formatMessage(getTrad("popup.item.form.i18n.locale.button"))
53777
+ }
53778
+ ) }) })
53779
+ ] })
53780
+ ] })
53781
+ ] });
53782
+ } }) }),
53635
53783
  /* @__PURE__ */ jsxRuntime.jsx(
53636
53784
  NavigationItemPopupFooter,
53637
53785
  {
@@ -53811,6 +53959,7 @@ const queryClient$1 = new reactQuery.QueryClient();
53811
53959
  const Inner$1 = () => {
53812
53960
  const { formatMessage } = reactIntl.useIntl();
53813
53961
  const localeQuery = useLocale();
53962
+ const [recentNavigation, setRecentNavigation] = React.useState();
53814
53963
  const [currentNavigation, setCurrentNavigation] = React.useState();
53815
53964
  const [activeNavigationItem, setActiveNavigationItemState] = React.useState();
53816
53965
  const [isItemPopupVisible, setIsItemPopupVisible] = React.useState(false);
@@ -53898,14 +54047,14 @@ const Inner$1 = () => {
53898
54047
  React.useCallback(
53899
54048
  (sourceLocale) => {
53900
54049
  const source = navigationsQuery.data?.find(
53901
- ({ localeCode, documentId }) => localeCode === sourceLocale && documentId === currentNavigation?.documentId
54050
+ ({ locale, documentId }) => locale === sourceLocale && documentId === currentNavigation?.documentId
53902
54051
  );
53903
54052
  if (source) {
53904
54053
  if (source.documentId && currentNavigation?.documentId) {
53905
54054
  copyNavigationI18nMutation.mutate(
53906
54055
  {
53907
- source: source.localeCode,
53908
- target: currentNavigation.localeCode,
54056
+ source: source.locale,
54057
+ target: currentNavigation.locale,
53909
54058
  documentId: source.documentId
53910
54059
  },
53911
54060
  {
@@ -53925,6 +54074,10 @@ const Inner$1 = () => {
53925
54074
  i18nCopySourceLocale && setI18nCopyModalOpened(true);
53926
54075
  }, [setI18nCopyModalOpened, i18nCopySourceLocale]);
53927
54076
  const updateNavigationMutation = useUpdateNavigation(() => {
54077
+ setRecentNavigation({
54078
+ documentId: currentNavigation?.documentId,
54079
+ id: currentNavigation?.id
54080
+ });
53928
54081
  setCurrentNavigation(void 0);
53929
54082
  });
53930
54083
  const submit = () => {
@@ -54054,7 +54207,14 @@ const Inner$1 = () => {
54054
54207
  }
54055
54208
  React.useEffect(() => {
54056
54209
  if (!currentNavigation && navigationsQuery.data?.[0]) {
54057
- setCurrentNavigation(navigationsQuery.data[0]);
54210
+ let navigation2;
54211
+ if (recentNavigation?.documentId) {
54212
+ navigation2 = navigationsQuery.data.find(
54213
+ (nav2) => nav2.documentId === recentNavigation.documentId && nav2.id === recentNavigation.id
54214
+ );
54215
+ }
54216
+ setRecentNavigation(void 0);
54217
+ setCurrentNavigation(navigation2 ? navigation2 : lodash$1.first(navigationsQuery.data));
54058
54218
  }
54059
54219
  }, [navigationsQuery.data]);
54060
54220
  React.useEffect(() => {
@@ -54063,11 +54223,12 @@ const Inner$1 = () => {
54063
54223
  }
54064
54224
  }, [navigationsQuery.data]);
54065
54225
  React.useEffect(() => {
54066
- if (currentNavigation && currentLocale !== currentNavigation.localeCode) {
54226
+ if (currentNavigation && currentLocale !== currentNavigation.locale) {
54227
+ setRecentNavigation(void 0);
54067
54228
  const nextNavigation = navigationsQuery.data?.find(
54068
- (navigation2) => navigation2.documentId === currentNavigation.documentId && navigation2.localeCode === currentLocale
54229
+ (navigation2) => navigation2.documentId === currentNavigation.documentId && navigation2.locale === currentLocale
54069
54230
  );
54070
- if (nextNavigation && nextNavigation.documentId === currentNavigation.documentId && nextNavigation.localeCode !== currentNavigation.localeCode) {
54231
+ if (nextNavigation && nextNavigation.documentId === currentNavigation.documentId && nextNavigation.locale !== currentNavigation.locale) {
54071
54232
  setCurrentNavigation(nextNavigation);
54072
54233
  }
54073
54234
  }
@@ -54632,8 +54793,17 @@ const useConfig = () => {
54632
54793
  const useRestart = () => {
54633
54794
  const fetch = admin.getFetchClient();
54634
54795
  const apiClient = getApiClient(fetch);
54796
+ const healthCheck = reactQuery.useQuery({
54797
+ queryKey: apiClient.healthCheckIndex(),
54798
+ queryFn: () => apiClient.healthCheck(),
54799
+ retry: true,
54800
+ retryDelay: 1e3 * 5,
54801
+ enabled: false
54802
+ });
54635
54803
  return reactQuery.useMutation({
54636
- mutationFn: () => apiClient.restart()
54804
+ mutationFn: () => {
54805
+ return apiClient.restart().then(() => healthCheck.refetch());
54806
+ }
54637
54807
  });
54638
54808
  };
54639
54809
  const useRestoreConfig = () => {
@@ -54845,12 +55015,13 @@ const Inner = () => {
54845
55015
  restartMutation.mutate(void 0, {
54846
55016
  onSuccess() {
54847
55017
  setRestartStatus({ required: false });
55018
+ window.location.reload();
54848
55019
  },
54849
55020
  onError() {
54850
55021
  setRestartStatus({ required: false });
55022
+ window.location.reload();
54851
55023
  }
54852
55024
  });
54853
- window.location.reload();
54854
55025
  };
54855
55026
  const handleRestartDiscard = () => setRestartStatus({ required: false });
54856
55027
  React.useEffect(() => {
@@ -54951,8 +55122,8 @@ const Inner = () => {
54951
55122
  name: "preferCustomContentTypes",
54952
55123
  checked: values.preferCustomContentTypes,
54953
55124
  onChange: (eventOrPath) => handleChange(eventOrPath, !values.preferCustomContentTypes, onChange),
54954
- onLabel: formatMessage(getTrad("component.toggle.enabled")),
54955
- offLabel: formatMessage(getTrad("component.toggle.disabled")),
55125
+ onLabel: formatMessage(getTrad("components.toggle.enabled")),
55126
+ offLabel: formatMessage(getTrad("components.toggle.disabled")),
54956
55127
  disabled: restartStatus.required,
54957
55128
  width: "100%"
54958
55129
  }
@@ -55213,10 +55384,17 @@ const Inner = () => {
55213
55384
  {
55214
55385
  width: "100%",
55215
55386
  name: "allowedLevels",
55387
+ type: "number",
55216
55388
  placeholder: formatMessage(
55217
55389
  getTrad("pages.settings.form.allowedLevels.placeholder")
55218
55390
  ),
55219
- onChange: (eventOrPath, value) => handleChange(eventOrPath, value, onChange),
55391
+ onChange: (eventOrPath, value) => {
55392
+ if (lodash$1.isObject(eventOrPath)) {
55393
+ const parsedVal = parseInt(eventOrPath.target.value);
55394
+ return handleChange(eventOrPath.target.name, lodash$1.isNaN(parsedVal) ? 0 : parsedVal, onChange);
55395
+ }
55396
+ return handleChange(eventOrPath, value, onChange);
55397
+ },
55220
55398
  value: values.allowedLevels,
55221
55399
  disabled: restartStatus.required
55222
55400
  }
@@ -55238,8 +55416,8 @@ const Inner = () => {
55238
55416
  name: "cascadeMenuAttached",
55239
55417
  checked: values.cascadeMenuAttached,
55240
55418
  onChange: (eventOrPath) => handleChange(eventOrPath, !values.cascadeMenuAttached, onChange),
55241
- onLabel: formatMessage(getTrad("component.toggle.enabled")),
55242
- offLabel: formatMessage(getTrad("component.toggle.disabled")),
55419
+ onLabel: formatMessage(getTrad("components.toggle.enabled")),
55420
+ offLabel: formatMessage(getTrad("components.toggle.disabled")),
55243
55421
  disabled: restartStatus.required
55244
55422
  }
55245
55423
  )
@@ -55257,8 +55435,8 @@ const Inner = () => {
55257
55435
  name: "audienceFieldChecked",
55258
55436
  checked: values.audienceFieldChecked,
55259
55437
  onChange: (eventOrPath) => handleChange(eventOrPath, !values.audienceFieldChecked, 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
  }
@@ -55277,8 +55455,8 @@ const Inner = () => {
55277
55455
  name: "isCacheEnabled",
55278
55456
  checked: values.isCacheEnabled,
55279
55457
  onChange: (eventOrPath) => handleChange(eventOrPath, !values.isCacheEnabled, onChange),
55280
- onLabel: formatMessage(getTrad("component.toggle.enabled")),
55281
- offLabel: formatMessage(getTrad("component.toggle.disabled")),
55458
+ onLabel: formatMessage(getTrad("components.toggle.enabled")),
55459
+ offLabel: formatMessage(getTrad("components.toggle.disabled")),
55282
55460
  disabled: restartStatus.required,
55283
55461
  width: "100%"
55284
55462
  }