@mattisvensson/strapi-plugin-webatlas 0.12.1 → 0.13.0

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 (32) hide show
  1. package/README.md +59 -2
  2. package/dist/admin/{SettingTitle-Ib_0AvoZ.js → ContentBox-D4PGQ8eh.js} +1 -5
  3. package/dist/admin/{SettingTitle-0mKlA80i.mjs → ContentBox-KyQN2KGV.mjs} +2 -6
  4. package/dist/admin/{RoutePicker-IRZiHKFi.mjs → RoutePicker-CgndSXoF.mjs} +1 -1
  5. package/dist/admin/{RoutePicker-C3_tzz9U.js → RoutePicker-CwoMMhf_.js} +1 -1
  6. package/dist/admin/WarningBox-AyYq0Onj.mjs +18 -0
  7. package/dist/admin/{WarningBox-BZ3BZ5fR.js → WarningBox-FF1yYDXP.js} +0 -24
  8. package/dist/admin/{de-DhwCZE_m.js → de-Cl0vM1wA.js} +52 -4
  9. package/dist/admin/{de-BFjenpyN.mjs → de-DWs5ckOd.mjs} +52 -4
  10. package/dist/admin/{en-CGCh9ld_.mjs → en-CyhISGZi.mjs} +52 -4
  11. package/dist/admin/{en-C-rPCNd2.js → en-DSmtmPYk.js} +52 -4
  12. package/dist/admin/{index-ByxM39aL.mjs → index-BKhrfzjO.mjs} +105 -33
  13. package/dist/admin/{index-Bym1mXg1.mjs → index-Bv5Ri-ri.mjs} +44 -12
  14. package/dist/admin/{index-88JTX1Mj.js → index-BxGPKxr_.js} +50 -18
  15. package/dist/admin/index-Ctm4TBT5.mjs +5308 -0
  16. package/dist/admin/{index-PD3gcnXA.mjs → index-D2O7sLKs.mjs} +1 -1
  17. package/dist/admin/{index-CsKnBzp6.js → index-DTrsl_uN.js} +105 -33
  18. package/dist/admin/index-FvaXwOH0.mjs +174 -0
  19. package/dist/admin/index-JBUU7dE6.js +5308 -0
  20. package/dist/admin/{index-DNBXz42q.js → index-jOCO4_-k.js} +1 -1
  21. package/dist/admin/index-uOC1Clyv.js +174 -0
  22. package/dist/admin/index.js +1 -1
  23. package/dist/admin/index.mjs +1 -1
  24. package/dist/server/index.js +443 -96
  25. package/dist/server/index.mjs +444 -97
  26. package/dist/server/src/index.d.ts +17 -4
  27. package/package.json +3 -3
  28. package/dist/admin/WarningBox-CXEmXfVx.mjs +0 -42
  29. package/dist/admin/index-BPUJTNed.js +0 -9622
  30. package/dist/admin/index-BY6JLZrD.mjs +0 -9622
  31. package/dist/admin/index-CEJBltoJ.js +0 -147
  32. package/dist/admin/index-CNCyng5O.mjs +0 -147
@@ -9,7 +9,25 @@ const en = {
9
9
  "webatlas.navigation.page.newItemButton": "New Item",
10
10
  "webatlas.navigation.page.selectNavigation": "Select Navigation",
11
11
  "webatlas.navigation.page.navItem.addChildren": "Add children",
12
- "webatlas.navigation.page.navItem.viewEntity": "View entity",
12
+ "webatlas.navigation.page.navItem.viewEntity": "Open entry",
13
+ "webatlas.navigation.page.search.placeholder": "Search by title or path",
14
+ "webatlas.navigation.page.search.clear": "Clear search",
15
+ "webatlas.navigation.page.search.noResults": "No items found",
16
+ "webatlas.navigation.page.search.dragDisabled": "Drag and drop is disabled while searching.",
17
+ "webatlas.navigation.page.collapseAll": "Collapse all",
18
+ "webatlas.navigation.page.expandAll": "Expand all",
19
+ "webatlas.navigation.page.navItem.collapse": "Collapse",
20
+ "webatlas.navigation.page.navItem.expand": "Expand",
21
+ "webatlas.navigation.page.navItem.movedChildren": "+{count} {count, plural, one {child} other {children}}",
22
+ "webatlas.navigation.page.navItem.insertBelow": "Add item below",
23
+ "webatlas.navigation.page.discardChanges": "Discard changes",
24
+ "webatlas.navigation.page.emptyItems": "Your navigation is empty...",
25
+ "webatlas.navigation.page.itemCount": "{count, plural, one {# item} other {# items}}",
26
+ "webatlas.navigation.page.navItem.actions": "Item actions",
27
+ "webatlas.navigation.page.navItem.undoDelete": "Undo delete",
28
+ "webatlas.navigation.page.navItem.resetEdits": "Reset edits",
29
+ "webatlas.navigation.page.navItem.draftHint": "Only shown in the frontend once the page is published.",
30
+ "webatlas.navigation.page.navItem.modifiedHint": "The latest changes of the page are not published yet.",
13
31
  "webatlas.paths.page.title": "Paths",
14
32
  "webatlas.paths.page.subtitle": "Overview of all existing paths",
15
33
  "webatlas.paths.page.emptyPaths": "No paths found",
@@ -36,7 +54,13 @@ const en = {
36
54
  "webatlas.settings.page.defaultParentRoute.entity.placeholder": "Select an entity",
37
55
  "webatlas.settings.page.navigation.subtitle": "Configure navigation settings",
38
56
  "webatlas.settings.page.navigation.navigation": "Navigation",
39
- "webatlas.settings.page.navigation.maxNavDepth.label": "Max depth of navigation tree",
57
+ "webatlas.settings.page.navigation.maxDepth.title": "Maximum depth",
58
+ "webatlas.settings.page.navigation.maxDepth.description": "Sets how many levels a navigation may have. It cannot be lower than the deepest existing level.",
59
+ "webatlas.settings.page.navigation.maxDepth.levels": "Maximum levels",
60
+ "webatlas.settings.page.navigation.maxDepth.deepest": "Current deepest level",
61
+ "webatlas.settings.page.navigation.maxDepth.invalid": "At least 1",
62
+ "webatlas.settings.page.navigation.maxDepth.tooLow": "At least {count}, the navigation already has items on level {count}",
63
+ "webatlas.settings.page.navigation.maxDepth.empty": "There are no navigations yet.",
40
64
  "webatlas.modal.navOverview.confirmText": "New navigation",
41
65
  "webatlas.modal.navOverview.closeText": "Cancel",
42
66
  "webatlas.modal.navOverview.titleText": "Navigation overview",
@@ -51,9 +75,12 @@ const en = {
51
75
  "webatlas.modal.delete.cancelText": "No, keep",
52
76
  "webatlas.modal.delete.confirmText": "Yes, delete",
53
77
  "webatlas.modal.delete.message.start": "You are about to delete the following",
54
- "webatlas.modal.delete.message.navItem": "navigation item",
55
78
  "webatlas.modal.delete.message.navigation": "navigation",
56
79
  "webatlas.modal.delete.message.end": "This can not be undone. Are you sure?",
80
+ "webatlas.modal.saveConfirm.title": "Save changes?",
81
+ "webatlas.modal.saveConfirm.deletedItems": "{count, plural, one {# item is} other {# items are}} deleted when saving:",
82
+ "webatlas.modal.saveConfirm.orphanedChildren": "Children of deleted items are kept and move up one level.",
83
+ "webatlas.modal.saveConfirm.confirm": "Save and delete",
57
84
  "webatlas.modal.nameField.label": "Name",
58
85
  "webatlas.modal.activeField.label": "Active",
59
86
  "webatlas.modal.activeField.onLabel": "Yes",
@@ -85,6 +112,26 @@ const en = {
85
112
  "webatlas.modal.item.canonicalPathMismatch": "Warning: Canonical Path does not match navigation path",
86
113
  "webatlas.modal.item.routeAlreadyUsed": 'Warning: This path is already used in the navigation "{navigationName}"',
87
114
  "webatlas.modal.item.routeAlreadyUsed.info": "Changing the path for this item will also update the path in the existing item.",
115
+ "webatlas.modal.entrySelection.search": "Search entries",
116
+ "webatlas.modal.entrySelection.error": "The entries could not be loaded.",
117
+ "webatlas.modal.entrySelection.empty": "No entries found",
118
+ "webatlas.modal.entrySelection.loadMore": "Load more",
119
+ "webatlas.modal.entrySelection.selectedCount": "{count} selected",
120
+ "webatlas.modal.entrySelection.clear": "Clear selection",
121
+ "webatlas.modal.entrySelection.usedHere": "Already in this navigation",
122
+ "webatlas.modal.entrySelection.usedIn": 'In "{navigationName}"',
123
+ "webatlas.modal.entrySelection.next": "Next ({count})",
124
+ "webatlas.modal.entrySelection.noRoute": "No route",
125
+ "webatlas.modal.multiItem.status": "Status",
126
+ "webatlas.modal.multiItem.status.ok": "OK",
127
+ "webatlas.modal.multiItem.status.replaced": "Path was taken, replaced",
128
+ "webatlas.modal.multiItem.status.blacklisted": "Path is blocked",
129
+ "webatlas.modal.multiItem.status.duplicate": "Path is selected twice",
130
+ "webatlas.modal.multiItem.status.noRoute": "Entry has no route",
131
+ "webatlas.modal.multiItem.status.error": "Check failed",
132
+ "webatlas.modal.multiItem.remove": "Remove from selection",
133
+ "webatlas.modal.multiItem.confirm": "Add {count, plural, one {# item} other {# items}}",
134
+ "webatlas.modal.discardChanges.message": "All unsaved changes of this navigation will be discarded. This can not be undone.",
88
135
  "webatlas.components.pathInfo.checking": "Checking if path is available...",
89
136
  "webatlas.components.pathInfo.available": "Path is available",
90
137
  "webatlas.components.pathInfo.notAvailable": "Path is not available. Replaced with",
@@ -96,6 +143,7 @@ const en = {
96
143
  "webatlas.components.CMEditViewAside.path.overrideCheckbox": "Override automatic path generation",
97
144
  "webatlas.components.CMEditViewAside.path.uidPath.hint": "Permanent UID path, cannot be changed",
98
145
  "webatlas.components.CMEditViewAside.path.newPathInfo": "A new path will be created upon saving this entry.",
146
+ "webatlas.components.CMEditViewAside.path.noPathInfo": 'No path will be created while the "{field}" field is empty. Fill it in or use the override option to set a custom path.',
99
147
  "webatlas.components.CMEditViewAside.path.input.noSourceField": "Use the override option to set a custom Path.",
100
148
  "webatlas.components.CMEditViewAside.path.input.parentSelect.label": "Place under",
101
149
  "webatlas.components.CMEditViewAside.path.input.parentSelect.rootPath": "None (root path)",
@@ -112,6 +160,7 @@ const en = {
112
160
  "webatlas.delete": "Delete",
113
161
  "webatlas.edit": "Edit",
114
162
  "webatlas.add": "Add",
163
+ "webatlas.back": "Back",
115
164
  "webatlas.cancel": "Cancel",
116
165
  "webatlas.save": "Save",
117
166
  "webatlas.select": "Select",
@@ -120,7 +169,6 @@ const en = {
120
169
  "webatlas.draft": "Draft",
121
170
  "webatlas.modified": "Modified",
122
171
  "webatlas.deleted": "Deleted",
123
- "webatlas.restore.metadata": "Restore Metadata",
124
172
  "webatlas.loading": "Loading...",
125
173
  "webatlas.version": "Version",
126
174
  "webatlas.contentType": "Content Type",
@@ -52,7 +52,7 @@ function transformToUrl(input, replaceSlash = true) {
52
52
  input = input.replace(/-+/g, "-");
53
53
  return input;
54
54
  }
55
- const version = "0.12.1";
55
+ const version = "0.12.2";
56
56
  const strapi = { "name": "webatlas", "displayName": "Webatlas" };
57
57
  const pluginPkg = {
58
58
  version,
@@ -158,6 +158,14 @@ function useApi() {
158
158
  });
159
159
  return data;
160
160
  };
161
+ const getNavigationDepths = async () => {
162
+ const { data } = await get(`/${PLUGIN_ID}/settings/navigation-depths`);
163
+ return data;
164
+ };
165
+ const updateNavigationDepths = async (depths) => {
166
+ const { data } = await put(`/${PLUGIN_ID}/settings/navigation-depths`, { data: depths });
167
+ return data;
168
+ };
161
169
  return {
162
170
  fetchAllContentTypes,
163
171
  fetchAllEntities,
@@ -169,7 +177,9 @@ function useApi() {
169
177
  createNavigation,
170
178
  deleteNavigation,
171
179
  updateNavigation,
172
- updateNavigationItemStructure
180
+ updateNavigationItemStructure,
181
+ getNavigationDepths,
182
+ updateNavigationDepths
173
183
  };
174
184
  }
175
185
  function debounce(func, wait) {
@@ -332,8 +342,19 @@ function OverrideCheckbox({ isOverride, setIsOverride, disabledCondition }) {
332
342
  }
333
343
  ) });
334
344
  }
335
- function NewPathInfo() {
345
+ function NewPathInfo({
346
+ hasSlug,
347
+ routeSourceField
348
+ }) {
336
349
  const { formatMessage } = useIntl();
350
+ if (!hasSlug)
351
+ return /* @__PURE__ */ jsx(Typography, { textColor: "danger600", children: formatMessage(
352
+ {
353
+ id: getTranslation("components.CMEditViewAside.path.noPathInfo"),
354
+ defaultMessage: 'No path will be created while the "{field}" field is empty. Fill it in or use the override option to set a custom path.'
355
+ },
356
+ { field: routeSourceField }
357
+ ) });
337
358
  return /* @__PURE__ */ jsx(Typography, { textColor: "neutral600", children: formatMessage({
338
359
  id: getTranslation("components.CMEditViewAside.path.newPathInfo"),
339
360
  defaultMessage: "A new path will be created upon saving this entry."
@@ -3654,7 +3675,14 @@ function Tooltip({ description }) {
3654
3675
  ) }) })
3655
3676
  ] }) });
3656
3677
  }
3657
- function PathInput({ path, dispatchPath, isOverride, config, hasUserInteracted }) {
3678
+ function PathInput({
3679
+ path,
3680
+ dispatchPath,
3681
+ isOverride,
3682
+ config,
3683
+ hasUserInteracted,
3684
+ disabled
3685
+ }) {
3658
3686
  const { formatMessage } = useIntl();
3659
3687
  const displayedPath = isOverride && path.overridePath !== void 0 ? path.overridePath : path.value ?? "";
3660
3688
  const inputBorder = path.replacement === null ? "" : path.replacement ? "1px solid #ee5e52" : "1px solid #5cb176";
@@ -3696,7 +3724,7 @@ function PathInput({ path, dispatchPath, isOverride, config, hasUserInteracted }
3696
3724
  hasUserInteracted.current = true;
3697
3725
  dispatchPath({ type: "SET_OVERRIDEPATH", payload: e.target.value });
3698
3726
  },
3699
- disabled: !isOverride,
3727
+ disabled: !isOverride || disabled,
3700
3728
  onBlur: (e) => {
3701
3729
  dispatchPath({
3702
3730
  type: "SET_OVERRIDEPATH",
@@ -3722,7 +3750,8 @@ function RouteStructure({
3722
3750
  canonicalPath,
3723
3751
  prohibitedRouteIds,
3724
3752
  defaultParentRoute,
3725
- isCreatingEntry
3753
+ isCreatingEntry,
3754
+ disabled
3726
3755
  }) {
3727
3756
  const { formatMessage } = useIntl();
3728
3757
  const handleSelectParent = (value) => {
@@ -3753,7 +3782,7 @@ function RouteStructure({
3753
3782
  id: getTranslation("components.CMEditViewAside.path.input.parentSelect.label"),
3754
3783
  defaultMessage: "Place under"
3755
3784
  }) }),
3756
- /* @__PURE__ */ jsxs(SingleSelect, { value: selectValue, onValueChange: handleSelectParent, children: [
3785
+ /* @__PURE__ */ jsxs(SingleSelect, { value: selectValue, onValueChange: handleSelectParent, disabled, children: [
3757
3786
  /* @__PURE__ */ jsx(SingleSelectOption, { value: "", children: formatMessage({
3758
3787
  id: getTranslation("components.CMEditViewAside.path.input.parentSelect.rootPath"),
3759
3788
  defaultMessage: "None (root path)"
@@ -3782,6 +3811,30 @@ function RouteStructure({
3782
3811
  ] })
3783
3812
  ] });
3784
3813
  }
3814
+ const pluginPermissions = {
3815
+ "cm.aside": [{ action: `plugin::${PLUGIN_ID}.cm.aside`, subject: null }],
3816
+ "cm.edit-path": [{ action: `plugin::${PLUGIN_ID}.cm.edit-path`, subject: null }],
3817
+ "navigation.read": [{ action: `plugin::${PLUGIN_ID}.navigation.read`, subject: null }],
3818
+ "navigation.create": [{ action: `plugin::${PLUGIN_ID}.navigation.create`, subject: null }],
3819
+ "navigation.update": [{ action: `plugin::${PLUGIN_ID}.navigation.update`, subject: null }],
3820
+ "navigation.delete": [{ action: `plugin::${PLUGIN_ID}.navigation.delete`, subject: null }],
3821
+ "navigation.edit-items": [
3822
+ { action: `plugin::${PLUGIN_ID}.navigation.edit-items`, subject: null }
3823
+ ],
3824
+ "page.routes": [{ action: `plugin::${PLUGIN_ID}.page.routes`, subject: null }],
3825
+ "settings.general.read": [
3826
+ { action: `plugin::${PLUGIN_ID}.settings.general.read`, subject: null }
3827
+ ],
3828
+ "settings.general.update": [
3829
+ { action: `plugin::${PLUGIN_ID}.settings.general.update`, subject: null }
3830
+ ],
3831
+ "settings.navigation.read": [
3832
+ { action: `plugin::${PLUGIN_ID}.settings.navigation.read`, subject: null }
3833
+ ],
3834
+ "settings.navigation.update": [
3835
+ { action: `plugin::${PLUGIN_ID}.settings.navigation.update`, subject: null }
3836
+ ]
3837
+ };
3785
3838
  function buildPath(type, slug, parent) {
3786
3839
  const parentSlug = type === "canonical" ? parent?.canonicalPath : parent?.path;
3787
3840
  const parentPath = parentSlug ? `${parentSlug}/` : "";
@@ -3827,14 +3880,15 @@ function reducer(state, action) {
3827
3880
  }
3828
3881
  }
3829
3882
  const Panel = ({ config }) => {
3830
- const { form, model } = unstable_useContentManagerContext();
3831
- const { initialValues, values, onChange } = form;
3883
+ const { form, model, contentType } = unstable_useContentManagerContext();
3884
+ const { initialValues, values, onChange, isSubmitting } = form;
3832
3885
  const { getRelatedRoute, getAllRoutes, getProhibitedRouteIds } = useApi();
3833
3886
  const { formatMessage } = useIntl();
3834
3887
  const { get } = useFetchClient();
3835
3888
  const {
3836
- allowedActions: { canUpdate, canCreate }
3889
+ allowedActions: { canUpdate, canCreate, canEditPath }
3837
3890
  } = useRBAC([
3891
+ ...pluginPermissions["cm.edit-path"],
3838
3892
  {
3839
3893
  action: "plugin::content-manager.explorer.update",
3840
3894
  subject: model,
@@ -3866,6 +3920,8 @@ const Panel = ({ config }) => {
3866
3920
  slug: "",
3867
3921
  overridePath: ""
3868
3922
  });
3923
+ const [routeRefreshKey, setRouteRefreshKey] = useState(0);
3924
+ const wasSubmitting = useRef(false);
3869
3925
  const hasUserChangedField = useRef(false);
3870
3926
  const hasUserInteracted = useRef(false);
3871
3927
  const initialRouteData = useRef(null);
@@ -3873,6 +3929,7 @@ const Panel = ({ config }) => {
3873
3929
  const routeSourceField = config?.routeSourceField;
3874
3930
  const sourceFieldValue = routeSourceField ? values[routeSourceField] || "" : "";
3875
3931
  const initialSourceFieldValue = routeSourceField ? initialValues[routeSourceField] || "" : "";
3932
+ const isSourceFieldRequired = !!(routeSourceField && contentType?.attributes?.[routeSourceField]?.required);
3876
3933
  const latestCheckPathRef = useRef(checkPath);
3877
3934
  latestCheckPathRef.current = checkPath;
3878
3935
  const debouncedCheckPath = useRef(
@@ -3899,7 +3956,7 @@ const Panel = ({ config }) => {
3899
3956
  parentDocumentId: selectedParent?.documentId || null,
3900
3957
  slug: isOverride ? overridePath : slug
3901
3958
  };
3902
- if (initialRouteData.current?.isOverride === isOverride && data.path === initialRouteData.current?.path && data.parentDocumentId === (initialRouteData.current?.parent?.documentId ?? null)) {
3959
+ if (initialRouteData.current?.isOverride === isOverride && data.path === initialRouteData.current?.path && data.parentDocumentId === (initialRouteData.current?.parent?.documentId ?? null) && sourceFieldValue.trim() === (initialRouteData.current?.title ?? "")) {
3903
3960
  onChange("webatlas", void 0);
3904
3961
  return;
3905
3962
  }
@@ -3921,7 +3978,11 @@ const Panel = ({ config }) => {
3921
3978
  hasUserChangedField.current = true;
3922
3979
  }
3923
3980
  if (!sourceFieldValue) {
3924
- dispatchPath({ type: "NO_URL_CHECK", payload: "" });
3981
+ dispatchPath({ type: "NO_URL_CHECK", payload: initialRouteData.current?.path ?? "" });
3982
+ dispatchPath({
3983
+ type: "SET_CANONICALPATH",
3984
+ payload: initialRouteData.current?.canonicalPath ?? ""
3985
+ });
3925
3986
  return;
3926
3987
  }
3927
3988
  if (initialLoadComplete && (hasUserChangedField.current || !route) && prevSourceValueRef.current !== sourceFieldValue && !isOverride) {
@@ -3999,7 +4060,16 @@ const Panel = ({ config }) => {
3999
4060
  }
4000
4061
  }
4001
4062
  fetchRelatedRute();
4002
- }, [config]);
4063
+ }, [config, routeRefreshKey]);
4064
+ useEffect(() => {
4065
+ if (isSubmitting) {
4066
+ wasSubmitting.current = true;
4067
+ return;
4068
+ }
4069
+ if (!wasSubmitting.current) return;
4070
+ wasSubmitting.current = false;
4071
+ setRouteRefreshKey((key) => key + 1);
4072
+ }, [isSubmitting]);
4003
4073
  useEffect(() => {
4004
4074
  if (!route || !routes.length) return;
4005
4075
  const parentRoute = routes.find(
@@ -4067,7 +4137,13 @@ const Panel = ({ config }) => {
4067
4137
  }) });
4068
4138
  return /* @__PURE__ */ jsx(Box, { tag: "aside", "aria-labelledby": "URL Route", width: "100%", children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 1, children: [
4069
4139
  !route && /* @__PURE__ */ jsxs(Fragment$1, { children: [
4070
- /* @__PURE__ */ jsx(NewPathInfo, {}),
4140
+ /* @__PURE__ */ jsx(
4141
+ NewPathInfo,
4142
+ {
4143
+ hasSlug: !!(isOverride ? path.overridePath : sourceFieldValue.trim()) || !isOverride && isSourceFieldRequired,
4144
+ routeSourceField
4145
+ }
4146
+ ),
4071
4147
  /* @__PURE__ */ jsx(Divider, { marginTop: 2, marginBottom: 2 })
4072
4148
  ] }),
4073
4149
  /* @__PURE__ */ jsx(
@@ -4082,7 +4158,8 @@ const Panel = ({ config }) => {
4082
4158
  },
4083
4159
  prohibitedRouteIds,
4084
4160
  defaultParentRoute: config.defaultParentRoute || "",
4085
- isCreatingEntry: !initialValues.documentId
4161
+ isCreatingEntry: !initialValues.documentId,
4162
+ disabled: !canEditPath
4086
4163
  }
4087
4164
  ),
4088
4165
  /* @__PURE__ */ jsx(Divider, { marginTop: 2, marginBottom: 2 }),
@@ -4094,7 +4171,8 @@ const Panel = ({ config }) => {
4094
4171
  dispatchPath,
4095
4172
  isOverride,
4096
4173
  config,
4097
- hasUserInteracted
4174
+ hasUserInteracted,
4175
+ disabled: !canEditPath
4098
4176
  }
4099
4177
  ),
4100
4178
  (validationState !== "initial" || isBlacklisted) && /* @__PURE__ */ jsx(
@@ -4116,7 +4194,7 @@ const Panel = ({ config }) => {
4116
4194
  dispatchPath({ type: "SET_URL_CHECK_FLAG", payload: true });
4117
4195
  setIsOverride(val);
4118
4196
  },
4119
- disabledCondition: !canCreate && !canUpdate
4197
+ disabledCondition: !canCreate && !canUpdate || !canEditPath
4120
4198
  }
4121
4199
  ),
4122
4200
  path.uidPath && /* @__PURE__ */ jsxs(Fragment$1, { children: [
@@ -4125,13 +4203,6 @@ const Panel = ({ config }) => {
4125
4203
  ] })
4126
4204
  ] }) });
4127
4205
  };
4128
- const pluginPermissions = {
4129
- "cm.aside": [{ action: `plugin::${PLUGIN_ID}.cm.aside`, subject: null }],
4130
- "page.navigation": [{ action: `plugin::${PLUGIN_ID}.page.navigation`, subject: null }],
4131
- "page.routes": [{ action: `plugin::${PLUGIN_ID}.page.routes`, subject: null }],
4132
- "settings.general": [{ action: `plugin::${PLUGIN_ID}.settings.general`, subject: null }],
4133
- "settings.navigation": [{ action: `plugin::${PLUGIN_ID}.settings.navigation`, subject: null }]
4134
- };
4135
4206
  const CMEditViewAside = ({ model }) => {
4136
4207
  const { contentTypes } = useAllContentTypes();
4137
4208
  const { config } = usePluginConfig();
@@ -4188,7 +4259,7 @@ const index = {
4188
4259
  id: `${PLUGIN_ID}.link.paths`,
4189
4260
  defaultMessage: "Paths"
4190
4261
  },
4191
- Component: () => import("./index-PD3gcnXA.mjs"),
4262
+ Component: () => import("./index-D2O7sLKs.mjs"),
4192
4263
  permissions: [pluginPermissions["page.routes"][0]]
4193
4264
  });
4194
4265
  app.addMenuLink({
@@ -4198,8 +4269,8 @@ const index = {
4198
4269
  id: `${PLUGIN_ID}.link.navigation`,
4199
4270
  defaultMessage: "Navigation"
4200
4271
  },
4201
- Component: () => import("./index-BY6JLZrD.mjs"),
4202
- permissions: [pluginPermissions["page.navigation"][0]]
4272
+ Component: () => import("./index-Ctm4TBT5.mjs"),
4273
+ permissions: [pluginPermissions["navigation.read"][0]]
4203
4274
  });
4204
4275
  app.addSettingsLink(
4205
4276
  {
@@ -4216,8 +4287,8 @@ const index = {
4216
4287
  },
4217
4288
  id: `${PLUGIN_ID}-general`,
4218
4289
  to: `${PLUGIN_ID}/general`,
4219
- Component: () => import("./index-Bym1mXg1.mjs"),
4220
- permissions: [pluginPermissions["settings.general"][0]]
4290
+ Component: () => import("./index-Bv5Ri-ri.mjs"),
4291
+ permissions: [pluginPermissions["settings.general.read"][0]]
4221
4292
  }
4222
4293
  );
4223
4294
  app.addSettingsLink(PLUGIN_ID, {
@@ -4227,8 +4298,8 @@ const index = {
4227
4298
  },
4228
4299
  id: `${PLUGIN_ID}-navigation`,
4229
4300
  to: `${PLUGIN_ID}/navigation`,
4230
- Component: () => import("./index-CNCyng5O.mjs"),
4231
- permissions: [pluginPermissions["settings.navigation"][0]]
4301
+ Component: () => import("./index-FvaXwOH0.mjs"),
4302
+ permissions: [pluginPermissions["settings.navigation.read"][0]]
4232
4303
  });
4233
4304
  app.customFields.register({
4234
4305
  name: "route-picker",
@@ -4243,7 +4314,7 @@ const index = {
4243
4314
  defaultMessage: "Select a route"
4244
4315
  },
4245
4316
  components: {
4246
- Input: async () => import("./RoutePicker-IRZiHKFi.mjs").then((module) => ({
4317
+ Input: async () => import("./RoutePicker-CgndSXoF.mjs").then((module) => ({
4247
4318
  default: module.default
4248
4319
  }))
4249
4320
  },
@@ -4286,7 +4357,7 @@ const index = {
4286
4357
  return Promise.all(
4287
4358
  locales.map(async (locale) => {
4288
4359
  try {
4289
- const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/de.json": () => import("./de-BFjenpyN.mjs"), "./translations/en.json": () => import("./en-CGCh9ld_.mjs") }), `./translations/${locale}.json`, 3);
4360
+ const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/de.json": () => import("./de-DWs5ckOd.mjs"), "./translations/en.json": () => import("./en-CyhISGZi.mjs") }), `./translations/${locale}.json`, 3);
4290
4361
  return { data, locale };
4291
4362
  } catch {
4292
4363
  return { data: {}, locale };
@@ -4309,5 +4380,6 @@ export {
4309
4380
  isAbortError as i,
4310
4381
  index as j,
4311
4382
  pluginPermissions as p,
4383
+ transformToUrl as t,
4312
4384
  useApi as u
4313
4385
  };
@@ -1,26 +1,51 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useState, useEffect, useReducer, useRef, useMemo } from "react";
3
- import { Box, Accordion, Field, SingleSelect, SingleSelectOption, Grid, Typography, Link } from "@strapi/design-system";
4
- import { useNotification, Page } from "@strapi/strapi/admin";
5
- import { g as getTranslation, T as Tooltip, c as usePluginConfig, e as useAllContentTypes, p as pluginPermissions, f as PLUGIN_NAME, h as PLUGIN_VERSION } from "./index-ByxM39aL.mjs";
6
- import { W as WarningBox, u as useAllEntities } from "./WarningBox-CXEmXfVx.mjs";
3
+ import { Typography, Box, Accordion, Field, SingleSelect, SingleSelectOption, Grid, Link } from "@strapi/design-system";
4
+ import { useNotification, useRBAC, Page } from "@strapi/strapi/admin";
5
+ import { u as useApi, i as isAbortError, g as getTranslation, T as Tooltip, c as usePluginConfig, e as useAllContentTypes, p as pluginPermissions, f as PLUGIN_NAME, h as PLUGIN_VERSION } from "./index-BKhrfzjO.mjs";
7
6
  import { u as useErrorMessage, F as FullLoader } from "./FullLoader-BTZzPY8g.mjs";
8
7
  import { useIntl } from "react-intl";
9
8
  import "@strapi/icons/symbols";
10
9
  import { ExternalLink } from "@strapi/icons";
11
- import { P as PageWrapper, C as ContentBox, S as SettingTitle } from "./SettingTitle-0mKlA80i.mjs";
10
+ import { P as PageWrapper, C as ContentBox } from "./ContentBox-KyQN2KGV.mjs";
11
+ import { W as WarningBox } from "./WarningBox-AyYq0Onj.mjs";
12
12
  function getRouteSourceFields(contentType) {
13
13
  if (!contentType?.attributes) return [];
14
14
  return Object.entries(contentType.attributes).filter(
15
15
  ([key, attribute]) => attribute.type === "string" && key !== "documentId"
16
16
  );
17
17
  }
18
+ const useAllEntities = () => {
19
+ const { fetchAllEntities } = useApi();
20
+ const [entities, setEntities] = useState([]);
21
+ const [loading, setLoading] = useState(true);
22
+ const [error, setError] = useState(null);
23
+ useEffect(() => {
24
+ const fetchEntities = async () => {
25
+ try {
26
+ const result = await fetchAllEntities();
27
+ setEntities(result);
28
+ setLoading(false);
29
+ } catch (err) {
30
+ if (isAbortError(err)) return;
31
+ setError(err);
32
+ setLoading(false);
33
+ }
34
+ };
35
+ fetchEntities();
36
+ }, []);
37
+ return { entities, loading, error };
38
+ };
39
+ function SettingTitle({ children }) {
40
+ return /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", children });
41
+ }
18
42
  function ContentTypeAccordion({
19
43
  contentType,
20
44
  contentTypeSettings,
21
45
  dispatch,
22
46
  allGroupedEntities,
23
- entitiesLoading
47
+ entitiesLoading,
48
+ disabled
24
49
  }) {
25
50
  const { formatMessage } = useIntl();
26
51
  const [selectedContentType, setSelectedContentType] = useState(null);
@@ -107,7 +132,7 @@ function ContentTypeAccordion({
107
132
  type: "SET_DEFAULT_FIELD",
108
133
  payload: { ctUid: contentType.uid, field: String(value) }
109
134
  }),
110
- disabled: filteredAttributes.length === 0,
135
+ disabled: disabled || filteredAttributes.length === 0,
111
136
  children: filteredAttributes.map(([key], index) => {
112
137
  return /* @__PURE__ */ jsx(SingleSelectOption, { value: key, children: key }, index);
113
138
  })
@@ -164,6 +189,7 @@ function ContentTypeAccordion({
164
189
  ),
165
190
  defaultMessage: "Select a content type"
166
191
  }),
192
+ disabled,
167
193
  children: allGroupedEntities.map((groupedEntity) => {
168
194
  return /* @__PURE__ */ jsx(
169
195
  SingleSelectOption,
@@ -196,7 +222,7 @@ function ContentTypeAccordion({
196
222
  type: "SET_DEFAULT_PARENT_ROUTE",
197
223
  payload: { ctUid: contentType.uid, parentRoute: String(value) }
198
224
  }),
199
- disabled: !selectedContentType || selectedContentType.entities.length === 0 || !selectedContentType.contentType.routeSourceField,
225
+ disabled: disabled || !selectedContentType || selectedContentType.entities.length === 0 || !selectedContentType.contentType.routeSourceField,
200
226
  children: selectedContentType?.entities.map((entity) => {
201
227
  if (!selectedContentType.contentType.routeSourceField) return null;
202
228
  return /* @__PURE__ */ jsx(SingleSelectOption, { value: entity.documentId, children: entity[selectedContentType.contentType.routeSourceField] }, entity.documentId);
@@ -251,6 +277,10 @@ const Settings = () => {
251
277
  const [blacklistInput, setBlacklistInput] = useState("");
252
278
  const initialConfig = useRef(fetchedConfig);
253
279
  const { entities, loading: entitiesLoading, error: entitiesError } = useAllEntities();
280
+ const {
281
+ isLoading: isLoadingPermissions,
282
+ allowedActions: { canUpdate }
283
+ } = useRBAC(pluginPermissions["settings.general.update"]);
254
284
  const selectableEntities = useMemo(
255
285
  () => entities.filter(
256
286
  (groupedEntity) => config?.selectedContentTypes.some(
@@ -329,7 +359,7 @@ const Settings = () => {
329
359
  console.error(err);
330
360
  }
331
361
  }
332
- if (loading) {
362
+ if (loading || isLoadingPermissions) {
333
363
  return /* @__PURE__ */ jsx(
334
364
  PageWrapper,
335
365
  {
@@ -343,10 +373,10 @@ const Settings = () => {
343
373
  }
344
374
  );
345
375
  }
346
- return /* @__PURE__ */ jsx(Page.Protect, { permissions: pluginPermissions["settings.general"], children: /* @__PURE__ */ jsxs(
376
+ return /* @__PURE__ */ jsx(Page.Protect, { permissions: pluginPermissions["settings.general.read"], children: /* @__PURE__ */ jsxs(
347
377
  PageWrapper,
348
378
  {
349
- save,
379
+ save: canUpdate ? save : void 0,
350
380
  isSaving,
351
381
  subtitle: formatMessage({
352
382
  id: getTranslation("settings.page.general.subtitle"),
@@ -378,7 +408,8 @@ const Settings = () => {
378
408
  contentTypeSettings,
379
409
  dispatch,
380
410
  allGroupedEntities: selectableEntities,
381
- entitiesLoading
411
+ entitiesLoading,
412
+ disabled: !canUpdate
382
413
  },
383
414
  contentTypeSettings.uid
384
415
  );
@@ -423,6 +454,7 @@ const Settings = () => {
423
454
  defaultMessage: "Enter comma-separated URL segments to block"
424
455
  }),
425
456
  value: blacklistInput,
457
+ disabled: !canUpdate,
426
458
  onChange: (e) => setBlacklistInput(e.target.value),
427
459
  onBlur: () => {
428
460
  const blacklist = blacklistInput.split(",").map((s) => s.trim().toLowerCase().replace(/^\/+/, "").replace(/\/+$/, "")).filter(Boolean);