@mattisvensson/strapi-plugin-webatlas 0.11.0 → 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 (52) hide show
  1. package/README.md +14 -8
  2. package/dist/admin/{FullLoader-CrPED_dY.mjs → FullLoader-Btjb2W2p.mjs} +5 -2
  3. package/dist/admin/FullLoader-Btjb2W2p.mjs.map +1 -0
  4. package/dist/admin/{FullLoader-Cmsf8xS6.js → FullLoader-Da2n70bJ.js} +5 -2
  5. package/dist/admin/FullLoader-Da2n70bJ.js.map +1 -0
  6. package/dist/admin/{SettingTitle-BjE_2u6R.js → SettingTitle-B0quw3f8.js} +6 -3
  7. package/dist/admin/SettingTitle-B0quw3f8.js.map +1 -0
  8. package/dist/admin/{SettingTitle-B1IaU3qs.mjs → SettingTitle-HMfQOJnK.mjs} +6 -3
  9. package/dist/admin/SettingTitle-HMfQOJnK.mjs.map +1 -0
  10. package/dist/admin/{index-Cf9j0bn2.mjs → index-9_HhKDUC.mjs} +32 -59
  11. package/dist/admin/index-9_HhKDUC.mjs.map +1 -0
  12. package/dist/admin/{index-DCYCtKrj.mjs → index-B79ELMEC.mjs} +221 -215
  13. package/dist/admin/index-B79ELMEC.mjs.map +1 -0
  14. package/dist/admin/{index-JLpXBQVL.js → index-BEVoxEAm.js} +32 -59
  15. package/dist/admin/index-BEVoxEAm.js.map +1 -0
  16. package/dist/admin/index-Bmg-ERct.mjs +244 -0
  17. package/dist/admin/index-Bmg-ERct.mjs.map +1 -0
  18. package/dist/admin/{index-AVI3QJ0R.js → index-C8YjuuOx.js} +497 -354
  19. package/dist/admin/index-C8YjuuOx.js.map +1 -0
  20. package/dist/admin/{index-Yq-QR8t0.js → index-Cx_mktdk.js} +221 -215
  21. package/dist/admin/index-Cx_mktdk.js.map +1 -0
  22. package/dist/admin/{index-BbnlyBrZ.mjs → index-Cz_k_jjp.mjs} +42 -31
  23. package/dist/admin/index-Cz_k_jjp.mjs.map +1 -0
  24. package/dist/admin/{index-D8bG0YFB.js → index-D2hB1vTw.js} +42 -31
  25. package/dist/admin/index-D2hB1vTw.js.map +1 -0
  26. package/dist/admin/index-YdWxpvOH.js +244 -0
  27. package/dist/admin/index-YdWxpvOH.js.map +1 -0
  28. package/dist/admin/{index-BIEUXWe7.mjs → index-oEJT_mvw.mjs} +497 -354
  29. package/dist/admin/index-oEJT_mvw.mjs.map +1 -0
  30. package/dist/admin/index.js +1 -1
  31. package/dist/admin/index.mjs +1 -1
  32. package/dist/server/index.js +273 -214
  33. package/dist/server/index.js.map +1 -1
  34. package/dist/server/index.mjs +273 -214
  35. package/dist/server/index.mjs.map +1 -1
  36. package/package.json +108 -108
  37. package/dist/admin/FullLoader-Cmsf8xS6.js.map +0 -1
  38. package/dist/admin/FullLoader-CrPED_dY.mjs.map +0 -1
  39. package/dist/admin/SettingTitle-B1IaU3qs.mjs.map +0 -1
  40. package/dist/admin/SettingTitle-BjE_2u6R.js.map +0 -1
  41. package/dist/admin/index-AVI3QJ0R.js.map +0 -1
  42. package/dist/admin/index-B90eSO4a.js +0 -219
  43. package/dist/admin/index-B90eSO4a.js.map +0 -1
  44. package/dist/admin/index-BIEUXWe7.mjs.map +0 -1
  45. package/dist/admin/index-BbnlyBrZ.mjs.map +0 -1
  46. package/dist/admin/index-Cf9j0bn2.mjs.map +0 -1
  47. package/dist/admin/index-D8bG0YFB.js.map +0 -1
  48. package/dist/admin/index-DCYCtKrj.mjs.map +0 -1
  49. package/dist/admin/index-JLpXBQVL.js.map +0 -1
  50. package/dist/admin/index-Y_PYIiRA.mjs +0 -219
  51. package/dist/admin/index-Y_PYIiRA.mjs.map +0 -1
  52. package/dist/admin/index-Yq-QR8t0.js.map +0 -1
@@ -25,10 +25,10 @@ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
25
25
  };
26
26
  function transformToUrl(input, replaceSlash = true) {
27
27
  const specialCharMap = {
28
- "ü": "ue",
29
- "ä": "ae",
30
- "ö": "oe",
31
- "ß": "ss"
28
+ ü: "ue",
29
+ ä: "ae",
30
+ ö: "oe",
31
+ ß: "ss"
32
32
  };
33
33
  if (!input || typeof input !== "string") return "";
34
34
  input = input.toLowerCase();
@@ -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.11.0";
55
+ const version = "0.11.1";
56
56
  const strapi$1 = { "name": "webatlas", "displayName": "Webatlas" };
57
57
  const pluginPkg = {
58
58
  version,
@@ -107,7 +107,9 @@ function useApi() {
107
107
  const entityResults = await Promise.allSettled(
108
108
  contentTypes.map(async (contentType) => {
109
109
  try {
110
- const { data: data2 } = await get(`/content-manager/collection-types/${contentType.uid}?pageSize=9999`);
110
+ const { data: data2 } = await get(
111
+ `/content-manager/collection-types/${contentType.uid}?pageSize=9999`
112
+ );
111
113
  if (!data2 || !data2.results) {
112
114
  return null;
113
115
  }
@@ -141,14 +143,21 @@ function useApi() {
141
143
  return data;
142
144
  };
143
145
  const getProhibitedRouteIds = async (documentId) => {
144
- const { data } = await get(`/${PLUGIN_ID}/route/prohibitedIds/${documentId ? `${documentId}` : ""}`);
146
+ const { data } = await get(
147
+ `/${PLUGIN_ID}/route/prohibitedIds/${documentId ? `${documentId}` : ""}`
148
+ );
145
149
  return data;
146
150
  };
147
- const getNavigation = async ({ documentId, variant } = {}) => {
151
+ const getNavigation = async ({
152
+ documentId,
153
+ variant
154
+ } = {}) => {
148
155
  const query = [];
149
156
  if (documentId) query.push(`documentId=${documentId}`);
150
157
  if (variant) query.push(`variant=${variant}`);
151
- const { data } = await get(`/${PLUGIN_ID}/navigation${query.length > 0 ? `?${query.join("&")}` : ""}`);
158
+ const { data } = await get(
159
+ `/${PLUGIN_ID}/navigation${query.length > 0 ? `?${query.join("&")}` : ""}`
160
+ );
152
161
  return data;
153
162
  };
154
163
  const createNavigation = async (body) => {
@@ -219,7 +228,9 @@ function usePluginConfig() {
219
228
  setLoading(true);
220
229
  setFetchError(null);
221
230
  try {
222
- const { data: { data: contentTypesArray } } = await get("/content-manager/content-types");
231
+ const {
232
+ data: { data: contentTypesArray }
233
+ } = await get("/content-manager/content-types");
223
234
  let { data: config2 } = await get(`/${PLUGIN_ID}/config`);
224
235
  if (!config2 || !config2.selectedContentTypes) {
225
236
  throw new Error(`Couldn't fetch plugin config`);
@@ -228,7 +239,9 @@ function usePluginConfig() {
228
239
  (type) => type.pluginOptions?.webatlas?.enabled === true
229
240
  );
230
241
  const contentTypeUids = new Set(allowedContentTypes.map((type) => type.uid));
231
- const activeContentTypes = config2.selectedContentTypes.filter((type) => contentTypeUids.has(type.uid));
242
+ const activeContentTypes = config2.selectedContentTypes.filter(
243
+ (type) => contentTypeUids.has(type.uid)
244
+ );
232
245
  const displayConfig = {
233
246
  ...config2,
234
247
  selectedContentTypes: activeContentTypes
@@ -271,7 +284,9 @@ async function duplicateCheck({
271
284
  if (!path) throw new Error("URL is required");
272
285
  try {
273
286
  const pathToCheck = withoutTransform ? path : transformToUrl(path);
274
- const { data } = await fetchFunction(`/${PLUGIN_ID}/checkUniquePath?path=${pathToCheck}${routeDocumentId ? `&targetRouteDocumentId=${routeDocumentId}` : ""}`);
287
+ const { data } = await fetchFunction(
288
+ `/${PLUGIN_ID}/checkUniquePath?path=${pathToCheck}${routeDocumentId ? `&targetRouteDocumentId=${routeDocumentId}` : ""}`
289
+ );
275
290
  if (!data.uniquePath) {
276
291
  throw new Error("Network response was not ok");
277
292
  }
@@ -289,45 +304,42 @@ function PathInfo({ validationState, replacement }) {
289
304
  if (validationState === "initial") return;
290
305
  if (validationState === "checking") {
291
306
  setColor("neutral800");
292
- setText(formatMessage({
293
- id: getTranslation("components.pathInfo.checking"),
294
- defaultMessage: "Checking if path is available..."
295
- }));
307
+ setText(
308
+ formatMessage({
309
+ id: getTranslation("components.pathInfo.checking"),
310
+ defaultMessage: "Checking if path is available..."
311
+ })
312
+ );
296
313
  } else if (validationState === "done") {
297
314
  setColor(replacement ? "danger500" : "success500");
298
- setText(replacement ? `${formatMessage({
299
- id: getTranslation("components.pathInfo.notAvailable"),
300
- defaultMessage: "Path is not available. Replaced with"
301
- })} "${replacement}".` : formatMessage({
302
- id: getTranslation("components.pathInfo.available"),
303
- defaultMessage: "Path is available."
304
- }));
315
+ setText(
316
+ replacement ? `${formatMessage({
317
+ id: getTranslation("components.pathInfo.notAvailable"),
318
+ defaultMessage: "Path is not available. Replaced with"
319
+ })} "${replacement}".` : formatMessage({
320
+ id: getTranslation("components.pathInfo.available"),
321
+ defaultMessage: "Path is available."
322
+ })
323
+ );
305
324
  }
306
325
  }, [validationState, replacement, formatMessage]);
307
326
  return /* @__PURE__ */ jsx(Box, { paddingTop: 1, children: /* @__PURE__ */ jsx(Typography, { textColor: color, children: text }) });
308
327
  }
309
328
  function OverrideCheckbox({ isOverride, setIsOverride, disabledCondition }) {
310
329
  const { formatMessage } = useIntl();
311
- return /* @__PURE__ */ jsx(
312
- Flex,
330
+ return /* @__PURE__ */ jsx(Flex, { gap: 2, paddingTop: 2, children: /* @__PURE__ */ jsx(
331
+ Checkbox,
313
332
  {
314
- gap: 2,
315
- paddingTop: 2,
316
- children: /* @__PURE__ */ jsx(
317
- Checkbox,
318
- {
319
- id: "path-override-checkbox",
320
- checked: isOverride,
321
- onCheckedChange: () => setIsOverride(!isOverride),
322
- disabled: disabledCondition,
323
- children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral600", children: formatMessage({
324
- id: getTranslation("components.CMEditViewAside.path.overrideCheckbox"),
325
- defaultMessage: "Override automatic path generation"
326
- }) })
327
- }
328
- )
333
+ id: "path-override-checkbox",
334
+ checked: isOverride,
335
+ onCheckedChange: () => setIsOverride(!isOverride),
336
+ disabled: disabledCondition,
337
+ children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral600", children: formatMessage({
338
+ id: getTranslation("components.CMEditViewAside.path.overrideCheckbox"),
339
+ defaultMessage: "Override automatic path generation"
340
+ }) })
329
341
  }
330
- );
342
+ ) });
331
343
  }
332
344
  function NewPathInfo() {
333
345
  const { formatMessage } = useIntl();
@@ -346,13 +358,7 @@ function UidPathDisplay({ path }) {
346
358
  defaultMessage: "Permanent UID path, cannot be changed"
347
359
  }),
348
360
  children: [
349
- /* @__PURE__ */ jsx(
350
- Field.Input,
351
- {
352
- value: path,
353
- disabled: true
354
- }
355
- ),
361
+ /* @__PURE__ */ jsx(Field.Input, { value: path, disabled: true }),
356
362
  /* @__PURE__ */ jsx(Field.Hint, {})
357
363
  ]
358
364
  }
@@ -3680,10 +3686,15 @@ function PathInput({ path, dispatchPath, isOverride, config }) {
3680
3686
  id: getTranslation("components.CMEditViewAside.path.input.label"),
3681
3687
  defaultMessage: "Path"
3682
3688
  }),
3683
- /* @__PURE__ */ jsx(Tooltip, { description: formatMessage({
3684
- id: getTranslation("components.CMEditViewAside.path.input.tooltip"),
3685
- defaultMessage: "The following characters are valid: A-Z, a-z, 0-9, /, -, _, $, ., +, !, *, ', (, )"
3686
- }) })
3689
+ /* @__PURE__ */ jsx(
3690
+ Tooltip,
3691
+ {
3692
+ description: formatMessage({
3693
+ id: getTranslation("components.CMEditViewAside.path.input.tooltip"),
3694
+ defaultMessage: "The following characters are valid: A-Z, a-z, 0-9, /, -, _, $, ., +, !, *, ', (, )"
3695
+ })
3696
+ }
3697
+ )
3687
3698
  ] }),
3688
3699
  /* @__PURE__ */ jsx(
3689
3700
  Field.Input,
@@ -3692,7 +3703,10 @@ function PathInput({ path, dispatchPath, isOverride, config }) {
3692
3703
  value: displayedPath,
3693
3704
  onChange: (e) => dispatchPath({ type: "SET_OVERRIDEPATH", payload: e.target.value }),
3694
3705
  disabled: !isOverride,
3695
- onBlur: (e) => dispatchPath({ type: "SET_OVERRIDEPATH", payload: transformToUrl(e.target.value) }),
3706
+ onBlur: (e) => dispatchPath({
3707
+ type: "SET_OVERRIDEPATH",
3708
+ payload: transformToUrl(e.target.value, false)
3709
+ }),
3696
3710
  style: { outline: inputBorder }
3697
3711
  }
3698
3712
  ),
@@ -3710,7 +3724,9 @@ function RouteStructure({
3710
3724
  }) {
3711
3725
  const { formatMessage } = useIntl();
3712
3726
  const filteredRoutes = useMemo(() => {
3713
- return [...routes].sort((a, b) => a.title.localeCompare(b.title)).filter((route) => !prohibitedRouteIds?.includes(route.documentId) || route.documentId === selectedParent?.documentId);
3727
+ return [...routes].sort((a, b) => a.title.localeCompare(b.title)).filter(
3728
+ (route) => !prohibitedRouteIds?.includes(route.documentId) || route.documentId === selectedParent?.documentId
3729
+ );
3714
3730
  }, [routes, prohibitedRouteIds, selectedParent]);
3715
3731
  const handleSelectParent = (value) => {
3716
3732
  const parentRoute = routes.find((route) => route.documentId === value) || null;
@@ -3722,27 +3738,13 @@ function RouteStructure({
3722
3738
  id: getTranslation("components.CMEditViewAside.path.input.parentSelect.label"),
3723
3739
  defaultMessage: "Place under"
3724
3740
  }) }),
3725
- /* @__PURE__ */ jsxs(
3726
- SingleSelect,
3727
- {
3728
- value: selectedParent?.documentId || "",
3729
- onValueChange: handleSelectParent,
3730
- children: [
3731
- /* @__PURE__ */ jsx(SingleSelectOption, { value: "", children: formatMessage({
3732
- id: getTranslation("components.CMEditViewAside.path.input.parentSelect.rootPath"),
3733
- defaultMessage: "None (root path)"
3734
- }) }),
3735
- filteredRoutes.map((route) => /* @__PURE__ */ jsx(
3736
- SingleSelectOption,
3737
- {
3738
- value: route.documentId,
3739
- children: route.title
3740
- },
3741
- route.documentId
3742
- ))
3743
- ]
3744
- }
3745
- )
3741
+ /* @__PURE__ */ jsxs(SingleSelect, { value: selectedParent?.documentId || "", onValueChange: handleSelectParent, children: [
3742
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "", children: formatMessage({
3743
+ id: getTranslation("components.CMEditViewAside.path.input.parentSelect.rootPath"),
3744
+ defaultMessage: "None (root path)"
3745
+ }) }),
3746
+ filteredRoutes.map((route) => /* @__PURE__ */ jsx(SingleSelectOption, { value: route.documentId, children: route.title }, route.documentId))
3747
+ ] })
3746
3748
  ] }),
3747
3749
  /* @__PURE__ */ jsxs(Field.Root, { marginTop: 4, children: [
3748
3750
  /* @__PURE__ */ jsxs(Field.Label, { children: [
@@ -3750,19 +3752,17 @@ function RouteStructure({
3750
3752
  id: getTranslation("components.CMEditViewAside.canonicalPath.input.label"),
3751
3753
  defaultMessage: "Canonical Path"
3752
3754
  }),
3753
- /* @__PURE__ */ jsx(Tooltip, { description: formatMessage({
3754
- id: getTranslation("components.CMEditViewAside.canonicalPath.input.tooltip"),
3755
- defaultMessage: "The path determined by your content's natural hierarchy, independent of where it appears in navigation menus."
3756
- }) })
3755
+ /* @__PURE__ */ jsx(
3756
+ Tooltip,
3757
+ {
3758
+ description: formatMessage({
3759
+ id: getTranslation("components.CMEditViewAside.canonicalPath.input.tooltip"),
3760
+ defaultMessage: "The path determined by your content's natural hierarchy, independent of where it appears in navigation menus."
3761
+ })
3762
+ }
3763
+ )
3757
3764
  ] }),
3758
- /* @__PURE__ */ jsx(
3759
- Field.Input,
3760
- {
3761
- id: "canonicalPath-input",
3762
- value: canonicalPath,
3763
- disabled: true
3764
- }
3765
- ),
3765
+ /* @__PURE__ */ jsx(Field.Input, { id: "canonicalPath-input", value: canonicalPath, disabled: true }),
3766
3766
  /* @__PURE__ */ jsx(Field.Hint, {})
3767
3767
  ] })
3768
3768
  ] });
@@ -3817,10 +3817,9 @@ const Panel = ({ config }) => {
3817
3817
  const { getRelatedRoute, getAllRoutes, getProhibitedRouteIds } = useApi();
3818
3818
  const { formatMessage } = useIntl();
3819
3819
  const { get } = useFetchClient();
3820
- const { allowedActions: {
3821
- canUpdate,
3822
- canCreate
3823
- } } = useRBAC([
3820
+ const {
3821
+ allowedActions: { canUpdate, canCreate }
3822
+ } = useRBAC([
3824
3823
  {
3825
3824
  action: "plugin::content-manager.explorer.update",
3826
3825
  subject: model,
@@ -3859,10 +3858,14 @@ const Panel = ({ config }) => {
3859
3858
  const initialSourceFieldValue = initialValues[config?.default] || "";
3860
3859
  const latestCheckPathRef = useRef(checkPath);
3861
3860
  latestCheckPathRef.current = checkPath;
3862
- const debouncedCheckPath = useRef(debounce((p, id) => latestCheckPathRef.current(p, id), 250)).current;
3861
+ const debouncedCheckPath = useRef(
3862
+ debounce((p, id) => latestCheckPathRef.current(p, id), 250)
3863
+ ).current;
3863
3864
  const latestCheckCanonicalRef = useRef(checkCanonicalPath);
3864
3865
  latestCheckCanonicalRef.current = checkCanonicalPath;
3865
- const debouncedCheckCanonicalPath = useRef(debounce((p, id) => latestCheckCanonicalRef.current(p, id), 250)).current;
3866
+ const debouncedCheckCanonicalPath = useRef(
3867
+ debounce((p, id) => latestCheckCanonicalRef.current(p, id), 250)
3868
+ ).current;
3866
3869
  useEffect(() => {
3867
3870
  async function fetchAllRoutes() {
3868
3871
  const allRoutes = await getAllRoutes();
@@ -3882,7 +3885,15 @@ const Panel = ({ config }) => {
3882
3885
  if (hasUserChangedField.current || hasUserInteracted.current) {
3883
3886
  onChange("webatlas", data);
3884
3887
  }
3885
- }, [path.value, path.overridePath, isOverride, selectedParent, sourceFieldValue, hasUserChangedField, hasUserInteracted]);
3888
+ }, [
3889
+ path.value,
3890
+ path.overridePath,
3891
+ isOverride,
3892
+ selectedParent,
3893
+ sourceFieldValue,
3894
+ hasUserChangedField,
3895
+ hasUserInteracted
3896
+ ]);
3886
3897
  useEffect(() => {
3887
3898
  if (!initialLoadComplete) return;
3888
3899
  if (sourceFieldValue !== initialSourceFieldValue) {
@@ -3904,7 +3915,14 @@ const Panel = ({ config }) => {
3904
3915
  const canonicalPath = buildPath("canonical", sourceFieldValue, selectedParent);
3905
3916
  dispatchPath({ type: "SET_CANONICALPATH", payload: canonicalPath });
3906
3917
  debouncedCheckCanonicalPath(canonicalPath, route?.documentId || null);
3907
- }, [sourceFieldValue, initialSourceFieldValue, initialLoadComplete, selectedParent, isOverride, route]);
3918
+ }, [
3919
+ sourceFieldValue,
3920
+ initialSourceFieldValue,
3921
+ initialLoadComplete,
3922
+ selectedParent,
3923
+ isOverride,
3924
+ route
3925
+ ]);
3908
3926
  useEffect(() => {
3909
3927
  if (!initialLoadComplete) return;
3910
3928
  if (path.needsUrlCheck && path.value) {
@@ -3925,14 +3943,20 @@ const Panel = ({ config }) => {
3925
3943
  try {
3926
3944
  const route2 = await getRelatedRoute(initialValues.documentId);
3927
3945
  if (!route2) return;
3928
- initialPath.current = initialValues.webatlas_path || route2.uidPath;
3946
+ initialPath.current = initialValues.webatlas.path || route2.uidPath;
3929
3947
  setRoute(route2);
3930
3948
  setIsOverride(route2.isOverride || false);
3931
3949
  dispatchPath({ type: "SET_OVERRIDEPATH", payload: route2.path || "" });
3932
- dispatchPath({ type: "NO_TRANSFORM_AND_CHECK", payload: route2.path || "" });
3950
+ dispatchPath({
3951
+ type: "NO_TRANSFORM_AND_CHECK",
3952
+ payload: route2.path || ""
3953
+ });
3933
3954
  dispatchPath({ type: "SET_UIDPATH", payload: route2.uidPath || "" });
3934
3955
  dispatchPath({ type: "SET_SLUG", payload: route2.slug || "" });
3935
- dispatchPath({ type: "SET_CANONICALPATH", payload: route2.canonicalPath || "" });
3956
+ dispatchPath({
3957
+ type: "SET_CANONICALPATH",
3958
+ payload: route2.canonicalPath || ""
3959
+ });
3936
3960
  const key = config?.default;
3937
3961
  if (key) {
3938
3962
  prevSourceValueRef.current = values[key];
@@ -3947,7 +3971,9 @@ const Panel = ({ config }) => {
3947
3971
  }, [config]);
3948
3972
  useEffect(() => {
3949
3973
  if (!route || !routes.length) return;
3950
- const parentRoute = routes.find((singleRoute) => singleRoute.documentId === route.parent?.documentId);
3974
+ const parentRoute = routes.find(
3975
+ (singleRoute) => singleRoute.documentId === route.parent?.documentId
3976
+ );
3951
3977
  setSelectedParent(parentRoute || null);
3952
3978
  }, [route, routes]);
3953
3979
  useEffect(() => {
@@ -3958,16 +3984,20 @@ const Panel = ({ config }) => {
3958
3984
  fetchProhibitedRouteIds();
3959
3985
  }, [route]);
3960
3986
  useEffect(() => {
3961
- if (!sourceFieldValue) return;
3962
- if (!isOverride) {
3963
- const newPath = buildPath("path", sourceFieldValue, selectedParent);
3964
- dispatchPath({ type: "DEFAULT", payload: newPath });
3965
- }
3987
+ if (!sourceFieldValue || isOverride || !hasUserChangedField.current && !hasUserInteracted.current)
3988
+ return;
3989
+ const newPath = buildPath("path", sourceFieldValue, selectedParent);
3990
+ dispatchPath({ type: "DEFAULT", payload: newPath });
3966
3991
  }, [selectedParent, sourceFieldValue, route, isOverride]);
3967
3992
  async function checkCanonicalPath(path2, routeDocumentId) {
3968
3993
  if (!path2) return;
3969
3994
  try {
3970
- const result = await duplicateCheck({ fetchFunction: get, path: path2, routeDocumentId, withoutTransform: true });
3995
+ const result = await duplicateCheck({
3996
+ fetchFunction: get,
3997
+ path: path2,
3998
+ routeDocumentId,
3999
+ withoutTransform: true
4000
+ });
3971
4001
  dispatchPath({ type: "SET_CANONICALPATH", payload: result });
3972
4002
  } catch (err) {
3973
4003
  strapi.log.error(err);
@@ -3978,7 +4008,12 @@ const Panel = ({ config }) => {
3978
4008
  setValidationState("checking");
3979
4009
  dispatchPath({ type: "SET_REPLACEMENT", payload: "" });
3980
4010
  try {
3981
- const data = await duplicateCheck({ fetchFunction: get, path: path2, routeDocumentId, withoutTransform: true });
4011
+ const data = await duplicateCheck({
4012
+ fetchFunction: get,
4013
+ path: path2,
4014
+ routeDocumentId,
4015
+ withoutTransform: true
4016
+ });
3982
4017
  if (!data || data === path2) return;
3983
4018
  dispatchPath({ type: "NO_URL_CHECK", payload: data });
3984
4019
  dispatchPath({ type: "SET_REPLACEMENT", payload: data });
@@ -3988,79 +4023,58 @@ const Panel = ({ config }) => {
3988
4023
  setValidationState("done");
3989
4024
  }
3990
4025
  }
3991
- if (!initialLoadComplete) return /* @__PURE__ */ jsx(Typography, { textColor: "neutral600", children: formatMessage({
3992
- id: getTranslation("loading"),
3993
- defaultMessage: "Loading..."
3994
- }) });
3995
- return /* @__PURE__ */ jsx(
3996
- Box,
3997
- {
3998
- tag: "aside",
3999
- "aria-labelledby": "URL Route",
4000
- width: "100%",
4001
- children: /* @__PURE__ */ jsxs(
4002
- Flex,
4026
+ if (!initialLoadComplete)
4027
+ return /* @__PURE__ */ jsx(Typography, { textColor: "neutral600", children: formatMessage({
4028
+ id: getTranslation("loading"),
4029
+ defaultMessage: "Loading..."
4030
+ }) });
4031
+ return /* @__PURE__ */ jsx(Box, { tag: "aside", "aria-labelledby": "URL Route", width: "100%", children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 1, children: [
4032
+ !route && /* @__PURE__ */ jsxs(Fragment$1, { children: [
4033
+ /* @__PURE__ */ jsx(NewPathInfo, {}),
4034
+ /* @__PURE__ */ jsx(Divider, { marginTop: 2, marginBottom: 2 })
4035
+ ] }),
4036
+ /* @__PURE__ */ jsx(
4037
+ RouteStructure,
4038
+ {
4039
+ canonicalPath: path.canonicalPath,
4040
+ routes,
4041
+ selectedParent,
4042
+ setSelectedParent: (val) => {
4043
+ hasUserInteracted.current = true;
4044
+ setSelectedParent(val);
4045
+ },
4046
+ prohibitedRouteIds
4047
+ }
4048
+ ),
4049
+ /* @__PURE__ */ jsx(Divider, { marginTop: 2, marginBottom: 2 }),
4050
+ /* @__PURE__ */ jsxs(Box, { children: [
4051
+ /* @__PURE__ */ jsx(
4052
+ PathInput,
4003
4053
  {
4004
- direction: "column",
4005
- alignItems: "stretch",
4006
- gap: 1,
4007
- children: [
4008
- !route && /* @__PURE__ */ jsxs(Fragment$1, { children: [
4009
- /* @__PURE__ */ jsx(NewPathInfo, {}),
4010
- /* @__PURE__ */ jsx(Divider, { marginTop: 2, marginBottom: 2 })
4011
- ] }),
4012
- /* @__PURE__ */ jsx(
4013
- RouteStructure,
4014
- {
4015
- canonicalPath: path.canonicalPath,
4016
- routes,
4017
- selectedParent,
4018
- setSelectedParent: (val) => {
4019
- hasUserInteracted.current = true;
4020
- setSelectedParent(val);
4021
- },
4022
- prohibitedRouteIds
4023
- }
4024
- ),
4025
- /* @__PURE__ */ jsx(Divider, { marginTop: 2, marginBottom: 2 }),
4026
- /* @__PURE__ */ jsxs(Box, { children: [
4027
- /* @__PURE__ */ jsx(
4028
- PathInput,
4029
- {
4030
- path,
4031
- dispatchPath,
4032
- isOverride,
4033
- config
4034
- }
4035
- ),
4036
- validationState !== "initial" && /* @__PURE__ */ jsx(
4037
- PathInfo,
4038
- {
4039
- validationState,
4040
- replacement: path.replacement
4041
- }
4042
- )
4043
- ] }),
4044
- /* @__PURE__ */ jsx(
4045
- OverrideCheckbox,
4046
- {
4047
- isOverride,
4048
- setIsOverride: (val) => {
4049
- hasUserInteracted.current = true;
4050
- setIsOverride(val);
4051
- },
4052
- disabledCondition: !canCreate && !canUpdate
4053
- }
4054
- ),
4055
- path.uidPath && /* @__PURE__ */ jsxs(Fragment$1, { children: [
4056
- /* @__PURE__ */ jsx(Divider, { marginTop: 2, marginBottom: 2 }),
4057
- /* @__PURE__ */ jsx(UidPathDisplay, { path: path.uidPath })
4058
- ] })
4059
- ]
4054
+ path,
4055
+ dispatchPath,
4056
+ isOverride,
4057
+ config
4060
4058
  }
4061
- )
4062
- }
4063
- );
4059
+ ),
4060
+ validationState !== "initial" && /* @__PURE__ */ jsx(PathInfo, { validationState, replacement: path.replacement })
4061
+ ] }),
4062
+ /* @__PURE__ */ jsx(
4063
+ OverrideCheckbox,
4064
+ {
4065
+ isOverride,
4066
+ setIsOverride: (val) => {
4067
+ hasUserInteracted.current = true;
4068
+ setIsOverride(val);
4069
+ },
4070
+ disabledCondition: !canCreate && !canUpdate
4071
+ }
4072
+ ),
4073
+ path.uidPath && /* @__PURE__ */ jsxs(Fragment$1, { children: [
4074
+ /* @__PURE__ */ jsx(Divider, { marginTop: 2, marginBottom: 2 }),
4075
+ /* @__PURE__ */ jsx(UidPathDisplay, { path: path.uidPath })
4076
+ ] })
4077
+ ] }) });
4064
4078
  };
4065
4079
  const pluginPermissions = {
4066
4080
  "cm.aside": [{ action: `plugin::${PLUGIN_ID}.cm.aside`, subject: null }],
@@ -4069,7 +4083,7 @@ const pluginPermissions = {
4069
4083
  "settings.general": [{ action: `plugin::${PLUGIN_ID}.settings.general`, subject: null }],
4070
4084
  "settings.navigation": [{ action: `plugin::${PLUGIN_ID}.settings.navigation`, subject: null }]
4071
4085
  };
4072
- const CMEditViewAside = ({ documentId, model }) => {
4086
+ const CMEditViewAside = ({ documentId, model, activeTab }) => {
4073
4087
  const { contentTypes } = useAllContentTypes();
4074
4088
  const { config } = usePluginConfig();
4075
4089
  const { formatMessage } = useIntl();
@@ -4092,7 +4106,9 @@ const CMEditViewAside = ({ documentId, model }) => {
4092
4106
  const parent = container?.parentElement;
4093
4107
  const greatGrandParent = parent?.parentElement?.parentElement;
4094
4108
  if (!container || !parent) return;
4095
- const parentWebatlasCount = Array.from(parent.querySelectorAll("label")).filter(isWebatlasLabel).length;
4109
+ const parentWebatlasCount = Array.from(parent.querySelectorAll("label")).filter(
4110
+ isWebatlasLabel
4111
+ ).length;
4096
4112
  const childrenCount = parent.children.length;
4097
4113
  if (greatGrandParent && greatGrandParent?.querySelectorAll("label").length === Array.from(greatGrandParent.querySelectorAll("label")).filter(isWebatlasLabel).length) {
4098
4114
  greatGrandParent.remove();
@@ -4109,7 +4125,7 @@ const CMEditViewAside = ({ documentId, model }) => {
4109
4125
  return () => clearTimeout(secondTimeoutId);
4110
4126
  }, 100);
4111
4127
  return () => clearTimeout(timeoutId);
4112
- }, [documentId, model]);
4128
+ }, [documentId, model, activeTab]);
4113
4129
  useEffect(() => {
4114
4130
  if (!config) return;
4115
4131
  setIsActiveContentType(false);
@@ -4132,13 +4148,14 @@ const CMEditViewAside = ({ documentId, model }) => {
4132
4148
  strapi.log.error("CMEditViewAside: Plugin is not configured.");
4133
4149
  return null;
4134
4150
  }
4135
- if (isLoading) return {
4136
- title: panelTitle,
4137
- content: /* @__PURE__ */ jsx(Typography, { textColor: "neutral600", children: formatMessage({
4138
- id: getTranslation("loading"),
4139
- defaultMessage: "Loading..."
4140
- }) })
4141
- };
4151
+ if (isLoading)
4152
+ return {
4153
+ title: panelTitle,
4154
+ content: /* @__PURE__ */ jsx(Typography, { textColor: "neutral600", children: formatMessage({
4155
+ id: getTranslation("loading"),
4156
+ defaultMessage: "Loading..."
4157
+ }) })
4158
+ };
4142
4159
  return {
4143
4160
  title: panelTitle,
4144
4161
  content: /* @__PURE__ */ jsx(Panel, { config: contentTypeConfig })
@@ -4153,10 +4170,8 @@ const index = {
4153
4170
  id: `${PLUGIN_ID}.link.paths`,
4154
4171
  defaultMessage: "Paths"
4155
4172
  },
4156
- Component: () => import("./index-Cf9j0bn2.mjs"),
4157
- permissions: [
4158
- pluginPermissions["page.routes"][0]
4159
- ]
4173
+ Component: () => import("./index-9_HhKDUC.mjs"),
4174
+ permissions: [pluginPermissions["page.routes"][0]]
4160
4175
  });
4161
4176
  app.addMenuLink({
4162
4177
  to: `plugins/${PLUGIN_ID}/navigation`,
@@ -4165,10 +4180,8 @@ const index = {
4165
4180
  id: `${PLUGIN_ID}.link.navigation`,
4166
4181
  defaultMessage: "Navigation"
4167
4182
  },
4168
- Component: () => import("./index-BIEUXWe7.mjs"),
4169
- permissions: [
4170
- pluginPermissions["page.navigation"][0]
4171
- ]
4183
+ Component: () => import("./index-oEJT_mvw.mjs"),
4184
+ permissions: [pluginPermissions["page.navigation"][0]]
4172
4185
  });
4173
4186
  app.addSettingsLink(
4174
4187
  {
@@ -4185,27 +4198,20 @@ const index = {
4185
4198
  },
4186
4199
  id: `${PLUGIN_ID}-general`,
4187
4200
  to: `${PLUGIN_ID}/general`,
4188
- Component: () => import("./index-Y_PYIiRA.mjs"),
4189
- permissions: [
4190
- pluginPermissions["settings.general"][0]
4191
- ]
4192
- }
4193
- );
4194
- app.addSettingsLink(
4195
- PLUGIN_ID,
4196
- {
4197
- intlLabel: {
4198
- id: `${PLUGIN_ID}.settings.navigation`,
4199
- defaultMessage: "Navigation"
4200
- },
4201
- id: `${PLUGIN_ID}-navigation`,
4202
- to: `${PLUGIN_ID}/navigation`,
4203
- Component: () => import("./index-BbnlyBrZ.mjs"),
4204
- permissions: [
4205
- pluginPermissions["settings.navigation"][0]
4206
- ]
4201
+ Component: () => import("./index-Bmg-ERct.mjs"),
4202
+ permissions: [pluginPermissions["settings.general"][0]]
4207
4203
  }
4208
4204
  );
4205
+ app.addSettingsLink(PLUGIN_ID, {
4206
+ intlLabel: {
4207
+ id: `${PLUGIN_ID}.settings.navigation`,
4208
+ defaultMessage: "Navigation"
4209
+ },
4210
+ id: `${PLUGIN_ID}-navigation`,
4211
+ to: `${PLUGIN_ID}/navigation`,
4212
+ Component: () => import("./index-Cz_k_jjp.mjs"),
4213
+ permissions: [pluginPermissions["settings.navigation"][0]]
4214
+ });
4209
4215
  app.registerPlugin({
4210
4216
  id: PLUGIN_ID,
4211
4217
  initializer: Initializer,
@@ -4244,4 +4250,4 @@ export {
4244
4250
  pluginPermissions as p,
4245
4251
  useApi as u
4246
4252
  };
4247
- //# sourceMappingURL=index-DCYCtKrj.mjs.map
4253
+ //# sourceMappingURL=index-B79ELMEC.mjs.map