@littlebox/strapi-suite 1.0.33 → 1.0.35
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 +154 -33
- package/dist/_chunks/{App-CXitaGLI.mjs → App-2SwRpCFC.mjs} +214 -27
- package/dist/_chunks/{App-BwtvAoMl.js → App-DBXgA-D1.js} +213 -26
- package/dist/_chunks/{SlugInput-DvuzCwKx.mjs → SlugInput-BcUe-oCY.mjs} +2 -2
- package/dist/_chunks/{SlugInput-0Vo-U5cA.js → SlugInput-CVnNz0al.js} +2 -2
- package/dist/_chunks/{convertToSlug-DGSdTBaK.js → convertToSlug-Btfca6aI.js} +1 -1
- package/dist/_chunks/{convertToSlug-CRnBMJHB.mjs → convertToSlug-q9_W-VMA.mjs} +1 -1
- package/dist/_chunks/{en-Bz6GsXYT.js → en-CGJcJfk1.js} +6 -0
- package/dist/_chunks/{en-RUOaam8y.mjs → en-CRSiVe4w.mjs} +6 -0
- package/dist/_chunks/{index-BBTYu57z.mjs → index-DmkEUACh.mjs} +10 -6
- package/dist/_chunks/{index-BZqSioMv.js → index-Pylfg-hk.js} +7 -3
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/components/SlugSettingsModal.d.ts +7 -1
- package/dist/admin/src/core/config.d.ts +2 -0
- package/dist/server/index.js +199 -31
- package/dist/server/index.mjs +199 -31
- package/dist/server/src/config/index.d.ts +2 -0
- package/dist/server/src/controllers/index.d.ts +1 -0
- package/dist/server/src/controllers/modules/slug.d.ts +1 -0
- package/dist/server/src/index.d.ts +5 -6
- package/dist/server/src/services/index.d.ts +4 -6
- package/dist/server/src/services/modules/slug.d.ts +4 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -200,6 +200,53 @@ GET /api/littlebox-strapi-suite/modules/pages?slug=<SLUG>
|
|
|
200
200
|
```
|
|
201
201
|
**Note**: The default language won't show up in the URL slug if the `SHOW LANGUAGE SLUG` setting is turned off in the slug module settings (see screenshot above).
|
|
202
202
|
|
|
203
|
+
Using the slug module settings (as shown in the screenshot above), you can choose which content will be set as the homepage. Then, just call the API to get the data:
|
|
204
|
+
```
|
|
205
|
+
GET /api/littlebox-strapi-suite/modules/pages/home?properties=attributes
|
|
206
|
+
```
|
|
207
|
+
The return will be the content in the default language and the respective localizations:
|
|
208
|
+
```
|
|
209
|
+
{
|
|
210
|
+
"document": {
|
|
211
|
+
"id": 53,
|
|
212
|
+
"documentId": "un6hqh6smm657hwf0n06xm72",
|
|
213
|
+
"title": "Home PT",
|
|
214
|
+
"slug": "",
|
|
215
|
+
"createdAt": "2025-04-14T19:38:34.673Z",
|
|
216
|
+
"updatedAt": "2025-04-14T22:19:21.242Z",
|
|
217
|
+
"publishedAt": "2025-04-14T22:19:21.270Z",
|
|
218
|
+
"locale": "pt",
|
|
219
|
+
"localizations": [
|
|
220
|
+
{
|
|
221
|
+
"id": 59,
|
|
222
|
+
"documentId": "un6hqh6smm657hwf0n06xm72",
|
|
223
|
+
"title": "Home EN",
|
|
224
|
+
"slug": "en",
|
|
225
|
+
"createdAt": "2025-04-14T22:19:29.371Z",
|
|
226
|
+
"updatedAt": "2025-04-14T23:45:50.177Z",
|
|
227
|
+
"publishedAt": "2025-04-14T23:45:50.210Z",
|
|
228
|
+
"locale": "en"
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"id": 61,
|
|
232
|
+
"documentId": "un6hqh6smm657hwf0n06xm72",
|
|
233
|
+
"title": "Home EU",
|
|
234
|
+
"slug": "en-eu",
|
|
235
|
+
"createdAt": "2025-04-15T10:49:50.490Z",
|
|
236
|
+
"updatedAt": "2025-04-15T10:49:51.244Z",
|
|
237
|
+
"publishedAt": "2025-04-15T10:49:51.263Z",
|
|
238
|
+
"locale": "en-EU"
|
|
239
|
+
}
|
|
240
|
+
]
|
|
241
|
+
},
|
|
242
|
+
"attributes": {
|
|
243
|
+
"template": "default",
|
|
244
|
+
"priority": "0.5",
|
|
245
|
+
"frequency": "weekly"
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
```
|
|
249
|
+
|
|
203
250
|
|
|
204
251
|
|
|
205
252
|
|
|
@@ -266,56 +313,130 @@ GET /api/littlebox-strapi-suite/modules/pages?properties=attributes
|
|
|
266
313
|
```
|
|
267
314
|
[
|
|
268
315
|
{
|
|
269
|
-
"id":
|
|
270
|
-
"
|
|
271
|
-
"slug": "
|
|
272
|
-
"locale": "en",
|
|
273
|
-
"attributes": {
|
|
274
|
-
"template": "default",
|
|
275
|
-
"priority": "1.0",
|
|
276
|
-
"frequency": "weekly"
|
|
277
|
-
}
|
|
278
|
-
},
|
|
279
|
-
{
|
|
280
|
-
"id": "wnzxub0s3ghckznjdkshgcw7",
|
|
281
|
-
"model": "api::page.page",
|
|
282
|
-
"slug": "noticias",
|
|
316
|
+
"id": 69,
|
|
317
|
+
"documentId": "un6hqh6smm657hwf0n06xm72",
|
|
318
|
+
"slug": "",
|
|
283
319
|
"locale": "pt",
|
|
320
|
+
"updatedAt": "2025-04-14T22:19:21.283Z",
|
|
284
321
|
"attributes": {
|
|
285
322
|
"template": "default",
|
|
286
|
-
"priority": "
|
|
323
|
+
"priority": "0.5",
|
|
287
324
|
"frequency": "weekly"
|
|
288
|
-
}
|
|
325
|
+
},
|
|
326
|
+
"localizations": [
|
|
327
|
+
{
|
|
328
|
+
"id": 74,
|
|
329
|
+
"documentId": "un6hqh6smm657hwf0n06xm72",
|
|
330
|
+
"slug": "en",
|
|
331
|
+
"locale": "en",
|
|
332
|
+
"updatedAt": "2025-04-14T23:45:50.237Z",
|
|
333
|
+
"attributes": {
|
|
334
|
+
"template": "default",
|
|
335
|
+
"priority": "0.5",
|
|
336
|
+
"frequency": "weekly"
|
|
337
|
+
}
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
"id": 76,
|
|
341
|
+
"documentId": "un6hqh6smm657hwf0n06xm72",
|
|
342
|
+
"slug": "en-eu",
|
|
343
|
+
"locale": "en-EU",
|
|
344
|
+
"updatedAt": "2025-04-15T10:49:51.275Z",
|
|
345
|
+
"attributes": {
|
|
346
|
+
"template": "default",
|
|
347
|
+
"priority": "0.5",
|
|
348
|
+
"frequency": "weekly"
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
]
|
|
289
352
|
},
|
|
290
353
|
{
|
|
291
|
-
"id":
|
|
292
|
-
"
|
|
293
|
-
"slug": "
|
|
294
|
-
"locale": "
|
|
354
|
+
"id": 59,
|
|
355
|
+
"documentId": "wgobkq9xr8bxtdwz4bcjx69y",
|
|
356
|
+
"slug": "noticias/littlebox-suite-ajudou-me-a-construir-sites-mais-rapido",
|
|
357
|
+
"locale": "pt",
|
|
358
|
+
"updatedAt": "2025-04-13T23:58:16.975Z",
|
|
295
359
|
"attributes": {
|
|
296
360
|
"template": "default",
|
|
297
|
-
"priority": "
|
|
298
|
-
"frequency": "
|
|
361
|
+
"priority": "0.5",
|
|
362
|
+
"frequency": "weekly",
|
|
299
363
|
"parent": {
|
|
300
|
-
"id": "
|
|
364
|
+
"id": "p49dnxpwf5lcvd56dym1895d",
|
|
301
365
|
"model": "api::page.page"
|
|
302
366
|
}
|
|
303
|
-
}
|
|
367
|
+
},
|
|
368
|
+
"localizations": [
|
|
369
|
+
{
|
|
370
|
+
"id": 54,
|
|
371
|
+
"documentId": "wgobkq9xr8bxtdwz4bcjx69y",
|
|
372
|
+
"slug": "en/news/littlebox-suite-helped-me-build-websites-faster",
|
|
373
|
+
"locale": "en",
|
|
374
|
+
"updatedAt": "2025-04-13T23:11:36.047Z",
|
|
375
|
+
"attributes": {
|
|
376
|
+
"template": "default",
|
|
377
|
+
"priority": "0.5",
|
|
378
|
+
"frequency": "weekly",
|
|
379
|
+
"parent": {
|
|
380
|
+
"id": "p49dnxpwf5lcvd56dym1895d",
|
|
381
|
+
"model": "api::page.page"
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
"id": 65,
|
|
387
|
+
"documentId": "wgobkq9xr8bxtdwz4bcjx69y",
|
|
388
|
+
"slug": "en-eu/news/littlebox-suite-helped-me-build-websites-faster",
|
|
389
|
+
"locale": "en-EU",
|
|
390
|
+
"updatedAt": "2025-04-14T01:15:31.193Z",
|
|
391
|
+
"attributes": {
|
|
392
|
+
"template": "default",
|
|
393
|
+
"priority": "0.9",
|
|
394
|
+
"frequency": "weekly",
|
|
395
|
+
"parent": {
|
|
396
|
+
"id": "p49dnxpwf5lcvd56dym1895d",
|
|
397
|
+
"model": "api::page.page"
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
]
|
|
304
402
|
},
|
|
305
403
|
{
|
|
306
|
-
"id":
|
|
307
|
-
"
|
|
308
|
-
"slug": "
|
|
404
|
+
"id": 68,
|
|
405
|
+
"documentId": "p49dnxpwf5lcvd56dym1895d",
|
|
406
|
+
"slug": "noticias",
|
|
309
407
|
"locale": "pt",
|
|
408
|
+
"updatedAt": "2025-04-14T20:10:06.388Z",
|
|
310
409
|
"attributes": {
|
|
311
410
|
"template": "default",
|
|
312
|
-
"priority": "
|
|
313
|
-
"frequency": "
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
411
|
+
"priority": "0.5",
|
|
412
|
+
"frequency": "weekly"
|
|
413
|
+
},
|
|
414
|
+
"localizations": [
|
|
415
|
+
{
|
|
416
|
+
"id": 52,
|
|
417
|
+
"documentId": "p49dnxpwf5lcvd56dym1895d",
|
|
418
|
+
"slug": "en/news",
|
|
419
|
+
"locale": "en",
|
|
420
|
+
"updatedAt": "2025-04-13T23:11:21.477Z",
|
|
421
|
+
"attributes": {
|
|
422
|
+
"template": "default",
|
|
423
|
+
"priority": "0.5",
|
|
424
|
+
"frequency": "weekly"
|
|
425
|
+
}
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
"id": 63,
|
|
429
|
+
"documentId": "p49dnxpwf5lcvd56dym1895d",
|
|
430
|
+
"slug": "en-eu/news",
|
|
431
|
+
"locale": "en-EU",
|
|
432
|
+
"updatedAt": "2025-04-14T01:15:01.792Z",
|
|
433
|
+
"attributes": {
|
|
434
|
+
"template": "default",
|
|
435
|
+
"priority": "0.9",
|
|
436
|
+
"frequency": "daily"
|
|
437
|
+
}
|
|
317
438
|
}
|
|
318
|
-
|
|
439
|
+
]
|
|
319
440
|
}
|
|
320
441
|
]
|
|
321
442
|
```
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useNavigate, useParams, Routes, Route } from "react-router-dom";
|
|
3
3
|
import React__default, { useState, useEffect, createContext, useContext, Fragment as Fragment$1, useRef } from "react";
|
|
4
|
-
import { Box, Loader, Main, Typography, Button, Flex, Breadcrumbs, Crumb, CrumbLink, CardBody, CardContent, CardTitle, CardBadge, CardSubtitle, Card as Card$1, Dialog, IconButton, Toggle,
|
|
5
|
-
import { R as Registry, F as FetchSettings, g as getTranslation, c as config, a as FetchSlugs, f as fetchTemplates } from "./index-
|
|
4
|
+
import { Box, Loader, Main, Typography, Button, Flex, Breadcrumbs, Crumb, CrumbLink, CardBody, CardContent, CardTitle, CardBadge, CardSubtitle, Card as Card$1, Dialog, IconButton, Toggle, SingleSelect, SingleSelectOption, SearchForm, Searchbar, Table, Thead, Tr, Th, Checkbox, VisuallyHidden, Tbody, Td, EmptyStateLayout, TextInput, Field, Tooltip } from "@strapi/design-system";
|
|
5
|
+
import { R as Registry, F as FetchSettings, g as getTranslation, c as config, S as SLUG_LANGUAGE_STRATEGY, a as SLUG_CONTENT_STRATEGY, b as FetchSlugs, f as fetchTemplates } from "./index-DmkEUACh.mjs";
|
|
6
6
|
import { ArrowLeft, ExternalLink, WarningCircle, Cross, BulletList, Pencil, Trash, Plus, Duplicate, Drag, Check } from "@strapi/icons";
|
|
7
7
|
import { useIntl } from "react-intl";
|
|
8
8
|
import styled, { useTheme } from "styled-components";
|
|
9
9
|
import { EmptyDocuments } from "@strapi/icons/symbols";
|
|
10
|
-
import { F as FetchLocales, c as convertToSlug } from "./convertToSlug-
|
|
10
|
+
import { F as FetchLocales, c as convertToSlug } from "./convertToSlug-q9_W-VMA.mjs";
|
|
11
11
|
import { DndContext, DragOverlay, pointerWithin, rectIntersection } from "@dnd-kit/core";
|
|
12
12
|
import { useSortable, SortableContext, verticalListSortingStrategy, arrayMove } from "@dnd-kit/sortable";
|
|
13
13
|
import { restrictToVerticalAxis, restrictToParentElement } from "@dnd-kit/modifiers";
|
|
@@ -925,27 +925,60 @@ const ConfirmModal = ({ open, title, text, confirm, cancel }) => {
|
|
|
925
925
|
] }) }) })
|
|
926
926
|
] }) }) });
|
|
927
927
|
};
|
|
928
|
-
const
|
|
928
|
+
const BoxInput$7 = styled(Box)`
|
|
929
|
+
& > div {
|
|
930
|
+
width: 100%;
|
|
931
|
+
}
|
|
932
|
+
`;
|
|
933
|
+
const SlugSettingsModal = ({ open, close, defaultLocale }) => {
|
|
929
934
|
const [module, setModule] = useState(config.uuid.modules.slug);
|
|
930
935
|
const [hidden, setHidden] = useState(true);
|
|
931
|
-
const [
|
|
936
|
+
const [showDefaultLanguage, setShowDefaultLanguage] = useState(true);
|
|
937
|
+
const [selectedContent, setSelectedContent] = useState();
|
|
938
|
+
const [selectedStrategy, setSelectedStrategy] = useState(SLUG_LANGUAGE_STRATEGY);
|
|
939
|
+
const [pages, setPages] = useState([]);
|
|
940
|
+
const [saveInProgress, setSaveInProgress] = useState(false);
|
|
932
941
|
const { formatMessage } = useIntl();
|
|
933
942
|
const settings = useSettings();
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
943
|
+
function updateSetting(property, value) {
|
|
944
|
+
const updateSetting2 = new UpdateSetting();
|
|
945
|
+
updateSetting2.execute({ property, module, value });
|
|
946
|
+
}
|
|
947
|
+
function handleChangeSelectedContent(value) {
|
|
948
|
+
const page = pages.find((page2) => page2.id == value);
|
|
949
|
+
setSelectedContent(page);
|
|
950
|
+
}
|
|
951
|
+
function save() {
|
|
952
|
+
updateSetting("showDefaultLanguage", showDefaultLanguage);
|
|
953
|
+
updateSetting("homepageContentId", selectedContent?.contentId);
|
|
954
|
+
updateSetting("homepageContentModel", selectedContent?.contentModel);
|
|
955
|
+
updateSetting("homepageSlugStrategy", selectedStrategy);
|
|
956
|
+
close();
|
|
957
|
+
}
|
|
958
|
+
async function fetchSlugs() {
|
|
959
|
+
const fetchSlugs2 = new FetchSlugs();
|
|
960
|
+
const outputFetchSlugs = await fetchSlugs2.execute({ locale: defaultLocale.code });
|
|
961
|
+
setPages(outputFetchSlugs);
|
|
942
962
|
}
|
|
963
|
+
useEffect(() => {
|
|
964
|
+
if (defaultLocale) {
|
|
965
|
+
fetchSlugs();
|
|
966
|
+
}
|
|
967
|
+
}, [defaultLocale]);
|
|
943
968
|
useEffect(() => {
|
|
944
969
|
setHidden(!open);
|
|
945
970
|
}, [open]);
|
|
946
971
|
useEffect(() => {
|
|
947
|
-
|
|
948
|
-
|
|
972
|
+
const currentShowDefaultLanguage = settings.provide("slug").showDefaultLanguage;
|
|
973
|
+
const currentHomepageSlugStrategy = settings.provide("slug").homepageSlugStrategy;
|
|
974
|
+
setShowDefaultLanguage(currentShowDefaultLanguage);
|
|
975
|
+
setSelectedStrategy(currentHomepageSlugStrategy);
|
|
976
|
+
}, []);
|
|
977
|
+
useEffect(() => {
|
|
978
|
+
const currentHomePage = settings.provide("slug").homepageContentId;
|
|
979
|
+
const page = pages.find((page2) => page2.contentId == currentHomePage);
|
|
980
|
+
setSelectedContent(page);
|
|
981
|
+
}, [pages]);
|
|
949
982
|
return /* @__PURE__ */ jsx(Fragment, { children: !hidden && /* @__PURE__ */ jsx(Dialog.Root, { defaultOpen: true, children: /* @__PURE__ */ jsxs(Dialog.Content, { children: [
|
|
950
983
|
/* @__PURE__ */ jsx(Dialog.Header, { style: { textAlign: "left" }, children: /* @__PURE__ */ jsxs(Flex, { style: { width: "100%", justifyContent: "space-between" }, children: [
|
|
951
984
|
/* @__PURE__ */ jsx(Typography, { variant: "omega", children: formatMessage({
|
|
@@ -955,20 +988,140 @@ const SlugSettingsModal = ({ open, close }) => {
|
|
|
955
988
|
/* @__PURE__ */ jsx(IconButton, { variant: "tertiary", onClick: close, label: "Close", borderWidth: 0, children: /* @__PURE__ */ jsx(Cross, {}) })
|
|
956
989
|
] }) }),
|
|
957
990
|
/* @__PURE__ */ jsx(Dialog.Body, { children: /* @__PURE__ */ jsxs(Box, { style: { display: "flex", flexDirection: "column", width: "100%" }, children: [
|
|
958
|
-
/* @__PURE__ */ jsx(
|
|
991
|
+
/* @__PURE__ */ jsx(Typography, { variant: "sigma", style: { paddingBottom: "5px" }, children: formatMessage({
|
|
959
992
|
id: getTranslation(
|
|
960
993
|
`module.${module}.modal.settings.input.default-language.title`
|
|
961
994
|
),
|
|
962
995
|
defaultMessage: "Show language slug"
|
|
963
|
-
}) })
|
|
964
|
-
/* @__PURE__ */ jsx(
|
|
996
|
+
}) }),
|
|
997
|
+
/* @__PURE__ */ jsx(
|
|
998
|
+
Typography,
|
|
999
|
+
{
|
|
1000
|
+
variant: "pi",
|
|
1001
|
+
style: { paddingBottom: "5px", color: "#a5a5ba", display: "flex" },
|
|
1002
|
+
children: formatMessage({
|
|
1003
|
+
id: getTranslation(
|
|
1004
|
+
`module.${module}.modal.settings.input.default-language.description`
|
|
1005
|
+
),
|
|
1006
|
+
defaultMessage: "Show language slug for default language in site url"
|
|
1007
|
+
})
|
|
1008
|
+
}
|
|
1009
|
+
),
|
|
1010
|
+
/* @__PURE__ */ jsx(
|
|
1011
|
+
Toggle,
|
|
1012
|
+
{
|
|
1013
|
+
onLabel: "True",
|
|
1014
|
+
offLabel: "False",
|
|
1015
|
+
checked: showDefaultLanguage,
|
|
1016
|
+
onChange: (e) => setShowDefaultLanguage(e.target.checked)
|
|
1017
|
+
}
|
|
1018
|
+
),
|
|
1019
|
+
/* @__PURE__ */ jsx(Typography, { variant: "sigma", style: { paddingBottom: "5px", paddingTop: "24px" }, children: formatMessage({
|
|
1020
|
+
id: getTranslation(`module.${module}.modal.settings.input.homepage.title`),
|
|
1021
|
+
defaultMessage: "Home page"
|
|
1022
|
+
}) }),
|
|
1023
|
+
/* @__PURE__ */ jsx(
|
|
1024
|
+
Typography,
|
|
1025
|
+
{
|
|
1026
|
+
variant: "pi",
|
|
1027
|
+
style: { paddingBottom: "5px", color: "#a5a5ba", display: "flex" },
|
|
1028
|
+
children: formatMessage({
|
|
1029
|
+
id: getTranslation(
|
|
1030
|
+
`module.${module}.modal.settings.input.homepage.description`
|
|
1031
|
+
),
|
|
1032
|
+
defaultMessage: "The content that will be rendered as the homepage"
|
|
1033
|
+
})
|
|
1034
|
+
}
|
|
1035
|
+
),
|
|
1036
|
+
/* @__PURE__ */ jsx(BoxInput$7, { style: { flex: 1, display: "flex", width: "100%" }, children: /* @__PURE__ */ jsx(
|
|
1037
|
+
SingleSelect,
|
|
1038
|
+
{
|
|
1039
|
+
onChange: (value) => handleChangeSelectedContent(value),
|
|
1040
|
+
value: selectedContent?.id,
|
|
1041
|
+
children: pages.map((page, index) => /* @__PURE__ */ jsx(SingleSelectOption, { value: page.id, children: page.contentTitle }, index))
|
|
1042
|
+
}
|
|
1043
|
+
) }),
|
|
1044
|
+
/* @__PURE__ */ jsx(Typography, { variant: "sigma", style: { paddingBottom: "5px", paddingTop: "24px" }, children: formatMessage({
|
|
965
1045
|
id: getTranslation(
|
|
966
|
-
`module.${module}.modal.settings.input.
|
|
1046
|
+
`module.${module}.modal.settings.input.homepage-strategy.title`
|
|
967
1047
|
),
|
|
968
|
-
defaultMessage: "
|
|
969
|
-
}) })
|
|
970
|
-
/* @__PURE__ */ jsx(
|
|
971
|
-
|
|
1048
|
+
defaultMessage: "Home page slug strategy"
|
|
1049
|
+
}) }),
|
|
1050
|
+
/* @__PURE__ */ jsx(BoxInput$7, { style: { flex: 1, display: "flex", width: "100%" }, children: /* @__PURE__ */ jsxs(
|
|
1051
|
+
SingleSelect,
|
|
1052
|
+
{
|
|
1053
|
+
onChange: (value) => setSelectedStrategy(value),
|
|
1054
|
+
value: selectedStrategy,
|
|
1055
|
+
children: [
|
|
1056
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: SLUG_LANGUAGE_STRATEGY, children: "Language" }),
|
|
1057
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: SLUG_CONTENT_STRATEGY, children: "Content" })
|
|
1058
|
+
]
|
|
1059
|
+
}
|
|
1060
|
+
) }),
|
|
1061
|
+
/* @__PURE__ */ jsxs(
|
|
1062
|
+
Card$1,
|
|
1063
|
+
{
|
|
1064
|
+
shadow: false,
|
|
1065
|
+
style: {
|
|
1066
|
+
marginTop: "10px",
|
|
1067
|
+
padding: "10px",
|
|
1068
|
+
display: "flex",
|
|
1069
|
+
alignItems: "center"
|
|
1070
|
+
},
|
|
1071
|
+
children: [
|
|
1072
|
+
/* @__PURE__ */ jsx(
|
|
1073
|
+
"svg",
|
|
1074
|
+
{
|
|
1075
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1076
|
+
width: "24",
|
|
1077
|
+
fill: "none",
|
|
1078
|
+
viewBox: "0 0 24 24",
|
|
1079
|
+
children: /* @__PURE__ */ jsx(
|
|
1080
|
+
"path",
|
|
1081
|
+
{
|
|
1082
|
+
fill: "#7b79ff",
|
|
1083
|
+
d: "M12 0C5.383 0 0 5.383 0 12s5.383 12 12 12 12-5.383 12-12S18.617 0 12 0Zm1.154 18.456h-2.308V16.15h2.308v2.307Zm-.23-3.687h-1.847l-.346-9.23h2.538l-.346 9.23Z"
|
|
1084
|
+
}
|
|
1085
|
+
)
|
|
1086
|
+
}
|
|
1087
|
+
),
|
|
1088
|
+
selectedStrategy === SLUG_LANGUAGE_STRATEGY && /* @__PURE__ */ jsx(
|
|
1089
|
+
Typography,
|
|
1090
|
+
{
|
|
1091
|
+
variant: "pi",
|
|
1092
|
+
style: { color: "#a5a5ba", display: "flex", marginLeft: "10px" },
|
|
1093
|
+
children: formatMessage({
|
|
1094
|
+
id: getTranslation(
|
|
1095
|
+
`module.${module}.modal.settings.input.homepage-strategy.description.language`
|
|
1096
|
+
),
|
|
1097
|
+
defaultMessage: "Use the language slug and ignore the content slug set as the homepage"
|
|
1098
|
+
})
|
|
1099
|
+
}
|
|
1100
|
+
),
|
|
1101
|
+
selectedStrategy === SLUG_CONTENT_STRATEGY && /* @__PURE__ */ jsx(
|
|
1102
|
+
Typography,
|
|
1103
|
+
{
|
|
1104
|
+
variant: "pi",
|
|
1105
|
+
style: { color: "#a5a5ba", display: "flex", marginLeft: "10px" },
|
|
1106
|
+
children: formatMessage({
|
|
1107
|
+
id: getTranslation(
|
|
1108
|
+
`module.${module}.modal.settings.input.homepage-strategy.description.content`
|
|
1109
|
+
),
|
|
1110
|
+
defaultMessage: "Use the slug of the content set as the homepage"
|
|
1111
|
+
})
|
|
1112
|
+
}
|
|
1113
|
+
)
|
|
1114
|
+
]
|
|
1115
|
+
}
|
|
1116
|
+
)
|
|
1117
|
+
] }) }),
|
|
1118
|
+
/* @__PURE__ */ jsxs(Dialog.Footer, { style: { justifyContent: "end" }, children: [
|
|
1119
|
+
saveInProgress && /* @__PURE__ */ jsx(Loader, { small: true }),
|
|
1120
|
+
/* @__PURE__ */ jsx(Button, { style: { marginRight: "5px" }, onClick: save, disabled: saveInProgress, children: formatMessage({
|
|
1121
|
+
id: getTranslation(`module.${module}.modal.settings.button.save`),
|
|
1122
|
+
defaultMessage: "Save"
|
|
1123
|
+
}) })
|
|
1124
|
+
] })
|
|
972
1125
|
] }) }) });
|
|
973
1126
|
};
|
|
974
1127
|
const SlugSettingsPage = () => {
|
|
@@ -977,11 +1130,13 @@ const SlugSettingsPage = () => {
|
|
|
977
1130
|
const [filteredRecords, setFilteredRecords] = useState([]);
|
|
978
1131
|
const [i18nLocales, setI18nLocales] = useState([]);
|
|
979
1132
|
const [currentI18nLocale, setCurrentI18nLocale] = useState();
|
|
1133
|
+
const [defaultLocale, setDefaultLocale] = useState();
|
|
980
1134
|
const [fetchInProgress, setFetchInProgress] = useState(true);
|
|
981
1135
|
const [showConfirmModal, setShowConfirmModal] = useState(false);
|
|
982
1136
|
const [showSettingsModal, setShowSettingsModal] = useState(false);
|
|
983
1137
|
const [selectedRecords, setSelectedRecords] = useState([]);
|
|
984
1138
|
const [searchTerm, setSearchTerm] = useState("");
|
|
1139
|
+
const [currentHomePage, setCurrentHomePage] = useState();
|
|
985
1140
|
const { formatMessage } = useIntl();
|
|
986
1141
|
const settings = useSettings();
|
|
987
1142
|
async function toggleState(value) {
|
|
@@ -1002,7 +1157,9 @@ const SlugSettingsPage = () => {
|
|
|
1002
1157
|
async function fetchLocales() {
|
|
1003
1158
|
const fetchLocales2 = new FetchLocales();
|
|
1004
1159
|
const fetchLocalesOutput = await fetchLocales2.execute();
|
|
1160
|
+
const defaultLocale2 = fetchLocalesOutput.find((locale) => locale.isDefault);
|
|
1005
1161
|
setI18nLocales(fetchLocalesOutput);
|
|
1162
|
+
setDefaultLocale(defaultLocale2);
|
|
1006
1163
|
}
|
|
1007
1164
|
async function fetchRecords() {
|
|
1008
1165
|
setFetchInProgress(true);
|
|
@@ -1046,6 +1203,10 @@ const SlugSettingsPage = () => {
|
|
|
1046
1203
|
const parent = records.find((record) => record.contentId === parentId);
|
|
1047
1204
|
return parent?.contentTitle;
|
|
1048
1205
|
}
|
|
1206
|
+
function getCurrentHomePage() {
|
|
1207
|
+
const currentHomePage2 = settings.provide("slug").homepageContentId;
|
|
1208
|
+
setCurrentHomePage(currentHomePage2);
|
|
1209
|
+
}
|
|
1049
1210
|
useEffect(() => {
|
|
1050
1211
|
const timer = setTimeout(() => {
|
|
1051
1212
|
if (records.length > 0) {
|
|
@@ -1066,6 +1227,9 @@ const SlugSettingsPage = () => {
|
|
|
1066
1227
|
fetchRecords();
|
|
1067
1228
|
}
|
|
1068
1229
|
}, [currentI18nLocale]);
|
|
1230
|
+
useEffect(() => {
|
|
1231
|
+
getCurrentHomePage();
|
|
1232
|
+
}, [settings]);
|
|
1069
1233
|
useEffect(() => {
|
|
1070
1234
|
fetchLocales();
|
|
1071
1235
|
}, []);
|
|
@@ -1185,7 +1349,25 @@ const SlugSettingsPage = () => {
|
|
|
1185
1349
|
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: entry.id }) }),
|
|
1186
1350
|
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: entry.locale }) }),
|
|
1187
1351
|
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: entry.slug }) }),
|
|
1188
|
-
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */
|
|
1352
|
+
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsxs(Box, { style: { display: "flex", alignItems: "center" }, children: [
|
|
1353
|
+
entry.contentId === currentHomePage && /* @__PURE__ */ jsx(
|
|
1354
|
+
Box,
|
|
1355
|
+
{
|
|
1356
|
+
style: {
|
|
1357
|
+
display: "flex",
|
|
1358
|
+
alignItems: "center",
|
|
1359
|
+
justifyContent: "center",
|
|
1360
|
+
backgroundColor: "#7b79ff",
|
|
1361
|
+
color: "#fff",
|
|
1362
|
+
borderRadius: "4px",
|
|
1363
|
+
padding: "3px 8px",
|
|
1364
|
+
marginRight: "10px"
|
|
1365
|
+
},
|
|
1366
|
+
children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: "Homepage" })
|
|
1367
|
+
}
|
|
1368
|
+
),
|
|
1369
|
+
/* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: entry.contentTitle })
|
|
1370
|
+
] }) }),
|
|
1189
1371
|
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsxs(Typography, { textColor: "neutral800", children: [
|
|
1190
1372
|
!entry.parentContentId && /* @__PURE__ */ jsx(Fragment, { children: "--" }),
|
|
1191
1373
|
entry.parentContentId && /* @__PURE__ */ jsx(
|
|
@@ -1283,7 +1465,14 @@ const SlugSettingsPage = () => {
|
|
|
1283
1465
|
}
|
|
1284
1466
|
}
|
|
1285
1467
|
),
|
|
1286
|
-
/* @__PURE__ */ jsx(
|
|
1468
|
+
/* @__PURE__ */ jsx(
|
|
1469
|
+
SlugSettingsModal,
|
|
1470
|
+
{
|
|
1471
|
+
defaultLocale,
|
|
1472
|
+
open: showSettingsModal,
|
|
1473
|
+
close: () => setShowSettingsModal(false)
|
|
1474
|
+
}
|
|
1475
|
+
)
|
|
1287
1476
|
]
|
|
1288
1477
|
}
|
|
1289
1478
|
);
|
|
@@ -2682,8 +2871,6 @@ function MenuEditItem(props) {
|
|
|
2682
2871
|
setContents(outputFetchSlugs);
|
|
2683
2872
|
}
|
|
2684
2873
|
function dispatchOnChangeEvent(form2) {
|
|
2685
|
-
console.log("dispatchOnChangeEvent:");
|
|
2686
|
-
console.log(form2);
|
|
2687
2874
|
if (!form2 || form2 && isEmpty(form2.title) || form2 && isEmpty(form2.target) || form2 && isEmpty(form2.url) && isEmpty(form2.contentId)) {
|
|
2688
2875
|
props.onCheckEvent(false);
|
|
2689
2876
|
} else {
|