@mattisvensson/strapi-plugin-webatlas 0.2.6 → 0.3.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.
@@ -3,9 +3,10 @@ import * as React from "react";
3
3
  import { useRef, useEffect, useState, useCallback, createContext, useMemo, createElement, useContext, Fragment, forwardRef, Children, isValidElement, cloneElement, useLayoutEffect, useReducer } from "react";
4
4
  import { Link, List, Information } from "@strapi/icons";
5
5
  import { useFetchClient, unstable_useContentManagerContext } from "@strapi/strapi/admin";
6
- import { Box, Typography, Flex, Field, Checkbox, Divider, Link as Link$1 } from "@strapi/design-system";
6
+ import { Box, Typography, Flex, Divider, Field, Checkbox, Link as Link$1 } from "@strapi/design-system";
7
7
  import * as ReactDOM from "react-dom";
8
8
  import ReactDOM__default, { flushSync } from "react-dom";
9
+ import { useIntl } from "react-intl";
9
10
  const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
10
11
  const v = glob[path];
11
12
  if (v) {
@@ -22,7 +23,7 @@ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
22
23
  );
23
24
  });
24
25
  };
25
- const version = "0.2.5";
26
+ const version = "0.3.0";
26
27
  const keywords = [];
27
28
  const type = "commonjs";
28
29
  const exports = {
@@ -146,6 +147,7 @@ const pluginPkg = {
146
147
  packageManager
147
148
  };
148
149
  const PLUGIN_ID = pluginPkg.strapi.name.replace(/^(@[^-,.][\w,-]+\/|strapi-)plugin-/i, "") || "webatlas";
150
+ const PLUGIN_NAME = pluginPkg.strapi.displayName;
149
151
  const Initializer = ({ setPlugin }) => {
150
152
  const ref = useRef(setPlugin);
151
153
  useEffect(() => {
@@ -3641,6 +3643,7 @@ function Tooltip({ description: description2 }) {
3641
3643
  background: "neutral1000",
3642
3644
  hasRadius: true,
3643
3645
  shadow: "filterShadow",
3646
+ maxWidth: "300px",
3644
3647
  children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral0", children: description2 })
3645
3648
  }
3646
3649
  ) }) })
@@ -3657,19 +3660,6 @@ function debounce(func, wait) {
3657
3660
  timeout = setTimeout(later, wait);
3658
3661
  };
3659
3662
  }
3660
- function URLInfo({ validationState, replacement }) {
3661
- if (validationState === "initial") return null;
3662
- let color = "neutral800";
3663
- let text = "Checking if URL is available...";
3664
- if (validationState === "checking") {
3665
- color = "neutral800";
3666
- text = "Checking if URL is available...";
3667
- } else if (validationState === "done") {
3668
- color = replacement ? "danger500" : "success500";
3669
- text = replacement ? `URL is not available. Replaced with "${replacement}".` : "URL is available";
3670
- }
3671
- return /* @__PURE__ */ jsx(Box, { paddingTop: 2, children: /* @__PURE__ */ jsx(Typography, { textColor: color, children: text }) });
3672
- }
3673
3663
  async function duplicateCheck(url, routeDocumentId) {
3674
3664
  if (!url) throw new Error("URL is required");
3675
3665
  try {
@@ -3681,6 +3671,33 @@ async function duplicateCheck(url, routeDocumentId) {
3681
3671
  throw new Error("Failed to check URL uniqueness");
3682
3672
  }
3683
3673
  }
3674
+ const getTranslation = (id) => `${PLUGIN_ID}.${id}`;
3675
+ function URLInfo({ validationState, replacement, setUrlStatus }) {
3676
+ const [color, setColor] = useState(null);
3677
+ const [text, setText] = useState(null);
3678
+ const { formatMessage } = useIntl();
3679
+ useEffect(() => {
3680
+ if (validationState === "initial") return;
3681
+ if (validationState === "checking") {
3682
+ setColor("neutral800");
3683
+ setText(formatMessage({
3684
+ id: getTranslation("components.URLInfo.checking"),
3685
+ defaultMessage: "Checking if URL is available..."
3686
+ }));
3687
+ } else if (validationState === "done") {
3688
+ setColor(replacement ? "danger500" : "success500");
3689
+ setText(replacement ? `${formatMessage({
3690
+ id: getTranslation("components.URLInfo.notAvailable"),
3691
+ defaultMessage: "URL is not available. Replaced with"
3692
+ })} "${replacement}".` : formatMessage({
3693
+ id: getTranslation("components.URLInfo.available"),
3694
+ defaultMessage: "URL is available."
3695
+ }));
3696
+ if (setUrlStatus) setUrlStatus(replacement ? "invalid" : "valid");
3697
+ }
3698
+ }, [validationState, replacement, formatMessage, setUrlStatus]);
3699
+ return /* @__PURE__ */ jsx(Box, { paddingTop: 2, children: /* @__PURE__ */ jsx(Typography, { textColor: color, children: text }) });
3700
+ }
3684
3701
  function reducer(state, action) {
3685
3702
  switch (action.type) {
3686
3703
  case "DEFAULT":
@@ -3715,14 +3732,16 @@ function reducer(state, action) {
3715
3732
  }
3716
3733
  }
3717
3734
  const Alias = ({ config }) => {
3718
- const { layout, form } = unstable_useContentManagerContext();
3735
+ const { form } = unstable_useContentManagerContext();
3719
3736
  const { initialValues, values, onChange } = form;
3720
3737
  const { getRelatedRoute } = useApi();
3738
+ const { formatMessage } = useIntl();
3721
3739
  const [routeId, setRouteId] = useState();
3722
3740
  const [isOverride, setIsOverride] = useState(false);
3723
3741
  const [validationState, setValidationState] = useState("initial");
3724
3742
  const [replacement, setReplacement] = useState("");
3725
3743
  const [initialLoadComplete, setInitialLoadComplete] = useState(false);
3744
+ const [urlIsValid, setUrlIsValid] = useState(null);
3726
3745
  const [path, dispatchPath] = useReducer(reducer, {
3727
3746
  needsUrlCheck: false,
3728
3747
  value: "",
@@ -3732,32 +3751,29 @@ const Alias = ({ config }) => {
3732
3751
  const hasUserChangedField = useRef(false);
3733
3752
  const initialPath = useRef("");
3734
3753
  const prevValueRef = useRef(null);
3735
- const debouncedCheckUrl = useCallback(debounce(checkUrl, 500), []);
3754
+ const debouncedCheckUrl = useCallback(debounce(checkUrl, 250), []);
3736
3755
  useEffect(() => {
3737
3756
  onChange("webatlas_path", path.value);
3738
3757
  onChange("webatlas_override", isOverride);
3739
- }, [path.value, routeId, isOverride]);
3740
- const debouncedValueEffect = useMemo(
3741
- () => debounce((currentValues) => {
3742
- const key = config?.default;
3743
- if (!key) return;
3744
- const currentValue = currentValues[key];
3745
- if (!currentValue) {
3746
- dispatchPath({ type: "NO_URL_CHECK", payload: "" });
3747
- return;
3748
- }
3749
- if (initialLoadComplete && (hasUserChangedField.current || !routeId) && prevValueRef.current !== currentValue && !isOverride) {
3750
- const path2 = config.pattern ? `${config.pattern}/${currentValue}` : `${currentValue}`;
3751
- if (currentValue === initialValues[key]) {
3752
- dispatchPath({ type: "NO_URL_CHECK", payload: path2 });
3753
- } else {
3754
- dispatchPath({ type: "DEFAULT", payload: path2 });
3755
- }
3756
- prevValueRef.current = currentValue;
3758
+ }, [path.value, isOverride]);
3759
+ const debouncedValueEffect = useMemo(() => 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 });
3757
3773
  }
3758
- }, 500),
3759
- [config?.default, config?.pattern, initialValues, isOverride, initialLoadComplete, routeId]
3760
- );
3774
+ prevValueRef.current = currentValue;
3775
+ }
3776
+ }, 500), [config?.default, config?.pattern, initialValues, isOverride, initialLoadComplete, routeId]);
3761
3777
  useEffect(() => {
3762
3778
  const key = config?.default;
3763
3779
  if (!key) return;
@@ -3765,7 +3781,7 @@ const Alias = ({ config }) => {
3765
3781
  const initialValue = initialValues[key];
3766
3782
  if (currentValue && !isOverride) {
3767
3783
  const path2 = config.pattern ? `${config.pattern}/${currentValue}` : `${currentValue}`;
3768
- onChange("webatlas_path", path2);
3784
+ onChange("webatlas_path", transformToUrl(path2));
3769
3785
  }
3770
3786
  if (!initialLoadComplete) return;
3771
3787
  if (currentValue !== initialValue) {
@@ -3823,10 +3839,14 @@ const Alias = ({ config }) => {
3823
3839
  } catch (err) {
3824
3840
  console.log(err);
3825
3841
  } finally {
3842
+ setUrlIsValid(null);
3826
3843
  setValidationState("done");
3827
3844
  }
3828
3845
  }
3829
- if (!initialLoadComplete) return /* @__PURE__ */ jsx(Typography, { textColor: "neutral600", children: "Loading..." });
3846
+ if (!initialLoadComplete) return /* @__PURE__ */ jsx(Typography, { textColor: "neutral600", children: formatMessage({
3847
+ id: getTranslation("components.CMEditViewAside.loading"),
3848
+ defaultMessage: "Loading..."
3849
+ }) });
3830
3850
  return /* @__PURE__ */ jsx(
3831
3851
  Box,
3832
3852
  {
@@ -3841,28 +3861,53 @@ const Alias = ({ config }) => {
3841
3861
  gap: 4,
3842
3862
  children: [
3843
3863
  /* @__PURE__ */ jsxs(Box, { children: [
3844
- /* @__PURE__ */ jsxs(Field.Root, { hint: !initialValues.id && !config.default ? "[id] will be replaced with the entry ID" : "", children: [
3845
- /* @__PURE__ */ jsxs(Field.Label, { children: [
3846
- "URL",
3847
- /* @__PURE__ */ jsx(Tooltip, { description: "The following characters are valid: A-Z, a-z, 0-9, /, -, _, $, ., +, !, *, ', (, )" })
3848
- ] }),
3849
- /* @__PURE__ */ jsx(
3850
- Field.Input,
3851
- {
3852
- id: "url-input",
3853
- value: path.value,
3854
- placeholder: config.default ? `Edit the "${config.default}" field to generate a URL` : `${layout.list.settings.displayName?.toLowerCase()}/[id]`,
3855
- onChange: (e) => dispatchPath({ type: "NO_TRANSFORM_AND_CHECK", payload: e.target.value }),
3856
- disabled: !isOverride,
3857
- onBlur: (e) => {
3858
- if (e.target.value === path.prevValue) return;
3859
- dispatchPath({ type: "DEFAULT", payload: e.target.value });
3860
- }
3861
- }
3862
- ),
3863
- /* @__PURE__ */ jsx(Field.Hint, {})
3864
+ !routeId && /* @__PURE__ */ jsxs(Fragment$1, { children: [
3865
+ /* @__PURE__ */ jsx(Typography, { textColor: "neutral600", marginBottom: 2, children: formatMessage({
3866
+ id: getTranslation("components.CMEditViewAside.alias.newRouteInfo"),
3867
+ defaultMessage: "A new URL route will be created upon saving this entry."
3868
+ }) }),
3869
+ /* @__PURE__ */ jsx(Box, { paddingBottom: 2, paddingTop: 2, children: /* @__PURE__ */ jsx(Divider, {}) })
3864
3870
  ] }),
3865
- /* @__PURE__ */ jsx(URLInfo, { validationState, replacement }),
3871
+ /* @__PURE__ */ jsxs(
3872
+ Field.Root,
3873
+ {
3874
+ hint: formatMessage({
3875
+ id: getTranslation("components.CMEditViewAside.alias.urlInput.start"),
3876
+ defaultMessage: "Edit the"
3877
+ }) + ' "' + config.default + '" ' + formatMessage({
3878
+ id: getTranslation("components.CMEditViewAside.alias.urlInput.end"),
3879
+ defaultMessage: "field to generate a URL"
3880
+ }),
3881
+ children: [
3882
+ /* @__PURE__ */ jsxs(Field.Label, { children: [
3883
+ formatMessage({
3884
+ id: getTranslation("components.CMEditViewAside.alias.urlInput.label"),
3885
+ defaultMessage: "URL"
3886
+ }),
3887
+ /* @__PURE__ */ jsx(Tooltip, { description: formatMessage({
3888
+ id: getTranslation("components.CMEditViewAside.alias.urlInput.tooltip"),
3889
+ defaultMessage: "The following characters are valid: A-Z, a-z, 0-9, /, -, _, $, ., +, !, *, ', (, )"
3890
+ }) })
3891
+ ] }),
3892
+ /* @__PURE__ */ jsx(
3893
+ Field.Input,
3894
+ {
3895
+ id: "url-input",
3896
+ value: path.value,
3897
+ onChange: (e) => dispatchPath({ type: "NO_TRANSFORM_AND_CHECK", payload: e.target.value }),
3898
+ disabled: !isOverride,
3899
+ onBlur: (e) => {
3900
+ if (e.target.value === path.prevValue) return;
3901
+ dispatchPath({ type: "DEFAULT", payload: e.target.value });
3902
+ },
3903
+ style: { outline: urlIsValid !== null ? urlIsValid === "valid" ? "1px solid #5cb176" : "1px solid #ee5e52" : void 0 }
3904
+ }
3905
+ ),
3906
+ /* @__PURE__ */ jsx(Field.Hint, {})
3907
+ ]
3908
+ }
3909
+ ),
3910
+ /* @__PURE__ */ jsx(URLInfo, { validationState, replacement, setUrlStatus: setUrlIsValid }),
3866
3911
  /* @__PURE__ */ jsx(
3867
3912
  Flex,
3868
3913
  {
@@ -3874,7 +3919,10 @@ const Alias = ({ config }) => {
3874
3919
  id: "override-url",
3875
3920
  checked: isOverride,
3876
3921
  onCheckedChange: () => setIsOverride((prev) => !prev),
3877
- children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral600", children: "Override generated URL" })
3922
+ children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral600", children: formatMessage({
3923
+ id: getTranslation("components.CMEditViewAside.alias.overrideCheckbox"),
3924
+ defaultMessage: "Override automatic URL generation"
3925
+ }) })
3878
3926
  }
3879
3927
  )
3880
3928
  }
@@ -3885,8 +3933,14 @@ const Alias = ({ config }) => {
3885
3933
  /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(
3886
3934
  Field.Root,
3887
3935
  {
3888
- hint: "Permanent UID path, cannot be changed.",
3889
- label: "UID path",
3936
+ hint: formatMessage({
3937
+ id: getTranslation("components.CMEditViewAside.alias.uidRoute.hint"),
3938
+ defaultMessage: "Permanent UID route, cannot be changed"
3939
+ }),
3940
+ label: formatMessage({
3941
+ id: getTranslation("components.CMEditViewAside.alias.uidRoute.label"),
3942
+ defaultMessage: "UID route"
3943
+ }),
3890
3944
  children: [
3891
3945
  /* @__PURE__ */ jsx(Field.Label, {}),
3892
3946
  /* @__PURE__ */ jsx(
@@ -3903,8 +3957,14 @@ const Alias = ({ config }) => {
3903
3957
  /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(
3904
3958
  Field.Root,
3905
3959
  {
3906
- hint: "Permanent DocumentID path, cannot be changed.",
3907
- label: "DocumentID path",
3960
+ hint: formatMessage({
3961
+ id: getTranslation("components.CMEditViewAside.alias.documentIdRoute.hint"),
3962
+ defaultMessage: "Permanent Document ID route, cannot be changed"
3963
+ }),
3964
+ label: formatMessage({
3965
+ id: getTranslation("components.CMEditViewAside.alias.documentIdRoute.label"),
3966
+ defaultMessage: "Document ID route"
3967
+ }),
3908
3968
  children: [
3909
3969
  /* @__PURE__ */ jsx(Field.Label, {}),
3910
3970
  /* @__PURE__ */ jsx(
@@ -3933,6 +3993,7 @@ const CMEditViewAside = () => {
3933
3993
  const [isAllowedContentType, setIsAllowedContentType] = useState(false);
3934
3994
  const [isActiveContentType, setIsActiveContentType] = useState(false);
3935
3995
  const [isLoading, setIsLoading] = useState(true);
3996
+ const { formatMessage } = useIntl();
3936
3997
  useEffect(() => {
3937
3998
  if (!config) return;
3938
3999
  const contentType = contentTypes?.find((ct) => ct.uid === model);
@@ -3964,17 +4025,43 @@ const CMEditViewAside = () => {
3964
4025
  }
3965
4026
  });
3966
4027
  }, []);
3967
- if (isLoading || !config) return /* @__PURE__ */ jsx(Typography, { textColor: "neutral600", children: "Loading..." });
4028
+ if (isLoading || !config) return /* @__PURE__ */ jsx(Typography, { textColor: "neutral600", children: formatMessage({
4029
+ id: getTranslation("components.CMEditViewAside.loading"),
4030
+ defaultMessage: "Loading..."
4031
+ }) });
3968
4032
  if (!isAllowedContentType) return /* @__PURE__ */ jsxs(Typography, { textColor: "neutral600", children: [
3969
- "This content type is not allowed for ",
3970
- /* @__PURE__ */ jsx("strong", { children: "WebAtlas" }),
3971
- ". If you wish to use it, please contact your administrator."
4033
+ formatMessage({
4034
+ id: getTranslation("components.CMEditViewAside.notAllowed.start"),
4035
+ defaultMessage: "This content type is not allowed for"
4036
+ }),
4037
+ " ",
4038
+ /* @__PURE__ */ jsx("strong", { children: PLUGIN_NAME }),
4039
+ ".",
4040
+ " ",
4041
+ formatMessage({
4042
+ id: getTranslation("components.CMEditViewAside.notAllowed.end"),
4043
+ defaultMessage: "If you wish to use it, please contact your administrator"
4044
+ }),
4045
+ "."
3972
4046
  ] });
3973
4047
  if (!isActiveContentType || !contentTypeConfig) return /* @__PURE__ */ jsxs(Typography, { textColor: "neutral600", children: [
3974
- "This content type is not configured for ",
3975
- /* @__PURE__ */ jsx("strong", { children: "WebAtlas" }),
3976
- ". If you wish to use it, please configure it in the",
3977
- /* @__PURE__ */ jsx(Link$1, { href: "/admin/settings/webatlas/configuration", marginLeft: 1, children: "settings" }),
4048
+ formatMessage({
4049
+ id: getTranslation("components.CMEditViewAside.notConfigured.start"),
4050
+ defaultMessage: "This content type is not configured for"
4051
+ }),
4052
+ " ",
4053
+ /* @__PURE__ */ jsx("strong", { children: PLUGIN_NAME }),
4054
+ ".",
4055
+ " ",
4056
+ formatMessage({
4057
+ id: getTranslation("components.CMEditViewAside.notConfigured.middle"),
4058
+ defaultMessage: "If you wish to use it, please configure it in the"
4059
+ }),
4060
+ " ",
4061
+ /* @__PURE__ */ jsx(Link$1, { href: "/admin/settings/webatlas/configuration", children: formatMessage({
4062
+ id: getTranslation("components.CMEditViewAside.notConfigured.end"),
4063
+ defaultMessage: "settings"
4064
+ }) }),
3978
4065
  "."
3979
4066
  ] });
3980
4067
  return /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(Alias, { config: contentTypeConfig }) });
@@ -3989,7 +4076,7 @@ const index = {
3989
4076
  defaultMessage: "Routes"
3990
4077
  },
3991
4078
  Component: async () => {
3992
- const component = await import("./index-BMlQpLGa.mjs");
4079
+ const component = await import("./index-DZmhgSeq.mjs");
3993
4080
  return { default: component.default };
3994
4081
  },
3995
4082
  permissions: [
@@ -4008,7 +4095,7 @@ const index = {
4008
4095
  defaultMessage: "Navigation"
4009
4096
  },
4010
4097
  Component: async () => {
4011
- const component = await import("./index-uoH_HJQr.mjs");
4098
+ const component = await import("./index-CwHhwtOU.mjs");
4012
4099
  return { default: component.default };
4013
4100
  },
4014
4101
  permissions: [
@@ -4037,7 +4124,7 @@ const index = {
4037
4124
  Component: async () => {
4038
4125
  return await import(
4039
4126
  /* webpackChunkName: "webatlas-settings-page" */
4040
- "./index-B_RPO9ty.mjs"
4127
+ "./index-BOq-WidK.mjs"
4041
4128
  );
4042
4129
  },
4043
4130
  permissions: [
@@ -4066,7 +4153,7 @@ const index = {
4066
4153
  return Promise.all(
4067
4154
  locales.map(async (locale) => {
4068
4155
  try {
4069
- const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => import("./en-Byx4XI2L.mjs") }), `./translations/${locale}.json`, 3);
4156
+ const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/de.json": () => import("./de-C8PE3n3B.mjs"), "./translations/en.json": () => import("./en-CR1YZvJo.mjs") }), `./translations/${locale}.json`, 3);
4070
4157
  return { data, locale };
4071
4158
  } catch {
4072
4159
  return { data: {}, locale };
@@ -4076,6 +4163,7 @@ const index = {
4076
4163
  }
4077
4164
  };
4078
4165
  export {
4166
+ PLUGIN_NAME as P,
4079
4167
  Tooltip as T,
4080
4168
  URLInfo as U,
4081
4169
  _extends as _,
@@ -4083,6 +4171,7 @@ export {
4083
4171
  usePluginConfig as b,
4084
4172
  useAllContentTypes as c,
4085
4173
  debounce as d,
4174
+ getTranslation as g,
4086
4175
  index as i,
4087
4176
  transformToUrl as t,
4088
4177
  useApi as u
@@ -10,7 +10,7 @@ import { useIntl } from "react-intl";
10
10
  import "@strapi/icons/symbols";
11
11
  import ReactDOM__default, { unstable_batchedUpdates as unstable_batchedUpdates$1 } from "react-dom";
12
12
  import { createGlobalStyle, styled } from "styled-components";
13
- import { _ as _extends$4, b as usePluginConfig, c as useAllContentTypes, t as transformToUrl, T as Tooltip } from "./index-BMQSVj43.mjs";
13
+ import { _ as _extends$4, b as usePluginConfig, c as useAllContentTypes, t as transformToUrl, P as PLUGIN_NAME, g as getTranslation, T as Tooltip } from "./index-BBL_eQ0G.mjs";
14
14
  var freeGlobal$1 = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
15
15
  var _freeGlobal = freeGlobal$1;
16
16
  var freeGlobal = _freeGlobal;
@@ -16957,6 +16957,7 @@ const Settings = () => {
16957
16957
  const { contentTypes: allContentTypesData } = useAllContentTypes();
16958
16958
  const allContentTypes = allContentTypesData?.filter((ct) => ct.pluginOptions?.webatlas?.active === true);
16959
16959
  const [initialState2, setInitialState] = useState(config || { selectedContentTypes: [] });
16960
+ const { formatMessage } = useIntl();
16960
16961
  function reducer2(settingsState2, action) {
16961
16962
  let updatedContentTypes;
16962
16963
  switch (action.type) {
@@ -16999,8 +17000,11 @@ const Settings = () => {
16999
17000
  /* @__PURE__ */ jsx(
17000
17001
  Layouts.Header,
17001
17002
  {
17002
- title: "Routes",
17003
- subtitle: "Settings",
17003
+ title: PLUGIN_NAME,
17004
+ subtitle: formatMessage({
17005
+ id: getTranslation("settings.page.subtitle"),
17006
+ defaultMessage: "Settings"
17007
+ }),
17004
17008
  primaryAction: /* @__PURE__ */ jsx(
17005
17009
  Button,
17006
17010
  {
@@ -17008,7 +17012,10 @@ const Settings = () => {
17008
17012
  startIcon: /* @__PURE__ */ jsx(Check, {}),
17009
17013
  onClick: save,
17010
17014
  disabled: JSON.stringify(settingsState) === JSON.stringify(initialState2) || settingsState.selectedContentTypes.find((cta) => !cta.default) !== void 0,
17011
- children: "Save"
17015
+ children: formatMessage({
17016
+ id: getTranslation("save"),
17017
+ defaultMessage: "Save"
17018
+ })
17012
17019
  }
17013
17020
  )
17014
17021
  }
@@ -17030,13 +17037,22 @@ const Settings = () => {
17030
17037
  Field.Root,
17031
17038
  {
17032
17039
  name: "selectedContentTypes",
17033
- hint: "Select the content types you want to enable the Webatlas plugin for.",
17040
+ hint: formatMessage({
17041
+ id: getTranslation("settings.page.enabledContentTypes.hint"),
17042
+ defaultMessage: "Select the content types for which you want to enable URL aliases"
17043
+ }),
17034
17044
  children: [
17035
- /* @__PURE__ */ jsx(Field.Label, { children: "Enabled Content Types" }),
17045
+ /* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
17046
+ id: getTranslation("settings.page.enabledContentTypes"),
17047
+ defaultMessage: "Enabled Content Types"
17048
+ }) }),
17036
17049
  /* @__PURE__ */ jsx(
17037
17050
  MultiSelect,
17038
17051
  {
17039
- placeholder: "Select Content Types",
17052
+ placeholder: formatMessage({
17053
+ id: getTranslation("settings.page.enabledContentTypes.placeholder"),
17054
+ defaultMessage: "Select content types..."
17055
+ }),
17040
17056
  onClear: () => dispatch({ type: "SET_SELECTED_CONTENT_TYPES", payload: [] }),
17041
17057
  value: [...settingsState.selectedContentTypes.map((ct) => ct.uid)],
17042
17058
  onChange: (value) => dispatch({
@@ -17056,8 +17072,11 @@ const Settings = () => {
17056
17072
  }
17057
17073
  ),
17058
17074
  settingsState.selectedContentTypes && settingsState.selectedContentTypes.length > 0 && /* @__PURE__ */ jsx(Box, { paddingTop: 4, children: /* @__PURE__ */ jsxs(Field.Root, { name: "selectedContentTypesAccordion", children: [
17059
- /* @__PURE__ */ jsx(Field.Label, { children: "Enabled Content Types Settings" }),
17060
- /* @__PURE__ */ jsx(Accordion.Root, { label: "Content Type settings", children: settingsState.selectedContentTypes?.map((contentType) => {
17075
+ /* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
17076
+ id: getTranslation("settings.page.contentTypeSettings"),
17077
+ defaultMessage: "Content Type settings"
17078
+ }) }),
17079
+ /* @__PURE__ */ jsx(Accordion.Root, { children: settingsState.selectedContentTypes?.map((contentType) => {
17061
17080
  const ct = allContentTypes?.find((item) => item.uid === contentType.uid);
17062
17081
  if (!ct) return null;
17063
17082
  return /* @__PURE__ */ jsx(
@@ -17071,11 +17090,20 @@ const Settings = () => {
17071
17090
  Field.Root,
17072
17091
  {
17073
17092
  name: "selectedContentTypes",
17074
- 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".',
17075
- error: !contentType.default && "Please select a default field",
17093
+ hint: formatMessage({
17094
+ id: getTranslation("settings.page.defaultField.hint"),
17095
+ 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".'
17096
+ }),
17097
+ error: !contentType.default && formatMessage({
17098
+ id: getTranslation("settings.page.defaultField.error"),
17099
+ defaultMessage: "Please select a default field"
17100
+ }),
17076
17101
  required: true,
17077
17102
  children: [
17078
- /* @__PURE__ */ jsx(Field.Label, { children: "Default URL Alias field" }),
17103
+ /* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
17104
+ id: getTranslation("settings.page.defaultField"),
17105
+ defaultMessage: "Default URL Alias field"
17106
+ }) }),
17079
17107
  /* @__PURE__ */ jsx(
17080
17108
  SingleSelect,
17081
17109
  {
@@ -17084,7 +17112,7 @@ const Settings = () => {
17084
17112
  value: contentType?.default || "",
17085
17113
  onChange: (value) => dispatch({ type: "SET_DEFAULT_FIELD", payload: { ctUid: ct.uid, field: value } }),
17086
17114
  children: Object.entries(ct.attributes).map(([key], index) => {
17087
- if (key === "id" || key === "createdAt" || key === "updatedAt" || key === "createdBy" || key === "updatedBy") return null;
17115
+ if (key === "id" || key === "documentId" || key === "createdAt" || key === "updatedAt" || key === "createdBy" || key === "updatedBy" || key === "webatlas_path" || key === "webatlas_override") return null;
17088
17116
  return /* @__PURE__ */ jsx(SingleSelectOption, { value: key, children: key }, index);
17089
17117
  })
17090
17118
  }
@@ -17097,11 +17125,20 @@ const Settings = () => {
17097
17125
  Field.Root,
17098
17126
  {
17099
17127
  name: "urlAliasPattern",
17100
- 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.',
17128
+ hint: formatMessage({
17129
+ id: getTranslation("settings.page.urlAliasPattern.hint"),
17130
+ 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.'
17131
+ }),
17101
17132
  children: [
17102
17133
  /* @__PURE__ */ jsxs(Field.Label, { children: [
17103
- "URL Alias pattern",
17104
- /* @__PURE__ */ jsx(Tooltip, { description: "Leading and trailing slashes will be removed. Spaces will be replaced with hyphens. Special characters will be encoded." })
17134
+ formatMessage({
17135
+ id: getTranslation("settings.page.urlAliasPattern"),
17136
+ defaultMessage: "URL Alias Pattern"
17137
+ }),
17138
+ /* @__PURE__ */ jsx(Tooltip, { description: formatMessage({
17139
+ id: getTranslation("settings.page.urlAliasPattern.tooltip"),
17140
+ defaultMessage: "Leading and trailing slashes will be removed. Spaces will be replaced with hyphens. Special characters will be encoded."
17141
+ }) })
17105
17142
  ] }),
17106
17143
  /* @__PURE__ */ jsx(
17107
17144
  Field.Input,
@@ -17110,7 +17147,10 @@ const Settings = () => {
17110
17147
  onChange: (e2) => dispatch({ type: "SET_PATTERN", payload: { ctUid: ct.uid, pattern: e2.target.value } }),
17111
17148
  disabled: !contentType.default,
17112
17149
  type: "text",
17113
- placeholder: "e.g. blog"
17150
+ placeholder: formatMessage({
17151
+ id: getTranslation("settings.page.urlAliasPattern.placeholder"),
17152
+ defaultMessage: "e.g. blog"
17153
+ })
17114
17154
  }
17115
17155
  ),
17116
17156
  /* @__PURE__ */ jsx(Field.Hint, {})