@littlebox/strapi-suite 1.0.34 → 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 +149 -33
- package/dist/_chunks/{App-DyjWjB7j.mjs → App-2SwRpCFC.mjs} +111 -22
- package/dist/_chunks/{App-BHSmVWtI.js → App-DBXgA-D1.js} +111 -22
- package/dist/_chunks/{SlugInput-Blvf1j9x.mjs → SlugInput-BcUe-oCY.mjs} +2 -2
- package/dist/_chunks/{SlugInput-6ZNFcvBl.js → SlugInput-CVnNz0al.js} +2 -2
- package/dist/_chunks/{convertToSlug-CTdv5t0Z.js → convertToSlug-Btfca6aI.js} +1 -1
- package/dist/_chunks/{convertToSlug-Cc3NGUTL.mjs → convertToSlug-q9_W-VMA.mjs} +1 -1
- package/dist/_chunks/{en-B02DK8eB.js → en-CGJcJfk1.js} +3 -0
- package/dist/_chunks/{en-Gbpe0cex.mjs → en-CRSiVe4w.mjs} +3 -0
- package/dist/_chunks/{index-JYGAi1yZ.mjs → index-DmkEUACh.mjs} +10 -6
- package/dist/_chunks/{index-DXJ64IZL.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/core/config.d.ts +2 -0
- package/dist/server/index.js +102 -35
- package/dist/server/index.mjs +102 -35
- package/dist/server/src/config/index.d.ts +2 -0
- package/dist/server/src/index.d.ts +1 -7
- package/dist/server/src/services/index.d.ts +1 -7
- package/dist/server/src/services/modules/slug.d.ts +1 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -204,6 +204,48 @@ Using the slug module settings (as shown in the screenshot above), you can choos
|
|
|
204
204
|
```
|
|
205
205
|
GET /api/littlebox-strapi-suite/modules/pages/home?properties=attributes
|
|
206
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
|
+
```
|
|
207
249
|
|
|
208
250
|
|
|
209
251
|
|
|
@@ -271,56 +313,130 @@ GET /api/littlebox-strapi-suite/modules/pages?properties=attributes
|
|
|
271
313
|
```
|
|
272
314
|
[
|
|
273
315
|
{
|
|
274
|
-
"id":
|
|
275
|
-
"
|
|
276
|
-
"slug": "
|
|
277
|
-
"locale": "en",
|
|
278
|
-
"attributes": {
|
|
279
|
-
"template": "default",
|
|
280
|
-
"priority": "1.0",
|
|
281
|
-
"frequency": "weekly"
|
|
282
|
-
}
|
|
283
|
-
},
|
|
284
|
-
{
|
|
285
|
-
"id": "wnzxub0s3ghckznjdkshgcw7",
|
|
286
|
-
"model": "api::page.page",
|
|
287
|
-
"slug": "noticias",
|
|
316
|
+
"id": 69,
|
|
317
|
+
"documentId": "un6hqh6smm657hwf0n06xm72",
|
|
318
|
+
"slug": "",
|
|
288
319
|
"locale": "pt",
|
|
320
|
+
"updatedAt": "2025-04-14T22:19:21.283Z",
|
|
289
321
|
"attributes": {
|
|
290
322
|
"template": "default",
|
|
291
|
-
"priority": "
|
|
323
|
+
"priority": "0.5",
|
|
292
324
|
"frequency": "weekly"
|
|
293
|
-
}
|
|
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
|
+
]
|
|
294
352
|
},
|
|
295
353
|
{
|
|
296
|
-
"id":
|
|
297
|
-
"
|
|
298
|
-
"slug": "
|
|
299
|
-
"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",
|
|
300
359
|
"attributes": {
|
|
301
360
|
"template": "default",
|
|
302
|
-
"priority": "
|
|
303
|
-
"frequency": "
|
|
361
|
+
"priority": "0.5",
|
|
362
|
+
"frequency": "weekly",
|
|
304
363
|
"parent": {
|
|
305
|
-
"id": "
|
|
364
|
+
"id": "p49dnxpwf5lcvd56dym1895d",
|
|
306
365
|
"model": "api::page.page"
|
|
307
366
|
}
|
|
308
|
-
}
|
|
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
|
+
]
|
|
309
402
|
},
|
|
310
403
|
{
|
|
311
|
-
"id":
|
|
312
|
-
"
|
|
313
|
-
"slug": "
|
|
404
|
+
"id": 68,
|
|
405
|
+
"documentId": "p49dnxpwf5lcvd56dym1895d",
|
|
406
|
+
"slug": "noticias",
|
|
314
407
|
"locale": "pt",
|
|
408
|
+
"updatedAt": "2025-04-14T20:10:06.388Z",
|
|
315
409
|
"attributes": {
|
|
316
410
|
"template": "default",
|
|
317
|
-
"priority": "
|
|
318
|
-
"frequency": "
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
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
|
+
}
|
|
322
438
|
}
|
|
323
|
-
|
|
439
|
+
]
|
|
324
440
|
}
|
|
325
441
|
]
|
|
326
442
|
```
|
|
@@ -2,12 +2,12 @@ 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
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, a as FetchSlugs, f as fetchTemplates } from "./index-
|
|
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";
|
|
@@ -935,6 +935,7 @@ const SlugSettingsModal = ({ open, close, defaultLocale }) => {
|
|
|
935
935
|
const [hidden, setHidden] = useState(true);
|
|
936
936
|
const [showDefaultLanguage, setShowDefaultLanguage] = useState(true);
|
|
937
937
|
const [selectedContent, setSelectedContent] = useState();
|
|
938
|
+
const [selectedStrategy, setSelectedStrategy] = useState(SLUG_LANGUAGE_STRATEGY);
|
|
938
939
|
const [pages, setPages] = useState([]);
|
|
939
940
|
const [saveInProgress, setSaveInProgress] = useState(false);
|
|
940
941
|
const { formatMessage } = useIntl();
|
|
@@ -951,6 +952,7 @@ const SlugSettingsModal = ({ open, close, defaultLocale }) => {
|
|
|
951
952
|
updateSetting("showDefaultLanguage", showDefaultLanguage);
|
|
952
953
|
updateSetting("homepageContentId", selectedContent?.contentId);
|
|
953
954
|
updateSetting("homepageContentModel", selectedContent?.contentModel);
|
|
955
|
+
updateSetting("homepageSlugStrategy", selectedStrategy);
|
|
954
956
|
close();
|
|
955
957
|
}
|
|
956
958
|
async function fetchSlugs() {
|
|
@@ -968,7 +970,9 @@ const SlugSettingsModal = ({ open, close, defaultLocale }) => {
|
|
|
968
970
|
}, [open]);
|
|
969
971
|
useEffect(() => {
|
|
970
972
|
const currentShowDefaultLanguage = settings.provide("slug").showDefaultLanguage;
|
|
973
|
+
const currentHomepageSlugStrategy = settings.provide("slug").homepageSlugStrategy;
|
|
971
974
|
setShowDefaultLanguage(currentShowDefaultLanguage);
|
|
975
|
+
setSelectedStrategy(currentHomepageSlugStrategy);
|
|
972
976
|
}, []);
|
|
973
977
|
useEffect(() => {
|
|
974
978
|
const currentHomePage = settings.provide("slug").homepageContentId;
|
|
@@ -984,18 +988,25 @@ const SlugSettingsModal = ({ open, close, defaultLocale }) => {
|
|
|
984
988
|
/* @__PURE__ */ jsx(IconButton, { variant: "tertiary", onClick: close, label: "Close", borderWidth: 0, children: /* @__PURE__ */ jsx(Cross, {}) })
|
|
985
989
|
] }) }),
|
|
986
990
|
/* @__PURE__ */ jsx(Dialog.Body, { children: /* @__PURE__ */ jsxs(Box, { style: { display: "flex", flexDirection: "column", width: "100%" }, children: [
|
|
987
|
-
/* @__PURE__ */ jsx(
|
|
991
|
+
/* @__PURE__ */ jsx(Typography, { variant: "sigma", style: { paddingBottom: "5px" }, children: formatMessage({
|
|
988
992
|
id: getTranslation(
|
|
989
993
|
`module.${module}.modal.settings.input.default-language.title`
|
|
990
994
|
),
|
|
991
995
|
defaultMessage: "Show language slug"
|
|
992
|
-
}) })
|
|
993
|
-
/* @__PURE__ */ jsx(
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
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
|
+
),
|
|
999
1010
|
/* @__PURE__ */ jsx(
|
|
1000
1011
|
Toggle,
|
|
1001
1012
|
{
|
|
@@ -1005,24 +1016,104 @@ const SlugSettingsModal = ({ open, close, defaultLocale }) => {
|
|
|
1005
1016
|
onChange: (e) => setShowDefaultLanguage(e.target.checked)
|
|
1006
1017
|
}
|
|
1007
1018
|
),
|
|
1008
|
-
/* @__PURE__ */ jsx("
|
|
1019
|
+
/* @__PURE__ */ jsx(Typography, { variant: "sigma", style: { paddingBottom: "5px", paddingTop: "24px" }, children: formatMessage({
|
|
1009
1020
|
id: getTranslation(`module.${module}.modal.settings.input.homepage.title`),
|
|
1010
1021
|
defaultMessage: "Home page"
|
|
1011
|
-
}) })
|
|
1012
|
-
/* @__PURE__ */ jsx(
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
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(
|
|
1019
1037
|
SingleSelect,
|
|
1020
1038
|
{
|
|
1021
1039
|
onChange: (value) => handleChangeSelectedContent(value),
|
|
1022
1040
|
value: selectedContent?.id,
|
|
1023
1041
|
children: pages.map((page, index) => /* @__PURE__ */ jsx(SingleSelectOption, { value: page.id, children: page.contentTitle }, index))
|
|
1024
1042
|
}
|
|
1025
|
-
) })
|
|
1043
|
+
) }),
|
|
1044
|
+
/* @__PURE__ */ jsx(Typography, { variant: "sigma", style: { paddingBottom: "5px", paddingTop: "24px" }, children: formatMessage({
|
|
1045
|
+
id: getTranslation(
|
|
1046
|
+
`module.${module}.modal.settings.input.homepage-strategy.title`
|
|
1047
|
+
),
|
|
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
|
+
)
|
|
1026
1117
|
] }) }),
|
|
1027
1118
|
/* @__PURE__ */ jsxs(Dialog.Footer, { style: { justifyContent: "end" }, children: [
|
|
1028
1119
|
saveInProgress && /* @__PURE__ */ jsx(Loader, { small: true }),
|
|
@@ -2780,8 +2871,6 @@ function MenuEditItem(props) {
|
|
|
2780
2871
|
setContents(outputFetchSlugs);
|
|
2781
2872
|
}
|
|
2782
2873
|
function dispatchOnChangeEvent(form2) {
|
|
2783
|
-
console.log("dispatchOnChangeEvent:");
|
|
2784
|
-
console.log(form2);
|
|
2785
2874
|
if (!form2 || form2 && isEmpty(form2.title) || form2 && isEmpty(form2.target) || form2 && isEmpty(form2.url) && isEmpty(form2.contentId)) {
|
|
2786
2875
|
props.onCheckEvent(false);
|
|
2787
2876
|
} else {
|
|
@@ -4,12 +4,12 @@ const jsxRuntime = require("react/jsx-runtime");
|
|
|
4
4
|
const reactRouterDom = require("react-router-dom");
|
|
5
5
|
const React = require("react");
|
|
6
6
|
const designSystem = require("@strapi/design-system");
|
|
7
|
-
const index = require("./index-
|
|
7
|
+
const index = require("./index-Pylfg-hk.js");
|
|
8
8
|
const icons = require("@strapi/icons");
|
|
9
9
|
const reactIntl = require("react-intl");
|
|
10
10
|
const styled = require("styled-components");
|
|
11
11
|
const symbols = require("@strapi/icons/symbols");
|
|
12
|
-
const convertToSlug = require("./convertToSlug-
|
|
12
|
+
const convertToSlug = require("./convertToSlug-Btfca6aI.js");
|
|
13
13
|
const core = require("@dnd-kit/core");
|
|
14
14
|
const sortable = require("@dnd-kit/sortable");
|
|
15
15
|
const modifiers = require("@dnd-kit/modifiers");
|
|
@@ -940,6 +940,7 @@ const SlugSettingsModal = ({ open, close, defaultLocale }) => {
|
|
|
940
940
|
const [hidden, setHidden] = React.useState(true);
|
|
941
941
|
const [showDefaultLanguage, setShowDefaultLanguage] = React.useState(true);
|
|
942
942
|
const [selectedContent, setSelectedContent] = React.useState();
|
|
943
|
+
const [selectedStrategy, setSelectedStrategy] = React.useState(index.SLUG_LANGUAGE_STRATEGY);
|
|
943
944
|
const [pages, setPages] = React.useState([]);
|
|
944
945
|
const [saveInProgress, setSaveInProgress] = React.useState(false);
|
|
945
946
|
const { formatMessage } = reactIntl.useIntl();
|
|
@@ -956,6 +957,7 @@ const SlugSettingsModal = ({ open, close, defaultLocale }) => {
|
|
|
956
957
|
updateSetting("showDefaultLanguage", showDefaultLanguage);
|
|
957
958
|
updateSetting("homepageContentId", selectedContent?.contentId);
|
|
958
959
|
updateSetting("homepageContentModel", selectedContent?.contentModel);
|
|
960
|
+
updateSetting("homepageSlugStrategy", selectedStrategy);
|
|
959
961
|
close();
|
|
960
962
|
}
|
|
961
963
|
async function fetchSlugs() {
|
|
@@ -973,7 +975,9 @@ const SlugSettingsModal = ({ open, close, defaultLocale }) => {
|
|
|
973
975
|
}, [open]);
|
|
974
976
|
React.useEffect(() => {
|
|
975
977
|
const currentShowDefaultLanguage = settings.provide("slug").showDefaultLanguage;
|
|
978
|
+
const currentHomepageSlugStrategy = settings.provide("slug").homepageSlugStrategy;
|
|
976
979
|
setShowDefaultLanguage(currentShowDefaultLanguage);
|
|
980
|
+
setSelectedStrategy(currentHomepageSlugStrategy);
|
|
977
981
|
}, []);
|
|
978
982
|
React.useEffect(() => {
|
|
979
983
|
const currentHomePage = settings.provide("slug").homepageContentId;
|
|
@@ -989,18 +993,25 @@ const SlugSettingsModal = ({ open, close, defaultLocale }) => {
|
|
|
989
993
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.IconButton, { variant: "tertiary", onClick: close, label: "Close", borderWidth: 0, children: /* @__PURE__ */ jsxRuntime.jsx(icons.Cross, {}) })
|
|
990
994
|
] }) }),
|
|
991
995
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Body, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { display: "flex", flexDirection: "column", width: "100%" }, children: [
|
|
992
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
996
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", style: { paddingBottom: "5px" }, children: formatMessage({
|
|
993
997
|
id: index.getTranslation(
|
|
994
998
|
`module.${module2}.modal.settings.input.default-language.title`
|
|
995
999
|
),
|
|
996
1000
|
defaultMessage: "Show language slug"
|
|
997
|
-
}) })
|
|
998
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1001
|
+
}) }),
|
|
1002
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1003
|
+
designSystem.Typography,
|
|
1004
|
+
{
|
|
1005
|
+
variant: "pi",
|
|
1006
|
+
style: { paddingBottom: "5px", color: "#a5a5ba", display: "flex" },
|
|
1007
|
+
children: formatMessage({
|
|
1008
|
+
id: index.getTranslation(
|
|
1009
|
+
`module.${module2}.modal.settings.input.default-language.description`
|
|
1010
|
+
),
|
|
1011
|
+
defaultMessage: "Show language slug for default language in site url"
|
|
1012
|
+
})
|
|
1013
|
+
}
|
|
1014
|
+
),
|
|
1004
1015
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1005
1016
|
designSystem.Toggle,
|
|
1006
1017
|
{
|
|
@@ -1010,24 +1021,104 @@ const SlugSettingsModal = ({ open, close, defaultLocale }) => {
|
|
|
1010
1021
|
onChange: (e) => setShowDefaultLanguage(e.target.checked)
|
|
1011
1022
|
}
|
|
1012
1023
|
),
|
|
1013
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
1024
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", style: { paddingBottom: "5px", paddingTop: "24px" }, children: formatMessage({
|
|
1014
1025
|
id: index.getTranslation(`module.${module2}.modal.settings.input.homepage.title`),
|
|
1015
1026
|
defaultMessage: "Home page"
|
|
1016
|
-
}) })
|
|
1017
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1027
|
+
}) }),
|
|
1028
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1029
|
+
designSystem.Typography,
|
|
1030
|
+
{
|
|
1031
|
+
variant: "pi",
|
|
1032
|
+
style: { paddingBottom: "5px", color: "#a5a5ba", display: "flex" },
|
|
1033
|
+
children: formatMessage({
|
|
1034
|
+
id: index.getTranslation(
|
|
1035
|
+
`module.${module2}.modal.settings.input.homepage.description`
|
|
1036
|
+
),
|
|
1037
|
+
defaultMessage: "The content that will be rendered as the homepage"
|
|
1038
|
+
})
|
|
1039
|
+
}
|
|
1040
|
+
),
|
|
1041
|
+
/* @__PURE__ */ jsxRuntime.jsx(BoxInput$7, { style: { flex: 1, display: "flex", width: "100%" }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1024
1042
|
designSystem.SingleSelect,
|
|
1025
1043
|
{
|
|
1026
1044
|
onChange: (value) => handleChangeSelectedContent(value),
|
|
1027
1045
|
value: selectedContent?.id,
|
|
1028
1046
|
children: pages.map((page, index2) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: page.id, children: page.contentTitle }, index2))
|
|
1029
1047
|
}
|
|
1030
|
-
) })
|
|
1048
|
+
) }),
|
|
1049
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", style: { paddingBottom: "5px", paddingTop: "24px" }, children: formatMessage({
|
|
1050
|
+
id: index.getTranslation(
|
|
1051
|
+
`module.${module2}.modal.settings.input.homepage-strategy.title`
|
|
1052
|
+
),
|
|
1053
|
+
defaultMessage: "Home page slug strategy"
|
|
1054
|
+
}) }),
|
|
1055
|
+
/* @__PURE__ */ jsxRuntime.jsx(BoxInput$7, { style: { flex: 1, display: "flex", width: "100%" }, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1056
|
+
designSystem.SingleSelect,
|
|
1057
|
+
{
|
|
1058
|
+
onChange: (value) => setSelectedStrategy(value),
|
|
1059
|
+
value: selectedStrategy,
|
|
1060
|
+
children: [
|
|
1061
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: index.SLUG_LANGUAGE_STRATEGY, children: "Language" }),
|
|
1062
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: index.SLUG_CONTENT_STRATEGY, children: "Content" })
|
|
1063
|
+
]
|
|
1064
|
+
}
|
|
1065
|
+
) }),
|
|
1066
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1067
|
+
designSystem.Card,
|
|
1068
|
+
{
|
|
1069
|
+
shadow: false,
|
|
1070
|
+
style: {
|
|
1071
|
+
marginTop: "10px",
|
|
1072
|
+
padding: "10px",
|
|
1073
|
+
display: "flex",
|
|
1074
|
+
alignItems: "center"
|
|
1075
|
+
},
|
|
1076
|
+
children: [
|
|
1077
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1078
|
+
"svg",
|
|
1079
|
+
{
|
|
1080
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1081
|
+
width: "24",
|
|
1082
|
+
fill: "none",
|
|
1083
|
+
viewBox: "0 0 24 24",
|
|
1084
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1085
|
+
"path",
|
|
1086
|
+
{
|
|
1087
|
+
fill: "#7b79ff",
|
|
1088
|
+
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"
|
|
1089
|
+
}
|
|
1090
|
+
)
|
|
1091
|
+
}
|
|
1092
|
+
),
|
|
1093
|
+
selectedStrategy === index.SLUG_LANGUAGE_STRATEGY && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1094
|
+
designSystem.Typography,
|
|
1095
|
+
{
|
|
1096
|
+
variant: "pi",
|
|
1097
|
+
style: { color: "#a5a5ba", display: "flex", marginLeft: "10px" },
|
|
1098
|
+
children: formatMessage({
|
|
1099
|
+
id: index.getTranslation(
|
|
1100
|
+
`module.${module2}.modal.settings.input.homepage-strategy.description.language`
|
|
1101
|
+
),
|
|
1102
|
+
defaultMessage: "Use the language slug and ignore the content slug set as the homepage"
|
|
1103
|
+
})
|
|
1104
|
+
}
|
|
1105
|
+
),
|
|
1106
|
+
selectedStrategy === index.SLUG_CONTENT_STRATEGY && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1107
|
+
designSystem.Typography,
|
|
1108
|
+
{
|
|
1109
|
+
variant: "pi",
|
|
1110
|
+
style: { color: "#a5a5ba", display: "flex", marginLeft: "10px" },
|
|
1111
|
+
children: formatMessage({
|
|
1112
|
+
id: index.getTranslation(
|
|
1113
|
+
`module.${module2}.modal.settings.input.homepage-strategy.description.content`
|
|
1114
|
+
),
|
|
1115
|
+
defaultMessage: "Use the slug of the content set as the homepage"
|
|
1116
|
+
})
|
|
1117
|
+
}
|
|
1118
|
+
)
|
|
1119
|
+
]
|
|
1120
|
+
}
|
|
1121
|
+
)
|
|
1031
1122
|
] }) }),
|
|
1032
1123
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Footer, { style: { justifyContent: "end" }, children: [
|
|
1033
1124
|
saveInProgress && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, { small: true }),
|
|
@@ -2785,8 +2876,6 @@ function MenuEditItem(props) {
|
|
|
2785
2876
|
setContents(outputFetchSlugs);
|
|
2786
2877
|
}
|
|
2787
2878
|
function dispatchOnChangeEvent(form2) {
|
|
2788
|
-
console.log("dispatchOnChangeEvent:");
|
|
2789
|
-
console.log(form2);
|
|
2790
2879
|
if (!form2 || form2 && isEmpty(form2.title) || form2 && isEmpty(form2.target) || form2 && isEmpty(form2.url) && isEmpty(form2.contentId)) {
|
|
2791
2880
|
props.onCheckEvent(false);
|
|
2792
2881
|
} else {
|
|
@@ -6,8 +6,8 @@ import { useComposedRefs, Field, Box, Typography, TextInput, IconButton, Button
|
|
|
6
6
|
import { Pin, Cross } from "@strapi/icons";
|
|
7
7
|
import { useFocusInputField, unstable_useContentManagerContext } from "@strapi/strapi/admin";
|
|
8
8
|
import styled from "styled-components";
|
|
9
|
-
import { R as Registry, P as PageAttributeUpdated, D as DocumentCustomFieldStarted,
|
|
10
|
-
import { c as convertToSlug, F as FetchLocales } from "./convertToSlug-
|
|
9
|
+
import { R as Registry, P as PageAttributeUpdated, D as DocumentCustomFieldStarted, d as PluginIcon, g as getTranslation, c as config, e as FetchModuleSettings } from "./index-DmkEUACh.mjs";
|
|
10
|
+
import { c as convertToSlug, F as FetchLocales } from "./convertToSlug-q9_W-VMA.mjs";
|
|
11
11
|
const BoxInput = styled(Box)`
|
|
12
12
|
& > div {
|
|
13
13
|
width: 100%;
|
|
@@ -8,8 +8,8 @@ const designSystem = require("@strapi/design-system");
|
|
|
8
8
|
const icons = require("@strapi/icons");
|
|
9
9
|
const admin = require("@strapi/strapi/admin");
|
|
10
10
|
const styled = require("styled-components");
|
|
11
|
-
const index = require("./index-
|
|
12
|
-
const convertToSlug = require("./convertToSlug-
|
|
11
|
+
const index = require("./index-Pylfg-hk.js");
|
|
12
|
+
const convertToSlug = require("./convertToSlug-Btfca6aI.js");
|
|
13
13
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
14
14
|
function _interopNamespace(e) {
|
|
15
15
|
if (e && e.__esModule) return e;
|