@mattisvensson/strapi-plugin-webatlas 0.2.6 → 0.3.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 (53) hide show
  1. package/README.md +2 -3
  2. package/dist/_chunks/EmptyBox-7D4LrvdH.mjs.map +1 -0
  3. package/dist/_chunks/EmptyBox-DT6D5gcf.js.map +1 -0
  4. package/dist/_chunks/_baseConvert-B84_vf8X.js.map +1 -0
  5. package/dist/_chunks/_baseConvert-C2SW1VHq.mjs.map +1 -0
  6. package/dist/_chunks/de-4tL_cJTC.js +104 -0
  7. package/dist/_chunks/de-4tL_cJTC.js.map +1 -0
  8. package/dist/_chunks/de-C8PE3n3B.mjs +104 -0
  9. package/dist/_chunks/de-C8PE3n3B.mjs.map +1 -0
  10. package/dist/_chunks/en-Bg4z3fR7.js +104 -0
  11. package/dist/_chunks/en-Bg4z3fR7.js.map +1 -0
  12. package/dist/_chunks/en-CR1YZvJo.mjs +104 -0
  13. package/dist/_chunks/en-CR1YZvJo.mjs.map +1 -0
  14. package/dist/_chunks/{index-D4IHmUrH.js → index-B0XE_zRP.js} +298 -91
  15. package/dist/_chunks/index-B2Tiv3EK.mjs +92 -0
  16. package/dist/_chunks/index-B48CGofU.mjs +17170 -0
  17. package/dist/_chunks/index-B48CGofU.mjs.map +1 -0
  18. package/dist/_chunks/{index-DrlYDm6a.js → index-B85fJxGa.js} +165 -76
  19. package/dist/_chunks/{index-DIyVy-8D.js → index-BbM9Sn1t.js} +57 -17
  20. package/dist/_chunks/{index-B_RPO9ty.mjs → index-BocSkZOu.mjs} +57 -17
  21. package/dist/_chunks/{index-uoH_HJQr.mjs → index-C7B8QHDT.mjs} +296 -89
  22. package/dist/_chunks/{index-BMQSVj43.mjs → index-CCiDvLAC.mjs} +166 -77
  23. package/dist/_chunks/index-CXzNr2cH.mjs +93 -0
  24. package/dist/_chunks/index-CXzNr2cH.mjs.map +1 -0
  25. package/dist/_chunks/index-Cd6y6nuf.js +93 -0
  26. package/dist/_chunks/index-Cd6y6nuf.js.map +1 -0
  27. package/dist/_chunks/index-Cf9ZIBLd.js +4195 -0
  28. package/dist/_chunks/index-Cf9ZIBLd.js.map +1 -0
  29. package/dist/_chunks/index-D981K4TK.mjs +4179 -0
  30. package/dist/_chunks/index-D981K4TK.mjs.map +1 -0
  31. package/dist/_chunks/{index-BvXbuF1E.js → index-DGb8ESH-.js} +56 -8
  32. package/dist/_chunks/index-DYiJBXKE.js +10131 -0
  33. package/dist/_chunks/index-DYiJBXKE.js.map +1 -0
  34. package/dist/_chunks/index-DjZ3ZaVB.js +17189 -0
  35. package/dist/_chunks/index-DjZ3ZaVB.js.map +1 -0
  36. package/dist/_chunks/index-DkhJl5mF.mjs +10131 -0
  37. package/dist/_chunks/index-DkhJl5mF.mjs.map +1 -0
  38. package/dist/admin/index.js +1 -1
  39. package/dist/admin/index.js.map +1 -0
  40. package/dist/admin/index.mjs +1 -1
  41. package/dist/admin/index.mjs.map +1 -0
  42. package/dist/admin/src/components/URLInfo.d.ts +2 -1
  43. package/dist/admin/src/components/modals/NavModal.d.ts +2 -1
  44. package/dist/admin/src/utils/getRouteType.d.ts +2 -0
  45. package/dist/admin/src/utils/index.d.ts +2 -1
  46. package/dist/server/index.js +12 -1
  47. package/dist/server/index.js.map +1 -1
  48. package/dist/server/index.mjs +12 -1
  49. package/dist/server/index.mjs.map +1 -1
  50. package/package.json +1 -1
  51. package/dist/_chunks/en-B4KWt_jN.js +0 -4
  52. package/dist/_chunks/en-Byx4XI2L.mjs +0 -4
  53. package/dist/_chunks/index-BMlQpLGa.mjs +0 -44
@@ -5,6 +5,7 @@ const icons = require("@strapi/icons");
5
5
  const admin = require("@strapi/strapi/admin");
6
6
  const designSystem = require("@strapi/design-system");
7
7
  const ReactDOM = require("react-dom");
8
+ const reactIntl = require("react-intl");
8
9
  function _interopNamespace(e) {
9
10
  if (e && e.__esModule) return e;
10
11
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
@@ -40,7 +41,7 @@ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
40
41
  );
41
42
  });
42
43
  };
43
- const version = "0.2.5";
44
+ const version = "0.2.6";
44
45
  const keywords = [];
45
46
  const type = "commonjs";
46
47
  const exports$1 = {
@@ -164,6 +165,7 @@ const pluginPkg = {
164
165
  packageManager
165
166
  };
166
167
  const PLUGIN_ID = pluginPkg.strapi.name.replace(/^(@[^-,.][\w,-]+\/|strapi-)plugin-/i, "") || "webatlas";
168
+ const PLUGIN_NAME = pluginPkg.strapi.displayName;
167
169
  const Initializer = ({ setPlugin }) => {
168
170
  const ref = React.useRef(setPlugin);
169
171
  React.useEffect(() => {
@@ -3659,6 +3661,7 @@ function Tooltip({ description: description2 }) {
3659
3661
  background: "neutral1000",
3660
3662
  hasRadius: true,
3661
3663
  shadow: "filterShadow",
3664
+ maxWidth: "300px",
3662
3665
  children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral0", children: description2 })
3663
3666
  }
3664
3667
  ) }) })
@@ -3675,19 +3678,6 @@ function debounce(func, wait) {
3675
3678
  timeout = setTimeout(later, wait);
3676
3679
  };
3677
3680
  }
3678
- function URLInfo({ validationState, replacement }) {
3679
- if (validationState === "initial") return null;
3680
- let color = "neutral800";
3681
- let text = "Checking if URL is available...";
3682
- if (validationState === "checking") {
3683
- color = "neutral800";
3684
- text = "Checking if URL is available...";
3685
- } else if (validationState === "done") {
3686
- color = replacement ? "danger500" : "success500";
3687
- text = replacement ? `URL is not available. Replaced with "${replacement}".` : "URL is available";
3688
- }
3689
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 2, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: color, children: text }) });
3690
- }
3691
3681
  async function duplicateCheck(url, routeDocumentId) {
3692
3682
  if (!url) throw new Error("URL is required");
3693
3683
  try {
@@ -3699,6 +3689,33 @@ async function duplicateCheck(url, routeDocumentId) {
3699
3689
  throw new Error("Failed to check URL uniqueness");
3700
3690
  }
3701
3691
  }
3692
+ const getTranslation = (id) => `${PLUGIN_ID}.${id}`;
3693
+ function URLInfo({ validationState, replacement, setUrlStatus }) {
3694
+ const [color, setColor] = React.useState(null);
3695
+ const [text, setText] = React.useState(null);
3696
+ const { formatMessage } = reactIntl.useIntl();
3697
+ React.useEffect(() => {
3698
+ if (validationState === "initial") return;
3699
+ if (validationState === "checking") {
3700
+ setColor("neutral800");
3701
+ setText(formatMessage({
3702
+ id: getTranslation("components.URLInfo.checking"),
3703
+ defaultMessage: "Checking if URL is available..."
3704
+ }));
3705
+ } else if (validationState === "done") {
3706
+ setColor(replacement ? "danger500" : "success500");
3707
+ setText(replacement ? `${formatMessage({
3708
+ id: getTranslation("components.URLInfo.notAvailable"),
3709
+ defaultMessage: "URL is not available. Replaced with"
3710
+ })} "${replacement}".` : formatMessage({
3711
+ id: getTranslation("components.URLInfo.available"),
3712
+ defaultMessage: "URL is available."
3713
+ }));
3714
+ if (setUrlStatus) setUrlStatus(replacement ? "invalid" : "valid");
3715
+ }
3716
+ }, [validationState, replacement, formatMessage, setUrlStatus]);
3717
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 2, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: color, children: text }) });
3718
+ }
3702
3719
  function reducer(state, action) {
3703
3720
  switch (action.type) {
3704
3721
  case "DEFAULT":
@@ -3733,14 +3750,16 @@ function reducer(state, action) {
3733
3750
  }
3734
3751
  }
3735
3752
  const Alias = ({ config }) => {
3736
- const { layout, form } = admin.unstable_useContentManagerContext();
3753
+ const { form } = admin.unstable_useContentManagerContext();
3737
3754
  const { initialValues, values, onChange } = form;
3738
3755
  const { getRelatedRoute } = useApi();
3756
+ const { formatMessage } = reactIntl.useIntl();
3739
3757
  const [routeId, setRouteId] = React.useState();
3740
3758
  const [isOverride, setIsOverride] = React.useState(false);
3741
3759
  const [validationState, setValidationState] = React.useState("initial");
3742
3760
  const [replacement, setReplacement] = React.useState("");
3743
3761
  const [initialLoadComplete, setInitialLoadComplete] = React.useState(false);
3762
+ const [urlIsValid, setUrlIsValid] = React.useState(null);
3744
3763
  const [path, dispatchPath] = React.useReducer(reducer, {
3745
3764
  needsUrlCheck: false,
3746
3765
  value: "",
@@ -3750,32 +3769,29 @@ const Alias = ({ config }) => {
3750
3769
  const hasUserChangedField = React.useRef(false);
3751
3770
  const initialPath = React.useRef("");
3752
3771
  const prevValueRef = React.useRef(null);
3753
- const debouncedCheckUrl = React.useCallback(debounce(checkUrl, 500), []);
3772
+ const debouncedCheckUrl = React.useCallback(debounce(checkUrl, 250), []);
3754
3773
  React.useEffect(() => {
3755
3774
  onChange("webatlas_path", path.value);
3756
3775
  onChange("webatlas_override", isOverride);
3757
- }, [path.value, routeId, isOverride]);
3758
- const debouncedValueEffect = React.useMemo(
3759
- () => debounce((currentValues) => {
3760
- const key = config?.default;
3761
- if (!key) return;
3762
- const currentValue = currentValues[key];
3763
- if (!currentValue) {
3764
- dispatchPath({ type: "NO_URL_CHECK", payload: "" });
3765
- return;
3766
- }
3767
- if (initialLoadComplete && (hasUserChangedField.current || !routeId) && prevValueRef.current !== currentValue && !isOverride) {
3768
- const path2 = config.pattern ? `${config.pattern}/${currentValue}` : `${currentValue}`;
3769
- if (currentValue === initialValues[key]) {
3770
- dispatchPath({ type: "NO_URL_CHECK", payload: path2 });
3771
- } else {
3772
- dispatchPath({ type: "DEFAULT", payload: path2 });
3773
- }
3774
- prevValueRef.current = currentValue;
3776
+ }, [path.value, isOverride]);
3777
+ const debouncedValueEffect = React.useMemo(() => debounce((currentValues) => {
3778
+ const key = config?.default;
3779
+ if (!key) return;
3780
+ const currentValue = currentValues[key];
3781
+ if (!currentValue) {
3782
+ dispatchPath({ type: "NO_URL_CHECK", payload: "" });
3783
+ return;
3784
+ }
3785
+ if (initialLoadComplete && (hasUserChangedField.current || !routeId) && prevValueRef.current !== currentValue && !isOverride) {
3786
+ const path2 = config.pattern ? `${config.pattern}/${currentValue}` : `${currentValue}`;
3787
+ if (currentValue === initialValues[key]) {
3788
+ dispatchPath({ type: "NO_URL_CHECK", payload: path2 });
3789
+ } else {
3790
+ dispatchPath({ type: "DEFAULT", payload: path2 });
3775
3791
  }
3776
- }, 500),
3777
- [config?.default, config?.pattern, initialValues, isOverride, initialLoadComplete, routeId]
3778
- );
3792
+ prevValueRef.current = currentValue;
3793
+ }
3794
+ }, 500), [config?.default, config?.pattern, initialValues, isOverride, initialLoadComplete, routeId]);
3779
3795
  React.useEffect(() => {
3780
3796
  const key = config?.default;
3781
3797
  if (!key) return;
@@ -3841,10 +3857,14 @@ const Alias = ({ config }) => {
3841
3857
  } catch (err) {
3842
3858
  console.log(err);
3843
3859
  } finally {
3860
+ setUrlIsValid(null);
3844
3861
  setValidationState("done");
3845
3862
  }
3846
3863
  }
3847
- if (!initialLoadComplete) return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: "Loading..." });
3864
+ if (!initialLoadComplete) return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: formatMessage({
3865
+ id: getTranslation("components.CMEditViewAside.loading"),
3866
+ defaultMessage: "Loading..."
3867
+ }) });
3848
3868
  return /* @__PURE__ */ jsxRuntime.jsx(
3849
3869
  designSystem.Box,
3850
3870
  {
@@ -3859,28 +3879,53 @@ const Alias = ({ config }) => {
3859
3879
  gap: 4,
3860
3880
  children: [
3861
3881
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
3862
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { hint: !initialValues.id && !config.default ? "[id] will be replaced with the entry ID" : "", children: [
3863
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Label, { children: [
3864
- "URL",
3865
- /* @__PURE__ */ jsxRuntime.jsx(Tooltip, { description: "The following characters are valid: A-Z, a-z, 0-9, /, -, _, $, ., +, !, *, ', (, )" })
3866
- ] }),
3867
- /* @__PURE__ */ jsxRuntime.jsx(
3868
- designSystem.Field.Input,
3869
- {
3870
- id: "url-input",
3871
- value: path.value,
3872
- placeholder: config.default ? `Edit the "${config.default}" field to generate a URL` : `${layout.list.settings.displayName?.toLowerCase()}/[id]`,
3873
- onChange: (e) => dispatchPath({ type: "NO_TRANSFORM_AND_CHECK", payload: e.target.value }),
3874
- disabled: !isOverride,
3875
- onBlur: (e) => {
3876
- if (e.target.value === path.prevValue) return;
3877
- dispatchPath({ type: "DEFAULT", payload: e.target.value });
3878
- }
3879
- }
3880
- ),
3881
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
3882
+ !routeId && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3883
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", marginBottom: 2, children: formatMessage({
3884
+ id: getTranslation("components.CMEditViewAside.alias.newRouteInfo"),
3885
+ defaultMessage: "A new URL route will be created upon saving this entry."
3886
+ }) }),
3887
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingBottom: 2, paddingTop: 2, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Divider, {}) })
3882
3888
  ] }),
3883
- /* @__PURE__ */ jsxRuntime.jsx(URLInfo, { validationState, replacement }),
3889
+ /* @__PURE__ */ jsxRuntime.jsxs(
3890
+ designSystem.Field.Root,
3891
+ {
3892
+ hint: formatMessage({
3893
+ id: getTranslation("components.CMEditViewAside.alias.urlInput.start"),
3894
+ defaultMessage: "Edit the"
3895
+ }) + ' "' + config.default + '" ' + formatMessage({
3896
+ id: getTranslation("components.CMEditViewAside.alias.urlInput.end"),
3897
+ defaultMessage: "field to generate a URL"
3898
+ }),
3899
+ children: [
3900
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Label, { children: [
3901
+ formatMessage({
3902
+ id: getTranslation("components.CMEditViewAside.alias.urlInput.label"),
3903
+ defaultMessage: "URL"
3904
+ }),
3905
+ /* @__PURE__ */ jsxRuntime.jsx(Tooltip, { description: formatMessage({
3906
+ id: getTranslation("components.CMEditViewAside.alias.urlInput.tooltip"),
3907
+ defaultMessage: "The following characters are valid: A-Z, a-z, 0-9, /, -, _, $, ., +, !, *, ', (, )"
3908
+ }) })
3909
+ ] }),
3910
+ /* @__PURE__ */ jsxRuntime.jsx(
3911
+ designSystem.Field.Input,
3912
+ {
3913
+ id: "url-input",
3914
+ value: path.value,
3915
+ onChange: (e) => dispatchPath({ type: "NO_TRANSFORM_AND_CHECK", payload: e.target.value }),
3916
+ disabled: !isOverride,
3917
+ onBlur: (e) => {
3918
+ if (e.target.value === path.prevValue) return;
3919
+ dispatchPath({ type: "DEFAULT", payload: e.target.value });
3920
+ },
3921
+ style: { outline: urlIsValid !== null ? urlIsValid === "valid" ? "1px solid #5cb176" : "1px solid #ee5e52" : void 0 }
3922
+ }
3923
+ ),
3924
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
3925
+ ]
3926
+ }
3927
+ ),
3928
+ /* @__PURE__ */ jsxRuntime.jsx(URLInfo, { validationState, replacement, setUrlStatus: setUrlIsValid }),
3884
3929
  /* @__PURE__ */ jsxRuntime.jsx(
3885
3930
  designSystem.Flex,
3886
3931
  {
@@ -3892,7 +3937,10 @@ const Alias = ({ config }) => {
3892
3937
  id: "override-url",
3893
3938
  checked: isOverride,
3894
3939
  onCheckedChange: () => setIsOverride((prev) => !prev),
3895
- children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: "Override generated URL" })
3940
+ children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: formatMessage({
3941
+ id: getTranslation("components.CMEditViewAside.alias.overrideCheckbox"),
3942
+ defaultMessage: "Override automatic URL generation"
3943
+ }) })
3896
3944
  }
3897
3945
  )
3898
3946
  }
@@ -3903,8 +3951,14 @@ const Alias = ({ config }) => {
3903
3951
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { children: /* @__PURE__ */ jsxRuntime.jsxs(
3904
3952
  designSystem.Field.Root,
3905
3953
  {
3906
- hint: "Permanent UID path, cannot be changed.",
3907
- label: "UID path",
3954
+ hint: formatMessage({
3955
+ id: getTranslation("components.CMEditViewAside.alias.uidRoute.hint"),
3956
+ defaultMessage: "Permanent UID route, cannot be changed"
3957
+ }),
3958
+ label: formatMessage({
3959
+ id: getTranslation("components.CMEditViewAside.alias.uidRoute.label"),
3960
+ defaultMessage: "UID route"
3961
+ }),
3908
3962
  children: [
3909
3963
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, {}),
3910
3964
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -3921,8 +3975,14 @@ const Alias = ({ config }) => {
3921
3975
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { children: /* @__PURE__ */ jsxRuntime.jsxs(
3922
3976
  designSystem.Field.Root,
3923
3977
  {
3924
- hint: "Permanent DocumentID path, cannot be changed.",
3925
- label: "DocumentID path",
3978
+ hint: formatMessage({
3979
+ id: getTranslation("components.CMEditViewAside.alias.documentIdRoute.hint"),
3980
+ defaultMessage: "Permanent Document ID route, cannot be changed"
3981
+ }),
3982
+ label: formatMessage({
3983
+ id: getTranslation("components.CMEditViewAside.alias.documentIdRoute.label"),
3984
+ defaultMessage: "Document ID route"
3985
+ }),
3926
3986
  children: [
3927
3987
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, {}),
3928
3988
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -3951,6 +4011,7 @@ const CMEditViewAside = () => {
3951
4011
  const [isAllowedContentType, setIsAllowedContentType] = React.useState(false);
3952
4012
  const [isActiveContentType, setIsActiveContentType] = React.useState(false);
3953
4013
  const [isLoading, setIsLoading] = React.useState(true);
4014
+ const { formatMessage } = reactIntl.useIntl();
3954
4015
  React.useEffect(() => {
3955
4016
  if (!config) return;
3956
4017
  const contentType = contentTypes?.find((ct) => ct.uid === model);
@@ -3982,17 +4043,43 @@ const CMEditViewAside = () => {
3982
4043
  }
3983
4044
  });
3984
4045
  }, []);
3985
- if (isLoading || !config) return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: "Loading..." });
4046
+ if (isLoading || !config) return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: formatMessage({
4047
+ id: getTranslation("components.CMEditViewAside.loading"),
4048
+ defaultMessage: "Loading..."
4049
+ }) });
3986
4050
  if (!isAllowedContentType) return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { textColor: "neutral600", children: [
3987
- "This content type is not allowed for ",
3988
- /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "WebAtlas" }),
3989
- ". If you wish to use it, please contact your administrator."
4051
+ formatMessage({
4052
+ id: getTranslation("components.CMEditViewAside.notAllowed.start"),
4053
+ defaultMessage: "This content type is not allowed for"
4054
+ }),
4055
+ " ",
4056
+ /* @__PURE__ */ jsxRuntime.jsx("strong", { children: PLUGIN_NAME }),
4057
+ ".",
4058
+ " ",
4059
+ formatMessage({
4060
+ id: getTranslation("components.CMEditViewAside.notAllowed.end"),
4061
+ defaultMessage: "If you wish to use it, please contact your administrator"
4062
+ }),
4063
+ "."
3990
4064
  ] });
3991
4065
  if (!isActiveContentType || !contentTypeConfig) return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { textColor: "neutral600", children: [
3992
- "This content type is not configured for ",
3993
- /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "WebAtlas" }),
3994
- ". If you wish to use it, please configure it in the",
3995
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Link, { href: "/admin/settings/webatlas/configuration", marginLeft: 1, children: "settings" }),
4066
+ formatMessage({
4067
+ id: getTranslation("components.CMEditViewAside.notConfigured.start"),
4068
+ defaultMessage: "This content type is not configured for"
4069
+ }),
4070
+ " ",
4071
+ /* @__PURE__ */ jsxRuntime.jsx("strong", { children: PLUGIN_NAME }),
4072
+ ".",
4073
+ " ",
4074
+ formatMessage({
4075
+ id: getTranslation("components.CMEditViewAside.notConfigured.middle"),
4076
+ defaultMessage: "If you wish to use it, please configure it in the"
4077
+ }),
4078
+ " ",
4079
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Link, { href: "/admin/settings/webatlas/configuration", children: formatMessage({
4080
+ id: getTranslation("components.CMEditViewAside.notConfigured.end"),
4081
+ defaultMessage: "settings"
4082
+ }) }),
3996
4083
  "."
3997
4084
  ] });
3998
4085
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(Alias, { config: contentTypeConfig }) });
@@ -4007,7 +4094,7 @@ const index = {
4007
4094
  defaultMessage: "Routes"
4008
4095
  },
4009
4096
  Component: async () => {
4010
- const component = await Promise.resolve().then(() => require("./index-BvXbuF1E.js"));
4097
+ const component = await Promise.resolve().then(() => require("./index-DGb8ESH-.js"));
4011
4098
  return { default: component.default };
4012
4099
  },
4013
4100
  permissions: [
@@ -4026,7 +4113,7 @@ const index = {
4026
4113
  defaultMessage: "Navigation"
4027
4114
  },
4028
4115
  Component: async () => {
4029
- const component = await Promise.resolve().then(() => require("./index-D4IHmUrH.js"));
4116
+ const component = await Promise.resolve().then(() => require("./index-B0XE_zRP.js"));
4030
4117
  return { default: component.default };
4031
4118
  },
4032
4119
  permissions: [
@@ -4055,7 +4142,7 @@ const index = {
4055
4142
  Component: async () => {
4056
4143
  return await Promise.resolve().then(() => require(
4057
4144
  /* webpackChunkName: "webatlas-settings-page" */
4058
- "./index-DIyVy-8D.js"
4145
+ "./index-BbM9Sn1t.js"
4059
4146
  ));
4060
4147
  },
4061
4148
  permissions: [
@@ -4084,7 +4171,7 @@ const index = {
4084
4171
  return Promise.all(
4085
4172
  locales.map(async (locale) => {
4086
4173
  try {
4087
- const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => Promise.resolve().then(() => require("./en-B4KWt_jN.js")) }), `./translations/${locale}.json`, 3);
4174
+ const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/de.json": () => Promise.resolve().then(() => require("./de-4tL_cJTC.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-Bg4z3fR7.js")) }), `./translations/${locale}.json`, 3);
4088
4175
  return { data, locale };
4089
4176
  } catch {
4090
4177
  return { data: {}, locale };
@@ -4093,11 +4180,13 @@ const index = {
4093
4180
  );
4094
4181
  }
4095
4182
  };
4183
+ exports.PLUGIN_NAME = PLUGIN_NAME;
4096
4184
  exports.Tooltip = Tooltip;
4097
4185
  exports.URLInfo = URLInfo;
4098
4186
  exports._extends = _extends;
4099
4187
  exports.debounce = debounce;
4100
4188
  exports.duplicateCheck = duplicateCheck;
4189
+ exports.getTranslation = getTranslation;
4101
4190
  exports.index = index;
4102
4191
  exports.transformToUrl = transformToUrl;
4103
4192
  exports.useAllContentTypes = useAllContentTypes;
@@ -11,7 +11,7 @@ const reactIntl = require("react-intl");
11
11
  require("@strapi/icons/symbols");
12
12
  const ReactDOM = require("react-dom");
13
13
  const styledComponents = require("styled-components");
14
- const index = require("./index-DrlYDm6a.js");
14
+ const index = require("./index-B85fJxGa.js");
15
15
  const _interopDefault = (e2) => e2 && e2.__esModule ? e2 : { default: e2 };
16
16
  function _interopNamespace(e2) {
17
17
  if (e2 && e2.__esModule) return e2;
@@ -16978,6 +16978,7 @@ const Settings = () => {
16978
16978
  const { contentTypes: allContentTypesData } = index.useAllContentTypes();
16979
16979
  const allContentTypes = allContentTypesData?.filter((ct) => ct.pluginOptions?.webatlas?.active === true);
16980
16980
  const [initialState2, setInitialState] = React.useState(config || { selectedContentTypes: [] });
16981
+ const { formatMessage } = reactIntl.useIntl();
16981
16982
  function reducer2(settingsState2, action) {
16982
16983
  let updatedContentTypes;
16983
16984
  switch (action.type) {
@@ -17020,8 +17021,11 @@ const Settings = () => {
17020
17021
  /* @__PURE__ */ jsxRuntime.jsx(
17021
17022
  Layouts.Header,
17022
17023
  {
17023
- title: "Routes",
17024
- subtitle: "Settings",
17024
+ title: index.PLUGIN_NAME,
17025
+ subtitle: formatMessage({
17026
+ id: index.getTranslation("settings.page.subtitle"),
17027
+ defaultMessage: "Settings"
17028
+ }),
17025
17029
  primaryAction: /* @__PURE__ */ jsxRuntime.jsx(
17026
17030
  designSystem.Button,
17027
17031
  {
@@ -17029,7 +17033,10 @@ const Settings = () => {
17029
17033
  startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Check, {}),
17030
17034
  onClick: save,
17031
17035
  disabled: JSON.stringify(settingsState) === JSON.stringify(initialState2) || settingsState.selectedContentTypes.find((cta) => !cta.default) !== void 0,
17032
- children: "Save"
17036
+ children: formatMessage({
17037
+ id: index.getTranslation("save"),
17038
+ defaultMessage: "Save"
17039
+ })
17033
17040
  }
17034
17041
  )
17035
17042
  }
@@ -17051,13 +17058,22 @@ const Settings = () => {
17051
17058
  designSystem.Field.Root,
17052
17059
  {
17053
17060
  name: "selectedContentTypes",
17054
- hint: "Select the content types you want to enable the Webatlas plugin for.",
17061
+ hint: formatMessage({
17062
+ id: index.getTranslation("settings.page.enabledContentTypes.hint"),
17063
+ defaultMessage: "Select the content types for which you want to enable URL aliases"
17064
+ }),
17055
17065
  children: [
17056
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: "Enabled Content Types" }),
17066
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
17067
+ id: index.getTranslation("settings.page.enabledContentTypes"),
17068
+ defaultMessage: "Enabled Content Types"
17069
+ }) }),
17057
17070
  /* @__PURE__ */ jsxRuntime.jsx(
17058
17071
  designSystem.MultiSelect,
17059
17072
  {
17060
- placeholder: "Select Content Types",
17073
+ placeholder: formatMessage({
17074
+ id: index.getTranslation("settings.page.enabledContentTypes.placeholder"),
17075
+ defaultMessage: "Select content types..."
17076
+ }),
17061
17077
  onClear: () => dispatch({ type: "SET_SELECTED_CONTENT_TYPES", payload: [] }),
17062
17078
  value: [...settingsState.selectedContentTypes.map((ct) => ct.uid)],
17063
17079
  onChange: (value) => dispatch({
@@ -17077,8 +17093,11 @@ const Settings = () => {
17077
17093
  }
17078
17094
  ),
17079
17095
  settingsState.selectedContentTypes && settingsState.selectedContentTypes.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { name: "selectedContentTypesAccordion", children: [
17080
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: "Enabled Content Types Settings" }),
17081
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Root, { label: "Content Type settings", children: settingsState.selectedContentTypes?.map((contentType) => {
17096
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
17097
+ id: index.getTranslation("settings.page.contentTypeSettings"),
17098
+ defaultMessage: "Content Type settings"
17099
+ }) }),
17100
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Root, { children: settingsState.selectedContentTypes?.map((contentType) => {
17082
17101
  const ct = allContentTypes?.find((item) => item.uid === contentType.uid);
17083
17102
  if (!ct) return null;
17084
17103
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -17092,11 +17111,20 @@ const Settings = () => {
17092
17111
  designSystem.Field.Root,
17093
17112
  {
17094
17113
  name: "selectedContentTypes",
17095
- hint: 'The selected field from the content type will be used to generate the URL alias. Use a field that is unique and descriptive, such as a "title" or "name".',
17096
- error: !contentType.default && "Please select a default field",
17114
+ hint: formatMessage({
17115
+ id: index.getTranslation("settings.page.defaultField.hint"),
17116
+ defaultMessage: 'The selected field from the content type will be used to generate the URL alias. Use a field that is unique and descriptive, such as a "title" or "name".'
17117
+ }),
17118
+ error: !contentType.default && formatMessage({
17119
+ id: index.getTranslation("settings.page.defaultField.error"),
17120
+ defaultMessage: "Please select a default field"
17121
+ }),
17097
17122
  required: true,
17098
17123
  children: [
17099
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: "Default URL Alias field" }),
17124
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
17125
+ id: index.getTranslation("settings.page.defaultField"),
17126
+ defaultMessage: "Default URL Alias field"
17127
+ }) }),
17100
17128
  /* @__PURE__ */ jsxRuntime.jsx(
17101
17129
  designSystem.SingleSelect,
17102
17130
  {
@@ -17105,7 +17133,7 @@ const Settings = () => {
17105
17133
  value: contentType?.default || "",
17106
17134
  onChange: (value) => dispatch({ type: "SET_DEFAULT_FIELD", payload: { ctUid: ct.uid, field: value } }),
17107
17135
  children: Object.entries(ct.attributes).map(([key], index2) => {
17108
- if (key === "id" || key === "createdAt" || key === "updatedAt" || key === "createdBy" || key === "updatedBy") return null;
17136
+ if (key === "id" || key === "documentId" || key === "createdAt" || key === "updatedAt" || key === "createdBy" || key === "updatedBy" || key === "webatlas_path" || key === "webatlas_override") return null;
17109
17137
  return /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: key, children: key }, index2);
17110
17138
  })
17111
17139
  }
@@ -17118,11 +17146,20 @@ const Settings = () => {
17118
17146
  designSystem.Field.Root,
17119
17147
  {
17120
17148
  name: "urlAliasPattern",
17121
- hint: 'The pattern to prepend to the generated URL alias. For example, if you enter "blog" and the value of default field is "My First Post", the generated URL alias will be "blog/my-first-post". Leave empty for no prefix.',
17149
+ hint: formatMessage({
17150
+ id: index.getTranslation("settings.page.urlAliasPattern.hint"),
17151
+ defaultMessage: 'The pattern to prepend to the generated URL alias. For example, if you enter "blog" and the value of default field is "My First Post", the generated URL alias will be "blog/my-first-post". Leave empty for no prefix.'
17152
+ }),
17122
17153
  children: [
17123
17154
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Label, { children: [
17124
- "URL Alias pattern",
17125
- /* @__PURE__ */ jsxRuntime.jsx(index.Tooltip, { description: "Leading and trailing slashes will be removed. Spaces will be replaced with hyphens. Special characters will be encoded." })
17155
+ formatMessage({
17156
+ id: index.getTranslation("settings.page.urlAliasPattern"),
17157
+ defaultMessage: "URL Alias Pattern"
17158
+ }),
17159
+ /* @__PURE__ */ jsxRuntime.jsx(index.Tooltip, { description: formatMessage({
17160
+ id: index.getTranslation("settings.page.urlAliasPattern.tooltip"),
17161
+ defaultMessage: "Leading and trailing slashes will be removed. Spaces will be replaced with hyphens. Special characters will be encoded."
17162
+ }) })
17126
17163
  ] }),
17127
17164
  /* @__PURE__ */ jsxRuntime.jsx(
17128
17165
  designSystem.Field.Input,
@@ -17131,7 +17168,10 @@ const Settings = () => {
17131
17168
  onChange: (e2) => dispatch({ type: "SET_PATTERN", payload: { ctUid: ct.uid, pattern: e2.target.value } }),
17132
17169
  disabled: !contentType.default,
17133
17170
  type: "text",
17134
- placeholder: "e.g. blog"
17171
+ placeholder: formatMessage({
17172
+ id: index.getTranslation("settings.page.urlAliasPattern.placeholder"),
17173
+ defaultMessage: "e.g. blog"
17174
+ })
17135
17175
  }
17136
17176
  ),
17137
17177
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})