@mattisvensson/strapi-plugin-webatlas 0.12.1 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -2
- package/dist/admin/{SettingTitle-Ib_0AvoZ.js → ContentBox-D4PGQ8eh.js} +1 -5
- package/dist/admin/{SettingTitle-0mKlA80i.mjs → ContentBox-KyQN2KGV.mjs} +2 -6
- package/dist/admin/{RoutePicker-IRZiHKFi.mjs → RoutePicker-CgndSXoF.mjs} +1 -1
- package/dist/admin/{RoutePicker-C3_tzz9U.js → RoutePicker-CwoMMhf_.js} +1 -1
- package/dist/admin/WarningBox-AyYq0Onj.mjs +18 -0
- package/dist/admin/{WarningBox-BZ3BZ5fR.js → WarningBox-FF1yYDXP.js} +0 -24
- package/dist/admin/{de-DhwCZE_m.js → de-Cl0vM1wA.js} +52 -4
- package/dist/admin/{de-BFjenpyN.mjs → de-DWs5ckOd.mjs} +52 -4
- package/dist/admin/{en-CGCh9ld_.mjs → en-CyhISGZi.mjs} +52 -4
- package/dist/admin/{en-C-rPCNd2.js → en-DSmtmPYk.js} +52 -4
- package/dist/admin/{index-ByxM39aL.mjs → index-BKhrfzjO.mjs} +105 -33
- package/dist/admin/{index-Bym1mXg1.mjs → index-Bv5Ri-ri.mjs} +44 -12
- package/dist/admin/{index-88JTX1Mj.js → index-BxGPKxr_.js} +50 -18
- package/dist/admin/index-Ctm4TBT5.mjs +5308 -0
- package/dist/admin/{index-PD3gcnXA.mjs → index-D2O7sLKs.mjs} +1 -1
- package/dist/admin/{index-CsKnBzp6.js → index-DTrsl_uN.js} +105 -33
- package/dist/admin/index-FvaXwOH0.mjs +174 -0
- package/dist/admin/index-JBUU7dE6.js +5308 -0
- package/dist/admin/{index-DNBXz42q.js → index-jOCO4_-k.js} +1 -1
- package/dist/admin/index-uOC1Clyv.js +174 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/server/index.js +443 -96
- package/dist/server/index.mjs +444 -97
- package/dist/server/src/index.d.ts +17 -4
- package/package.json +3 -3
- package/dist/admin/WarningBox-CXEmXfVx.mjs +0 -42
- package/dist/admin/index-BPUJTNed.js +0 -9622
- package/dist/admin/index-BY6JLZrD.mjs +0 -9622
- package/dist/admin/index-CEJBltoJ.js +0 -147
- package/dist/admin/index-CNCyng5O.mjs +0 -147
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
-
const React = require("react");
|
|
5
|
-
const designSystem = require("@strapi/design-system");
|
|
6
|
-
const admin = require("@strapi/strapi/admin");
|
|
7
|
-
const index = require("./index-CsKnBzp6.js");
|
|
8
|
-
const FullLoader = require("./FullLoader-C4hXFaLP.js");
|
|
9
|
-
const reactIntl = require("react-intl");
|
|
10
|
-
require("@strapi/icons/symbols");
|
|
11
|
-
require("@strapi/icons");
|
|
12
|
-
const SettingTitle = require("./SettingTitle-Ib_0AvoZ.js");
|
|
13
|
-
function reducer(newConfig, action) {
|
|
14
|
-
switch (action.type) {
|
|
15
|
-
case "SET_MAX_DEPTH":
|
|
16
|
-
if (!newConfig) return null;
|
|
17
|
-
return {
|
|
18
|
-
...newConfig,
|
|
19
|
-
navigation: { ...newConfig.navigation, maxDepth: action.payload },
|
|
20
|
-
selectedContentTypes: newConfig.selectedContentTypes || []
|
|
21
|
-
};
|
|
22
|
-
case "SET_CONFIG":
|
|
23
|
-
return action.payload;
|
|
24
|
-
default:
|
|
25
|
-
throw new Error();
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
const Settings = () => {
|
|
29
|
-
const { config: fetchedConfig, setConfig, loading, fetchError } = index.usePluginConfig();
|
|
30
|
-
const [config, dispatch] = React.useReducer(reducer, fetchedConfig);
|
|
31
|
-
const { toggleNotification } = admin.useNotification();
|
|
32
|
-
const getErrorMessage = FullLoader.useErrorMessage();
|
|
33
|
-
const { formatMessage } = reactIntl.useIntl();
|
|
34
|
-
const [isSaving, setIsSaving] = React.useState(false);
|
|
35
|
-
const initialConfig = React.useRef(fetchedConfig);
|
|
36
|
-
React.useEffect(() => {
|
|
37
|
-
initialConfig.current = fetchedConfig;
|
|
38
|
-
if (fetchedConfig) dispatch({ type: "SET_CONFIG", payload: fetchedConfig });
|
|
39
|
-
}, [fetchedConfig]);
|
|
40
|
-
React.useEffect(() => {
|
|
41
|
-
if (fetchError) {
|
|
42
|
-
toggleNotification({
|
|
43
|
-
type: "danger",
|
|
44
|
-
message: getErrorMessage(
|
|
45
|
-
fetchError,
|
|
46
|
-
formatMessage({
|
|
47
|
-
id: index.getTranslation("notification.error"),
|
|
48
|
-
defaultMessage: "An error occurred"
|
|
49
|
-
})
|
|
50
|
-
)
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
}, [fetchError, toggleNotification, getErrorMessage, formatMessage]);
|
|
54
|
-
async function save() {
|
|
55
|
-
if (!config) return;
|
|
56
|
-
setIsSaving(true);
|
|
57
|
-
try {
|
|
58
|
-
await setConfig({ navigation: config.navigation });
|
|
59
|
-
initialConfig.current = config;
|
|
60
|
-
toggleNotification({
|
|
61
|
-
type: "success",
|
|
62
|
-
message: formatMessage({
|
|
63
|
-
id: index.getTranslation("notification.settings.saved"),
|
|
64
|
-
defaultMessage: "Settings saved successfully"
|
|
65
|
-
})
|
|
66
|
-
});
|
|
67
|
-
setIsSaving(false);
|
|
68
|
-
} catch (err) {
|
|
69
|
-
setIsSaving(false);
|
|
70
|
-
toggleNotification({
|
|
71
|
-
type: "danger",
|
|
72
|
-
message: getErrorMessage(
|
|
73
|
-
err,
|
|
74
|
-
formatMessage({
|
|
75
|
-
id: index.getTranslation("notification.error"),
|
|
76
|
-
defaultMessage: "An error occurred"
|
|
77
|
-
})
|
|
78
|
-
)
|
|
79
|
-
});
|
|
80
|
-
console.error(err);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
if (loading) {
|
|
84
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
85
|
-
SettingTitle.PageWrapper,
|
|
86
|
-
{
|
|
87
|
-
isSaving,
|
|
88
|
-
subtitle: formatMessage({
|
|
89
|
-
id: index.getTranslation("loading"),
|
|
90
|
-
defaultMessage: "Loading..."
|
|
91
|
-
}),
|
|
92
|
-
disabledCondition: true,
|
|
93
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(FullLoader.FullLoader, { height: 200 })
|
|
94
|
-
}
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
return /* @__PURE__ */ jsxRuntime.jsx(admin.Page.Protect, { permissions: index.pluginPermissions["settings.navigation"], children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
98
|
-
SettingTitle.PageWrapper,
|
|
99
|
-
{
|
|
100
|
-
save,
|
|
101
|
-
isSaving,
|
|
102
|
-
subtitle: formatMessage({
|
|
103
|
-
id: index.getTranslation("settings.page.navigation.subtitle"),
|
|
104
|
-
defaultMessage: "Configure navigation settings"
|
|
105
|
-
}),
|
|
106
|
-
disabledCondition: JSON.stringify(config) === JSON.stringify(initialConfig.current),
|
|
107
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
108
|
-
SettingTitle.ContentBox,
|
|
109
|
-
{
|
|
110
|
-
title: formatMessage({
|
|
111
|
-
id: index.getTranslation("settings.page.navigation.navigation"),
|
|
112
|
-
defaultMessage: "Navigation"
|
|
113
|
-
}),
|
|
114
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { name: "maxNavDepth", children: [
|
|
115
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: /* @__PURE__ */ jsxRuntime.jsx(SettingTitle.SettingTitle, { children: formatMessage({
|
|
116
|
-
id: index.getTranslation("settings.page.navigation.maxNavDepth.label"),
|
|
117
|
-
defaultMessage: "Max depth of navigation tree"
|
|
118
|
-
}) }) }),
|
|
119
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
120
|
-
designSystem.Field.Input,
|
|
121
|
-
{
|
|
122
|
-
id: "maxNavDepth",
|
|
123
|
-
type: "number",
|
|
124
|
-
min: 0,
|
|
125
|
-
step: 1,
|
|
126
|
-
value: config?.navigation?.maxDepth !== void 0 ? config.navigation.maxDepth + 1 : "",
|
|
127
|
-
onChange: (e) => dispatch({
|
|
128
|
-
type: "SET_MAX_DEPTH",
|
|
129
|
-
payload: Number(e.target.value) - 1
|
|
130
|
-
}),
|
|
131
|
-
onBlur: (e) => {
|
|
132
|
-
if (e.target.value === "") return;
|
|
133
|
-
dispatch({
|
|
134
|
-
type: "SET_MAX_DEPTH",
|
|
135
|
-
payload: Number(e.target.value) - 1
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
),
|
|
140
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
|
|
141
|
-
] })
|
|
142
|
-
}
|
|
143
|
-
)
|
|
144
|
-
}
|
|
145
|
-
) });
|
|
146
|
-
};
|
|
147
|
-
exports.default = Settings;
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useReducer, useState, useRef, useEffect } from "react";
|
|
3
|
-
import { Field } from "@strapi/design-system";
|
|
4
|
-
import { useNotification, Page } from "@strapi/strapi/admin";
|
|
5
|
-
import { c as usePluginConfig, g as getTranslation, p as pluginPermissions } from "./index-ByxM39aL.mjs";
|
|
6
|
-
import { u as useErrorMessage, F as FullLoader } from "./FullLoader-BTZzPY8g.mjs";
|
|
7
|
-
import { useIntl } from "react-intl";
|
|
8
|
-
import "@strapi/icons/symbols";
|
|
9
|
-
import "@strapi/icons";
|
|
10
|
-
import { P as PageWrapper, C as ContentBox, S as SettingTitle } from "./SettingTitle-0mKlA80i.mjs";
|
|
11
|
-
function reducer(newConfig, action) {
|
|
12
|
-
switch (action.type) {
|
|
13
|
-
case "SET_MAX_DEPTH":
|
|
14
|
-
if (!newConfig) return null;
|
|
15
|
-
return {
|
|
16
|
-
...newConfig,
|
|
17
|
-
navigation: { ...newConfig.navigation, maxDepth: action.payload },
|
|
18
|
-
selectedContentTypes: newConfig.selectedContentTypes || []
|
|
19
|
-
};
|
|
20
|
-
case "SET_CONFIG":
|
|
21
|
-
return action.payload;
|
|
22
|
-
default:
|
|
23
|
-
throw new Error();
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
const Settings = () => {
|
|
27
|
-
const { config: fetchedConfig, setConfig, loading, fetchError } = usePluginConfig();
|
|
28
|
-
const [config, dispatch] = useReducer(reducer, fetchedConfig);
|
|
29
|
-
const { toggleNotification } = useNotification();
|
|
30
|
-
const getErrorMessage = useErrorMessage();
|
|
31
|
-
const { formatMessage } = useIntl();
|
|
32
|
-
const [isSaving, setIsSaving] = useState(false);
|
|
33
|
-
const initialConfig = useRef(fetchedConfig);
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
initialConfig.current = fetchedConfig;
|
|
36
|
-
if (fetchedConfig) dispatch({ type: "SET_CONFIG", payload: fetchedConfig });
|
|
37
|
-
}, [fetchedConfig]);
|
|
38
|
-
useEffect(() => {
|
|
39
|
-
if (fetchError) {
|
|
40
|
-
toggleNotification({
|
|
41
|
-
type: "danger",
|
|
42
|
-
message: getErrorMessage(
|
|
43
|
-
fetchError,
|
|
44
|
-
formatMessage({
|
|
45
|
-
id: getTranslation("notification.error"),
|
|
46
|
-
defaultMessage: "An error occurred"
|
|
47
|
-
})
|
|
48
|
-
)
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
}, [fetchError, toggleNotification, getErrorMessage, formatMessage]);
|
|
52
|
-
async function save() {
|
|
53
|
-
if (!config) return;
|
|
54
|
-
setIsSaving(true);
|
|
55
|
-
try {
|
|
56
|
-
await setConfig({ navigation: config.navigation });
|
|
57
|
-
initialConfig.current = config;
|
|
58
|
-
toggleNotification({
|
|
59
|
-
type: "success",
|
|
60
|
-
message: formatMessage({
|
|
61
|
-
id: getTranslation("notification.settings.saved"),
|
|
62
|
-
defaultMessage: "Settings saved successfully"
|
|
63
|
-
})
|
|
64
|
-
});
|
|
65
|
-
setIsSaving(false);
|
|
66
|
-
} catch (err) {
|
|
67
|
-
setIsSaving(false);
|
|
68
|
-
toggleNotification({
|
|
69
|
-
type: "danger",
|
|
70
|
-
message: getErrorMessage(
|
|
71
|
-
err,
|
|
72
|
-
formatMessage({
|
|
73
|
-
id: getTranslation("notification.error"),
|
|
74
|
-
defaultMessage: "An error occurred"
|
|
75
|
-
})
|
|
76
|
-
)
|
|
77
|
-
});
|
|
78
|
-
console.error(err);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
if (loading) {
|
|
82
|
-
return /* @__PURE__ */ jsx(
|
|
83
|
-
PageWrapper,
|
|
84
|
-
{
|
|
85
|
-
isSaving,
|
|
86
|
-
subtitle: formatMessage({
|
|
87
|
-
id: getTranslation("loading"),
|
|
88
|
-
defaultMessage: "Loading..."
|
|
89
|
-
}),
|
|
90
|
-
disabledCondition: true,
|
|
91
|
-
children: /* @__PURE__ */ jsx(FullLoader, { height: 200 })
|
|
92
|
-
}
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
return /* @__PURE__ */ jsx(Page.Protect, { permissions: pluginPermissions["settings.navigation"], children: /* @__PURE__ */ jsx(
|
|
96
|
-
PageWrapper,
|
|
97
|
-
{
|
|
98
|
-
save,
|
|
99
|
-
isSaving,
|
|
100
|
-
subtitle: formatMessage({
|
|
101
|
-
id: getTranslation("settings.page.navigation.subtitle"),
|
|
102
|
-
defaultMessage: "Configure navigation settings"
|
|
103
|
-
}),
|
|
104
|
-
disabledCondition: JSON.stringify(config) === JSON.stringify(initialConfig.current),
|
|
105
|
-
children: /* @__PURE__ */ jsx(
|
|
106
|
-
ContentBox,
|
|
107
|
-
{
|
|
108
|
-
title: formatMessage({
|
|
109
|
-
id: getTranslation("settings.page.navigation.navigation"),
|
|
110
|
-
defaultMessage: "Navigation"
|
|
111
|
-
}),
|
|
112
|
-
children: /* @__PURE__ */ jsxs(Field.Root, { name: "maxNavDepth", children: [
|
|
113
|
-
/* @__PURE__ */ jsx(Field.Label, { children: /* @__PURE__ */ jsx(SettingTitle, { children: formatMessage({
|
|
114
|
-
id: getTranslation("settings.page.navigation.maxNavDepth.label"),
|
|
115
|
-
defaultMessage: "Max depth of navigation tree"
|
|
116
|
-
}) }) }),
|
|
117
|
-
/* @__PURE__ */ jsx(
|
|
118
|
-
Field.Input,
|
|
119
|
-
{
|
|
120
|
-
id: "maxNavDepth",
|
|
121
|
-
type: "number",
|
|
122
|
-
min: 0,
|
|
123
|
-
step: 1,
|
|
124
|
-
value: config?.navigation?.maxDepth !== void 0 ? config.navigation.maxDepth + 1 : "",
|
|
125
|
-
onChange: (e) => dispatch({
|
|
126
|
-
type: "SET_MAX_DEPTH",
|
|
127
|
-
payload: Number(e.target.value) - 1
|
|
128
|
-
}),
|
|
129
|
-
onBlur: (e) => {
|
|
130
|
-
if (e.target.value === "") return;
|
|
131
|
-
dispatch({
|
|
132
|
-
type: "SET_MAX_DEPTH",
|
|
133
|
-
payload: Number(e.target.value) - 1
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
),
|
|
138
|
-
/* @__PURE__ */ jsx(Field.Hint, {})
|
|
139
|
-
] })
|
|
140
|
-
}
|
|
141
|
-
)
|
|
142
|
-
}
|
|
143
|
-
) });
|
|
144
|
-
};
|
|
145
|
-
export {
|
|
146
|
-
Settings as default
|
|
147
|
-
};
|