strapi-plugin-navigation 3.0.0-beta.2 → 3.0.0-beta.3
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 +7 -7
- package/dist/_chunks/{ca-DIZHA0OL.mjs → ca-Catou0wg.mjs} +4 -0
- package/dist/_chunks/{ca-Bjfh0w36.js → ca-DtaqQvTI.js} +4 -0
- package/dist/admin/index.js +64 -28
- package/dist/admin/index.mjs +65 -29
- package/dist/admin/src/api/client.d.ts +3 -1
- package/dist/admin/src/api/validators.d.ts +3 -3
- package/dist/admin/src/pages/HomePage/components/NavigationItemForm/index.d.ts +1 -1
- package/dist/admin/src/pages/HomePage/components/NavigationItemPopup/index.d.ts +1 -1
- package/dist/admin/src/pages/HomePage/components/NavigationManager/types.d.ts +1 -1
- package/dist/admin/src/pages/HomePage/hooks/index.d.ts +3 -3
- package/dist/admin/src/pages/SettingsPage/hooks/index.d.ts +1 -1
- package/dist/admin/src/translations/ca.d.ts +4 -0
- package/dist/server/index.js +98 -92
- package/dist/server/index.mjs +98 -92
- package/dist/server/src/content-types/index.d.ts +0 -4
- package/dist/server/src/content-types/navigation/index.d.ts +0 -4
- package/dist/server/src/content-types/navigation/schema.d.ts +0 -4
- package/dist/server/src/controllers/admin.d.ts +10 -10
- package/dist/server/src/controllers/client.d.ts +2 -2
- package/dist/server/src/controllers/validators.d.ts +2 -2
- package/dist/server/src/index.d.ts +7 -11
- package/dist/server/src/repositories/navigation-item.d.ts +8 -4
- package/dist/server/src/repositories/navigation.d.ts +12 -8
- package/dist/server/src/schemas/navigation.d.ts +8 -8
- package/dist/server/src/services/admin/admin.d.ts +2 -2
- package/dist/server/src/services/admin/types.d.ts +2 -2
- package/dist/server/src/services/admin/utils.d.ts +1 -1
- package/dist/server/src/services/client/client.d.ts +1 -1
- package/dist/server/src/services/index.d.ts +7 -7
- package/package.json +6 -7
package/README.md
CHANGED
|
@@ -121,7 +121,7 @@ Complete installation requirements are exact same as for Strapi itself and can b
|
|
|
121
121
|
|
|
122
122
|
**Supported Strapi versions**:
|
|
123
123
|
|
|
124
|
-
- Strapi v5.0
|
|
124
|
+
- Strapi v5.1.0 (recently tested)
|
|
125
125
|
- Strapi v5.x
|
|
126
126
|
|
|
127
127
|
> This plugin is designed for **Strapi v5** and is not working with v4.x. To get version for **Strapi v4** install version [v4.x](https://github.com/VirtusLab-Open-Source/strapi-plugin-navigation/tree/strapi-v4).
|
|
@@ -373,7 +373,7 @@ NOTE: All params are optional
|
|
|
373
373
|
"visible": true,
|
|
374
374
|
"createdAt": "2023-09-29T12:45:54.399Z",
|
|
375
375
|
"updatedAt": "2023-09-29T13:44:08.702Z",
|
|
376
|
-
"
|
|
376
|
+
"locale": "pl"
|
|
377
377
|
},
|
|
378
378
|
{
|
|
379
379
|
"id": 384,
|
|
@@ -382,7 +382,7 @@ NOTE: All params are optional
|
|
|
382
382
|
"visible": true,
|
|
383
383
|
"createdAt": "2023-09-29T12:45:54.399Z",
|
|
384
384
|
"updatedAt": "2023-09-29T13:44:08.725Z",
|
|
385
|
-
"
|
|
385
|
+
"locale": "fr"
|
|
386
386
|
},
|
|
387
387
|
{
|
|
388
388
|
"id": 382,
|
|
@@ -391,7 +391,7 @@ NOTE: All params are optional
|
|
|
391
391
|
"visible": true,
|
|
392
392
|
"createdAt": "2023-09-29T12:45:54.173Z",
|
|
393
393
|
"updatedAt": "2023-09-29T13:44:08.747Z",
|
|
394
|
-
"
|
|
394
|
+
"locale": "en"
|
|
395
395
|
},
|
|
396
396
|
{
|
|
397
397
|
"id": 374,
|
|
@@ -400,7 +400,7 @@ NOTE: All params are optional
|
|
|
400
400
|
"visible": true,
|
|
401
401
|
"createdAt": "2023-09-29T12:22:30.373Z",
|
|
402
402
|
"updatedAt": "2023-09-29T13:44:08.631Z",
|
|
403
|
-
"
|
|
403
|
+
"locale": "pl"
|
|
404
404
|
},
|
|
405
405
|
{
|
|
406
406
|
"id": 375,
|
|
@@ -409,7 +409,7 @@ NOTE: All params are optional
|
|
|
409
409
|
"visible": true,
|
|
410
410
|
"createdAt": "2023-09-29T12:22:30.373Z",
|
|
411
411
|
"updatedAt": "2023-09-29T13:44:08.658Z",
|
|
412
|
-
"
|
|
412
|
+
"locale": "fr"
|
|
413
413
|
},
|
|
414
414
|
{
|
|
415
415
|
"id": 373,
|
|
@@ -418,7 +418,7 @@ NOTE: All params are optional
|
|
|
418
418
|
"visible": true,
|
|
419
419
|
"createdAt": "2023-09-29T12:22:30.356Z",
|
|
420
420
|
"updatedAt": "2023-09-29T13:44:08.680Z",
|
|
421
|
-
"
|
|
421
|
+
"locale": "en"
|
|
422
422
|
}
|
|
423
423
|
]
|
|
424
424
|
```
|
package/dist/admin/index.js
CHANGED
|
@@ -13815,7 +13815,7 @@ class TreeCursor {
|
|
|
13815
13815
|
return this.move(1, enter);
|
|
13816
13816
|
}
|
|
13817
13817
|
/**
|
|
13818
|
-
Move to the next node in a last-to-first pre-order
|
|
13818
|
+
Move to the next node in a last-to-first pre-order traversal. A
|
|
13819
13819
|
node is followed by its last child or, if it has none, its
|
|
13820
13820
|
previous sibling or the previous sibling of the first parent
|
|
13821
13821
|
node that has one.
|
|
@@ -13890,10 +13890,10 @@ class TreeCursor {
|
|
|
13890
13890
|
if (mustLeave && leave)
|
|
13891
13891
|
leave(this);
|
|
13892
13892
|
mustLeave = this.type.isAnonymous;
|
|
13893
|
-
if (this.nextSibling())
|
|
13894
|
-
break;
|
|
13895
13893
|
if (!depth)
|
|
13896
13894
|
return;
|
|
13895
|
+
if (this.nextSibling())
|
|
13896
|
+
break;
|
|
13897
13897
|
this.parent();
|
|
13898
13898
|
depth--;
|
|
13899
13899
|
mustLeave = true;
|
|
@@ -50403,7 +50403,7 @@ const Field = ({ children, name: name2, hint, label, error, required }) => {
|
|
|
50403
50403
|
const trads = {
|
|
50404
50404
|
en: () => Promise.resolve().then(() => require("../_chunks/en-CT7eKHZS.js")),
|
|
50405
50405
|
fr: () => Promise.resolve().then(() => require("../_chunks/fr-ybbSdjZO.js")),
|
|
50406
|
-
ca: () => Promise.resolve().then(() => require("../_chunks/ca-
|
|
50406
|
+
ca: () => Promise.resolve().then(() => require("../_chunks/ca-DtaqQvTI.js"))
|
|
50407
50407
|
};
|
|
50408
50408
|
const getTradId = (msg) => `${PLUGIN_ID}.${msg}`;
|
|
50409
50409
|
const getTrad = (msg, defaultMessage) => ({
|
|
@@ -50525,7 +50525,7 @@ const navigationSchema = z__namespace.object({
|
|
|
50525
50525
|
documentId: z__namespace.string(),
|
|
50526
50526
|
name: z__namespace.string(),
|
|
50527
50527
|
slug: z__namespace.string(),
|
|
50528
|
-
|
|
50528
|
+
locale: z__namespace.string(),
|
|
50529
50529
|
visible: z__namespace.boolean(),
|
|
50530
50530
|
items: z__namespace.array(navigationItemSchema)
|
|
50531
50531
|
});
|
|
@@ -50766,6 +50766,12 @@ const getApiClient = lodash$1.once((fetch) => ({
|
|
|
50766
50766
|
readConfigIndex() {
|
|
50767
50767
|
return [URL_PREFIX, "config"];
|
|
50768
50768
|
},
|
|
50769
|
+
healthCheck() {
|
|
50770
|
+
return fetch.get(`/_health`);
|
|
50771
|
+
},
|
|
50772
|
+
healthCheckIndex() {
|
|
50773
|
+
return ["health"];
|
|
50774
|
+
},
|
|
50769
50775
|
readNavigationItemFromLocale({
|
|
50770
50776
|
source,
|
|
50771
50777
|
structureId,
|
|
@@ -51509,7 +51515,7 @@ const AllNavigations = ({ navigations, selected, setState }) => {
|
|
|
51509
51515
|
const purgeSelected = React.useCallback(purgeCache(selected), [purgeCache]);
|
|
51510
51516
|
const getLocalizations = (focused) => [focused].concat(
|
|
51511
51517
|
navigations.filter(
|
|
51512
|
-
(navigation2) => navigation2.documentId === focused.documentId && navigation2.
|
|
51518
|
+
(navigation2) => navigation2.documentId === focused.documentId && navigation2.locale !== focused.locale
|
|
51513
51519
|
)
|
|
51514
51520
|
);
|
|
51515
51521
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -51537,7 +51543,7 @@ const AllNavigations = ({ navigations, selected, setState }) => {
|
|
|
51537
51543
|
}
|
|
51538
51544
|
) }) }) : null })
|
|
51539
51545
|
] }) }),
|
|
51540
|
-
/* @__PURE__ */ jsxRuntime.jsx(Tbody, { children: navigations.filter(({
|
|
51546
|
+
/* @__PURE__ */ jsxRuntime.jsx(Tbody, { children: navigations.filter(({ locale }) => locale === localeQuery.data?.defaultLocale).map((navigation2) => /* @__PURE__ */ jsxRuntime.jsxs(Tr, { children: [
|
|
51541
51547
|
/* @__PURE__ */ jsxRuntime.jsx(Td, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
51542
51548
|
CheckboxImpl,
|
|
51543
51549
|
{
|
|
@@ -51550,7 +51556,7 @@ const AllNavigations = ({ navigations, selected, setState }) => {
|
|
|
51550
51556
|
) }),
|
|
51551
51557
|
/* @__PURE__ */ jsxRuntime.jsx(Td, { children: /* @__PURE__ */ jsxRuntime.jsx(Typography, { textColor: "neutral800", children: navigation2.documentId }) }),
|
|
51552
51558
|
/* @__PURE__ */ jsxRuntime.jsx(Td, { children: /* @__PURE__ */ jsxRuntime.jsx(Typography, { textColor: "neutral800", children: navigation2.name }) }),
|
|
51553
|
-
/* @__PURE__ */ jsxRuntime.jsx(Td, { children: /* @__PURE__ */ jsxRuntime.jsx(Typography, { textColor: "neutral800", children: getLocalizations(navigation2).map(fp.prop("
|
|
51559
|
+
/* @__PURE__ */ jsxRuntime.jsx(Td, { children: /* @__PURE__ */ jsxRuntime.jsx(Typography, { textColor: "neutral800", children: getLocalizations(navigation2).map(fp.prop("locale")).join(", ") }) }),
|
|
51554
51560
|
/* @__PURE__ */ jsxRuntime.jsx(Td, { children: /* @__PURE__ */ jsxRuntime.jsx(Typography, { textColor: "neutral800", children: navigation2.visible ? formatMessage(getTrad("popup.navigation.manage.navigation.visible")) : formatMessage(getTrad("popup.navigation.manage.navigation.hidden")) }) }),
|
|
51555
51561
|
/* @__PURE__ */ jsxRuntime.jsx(Td, { children: /* @__PURE__ */ jsxRuntime.jsxs(Flex, { width: "100%", direction: "row", alignItems: "center", justifyContent: "flex-end", children: [
|
|
51556
51562
|
/* @__PURE__ */ jsxRuntime.jsx(Box, { paddingLeft: 1, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -52070,7 +52076,7 @@ const NavigationHeader = ({
|
|
|
52070
52076
|
value: activeNavigation?.documentId,
|
|
52071
52077
|
size: "S",
|
|
52072
52078
|
style: null,
|
|
52073
|
-
children: availableNavigations.filter(({
|
|
52079
|
+
children: availableNavigations.filter(({ locale: locale2 }) => locale2 === currentLocale).map(({ documentId, name: name2 }) => /* @__PURE__ */ jsxRuntime.jsx(SingleSelectOption, { value: documentId, children: name2 }, documentId))
|
|
52074
52080
|
}
|
|
52075
52081
|
) }) }),
|
|
52076
52082
|
hasLocalizations ? /* @__PURE__ */ jsxRuntime.jsx(Grid.Item, { col: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -53262,7 +53268,7 @@ const NavigationItemForm = ({
|
|
|
53262
53268
|
event.preventDefault();
|
|
53263
53269
|
event.stopPropagation();
|
|
53264
53270
|
const source = navigationsQuery.data?.find(
|
|
53265
|
-
({
|
|
53271
|
+
({ locale: locale2 }) => locale2 === itemLocaleCopyValue
|
|
53266
53272
|
);
|
|
53267
53273
|
if (source) {
|
|
53268
53274
|
setIsLoading(true);
|
|
@@ -53811,6 +53817,7 @@ const queryClient$1 = new reactQuery.QueryClient();
|
|
|
53811
53817
|
const Inner$1 = () => {
|
|
53812
53818
|
const { formatMessage } = reactIntl.useIntl();
|
|
53813
53819
|
const localeQuery = useLocale();
|
|
53820
|
+
const [recentNavigation, setRecentNavigation] = React.useState();
|
|
53814
53821
|
const [currentNavigation, setCurrentNavigation] = React.useState();
|
|
53815
53822
|
const [activeNavigationItem, setActiveNavigationItemState] = React.useState();
|
|
53816
53823
|
const [isItemPopupVisible, setIsItemPopupVisible] = React.useState(false);
|
|
@@ -53898,14 +53905,14 @@ const Inner$1 = () => {
|
|
|
53898
53905
|
React.useCallback(
|
|
53899
53906
|
(sourceLocale) => {
|
|
53900
53907
|
const source = navigationsQuery.data?.find(
|
|
53901
|
-
({
|
|
53908
|
+
({ locale, documentId }) => locale === sourceLocale && documentId === currentNavigation?.documentId
|
|
53902
53909
|
);
|
|
53903
53910
|
if (source) {
|
|
53904
53911
|
if (source.documentId && currentNavigation?.documentId) {
|
|
53905
53912
|
copyNavigationI18nMutation.mutate(
|
|
53906
53913
|
{
|
|
53907
|
-
source: source.
|
|
53908
|
-
target: currentNavigation.
|
|
53914
|
+
source: source.locale,
|
|
53915
|
+
target: currentNavigation.locale,
|
|
53909
53916
|
documentId: source.documentId
|
|
53910
53917
|
},
|
|
53911
53918
|
{
|
|
@@ -53925,6 +53932,10 @@ const Inner$1 = () => {
|
|
|
53925
53932
|
i18nCopySourceLocale && setI18nCopyModalOpened(true);
|
|
53926
53933
|
}, [setI18nCopyModalOpened, i18nCopySourceLocale]);
|
|
53927
53934
|
const updateNavigationMutation = useUpdateNavigation(() => {
|
|
53935
|
+
setRecentNavigation({
|
|
53936
|
+
documentId: currentNavigation?.documentId,
|
|
53937
|
+
id: currentNavigation?.id
|
|
53938
|
+
});
|
|
53928
53939
|
setCurrentNavigation(void 0);
|
|
53929
53940
|
});
|
|
53930
53941
|
const submit = () => {
|
|
@@ -54054,7 +54065,14 @@ const Inner$1 = () => {
|
|
|
54054
54065
|
}
|
|
54055
54066
|
React.useEffect(() => {
|
|
54056
54067
|
if (!currentNavigation && navigationsQuery.data?.[0]) {
|
|
54057
|
-
|
|
54068
|
+
let navigation2;
|
|
54069
|
+
if (recentNavigation?.documentId) {
|
|
54070
|
+
navigation2 = navigationsQuery.data.find(
|
|
54071
|
+
(nav2) => nav2.documentId === recentNavigation.documentId && nav2.id === recentNavigation.id
|
|
54072
|
+
);
|
|
54073
|
+
}
|
|
54074
|
+
setRecentNavigation(void 0);
|
|
54075
|
+
setCurrentNavigation(navigation2 ? navigation2 : lodash$1.first(navigationsQuery.data));
|
|
54058
54076
|
}
|
|
54059
54077
|
}, [navigationsQuery.data]);
|
|
54060
54078
|
React.useEffect(() => {
|
|
@@ -54063,11 +54081,12 @@ const Inner$1 = () => {
|
|
|
54063
54081
|
}
|
|
54064
54082
|
}, [navigationsQuery.data]);
|
|
54065
54083
|
React.useEffect(() => {
|
|
54066
|
-
if (currentNavigation && currentLocale !== currentNavigation.
|
|
54084
|
+
if (currentNavigation && currentLocale !== currentNavigation.locale) {
|
|
54085
|
+
setRecentNavigation(void 0);
|
|
54067
54086
|
const nextNavigation = navigationsQuery.data?.find(
|
|
54068
|
-
(navigation2) => navigation2.documentId === currentNavigation.documentId && navigation2.
|
|
54087
|
+
(navigation2) => navigation2.documentId === currentNavigation.documentId && navigation2.locale === currentLocale
|
|
54069
54088
|
);
|
|
54070
|
-
if (nextNavigation && nextNavigation.documentId === currentNavigation.documentId && nextNavigation.
|
|
54089
|
+
if (nextNavigation && nextNavigation.documentId === currentNavigation.documentId && nextNavigation.locale !== currentNavigation.locale) {
|
|
54071
54090
|
setCurrentNavigation(nextNavigation);
|
|
54072
54091
|
}
|
|
54073
54092
|
}
|
|
@@ -54632,8 +54651,17 @@ const useConfig = () => {
|
|
|
54632
54651
|
const useRestart = () => {
|
|
54633
54652
|
const fetch = admin.getFetchClient();
|
|
54634
54653
|
const apiClient = getApiClient(fetch);
|
|
54654
|
+
const healthCheck = reactQuery.useQuery({
|
|
54655
|
+
queryKey: apiClient.healthCheckIndex(),
|
|
54656
|
+
queryFn: () => apiClient.healthCheck(),
|
|
54657
|
+
retry: true,
|
|
54658
|
+
retryDelay: 1e3 * 5,
|
|
54659
|
+
enabled: false
|
|
54660
|
+
});
|
|
54635
54661
|
return reactQuery.useMutation({
|
|
54636
|
-
mutationFn: () =>
|
|
54662
|
+
mutationFn: () => {
|
|
54663
|
+
return apiClient.restart().then(() => healthCheck.refetch());
|
|
54664
|
+
}
|
|
54637
54665
|
});
|
|
54638
54666
|
};
|
|
54639
54667
|
const useRestoreConfig = () => {
|
|
@@ -54845,12 +54873,13 @@ const Inner = () => {
|
|
|
54845
54873
|
restartMutation.mutate(void 0, {
|
|
54846
54874
|
onSuccess() {
|
|
54847
54875
|
setRestartStatus({ required: false });
|
|
54876
|
+
window.location.reload();
|
|
54848
54877
|
},
|
|
54849
54878
|
onError() {
|
|
54850
54879
|
setRestartStatus({ required: false });
|
|
54880
|
+
window.location.reload();
|
|
54851
54881
|
}
|
|
54852
54882
|
});
|
|
54853
|
-
window.location.reload();
|
|
54854
54883
|
};
|
|
54855
54884
|
const handleRestartDiscard = () => setRestartStatus({ required: false });
|
|
54856
54885
|
React.useEffect(() => {
|
|
@@ -54951,8 +54980,8 @@ const Inner = () => {
|
|
|
54951
54980
|
name: "preferCustomContentTypes",
|
|
54952
54981
|
checked: values.preferCustomContentTypes,
|
|
54953
54982
|
onChange: (eventOrPath) => handleChange(eventOrPath, !values.preferCustomContentTypes, onChange),
|
|
54954
|
-
onLabel: formatMessage(getTrad("
|
|
54955
|
-
offLabel: formatMessage(getTrad("
|
|
54983
|
+
onLabel: formatMessage(getTrad("components.toggle.enabled")),
|
|
54984
|
+
offLabel: formatMessage(getTrad("components.toggle.disabled")),
|
|
54956
54985
|
disabled: restartStatus.required,
|
|
54957
54986
|
width: "100%"
|
|
54958
54987
|
}
|
|
@@ -55213,10 +55242,17 @@ const Inner = () => {
|
|
|
55213
55242
|
{
|
|
55214
55243
|
width: "100%",
|
|
55215
55244
|
name: "allowedLevels",
|
|
55245
|
+
type: "number",
|
|
55216
55246
|
placeholder: formatMessage(
|
|
55217
55247
|
getTrad("pages.settings.form.allowedLevels.placeholder")
|
|
55218
55248
|
),
|
|
55219
|
-
onChange: (eventOrPath, value) =>
|
|
55249
|
+
onChange: (eventOrPath, value) => {
|
|
55250
|
+
if (lodash$1.isObject(eventOrPath)) {
|
|
55251
|
+
const parsedVal = parseInt(eventOrPath.target.value);
|
|
55252
|
+
return handleChange(eventOrPath.target.name, lodash$1.isNaN(parsedVal) ? 0 : parsedVal, onChange);
|
|
55253
|
+
}
|
|
55254
|
+
return handleChange(eventOrPath, value, onChange);
|
|
55255
|
+
},
|
|
55220
55256
|
value: values.allowedLevels,
|
|
55221
55257
|
disabled: restartStatus.required
|
|
55222
55258
|
}
|
|
@@ -55238,8 +55274,8 @@ const Inner = () => {
|
|
|
55238
55274
|
name: "cascadeMenuAttached",
|
|
55239
55275
|
checked: values.cascadeMenuAttached,
|
|
55240
55276
|
onChange: (eventOrPath) => handleChange(eventOrPath, !values.cascadeMenuAttached, onChange),
|
|
55241
|
-
onLabel: formatMessage(getTrad("
|
|
55242
|
-
offLabel: formatMessage(getTrad("
|
|
55277
|
+
onLabel: formatMessage(getTrad("components.toggle.enabled")),
|
|
55278
|
+
offLabel: formatMessage(getTrad("components.toggle.disabled")),
|
|
55243
55279
|
disabled: restartStatus.required
|
|
55244
55280
|
}
|
|
55245
55281
|
)
|
|
@@ -55257,8 +55293,8 @@ const Inner = () => {
|
|
|
55257
55293
|
name: "audienceFieldChecked",
|
|
55258
55294
|
checked: values.audienceFieldChecked,
|
|
55259
55295
|
onChange: (eventOrPath) => handleChange(eventOrPath, !values.audienceFieldChecked, onChange),
|
|
55260
|
-
onLabel: formatMessage(getTrad("
|
|
55261
|
-
offLabel: formatMessage(getTrad("
|
|
55296
|
+
onLabel: formatMessage(getTrad("components.toggle.enabled")),
|
|
55297
|
+
offLabel: formatMessage(getTrad("components.toggle.disabled")),
|
|
55262
55298
|
disabled: restartStatus.required,
|
|
55263
55299
|
width: "100%"
|
|
55264
55300
|
}
|
|
@@ -55277,8 +55313,8 @@ const Inner = () => {
|
|
|
55277
55313
|
name: "isCacheEnabled",
|
|
55278
55314
|
checked: values.isCacheEnabled,
|
|
55279
55315
|
onChange: (eventOrPath) => handleChange(eventOrPath, !values.isCacheEnabled, onChange),
|
|
55280
|
-
onLabel: formatMessage(getTrad("
|
|
55281
|
-
offLabel: formatMessage(getTrad("
|
|
55316
|
+
onLabel: formatMessage(getTrad("components.toggle.enabled")),
|
|
55317
|
+
offLabel: formatMessage(getTrad("components.toggle.disabled")),
|
|
55282
55318
|
disabled: restartStatus.required,
|
|
55283
55319
|
width: "100%"
|
|
55284
55320
|
}
|
package/dist/admin/index.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import { Routes, Route } from "react-router-dom";
|
|
|
9
9
|
import * as ReactDOM from "react-dom";
|
|
10
10
|
import ReactDOM__default, { flushSync, createPortal } from "react-dom";
|
|
11
11
|
import { useQuery, useQueryClient, useMutation, QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
12
|
-
import { once, orderBy, capitalize, get, isEmpty, first, isObject, isNil, isString, set, sortBy, isNumber, isBoolean, isArray, pick } from "lodash";
|
|
12
|
+
import { once, orderBy, capitalize, get, isEmpty, first, isObject, isNil, isString, set, sortBy, isNumber, isBoolean, isArray, pick, isNaN as isNaN$1 } from "lodash";
|
|
13
13
|
import { useIntl } from "react-intl";
|
|
14
14
|
import * as z from "zod";
|
|
15
15
|
import { z as z$1 } from "zod";
|
|
@@ -13795,7 +13795,7 @@ class TreeCursor {
|
|
|
13795
13795
|
return this.move(1, enter);
|
|
13796
13796
|
}
|
|
13797
13797
|
/**
|
|
13798
|
-
Move to the next node in a last-to-first pre-order
|
|
13798
|
+
Move to the next node in a last-to-first pre-order traversal. A
|
|
13799
13799
|
node is followed by its last child or, if it has none, its
|
|
13800
13800
|
previous sibling or the previous sibling of the first parent
|
|
13801
13801
|
node that has one.
|
|
@@ -13870,10 +13870,10 @@ class TreeCursor {
|
|
|
13870
13870
|
if (mustLeave && leave)
|
|
13871
13871
|
leave(this);
|
|
13872
13872
|
mustLeave = this.type.isAnonymous;
|
|
13873
|
-
if (this.nextSibling())
|
|
13874
|
-
break;
|
|
13875
13873
|
if (!depth)
|
|
13876
13874
|
return;
|
|
13875
|
+
if (this.nextSibling())
|
|
13876
|
+
break;
|
|
13877
13877
|
this.parent();
|
|
13878
13878
|
depth--;
|
|
13879
13879
|
mustLeave = true;
|
|
@@ -50383,7 +50383,7 @@ const Field = ({ children, name: name2, hint, label, error, required }) => {
|
|
|
50383
50383
|
const trads = {
|
|
50384
50384
|
en: () => import("../_chunks/en-BPYZYsnc.mjs"),
|
|
50385
50385
|
fr: () => import("../_chunks/fr-BTVWPkax.mjs"),
|
|
50386
|
-
ca: () => import("../_chunks/ca-
|
|
50386
|
+
ca: () => import("../_chunks/ca-Catou0wg.mjs")
|
|
50387
50387
|
};
|
|
50388
50388
|
const getTradId = (msg) => `${PLUGIN_ID}.${msg}`;
|
|
50389
50389
|
const getTrad = (msg, defaultMessage) => ({
|
|
@@ -50505,7 +50505,7 @@ const navigationSchema = z.object({
|
|
|
50505
50505
|
documentId: z.string(),
|
|
50506
50506
|
name: z.string(),
|
|
50507
50507
|
slug: z.string(),
|
|
50508
|
-
|
|
50508
|
+
locale: z.string(),
|
|
50509
50509
|
visible: z.boolean(),
|
|
50510
50510
|
items: z.array(navigationItemSchema)
|
|
50511
50511
|
});
|
|
@@ -50746,6 +50746,12 @@ const getApiClient = once((fetch) => ({
|
|
|
50746
50746
|
readConfigIndex() {
|
|
50747
50747
|
return [URL_PREFIX, "config"];
|
|
50748
50748
|
},
|
|
50749
|
+
healthCheck() {
|
|
50750
|
+
return fetch.get(`/_health`);
|
|
50751
|
+
},
|
|
50752
|
+
healthCheckIndex() {
|
|
50753
|
+
return ["health"];
|
|
50754
|
+
},
|
|
50749
50755
|
readNavigationItemFromLocale({
|
|
50750
50756
|
source,
|
|
50751
50757
|
structureId,
|
|
@@ -51489,7 +51495,7 @@ const AllNavigations = ({ navigations, selected, setState }) => {
|
|
|
51489
51495
|
const purgeSelected = useCallback(purgeCache(selected), [purgeCache]);
|
|
51490
51496
|
const getLocalizations = (focused) => [focused].concat(
|
|
51491
51497
|
navigations.filter(
|
|
51492
|
-
(navigation2) => navigation2.documentId === focused.documentId && navigation2.
|
|
51498
|
+
(navigation2) => navigation2.documentId === focused.documentId && navigation2.locale !== focused.locale
|
|
51493
51499
|
)
|
|
51494
51500
|
);
|
|
51495
51501
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
@@ -51517,7 +51523,7 @@ const AllNavigations = ({ navigations, selected, setState }) => {
|
|
|
51517
51523
|
}
|
|
51518
51524
|
) }) }) : null })
|
|
51519
51525
|
] }) }),
|
|
51520
|
-
/* @__PURE__ */ jsx(Tbody, { children: navigations.filter(({
|
|
51526
|
+
/* @__PURE__ */ jsx(Tbody, { children: navigations.filter(({ locale }) => locale === localeQuery.data?.defaultLocale).map((navigation2) => /* @__PURE__ */ jsxs(Tr, { children: [
|
|
51521
51527
|
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(
|
|
51522
51528
|
CheckboxImpl,
|
|
51523
51529
|
{
|
|
@@ -51530,7 +51536,7 @@ const AllNavigations = ({ navigations, selected, setState }) => {
|
|
|
51530
51536
|
) }),
|
|
51531
51537
|
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: navigation2.documentId }) }),
|
|
51532
51538
|
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: navigation2.name }) }),
|
|
51533
|
-
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: getLocalizations(navigation2).map(prop("
|
|
51539
|
+
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: getLocalizations(navigation2).map(prop("locale")).join(", ") }) }),
|
|
51534
51540
|
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: navigation2.visible ? formatMessage(getTrad("popup.navigation.manage.navigation.visible")) : formatMessage(getTrad("popup.navigation.manage.navigation.hidden")) }) }),
|
|
51535
51541
|
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsxs(Flex, { width: "100%", direction: "row", alignItems: "center", justifyContent: "flex-end", children: [
|
|
51536
51542
|
/* @__PURE__ */ jsx(Box, { paddingLeft: 1, children: /* @__PURE__ */ jsx(
|
|
@@ -52050,7 +52056,7 @@ const NavigationHeader = ({
|
|
|
52050
52056
|
value: activeNavigation?.documentId,
|
|
52051
52057
|
size: "S",
|
|
52052
52058
|
style: null,
|
|
52053
|
-
children: availableNavigations.filter(({
|
|
52059
|
+
children: availableNavigations.filter(({ locale: locale2 }) => locale2 === currentLocale).map(({ documentId, name: name2 }) => /* @__PURE__ */ jsx(SingleSelectOption, { value: documentId, children: name2 }, documentId))
|
|
52054
52060
|
}
|
|
52055
52061
|
) }) }),
|
|
52056
52062
|
hasLocalizations ? /* @__PURE__ */ jsx(Grid.Item, { col: 2, children: /* @__PURE__ */ jsx(
|
|
@@ -53242,7 +53248,7 @@ const NavigationItemForm = ({
|
|
|
53242
53248
|
event.preventDefault();
|
|
53243
53249
|
event.stopPropagation();
|
|
53244
53250
|
const source = navigationsQuery.data?.find(
|
|
53245
|
-
({
|
|
53251
|
+
({ locale: locale2 }) => locale2 === itemLocaleCopyValue
|
|
53246
53252
|
);
|
|
53247
53253
|
if (source) {
|
|
53248
53254
|
setIsLoading(true);
|
|
@@ -53791,6 +53797,7 @@ const queryClient$1 = new QueryClient();
|
|
|
53791
53797
|
const Inner$1 = () => {
|
|
53792
53798
|
const { formatMessage } = useIntl();
|
|
53793
53799
|
const localeQuery = useLocale();
|
|
53800
|
+
const [recentNavigation, setRecentNavigation] = useState();
|
|
53794
53801
|
const [currentNavigation, setCurrentNavigation] = useState();
|
|
53795
53802
|
const [activeNavigationItem, setActiveNavigationItemState] = useState();
|
|
53796
53803
|
const [isItemPopupVisible, setIsItemPopupVisible] = useState(false);
|
|
@@ -53878,14 +53885,14 @@ const Inner$1 = () => {
|
|
|
53878
53885
|
useCallback(
|
|
53879
53886
|
(sourceLocale) => {
|
|
53880
53887
|
const source = navigationsQuery.data?.find(
|
|
53881
|
-
({
|
|
53888
|
+
({ locale, documentId }) => locale === sourceLocale && documentId === currentNavigation?.documentId
|
|
53882
53889
|
);
|
|
53883
53890
|
if (source) {
|
|
53884
53891
|
if (source.documentId && currentNavigation?.documentId) {
|
|
53885
53892
|
copyNavigationI18nMutation.mutate(
|
|
53886
53893
|
{
|
|
53887
|
-
source: source.
|
|
53888
|
-
target: currentNavigation.
|
|
53894
|
+
source: source.locale,
|
|
53895
|
+
target: currentNavigation.locale,
|
|
53889
53896
|
documentId: source.documentId
|
|
53890
53897
|
},
|
|
53891
53898
|
{
|
|
@@ -53905,6 +53912,10 @@ const Inner$1 = () => {
|
|
|
53905
53912
|
i18nCopySourceLocale && setI18nCopyModalOpened(true);
|
|
53906
53913
|
}, [setI18nCopyModalOpened, i18nCopySourceLocale]);
|
|
53907
53914
|
const updateNavigationMutation = useUpdateNavigation(() => {
|
|
53915
|
+
setRecentNavigation({
|
|
53916
|
+
documentId: currentNavigation?.documentId,
|
|
53917
|
+
id: currentNavigation?.id
|
|
53918
|
+
});
|
|
53908
53919
|
setCurrentNavigation(void 0);
|
|
53909
53920
|
});
|
|
53910
53921
|
const submit = () => {
|
|
@@ -54034,7 +54045,14 @@ const Inner$1 = () => {
|
|
|
54034
54045
|
}
|
|
54035
54046
|
useEffect(() => {
|
|
54036
54047
|
if (!currentNavigation && navigationsQuery.data?.[0]) {
|
|
54037
|
-
|
|
54048
|
+
let navigation2;
|
|
54049
|
+
if (recentNavigation?.documentId) {
|
|
54050
|
+
navigation2 = navigationsQuery.data.find(
|
|
54051
|
+
(nav2) => nav2.documentId === recentNavigation.documentId && nav2.id === recentNavigation.id
|
|
54052
|
+
);
|
|
54053
|
+
}
|
|
54054
|
+
setRecentNavigation(void 0);
|
|
54055
|
+
setCurrentNavigation(navigation2 ? navigation2 : first(navigationsQuery.data));
|
|
54038
54056
|
}
|
|
54039
54057
|
}, [navigationsQuery.data]);
|
|
54040
54058
|
useEffect(() => {
|
|
@@ -54043,11 +54061,12 @@ const Inner$1 = () => {
|
|
|
54043
54061
|
}
|
|
54044
54062
|
}, [navigationsQuery.data]);
|
|
54045
54063
|
useEffect(() => {
|
|
54046
|
-
if (currentNavigation && currentLocale !== currentNavigation.
|
|
54064
|
+
if (currentNavigation && currentLocale !== currentNavigation.locale) {
|
|
54065
|
+
setRecentNavigation(void 0);
|
|
54047
54066
|
const nextNavigation = navigationsQuery.data?.find(
|
|
54048
|
-
(navigation2) => navigation2.documentId === currentNavigation.documentId && navigation2.
|
|
54067
|
+
(navigation2) => navigation2.documentId === currentNavigation.documentId && navigation2.locale === currentLocale
|
|
54049
54068
|
);
|
|
54050
|
-
if (nextNavigation && nextNavigation.documentId === currentNavigation.documentId && nextNavigation.
|
|
54069
|
+
if (nextNavigation && nextNavigation.documentId === currentNavigation.documentId && nextNavigation.locale !== currentNavigation.locale) {
|
|
54051
54070
|
setCurrentNavigation(nextNavigation);
|
|
54052
54071
|
}
|
|
54053
54072
|
}
|
|
@@ -54612,8 +54631,17 @@ const useConfig = () => {
|
|
|
54612
54631
|
const useRestart = () => {
|
|
54613
54632
|
const fetch = getFetchClient();
|
|
54614
54633
|
const apiClient = getApiClient(fetch);
|
|
54634
|
+
const healthCheck = useQuery({
|
|
54635
|
+
queryKey: apiClient.healthCheckIndex(),
|
|
54636
|
+
queryFn: () => apiClient.healthCheck(),
|
|
54637
|
+
retry: true,
|
|
54638
|
+
retryDelay: 1e3 * 5,
|
|
54639
|
+
enabled: false
|
|
54640
|
+
});
|
|
54615
54641
|
return useMutation({
|
|
54616
|
-
mutationFn: () =>
|
|
54642
|
+
mutationFn: () => {
|
|
54643
|
+
return apiClient.restart().then(() => healthCheck.refetch());
|
|
54644
|
+
}
|
|
54617
54645
|
});
|
|
54618
54646
|
};
|
|
54619
54647
|
const useRestoreConfig = () => {
|
|
@@ -54825,12 +54853,13 @@ const Inner = () => {
|
|
|
54825
54853
|
restartMutation.mutate(void 0, {
|
|
54826
54854
|
onSuccess() {
|
|
54827
54855
|
setRestartStatus({ required: false });
|
|
54856
|
+
window.location.reload();
|
|
54828
54857
|
},
|
|
54829
54858
|
onError() {
|
|
54830
54859
|
setRestartStatus({ required: false });
|
|
54860
|
+
window.location.reload();
|
|
54831
54861
|
}
|
|
54832
54862
|
});
|
|
54833
|
-
window.location.reload();
|
|
54834
54863
|
};
|
|
54835
54864
|
const handleRestartDiscard = () => setRestartStatus({ required: false });
|
|
54836
54865
|
useEffect(() => {
|
|
@@ -54931,8 +54960,8 @@ const Inner = () => {
|
|
|
54931
54960
|
name: "preferCustomContentTypes",
|
|
54932
54961
|
checked: values.preferCustomContentTypes,
|
|
54933
54962
|
onChange: (eventOrPath) => handleChange(eventOrPath, !values.preferCustomContentTypes, onChange),
|
|
54934
|
-
onLabel: formatMessage(getTrad("
|
|
54935
|
-
offLabel: formatMessage(getTrad("
|
|
54963
|
+
onLabel: formatMessage(getTrad("components.toggle.enabled")),
|
|
54964
|
+
offLabel: formatMessage(getTrad("components.toggle.disabled")),
|
|
54936
54965
|
disabled: restartStatus.required,
|
|
54937
54966
|
width: "100%"
|
|
54938
54967
|
}
|
|
@@ -55193,10 +55222,17 @@ const Inner = () => {
|
|
|
55193
55222
|
{
|
|
55194
55223
|
width: "100%",
|
|
55195
55224
|
name: "allowedLevels",
|
|
55225
|
+
type: "number",
|
|
55196
55226
|
placeholder: formatMessage(
|
|
55197
55227
|
getTrad("pages.settings.form.allowedLevels.placeholder")
|
|
55198
55228
|
),
|
|
55199
|
-
onChange: (eventOrPath, value) =>
|
|
55229
|
+
onChange: (eventOrPath, value) => {
|
|
55230
|
+
if (isObject(eventOrPath)) {
|
|
55231
|
+
const parsedVal = parseInt(eventOrPath.target.value);
|
|
55232
|
+
return handleChange(eventOrPath.target.name, isNaN$1(parsedVal) ? 0 : parsedVal, onChange);
|
|
55233
|
+
}
|
|
55234
|
+
return handleChange(eventOrPath, value, onChange);
|
|
55235
|
+
},
|
|
55200
55236
|
value: values.allowedLevels,
|
|
55201
55237
|
disabled: restartStatus.required
|
|
55202
55238
|
}
|
|
@@ -55218,8 +55254,8 @@ const Inner = () => {
|
|
|
55218
55254
|
name: "cascadeMenuAttached",
|
|
55219
55255
|
checked: values.cascadeMenuAttached,
|
|
55220
55256
|
onChange: (eventOrPath) => handleChange(eventOrPath, !values.cascadeMenuAttached, onChange),
|
|
55221
|
-
onLabel: formatMessage(getTrad("
|
|
55222
|
-
offLabel: formatMessage(getTrad("
|
|
55257
|
+
onLabel: formatMessage(getTrad("components.toggle.enabled")),
|
|
55258
|
+
offLabel: formatMessage(getTrad("components.toggle.disabled")),
|
|
55223
55259
|
disabled: restartStatus.required
|
|
55224
55260
|
}
|
|
55225
55261
|
)
|
|
@@ -55237,8 +55273,8 @@ const Inner = () => {
|
|
|
55237
55273
|
name: "audienceFieldChecked",
|
|
55238
55274
|
checked: values.audienceFieldChecked,
|
|
55239
55275
|
onChange: (eventOrPath) => handleChange(eventOrPath, !values.audienceFieldChecked, onChange),
|
|
55240
|
-
onLabel: formatMessage(getTrad("
|
|
55241
|
-
offLabel: formatMessage(getTrad("
|
|
55276
|
+
onLabel: formatMessage(getTrad("components.toggle.enabled")),
|
|
55277
|
+
offLabel: formatMessage(getTrad("components.toggle.disabled")),
|
|
55242
55278
|
disabled: restartStatus.required,
|
|
55243
55279
|
width: "100%"
|
|
55244
55280
|
}
|
|
@@ -55257,8 +55293,8 @@ const Inner = () => {
|
|
|
55257
55293
|
name: "isCacheEnabled",
|
|
55258
55294
|
checked: values.isCacheEnabled,
|
|
55259
55295
|
onChange: (eventOrPath) => handleChange(eventOrPath, !values.isCacheEnabled, onChange),
|
|
55260
|
-
onLabel: formatMessage(getTrad("
|
|
55261
|
-
offLabel: formatMessage(getTrad("
|
|
55296
|
+
onLabel: formatMessage(getTrad("components.toggle.enabled")),
|
|
55297
|
+
offLabel: formatMessage(getTrad("components.toggle.disabled")),
|
|
55262
55298
|
disabled: restartStatus.required,
|
|
55263
55299
|
width: "100%"
|
|
55264
55300
|
}
|
|
@@ -9,7 +9,7 @@ export declare const getApiClient: (fetch: ReturnType<typeof getFetchClient>) =>
|
|
|
9
9
|
documentId: string;
|
|
10
10
|
items: import("./validators").NavigationItemSchema[];
|
|
11
11
|
slug: string;
|
|
12
|
-
|
|
12
|
+
locale: string;
|
|
13
13
|
visible: boolean;
|
|
14
14
|
}[]>;
|
|
15
15
|
readAllIndex(): string[];
|
|
@@ -82,6 +82,8 @@ export declare const getApiClient: (fetch: ReturnType<typeof getFetchClient>) =>
|
|
|
82
82
|
isCachePluginEnabled?: boolean | undefined;
|
|
83
83
|
}>;
|
|
84
84
|
readConfigIndex(): string[];
|
|
85
|
+
healthCheck(): Promise<import("@strapi/strapi/admin").FetchResponse<any>>;
|
|
86
|
+
healthCheckIndex(): string[];
|
|
85
87
|
readNavigationItemFromLocale({ source, structureId, target, documentId, }: {
|
|
86
88
|
source: string;
|
|
87
89
|
target: string;
|
|
@@ -118,7 +118,7 @@ export declare const navigationSchema: z.ZodObject<{
|
|
|
118
118
|
documentId: z.ZodString;
|
|
119
119
|
name: z.ZodString;
|
|
120
120
|
slug: z.ZodString;
|
|
121
|
-
|
|
121
|
+
locale: z.ZodString;
|
|
122
122
|
visible: z.ZodBoolean;
|
|
123
123
|
items: z.ZodArray<z.ZodType<NavigationItemSchema, z.ZodTypeDef, NavigationItemSchema>, "many">;
|
|
124
124
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -127,7 +127,7 @@ export declare const navigationSchema: z.ZodObject<{
|
|
|
127
127
|
documentId: string;
|
|
128
128
|
items: NavigationItemSchema[];
|
|
129
129
|
slug: string;
|
|
130
|
-
|
|
130
|
+
locale: string;
|
|
131
131
|
visible: boolean;
|
|
132
132
|
}, {
|
|
133
133
|
id: number;
|
|
@@ -135,7 +135,7 @@ export declare const navigationSchema: z.ZodObject<{
|
|
|
135
135
|
documentId: string;
|
|
136
136
|
items: NavigationItemSchema[];
|
|
137
137
|
slug: string;
|
|
138
|
-
|
|
138
|
+
locale: string;
|
|
139
139
|
visible: boolean;
|
|
140
140
|
}>;
|
|
141
141
|
export type NavigationItemCustomFieldSelect = z.infer<typeof navigationItemCustomFieldSelect>;
|