@strapi/content-manager 5.47.1 → 5.48.1

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 (106) hide show
  1. package/dist/admin/features/DocumentRBAC.js +9 -1
  2. package/dist/admin/features/DocumentRBAC.js.map +1 -1
  3. package/dist/admin/features/DocumentRBAC.mjs +9 -1
  4. package/dist/admin/features/DocumentRBAC.mjs.map +1 -1
  5. package/dist/admin/hooks/useContentTypeSchema.js +37 -17
  6. package/dist/admin/hooks/useContentTypeSchema.js.map +1 -1
  7. package/dist/admin/hooks/useContentTypeSchema.mjs +37 -17
  8. package/dist/admin/hooks/useContentTypeSchema.mjs.map +1 -1
  9. package/dist/admin/hooks/useDocumentLayout.js +43 -4
  10. package/dist/admin/hooks/useDocumentLayout.js.map +1 -1
  11. package/dist/admin/hooks/useDocumentLayout.mjs +43 -4
  12. package/dist/admin/hooks/useDocumentLayout.mjs.map +1 -1
  13. package/dist/admin/pages/ComponentConfigurationPage.js +6 -3
  14. package/dist/admin/pages/ComponentConfigurationPage.js.map +1 -1
  15. package/dist/admin/pages/ComponentConfigurationPage.mjs +6 -3
  16. package/dist/admin/pages/ComponentConfigurationPage.mjs.map +1 -1
  17. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.js +1 -0
  18. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.js.map +1 -1
  19. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.mjs +1 -0
  20. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.mjs.map +1 -1
  21. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksContent.js +5 -2
  22. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksContent.js.map +1 -1
  23. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksContent.mjs +5 -2
  24. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksContent.mjs.map +1 -1
  25. package/dist/admin/pages/EditView/components/FormInputs/Component/Input.js.map +1 -1
  26. package/dist/admin/pages/EditView/components/FormInputs/Component/Input.mjs.map +1 -1
  27. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.js +11 -2
  28. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.js.map +1 -1
  29. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.mjs +11 -2
  30. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.mjs.map +1 -1
  31. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/Field.js +9 -4
  32. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/Field.js.map +1 -1
  33. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/Field.mjs +9 -4
  34. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/Field.mjs.map +1 -1
  35. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/PreviewWysiwyg.js +2 -26
  36. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/PreviewWysiwyg.js.map +1 -1
  37. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/PreviewWysiwyg.mjs +2 -26
  38. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/PreviewWysiwyg.mjs.map +1 -1
  39. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/utils/sanitizer.js +72 -0
  40. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/utils/sanitizer.js.map +1 -0
  41. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/utils/sanitizer.mjs +70 -0
  42. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/utils/sanitizer.mjs.map +1 -0
  43. package/dist/admin/pages/ListConfiguration/ListConfigurationPage.js +4 -8
  44. package/dist/admin/pages/ListConfiguration/ListConfigurationPage.js.map +1 -1
  45. package/dist/admin/pages/ListConfiguration/ListConfigurationPage.mjs +5 -9
  46. package/dist/admin/pages/ListConfiguration/ListConfigurationPage.mjs.map +1 -1
  47. package/dist/admin/pages/ListConfiguration/components/SortDisplayedFields.js +6 -10
  48. package/dist/admin/pages/ListConfiguration/components/SortDisplayedFields.js.map +1 -1
  49. package/dist/admin/pages/ListConfiguration/components/SortDisplayedFields.mjs +6 -10
  50. package/dist/admin/pages/ListConfiguration/components/SortDisplayedFields.mjs.map +1 -1
  51. package/dist/admin/pages/ListView/components/Filters.js +7 -9
  52. package/dist/admin/pages/ListView/components/Filters.js.map +1 -1
  53. package/dist/admin/pages/ListView/components/Filters.mjs +7 -9
  54. package/dist/admin/pages/ListView/components/Filters.mjs.map +1 -1
  55. package/dist/admin/pages/ListView/components/TableCells/Media.js +5 -4
  56. package/dist/admin/pages/ListView/components/TableCells/Media.js.map +1 -1
  57. package/dist/admin/pages/ListView/components/TableCells/Media.mjs +5 -4
  58. package/dist/admin/pages/ListView/components/TableCells/Media.mjs.map +1 -1
  59. package/dist/admin/pages/formatComponentConfigurationEditLayout.js +15 -9
  60. package/dist/admin/pages/formatComponentConfigurationEditLayout.js.map +1 -1
  61. package/dist/admin/pages/formatComponentConfigurationEditLayout.mjs +15 -9
  62. package/dist/admin/pages/formatComponentConfigurationEditLayout.mjs.map +1 -1
  63. package/dist/admin/services/components.js +3 -2
  64. package/dist/admin/services/components.js.map +1 -1
  65. package/dist/admin/services/components.mjs +3 -2
  66. package/dist/admin/services/components.mjs.map +1 -1
  67. package/dist/admin/services/contentTypes.js +4 -3
  68. package/dist/admin/services/contentTypes.js.map +1 -1
  69. package/dist/admin/services/contentTypes.mjs +4 -3
  70. package/dist/admin/services/contentTypes.mjs.map +1 -1
  71. package/dist/admin/src/pages/EditView/components/FormInputs/Component/Input.d.ts +1 -1
  72. package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.d.ts +1 -1
  73. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/utils/sanitizer.d.ts +2 -0
  74. package/dist/admin/src/pages/ListConfiguration/components/SortDisplayedFields.d.ts +2 -2
  75. package/dist/admin/src/pages/ListView/components/TableCells/Media.d.ts +2 -2
  76. package/dist/admin/src/pages/formatComponentConfigurationEditLayout.d.ts +3 -1
  77. package/dist/admin/src/utils/layouts/normalizeContentManagerLayout.d.ts +24 -0
  78. package/dist/admin/translations/en.json.js +1 -0
  79. package/dist/admin/translations/en.json.js.map +1 -1
  80. package/dist/admin/translations/en.json.mjs +1 -0
  81. package/dist/admin/translations/en.json.mjs.map +1 -1
  82. package/dist/admin/utils/attributes.js +17 -2
  83. package/dist/admin/utils/attributes.js.map +1 -1
  84. package/dist/admin/utils/attributes.mjs +17 -2
  85. package/dist/admin/utils/attributes.mjs.map +1 -1
  86. package/dist/admin/utils/layouts/normalizeContentManagerLayout.js +329 -0
  87. package/dist/admin/utils/layouts/normalizeContentManagerLayout.js.map +1 -0
  88. package/dist/admin/utils/layouts/normalizeContentManagerLayout.mjs +321 -0
  89. package/dist/admin/utils/layouts/normalizeContentManagerLayout.mjs.map +1 -0
  90. package/dist/server/controllers/collection-types.js +7 -2
  91. package/dist/server/controllers/collection-types.js.map +1 -1
  92. package/dist/server/controllers/collection-types.mjs +7 -2
  93. package/dist/server/controllers/collection-types.mjs.map +1 -1
  94. package/dist/server/homepage/services/homepage-query-utils.js +56 -0
  95. package/dist/server/homepage/services/homepage-query-utils.js.map +1 -0
  96. package/dist/server/homepage/services/homepage-query-utils.mjs +50 -0
  97. package/dist/server/homepage/services/homepage-query-utils.mjs.map +1 -0
  98. package/dist/server/homepage/services/homepage.js +29 -29
  99. package/dist/server/homepage/services/homepage.js.map +1 -1
  100. package/dist/server/homepage/services/homepage.mjs +29 -29
  101. package/dist/server/homepage/services/homepage.mjs.map +1 -1
  102. package/dist/server/src/controllers/collection-types.d.ts.map +1 -1
  103. package/dist/server/src/homepage/services/homepage-query-utils.d.ts +28 -0
  104. package/dist/server/src/homepage/services/homepage-query-utils.d.ts.map +1 -0
  105. package/dist/server/src/homepage/services/homepage.d.ts.map +1 -1
  106. package/package.json +8 -8
@@ -1 +1 @@
1
- {"version":3,"file":"formatComponentConfigurationEditLayout.js","sources":["../../../admin/src/pages/formatComponentConfigurationEditLayout.ts"],"sourcesContent":["import { ComponentsDictionary } from '../hooks/useContentTypeSchema';\nimport { EditLayout, convertEditLayoutToFieldLayouts } from '../hooks/useDocumentLayout';\n\nimport type { Component, FindComponentConfiguration } from '../../../shared/contracts/components';\n\n/**\n * Formats API configuration + schemas into the shape expected by the component\n * \"Configure the view\" form. Matches the ListView / content-type path: nested\n * `convertEditLayoutToFieldLayouts` calls must receive component configuration\n * and full component schemas so `getMainField` can resolve fields inside nested\n * component attributes (see #25509).\n */\nconst formatComponentConfigurationEditLayout = (\n data: FindComponentConfiguration.Response['data'],\n { schema, components }: { schema?: Component; components: ComponentsDictionary }\n): EditLayout => {\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 const componentSchema = components[uid];\n if (!componentSchema) {\n return acc;\n }\n\n acc[uid] = {\n layout: convertEditLayoutToFieldLayouts(\n configuration.layouts.edit,\n componentSchema.attributes,\n configuration.metadatas,\n { configurations: data.components, schemas: components }\n ),\n settings: {\n ...configuration.settings,\n icon: componentSchema.info.icon,\n displayName: componentSchema.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\nexport { formatComponentConfigurationEditLayout };\n"],"names":["formatComponentConfigurationEditLayout","data","schema","components","editAttributes","convertEditLayoutToFieldLayouts","component","layouts","edit","attributes","metadatas","configurations","schemas","componentEditAttributes","Object","entries","reduce","acc","uid","configuration","componentSchema","layout","settings","icon","info","displayName","editMetadatas","attribute","metadata","options","pluginOptions"],"mappings":";;;;AAKA;;;;;;IAOA,MAAMA,yCAAyC,CAC7CC,IAAAA,EACA,EAAEC,MAAM,EAAEC,UAAU,EAA4D,GAAA;AAEhF,IAAA,MAAMC,cAAAA,GAAiBC,iDAAAA,CACrBJ,IAAAA,CAAKK,SAAS,CAACC,OAAO,CAACC,IAAI,EAC3BN,QAAQO,UAAAA,EACRR,IAAAA,CAAKK,SAAS,CAACI,SAAS,EACxB;AAAEC,QAAAA,cAAAA,EAAgBV,KAAKE,UAAU;QAAES,OAAAA,EAAST;AAAW,KAAA,CAAA;AAGzD,IAAA,MAAMU,uBAAAA,GAA0BC,MAAAA,CAAOC,OAAO,CAACd,IAAAA,CAAKE,UAAU,CAAA,CAAEa,MAAM,CACpE,CAACC,GAAAA,EAAK,CAACC,KAAKC,aAAAA,CAAc,GAAA;QACxB,MAAMC,eAAAA,GAAkBjB,UAAU,CAACe,GAAAA,CAAI;AACvC,QAAA,IAAI,CAACE,eAAAA,EAAiB;YACpB,OAAOH,GAAAA;AACT,QAAA;QAEAA,GAAG,CAACC,IAAI,GAAG;YACTG,MAAAA,EAAQhB,iDAAAA,CACNc,aAAAA,CAAcZ,OAAO,CAACC,IAAI,EAC1BY,eAAAA,CAAgBX,UAAU,EAC1BU,aAAAA,CAAcT,SAAS,EACvB;AAAEC,gBAAAA,cAAAA,EAAgBV,KAAKE,UAAU;gBAAES,OAAAA,EAAST;AAAW,aAAA,CAAA;YAEzDmB,QAAAA,EAAU;AACR,gBAAA,GAAGH,cAAcG,QAAQ;gBACzBC,IAAAA,EAAMH,eAAAA,CAAgBI,IAAI,CAACD,IAAI;gBAC/BE,WAAAA,EAAaL,eAAAA,CAAgBI,IAAI,CAACC;AACpC;AACF,SAAA;QACA,OAAOR,GAAAA;AACT,IAAA,CAAA,EACA,EAAC,CAAA;AAGH,IAAA,MAAMS,aAAAA,GAAgBZ,MAAAA,CAAOC,OAAO,CAACd,KAAKK,SAAS,CAACI,SAAS,CAAA,CAAEM,MAAM,CACnE,CAACC,GAAAA,EAAK,CAACU,WAAWC,QAAAA,CAAS,GAAA;QACzB,OAAO;AACL,YAAA,GAAGX,GAAG;YACN,CAACU,SAAAA,GAAYC,QAAAA,CAASpB;AACxB,SAAA;AACF,IAAA,CAAA,EACA,EAAC,CAAA;IAGH,OAAO;QACLa,MAAAA,EAAQ;AAACjB,YAAAA;AAAe,SAAA;QACxBD,UAAAA,EAAYU,uBAAAA;QACZH,SAAAA,EAAWgB,aAAAA;QACXG,OAAAA,EAAS;AACP,YAAA,GAAG3B,QAAQ2B,OAAO;AAClB,YAAA,GAAG3B,QAAQ4B;AACb,SAAA;QACAR,QAAAA,EAAU;YACR,GAAGrB,IAAAA,CAAKK,SAAS,CAACgB,QAAQ;AAC1BG,YAAAA,WAAAA,EAAavB,QAAQsB,IAAAA,CAAKC;AAC5B;AACF,KAAA;AACF;;;;"}
1
+ {"version":3,"file":"formatComponentConfigurationEditLayout.js","sources":["../../../admin/src/pages/formatComponentConfigurationEditLayout.ts"],"sourcesContent":["import { ComponentsDictionary } from '../hooks/useContentTypeSchema';\nimport { EditLayout, convertEditLayoutToFieldLayouts } from '../hooks/useDocumentLayout';\nimport { normalizeComponentConfigurationLayout } from '../utils/layouts/normalizeContentManagerLayout';\n\nimport type { Component, FindComponentConfiguration } from '../../../shared/contracts/components';\nimport type { Schema } from '../hooks/useDocument';\n\n/**\n * Formats API configuration + schemas into the shape expected by the component\n * \"Configure the view\" form. Matches the ListView / content-type path: nested\n * `convertEditLayoutToFieldLayouts` calls must receive component configuration\n * and full component schemas so `getMainField` can resolve fields inside nested\n * component attributes (see #25509).\n */\nconst formatComponentConfigurationEditLayout = (\n data: FindComponentConfiguration.Response['data'],\n {\n schema,\n components,\n schemas = [],\n }: { schema?: Component; components: ComponentsDictionary; schemas?: Schema[] }\n): EditLayout => {\n const normalizedData = normalizeComponentConfigurationLayout(data, {\n schema,\n components,\n schemas,\n });\n\n const editAttributes = convertEditLayoutToFieldLayouts(\n normalizedData.component.layouts.edit,\n schema?.attributes,\n normalizedData.component.metadatas,\n { configurations: normalizedData.components, schemas: components },\n schemas\n );\n\n const componentEditAttributes = Object.entries(normalizedData.components).reduce<\n EditLayout['components']\n >((acc, [uid, configuration]) => {\n const componentSchema = components[uid];\n if (!componentSchema) {\n return acc;\n }\n\n acc[uid] = {\n layout: convertEditLayoutToFieldLayouts(\n configuration.layouts.edit,\n componentSchema.attributes,\n configuration.metadatas,\n { configurations: normalizedData.components, schemas: components },\n schemas\n ),\n settings: {\n ...configuration.settings,\n icon: componentSchema.info.icon,\n displayName: componentSchema.info.displayName,\n },\n };\n return acc;\n }, {});\n\n const editMetadatas = Object.entries(normalizedData.component.metadatas).reduce<\n EditLayout['metadatas']\n >((acc, [attribute, metadata]) => {\n return {\n ...acc,\n [attribute]: metadata.edit,\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 ...normalizedData.component.settings,\n displayName: schema?.info.displayName,\n },\n };\n};\n\nexport { formatComponentConfigurationEditLayout };\n"],"names":["formatComponentConfigurationEditLayout","data","schema","components","schemas","normalizedData","normalizeComponentConfigurationLayout","editAttributes","convertEditLayoutToFieldLayouts","component","layouts","edit","attributes","metadatas","configurations","componentEditAttributes","Object","entries","reduce","acc","uid","configuration","componentSchema","layout","settings","icon","info","displayName","editMetadatas","attribute","metadata","options","pluginOptions"],"mappings":";;;;;AAOA;;;;;;IAOA,MAAMA,sCAAAA,GAAyC,CAC7CC,IAAAA,EACA,EACEC,MAAM,EACNC,UAAU,EACVC,OAAAA,GAAU,EAAE,EACiE,GAAA;IAE/E,MAAMC,cAAAA,GAAiBC,o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MAAM,CAE7E,CAACC,GAAAA,EAAK,CAACU,WAAWC,QAAAA,CAAS,GAAA;QAC3B,OAAO;AACL,YAAA,GAAGX,GAAG;YACN,CAACU,SAAAA,GAAYC,QAAAA,CAASnB;AACxB,SAAA;AACF,IAAA,CAAA,EAAG,EAAC,CAAA;IAEJ,OAAO;QACLY,MAAAA,EAAQ;AAAChB,YAAAA;AAAe,SAAA;QACxBJ,UAAAA,EAAYY,uBAAAA;QACZF,SAAAA,EAAWe,aAAAA;QACXG,OAAAA,EAAS;AACP,YAAA,GAAG7B,QAAQ6B,OAAO;AAClB,YAAA,GAAG7B,QAAQ8B;AACb,SAAA;QACAR,QAAAA,EAAU;YACR,GAAGnB,cAAAA,CAAeI,SAAS,CAACe,QAAQ;AACpCG,YAAAA,WAAAA,EAAazB,QAAQwB,IAAAA,CAAKC;AAC5B;AACF,KAAA;AACF;;;;"}
@@ -1,4 +1,5 @@
1
1
  import { convertEditLayoutToFieldLayouts } from '../hooks/useDocumentLayout.mjs';
2
+ import { normalizeComponentConfigurationLayout } from '../utils/layouts/normalizeContentManagerLayout.mjs';
2
3
 
3
4
  /**
4
5
  * Formats API configuration + schemas into the shape expected by the component
@@ -6,21 +7,26 @@ import { convertEditLayoutToFieldLayouts } from '../hooks/useDocumentLayout.mjs'
6
7
  * `convertEditLayoutToFieldLayouts` calls must receive component configuration
7
8
  * and full component schemas so `getMainField` can resolve fields inside nested
8
9
  * component attributes (see #25509).
9
- */ const formatComponentConfigurationEditLayout = (data, { schema, components })=>{
10
- const editAttributes = convertEditLayoutToFieldLayouts(data.component.layouts.edit, schema?.attributes, data.component.metadatas, {
11
- configurations: data.components,
12
- schemas: components
10
+ */ const formatComponentConfigurationEditLayout = (data, { schema, components, schemas = [] })=>{
11
+ const normalizedData = normalizeComponentConfigurationLayout(data, {
12
+ schema,
13
+ components,
14
+ schemas
13
15
  });
14
- const componentEditAttributes = Object.entries(data.components).reduce((acc, [uid, configuration])=>{
16
+ const editAttributes = convertEditLayoutToFieldLayouts(normalizedData.component.layouts.edit, schema?.attributes, normalizedData.component.metadatas, {
17
+ configurations: normalizedData.components,
18
+ schemas: components
19
+ }, schemas);
20
+ const componentEditAttributes = Object.entries(normalizedData.components).reduce((acc, [uid, configuration])=>{
15
21
  const componentSchema = components[uid];
16
22
  if (!componentSchema) {
17
23
  return acc;
18
24
  }
19
25
  acc[uid] = {
20
26
  layout: convertEditLayoutToFieldLayouts(configuration.layouts.edit, componentSchema.attributes, configuration.metadatas, {
21
- configurations: data.components,
27
+ configurations: normalizedData.components,
22
28
  schemas: components
23
- }),
29
+ }, schemas),
24
30
  settings: {
25
31
  ...configuration.settings,
26
32
  icon: componentSchema.info.icon,
@@ -29,7 +35,7 @@ import { convertEditLayoutToFieldLayouts } from '../hooks/useDocumentLayout.mjs'
29
35
  };
30
36
  return acc;
31
37
  }, {});
32
- const editMetadatas = Object.entries(data.component.metadatas).reduce((acc, [attribute, metadata])=>{
38
+ const editMetadatas = Object.entries(normalizedData.component.metadatas).reduce((acc, [attribute, metadata])=>{
33
39
  return {
34
40
  ...acc,
35
41
  [attribute]: metadata.edit
@@ -46,7 +52,7 @@ import { convertEditLayoutToFieldLayouts } from '../hooks/useDocumentLayout.mjs'
46
52
  ...schema?.pluginOptions
47
53
  },
48
54
  settings: {
49
- ...data.component.settings,
55
+ ...normalizedData.component.settings,
50
56
  displayName: schema?.info.displayName
51
57
  }
52
58
  };
@@ -1 +1 @@
1
- {"version":3,"file":"formatComponentConfigurationEditLayout.mjs","sources":["../../../admin/src/pages/formatComponentConfigurationEditLayout.ts"],"sourcesContent":["import { ComponentsDictionary } from '../hooks/useContentTypeSchema';\nimport { EditLayout, convertEditLayoutToFieldLayouts } from '../hooks/useDocumentLayout';\n\nimport type { Component, FindComponentConfiguration } from '../../../shared/contracts/components';\n\n/**\n * Formats API configuration + schemas into the shape expected by the component\n * \"Configure the view\" form. Matches the ListView / content-type path: nested\n * `convertEditLayoutToFieldLayouts` calls must receive component configuration\n * and full component schemas so `getMainField` can resolve fields inside nested\n * component attributes (see #25509).\n */\nconst formatComponentConfigurationEditLayout = (\n data: FindComponentConfiguration.Response['data'],\n { schema, components }: { schema?: Component; components: ComponentsDictionary }\n): EditLayout => {\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 const componentSchema = components[uid];\n if (!componentSchema) {\n return acc;\n }\n\n acc[uid] = {\n layout: convertEditLayoutToFieldLayouts(\n configuration.layouts.edit,\n componentSchema.attributes,\n configuration.metadatas,\n { configurations: data.components, schemas: components }\n ),\n settings: {\n ...configuration.settings,\n icon: componentSchema.info.icon,\n displayName: componentSchema.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\nexport { formatComponentConfigurationEditLayout };\n"],"names":["formatComponentConfigurationEditLayout","data","schema","components","editAttributes","convertEditLayoutToFieldLayouts","component","layouts","edit","attributes","metadatas","configurations","schemas","componentEditAttributes","Object","entries","reduce","acc","uid","configuration","componentSchema","layout","settings","icon","info","displayName","editMetadatas","attribute","metadata","options","pluginOptions"],"mappings":";;AAKA;;;;;;IAOA,MAAMA,yCAAyC,CAC7CC,IAAAA,EACA,EAAEC,MAAM,EAAEC,UAAU,EAA4D,GAAA;AAEhF,IAAA,MAAMC,cAAAA,GAAiBC,+BAAAA,CACrBJ,IAAAA,CAAKK,SAAS,CAACC,OAAO,CAACC,IAAI,EAC3BN,QAAQ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AAAA;AAAe,SAAA;QACxBD,UAAAA,EAAYU,uBAAAA;QACZH,SAAAA,EAAWgB,aAAAA;QACXG,OAAAA,EAAS;AACP,YAAA,GAAG3B,QAAQ2B,OAAO;AAClB,YAAA,GAAG3B,QAAQ4B;AACb,SAAA;QACAR,QAAAA,EAAU;YACR,GAAGrB,IAAAA,CAAKK,SAAS,CAACgB,QAAQ;AAC1BG,YAAAA,WAAAA,EAAavB,QAAQsB,IAAAA,CAAKC;AAC5B;AACF,KAAA;AACF;;;;"}
1
+ {"version":3,"file":"formatComponentConfigurationEditLayout.mjs","sources":["../../../admin/src/pages/formatComponentConfigurationEditLayout.ts"],"sourcesContent":["import { ComponentsDictionary } from '../hooks/useContentTypeSchema';\nimport { EditLayout, convertEditLayoutToFieldLayouts } from '../hooks/useDocumentLayout';\nimport { normalizeComponentConfigurationLayout } from '../utils/layouts/normalizeContentManagerLayout';\n\nimport type { Component, FindComponentConfiguration } from '../../../shared/contracts/components';\nimport type { Schema } from '../hooks/useDocument';\n\n/**\n * Formats API configuration + schemas into the shape expected by the component\n * \"Configure the view\" form. Matches the ListView / content-type path: nested\n * `convertEditLayoutToFieldLayouts` calls must receive component configuration\n * and full component schemas so `getMainField` can resolve fields inside nested\n * component attributes (see #25509).\n */\nconst formatComponentConfigurationEditLayout = (\n data: FindComponentConfiguration.Response['data'],\n {\n schema,\n components,\n schemas = [],\n }: { schema?: Component; components: ComponentsDictionary; schemas?: Schema[] }\n): EditLayout => {\n const normalizedData = normalizeComponentConfigurationLayout(data, {\n schema,\n components,\n schemas,\n });\n\n const editAttributes = convertEditLayoutToFieldLayouts(\n normalizedData.component.layouts.edit,\n schema?.attributes,\n normalizedData.component.metadatas,\n { configurations: normalizedData.components, schemas: components },\n schemas\n );\n\n const componentEditAttributes = Object.entries(normalizedData.components).reduce<\n EditLayout['components']\n >((acc, [uid, configuration]) => {\n const componentSchema = components[uid];\n if (!componentSchema) {\n return acc;\n }\n\n acc[uid] = {\n layout: convertEditLayoutToFieldLayouts(\n configuration.layouts.edit,\n componentSchema.attributes,\n configuration.metadatas,\n { configurations: normalizedData.components, schemas: components },\n schemas\n ),\n settings: {\n ...configuration.settings,\n icon: componentSchema.info.icon,\n displayName: componentSchema.info.displayName,\n },\n };\n return acc;\n }, {});\n\n const editMetadatas = Object.entries(normalizedData.component.metadatas).reduce<\n EditLayout['metadatas']\n >((acc, [attribute, metadata]) => {\n return {\n ...acc,\n [attribute]: metadata.edit,\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 ...normalizedData.component.settings,\n displayName: schema?.info.displayName,\n },\n };\n};\n\nexport { formatComponentConfigurationEditLayout };\n"],"names":["formatComponentConfigurationEditLayout","data","schema","components","schemas","normalizedData","normalizeComponentConfigurationLayout","editAttributes","convertEditLayoutToFieldLayouts","component","layouts","edit","attributes","metadatas","configurations","componentEditAttributes","Object","entries","reduce","acc","uid","configuration","componentSchema","layout","settings","icon","info","displayName","editMetadatas","attribute","metadata","options","pluginOptions"],"mappings":";;;AAOA;;;;;;IAOA,MAAMA,sCAAAA,GAAyC,CAC7CC,IAAAA,EACA,EACEC,MAAM,EACNC,UAAU,EACVC,OAAAA,GAAU,EAAE,EACiE,GAAA;IAE/E,MAAMC,cAAAA,GAAiBC,sCAAsCL,IAAAA,EAAM;AACjEC,QAAAA,MAAAA;AACAC,QAAAA,UAAAA;AACAC,QAAAA;AACF,KAAA,CAAA;AAEA,IAAA,MAAMG,cAAAA,GAAiBC,+BAAAA,CACrBH,cAAAA,CAAeI,SAAS,CAACC,OAAO,CAACC,IAAI,EACrCT,QAAQU,UAAAA,EACRP,cAAAA,CAAeI,SAAS,CAACI,SAAS,EAClC;AAAEC,QAAAA,cAAAA,EAAgBT,eAAeF,UAAU;QAAEC,OAAAA,EAASD;KAAW,EACjEC,OAAAA,CAAAA;AAGF,IAAA,MAAMW,uBAAAA,GAA0BC,M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AAQ8B;AACb,SAAA;QACAR,QAAAA,EAAU;YACR,GAAGnB,cAAAA,CAAeI,SAAS,CAACe,QAAQ;AACpCG,YAAAA,WAAAA,EAAazB,QAAQwB,IAAAA,CAAKC;AAC5B;AACF,KAAA;AACF;;;;"}
@@ -1,12 +1,13 @@
1
1
  'use strict';
2
2
 
3
+ var normalizeContentManagerLayout = require('../utils/layouts/normalizeContentManagerLayout.js');
3
4
  var api = require('./api.js');
4
5
 
5
6
  const componentsApi = api.contentManagerApi.injectEndpoints({
6
7
  endpoints: (builder)=>({
7
8
  getComponentConfiguration: builder.query({
8
9
  query: (uid)=>`/content-manager/components/${uid}/configuration`,
9
- transformResponse: (response)=>response.data,
10
+ transformResponse: (response, _meta, uid)=>normalizeContentManagerLayout.normalizeComponentConfigurationResponse(response.data, uid),
10
11
  providesTags: (_result, _error, uid)=>[
11
12
  {
12
13
  type: 'ComponentConfiguration',
@@ -20,7 +21,7 @@ const componentsApi = api.contentManagerApi.injectEndpoints({
20
21
  method: 'PUT',
21
22
  data: body
22
23
  }),
23
- transformResponse: (response)=>response.data,
24
+ transformResponse: (response)=>normalizeContentManagerLayout.normalizeComponentConfigurationUpdateResponse(response.data),
24
25
  invalidatesTags: (_result, _error, { uid })=>[
25
26
  {
26
27
  type: 'ComponentConfiguration',
@@ -1 +1 @@
1
- {"version":3,"file":"components.js","sources":["../../../admin/src/services/components.ts"],"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"],"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"],"mappings":";;;;AAOA,MAAMA,aAAAA,GAAgBC,qBAAAA,CAAkBC,eAAe,CAAC;IACtDC,SAAAA,EAAW,CAACC,WAAa;YACvBC,yBAAAA,EAA2BD,OAAAA,CAAQE,KAAK,CAGtC;AACAA,gBAAAA,KAAAA,EAAO,CAACC,GAAAA,GAAQ,CAAC,4BAA4B,EAAEA,GAAAA,CAAI,cAAc,CAAC;gBAClEC,iBAAAA,EAAmB,CAACC,QAAAA,GAAkDA,QAAAA,CAASC,IAAI;gBACnFC,YAAAA,EAAc,CAACC,OAAAA,EAASC,MAAAA,EAAQN,GAAAA,GAAQ;AAAC,wBAAA;4BAAEO,IAAAA,EAAM,wBAAA;4BAA0BC,EAAAA,EAAIR;AAAI;AAAE;AACvF,aAAA,CAAA;YACAS,4BAAAA,EAA8BZ,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,MAAAA,EAAQ,KAAA;wBACRV,IAAAA,EAAMQ;qBACR,CAAA;gBACAV,iBAAAA,EAAmB,CAACC,QAAAA,GAAoDA,QAAAA,CAASC,IAAI;AACrFW,gBAAAA,eAAAA,EAAiB,CAACT,OAAAA,EAASC,MAAAA,EAAQ,EAAEN,GAAG,EAAE,GAAK;AAC7C,wBAAA;4BAAEO,IAAAA,EAAM,wBAAA;4BAA0BC,EAAAA,EAAIR;AAAI,yBAAA;;AAE1C,wBAAA;4BAAEO,IAAAA,EAAM,qBAAA;4BAAuBC,EAAAA,EAAI;AAAO;AAC3C;AACH,aAAA;SACF;AACF,CAAA,CAAA;AAEA,MAAM,EAAEO,iCAAiC,EAAEC,uCAAuC,EAAE,GAClFvB;;;;;"}
1
+ {"version":3,"file":"components.js","sources":["../../../admin/src/services/components.ts"],"sourcesContent":["import {\n normalizeComponentConfigurationResponse,\n normalizeComponentConfigurationUpdateResponse,\n} from '../utils/layouts/normalizeContentManagerLayout';\n\nimport { 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, _meta, uid) =>\n normalizeComponentConfigurationResponse(response.data, uid),\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) =>\n normalizeComponentConfigurationUpdateResponse(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"],"names":["componentsApi","contentManagerApi","injectEndpoints","endpoints","builder","getComponentConfiguration","query","uid","transformResponse","response","_meta","normalizeComponentConfigurationResponse","data","providesTags","_result","_error","type","id","updateComponentConfiguration","mutation","body","url","method","normalizeComponentConfigurationUpdateResponse","invalidatesTags","useGetComponentConfigurationQuery","useUpdateComponentConfigurationMutation"],"mappings":";;;;;AAYA,MAAMA,aAAAA,GAAgBC,qBAAAA,CAAkBC,eAAe,CAAC;IACtDC,SAAAA,EAAW,CAACC,WAAa;YACvBC,yBAAAA,EAA2BD,OAAAA,CAAQE,KAAK,CAGtC;AACAA,gBAAAA,KAAAA,EAAO,CAACC,GAAAA,GAAQ,CAAC,4BAA4B,EAAEA,GAAAA,CAAI,cAAc,CAAC;AAClEC,gBAAAA,iBAAAA,EAAmB,CAACC,QAAAA,EAA+CC,KAAAA,EAAOH,MACxEI,qEAAAA,CAAwCF,QAAAA,CAASG,IAAI,EAAEL,GAAAA,CAAAA;gBACzDM,YAAAA,EAAc,CAACC,OAAAA,EAASC,MAAAA,EAAQR,GAAAA,GAAQ;AAAC,wBAAA;4BAAES,IAAAA,EAAM,wBAAA;4BAA0BC,EAAAA,EAAIV;AAAI;AAAE;AACvF,aAAA,CAAA;YACAW,4BAAAA,EAA8Bd,OAAAA,CAAQe,QAAQ,CAAC;AAC7Cb,gBAAAA,KAAAA,EAAO,CAAC,EAAEC,GAAG,EAAE,GAAGa,IAAAA,EAAM,IAAM;AAC5BC,wBAAAA,GAAAA,EAAK,CAAC,4BAA4B,EAAEd,GAAAA,CAAI,cAAc,CAAC;wBACvDe,MAAAA,EAAQ,KAAA;wBACRV,IAAAA,EAAMQ;qBACR,CAAA;AACAZ,gBAAAA,iBAAAA,EAAmB,CAACC,QAAAA,GAClBc,2EAAAA,CAA8Cd,QAAAA,CAASG,IAAI,CAAA;AAC7DY,gBAAAA,eAAAA,EAAiB,CAACV,OAAAA,EAASC,MAAAA,EAAQ,EAAER,GAAG,EAAE,GAAK;AAC7C,wBAAA;4BAAES,IAAAA,EAAM,wBAAA;4BAA0BC,EAAAA,EAAIV;AAAI,yBAAA;;AAE1C,wBAAA;4BAAES,IAAAA,EAAM,qBAAA;4BAAuBC,EAAAA,EAAI;AAAO;AAC3C;AACH,aAAA;SACF;AACF,CAAA,CAAA;AAEA,MAAM,EAAEQ,iCAAiC,EAAEC,uCAAuC,EAAE,GAClF1B;;;;;"}
@@ -1,10 +1,11 @@
1
+ import { normalizeComponentConfigurationUpdateResponse, normalizeComponentConfigurationResponse } from '../utils/layouts/normalizeContentManagerLayout.mjs';
1
2
  import { contentManagerApi } from './api.mjs';
2
3
 
3
4
  const componentsApi = contentManagerApi.injectEndpoints({
4
5
  endpoints: (builder)=>({
5
6
  getComponentConfiguration: builder.query({
6
7
  query: (uid)=>`/content-manager/components/${uid}/configuration`,
7
- transformResponse: (response)=>response.data,
8
+ transformResponse: (response, _meta, uid)=>normalizeComponentConfigurationResponse(response.data, uid),
8
9
  providesTags: (_result, _error, uid)=>[
9
10
  {
10
11
  type: 'ComponentConfiguration',
@@ -18,7 +19,7 @@ const componentsApi = contentManagerApi.injectEndpoints({
18
19
  method: 'PUT',
19
20
  data: body
20
21
  }),
21
- transformResponse: (response)=>response.data,
22
+ transformResponse: (response)=>normalizeComponentConfigurationUpdateResponse(response.data),
22
23
  invalidatesTags: (_result, _error, { uid })=>[
23
24
  {
24
25
  type: 'ComponentConfiguration',
@@ -1 +1 @@
1
- {"version":3,"file":"components.mjs","sources":["../../../admin/src/services/components.ts"],"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"],"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"],"mappings":";;AAOA,MAAMA,aAAAA,GAAgBC,iBAAAA,CAAkBC,eAAe,CAAC;IACtDC,SAAAA,EAAW,CAACC,WAAa;YACvBC,yBAAAA,EAA2BD,OAAAA,CAAQE,KAAK,CAGtC;AACAA,gBAAAA,KAAAA,EAAO,CAACC,GAAAA,GAAQ,CAAC,4BAA4B,EAAEA,GAAAA,CAAI,cAAc,CAAC;gBAClEC,iBAAAA,EAAmB,CAACC,QAAAA,GAAkDA,QAAAA,CAASC,IAAI;gBACnFC,YAAAA,EAAc,CAACC,OAAAA,EAASC,MAAAA,EAAQN,GAAAA,GAAQ;AAAC,wBAAA;4BAAEO,IAAAA,EAAM,wBAAA;4BAA0BC,EAAAA,EAAIR;AAAI;AAAE;AACvF,aAAA,CAAA;YACAS,4BAAAA,EAA8BZ,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,MAAAA,EAAQ,KAAA;wBACRV,IAAAA,EAAMQ;qBACR,CAAA;gBACAV,iBAAAA,EAAmB,CAACC,QAAAA,GAAoDA,QAAAA,CAASC,IAAI;AACrFW,gBAAAA,eAAAA,EAAiB,CAACT,OAAAA,EAASC,MAAAA,EAAQ,EAAEN,GAAG,EAAE,GAAK;AAC7C,wBAAA;4BAAEO,IAAAA,EAAM,wBAAA;4BAA0BC,EAAAA,EAAIR;AAAI,yBAAA;;AAE1C,wBAAA;4BAAEO,IAAAA,EAAM,qBAAA;4BAAuBC,EAAAA,EAAI;AAAO;AAC3C;AACH,aAAA;SACF;AACF,CAAA,CAAA;AAEA,MAAM,EAAEO,iCAAiC,EAAEC,uCAAuC,EAAE,GAClFvB;;;;"}
1
+ {"version":3,"file":"components.mjs","sources":["../../../admin/src/services/components.ts"],"sourcesContent":["import {\n normalizeComponentConfigurationResponse,\n normalizeComponentConfigurationUpdateResponse,\n} from '../utils/layouts/normalizeContentManagerLayout';\n\nimport { 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, _meta, uid) =>\n normalizeComponentConfigurationResponse(response.data, uid),\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) =>\n normalizeComponentConfigurationUpdateResponse(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"],"names":["componentsApi","contentManagerApi","injectEndpoints","endpoints","builder","getComponentConfiguration","query","uid","transformResponse","response","_meta","normalizeComponentConfigurationResponse","data","providesTags","_result","_error","type","id","updateComponentConfiguration","mutation","body","url","method","normalizeComponentConfigurationUpdateResponse","invalidatesTags","useGetComponentConfigurationQuery","useUpdateComponentConfigurationMutation"],"mappings":";;;AAYA,MAAMA,aAAAA,GAAgBC,iBAAAA,CAAkBC,eAAe,CAAC;IACtDC,SAAAA,EAAW,CAACC,WAAa;YACvBC,yBAAAA,EAA2BD,OAAAA,CAAQE,KAAK,CAGtC;AACAA,gBAAAA,KAAAA,EAAO,CAACC,GAAAA,GAAQ,CAAC,4BAA4B,EAAEA,GAAAA,CAAI,cAAc,CAAC;AAClEC,gBAAAA,iBAAAA,EAAmB,CAACC,QAAAA,EAA+CC,KAAAA,EAAOH,MACxEI,uCAAAA,CAAwCF,QAAAA,CAASG,IAAI,EAAEL,GAAAA,CAAAA;gBACzDM,YAAAA,EAAc,CAACC,OAAAA,EAASC,MAAAA,EAAQR,GAAAA,GAAQ;AAAC,wBAAA;4BAAES,IAAAA,EAAM,wBAAA;4BAA0BC,EAAAA,EAAIV;AAAI;AAAE;AACvF,aAAA,CAAA;YACAW,4BAAAA,EAA8Bd,OAAAA,CAAQe,QAAQ,CAAC;AAC7Cb,gBAAAA,KAAAA,EAAO,CAAC,EAAEC,GAAG,EAAE,GAAGa,IAAAA,EAAM,IAAM;AAC5BC,wBAAAA,GAAAA,EAAK,CAAC,4BAA4B,EAAEd,GAAAA,CAAI,cAAc,CAAC;wBACvDe,MAAAA,EAAQ,KAAA;wBACRV,IAAAA,EAAMQ;qBACR,CAAA;AACAZ,gBAAAA,iBAAAA,EAAmB,CAACC,QAAAA,GAClBc,6CAAAA,CAA8Cd,QAAAA,CAASG,IAAI,CAAA;AAC7DY,gBAAAA,eAAAA,EAAiB,CAACV,OAAAA,EAASC,MAAAA,EAAQ,EAAER,GAAG,EAAE,GAAK;AAC7C,wBAAA;4BAAES,IAAAA,EAAM,wBAAA;4BAA0BC,EAAAA,EAAIV;AAAI,yBAAA;;AAE1C,wBAAA;4BAAES,IAAAA,EAAM,qBAAA;4BAAuBC,EAAAA,EAAI;AAAO;AAC3C;AACH,aAAA;SACF;AACF,CAAA,CAAA;AAEA,MAAM,EAAEQ,iCAAiC,EAAEC,uCAAuC,EAAE,GAClF1B;;;;"}
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
 
3
+ var normalizeContentManagerLayout = require('../utils/layouts/normalizeContentManagerLayout.js');
3
4
  var api = require('./api.js');
4
5
 
5
6
  const contentTypesApi = api.contentManagerApi.injectEndpoints({
@@ -9,7 +10,7 @@ const contentTypesApi = api.contentManagerApi.injectEndpoints({
9
10
  url: `/content-manager/content-types/${uid}/configuration`,
10
11
  method: 'GET'
11
12
  }),
12
- transformResponse: (response)=>response.data,
13
+ transformResponse: (response, _meta, uid)=>normalizeContentManagerLayout.normalizeContentTypeConfigurationResponse(response.data, uid),
13
14
  providesTags: (_result, _error, uid)=>[
14
15
  {
15
16
  type: 'ContentTypesConfiguration',
@@ -23,7 +24,7 @@ const contentTypesApi = api.contentManagerApi.injectEndpoints({
23
24
  }),
24
25
  getAllContentTypeSettings: builder.query({
25
26
  query: ()=>'/content-manager/content-types-settings',
26
- transformResponse: (response)=>response.data,
27
+ transformResponse: (response)=>normalizeContentManagerLayout.normalizeContentTypeSettingsResponse(response.data),
27
28
  providesTags: [
28
29
  {
29
30
  type: 'ContentTypeSettings',
@@ -37,7 +38,7 @@ const contentTypesApi = api.contentManagerApi.injectEndpoints({
37
38
  method: 'PUT',
38
39
  data: body
39
40
  }),
40
- transformResponse: (response)=>response.data,
41
+ transformResponse: (response)=>normalizeContentManagerLayout.normalizeContentTypeConfigurationUpdateResponse(response.data),
41
42
  invalidatesTags: (_result, _error, { uid })=>[
42
43
  {
43
44
  type: 'ContentTypesConfiguration',
@@ -1 +1 @@
1
- {"version":3,"file":"contentTypes.js","sources":["../../../admin/src/services/contentTypes.ts"],"sourcesContent":["import {\n FindContentTypeConfiguration,\n UpdateContentTypeConfiguration,\n FindContentTypesSettings,\n} from '../../../shared/contracts/content-types';\n\nimport { contentManagerApi } from './api';\n\nconst contentTypesApi = contentManagerApi.injectEndpoints({\n endpoints: (builder) => ({\n getContentTypeConfiguration: builder.query<\n FindContentTypeConfiguration.Response['data'],\n string\n >({\n query: (uid) => ({\n url: `/content-manager/content-types/${uid}/configuration`,\n method: 'GET',\n }),\n transformResponse: (response: FindContentTypeConfiguration.Response) => response.data,\n providesTags: (_result, _error, uid) => [\n { type: 'ContentTypesConfiguration', id: uid },\n { type: 'ContentTypeSettings', id: 'LIST' },\n ],\n }),\n getAllContentTypeSettings: builder.query<FindContentTypesSettings.Response['data'], void>({\n query: () => '/content-manager/content-types-settings',\n transformResponse: (response: FindContentTypesSettings.Response) => response.data,\n providesTags: [{ type: 'ContentTypeSettings', id: 'LIST' }],\n }),\n updateContentTypeConfiguration: builder.mutation<\n UpdateContentTypeConfiguration.Response['data'],\n UpdateContentTypeConfiguration.Request['body'] & {\n uid: string;\n }\n >({\n query: ({ uid, ...body }) => ({\n url: `/content-manager/content-types/${uid}/configuration`,\n method: 'PUT',\n data: body,\n }),\n transformResponse: (response: UpdateContentTypeConfiguration.Response) => response.data,\n invalidatesTags: (_result, _error, { uid }) => [\n { type: 'ContentTypesConfiguration', id: uid },\n { type: 'ContentTypeSettings', id: 'LIST' },\n // Is this necessary?\n { type: 'InitialData' },\n ],\n }),\n }),\n});\n\nconst {\n useGetContentTypeConfigurationQuery,\n useGetAllContentTypeSettingsQuery,\n useUpdateContentTypeConfigurationMutation,\n} = contentTypesApi;\n\nexport {\n useGetContentTypeConfigurationQuery,\n useGetAllContentTypeSettingsQuery,\n useUpdateContentTypeConfigurationMutation,\n};\n"],"names":["contentTypesApi","contentManagerApi","injectEndpoints","endpoints","builder","getContentTypeConfiguration","query","uid","url","method","transformResponse","response","data","providesTags","_result","_error","type","id","getAllContentTypeSettings","updateContentTypeConfiguration","mutation","body","invalidatesTags","useGetContentTypeConfigurationQuery","useGetAllContentTypeSettingsQuery","useUpdateContentTypeConfigurationMutation"],"mappings":";;;;AAQA,MAAMA,eAAAA,GAAkBC,qBAAAA,CAAkBC,eAAe,CAAC;IACxDC,SAAAA,EAAW,CAACC,WAAa;YACvBC,2BAAAA,EAA6BD,OAAAA,CAAQE,KAAK,CAGxC;gBACAA,KAAAA,EAAO,CAACC,OAAS;AACfC,wBAAAA,GAAAA,EAAK,CAAC,+BAA+B,EAAED,GAAAA,CAAI,cAAc,CAAC;wBAC1DE,MAAAA,EAAQ;qBACV,CAAA;gBACAC,iBAAAA,EAAmB,CAACC,QAAAA,GAAoDA,QAAAA,CAASC,IAAI;gBACrFC,YAAAA,EAAc,CAACC,OAAAA,EAASC,MAAAA,EAAQR,GAAAA,GAAQ;AACtC,wBAAA;4BAAES,IAAAA,EAAM,2BAAA;4BAA6BC,EAAAA,EAAIV;AAAI,yBAAA;AAC7C,wBAAA;4BAAES,IAAAA,EAAM,qBAAA;4BAAuBC,EAAAA,EAAI;AAAO;AAC3C;AACH,aAAA,CAAA;YACAC,yBAAAA,EAA2Bd,OAAAA,CAAQE,KAAK,CAAkD;AACxFA,gBAAAA,KAAAA,EAAO,IAAM,yCAAA;gBACbI,iBAAAA,EAAmB,CAACC,QAAAA,GAAgDA,QAAAA,CAASC,IAAI;gBACjFC,YAAAA,EAAc;AAAC,oBAAA;wBAAEG,IAAAA,EAAM,qBAAA;wBAAuBC,EAAAA,EAAI;AAAO;AAAE;AAC7D,aAAA,CAAA;YACAE,8BAAAA,EAAgCf,OAAAA,CAAQgB,QAAQ,CAK9C;AACAd,gBAAAA,KAAAA,EAAO,CAAC,EAAEC,GAAG,EAAE,GAAGc,IAAAA,EAAM,IAAM;AAC5Bb,wBAAAA,GAAAA,EAAK,CAAC,+BAA+B,EAAED,GAAAA,CAAI,cAAc,CAAC;wBAC1DE,MAAAA,EAAQ,KAAA;wBACRG,IAAAA,EAAMS;qBACR,CAAA;gBACAX,iBAAAA,EAAmB,CAACC,QAAAA,GAAsDA,QAAAA,CAASC,IAAI;AACvFU,gBAAAA,eAAAA,EAAiB,CAACR,OAAAA,EAASC,MAAAA,EAAQ,EAAER,GAAG,EAAE,GAAK;AAC7C,wBAAA;4BAAES,IAAAA,EAAM,2BAAA;4BAA6BC,EAAAA,EAAIV;AAAI,yBAAA;AAC7C,wBAAA;4BAAES,IAAAA,EAAM,qBAAA;4BAAuBC,EAAAA,EAAI;AAAO,yBAAA;;AAE1C,wBAAA;4BAAED,IAAAA,EAAM;AAAc;AACvB;AACH,aAAA;SACF;AACF,CAAA,CAAA;AAEA,MAAM,EACJO,mCAAmC,EACnCC,iCAAiC,EACjCC,yCAAyC,EAC1C,GAAGzB;;;;;;"}
1
+ {"version":3,"file":"contentTypes.js","sources":["../../../admin/src/services/contentTypes.ts"],"sourcesContent":["import {\n FindContentTypeConfiguration,\n UpdateContentTypeConfiguration,\n FindContentTypesSettings,\n} from '../../../shared/contracts/content-types';\nimport {\n normalizeContentTypeConfigurationResponse,\n normalizeContentTypeConfigurationUpdateResponse,\n normalizeContentTypeSettingsResponse,\n} from '../utils/layouts/normalizeContentManagerLayout';\n\nimport { contentManagerApi } from './api';\n\nconst contentTypesApi = contentManagerApi.injectEndpoints({\n endpoints: (builder) => ({\n getContentTypeConfiguration: builder.query<\n FindContentTypeConfiguration.Response['data'],\n string\n >({\n query: (uid) => ({\n url: `/content-manager/content-types/${uid}/configuration`,\n method: 'GET',\n }),\n transformResponse: (response: FindContentTypeConfiguration.Response, _meta, uid) =>\n normalizeContentTypeConfigurationResponse(response.data, uid),\n providesTags: (_result, _error, uid) => [\n { type: 'ContentTypesConfiguration', id: uid },\n { type: 'ContentTypeSettings', id: 'LIST' },\n ],\n }),\n getAllContentTypeSettings: builder.query<FindContentTypesSettings.Response['data'], void>({\n query: () => '/content-manager/content-types-settings',\n transformResponse: (response: FindContentTypesSettings.Response) =>\n normalizeContentTypeSettingsResponse(response.data),\n providesTags: [{ type: 'ContentTypeSettings', id: 'LIST' }],\n }),\n updateContentTypeConfiguration: builder.mutation<\n UpdateContentTypeConfiguration.Response['data'],\n UpdateContentTypeConfiguration.Request['body'] & {\n uid: string;\n }\n >({\n query: ({ uid, ...body }) => ({\n url: `/content-manager/content-types/${uid}/configuration`,\n method: 'PUT',\n data: body,\n }),\n transformResponse: (response: UpdateContentTypeConfiguration.Response) =>\n normalizeContentTypeConfigurationUpdateResponse(response.data),\n invalidatesTags: (_result, _error, { uid }) => [\n { type: 'ContentTypesConfiguration', id: uid },\n { type: 'ContentTypeSettings', id: 'LIST' },\n // Is this necessary?\n { type: 'InitialData' },\n ],\n }),\n }),\n});\n\nconst {\n useGetContentTypeConfigurationQuery,\n useGetAllContentTypeSettingsQuery,\n useUpdateContentTypeConfigurationMutation,\n} = contentTypesApi;\n\nexport {\n useGetContentTypeConfigurationQuery,\n useGetAllContentTypeSettingsQuery,\n useUpdateContentTypeConfigurationMutation,\n};\n"],"names":["contentTypesApi","contentManagerApi","injectEndpoints","endpoints","builder","getContentTypeConfiguration","query","uid","url","method","transformResponse","response","_meta","normalizeContentTypeConfigurationResponse","data","providesTags","_result","_error","type","id","getAllContentTypeSettings","normalizeContentTypeSettingsResponse","updateContentTypeConfiguration","mutation","body","normalizeContentTypeConfigurationUpdateResponse","invalidatesTags","useGetContentTypeConfigurationQuery","useGetAllContentTypeSettingsQuery","useUpdateContentTypeConfigurationMutation"],"mappings":";;;;;AAaA,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,CAAA;AACAd,gBAAAA,iBAAAA,EAAmB,CAACC,QAAAA,GAClBc,6EAAAA,CAAgDd,QAAAA,CAASG,IAAI,CAAA;AAC/DY,gBAAAA,eAAAA,EAAiB,CAACV,OAAAA,EAASC,MAAAA,EAAQ,EAAEV,GAAG,EAAE,GAAK;AAC7C,wBAAA;4BAAEW,IAAAA,EAAM,2BAAA;4BAA6BC,EAAAA,EAAIZ;AAAI,yBAAA;AAC7C,wBAAA;4BAAEW,IAAAA,EAAM,qBAAA;4BAAuBC,EAAAA,EAAI;AAAO,yBAAA;;AAE1C,wBAAA;4BAAED,IAAAA,EAAM;AAAc;AACvB;AACH,aAAA;SACF;AACF,CAAA,CAAA;AAEA,MAAM,EACJS,mCAAmC,EACnCC,iCAAiC,EACjCC,yCAAyC,EAC1C,GAAG7B;;;;;;"}
@@ -1,3 +1,4 @@
1
+ import { normalizeContentTypeConfigurationUpdateResponse, normalizeContentTypeSettingsResponse, normalizeContentTypeConfigurationResponse } from '../utils/layouts/normalizeContentManagerLayout.mjs';
1
2
  import { contentManagerApi } from './api.mjs';
2
3
 
3
4
  const contentTypesApi = contentManagerApi.injectEndpoints({
@@ -7,7 +8,7 @@ const contentTypesApi = contentManagerApi.injectEndpoints({
7
8
  url: `/content-manager/content-types/${uid}/configuration`,
8
9
  method: 'GET'
9
10
  }),
10
- transformResponse: (response)=>response.data,
11
+ transformResponse: (response, _meta, uid)=>normalizeContentTypeConfigurationResponse(response.data, uid),
11
12
  providesTags: (_result, _error, uid)=>[
12
13
  {
13
14
  type: 'ContentTypesConfiguration',
@@ -21,7 +22,7 @@ const contentTypesApi = contentManagerApi.injectEndpoints({
21
22
  }),
22
23
  getAllContentTypeSettings: builder.query({
23
24
  query: ()=>'/content-manager/content-types-settings',
24
- transformResponse: (response)=>response.data,
25
+ transformResponse: (response)=>normalizeContentTypeSettingsResponse(response.data),
25
26
  providesTags: [
26
27
  {
27
28
  type: 'ContentTypeSettings',
@@ -35,7 +36,7 @@ const contentTypesApi = contentManagerApi.injectEndpoints({
35
36
  method: 'PUT',
36
37
  data: body
37
38
  }),
38
- transformResponse: (response)=>response.data,
39
+ transformResponse: (response)=>normalizeContentTypeConfigurationUpdateResponse(response.data),
39
40
  invalidatesTags: (_result, _error, { uid })=>[
40
41
  {
41
42
  type: 'ContentTypesConfiguration',
@@ -1 +1 @@
1
- {"version":3,"file":"contentTypes.mjs","sources":["../../../admin/src/services/contentTypes.ts"],"sourcesContent":["import {\n FindContentTypeConfiguration,\n UpdateContentTypeConfiguration,\n FindContentTypesSettings,\n} from '../../../shared/contracts/content-types';\n\nimport { contentManagerApi } from './api';\n\nconst contentTypesApi = contentManagerApi.injectEndpoints({\n endpoints: (builder) => ({\n getContentTypeConfiguration: builder.query<\n FindContentTypeConfiguration.Response['data'],\n string\n >({\n query: (uid) => ({\n url: `/content-manager/content-types/${uid}/configuration`,\n method: 'GET',\n }),\n transformResponse: (response: FindContentTypeConfiguration.Response) => response.data,\n providesTags: (_result, _error, uid) => [\n { type: 'ContentTypesConfiguration', id: uid },\n { type: 'ContentTypeSettings', id: 'LIST' },\n ],\n }),\n getAllContentTypeSettings: builder.query<FindContentTypesSettings.Response['data'], void>({\n query: () => '/content-manager/content-types-settings',\n transformResponse: (response: FindContentTypesSettings.Response) => response.data,\n providesTags: [{ type: 'ContentTypeSettings', id: 'LIST' }],\n }),\n updateContentTypeConfiguration: builder.mutation<\n UpdateContentTypeConfiguration.Response['data'],\n UpdateContentTypeConfiguration.Request['body'] & {\n uid: string;\n }\n >({\n query: ({ uid, ...body }) => ({\n url: `/content-manager/content-types/${uid}/configuration`,\n method: 'PUT',\n data: body,\n }),\n transformResponse: (response: UpdateContentTypeConfiguration.Response) => response.data,\n invalidatesTags: (_result, _error, { uid }) => [\n { type: 'ContentTypesConfiguration', id: uid },\n { type: 'ContentTypeSettings', id: 'LIST' },\n // Is this necessary?\n { type: 'InitialData' },\n ],\n }),\n }),\n});\n\nconst {\n useGetContentTypeConfigurationQuery,\n useGetAllContentTypeSettingsQuery,\n useUpdateContentTypeConfigurationMutation,\n} = contentTypesApi;\n\nexport {\n useGetContentTypeConfigurationQuery,\n useGetAllContentTypeSettingsQuery,\n useUpdateContentTypeConfigurationMutation,\n};\n"],"names":["contentTypesApi","contentManagerApi","injectEndpoints","endpoints","builder","getContentTypeConfiguration","query","uid","url","method","transformResponse","response","data","providesTags","_result","_error","type","id","getAllContentTypeSettings","updateContentTypeConfiguration","mutation","body","invalidatesTags","useGetContentTypeConfigurationQuery","useGetAllContentTypeSettingsQuery","useUpdateContentTypeConfigurationMutation"],"mappings":";;AAQA,MAAMA,eAAAA,GAAkBC,iBAAAA,CAAkBC,eAAe,CAAC;IACxDC,SAAAA,EAAW,CAACC,WAAa;YACvBC,2BAAAA,EAA6BD,OAAAA,CAAQE,KAAK,CAGxC;gBACAA,KAAAA,EAAO,CAACC,OAAS;AACfC,wBAAAA,GAAAA,EAAK,CAAC,+BAA+B,EAAED,GAAAA,CAAI,cAAc,CAAC;wBAC1DE,MAAAA,EAAQ;qBACV,CAAA;gBACAC,iBAAAA,EAAmB,CAACC,QAAAA,GAAoDA,QAAAA,CAASC,IAAI;gBACrFC,YAAAA,EAAc,CAACC,OAAAA,EAASC,MAAAA,EAAQR,GAAAA,GAAQ;AACtC,wBAAA;4BAAES,IAAAA,EAAM,2BAAA;4BAA6BC,EAAAA,EAAIV;AAAI,yBAAA;AAC7C,wBAAA;4BAAES,IAAAA,EAAM,qBAAA;4BAAuBC,EAAAA,EAAI;AAAO;AAC3C;AACH,aAAA,CAAA;YACAC,yBAAAA,EAA2Bd,OAAAA,CAAQE,KAAK,CAAkD;AACxFA,gBAAAA,KAAAA,EAAO,IAAM,yCAAA;gBACbI,iBAAAA,EAAmB,CAACC,QAAAA,GAAgDA,QAAAA,CAASC,IAAI;gBACjFC,YAAAA,EAAc;AAAC,oBAAA;wBAAEG,IAAAA,EAAM,qBAAA;wBAAuBC,EAAAA,EAAI;AAAO;AAAE;AAC7D,aAAA,CAAA;YACAE,8BAAAA,EAAgCf,OAAAA,CAAQgB,QAAQ,CAK9C;AACAd,gBAAAA,KAAAA,EAAO,CAAC,EAAEC,GAAG,EAAE,GAAGc,IAAAA,EAAM,IAAM;AAC5Bb,wBAAAA,GAAAA,EAAK,CAAC,+BAA+B,EAAED,GAAAA,CAAI,cAAc,CAAC;wBAC1DE,MAAAA,EAAQ,KAAA;wBACRG,IAAAA,EAAMS;qBACR,CAAA;gBACAX,iBAAAA,EAAmB,CAACC,QAAAA,GAAsDA,QAAAA,CAASC,IAAI;AACvFU,gBAAAA,eAAAA,EAAiB,CAACR,OAAAA,EAASC,MAAAA,EAAQ,EAAER,GAAG,EAAE,GAAK;AAC7C,wBAAA;4BAAES,IAAAA,EAAM,2BAAA;4BAA6BC,EAAAA,EAAIV;AAAI,yBAAA;AAC7C,wBAAA;4BAAES,IAAAA,EAAM,qBAAA;4BAAuBC,EAAAA,EAAI;AAAO,yBAAA;;AAE1C,wBAAA;4BAAED,IAAAA,EAAM;AAAc;AACvB;AACH,aAAA;SACF;AACF,CAAA,CAAA;AAEA,MAAM,EACJO,mCAAmC,EACnCC,iCAAiC,EACjCC,yCAAyC,EAC1C,GAAGzB;;;;"}
1
+ {"version":3,"file":"contentTypes.mjs","sources":["../../../admin/src/services/contentTypes.ts"],"sourcesContent":["import {\n FindContentTypeConfiguration,\n UpdateContentTypeConfiguration,\n FindContentTypesSettings,\n} from '../../../shared/contracts/content-types';\nimport {\n normalizeContentTypeConfigurationResponse,\n normalizeContentTypeConfigurationUpdateResponse,\n normalizeContentTypeSettingsResponse,\n} from '../utils/layouts/normalizeContentManagerLayout';\n\nimport { contentManagerApi } from './api';\n\nconst contentTypesApi = contentManagerApi.injectEndpoints({\n endpoints: (builder) => ({\n getContentTypeConfiguration: builder.query<\n FindContentTypeConfiguration.Response['data'],\n string\n >({\n query: (uid) => ({\n url: `/content-manager/content-types/${uid}/configuration`,\n method: 'GET',\n }),\n transformResponse: (response: FindContentTypeConfiguration.Response, _meta, uid) =>\n normalizeContentTypeConfigurationResponse(response.data, uid),\n providesTags: (_result, _error, uid) => [\n { type: 'ContentTypesConfiguration', id: uid },\n { type: 'ContentTypeSettings', id: 'LIST' },\n ],\n }),\n getAllContentTypeSettings: builder.query<FindContentTypesSettings.Response['data'], void>({\n query: () => '/content-manager/content-types-settings',\n transformResponse: (response: FindContentTypesSettings.Response) =>\n normalizeContentTypeSettingsResponse(response.data),\n providesTags: [{ type: 'ContentTypeSettings', id: 'LIST' }],\n }),\n updateContentTypeConfiguration: builder.mutation<\n UpdateContentTypeConfiguration.Response['data'],\n UpdateContentTypeConfiguration.Request['body'] & {\n uid: string;\n }\n >({\n query: ({ uid, ...body }) => ({\n url: `/content-manager/content-types/${uid}/configuration`,\n method: 'PUT',\n data: body,\n }),\n transformResponse: (response: UpdateContentTypeConfiguration.Response) =>\n normalizeContentTypeConfigurationUpdateResponse(response.data),\n invalidatesTags: (_result, _error, { uid }) => [\n { type: 'ContentTypesConfiguration', id: uid },\n { type: 'ContentTypeSettings', id: 'LIST' },\n // Is this necessary?\n { type: 'InitialData' },\n ],\n }),\n }),\n});\n\nconst {\n useGetContentTypeConfigurationQuery,\n useGetAllContentTypeSettingsQuery,\n useUpdateContentTypeConfigurationMutation,\n} = contentTypesApi;\n\nexport {\n useGetContentTypeConfigurationQuery,\n useGetAllContentTypeSettingsQuery,\n useUpdateContentTypeConfigurationMutation,\n};\n"],"names":["contentTypesApi","contentManagerApi","injectEndpoints","endpoints","builder","getContentTypeConfiguration","query","uid","url","method","transformResponse","response","_meta","normalizeContentTypeConfigurationResponse","data","providesTags","_result","_error","type","id","getAllContentTypeSettings","normalizeContentTypeSettingsResponse","updateContentTypeConfiguration","mutation","body","normalizeContentTypeConfigurationUpdateResponse","invalidatesTags","useGetContentTypeConfigurationQuery","useGetAllContentTypeSettingsQuery","useUpdateContentTypeConfigurationMutation"],"mappings":";;;AAaA,MAAMA,eAAAA,GAAkBC,iBAAAA,CAAkBC,eAAe,CAAC;IACxD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,+CAAAA,CAAgDd,QAAAA,CAASG,IAAI,CAAA;AAC/DY,gBAAAA,eAAAA,EAAiB,CAACV,OAAAA,EAASC,MAAAA,EAAQ,EAAEV,GAAG,EAAE,GAAK;AAC7C,wBAAA;4BAAEW,IAAAA,EAAM,2BAAA;4BAA6BC,EAAAA,EAAIZ;AAAI,yBAAA;AAC7C,wBAAA;4BAAEW,IAAAA,EAAM,qBAAA;4BAAuBC,EAAAA,EAAI;AAAO,yBAAA;;AAE1C,wBAAA;4BAAED,IAAAA,EAAM;AAAc;AACvB;AACH,aAAA;SACF;AACF,CAAA,CAAA;AAEA,MAAM,EACJS,mCAAmC,EACnCC,iCAAiC,EACjCC,yCAAyC,EAC1C,GAAG7B;;;;"}
@@ -11,7 +11,7 @@ interface ComponentInputProps extends Omit<Extract<EditFieldLayout, {
11
11
  * We need layout to come from the props, and not via a hook, because Content History needs
12
12
  * a way to modify the normal component layout to add hidden fields.
13
13
  */
14
- layout: EditFieldLayout[][];
14
+ layout: ReadonlyArray<ReadonlyArray<EditFieldLayout>>;
15
15
  }
16
16
  declare const MemoizedComponentInput: React.MemoExoticComponent<({ label, required, name, attribute, disabled, labelAction, ...props }: ComponentInputProps) => import("react/jsx-runtime").JSX.Element>;
17
17
  export { MemoizedComponentInput as ComponentInput };
@@ -3,7 +3,7 @@ import { type UseDragAndDropOptions } from '../../../../../hooks/useDragAndDrop'
3
3
  import { type InputRendererProps } from '../../InputRenderer';
4
4
  import type { ComponentPickerProps } from './ComponentPicker';
5
5
  interface DynamicComponentProps extends Pick<UseDragAndDropOptions, 'onGrabItem' | 'onDropItem' | 'onCancel'>, Pick<ComponentPickerProps, 'dynamicComponentsByCategory'> {
6
- componentUid: string;
6
+ componentUid?: string;
7
7
  disabled?: boolean;
8
8
  index: number;
9
9
  name: string;
@@ -0,0 +1,2 @@
1
+ declare const sanitize: (html: string) => string;
2
+ export { sanitize };
@@ -1,6 +1,6 @@
1
1
  import type { ListLayout } from '../../../hooks/useDocumentLayout';
2
- interface SortDisplayedFieldsProps extends Pick<ListLayout, 'layout'> {
2
+ interface SortDisplayedFieldsProps extends Pick<ListLayout, 'metadatas'> {
3
3
  }
4
- declare const SortDisplayedFields: () => import("react/jsx-runtime").JSX.Element;
4
+ declare const SortDisplayedFields: ({ metadatas }: SortDisplayedFieldsProps) => import("react/jsx-runtime").JSX.Element;
5
5
  export { SortDisplayedFields };
6
6
  export type { SortDisplayedFieldsProps };
@@ -8,8 +8,8 @@ interface MediaFile {
8
8
  url?: string;
9
9
  };
10
10
  };
11
- mime: string;
12
- name: string;
11
+ mime?: string | null;
12
+ name?: string | null;
13
13
  url: string;
14
14
  }
15
15
  interface MediaSingleProps extends MediaFile {
@@ -1,6 +1,7 @@
1
1
  import { ComponentsDictionary } from '../hooks/useContentTypeSchema';
2
2
  import { EditLayout } from '../hooks/useDocumentLayout';
3
3
  import type { Component, FindComponentConfiguration } from '../../../shared/contracts/components';
4
+ import type { Schema } from '../hooks/useDocument';
4
5
  /**
5
6
  * Formats API configuration + schemas into the shape expected by the component
6
7
  * "Configure the view" form. Matches the ListView / content-type path: nested
@@ -8,8 +9,9 @@ import type { Component, FindComponentConfiguration } from '../../../shared/cont
8
9
  * and full component schemas so `getMainField` can resolve fields inside nested
9
10
  * component attributes (see #25509).
10
11
  */
11
- declare const formatComponentConfigurationEditLayout: (data: FindComponentConfiguration.Response['data'], { schema, components }: {
12
+ declare const formatComponentConfigurationEditLayout: (data: FindComponentConfiguration.Response['data'], { schema, components, schemas, }: {
12
13
  schema?: Component;
13
14
  components: ComponentsDictionary;
15
+ schemas?: Schema[];
14
16
  }) => EditLayout;
15
17
  export { formatComponentConfigurationEditLayout };
@@ -0,0 +1,24 @@
1
+ import type { Component, FindComponentConfiguration } from '../../../../shared/contracts/components';
2
+ import type { FindContentTypeConfiguration, FindContentTypesSettings, UpdateContentTypeConfiguration } from '../../../../shared/contracts/content-types';
3
+ import type { ComponentsDictionary, Schema } from '../../hooks/useDocument';
4
+ type ContentTypeConfigurationData = FindContentTypeConfiguration.Response['data'];
5
+ type ComponentConfigurationData = FindComponentConfiguration.Response['data'];
6
+ type ComponentConfigurationResponseData = ComponentConfigurationData['component'];
7
+ type NormalizationContext = {
8
+ components: ComponentsDictionary;
9
+ schema?: Schema | Component;
10
+ schemas: Schema[];
11
+ };
12
+ type ComponentNormalizationContext = {
13
+ components: ComponentsDictionary;
14
+ schema?: Component;
15
+ schemas: Schema[];
16
+ };
17
+ declare const normalizeContentTypeConfigurationResponse: (data: unknown, uid?: string) => FindContentTypeConfiguration.Response['data'];
18
+ declare const normalizeContentTypeConfigurationUpdateResponse: (data: unknown) => UpdateContentTypeConfiguration.Response['data'];
19
+ declare const normalizeComponentConfigurationResponse: (data: unknown, uid?: string) => FindComponentConfiguration.Response['data'];
20
+ declare const normalizeComponentConfigurationUpdateResponse: (data: unknown) => ComponentConfigurationResponseData;
21
+ declare const normalizeContentTypeSettingsResponse: (data: unknown) => FindContentTypesSettings.Response['data'];
22
+ declare const normalizeContentManagerLayout: (data: ContentTypeConfigurationData, context: NormalizationContext) => ContentTypeConfigurationData;
23
+ declare const normalizeComponentConfigurationLayout: (data: ComponentConfigurationData, context: ComponentNormalizationContext) => ComponentConfigurationData;
24
+ export { normalizeContentManagerLayout, normalizeComponentConfigurationLayout, normalizeContentTypeConfigurationResponse, normalizeContentTypeConfigurationUpdateResponse, normalizeComponentConfigurationResponse, normalizeComponentConfigurationUpdateResponse, normalizeContentTypeSettingsResponse, };
@@ -47,6 +47,7 @@ var en = {
47
47
  "components.DynamicZone.move-up-label": "Move component up",
48
48
  "components.DynamicZone.pick-compo": "Pick one component",
49
49
  "components.DynamicZone.required": "Component is required",
50
+ "components.DynamicZone.unknown-component": "Unknown component",
50
51
  "components.DynamicZone.move-up": "Move up",
51
52
  "components.DynamicZone.move-down": "Move down",
52
53
  "components.EmptyAttributesBlock.button": "Go to settings page",
@@ -1 +1 @@
1
- {"version":3,"file":"en.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"en.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -43,6 +43,7 @@ var en = {
43
43
  "components.DynamicZone.move-up-label": "Move component up",
44
44
  "components.DynamicZone.pick-compo": "Pick one component",
45
45
  "components.DynamicZone.required": "Component is required",
46
+ "components.DynamicZone.unknown-component": "Unknown component",
46
47
  "components.DynamicZone.move-up": "Move up",
47
48
  "components.DynamicZone.move-down": "Move down",
48
49
  "components.EmptyAttributesBlock.button": "Go to settings page",
@@ -1 +1 @@
1
- {"version":3,"file":"en.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"en.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -22,10 +22,25 @@ const checkIfAttributeIsDisplayable = (attribute)=>{
22
22
  if (!mainFieldName) {
23
23
  return undefined;
24
24
  }
25
- const mainFieldType = attribute.type === 'component' ? components[attribute.component].attributes[mainFieldName].type : schemas.find((schema)=>schema.uid === attribute.targetModel)?.attributes[mainFieldName].type;
25
+ if (attribute.type === 'component') {
26
+ const mainFieldType = components[attribute.component]?.attributes?.[mainFieldName]?.type;
27
+ return {
28
+ name: mainFieldType ? mainFieldName : 'id',
29
+ type: mainFieldType ?? 'custom'
30
+ };
31
+ }
32
+ if (attribute.type === 'relation') {
33
+ const target = 'targetModel' in attribute ? attribute.targetModel : 'target' in attribute ? attribute.target : undefined;
34
+ const targetSchema = schemas.find((schema)=>schema.uid === target);
35
+ const mainFieldType = targetSchema?.attributes?.[mainFieldName]?.type;
36
+ return {
37
+ name: !targetSchema || mainFieldType ? mainFieldName : 'id',
38
+ type: mainFieldType ?? 'custom'
39
+ };
40
+ }
26
41
  return {
27
42
  name: mainFieldName,
28
- type: mainFieldType ?? 'string'
43
+ type: 'string'
29
44
  };
30
45
  };
31
46
 
@@ -1 +1 @@
1
- {"version":3,"file":"attributes.js","sources":["../../../admin/src/utils/attributes.ts"],"sourcesContent":["import type { ComponentsDictionary, Schema } from '../hooks/useDocument';\nimport type { Schema as SchemaUtils } from '@strapi/types';\n\nconst checkIfAttributeIsDisplayable = (attribute: SchemaUtils.Attribute.AnyAttribute) => {\n const { type } = attribute;\n\n if (type === 'relation') {\n return !attribute.relation.toLowerCase().includes('morph');\n }\n\n return !['json', 'dynamiczone', 'richtext', 'password', 'blocks'].includes(type) && !!type;\n};\n\ninterface MainField {\n name: string;\n type: SchemaUtils.Attribute.Kind | 'custom';\n}\n\n/**\n * @internal\n * @description given an attribute, content-type schemas & component schemas, find the mainField name & type.\n * If the attribute does not need a `mainField` then we return undefined. If we do not find the type\n * of the field, we assume it's a string #sensible-defaults\n */\nconst getMainField = (\n attribute: SchemaUtils.Attribute.AnyAttribute,\n mainFieldName: string | undefined,\n { schemas, components }: { schemas: Schema[]; components: ComponentsDictionary }\n): MainField | undefined => {\n if (!mainFieldName) {\n return undefined;\n }\n\n const mainFieldType =\n attribute.type === 'component'\n ? components[attribute.component].attributes[mainFieldName].type\n : // @ts-expect-error `targetModel` does exist on the attribute for a relation.\n schemas.find((schema) => schema.uid === attribute.targetModel)?.attributes[mainFieldName]\n .type;\n\n return {\n name: mainFieldName,\n type: mainFieldType ?? 'string',\n };\n};\n\nexport { checkIfAttributeIsDisplayable, getMainField };\nexport type { MainField };\n"],"names":["checkIfAttributeIsDisplayable","attribute","type","relation","toLowerCase","includes","getMainField","mainFieldName","schemas","components","undefined","mainFieldType","component","attributes","find","schema","uid","targetModel","name"],"mappings":";;AAGA,MAAMA,gCAAgC,CAACC,SAAAA,GAAAA;IACrC,MAAM,EAAEC,IAAI,EAAE,GAAGD,SAAAA;AAEjB,IAAA,IAAIC,SAAS,UAAA,EAAY;AACvB,QAAA,OAAO,CAACD,SAAAA,CAAUE,QAAQ,CAACC,WAAW,EAAA,CAAGC,QAAQ,CAAC,OAAA,CAAA;AACpD,IAAA;AAEA,IAAA,OAAO,CAAC;AAAC,QAAA,MAAA;AAAQ,QAAA,aAAA;AAAe,QAAA,UAAA;AAAY,QAAA,UAAA;AAAY,QAAA;AAAS,KAAA,CAACA,QAAQ,CAACH,IAAAA,CAAAA,IAAS,CAAC,CAACA,IAAAA;AACxF;AAOA;;;;;IAMA,MAAMI,eAAe,CACnBL,SAAAA,EACAM,eACA,EAAEC,OAAO,EAAEC,UAAU,EAA2D,GAAA;AAEhF,IAAA,IAAI,CAACF,aAAAA,EAAe;QAClB,OAAOG,SAAAA;AACT,IAAA;AAEA,IAAA,MAAMC,aAAAA,GACJV,SAAAA,CAAUC,IAAI,KAAK,WAAA,GACfO,UAAU,CAACR,SAAAA,CAAUW,SAAS,CAAC,CAACC,UAAU,CAACN,aAAAA,CAAc,CAACL,IAAI,GAE9DM,OAAAA,CAAQM,IAAI,CAAC,CAACC,SAAWA,MAAAA,CAAOC,GAAG,KAAKf,SAAAA,CAAUgB,WAAW,CAAA,EAAGJ,UAAU,CAACN,cAAc,CACtFL,IAAAA;IAET,OAAO;QACLgB,IAAAA,EAAMX,aAAAA;AACNL,QAAAA,IAAAA,EAAMS,aAAAA,IAAiB;AACzB,KAAA;AACF;;;;;"}
1
+ {"version":3,"file":"attributes.js","sources":["../../../admin/src/utils/attributes.ts"],"sourcesContent":["import type { ComponentsDictionary, Schema } from '../hooks/useDocument';\nimport type { Schema as SchemaUtils } from '@strapi/types';\n\nconst checkIfAttributeIsDisplayable = (attribute: SchemaUtils.Attribute.AnyAttribute) => {\n const { type } = attribute;\n\n if (type === 'relation') {\n return !attribute.relation.toLowerCase().includes('morph');\n }\n\n return !['json', 'dynamiczone', 'richtext', 'password', 'blocks'].includes(type) && !!type;\n};\n\ninterface MainField {\n name: string;\n type: SchemaUtils.Attribute.Kind | 'custom';\n}\n\n/**\n * @internal\n * @description given an attribute, content-type schemas & component schemas, find the mainField name & type.\n * If the attribute does not need a `mainField` then we return undefined. If we do not find the type\n * of the field, we assume it's a string #sensible-defaults\n */\nconst getMainField = (\n attribute: SchemaUtils.Attribute.AnyAttribute,\n mainFieldName: string | undefined,\n { schemas, components }: { schemas: Schema[]; components: ComponentsDictionary }\n): MainField | undefined => {\n if (!mainFieldName) {\n return undefined;\n }\n\n if (attribute.type === 'component') {\n const mainFieldType = components[attribute.component]?.attributes?.[mainFieldName]?.type;\n\n return {\n name: mainFieldType ? mainFieldName : 'id',\n type: mainFieldType ?? 'custom',\n };\n }\n\n if (attribute.type === 'relation') {\n const target =\n 'targetModel' in attribute\n ? attribute.targetModel\n : 'target' in attribute\n ? attribute.target\n : undefined;\n const targetSchema = schemas.find((schema) => schema.uid === target);\n const mainFieldType = targetSchema?.attributes?.[mainFieldName]?.type;\n\n return {\n name: !targetSchema || mainFieldType ? mainFieldName : 'id',\n type: mainFieldType ?? 'custom',\n };\n }\n\n return {\n name: mainFieldName,\n type: 'string',\n };\n};\n\nexport { checkIfAttributeIsDisplayable, getMainField };\nexport type { MainField };\n"],"names":["checkIfAttributeIsDisplayable","attribute","type","relation","toLowerCase","includes","getMainField","mainFieldName","schemas","components","undefined","mainFieldType","component","attributes","name","target","targetModel","targetSchema","find","schema","uid"],"mappings":";;AAGA,MAAMA,gCAAgC,CAACC,SAAAA,GAAAA;IACrC,MAAM,EAAEC,IAAI,EAAE,GAAGD,SAAAA;AAEjB,IAAA,IAAIC,SAAS,UAAA,EAAY;AACvB,QAAA,OAAO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ACvDL,YAAAA,IAAAA,EAAMS,aAAAA,IAAiB;AACzB,SAAA;AACF,IAAA;IAEA,OAAO;QACLG,IAAAA,EAAMP,aAAAA;QACNL,IAAAA,EAAM;AACR,KAAA;AACF;;;;;"}
@@ -20,10 +20,25 @@ const checkIfAttributeIsDisplayable = (attribute)=>{
20
20
  if (!mainFieldName) {
21
21
  return undefined;
22
22
  }
23
- const mainFieldType = attribute.type === 'component' ? components[attribute.component].attributes[mainFieldName].type : schemas.find((schema)=>schema.uid === attribute.targetModel)?.attributes[mainFieldName].type;
23
+ if (attribute.type === 'component') {
24
+ const mainFieldType = components[attribute.component]?.attributes?.[mainFieldName]?.type;
25
+ return {
26
+ name: mainFieldType ? mainFieldName : 'id',
27
+ type: mainFieldType ?? 'custom'
28
+ };
29
+ }
30
+ if (attribute.type === 'relation') {
31
+ const target = 'targetModel' in attribute ? attribute.targetModel : 'target' in attribute ? attribute.target : undefined;
32
+ const targetSchema = schemas.find((schema)=>schema.uid === target);
33
+ const mainFieldType = targetSchema?.attributes?.[mainFieldName]?.type;
34
+ return {
35
+ name: !targetSchema || mainFieldType ? mainFieldName : 'id',
36
+ type: mainFieldType ?? 'custom'
37
+ };
38
+ }
24
39
  return {
25
40
  name: mainFieldName,
26
- type: mainFieldType ?? 'string'
41
+ type: 'string'
27
42
  };
28
43
  };
29
44
 
@@ -1 +1 @@
1
- {"version":3,"file":"attributes.mjs","sources":["../../../admin/src/utils/attributes.ts"],"sourcesContent":["import type { ComponentsDictionary, Schema } from '../hooks/useDocument';\nimport type { Schema as SchemaUtils } from '@strapi/types';\n\nconst checkIfAttributeIsDisplayable = (attribute: SchemaUtils.Attribute.AnyAttribute) => {\n const { type } = attribute;\n\n if (type === 'relation') {\n return !attribute.relation.toLowerCase().includes('morph');\n }\n\n return !['json', 'dynamiczone', 'richtext', 'password', 'blocks'].includes(type) && !!type;\n};\n\ninterface MainField {\n name: string;\n type: SchemaUtils.Attribute.Kind | 'custom';\n}\n\n/**\n * @internal\n * @description given an attribute, content-type schemas & component schemas, find the mainField name & type.\n * If the attribute does not need a `mainField` then we return undefined. If we do not find the type\n * of the field, we assume it's a string #sensible-defaults\n */\nconst getMainField = (\n attribute: SchemaUtils.Attribute.AnyAttribute,\n mainFieldName: string | undefined,\n { schemas, components }: { schemas: Schema[]; components: ComponentsDictionary }\n): MainField | undefined => {\n if (!mainFieldName) {\n return undefined;\n }\n\n const mainFieldType =\n attribute.type === 'component'\n ? components[attribute.component].attributes[mainFieldName].type\n : // @ts-expect-error `targetModel` does exist on the attribute for a relation.\n schemas.find((schema) => schema.uid === attribute.targetModel)?.attributes[mainFieldName]\n .type;\n\n return {\n name: mainFieldName,\n type: mainFieldType ?? 'string',\n };\n};\n\nexport { checkIfAttributeIsDisplayable, getMainField };\nexport type { MainField };\n"],"names":["checkIfAttributeIsDisplayable","attribute","type","relation","toLowerCase","includes","getMainField","mainFieldName","schemas","components","undefined","mainFieldType","component","attributes","find","schema","uid","targetModel","name"],"mappings":"AAGA,MAAMA,gCAAgC,CAACC,SAAAA,GAAAA;IACrC,MAAM,EAAEC,IAAI,EAAE,GAAGD,SAAAA;AAEjB,IAAA,IAAIC,SAAS,UAAA,EAAY;AACvB,QAAA,OAAO,CAACD,SAAAA,CAAUE,QAAQ,CAACC,WAAW,EAAA,CAAGC,QAAQ,CAAC,OAAA,CAAA;AACpD,IAAA;AAEA,IAAA,OAAO,CAAC;AAAC,QAAA,MAAA;AAAQ,QAAA,aAAA;AAAe,QAAA,UAAA;AAAY,QAAA,UAAA;AAAY,QAAA;AAAS,KAAA,CAACA,QAAQ,CAACH,IAAAA,CAAAA,IAAS,CAAC,CAACA,IAAAA;AACxF;AAOA;;;;;IAMA,MAAMI,eAAe,CACnBL,SAAAA,EACAM,eACA,EAAEC,OAAO,EAAEC,UAAU,EAA2D,GAAA;AAEhF,IAAA,IAAI,CAACF,aAAAA,EAAe;QAClB,OAAOG,SAAAA;AACT,IAAA;AAEA,IAAA,MAAMC,aAAAA,GACJV,SAAAA,CAAUC,IAAI,KAAK,WAAA,GACfO,UAAU,CAACR,SAAAA,CAAUW,SAAS,CAAC,CAACC,UAAU,CAACN,aAAAA,CAAc,CAACL,IAAI,GAE9DM,OAAAA,CAAQM,IAAI,CAAC,CAACC,SAAWA,MAAAA,CAAOC,GAAG,KAAKf,SAAAA,CAAUgB,WAAW,CAAA,EAAGJ,UAAU,CAACN,cAAc,CACtFL,IAAAA;IAET,OAAO;QACLgB,IAAAA,EAAMX,aAAAA;AACNL,QAAAA,IAAAA,EAAMS,aAAAA,IAAiB;AACzB,KAAA;AACF;;;;"}
1
+ {"version":3,"file":"attributes.mjs","sources":["../../../admin/src/utils/attributes.ts"],"sourcesContent":["import type { ComponentsDictionary, Schema } from '../hooks/useDocument';\nimport type { Schema as SchemaUtils } from '@strapi/types';\n\nconst checkIfAttributeIsDisplayable = (attribute: SchemaUtils.Attribute.AnyAttribute) => {\n const { type } = attribute;\n\n if (type === 'relation') {\n return !attribute.relation.toLowerCase().includes('morph');\n }\n\n return !['json', 'dynamiczone', 'richtext', 'password', 'blocks'].includes(type) && !!type;\n};\n\ninterface MainField {\n name: string;\n type: SchemaUtils.Attribute.Kind | 'custom';\n}\n\n/**\n * @internal\n * @description given an attribute, content-type schemas & component schemas, find the mainField name & type.\n * If the attribute does not need a `mainField` then we return undefined. If we do not find the type\n * of the field, we assume it's a string #sensible-defaults\n */\nconst getMainField = (\n attribute: SchemaUtils.Attribute.AnyAttribute,\n mainFieldName: string | undefined,\n { schemas, components }: { schemas: Schema[]; components: ComponentsDictionary }\n): MainField | undefined => {\n if (!mainFieldName) {\n return undefined;\n }\n\n if (attribute.type === 'component') {\n const mainFieldType = components[attribute.component]?.attributes?.[mainFieldName]?.type;\n\n return {\n name: mainFieldType ? mainFieldName : 'id',\n type: mainFieldType ?? 'custom',\n };\n }\n\n if (attribute.type === 'relation') {\n const target =\n 'targetModel' in attribute\n ? attribute.targetModel\n : 'target' in attribute\n ? attribute.target\n : undefined;\n const targetSchema = schemas.find((schema) => schema.uid === target);\n const mainFieldType = targetSchema?.attributes?.[mainFieldName]?.type;\n\n return {\n name: !targetSchema || mainFieldType ? mainFieldName : 'id',\n type: mainFieldType ?? 'custom',\n };\n }\n\n return {\n name: mainFieldName,\n type: 'string',\n };\n};\n\nexport { checkIfAttributeIsDisplayable, getMainField };\nexport type { MainField };\n"],"names":["checkIfAttributeIsDisplayable","attribute","type","relation","toLowerCase","includes","getMainField","mainFieldName","schemas","components","undefined","mainFieldType","component","attributes","name","target","targetModel","targetSchema","find","schema","uid"],"mappings":"AAGA,MAAMA,gCAAgC,CAACC,SAAAA,GAAAA;IACrC,MAAM,EAAEC,IAAI,EAAE,GAAGD,SAAAA;AAEjB,IAAA,IAAIC,SAAS,UAAA,EAAY;AACvB,QAAA,OAAO,CAACD,SAAAA,CAAUE,QAAQ,CAACC,WAAW,EAAA,CAAGC,QAAQ,CAAC,OAAA,CAAA;AACpD,IAAA;AAEA,IAAA,OAAO,CAAC;AAAC,QAAA,MAAA;AAAQ,QAAA,aAAA;AAAe,QAAA,UAAA;AAAY,QAAA,UAAA;AAAY,QAAA;AAAS,KAAA,CAACA,QAAQ,CAACH,IAAAA,CAAAA,IAAS,CAAC,CAACA,IAAAA;AACxF;AAOA;;;;;IAMA,MAAMI,eAAe,CACnBL,SAAAA,EACAM,eACA,EAAEC,OAAO,EAAEC,UAAU,EAA2D,GAAA;AAEhF,IAAA,IAAI,CAACF,aAAAA,EAAe;QAClB,OAAOG,SAAAA;AACT,IAAA;IAEA,IAAIT,SAAAA,CAAUC,IAAI,KAAK,WAAA,EAAa;QAClC,MAAMS,aAAAA,GAAgBF,UAAU,CAACR,SAAAA,CAAUW,SAAS,CAAC,EAAEC,UAAAA,GAAaN,aAAAA,CAAc,EAAEL,IAAAA;QAEpF,OAAO;AACLY,YAAAA,IAAAA,EAAMH,gBAAgBJ,aAAAA,GAAgB,IAAA;AACtCL,YAAAA,IAAAA,EAAMS,aAAAA,IAAiB;AACzB,SAAA;AACF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