@mattisvensson/strapi-plugin-webatlas 0.2.4 → 0.2.6

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.
@@ -22,7 +22,7 @@ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
22
22
  );
23
23
  });
24
24
  };
25
- const version = "0.2.3";
25
+ const version = "0.2.5";
26
26
  const keywords = [];
27
27
  const type = "commonjs";
28
28
  const exports = {
@@ -3732,7 +3732,6 @@ const Alias = ({ config }) => {
3732
3732
  const hasUserChangedField = useRef(false);
3733
3733
  const initialPath = useRef("");
3734
3734
  const prevValueRef = useRef(null);
3735
- if (!config) return null;
3736
3735
  const debouncedCheckUrl = useCallback(debounce(checkUrl, 500), []);
3737
3736
  useEffect(() => {
3738
3737
  onChange("webatlas_path", path.value);
@@ -3760,11 +3759,15 @@ const Alias = ({ config }) => {
3760
3759
  [config?.default, config?.pattern, initialValues, isOverride, initialLoadComplete, routeId]
3761
3760
  );
3762
3761
  useEffect(() => {
3763
- if (!initialLoadComplete) return;
3764
3762
  const key = config?.default;
3765
3763
  if (!key) return;
3766
3764
  const currentValue = values[key];
3767
3765
  const initialValue = initialValues[key];
3766
+ if (currentValue && !isOverride) {
3767
+ const path2 = config.pattern ? `${config.pattern}/${currentValue}` : `${currentValue}`;
3768
+ onChange("webatlas_path", path2);
3769
+ }
3770
+ if (!initialLoadComplete) return;
3768
3771
  if (currentValue !== initialValue) {
3769
3772
  hasUserChangedField.current = true;
3770
3773
  }
@@ -3823,6 +3826,7 @@ const Alias = ({ config }) => {
3823
3826
  setValidationState("done");
3824
3827
  }
3825
3828
  }
3829
+ if (!initialLoadComplete) return /* @__PURE__ */ jsx(Typography, { textColor: "neutral600", children: "Loading..." });
3826
3830
  return /* @__PURE__ */ jsx(
3827
3831
  Box,
3828
3832
  {
@@ -3960,7 +3964,7 @@ const CMEditViewAside = () => {
3960
3964
  }
3961
3965
  });
3962
3966
  }, []);
3963
- if (isLoading) return /* @__PURE__ */ jsx(Typography, { textColor: "neutral600", children: "Loading..." });
3967
+ if (isLoading || !config) return /* @__PURE__ */ jsx(Typography, { textColor: "neutral600", children: "Loading..." });
3964
3968
  if (!isAllowedContentType) return /* @__PURE__ */ jsxs(Typography, { textColor: "neutral600", children: [
3965
3969
  "This content type is not allowed for ",
3966
3970
  /* @__PURE__ */ jsx("strong", { children: "WebAtlas" }),
@@ -3985,7 +3989,7 @@ const index = {
3985
3989
  defaultMessage: "Routes"
3986
3990
  },
3987
3991
  Component: async () => {
3988
- const component = await import("./index-rvOUYDZ4.mjs");
3992
+ const component = await import("./index-BMlQpLGa.mjs");
3989
3993
  return { default: component.default };
3990
3994
  },
3991
3995
  permissions: [
@@ -4004,7 +4008,7 @@ const index = {
4004
4008
  defaultMessage: "Navigation"
4005
4009
  },
4006
4010
  Component: async () => {
4007
- const component = await import("./index-BDCJSjey.mjs");
4011
+ const component = await import("./index-uoH_HJQr.mjs");
4008
4012
  return { default: component.default };
4009
4013
  },
4010
4014
  permissions: [
@@ -4033,7 +4037,7 @@ const index = {
4033
4037
  Component: async () => {
4034
4038
  return await import(
4035
4039
  /* webpackChunkName: "webatlas-settings-page" */
4036
- "./index-C3a42qmP.mjs"
4040
+ "./index-B_RPO9ty.mjs"
4037
4041
  );
4038
4042
  },
4039
4043
  permissions: [
@@ -3,7 +3,7 @@ import { useState, useEffect } from "react";
3
3
  import { Layouts } from "@strapi/strapi/admin";
4
4
  import { Table, Thead, Tr, Th, Typography, VisuallyHidden, Tbody, Td, Flex, LinkButton } from "@strapi/design-system";
5
5
  import { Pencil } from "@strapi/icons";
6
- import { u as useApi } from "./index-C4EZHacG.mjs";
6
+ import { u as useApi } from "./index-BMQSVj43.mjs";
7
7
  import { C as Center, E as EmptyBox } from "./EmptyBox-7D4LrvdH.mjs";
8
8
  const Routes = () => {
9
9
  const { getRoutes } = useApi();
@@ -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-C4EZHacG.mjs";
13
+ import { _ as _extends$4, b as usePluginConfig, c as useAllContentTypes, t as transformToUrl, T as Tooltip } from "./index-BMQSVj43.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;
@@ -16975,11 +16975,6 @@ const Settings = () => {
16975
16975
  (ct) => ct.uid === action.payload.ctUid ? { ...ct, pattern: transformToUrl(action.payload.pattern) } : ct
16976
16976
  );
16977
16977
  return { ...settingsState2, selectedContentTypes: updatedContentTypes };
16978
- case "SET_API_FIELD":
16979
- updatedContentTypes = settingsState2.selectedContentTypes.map(
16980
- (ct) => ct.uid === action.payload.ctUid ? { ...ct, apiField: transformToUrl(action.payload.apiField) } : ct
16981
- );
16982
- return { ...settingsState2, selectedContentTypes: updatedContentTypes };
16983
16978
  default:
16984
16979
  throw new Error();
16985
16980
  }
@@ -17049,8 +17044,7 @@ const Settings = () => {
17049
17044
  payload: value.map((v2) => ({
17050
17045
  uid: v2,
17051
17046
  default: "",
17052
- pattern: "",
17053
- apiField: ""
17047
+ pattern: ""
17054
17048
  }))
17055
17049
  }),
17056
17050
  withTags: true,
@@ -17122,30 +17116,6 @@ const Settings = () => {
17122
17116
  /* @__PURE__ */ jsx(Field.Hint, {})
17123
17117
  ]
17124
17118
  }
17125
- ) }),
17126
- /* @__PURE__ */ jsx(Box, { paddingTop: 4, children: /* @__PURE__ */ jsxs(
17127
- Field.Root,
17128
- {
17129
- name: "urlAliasPattern",
17130
- hint: "This field is necessary for the API. Do not change this field unless you know what you are doing.",
17131
- children: [
17132
- /* @__PURE__ */ jsxs(Field.Label, { children: [
17133
- "URL Alias API field",
17134
- /* @__PURE__ */ jsx(Tooltip, { description: "The field which will be visible in the content manger to store the url alias. Necessary for the API." })
17135
- ] }),
17136
- /* @__PURE__ */ jsx(
17137
- Field.Input,
17138
- {
17139
- value: contentType.apiField,
17140
- onChange: (e2) => dispatch({ type: "SET_API_FIELD", payload: { ctUid: ct.uid, apiField: e2.target.value } }),
17141
- disabled: !contentType.default,
17142
- type: "text",
17143
- placeholder: "e.g. teaser.teaser_url"
17144
- }
17145
- ),
17146
- /* @__PURE__ */ jsx(Field.Hint, {})
17147
- ]
17148
- }
17149
17119
  ) })
17150
17120
  ] }) })
17151
17121
  ] }, ct.uid)
@@ -5,7 +5,7 @@ const React = require("react");
5
5
  const admin = require("@strapi/strapi/admin");
6
6
  const designSystem = require("@strapi/design-system");
7
7
  const icons = require("@strapi/icons");
8
- const index = require("./index-CnY7liYv.js");
8
+ const index = require("./index-DrlYDm6a.js");
9
9
  const EmptyBox = require("./EmptyBox-DT6D5gcf.js");
10
10
  const Routes = () => {
11
11
  const { getRoutes } = index.useApi();
@@ -6,7 +6,7 @@ const designSystem = require("@strapi/design-system");
6
6
  const admin = require("@strapi/strapi/admin");
7
7
  const React = require("react");
8
8
  const ReactDOM = require("react-dom");
9
- const index = require("./index-CnY7liYv.js");
9
+ const index = require("./index-DrlYDm6a.js");
10
10
  const EmptyBox = require("./EmptyBox-DT6D5gcf.js");
11
11
  const _baseConvert = require("./_baseConvert-B84_vf8X.js");
12
12
  const core = require("@dnd-kit/core");
@@ -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-CnY7liYv.js");
14
+ const index = require("./index-DrlYDm6a.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;
@@ -16996,11 +16996,6 @@ const Settings = () => {
16996
16996
  (ct) => ct.uid === action.payload.ctUid ? { ...ct, pattern: index.transformToUrl(action.payload.pattern) } : ct
16997
16997
  );
16998
16998
  return { ...settingsState2, selectedContentTypes: updatedContentTypes };
16999
- case "SET_API_FIELD":
17000
- updatedContentTypes = settingsState2.selectedContentTypes.map(
17001
- (ct) => ct.uid === action.payload.ctUid ? { ...ct, apiField: index.transformToUrl(action.payload.apiField) } : ct
17002
- );
17003
- return { ...settingsState2, selectedContentTypes: updatedContentTypes };
17004
16999
  default:
17005
17000
  throw new Error();
17006
17001
  }
@@ -17070,8 +17065,7 @@ const Settings = () => {
17070
17065
  payload: value.map((v2) => ({
17071
17066
  uid: v2,
17072
17067
  default: "",
17073
- pattern: "",
17074
- apiField: ""
17068
+ pattern: ""
17075
17069
  }))
17076
17070
  }),
17077
17071
  withTags: true,
@@ -17143,30 +17137,6 @@ const Settings = () => {
17143
17137
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
17144
17138
  ]
17145
17139
  }
17146
- ) }),
17147
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(
17148
- designSystem.Field.Root,
17149
- {
17150
- name: "urlAliasPattern",
17151
- hint: "This field is necessary for the API. Do not change this field unless you know what you are doing.",
17152
- children: [
17153
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Label, { children: [
17154
- "URL Alias API field",
17155
- /* @__PURE__ */ jsxRuntime.jsx(index.Tooltip, { description: "The field which will be visible in the content manger to store the url alias. Necessary for the API." })
17156
- ] }),
17157
- /* @__PURE__ */ jsxRuntime.jsx(
17158
- designSystem.Field.Input,
17159
- {
17160
- value: contentType.apiField,
17161
- onChange: (e2) => dispatch({ type: "SET_API_FIELD", payload: { ctUid: ct.uid, apiField: e2.target.value } }),
17162
- disabled: !contentType.default,
17163
- type: "text",
17164
- placeholder: "e.g. teaser.teaser_url"
17165
- }
17166
- ),
17167
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
17168
- ]
17169
- }
17170
17140
  ) })
17171
17141
  ] }) })
17172
17142
  ] }, ct.uid)
@@ -40,7 +40,7 @@ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
40
40
  );
41
41
  });
42
42
  };
43
- const version = "0.2.3";
43
+ const version = "0.2.5";
44
44
  const keywords = [];
45
45
  const type = "commonjs";
46
46
  const exports$1 = {
@@ -3750,7 +3750,6 @@ const Alias = ({ config }) => {
3750
3750
  const hasUserChangedField = React.useRef(false);
3751
3751
  const initialPath = React.useRef("");
3752
3752
  const prevValueRef = React.useRef(null);
3753
- if (!config) return null;
3754
3753
  const debouncedCheckUrl = React.useCallback(debounce(checkUrl, 500), []);
3755
3754
  React.useEffect(() => {
3756
3755
  onChange("webatlas_path", path.value);
@@ -3778,11 +3777,15 @@ const Alias = ({ config }) => {
3778
3777
  [config?.default, config?.pattern, initialValues, isOverride, initialLoadComplete, routeId]
3779
3778
  );
3780
3779
  React.useEffect(() => {
3781
- if (!initialLoadComplete) return;
3782
3780
  const key = config?.default;
3783
3781
  if (!key) return;
3784
3782
  const currentValue = values[key];
3785
3783
  const initialValue = initialValues[key];
3784
+ if (currentValue && !isOverride) {
3785
+ const path2 = config.pattern ? `${config.pattern}/${currentValue}` : `${currentValue}`;
3786
+ onChange("webatlas_path", path2);
3787
+ }
3788
+ if (!initialLoadComplete) return;
3786
3789
  if (currentValue !== initialValue) {
3787
3790
  hasUserChangedField.current = true;
3788
3791
  }
@@ -3841,6 +3844,7 @@ const Alias = ({ config }) => {
3841
3844
  setValidationState("done");
3842
3845
  }
3843
3846
  }
3847
+ if (!initialLoadComplete) return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: "Loading..." });
3844
3848
  return /* @__PURE__ */ jsxRuntime.jsx(
3845
3849
  designSystem.Box,
3846
3850
  {
@@ -3978,7 +3982,7 @@ const CMEditViewAside = () => {
3978
3982
  }
3979
3983
  });
3980
3984
  }, []);
3981
- if (isLoading) return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: "Loading..." });
3985
+ if (isLoading || !config) return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: "Loading..." });
3982
3986
  if (!isAllowedContentType) return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { textColor: "neutral600", children: [
3983
3987
  "This content type is not allowed for ",
3984
3988
  /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "WebAtlas" }),
@@ -4003,7 +4007,7 @@ const index = {
4003
4007
  defaultMessage: "Routes"
4004
4008
  },
4005
4009
  Component: async () => {
4006
- const component = await Promise.resolve().then(() => require("./index-B_a-qtdq.js"));
4010
+ const component = await Promise.resolve().then(() => require("./index-BvXbuF1E.js"));
4007
4011
  return { default: component.default };
4008
4012
  },
4009
4013
  permissions: [
@@ -4022,7 +4026,7 @@ const index = {
4022
4026
  defaultMessage: "Navigation"
4023
4027
  },
4024
4028
  Component: async () => {
4025
- const component = await Promise.resolve().then(() => require("./index-BLQ7k9G6.js"));
4029
+ const component = await Promise.resolve().then(() => require("./index-D4IHmUrH.js"));
4026
4030
  return { default: component.default };
4027
4031
  },
4028
4032
  permissions: [
@@ -4051,7 +4055,7 @@ const index = {
4051
4055
  Component: async () => {
4052
4056
  return await Promise.resolve().then(() => require(
4053
4057
  /* webpackChunkName: "webatlas-settings-page" */
4054
- "./index-C9tlbXg0.js"
4058
+ "./index-DIyVy-8D.js"
4055
4059
  ));
4056
4060
  },
4057
4061
  permissions: [
@@ -4,7 +4,7 @@ import { Dialog, Typography, Button, Modal, Flex, SingleSelect, SingleSelectOpti
4
4
  import { useFetchClient, Layouts } from "@strapi/strapi/admin";
5
5
  import { useState, useEffect, createContext, useRef, useContext, useReducer, useCallback, useMemo, forwardRef } from "react";
6
6
  import { createPortal } from "react-dom";
7
- import { u as useApi, d as debounce, a as duplicateCheck, t as transformToUrl, U as URLInfo } from "./index-C4EZHacG.mjs";
7
+ import { u as useApi, d as debounce, a as duplicateCheck, t as transformToUrl, U as URLInfo } from "./index-BMQSVj43.mjs";
8
8
  import { C as Center, E as EmptyBox } from "./EmptyBox-7D4LrvdH.mjs";
9
9
  import { c as commonjsGlobal, _ as _baseConvert } from "./_baseConvert-C2SW1VHq.mjs";
10
10
  import { MeasuringStrategy, DndContext, closestCenter, DragOverlay } from "@dnd-kit/core";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
- const index = require("../_chunks/index-CnY7liYv.js");
2
+ const index = require("../_chunks/index-DrlYDm6a.js");
3
3
  require("react/jsx-runtime");
4
4
  module.exports = index.index;
@@ -1,4 +1,4 @@
1
- import { i } from "../_chunks/index-C4EZHacG.mjs";
1
+ import { i } from "../_chunks/index-BMQSVj43.mjs";
2
2
  import "react/jsx-runtime";
3
3
  export {
4
4
  i as default
@@ -1,5 +1,5 @@
1
1
  import { ConfigContentType } from '../../../../types';
2
2
  declare const Alias: ({ config }: {
3
3
  config: ConfigContentType;
4
- }) => import("react/jsx-runtime").JSX.Element | null;
4
+ }) => import("react/jsx-runtime").JSX.Element;
5
5
  export default Alias;
@@ -20,7 +20,7 @@ function transformToUrl(input) {
20
20
  input = input.replace(/-+/g, "-");
21
21
  return input;
22
22
  }
23
- const version = "0.2.4";
23
+ const version = "0.2.6";
24
24
  const keywords = [];
25
25
  const type = "commonjs";
26
26
  const exports$1 = {
@@ -877,7 +877,6 @@ const register = ({ strapi: strapi2 }) => {
877
877
  const { attributes } = contentType;
878
878
  const fieldSettings = {
879
879
  writable: true,
880
- private: true,
881
880
  configurable: false,
882
881
  editable: false,
883
882
  visible: true,
@@ -885,11 +884,13 @@ const register = ({ strapi: strapi2 }) => {
885
884
  };
886
885
  set$1(attributes, "webatlas_path", {
887
886
  ...fieldSettings,
888
- type: "string"
887
+ type: "string",
888
+ private: false
889
889
  });
890
890
  set$1(attributes, "webatlas_override", {
891
891
  ...fieldSettings,
892
- type: "boolean"
892
+ type: "boolean",
893
+ private: true
893
894
  });
894
895
  });
895
896
  };
@@ -973,10 +974,10 @@ const schema$2 = {
973
974
  },
974
975
  navitem: {
975
976
  type: "relation",
976
- relation: "oneToOne",
977
+ configurable: true,
978
+ relation: "oneToMany",
977
979
  target: "plugin::webatlas.navitem",
978
- mappedBy: "route",
979
- configurable: false
980
+ mappedBy: "route"
980
981
  },
981
982
  wrapper: {
982
983
  type: "boolean",
@@ -1027,10 +1028,10 @@ const schema$1 = {
1027
1028
  },
1028
1029
  items: {
1029
1030
  type: "relation",
1031
+ configurable: false,
1030
1032
  relation: "oneToMany",
1031
1033
  target: "plugin::webatlas.navitem",
1032
- configurable: false,
1033
- mappedBy: "plugin::webatlas.navigation"
1034
+ mappedBy: "navigation"
1034
1035
  }
1035
1036
  }
1036
1037
  };
@@ -1060,23 +1061,23 @@ const schema = {
1060
1061
  attributes: {
1061
1062
  navigation: {
1062
1063
  type: "relation",
1064
+ configurable: false,
1063
1065
  relation: "manyToOne",
1064
1066
  target: "plugin::webatlas.navigation",
1065
- configurable: false,
1066
1067
  inversedBy: "items"
1067
1068
  },
1068
1069
  route: {
1069
1070
  type: "relation",
1070
- relation: "oneToOne",
1071
+ configurable: false,
1072
+ relation: "manyToOne",
1071
1073
  target: "plugin::webatlas.route",
1072
- inversedBy: "navitem",
1073
- configurable: false
1074
+ inversedBy: "navitem"
1074
1075
  },
1075
1076
  parent: {
1076
1077
  type: "relation",
1078
+ configurable: false,
1077
1079
  relation: "oneToOne",
1078
- target: "plugin::webatlas.navitem",
1079
- configurable: false
1080
+ target: "plugin::webatlas.navitem"
1080
1081
  },
1081
1082
  order: {
1082
1083
  type: "integer",