@mattisvensson/strapi-plugin-webatlas 0.3.1 → 0.4.2

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.
Files changed (56) hide show
  1. package/dist/_chunks/{EmptyBox-7D4LrvdH.mjs → EmptyBox-BM4IscSk.mjs} +2 -6
  2. package/dist/_chunks/{EmptyBox-DT6D5gcf.js → EmptyBox-T8t29l25.js} +1 -5
  3. package/dist/_chunks/FullLoader-Cmsf8xS6.js +11 -0
  4. package/dist/_chunks/FullLoader-CrPED_dY.mjs +12 -0
  5. package/dist/_chunks/{de-C8PE3n3B.mjs → de-Dn24NwJf.mjs} +11 -1
  6. package/dist/_chunks/{de-4tL_cJTC.js → de-RiCps8UH.js} +11 -1
  7. package/dist/_chunks/{en-CR1YZvJo.mjs → en-D9Lxaugc.mjs} +11 -1
  8. package/dist/_chunks/{en-Bg4z3fR7.js → en-JLW5S3ZC.js} +11 -1
  9. package/dist/_chunks/index-9db80XRS.mjs +126 -0
  10. package/dist/_chunks/{index-CwHhwtOU.mjs → index-B4pe6Yuh.mjs} +1375 -357
  11. package/dist/_chunks/{index-CKoxbSC0.js → index-CSYue_D0.js} +42 -60
  12. package/dist/_chunks/index-CVj7qbwh.mjs +281 -0
  13. package/dist/_chunks/index-CiY-8z8F.js +126 -0
  14. package/dist/_chunks/{index-BAqGJ3TM.js → index-Clikpy91.js} +1381 -363
  15. package/dist/_chunks/{index-BBL_eQ0G.mjs → index-CtJ_9-RB.mjs} +42 -60
  16. package/dist/_chunks/index-IHvD3566.js +281 -0
  17. package/dist/admin/index.js +1 -1
  18. package/dist/admin/index.mjs +1 -1
  19. package/dist/admin/src/components/UI/FullLoader.d.ts +3 -0
  20. package/dist/admin/src/components/UI/index.d.ts +2 -1
  21. package/dist/admin/src/components/modals/Delete.d.ts +3 -3
  22. package/dist/admin/src/components/modals/NavEdit.d.ts +2 -2
  23. package/dist/admin/src/components/modals/externalItem/index.d.ts +10 -4
  24. package/dist/admin/src/components/modals/internalItem/internalItemCreate.d.ts +1 -1
  25. package/dist/admin/src/components/modals/wrapperItem/index.d.ts +11 -5
  26. package/dist/admin/src/hooks/useApi.d.ts +6 -5
  27. package/dist/admin/src/hooks/useNavigations.d.ts +2 -0
  28. package/dist/admin/src/hooks/usePluginConfig.d.ts +3 -3
  29. package/dist/admin/src/pages/Navigation/PageWrapper.d.ts +7 -0
  30. package/dist/admin/src/pages/Navigation/index.d.ts +1 -1
  31. package/dist/admin/src/pages/Routes/PageWrapper.d.ts +4 -0
  32. package/dist/admin/src/pages/Routes/TableHeader.d.ts +1 -0
  33. package/dist/admin/src/pages/Routes/TableRow.d.ts +4 -0
  34. package/dist/admin/src/pages/Settings/ContentTypeAccordion.d.ts +7 -0
  35. package/dist/admin/src/pages/Settings/PageWrapper.d.ts +8 -0
  36. package/dist/admin/src/utils/createTempNavItemObject.d.ts +25 -0
  37. package/dist/admin/src/utils/index.d.ts +2 -1
  38. package/dist/server/index.js +225 -176
  39. package/dist/server/index.mjs +225 -176
  40. package/dist/server/src/controllers/admin.d.ts +1 -4
  41. package/dist/server/src/controllers/index.d.ts +1 -4
  42. package/dist/server/src/index.d.ts +2 -8
  43. package/dist/server/src/services/admin.d.ts +2 -5
  44. package/dist/server/src/services/index.d.ts +1 -4
  45. package/dist/server/src/utils/navItemHandler.d.ts +5 -0
  46. package/dist/server/src/utils/routeHandler.d.ts +3 -0
  47. package/package.json +1 -1
  48. package/dist/_chunks/_baseConvert-B84_vf8X.js +0 -864
  49. package/dist/_chunks/_baseConvert-C2SW1VHq.mjs +0 -865
  50. package/dist/_chunks/index-BOq-WidK.mjs +0 -17176
  51. package/dist/_chunks/index-C4ou6MTp.js +0 -17195
  52. package/dist/_chunks/index-DZmhgSeq.mjs +0 -92
  53. package/dist/_chunks/index-DsTyLL2l.js +0 -92
  54. package/dist/admin/src/pages/Navigation/Header.d.ts +0 -6
  55. package/dist/server/index.js.map +0 -1
  56. package/dist/server/index.mjs.map +0 -1
@@ -1,9 +1,6 @@
1
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import { Flex, Box, Typography } from "@strapi/design-system";
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
3
2
  import { EmptyDocuments } from "@strapi/icons/symbols";
4
- function Center({ height = 400, children }) {
5
- return /* @__PURE__ */ jsx(Flex, { direction: "column", minHeight: `${height}px`, justifyContent: "center", children });
6
- }
3
+ import { Box, Typography } from "@strapi/design-system";
7
4
  function EmptyBox({ msg }) {
8
5
  return /* @__PURE__ */ jsxs(Fragment, { children: [
9
6
  /* @__PURE__ */ jsx(EmptyDocuments, { width: "10rem", height: "6rem" }),
@@ -11,6 +8,5 @@ function EmptyBox({ msg }) {
11
8
  ] });
12
9
  }
13
10
  export {
14
- Center as C,
15
11
  EmptyBox as E
16
12
  };
@@ -1,15 +1,11 @@
1
1
  "use strict";
2
2
  const jsxRuntime = require("react/jsx-runtime");
3
- const designSystem = require("@strapi/design-system");
4
3
  const symbols = require("@strapi/icons/symbols");
5
- function Center({ height = 400, children }) {
6
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", minHeight: `${height}px`, justifyContent: "center", children });
7
- }
4
+ const designSystem = require("@strapi/design-system");
8
5
  function EmptyBox({ msg }) {
9
6
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
10
7
  /* @__PURE__ */ jsxRuntime.jsx(symbols.EmptyDocuments, { width: "10rem", height: "6rem" }),
11
8
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 4, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", textColor: "neutral600", children: msg }) })
12
9
  ] });
13
10
  }
14
- exports.Center = Center;
15
11
  exports.EmptyBox = EmptyBox;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ const jsxRuntime = require("react/jsx-runtime");
3
+ const designSystem = require("@strapi/design-system");
4
+ function Center({ height = 400, children }) {
5
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", minHeight: `${height}px`, justifyContent: "center", children });
6
+ }
7
+ function FullLoader({ height }) {
8
+ return /* @__PURE__ */ jsxRuntime.jsx(Center, { height, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, { children: "Loading..." }) });
9
+ }
10
+ exports.Center = Center;
11
+ exports.FullLoader = FullLoader;
@@ -0,0 +1,12 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Flex, Loader } from "@strapi/design-system";
3
+ function Center({ height = 400, children }) {
4
+ return /* @__PURE__ */ jsx(Flex, { direction: "column", minHeight: `${height}px`, justifyContent: "center", children });
5
+ }
6
+ function FullLoader({ height }) {
7
+ return /* @__PURE__ */ jsx(Center, { height, children: /* @__PURE__ */ jsx(Loader, { children: "Loading..." }) });
8
+ }
9
+ export {
10
+ Center as C,
11
+ FullLoader as F
12
+ };
@@ -97,7 +97,17 @@ const de = {
97
97
  "webatlas.cancel": "Abbrechen",
98
98
  "webatlas.save": "Speichern",
99
99
  "webatlas.select": "Auswählen",
100
- "webatlas.manage": "Verwalten"
100
+ "webatlas.manage": "Verwalten",
101
+ "webatlas.published": "Veröffentlicht",
102
+ "webatlas.draft": "Entwurf",
103
+ "webatlas.modified": "Geändert",
104
+ "webatlas.deleted": "Gelöscht",
105
+ "webatlas.notification.error": "Ein Fehler ist aufgetreten",
106
+ "webatlas.notification.settings.saved": "Einstellungen erfolgreich gespeichert",
107
+ "webatlas.notification.routes.fetchFailed": "Routen konnten nicht abgerufen werden",
108
+ "webatlas.notification.navigation.saveNavigationFailed": "Fehler beim Aktualisieren des Navigationselements",
109
+ "webatlas.notification.navigation.navigationSaved": "Navigation erfolgreich aktualisiert",
110
+ "webatlas.notification.navigation.fetchFailed": "Fehler beim Abrufen der Navigationen"
101
111
  };
102
112
  export {
103
113
  de as default
@@ -99,6 +99,16 @@ const de = {
99
99
  "webatlas.cancel": "Abbrechen",
100
100
  "webatlas.save": "Speichern",
101
101
  "webatlas.select": "Auswählen",
102
- "webatlas.manage": "Verwalten"
102
+ "webatlas.manage": "Verwalten",
103
+ "webatlas.published": "Veröffentlicht",
104
+ "webatlas.draft": "Entwurf",
105
+ "webatlas.modified": "Geändert",
106
+ "webatlas.deleted": "Gelöscht",
107
+ "webatlas.notification.error": "Ein Fehler ist aufgetreten",
108
+ "webatlas.notification.settings.saved": "Einstellungen erfolgreich gespeichert",
109
+ "webatlas.notification.routes.fetchFailed": "Routen konnten nicht abgerufen werden",
110
+ "webatlas.notification.navigation.saveNavigationFailed": "Fehler beim Aktualisieren des Navigationselements",
111
+ "webatlas.notification.navigation.navigationSaved": "Navigation erfolgreich aktualisiert",
112
+ "webatlas.notification.navigation.fetchFailed": "Fehler beim Abrufen der Navigationen"
103
113
  };
104
114
  exports.default = de;
@@ -97,7 +97,17 @@ const en = {
97
97
  "webatlas.cancel": "Cancel",
98
98
  "webatlas.save": "Save",
99
99
  "webatlas.select": "Select",
100
- "webatlas.manage": "Manage"
100
+ "webatlas.manage": "Manage",
101
+ "webatlas.published": "Published",
102
+ "webatlas.draft": "Draft",
103
+ "webatlas.modified": "Modified",
104
+ "webatlas.deleted": "Deleted",
105
+ "webatlas.notification.error": "An error occurred",
106
+ "webatlas.notification.settings.saved": "Settings saved successfully",
107
+ "webatlas.notification.routes.fetchFailed": "Failed to fetch routes",
108
+ "webatlas.notification.navigation.saveNavigationFailed": "Error updating navigation item",
109
+ "webatlas.notification.navigation.navigationSaved": "Navigation updated successfully",
110
+ "webatlas.notification.navigation.fetchFailed": "Failed to fetch navigations"
101
111
  };
102
112
  export {
103
113
  en as default
@@ -99,6 +99,16 @@ const en = {
99
99
  "webatlas.cancel": "Cancel",
100
100
  "webatlas.save": "Save",
101
101
  "webatlas.select": "Select",
102
- "webatlas.manage": "Manage"
102
+ "webatlas.manage": "Manage",
103
+ "webatlas.published": "Published",
104
+ "webatlas.draft": "Draft",
105
+ "webatlas.modified": "Modified",
106
+ "webatlas.deleted": "Deleted",
107
+ "webatlas.notification.error": "An error occurred",
108
+ "webatlas.notification.settings.saved": "Settings saved successfully",
109
+ "webatlas.notification.routes.fetchFailed": "Failed to fetch routes",
110
+ "webatlas.notification.navigation.saveNavigationFailed": "Error updating navigation item",
111
+ "webatlas.notification.navigation.navigationSaved": "Navigation updated successfully",
112
+ "webatlas.notification.navigation.fetchFailed": "Failed to fetch navigations"
103
113
  };
104
114
  exports.default = en;
@@ -0,0 +1,126 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useState, useEffect } from "react";
3
+ import { Thead, Tr, Th, Typography, VisuallyHidden, Td, Flex, LinkButton, Box, Table, Tbody } from "@strapi/design-system";
4
+ import { g as getTranslation, u as useApi } from "./index-CtJ_9-RB.mjs";
5
+ import { Page, Layouts, useNotification } from "@strapi/strapi/admin";
6
+ import { F as FullLoader, C as Center } from "./FullLoader-CrPED_dY.mjs";
7
+ import { E as EmptyBox } from "./EmptyBox-BM4IscSk.mjs";
8
+ import { useIntl } from "react-intl";
9
+ import { Pencil } from "@strapi/icons";
10
+ function getRouteType(route) {
11
+ if (route.wrapper) {
12
+ return "wrapper";
13
+ } else if (!route.internal) {
14
+ return "external";
15
+ } else {
16
+ return "internal";
17
+ }
18
+ }
19
+ function TableHeader() {
20
+ const { formatMessage } = useIntl();
21
+ return /* @__PURE__ */ jsx(Thead, { children: /* @__PURE__ */ jsxs(Tr, { children: [
22
+ /* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: "ID" }) }),
23
+ /* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: formatMessage({
24
+ id: getTranslation("title"),
25
+ defaultMessage: "Title"
26
+ }) }) }),
27
+ /* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: formatMessage({
28
+ id: getTranslation("route"),
29
+ defaultMessage: "Route"
30
+ }) }) }),
31
+ /* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: formatMessage({
32
+ id: getTranslation("routes.page.column.type"),
33
+ defaultMessage: "Type"
34
+ }) }) }),
35
+ /* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(VisuallyHidden, { children: formatMessage({
36
+ id: getTranslation("actions"),
37
+ defaultMessage: "Actions"
38
+ }) }) })
39
+ ] }) });
40
+ }
41
+ function TableRow({ route }) {
42
+ const { formatMessage } = useIntl();
43
+ return /* @__PURE__ */ jsxs(Tr, { children: [
44
+ /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: route.id }) }),
45
+ /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: route.title }) }),
46
+ /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: route.fullPath }) }),
47
+ /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: formatMessage({
48
+ id: getTranslation(`route.type.${getRouteType(route)}`),
49
+ defaultMessage: "-"
50
+ }) }) }),
51
+ /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Flex, { gap: 2, justifyContent: "end", children: route.internal && /* @__PURE__ */ jsx(
52
+ LinkButton,
53
+ {
54
+ variant: "secondary",
55
+ startIcon: /* @__PURE__ */ jsx(Pencil, {}),
56
+ href: `/admin/content-manager/collection-types/${route.relatedContentType}/${route.relatedDocumentId}`,
57
+ children: formatMessage({
58
+ id: getTranslation("edit"),
59
+ defaultMessage: "Edit"
60
+ })
61
+ }
62
+ ) }) })
63
+ ] });
64
+ }
65
+ function PageWrapper({ children }) {
66
+ const { formatMessage } = useIntl();
67
+ return /* @__PURE__ */ jsxs(Page.Main, { children: [
68
+ /* @__PURE__ */ jsx(
69
+ Layouts.Header,
70
+ {
71
+ title: formatMessage({
72
+ id: getTranslation("routes.page.title"),
73
+ defaultMessage: "Routes"
74
+ }),
75
+ subtitle: formatMessage({
76
+ id: getTranslation("routes.page.subtitle"),
77
+ defaultMessage: "Overview of all existing routes"
78
+ })
79
+ }
80
+ ),
81
+ /* @__PURE__ */ jsx(Layouts.Content, { children: /* @__PURE__ */ jsx(Box, { children }) })
82
+ ] });
83
+ }
84
+ const Routes = () => {
85
+ const { getRoutes } = useApi();
86
+ const { formatMessage } = useIntl();
87
+ const { toggleNotification } = useNotification();
88
+ const [routes, setRoutes] = useState([]);
89
+ const [loading, setLoading] = useState(true);
90
+ useEffect(() => {
91
+ async function fetchRoutes() {
92
+ try {
93
+ const data = await getRoutes();
94
+ setRoutes(data);
95
+ } catch (err) {
96
+ console.error("Failed to fetch routes:", err);
97
+ toggleNotification({
98
+ type: "danger",
99
+ message: formatMessage({
100
+ id: getTranslation("notification.routes.fetchFailed"),
101
+ defaultMessage: "Failed to fetch routes"
102
+ })
103
+ });
104
+ } finally {
105
+ setLoading(false);
106
+ }
107
+ }
108
+ fetchRoutes();
109
+ }, []);
110
+ if (loading) {
111
+ return /* @__PURE__ */ jsx(PageWrapper, { children: /* @__PURE__ */ jsx(FullLoader, {}) });
112
+ }
113
+ if (routes.length === 0) {
114
+ return /* @__PURE__ */ jsx(PageWrapper, { children: /* @__PURE__ */ jsx(Center, { height: 400, children: /* @__PURE__ */ jsx(EmptyBox, { msg: formatMessage({
115
+ id: getTranslation("routes.page.emptyRoutes"),
116
+ defaultMessage: "No routes found"
117
+ }) }) }) });
118
+ }
119
+ return /* @__PURE__ */ jsx(PageWrapper, { children: /* @__PURE__ */ jsxs(Table, { colCount: 4, rowCount: routes.length, children: [
120
+ /* @__PURE__ */ jsx(TableHeader, {}),
121
+ /* @__PURE__ */ jsx(Tbody, { children: routes.map((route) => /* @__PURE__ */ jsx(TableRow, { route }, route.id)) })
122
+ ] }) });
123
+ };
124
+ export {
125
+ Routes as default
126
+ };