@mattisvensson/strapi-plugin-webatlas 0.11.4 → 0.11.5
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/dist/admin/{SettingTitle-BdiDHFXF.js → SettingTitle-DGSkTF7e.js} +1 -1
- package/dist/admin/{SettingTitle-CcNfx_4T.mjs → SettingTitle-UPbQCuTC.mjs} +1 -1
- package/dist/admin/{index-uW7YJoRU.js → index-BiXgA5Ru.js} +5 -5
- package/dist/admin/{index-BkPtrXJO.js → index-Bm8lkiNL.js} +25 -15
- package/dist/admin/{index-DBG6vBGU.js → index-BztvKcfc.js} +1 -1
- package/dist/admin/{index-BMTlUOrK.mjs → index-CrgTYzgl.mjs} +2 -2
- package/dist/admin/{index-Sj2FxwAu.js → index-CyzPvvul.js} +2 -2
- package/dist/admin/{index-DkEReTkt.mjs → index-D4B4s4XO.mjs} +2 -2
- package/dist/admin/{index-DkfE_arE.mjs → index-DLoZpHxU.mjs} +5 -5
- package/dist/admin/{index-CEBh9c4X.js → index-DcUmtUyp.js} +2 -2
- package/dist/admin/{index-BX3hiURm.mjs → index-Dx-EVn-t.mjs} +25 -15
- package/dist/admin/{index-BdyLsiR4.mjs → index-b3yS9Dm7.mjs} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/server/index.js +109 -123
- package/dist/server/index.mjs +109 -123
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
const jsxRuntime = require("react/jsx-runtime");
|
|
3
3
|
const designSystem = require("@strapi/design-system");
|
|
4
4
|
const admin = require("@strapi/strapi/admin");
|
|
5
|
-
const index = require("./index-
|
|
5
|
+
const index = require("./index-Bm8lkiNL.js");
|
|
6
6
|
const reactIntl = require("react-intl");
|
|
7
7
|
const icons = require("@strapi/icons");
|
|
8
8
|
function PageWrapper({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Button, Flex, Typography, Box } from "@strapi/design-system";
|
|
3
3
|
import { Page, Layouts } from "@strapi/strapi/admin";
|
|
4
|
-
import { f as PLUGIN_NAME, g as getTranslation } from "./index-
|
|
4
|
+
import { f as PLUGIN_NAME, g as getTranslation } from "./index-Dx-EVn-t.mjs";
|
|
5
5
|
import { useIntl } from "react-intl";
|
|
6
6
|
import { Check } from "@strapi/icons";
|
|
7
7
|
function PageWrapper({
|
|
@@ -7,7 +7,7 @@ const designSystem = require("@strapi/design-system");
|
|
|
7
7
|
const React = require("react");
|
|
8
8
|
const ReactDOM = require("react-dom");
|
|
9
9
|
const reactIntl = require("react-intl");
|
|
10
|
-
const index = require("./index-
|
|
10
|
+
const index = require("./index-Bm8lkiNL.js");
|
|
11
11
|
const admin = require("@strapi/strapi/admin");
|
|
12
12
|
const FullLoader = require("./FullLoader-Da2n70bJ.js");
|
|
13
13
|
const symbols = require("@strapi/icons/symbols");
|
|
@@ -582,8 +582,8 @@ function pathReducer(state, action) {
|
|
|
582
582
|
prevValue: state.value,
|
|
583
583
|
needsUrlCheck: false
|
|
584
584
|
};
|
|
585
|
-
case "
|
|
586
|
-
return { ...state, needsUrlCheck: false };
|
|
585
|
+
case "SET_URL_CHECK_FLAG":
|
|
586
|
+
return { ...state, needsUrlCheck: action.payload || false };
|
|
587
587
|
case "SET_REPLACEMENT":
|
|
588
588
|
return { ...state, replacement: action.payload };
|
|
589
589
|
case "SET_UIDPATH":
|
|
@@ -866,7 +866,7 @@ function ItemDetails({
|
|
|
866
866
|
routeDocumentId: route.documentId,
|
|
867
867
|
withoutTransform: true
|
|
868
868
|
});
|
|
869
|
-
dispatchPath({ type: "
|
|
869
|
+
dispatchPath({ type: "SET_URL_CHECK_FLAG" });
|
|
870
870
|
}
|
|
871
871
|
}, [path.needsUrlCheck, route.documentId]);
|
|
872
872
|
React.useEffect(() => {
|
|
@@ -6747,7 +6747,7 @@ function ItemEditComponent({
|
|
|
6747
6747
|
url: path.value,
|
|
6748
6748
|
routeDocumentId: item.route.documentId
|
|
6749
6749
|
});
|
|
6750
|
-
dispatchPath({ type: "
|
|
6750
|
+
dispatchPath({ type: "SET_URL_CHECK_FLAG" });
|
|
6751
6751
|
}
|
|
6752
6752
|
}, [path.needsUrlCheck, item.route.documentId]);
|
|
6753
6753
|
const updateItem = async () => {
|
|
@@ -70,7 +70,7 @@ function transformToUrl(input, replaceSlash = true) {
|
|
|
70
70
|
input = input.replace(/-+/g, "-");
|
|
71
71
|
return input;
|
|
72
72
|
}
|
|
73
|
-
const version = "0.11.
|
|
73
|
+
const version = "0.11.4";
|
|
74
74
|
const strapi$1 = { "name": "webatlas", "displayName": "Webatlas" };
|
|
75
75
|
const pluginPkg = {
|
|
76
76
|
version,
|
|
@@ -3681,7 +3681,7 @@ function Tooltip({ description }) {
|
|
|
3681
3681
|
) }) })
|
|
3682
3682
|
] }) });
|
|
3683
3683
|
}
|
|
3684
|
-
function PathInput({ path, dispatchPath, isOverride, config }) {
|
|
3684
|
+
function PathInput({ path, dispatchPath, isOverride, config, hasUserInteracted }) {
|
|
3685
3685
|
const { formatMessage } = reactIntl.useIntl();
|
|
3686
3686
|
const displayedPath = isOverride && path.overridePath !== void 0 ? path.overridePath : path.value ?? "";
|
|
3687
3687
|
const inputBorder = path.replacement === null ? "" : path.replacement ? "1px solid #ee5e52" : "1px solid #5cb176";
|
|
@@ -3719,12 +3719,21 @@ function PathInput({ path, dispatchPath, isOverride, config }) {
|
|
|
3719
3719
|
{
|
|
3720
3720
|
id: "path-input",
|
|
3721
3721
|
value: displayedPath,
|
|
3722
|
-
onChange: (e) =>
|
|
3722
|
+
onChange: (e) => {
|
|
3723
|
+
hasUserInteracted.current = true;
|
|
3724
|
+
dispatchPath({ type: "SET_OVERRIDEPATH", payload: e.target.value });
|
|
3725
|
+
},
|
|
3723
3726
|
disabled: !isOverride,
|
|
3724
|
-
onBlur: (e) =>
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3727
|
+
onBlur: (e) => {
|
|
3728
|
+
dispatchPath({
|
|
3729
|
+
type: "SET_OVERRIDEPATH",
|
|
3730
|
+
payload: transformToUrl(e.target.value, false)
|
|
3731
|
+
});
|
|
3732
|
+
dispatchPath({
|
|
3733
|
+
type: "SET_URL_CHECK_FLAG",
|
|
3734
|
+
payload: true
|
|
3735
|
+
});
|
|
3736
|
+
},
|
|
3728
3737
|
style: { outline: inputBorder }
|
|
3729
3738
|
}
|
|
3730
3739
|
),
|
|
@@ -3813,8 +3822,8 @@ function reducer(state, action) {
|
|
|
3813
3822
|
prevValue: state.value,
|
|
3814
3823
|
needsUrlCheck: false
|
|
3815
3824
|
};
|
|
3816
|
-
case "
|
|
3817
|
-
return { ...state, needsUrlCheck: false };
|
|
3825
|
+
case "SET_URL_CHECK_FLAG":
|
|
3826
|
+
return { ...state, needsUrlCheck: action.payload || false };
|
|
3818
3827
|
case "SET_REPLACEMENT":
|
|
3819
3828
|
return { ...state, replacement: action.payload };
|
|
3820
3829
|
case "SET_UIDPATH":
|
|
@@ -3946,7 +3955,7 @@ const Panel = ({ config }) => {
|
|
|
3946
3955
|
if (path.needsUrlCheck && path.value) {
|
|
3947
3956
|
if (path.uidPath === path.value || initialPath.current === path.value) return;
|
|
3948
3957
|
debouncedCheckPath(path.value, route?.documentId || null);
|
|
3949
|
-
dispatchPath({ type: "
|
|
3958
|
+
dispatchPath({ type: "SET_URL_CHECK_FLAG" });
|
|
3950
3959
|
} else {
|
|
3951
3960
|
setValidationState("idle");
|
|
3952
3961
|
dispatchPath({ type: "SET_REPLACEMENT", payload: null });
|
|
@@ -4073,7 +4082,8 @@ const Panel = ({ config }) => {
|
|
|
4073
4082
|
path,
|
|
4074
4083
|
dispatchPath,
|
|
4075
4084
|
isOverride,
|
|
4076
|
-
config
|
|
4085
|
+
config,
|
|
4086
|
+
hasUserInteracted
|
|
4077
4087
|
}
|
|
4078
4088
|
),
|
|
4079
4089
|
validationState !== "initial" && /* @__PURE__ */ jsxRuntime.jsx(PathInfo, { validationState, replacement: path.replacement })
|
|
@@ -4159,7 +4169,7 @@ const index = {
|
|
|
4159
4169
|
id: `${PLUGIN_ID}.link.paths`,
|
|
4160
4170
|
defaultMessage: "Paths"
|
|
4161
4171
|
},
|
|
4162
|
-
Component: () => Promise.resolve().then(() => require("./index-
|
|
4172
|
+
Component: () => Promise.resolve().then(() => require("./index-BztvKcfc.js")),
|
|
4163
4173
|
permissions: [pluginPermissions["page.routes"][0]]
|
|
4164
4174
|
});
|
|
4165
4175
|
app.addMenuLink({
|
|
@@ -4169,7 +4179,7 @@ const index = {
|
|
|
4169
4179
|
id: `${PLUGIN_ID}.link.navigation`,
|
|
4170
4180
|
defaultMessage: "Navigation"
|
|
4171
4181
|
},
|
|
4172
|
-
Component: () => Promise.resolve().then(() => require("./index-
|
|
4182
|
+
Component: () => Promise.resolve().then(() => require("./index-BiXgA5Ru.js")),
|
|
4173
4183
|
permissions: [pluginPermissions["page.navigation"][0]]
|
|
4174
4184
|
});
|
|
4175
4185
|
app.addSettingsLink(
|
|
@@ -4187,7 +4197,7 @@ const index = {
|
|
|
4187
4197
|
},
|
|
4188
4198
|
id: `${PLUGIN_ID}-general`,
|
|
4189
4199
|
to: `${PLUGIN_ID}/general`,
|
|
4190
|
-
Component: () => Promise.resolve().then(() => require("./index-
|
|
4200
|
+
Component: () => Promise.resolve().then(() => require("./index-DcUmtUyp.js")),
|
|
4191
4201
|
permissions: [pluginPermissions["settings.general"][0]]
|
|
4192
4202
|
}
|
|
4193
4203
|
);
|
|
@@ -4198,7 +4208,7 @@ const index = {
|
|
|
4198
4208
|
},
|
|
4199
4209
|
id: `${PLUGIN_ID}-navigation`,
|
|
4200
4210
|
to: `${PLUGIN_ID}/navigation`,
|
|
4201
|
-
Component: () => Promise.resolve().then(() => require("./index-
|
|
4211
|
+
Component: () => Promise.resolve().then(() => require("./index-CyzPvvul.js")),
|
|
4202
4212
|
permissions: [pluginPermissions["settings.navigation"][0]]
|
|
4203
4213
|
});
|
|
4204
4214
|
app.registerPlugin({
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const React = require("react");
|
|
5
|
-
const index = require("./index-
|
|
5
|
+
const index = require("./index-Bm8lkiNL.js");
|
|
6
6
|
const admin = require("@strapi/strapi/admin");
|
|
7
7
|
const designSystem = require("@strapi/design-system");
|
|
8
8
|
require("@strapi/icons/symbols");
|
|
@@ -2,11 +2,11 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useReducer, useState, useRef, useEffect } from "react";
|
|
3
3
|
import { Box, Accordion, Field, SingleSelect, SingleSelectOption, Typography, Link } from "@strapi/design-system";
|
|
4
4
|
import { useNotification, Page } from "@strapi/strapi/admin";
|
|
5
|
-
import { g as getTranslation, c as usePluginConfig, e as useAllContentTypes, p as pluginPermissions, f as PLUGIN_NAME, h as PLUGIN_VERSION } from "./index-
|
|
5
|
+
import { g as getTranslation, c as usePluginConfig, e as useAllContentTypes, p as pluginPermissions, f as PLUGIN_NAME, h as PLUGIN_VERSION } from "./index-Dx-EVn-t.mjs";
|
|
6
6
|
import { useIntl } from "react-intl";
|
|
7
7
|
import "@strapi/icons/symbols";
|
|
8
8
|
import { F as FullLoader } from "./FullLoader-Btjb2W2p.mjs";
|
|
9
|
-
import { P as PageWrapper, C as ContentBox, S as SettingTitle } from "./SettingTitle-
|
|
9
|
+
import { P as PageWrapper, C as ContentBox, S as SettingTitle } from "./SettingTitle-UPbQCuTC.mjs";
|
|
10
10
|
import { ExternalLink } from "@strapi/icons";
|
|
11
11
|
function ContentTypeAccordion({
|
|
12
12
|
contentType,
|
|
@@ -4,11 +4,11 @@ const jsxRuntime = require("react/jsx-runtime");
|
|
|
4
4
|
const React = require("react");
|
|
5
5
|
const designSystem = require("@strapi/design-system");
|
|
6
6
|
const admin = require("@strapi/strapi/admin");
|
|
7
|
-
const index = require("./index-
|
|
7
|
+
const index = require("./index-Bm8lkiNL.js");
|
|
8
8
|
const reactIntl = require("react-intl");
|
|
9
9
|
require("@strapi/icons/symbols");
|
|
10
10
|
const FullLoader = require("./FullLoader-Da2n70bJ.js");
|
|
11
|
-
const SettingTitle = require("./SettingTitle-
|
|
11
|
+
const SettingTitle = require("./SettingTitle-DGSkTF7e.js");
|
|
12
12
|
function reducer(newConfig, action) {
|
|
13
13
|
switch (action.type) {
|
|
14
14
|
case "SET_MAX_DEPTH":
|
|
@@ -2,11 +2,11 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useReducer, useState, useRef, useEffect } from "react";
|
|
3
3
|
import { Field } from "@strapi/design-system";
|
|
4
4
|
import { useNotification, Page } from "@strapi/strapi/admin";
|
|
5
|
-
import { c as usePluginConfig, g as getTranslation, p as pluginPermissions } from "./index-
|
|
5
|
+
import { c as usePluginConfig, g as getTranslation, p as pluginPermissions } from "./index-Dx-EVn-t.mjs";
|
|
6
6
|
import { useIntl } from "react-intl";
|
|
7
7
|
import "@strapi/icons/symbols";
|
|
8
8
|
import { F as FullLoader } from "./FullLoader-Btjb2W2p.mjs";
|
|
9
|
-
import { P as PageWrapper, C as ContentBox, S as SettingTitle } from "./SettingTitle-
|
|
9
|
+
import { P as PageWrapper, C as ContentBox, S as SettingTitle } from "./SettingTitle-UPbQCuTC.mjs";
|
|
10
10
|
function reducer(newConfig, action) {
|
|
11
11
|
switch (action.type) {
|
|
12
12
|
case "SET_MAX_DEPTH":
|
|
@@ -5,7 +5,7 @@ import { Box, Typography, Dialog, Button, Modal, Flex, SingleSelect, SingleSelec
|
|
|
5
5
|
import { useState, useEffect, createContext, useRef, useContext, useMemo, useReducer, useCallback, forwardRef } from "react";
|
|
6
6
|
import { createPortal } from "react-dom";
|
|
7
7
|
import { useIntl } from "react-intl";
|
|
8
|
-
import { u as useApi, g as getTranslation, P as PLUGIN_ID, d as debounce, a as duplicateCheck, T as Tooltip, b as PathInfo, c as usePluginConfig, p as pluginPermissions } from "./index-
|
|
8
|
+
import { u as useApi, g as getTranslation, P as PLUGIN_ID, d as debounce, a as duplicateCheck, T as Tooltip, b as PathInfo, c as usePluginConfig, p as pluginPermissions } from "./index-Dx-EVn-t.mjs";
|
|
9
9
|
import { useNotification, useFetchClient, Page, Layouts } from "@strapi/strapi/admin";
|
|
10
10
|
import { C as Center, F as FullLoader } from "./FullLoader-Btjb2W2p.mjs";
|
|
11
11
|
import { EmptyDocuments } from "@strapi/icons/symbols";
|
|
@@ -580,8 +580,8 @@ function pathReducer(state, action) {
|
|
|
580
580
|
prevValue: state.value,
|
|
581
581
|
needsUrlCheck: false
|
|
582
582
|
};
|
|
583
|
-
case "
|
|
584
|
-
return { ...state, needsUrlCheck: false };
|
|
583
|
+
case "SET_URL_CHECK_FLAG":
|
|
584
|
+
return { ...state, needsUrlCheck: action.payload || false };
|
|
585
585
|
case "SET_REPLACEMENT":
|
|
586
586
|
return { ...state, replacement: action.payload };
|
|
587
587
|
case "SET_UIDPATH":
|
|
@@ -864,7 +864,7 @@ function ItemDetails({
|
|
|
864
864
|
routeDocumentId: route.documentId,
|
|
865
865
|
withoutTransform: true
|
|
866
866
|
});
|
|
867
|
-
dispatchPath({ type: "
|
|
867
|
+
dispatchPath({ type: "SET_URL_CHECK_FLAG" });
|
|
868
868
|
}
|
|
869
869
|
}, [path.needsUrlCheck, route.documentId]);
|
|
870
870
|
useEffect(() => {
|
|
@@ -6745,7 +6745,7 @@ function ItemEditComponent({
|
|
|
6745
6745
|
url: path.value,
|
|
6746
6746
|
routeDocumentId: item.route.documentId
|
|
6747
6747
|
});
|
|
6748
|
-
dispatchPath({ type: "
|
|
6748
|
+
dispatchPath({ type: "SET_URL_CHECK_FLAG" });
|
|
6749
6749
|
}
|
|
6750
6750
|
}, [path.needsUrlCheck, item.route.documentId]);
|
|
6751
6751
|
const updateItem = async () => {
|
|
@@ -4,11 +4,11 @@ const jsxRuntime = require("react/jsx-runtime");
|
|
|
4
4
|
const React = require("react");
|
|
5
5
|
const designSystem = require("@strapi/design-system");
|
|
6
6
|
const admin = require("@strapi/strapi/admin");
|
|
7
|
-
const index = require("./index-
|
|
7
|
+
const index = require("./index-Bm8lkiNL.js");
|
|
8
8
|
const reactIntl = require("react-intl");
|
|
9
9
|
require("@strapi/icons/symbols");
|
|
10
10
|
const FullLoader = require("./FullLoader-Da2n70bJ.js");
|
|
11
|
-
const SettingTitle = require("./SettingTitle-
|
|
11
|
+
const SettingTitle = require("./SettingTitle-DGSkTF7e.js");
|
|
12
12
|
const icons = require("@strapi/icons");
|
|
13
13
|
function ContentTypeAccordion({
|
|
14
14
|
contentType,
|
|
@@ -52,7 +52,7 @@ function transformToUrl(input, replaceSlash = true) {
|
|
|
52
52
|
input = input.replace(/-+/g, "-");
|
|
53
53
|
return input;
|
|
54
54
|
}
|
|
55
|
-
const version = "0.11.
|
|
55
|
+
const version = "0.11.4";
|
|
56
56
|
const strapi$1 = { "name": "webatlas", "displayName": "Webatlas" };
|
|
57
57
|
const pluginPkg = {
|
|
58
58
|
version,
|
|
@@ -3663,7 +3663,7 @@ function Tooltip({ description }) {
|
|
|
3663
3663
|
) }) })
|
|
3664
3664
|
] }) });
|
|
3665
3665
|
}
|
|
3666
|
-
function PathInput({ path, dispatchPath, isOverride, config }) {
|
|
3666
|
+
function PathInput({ path, dispatchPath, isOverride, config, hasUserInteracted }) {
|
|
3667
3667
|
const { formatMessage } = useIntl();
|
|
3668
3668
|
const displayedPath = isOverride && path.overridePath !== void 0 ? path.overridePath : path.value ?? "";
|
|
3669
3669
|
const inputBorder = path.replacement === null ? "" : path.replacement ? "1px solid #ee5e52" : "1px solid #5cb176";
|
|
@@ -3701,12 +3701,21 @@ function PathInput({ path, dispatchPath, isOverride, config }) {
|
|
|
3701
3701
|
{
|
|
3702
3702
|
id: "path-input",
|
|
3703
3703
|
value: displayedPath,
|
|
3704
|
-
onChange: (e) =>
|
|
3704
|
+
onChange: (e) => {
|
|
3705
|
+
hasUserInteracted.current = true;
|
|
3706
|
+
dispatchPath({ type: "SET_OVERRIDEPATH", payload: e.target.value });
|
|
3707
|
+
},
|
|
3705
3708
|
disabled: !isOverride,
|
|
3706
|
-
onBlur: (e) =>
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3709
|
+
onBlur: (e) => {
|
|
3710
|
+
dispatchPath({
|
|
3711
|
+
type: "SET_OVERRIDEPATH",
|
|
3712
|
+
payload: transformToUrl(e.target.value, false)
|
|
3713
|
+
});
|
|
3714
|
+
dispatchPath({
|
|
3715
|
+
type: "SET_URL_CHECK_FLAG",
|
|
3716
|
+
payload: true
|
|
3717
|
+
});
|
|
3718
|
+
},
|
|
3710
3719
|
style: { outline: inputBorder }
|
|
3711
3720
|
}
|
|
3712
3721
|
),
|
|
@@ -3795,8 +3804,8 @@ function reducer(state, action) {
|
|
|
3795
3804
|
prevValue: state.value,
|
|
3796
3805
|
needsUrlCheck: false
|
|
3797
3806
|
};
|
|
3798
|
-
case "
|
|
3799
|
-
return { ...state, needsUrlCheck: false };
|
|
3807
|
+
case "SET_URL_CHECK_FLAG":
|
|
3808
|
+
return { ...state, needsUrlCheck: action.payload || false };
|
|
3800
3809
|
case "SET_REPLACEMENT":
|
|
3801
3810
|
return { ...state, replacement: action.payload };
|
|
3802
3811
|
case "SET_UIDPATH":
|
|
@@ -3928,7 +3937,7 @@ const Panel = ({ config }) => {
|
|
|
3928
3937
|
if (path.needsUrlCheck && path.value) {
|
|
3929
3938
|
if (path.uidPath === path.value || initialPath.current === path.value) return;
|
|
3930
3939
|
debouncedCheckPath(path.value, route?.documentId || null);
|
|
3931
|
-
dispatchPath({ type: "
|
|
3940
|
+
dispatchPath({ type: "SET_URL_CHECK_FLAG" });
|
|
3932
3941
|
} else {
|
|
3933
3942
|
setValidationState("idle");
|
|
3934
3943
|
dispatchPath({ type: "SET_REPLACEMENT", payload: null });
|
|
@@ -4055,7 +4064,8 @@ const Panel = ({ config }) => {
|
|
|
4055
4064
|
path,
|
|
4056
4065
|
dispatchPath,
|
|
4057
4066
|
isOverride,
|
|
4058
|
-
config
|
|
4067
|
+
config,
|
|
4068
|
+
hasUserInteracted
|
|
4059
4069
|
}
|
|
4060
4070
|
),
|
|
4061
4071
|
validationState !== "initial" && /* @__PURE__ */ jsx(PathInfo, { validationState, replacement: path.replacement })
|
|
@@ -4141,7 +4151,7 @@ const index = {
|
|
|
4141
4151
|
id: `${PLUGIN_ID}.link.paths`,
|
|
4142
4152
|
defaultMessage: "Paths"
|
|
4143
4153
|
},
|
|
4144
|
-
Component: () => import("./index-
|
|
4154
|
+
Component: () => import("./index-b3yS9Dm7.mjs"),
|
|
4145
4155
|
permissions: [pluginPermissions["page.routes"][0]]
|
|
4146
4156
|
});
|
|
4147
4157
|
app.addMenuLink({
|
|
@@ -4151,7 +4161,7 @@ const index = {
|
|
|
4151
4161
|
id: `${PLUGIN_ID}.link.navigation`,
|
|
4152
4162
|
defaultMessage: "Navigation"
|
|
4153
4163
|
},
|
|
4154
|
-
Component: () => import("./index-
|
|
4164
|
+
Component: () => import("./index-DLoZpHxU.mjs"),
|
|
4155
4165
|
permissions: [pluginPermissions["page.navigation"][0]]
|
|
4156
4166
|
});
|
|
4157
4167
|
app.addSettingsLink(
|
|
@@ -4169,7 +4179,7 @@ const index = {
|
|
|
4169
4179
|
},
|
|
4170
4180
|
id: `${PLUGIN_ID}-general`,
|
|
4171
4181
|
to: `${PLUGIN_ID}/general`,
|
|
4172
|
-
Component: () => import("./index-
|
|
4182
|
+
Component: () => import("./index-CrgTYzgl.mjs"),
|
|
4173
4183
|
permissions: [pluginPermissions["settings.general"][0]]
|
|
4174
4184
|
}
|
|
4175
4185
|
);
|
|
@@ -4180,7 +4190,7 @@ const index = {
|
|
|
4180
4190
|
},
|
|
4181
4191
|
id: `${PLUGIN_ID}-navigation`,
|
|
4182
4192
|
to: `${PLUGIN_ID}/navigation`,
|
|
4183
|
-
Component: () => import("./index-
|
|
4193
|
+
Component: () => import("./index-D4B4s4XO.mjs"),
|
|
4184
4194
|
permissions: [pluginPermissions["settings.navigation"][0]]
|
|
4185
4195
|
});
|
|
4186
4196
|
app.registerPlugin({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useEffect, useMemo } from "react";
|
|
3
|
-
import { g as getTranslation, u as useApi, d as debounce, p as pluginPermissions } from "./index-
|
|
3
|
+
import { g as getTranslation, u as useApi, d as debounce, p as pluginPermissions } from "./index-Dx-EVn-t.mjs";
|
|
4
4
|
import { Page, Layouts, useNotification } from "@strapi/strapi/admin";
|
|
5
5
|
import { Grid, Box, Field, Thead, Tr, Th, Typography, VisuallyHidden, Td, Flex, LinkButton, Table, Tbody, EmptyStateLayout } from "@strapi/design-system";
|
|
6
6
|
import "@strapi/icons/symbols";
|
package/dist/admin/index.js
CHANGED
package/dist/admin/index.mjs
CHANGED
package/dist/server/index.js
CHANGED
|
@@ -4664,6 +4664,106 @@ function calculateParentAndOrder({
|
|
|
4664
4664
|
calculatedOrder
|
|
4665
4665
|
};
|
|
4666
4666
|
}
|
|
4667
|
+
async function enrichWebatlasData(data, contentTypeUid) {
|
|
4668
|
+
console.log("Enriching data with webatlas fields...", { contentTypeUid });
|
|
4669
|
+
console.log("Original data:", JSON.stringify(data, null, 2));
|
|
4670
|
+
if (!data || typeof data !== "object") return data;
|
|
4671
|
+
const collectDocumentIds = (obj, uid) => {
|
|
4672
|
+
if (!obj || typeof obj !== "object") return [];
|
|
4673
|
+
const ids = [];
|
|
4674
|
+
if (obj.documentId) ids.push(obj.documentId);
|
|
4675
|
+
if (!uid) return ids;
|
|
4676
|
+
const ct = strapi.contentTypes[uid];
|
|
4677
|
+
if (!ct?.attributes) return ids;
|
|
4678
|
+
for (const [key, attr] of Object.entries(ct.attributes)) {
|
|
4679
|
+
const attribute = attr;
|
|
4680
|
+
if (attribute.type === "relation" && obj[key]) {
|
|
4681
|
+
const targetUid = attribute.target;
|
|
4682
|
+
if (Array.isArray(obj[key])) {
|
|
4683
|
+
ids.push(...obj[key].flatMap((item) => collectDocumentIds(item, targetUid)));
|
|
4684
|
+
} else {
|
|
4685
|
+
ids.push(...collectDocumentIds(obj[key], targetUid));
|
|
4686
|
+
}
|
|
4687
|
+
}
|
|
4688
|
+
if (attribute.type === "component" && obj[key]) {
|
|
4689
|
+
const componentUid = attribute.component;
|
|
4690
|
+
if (Array.isArray(obj[key])) {
|
|
4691
|
+
ids.push(...obj[key].flatMap((item) => collectDocumentIds(item, componentUid)));
|
|
4692
|
+
} else {
|
|
4693
|
+
ids.push(...collectDocumentIds(obj[key], componentUid));
|
|
4694
|
+
}
|
|
4695
|
+
}
|
|
4696
|
+
if (attribute.type === "dynamiczone" && Array.isArray(obj[key])) {
|
|
4697
|
+
ids.push(
|
|
4698
|
+
...obj[key].flatMap((item) => {
|
|
4699
|
+
if (!item || !item.__component) return [];
|
|
4700
|
+
return collectDocumentIds(item, item.__component);
|
|
4701
|
+
})
|
|
4702
|
+
);
|
|
4703
|
+
}
|
|
4704
|
+
}
|
|
4705
|
+
return ids;
|
|
4706
|
+
};
|
|
4707
|
+
const documentIds = collectDocumentIds(data, contentTypeUid);
|
|
4708
|
+
if (documentIds.length === 0) return data;
|
|
4709
|
+
const uniqueDocumentIds = [...new Set(documentIds)];
|
|
4710
|
+
const routes2 = await strapi.db?.query(waRoute).findMany({
|
|
4711
|
+
where: {
|
|
4712
|
+
relatedDocumentId: { $in: uniqueDocumentIds }
|
|
4713
|
+
},
|
|
4714
|
+
select: ["relatedDocumentId", "relatedContentType", "path", "canonicalPath", "slug", "uidPath"]
|
|
4715
|
+
});
|
|
4716
|
+
const routeMap = new Map(routes2?.map((route2) => [route2.relatedDocumentId, route2]) || []);
|
|
4717
|
+
const enrichEntity = (entity, uid) => {
|
|
4718
|
+
if (!entity || typeof entity !== "object") return entity;
|
|
4719
|
+
const ct = uid ? strapi.contentTypes[uid] : null;
|
|
4720
|
+
const isWebatlasEnabled = ct?.pluginOptions?.webatlas?.enabled === true;
|
|
4721
|
+
if (isWebatlasEnabled && entity.documentId && routeMap.has(entity.documentId)) {
|
|
4722
|
+
const route2 = routeMap.get(entity.documentId);
|
|
4723
|
+
entity.webatlas = {
|
|
4724
|
+
path: route2.path || "",
|
|
4725
|
+
canonicalPath: route2.canonicalPath || "",
|
|
4726
|
+
slug: route2.slug || "",
|
|
4727
|
+
uidPath: route2.uidPath || ""
|
|
4728
|
+
};
|
|
4729
|
+
}
|
|
4730
|
+
if (ct?.attributes) {
|
|
4731
|
+
for (const [key, attr] of Object.entries(ct.attributes)) {
|
|
4732
|
+
const attribute = attr;
|
|
4733
|
+
if (attribute.type === "relation" && entity[key]) {
|
|
4734
|
+
const targetUid = attribute.target;
|
|
4735
|
+
strapi.log.debug("relation found");
|
|
4736
|
+
if (Array.isArray(entity[key])) {
|
|
4737
|
+
entity[key] = entity[key].map(
|
|
4738
|
+
(item) => item ? enrichEntity(item, targetUid) : item
|
|
4739
|
+
);
|
|
4740
|
+
} else {
|
|
4741
|
+
entity[key] = enrichEntity(entity[key], targetUid);
|
|
4742
|
+
}
|
|
4743
|
+
}
|
|
4744
|
+
if (attribute.type === "component" && entity[key]) {
|
|
4745
|
+
const componentUid = attribute.component;
|
|
4746
|
+
if (Array.isArray(entity[key])) {
|
|
4747
|
+
entity[key] = entity[key].map(
|
|
4748
|
+
(item) => item ? enrichEntity(item, componentUid) : item
|
|
4749
|
+
);
|
|
4750
|
+
} else {
|
|
4751
|
+
entity[key] = enrichEntity(entity[key], componentUid);
|
|
4752
|
+
}
|
|
4753
|
+
}
|
|
4754
|
+
if (attribute.type === "dynamiczone" && Array.isArray(entity[key])) {
|
|
4755
|
+
entity[key] = entity[key].map((item) => {
|
|
4756
|
+
if (!item || !item.__component) return item;
|
|
4757
|
+
return enrichEntity(item, item.__component);
|
|
4758
|
+
});
|
|
4759
|
+
}
|
|
4760
|
+
}
|
|
4761
|
+
}
|
|
4762
|
+
strapi.log.debug("finished - returning");
|
|
4763
|
+
return entity;
|
|
4764
|
+
};
|
|
4765
|
+
return enrichEntity(data, contentTypeUid);
|
|
4766
|
+
}
|
|
4667
4767
|
const migration_001_canonical_path = {
|
|
4668
4768
|
version: "001",
|
|
4669
4769
|
description: "Migrate title field to canonicalPath using transformToUrl",
|
|
@@ -4902,7 +5002,7 @@ function documentMiddleware(strapi2, enabledContentTypes, config2) {
|
|
|
4902
5002
|
const data = context.params.data;
|
|
4903
5003
|
const { webatlas } = data;
|
|
4904
5004
|
const { slug, parentDocumentId, isOverride } = webatlas || {};
|
|
4905
|
-
const transformedSlug = slug ? transformToUrl(slug) : null;
|
|
5005
|
+
const transformedSlug = slug ? transformToUrl(slug, !isOverride) : null;
|
|
4906
5006
|
const result2 = await next();
|
|
4907
5007
|
if (!transformedSlug) return result2;
|
|
4908
5008
|
const existing = await strapi2.db?.query(waRoute).findOne({
|
|
@@ -4975,7 +5075,7 @@ function documentMiddleware(strapi2, enabledContentTypes, config2) {
|
|
|
4975
5075
|
});
|
|
4976
5076
|
}
|
|
4977
5077
|
}
|
|
4978
|
-
const transformedSlug = transformToUrl(slug);
|
|
5078
|
+
const transformedSlug = transformToUrl(slug, !isOverride);
|
|
4979
5079
|
let rawPath = transformedSlug;
|
|
4980
5080
|
if (!isOverride) rawPath = parent ? `${parent.path}/${transformedSlug}` : transformedSlug;
|
|
4981
5081
|
const validatedPath = await duplicateCheck(rawPath, relatedRoute?.documentId ?? null);
|
|
@@ -5087,124 +5187,18 @@ const addWebatlasField = ({ strapi: strapi2 }) => {
|
|
|
5087
5187
|
);
|
|
5088
5188
|
if (!contentTypeEntry) return;
|
|
5089
5189
|
const [contentTypeUid, contentType] = contentTypeEntry;
|
|
5090
|
-
const collectDocumentIds = (data, uid = contentTypeUid) => {
|
|
5091
|
-
if (!data || typeof data !== "object") return [];
|
|
5092
|
-
const ids = [];
|
|
5093
|
-
if (data.documentId) {
|
|
5094
|
-
ids.push(data.documentId);
|
|
5095
|
-
}
|
|
5096
|
-
const ct = strapi2.contentTypes[uid];
|
|
5097
|
-
if (ct?.attributes) {
|
|
5098
|
-
for (const [key, attr] of Object.entries(ct.attributes)) {
|
|
5099
|
-
const attribute = attr;
|
|
5100
|
-
if (attribute.type === "relation" && data[key]) {
|
|
5101
|
-
const targetUid = attribute.target;
|
|
5102
|
-
if (Array.isArray(data[key])) {
|
|
5103
|
-
ids.push(...data[key].flatMap((item) => collectDocumentIds(item, targetUid)));
|
|
5104
|
-
} else {
|
|
5105
|
-
ids.push(...collectDocumentIds(data[key], targetUid));
|
|
5106
|
-
}
|
|
5107
|
-
}
|
|
5108
|
-
if (attribute.type === "component" && data[key]) {
|
|
5109
|
-
const componentUid = attribute.component;
|
|
5110
|
-
if (Array.isArray(data[key])) {
|
|
5111
|
-
ids.push(...data[key].flatMap((item) => collectDocumentIds(item, componentUid)));
|
|
5112
|
-
} else {
|
|
5113
|
-
ids.push(...collectDocumentIds(data[key], componentUid));
|
|
5114
|
-
}
|
|
5115
|
-
}
|
|
5116
|
-
if (attribute.type === "dynamiczone" && Array.isArray(data[key])) {
|
|
5117
|
-
ids.push(
|
|
5118
|
-
...data[key].flatMap((item) => {
|
|
5119
|
-
const componentUid = item.__component;
|
|
5120
|
-
return collectDocumentIds(item, componentUid);
|
|
5121
|
-
})
|
|
5122
|
-
);
|
|
5123
|
-
}
|
|
5124
|
-
}
|
|
5125
|
-
}
|
|
5126
|
-
return ids;
|
|
5127
|
-
};
|
|
5128
|
-
let documentIds = [];
|
|
5129
|
-
if (ctx.body.data) {
|
|
5130
|
-
if (Array.isArray(ctx.body.data)) {
|
|
5131
|
-
documentIds = ctx.body.data.flatMap((item) => collectDocumentIds(item, contentTypeUid));
|
|
5132
|
-
} else {
|
|
5133
|
-
documentIds = collectDocumentIds(ctx.body.data, contentTypeUid);
|
|
5134
|
-
}
|
|
5135
|
-
} else if (Array.isArray(ctx.body)) {
|
|
5136
|
-
documentIds = ctx.body.flatMap((item) => collectDocumentIds(item, contentTypeUid));
|
|
5137
|
-
} else if (typeof ctx.body === "object") {
|
|
5138
|
-
documentIds = collectDocumentIds(ctx.body, contentTypeUid);
|
|
5139
|
-
}
|
|
5140
|
-
if (documentIds.length === 0) return;
|
|
5141
|
-
const uniqueDocumentIds = [...new Set(documentIds)];
|
|
5142
|
-
const routes2 = await strapi2.db?.query(waRoute).findMany({
|
|
5143
|
-
where: {
|
|
5144
|
-
relatedDocumentId: { $in: uniqueDocumentIds }
|
|
5145
|
-
},
|
|
5146
|
-
select: [
|
|
5147
|
-
"relatedDocumentId",
|
|
5148
|
-
"relatedContentType",
|
|
5149
|
-
"path",
|
|
5150
|
-
"canonicalPath",
|
|
5151
|
-
"slug",
|
|
5152
|
-
"uidPath"
|
|
5153
|
-
]
|
|
5154
|
-
});
|
|
5155
|
-
const routeMap = new Map(routes2?.map((route2) => [route2.relatedDocumentId, route2]) || []);
|
|
5156
|
-
const enrichWebatlasField = (data, uid = contentTypeUid) => {
|
|
5157
|
-
if (!data || typeof data !== "object") return data;
|
|
5158
|
-
const ct = strapi2.contentTypes[uid];
|
|
5159
|
-
const isWebatlasEnabled = ct?.pluginOptions?.webatlas?.enabled === true;
|
|
5160
|
-
if (isWebatlasEnabled && data.documentId && routeMap.has(data.documentId)) {
|
|
5161
|
-
const route2 = routeMap.get(data.documentId);
|
|
5162
|
-
data.webatlas = {
|
|
5163
|
-
path: route2.path || "",
|
|
5164
|
-
canonicalPath: route2.canonicalPath || "",
|
|
5165
|
-
slug: route2.slug || "",
|
|
5166
|
-
uidPath: route2.uidPath || ""
|
|
5167
|
-
};
|
|
5168
|
-
}
|
|
5169
|
-
if (ct?.attributes) {
|
|
5170
|
-
for (const [key, attr] of Object.entries(ct.attributes)) {
|
|
5171
|
-
const attribute = attr;
|
|
5172
|
-
if (attribute.type === "relation" && data[key]) {
|
|
5173
|
-
const targetUid = attribute.target;
|
|
5174
|
-
if (Array.isArray(data[key])) {
|
|
5175
|
-
data[key] = data[key].map((item) => enrichWebatlasField(item, targetUid));
|
|
5176
|
-
} else {
|
|
5177
|
-
data[key] = enrichWebatlasField(data[key], targetUid);
|
|
5178
|
-
}
|
|
5179
|
-
}
|
|
5180
|
-
if (attribute.type === "component" && data[key]) {
|
|
5181
|
-
const componentUid = attribute.component;
|
|
5182
|
-
if (Array.isArray(data[key])) {
|
|
5183
|
-
data[key] = data[key].map((item) => enrichWebatlasField(item, componentUid));
|
|
5184
|
-
} else {
|
|
5185
|
-
data[key] = enrichWebatlasField(data[key], componentUid);
|
|
5186
|
-
}
|
|
5187
|
-
}
|
|
5188
|
-
if (attribute.type === "dynamiczone" && Array.isArray(data[key])) {
|
|
5189
|
-
data[key] = data[key].map((item) => {
|
|
5190
|
-
const componentUid = item.__component;
|
|
5191
|
-
return enrichWebatlasField(item, componentUid);
|
|
5192
|
-
});
|
|
5193
|
-
}
|
|
5194
|
-
}
|
|
5195
|
-
}
|
|
5196
|
-
return data;
|
|
5197
|
-
};
|
|
5198
5190
|
if (ctx.body.data) {
|
|
5199
5191
|
if (Array.isArray(ctx.body.data)) {
|
|
5200
|
-
ctx.body.data =
|
|
5192
|
+
ctx.body.data = await Promise.all(
|
|
5193
|
+
ctx.body.data.map((item) => enrichWebatlasData(item, contentTypeUid))
|
|
5194
|
+
);
|
|
5201
5195
|
} else {
|
|
5202
|
-
ctx.body.data =
|
|
5196
|
+
ctx.body.data = await enrichWebatlasData(ctx.body.data, contentTypeUid);
|
|
5203
5197
|
}
|
|
5204
5198
|
} else if (Array.isArray(ctx.body)) {
|
|
5205
|
-
ctx.body = ctx.body.map((item) =>
|
|
5199
|
+
ctx.body = await Promise.all(ctx.body.map((item) => enrichWebatlasData(item, contentTypeUid)));
|
|
5206
5200
|
} else if (typeof ctx.body === "object") {
|
|
5207
|
-
ctx.body =
|
|
5201
|
+
ctx.body = await enrichWebatlasData(ctx.body, contentTypeUid);
|
|
5208
5202
|
}
|
|
5209
5203
|
};
|
|
5210
5204
|
};
|
|
@@ -6092,17 +6086,9 @@ const client = ({ strapi: strapi2 }) => ({
|
|
|
6092
6086
|
if (!entity) return null;
|
|
6093
6087
|
let cleanEntity = cleanRootKeys(entity);
|
|
6094
6088
|
cleanEntity = removeWaFields(cleanEntity);
|
|
6095
|
-
|
|
6096
|
-
path: route2.path,
|
|
6097
|
-
canonicalPath: route2.canonicalPath,
|
|
6098
|
-
slug: route2.slug,
|
|
6099
|
-
uidPath: route2.uidPath
|
|
6100
|
-
};
|
|
6089
|
+
cleanEntity = await enrichWebatlasData(cleanEntity, route2.relatedContentType);
|
|
6101
6090
|
return {
|
|
6102
6091
|
contentType: contentType.info.singularName,
|
|
6103
|
-
webatlas: {
|
|
6104
|
-
...webatlasFields
|
|
6105
|
-
},
|
|
6106
6092
|
...cleanEntity
|
|
6107
6093
|
};
|
|
6108
6094
|
} catch (e) {
|
package/dist/server/index.mjs
CHANGED
|
@@ -4662,6 +4662,106 @@ function calculateParentAndOrder({
|
|
|
4662
4662
|
calculatedOrder
|
|
4663
4663
|
};
|
|
4664
4664
|
}
|
|
4665
|
+
async function enrichWebatlasData(data, contentTypeUid) {
|
|
4666
|
+
console.log("Enriching data with webatlas fields...", { contentTypeUid });
|
|
4667
|
+
console.log("Original data:", JSON.stringify(data, null, 2));
|
|
4668
|
+
if (!data || typeof data !== "object") return data;
|
|
4669
|
+
const collectDocumentIds = (obj, uid) => {
|
|
4670
|
+
if (!obj || typeof obj !== "object") return [];
|
|
4671
|
+
const ids = [];
|
|
4672
|
+
if (obj.documentId) ids.push(obj.documentId);
|
|
4673
|
+
if (!uid) return ids;
|
|
4674
|
+
const ct = strapi.contentTypes[uid];
|
|
4675
|
+
if (!ct?.attributes) return ids;
|
|
4676
|
+
for (const [key, attr] of Object.entries(ct.attributes)) {
|
|
4677
|
+
const attribute = attr;
|
|
4678
|
+
if (attribute.type === "relation" && obj[key]) {
|
|
4679
|
+
const targetUid = attribute.target;
|
|
4680
|
+
if (Array.isArray(obj[key])) {
|
|
4681
|
+
ids.push(...obj[key].flatMap((item) => collectDocumentIds(item, targetUid)));
|
|
4682
|
+
} else {
|
|
4683
|
+
ids.push(...collectDocumentIds(obj[key], targetUid));
|
|
4684
|
+
}
|
|
4685
|
+
}
|
|
4686
|
+
if (attribute.type === "component" && obj[key]) {
|
|
4687
|
+
const componentUid = attribute.component;
|
|
4688
|
+
if (Array.isArray(obj[key])) {
|
|
4689
|
+
ids.push(...obj[key].flatMap((item) => collectDocumentIds(item, componentUid)));
|
|
4690
|
+
} else {
|
|
4691
|
+
ids.push(...collectDocumentIds(obj[key], componentUid));
|
|
4692
|
+
}
|
|
4693
|
+
}
|
|
4694
|
+
if (attribute.type === "dynamiczone" && Array.isArray(obj[key])) {
|
|
4695
|
+
ids.push(
|
|
4696
|
+
...obj[key].flatMap((item) => {
|
|
4697
|
+
if (!item || !item.__component) return [];
|
|
4698
|
+
return collectDocumentIds(item, item.__component);
|
|
4699
|
+
})
|
|
4700
|
+
);
|
|
4701
|
+
}
|
|
4702
|
+
}
|
|
4703
|
+
return ids;
|
|
4704
|
+
};
|
|
4705
|
+
const documentIds = collectDocumentIds(data, contentTypeUid);
|
|
4706
|
+
if (documentIds.length === 0) return data;
|
|
4707
|
+
const uniqueDocumentIds = [...new Set(documentIds)];
|
|
4708
|
+
const routes2 = await strapi.db?.query(waRoute).findMany({
|
|
4709
|
+
where: {
|
|
4710
|
+
relatedDocumentId: { $in: uniqueDocumentIds }
|
|
4711
|
+
},
|
|
4712
|
+
select: ["relatedDocumentId", "relatedContentType", "path", "canonicalPath", "slug", "uidPath"]
|
|
4713
|
+
});
|
|
4714
|
+
const routeMap = new Map(routes2?.map((route2) => [route2.relatedDocumentId, route2]) || []);
|
|
4715
|
+
const enrichEntity = (entity, uid) => {
|
|
4716
|
+
if (!entity || typeof entity !== "object") return entity;
|
|
4717
|
+
const ct = uid ? strapi.contentTypes[uid] : null;
|
|
4718
|
+
const isWebatlasEnabled = ct?.pluginOptions?.webatlas?.enabled === true;
|
|
4719
|
+
if (isWebatlasEnabled && entity.documentId && routeMap.has(entity.documentId)) {
|
|
4720
|
+
const route2 = routeMap.get(entity.documentId);
|
|
4721
|
+
entity.webatlas = {
|
|
4722
|
+
path: route2.path || "",
|
|
4723
|
+
canonicalPath: route2.canonicalPath || "",
|
|
4724
|
+
slug: route2.slug || "",
|
|
4725
|
+
uidPath: route2.uidPath || ""
|
|
4726
|
+
};
|
|
4727
|
+
}
|
|
4728
|
+
if (ct?.attributes) {
|
|
4729
|
+
for (const [key, attr] of Object.entries(ct.attributes)) {
|
|
4730
|
+
const attribute = attr;
|
|
4731
|
+
if (attribute.type === "relation" && entity[key]) {
|
|
4732
|
+
const targetUid = attribute.target;
|
|
4733
|
+
strapi.log.debug("relation found");
|
|
4734
|
+
if (Array.isArray(entity[key])) {
|
|
4735
|
+
entity[key] = entity[key].map(
|
|
4736
|
+
(item) => item ? enrichEntity(item, targetUid) : item
|
|
4737
|
+
);
|
|
4738
|
+
} else {
|
|
4739
|
+
entity[key] = enrichEntity(entity[key], targetUid);
|
|
4740
|
+
}
|
|
4741
|
+
}
|
|
4742
|
+
if (attribute.type === "component" && entity[key]) {
|
|
4743
|
+
const componentUid = attribute.component;
|
|
4744
|
+
if (Array.isArray(entity[key])) {
|
|
4745
|
+
entity[key] = entity[key].map(
|
|
4746
|
+
(item) => item ? enrichEntity(item, componentUid) : item
|
|
4747
|
+
);
|
|
4748
|
+
} else {
|
|
4749
|
+
entity[key] = enrichEntity(entity[key], componentUid);
|
|
4750
|
+
}
|
|
4751
|
+
}
|
|
4752
|
+
if (attribute.type === "dynamiczone" && Array.isArray(entity[key])) {
|
|
4753
|
+
entity[key] = entity[key].map((item) => {
|
|
4754
|
+
if (!item || !item.__component) return item;
|
|
4755
|
+
return enrichEntity(item, item.__component);
|
|
4756
|
+
});
|
|
4757
|
+
}
|
|
4758
|
+
}
|
|
4759
|
+
}
|
|
4760
|
+
strapi.log.debug("finished - returning");
|
|
4761
|
+
return entity;
|
|
4762
|
+
};
|
|
4763
|
+
return enrichEntity(data, contentTypeUid);
|
|
4764
|
+
}
|
|
4665
4765
|
const migration_001_canonical_path = {
|
|
4666
4766
|
version: "001",
|
|
4667
4767
|
description: "Migrate title field to canonicalPath using transformToUrl",
|
|
@@ -4900,7 +5000,7 @@ function documentMiddleware(strapi2, enabledContentTypes, config2) {
|
|
|
4900
5000
|
const data = context.params.data;
|
|
4901
5001
|
const { webatlas } = data;
|
|
4902
5002
|
const { slug, parentDocumentId, isOverride } = webatlas || {};
|
|
4903
|
-
const transformedSlug = slug ? transformToUrl(slug) : null;
|
|
5003
|
+
const transformedSlug = slug ? transformToUrl(slug, !isOverride) : null;
|
|
4904
5004
|
const result2 = await next();
|
|
4905
5005
|
if (!transformedSlug) return result2;
|
|
4906
5006
|
const existing = await strapi2.db?.query(waRoute).findOne({
|
|
@@ -4973,7 +5073,7 @@ function documentMiddleware(strapi2, enabledContentTypes, config2) {
|
|
|
4973
5073
|
});
|
|
4974
5074
|
}
|
|
4975
5075
|
}
|
|
4976
|
-
const transformedSlug = transformToUrl(slug);
|
|
5076
|
+
const transformedSlug = transformToUrl(slug, !isOverride);
|
|
4977
5077
|
let rawPath = transformedSlug;
|
|
4978
5078
|
if (!isOverride) rawPath = parent ? `${parent.path}/${transformedSlug}` : transformedSlug;
|
|
4979
5079
|
const validatedPath = await duplicateCheck(rawPath, relatedRoute?.documentId ?? null);
|
|
@@ -5085,124 +5185,18 @@ const addWebatlasField = ({ strapi: strapi2 }) => {
|
|
|
5085
5185
|
);
|
|
5086
5186
|
if (!contentTypeEntry) return;
|
|
5087
5187
|
const [contentTypeUid, contentType] = contentTypeEntry;
|
|
5088
|
-
const collectDocumentIds = (data, uid = contentTypeUid) => {
|
|
5089
|
-
if (!data || typeof data !== "object") return [];
|
|
5090
|
-
const ids = [];
|
|
5091
|
-
if (data.documentId) {
|
|
5092
|
-
ids.push(data.documentId);
|
|
5093
|
-
}
|
|
5094
|
-
const ct = strapi2.contentTypes[uid];
|
|
5095
|
-
if (ct?.attributes) {
|
|
5096
|
-
for (const [key, attr] of Object.entries(ct.attributes)) {
|
|
5097
|
-
const attribute = attr;
|
|
5098
|
-
if (attribute.type === "relation" && data[key]) {
|
|
5099
|
-
const targetUid = attribute.target;
|
|
5100
|
-
if (Array.isArray(data[key])) {
|
|
5101
|
-
ids.push(...data[key].flatMap((item) => collectDocumentIds(item, targetUid)));
|
|
5102
|
-
} else {
|
|
5103
|
-
ids.push(...collectDocumentIds(data[key], targetUid));
|
|
5104
|
-
}
|
|
5105
|
-
}
|
|
5106
|
-
if (attribute.type === "component" && data[key]) {
|
|
5107
|
-
const componentUid = attribute.component;
|
|
5108
|
-
if (Array.isArray(data[key])) {
|
|
5109
|
-
ids.push(...data[key].flatMap((item) => collectDocumentIds(item, componentUid)));
|
|
5110
|
-
} else {
|
|
5111
|
-
ids.push(...collectDocumentIds(data[key], componentUid));
|
|
5112
|
-
}
|
|
5113
|
-
}
|
|
5114
|
-
if (attribute.type === "dynamiczone" && Array.isArray(data[key])) {
|
|
5115
|
-
ids.push(
|
|
5116
|
-
...data[key].flatMap((item) => {
|
|
5117
|
-
const componentUid = item.__component;
|
|
5118
|
-
return collectDocumentIds(item, componentUid);
|
|
5119
|
-
})
|
|
5120
|
-
);
|
|
5121
|
-
}
|
|
5122
|
-
}
|
|
5123
|
-
}
|
|
5124
|
-
return ids;
|
|
5125
|
-
};
|
|
5126
|
-
let documentIds = [];
|
|
5127
|
-
if (ctx.body.data) {
|
|
5128
|
-
if (Array.isArray(ctx.body.data)) {
|
|
5129
|
-
documentIds = ctx.body.data.flatMap((item) => collectDocumentIds(item, contentTypeUid));
|
|
5130
|
-
} else {
|
|
5131
|
-
documentIds = collectDocumentIds(ctx.body.data, contentTypeUid);
|
|
5132
|
-
}
|
|
5133
|
-
} else if (Array.isArray(ctx.body)) {
|
|
5134
|
-
documentIds = ctx.body.flatMap((item) => collectDocumentIds(item, contentTypeUid));
|
|
5135
|
-
} else if (typeof ctx.body === "object") {
|
|
5136
|
-
documentIds = collectDocumentIds(ctx.body, contentTypeUid);
|
|
5137
|
-
}
|
|
5138
|
-
if (documentIds.length === 0) return;
|
|
5139
|
-
const uniqueDocumentIds = [...new Set(documentIds)];
|
|
5140
|
-
const routes2 = await strapi2.db?.query(waRoute).findMany({
|
|
5141
|
-
where: {
|
|
5142
|
-
relatedDocumentId: { $in: uniqueDocumentIds }
|
|
5143
|
-
},
|
|
5144
|
-
select: [
|
|
5145
|
-
"relatedDocumentId",
|
|
5146
|
-
"relatedContentType",
|
|
5147
|
-
"path",
|
|
5148
|
-
"canonicalPath",
|
|
5149
|
-
"slug",
|
|
5150
|
-
"uidPath"
|
|
5151
|
-
]
|
|
5152
|
-
});
|
|
5153
|
-
const routeMap = new Map(routes2?.map((route2) => [route2.relatedDocumentId, route2]) || []);
|
|
5154
|
-
const enrichWebatlasField = (data, uid = contentTypeUid) => {
|
|
5155
|
-
if (!data || typeof data !== "object") return data;
|
|
5156
|
-
const ct = strapi2.contentTypes[uid];
|
|
5157
|
-
const isWebatlasEnabled = ct?.pluginOptions?.webatlas?.enabled === true;
|
|
5158
|
-
if (isWebatlasEnabled && data.documentId && routeMap.has(data.documentId)) {
|
|
5159
|
-
const route2 = routeMap.get(data.documentId);
|
|
5160
|
-
data.webatlas = {
|
|
5161
|
-
path: route2.path || "",
|
|
5162
|
-
canonicalPath: route2.canonicalPath || "",
|
|
5163
|
-
slug: route2.slug || "",
|
|
5164
|
-
uidPath: route2.uidPath || ""
|
|
5165
|
-
};
|
|
5166
|
-
}
|
|
5167
|
-
if (ct?.attributes) {
|
|
5168
|
-
for (const [key, attr] of Object.entries(ct.attributes)) {
|
|
5169
|
-
const attribute = attr;
|
|
5170
|
-
if (attribute.type === "relation" && data[key]) {
|
|
5171
|
-
const targetUid = attribute.target;
|
|
5172
|
-
if (Array.isArray(data[key])) {
|
|
5173
|
-
data[key] = data[key].map((item) => enrichWebatlasField(item, targetUid));
|
|
5174
|
-
} else {
|
|
5175
|
-
data[key] = enrichWebatlasField(data[key], targetUid);
|
|
5176
|
-
}
|
|
5177
|
-
}
|
|
5178
|
-
if (attribute.type === "component" && data[key]) {
|
|
5179
|
-
const componentUid = attribute.component;
|
|
5180
|
-
if (Array.isArray(data[key])) {
|
|
5181
|
-
data[key] = data[key].map((item) => enrichWebatlasField(item, componentUid));
|
|
5182
|
-
} else {
|
|
5183
|
-
data[key] = enrichWebatlasField(data[key], componentUid);
|
|
5184
|
-
}
|
|
5185
|
-
}
|
|
5186
|
-
if (attribute.type === "dynamiczone" && Array.isArray(data[key])) {
|
|
5187
|
-
data[key] = data[key].map((item) => {
|
|
5188
|
-
const componentUid = item.__component;
|
|
5189
|
-
return enrichWebatlasField(item, componentUid);
|
|
5190
|
-
});
|
|
5191
|
-
}
|
|
5192
|
-
}
|
|
5193
|
-
}
|
|
5194
|
-
return data;
|
|
5195
|
-
};
|
|
5196
5188
|
if (ctx.body.data) {
|
|
5197
5189
|
if (Array.isArray(ctx.body.data)) {
|
|
5198
|
-
ctx.body.data =
|
|
5190
|
+
ctx.body.data = await Promise.all(
|
|
5191
|
+
ctx.body.data.map((item) => enrichWebatlasData(item, contentTypeUid))
|
|
5192
|
+
);
|
|
5199
5193
|
} else {
|
|
5200
|
-
ctx.body.data =
|
|
5194
|
+
ctx.body.data = await enrichWebatlasData(ctx.body.data, contentTypeUid);
|
|
5201
5195
|
}
|
|
5202
5196
|
} else if (Array.isArray(ctx.body)) {
|
|
5203
|
-
ctx.body = ctx.body.map((item) =>
|
|
5197
|
+
ctx.body = await Promise.all(ctx.body.map((item) => enrichWebatlasData(item, contentTypeUid)));
|
|
5204
5198
|
} else if (typeof ctx.body === "object") {
|
|
5205
|
-
ctx.body =
|
|
5199
|
+
ctx.body = await enrichWebatlasData(ctx.body, contentTypeUid);
|
|
5206
5200
|
}
|
|
5207
5201
|
};
|
|
5208
5202
|
};
|
|
@@ -6090,17 +6084,9 @@ const client = ({ strapi: strapi2 }) => ({
|
|
|
6090
6084
|
if (!entity) return null;
|
|
6091
6085
|
let cleanEntity = cleanRootKeys(entity);
|
|
6092
6086
|
cleanEntity = removeWaFields(cleanEntity);
|
|
6093
|
-
|
|
6094
|
-
path: route2.path,
|
|
6095
|
-
canonicalPath: route2.canonicalPath,
|
|
6096
|
-
slug: route2.slug,
|
|
6097
|
-
uidPath: route2.uidPath
|
|
6098
|
-
};
|
|
6087
|
+
cleanEntity = await enrichWebatlasData(cleanEntity, route2.relatedContentType);
|
|
6099
6088
|
return {
|
|
6100
6089
|
contentType: contentType.info.singularName,
|
|
6101
|
-
webatlas: {
|
|
6102
|
-
...webatlasFields
|
|
6103
|
-
},
|
|
6104
6090
|
...cleanEntity
|
|
6105
6091
|
};
|
|
6106
6092
|
} catch (e) {
|