@mattisvensson/strapi-plugin-webatlas 0.10.1 → 0.11.1

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 (50) hide show
  1. package/README.md +16 -9
  2. package/dist/admin/{FullLoader-CrPED_dY.mjs → FullLoader-Btjb2W2p.mjs} +5 -1
  3. package/dist/admin/FullLoader-Btjb2W2p.mjs.map +1 -0
  4. package/dist/admin/{FullLoader-Cmsf8xS6.js → FullLoader-Da2n70bJ.js} +5 -1
  5. package/dist/admin/FullLoader-Da2n70bJ.js.map +1 -0
  6. package/dist/admin/{SettingTitle-uw1S5OmC.js → SettingTitle-B0quw3f8.js} +6 -2
  7. package/dist/admin/SettingTitle-B0quw3f8.js.map +1 -0
  8. package/dist/admin/{SettingTitle-DbsxB1V9.mjs → SettingTitle-HMfQOJnK.mjs} +6 -2
  9. package/dist/admin/SettingTitle-HMfQOJnK.mjs.map +1 -0
  10. package/dist/admin/de-B5pRvs13.mjs +1 -0
  11. package/dist/admin/de-B5pRvs13.mjs.map +1 -0
  12. package/dist/admin/de-CqU1FU8C.js +1 -0
  13. package/dist/admin/de-CqU1FU8C.js.map +1 -0
  14. package/dist/admin/en-BE-zzIv8.mjs +1 -0
  15. package/dist/admin/en-BE-zzIv8.mjs.map +1 -0
  16. package/dist/admin/en-C7I90FwV.js +1 -0
  17. package/dist/admin/en-C7I90FwV.js.map +1 -0
  18. package/dist/admin/{index-BKWY9Ta-.mjs → index-9_HhKDUC.mjs} +32 -58
  19. package/dist/admin/index-9_HhKDUC.mjs.map +1 -0
  20. package/dist/admin/{index-CIr8o1RP.mjs → index-B79ELMEC.mjs} +300 -282
  21. package/dist/admin/index-B79ELMEC.mjs.map +1 -0
  22. package/dist/admin/{index-DkqiqVx2.js → index-BEVoxEAm.js} +32 -58
  23. package/dist/admin/index-BEVoxEAm.js.map +1 -0
  24. package/dist/admin/index-Bmg-ERct.mjs +244 -0
  25. package/dist/admin/index-Bmg-ERct.mjs.map +1 -0
  26. package/dist/admin/{index-BXt-QjKo.js → index-C8YjuuOx.js} +497 -353
  27. package/dist/admin/index-C8YjuuOx.js.map +1 -0
  28. package/dist/admin/{index-DC5WwNdi.js → index-Cx_mktdk.js} +300 -282
  29. package/dist/admin/index-Cx_mktdk.js.map +1 -0
  30. package/dist/admin/{index-CUaBX_v-.mjs → index-Cz_k_jjp.mjs} +42 -30
  31. package/dist/admin/index-Cz_k_jjp.mjs.map +1 -0
  32. package/dist/admin/{index-BYlmJycd.js → index-D2hB1vTw.js} +42 -30
  33. package/dist/admin/index-D2hB1vTw.js.map +1 -0
  34. package/dist/admin/index-YdWxpvOH.js +244 -0
  35. package/dist/admin/index-YdWxpvOH.js.map +1 -0
  36. package/dist/admin/{index-tPrfjOIn.mjs → index-oEJT_mvw.mjs} +497 -353
  37. package/dist/admin/index-oEJT_mvw.mjs.map +1 -0
  38. package/dist/admin/index.js +2 -1
  39. package/dist/admin/index.js.map +1 -0
  40. package/dist/admin/index.mjs +2 -1
  41. package/dist/admin/index.mjs.map +1 -0
  42. package/dist/server/index.js +578 -394
  43. package/dist/server/index.js.map +1 -0
  44. package/dist/server/index.mjs +578 -394
  45. package/dist/server/index.mjs.map +1 -0
  46. package/package.json +108 -108
  47. package/dist/admin/index-B07KlG03.mjs +0 -218
  48. package/dist/admin/index-CGsC8P9P.js +0 -218
  49. package/dist/admin/src/index.d.ts +0 -12
  50. package/dist/server/src/index.d.ts +0 -301
@@ -7,9 +7,9 @@ const designSystem = require("@strapi/design-system");
7
7
  const React = require("react");
8
8
  const ReactDOM = require("react-dom");
9
9
  const reactIntl = require("react-intl");
10
- const index = require("./index-DC5WwNdi.js");
10
+ const index = require("./index-Cx_mktdk.js");
11
11
  const admin = require("@strapi/strapi/admin");
12
- const FullLoader = require("./FullLoader-Cmsf8xS6.js");
12
+ const FullLoader = require("./FullLoader-Da2n70bJ.js");
13
13
  const symbols = require("@strapi/icons/symbols");
14
14
  const core = require("@dnd-kit/core");
15
15
  const sortable = require("@dnd-kit/sortable");
@@ -140,10 +140,16 @@ function EmptyBox({ msg }) {
140
140
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 4, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", textColor: "neutral600", children: msg }) })
141
141
  ] });
142
142
  }
143
- const ModalContext = React.createContext({ modalType: "", setModalType: () => {
144
- } });
145
- const SelectedNavigationContext = React.createContext({ selectedNavigation: void 0, setSelectedNavigation: () => {
146
- } });
143
+ const ModalContext = React.createContext({
144
+ modalType: "",
145
+ setModalType: () => {
146
+ }
147
+ });
148
+ const SelectedNavigationContext = React.createContext({
149
+ selectedNavigation: void 0,
150
+ setSelectedNavigation: () => {
151
+ }
152
+ });
147
153
  function Delete({ variant, item, onDelete }) {
148
154
  const itemName = React.useRef(variant === "NavDelete" ? item.name : item.route.title);
149
155
  const closeModalState = React.useRef(variant === "NavDelete" ? "NavOverview" : "");
@@ -202,7 +208,15 @@ function Delete({ variant, item, onDelete }) {
202
208
  defaultMessage: "navigation"
203
209
  })
204
210
  ] }),
205
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textAlign: "center", fontWeight: "bold", style: { marginTop: 8, marginBottom: 8, fontSize: 20 }, children: itemName.current }),
211
+ /* @__PURE__ */ jsxRuntime.jsx(
212
+ designSystem.Typography,
213
+ {
214
+ textAlign: "center",
215
+ fontWeight: "bold",
216
+ style: { marginTop: 8, marginBottom: 8, fontSize: 20 },
217
+ children: itemName.current
218
+ }
219
+ ),
206
220
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textAlign: "center", children: formatMessage({
207
221
  id: index.getTranslation("modal.delete.message.end"),
208
222
  defaultMessage: "This can not be undone. Are you sure?"
@@ -327,10 +341,22 @@ function NavCreate() {
327
341
  return /* @__PURE__ */ jsxRuntime.jsx(
328
342
  NavModal,
329
343
  {
330
- confirmText: formatMessage({ id: index.getTranslation("modal.navCreate.confirmText"), defaultMessage: "Create" }),
331
- closeText: formatMessage({ id: index.getTranslation("modal.navCreate.closeText"), defaultMessage: "Cancel" }),
332
- titleText: formatMessage({ id: index.getTranslation("modal.navCreate.titleText"), defaultMessage: "Create new navigation" }),
333
- loadingText: formatMessage({ id: index.getTranslation("modal.navCreate.loadingText"), defaultMessage: "Creating" }),
344
+ confirmText: formatMessage({
345
+ id: index.getTranslation("modal.navCreate.confirmText"),
346
+ defaultMessage: "Create"
347
+ }),
348
+ closeText: formatMessage({
349
+ id: index.getTranslation("modal.navCreate.closeText"),
350
+ defaultMessage: "Cancel"
351
+ }),
352
+ titleText: formatMessage({
353
+ id: index.getTranslation("modal.navCreate.titleText"),
354
+ defaultMessage: "Create new navigation"
355
+ }),
356
+ loadingText: formatMessage({
357
+ id: index.getTranslation("modal.navCreate.loadingText"),
358
+ defaultMessage: "Creating"
359
+ }),
334
360
  onConfirm,
335
361
  loading,
336
362
  disabled: name.trim() === "",
@@ -382,10 +408,22 @@ function NavEdit({ item, onEdit }) {
382
408
  return /* @__PURE__ */ jsxRuntime.jsx(
383
409
  NavModal,
384
410
  {
385
- confirmText: formatMessage({ id: index.getTranslation("modal.navEdit.confirmText"), defaultMessage: "Create" }),
386
- closeText: formatMessage({ id: index.getTranslation("modal.navEdit.closeText"), defaultMessage: "Cancel" }),
387
- titleText: formatMessage({ id: index.getTranslation("modal.navEdit.titleText"), defaultMessage: "Edit navigation:" }) + " " + item.name,
388
- loadingText: formatMessage({ id: index.getTranslation("modal.navEdit.loadingText"), defaultMessage: "Updating" }),
411
+ confirmText: formatMessage({
412
+ id: index.getTranslation("modal.navEdit.confirmText"),
413
+ defaultMessage: "Create"
414
+ }),
415
+ closeText: formatMessage({
416
+ id: index.getTranslation("modal.navEdit.closeText"),
417
+ defaultMessage: "Cancel"
418
+ }),
419
+ titleText: formatMessage({
420
+ id: index.getTranslation("modal.navEdit.titleText"),
421
+ defaultMessage: "Edit navigation:"
422
+ }) + " " + item.name,
423
+ loadingText: formatMessage({
424
+ id: index.getTranslation("modal.navEdit.loadingText"),
425
+ defaultMessage: "Updating"
426
+ }),
389
427
  onConfirm: updateNav,
390
428
  loading,
391
429
  disabled: name.trim() === "" || name === initialNavState.name && visible === initialNavState.visible,
@@ -470,10 +508,18 @@ function NavOverview({ navigations, setActionItem }) {
470
508
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", children: [
471
509
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", children: nav.name }),
472
510
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
473
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, {}), variant: "danger-light", onClick: () => handleDelete(nav), children: formatMessage({
474
- id: index.getTranslation("delete"),
475
- defaultMessage: "Delete"
476
- }) }),
511
+ /* @__PURE__ */ jsxRuntime.jsx(
512
+ designSystem.Button,
513
+ {
514
+ startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, {}),
515
+ variant: "danger-light",
516
+ onClick: () => handleDelete(nav),
517
+ children: formatMessage({
518
+ id: index.getTranslation("delete"),
519
+ defaultMessage: "Delete"
520
+ })
521
+ }
522
+ ),
477
523
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Pencil, {}), variant: "secondary", onClick: () => handleEdit(nav), children: formatMessage({
478
524
  id: index.getTranslation("edit"),
479
525
  defaultMessage: "Edit"
@@ -493,14 +539,7 @@ function NavOverview({ navigations, setActionItem }) {
493
539
  )
494
540
  ] })
495
541
  ] }, `box-${nav.slug}`),
496
- navigations.length - 1 !== index$1 && /* @__PURE__ */ jsxRuntime.jsx(
497
- designSystem.Box,
498
- {
499
- paddingTop: 2,
500
- paddingBottom: 2,
501
- children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Divider, {})
502
- }
503
- )
542
+ navigations.length - 1 !== index$1 && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 2, paddingBottom: 2, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Divider, {}) })
504
543
  ] }, nav.id)) : /* @__PURE__ */ jsxRuntime.jsx(FullLoader.Center, { height: 100, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", children: formatMessage({
505
544
  id: index.getTranslation("navigation.page.emptyNavigation"),
506
545
  defaultMessage: "You have no navigations yet..."
@@ -598,7 +637,12 @@ function useModalSharedLogic() {
598
637
  setValidationState("checking");
599
638
  dispatchPath({ type: "SET_REPLACEMENT", payload: "" });
600
639
  try {
601
- const data = await index.duplicateCheck({ fetchFunction: get, path: url, routeDocumentId, withoutTransform });
640
+ const data = await index.duplicateCheck({
641
+ fetchFunction: get,
642
+ path: url,
643
+ routeDocumentId,
644
+ withoutTransform
645
+ });
602
646
  if (!data || data === url) return;
603
647
  dispatchPath({ type: "NO_URL_CHECK", payload: data });
604
648
  dispatchPath({ type: "SET_REPLACEMENT", payload: data });
@@ -662,7 +706,8 @@ function ExternalItemComponent(props) {
662
706
  }, [variant, item, dispatchNavItemState, dispatchPath]);
663
707
  const handleConfirm = async () => {
664
708
  try {
665
- if (!path || path.value?.trim() === "" || !navItemState.title || navItemState.title?.trim() === "" || !selectedNavigation) return;
709
+ if (!path || path.value?.trim() === "" || !navItemState.title || navItemState.title?.trim() === "" || !selectedNavigation)
710
+ return;
666
711
  if (variant === "ExternalEdit" && item && onSave) {
667
712
  onSave({
668
713
  ...item,
@@ -694,10 +739,28 @@ function ExternalItemComponent(props) {
694
739
  return /* @__PURE__ */ jsxRuntime.jsx(
695
740
  NavModal,
696
741
  {
697
- confirmText: variant === "ExternalCreate" ? formatMessage({ id: index.getTranslation("add"), defaultMessage: "Add" }) : formatMessage({ id: index.getTranslation("save"), defaultMessage: "Save" }),
698
- closeText: formatMessage({ id: index.getTranslation("cancel"), defaultMessage: "Cancel" }),
699
- titleText: variant === "ExternalCreate" ? formatMessage({ id: index.getTranslation("modal.externalItem.titleText.create"), defaultMessage: "Create new external item" }) : formatMessage({ id: index.getTranslation("modal.externalItem.titleText.edit"), defaultMessage: `Edit external path "${navItemState.title}"` }),
700
- loadingText: variant === "ExternalCreate" ? formatMessage({ id: index.getTranslation("modal.externalItem.loadingText.create"), defaultMessage: "Adding" }) : formatMessage({ id: index.getTranslation("modal.externalItem.loadingText.edit"), defaultMessage: "Saving" }),
742
+ confirmText: variant === "ExternalCreate" ? formatMessage({ id: index.getTranslation("add"), defaultMessage: "Add" }) : formatMessage({
743
+ id: index.getTranslation("save"),
744
+ defaultMessage: "Save"
745
+ }),
746
+ closeText: formatMessage({
747
+ id: index.getTranslation("cancel"),
748
+ defaultMessage: "Cancel"
749
+ }),
750
+ titleText: variant === "ExternalCreate" ? formatMessage({
751
+ id: index.getTranslation("modal.externalItem.titleText.create"),
752
+ defaultMessage: "Create new external item"
753
+ }) : formatMessage({
754
+ id: index.getTranslation("modal.externalItem.titleText.edit"),
755
+ defaultMessage: `Edit external path "${navItemState.title}"`
756
+ }),
757
+ loadingText: variant === "ExternalCreate" ? formatMessage({
758
+ id: index.getTranslation("modal.externalItem.loadingText.create"),
759
+ defaultMessage: "Adding"
760
+ }) : formatMessage({
761
+ id: index.getTranslation("modal.externalItem.loadingText.edit"),
762
+ defaultMessage: "Saving"
763
+ }),
701
764
  onConfirm: handleConfirm,
702
765
  modalToOpen: "",
703
766
  currentModalType: "ExternalCreate",
@@ -718,7 +781,10 @@ function ExternalItemComponent(props) {
718
781
  }),
719
782
  name: "title",
720
783
  value: navItemState.title || "",
721
- onChange: (e) => dispatchNavItemState({ type: "SET_TITLE", payload: e.target.value }),
784
+ onChange: (e) => dispatchNavItemState({
785
+ type: "SET_TITLE",
786
+ payload: e.target.value
787
+ }),
722
788
  required: true
723
789
  }
724
790
  )
@@ -738,7 +804,10 @@ function ExternalItemComponent(props) {
738
804
  }),
739
805
  name: "slug",
740
806
  value: path?.value || "",
741
- onChange: (e) => dispatchPath({ type: "NO_TRANSFORM_AND_CHECK", payload: e.target.value })
807
+ onChange: (e) => dispatchPath({
808
+ type: "NO_TRANSFORM_AND_CHECK",
809
+ payload: e.target.value
810
+ })
742
811
  }
743
812
  )
744
813
  ] }) }) })
@@ -775,16 +844,28 @@ function ItemDetails({
775
844
  if (!navigationItems) return null;
776
845
  const targetItem = item || parentNavItem;
777
846
  if (!targetItem || typeof targetItem.depth !== "number") return null;
778
- return buildBreadcrumbString({ navigationItems, targetItem, includeTarget: modalVariant === "create" });
847
+ return buildBreadcrumbString({
848
+ navigationItems,
849
+ targetItem,
850
+ includeTarget: modalVariant === "create"
851
+ });
779
852
  }, [parentNavItem, navigationItems, item, modalVariant]);
780
853
  const navigationWhereRouteExists = React.useMemo(() => {
781
854
  if (!navigations || !route) return false;
782
- return navigations.find((nav) => nav.items.some((r) => r.route.documentId === route.documentId || r.route.relatedContentType === route.relatedContentType && r.route.relatedDocumentId === route.relatedDocumentId));
855
+ return navigations.find(
856
+ (nav) => nav.items.some(
857
+ (r) => r.route.documentId === route.documentId || r.route.relatedContentType === route.relatedContentType && r.route.relatedDocumentId === route.relatedDocumentId
858
+ )
859
+ );
783
860
  }, [navigations, route, navigationItems]);
784
861
  React.useEffect(() => {
785
862
  if (path.needsUrlCheck && path.value) {
786
863
  if (path.uidPath === path.value || path.initialPath === path.value) return;
787
- debouncedCheckUrl({ url: path.value, routeDocumentId: route.documentId, withoutTransform: true });
864
+ debouncedCheckUrl({
865
+ url: path.value,
866
+ routeDocumentId: route.documentId,
867
+ withoutTransform: true
868
+ });
788
869
  dispatchPath({ type: "RESET_URL_CHECK_FLAG" });
789
870
  }
790
871
  }, [path.needsUrlCheck, route.documentId]);
@@ -807,12 +888,15 @@ function ItemDetails({
807
888
  navigationWhereRouteExists && /* @__PURE__ */ jsxRuntime.jsx(
808
889
  Warning,
809
890
  {
810
- main: formatMessage({
811
- id: index.getTranslation("modal.item.routeAlreadyUsed"),
812
- defaultMessage: 'Warning: This route is already used in the navigation "{navigationName}"'
813
- }, {
814
- navigationName: navigationWhereRouteExists.name
815
- }),
891
+ main: formatMessage(
892
+ {
893
+ id: index.getTranslation("modal.item.routeAlreadyUsed"),
894
+ defaultMessage: 'Warning: This route is already used in the navigation "{navigationName}"'
895
+ },
896
+ {
897
+ navigationName: navigationWhereRouteExists.name
898
+ }
899
+ ),
816
900
  info: formatMessage({
817
901
  id: index.getTranslation("modal.item.routeAlreadyUsed.info"),
818
902
  defaultMessage: "Changing the path for this item will also update the path in the existing item."
@@ -829,7 +913,10 @@ function ItemDetails({
829
913
  {
830
914
  name: "title",
831
915
  value: navItemState?.title || "",
832
- onChange: (e) => dispatchNavItemState({ type: "SET_TITLE", payload: e.target.value }),
916
+ onChange: (e) => dispatchNavItemState({
917
+ type: "SET_TITLE",
918
+ payload: e.target.value
919
+ }),
833
920
  required: true
834
921
  }
835
922
  )
@@ -840,19 +927,17 @@ function ItemDetails({
840
927
  id: index.getTranslation("modal.item.canonicalPathField.label"),
841
928
  defaultMessage: "Canonical Path"
842
929
  }),
843
- /* @__PURE__ */ jsxRuntime.jsx(index.Tooltip, { description: formatMessage({
844
- id: index.getTranslation("modal.item.canonicalPathField.tooltip"),
845
- defaultMessage: "Based on content hierarchy"
846
- }) })
930
+ /* @__PURE__ */ jsxRuntime.jsx(
931
+ index.Tooltip,
932
+ {
933
+ description: formatMessage({
934
+ id: index.getTranslation("modal.item.canonicalPathField.tooltip"),
935
+ defaultMessage: "Based on content hierarchy"
936
+ })
937
+ }
938
+ )
847
939
  ] }),
848
- /* @__PURE__ */ jsxRuntime.jsx(
849
- designSystem.Field.Input,
850
- {
851
- name: "canonicalPath",
852
- value: route.canonicalPath || "",
853
- disabled: true
854
- }
855
- ),
940
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Input, { name: "canonicalPath", value: route.canonicalPath || "", disabled: true }),
856
941
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
857
942
  ] }) }) }),
858
943
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, s: 12, alignItems: "baseline", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { required: true, children: [
@@ -877,14 +962,7 @@ function ItemDetails({
877
962
  id: index.getTranslation("modal.item.navigationPosition.label"),
878
963
  defaultMessage: "Navigation Position"
879
964
  }) }),
880
- /* @__PURE__ */ jsxRuntime.jsx(
881
- designSystem.Field.Input,
882
- {
883
- name: "navigationPosition",
884
- value: breadcrumbString || "Root",
885
- disabled: true
886
- }
887
- )
965
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Input, { name: "navigationPosition", value: breadcrumbString || "Root", disabled: true })
888
966
  ] }) }) }),
889
967
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, s: 12, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { width: "100%", children: [
890
968
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { children: [
@@ -892,14 +970,7 @@ function ItemDetails({
892
970
  id: index.getTranslation("modal.item.pathField.label"),
893
971
  defaultMessage: "Path"
894
972
  }) }),
895
- /* @__PURE__ */ jsxRuntime.jsx(
896
- designSystem.Field.Input,
897
- {
898
- name: "path",
899
- value: path.value,
900
- disabled: true
901
- }
902
- )
973
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Input, { name: "path", value: path.value, disabled: true })
903
974
  ] }),
904
975
  /* @__PURE__ */ jsxRuntime.jsx(index.PathInfo, { validationState, replacement: path.replacement })
905
976
  ] }) })
@@ -937,10 +1008,19 @@ function ItemCreateComponent({
937
1008
  dispatchPath({ type: "NO_URL_CHECK", payload: relatedRoute.path });
938
1009
  dispatchPath({ type: "SET_SLUG", payload: relatedRoute.slug });
939
1010
  dispatchPath({ type: "SET_INITIALPATH", payload: relatedRoute.path });
940
- dispatchPath({ type: "SET_CANONICALPATH", payload: relatedRoute.canonicalPath });
1011
+ dispatchPath({
1012
+ type: "SET_CANONICALPATH",
1013
+ payload: relatedRoute.canonicalPath
1014
+ });
941
1015
  dispatchNavItemState({ type: "SET_TITLE", payload: relatedRoute.title });
942
- dispatchNavItemState({ type: "SET_ACTIVE", payload: relatedRoute.active });
943
- dispatchNavItemState({ type: "SET_OVERRIDE", payload: relatedRoute.isOverride });
1016
+ dispatchNavItemState({
1017
+ type: "SET_ACTIVE",
1018
+ payload: relatedRoute.active
1019
+ });
1020
+ dispatchNavItemState({
1021
+ type: "SET_OVERRIDE",
1022
+ payload: relatedRoute.isOverride
1023
+ });
944
1024
  setRoute(relatedRoute);
945
1025
  } catch (err) {
946
1026
  strapi.log.error(err);
@@ -952,7 +1032,8 @@ function ItemCreateComponent({
952
1032
  }, [entity]);
953
1033
  const addItem = async () => {
954
1034
  try {
955
- if (!selectedContentType?.contentType || !entity?.documentId || !path || !path.value?.trim() || !navItemState.title || !navItemState.title?.trim() || !selectedNavigation || !route) return;
1035
+ if (!selectedContentType?.contentType || !entity?.documentId || !path || !path.value?.trim() || !navItemState.title || !navItemState.title?.trim() || !selectedNavigation || !route)
1036
+ return;
956
1037
  const newItem = createTempNavItemObject({
957
1038
  actionItemParentId: actionItemParent?.documentId,
958
1039
  entityRoute: route,
@@ -972,9 +1053,18 @@ function ItemCreateComponent({
972
1053
  return /* @__PURE__ */ jsxRuntime.jsx(
973
1054
  NavModal,
974
1055
  {
975
- confirmText: formatMessage({ id: index.getTranslation("add"), defaultMessage: "Add" }),
976
- closeText: formatMessage({ id: index.getTranslation("cancel"), defaultMessage: "Cancel" }),
977
- titleText: formatMessage({ id: index.getTranslation("modal.internalItem.titleText.create"), defaultMessage: "Add new navigation item" }),
1056
+ confirmText: formatMessage({
1057
+ id: index.getTranslation("add"),
1058
+ defaultMessage: "Add"
1059
+ }),
1060
+ closeText: formatMessage({
1061
+ id: index.getTranslation("cancel"),
1062
+ defaultMessage: "Cancel"
1063
+ }),
1064
+ titleText: formatMessage({
1065
+ id: index.getTranslation("modal.internalItem.titleText.create"),
1066
+ defaultMessage: "Add new navigation item"
1067
+ }),
978
1068
  footer: /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}),
979
1069
  children: /* @__PURE__ */ jsxRuntime.jsx(FullLoader.FullLoader, { height: 50 })
980
1070
  }
@@ -983,10 +1073,22 @@ function ItemCreateComponent({
983
1073
  return /* @__PURE__ */ jsxRuntime.jsxs(
984
1074
  NavModal,
985
1075
  {
986
- confirmText: formatMessage({ id: index.getTranslation("add"), defaultMessage: "Add" }),
987
- closeText: formatMessage({ id: index.getTranslation("cancel"), defaultMessage: "Cancel" }),
988
- titleText: formatMessage({ id: index.getTranslation("modal.internalItem.titleText.create"), defaultMessage: "Add new navigation item" }),
989
- loadingText: formatMessage({ id: index.getTranslation("modal.internalItem.loadingText.create"), defaultMessage: "Creating" }),
1076
+ confirmText: formatMessage({
1077
+ id: index.getTranslation("add"),
1078
+ defaultMessage: "Add"
1079
+ }),
1080
+ closeText: formatMessage({
1081
+ id: index.getTranslation("cancel"),
1082
+ defaultMessage: "Cancel"
1083
+ }),
1084
+ titleText: formatMessage({
1085
+ id: index.getTranslation("modal.internalItem.titleText.create"),
1086
+ defaultMessage: "Add new navigation item"
1087
+ }),
1088
+ loadingText: formatMessage({
1089
+ id: index.getTranslation("modal.internalItem.loadingText.create"),
1090
+ defaultMessage: "Creating"
1091
+ }),
990
1092
  onConfirm: addItem,
991
1093
  modalToOpen: "",
992
1094
  currentModalType: "ItemCreate",
@@ -1008,7 +1110,9 @@ function ItemCreateComponent({
1008
1110
  defaultMessage: "Select a content type"
1009
1111
  }),
1010
1112
  onChange: (value) => {
1011
- const [contentType] = availableEntities.filter((group) => group.contentType.label === value);
1113
+ const [contentType] = availableEntities.filter(
1114
+ (group) => group.contentType.label === value
1115
+ );
1012
1116
  if (contentType) {
1013
1117
  setSelectedContentType(contentType);
1014
1118
  setEntity(null);
@@ -1033,14 +1137,16 @@ function ItemCreateComponent({
1033
1137
  defaultMessage: "Select an entity"
1034
1138
  }),
1035
1139
  onChange: (value) => {
1036
- const flatEntities = availableEntities.flatMap((group) => group.entities);
1037
- const route2 = flatEntities.find((route3) => route3.documentId === String(value));
1140
+ const flatEntities = availableEntities.flatMap(
1141
+ (group) => group.entities
1142
+ );
1143
+ const route2 = flatEntities.find(
1144
+ (route3) => route3.documentId === String(value)
1145
+ );
1038
1146
  if (route2) setEntity(route2);
1039
1147
  },
1040
1148
  disabled: !selectedContentType || selectedContentType?.entities && selectedContentType?.entities.length === 0,
1041
- children: selectedContentType && selectedContentType.entities?.map(
1042
- (entity2) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: entity2.documentId, children: entity2[selectedContentType.contentType.default] }, entity2.id)
1043
- )
1149
+ children: selectedContentType && selectedContentType.entities?.map((entity2) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: entity2.documentId, children: entity2[selectedContentType.contentType.default] }, entity2.id))
1044
1150
  }
1045
1151
  )
1046
1152
  ] }) }) })
@@ -6591,10 +6697,16 @@ function ItemEditComponent({
6591
6697
  dispatchPath({ type: "DEFAULT", payload: initialPath });
6592
6698
  dispatchPath({ type: "SET_SLUG", payload: item.route.slug });
6593
6699
  dispatchPath({ type: "SET_INITIALPATH", payload: initialPath });
6594
- dispatchPath({ type: "SET_CANONICALPATH", payload: item.route.canonicalPath });
6700
+ dispatchPath({
6701
+ type: "SET_CANONICALPATH",
6702
+ payload: item.route.canonicalPath
6703
+ });
6595
6704
  dispatchNavItemState({ type: "SET_TITLE", payload: item.route.title });
6596
6705
  dispatchNavItemState({ type: "SET_ACTIVE", payload: item.route.active });
6597
- dispatchNavItemState({ type: "SET_OVERRIDE", payload: item.route.isOverride });
6706
+ dispatchNavItemState({
6707
+ type: "SET_OVERRIDE",
6708
+ payload: item.route.isOverride
6709
+ });
6598
6710
  const initialValues = {
6599
6711
  title: item.route.title,
6600
6712
  active: item.route.active,
@@ -6605,13 +6717,18 @@ function ItemEditComponent({
6605
6717
  }, [navigationItems, item, parentNavItem]);
6606
6718
  React.useEffect(() => {
6607
6719
  if (!entities) return;
6608
- const contentType = entities.find((group) => group.contentType.uid === item.route.relatedContentType);
6720
+ const contentType = entities.find(
6721
+ (group) => group.contentType.uid === item.route.relatedContentType
6722
+ );
6609
6723
  if (contentType) setSelectedContentType(contentType);
6610
6724
  }, [entities]);
6611
6725
  React.useEffect(() => {
6612
6726
  if (path.needsUrlCheck && path.value) {
6613
6727
  if (path.uidPath === path.value || path.initialPath === path.value) return;
6614
- debouncedCheckUrl({ url: path.value, routeDocumentId: item.route.documentId });
6728
+ debouncedCheckUrl({
6729
+ url: path.value,
6730
+ routeDocumentId: item.route.documentId
6731
+ });
6615
6732
  dispatchPath({ type: "RESET_URL_CHECK_FLAG" });
6616
6733
  }
6617
6734
  }, [path.needsUrlCheck, item.route.documentId]);
@@ -6638,10 +6755,19 @@ function ItemEditComponent({
6638
6755
  return /* @__PURE__ */ jsxRuntime.jsxs(
6639
6756
  NavModal,
6640
6757
  {
6641
- confirmText: formatMessage({ id: index.getTranslation("save"), defaultMessage: "Save" }),
6642
- closeText: formatMessage({ id: index.getTranslation("cancel"), defaultMessage: "Cancel" }),
6758
+ confirmText: formatMessage({
6759
+ id: index.getTranslation("save"),
6760
+ defaultMessage: "Save"
6761
+ }),
6762
+ closeText: formatMessage({
6763
+ id: index.getTranslation("cancel"),
6764
+ defaultMessage: "Cancel"
6765
+ }),
6643
6766
  titleText: `${formatMessage({ id: index.getTranslation("edit"), defaultMessage: "Edit" })} ${selectedContentType.contentType.label} "${item.route.title}"`,
6644
- loadingText: formatMessage({ id: index.getTranslation("modal.internalItem.loadingText.edit"), defaultMessage: "Saving" }),
6767
+ loadingText: formatMessage({
6768
+ id: index.getTranslation("modal.internalItem.loadingText.edit"),
6769
+ defaultMessage: "Saving"
6770
+ }),
6645
6771
  onConfirm: updateItem,
6646
6772
  modalToOpen: "",
6647
6773
  currentModalType: "ItemCreate",
@@ -6654,26 +6780,14 @@ function ItemEditComponent({
6654
6780
  id: index.getTranslation("modal.internalItem.contentType.label"),
6655
6781
  defaultMessage: "Content Type"
6656
6782
  }) }),
6657
- /* @__PURE__ */ jsxRuntime.jsx(
6658
- designSystem.Field.Input,
6659
- {
6660
- value: selectedContentType.contentType.label,
6661
- disabled: true
6662
- }
6663
- )
6783
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Input, { value: selectedContentType.contentType.label, disabled: true })
6664
6784
  ] }) }) }),
6665
6785
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, s: 12, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { children: [
6666
6786
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
6667
6787
  id: index.getTranslation("modal.internalItem.entity.label"),
6668
6788
  defaultMessage: "Entity"
6669
6789
  }) }),
6670
- /* @__PURE__ */ jsxRuntime.jsx(
6671
- designSystem.Field.Input,
6672
- {
6673
- value: `${item.route.relatedId} - ${item.route.title}`,
6674
- disabled: true
6675
- }
6676
- )
6790
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Input, { value: `${item.route.relatedId} - ${item.route.title}`, disabled: true })
6677
6791
  ] }) }) })
6678
6792
  ] }),
6679
6793
  item && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
@@ -6758,10 +6872,28 @@ function WrapperItemComponent(props) {
6758
6872
  return /* @__PURE__ */ jsxRuntime.jsx(
6759
6873
  NavModal,
6760
6874
  {
6761
- confirmText: variant === "WrapperCreate" ? formatMessage({ id: index.getTranslation("add"), defaultMessage: "Add" }) : formatMessage({ id: index.getTranslation("save"), defaultMessage: "Save" }),
6762
- closeText: formatMessage({ id: index.getTranslation("cancel"), defaultMessage: "Cancel" }),
6763
- titleText: variant === "WrapperCreate" ? formatMessage({ id: index.getTranslation("modal.wrapperItem.titleText.create"), defaultMessage: "Create new wrapper item" }) : formatMessage({ id: index.getTranslation("modal.wrapperItem.titleText.edit"), defaultMessage: "Edit wrapper item:" }) + ` "${navItemState.title}"`,
6764
- loadingText: variant === "WrapperCreate" ? formatMessage({ id: index.getTranslation("modal.wrapperItem.loadingText.create"), defaultMessage: "Adding" }) : formatMessage({ id: index.getTranslation("modal.wrapperItem.loadingText.edit"), defaultMessage: "Saving" }),
6875
+ confirmText: variant === "WrapperCreate" ? formatMessage({ id: index.getTranslation("add"), defaultMessage: "Add" }) : formatMessage({
6876
+ id: index.getTranslation("save"),
6877
+ defaultMessage: "Save"
6878
+ }),
6879
+ closeText: formatMessage({
6880
+ id: index.getTranslation("cancel"),
6881
+ defaultMessage: "Cancel"
6882
+ }),
6883
+ titleText: variant === "WrapperCreate" ? formatMessage({
6884
+ id: index.getTranslation("modal.wrapperItem.titleText.create"),
6885
+ defaultMessage: "Create new wrapper item"
6886
+ }) : formatMessage({
6887
+ id: index.getTranslation("modal.wrapperItem.titleText.edit"),
6888
+ defaultMessage: "Edit wrapper item:"
6889
+ }) + ` "${navItemState.title}"`,
6890
+ loadingText: variant === "WrapperCreate" ? formatMessage({
6891
+ id: index.getTranslation("modal.wrapperItem.loadingText.create"),
6892
+ defaultMessage: "Adding"
6893
+ }) : formatMessage({
6894
+ id: index.getTranslation("modal.wrapperItem.loadingText.edit"),
6895
+ defaultMessage: "Saving"
6896
+ }),
6765
6897
  onConfirm,
6766
6898
  modalToOpen: "",
6767
6899
  currentModalType: "WrapperCreate",
@@ -6781,7 +6913,10 @@ function WrapperItemComponent(props) {
6781
6913
  }),
6782
6914
  name: "title",
6783
6915
  value: navItemState.title || "",
6784
- onChange: (e) => dispatchNavItemState({ type: "SET_TITLE", payload: e.target.value }),
6916
+ onChange: (e) => dispatchNavItemState({
6917
+ type: "SET_TITLE",
6918
+ payload: e.target.value
6919
+ }),
6785
6920
  required: true
6786
6921
  }
6787
6922
  )
@@ -6815,7 +6950,10 @@ function getProjection(items, activeId, overId, dragOffset, maxDepthValue) {
6815
6950
  }
6816
6951
  return { depth, maxDepth, minDepth };
6817
6952
  }
6818
- function getMaxDepth({ previousItem, maxDepthValue }) {
6953
+ function getMaxDepth({
6954
+ previousItem,
6955
+ maxDepthValue
6956
+ }) {
6819
6957
  if (previousItem && typeof previousItem.depth === "number") {
6820
6958
  return Math.min(previousItem.depth + 1, maxDepthValue);
6821
6959
  }
@@ -6846,16 +6984,10 @@ function RouteItemMenu({
6846
6984
  id: index.getTranslation("edit"),
6847
6985
  defaultMessage: "Edit"
6848
6986
  }) }),
6849
- item.route.type === "internal" && viewEntityTo && /* @__PURE__ */ jsxRuntime.jsx(
6850
- designSystem.MenuItem,
6851
- {
6852
- onClick: () => navigate(viewEntityTo),
6853
- children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
6854
- id: index.getTranslation("navigation.page.navItem.viewEntity"),
6855
- defaultMessage: "View Entity"
6856
- }) })
6857
- }
6858
- ),
6987
+ item.route.type === "internal" && viewEntityTo && /* @__PURE__ */ jsxRuntime.jsx(designSystem.MenuItem, { onClick: () => navigate(viewEntityTo), children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
6988
+ id: index.getTranslation("navigation.page.navItem.viewEntity"),
6989
+ defaultMessage: "View Entity"
6990
+ }) }) }),
6859
6991
  depth !== void 0 && depth < maxDepth && /* @__PURE__ */ jsxRuntime.jsx(designSystem.MenuItem, { onClick: () => handleAddChildren(), children: formatMessage({
6860
6992
  id: index.getTranslation("navigation.page.navItem.addChildren"),
6861
6993
  defaultMessage: "Add children"
@@ -6874,47 +7006,26 @@ function RouteItemStatus({
6874
7006
  if (!item) return null;
6875
7007
  const { formatMessage } = reactIntl.useIntl();
6876
7008
  if (item.clientModifications?.type === "create")
6877
- return /* @__PURE__ */ jsxRuntime.jsx(
6878
- designSystem.Badge,
6879
- {
6880
- backgroundColor: "success100",
6881
- textColor: "success600",
6882
- borderColor: "success200",
6883
- children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", children: formatMessage({
6884
- id: index.getTranslation("new"),
6885
- defaultMessage: "New"
6886
- }) })
6887
- }
6888
- );
7009
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { backgroundColor: "success100", textColor: "success600", borderColor: "success200", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", children: formatMessage({
7010
+ id: index.getTranslation("new"),
7011
+ defaultMessage: "New"
7012
+ }) }) });
6889
7013
  if (item.clientModifications?.type === "update" || isUpdated)
6890
- return /* @__PURE__ */ jsxRuntime.jsx(
6891
- designSystem.Badge,
6892
- {
6893
- backgroundColor: "warning100",
6894
- textColor: "warning600",
6895
- borderColor: "warning200",
6896
- children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", children: formatMessage({
6897
- id: index.getTranslation("updated"),
6898
- defaultMessage: "Updated"
6899
- }) })
6900
- }
6901
- );
7014
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { backgroundColor: "warning100", textColor: "warning600", borderColor: "warning200", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", children: formatMessage({
7015
+ id: index.getTranslation("updated"),
7016
+ defaultMessage: "Updated"
7017
+ }) }) });
6902
7018
  if (item.clientModifications?.type === "delete")
6903
- return /* @__PURE__ */ jsxRuntime.jsx(
6904
- designSystem.Badge,
6905
- {
6906
- backgroundColor: "danger100",
6907
- textColor: "danger600",
6908
- borderColor: "danger200",
6909
- children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", children: formatMessage({
6910
- id: index.getTranslation("deleted"),
6911
- defaultMessage: "Deleted"
6912
- }) })
6913
- }
6914
- );
7019
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { backgroundColor: "danger100", textColor: "danger600", borderColor: "danger200", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", children: formatMessage({
7020
+ id: index.getTranslation("deleted"),
7021
+ defaultMessage: "Deleted"
7022
+ }) }) });
6915
7023
  return null;
6916
7024
  }
6917
- function RouteItemIcon({ type, color = "neutral800" }) {
7025
+ function RouteItemIcon({
7026
+ type,
7027
+ color = "neutral800"
7028
+ }) {
6918
7029
  switch (type) {
6919
7030
  case "external":
6920
7031
  return /* @__PURE__ */ jsxRuntime.jsx(icons.ExternalLink, { color });
@@ -6968,176 +7079,191 @@ function RouteItemBadge({ item }) {
6968
7079
  }
6969
7080
  );
6970
7081
  }
6971
- const RouteItem = React.forwardRef(({
6972
- item,
6973
- initialItem,
6974
- setActionItemParent,
6975
- setActionItem,
6976
- setNavigationItems,
6977
- ghost,
6978
- depth,
6979
- maxDepth,
6980
- style,
6981
- wrapperRef,
6982
- handleProps,
6983
- navigationItems
6984
- }, ref) => {
6985
- const { setModalType } = React.useContext(ModalContext);
6986
- const parentNavItem = React.useMemo(() => findParentNavItem({
6987
- navigationItems,
6988
- targetItem: item,
6989
- onlyInternalItems: true
6990
- }), [navigationItems, item]);
6991
- const hasStructureChanges = React.useMemo(() => {
6992
- if (!initialItem) return false;
6993
- return initialItem.order !== item.order || initialItem.depth !== item.depth;
6994
- }, [initialItem, item.order, item.depth]);
6995
- const isUpdated = item.clientModifications?.type === "update" || hasStructureChanges;
6996
- const itemPath = React.useMemo(() => {
6997
- if (!item.route) return "";
6998
- if (item.route.type !== "internal") return item.route.path;
6999
- const parentPath = parentNavItem ? `${parentNavItem.clientModifications?.path || parentNavItem.route.path}/` : "";
7000
- const itemSlug = item.clientModifications?.slug || item.route.slug;
7001
- return `${parentPath}${itemSlug}`;
7002
- }, [item, parentNavItem, isUpdated]);
7003
- const updateNavItem = (navItems) => {
7004
- if (!navItems) return navItems;
7005
- return navItems.map((navItem) => {
7006
- if (navItem.documentId === item.documentId) {
7007
- if (navItem.clientModifications?.path === itemPath) {
7008
- return navItem;
7082
+ const RouteItem = React.forwardRef(
7083
+ ({
7084
+ item,
7085
+ initialItem,
7086
+ setActionItemParent,
7087
+ setActionItem,
7088
+ setNavigationItems,
7089
+ ghost,
7090
+ depth,
7091
+ maxDepth,
7092
+ style,
7093
+ wrapperRef,
7094
+ handleProps,
7095
+ navigationItems
7096
+ }, ref) => {
7097
+ const { setModalType } = React.useContext(ModalContext);
7098
+ const parentNavItem = React.useMemo(
7099
+ () => findParentNavItem({
7100
+ navigationItems,
7101
+ targetItem: item,
7102
+ onlyInternalItems: true
7103
+ }),
7104
+ [navigationItems, item]
7105
+ );
7106
+ const hasStructureChanges = React.useMemo(() => {
7107
+ if (!initialItem) return false;
7108
+ return initialItem.order !== item.order || initialItem.depth !== item.depth;
7109
+ }, [initialItem, item.order, item.depth]);
7110
+ const isUpdated = item.clientModifications?.type === "update" || hasStructureChanges;
7111
+ const itemPath = React.useMemo(() => {
7112
+ if (!item.route) return "";
7113
+ if (item.route.type !== "internal") return item.route.path;
7114
+ const parentPath = parentNavItem ? `${parentNavItem.clientModifications?.path || parentNavItem.route.path}/` : "";
7115
+ const itemSlug = item.clientModifications?.slug || item.route.slug;
7116
+ return `${parentPath}${itemSlug}`;
7117
+ }, [item, parentNavItem, isUpdated]);
7118
+ const updateNavItem = (navItems) => {
7119
+ if (!navItems) return navItems;
7120
+ return navItems.map((navItem) => {
7121
+ if (navItem.documentId === item.documentId) {
7122
+ if (navItem.clientModifications?.path === itemPath) {
7123
+ return navItem;
7124
+ }
7125
+ return {
7126
+ ...navItem,
7127
+ clientModifications: navItem.clientModifications ? {
7128
+ ...navItem.clientModifications,
7129
+ path: itemPath
7130
+ } : {
7131
+ type: "update",
7132
+ path: itemPath,
7133
+ autoGenerated: true
7134
+ }
7135
+ };
7009
7136
  }
7010
- return {
7011
- ...navItem,
7012
- clientModifications: navItem.clientModifications ? {
7013
- ...navItem.clientModifications,
7014
- path: itemPath
7015
- } : {
7016
- type: "update",
7017
- path: itemPath,
7018
- autoGenerated: true
7019
- }
7020
- };
7021
- }
7022
- return navItem;
7023
- });
7024
- };
7025
- const removeNavItemModifications = (navItems) => {
7026
- if (!navItems) return navItems;
7027
- return navItems.map((navItem) => {
7028
- if (navItem.documentId === item.documentId) {
7029
- const { clientModifications, ...rest } = navItem;
7030
- return rest;
7031
- }
7032
- return navItem;
7033
- });
7034
- };
7035
- React.useEffect(() => {
7036
- if (item.route?.type !== "internal") return;
7037
- const shouldSyncPath = item.clientModifications?.path !== itemPath && (item.clientModifications?.type === "update" || itemPath !== item.route.path);
7038
- if (shouldSyncPath) {
7039
- setNavigationItems(updateNavItem);
7040
- }
7041
- }, [itemPath, item.documentId, item.route?.type, item.route?.path, item.clientModifications?.type, item.clientModifications?.path, setNavigationItems]);
7042
- React.useEffect(() => {
7043
- if (item.route?.type !== "internal") return;
7044
- const canBeRemoved = item.clientModifications?.autoGenerated && item.route.path === itemPath && !hasStructureChanges;
7045
- if (canBeRemoved) {
7046
- setNavigationItems(removeNavItemModifications);
7047
- }
7048
- }, [itemPath, item.documentId, item.route?.type, item.route?.path, item.clientModifications?.autoGenerated, hasStructureChanges, setNavigationItems]);
7049
- const handleAddChildren = () => {
7050
- setActionItemParent(item);
7051
- setModalType("ItemCreate");
7052
- };
7053
- const handleEdit = () => {
7054
- setActionItem(item);
7055
- let newModal = "ItemEdit";
7056
- if (item.route.type === "external") newModal = "ExternalEdit";
7057
- if (item.route.type === "wrapper") newModal = "WrapperEdit";
7058
- setModalType(newModal);
7059
- };
7060
- const handleDelete = () => {
7061
- setActionItem(item);
7062
- setModalType("ItemDelete");
7063
- };
7064
- const handleRestore = () => {
7065
- setNavigationItems(
7066
- (navItems) => navItems?.map((navItem) => {
7137
+ return navItem;
7138
+ });
7139
+ };
7140
+ const removeNavItemModifications = (navItems) => {
7141
+ if (!navItems) return navItems;
7142
+ return navItems.map((navItem) => {
7067
7143
  if (navItem.documentId === item.documentId) {
7068
- const { clientModifications: _, ...rest } = navItem;
7069
- return navItem.initialClientModifications ? { ...rest, clientModifications: navItem.initialClientModifications } : rest;
7144
+ const { clientModifications, ...rest } = navItem;
7145
+ return rest;
7070
7146
  }
7071
7147
  return navItem;
7072
- })
7073
- );
7074
- };
7075
- const elStyle = {
7076
- marginLeft: depth !== void 0 ? depth * 48 : 0,
7077
- opacity: ghost || item.clientModifications?.type === "delete" ? 0.5 : 1,
7078
- ...style
7079
- };
7080
- if (!item || !item.route) return null;
7081
- return /* @__PURE__ */ jsxRuntime.jsx(
7082
- designSystem.Box,
7083
- {
7084
- ref: wrapperRef,
7085
- style: elStyle,
7086
- children: /* @__PURE__ */ jsxRuntime.jsx(
7087
- designSystem.Box,
7088
- {
7089
- background: "neutral0",
7090
- borderColor: item.clientModifications?.type === "delete" ? "danger500" : "neutral150",
7091
- hasRadius: true,
7092
- paddingBottom: 4,
7093
- paddingLeft: 4,
7094
- paddingRight: 4,
7095
- paddingTop: 4,
7096
- shadow: "tableShadow",
7097
- ref,
7098
- children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", gap: 4, children: [
7099
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, children: [
7100
- /* @__PURE__ */ jsxRuntime.jsx(icons.Drag, { color: "neutral800", ...handleProps }),
7101
- /* @__PURE__ */ jsxRuntime.jsx(
7102
- designSystem.Box,
7103
- {
7104
- width: "1px",
7105
- height: "32px",
7106
- background: "neutral150"
7107
- }
7108
- ),
7109
- /* @__PURE__ */ jsxRuntime.jsx(RouteItemIcon, { type: item.route.type }),
7110
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
7111
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", children: item.clientModifications?.title ? item.clientModifications.title : item.route.title }),
7112
- itemPath && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { textColor: "neutral400", children: [
7113
- "/",
7114
- itemPath
7115
- ] })
7116
- ] }),
7117
- /* @__PURE__ */ jsxRuntime.jsx(RouteItemStatus, { item, isUpdated: hasStructureChanges })
7148
+ });
7149
+ };
7150
+ React.useEffect(() => {
7151
+ if (item.route?.type !== "internal") return;
7152
+ const shouldSyncPath = item.clientModifications?.path !== itemPath && (item.clientModifications?.type === "update" || itemPath !== item.route.path);
7153
+ if (shouldSyncPath) {
7154
+ setNavigationItems(updateNavItem);
7155
+ }
7156
+ }, [
7157
+ itemPath,
7158
+ item.documentId,
7159
+ item.route?.type,
7160
+ item.route?.path,
7161
+ item.clientModifications?.type,
7162
+ item.clientModifications?.path,
7163
+ setNavigationItems
7164
+ ]);
7165
+ React.useEffect(() => {
7166
+ if (item.route?.type !== "internal") return;
7167
+ const canBeRemoved = item.clientModifications?.autoGenerated && item.route.path === itemPath && !hasStructureChanges;
7168
+ if (canBeRemoved) {
7169
+ setNavigationItems(removeNavItemModifications);
7170
+ }
7171
+ }, [
7172
+ itemPath,
7173
+ item.documentId,
7174
+ item.route?.type,
7175
+ item.route?.path,
7176
+ item.clientModifications?.autoGenerated,
7177
+ hasStructureChanges,
7178
+ setNavigationItems
7179
+ ]);
7180
+ const handleAddChildren = () => {
7181
+ setActionItemParent(item);
7182
+ setModalType("ItemCreate");
7183
+ };
7184
+ const handleEdit = () => {
7185
+ setActionItem(item);
7186
+ let newModal = "ItemEdit";
7187
+ if (item.route.type === "external") newModal = "ExternalEdit";
7188
+ if (item.route.type === "wrapper") newModal = "WrapperEdit";
7189
+ setModalType(newModal);
7190
+ };
7191
+ const handleDelete = () => {
7192
+ setActionItem(item);
7193
+ setModalType("ItemDelete");
7194
+ };
7195
+ const handleRestore = () => {
7196
+ setNavigationItems(
7197
+ (navItems) => navItems?.map((navItem) => {
7198
+ if (navItem.documentId === item.documentId) {
7199
+ const { clientModifications: _, ...rest } = navItem;
7200
+ return navItem.initialClientModifications ? {
7201
+ ...rest,
7202
+ clientModifications: navItem.initialClientModifications
7203
+ } : rest;
7204
+ }
7205
+ return navItem;
7206
+ })
7207
+ );
7208
+ };
7209
+ const elStyle = {
7210
+ marginLeft: depth !== void 0 ? depth * 48 : 0,
7211
+ opacity: ghost || item.clientModifications?.type === "delete" ? 0.5 : 1,
7212
+ ...style
7213
+ };
7214
+ if (!item || !item.route) return null;
7215
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { ref: wrapperRef, style: elStyle, children: /* @__PURE__ */ jsxRuntime.jsx(
7216
+ designSystem.Box,
7217
+ {
7218
+ background: "neutral0",
7219
+ borderColor: item.clientModifications?.type === "delete" ? "danger500" : "neutral150",
7220
+ hasRadius: true,
7221
+ paddingBottom: 4,
7222
+ paddingLeft: 4,
7223
+ paddingRight: 4,
7224
+ paddingTop: 4,
7225
+ shadow: "tableShadow",
7226
+ ref,
7227
+ children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", gap: 4, children: [
7228
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, children: [
7229
+ /* @__PURE__ */ jsxRuntime.jsx(icons.Drag, { color: "neutral800", ...handleProps }),
7230
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "1px", height: "32px", background: "neutral150" }),
7231
+ /* @__PURE__ */ jsxRuntime.jsx(RouteItemIcon, { type: item.route.type }),
7232
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
7233
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", children: item.clientModifications?.title ? item.clientModifications.title : item.route.title }),
7234
+ itemPath && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { textColor: "neutral400", children: [
7235
+ "/",
7236
+ itemPath
7237
+ ] })
7118
7238
  ] }),
7119
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "row", gap: 4, children: [
7120
- /* @__PURE__ */ jsxRuntime.jsx(RouteItemBadge, { item }),
7121
- /* @__PURE__ */ jsxRuntime.jsx(
7122
- RouteItemMenu,
7123
- {
7124
- item,
7125
- depth,
7126
- maxDepth,
7127
- handleEdit,
7128
- handleAddChildren,
7129
- handleDelete,
7130
- handleRestore
7131
- }
7132
- )
7133
- ] })
7239
+ /* @__PURE__ */ jsxRuntime.jsx(RouteItemStatus, { item, isUpdated: hasStructureChanges })
7240
+ ] }),
7241
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "row", gap: 4, children: [
7242
+ /* @__PURE__ */ jsxRuntime.jsx(RouteItemBadge, { item }),
7243
+ /* @__PURE__ */ jsxRuntime.jsx(
7244
+ RouteItemMenu,
7245
+ {
7246
+ item,
7247
+ depth,
7248
+ maxDepth,
7249
+ handleEdit,
7250
+ handleAddChildren,
7251
+ handleDelete,
7252
+ handleRestore
7253
+ }
7254
+ )
7134
7255
  ] })
7135
- }
7136
- )
7137
- }
7138
- );
7139
- });
7140
- function SortableRouteItem({ item, depth, setNavigationItems, ...props }) {
7256
+ ] })
7257
+ }
7258
+ ) });
7259
+ }
7260
+ );
7261
+ function SortableRouteItem({
7262
+ item,
7263
+ depth,
7264
+ setNavigationItems,
7265
+ ...props
7266
+ }) {
7141
7267
  if (!item) return null;
7142
7268
  const {
7143
7269
  isDragging,
@@ -7170,7 +7296,11 @@ function SortableRouteItem({ item, depth, setNavigationItems, ...props }) {
7170
7296
  }
7171
7297
  );
7172
7298
  }
7173
- function PageWrapper({ navigations, loading = false, children }) {
7299
+ function PageWrapper({
7300
+ navigations,
7301
+ loading = false,
7302
+ children
7303
+ }) {
7174
7304
  const { formatMessage } = reactIntl.useIntl();
7175
7305
  const { selectedNavigation } = React.useContext(SelectedNavigationContext);
7176
7306
  const { setModalType } = React.useContext(ModalContext);
@@ -9049,13 +9179,15 @@ const Navigation = () => {
9049
9179
  }, [modalType]);
9050
9180
  React.useEffect(() => {
9051
9181
  if (!selectedNavigation || !navigationItems) return;
9052
- setNavigations(navigations.map((nav) => {
9053
- if (nav.documentId !== selectedNavigation.documentId) return nav;
9054
- return {
9055
- ...nav,
9056
- items: navigationItems
9057
- };
9058
- }));
9182
+ setNavigations(
9183
+ navigations.map((nav) => {
9184
+ if (nav.documentId !== selectedNavigation.documentId) return nav;
9185
+ return {
9186
+ ...nav,
9187
+ items: navigationItems
9188
+ };
9189
+ })
9190
+ );
9059
9191
  }, [setNavigations, navigationItems, selectedNavigation]);
9060
9192
  React.useEffect(() => {
9061
9193
  if (!activeId || !navigationItems) return;
@@ -9064,7 +9196,9 @@ const Navigation = () => {
9064
9196
  }, [navigationItems, activeId]);
9065
9197
  function handleSoftAddedItem(newItem) {
9066
9198
  if (newItem.clientModifications?.parent) {
9067
- const parentIndex = navigationItems?.findIndex((item) => item.documentId === newItem.clientModifications?.parent);
9199
+ const parentIndex = navigationItems?.findIndex(
9200
+ (item) => item.documentId === newItem.clientModifications?.parent
9201
+ );
9068
9202
  if (parentIndex !== void 0 && parentIndex >= 0) {
9069
9203
  const parentDepth = navigationItems ? navigationItems[parentIndex].depth || 0 : 0;
9070
9204
  newItem.depth = parentDepth + 1;
@@ -9164,10 +9298,18 @@ const Navigation = () => {
9164
9298
  return /* @__PURE__ */ jsxRuntime.jsx(ModalContext.Provider, { value: { modalType, setModalType }, children: /* @__PURE__ */ jsxRuntime.jsxs(SelectedNavigationContext.Provider, { value: { selectedNavigation, setSelectedNavigation }, children: [
9165
9299
  /* @__PURE__ */ jsxRuntime.jsxs(PageWrapper, { navigations, children: [
9166
9300
  selectedNavigation && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, paddingBottom: 6, justifyContent: "flex-end", children: [
9167
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "secondary", startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Plus, {}), onClick: () => setModalType("ItemCreate"), children: formatMessage({
9168
- id: index.getTranslation("navigation.page.newItemButton"),
9169
- defaultMessage: "New Item"
9170
- }) }),
9301
+ /* @__PURE__ */ jsxRuntime.jsx(
9302
+ designSystem.Button,
9303
+ {
9304
+ variant: "secondary",
9305
+ startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Plus, {}),
9306
+ onClick: () => setModalType("ItemCreate"),
9307
+ children: formatMessage({
9308
+ id: index.getTranslation("navigation.page.newItemButton"),
9309
+ defaultMessage: "New Item"
9310
+ })
9311
+ }
9312
+ ),
9171
9313
  /* @__PURE__ */ jsxRuntime.jsx(
9172
9314
  designSystem.Button,
9173
9315
  {
@@ -9195,7 +9337,9 @@ const Navigation = () => {
9195
9337
  measuring,
9196
9338
  children: /* @__PURE__ */ jsxRuntime.jsxs(sortable.SortableContext, { items: navigationItems, strategy: sortable.verticalListSortingStrategy, children: [
9197
9339
  navigationItems.map((item, index2) => {
9198
- const initialItem = initialNavigationItemsRef.current?.find((i) => i.documentId === item.documentId);
9340
+ const initialItem = initialNavigationItemsRef.current?.find(
9341
+ (i) => i.documentId === item.documentId
9342
+ );
9199
9343
  return config?.navigation.maxDepth && /* @__PURE__ */ jsxRuntime.jsx(
9200
9344
  SortableRouteItem,
9201
9345
  {
@@ -9230,10 +9374,15 @@ const Navigation = () => {
9230
9374
  }
9231
9375
  ) }),
9232
9376
  navigations?.length === 0 && /* @__PURE__ */ jsxRuntime.jsxs(FullLoader.Center, { height: 400, children: [
9233
- /* @__PURE__ */ jsxRuntime.jsx(EmptyBox, { msg: formatMessage({
9234
- id: index.getTranslation("navigation.page.emptyNavigation"),
9235
- defaultMessage: "You have no navigations yet..."
9236
- }) }),
9377
+ /* @__PURE__ */ jsxRuntime.jsx(
9378
+ EmptyBox,
9379
+ {
9380
+ msg: formatMessage({
9381
+ id: index.getTranslation("navigation.page.emptyNavigation"),
9382
+ defaultMessage: "You have no navigations yet..."
9383
+ })
9384
+ }
9385
+ ),
9237
9386
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "default", onClick: () => setModalType("NavCreate"), children: formatMessage({
9238
9387
  id: index.getTranslation("navigation.page.createNewNavigation"),
9239
9388
  defaultMessage: "Create new navigation"
@@ -9247,13 +9396,7 @@ const Navigation = () => {
9247
9396
  }) })
9248
9397
  ] })
9249
9398
  ] }),
9250
- modalType === "NavOverview" && /* @__PURE__ */ jsxRuntime.jsx(
9251
- NavOverview,
9252
- {
9253
- navigations,
9254
- setActionItem
9255
- }
9256
- ),
9399
+ modalType === "NavOverview" && /* @__PURE__ */ jsxRuntime.jsx(NavOverview, { navigations, setActionItem }),
9257
9400
  modalType === "NavCreate" && /* @__PURE__ */ jsxRuntime.jsx(NavCreate, {}),
9258
9401
  modalType === "NavDelete" && /* @__PURE__ */ jsxRuntime.jsx(
9259
9402
  Delete,
@@ -9366,3 +9509,4 @@ const App = () => {
9366
9509
  ] }) });
9367
9510
  };
9368
9511
  exports.default = App;
9512
+ //# sourceMappingURL=index-C8YjuuOx.js.map