strapi-plugin-navigation 3.0.5 → 3.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/admin/index.js +34 -5
- package/dist/admin/index.mjs +34 -5
- package/dist/admin/src/pages/HomePage/hooks/index.d.ts +3 -0
- package/dist/server/index.js +60 -16
- package/dist/server/index.mjs +60 -16
- package/dist/server/src/controllers/admin.d.ts +2 -2
- package/dist/server/src/index.d.ts +2 -2
- package/dist/server/src/services/admin/admin.d.ts +1 -1
- package/dist/server/src/services/admin/types.d.ts +1 -0
- package/dist/server/src/services/common/common.d.ts +1 -1
- package/dist/server/src/services/common/types.d.ts +1 -0
- package/dist/server/src/services/index.d.ts +2 -2
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -113,7 +113,7 @@ Complete installation requirements are exact same as for Strapi itself and can b
|
|
|
113
113
|
|
|
114
114
|
**Supported Strapi versions**:
|
|
115
115
|
|
|
116
|
-
- Strapi v5.
|
|
116
|
+
- Strapi v5.8.1 (recently tested)
|
|
117
117
|
- Strapi v5.x
|
|
118
118
|
|
|
119
119
|
> 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).
|
package/dist/admin/index.js
CHANGED
|
@@ -48,10 +48,10 @@ const NavigationIconSvg = styled__default.default.svg`
|
|
|
48
48
|
fill: ${({ theme: theme2 }) => theme2.colors.neutral500};
|
|
49
49
|
}
|
|
50
50
|
`;
|
|
51
|
-
const NavigationIcon = ({ width =
|
|
51
|
+
const NavigationIcon = ({ width = 20, height = 20 }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
52
52
|
NavigationIconSvg,
|
|
53
53
|
{
|
|
54
|
-
viewBox: `
|
|
54
|
+
viewBox: `0 0 ${width} ${height}`,
|
|
55
55
|
xmlns: "http://www.w3.org/2000/svg",
|
|
56
56
|
height,
|
|
57
57
|
width,
|
|
@@ -51195,6 +51195,26 @@ const useContentTypes$1 = () => {
|
|
|
51195
51195
|
staleTime: 1e3 * 60 * 3
|
|
51196
51196
|
});
|
|
51197
51197
|
};
|
|
51198
|
+
const useResetNavigations = () => {
|
|
51199
|
+
const fetch2 = admin.getFetchClient();
|
|
51200
|
+
const apiClient = getApiClient(fetch2);
|
|
51201
|
+
const queryClient2 = reactQuery.useQueryClient();
|
|
51202
|
+
return () => {
|
|
51203
|
+
queryClient2.resetQueries({
|
|
51204
|
+
queryKey: apiClient.readAllIndex()
|
|
51205
|
+
});
|
|
51206
|
+
};
|
|
51207
|
+
};
|
|
51208
|
+
const useResetContentTypes = () => {
|
|
51209
|
+
const fetch2 = admin.getFetchClient();
|
|
51210
|
+
const apiClient = getApiClient(fetch2);
|
|
51211
|
+
const queryClient2 = reactQuery.useQueryClient();
|
|
51212
|
+
return () => {
|
|
51213
|
+
queryClient2.resetQueries({
|
|
51214
|
+
queryKey: apiClient.readContentTypeIndex()
|
|
51215
|
+
});
|
|
51216
|
+
};
|
|
51217
|
+
};
|
|
51198
51218
|
const useNavigations = () => {
|
|
51199
51219
|
const fetch2 = admin.getFetchClient();
|
|
51200
51220
|
const apiClient = getApiClient(fetch2);
|
|
@@ -51287,7 +51307,9 @@ const usePurgeNavigation = () => {
|
|
|
51287
51307
|
if (!documentIds?.length) {
|
|
51288
51308
|
return apiClient.purge({});
|
|
51289
51309
|
}
|
|
51290
|
-
return Promise.all(
|
|
51310
|
+
return Promise.all(
|
|
51311
|
+
documentIds.map((documentId) => apiClient.purge({ documentId, withLangVersions: true }))
|
|
51312
|
+
);
|
|
51291
51313
|
}
|
|
51292
51314
|
});
|
|
51293
51315
|
};
|
|
@@ -54292,6 +54314,8 @@ const Inner$1 = () => {
|
|
|
54292
54314
|
() => (localeQuery.data ? [localeQuery.data.defaultLocale, ...localeQuery.data.restLocale] : []).filter((locale) => locale !== currentLocale),
|
|
54293
54315
|
[localeQuery.data, currentLocale]
|
|
54294
54316
|
);
|
|
54317
|
+
const resetContentTypes = useResetContentTypes();
|
|
54318
|
+
const resetNavigations = useResetNavigations();
|
|
54295
54319
|
const {
|
|
54296
54320
|
i18nCopyItemsModal,
|
|
54297
54321
|
i18nCopySourceLocale,
|
|
@@ -54314,7 +54338,12 @@ const Inner$1 = () => {
|
|
|
54314
54338
|
{
|
|
54315
54339
|
onSuccess(res) {
|
|
54316
54340
|
copyNavigationI18nMutation.reset();
|
|
54317
|
-
setCurrentNavigation(
|
|
54341
|
+
setCurrentNavigation({
|
|
54342
|
+
...res.data,
|
|
54343
|
+
items: res.data.items.map(appendViewId)
|
|
54344
|
+
});
|
|
54345
|
+
resetContentTypes();
|
|
54346
|
+
resetNavigations();
|
|
54318
54347
|
}
|
|
54319
54348
|
}
|
|
54320
54349
|
);
|
|
@@ -55752,7 +55781,7 @@ const Inner = () => {
|
|
|
55752
55781
|
) })
|
|
55753
55782
|
] })
|
|
55754
55783
|
] }) }),
|
|
55755
|
-
/* @__PURE__ */ jsxRuntime.jsxs(Box, { ...BOX_DEFAULT_PROPS, width: "100%",
|
|
55784
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Box, { ...BOX_DEFAULT_PROPS, width: "100%", children: [
|
|
55756
55785
|
/* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "delta", as: "h2", children: formatMessage(getTrad("pages.settings.customFields.title")) }),
|
|
55757
55786
|
/* @__PURE__ */ jsxRuntime.jsx(Box, { padding: 1 }),
|
|
55758
55787
|
/* @__PURE__ */ jsxRuntime.jsx(
|
package/dist/admin/index.mjs
CHANGED
|
@@ -28,10 +28,10 @@ const NavigationIconSvg = styled.svg`
|
|
|
28
28
|
fill: ${({ theme: theme2 }) => theme2.colors.neutral500};
|
|
29
29
|
}
|
|
30
30
|
`;
|
|
31
|
-
const NavigationIcon = ({ width =
|
|
31
|
+
const NavigationIcon = ({ width = 20, height = 20 }) => /* @__PURE__ */ jsx(
|
|
32
32
|
NavigationIconSvg,
|
|
33
33
|
{
|
|
34
|
-
viewBox: `
|
|
34
|
+
viewBox: `0 0 ${width} ${height}`,
|
|
35
35
|
xmlns: "http://www.w3.org/2000/svg",
|
|
36
36
|
height,
|
|
37
37
|
width,
|
|
@@ -51175,6 +51175,26 @@ const useContentTypes$1 = () => {
|
|
|
51175
51175
|
staleTime: 1e3 * 60 * 3
|
|
51176
51176
|
});
|
|
51177
51177
|
};
|
|
51178
|
+
const useResetNavigations = () => {
|
|
51179
|
+
const fetch2 = getFetchClient();
|
|
51180
|
+
const apiClient = getApiClient(fetch2);
|
|
51181
|
+
const queryClient2 = useQueryClient();
|
|
51182
|
+
return () => {
|
|
51183
|
+
queryClient2.resetQueries({
|
|
51184
|
+
queryKey: apiClient.readAllIndex()
|
|
51185
|
+
});
|
|
51186
|
+
};
|
|
51187
|
+
};
|
|
51188
|
+
const useResetContentTypes = () => {
|
|
51189
|
+
const fetch2 = getFetchClient();
|
|
51190
|
+
const apiClient = getApiClient(fetch2);
|
|
51191
|
+
const queryClient2 = useQueryClient();
|
|
51192
|
+
return () => {
|
|
51193
|
+
queryClient2.resetQueries({
|
|
51194
|
+
queryKey: apiClient.readContentTypeIndex()
|
|
51195
|
+
});
|
|
51196
|
+
};
|
|
51197
|
+
};
|
|
51178
51198
|
const useNavigations = () => {
|
|
51179
51199
|
const fetch2 = getFetchClient();
|
|
51180
51200
|
const apiClient = getApiClient(fetch2);
|
|
@@ -51267,7 +51287,9 @@ const usePurgeNavigation = () => {
|
|
|
51267
51287
|
if (!documentIds?.length) {
|
|
51268
51288
|
return apiClient.purge({});
|
|
51269
51289
|
}
|
|
51270
|
-
return Promise.all(
|
|
51290
|
+
return Promise.all(
|
|
51291
|
+
documentIds.map((documentId) => apiClient.purge({ documentId, withLangVersions: true }))
|
|
51292
|
+
);
|
|
51271
51293
|
}
|
|
51272
51294
|
});
|
|
51273
51295
|
};
|
|
@@ -54272,6 +54294,8 @@ const Inner$1 = () => {
|
|
|
54272
54294
|
() => (localeQuery.data ? [localeQuery.data.defaultLocale, ...localeQuery.data.restLocale] : []).filter((locale) => locale !== currentLocale),
|
|
54273
54295
|
[localeQuery.data, currentLocale]
|
|
54274
54296
|
);
|
|
54297
|
+
const resetContentTypes = useResetContentTypes();
|
|
54298
|
+
const resetNavigations = useResetNavigations();
|
|
54275
54299
|
const {
|
|
54276
54300
|
i18nCopyItemsModal,
|
|
54277
54301
|
i18nCopySourceLocale,
|
|
@@ -54294,7 +54318,12 @@ const Inner$1 = () => {
|
|
|
54294
54318
|
{
|
|
54295
54319
|
onSuccess(res) {
|
|
54296
54320
|
copyNavigationI18nMutation.reset();
|
|
54297
|
-
setCurrentNavigation(
|
|
54321
|
+
setCurrentNavigation({
|
|
54322
|
+
...res.data,
|
|
54323
|
+
items: res.data.items.map(appendViewId)
|
|
54324
|
+
});
|
|
54325
|
+
resetContentTypes();
|
|
54326
|
+
resetNavigations();
|
|
54298
54327
|
}
|
|
54299
54328
|
}
|
|
54300
54329
|
);
|
|
@@ -55732,7 +55761,7 @@ const Inner = () => {
|
|
|
55732
55761
|
) })
|
|
55733
55762
|
] })
|
|
55734
55763
|
] }) }),
|
|
55735
|
-
/* @__PURE__ */ jsxs(Box, { ...BOX_DEFAULT_PROPS, width: "100%",
|
|
55764
|
+
/* @__PURE__ */ jsxs(Box, { ...BOX_DEFAULT_PROPS, width: "100%", children: [
|
|
55736
55765
|
/* @__PURE__ */ jsx(Typography, { variant: "delta", as: "h2", children: formatMessage(getTrad("pages.settings.customFields.title")) }),
|
|
55737
55766
|
/* @__PURE__ */ jsx(Box, { padding: 1 }),
|
|
55738
55767
|
/* @__PURE__ */ jsx(
|
|
@@ -29,6 +29,8 @@ export declare const useContentTypes: () => import("@tanstack/react-query").UseQ
|
|
|
29
29
|
isDisplayed: boolean;
|
|
30
30
|
apiID: string;
|
|
31
31
|
}[], Error>;
|
|
32
|
+
export declare const useResetNavigations: () => () => void;
|
|
33
|
+
export declare const useResetContentTypes: () => () => void;
|
|
32
34
|
export declare const useNavigations: () => import("@tanstack/react-query").UseQueryResult<{
|
|
33
35
|
id: number;
|
|
34
36
|
name: string;
|
|
@@ -145,3 +147,4 @@ export declare const useI18nCopyNavigationItemsModal: (onConfirm: ConfirmEffect)
|
|
|
145
147
|
i18nCopyItemsModal: import("react/jsx-runtime").JSX.Element | null;
|
|
146
148
|
i18nCopySourceLocale: string | undefined;
|
|
147
149
|
};
|
|
150
|
+
export declare const appendViewId: (item: NavigationItemSchema) => NavigationItemSchema;
|
package/dist/server/index.js
CHANGED
|
@@ -14903,7 +14903,8 @@ const processItems = (context) => async (item) => {
|
|
|
14903
14903
|
items: item.items ? await Promise.all(item.items.map(processItems(context))) : [],
|
|
14904
14904
|
master: context.master,
|
|
14905
14905
|
parent: void 0,
|
|
14906
|
-
related: item.related
|
|
14906
|
+
related: item.related,
|
|
14907
|
+
additionalFields: item.additionalFields
|
|
14907
14908
|
};
|
|
14908
14909
|
};
|
|
14909
14910
|
const intercalate = (glue, arr) => arr.slice(1).reduce((acc, element) => acc.concat([glue, element]), arr.slice(0, 1));
|
|
@@ -15108,7 +15109,7 @@ const adminService = (context) => ({
|
|
|
15108
15109
|
).sort((a, b) => a.order - b.order)
|
|
15109
15110
|
}));
|
|
15110
15111
|
},
|
|
15111
|
-
async getById({ documentId, locale: locale2 }) {
|
|
15112
|
+
async getById({ documentId, locale: locale2, populate: populate2 = [] }) {
|
|
15112
15113
|
const commonService2 = getPluginService(context, "common");
|
|
15113
15114
|
const { defaultLocale } = await commonService2.readLocale();
|
|
15114
15115
|
const filters2 = {
|
|
@@ -15123,7 +15124,7 @@ const adminService = (context) => ({
|
|
|
15123
15124
|
locale: locale2 || defaultLocale,
|
|
15124
15125
|
limit: Number.MAX_SAFE_INTEGER,
|
|
15125
15126
|
order: [{ order: "asc" }],
|
|
15126
|
-
populate: ["parent", "audience"]
|
|
15127
|
+
populate: ["parent", "audience", ...populate2]
|
|
15127
15128
|
});
|
|
15128
15129
|
return {
|
|
15129
15130
|
...navigation2,
|
|
@@ -15263,9 +15264,7 @@ const adminService = (context) => ({
|
|
|
15263
15264
|
filters: { documentId: navigation2.documentId },
|
|
15264
15265
|
populate: "*"
|
|
15265
15266
|
});
|
|
15266
|
-
await cleanNavigationItems(
|
|
15267
|
-
allNavigations.map(({ id }) => id)
|
|
15268
|
-
);
|
|
15267
|
+
await cleanNavigationItems(allNavigations.map(({ id }) => id));
|
|
15269
15268
|
await navigationRepository.remove({ documentId: navigation2.documentId });
|
|
15270
15269
|
sendAuditLog(auditLog, "onNavigationDeletion", {
|
|
15271
15270
|
entity: navigationAsDTO,
|
|
@@ -15313,9 +15312,9 @@ const adminService = (context) => ({
|
|
|
15313
15312
|
}) {
|
|
15314
15313
|
const targetEntity = await this.getById({ documentId, locale: target });
|
|
15315
15314
|
return await this.i18nNavigationContentsCopy({
|
|
15316
|
-
source: await this.getById({ documentId, locale: source }),
|
|
15315
|
+
source: await this.getById({ documentId, locale: source, populate: ["related"] }),
|
|
15317
15316
|
target: targetEntity
|
|
15318
|
-
}).then(() => this.getById({ documentId, locale: target })).then((newEntity) => {
|
|
15317
|
+
}).then(() => this.getById({ documentId, locale: target, populate: ["related"] })).then((newEntity) => {
|
|
15319
15318
|
sendAuditLog(auditLog, "onChangeNavigation", {
|
|
15320
15319
|
actionType: "UPDATE",
|
|
15321
15320
|
oldEntity: targetEntity,
|
|
@@ -15555,7 +15554,17 @@ const clientService = (context) => ({
|
|
|
15555
15554
|
throw new NavigationError("Unknown item type", item);
|
|
15556
15555
|
},
|
|
15557
15556
|
renderRFRPage({ item, parent, enabledCustomFieldsNames }) {
|
|
15558
|
-
const {
|
|
15557
|
+
const {
|
|
15558
|
+
documentId,
|
|
15559
|
+
uiRouterKey,
|
|
15560
|
+
title,
|
|
15561
|
+
path: path2,
|
|
15562
|
+
related,
|
|
15563
|
+
type: type2,
|
|
15564
|
+
audience: audience2,
|
|
15565
|
+
menuAttached,
|
|
15566
|
+
additionalFields
|
|
15567
|
+
} = item;
|
|
15559
15568
|
const additionalFieldsRendered = enabledCustomFieldsNames.reduce(
|
|
15560
15569
|
(acc, field) => ({ ...acc, [field]: additionalFields?.[field] }),
|
|
15561
15570
|
{}
|
|
@@ -15727,9 +15736,10 @@ const clientService = (context) => ({
|
|
|
15727
15736
|
populate: ["audience", "parent", "related"]
|
|
15728
15737
|
});
|
|
15729
15738
|
const mappedItems = await commonService2.mapToNavigationItemDTO({
|
|
15739
|
+
locale: locale2,
|
|
15740
|
+
master: navigation2,
|
|
15730
15741
|
navigationItems,
|
|
15731
|
-
populate: populate2
|
|
15732
|
-
master: navigation2
|
|
15742
|
+
populate: populate2
|
|
15733
15743
|
});
|
|
15734
15744
|
const { contentTypes: contentTypes2, contentTypesNameFields: contentTypesNameFields2, additionalFields } = await adminService2.config({
|
|
15735
15745
|
viaSettingsPage: false
|
|
@@ -15930,13 +15940,46 @@ const commonService = (context) => ({
|
|
|
15930
15940
|
return await strapi.store({ type: "plugin", name: "navigation" });
|
|
15931
15941
|
},
|
|
15932
15942
|
async mapToNavigationItemDTO({
|
|
15933
|
-
|
|
15934
|
-
populate: populate2,
|
|
15943
|
+
locale: locale2,
|
|
15935
15944
|
master,
|
|
15936
|
-
|
|
15945
|
+
navigationItems,
|
|
15946
|
+
parent,
|
|
15947
|
+
populate: populate2
|
|
15937
15948
|
}) {
|
|
15938
15949
|
const result = [];
|
|
15939
|
-
|
|
15950
|
+
const pluginStore = await this.getPluginStore();
|
|
15951
|
+
const config2 = await pluginStore.get({
|
|
15952
|
+
key: "config"
|
|
15953
|
+
}).then(configSchema.parse);
|
|
15954
|
+
const extendedNavigationItems = await Promise.all(
|
|
15955
|
+
navigationItems.map(async (item) => {
|
|
15956
|
+
if (!item.related?.__type || !item.related.documentId) {
|
|
15957
|
+
return item;
|
|
15958
|
+
}
|
|
15959
|
+
const fieldsToPopulate = config2.contentTypesPopulate[item.related.__type];
|
|
15960
|
+
if (!fieldsToPopulate?.length) {
|
|
15961
|
+
return item;
|
|
15962
|
+
}
|
|
15963
|
+
const repository = getGenericRepository({ strapi }, item.related.__type);
|
|
15964
|
+
const related = await repository.findById(
|
|
15965
|
+
item.related.documentId,
|
|
15966
|
+
fieldsToPopulate,
|
|
15967
|
+
"published",
|
|
15968
|
+
{
|
|
15969
|
+
locale: locale2
|
|
15970
|
+
}
|
|
15971
|
+
);
|
|
15972
|
+
return {
|
|
15973
|
+
...item,
|
|
15974
|
+
related: {
|
|
15975
|
+
...related,
|
|
15976
|
+
__type: item.related.__type,
|
|
15977
|
+
documentId: item.related.documentId
|
|
15978
|
+
}
|
|
15979
|
+
};
|
|
15980
|
+
})
|
|
15981
|
+
);
|
|
15982
|
+
for (const navigationItem2 of extendedNavigationItems) {
|
|
15940
15983
|
const { items = [], ...base } = navigationItem2;
|
|
15941
15984
|
result.push({
|
|
15942
15985
|
...base,
|
|
@@ -15945,7 +15988,8 @@ const commonService = (context) => ({
|
|
|
15945
15988
|
navigationItems: items,
|
|
15946
15989
|
populate: populate2,
|
|
15947
15990
|
master,
|
|
15948
|
-
parent: base
|
|
15991
|
+
parent: base,
|
|
15992
|
+
locale: locale2
|
|
15949
15993
|
})
|
|
15950
15994
|
});
|
|
15951
15995
|
}
|
package/dist/server/index.mjs
CHANGED
|
@@ -14865,7 +14865,8 @@ const processItems = (context) => async (item) => {
|
|
|
14865
14865
|
items: item.items ? await Promise.all(item.items.map(processItems(context))) : [],
|
|
14866
14866
|
master: context.master,
|
|
14867
14867
|
parent: void 0,
|
|
14868
|
-
related: item.related
|
|
14868
|
+
related: item.related,
|
|
14869
|
+
additionalFields: item.additionalFields
|
|
14869
14870
|
};
|
|
14870
14871
|
};
|
|
14871
14872
|
const intercalate = (glue, arr) => arr.slice(1).reduce((acc, element) => acc.concat([glue, element]), arr.slice(0, 1));
|
|
@@ -15070,7 +15071,7 @@ const adminService = (context) => ({
|
|
|
15070
15071
|
).sort((a, b) => a.order - b.order)
|
|
15071
15072
|
}));
|
|
15072
15073
|
},
|
|
15073
|
-
async getById({ documentId, locale: locale2 }) {
|
|
15074
|
+
async getById({ documentId, locale: locale2, populate: populate2 = [] }) {
|
|
15074
15075
|
const commonService2 = getPluginService(context, "common");
|
|
15075
15076
|
const { defaultLocale } = await commonService2.readLocale();
|
|
15076
15077
|
const filters2 = {
|
|
@@ -15085,7 +15086,7 @@ const adminService = (context) => ({
|
|
|
15085
15086
|
locale: locale2 || defaultLocale,
|
|
15086
15087
|
limit: Number.MAX_SAFE_INTEGER,
|
|
15087
15088
|
order: [{ order: "asc" }],
|
|
15088
|
-
populate: ["parent", "audience"]
|
|
15089
|
+
populate: ["parent", "audience", ...populate2]
|
|
15089
15090
|
});
|
|
15090
15091
|
return {
|
|
15091
15092
|
...navigation2,
|
|
@@ -15225,9 +15226,7 @@ const adminService = (context) => ({
|
|
|
15225
15226
|
filters: { documentId: navigation2.documentId },
|
|
15226
15227
|
populate: "*"
|
|
15227
15228
|
});
|
|
15228
|
-
await cleanNavigationItems(
|
|
15229
|
-
allNavigations.map(({ id }) => id)
|
|
15230
|
-
);
|
|
15229
|
+
await cleanNavigationItems(allNavigations.map(({ id }) => id));
|
|
15231
15230
|
await navigationRepository.remove({ documentId: navigation2.documentId });
|
|
15232
15231
|
sendAuditLog(auditLog, "onNavigationDeletion", {
|
|
15233
15232
|
entity: navigationAsDTO,
|
|
@@ -15275,9 +15274,9 @@ const adminService = (context) => ({
|
|
|
15275
15274
|
}) {
|
|
15276
15275
|
const targetEntity = await this.getById({ documentId, locale: target });
|
|
15277
15276
|
return await this.i18nNavigationContentsCopy({
|
|
15278
|
-
source: await this.getById({ documentId, locale: source }),
|
|
15277
|
+
source: await this.getById({ documentId, locale: source, populate: ["related"] }),
|
|
15279
15278
|
target: targetEntity
|
|
15280
|
-
}).then(() => this.getById({ documentId, locale: target })).then((newEntity) => {
|
|
15279
|
+
}).then(() => this.getById({ documentId, locale: target, populate: ["related"] })).then((newEntity) => {
|
|
15281
15280
|
sendAuditLog(auditLog, "onChangeNavigation", {
|
|
15282
15281
|
actionType: "UPDATE",
|
|
15283
15282
|
oldEntity: targetEntity,
|
|
@@ -15517,7 +15516,17 @@ const clientService = (context) => ({
|
|
|
15517
15516
|
throw new NavigationError("Unknown item type", item);
|
|
15518
15517
|
},
|
|
15519
15518
|
renderRFRPage({ item, parent, enabledCustomFieldsNames }) {
|
|
15520
|
-
const {
|
|
15519
|
+
const {
|
|
15520
|
+
documentId,
|
|
15521
|
+
uiRouterKey,
|
|
15522
|
+
title,
|
|
15523
|
+
path: path2,
|
|
15524
|
+
related,
|
|
15525
|
+
type: type2,
|
|
15526
|
+
audience: audience2,
|
|
15527
|
+
menuAttached,
|
|
15528
|
+
additionalFields
|
|
15529
|
+
} = item;
|
|
15521
15530
|
const additionalFieldsRendered = enabledCustomFieldsNames.reduce(
|
|
15522
15531
|
(acc, field) => ({ ...acc, [field]: additionalFields?.[field] }),
|
|
15523
15532
|
{}
|
|
@@ -15689,9 +15698,10 @@ const clientService = (context) => ({
|
|
|
15689
15698
|
populate: ["audience", "parent", "related"]
|
|
15690
15699
|
});
|
|
15691
15700
|
const mappedItems = await commonService2.mapToNavigationItemDTO({
|
|
15701
|
+
locale: locale2,
|
|
15702
|
+
master: navigation2,
|
|
15692
15703
|
navigationItems,
|
|
15693
|
-
populate: populate2
|
|
15694
|
-
master: navigation2
|
|
15704
|
+
populate: populate2
|
|
15695
15705
|
});
|
|
15696
15706
|
const { contentTypes: contentTypes2, contentTypesNameFields: contentTypesNameFields2, additionalFields } = await adminService2.config({
|
|
15697
15707
|
viaSettingsPage: false
|
|
@@ -15892,13 +15902,46 @@ const commonService = (context) => ({
|
|
|
15892
15902
|
return await strapi.store({ type: "plugin", name: "navigation" });
|
|
15893
15903
|
},
|
|
15894
15904
|
async mapToNavigationItemDTO({
|
|
15895
|
-
|
|
15896
|
-
populate: populate2,
|
|
15905
|
+
locale: locale2,
|
|
15897
15906
|
master,
|
|
15898
|
-
|
|
15907
|
+
navigationItems,
|
|
15908
|
+
parent,
|
|
15909
|
+
populate: populate2
|
|
15899
15910
|
}) {
|
|
15900
15911
|
const result = [];
|
|
15901
|
-
|
|
15912
|
+
const pluginStore = await this.getPluginStore();
|
|
15913
|
+
const config2 = await pluginStore.get({
|
|
15914
|
+
key: "config"
|
|
15915
|
+
}).then(configSchema.parse);
|
|
15916
|
+
const extendedNavigationItems = await Promise.all(
|
|
15917
|
+
navigationItems.map(async (item) => {
|
|
15918
|
+
if (!item.related?.__type || !item.related.documentId) {
|
|
15919
|
+
return item;
|
|
15920
|
+
}
|
|
15921
|
+
const fieldsToPopulate = config2.contentTypesPopulate[item.related.__type];
|
|
15922
|
+
if (!fieldsToPopulate?.length) {
|
|
15923
|
+
return item;
|
|
15924
|
+
}
|
|
15925
|
+
const repository = getGenericRepository({ strapi }, item.related.__type);
|
|
15926
|
+
const related = await repository.findById(
|
|
15927
|
+
item.related.documentId,
|
|
15928
|
+
fieldsToPopulate,
|
|
15929
|
+
"published",
|
|
15930
|
+
{
|
|
15931
|
+
locale: locale2
|
|
15932
|
+
}
|
|
15933
|
+
);
|
|
15934
|
+
return {
|
|
15935
|
+
...item,
|
|
15936
|
+
related: {
|
|
15937
|
+
...related,
|
|
15938
|
+
__type: item.related.__type,
|
|
15939
|
+
documentId: item.related.documentId
|
|
15940
|
+
}
|
|
15941
|
+
};
|
|
15942
|
+
})
|
|
15943
|
+
);
|
|
15944
|
+
for (const navigationItem2 of extendedNavigationItems) {
|
|
15902
15945
|
const { items = [], ...base } = navigationItem2;
|
|
15903
15946
|
result.push({
|
|
15904
15947
|
...base,
|
|
@@ -15907,7 +15950,8 @@ const commonService = (context) => ({
|
|
|
15907
15950
|
navigationItems: items,
|
|
15908
15951
|
populate: populate2,
|
|
15909
15952
|
master,
|
|
15910
|
-
parent: base
|
|
15953
|
+
parent: base,
|
|
15954
|
+
locale: locale2
|
|
15911
15955
|
})
|
|
15912
15956
|
});
|
|
15913
15957
|
}
|
|
@@ -20,7 +20,7 @@ export default function adminController(context: {
|
|
|
20
20
|
visible: boolean;
|
|
21
21
|
items?: import("../schemas").NavigationItemDBSchema[] | undefined;
|
|
22
22
|
}[]>;
|
|
23
|
-
getById({ documentId, locale }: import("../services/admin/types").GetByIdInput): Promise<{
|
|
23
|
+
getById({ documentId, locale, populate }: import("../services/admin/types").GetByIdInput): Promise<{
|
|
24
24
|
name: string;
|
|
25
25
|
id: number;
|
|
26
26
|
documentId: string;
|
|
@@ -96,7 +96,7 @@ export default function adminController(context: {
|
|
|
96
96
|
tag?: string | undefined;
|
|
97
97
|
}> | undefined): Promise<void>;
|
|
98
98
|
}>;
|
|
99
|
-
mapToNavigationItemDTO({
|
|
99
|
+
mapToNavigationItemDTO({ locale, master, navigationItems, parent, populate, }: import("../services/common/types").MapToNavigationItemDTOInput): Promise<import("../dtos").NavigationItemDTO[]>;
|
|
100
100
|
setDefaultConfig(): Promise<{
|
|
101
101
|
additionalFields: ("audience" | {
|
|
102
102
|
type: "string" | "boolean";
|
|
@@ -274,7 +274,7 @@ declare const _default: {
|
|
|
274
274
|
visible: boolean;
|
|
275
275
|
items?: import("./schemas").NavigationItemDBSchema[] | undefined;
|
|
276
276
|
}[]>;
|
|
277
|
-
getById({ documentId, locale }: import("./services/admin/types").GetByIdInput): Promise<{
|
|
277
|
+
getById({ documentId, locale, populate }: import("./services/admin/types").GetByIdInput): Promise<{
|
|
278
278
|
name: string;
|
|
279
279
|
id: number;
|
|
280
280
|
documentId: string;
|
|
@@ -354,7 +354,7 @@ declare const _default: {
|
|
|
354
354
|
tag?: string | undefined;
|
|
355
355
|
}> | undefined): Promise<void>;
|
|
356
356
|
}>;
|
|
357
|
-
mapToNavigationItemDTO({
|
|
357
|
+
mapToNavigationItemDTO({ locale, master, navigationItems, parent, populate, }: import("./services/common/types").MapToNavigationItemDTOInput): Promise<import("./dtos").NavigationItemDTO[]>;
|
|
358
358
|
setDefaultConfig(): Promise<{
|
|
359
359
|
additionalFields: ("audience" | {
|
|
360
360
|
type: "string" | "boolean";
|
|
@@ -9,7 +9,7 @@ declare const adminService: (context: {
|
|
|
9
9
|
config({ viaSettingsPage }: ConfigInput): Promise<NavigationPluginConfigDTO>;
|
|
10
10
|
configContentTypes({ viaSettingsPage, }: ConfigInput): Promise<ConfigContentTypeDTO[]>;
|
|
11
11
|
get({ ids, locale }: GetInput): Promise<NavigationDBSchema[]>;
|
|
12
|
-
getById({ documentId, locale }: GetByIdInput): Promise<NavigationDBSchema>;
|
|
12
|
+
getById({ documentId, locale, populate }: GetByIdInput): Promise<NavigationDBSchema>;
|
|
13
13
|
post({ auditLog, payload }: PostInput): Promise<NavigationDTO>;
|
|
14
14
|
put({ auditLog, payload }: PutInput): Promise<NavigationDBSchema>;
|
|
15
15
|
delete({ auditLog, documentId }: DeleteInput): Promise<void>;
|
|
@@ -8,7 +8,7 @@ declare const commonService: (context: {
|
|
|
8
8
|
strapi: Core.Strapi;
|
|
9
9
|
}) => {
|
|
10
10
|
getPluginStore(): Promise<ReturnType<typeof strapi.store>>;
|
|
11
|
-
mapToNavigationItemDTO({
|
|
11
|
+
mapToNavigationItemDTO({ locale, master, navigationItems, parent, populate, }: MapToNavigationItemDTOInput): Promise<NavigationItemDTO[]>;
|
|
12
12
|
setDefaultConfig(): Promise<NavigationPluginConfigDBSchema>;
|
|
13
13
|
getBranchName({ item }: GetBranchNameInput): NavigationActionsCategories | void;
|
|
14
14
|
analyzeBranch({ masterEntity, navigationItems, parentItem, prevAction, }: AnalyzeBranchInput): Promise<NavigationAction[]>;
|
|
@@ -17,7 +17,7 @@ declare const _default: {
|
|
|
17
17
|
visible: boolean;
|
|
18
18
|
items?: import("../schemas").NavigationItemDBSchema[] | undefined;
|
|
19
19
|
}[]>;
|
|
20
|
-
getById({ documentId, locale }: import("./admin/types").GetByIdInput): Promise<{
|
|
20
|
+
getById({ documentId, locale, populate }: import("./admin/types").GetByIdInput): Promise<{
|
|
21
21
|
name: string;
|
|
22
22
|
id: number;
|
|
23
23
|
documentId: string;
|
|
@@ -95,7 +95,7 @@ declare const _default: {
|
|
|
95
95
|
tag?: string | undefined;
|
|
96
96
|
}> | undefined): Promise<void>;
|
|
97
97
|
}>;
|
|
98
|
-
mapToNavigationItemDTO({
|
|
98
|
+
mapToNavigationItemDTO({ locale, master, navigationItems, parent, populate, }: import("./common/types").MapToNavigationItemDTOInput): Promise<import("../dtos").NavigationItemDTO[]>;
|
|
99
99
|
setDefaultConfig(): Promise<{
|
|
100
100
|
additionalFields: ("audience" | {
|
|
101
101
|
type: "string" | "boolean";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "strapi-plugin-navigation",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.6",
|
|
4
4
|
"description": "Strapi - Navigation plugin",
|
|
5
5
|
"strapi": {
|
|
6
6
|
"name": "navigation",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"react-dnd": "^16.0.1",
|
|
49
49
|
"react-dnd-html5-backend": "^16.0.1",
|
|
50
50
|
"react-dom": "^18.2.0",
|
|
51
|
-
"react-intl": "6.6.
|
|
51
|
+
"react-intl": "6.6.2",
|
|
52
52
|
"react-router-dom": "^6.22.3",
|
|
53
53
|
"uuid": "^10.0.0",
|
|
54
54
|
"zod": "^3.22.5"
|
|
@@ -60,11 +60,11 @@
|
|
|
60
60
|
"@sensinum/strapi-utils": "^1.0.4",
|
|
61
61
|
"@strapi/design-system": "2.0.0-rc.14",
|
|
62
62
|
"@strapi/icons": "2.0.0-rc.14",
|
|
63
|
-
"@strapi/plugin-graphql": "^5.
|
|
64
|
-
"@strapi/sdk-plugin": "^5.
|
|
65
|
-
"@strapi/strapi": "^5.
|
|
66
|
-
"@strapi/types": "^5.
|
|
67
|
-
"@strapi/typescript-utils": "^5.
|
|
63
|
+
"@strapi/plugin-graphql": "^5.8.1",
|
|
64
|
+
"@strapi/sdk-plugin": "^5.3.0",
|
|
65
|
+
"@strapi/strapi": "^5.8.1",
|
|
66
|
+
"@strapi/types": "^5.8.1",
|
|
67
|
+
"@strapi/typescript-utils": "^5.8.1",
|
|
68
68
|
"@types/jest": "^29.5.12",
|
|
69
69
|
"@types/koa": "^2.15.0",
|
|
70
70
|
"@types/koa-bodyparser": "^4.3.12",
|
|
@@ -90,9 +90,9 @@
|
|
|
90
90
|
"prettier": "^3.3.3",
|
|
91
91
|
"react": "^18.3.1",
|
|
92
92
|
"react-dom": "^18.3.1",
|
|
93
|
-
"react-intl": "^6.6.
|
|
93
|
+
"react-intl": "^6.6.2",
|
|
94
94
|
"react-query": "3.39.3",
|
|
95
|
-
"react-router-dom": "^6.
|
|
95
|
+
"react-router-dom": "^6.22.3",
|
|
96
96
|
"strapi-plugin-rest-cache": "^4.2.9",
|
|
97
97
|
"styled-components": "^6.1.13",
|
|
98
98
|
"ts-jest": "^29.1.4",
|
|
@@ -100,11 +100,11 @@
|
|
|
100
100
|
"typescript": "^5.6.2"
|
|
101
101
|
},
|
|
102
102
|
"peerDependencies": {
|
|
103
|
-
"@strapi/sdk-plugin": "^5.
|
|
104
|
-
"@strapi/strapi": "^5.
|
|
103
|
+
"@strapi/sdk-plugin": "^5.3.0",
|
|
104
|
+
"@strapi/strapi": "^5.8.1",
|
|
105
105
|
"react": "^18.3.1",
|
|
106
106
|
"react-dom": "^18.3.1",
|
|
107
|
-
"react-router-dom": "^6.
|
|
107
|
+
"react-router-dom": "^6.22.3",
|
|
108
108
|
"styled-components": "^6.1.13"
|
|
109
109
|
},
|
|
110
110
|
"husky": {
|