@strapi/content-manager 5.10.3 → 5.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 (92) hide show
  1. package/dist/admin/chunks/{ComponentConfigurationPage-C5H-5L1u.js → ComponentConfigurationPage-BBCYsnnE.js} +3 -3
  2. package/dist/admin/chunks/{ComponentConfigurationPage-C5H-5L1u.js.map → ComponentConfigurationPage-BBCYsnnE.js.map} +1 -1
  3. package/dist/admin/chunks/{ComponentConfigurationPage-BN2kOtDm.mjs → ComponentConfigurationPage-DNBN8tI3.mjs} +3 -3
  4. package/dist/admin/chunks/{ComponentConfigurationPage-BN2kOtDm.mjs.map → ComponentConfigurationPage-DNBN8tI3.mjs.map} +1 -1
  5. package/dist/admin/chunks/{EditConfigurationPage-tMgOELQG.mjs → EditConfigurationPage-CoivzF-x.mjs} +3 -3
  6. package/dist/admin/chunks/{EditConfigurationPage-tMgOELQG.mjs.map → EditConfigurationPage-CoivzF-x.mjs.map} +1 -1
  7. package/dist/admin/chunks/{EditConfigurationPage-BExtZuB7.js → EditConfigurationPage-Cu0Vt-uc.js} +3 -3
  8. package/dist/admin/chunks/{EditConfigurationPage-BExtZuB7.js.map → EditConfigurationPage-Cu0Vt-uc.js.map} +1 -1
  9. package/dist/admin/chunks/{EditViewPage-DFkloeMZ.js → EditViewPage-B48r4DLX.js} +6 -9
  10. package/dist/admin/chunks/EditViewPage-B48r4DLX.js.map +1 -0
  11. package/dist/admin/chunks/{EditViewPage-CYe7wAXF.mjs → EditViewPage-BpGtaOKG.mjs} +6 -9
  12. package/dist/admin/chunks/EditViewPage-BpGtaOKG.mjs.map +1 -0
  13. package/dist/admin/chunks/{Form-DGUP3zQO.js → Form-DD49gSWW.js} +2 -2
  14. package/dist/admin/chunks/{Form-DGUP3zQO.js.map → Form-DD49gSWW.js.map} +1 -1
  15. package/dist/admin/chunks/{Form-DTO0ZIaB.mjs → Form-rQQtxfmF.mjs} +2 -2
  16. package/dist/admin/chunks/{Form-DTO0ZIaB.mjs.map → Form-rQQtxfmF.mjs.map} +1 -1
  17. package/dist/admin/chunks/{History-C333pgXF.mjs → History-BdsTgpW-.mjs} +5 -5
  18. package/dist/admin/chunks/{History-C333pgXF.mjs.map → History-BdsTgpW-.mjs.map} +1 -1
  19. package/dist/admin/chunks/{History-CQznK1pG.js → History-RLJ9Svg6.js} +5 -5
  20. package/dist/admin/chunks/{History-CQznK1pG.js.map → History-RLJ9Svg6.js.map} +1 -1
  21. package/dist/admin/chunks/{Input-DLJZHw9Y.js → Input-BUVu6H9n.js} +4 -4
  22. package/dist/admin/chunks/{Input-DLJZHw9Y.js.map → Input-BUVu6H9n.js.map} +1 -1
  23. package/dist/admin/chunks/{Input-BexkC_pp.mjs → Input-CtIJ2J0c.mjs} +4 -4
  24. package/dist/admin/chunks/{Input-BexkC_pp.mjs.map → Input-CtIJ2J0c.mjs.map} +1 -1
  25. package/dist/admin/chunks/{ListConfigurationPage-BX2WR7MI.mjs → ListConfigurationPage-38s4e-VJ.mjs} +2 -2
  26. package/dist/admin/chunks/{ListConfigurationPage-BX2WR7MI.mjs.map → ListConfigurationPage-38s4e-VJ.mjs.map} +1 -1
  27. package/dist/admin/chunks/{ListConfigurationPage-71I_stAM.js → ListConfigurationPage-DfnrA3dw.js} +2 -2
  28. package/dist/admin/chunks/{ListConfigurationPage-71I_stAM.js.map → ListConfigurationPage-DfnrA3dw.js.map} +1 -1
  29. package/dist/admin/chunks/{ListViewPage-BDeT3Dkk.mjs → ListViewPage-BTmlktgT.mjs} +3 -3
  30. package/dist/admin/chunks/{ListViewPage-BDeT3Dkk.mjs.map → ListViewPage-BTmlktgT.mjs.map} +1 -1
  31. package/dist/admin/chunks/{ListViewPage-DV3heO4F.js → ListViewPage-D9-LGPq_.js} +3 -3
  32. package/dist/admin/chunks/{ListViewPage-DV3heO4F.js.map → ListViewPage-D9-LGPq_.js.map} +1 -1
  33. package/dist/admin/chunks/{NoContentTypePage-9JHYpYVX.mjs → NoContentTypePage-CcyR2i1K.mjs} +2 -2
  34. package/dist/admin/chunks/{NoContentTypePage-9JHYpYVX.mjs.map → NoContentTypePage-CcyR2i1K.mjs.map} +1 -1
  35. package/dist/admin/chunks/{NoContentTypePage-COih9y2J.js → NoContentTypePage-owzdv-pl.js} +2 -2
  36. package/dist/admin/chunks/{NoContentTypePage-COih9y2J.js.map → NoContentTypePage-owzdv-pl.js.map} +1 -1
  37. package/dist/admin/chunks/{NoPermissionsPage-DGAwRIlN.js → NoPermissionsPage-CM_r8w5u.js} +2 -2
  38. package/dist/admin/chunks/{NoPermissionsPage-DGAwRIlN.js.map → NoPermissionsPage-CM_r8w5u.js.map} +1 -1
  39. package/dist/admin/chunks/{NoPermissionsPage-DTe9I47q.mjs → NoPermissionsPage-lBonAXej.mjs} +2 -2
  40. package/dist/admin/chunks/{NoPermissionsPage-DTe9I47q.mjs.map → NoPermissionsPage-lBonAXej.mjs.map} +1 -1
  41. package/dist/admin/chunks/{Preview-CXtc9yEV.js → Preview-Bv3GKyWZ.js} +209 -86
  42. package/dist/admin/chunks/Preview-Bv3GKyWZ.js.map +1 -0
  43. package/dist/admin/chunks/{Preview-BEq0FXda.mjs → Preview-Dh5Z7aGp.mjs} +213 -90
  44. package/dist/admin/chunks/Preview-Dh5Z7aGp.mjs.map +1 -0
  45. package/dist/admin/chunks/{Relations-qeZyLDgQ.mjs → Relations-DP5krCGC.mjs} +3 -3
  46. package/dist/admin/chunks/{Relations-qeZyLDgQ.mjs.map → Relations-DP5krCGC.mjs.map} +1 -1
  47. package/dist/admin/chunks/{Relations-o7_hVGyK.js → Relations-T8Cr0N9M.js} +3 -3
  48. package/dist/admin/chunks/{Relations-o7_hVGyK.js.map → Relations-T8Cr0N9M.js.map} +1 -1
  49. package/dist/admin/chunks/{en-LfhocNG2.mjs → en-CImiNxXE.mjs} +3 -1
  50. package/dist/admin/chunks/{en-LfhocNG2.mjs.map → en-CImiNxXE.mjs.map} +1 -1
  51. package/dist/admin/chunks/{en-C1CjdAtC.js → en-CLf4SuMQ.js} +3 -1
  52. package/dist/admin/chunks/{en-C1CjdAtC.js.map → en-CLf4SuMQ.js.map} +1 -1
  53. package/dist/admin/chunks/{index-Cs6qwFQu.mjs → index-BkM_Z7pU.mjs} +78 -40
  54. package/dist/admin/chunks/index-BkM_Z7pU.mjs.map +1 -0
  55. package/dist/admin/chunks/{index-BHimg6jW.js → index-CGBB9Dho.js} +78 -39
  56. package/dist/admin/chunks/index-CGBB9Dho.js.map +1 -0
  57. package/dist/admin/chunks/{layout-DStNia_P.mjs → layout-D8ji6QNJ.mjs} +4 -4
  58. package/dist/admin/chunks/{layout-DStNia_P.mjs.map → layout-D8ji6QNJ.mjs.map} +1 -1
  59. package/dist/admin/chunks/{layout-Dtahn4Ue.js → layout-Dbmjk7mC.js} +4 -4
  60. package/dist/admin/chunks/{layout-Dtahn4Ue.js.map → layout-Dbmjk7mC.js.map} +1 -1
  61. package/dist/admin/chunks/{relations-Cq8NRUto.mjs → relations-Dv0FHoBS.mjs} +2 -2
  62. package/dist/admin/chunks/{relations-Cq8NRUto.mjs.map → relations-Dv0FHoBS.mjs.map} +1 -1
  63. package/dist/admin/chunks/{relations-XOYEEqMz.js → relations-jNJK8ESO.js} +2 -2
  64. package/dist/admin/chunks/{relations-XOYEEqMz.js.map → relations-jNJK8ESO.js.map} +1 -1
  65. package/dist/admin/chunks/uk-BtM6WnaE.mjs +313 -0
  66. package/dist/admin/chunks/uk-BtM6WnaE.mjs.map +1 -0
  67. package/dist/admin/chunks/uk-DB6OgySY.js +318 -0
  68. package/dist/admin/chunks/uk-DB6OgySY.js.map +1 -0
  69. package/dist/admin/index.js +1 -1
  70. package/dist/admin/index.mjs +1 -1
  71. package/dist/admin/src/components/InjectionZone.d.ts +7 -1
  72. package/dist/admin/src/content-manager.d.ts +4 -0
  73. package/dist/admin/src/hooks/useDocument.d.ts +2 -0
  74. package/dist/admin/src/hooks/useDocumentActions.d.ts +1 -0
  75. package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +2 -1
  76. package/dist/admin/src/preview/components/PreviewContent.d.ts +1 -2
  77. package/dist/admin/src/preview/pages/Preview.d.ts +2 -0
  78. package/dist/server/index.js +1 -1
  79. package/dist/server/index.js.map +1 -1
  80. package/dist/server/index.mjs +1 -1
  81. package/dist/server/index.mjs.map +1 -1
  82. package/package.json +8 -8
  83. package/dist/admin/chunks/EditViewPage-CYe7wAXF.mjs.map +0 -1
  84. package/dist/admin/chunks/EditViewPage-DFkloeMZ.js.map +0 -1
  85. package/dist/admin/chunks/Preview-BEq0FXda.mjs.map +0 -1
  86. package/dist/admin/chunks/Preview-CXtc9yEV.js.map +0 -1
  87. package/dist/admin/chunks/index-BHimg6jW.js.map +0 -1
  88. package/dist/admin/chunks/index-Cs6qwFQu.mjs.map +0 -1
  89. package/dist/admin/chunks/uk-B24MoTVg.js +0 -145
  90. package/dist/admin/chunks/uk-B24MoTVg.js.map +0 -1
  91. package/dist/admin/chunks/uk-Cpgmm7gE.mjs +0 -140
  92. package/dist/admin/chunks/uk-Cpgmm7gE.mjs.map +0 -1
@@ -5,8 +5,8 @@ var React = require('react');
5
5
  var strapiAdmin = require('@strapi/admin/strapi-admin');
6
6
  var reactIntl = require('react-intl');
7
7
  var reactRouterDom = require('react-router-dom');
8
- var Form = require('./Form-DGUP3zQO.js');
9
- var index = require('./index-BHimg6jW.js');
8
+ var Form = require('./Form-DD49gSWW.js');
9
+ var index = require('./index-CGBB9Dho.js');
10
10
  var hooks = require('./hooks-D-sOYd1s.js');
11
11
  var objects = require('./objects-C3EebVVe.js');
12
12
  require('@strapi/design-system');
@@ -296,4 +296,4 @@ const { useGetComponentConfigurationQuery, useUpdateComponentConfigurationMutati
296
296
 
297
297
  exports.ComponentConfigurationPage = ComponentConfigurationPage;
298
298
  exports.ProtectedComponentConfigurationPage = ProtectedComponentConfigurationPage;
299
- //# sourceMappingURL=ComponentConfigurationPage-C5H-5L1u.js.map
299
+ //# sourceMappingURL=ComponentConfigurationPage-BBCYsnnE.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ComponentConfigurationPage-C5H-5L1u.js","sources":["../../../admin/src/services/components.ts","../../../admin/src/pages/ComponentConfigurationPage.tsx"],"sourcesContent":["import { contentManagerApi } from './api';\n\nimport type {\n FindComponentConfiguration,\n UpdateComponentConfiguration,\n} from '../../../shared/contracts/components';\n\nconst componentsApi = contentManagerApi.injectEndpoints({\n endpoints: (builder) => ({\n getComponentConfiguration: builder.query<\n FindComponentConfiguration.Response['data'],\n FindComponentConfiguration.Params['uid']\n >({\n query: (uid) => `/content-manager/components/${uid}/configuration`,\n transformResponse: (response: FindComponentConfiguration.Response) => response.data,\n providesTags: (_result, _error, uid) => [{ type: 'ComponentConfiguration', id: uid }],\n }),\n updateComponentConfiguration: builder.mutation({\n query: ({ uid, ...body }) => ({\n url: `/content-manager/components/${uid}/configuration`,\n method: 'PUT',\n data: body,\n }),\n transformResponse: (response: UpdateComponentConfiguration.Response) => response.data,\n invalidatesTags: (_result, _error, { uid }) => [\n { type: 'ComponentConfiguration', id: uid },\n // otherwise layouts already fetched will have stale component configuration data.\n { type: 'ContentTypeSettings', id: 'LIST' },\n ],\n }),\n }),\n});\n\nconst { useGetComponentConfigurationQuery, useUpdateComponentConfigurationMutation } =\n componentsApi;\n\nexport { useGetComponentConfigurationQuery, useUpdateComponentConfigurationMutation };\n","import * as React from 'react';\n\nimport { Page, useNotification, useAPIErrorHandler } from '@strapi/admin/strapi-admin';\nimport { useIntl } from 'react-intl';\nimport { useParams } from 'react-router-dom';\n\nimport { TEMP_FIELD_NAME } from '../components/ConfigurationForm/Fields';\nimport { ConfigurationForm, ConfigurationFormProps } from '../components/ConfigurationForm/Form';\nimport { ComponentsDictionary, extractContentTypeComponents } from '../hooks/useContentTypeSchema';\nimport {\n DEFAULT_SETTINGS,\n EditLayout,\n convertEditLayoutToFieldLayouts,\n} from '../hooks/useDocumentLayout';\nimport { useTypedSelector } from '../modules/hooks';\nimport {\n useGetComponentConfigurationQuery,\n useUpdateComponentConfigurationMutation,\n} from '../services/components';\nimport { useGetInitialDataQuery } from '../services/init';\nimport { setIn } from '../utils/objects';\n\nimport type { Component, FindComponentConfiguration } from '../../../shared/contracts/components';\nimport type { Metadatas } from '../../../shared/contracts/content-types';\n\n/* -------------------------------------------------------------------------------------------------\n * ComponentConfigurationPage\n * -----------------------------------------------------------------------------------------------*/\n\nconst ComponentConfigurationPage = () => {\n /**\n * useDocumentLayout only works for documents, not components,\n * it feels weird to make that hook work for both when this is SUCH\n * a unique use case and we only do it here, so in short, we essentially\n * just extracted the logic to make an edit view layout and reproduced it here.\n */\n const { slug: model } = useParams<{ slug: string }>();\n const { toggleNotification } = useNotification();\n const { formatMessage } = useIntl();\n const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();\n\n const {\n components,\n fieldSizes,\n schema,\n error: errorSchema,\n isLoading: isLoadingSchema,\n isFetching: isFetchingSchema,\n } = useGetInitialDataQuery(undefined, {\n selectFromResult: (res) => {\n const schema = res.data?.components.find((ct) => ct.uid === model);\n\n const componentsByKey = res.data?.components.reduce<ComponentsDictionary>(\n (acc, component) => {\n acc[component.uid] = component;\n\n return acc;\n },\n {}\n );\n\n const components = extractContentTypeComponents(schema?.attributes, componentsByKey);\n\n const fieldSizes = Object.entries(res.data?.fieldSizes ?? {}).reduce<\n ConfigurationFormProps['fieldSizes']\n >((acc, [attributeName, { default: size }]) => {\n acc[attributeName] = size;\n\n return acc;\n }, {});\n\n return {\n isFetching: res.isFetching,\n isLoading: res.isLoading,\n error: res.error,\n components,\n schema,\n fieldSizes,\n };\n },\n });\n\n React.useEffect(() => {\n if (errorSchema) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(errorSchema),\n });\n }\n }, [errorSchema, formatAPIError, toggleNotification]);\n\n const {\n data,\n isLoading: isLoadingConfig,\n isFetching: isFetchingConfig,\n error,\n } = useGetComponentConfigurationQuery(model ?? '');\n\n React.useEffect(() => {\n if (error) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(error),\n });\n }\n }, [error, formatAPIError, toggleNotification]);\n\n /**\n * you **must** check if we're loading or fetching in case the component gets new props\n * but nothing was unmounted, it then becomes a fetch, not a load.\n */\n const isLoading = isLoadingConfig || isLoadingSchema || isFetchingConfig || isFetchingSchema;\n\n const editLayout = React.useMemo(\n () =>\n data && !isLoading\n ? formatEditLayout(data, { schema, components })\n : ({\n layout: [],\n components: {},\n metadatas: {},\n options: {},\n settings: DEFAULT_SETTINGS,\n } as EditLayout),\n [data, isLoading, schema, components]\n );\n\n const [updateConfiguration] = useUpdateComponentConfigurationMutation();\n const handleSubmit: ConfigurationFormProps['onSubmit'] = async (formData) => {\n try {\n /**\n * We reconstruct the metadatas object by taking the existing list metadatas\n * and re-merging that by attribute name with the current list metadatas, whilst overwriting\n * the data from the form we've built.\n */\n const meta = Object.entries(data?.component.metadatas ?? {}).reduce<Metadatas>(\n (acc, [name, { edit, list }]) => {\n const {\n __temp_key__,\n size: _size,\n name: _name,\n ...editedMetadata\n } = formData.layout.flatMap((row) => row.children).find((field) => field.name === name) ??\n {};\n\n acc[name] = {\n edit: {\n ...edit,\n ...editedMetadata,\n },\n list,\n };\n\n return acc;\n },\n {}\n );\n\n const res = await updateConfiguration({\n layouts: {\n edit: formData.layout.map((row) =>\n row.children.reduce<Array<{ name: string; size: number }>>((acc, { name, size }) => {\n if (name !== TEMP_FIELD_NAME) {\n return [...acc, { name, size }];\n }\n\n return acc;\n }, [])\n ),\n list: data?.component.layouts.list,\n },\n settings: setIn(formData.settings, 'displayName', undefined),\n metadatas: meta,\n uid: model,\n });\n\n if ('data' in res) {\n toggleNotification({\n type: 'success',\n message: formatMessage({ id: 'notification.success.saved', defaultMessage: 'Saved' }),\n });\n } else {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(res.error),\n });\n }\n } catch {\n toggleNotification({\n type: 'danger',\n message: formatMessage({ id: 'notification.error', defaultMessage: 'An error occurred' }),\n });\n }\n };\n\n if (isLoading) {\n return <Page.Loading />;\n }\n\n if (error || errorSchema || !schema) {\n return <Page.Error />;\n }\n\n return (\n <>\n <Page.Title>{`Configure ${editLayout.settings.displayName} Edit View`}</Page.Title>\n <ConfigurationForm\n onSubmit={handleSubmit}\n attributes={schema.attributes}\n fieldSizes={fieldSizes}\n layout={editLayout}\n />\n </>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * Header\n * -----------------------------------------------------------------------------------------------*/\n\nconst formatEditLayout = (\n data: FindComponentConfiguration.Response['data'],\n { schema, components }: { schema?: Component; components: ComponentsDictionary }\n) => {\n const editAttributes = convertEditLayoutToFieldLayouts(\n data.component.layouts.edit,\n schema?.attributes,\n data.component.metadatas,\n { configurations: data.components, schemas: components }\n );\n\n const componentEditAttributes = Object.entries(data.components).reduce<EditLayout['components']>(\n (acc, [uid, configuration]) => {\n acc[uid] = {\n layout: convertEditLayoutToFieldLayouts(\n configuration.layouts.edit,\n components[uid].attributes,\n configuration.metadatas\n ),\n settings: {\n ...configuration.settings,\n icon: components[uid].info.icon,\n displayName: components[uid].info.displayName,\n },\n };\n return acc;\n },\n {}\n );\n\n const editMetadatas = Object.entries(data.component.metadatas).reduce<EditLayout['metadatas']>(\n (acc, [attribute, metadata]) => {\n return {\n ...acc,\n [attribute]: metadata.edit,\n };\n },\n {}\n );\n\n return {\n layout: [editAttributes],\n components: componentEditAttributes,\n metadatas: editMetadatas,\n options: {\n ...schema?.options,\n ...schema?.pluginOptions,\n },\n settings: {\n ...data.component.settings,\n displayName: schema?.info.displayName,\n },\n };\n};\n\n/* -------------------------------------------------------------------------------------------------\n * Header\n * -----------------------------------------------------------------------------------------------*/\n\nconst ProtectedComponentConfigurationPage = () => {\n const permissions = useTypedSelector(\n (state) => state.admin_app.permissions.contentManager?.componentsConfigurations\n );\n\n return (\n <Page.Protect permissions={permissions}>\n <ComponentConfigurationPage />\n </Page.Protect>\n );\n};\n\nexport { ComponentConfigurationPage, ProtectedComponentConfigurationPage };\n"],"names":["componentsApi","contentManagerApi","injectEndpoints","endpoints","builder","getComponentConfiguration","query","uid","transformResponse","response","data","providesTags","_result","_error","type","id","updateComponentConfiguration","mutation","body","url","method","invalidatesTags","useGetComponentConfigurationQuery","useUpdateComponentConfigurationMutation","ComponentConfigurationPage","slug","model","useParams","toggleNotification","useNotification","formatMessage","useIntl","_unstableFormatAPIError","formatAPIError","useAPIErrorHandler","components","fieldSizes","schema","error","errorSchema","isLoading","isLoadingSchema","isFetching","isFetchingSchema","useGetInitialDataQuery","undefined","selectFromResult","res","find","ct","componentsByKey","reduce","acc","component","extractContentTypeComponents","attributes","Object","entries","attributeName","default","size","React","useEffect","message","isLoadingConfig","isFetchingConfig","editLayout","useMemo","formatEditLayout","layout","metadatas","options","settings","DEFAULT_SETTINGS","updateConfiguration","handleSubmit","formData","meta","name","edit","list","__temp_key__","_size","_name","editedMetadata","flatMap","row","children","field","layouts","map","TEMP_FIELD_NAME","setIn","defaultMessage","_jsx","Page","Loading","Error","_jsxs","_Fragment","Title","displayName","ConfigurationForm","onSubmit","editAttributes","convertEditLayoutToFieldLayouts","configurations","schemas","componentEditAttributes","configuration","icon","info","editMetadatas","attribute","metadata","pluginOptions","ProtectedComponentConfigurationPage","permissions","useTypedSelector","state","admin_app","contentManager","componentsConfigurations","Protect"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAMA,aAAAA,GAAgBC,uBAAkBC,CAAAA,eAAe,CAAC;IACtDC,SAAW,EAAA,CAACC,WAAa;YACvBC,yBAA2BD,EAAAA,OAAAA,CAAQE,KAAK,CAGtC;AACAA,gBAAAA,KAAAA,EAAO,CAACC,GAAQ,GAAA,CAAC,4BAA4B,EAAEA,GAAAA,CAAI,cAAc,CAAC;gBAClEC,iBAAmB,EAAA,CAACC,QAAkDA,GAAAA,QAAAA,CAASC,IAAI;gBACnFC,YAAc,EAAA,CAACC,OAASC,EAAAA,MAAAA,EAAQN,GAAQ,GAAA;AAAC,wBAAA;4BA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AWC,QAAS,CAAA,GAAA;QACzB,OAAO;AACL,YAAA,GAAG9D,GAAG;YACN,CAAC6D,SAAAA,GAAYC,QAAAA,CAASnC;AACxB,SAAA;AACF,KAAA,EACA,EAAC,CAAA;IAGH,OAAO;QACLV,MAAQ,EAAA;AAACmC,YAAAA;AAAe,SAAA;QACxBrE,UAAYyE,EAAAA,uBAAAA;QACZtC,SAAW0C,EAAAA,aAAAA;QACXzC,OAAS,EAAA;AACP,YAAA,GAAGlC,QAAQkC,OAAO;AAClB,YAAA,GAAGlC,QAAQ8E;AACb,SAAA;QACA3C,QAAU,EAAA;YACR,GAAG9D,IAAAA,CAAK2C,SAAS,CAACmB,QAAQ;AAC1B6B,YAAAA,WAAAA,EAAahE,QAAQ0E,IAAKV,CAAAA;AAC5B;AACF,KAAA;AACF,CAAA;AAEA;;AAEkG,2GAE5Fe,mCAAsC,GAAA,IAAA;IAC1C,MAAMC,WAAAA,GAAcC,sBAClB,CAAA,CAACC,KAAUA,GAAAA,KAAAA,CAAMC,SAAS,CAACH,WAAW,CAACI,cAAc,EAAEC,wBAAAA,CAAAA;IAGzD,qBACE5B,cAAA,CAACC,iBAAK4B,OAAO,EAAA;QAACN,WAAaA,EAAAA,WAAAA;AACzB,QAAA,QAAA,gBAAAvB,cAACtE,CAAAA,0BAAAA,EAAAA,EAAAA;;AAGP;;;;;"}
1
+ {"version":3,"file":"ComponentConfigurationPage-BBCYsnnE.js","sources":["../../../admin/src/services/components.ts","../../../admin/src/pages/ComponentConfigurationPage.tsx"],"sourcesContent":["import { contentManagerApi } from './api';\n\nimport type {\n FindComponentConfiguration,\n UpdateComponentConfiguration,\n} from '../../../shared/contracts/components';\n\nconst componentsApi = contentManagerApi.injectEndpoints({\n endpoints: (builder) => ({\n getComponentConfiguration: builder.query<\n FindComponentConfiguration.Response['data'],\n FindComponentConfiguration.Params['uid']\n >({\n query: (uid) => `/content-manager/components/${uid}/configuration`,\n transformResponse: (response: FindComponentConfiguration.Response) => response.data,\n providesTags: (_result, _error, uid) => [{ type: 'ComponentConfiguration', id: uid }],\n }),\n updateComponentConfiguration: builder.mutation({\n query: ({ uid, ...body }) => ({\n url: `/content-manager/components/${uid}/configuration`,\n method: 'PUT',\n data: body,\n }),\n transformResponse: (response: UpdateComponentConfiguration.Response) => response.data,\n invalidatesTags: (_result, _error, { uid }) => [\n { type: 'ComponentConfiguration', id: uid },\n // otherwise layouts already fetched will have stale component configuration data.\n { type: 'ContentTypeSettings', id: 'LIST' },\n ],\n }),\n }),\n});\n\nconst { useGetComponentConfigurationQuery, useUpdateComponentConfigurationMutation } =\n componentsApi;\n\nexport { useGetComponentConfigurationQuery, useUpdateComponentConfigurationMutation };\n","import * as React from 'react';\n\nimport { Page, useNotification, useAPIErrorHandler } from '@strapi/admin/strapi-admin';\nimport { useIntl } from 'react-intl';\nimport { useParams } from 'react-router-dom';\n\nimport { TEMP_FIELD_NAME } from '../components/ConfigurationForm/Fields';\nimport { ConfigurationForm, ConfigurationFormProps } from '../components/ConfigurationForm/Form';\nimport { ComponentsDictionary, extractContentTypeComponents } from '../hooks/useContentTypeSchema';\nimport {\n DEFAULT_SETTINGS,\n EditLayout,\n convertEditLayoutToFieldLayouts,\n} from '../hooks/useDocumentLayout';\nimport { useTypedSelector } from '../modules/hooks';\nimport {\n useGetComponentConfigurationQuery,\n useUpdateComponentConfigurationMutation,\n} from '../services/components';\nimport { useGetInitialDataQuery } from '../services/init';\nimport { setIn } from '../utils/objects';\n\nimport type { Component, FindComponentConfiguration } from '../../../shared/contracts/components';\nimport type { Metadatas } from '../../../shared/contracts/content-types';\n\n/* -------------------------------------------------------------------------------------------------\n * ComponentConfigurationPage\n * -----------------------------------------------------------------------------------------------*/\n\nconst ComponentConfigurationPage = () => {\n /**\n * useDocumentLayout only works for documents, not components,\n * it feels weird to make that hook work for both when this is SUCH\n * a unique use case and we only do it here, so in short, we essentially\n * just extracted the logic to make an edit view layout and reproduced it here.\n */\n const { slug: model } = useParams<{ slug: string }>();\n const { toggleNotification } = useNotification();\n const { formatMessage } = useIntl();\n const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();\n\n const {\n components,\n fieldSizes,\n schema,\n error: errorSchema,\n isLoading: isLoadingSchema,\n isFetching: isFetchingSchema,\n } = useGetInitialDataQuery(undefined, {\n selectFromResult: (res) => {\n const schema = res.data?.components.find((ct) => ct.uid === model);\n\n const componentsByKey = res.data?.components.reduce<ComponentsDictionary>(\n (acc, component) => {\n acc[component.uid] = component;\n\n return acc;\n },\n {}\n );\n\n const components = extractContentTypeComponents(schema?.attributes, componentsByKey);\n\n const fieldSizes = Object.entries(res.data?.fieldSizes ?? {}).reduce<\n ConfigurationFormProps['fieldSizes']\n >((acc, [attributeName, { default: size }]) => {\n acc[attributeName] = size;\n\n return acc;\n }, {});\n\n return {\n isFetching: res.isFetching,\n isLoading: res.isLoading,\n error: res.error,\n components,\n schema,\n fieldSizes,\n };\n },\n });\n\n React.useEffect(() => {\n if (errorSchema) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(errorSchema),\n });\n }\n }, [errorSchema, formatAPIError, toggleNotification]);\n\n const {\n data,\n isLoading: isLoadingConfig,\n isFetching: isFetchingConfig,\n error,\n } = useGetComponentConfigurationQuery(model ?? '');\n\n React.useEffect(() => {\n if (error) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(error),\n });\n }\n }, [error, formatAPIError, toggleNotification]);\n\n /**\n * you **must** check if we're loading or fetching in case the component gets new props\n * but nothing was unmounted, it then becomes a fetch, not a load.\n */\n const isLoading = isLoadingConfig || isLoadingSchema || isFetchingConfig || isFetchingSchema;\n\n const editLayout = React.useMemo(\n () =>\n data && !isLoading\n ? formatEditLayout(data, { schema, components })\n : ({\n layout: [],\n components: {},\n metadatas: {},\n options: {},\n settings: DEFAULT_SETTINGS,\n } as EditLayout),\n [data, isLoading, schema, components]\n );\n\n const [updateConfiguration] = useUpdateComponentConfigurationMutation();\n const handleSubmit: ConfigurationFormProps['onSubmit'] = async (formData) => {\n try {\n /**\n * We reconstruct the metadatas object by taking the existing list metadatas\n * and re-merging that by attribute name with the current list metadatas, whilst overwriting\n * the data from the form we've built.\n */\n const meta = Object.entries(data?.component.metadatas ?? {}).reduce<Metadatas>(\n (acc, [name, { edit, list }]) => {\n const {\n __temp_key__,\n size: _size,\n name: _name,\n ...editedMetadata\n } = formData.layout.flatMap((row) => row.children).find((field) => field.name === name) ??\n {};\n\n acc[name] = {\n edit: {\n ...edit,\n ...editedMetadata,\n },\n list,\n };\n\n return acc;\n },\n {}\n );\n\n const res = await updateConfiguration({\n layouts: {\n edit: formData.layout.map((row) =>\n row.children.reduce<Array<{ name: string; size: number }>>((acc, { name, size }) => {\n if (name !== TEMP_FIELD_NAME) {\n return [...acc, { name, size }];\n }\n\n return acc;\n }, [])\n ),\n list: data?.component.layouts.list,\n },\n settings: setIn(formData.settings, 'displayName', undefined),\n metadatas: meta,\n uid: model,\n });\n\n if ('data' in res) {\n toggleNotification({\n type: 'success',\n message: formatMessage({ id: 'notification.success.saved', defaultMessage: 'Saved' }),\n });\n } else {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(res.error),\n });\n }\n } catch {\n toggleNotification({\n type: 'danger',\n message: formatMessage({ id: 'notification.error', defaultMessage: 'An error occurred' }),\n });\n }\n };\n\n if (isLoading) {\n return <Page.Loading />;\n }\n\n if (error || errorSchema || !schema) {\n return <Page.Error />;\n }\n\n return (\n <>\n <Page.Title>{`Configure ${editLayout.settings.displayName} Edit View`}</Page.Title>\n <ConfigurationForm\n onSubmit={handleSubmit}\n attributes={schema.attributes}\n fieldSizes={fieldSizes}\n layout={editLayout}\n />\n </>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * Header\n * -----------------------------------------------------------------------------------------------*/\n\nconst formatEditLayout = (\n data: FindComponentConfiguration.Response['data'],\n { schema, components }: { schema?: Component; components: ComponentsDictionary }\n) => {\n const editAttributes = convertEditLayoutToFieldLayouts(\n data.component.layouts.edit,\n schema?.attributes,\n data.component.metadatas,\n { configurations: data.components, schemas: components }\n );\n\n const componentEditAttributes = Object.entries(data.components).reduce<EditLayout['components']>(\n (acc, [uid, configuration]) => {\n acc[uid] = {\n layout: convertEditLayoutToFieldLayouts(\n configuration.layouts.edit,\n components[uid].attributes,\n configuration.metadatas\n ),\n settings: {\n ...configuration.settings,\n icon: components[uid].info.icon,\n displayName: components[uid].info.displayName,\n },\n };\n return acc;\n },\n {}\n );\n\n const editMetadatas = Object.entries(data.component.metadatas).reduce<EditLayout['metadatas']>(\n (acc, [attribute, metadata]) => {\n return {\n ...acc,\n [attribute]: metadata.edit,\n };\n },\n {}\n );\n\n return {\n layout: [editAttributes],\n components: componentEditAttributes,\n metadatas: editMetadatas,\n options: {\n ...schema?.options,\n ...schema?.pluginOptions,\n },\n settings: {\n ...data.component.settings,\n displayName: schema?.info.displayName,\n },\n };\n};\n\n/* -------------------------------------------------------------------------------------------------\n * Header\n * -----------------------------------------------------------------------------------------------*/\n\nconst ProtectedComponentConfigurationPage = () => {\n const permissions = useTypedSelector(\n (state) => state.admin_app.permissions.contentManager?.componentsConfigurations\n );\n\n return (\n <Page.Protect permissions={permissions}>\n <ComponentConfigurationPage />\n </Page.Protect>\n );\n};\n\nexport { ComponentConfigurationPage, ProtectedComponentConfigurationPage };\n"],"names":["componentsApi","contentManagerApi","injectEndpoints","endpoints","builder","getComponentConfiguration","query","uid","transformResponse","response","data","providesTags","_result","_error","type","id","updateComponentConfiguration","mutation","body","url","method","invalidatesTags","useGetComponentConfigurationQuery","useUpdateComponentConfigurationMutation","ComponentConfigurationPage","slug","model","useParams","toggleNotification","useNotification","formatMessage","useIntl","_unstableFormatAPIError","formatAPIError","useAPIErrorHandler","components","fieldSizes","schema","error","errorSchema","isLoading","isLoadingSchema","isFetching","isFetchingSchema","useGetInitialDataQuery","undefined","selectFromResult","res","find","ct","componentsByKey","reduce","acc","component","extractContentTypeComponents","attributes","Object","entries","attributeName","default","size","React","useEffect","message","isLoadingConfig","isFetchingConfig","editLayout","useMemo","formatEditLayout","layout","metadatas","options","settings","DEFAULT_SETTINGS","updateConfiguration","handleSubmit","formData","meta","name","edit","list","__temp_key__","_size","_name","editedMetadata","flatMap","row","children","field","layouts","map","TEMP_FIELD_NAME","setIn","defaultMessage","_jsx","Page","Loading","Error","_jsxs","_Fragment","Title","displayName","ConfigurationForm","onSubmit","editAttributes","convertEditLayoutToFieldLayouts","configurations","schemas","componentEditAttributes","configuration","icon","info","editMetadatas","attribute","metadata","pluginOptions","ProtectedComponentConfigurationPage","permissions","useTypedSelector","state","admin_app","contentManager","componentsConfigurations","Protect"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAMA,aAAAA,GAAgBC,uBAAkBC,CAAAA,eAAe,CAAC;IACtDC,SAAW,EAAA,CAACC,WAAa;YACvBC,yBAA2BD,EAAAA,OAAAA,CAAQE,KAAK,CAGtC;AACAA,gBAAAA,KAAAA,EAAO,CAACC,GAAQ,GAAA,CAAC,4BAA4B,EAAEA,GAAAA,CAAI,cAAc,CAAC;gBAClEC,iBAAmB,EAAA,CAACC,QAAkDA,GAAAA,QAAAA,CAASC,IAAI;gBACnFC,YAAc,EAAA,CAACC,OAASC,EAAAA,MAAAA,EAAQN,GAAQ,GAAA;AAAC,wBAAA;4BAAEO,IAAM,EAAA,wBAAA;4BAA0BC,EAAIR,EAAAA;AAAI;AAAE;AACvF,aAAA,CAAA;YACAS,4BAA8BZ,EAAAA,OAAAA,CAAQa,QAAQ,CAAC;AAC7CX,gBAAAA,KAAAA,EAAO,CAAC,EAAEC,GAAG,EAAE,GAAGW,IAAAA,EAAM,IAAM;AAC5BC,wBAAAA,GAAAA,EAAK,CAAC,4BAA4B,EAAEZ,GAAAA,CAAI,cAAc,CAAC;wBACvDa,MAAQ,EAAA,KAAA;wBACRV,IAAMQ,EAAAA;qBACR,CAAA;gBACAV,iBAAmB,EAAA,CAACC,QAAoDA,GAAAA,QAAAA,CAASC,IAAI;AACrFW,g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;AAC1B6B,YAAAA,WAAAA,EAAahE,QAAQ0E,IAAKV,CAAAA;AAC5B;AACF,KAAA;AACF,CAAA;AAEA;;AAEkG,2GAE5Fe,mCAAsC,GAAA,IAAA;IAC1C,MAAMC,WAAAA,GAAcC,sBAClB,CAAA,CAACC,KAAUA,GAAAA,KAAAA,CAAMC,SAAS,CAACH,WAAW,CAACI,cAAc,EAAEC,wBAAAA,CAAAA;IAGzD,qBACE5B,cAAA,CAACC,iBAAK4B,OAAO,EAAA;QAACN,WAAaA,EAAAA,WAAAA;AACzB,QAAA,QAAA,gBAAAvB,cAACtE,CAAAA,0BAAAA,EAAAA,EAAAA;;AAGP;;;;;"}
@@ -3,8 +3,8 @@ import * as React from 'react';
3
3
  import { useNotification, useAPIErrorHandler, Page } from '@strapi/admin/strapi-admin';
4
4
  import { useIntl } from 'react-intl';
5
5
  import { useParams } from 'react-router-dom';
6
- import { C as ConfigurationForm, T as TEMP_FIELD_NAME } from './Form-DTO0ZIaB.mjs';
7
- import { e as contentManagerApi, a as useGetInitialDataQuery, F as extractContentTypeComponents, G as DEFAULT_SETTINGS, J as convertEditLayoutToFieldLayouts } from './index-Cs6qwFQu.mjs';
6
+ import { C as ConfigurationForm, T as TEMP_FIELD_NAME } from './Form-rQQtxfmF.mjs';
7
+ import { e as contentManagerApi, a as useGetInitialDataQuery, F as extractContentTypeComponents, G as DEFAULT_SETTINGS, J as convertEditLayoutToFieldLayouts } from './index-BkM_Z7pU.mjs';
8
8
  import { u as useTypedSelector } from './hooks-DMvik5y_.mjs';
9
9
  import { s as setIn } from './objects-wl73iEma.mjs';
10
10
  import '@strapi/design-system';
@@ -274,4 +274,4 @@ const { useGetComponentConfigurationQuery, useUpdateComponentConfigurationMutati
274
274
  };
275
275
 
276
276
  export { ComponentConfigurationPage, ProtectedComponentConfigurationPage };
277
- //# sourceMappingURL=ComponentConfigurationPage-BN2kOtDm.mjs.map
277
+ //# sourceMappingURL=ComponentConfigurationPage-DNBN8tI3.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ComponentConfigurationPage-BN2kOtDm.mjs","sources":["../../../admin/src/services/components.ts","../../../admin/src/pages/ComponentConfigurationPage.tsx"],"sourcesContent":["import { contentManagerApi } from './api';\n\nimport type {\n FindComponentConfiguration,\n UpdateComponentConfiguration,\n} from '../../../shared/contracts/components';\n\nconst componentsApi = contentManagerApi.injectEndpoints({\n endpoints: (builder) => ({\n getComponentConfiguration: builder.query<\n FindComponentConfiguration.Response['data'],\n FindComponentConfiguration.Params['uid']\n >({\n query: (uid) => `/content-manager/components/${uid}/configuration`,\n transformResponse: (response: FindComponentConfiguration.Response) => response.data,\n providesTags: (_result, _error, uid) => [{ type: 'ComponentConfiguration', id: uid }],\n }),\n updateComponentConfiguration: builder.mutation({\n query: ({ uid, ...body }) => ({\n url: `/content-manager/components/${uid}/configuration`,\n method: 'PUT',\n data: body,\n }),\n transformResponse: (response: UpdateComponentConfiguration.Response) => response.data,\n invalidatesTags: (_result, _error, { uid }) => [\n { type: 'ComponentConfiguration', id: uid },\n // otherwise layouts already fetched will have stale component configuration data.\n { type: 'ContentTypeSettings', id: 'LIST' },\n ],\n }),\n }),\n});\n\nconst { useGetComponentConfigurationQuery, useUpdateComponentConfigurationMutation } =\n componentsApi;\n\nexport { useGetComponentConfigurationQuery, useUpdateComponentConfigurationMutation };\n","import * as React from 'react';\n\nimport { Page, useNotification, useAPIErrorHandler } from '@strapi/admin/strapi-admin';\nimport { useIntl } from 'react-intl';\nimport { useParams } from 'react-router-dom';\n\nimport { TEMP_FIELD_NAME } from '../components/ConfigurationForm/Fields';\nimport { ConfigurationForm, ConfigurationFormProps } from '../components/ConfigurationForm/Form';\nimport { ComponentsDictionary, extractContentTypeComponents } from '../hooks/useContentTypeSchema';\nimport {\n DEFAULT_SETTINGS,\n EditLayout,\n convertEditLayoutToFieldLayouts,\n} from '../hooks/useDocumentLayout';\nimport { useTypedSelector } from '../modules/hooks';\nimport {\n useGetComponentConfigurationQuery,\n useUpdateComponentConfigurationMutation,\n} from '../services/components';\nimport { useGetInitialDataQuery } from '../services/init';\nimport { setIn } from '../utils/objects';\n\nimport type { Component, FindComponentConfiguration } from '../../../shared/contracts/components';\nimport type { Metadatas } from '../../../shared/contracts/content-types';\n\n/* -------------------------------------------------------------------------------------------------\n * ComponentConfigurationPage\n * -----------------------------------------------------------------------------------------------*/\n\nconst ComponentConfigurationPage = () => {\n /**\n * useDocumentLayout only works for documents, not components,\n * it feels weird to make that hook work for both when this is SUCH\n * a unique use case and we only do it here, so in short, we essentially\n * just extracted the logic to make an edit view layout and reproduced it here.\n */\n const { slug: model } = useParams<{ slug: string }>();\n const { toggleNotification } = useNotification();\n const { formatMessage } = useIntl();\n const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();\n\n const {\n components,\n fieldSizes,\n schema,\n error: errorSchema,\n isLoading: isLoadingSchema,\n isFetching: isFetchingSchema,\n } = useGetInitialDataQuery(undefined, {\n selectFromResult: (res) => {\n const schema = res.data?.components.find((ct) => ct.uid === model);\n\n const componentsByKey = res.data?.components.reduce<ComponentsDictionary>(\n (acc, component) => {\n acc[component.uid] = component;\n\n return acc;\n },\n {}\n );\n\n const components = extractContentTypeComponents(schema?.attributes, componentsByKey);\n\n const fieldSizes = Object.entries(res.data?.fieldSizes ?? {}).reduce<\n ConfigurationFormProps['fieldSizes']\n >((acc, [attributeName, { default: size }]) => {\n acc[attributeName] = size;\n\n return acc;\n }, {});\n\n return {\n isFetching: res.isFetching,\n isLoading: res.isLoading,\n error: res.error,\n components,\n schema,\n fieldSizes,\n };\n },\n });\n\n React.useEffect(() => {\n if (errorSchema) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(errorSchema),\n });\n }\n }, [errorSchema, formatAPIError, toggleNotification]);\n\n const {\n data,\n isLoading: isLoadingConfig,\n isFetching: isFetchingConfig,\n error,\n } = useGetComponentConfigurationQuery(model ?? '');\n\n React.useEffect(() => {\n if (error) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(error),\n });\n }\n }, [error, formatAPIError, toggleNotification]);\n\n /**\n * you **must** check if we're loading or fetching in case the component gets new props\n * but nothing was unmounted, it then becomes a fetch, not a load.\n */\n const isLoading = isLoadingConfig || isLoadingSchema || isFetchingConfig || isFetchingSchema;\n\n const editLayout = React.useMemo(\n () =>\n data && !isLoading\n ? formatEditLayout(data, { schema, components })\n : ({\n layout: [],\n components: {},\n metadatas: {},\n options: {},\n settings: DEFAULT_SETTINGS,\n } as EditLayout),\n [data, isLoading, schema, components]\n );\n\n const [updateConfiguration] = useUpdateComponentConfigurationMutation();\n const handleSubmit: ConfigurationFormProps['onSubmit'] = async (formData) => {\n try {\n /**\n * We reconstruct the metadatas object by taking the existing list metadatas\n * and re-merging that by attribute name with the current list metadatas, whilst overwriting\n * the data from the form we've built.\n */\n const meta = Object.entries(data?.component.metadatas ?? {}).reduce<Metadatas>(\n (acc, [name, { edit, list }]) => {\n const {\n __temp_key__,\n size: _size,\n name: _name,\n ...editedMetadata\n } = formData.layout.flatMap((row) => row.children).find((field) => field.name === name) ??\n {};\n\n acc[name] = {\n edit: {\n ...edit,\n ...editedMetadata,\n },\n list,\n };\n\n return acc;\n },\n {}\n );\n\n const res = await updateConfiguration({\n layouts: {\n edit: formData.layout.map((row) =>\n row.children.reduce<Array<{ name: string; size: number }>>((acc, { name, size }) => {\n if (name !== TEMP_FIELD_NAME) {\n return [...acc, { name, size }];\n }\n\n return acc;\n }, [])\n ),\n list: data?.component.layouts.list,\n },\n settings: setIn(formData.settings, 'displayName', undefined),\n metadatas: meta,\n uid: model,\n });\n\n if ('data' in res) {\n toggleNotification({\n type: 'success',\n message: formatMessage({ id: 'notification.success.saved', defaultMessage: 'Saved' }),\n });\n } else {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(res.error),\n });\n }\n } catch {\n toggleNotification({\n type: 'danger',\n message: formatMessage({ id: 'notification.error', defaultMessage: 'An error occurred' }),\n });\n }\n };\n\n if (isLoading) {\n return <Page.Loading />;\n }\n\n if (error || errorSchema || !schema) {\n return <Page.Error />;\n }\n\n return (\n <>\n <Page.Title>{`Configure ${editLayout.settings.displayName} Edit View`}</Page.Title>\n <ConfigurationForm\n onSubmit={handleSubmit}\n attributes={schema.attributes}\n fieldSizes={fieldSizes}\n layout={editLayout}\n />\n </>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * Header\n * -----------------------------------------------------------------------------------------------*/\n\nconst formatEditLayout = (\n data: FindComponentConfiguration.Response['data'],\n { schema, components }: { schema?: Component; components: ComponentsDictionary }\n) => {\n const editAttributes = convertEditLayoutToFieldLayouts(\n data.component.layouts.edit,\n schema?.attributes,\n data.component.metadatas,\n { configurations: data.components, schemas: components }\n );\n\n const componentEditAttributes = Object.entries(data.components).reduce<EditLayout['components']>(\n (acc, [uid, configuration]) => {\n acc[uid] = {\n layout: convertEditLayoutToFieldLayouts(\n configuration.layouts.edit,\n components[uid].attributes,\n configuration.metadatas\n ),\n settings: {\n ...configuration.settings,\n icon: components[uid].info.icon,\n displayName: components[uid].info.displayName,\n },\n };\n return acc;\n },\n {}\n );\n\n const editMetadatas = Object.entries(data.component.metadatas).reduce<EditLayout['metadatas']>(\n (acc, [attribute, metadata]) => {\n return {\n ...acc,\n [attribute]: metadata.edit,\n };\n },\n {}\n );\n\n return {\n layout: [editAttributes],\n components: componentEditAttributes,\n metadatas: editMetadatas,\n options: {\n ...schema?.options,\n ...schema?.pluginOptions,\n },\n settings: {\n ...data.component.settings,\n displayName: schema?.info.displayName,\n },\n };\n};\n\n/* -------------------------------------------------------------------------------------------------\n * Header\n * -----------------------------------------------------------------------------------------------*/\n\nconst ProtectedComponentConfigurationPage = () => {\n const permissions = useTypedSelector(\n (state) => state.admin_app.permissions.contentManager?.componentsConfigurations\n );\n\n return (\n <Page.Protect permissions={permissions}>\n <ComponentConfigurationPage />\n </Page.Protect>\n );\n};\n\nexport { ComponentConfigurationPage, ProtectedComponentConfigurationPage };\n"],"names":["componentsApi","contentManagerApi","injectEndpoints","endpoints","builder","getComponentConfiguration","query","uid","transformResponse","response","data","providesTags","_result","_error","type","id","updateComponentConfiguration","mutation","body","url","method","invalidatesTags","useGetComponentConfigurationQuery","useUpdateComponentConfigurationMutation","ComponentConfigurationPage","slug","model","useParams","toggleNotification","useNotification","formatMessage","useIntl","_unstableFormatAPIError","formatAPIError","useAPIErrorHandler","components","fieldSizes","schema","error","errorSchema","isLoading","isLoadingSchema","isFetching","isFetchingSchema","useGetInitialDataQuery","undefined","selectFromResult","res","find","ct","componentsByKey","reduce","acc","component","extractContentTypeComponents","attributes","Object","entries","attributeName","default","size","React","useEffect","message","isLoadingConfig","isFetchingConfig","editLayout","useMemo","formatEditLayout","layout","metadatas","options","settings","DEFAULT_SETTINGS","updateConfiguration","handleSubmit","formData","meta","name","edit","list","__temp_key__","_size","_name","editedMetadata","flatMap","row","children","field","layouts","map","TEMP_FIELD_NAME","setIn","defaultMessage","_jsx","Page","Loading","Error","_jsxs","_Fragment","Title","displayName","ConfigurationForm","onSubmit","editAttributes","convertEditLayoutToFieldLayouts","configurations","schemas","componentEditAttributes","configuration","icon","info","editMetadatas","attribute","metadata","pluginOptions","ProtectedComponentConfigurationPage","permissions","useTypedSelector","state","admin_app","contentManager","componentsConfigurations","Protect"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAMA,aAAAA,GAAgBC,iBAAkBC,CAAAA,eAAe,CAAC;IACtDC,SAAW,EAAA,CAACC,WAAa;YACvBC,yBAA2BD,EAAAA,OAAAA,CAAQE,KAAK,CAGtC;AACAA,gBAAAA,KAAAA,EAAO,CAACC,GAAQ,GAAA,CAAC,4BAA4B,EAAEA,GAAAA,CAAI,cAAc,CAAC;gBAClEC,iBAAmB,EAAA,CAACC,QAAkDA,GAAAA,QAAAA,CAASC,IAAI;gBACnFC,YAAc,EAAA,CAACC,OAASC,EAAAA,MAAAA,EAAQN,GAAQ,GAAA;AAAC,wBAAA;4BAAEO,IAAM,EAAA,wBAAA;4BAA0BC,EAAIR,EAA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G;YACN,CAAC6D,SAAAA,GAAYC,QAAAA,CAASnC;AACxB,SAAA;AACF,KAAA,EACA,EAAC,CAAA;IAGH,OAAO;QACLV,MAAQ,EAAA;AAACmC,YAAAA;AAAe,SAAA;QACxBrE,UAAYyE,EAAAA,uBAAAA;QACZtC,SAAW0C,EAAAA,aAAAA;QACXzC,OAAS,EAAA;AACP,YAAA,GAAGlC,QAAQkC,OAAO;AAClB,YAAA,GAAGlC,QAAQ8E;AACb,SAAA;QACA3C,QAAU,EAAA;YACR,GAAG9D,IAAAA,CAAK2C,SAAS,CAACmB,QAAQ;AAC1B6B,YAAAA,WAAAA,EAAahE,QAAQ0E,IAAKV,CAAAA;AAC5B;AACF,KAAA;AACF,CAAA;AAEA;;AAEkG,2GAE5Fe,mCAAsC,GAAA,IAAA;IAC1C,MAAMC,WAAAA,GAAcC,gBAClB,CAAA,CAACC,KAAUA,GAAAA,KAAAA,CAAMC,SAAS,CAACH,WAAW,CAACI,cAAc,EAAEC,wBAAAA,CAAAA;IAGzD,qBACE5B,GAAA,CAACC,KAAK4B,OAAO,EAAA;QAACN,WAAaA,EAAAA,WAAAA;AACzB,QAAA,QAAA,gBAAAvB,GAACtE,CAAAA,0BAAAA,EAAAA,EAAAA;;AAGP;;;;"}
1
+ {"version":3,"file":"ComponentConfigurationPage-DNBN8tI3.mjs","sources":["../../../admin/src/services/components.ts","../../../admin/src/pages/ComponentConfigurationPage.tsx"],"sourcesContent":["import { contentManagerApi } from './api';\n\nimport type {\n FindComponentConfiguration,\n UpdateComponentConfiguration,\n} from '../../../shared/contracts/components';\n\nconst componentsApi = contentManagerApi.injectEndpoints({\n endpoints: (builder) => ({\n getComponentConfiguration: builder.query<\n FindComponentConfiguration.Response['data'],\n FindComponentConfiguration.Params['uid']\n >({\n query: (uid) => `/content-manager/components/${uid}/configuration`,\n transformResponse: (response: FindComponentConfiguration.Response) => response.data,\n providesTags: (_result, _error, uid) => [{ type: 'ComponentConfiguration', id: uid }],\n }),\n updateComponentConfiguration: builder.mutation({\n query: ({ uid, ...body }) => ({\n url: `/content-manager/components/${uid}/configuration`,\n method: 'PUT',\n data: body,\n }),\n transformResponse: (response: UpdateComponentConfiguration.Response) => response.data,\n invalidatesTags: (_result, _error, { uid }) => [\n { type: 'ComponentConfiguration', id: uid },\n // otherwise layouts already fetched will have stale component configuration data.\n { type: 'ContentTypeSettings', id: 'LIST' },\n ],\n }),\n }),\n});\n\nconst { useGetComponentConfigurationQuery, useUpdateComponentConfigurationMutation } =\n componentsApi;\n\nexport { useGetComponentConfigurationQuery, useUpdateComponentConfigurationMutation };\n","import * as React from 'react';\n\nimport { Page, useNotification, useAPIErrorHandler } from '@strapi/admin/strapi-admin';\nimport { useIntl } from 'react-intl';\nimport { useParams } from 'react-router-dom';\n\nimport { TEMP_FIELD_NAME } from '../components/ConfigurationForm/Fields';\nimport { ConfigurationForm, ConfigurationFormProps } from '../components/ConfigurationForm/Form';\nimport { ComponentsDictionary, extractContentTypeComponents } from '../hooks/useContentTypeSchema';\nimport {\n DEFAULT_SETTINGS,\n EditLayout,\n convertEditLayoutToFieldLayouts,\n} from '../hooks/useDocumentLayout';\nimport { useTypedSelector } from '../modules/hooks';\nimport {\n useGetComponentConfigurationQuery,\n useUpdateComponentConfigurationMutation,\n} from '../services/components';\nimport { useGetInitialDataQuery } from '../services/init';\nimport { setIn } from '../utils/objects';\n\nimport type { Component, FindComponentConfiguration } from '../../../shared/contracts/components';\nimport type { Metadatas } from '../../../shared/contracts/content-types';\n\n/* -------------------------------------------------------------------------------------------------\n * ComponentConfigurationPage\n * -----------------------------------------------------------------------------------------------*/\n\nconst ComponentConfigurationPage = () => {\n /**\n * useDocumentLayout only works for documents, not components,\n * it feels weird to make that hook work for both when this is SUCH\n * a unique use case and we only do it here, so in short, we essentially\n * just extracted the logic to make an edit view layout and reproduced it here.\n */\n const { slug: model } = useParams<{ slug: string }>();\n const { toggleNotification } = useNotification();\n const { formatMessage } = useIntl();\n const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();\n\n const {\n components,\n fieldSizes,\n schema,\n error: errorSchema,\n isLoading: isLoadingSchema,\n isFetching: isFetchingSchema,\n } = useGetInitialDataQuery(undefined, {\n selectFromResult: (res) => {\n const schema = res.data?.components.find((ct) => ct.uid === model);\n\n const componentsByKey = res.data?.components.reduce<ComponentsDictionary>(\n (acc, component) => {\n acc[component.uid] = component;\n\n return acc;\n },\n {}\n );\n\n const components = extractContentTypeComponents(schema?.attributes, componentsByKey);\n\n const fieldSizes = Object.entries(res.data?.fieldSizes ?? {}).reduce<\n ConfigurationFormProps['fieldSizes']\n >((acc, [attributeName, { default: size }]) => {\n acc[attributeName] = size;\n\n return acc;\n }, {});\n\n return {\n isFetching: res.isFetching,\n isLoading: res.isLoading,\n error: res.error,\n components,\n schema,\n fieldSizes,\n };\n },\n });\n\n React.useEffect(() => {\n if (errorSchema) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(errorSchema),\n });\n }\n }, [errorSchema, formatAPIError, toggleNotification]);\n\n const {\n data,\n isLoading: isLoadingConfig,\n isFetching: isFetchingConfig,\n error,\n } = useGetComponentConfigurationQuery(model ?? '');\n\n React.useEffect(() => {\n if (error) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(error),\n });\n }\n }, [error, formatAPIError, toggleNotification]);\n\n /**\n * you **must** check if we're loading or fetching in case the component gets new props\n * but nothing was unmounted, it then becomes a fetch, not a load.\n */\n const isLoading = isLoadingConfig || isLoadingSchema || isFetchingConfig || isFetchingSchema;\n\n const editLayout = React.useMemo(\n () =>\n data && !isLoading\n ? formatEditLayout(data, { schema, components })\n : ({\n layout: [],\n components: {},\n metadatas: {},\n options: {},\n settings: DEFAULT_SETTINGS,\n } as EditLayout),\n [data, isLoading, schema, components]\n );\n\n const [updateConfiguration] = useUpdateComponentConfigurationMutation();\n const handleSubmit: ConfigurationFormProps['onSubmit'] = async (formData) => {\n try {\n /**\n * We reconstruct the metadatas object by taking the existing list metadatas\n * and re-merging that by attribute name with the current list metadatas, whilst overwriting\n * the data from the form we've built.\n */\n const meta = Object.entries(data?.component.metadatas ?? {}).reduce<Metadatas>(\n (acc, [name, { edit, list }]) => {\n const {\n __temp_key__,\n size: _size,\n name: _name,\n ...editedMetadata\n } = formData.layout.flatMap((row) => row.children).find((field) => field.name === name) ??\n {};\n\n acc[name] = {\n edit: {\n ...edit,\n ...editedMetadata,\n },\n list,\n };\n\n return acc;\n },\n {}\n );\n\n const res = await updateConfiguration({\n layouts: {\n edit: formData.layout.map((row) =>\n row.children.reduce<Array<{ name: string; size: number }>>((acc, { name, size }) => {\n if (name !== TEMP_FIELD_NAME) {\n return [...acc, { name, size }];\n }\n\n return acc;\n }, [])\n ),\n list: data?.component.layouts.list,\n },\n settings: setIn(formData.settings, 'displayName', undefined),\n metadatas: meta,\n uid: model,\n });\n\n if ('data' in res) {\n toggleNotification({\n type: 'success',\n message: formatMessage({ id: 'notification.success.saved', defaultMessage: 'Saved' }),\n });\n } else {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(res.error),\n });\n }\n } catch {\n toggleNotification({\n type: 'danger',\n message: formatMessage({ id: 'notification.error', defaultMessage: 'An error occurred' }),\n });\n }\n };\n\n if (isLoading) {\n return <Page.Loading />;\n }\n\n if (error || errorSchema || !schema) {\n return <Page.Error />;\n }\n\n return (\n <>\n <Page.Title>{`Configure ${editLayout.settings.displayName} Edit View`}</Page.Title>\n <ConfigurationForm\n onSubmit={handleSubmit}\n attributes={schema.attributes}\n fieldSizes={fieldSizes}\n layout={editLayout}\n />\n </>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * Header\n * -----------------------------------------------------------------------------------------------*/\n\nconst formatEditLayout = (\n data: FindComponentConfiguration.Response['data'],\n { schema, components }: { schema?: Component; components: ComponentsDictionary }\n) => {\n const editAttributes = convertEditLayoutToFieldLayouts(\n data.component.layouts.edit,\n schema?.attributes,\n data.component.metadatas,\n { configurations: data.components, schemas: components }\n );\n\n const componentEditAttributes = Object.entries(data.components).reduce<EditLayout['components']>(\n (acc, [uid, configuration]) => {\n acc[uid] = {\n layout: convertEditLayoutToFieldLayouts(\n configuration.layouts.edit,\n components[uid].attributes,\n configuration.metadatas\n ),\n settings: {\n ...configuration.settings,\n icon: components[uid].info.icon,\n displayName: components[uid].info.displayName,\n },\n };\n return acc;\n },\n {}\n );\n\n const editMetadatas = Object.entries(data.component.metadatas).reduce<EditLayout['metadatas']>(\n (acc, [attribute, metadata]) => {\n return {\n ...acc,\n [attribute]: metadata.edit,\n };\n },\n {}\n );\n\n return {\n layout: [editAttributes],\n components: componentEditAttributes,\n metadatas: editMetadatas,\n options: {\n ...schema?.options,\n ...schema?.pluginOptions,\n },\n settings: {\n ...data.component.settings,\n displayName: schema?.info.displayName,\n },\n };\n};\n\n/* -------------------------------------------------------------------------------------------------\n * Header\n * -----------------------------------------------------------------------------------------------*/\n\nconst ProtectedComponentConfigurationPage = () => {\n const permissions = useTypedSelector(\n (state) => state.admin_app.permissions.contentManager?.componentsConfigurations\n );\n\n return (\n <Page.Protect permissions={permissions}>\n <ComponentConfigurationPage />\n </Page.Protect>\n );\n};\n\nexport { ComponentConfigurationPage, ProtectedComponentConfigurationPage };\n"],"names":["componentsApi","contentManagerApi","injectEndpoints","endpoints","builder","getComponentConfiguration","query","uid","transformResponse","response","data","providesTags","_result","_error","type","id","updateComponentConfiguration","mutation","body","url","method","invalidatesTags","useGetComponentConfigurationQuery","useUpdateComponentConfigurationMutation","ComponentConfigurationPage","slug","model","useParams","toggleNotification","useNotification","formatMessage","useIntl","_unstableFormatAPIError","formatAPIError","useAPIErrorHandler","components","fieldSizes","schema","error","errorSchema","isLoading","isLoadingSchema","isFetching","isFetchingSchema","useGetInitialDataQuery","undefined","selectFromResult","res","find","ct","componentsByKey","reduce","acc","component","extractContentTypeComponents","attributes","Object","entries","attributeName","default","size","React","useEffect","message","isLoadingConfig","isFetchingConfig","editLayout","useMemo","formatEditLayout","layout","metadatas","options","settings","DEFAULT_SETTINGS","updateConfiguration","handleSubmit","formData","meta","name","edit","list","__temp_key__","_size","_name","editedMetadata","flatMap","row","children","field","layouts","map","TEMP_FIELD_NAME","setIn","defaultMessage","_jsx","Page","Loading","Error","_jsxs","_Fragment","Title","displayName","ConfigurationForm","onSubmit","editAttributes","convertEditLayoutToFieldLayouts","configurations","schemas","componentEditAttributes","configuration","icon","info","editMetadatas","attribute","metadata","pluginOptions","ProtectedComponentConfigurationPage","permissions","useTypedSelector","state","admin_app","contentManager","componentsConfigurations","Protect"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAMA,aAAAA,GAAgBC,iBAAkBC,CAAAA,eAAe,CAAC;IACtDC,SAAW,EAAA,CAACC,WAAa;YACvBC,yBAA2BD,EAAAA,OAAAA,CAAQE,KAAK,CAGtC;AACAA,gBAAAA,KAAAA,EAAO,CAACC,GAAQ,GAAA,CAAC,4BAA4B,EAAEA,GAAAA,CAAI,cAAc,CAAC;gBAClEC,iBAAmB,EAAA,CAACC,QAAkDA,GAAAA,QAAAA,CAASC,IAAI;gBACnFC,YAAc,EAAA,CAACC,OAASC,EAAAA,MAAAA,EAAQN,GAAQ,GAAA;AAAC,wBAAA;4BAAEO,IAAM,EAAA,wBAAA;4BAA0BC,EAAIR,EAAAA;AAAI;AAAE;AACvF,aAAA,CAAA;YACAS,4BAA8BZ,EAAAA,OAAAA,CAAQa,QAAQ,CAAC;AAC7CX,gBAAAA,KAAAA,EAAO,CAAC,EAAEC,GAAG,EAAE,GAAGW,IAAAA,EAAM,IAAM;AAC5BC,wBAAAA,GAAAA,EAAK,CAAC,4BAA4B,EAAEZ,GAAAA,CAAI,cAAc,CAAC;wBACvDa,MAAQ,EAAA,KAAA;wBACRV,IAAMQ,EAAAA;qBACR,CAAA;gBACAV,iBAAmB,EAAA,CAACC,QAAoDA,GAAAA,QAAAA,CAASC,IAAI;AACrFW,gBAAAA,eAAAA,EAAiB,CAACT,OAASC,EAAAA,MAAAA,EAAQ,EAAEN,GAAG,EAAE,GAAK;AA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kG,2GAE5Fe,mCAAsC,GAAA,IAAA;IAC1C,MAAMC,WAAAA,GAAcC,gBAClB,CAAA,CAACC,KAAUA,GAAAA,KAAAA,CAAMC,SAAS,CAACH,WAAW,CAACI,cAAc,EAAEC,wBAAAA,CAAAA;IAGzD,qBACE5B,GAAA,CAACC,KAAK4B,OAAO,EAAA;QAACN,WAAaA,EAAAA,WAAAA;AACzB,QAAA,QAAA,gBAAAvB,GAACtE,CAAAA,0BAAAA,EAAAA,EAAAA;;AAGP;;;;"}
@@ -2,8 +2,8 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
  import { useTracking, useNotification, useAPIErrorHandler, Page } from '@strapi/admin/strapi-admin';
4
4
  import { useIntl } from 'react-intl';
5
- import { C as ConfigurationForm, T as TEMP_FIELD_NAME } from './Form-DTO0ZIaB.mjs';
6
- import { c as useDoc, m as useDocLayout, a as useGetInitialDataQuery, A as useUpdateContentTypeConfigurationMutation } from './index-Cs6qwFQu.mjs';
5
+ import { C as ConfigurationForm, T as TEMP_FIELD_NAME } from './Form-rQQtxfmF.mjs';
6
+ import { c as useDoc, m as useDocLayout, a as useGetInitialDataQuery, A as useUpdateContentTypeConfigurationMutation } from './index-BkM_Z7pU.mjs';
7
7
  import { u as useTypedSelector } from './hooks-DMvik5y_.mjs';
8
8
  import { s as setIn } from './objects-wl73iEma.mjs';
9
9
  import '@strapi/design-system';
@@ -156,4 +156,4 @@ const ProtectedEditConfigurationPage = ()=>{
156
156
  };
157
157
 
158
158
  export { EditConfigurationPage, ProtectedEditConfigurationPage };
159
- //# sourceMappingURL=EditConfigurationPage-tMgOELQG.mjs.map
159
+ //# sourceMappingURL=EditConfigurationPage-CoivzF-x.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"EditConfigurationPage-tMgOELQG.mjs","sources":["../../../admin/src/pages/EditConfigurationPage.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Page, useNotification, useTracking, useAPIErrorHandler } from '@strapi/admin/strapi-admin';\nimport { useIntl } from 'react-intl';\n\nimport { TEMP_FIELD_NAME } from '../components/ConfigurationForm/Fields';\nimport { ConfigurationForm, ConfigurationFormProps } from '../components/ConfigurationForm/Form';\nimport { useDoc } from '../hooks/useDocument';\nimport { useDocLayout } from '../hooks/useDocumentLayout';\nimport { useTypedSelector } from '../modules/hooks';\nimport { useUpdateContentTypeConfigurationMutation } from '../services/contentTypes';\nimport { useGetInitialDataQuery } from '../services/init';\nimport { setIn } from '../utils/objects';\n\nimport type { Metadatas } from '../../../shared/contracts/content-types';\n\nconst EditConfigurationPage = () => {\n const { trackUsage } = useTracking();\n const { formatMessage } = useIntl();\n const { toggleNotification } = useNotification();\n const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();\n const { isLoading: isLoadingSchema, schema, model } = useDoc();\n const { isLoading: isLoadingLayout, error, list, edit } = useDocLayout();\n\n const {\n fieldSizes,\n error: errorFieldSizes,\n isLoading: isLoadingFieldSizes,\n isFetching: isFetchingFieldSizes,\n } = useGetInitialDataQuery(undefined, {\n selectFromResult: (res) => {\n const fieldSizes = Object.entries(res.data?.fieldSizes ?? {}).reduce<\n ConfigurationFormProps['fieldSizes']\n >((acc, [attributeName, { default: size }]) => {\n acc[attributeName] = size;\n\n return acc;\n }, {});\n\n return {\n isFetching: res.isFetching,\n isLoading: res.isLoading,\n error: res.error,\n fieldSizes,\n };\n },\n });\n\n React.useEffect(() => {\n if (errorFieldSizes) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(errorFieldSizes),\n });\n }\n }, [errorFieldSizes, formatAPIError, toggleNotification]);\n\n const isLoading =\n isLoadingSchema || isLoadingLayout || isLoadingFieldSizes || isFetchingFieldSizes;\n\n const [updateConfiguration] = useUpdateContentTypeConfigurationMutation();\n const handleSubmit: ConfigurationFormProps['onSubmit'] = async (data) => {\n try {\n trackUsage('willSaveContentTypeLayout');\n\n /**\n * We reconstruct the metadatas object by taking the existing list metadatas\n * and re-merging that by attribute name with the current list metadatas, whilst overwriting\n * the data from the form we've built.\n */\n const meta = Object.entries(list.metadatas).reduce<Metadatas>(\n (acc, [name, { mainField: _mainField, ...listMeta }]) => {\n const existingEditMeta = edit.metadatas[name];\n\n const {\n __temp_key__,\n size: _size,\n name: _name,\n ...editedMetadata\n } = data.layout.flatMap((row) => row.children).find((field) => field.name === name) ?? {};\n\n acc[name] = {\n edit: {\n ...existingEditMeta,\n ...editedMetadata,\n },\n list: listMeta,\n };\n\n return acc;\n },\n {}\n );\n\n const res = await updateConfiguration({\n layouts: {\n edit: data.layout.map((row) =>\n row.children.reduce<Array<{ name: string; size: number }>>((acc, { name, size }) => {\n if (name !== TEMP_FIELD_NAME) {\n return [...acc, { name, size }];\n }\n\n return acc;\n }, [])\n ),\n list: list.layout.map((field) => field.name),\n },\n settings: setIn(data.settings, 'displayName', undefined),\n metadatas: meta,\n uid: model,\n });\n\n if ('data' in res) {\n trackUsage('didEditEditSettings');\n toggleNotification({\n type: 'success',\n message: formatMessage({ id: 'notification.success.saved', defaultMessage: 'Saved' }),\n });\n } else {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(res.error),\n });\n }\n } catch {\n toggleNotification({\n type: 'danger',\n message: formatMessage({ id: 'notification.error', defaultMessage: 'An error occurred' }),\n });\n }\n };\n\n if (isLoading) {\n return <Page.Loading />;\n }\n\n if (errorFieldSizes || error || !schema) {\n return <Page.Error />;\n }\n\n return (\n <>\n <Page.Title>{`Configure ${edit.settings.displayName} Edit View`}</Page.Title>\n <ConfigurationForm\n onSubmit={handleSubmit}\n attributes={schema.attributes}\n fieldSizes={fieldSizes}\n layout={edit}\n />\n </>\n );\n};\n\nconst ProtectedEditConfigurationPage = () => {\n const permissions = useTypedSelector(\n (state) => state.admin_app.permissions.contentManager?.collectionTypesConfigurations\n );\n\n return (\n <Page.Protect permissions={permissions}>\n <EditConfigurationPage />\n </Page.Protect>\n );\n};\n\nexport { ProtectedEditConfigurationPage, EditConfigurationPage };\n"],"names":["EditConfigurationPage","trackUsage","useTracking","formatMessage","useIntl","toggleNotification","useNotification","_unstableFormatAPIError","formatAPIError","useAPIErrorHandler","isLoading","isLoadingSchema","schema","model","useDoc","isLoadingLayout","error","list","edit","useDocLayout","fieldSizes","errorFieldSizes","isLoadingFieldSizes","isFetching","isFetchingFieldSizes","useGetInitialDataQuery","undefined","selectFromResult","res","Object","entries","data","reduce","acc","attributeName","default","size","React","useEffect","type","message","updateConfiguration","useUpdateContentTypeConfigurationMutation","handleSubmit","meta","metadatas","name","mainField","_mainField","listMeta","existingEditMeta","__temp_key__","_size","_name","editedMetadata","layout","flatMap","row","children","find","field","layouts","map","TEMP_FIELD_NAME","settings","setIn","uid","id","defaultMessage","_jsx","Page","Loading","Error","_jsxs","_Fragment","Title","displayName","ConfigurationForm","onSubmit","attributes","ProtectedEditConfigurationPage","permissions","useTypedSelector","state","admin_app","contentManager","collectionTypesConfigurations","Protect"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAMA,qBAAwB,GAAA,IAAA;IAC5B,MAAM,EAAEC,UAAU,EAAE,GAAGC,WAAAA,EAAAA;IACvB,MAAM,EAAEC,aAAa,EAAE,GAAGC,OAAAA,EAAAA;IAC1B,MAAM,EAAEC,kBAAkB,EAAE,GAAGC,eAAAA,EAAAA;AAC/B,IAAA,MAAM,EAAEC,uBAAAA,EAAyBC,cAAc,EAAE,GAAGC,kBAAAA,EAAAA;IACpD,MAAM,EAAEC,WAAWC,eAAe,EAAEC,MAAM,EAAEC,KAAK,EAAE,GAAGC,MAAAA,EAAAA;IACtD,MAAM,EAAEJ,SAAWK,EAAAA,eAAe,EAAEC,KAAK,EAAEC,IAAI,EAAEC,IAAI,EAAE,GAAGC,YAAAA,EAAAA;AAE1D,IAAA,MAAM,EACJC,UAAU,EACVJ,KAAAA,EAAOK,eAAe,EACtBX,SAAAA,EAAWY,mBAAmB,EAC9BC,UAAYC,EAAAA,oBAAoB,EACjC,GAAGC,uBAAuBC,SAAW,EAAA;A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A;;;;AAIhB;AAEA,MAAM8D,8BAAiC,GAAA,IAAA;IACrC,MAAMC,WAAAA,GAAcC,gBAClB,CAAA,CAACC,KAAUA,GAAAA,KAAAA,CAAMC,SAAS,CAACH,WAAW,CAACI,cAAc,EAAEC,6BAAAA,CAAAA;IAGzD,qBACEjB,GAAA,CAACC,KAAKiB,OAAO,EAAA;QAACN,WAAaA,EAAAA,WAAAA;AACzB,QAAA,QAAA,gBAAAZ,GAACrE,CAAAA,qBAAAA,EAAAA,EAAAA;;AAGP;;;;"}
1
+ {"version":3,"file":"EditConfigurationPage-CoivzF-x.mjs","sources":["../../../admin/src/pages/EditConfigurationPage.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Page, useNotification, useTracking, useAPIErrorHandler } from '@strapi/admin/strapi-admin';\nimport { useIntl } from 'react-intl';\n\nimport { TEMP_FIELD_NAME } from '../components/ConfigurationForm/Fields';\nimport { ConfigurationForm, ConfigurationFormProps } from '../components/ConfigurationForm/Form';\nimport { useDoc } from '../hooks/useDocument';\nimport { useDocLayout } from '../hooks/useDocumentLayout';\nimport { useTypedSelector } from '../modules/hooks';\nimport { useUpdateContentTypeConfigurationMutation } from '../services/contentTypes';\nimport { useGetInitialDataQuery } from '../services/init';\nimport { setIn } from '../utils/objects';\n\nimport type { Metadatas } from '../../../shared/contracts/content-types';\n\nconst EditConfigurationPage = () => {\n const { trackUsage } = useTracking();\n const { formatMessage } = useIntl();\n const { toggleNotification } = useNotification();\n const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();\n const { isLoading: isLoadingSchema, schema, model } = useDoc();\n const { isLoading: isLoadingLayout, error, list, edit } = useDocLayout();\n\n const {\n fieldSizes,\n error: errorFieldSizes,\n isLoading: isLoadingFieldSizes,\n isFetching: isFetchingFieldSizes,\n } = useGetInitialDataQuery(undefined, {\n selectFromResult: (res) => {\n const fieldSizes = Object.entries(res.data?.fieldSizes ?? {}).reduce<\n ConfigurationFormProps['fieldSizes']\n >((acc, [attributeName, { default: size }]) => {\n acc[attributeName] = size;\n\n return acc;\n }, {});\n\n return {\n isFetching: res.isFetching,\n isLoading: res.isLoading,\n error: res.error,\n fieldSizes,\n };\n },\n });\n\n React.useEffect(() => {\n if (errorFieldSizes) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(errorFieldSizes),\n });\n }\n }, [errorFieldSizes, formatAPIError, toggleNotification]);\n\n const isLoading =\n isLoadingSchema || isLoadingLayout || isLoadingFieldSizes || isFetchingFieldSizes;\n\n const [updateConfiguration] = useUpdateContentTypeConfigurationMutation();\n const handleSubmit: ConfigurationFormProps['onSubmit'] = async (data) => {\n try {\n trackUsage('willSaveContentTypeLayout');\n\n /**\n * We reconstruct the metadatas object by taking the existing list metadatas\n * and re-merging that by attribute name with the current list metadatas, whilst overwriting\n * the data from the form we've built.\n */\n const meta = Object.entries(list.metadatas).reduce<Metadatas>(\n (acc, [name, { mainField: _mainField, ...listMeta }]) => {\n const existingEditMeta = edit.metadatas[name];\n\n const {\n __temp_key__,\n size: _size,\n name: _name,\n ...editedMetadata\n } = data.layout.flatMap((row) => row.children).find((field) => field.name === name) ?? {};\n\n acc[name] = {\n edit: {\n ...existingEditMeta,\n ...editedMetadata,\n },\n list: listMeta,\n };\n\n return acc;\n },\n {}\n );\n\n const res = await updateConfiguration({\n layouts: {\n edit: data.layout.map((row) =>\n row.children.reduce<Array<{ name: string; size: number }>>((acc, { name, size }) => {\n if (name !== TEMP_FIELD_NAME) {\n return [...acc, { name, size }];\n }\n\n return acc;\n }, [])\n ),\n list: list.layout.map((field) => field.name),\n },\n settings: setIn(data.settings, 'displayName', undefined),\n metadatas: meta,\n uid: model,\n });\n\n if ('data' in res) {\n trackUsage('didEditEditSettings');\n toggleNotification({\n type: 'success',\n message: formatMessage({ id: 'notification.success.saved', defaultMessage: 'Saved' }),\n });\n } else {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(res.error),\n });\n }\n } catch {\n toggleNotification({\n type: 'danger',\n message: formatMessage({ id: 'notification.error', defaultMessage: 'An error occurred' }),\n });\n }\n };\n\n if (isLoading) {\n return <Page.Loading />;\n }\n\n if (errorFieldSizes || error || !schema) {\n return <Page.Error />;\n }\n\n return (\n <>\n <Page.Title>{`Configure ${edit.settings.displayName} Edit View`}</Page.Title>\n <ConfigurationForm\n onSubmit={handleSubmit}\n attributes={schema.attributes}\n fieldSizes={fieldSizes}\n layout={edit}\n />\n </>\n );\n};\n\nconst ProtectedEditConfigurationPage = () => {\n const permissions = useTypedSelector(\n (state) => state.admin_app.permissions.contentManager?.collectionTypesConfigurations\n );\n\n return (\n <Page.Protect permissions={permissions}>\n <EditConfigurationPage />\n </Page.Protect>\n );\n};\n\nexport { ProtectedEditConfigurationPage, EditConfigurationPage };\n"],"names":["EditConfigurationPage","trackUsage","useTracking","formatMessage","useIntl","toggleNotification","useNotification","_unstableFormatAPIError","formatAPIError","useAPIErrorHandler","isLoading","isLoadingSchema","schema","model","useDoc","isLoadingLayout","error","list","edit","useDocLayout","fieldSizes","errorFieldSizes","isLoadingFieldSizes","isFetching","isFetchingFieldSizes","useGetInitialDataQuery","undefined","selectFromResult","res","Object","entries","data","reduce","acc","attributeName","default","size","React","useEffect","type","message","updateConfiguration","useUpdateContentTypeConfigurationMutation","handleSubmit","meta","metadatas","name","mainField","_mainField","listMeta","existingEditMeta","__temp_key__","_size","_name","editedMetadata","layout","flatMap","row","children","find","field","layouts","map","TEMP_FIELD_NAME","settings","setIn","uid","id","defaultMessage","_jsx","Page","Loading","Error","_jsxs","_Fragment","Title","displayName","ConfigurationForm","onSubmit","attributes","ProtectedEditConfigurationPage","permissions","useTypedSelector","state","admin_app","contentManager","collectionTypesConfigurations","Protect"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAMA,qBAAwB,GAAA,IAAA;IAC5B,MAAM,EAAEC,UAAU,EAAE,GAAGC,WAAAA,EAAAA;IACvB,MAAM,EAAEC,aAAa,EAAE,GAAGC,OAAAA,EAAAA;IAC1B,MAAM,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AA,CAAA;AACtB;IAEA,IAAIlD,eAAAA,IAAmBL,KAAS,IAAA,CAACJ,MAAQ,EAAA;QACvC,qBAAOyD,GAAA,CAACC,KAAKE,KAAK,EAAA,EAAA,CAAA;AACpB;IAEA,qBACEC,IAAA,CAAAC,QAAA,EAAA;;AACE,0BAAAL,GAAA,CAACC,KAAKK,KAAK,EAAA;0BAAE,CAAC,UAAU,EAAEzD,IAAK8C,CAAAA,QAAQ,CAACY,WAAW,CAAC,UAAU;;0BAC9DP,GAACQ,CAAAA,iBAAAA,EAAAA;gBACCC,QAAUnC,EAAAA,YAAAA;AACVoC,gBAAAA,UAAAA,EAAYnE,OAAOmE,UAAU;gBAC7B3D,UAAYA,EAAAA,UAAAA;gBACZmC,MAAQrC,EAAAA;;;;AAIhB;AAEA,MAAM8D,8BAAiC,GAAA,IAAA;IACrC,MAAMC,WAAAA,GAAcC,gBAClB,CAAA,CAACC,KAAUA,GAAAA,KAAAA,CAAMC,SAAS,CAACH,WAAW,CAACI,cAAc,EAAEC,6BAAAA,CAAAA;IAGzD,qBACEjB,GAAA,CAACC,KAAKiB,OAAO,EAAA;QAACN,WAAaA,EAAAA,WAAAA;AACzB,QAAA,QAAA,gBAAAZ,GAACrE,CAAAA,qBAAAA,EAAAA,EAAAA;;AAGP;;;;"}
@@ -4,8 +4,8 @@ var jsxRuntime = require('react/jsx-runtime');
4
4
  var React = require('react');
5
5
  var strapiAdmin = require('@strapi/admin/strapi-admin');
6
6
  var reactIntl = require('react-intl');
7
- var Form = require('./Form-DGUP3zQO.js');
8
- var index = require('./index-BHimg6jW.js');
7
+ var Form = require('./Form-DD49gSWW.js');
8
+ var index = require('./index-CGBB9Dho.js');
9
9
  var hooks = require('./hooks-D-sOYd1s.js');
10
10
  var objects = require('./objects-C3EebVVe.js');
11
11
  require('@strapi/design-system');
@@ -178,4 +178,4 @@ const ProtectedEditConfigurationPage = ()=>{
178
178
 
179
179
  exports.EditConfigurationPage = EditConfigurationPage;
180
180
  exports.ProtectedEditConfigurationPage = ProtectedEditConfigurationPage;
181
- //# sourceMappingURL=EditConfigurationPage-BExtZuB7.js.map
181
+ //# sourceMappingURL=EditConfigurationPage-Cu0Vt-uc.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EditConfigurationPage-BExtZuB7.js","sources":["../../../admin/src/pages/EditConfigurationPage.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Page, useNotification, useTracking, useAPIErrorHandler } from '@strapi/admin/strapi-admin';\nimport { useIntl } from 'react-intl';\n\nimport { TEMP_FIELD_NAME } from '../components/ConfigurationForm/Fields';\nimport { ConfigurationForm, ConfigurationFormProps } from '../components/ConfigurationForm/Form';\nimport { useDoc } from '../hooks/useDocument';\nimport { useDocLayout } from '../hooks/useDocumentLayout';\nimport { useTypedSelector } from '../modules/hooks';\nimport { useUpdateContentTypeConfigurationMutation } from '../services/contentTypes';\nimport { useGetInitialDataQuery } from '../services/init';\nimport { setIn } from '../utils/objects';\n\nimport type { Metadatas } from '../../../shared/contracts/content-types';\n\nconst EditConfigurationPage = () => {\n const { trackUsage } = useTracking();\n const { formatMessage } = useIntl();\n const { toggleNotification } = useNotification();\n const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();\n const { isLoading: isLoadingSchema, schema, model } = useDoc();\n const { isLoading: isLoadingLayout, error, list, edit } = useDocLayout();\n\n const {\n fieldSizes,\n error: errorFieldSizes,\n isLoading: isLoadingFieldSizes,\n isFetching: isFetchingFieldSizes,\n } = useGetInitialDataQuery(undefined, {\n selectFromResult: (res) => {\n const fieldSizes = Object.entries(res.data?.fieldSizes ?? {}).reduce<\n ConfigurationFormProps['fieldSizes']\n >((acc, [attributeName, { default: size }]) => {\n acc[attributeName] = size;\n\n return acc;\n }, {});\n\n return {\n isFetching: res.isFetching,\n isLoading: res.isLoading,\n error: res.error,\n fieldSizes,\n };\n },\n });\n\n React.useEffect(() => {\n if (errorFieldSizes) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(errorFieldSizes),\n });\n }\n }, [errorFieldSizes, formatAPIError, toggleNotification]);\n\n const isLoading =\n isLoadingSchema || isLoadingLayout || isLoadingFieldSizes || isFetchingFieldSizes;\n\n const [updateConfiguration] = useUpdateContentTypeConfigurationMutation();\n const handleSubmit: ConfigurationFormProps['onSubmit'] = async (data) => {\n try {\n trackUsage('willSaveContentTypeLayout');\n\n /**\n * We reconstruct the metadatas object by taking the existing list metadatas\n * and re-merging that by attribute name with the current list metadatas, whilst overwriting\n * the data from the form we've built.\n */\n const meta = Object.entries(list.metadatas).reduce<Metadatas>(\n (acc, [name, { mainField: _mainField, ...listMeta }]) => {\n const existingEditMeta = edit.metadatas[name];\n\n const {\n __temp_key__,\n size: _size,\n name: _name,\n ...editedMetadata\n } = data.layout.flatMap((row) => row.children).find((field) => field.name === name) ?? {};\n\n acc[name] = {\n edit: {\n ...existingEditMeta,\n ...editedMetadata,\n },\n list: listMeta,\n };\n\n return acc;\n },\n {}\n );\n\n const res = await updateConfiguration({\n layouts: {\n edit: data.layout.map((row) =>\n row.children.reduce<Array<{ name: string; size: number }>>((acc, { name, size }) => {\n if (name !== TEMP_FIELD_NAME) {\n return [...acc, { name, size }];\n }\n\n return acc;\n }, [])\n ),\n list: list.layout.map((field) => field.name),\n },\n settings: setIn(data.settings, 'displayName', undefined),\n metadatas: meta,\n uid: model,\n });\n\n if ('data' in res) {\n trackUsage('didEditEditSettings');\n toggleNotification({\n type: 'success',\n message: formatMessage({ id: 'notification.success.saved', defaultMessage: 'Saved' }),\n });\n } else {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(res.error),\n });\n }\n } catch {\n toggleNotification({\n type: 'danger',\n message: formatMessage({ id: 'notification.error', defaultMessage: 'An error occurred' }),\n });\n }\n };\n\n if (isLoading) {\n return <Page.Loading />;\n }\n\n if (errorFieldSizes || error || !schema) {\n return <Page.Error />;\n }\n\n return (\n <>\n <Page.Title>{`Configure ${edit.settings.displayName} Edit View`}</Page.Title>\n <ConfigurationForm\n onSubmit={handleSubmit}\n attributes={schema.attributes}\n fieldSizes={fieldSizes}\n layout={edit}\n />\n </>\n );\n};\n\nconst ProtectedEditConfigurationPage = () => {\n const permissions = useTypedSelector(\n (state) => state.admin_app.permissions.contentManager?.collectionTypesConfigurations\n );\n\n return (\n <Page.Protect permissions={permissions}>\n <EditConfigurationPage />\n </Page.Protect>\n );\n};\n\nexport { ProtectedEditConfigurationPage, EditConfigurationPage };\n"],"names":["EditConfigurationPage","trackUsage","useTracking","formatMessage","useIntl","toggleNotification","useNotification","_unstableFormatAPIError","formatAPIError","useAPIErrorHandler","isLoading","isLoadingSchema","schema","model","useDoc","isLoadingLayout","error","list","edit","useDocLayout","fieldSizes","errorFieldSizes","isLoadingFieldSizes","isFetching","isFetchingFieldSizes","useGetInitialDataQuery","undefined","selectFromResult","res","Object","entries","data","reduce","acc","attributeName","default","size","React","useEffect","type","message","updateConfiguration","useUpdateContentTypeConfigurationMutation","handleSubmit","meta","metadatas","name","mainField","_mainField","listMeta","existingEditMeta","__temp_key__","_size","_name","editedMetadata","layout","flatMap","row","children","find","field","layouts","map","TEMP_FIELD_NAME","settings","setIn","uid","id","defaultMessage","_jsx","Page","Loading","Error","_jsxs","_Fragment","Title","displayName","ConfigurationForm","onSubmit","attributes","ProtectedEditConfigurationPage","permissions","useTypedSelector","state","admin_app","contentManager","collectionTypesConfigurations","Protect"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAMA,qBAAwB,GAAA,IAAA;IAC5B,MAAM,EAAEC,UAAU,EAAE,GAAGC,uBAAAA,EAAAA;IACvB,MAAM,EAAEC,aAAa,EAAE,GAAGC,iBAAAA,EAAAA;IAC1B,MAAM,EAAEC,kBAAkB,EAAE,GAAGC,2BAAAA,EAAAA;AAC/B,IAAA,MAAM,EAAEC,uBAAAA,EAAyBC,cAAc,EAAE,GAAGC,8BAAAA,EAAAA;IACpD,MAAM,EAAEC,WAAWC,eAAe,EAAEC,MAAM,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,CAAAC,mBAAA,EAAA;;AACE,0BAAAL,cAAA,CAACC,iBAAKK,KAAK,EAAA;0BAAE,CAAC,UAAU,EAAEzD,IAAK8C,CAAAA,QAAQ,CAACY,WAAW,CAAC,UAAU;;0BAC9DP,cAACQ,CAAAA,sBAAAA,EAAAA;gBACCC,QAAUnC,EAAAA,YAAAA;AACVoC,gBAAAA,UAAAA,EAAYnE,OAAOmE,UAAU;gBAC7B3D,UAAYA,EAAAA,UAAAA;gBACZmC,MAAQrC,EAAAA;;;;AAIhB;AAEA,MAAM8D,8BAAiC,GAAA,IAAA;IACrC,MAAMC,WAAAA,GAAcC,sBAClB,CAAA,CAACC,KAAUA,GAAAA,KAAAA,CAAMC,SAAS,CAACH,WAAW,CAACI,cAAc,EAAEC,6BAAAA,CAAAA;IAGzD,qBACEjB,cAAA,CAACC,iBAAKiB,OAAO,EAAA;QAACN,WAAaA,EAAAA,WAAAA;AACzB,QAAA,QAAA,gBAAAZ,cAACrE,CAAAA,qBAAAA,EAAAA,EAAAA;;AAGP;;;;;"}
1
+ {"version":3,"file":"EditConfigurationPage-Cu0Vt-uc.js","sources":["../../../admin/src/pages/EditConfigurationPage.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Page, useNotification, useTracking, useAPIErrorHandler } from '@strapi/admin/strapi-admin';\nimport { useIntl } from 'react-intl';\n\nimport { TEMP_FIELD_NAME } from '../components/ConfigurationForm/Fields';\nimport { ConfigurationForm, ConfigurationFormProps } from '../components/ConfigurationForm/Form';\nimport { useDoc } from '../hooks/useDocument';\nimport { useDocLayout } from '../hooks/useDocumentLayout';\nimport { useTypedSelector } from '../modules/hooks';\nimport { useUpdateContentTypeConfigurationMutation } from '../services/contentTypes';\nimport { useGetInitialDataQuery } from '../services/init';\nimport { setIn } from '../utils/objects';\n\nimport type { Metadatas } from '../../../shared/contracts/content-types';\n\nconst EditConfigurationPage = () => {\n const { trackUsage } = useTracking();\n const { formatMessage } = useIntl();\n const { toggleNotification } = useNotification();\n const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();\n const { isLoading: isLoadingSchema, schema, model } = useDoc();\n const { isLoading: isLoadingLayout, error, list, edit } = useDocLayout();\n\n const {\n fieldSizes,\n error: errorFieldSizes,\n isLoading: isLoadingFieldSizes,\n isFetching: isFetchingFieldSizes,\n } = useGetInitialDataQuery(undefined, {\n selectFromResult: (res) => {\n const fieldSizes = Object.entries(res.data?.fieldSizes ?? {}).reduce<\n ConfigurationFormProps['fieldSizes']\n >((acc, [attributeName, { default: size }]) => {\n acc[attributeName] = size;\n\n return acc;\n }, {});\n\n return {\n isFetching: res.isFetching,\n isLoading: res.isLoading,\n error: res.error,\n fieldSizes,\n };\n },\n });\n\n React.useEffect(() => {\n if (errorFieldSizes) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(errorFieldSizes),\n });\n }\n }, [errorFieldSizes, formatAPIError, toggleNotification]);\n\n const isLoading =\n isLoadingSchema || isLoadingLayout || isLoadingFieldSizes || isFetchingFieldSizes;\n\n const [updateConfiguration] = useUpdateContentTypeConfigurationMutation();\n const handleSubmit: ConfigurationFormProps['onSubmit'] = async (data) => {\n try {\n trackUsage('willSaveContentTypeLayout');\n\n /**\n * We reconstruct the metadatas object by taking the existing list metadatas\n * and re-merging that by attribute name with the current list metadatas, whilst overwriting\n * the data from the form we've built.\n */\n const meta = Object.entries(list.metadatas).reduce<Metadatas>(\n (acc, [name, { mainField: _mainField, ...listMeta }]) => {\n const existingEditMeta = edit.metadatas[name];\n\n const {\n __temp_key__,\n size: _size,\n name: _name,\n ...editedMetadata\n } = data.layout.flatMap((row) => row.children).find((field) => field.name === name) ?? {};\n\n acc[name] = {\n edit: {\n ...existingEditMeta,\n ...editedMetadata,\n },\n list: listMeta,\n };\n\n return acc;\n },\n {}\n );\n\n const res = await updateConfiguration({\n layouts: {\n edit: data.layout.map((row) =>\n row.children.reduce<Array<{ name: string; size: number }>>((acc, { name, size }) => {\n if (name !== TEMP_FIELD_NAME) {\n return [...acc, { name, size }];\n }\n\n return acc;\n }, [])\n ),\n list: list.layout.map((field) => field.name),\n },\n settings: setIn(data.settings, 'displayName', undefined),\n metadatas: meta,\n uid: model,\n });\n\n if ('data' in res) {\n trackUsage('didEditEditSettings');\n toggleNotification({\n type: 'success',\n message: formatMessage({ id: 'notification.success.saved', defaultMessage: 'Saved' }),\n });\n } else {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(res.error),\n });\n }\n } catch {\n toggleNotification({\n type: 'danger',\n message: formatMessage({ id: 'notification.error', defaultMessage: 'An error occurred' }),\n });\n }\n };\n\n if (isLoading) {\n return <Page.Loading />;\n }\n\n if (errorFieldSizes || error || !schema) {\n return <Page.Error />;\n }\n\n return (\n <>\n <Page.Title>{`Configure ${edit.settings.displayName} Edit View`}</Page.Title>\n <ConfigurationForm\n onSubmit={handleSubmit}\n attributes={schema.attributes}\n fieldSizes={fieldSizes}\n layout={edit}\n />\n </>\n );\n};\n\nconst ProtectedEditConfigurationPage = () => {\n const permissions = useTypedSelector(\n (state) => state.admin_app.permissions.contentManager?.collectionTypesConfigurations\n );\n\n return (\n <Page.Protect permissions={permissions}>\n <EditConfigurationPage />\n </Page.Protect>\n );\n};\n\nexport { ProtectedEditConfigurationPage, EditConfigurationPage };\n"],"names":["EditConfigurationPage","trackUsage","useTracking","formatMessage","useIntl","toggleNotification","useNotification","_unstableFormatAPIError","formatAPIError","useAPIErrorHandler","isLoading","isLoadingSchema","schema","model","useDoc","isLoadingLayout","error","list","edit","useDocLayout","fieldSizes","errorFieldSizes","isLoadingFieldSizes","isFetching","isFetchingFieldSizes","useGetInitialDataQuery","undefined","selectFromResult","res","Object","entries","data","reduce","acc","attributeName","default","size","React","useEffect","type","message","updateConfiguration","useUpdateContentTypeConfigurationMutation","handleSubmit","meta","metadatas","name","mainField","_mainField","listMeta","existingEditMeta","__temp_key__","_size","_name","editedMetadata","layout","flatMap","row","children","find","field","layouts","map","TEMP_FIELD_NAME","settings","setIn","uid","id","defaultMessage","_jsx","Page","Loading","Error","_jsxs","_Fragment","Title","displayName","ConfigurationForm","onSubmit","attributes","ProtectedEditConfigurationPage","permissions","useTypedSelector","state","admin_app","contentManager","collectionTypesConfigurations","Protect"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAMA,qBAAwB,GAAA,IAAA;IAC5B,MAAM,EAAEC,UAAU,EAAE,GAAGC,uBAAAA,EAAAA;IACvB,MAAM,EAAEC,aAAa,EAAE,GAAGC,iBAAAA,EAAAA;IAC1B,MAAM,EAAEC,kBAAkB,EAAE,GAAGC,2BAAAA,EAAAA;AAC/B,IAAA,MAAM,EAAEC,uBAAAA,EAAyBC,cAAc,EAAE,GAAGC,8BAAAA,EAAAA;IACpD,MAAM,EAAEC,WAAWC,eAAe,EAAEC,MAAM,EAAEC,KAAK,EAAE,GAAGC,YAAAA,EAAAA;IACtD,MAAM,EAAEJ,SAAWK,EAAAA,eAAe,EAAEC,KAAK,EAAEC,IAAI,EAAEC,IAAI,EAAE,GAAGC,kBAAAA,EAAAA;AAE1D,IAAA,MAAM,EACJC,UAAU,EACVJ,KAAAA,EAAOK,eAAe,EACtBX,SAAAA,EAAWY,mBAAmB,EAC9BC,UAAYC,EAAAA,oBAAoB,EACjC,GAAGC,6BAAuBC,SAAW,EAAA;AACpCC,QAAAA,gBAAAA,EAAkB,CAACC,GAAAA,GAAAA;YACjB,MAAMR,UAAAA,GAAaS,OAAOC,OAAO,CAACF,IAAIG,IAAI,EAAEX,cAAc,EAAC,CAAA,CAAGY,MAAM,CAElE,CAACC,KAAK,CAACC,aAAAA,EAAe,EAAEC,OAASC,EAAAA,IAAI,EAAE,CAAC,GAAA;gBACxCH,GAAG,CAACC,cAAc,GAAGE,IAAAA;gBAErB,OAAOH,GAAAA;AACT,aAAA,EAAG,EAAC,CAAA;YAEJ,OAAO;AACLV,gBAAAA,UAAAA,EAAYK,IAAIL,UAAU;AAC1Bb,gBAAAA,SAAAA,EAAWkB,I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  var reactRouterDom = require('react-router-dom');
9
9
  var styledComponents = require('styled-components');
10
- var index = require('./index-BHimg6jW.js');
11
- var Input = require('./Input-DLJZHw9Y.js');
10
+ var index = require('./index-CGBB9Dho.js');
11
+ var Input = require('./Input-BUVu6H9n.js');
12
12
  require('@strapi/icons');
13
13
  require('lodash/fp/mapValues');
14
14
  require('yup');
@@ -79,9 +79,9 @@ require('react-dnd-html5-backend');
79
79
  require('./objects-C3EebVVe.js');
80
80
  require('lodash/clone');
81
81
  require('lodash/toPath');
82
- require('./Relations-o7_hVGyK.js');
82
+ require('./Relations-T8Cr0N9M.js');
83
83
  require('react-window');
84
- require('./relations-XOYEEqMz.js');
84
+ require('./relations-jNJK8ESO.js');
85
85
  require('./ComponentIcon-C-EjOUPA.js');
86
86
  require('@strapi/icons/symbols');
87
87
  require('codemirror5');
@@ -157,13 +157,10 @@ const emptyDeps = [];
157
157
  const { isLazyLoading } = Input.useLazyComponents([]);
158
158
  const isLoading = isLoadingActionsRBAC || isLoadingDocument || isLoadingLayout || isLazyLoading;
159
159
  const initialValues = getInitialFormValues(isCreatingDocument);
160
- if (hasError) {
161
- return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Page.Error, {});
162
- }
163
160
  if (isLoading && !document?.documentId) {
164
161
  return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
165
162
  }
166
- if (!initialValues) {
163
+ if (!initialValues || hasError) {
167
164
  return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Page.Error, {});
168
165
  }
169
166
  const handleTabChange = (status)=>{
@@ -334,4 +331,4 @@ const StatusTab = styledComponents.styled(designSystem.Tabs.Trigger)`
334
331
  exports.EditViewPage = EditViewPage;
335
332
  exports.ProtectedEditViewPage = ProtectedEditViewPage;
336
333
  exports.getDocumentStatus = getDocumentStatus;
337
- //# sourceMappingURL=EditViewPage-DFkloeMZ.js.map
334
+ //# sourceMappingURL=EditViewPage-B48r4DLX.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EditViewPage-B48r4DLX.js","sources":["../../../admin/src/hooks/useOnce.ts","../../../admin/src/pages/EditView/EditViewPage.tsx"],"sourcesContent":["/* eslint-disable react-hooks/exhaustive-deps */\nimport * as React from 'react';\n\nexport const useOnce = (effect: React.EffectCallback) => React.useEffect(effect, emptyDeps);\n\nconst emptyDeps: React.DependencyList = [];\n","import * as React from 'react';\n\nimport {\n Page,\n Blocker,\n Form,\n useRBAC,\n useNotification,\n useQueryParams,\n} from '@strapi/admin/strapi-admin';\nimport { Grid, Main, Tabs } from '@strapi/design-system';\nimport { useIntl } from 'react-intl';\nimport { useLocation, useParams } from 'react-router-dom';\nimport { styled } from 'styled-components';\n\nimport { SINGLE_TYPES } from '../../constants/collections';\nimport { PERMISSIONS } from '../../constants/plugin';\nimport { DocumentRBAC, useDocumentRBAC } from '../../features/DocumentRBAC';\nimport { type UseDocument, useDoc } from '../../hooks/useDocument';\nimport { useDocumentLayout } from '../../hooks/useDocumentLayout';\nimport { useLazyComponents } from '../../hooks/useLazyComponents';\nimport { useOnce } from '../../hooks/useOnce';\nimport { getTranslation } from '../../utils/translations';\nimport { createYupSchema } from '../../utils/validation';\n\nimport { FormLayout } from './components/FormLayout';\nimport { Header } from './components/Header';\nimport { Panels } from './components/Panels';\n\n/* -------------------------------------------------------------------------------------------------\n * EditViewPage\n * -----------------------------------------------------------------------------------------------*/\n\nconst EditViewPage = () => {\n const location = useLocation();\n const [\n {\n query: { status },\n },\n setQuery,\n ] = useQueryParams<{ status: 'draft' | 'published' }>({\n status: 'draft',\n });\n const { formatMessage } = useIntl();\n const { toggleNotification } = useNotification();\n\n const {\n document,\n meta,\n isLoading: isLoadingDocument,\n schema,\n components,\n collectionType,\n id,\n model,\n hasError,\n getTitle,\n getInitialFormValues,\n } = useDoc();\n\n const hasDraftAndPublished = schema?.options?.draftAndPublish ?? false;\n\n useOnce(() => {\n /**\n * We only ever want to fire the notification once otherwise\n * whenever the app re-renders it'll pop up regardless of\n * what we do because the state comes from react-router-dom\n */\n if (location?.state && 'error' in location.state) {\n toggleNotification({\n type: 'danger',\n message: location.state.error,\n timeout: 5000,\n });\n }\n });\n\n const isLoadingActionsRBAC = useDocumentRBAC('EditViewPage', (state) => state.isLoading);\n\n const isSingleType = collectionType === SINGLE_TYPES;\n\n /**\n * single-types don't current have an id, but because they're a singleton\n * we can simply use the update operation to continuously update the same\n * document with varying params.\n */\n const isCreatingDocument = !id && !isSingleType;\n\n const {\n isLoading: isLoadingLayout,\n edit: {\n layout,\n settings: { mainField },\n },\n } = useDocumentLayout(model);\n\n const { isLazyLoading } = useLazyComponents([]);\n\n const isLoading = isLoadingActionsRBAC || isLoadingDocument || isLoadingLayout || isLazyLoading;\n\n const initialValues = getInitialFormValues(isCreatingDocument);\n\n if (isLoading && !document?.documentId) {\n return <Page.Loading />;\n }\n\n if (!initialValues || hasError) {\n return <Page.Error />;\n }\n\n const handleTabChange = (status: string) => {\n if (status === 'published' || status === 'draft') {\n setQuery({ status }, 'push', true);\n }\n };\n\n const validateSync = (values: Record<string, unknown>, options: Record<string, string>) => {\n const yupSchema = createYupSchema(schema?.attributes, components, {\n status,\n ...options,\n });\n\n return yupSchema.validateSync(values, { abortEarly: false });\n };\n\n return (\n <Main paddingLeft={10} paddingRight={10}>\n <Page.Title>{getTitle(mainField)}</Page.Title>\n <Form\n disabled={hasDraftAndPublished && status === 'published'}\n initialValues={initialValues}\n method={isCreatingDocument ? 'POST' : 'PUT'}\n validate={(values: Record<string, unknown>, options: Record<string, string>) => {\n const yupSchema = createYupSchema(schema?.attributes, components, {\n status,\n ...options,\n });\n\n return yupSchema.validate(values, { abortEarly: false });\n }}\n initialErrors={location?.state?.forceValidation ? validateSync(initialValues, {}) : {}}\n >\n {({ resetForm }) => (\n <>\n <Header\n isCreating={isCreatingDocument}\n status={hasDraftAndPublished ? getDocumentStatus(document, meta) : undefined}\n title={getTitle(mainField)}\n />\n <Tabs.Root variant=\"simple\" value={status} onValueChange={handleTabChange}>\n <Tabs.List\n aria-label={formatMessage({\n id: getTranslation('containers.edit.tabs.label'),\n defaultMessage: 'Document status',\n })}\n >\n {hasDraftAndPublished ? (\n <>\n <StatusTab value=\"draft\">\n {formatMessage({\n id: getTranslation('containers.edit.tabs.draft'),\n defaultMessage: 'draft',\n })}\n </StatusTab>\n <StatusTab\n disabled={!meta || meta.availableStatus.length === 0}\n value=\"published\"\n >\n {formatMessage({\n id: getTranslation('containers.edit.tabs.published'),\n defaultMessage: 'published',\n })}\n </StatusTab>\n </>\n ) : null}\n </Tabs.List>\n <Grid.Root paddingTop={8} gap={4}>\n <Grid.Item col={9} s={12} direction=\"column\" alignItems=\"stretch\">\n <Tabs.Content value=\"draft\">\n <FormLayout layout={layout} />\n </Tabs.Content>\n <Tabs.Content value=\"published\">\n <FormLayout layout={layout} />\n </Tabs.Content>\n </Grid.Item>\n <Grid.Item col={3} s={12} direction=\"column\" alignItems=\"stretch\">\n <Panels />\n </Grid.Item>\n </Grid.Root>\n </Tabs.Root>\n <Blocker\n // We reset the form to the published version to avoid errors like – https://strapi-inc.atlassian.net/browse/CONTENT-2284\n onProceed={resetForm}\n />\n </>\n )}\n </Form>\n </Main>\n );\n};\n\nconst StatusTab = styled(Tabs.Trigger)`\n text-transform: uppercase;\n`;\n\n/**\n * @internal\n * @description Returns the status of the document where its latest state takes priority,\n * this typically will be \"published\" unless a user has edited their draft in which we should\n * display \"modified\".\n */\nconst getDocumentStatus = (\n document: ReturnType<UseDocument>['document'],\n meta: ReturnType<UseDocument>['meta']\n): 'draft' | 'published' | 'modified' => {\n const docStatus = document?.status;\n const statuses = meta?.availableStatus ?? [];\n\n /**\n * Creating an entry\n */\n if (!docStatus) {\n return 'draft';\n }\n\n /**\n * We're viewing a draft, but the document could have a published version\n */\n if (docStatus === 'draft' && statuses.find((doc) => doc.publishedAt !== null)) {\n return 'published';\n }\n\n return docStatus;\n};\n\n/* -------------------------------------------------------------------------------------------------\n * ProtectedEditViewPage\n * -----------------------------------------------------------------------------------------------*/\n\nconst ProtectedEditViewPage = () => {\n const { slug = '' } = useParams<{\n slug: string;\n }>();\n const {\n permissions = [],\n isLoading,\n error,\n } = useRBAC(\n PERMISSIONS.map((action) => ({\n action,\n subject: slug,\n }))\n );\n\n if (isLoading) {\n return <Page.Loading />;\n }\n\n if (error || !slug) {\n return <Page.Error />;\n }\n\n return (\n <Page.Protect permissions={permissions}>\n {({ permissions }) => (\n <DocumentRBAC permissions={permissions}>\n <EditViewPage />\n </DocumentRBAC>\n )}\n </Page.Protect>\n );\n};\n\nexport { EditViewPage, ProtectedEditViewPage, getDocumentStatus };\n"],"names":["useOnce","effect","React","useEffect","emptyDeps","EditViewPage","location","useLocation","query","status","setQuery","useQueryParams","formatMessage","useIntl","toggleNotification","useNotification","document","meta","isLoading","isLoadingDocument","schema","components","collectionType","id","model","hasError","getTitle","getInitialFormValues","useDoc","hasDraftAndPublished","options","draftAndPublish","state","type","message","error","timeout","isLoadingActionsRBAC","useDocumentRBAC","isSingleType","SINGLE_TYPES","isCreatingDocument","isLoadingLayout","edit","layout","settings","mainField","useDocumentLayout","isLazyLoading","useLazyComponents","initialValues","documentId","_jsx","Page","Loading","Error","handleTabChange","validateSync","values","yupSchema","createYupSchema","attributes","abortEarly","_jsxs","Main","paddingLeft","paddingRight","Title","Form","disabled","method","validate","initialErrors","forceValidation","resetForm","_Fragment","Header","isCreating","getDocumentStatus","undefined","title","Tabs","Root","variant","value","onValueChange","List","aria-label","getTranslation","defaultMessage","StatusTab","availableStatus","length","Grid","paddingTop","gap","Item","col","s","direction","alignItems","Content","FormLayout","Panels","Blocker","onProceed","styled","Trigger","docStatus","statuses","find","doc","publishedAt","ProtectedEditViewPage","slug","useParams","permissions","useRBAC","PERMISSIONS","map","action","subject","Protect","DocumentRBAC"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;QACb,qBAAOkC,cAAA,CAACC,iBAAKC,OAAO,EAAA,EAAA,CAAA;AACtB;IAEA,IAAInB,KAAAA,IAAS,CAAC+E,IAAM,EAAA;QAClB,qBAAO9D,cAAA,CAACC,iBAAKE,KAAK,EAAA,EAAA,CAAA;AACpB;IAEA,qBACEH,cAAA,CAACC,iBAAKqE,OAAO,EAAA;QAACN,WAAaA,EAAAA,WAAAA;AACxB,QAAA,QAAA,EAAA,CAAC,EAAEA,WAAW,EAAE,iBACfhE,cAACuE,CAAAA,kBAAAA,EAAAA;gBAAaP,WAAaA,EAAAA,WAAAA;AACzB,gBAAA,QAAA,gBAAAhE,cAAC/C,CAAAA,YAAAA,EAAAA,EAAAA;;;AAKX;;;;;;"}
@@ -5,8 +5,8 @@ import { Main, Tabs, Grid } from '@strapi/design-system';
5
5
  import { useIntl } from 'react-intl';
6
6
  import { useLocation, useParams } from 'react-router-dom';
7
7
  import { styled } from 'styled-components';
8
- import { c as useDoc, f as useDocumentRBAC, h as useDocumentLayout, i as createYupSchema, j as Header, g as getTranslation, P as Panels, k as PERMISSIONS, l as DocumentRBAC, S as SINGLE_TYPES } from './index-Cs6qwFQu.mjs';
9
- import { u as useLazyComponents, F as FormLayout } from './Input-BexkC_pp.mjs';
8
+ import { c as useDoc, f as useDocumentRBAC, h as useDocumentLayout, i as createYupSchema, j as Header, g as getTranslation, P as Panels, k as PERMISSIONS, l as DocumentRBAC, S as SINGLE_TYPES } from './index-BkM_Z7pU.mjs';
9
+ import { u as useLazyComponents, F as FormLayout } from './Input-CtIJ2J0c.mjs';
10
10
  import '@strapi/icons';
11
11
  import 'lodash/fp/mapValues';
12
12
  import 'yup';
@@ -77,9 +77,9 @@ import 'react-dnd-html5-backend';
77
77
  import './objects-wl73iEma.mjs';
78
78
  import 'lodash/clone';
79
79
  import 'lodash/toPath';
80
- import './Relations-qeZyLDgQ.mjs';
80
+ import './Relations-DP5krCGC.mjs';
81
81
  import 'react-window';
82
- import './relations-Cq8NRUto.mjs';
82
+ import './relations-Dv0FHoBS.mjs';
83
83
  import './ComponentIcon-BZcTc4rj.mjs';
84
84
  import '@strapi/icons/symbols';
85
85
  import 'codemirror5';
@@ -136,13 +136,10 @@ const emptyDeps = [];
136
136
  const { isLazyLoading } = useLazyComponents([]);
137
137
  const isLoading = isLoadingActionsRBAC || isLoadingDocument || isLoadingLayout || isLazyLoading;
138
138
  const initialValues = getInitialFormValues(isCreatingDocument);
139
- if (hasError) {
140
- return /*#__PURE__*/ jsx(Page.Error, {});
141
- }
142
139
  if (isLoading && !document?.documentId) {
143
140
  return /*#__PURE__*/ jsx(Page.Loading, {});
144
141
  }
145
- if (!initialValues) {
142
+ if (!initialValues || hasError) {
146
143
  return /*#__PURE__*/ jsx(Page.Error, {});
147
144
  }
148
145
  const handleTabChange = (status)=>{
@@ -311,4 +308,4 @@ const StatusTab = styled(Tabs.Trigger)`
311
308
  };
312
309
 
313
310
  export { EditViewPage, ProtectedEditViewPage, getDocumentStatus };
314
- //# sourceMappingURL=EditViewPage-CYe7wAXF.mjs.map
311
+ //# sourceMappingURL=EditViewPage-BpGtaOKG.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EditViewPage-BpGtaOKG.mjs","sources":["../../../admin/src/hooks/useOnce.ts","../../../admin/src/pages/EditView/EditViewPage.tsx"],"sourcesContent":["/* eslint-disable react-hooks/exhaustive-deps */\nimport * as React from 'react';\n\nexport const useOnce = (effect: React.EffectCallback) => React.useEffect(effect, emptyDeps);\n\nconst emptyDeps: React.DependencyList = [];\n","import * as React from 'react';\n\nimport {\n Page,\n Blocker,\n Form,\n useRBAC,\n useNotification,\n useQueryParams,\n} from '@strapi/admin/strapi-admin';\nimport { Grid, Main, Tabs } from '@strapi/design-system';\nimport { useIntl } from 'react-intl';\nimport { useLocation, useParams } from 'react-router-dom';\nimport { styled } from 'styled-components';\n\nimport { SINGLE_TYPES } from '../../constants/collections';\nimport { PERMISSIONS } from '../../constants/plugin';\nimport { DocumentRBAC, useDocumentRBAC } from '../../features/DocumentRBAC';\nimport { type UseDocument, useDoc } from '../../hooks/useDocument';\nimport { useDocumentLayout } from '../../hooks/useDocumentLayout';\nimport { useLazyComponents } from '../../hooks/useLazyComponents';\nimport { useOnce } from '../../hooks/useOnce';\nimport { getTranslation } from '../../utils/translations';\nimport { createYupSchema } from '../../utils/validation';\n\nimport { FormLayout } from './components/FormLayout';\nimport { Header } from './components/Header';\nimport { Panels } from './components/Panels';\n\n/* -------------------------------------------------------------------------------------------------\n * EditViewPage\n * -----------------------------------------------------------------------------------------------*/\n\nconst EditViewPage = () => {\n const location = useLocation();\n const [\n {\n query: { status },\n },\n setQuery,\n ] = useQueryParams<{ status: 'draft' | 'published' }>({\n status: 'draft',\n });\n const { formatMessage } = useIntl();\n const { toggleNotification } = useNotification();\n\n const {\n document,\n meta,\n isLoading: isLoadingDocument,\n schema,\n components,\n collectionType,\n id,\n model,\n hasError,\n getTitle,\n getInitialFormValues,\n } = useDoc();\n\n const hasDraftAndPublished = schema?.options?.draftAndPublish ?? false;\n\n useOnce(() => {\n /**\n * We only ever want to fire the notification once otherwise\n * whenever the app re-renders it'll pop up regardless of\n * what we do because the state comes from react-router-dom\n */\n if (location?.state && 'error' in location.state) {\n toggleNotification({\n type: 'danger',\n message: location.state.error,\n timeout: 5000,\n });\n }\n });\n\n const isLoadingActionsRBAC = useDocumentRBAC('EditViewPage', (state) => state.isLoading);\n\n const isSingleType = collectionType === SINGLE_TYPES;\n\n /**\n * single-types don't current have an id, but because they're a singleton\n * we can simply use the update operation to continuously update the same\n * document with varying params.\n */\n const isCreatingDocument = !id && !isSingleType;\n\n const {\n isLoading: isLoadingLayout,\n edit: {\n layout,\n settings: { mainField },\n },\n } = useDocumentLayout(model);\n\n const { isLazyLoading } = useLazyComponents([]);\n\n const isLoading = isLoadingActionsRBAC || isLoadingDocument || isLoadingLayout || isLazyLoading;\n\n const initialValues = getInitialFormValues(isCreatingDocument);\n\n if (isLoading && !document?.documentId) {\n return <Page.Loading />;\n }\n\n if (!initialValues || hasError) {\n return <Page.Error />;\n }\n\n const handleTabChange = (status: string) => {\n if (status === 'published' || status === 'draft') {\n setQuery({ status }, 'push', true);\n }\n };\n\n const validateSync = (values: Record<string, unknown>, options: Record<string, string>) => {\n const yupSchema = createYupSchema(schema?.attributes, components, {\n status,\n ...options,\n });\n\n return yupSchema.validateSync(values, { abortEarly: false });\n };\n\n return (\n <Main paddingLeft={10} paddingRight={10}>\n <Page.Title>{getTitle(mainField)}</Page.Title>\n <Form\n disabled={hasDraftAndPublished && status === 'published'}\n initialValues={initialValues}\n method={isCreatingDocument ? 'POST' : 'PUT'}\n validate={(values: Record<string, unknown>, options: Record<string, string>) => {\n const yupSchema = createYupSchema(schema?.attributes, components, {\n status,\n ...options,\n });\n\n return yupSchema.validate(values, { abortEarly: false });\n }}\n initialErrors={location?.state?.forceValidation ? validateSync(initialValues, {}) : {}}\n >\n {({ resetForm }) => (\n <>\n <Header\n isCreating={isCreatingDocument}\n status={hasDraftAndPublished ? getDocumentStatus(document, meta) : undefined}\n title={getTitle(mainField)}\n />\n <Tabs.Root variant=\"simple\" value={status} onValueChange={handleTabChange}>\n <Tabs.List\n aria-label={formatMessage({\n id: getTranslation('containers.edit.tabs.label'),\n defaultMessage: 'Document status',\n })}\n >\n {hasDraftAndPublished ? (\n <>\n <StatusTab value=\"draft\">\n {formatMessage({\n id: getTranslation('containers.edit.tabs.draft'),\n defaultMessage: 'draft',\n })}\n </StatusTab>\n <StatusTab\n disabled={!meta || meta.availableStatus.length === 0}\n value=\"published\"\n >\n {formatMessage({\n id: getTranslation('containers.edit.tabs.published'),\n defaultMessage: 'published',\n })}\n </StatusTab>\n </>\n ) : null}\n </Tabs.List>\n <Grid.Root paddingTop={8} gap={4}>\n <Grid.Item col={9} s={12} direction=\"column\" alignItems=\"stretch\">\n <Tabs.Content value=\"draft\">\n <FormLayout layout={layout} />\n </Tabs.Content>\n <Tabs.Content value=\"published\">\n <FormLayout layout={layout} />\n </Tabs.Content>\n </Grid.Item>\n <Grid.Item col={3} s={12} direction=\"column\" alignItems=\"stretch\">\n <Panels />\n </Grid.Item>\n </Grid.Root>\n </Tabs.Root>\n <Blocker\n // We reset the form to the published version to avoid errors like – https://strapi-inc.atlassian.net/browse/CONTENT-2284\n onProceed={resetForm}\n />\n </>\n )}\n </Form>\n </Main>\n );\n};\n\nconst StatusTab = styled(Tabs.Trigger)`\n text-transform: uppercase;\n`;\n\n/**\n * @internal\n * @description Returns the status of the document where its latest state takes priority,\n * this typically will be \"published\" unless a user has edited their draft in which we should\n * display \"modified\".\n */\nconst getDocumentStatus = (\n document: ReturnType<UseDocument>['document'],\n meta: ReturnType<UseDocument>['meta']\n): 'draft' | 'published' | 'modified' => {\n const docStatus = document?.status;\n const statuses = meta?.availableStatus ?? [];\n\n /**\n * Creating an entry\n */\n if (!docStatus) {\n return 'draft';\n }\n\n /**\n * We're viewing a draft, but the document could have a published version\n */\n if (docStatus === 'draft' && statuses.find((doc) => doc.publishedAt !== null)) {\n return 'published';\n }\n\n return docStatus;\n};\n\n/* -------------------------------------------------------------------------------------------------\n * ProtectedEditViewPage\n * -----------------------------------------------------------------------------------------------*/\n\nconst ProtectedEditViewPage = () => {\n const { slug = '' } = useParams<{\n slug: string;\n }>();\n const {\n permissions = [],\n isLoading,\n error,\n } = useRBAC(\n PERMISSIONS.map((action) => ({\n action,\n subject: slug,\n }))\n );\n\n if (isLoading) {\n return <Page.Loading />;\n }\n\n if (error || !slug) {\n return <Page.Error />;\n }\n\n return (\n <Page.Protect permissions={permissions}>\n {({ permissions }) => (\n <DocumentRBAC permissions={permissions}>\n <EditViewPage />\n </DocumentRBAC>\n )}\n </Page.Protect>\n );\n};\n\nexport { EditViewPage, ProtectedEditViewPage, getDocumentStatus };\n"],"names":["useOnce","effect","React","useEffect","emptyDeps","EditViewPage","location","useLocation","query","status","setQuery","useQueryParams","formatMessage","useIntl","toggleNotification","useNotification","document","meta","isLoading","isLoadingDocument","schema","components","collectionType","id","model","hasError","getTitle","getInitialFormValues","useDoc","hasDraftAndPublished","options","draftAndPublish","state","type","message","error","timeout","isLoadingActionsRBAC","useDocumentRBAC","isSingleType","SINGLE_TYPES","isCreatingDocument","isLoadingLayout","edit","layout","settings","mainField","useDocumentLayout","isLazyLoading","useLazyComponents","initialValues","documentId","_jsx","Page","Loading","Error","handleTabChange","validateSync","values","yupSchema","createYupSchema","attributes","abortEarly","_jsxs","Main","paddingLeft","paddingRight","Title","Form","disabled","method","validate","initialErrors","forceValidation","resetForm","_Fragment","Header","isCreating","getDocumentStatus","undefined","title","Tabs","Root","variant","value","onValueChange","List","aria-label","getTranslation","defaultMessage","StatusTab","availableStatus","length","Grid","paddingTop","gap","Item","col","s","direction","alignItems","Content","FormLayout","Panels","Blocker","onProceed","styled","Trigger","docStatus","statuses","find","doc","publishedAt","ProtectedEditViewPage","slug","useParams","permissions","useRBAC","PERMISSIONS","map","action","subject","Protect","DocumentRBAC"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGO,MAAMA,UAAU,CAACC,MAAAA,GAAiCC,MAAMC,SAAS,CAACF,QAAQG,SAAW,CAAA;AAE5F,MAAMA,YAAkC,EAAE;;ACwB1C;;AAEkG,2GAE5FC,YAAe,GAAA,IAAA;AACnB,IAAA,MAAMC,QAAWC,GAAAA,WAAAA,EAAAA;IACjB,MAAM,CACJ,EACEC,KAAAA,EAAO,EAAEC,MAAM,EAAE,EAClB,EACDC,QACD,CAAA,GAAGC,cAAkD,CAAA;QACpDF,MAAQ,EAAA;AACV,KAAA,CAAA;IACA,MAAM,EAAEG,aAAa,EAAE,GAAGC,OAAAA,EAAAA;IAC1B,MAAM,EAAEC,kBAAkB,EAAE,GAAGC,eAAAA,EAAAA;IAE/B,MAAM,EACJC,QAAQ,EACRC,IAAI,EACJC,WAAWC,iBAAiB,EAC5BC,MAAM,EACNC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MoG,QAAAA,GAAW5F,IAAM0E,EAAAA,eAAAA,IAAmB,EAAE;AAE5C;;MAGA,IAAI,CAACiB,SAAW,EAAA;QACd,OAAO,OAAA;AACT;AAEA;;MAGA,IAAIA,SAAc,KAAA,OAAA,IAAWC,QAASC,CAAAA,IAAI,CAAC,CAACC,GAAQA,GAAAA,GAAAA,CAAIC,WAAW,KAAK,IAAO,CAAA,EAAA;QAC7E,OAAO,WAAA;AACT;IAEA,OAAOJ,SAAAA;AACT;AAEA;;AAEkG,2GAE5FK,qBAAwB,GAAA,IAAA;AAC5B,IAAA,MAAM,EAAEC,IAAAA,GAAO,EAAE,EAAE,GAAGC,SAAAA,EAAAA;AAGtB,IAAA,MAAM,EACJC,WAAAA,GAAc,EAAE,EAChBlG,SAAS,EACTiB,KAAK,EACN,GAAGkF,QACFC,WAAYC,CAAAA,GAAG,CAAC,CAACC,UAAY;AAC3BA,YAAAA,MAAAA;YACAC,OAASP,EAAAA;SACX,CAAA,CAAA,CAAA;AAGF,IAAA,IAAIhG,SAAW,EAAA;QACb,qBAAOkC,GAAA,CAACC,KAAKC,OAAO,EAAA,EAAA,CAAA;AACtB;IAEA,IAAInB,KAAAA,IAAS,CAAC+E,IAAM,EAAA;QAClB,qBAAO9D,GAAA,CAACC,KAAKE,KAAK,EAAA,EAAA,CAAA;AACpB;IAEA,qBACEH,GAAA,CAACC,KAAKqE,OAAO,EAAA;QAACN,WAAaA,EAAAA,WAAAA;AACxB,QAAA,QAAA,EAAA,CAAC,EAAEA,WAAW,EAAE,iBACfhE,GAACuE,CAAAA,YAAAA,EAAAA;gBAAaP,WAAaA,EAAAA,WAAAA;AACzB,gBAAA,QAAA,gBAAAhE,GAAC/C,CAAAA,YAAAA,EAAAA,EAAAA;;;AAKX;;;;"}
@@ -7,7 +7,7 @@ var designSystem = require('@strapi/design-system');
7
7
  var fractionalIndexing = require('fractional-indexing');
8
8
  var pipe = require('lodash/fp/pipe');
9
9
  var reactIntl = require('react-intl');
10
- var index = require('./index-BHimg6jW.js');
10
+ var index = require('./index-CGBB9Dho.js');
11
11
  var Icons = require('@strapi/icons');
12
12
  var reactDndHtml5Backend = require('react-dnd-html5-backend');
13
13
  var reactRouterDom = require('react-router-dom');
@@ -975,4 +975,4 @@ const Header = ({ name })=>{
975
975
 
976
976
  exports.ConfigurationForm = ConfigurationForm;
977
977
  exports.TEMP_FIELD_NAME = TEMP_FIELD_NAME;
978
- //# sourceMappingURL=Form-DGUP3zQO.js.map
978
+ //# sourceMappingURL=Form-DD49gSWW.js.map