@mattisvensson/strapi-plugin-webatlas 0.10.1 → 0.11.0

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 (48) hide show
  1. package/README.md +2 -1
  2. package/dist/admin/FullLoader-Cmsf8xS6.js +1 -0
  3. package/dist/admin/FullLoader-Cmsf8xS6.js.map +1 -0
  4. package/dist/admin/FullLoader-CrPED_dY.mjs +1 -0
  5. package/dist/admin/FullLoader-CrPED_dY.mjs.map +1 -0
  6. package/dist/admin/{SettingTitle-DbsxB1V9.mjs → SettingTitle-B1IaU3qs.mjs} +2 -1
  7. package/dist/admin/SettingTitle-B1IaU3qs.mjs.map +1 -0
  8. package/dist/admin/{SettingTitle-uw1S5OmC.js → SettingTitle-BjE_2u6R.js} +2 -1
  9. package/dist/admin/SettingTitle-BjE_2u6R.js.map +1 -0
  10. package/dist/admin/de-B5pRvs13.mjs +1 -0
  11. package/dist/admin/de-B5pRvs13.mjs.map +1 -0
  12. package/dist/admin/de-CqU1FU8C.js +1 -0
  13. package/dist/admin/de-CqU1FU8C.js.map +1 -0
  14. package/dist/admin/en-BE-zzIv8.mjs +1 -0
  15. package/dist/admin/en-BE-zzIv8.mjs.map +1 -0
  16. package/dist/admin/en-C7I90FwV.js +1 -0
  17. package/dist/admin/en-C7I90FwV.js.map +1 -0
  18. package/dist/admin/{index-BXt-QjKo.js → index-AVI3QJ0R.js} +2 -1
  19. package/dist/admin/index-AVI3QJ0R.js.map +1 -0
  20. package/dist/admin/{index-CGsC8P9P.js → index-B90eSO4a.js} +3 -2
  21. package/dist/admin/index-B90eSO4a.js.map +1 -0
  22. package/dist/admin/{index-tPrfjOIn.mjs → index-BIEUXWe7.mjs} +2 -1
  23. package/dist/admin/index-BIEUXWe7.mjs.map +1 -0
  24. package/dist/admin/{index-CUaBX_v-.mjs → index-BbnlyBrZ.mjs} +3 -2
  25. package/dist/admin/index-BbnlyBrZ.mjs.map +1 -0
  26. package/dist/admin/{index-BKWY9Ta-.mjs → index-Cf9j0bn2.mjs} +2 -1
  27. package/dist/admin/index-Cf9j0bn2.mjs.map +1 -0
  28. package/dist/admin/{index-BYlmJycd.js → index-D8bG0YFB.js} +3 -2
  29. package/dist/admin/index-D8bG0YFB.js.map +1 -0
  30. package/dist/admin/{index-CIr8o1RP.mjs → index-DCYCtKrj.mjs} +118 -106
  31. package/dist/admin/index-DCYCtKrj.mjs.map +1 -0
  32. package/dist/admin/{index-DkqiqVx2.js → index-JLpXBQVL.js} +2 -1
  33. package/dist/admin/index-JLpXBQVL.js.map +1 -0
  34. package/dist/admin/{index-B07KlG03.mjs → index-Y_PYIiRA.mjs} +3 -2
  35. package/dist/admin/index-Y_PYIiRA.mjs.map +1 -0
  36. package/dist/admin/{index-DC5WwNdi.js → index-Yq-QR8t0.js} +118 -106
  37. package/dist/admin/index-Yq-QR8t0.js.map +1 -0
  38. package/dist/admin/index.js +2 -1
  39. package/dist/admin/index.js.map +1 -0
  40. package/dist/admin/index.mjs +2 -1
  41. package/dist/admin/index.mjs.map +1 -0
  42. package/dist/server/index.js +384 -259
  43. package/dist/server/index.js.map +1 -0
  44. package/dist/server/index.mjs +384 -259
  45. package/dist/server/index.mjs.map +1 -0
  46. package/package.json +1 -1
  47. package/dist/admin/src/index.d.ts +0 -12
  48. package/dist/server/src/index.d.ts +0 -301
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
4
  const React = require("react");
5
- const index = require("./index-DC5WwNdi.js");
5
+ const index = require("./index-Yq-QR8t0.js");
6
6
  const admin = require("@strapi/strapi/admin");
7
7
  const designSystem = require("@strapi/design-system");
8
8
  require("@strapi/icons/symbols");
@@ -269,3 +269,4 @@ const Paths = () => {
269
269
  ] }) });
270
270
  };
271
271
  exports.default = Paths;
272
+ //# sourceMappingURL=index-JLpXBQVL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-JLpXBQVL.js","sources":["../../admin/src/pages/Paths/PageWrapper.tsx","../../admin/src/pages/Paths/compareBy.ts","../../admin/src/pages/Paths/SearchInput.tsx","../../admin/src/pages/Paths/TableHeader.tsx","../../admin/src/pages/Paths/TableRow.tsx","../../admin/src/pages/Paths/PathTable.tsx","../../admin/src/pages/Paths/index.tsx"],"sourcesContent":["import { Layouts, Page } from '@strapi/strapi/admin';\nimport { getTranslation } from '../../utils';\nimport { useIntl } from 'react-intl';\n\nexport default function PageWrapper({ children }: { children: React.ReactNode }) {\n const { formatMessage } = useIntl();\n\n return (\n <Page.Main>\n <Layouts.Header\n title={formatMessage({\n id: getTranslation('paths.page.title'),\n defaultMessage: 'Paths',\n })}\n subtitle={formatMessage({\n id: getTranslation('paths.page.subtitle'),\n defaultMessage: 'Overview of all existing paths',\n })}\n />\n <Layouts.Content>\n <>\n {children}\n </>\n </Layouts.Content>\n </Page.Main>\n );\n}","import type { Route } from '../../../../types';\nimport type { RouteSortKey } from '../../types';\n\nexport default function compareBy(field: RouteSortKey, direction: 'asc' | 'desc') {\n if (!field) {\n return () => 0;\n }\n if (field === 'type') {\n return (a: Route, b: Route) => {\n return direction === 'asc'\n ? a.type.localeCompare(b.type)\n : b.type.localeCompare(a.type);\n };\n }\n return (a: Route, b: Route) => {\n const aValue = a[field];\n const bValue = b[field];\n \n if (aValue == null && bValue == null) {\n return 0;\n }\n if (aValue == null) {\n return direction === 'asc' ? 1 : -1;\n }\n if (bValue == null) {\n return direction === 'asc' ? -1 : 1;\n }\n \n if (typeof aValue === 'string' && typeof bValue === 'string') {\n return direction === 'asc'\n ? aValue.localeCompare(bValue)\n : bValue.localeCompare(aValue);\n }\n return 0;\n };\n}","import { Box, Grid, Field } from '@strapi/design-system';\nimport { Cross } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\nimport { getTranslation } from '../../utils';\n\nfunction SearchInput({\n searchQuery,\n handleSearchChange\n}: {\n searchQuery: string;\n handleSearchChange: (e: React.ChangeEvent<HTMLInputElement>) => void;\n}) {\n\n const { formatMessage } = useIntl();\n\n return (\n <Grid.Root style={{ marginBottom: '16px' }}>\n <Grid.Item col={4} s={12}>\n <Box width=\"100%\">\n <Field.Root>\n <Field.Input\n name=\"search\"\n placeholder={formatMessage({\n id: getTranslation('paths.page.searchPlaceholder'),\n defaultMessage: 'Search paths',\n })}\n value={searchQuery}\n onChange={handleSearchChange}\n endAction={\n searchQuery ? (\n <button\n type=\"button\"\n onClick={() => handleSearchChange({ target: { value: '' } } as React.ChangeEvent<HTMLInputElement>)}\n style={{ color: 'inherit', background: 'none', border: 'none', cursor: 'pointer' }}\n aria-label=\"Clear search\"\n >\n <Cross />\n </button>\n ) : null\n }\n />\n </Field.Root>\n </Box>\n </Grid.Item>\n </Grid.Root>\n );\n}\n\nexport default SearchInput;","import type { RouteSortKey } from '../../types';\nimport { Typography, Thead, Tr, Th, VisuallyHidden } from '@strapi/design-system';\nimport { getTranslation } from '../../utils';\nimport { useIntl } from 'react-intl';\nimport { ChevronDown } from '@strapi/icons';\n\nexport default function TableHeader({\n sortKey,\n handleSort\n}: {\n sortKey: RouteSortKey,\n handleSort: (key: RouteSortKey) => void\n}) {\n const { formatMessage } = useIntl();\n\n return (\n <Thead>\n <Tr>\n <Th onClick={() => handleSort('title')} cursor=\"pointer\">\n <Typography variant=\"sigma\">\n {formatMessage({\n id: getTranslation('title'),\n defaultMessage: 'Title',\n })}\n </Typography>\n {sortKey === 'title' && <ChevronDown />}\n </Th>\n <Th onClick={() => handleSort('canonicalPath')} cursor=\"pointer\">\n <Typography variant=\"sigma\">\n {formatMessage({\n id: getTranslation('canonicalPath'),\n defaultMessage: 'Canonical Path',\n })}\n </Typography>\n {sortKey === 'canonicalPath' && <ChevronDown />}\n </Th>\n <Th onClick={() => handleSort('path')} cursor=\"pointer\">\n <Typography variant=\"sigma\">\n {formatMessage({\n id: getTranslation('path'),\n defaultMessage: 'Path',\n })}\n </Typography>\n {sortKey === 'path' && <ChevronDown />}\n </Th>\n <Th onClick={() => handleSort('type')} cursor=\"pointer\">\n <Typography variant=\"sigma\">\n {formatMessage({\n id: getTranslation('paths.page.column.type'),\n defaultMessage: 'Type',\n })}\n </Typography>\n {sortKey === 'type' && <ChevronDown />}\n </Th>\n <Th>\n <VisuallyHidden>\n {formatMessage({\n id: getTranslation('actions'),\n defaultMessage: 'Actions',\n })}\n </VisuallyHidden>\n </Th>\n </Tr>\n </Thead>\n )\n}","import type { Route } from '../../../../types';\nimport { Typography, Tr, Td, Flex, LinkButton } from '@strapi/design-system';\nimport { getTranslation } from '../../utils';\nimport { useIntl } from 'react-intl';\nimport { Pencil } from '@strapi/icons';\n\nexport default function TableRow({ route }: { route: Route }) {\n const { formatMessage } = useIntl();\n \n return (\n <Tr>\n {[route.title, route.canonicalPath, route.path].map((field, index) => (\n <Td key={index}>\n <Typography\n title={field}\n textColor=\"neutral800\"\n >\n {field || '-'}\n </Typography>\n </Td>\n ))}\n <Td>\n <Typography\n title={route.type}\n textColor=\"neutral800\"\n >\n {formatMessage({\n id: getTranslation(`path.type.${route.type}`),\n defaultMessage: '-',\n })}\n </Typography>\n </Td>\n <Td>\n <Flex gap={2} justifyContent=\"end\">\n {route.type === \"internal\" && \n <LinkButton\n variant=\"secondary\"\n startIcon={<Pencil />} \n href={`/admin/content-manager/collection-types/${route.relatedContentType}/${route.relatedDocumentId}`}\n >\n {formatMessage({\n id: getTranslation('edit'),\n defaultMessage: 'Edit',\n })}\n </LinkButton>\n }\n </Flex>\n </Td>\n </Tr>\n )\n}","import type { Route } from '../../../../types';\nimport type { RouteSortKey } from '../../types';\nimport { Table, Tbody, EmptyStateLayout, Tr, Td } from '@strapi/design-system';\nimport TableHeader from './TableHeader';\nimport TableRow from './TableRow';\nimport { useIntl } from 'react-intl';\nimport { getTranslation } from '../../utils';\n\nfunction PathTable({\n routes,\n sortKey,\n handleSort\n}: {\n routes: Route[],\n sortKey: RouteSortKey,\n handleSort: (key: RouteSortKey) => void\n}) {\n\n const { formatMessage } = useIntl();\n\n const TABLE_COL_COUNT = 5;\n\n return (\n <Table\n colCount={TABLE_COL_COUNT}\n rowCount={routes.length}\n >\n <TableHeader sortKey={sortKey} handleSort={handleSort} />\n <Tbody>\n {routes.length > 0 ? routes.map((route: Route) => (\n <TableRow key={route.id} route={route} />\n )) :\n <Tr>\n <Td colSpan={TABLE_COL_COUNT}>\n <EmptyStateLayout\n shadow=\"none\"\n content={\n formatMessage({\n id: getTranslation('paths.page.emptyPaths'),\n defaultMessage: 'No paths found',\n })\n }\n />\n </Td>\n </Tr>\n }\n </Tbody>\n </Table>\n )\n}\n\nexport default PathTable;\n","/*\n *\n * Routes\n * This file contains the Routes page of the Webatlas plugin for Strapi.\n * It displays a table of all existing routes with their details and allows editing.\n *\n*/\n\nimport type { Route } from '../../../../types';\nimport type { RouteSortKey } from '../../types';\nimport { useState, useEffect } from 'react';\nimport { useApi } from '../../hooks';\nimport { FullLoader } from '../../components/UI';\nimport { getTranslation } from '../../utils';\nimport { useIntl } from 'react-intl';\nimport { useNotification, Page } from '@strapi/strapi/admin'\nimport PageWrapper from './PageWrapper';\nimport { useSearchParams } from 'react-router-dom';\nimport debounce from '../../utils/debounce';\nimport { useMemo } from 'react';\nimport compareBy from './compareBy';\nimport pluginPermissions from '../../permissions';\nimport SearchInput from './SearchInput';\nimport PathTable from './PathTable';\n\nconst Paths = () => {\n const { getAllRoutes } = useApi();\n const { formatMessage } = useIntl();\n const { toggleNotification } = useNotification();\n\n const [allRoutes, setAllRoutes] = useState<Route[]>([]);\n const [routes, setRoutes] = useState<Route[]>([]);\n const [loading, setLoading] = useState(true);\n const [searchParams, setSearchParams] = useSearchParams();\n const initialQuery = searchParams.get('search') || '';\n const [searchQuery, setSearchQuery] = useState(initialQuery);\n const [sortKey, setSortKey] = useState<RouteSortKey>('canonicalPath');\n const [sortDirection, setSortDirection] = useState<'asc' | 'desc'>('asc');\n\n useEffect(() => {\n const query = searchQuery.toLowerCase()\n setRoutes(\n allRoutes.filter((route) =>\n JSON.stringify(route.id).toLowerCase().includes(query) ||\n route.title.toLowerCase().includes(query) ||\n route.path.toLowerCase().includes(query) ||\n route.relatedDocumentId.toLowerCase().includes(query) ||\n route.relatedContentType.toLowerCase().includes(query)\n )\n )\n }, [searchQuery, allRoutes]);\n\n const debouncedSetSearchParams = useMemo(() =>\n debounce((value: string) => {\n value\n ? setSearchParams({ search: value })\n : setSearchParams({});\n }, 300),\n [setSearchParams]);\n\n const handleSearchChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const value = e.target.value\n setSearchQuery(value);\n debouncedSetSearchParams(value);\n }\n\n useEffect(() => {\n async function fetchRoutes() {\n try {\n const data = await getAllRoutes();\n setAllRoutes(data);\n setRoutes(data);\n } catch (err) {\n strapi.log.error('Failed to fetch paths:', err);\n toggleNotification({\n type: 'danger',\n message: formatMessage({\n id: getTranslation('notification.paths.fetchFailed'),\n defaultMessage: 'Failed to fetch paths',\n }),\n });\n } finally {\n setLoading(false);\n }\n }\n fetchRoutes();\n }, [])\n\n const handleSort = (key: RouteSortKey) => {\n setSortDirection(prev => (prev === 'asc' ? 'desc' : 'asc'));\n setSortKey(key);\n };\n\n const sortedRoutes = useMemo(() => {\n return sortKey\n ? [...routes].sort(compareBy(sortKey, sortDirection))\n : routes;\n }, [routes, sortKey, sortDirection]);\n\n if (loading) {\n return <PageWrapper>\n <FullLoader />\n </PageWrapper>\n }\n\n return (\n <Page.Protect permissions={pluginPermissions['page.routes']}>\n <PageWrapper>\n <SearchInput\n handleSearchChange={handleSearchChange}\n searchQuery={searchQuery}\n />\n <PathTable\n routes={sortedRoutes}\n sortKey={sortKey}\n handleSort={handleSort}\n />\n </PageWrapper>\n </Page.Protect>\n );\n};\n\nexport default Paths;\n"],"names":["useIntl","jsxs","Page","jsx","Layouts","getTranslation","Fragment","Grid","Box","Field","Cross","Thead","Tr","Th","Typography","ChevronDown","VisuallyHidden","index","Td","Flex","LinkButton","Pencil","Table","Tbody","EmptyStateLayout","useApi","useNotification","useState","useSearchParams","use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,UAAA,CACjB;AAAA,QAAA,CACF;AAAA,MACH,UAAA;AACE,mBAAW,KAAK;AAAA,MAClB;AAAA,IACF;AACA,gBAAA;AAAA,EACF,GAAG,CAAA,CAAE;AAEL,QAAM,aAAa,CAAC,QAAsB;AACxC,qBAAiB,CAAA,SAAS,SAAS,QAAQ,SAAS,KAAM;AAC1D,eAAW,GAAG;AAAA,EAChB;AAEA,QAAM,eAAeyB,MAAAA,QAAQ,MAAM;AACjC,WAAO,UACH,CAAC,GAAG,MAAM,EAAE,KAAK,UAAU,SAAS,aAAa,CAAC,IAClD;AAAA,EACN,GAAG,CAAC,QAAQ,SAAS,aAAa,CAAC;AAEnC,MAAI,SAAS;AACX,WAAO3B,2BAAAA,IAAC,aAAA,EACN,UAAAA,2BAAAA,IAAC6B,WAAAA,YAAA,CAAA,CAAW,GACd;AAAA,EACF;AAEA,SACE7B,+BAACD,MAAAA,KAAK,SAAL,EAAa,aAAa+B,MAAAA,kBAAkB,aAAa,GACxD,UAAAhC,2BAAAA,KAAC,aAAA,EACC,UAAA;AAAA,IAAAE,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,MAAA;AAAA,IAAA;AAAA,IAEFA,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC,QAAQ;AAAA,QACR;AAAA,QACA;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,EAAA,CACF,EAAA,CACF;AAEJ;;"}
@@ -2,11 +2,11 @@ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useReducer, useState, useRef, useEffect } from "react";
3
3
  import { Box, Accordion, Field, SingleSelect, SingleSelectOption, Typography, Link } from "@strapi/design-system";
4
4
  import { useNotification, Page } from "@strapi/strapi/admin";
5
- import { g as getTranslation, c as usePluginConfig, e as useAllContentTypes, p as pluginPermissions, f as PLUGIN_NAME, h as PLUGIN_VERSION } from "./index-CIr8o1RP.mjs";
5
+ import { g as getTranslation, c as usePluginConfig, e as useAllContentTypes, p as pluginPermissions, f as PLUGIN_NAME, h as PLUGIN_VERSION } from "./index-DCYCtKrj.mjs";
6
6
  import { useIntl } from "react-intl";
7
7
  import "@strapi/icons/symbols";
8
8
  import { F as FullLoader } from "./FullLoader-CrPED_dY.mjs";
9
- import { P as PageWrapper, C as ContentBox, S as SettingTitle } from "./SettingTitle-DbsxB1V9.mjs";
9
+ import { P as PageWrapper, C as ContentBox, S as SettingTitle } from "./SettingTitle-B1IaU3qs.mjs";
10
10
  import { ExternalLink } from "@strapi/icons";
11
11
  function ContentTypeAccordion({
12
12
  contentType,
@@ -216,3 +216,4 @@ const Settings = () => {
216
216
  export {
217
217
  Settings as default
218
218
  };
219
+ //# sourceMappingURL=index-Y_PYIiRA.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-Y_PYIiRA.mjs","sources":["../../admin/src/pages/Settings/General/ContentTypeAccordion.tsx","../../admin/src/pages/Settings/General/index.tsx"],"sourcesContent":["import { SingleSelect, SingleSelectOption } from '@strapi/design-system';\nimport { Box, Accordion, Field } from '@strapi/design-system';\nimport { getTranslation } from '../../../utils';\nimport { useIntl } from 'react-intl';\nimport type { ContentType, ConfigContentType } from '../../../../../types';\n\nexport default function ContentTypeAccordion({\n contentType,\n contentTypeSettings,\n dispatch\n}: {\n contentType: ContentType | undefined,\n contentTypeSettings: ConfigContentType,\n dispatch: React.Dispatch<any>\n}) {\n\n const { formatMessage } = useIntl();\n\n if (!contentType) return null\n\n return (\n <Box\n borderColor={!contentTypeSettings.default ? 'danger500' : undefined}\n key={contentType.uid}\n >\n <Accordion.Item key={contentType.uid} value={contentType.uid}>\n <Accordion.Header>\n <Accordion.Trigger>\n {contentType?.info.displayName}\n </Accordion.Trigger>\n </Accordion.Header>\n <Accordion.Content>\n <Box padding={3}>\n <Field.Root\n name=\"selectedContentTypes\"\n hint={formatMessage({\n id: getTranslation('settings.page.generate.hint'),\n defaultMessage: 'The selected field from the content type will be used to generate the path. Use a field that is unique and descriptive, such as a \"title\" or \"name\".',\n })}\n error={!contentTypeSettings.default && formatMessage({\n id: getTranslation('settings.page.generate.error'),\n defaultMessage: 'Please select a default field',\n })}\n required\n >\n <Field.Label>\n {formatMessage({\n id: getTranslation('settings.page.generate'),\n defaultMessage: 'Generate paths from',\n })}\n </Field.Label>\n <SingleSelect\n name={`defaultField-${contentType.uid}`}\n onClear={() => dispatch({ type: 'SET_DEFAULT_FIELD', payload: { ctUid: contentType.uid, field: '' } })}\n value={contentTypeSettings?.default || ''}\n onChange={(value: string | number) => dispatch({ type: 'SET_DEFAULT_FIELD', payload: { ctUid: contentType.uid, field: String(value) } })}\n >\n {Object.entries(contentType.attributes).map(([key], index) => {\n if (\n key === 'id' ||\n key === 'documentId' ||\n key === 'createdAt' ||\n key === 'updatedAt' ||\n key === 'createdBy' ||\n key === 'updatedBy' ||\n key === 'webatlas_path' ||\n key === 'webatlas_override' ||\n key === 'webatlas_parent'\n ) return null\n return <SingleSelectOption key={index} value={key}>{key}</SingleSelectOption>\n })}\n </SingleSelect>\n <Field.Hint/>\n </Field.Root>\n </Box>\n </Accordion.Content>\n </Accordion.Item>\n </Box>\n\n )\n}\n","/*\n *\n * Settings\n * This file contains the general settings page for the Webatlas plugin.\n * It allows users to configure which content types are enabled for URL aliases and navigations,\n * as well as setting default fields for each content type.\n *\n*/\n\nimport type { ContentType, ConfigContentType, PluginConfig } from '../../../../../types';\nimport { useEffect, useState, useReducer, useRef } from 'react';\nimport { Box, Accordion, Field } from '@strapi/design-system';\nimport { useNotification, Page } from '@strapi/strapi/admin'\nimport usePluginConfig from '../../../hooks/usePluginConfig';\nimport useAllContentTypes from '../../../hooks/useAllContentTypes';\nimport { getTranslation } from '../../../utils';\nimport { useIntl } from 'react-intl';\nimport { FullLoader } from '../../../components/UI';\nimport { PageWrapper, ContentBox, SettingTitle } from '..';\nimport ContentTypeAccordion from './ContentTypeAccordion';\nimport { PLUGIN_VERSION, PLUGIN_NAME } from '../../../../../utils/pluginId';\nimport { Typography } from '@strapi/design-system';\nimport { Link } from '@strapi/design-system';\nimport { ExternalLink } from '@strapi/icons';\nimport pluginPermissions from '../../../permissions';\n\ntype Action =\n | { type: 'SET_DEFAULT_FIELD'; payload: { ctUid: string; field: string } }\n | { type: 'SET_CONFIG'; payload: PluginConfig }\n\nfunction reducer(newConfig: PluginConfig | null, action: Action): PluginConfig | null {\n let updatedContentTypes\n\n switch (action.type) {\n case 'SET_DEFAULT_FIELD':\n if (!newConfig) return null;\n updatedContentTypes = newConfig?.selectedContentTypes.map(ct =>\n ct.uid === action.payload.ctUid ? { ...ct, default: action.payload.field } : ct\n );\n return { ...newConfig, selectedContentTypes: updatedContentTypes || [] };\n case 'SET_CONFIG':\n return action.payload;\n default:\n throw new Error();\n }\n}\n\nconst Settings = () => {\n const { config: fetchedConfig, setConfig, loading, fetchError } = usePluginConfig();\n const [config, dispatch] = useReducer(reducer, fetchedConfig);\n const { contentTypes: allContentTypesData } = useAllContentTypes();\n const allContentTypes = allContentTypesData?.filter((ct: ContentType) => ct.pluginOptions?.webatlas?.enabled === true);\n const { toggleNotification } = useNotification();\n const { formatMessage } = useIntl();\n const [isSaving, setIsSaving] = useState(false);\n const initialConfig = useRef<PluginConfig | null>(fetchedConfig);\n\n useEffect(() => {\n initialConfig.current = fetchedConfig;\n\n if (fetchedConfig)\n dispatch({ type: 'SET_CONFIG', payload: fetchedConfig });\n }, [fetchedConfig]);\n\n useEffect(() => {\n if (fetchError) {\n toggleNotification({\n type: 'danger',\n message: formatMessage({\n id: getTranslation('notification.error'),\n defaultMessage: 'An error occurred',\n }) + ': ' + fetchError,\n });\n }\n }, [fetchError, toggleNotification, formatMessage]);\n\n async function save() {\n if (\n !config\n || config.selectedContentTypes.find((cta: ConfigContentType) => !cta.default) !== undefined\n ) return\n\n setIsSaving(true);\n try {\n await setConfig({selectedContentTypes: config.selectedContentTypes })\n initialConfig.current = config;\n\n toggleNotification({\n type: 'success',\n message: formatMessage({\n id: getTranslation('notification.settings.saved'),\n defaultMessage: 'Settings saved successfully',\n }),\n });\n setIsSaving(false);\n } catch (err) {\n setIsSaving(false);\n toggleNotification({\n type: 'danger',\n message: formatMessage({\n id: getTranslation('notification.error'),\n defaultMessage: 'An error occurred',\n }) + ': ' + err,\n });\n strapi.log.error(err);\n }\n }\n\n if (loading) {\n return <PageWrapper\n isSaving={isSaving}\n subtitle={formatMessage({\n id: getTranslation('loading'),\n defaultMessage: 'Loading...',\n })}\n disabledCondition={true}\n >\n <FullLoader height={200} />\n </PageWrapper>\n }\n\n return (\n <Page.Protect permissions={pluginPermissions['settings.general']}>\n <PageWrapper\n save={save}\n isSaving={isSaving}\n subtitle={formatMessage({\n id: getTranslation('settings.page.general.subtitle'),\n defaultMessage: 'Configure general settings',\n })}\n disabledCondition={JSON.stringify(config) === JSON.stringify(initialConfig.current)}\n >\n <ContentBox title={formatMessage({\n id: getTranslation('settings.page.general.contentTypes'),\n defaultMessage: 'Content Types',\n })}>\n {config?.selectedContentTypes && config.selectedContentTypes.length > 0 ?\n <Field.Root name=\"selectedContentTypesAccordion\">\n <Field.Label>\n <SettingTitle>\n {formatMessage({\n id: getTranslation('settings.page.contentTypeSettings'),\n defaultMessage: 'Content Type settings',\n })}\n </SettingTitle>\n </Field.Label>\n <Accordion.Root>\n {config.selectedContentTypes?.map((contentTypeSettings: ConfigContentType) => {\n const ct: ContentType | undefined = allContentTypes?.find((item) => item.uid === contentTypeSettings.uid)\n return <ContentTypeAccordion key={contentTypeSettings.uid} contentType={ct} contentTypeSettings={contentTypeSettings} dispatch={dispatch} />\n })}\n </Accordion.Root>\n </Field.Root>\n : (\n <Typography>\n {formatMessage({\n id: getTranslation('settings.page.general.noContentTypesEnabled'),\n defaultMessage: 'No content types are enabled for Webatlas. Please enable at least one content type to use this plugin.',\n })}\n <Link\n href='https://github.com/mattisvensson/strapi-plugin-webatlas?tab=readme-ov-file#-configuration'\n isExternal\n style={{ marginLeft: 4 }}>\n {formatMessage({\n id: getTranslation('settings.page.general.noContentTypesEnabled.moreInfo'),\n defaultMessage: 'More info',\n })}\n </Link>\n </Typography>\n )}\n </ContentBox>\n <ContentBox title={formatMessage({\n id: getTranslation('settings.page.general.details'),\n defaultMessage: 'Details',\n })}>\n <Field.Root name=\"selectedContentTypesAccordion\">\n <Field.Label>\n <SettingTitle>\n { PLUGIN_NAME }{' '}\n {formatMessage({\n id: getTranslation('version'),\n defaultMessage: 'Version',\n })}\n </SettingTitle>\n </Field.Label>\n <Typography>\n v{PLUGIN_VERSION}\n <Link\n href={`https://github.com/mattisvensson/strapi-plugin-webatlas/releases/tag/v${PLUGIN_VERSION}`}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n style={{ marginLeft: 4 }}>\n <ExternalLink />\n </Link>\n </Typography>\n </Field.Root>\n </ContentBox>\n </PageWrapper>\n </Page.Protect>\n );\n};\n\nexport default Settings;\n"],"names":[],"mappings":";;;;;;;;;;AAMA,SAAwB,qBAAqB;AAAA,EAC3C;AAAA,EACA;AAAA,EACA;AACF,GAIG;AAED,QAAM,EAAE,cAAA,IAAkB,QAAA;AAE1B,MAAI,CAAC,YAAa,QAAO;AAEzB,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,aAAa,CAAC,oBAAoB,UAAU,cAAc;AAAA,MAG1D,+BAAC,UAAU,MAAV,EAAqC,OAAO,YAAY,KACvD,UAAA;AAAA,QAAA,oBAAC,UAAU,QAAV,EACC,UAAA,oBAAC,UAAU,SAAV,EACE,UAAA,aAAa,KAAK,YAAA,CACrB,EAAA,CACF;AAAA,4BACC,UAAU,SAAV,EACC,UAAA,oBAAC,KAAA,EAAI,SAAS,GACZ,UAAA;AAAA,UAAC,MAAM;AAAA,UAAN;AAAA,YACC,MAAK;AAAA,YACL,MAAM,cAAc;AAAA,cAClB,IAAI,eAAe,6BAA6B;AAAA,cAChD,gBAAgB;AAAA,YAAA,CACjB;AAAA,YACD,OAAO,CAAC,oBAAoB,WAAW,cAAc;AAAA,cACnD,IAAI,eAAe,8BAA8B;AAAA,cACjD,g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c;AAAA,gBAC7F,QAAO;AAAA,gBACP,KAAI;AAAA,gBACJ,OAAO,EAAE,YAAY,EAAA;AAAA,gBACrB,8BAAC,cAAA,CAAA,CAAa;AAAA,cAAA;AAAA,YAAA;AAAA,UAChB,EAAA,CACF;AAAA,QAAA,EAAA,CACF,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ;"}
@@ -41,18 +41,25 @@ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
41
41
  );
42
42
  });
43
43
  };
44
- function transformToUrl(input) {
44
+ function transformToUrl(input, replaceSlash = true) {
45
45
  const specialCharMap = {
46
46
  "ü": "ue",
47
47
  "ä": "ae",
48
- "ö": "oe"
48
+ "ö": "oe",
49
+ "ß": "ss"
49
50
  };
50
51
  if (!input || typeof input !== "string") return "";
51
52
  input = input.toLowerCase();
52
53
  input = input.replace(/\/+/g, "/");
53
54
  input = input.startsWith("/") ? input.slice(1) : input;
54
55
  input = input.endsWith("/") ? input.slice(0, -1) : input;
55
- input = input.replace(/\//g, "-");
56
+ if (replaceSlash) {
57
+ input = input.replace(/\//g, "-");
58
+ } else {
59
+ input = input.replace(/\/+/g, "/");
60
+ input = input.startsWith("/") ? input.slice(1) : input;
61
+ input = input.endsWith("/") ? input.slice(0, -1) : input;
62
+ }
56
63
  for (const char in specialCharMap) {
57
64
  const regex = new RegExp(char, "g");
58
65
  input = input.replace(regex, specialCharMap[char]);
@@ -63,7 +70,7 @@ function transformToUrl(input) {
63
70
  input = input.replace(/-+/g, "-");
64
71
  return input;
65
72
  }
66
- const version = "0.10.0";
73
+ const version = "0.11.0";
67
74
  const strapi$1 = { "name": "webatlas", "displayName": "Webatlas" };
68
75
  const pluginPkg = {
69
76
  version,
@@ -3703,10 +3710,7 @@ function PathInput({ path, dispatchPath, isOverride, config }) {
3703
3710
  value: displayedPath,
3704
3711
  onChange: (e) => dispatchPath({ type: "SET_OVERRIDEPATH", payload: e.target.value }),
3705
3712
  disabled: !isOverride,
3706
- onBlur: (e) => {
3707
- if (e.target.value === path.prevValue) return;
3708
- dispatchPath({ type: "DEFAULT", payload: e.target.value });
3709
- },
3713
+ onBlur: (e) => dispatchPath({ type: "SET_OVERRIDEPATH", payload: transformToUrl(e.target.value) }),
3710
3714
  style: { outline: inputBorder }
3711
3715
  }
3712
3716
  ),
@@ -3715,11 +3719,17 @@ function PathInput({ path, dispatchPath, isOverride, config }) {
3715
3719
  }
3716
3720
  );
3717
3721
  }
3718
- function RouteStructure({ routes, selectedParent, setSelectedParent, canonicalPath, prohibitedRouteIds }) {
3722
+ function RouteStructure({
3723
+ routes,
3724
+ selectedParent,
3725
+ setSelectedParent,
3726
+ canonicalPath,
3727
+ prohibitedRouteIds
3728
+ }) {
3719
3729
  const { formatMessage } = reactIntl.useIntl();
3720
- const sortedRoutes = React.useMemo(() => {
3721
- return [...routes].sort((a, b) => a.title.localeCompare(b.title));
3722
- }, [routes]);
3730
+ const filteredRoutes = React.useMemo(() => {
3731
+ return [...routes].sort((a, b) => a.title.localeCompare(b.title)).filter((route) => !prohibitedRouteIds?.includes(route.documentId) || route.documentId === selectedParent?.documentId);
3732
+ }, [routes, prohibitedRouteIds, selectedParent]);
3723
3733
  const handleSelectParent = (value) => {
3724
3734
  const parentRoute = routes.find((route) => route.documentId === value) || null;
3725
3735
  setSelectedParent(parentRoute);
@@ -3740,16 +3750,14 @@ function RouteStructure({ routes, selectedParent, setSelectedParent, canonicalPa
3740
3750
  id: getTranslation("components.CMEditViewAside.path.input.parentSelect.rootPath"),
3741
3751
  defaultMessage: "None (root path)"
3742
3752
  }) }),
3743
- sortedRoutes.filter((route) => !prohibitedRouteIds?.includes(route.documentId) || route.documentId === selectedParent?.documentId).map(
3744
- (route) => /* @__PURE__ */ jsxRuntime.jsx(
3745
- designSystem.SingleSelectOption,
3746
- {
3747
- value: route.documentId,
3748
- children: route.title
3749
- },
3750
- route.documentId
3751
- )
3752
- )
3753
+ filteredRoutes.map((route) => /* @__PURE__ */ jsxRuntime.jsx(
3754
+ designSystem.SingleSelectOption,
3755
+ {
3756
+ value: route.documentId,
3757
+ children: route.title
3758
+ },
3759
+ route.documentId
3760
+ ))
3753
3761
  ]
3754
3762
  }
3755
3763
  )
@@ -3777,9 +3785,10 @@ function RouteStructure({ routes, selectedParent, setSelectedParent, canonicalPa
3777
3785
  ] })
3778
3786
  ] });
3779
3787
  }
3780
- function getCanonicalPath(selectedParent, sourceFieldValue) {
3781
- const parentPath = selectedParent ? selectedParent.canonicalPath + "/" : "";
3782
- return `${parentPath}${transformToUrl(sourceFieldValue)}`;
3788
+ function buildPath(type, slug, parent) {
3789
+ const parentSlug = type === "canonical" ? parent?.canonicalPath : parent?.path;
3790
+ const parentPath = parentSlug ? `${parentSlug}/` : "";
3791
+ return `${parentPath}${transformToUrl(slug)}`;
3783
3792
  }
3784
3793
  function reducer(state, action) {
3785
3794
  switch (action.type) {
@@ -3810,6 +3819,8 @@ function reducer(state, action) {
3810
3819
  return { ...state, replacement: action.payload };
3811
3820
  case "SET_UIDPATH":
3812
3821
  return { ...state, uidPath: action.payload };
3822
+ case "SET_SLUG":
3823
+ return { ...state, slug: action.payload };
3813
3824
  case "SET_CANONICALPATH":
3814
3825
  return { ...state, canonicalPath: action.payload };
3815
3826
  case "SET_OVERRIDEPATH":
@@ -3855,66 +3866,76 @@ const Panel = ({ config }) => {
3855
3866
  replacement: null,
3856
3867
  uidPath: "",
3857
3868
  canonicalPath: "",
3869
+ slug: "",
3858
3870
  overridePath: ""
3859
3871
  });
3860
3872
  const hasUserChangedField = React.useRef(false);
3873
+ const hasUserInteracted = React.useRef(false);
3861
3874
  const initialPath = React.useRef("");
3862
3875
  const prevSourceValueRef = React.useRef(null);
3863
- const sourceFieldValue = React.useMemo(() => {
3864
- const key = config?.default;
3865
- if (!key) return "";
3866
- const currentValue = values[key];
3867
- if (!currentValue) return "";
3868
- return currentValue;
3869
- }, [values, config]);
3870
- const debouncedCheckPath = React.useCallback(debounce(checkPath, 250), []);
3871
- const debouncedCheckCanonicalPath = React.useCallback(debounce(checkCanonicalPath, 250), []);
3876
+ const sourceFieldValue = values[config?.default] || "";
3877
+ const initialSourceFieldValue = initialValues[config?.default] || "";
3878
+ const latestCheckPathRef = React.useRef(checkPath);
3879
+ latestCheckPathRef.current = checkPath;
3880
+ const debouncedCheckPath = React.useRef(debounce((p, id) => latestCheckPathRef.current(p, id), 250)).current;
3881
+ const latestCheckCanonicalRef = React.useRef(checkCanonicalPath);
3882
+ latestCheckCanonicalRef.current = checkCanonicalPath;
3883
+ const debouncedCheckCanonicalPath = React.useRef(debounce((p, id) => latestCheckCanonicalRef.current(p, id), 250)).current;
3872
3884
  React.useEffect(() => {
3873
- if (isOverride) onChange("webatlas_path", path.overridePath);
3874
- onChange("webatlas_override", isOverride);
3875
- onChange("webatlas_parent", selectedParent?.documentId || null);
3876
- }, [path.value, path.overridePath, isOverride, selectedParent]);
3877
- const debouncedValueEffect = React.useMemo(() => debounce((currentValues) => {
3878
- const key = config?.default;
3879
- if (!key) return;
3880
- const currentValue = currentValues[key];
3881
- if (!currentValue) {
3882
- dispatchPath({ type: "NO_URL_CHECK", payload: "" });
3883
- return;
3884
- }
3885
- if (initialLoadComplete && (hasUserChangedField.current || !route) && prevSourceValueRef.current !== currentValue && !isOverride) {
3886
- const path2 = getCanonicalPath(selectedParent, currentValue);
3887
- if (currentValue === initialValues[key]) {
3888
- dispatchPath({ type: "NO_URL_CHECK", payload: path2 });
3889
- } else {
3890
- dispatchPath({ type: "DEFAULT", payload: path2 });
3891
- }
3892
- prevSourceValueRef.current = currentValue;
3885
+ async function fetchAllRoutes() {
3886
+ const allRoutes = await getAllRoutes();
3887
+ setRoutes(allRoutes);
3893
3888
  }
3894
- }, 500), [config?.default, initialValues, isOverride, initialLoadComplete, route, selectedParent]);
3889
+ fetchAllRoutes();
3890
+ }, []);
3895
3891
  React.useEffect(() => {
3896
- const key = config?.default;
3897
- if (!key) return;
3898
- const currentValue = values[key];
3899
- const initialValue = initialValues[key];
3900
- if (currentValue !== initialValue && currentValue && !isOverride) {
3901
- onChange("webatlas_path", transformToUrl(currentValue));
3892
+ const slug = transformToUrl(sourceFieldValue);
3893
+ const overridePath = transformToUrl(path.overridePath || "", false);
3894
+ const data = {
3895
+ path: isOverride ? overridePath : path.value,
3896
+ isOverride,
3897
+ parentDocumentId: selectedParent?.documentId || null,
3898
+ slug: isOverride ? overridePath : slug
3899
+ };
3900
+ if (hasUserChangedField.current || hasUserInteracted.current) {
3901
+ onChange("webatlas", data);
3902
3902
  }
3903
+ }, [path.value, path.overridePath, isOverride, selectedParent, sourceFieldValue, hasUserChangedField, hasUserInteracted]);
3904
+ React.useEffect(() => {
3903
3905
  if (!initialLoadComplete) return;
3904
- if (currentValue !== initialValue) {
3906
+ if (sourceFieldValue !== initialSourceFieldValue) {
3905
3907
  hasUserChangedField.current = true;
3906
3908
  }
3907
- debouncedValueEffect(values);
3908
- }, [values, debouncedValueEffect, initialLoadComplete, selectedParent]);
3909
+ if (!sourceFieldValue) {
3910
+ dispatchPath({ type: "NO_URL_CHECK", payload: "" });
3911
+ return;
3912
+ }
3913
+ if (initialLoadComplete && (hasUserChangedField.current || !route) && prevSourceValueRef.current !== sourceFieldValue && !isOverride) {
3914
+ const newPath = buildPath("path", sourceFieldValue, selectedParent);
3915
+ const type = sourceFieldValue === initialSourceFieldValue ? "NO_URL_CHECK" : "DEFAULT";
3916
+ const slug = transformToUrl(sourceFieldValue);
3917
+ dispatchPath({ type, payload: newPath });
3918
+ dispatchPath({ type: "SET_SLUG", payload: slug });
3919
+ dispatchPath({ type: "SET_OVERRIDEPATH", payload: slug });
3920
+ prevSourceValueRef.current = sourceFieldValue;
3921
+ }
3922
+ const canonicalPath = buildPath("canonical", sourceFieldValue, selectedParent);
3923
+ dispatchPath({ type: "SET_CANONICALPATH", payload: canonicalPath });
3924
+ debouncedCheckCanonicalPath(canonicalPath, route?.documentId || null);
3925
+ }, [sourceFieldValue, initialSourceFieldValue, initialLoadComplete, selectedParent, isOverride, route]);
3909
3926
  React.useEffect(() => {
3927
+ if (!initialLoadComplete) return;
3910
3928
  if (path.needsUrlCheck && path.value) {
3911
3929
  if (path.uidPath === path.value || initialPath.current === path.value) return;
3912
3930
  debouncedCheckPath(path.value, route?.documentId || null);
3913
3931
  dispatchPath({ type: "RESET_URL_CHECK_FLAG" });
3932
+ } else {
3933
+ setValidationState("idle");
3934
+ dispatchPath({ type: "SET_REPLACEMENT", payload: null });
3914
3935
  }
3915
- }, [path.needsUrlCheck, path.value, path.uidPath, route]);
3936
+ }, [path.needsUrlCheck, path.value, path.uidPath, route, initialLoadComplete]);
3916
3937
  React.useEffect(() => {
3917
- async function getTypes() {
3938
+ async function fetchRelatedRute() {
3918
3939
  if (!initialValues.documentId) {
3919
3940
  setInitialLoadComplete(true);
3920
3941
  return;
@@ -3925,12 +3946,11 @@ const Panel = ({ config }) => {
3925
3946
  initialPath.current = initialValues.webatlas_path || route2.uidPath;
3926
3947
  setRoute(route2);
3927
3948
  setIsOverride(route2.isOverride || false);
3928
- if (route2.isOverride) {
3929
- dispatchPath({ type: "SET_OVERRIDEPATH", payload: route2.path || "" });
3930
- } else {
3931
- dispatchPath({ type: "NO_TRANSFORM_AND_CHECK", payload: route2.path || "" });
3932
- }
3949
+ dispatchPath({ type: "SET_OVERRIDEPATH", payload: route2.path || "" });
3950
+ dispatchPath({ type: "NO_TRANSFORM_AND_CHECK", payload: route2.path || "" });
3933
3951
  dispatchPath({ type: "SET_UIDPATH", payload: route2.uidPath || "" });
3952
+ dispatchPath({ type: "SET_SLUG", payload: route2.slug || "" });
3953
+ dispatchPath({ type: "SET_CANONICALPATH", payload: route2.canonicalPath || "" });
3934
3954
  const key = config?.default;
3935
3955
  if (key) {
3936
3956
  prevSourceValueRef.current = values[key];
@@ -3941,27 +3961,13 @@ const Panel = ({ config }) => {
3941
3961
  }
3942
3962
  setInitialLoadComplete(true);
3943
3963
  }
3944
- getTypes();
3964
+ fetchRelatedRute();
3945
3965
  }, [config]);
3946
3966
  React.useEffect(() => {
3947
- if (initialValues.webatlas_parent && routes.length > 0 && !selectedParent) {
3948
- const parentRoute = routes.find((route2) => route2.documentId === initialValues.webatlas_parent);
3949
- if (parentRoute) {
3950
- setSelectedParent(parentRoute);
3951
- const canonicalPath = getCanonicalPath(parentRoute, sourceFieldValue);
3952
- dispatchPath({ type: "DEFAULT", payload: canonicalPath });
3953
- }
3954
- }
3955
- }, [initialValues, routes]);
3956
- React.useEffect(() => {
3957
- if (initialValues.webatlas_path) dispatchPath({ type: "NO_URL_CHECK", payload: initialValues.webatlas_path });
3958
- if (initialValues.webatlas_override) setIsOverride(initialValues.webatlas_override);
3959
- async function fetchAllRoutes() {
3960
- const allRoutes = await getAllRoutes();
3961
- setRoutes(allRoutes);
3962
- }
3963
- fetchAllRoutes();
3964
- }, []);
3967
+ if (!route || !routes.length) return;
3968
+ const parentRoute = routes.find((singleRoute) => singleRoute.documentId === route.parent?.documentId);
3969
+ setSelectedParent(parentRoute || null);
3970
+ }, [route, routes]);
3965
3971
  React.useEffect(() => {
3966
3972
  async function fetchProhibitedRouteIds() {
3967
3973
  const prohibitedIds = await getProhibitedRouteIds(route?.documentId);
@@ -3971,27 +3977,26 @@ const Panel = ({ config }) => {
3971
3977
  }, [route]);
3972
3978
  React.useEffect(() => {
3973
3979
  if (!sourceFieldValue) return;
3974
- const canonicalPath = getCanonicalPath(selectedParent, sourceFieldValue);
3975
- !isOverride && dispatchPath({ type: "DEFAULT", payload: canonicalPath });
3976
- dispatchPath({ type: "SET_CANONICALPATH", payload: canonicalPath });
3977
- debouncedCheckCanonicalPath(canonicalPath, route?.documentId || null);
3978
- dispatchPath({ type: "RESET_URL_CHECK_FLAG" });
3980
+ if (!isOverride) {
3981
+ const newPath = buildPath("path", sourceFieldValue, selectedParent);
3982
+ dispatchPath({ type: "DEFAULT", payload: newPath });
3983
+ }
3979
3984
  }, [selectedParent, sourceFieldValue, route, isOverride]);
3980
- async function checkCanonicalPath(path2, documentId) {
3985
+ async function checkCanonicalPath(path2, routeDocumentId) {
3981
3986
  if (!path2) return;
3982
3987
  try {
3983
- const result = await duplicateCheck({ fetchFunction: get, path: path2, routeDocumentId: documentId, withoutTransform: true });
3988
+ const result = await duplicateCheck({ fetchFunction: get, path: path2, routeDocumentId, withoutTransform: true });
3984
3989
  dispatchPath({ type: "SET_CANONICALPATH", payload: result });
3985
3990
  } catch (err) {
3986
3991
  strapi.log.error(err);
3987
3992
  }
3988
3993
  }
3989
- async function checkPath(path2, route2) {
3994
+ async function checkPath(path2, routeDocumentId) {
3990
3995
  if (!path2) return;
3991
3996
  setValidationState("checking");
3992
3997
  dispatchPath({ type: "SET_REPLACEMENT", payload: "" });
3993
3998
  try {
3994
- const data = await duplicateCheck({ fetchFunction: get, path: path2, routeDocumentId: route2, withoutTransform: true });
3999
+ const data = await duplicateCheck({ fetchFunction: get, path: path2, routeDocumentId, withoutTransform: true });
3995
4000
  if (!data || data === path2) return;
3996
4001
  dispatchPath({ type: "NO_URL_CHECK", payload: data });
3997
4002
  dispatchPath({ type: "SET_REPLACEMENT", payload: data });
@@ -4028,7 +4033,10 @@ const Panel = ({ config }) => {
4028
4033
  canonicalPath: path.canonicalPath,
4029
4034
  routes,
4030
4035
  selectedParent,
4031
- setSelectedParent,
4036
+ setSelectedParent: (val) => {
4037
+ hasUserInteracted.current = true;
4038
+ setSelectedParent(val);
4039
+ },
4032
4040
  prohibitedRouteIds
4033
4041
  }
4034
4042
  ),
@@ -4055,7 +4063,10 @@ const Panel = ({ config }) => {
4055
4063
  OverrideCheckbox,
4056
4064
  {
4057
4065
  isOverride,
4058
- setIsOverride,
4066
+ setIsOverride: (val) => {
4067
+ hasUserInteracted.current = true;
4068
+ setIsOverride(val);
4069
+ },
4059
4070
  disabledCondition: !canCreate && !canUpdate
4060
4071
  }
4061
4072
  ),
@@ -4090,7 +4101,7 @@ const CMEditViewAside = ({ documentId, model }) => {
4090
4101
  setIsAllowedContentType(!!contentType?.pluginOptions?.webatlas?.enabled);
4091
4102
  }, [contentTypes, model]);
4092
4103
  React.useEffect(() => {
4093
- const isWebatlasLabel = (label) => label.textContent?.startsWith("webatlas_");
4104
+ const isWebatlasLabel = (label) => label.textContent?.startsWith("webatlas");
4094
4105
  const cleanupLabels = () => {
4095
4106
  const labels = document.querySelectorAll("label");
4096
4107
  labels.forEach((label) => {
@@ -4160,7 +4171,7 @@ const index = {
4160
4171
  id: `${PLUGIN_ID}.link.paths`,
4161
4172
  defaultMessage: "Paths"
4162
4173
  },
4163
- Component: () => Promise.resolve().then(() => require("./index-DkqiqVx2.js")),
4174
+ Component: () => Promise.resolve().then(() => require("./index-JLpXBQVL.js")),
4164
4175
  permissions: [
4165
4176
  pluginPermissions["page.routes"][0]
4166
4177
  ]
@@ -4172,7 +4183,7 @@ const index = {
4172
4183
  id: `${PLUGIN_ID}.link.navigation`,
4173
4184
  defaultMessage: "Navigation"
4174
4185
  },
4175
- Component: () => Promise.resolve().then(() => require("./index-BXt-QjKo.js")),
4186
+ Component: () => Promise.resolve().then(() => require("./index-AVI3QJ0R.js")),
4176
4187
  permissions: [
4177
4188
  pluginPermissions["page.navigation"][0]
4178
4189
  ]
@@ -4192,7 +4203,7 @@ const index = {
4192
4203
  },
4193
4204
  id: `${PLUGIN_ID}-general`,
4194
4205
  to: `${PLUGIN_ID}/general`,
4195
- Component: () => Promise.resolve().then(() => require("./index-CGsC8P9P.js")),
4206
+ Component: () => Promise.resolve().then(() => require("./index-B90eSO4a.js")),
4196
4207
  permissions: [
4197
4208
  pluginPermissions["settings.general"][0]
4198
4209
  ]
@@ -4207,7 +4218,7 @@ const index = {
4207
4218
  },
4208
4219
  id: `${PLUGIN_ID}-navigation`,
4209
4220
  to: `${PLUGIN_ID}/navigation`,
4210
- Component: () => Promise.resolve().then(() => require("./index-BYlmJycd.js")),
4221
+ Component: () => Promise.resolve().then(() => require("./index-D8bG0YFB.js")),
4211
4222
  permissions: [
4212
4223
  pluginPermissions["settings.navigation"][0]
4213
4224
  ]
@@ -4249,3 +4260,4 @@ exports.pluginPermissions = pluginPermissions;
4249
4260
  exports.useAllContentTypes = useAllContentTypes;
4250
4261
  exports.useApi = useApi;
4251
4262
  exports.usePluginConfig = usePluginConfig;
4263
+ //# sourceMappingURL=index-Yq-QR8t0.js.map