@strapi/content-type-builder 5.8.1 → 5.10.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 (210) hide show
  1. package/dist/admin/chunks/ListView-CDnrvVrV.mjs +1184 -0
  2. package/dist/admin/chunks/ListView-CDnrvVrV.mjs.map +1 -0
  3. package/dist/admin/chunks/ListView-CQwvSbZH.js +1186 -0
  4. package/dist/admin/chunks/ListView-CQwvSbZH.js.map +1 -0
  5. package/dist/admin/chunks/ar-Df0f0-PT.js +52 -0
  6. package/dist/admin/chunks/ar-Df0f0-PT.js.map +1 -0
  7. package/dist/admin/chunks/ar-sRW9VFC-.mjs +49 -0
  8. package/dist/admin/chunks/ar-sRW9VFC-.mjs.map +1 -0
  9. package/dist/admin/chunks/cs-BpQ26jiq.mjs +136 -0
  10. package/dist/{_chunks/cs-ChL4LaFY.mjs.map → admin/chunks/cs-BpQ26jiq.mjs.map} +1 -1
  11. package/dist/admin/chunks/cs-DeTwqc7p.js +140 -0
  12. package/dist/{_chunks/cs-Ci3js5EC.js.map → admin/chunks/cs-DeTwqc7p.js.map} +1 -1
  13. package/dist/admin/chunks/de-BJkS06jF.js +194 -0
  14. package/dist/{_chunks/de-DnlblIOh.js.map → admin/chunks/de-BJkS06jF.js.map} +1 -1
  15. package/dist/admin/chunks/de-DSxx5_x-.mjs +190 -0
  16. package/dist/{_chunks/de-DsHQNzp2.mjs.map → admin/chunks/de-DSxx5_x-.mjs.map} +1 -1
  17. package/dist/admin/chunks/dk-BnjVZ7A_.mjs +180 -0
  18. package/dist/{_chunks/es-BE_zx2_w.mjs.map → admin/chunks/dk-BnjVZ7A_.mjs.map} +1 -1
  19. package/dist/admin/chunks/dk-CGm-qVH7.js +184 -0
  20. package/dist/{_chunks/dk-D3XnOjYz.js.map → admin/chunks/dk-CGm-qVH7.js.map} +1 -1
  21. package/dist/admin/chunks/en-BJUu34b0.js +217 -0
  22. package/dist/{_chunks/en-CXG5y_vo.js.map → admin/chunks/en-BJUu34b0.js.map} +1 -1
  23. package/dist/admin/chunks/en-Bhut8Yay.mjs +213 -0
  24. package/dist/{_chunks/en-jBwb53yg.mjs.map → admin/chunks/en-Bhut8Yay.mjs.map} +1 -1
  25. package/dist/admin/chunks/es-DG8g9igJ.mjs +180 -0
  26. package/dist/admin/chunks/es-DG8g9igJ.mjs.map +1 -0
  27. package/dist/admin/chunks/es-J8kvHlNy.js +184 -0
  28. package/dist/{_chunks/es-DL8lez9W.js.map → admin/chunks/es-J8kvHlNy.js.map} +1 -1
  29. package/dist/admin/chunks/fr-C6y35iY7.js +76 -0
  30. package/dist/admin/chunks/fr-C6y35iY7.js.map +1 -0
  31. package/dist/admin/chunks/fr-UpV34MHY.mjs +73 -0
  32. package/dist/admin/chunks/fr-UpV34MHY.mjs.map +1 -0
  33. package/dist/admin/chunks/id-BWM18ljw.mjs +163 -0
  34. package/dist/{_chunks/ru-DGSjru5m.mjs.map → admin/chunks/id-BWM18ljw.mjs.map} +1 -1
  35. package/dist/admin/chunks/id-BvxV6wLP.js +167 -0
  36. package/dist/{_chunks/ru-C8A_4j0w.js.map → admin/chunks/id-BvxV6wLP.js.map} +1 -1
  37. package/dist/admin/chunks/index-BQ2VO38W.js +7781 -0
  38. package/dist/admin/chunks/index-BQ2VO38W.js.map +1 -0
  39. package/dist/admin/chunks/index-BZeN5KRn.js +1421 -0
  40. package/dist/admin/chunks/index-BZeN5KRn.js.map +1 -0
  41. package/dist/admin/chunks/index-BhX2euW0.mjs +1384 -0
  42. package/dist/admin/chunks/index-BhX2euW0.mjs.map +1 -0
  43. package/dist/admin/chunks/index-Cr5tfW7U.mjs +7754 -0
  44. package/dist/admin/chunks/index-Cr5tfW7U.mjs.map +1 -0
  45. package/dist/admin/chunks/it-1_vd9gV4.mjs +164 -0
  46. package/dist/{_chunks/tr-DsUerr-c.mjs.map → admin/chunks/it-1_vd9gV4.mjs.map} +1 -1
  47. package/dist/admin/chunks/it-C_IgFU-G.js +168 -0
  48. package/dist/{_chunks/sk-raWRcmPT.js.map → admin/chunks/it-C_IgFU-G.js.map} +1 -1
  49. package/dist/admin/chunks/ja-CWo4Qqq6.js +51 -0
  50. package/dist/admin/chunks/ja-CWo4Qqq6.js.map +1 -0
  51. package/dist/admin/chunks/ja-Cx23a2Ui.mjs +48 -0
  52. package/dist/admin/chunks/ja-Cx23a2Ui.mjs.map +1 -0
  53. package/dist/admin/chunks/ko-BsByJNEl.js +184 -0
  54. package/dist/admin/chunks/ko-BsByJNEl.js.map +1 -0
  55. package/dist/admin/chunks/ko-DC7paEx5.mjs +180 -0
  56. package/dist/admin/chunks/ko-DC7paEx5.mjs.map +1 -0
  57. package/dist/admin/chunks/ms-C3s4kxq6.mjs +160 -0
  58. package/dist/{_chunks/id-W1sKBFEw.mjs.map → admin/chunks/ms-C3s4kxq6.mjs.map} +1 -1
  59. package/dist/admin/chunks/ms-DPTzS7SH.js +164 -0
  60. package/dist/{_chunks/th-C83Bb_kR.js.map → admin/chunks/ms-DPTzS7SH.js.map} +1 -1
  61. package/dist/admin/chunks/nl-TzvfktV_.mjs +153 -0
  62. package/dist/{_chunks/nl-BaTAuelQ.mjs.map → admin/chunks/nl-TzvfktV_.mjs.map} +1 -1
  63. package/dist/admin/chunks/nl-db29QMOx.js +157 -0
  64. package/dist/{_chunks/nl-DQjrDEw0.js.map → admin/chunks/nl-db29QMOx.js.map} +1 -1
  65. package/dist/admin/chunks/pl-BdvupIN_.mjs +190 -0
  66. package/dist/admin/chunks/pl-BdvupIN_.mjs.map +1 -0
  67. package/dist/admin/chunks/pl-pYy1djj3.js +194 -0
  68. package/dist/admin/chunks/pl-pYy1djj3.js.map +1 -0
  69. package/dist/admin/chunks/pt-BQmWcdeG.js +52 -0
  70. package/dist/admin/chunks/pt-BQmWcdeG.js.map +1 -0
  71. package/dist/admin/chunks/pt-BR-CTPuXGWF.js +194 -0
  72. package/dist/{_chunks/pt-BR-DPd5nRnl.js.map → admin/chunks/pt-BR-CTPuXGWF.js.map} +1 -1
  73. package/dist/admin/chunks/pt-BR-DPrVmKeZ.mjs +190 -0
  74. package/dist/{_chunks/pt-BR-CCQGwXs0.mjs.map → admin/chunks/pt-BR-DPrVmKeZ.mjs.map} +1 -1
  75. package/dist/admin/chunks/pt-BTLIwmCv.mjs +49 -0
  76. package/dist/admin/chunks/pt-BTLIwmCv.mjs.map +1 -0
  77. package/dist/admin/chunks/ru-D46no502.mjs +165 -0
  78. package/dist/{_chunks/dk-BC7NAQR2.mjs.map → admin/chunks/ru-D46no502.mjs.map} +1 -1
  79. package/dist/admin/chunks/ru-DQiDXgUV.js +169 -0
  80. package/dist/admin/chunks/ru-DQiDXgUV.js.map +1 -0
  81. package/dist/admin/chunks/sk-Byr_l4Jc.mjs +164 -0
  82. package/dist/{_chunks/ko-DoNsXHXA.mjs.map → admin/chunks/sk-Byr_l4Jc.mjs.map} +1 -1
  83. package/dist/admin/chunks/sk-DrnebmXb.js +168 -0
  84. package/dist/{_chunks/it-DS4sM3km.js.map → admin/chunks/sk-DrnebmXb.js.map} +1 -1
  85. package/dist/admin/chunks/sv-Bbam7IDm.mjs +199 -0
  86. package/dist/admin/chunks/sv-Bbam7IDm.mjs.map +1 -0
  87. package/dist/admin/chunks/sv-CrWlNosi.js +203 -0
  88. package/dist/admin/chunks/sv-CrWlNosi.js.map +1 -0
  89. package/dist/admin/chunks/th-BbrCkfgX.js +165 -0
  90. package/dist/{_chunks/id-DYuTgqcc.js.map → admin/chunks/th-BbrCkfgX.js.map} +1 -1
  91. package/dist/admin/chunks/th-hfS0Wmk_.mjs +161 -0
  92. package/dist/{_chunks/it-D04lb2Wc.mjs.map → admin/chunks/th-hfS0Wmk_.mjs.map} +1 -1
  93. package/dist/admin/chunks/tr-CHdMj8m6.js +180 -0
  94. package/dist/admin/chunks/tr-CHdMj8m6.js.map +1 -0
  95. package/dist/admin/chunks/tr-DS7DBOhC.mjs +176 -0
  96. package/dist/admin/chunks/tr-DS7DBOhC.mjs.map +1 -0
  97. package/dist/admin/chunks/uk-BQEQ3weH.js +165 -0
  98. package/dist/{_chunks/uk-VwB0oiuV.js.map → admin/chunks/uk-BQEQ3weH.js.map} +1 -1
  99. package/dist/admin/chunks/uk-Cj8-BKeu.mjs +161 -0
  100. package/dist/{_chunks/sk-DVK4HfSC.mjs.map → admin/chunks/uk-Cj8-BKeu.mjs.map} +1 -1
  101. package/dist/admin/chunks/zh-BUVXH75-.mjs +199 -0
  102. package/dist/admin/chunks/zh-BUVXH75-.mjs.map +1 -0
  103. package/dist/admin/chunks/zh-CWj4avQA.js +203 -0
  104. package/dist/admin/chunks/zh-CWj4avQA.js.map +1 -0
  105. package/dist/admin/chunks/zh-Hans-BElOnuRb.mjs +144 -0
  106. package/dist/{_chunks/zh-Hans-Cc0M5PXr.mjs.map → admin/chunks/zh-Hans-BElOnuRb.mjs.map} +1 -1
  107. package/dist/admin/chunks/zh-Hans-lXbNiMp9.js +148 -0
  108. package/dist/{_chunks/zh-Hans-CLTLm_nt.js.map → admin/chunks/zh-Hans-lXbNiMp9.js.map} +1 -1
  109. package/dist/admin/index.js +24 -4
  110. package/dist/admin/index.js.map +1 -1
  111. package/dist/admin/index.mjs +17 -7
  112. package/dist/admin/index.mjs.map +1 -1
  113. package/dist/admin/src/components/ContentTypeBuilderNav/useContentTypeBuilderMenu.d.ts +5 -2
  114. package/dist/admin/src/components/DataManagerProvider/reducer.d.ts +97 -6
  115. package/dist/admin/src/components/FormModal/reducer.d.ts +110 -4
  116. package/dist/admin/src/components/ListRow.d.ts +2 -1
  117. package/dist/admin/src/contexts/DataManagerContext.d.ts +4 -4
  118. package/dist/admin/src/index.d.ts +2 -1
  119. package/dist/admin/src/pages/ListView/LinkToCMSettingsView.d.ts +1 -2
  120. package/dist/admin/src/pluginId.d.ts +1 -1
  121. package/dist/admin/src/reducers.d.ts +8 -1
  122. package/dist/admin/src/types.d.ts +2 -5
  123. package/dist/server/index.js +2504 -2151
  124. package/dist/server/index.js.map +1 -1
  125. package/dist/server/index.mjs +2500 -2147
  126. package/dist/server/index.mjs.map +1 -1
  127. package/package.json +13 -10
  128. package/dist/_chunks/ListView-CsqdnKp3.mjs +0 -959
  129. package/dist/_chunks/ListView-CsqdnKp3.mjs.map +0 -1
  130. package/dist/_chunks/ListView-tgW460ly.js +0 -964
  131. package/dist/_chunks/ListView-tgW460ly.js.map +0 -1
  132. package/dist/_chunks/ar-BYDB75EB.mjs +0 -51
  133. package/dist/_chunks/ar-BYDB75EB.mjs.map +0 -1
  134. package/dist/_chunks/ar-OCxhAFUy.js +0 -51
  135. package/dist/_chunks/ar-OCxhAFUy.js.map +0 -1
  136. package/dist/_chunks/cs-ChL4LaFY.mjs +0 -139
  137. package/dist/_chunks/cs-Ci3js5EC.js +0 -139
  138. package/dist/_chunks/de-DnlblIOh.js +0 -193
  139. package/dist/_chunks/de-DsHQNzp2.mjs +0 -193
  140. package/dist/_chunks/dk-BC7NAQR2.mjs +0 -183
  141. package/dist/_chunks/dk-D3XnOjYz.js +0 -183
  142. package/dist/_chunks/en-CXG5y_vo.js +0 -216
  143. package/dist/_chunks/en-jBwb53yg.mjs +0 -216
  144. package/dist/_chunks/es-BE_zx2_w.mjs +0 -183
  145. package/dist/_chunks/es-DL8lez9W.js +0 -183
  146. package/dist/_chunks/fr-DnTxugIo.js +0 -75
  147. package/dist/_chunks/fr-DnTxugIo.js.map +0 -1
  148. package/dist/_chunks/fr-lU_OMJma.mjs +0 -75
  149. package/dist/_chunks/fr-lU_OMJma.mjs.map +0 -1
  150. package/dist/_chunks/id-DYuTgqcc.js +0 -166
  151. package/dist/_chunks/id-W1sKBFEw.mjs +0 -166
  152. package/dist/_chunks/index-AjJmuxjv.js +0 -1357
  153. package/dist/_chunks/index-AjJmuxjv.js.map +0 -1
  154. package/dist/_chunks/index-BhIIILgq.mjs +0 -6694
  155. package/dist/_chunks/index-BhIIILgq.mjs.map +0 -1
  156. package/dist/_chunks/index-D79WZLAU.js +0 -6730
  157. package/dist/_chunks/index-D79WZLAU.js.map +0 -1
  158. package/dist/_chunks/index-DIuvDpH9.mjs +0 -1331
  159. package/dist/_chunks/index-DIuvDpH9.mjs.map +0 -1
  160. package/dist/_chunks/it-D04lb2Wc.mjs +0 -167
  161. package/dist/_chunks/it-DS4sM3km.js +0 -167
  162. package/dist/_chunks/ja-BHLK_2_g.mjs +0 -50
  163. package/dist/_chunks/ja-BHLK_2_g.mjs.map +0 -1
  164. package/dist/_chunks/ja-BjouJgZf.js +0 -50
  165. package/dist/_chunks/ja-BjouJgZf.js.map +0 -1
  166. package/dist/_chunks/ko-D_71Pdfn.js +0 -183
  167. package/dist/_chunks/ko-D_71Pdfn.js.map +0 -1
  168. package/dist/_chunks/ko-DoNsXHXA.mjs +0 -183
  169. package/dist/_chunks/ms-BtGFDB9t.mjs +0 -163
  170. package/dist/_chunks/ms-BtGFDB9t.mjs.map +0 -1
  171. package/dist/_chunks/ms-Re1pSHmx.js +0 -163
  172. package/dist/_chunks/ms-Re1pSHmx.js.map +0 -1
  173. package/dist/_chunks/nl-BaTAuelQ.mjs +0 -156
  174. package/dist/_chunks/nl-DQjrDEw0.js +0 -156
  175. package/dist/_chunks/pl-BGwXgwH7.js +0 -193
  176. package/dist/_chunks/pl-BGwXgwH7.js.map +0 -1
  177. package/dist/_chunks/pl-CP2Zgp01.mjs +0 -193
  178. package/dist/_chunks/pl-CP2Zgp01.mjs.map +0 -1
  179. package/dist/_chunks/pt-BR-CCQGwXs0.mjs +0 -193
  180. package/dist/_chunks/pt-BR-DPd5nRnl.js +0 -193
  181. package/dist/_chunks/pt-CJoUDTHQ.js +0 -51
  182. package/dist/_chunks/pt-CJoUDTHQ.js.map +0 -1
  183. package/dist/_chunks/pt-DMeTMW2x.mjs +0 -51
  184. package/dist/_chunks/pt-DMeTMW2x.mjs.map +0 -1
  185. package/dist/_chunks/ru-C8A_4j0w.js +0 -168
  186. package/dist/_chunks/ru-DGSjru5m.mjs +0 -168
  187. package/dist/_chunks/sk-DVK4HfSC.mjs +0 -167
  188. package/dist/_chunks/sk-raWRcmPT.js +0 -167
  189. package/dist/_chunks/sv-BGb12eW3.mjs +0 -202
  190. package/dist/_chunks/sv-BGb12eW3.mjs.map +0 -1
  191. package/dist/_chunks/sv-BNN71SFE.js +0 -202
  192. package/dist/_chunks/sv-BNN71SFE.js.map +0 -1
  193. package/dist/_chunks/th--u3VqsON.mjs +0 -164
  194. package/dist/_chunks/th--u3VqsON.mjs.map +0 -1
  195. package/dist/_chunks/th-C83Bb_kR.js +0 -164
  196. package/dist/_chunks/tr-BW20CfcO.js +0 -179
  197. package/dist/_chunks/tr-BW20CfcO.js.map +0 -1
  198. package/dist/_chunks/tr-DsUerr-c.mjs +0 -179
  199. package/dist/_chunks/uk-Bx5IlOKX.mjs +0 -164
  200. package/dist/_chunks/uk-Bx5IlOKX.mjs.map +0 -1
  201. package/dist/_chunks/uk-VwB0oiuV.js +0 -164
  202. package/dist/_chunks/zh-BiOCwPJu.js +0 -202
  203. package/dist/_chunks/zh-BiOCwPJu.js.map +0 -1
  204. package/dist/_chunks/zh-CsUDN13W.mjs +0 -202
  205. package/dist/_chunks/zh-CsUDN13W.mjs.map +0 -1
  206. package/dist/_chunks/zh-Hans-CLTLm_nt.js +0 -147
  207. package/dist/_chunks/zh-Hans-Cc0M5PXr.mjs +0 -147
  208. package/dist/admin/src/components/DataManagerProvider/constants.d.ts +0 -17
  209. package/dist/admin/src/components/FormModal/constants.d.ts +0 -12
  210. package/dist/admin/src/pages/RecursivePath/RecursivePath.d.ts +0 -1
@@ -1,1357 +0,0 @@
1
- "use strict";
2
- const Icons = require("@strapi/icons");
3
- const produce = require("immer");
4
- const get = require("lodash/get");
5
- const set = require("lodash/set");
6
- const snakeCase = require("lodash/snakeCase");
7
- const pluralize = require("pluralize");
8
- const slugify = require("@sindresorhus/slugify");
9
- const cloneDeep = require("lodash/cloneDeep");
10
- const yup = require("yup");
11
- const jsxRuntime = require("react/jsx-runtime");
12
- const React = require("react");
13
- const designSystem = require("@strapi/design-system");
14
- const reactDom = require("react-dom");
15
- const reactIntl = require("react-intl");
16
- const styledComponents = require("styled-components");
17
- const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
18
- function _interopNamespace(e) {
19
- if (e && e.__esModule) return e;
20
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
21
- if (e) {
22
- for (const k in e) {
23
- if (k !== "default") {
24
- const d = Object.getOwnPropertyDescriptor(e, k);
25
- Object.defineProperty(n, k, d.get ? d : {
26
- enumerable: true,
27
- get: () => e[k]
28
- });
29
- }
30
- }
31
- }
32
- n.default = e;
33
- return Object.freeze(n);
34
- }
35
- const produce__default = /* @__PURE__ */ _interopDefault(produce);
36
- const get__default = /* @__PURE__ */ _interopDefault(get);
37
- const set__default = /* @__PURE__ */ _interopDefault(set);
38
- const snakeCase__default = /* @__PURE__ */ _interopDefault(snakeCase);
39
- const pluralize__default = /* @__PURE__ */ _interopDefault(pluralize);
40
- const slugify__default = /* @__PURE__ */ _interopDefault(slugify);
41
- const cloneDeep__default = /* @__PURE__ */ _interopDefault(cloneDeep);
42
- const yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
43
- const React__namespace = /* @__PURE__ */ _interopNamespace(React);
44
- const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
45
- const v = glob[path];
46
- if (v) {
47
- return typeof v === "function" ? v() : Promise.resolve(v);
48
- }
49
- return new Promise((_, reject) => {
50
- (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
51
- reject.bind(
52
- null,
53
- new Error(
54
- "Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
55
- )
56
- )
57
- );
58
- });
59
- };
60
- const name$1 = "@strapi/content-type-builder";
61
- const version = "5.8.0";
62
- const description = "Create and manage content types";
63
- const repository = {
64
- type: "git",
65
- url: "git://github.com/strapi/strapi.git"
66
- };
67
- const license = "SEE LICENSE IN LICENSE";
68
- const author = {
69
- name: "Strapi Solutions SAS",
70
- email: "hi@strapi.io",
71
- url: "https://strapi.io"
72
- };
73
- const maintainers = [
74
- {
75
- name: "Strapi Solutions SAS",
76
- email: "hi@strapi.io",
77
- url: "https://strapi.io"
78
- }
79
- ];
80
- const exports$1 = {
81
- "./strapi-admin": {
82
- types: "./dist/admin/src/index.d.ts",
83
- source: "./admin/src/index.ts",
84
- "import": "./dist/admin/index.mjs",
85
- require: "./dist/admin/index.js",
86
- "default": "./dist/admin/index.js"
87
- },
88
- "./strapi-server": {
89
- types: "./dist/server/src/index.d.ts",
90
- source: "./server/src/index.ts",
91
- "import": "./dist/server/index.mjs",
92
- require: "./dist/server/index.js",
93
- "default": "./dist/server/index.js"
94
- },
95
- "./package.json": "./package.json"
96
- };
97
- const types = "./dist/index.d.ts";
98
- const files = [
99
- "dist/",
100
- "strapi-server.js"
101
- ];
102
- const scripts = {
103
- build: "pack-up build",
104
- clean: "run -T rimraf ./dist",
105
- lint: "run -T eslint .",
106
- "test:front": "run -T cross-env IS_EE=true jest --config ./jest.config.front.js",
107
- "test:front:ce": "run -T cross-env IS_EE=false jest --config ./jest.config.front.js",
108
- "test:front:watch": "run -T cross-env IS_EE=true jest --config ./jest.config.front.js --watchAll",
109
- "test:front:watch:ce": "run -T cross-env IS_EE=false jest --config ./jest.config.front.js --watchAll",
110
- "test:ts:back": "run -T tsc -p server/tsconfig.eslint.json",
111
- "test:ts:front": "run -T tsc -p admin/tsconfig.json",
112
- "test:unit": "run -T jest",
113
- "test:unit:watch": "run -T jest --watch",
114
- watch: "pack-up watch"
115
- };
116
- const dependencies = {
117
- "@reduxjs/toolkit": "1.9.7",
118
- "@sindresorhus/slugify": "1.1.0",
119
- "@strapi/design-system": "2.0.0-rc.14",
120
- "@strapi/generators": "5.8.0",
121
- "@strapi/icons": "2.0.0-rc.14",
122
- "@strapi/utils": "5.8.0",
123
- "date-fns": "2.30.0",
124
- "fs-extra": "11.2.0",
125
- immer: "9.0.21",
126
- lodash: "4.17.21",
127
- pluralize: "8.0.0",
128
- qs: "6.11.1",
129
- "react-intl": "6.6.2",
130
- "react-redux": "8.1.3",
131
- yup: "0.32.9"
132
- };
133
- const devDependencies = {
134
- "@strapi/admin": "5.8.0",
135
- "@strapi/pack-up": "5.0.2",
136
- "@strapi/types": "5.8.0",
137
- "@testing-library/dom": "10.1.0",
138
- "@testing-library/react": "15.0.7",
139
- "@testing-library/user-event": "14.5.2",
140
- "@types/fs-extra": "11.0.4",
141
- "@types/pluralize": "0.0.30",
142
- koa: "2.15.2",
143
- "koa-body": "6.0.1",
144
- react: "18.3.1",
145
- "react-dom": "18.3.1",
146
- "react-query": "3.39.3",
147
- "react-router-dom": "6.22.3",
148
- "styled-components": "6.1.8"
149
- };
150
- const peerDependencies = {
151
- "@strapi/admin": "^5.0.0",
152
- react: "^17.0.0 || ^18.0.0",
153
- "react-dom": "^17.0.0 || ^18.0.0",
154
- "react-router-dom": "^6.0.0",
155
- "styled-components": "^6.0.0"
156
- };
157
- const engines = {
158
- node: ">=18.0.0 <=22.x.x",
159
- npm: ">=6.0.0"
160
- };
161
- const strapi = {
162
- name: "content-type-builder",
163
- displayName: "Content Type Builder",
164
- description: "Modelize the data structure of your API. Create new fields and relations in just a minute. The files are automatically created and updated in your project.",
165
- kind: "plugin",
166
- required: true
167
- };
168
- const pluginPkg = {
169
- name: name$1,
170
- version,
171
- description,
172
- repository,
173
- license,
174
- author,
175
- maintainers,
176
- exports: exports$1,
177
- types,
178
- files,
179
- scripts,
180
- dependencies,
181
- devDependencies,
182
- peerDependencies,
183
- engines,
184
- strapi
185
- };
186
- const PERMISSIONS = {
187
- // This permission regards the main component (App) and is used to tell
188
- // If the plugin link should be displayed in the menu
189
- // And also if the plugin is accessible. This use case is found when a user types the url of the
190
- // plugin directly in the browser
191
- main: [{ action: "plugin::content-type-builder.read", subject: null }]
192
- };
193
- const MAX_COMPONENT_DEPTH = 6;
194
- const pluginId = pluginPkg.name.replace(/^@strapi\//i, "");
195
- const getRelationType = (relation, targetAttribute) => {
196
- const hasNotTargetAttribute = targetAttribute === void 0 || targetAttribute === null;
197
- if (relation === "oneToOne" && hasNotTargetAttribute) {
198
- return "oneWay";
199
- }
200
- if (relation === "oneToMany" && hasNotTargetAttribute) {
201
- return "manyWay";
202
- }
203
- return relation;
204
- };
205
- const makeUnique = (array) => [...new Set(array)];
206
- const ADD_ATTRIBUTE = "ContentTypeBuilder/DataManagerProvider/ADD_ATTRIBUTE";
207
- const ADD_CUSTOM_FIELD_ATTRIBUTE = "ContentTypeBuilder/DataManagerProvider/ADD_CUSTOM_FIELD_ATTRIBUTE";
208
- const ADD_CREATED_COMPONENT_TO_DYNAMIC_ZONE = "ContentTypeBuilder/DataManagerProvider/ADD_CREATED_COMPONENT_TO_DYNAMIC_ZONE";
209
- const CHANGE_DYNAMIC_ZONE_COMPONENTS = "ContentTypeBuilder/DataManagerProvider/CHANGE_DYNAMIC_ZONE_COMPONENTS";
210
- const CREATE_SCHEMA = "ContentTypeBuilder/DataManagerProvider/CREATE_SCHEMA";
211
- const CREATE_COMPONENT_SCHEMA = "ContentTypeBuilder/DataManagerProvider/CREATE_COMPONENT_SCHEMA";
212
- const DELETE_NOT_SAVED_TYPE = "ContentTypeBuilder/DataManagerProvider/DELETE_NOT_SAVED_TYPE";
213
- const EDIT_ATTRIBUTE = "ContentTypeBuilder/DataManagerProvider/EDIT_ATTRIBUTE";
214
- const EDIT_CUSTOM_FIELD_ATTRIBUTE = "ContentTypeBuilder/DataManagerProvider/EDIT_CUSTOM_FIELD_ATTRIBUTE";
215
- const GET_DATA_SUCCEEDED = "ContentTypeBuilder/DataManagerProvider/GET_DATA_SUCCEEDED";
216
- const RELOAD_PLUGIN = "ContentTypeBuilder/DataManagerProvider/RELOAD_PLUGIN";
217
- const REMOVE_FIELD_FROM_DISPLAYED_COMPONENT = "ContentTypeBuilder/DataManagerProvider/REMOVE_FIELD_FROM_DISPLAYED_COMPONENT";
218
- const REMOVE_COMPONENT_FROM_DYNAMIC_ZONE = "ContentTypeBuilder/DataManagerProvider/REMOVE_COMPONENT_FROM_DYNAMIC_ZONE";
219
- const REMOVE_FIELD = "ContentTypeBuilder/DataManagerProvider/REMOVE_FIELD";
220
- const SET_MODIFIED_DATA = "ContentTypeBuilder/DataManagerProvider/SET_MODIFIED_DATA";
221
- const UPDATE_SCHEMA = "ContentTypeBuilder/DataManagerProvider/UPDATE_SCHEMA";
222
- const UPDATE_INITIAL_STATE = "ContentTypeBuilder/DataManagerProvider/UPDATE_INITIAL_STATE";
223
- const retrieveComponentsFromSchema = (attributes, allComponentsData) => {
224
- const allComponents = attributes.reduce((acc, current) => {
225
- const type = current.type;
226
- if (type === "component") {
227
- const currentComponentName = current.component;
228
- acc.push(currentComponentName);
229
- const currentComponentAttributes = get__default.default(
230
- allComponentsData,
231
- [currentComponentName, "schema", "attributes"],
232
- []
233
- );
234
- acc.push(...retrieveComponentsFromSchema(currentComponentAttributes, allComponentsData));
235
- }
236
- if (type === "dynamiczone") {
237
- const dynamicZoneComponents = current.components;
238
- const componentsFromDZComponents = dynamicZoneComponents.reduce((acc2, currentUid) => {
239
- const compoAttrs = get__default.default(allComponentsData, [currentUid, "schema", "attributes"], []);
240
- return [...acc2, ...retrieveComponentsFromSchema(compoAttrs, allComponentsData)];
241
- }, []);
242
- return [...acc, ...dynamicZoneComponents, ...componentsFromDZComponents];
243
- }
244
- return acc;
245
- }, []);
246
- return makeUnique(allComponents);
247
- };
248
- const initialState$1 = {
249
- components: {},
250
- contentTypes: {},
251
- initialComponents: {},
252
- initialContentTypes: {},
253
- initialData: {},
254
- modifiedData: {
255
- components: {},
256
- contentTypes: {}
257
- },
258
- reservedNames: {},
259
- isLoading: true,
260
- isLoadingForDataToBeSet: true
261
- };
262
- const ONE_SIDE_RELATIONS = ["oneWay", "manyWay"];
263
- const getOppositeRelation = (originalRelation) => {
264
- if (originalRelation === "manyToOne") {
265
- return "oneToMany";
266
- }
267
- if (originalRelation === "oneToMany") {
268
- return "manyToOne";
269
- }
270
- return originalRelation;
271
- };
272
- const findAttributeIndex = (schema, attributeToFind) => {
273
- return schema.schema.attributes.findIndex(
274
- ({ name: name2 }) => name2 === attributeToFind
275
- );
276
- };
277
- const reducer$1 = (state = initialState$1, action) => produce__default.default(state, (draftState) => {
278
- switch (action.type) {
279
- case ADD_ATTRIBUTE: {
280
- const {
281
- attributeToSet: { name: name2, ...rest },
282
- forTarget,
283
- targetUid
284
- } = action;
285
- delete rest.createComponent;
286
- const pathToDataToEdit = ["component", "contentType"].includes(forTarget) ? [forTarget] : [forTarget, targetUid];
287
- const currentAttributes = get__default.default(
288
- state,
289
- ["modifiedData", ...pathToDataToEdit, "schema", "attributes"],
290
- []
291
- ).slice();
292
- const updatedAttributes = [...currentAttributes, { ...rest, name: name2 }];
293
- set__default.default(
294
- draftState,
295
- ["modifiedData", ...pathToDataToEdit, "schema", "attributes"],
296
- updatedAttributes
297
- );
298
- if (action.shouldAddComponentToData) {
299
- const componentToAddUID = rest.component;
300
- const componentToAdd = state.components[componentToAddUID];
301
- const isTemporaryComponent = componentToAdd?.isTemporary;
302
- const hasComponentAlreadyBeenAdded = state.modifiedData.components?.[componentToAddUID] !== void 0;
303
- if (isTemporaryComponent || hasComponentAlreadyBeenAdded) {
304
- break;
305
- }
306
- if (!draftState.modifiedData.components) {
307
- draftState.modifiedData.components = {};
308
- }
309
- draftState.modifiedData.components[componentToAddUID] = componentToAdd;
310
- const nestedComponents = retrieveComponentsFromSchema(
311
- componentToAdd.schema.attributes,
312
- state.components
313
- );
314
- const nestedComponentsToAddInModifiedData = nestedComponents.filter(
315
- (compoUID) => {
316
- return get__default.default(state, ["modifiedData", "components", compoUID]) === void 0;
317
- }
318
- );
319
- nestedComponentsToAddInModifiedData.forEach((compoUID) => {
320
- const compoSchema = get__default.default(state, ["components", compoUID], {});
321
- const isTemporary = compoSchema.isTemporary || false;
322
- if (!isTemporary) {
323
- if (!draftState.modifiedData.components) {
324
- draftState.modifiedData.components = {};
325
- }
326
- draftState.modifiedData.components[compoUID] = compoSchema;
327
- }
328
- });
329
- break;
330
- }
331
- const isCreatingRelationAttribute = rest.type === "relation";
332
- if (isCreatingRelationAttribute) {
333
- const target = rest.target;
334
- const targetAttribute = rest.targetAttribute || null;
335
- const relation = rest.relation;
336
- const relationType = getRelationType(relation, targetAttribute);
337
- const currentUid = get__default.default(state, ["modifiedData", ...pathToDataToEdit, "uid"]);
338
- if (rest.type === "relation" && relationType !== "oneWay" && relationType !== "manyWay" && target === currentUid) {
339
- const oppositeAttribute = {
340
- name: targetAttribute,
341
- relation: getOppositeRelation(relationType),
342
- target,
343
- targetAttribute: name2,
344
- type: "relation"
345
- };
346
- if (rest.private) {
347
- oppositeAttribute.private = rest.private;
348
- }
349
- const attributesToSet = [...updatedAttributes, oppositeAttribute];
350
- set__default.default(
351
- draftState,
352
- ["modifiedData", ...pathToDataToEdit, "schema", "attributes"],
353
- attributesToSet
354
- );
355
- }
356
- }
357
- break;
358
- }
359
- case ADD_CREATED_COMPONENT_TO_DYNAMIC_ZONE: {
360
- const { dynamicZoneTarget, componentsToAdd } = action;
361
- const dzAttributeIndex = findAttributeIndex(
362
- state.modifiedData.contentType,
363
- dynamicZoneTarget
364
- );
365
- componentsToAdd.forEach((componentUid) => {
366
- if (!draftState.modifiedData.contentType?.schema.attributes[dzAttributeIndex].components) {
367
- draftState.modifiedData.contentType.schema.attributes[dzAttributeIndex].components = [];
368
- }
369
- draftState.modifiedData.contentType.schema.attributes[dzAttributeIndex].components.push(
370
- componentUid
371
- );
372
- });
373
- break;
374
- }
375
- case ADD_CUSTOM_FIELD_ATTRIBUTE: {
376
- const {
377
- attributeToSet: { name: name2, ...rest },
378
- forTarget,
379
- targetUid
380
- } = action;
381
- const pathToDataToEdit = ["component", "contentType"].includes(forTarget) ? [forTarget] : [forTarget, targetUid];
382
- const currentAttributes = get__default.default(
383
- state,
384
- ["modifiedData", ...pathToDataToEdit, "schema", "attributes"],
385
- []
386
- ).slice();
387
- const updatedAttributes = [...currentAttributes, { ...rest, name: name2 }];
388
- set__default.default(
389
- draftState,
390
- ["modifiedData", ...pathToDataToEdit, "schema", "attributes"],
391
- updatedAttributes
392
- );
393
- break;
394
- }
395
- case CHANGE_DYNAMIC_ZONE_COMPONENTS: {
396
- const { dynamicZoneTarget, newComponents } = action;
397
- const dzAttributeIndex = findAttributeIndex(
398
- state.modifiedData.contentType,
399
- dynamicZoneTarget
400
- );
401
- const currentDZComponents = (state.modifiedData.contentType?.schema.attributes[dzAttributeIndex]).components;
402
- const updatedComponents = makeUnique([...currentDZComponents, ...newComponents]);
403
- (draftState.modifiedData.contentType?.schema.attributes[dzAttributeIndex]).components = updatedComponents;
404
- const nestedComponents = retrieveComponentsFromSchema(
405
- produce.current(draftState.modifiedData.contentType.schema.attributes),
406
- state.components
407
- );
408
- const nestedComponentsToAddInModifiedData = nestedComponents.filter((compoUID) => {
409
- return get__default.default(state, ["modifiedData", "components", compoUID]) === void 0;
410
- });
411
- nestedComponentsToAddInModifiedData.forEach((compoUID) => {
412
- const compoSchema = get__default.default(state, ["components", compoUID], {});
413
- const isTemporary = compoSchema.isTemporary || false;
414
- if (!isTemporary) {
415
- if (!draftState.modifiedData.components) {
416
- draftState.modifiedData.components = {};
417
- }
418
- draftState.modifiedData.components[compoUID] = compoSchema;
419
- }
420
- });
421
- break;
422
- }
423
- case CREATE_COMPONENT_SCHEMA: {
424
- const newSchema = {
425
- uid: action.uid,
426
- isTemporary: true,
427
- category: action.componentCategory,
428
- schema: {
429
- ...action.data,
430
- attributes: []
431
- }
432
- };
433
- draftState.components[action.uid] = newSchema;
434
- if (action.shouldAddComponentToData) {
435
- draftState.modifiedData.components[action.uid] = newSchema;
436
- }
437
- break;
438
- }
439
- case CREATE_SCHEMA: {
440
- const newSchema = {
441
- uid: action.uid,
442
- isTemporary: true,
443
- schema: {
444
- ...action.data,
445
- attributes: []
446
- }
447
- };
448
- draftState.contentTypes[action.uid] = newSchema;
449
- break;
450
- }
451
- case EDIT_ATTRIBUTE: {
452
- const {
453
- attributeToSet: { name: name2, ...rest },
454
- forTarget,
455
- targetUid,
456
- initialAttribute
457
- } = action;
458
- const initialAttributeName = initialAttribute.name;
459
- const pathToDataToEdit = ["component", "contentType"].includes(forTarget) ? [forTarget] : [forTarget, targetUid];
460
- const initialAttributeIndex = findAttributeIndex(
461
- get__default.default(state, ["modifiedData", ...pathToDataToEdit]),
462
- initialAttributeName
463
- );
464
- const isEditingRelation = rest.type === "relation";
465
- if (!isEditingRelation) {
466
- set__default.default(
467
- draftState,
468
- ["modifiedData", ...pathToDataToEdit, "schema", "attributes", initialAttributeIndex],
469
- action.attributeToSet
470
- );
471
- break;
472
- }
473
- const updatedAttributes = get__default.default(state, [
474
- "modifiedData",
475
- ...pathToDataToEdit,
476
- "schema",
477
- "attributes"
478
- ]).slice();
479
- const toSet = {
480
- name: name2,
481
- relation: rest.relation,
482
- target: rest.target,
483
- targetAttribute: rest.targetAttribute,
484
- type: "relation"
485
- };
486
- if (rest.private) {
487
- toSet.private = rest.private;
488
- }
489
- if (rest.pluginOptions) {
490
- toSet.pluginOptions = rest.pluginOptions;
491
- }
492
- const currentAttributeIndex = updatedAttributes.findIndex((value) => {
493
- return value.name !== void 0 && value.name === initialAttribute.name;
494
- });
495
- if (currentAttributeIndex !== -1) {
496
- updatedAttributes.splice(currentAttributeIndex, 1, toSet);
497
- }
498
- let oppositeAttributeNameToRemove = null;
499
- let oppositeAttributeNameToUpdate = null;
500
- let oppositeAttributeToCreate = null;
501
- let initialOppositeAttribute = null;
502
- const currentUid = get__default.default(state, ["modifiedData", ...pathToDataToEdit, "uid"]);
503
- const didChangeTargetRelation = initialAttribute.target !== rest.target;
504
- const didCreateInternalRelation = rest.target === currentUid;
505
- const relationType = getRelationType(rest.relation, rest.targetAttribute);
506
- const initialRelationType = getRelationType(
507
- initialAttribute.relation,
508
- initialAttribute.targetAttribute
509
- );
510
- const hadInternalRelation = initialAttribute.target === currentUid;
511
- const didChangeRelationType = initialRelationType !== relationType;
512
- const shouldRemoveOppositeAttributeBecauseOfTargetChange = didChangeTargetRelation && !didCreateInternalRelation && hadInternalRelation && isEditingRelation;
513
- const shouldRemoveOppositeAttributeBecauseOfRelationTypeChange = didChangeRelationType && hadInternalRelation && ["oneWay", "manyWay"].includes(relationType) && isEditingRelation;
514
- const shouldUpdateOppositeAttributeBecauseOfRelationTypeChange = !ONE_SIDE_RELATIONS.includes(initialRelationType) && !ONE_SIDE_RELATIONS.includes(relationType) && hadInternalRelation && didCreateInternalRelation && isEditingRelation;
515
- const shouldCreateOppositeAttributeBecauseOfRelationTypeChange = ONE_SIDE_RELATIONS.includes(initialRelationType) && !ONE_SIDE_RELATIONS.includes(relationType) && hadInternalRelation && didCreateInternalRelation && isEditingRelation;
516
- const shouldCreateOppositeAttributeBecauseOfTargetChange = didChangeTargetRelation && didCreateInternalRelation && !ONE_SIDE_RELATIONS.includes(relationType);
517
- if (shouldRemoveOppositeAttributeBecauseOfTargetChange || shouldRemoveOppositeAttributeBecauseOfRelationTypeChange) {
518
- oppositeAttributeNameToRemove = initialAttribute.targetAttribute;
519
- }
520
- if (oppositeAttributeNameToRemove) {
521
- const indexToRemove = updatedAttributes.findIndex(
522
- (value) => value.name === oppositeAttributeNameToRemove
523
- );
524
- updatedAttributes.splice(indexToRemove, 1);
525
- }
526
- if (!shouldRemoveOppositeAttributeBecauseOfTargetChange) {
527
- const initialTargetContentType = get__default.default(state, [
528
- "initialContentTypes",
529
- initialAttribute.target
530
- ]);
531
- if (initialTargetContentType) {
532
- const oppositeAttributeIndex = findAttributeIndex(
533
- initialTargetContentType,
534
- initialAttribute.targetAttribute
535
- );
536
- initialOppositeAttribute = get__default.default(state, [
537
- "initialContentTypes",
538
- initialAttribute.target,
539
- "schema",
540
- "attributes",
541
- oppositeAttributeIndex
542
- ]);
543
- }
544
- }
545
- if (shouldCreateOppositeAttributeBecauseOfRelationTypeChange || shouldCreateOppositeAttributeBecauseOfTargetChange) {
546
- oppositeAttributeToCreate = {
547
- name: rest.targetAttribute,
548
- relation: getOppositeRelation(relationType),
549
- target: rest.target,
550
- targetAttribute: name2,
551
- type: "relation"
552
- };
553
- if (rest.private) {
554
- oppositeAttributeToCreate.private = rest.private;
555
- }
556
- if (initialOppositeAttribute && initialOppositeAttribute.pluginOptions) {
557
- oppositeAttributeToCreate.pluginOptions = initialOppositeAttribute.pluginOptions;
558
- }
559
- const indexOfInitialAttribute = updatedAttributes.findIndex(
560
- ({ name: name22 }) => name22 === initialAttribute.name
561
- );
562
- const indexOfUpdatedAttribute = updatedAttributes.findIndex(
563
- ({ name: attrName }) => name2 === attrName
564
- );
565
- const indexToInsert = (indexOfInitialAttribute === -1 ? indexOfUpdatedAttribute : indexOfInitialAttribute) + 1;
566
- updatedAttributes.splice(indexToInsert, 0, oppositeAttributeToCreate);
567
- }
568
- if (shouldUpdateOppositeAttributeBecauseOfRelationTypeChange) {
569
- oppositeAttributeNameToUpdate = initialAttribute.targetAttribute;
570
- oppositeAttributeToCreate = {
571
- name: rest.targetAttribute,
572
- relation: getOppositeRelation(relationType),
573
- target: rest.target,
574
- targetAttribute: name2,
575
- type: "relation"
576
- };
577
- if (rest.private) {
578
- oppositeAttributeToCreate.private = rest.private;
579
- }
580
- if (initialOppositeAttribute && initialOppositeAttribute.pluginOptions) {
581
- oppositeAttributeToCreate.pluginOptions = initialOppositeAttribute.pluginOptions;
582
- }
583
- if (oppositeAttributeNameToUpdate) {
584
- const indexToUpdate = updatedAttributes.findIndex(
585
- ({ name: name22 }) => name22 === oppositeAttributeNameToUpdate
586
- );
587
- updatedAttributes.splice(indexToUpdate, 1, oppositeAttributeToCreate);
588
- }
589
- }
590
- set__default.default(
591
- draftState,
592
- ["modifiedData", ...pathToDataToEdit, "schema", "attributes"],
593
- updatedAttributes
594
- );
595
- break;
596
- }
597
- case EDIT_CUSTOM_FIELD_ATTRIBUTE: {
598
- const { forTarget, targetUid, initialAttribute, attributeToSet } = action;
599
- const initialAttributeName = initialAttribute.name;
600
- const pathToDataToEdit = ["component", "contentType"].includes(forTarget) ? [forTarget] : [forTarget, targetUid];
601
- const initialAttributeIndex = findAttributeIndex(
602
- get__default.default(state, ["modifiedData", ...pathToDataToEdit]),
603
- initialAttributeName
604
- );
605
- set__default.default(
606
- draftState,
607
- ["modifiedData", ...pathToDataToEdit, "schema", "attributes", initialAttributeIndex],
608
- attributeToSet
609
- );
610
- break;
611
- }
612
- case GET_DATA_SUCCEEDED: {
613
- draftState.components = action.components;
614
- draftState.initialComponents = action.components;
615
- draftState.initialContentTypes = action.contentTypes;
616
- draftState.contentTypes = action.contentTypes;
617
- draftState.reservedNames = action.reservedNames;
618
- draftState.isLoading = false;
619
- break;
620
- }
621
- case UPDATE_INITIAL_STATE: {
622
- draftState.initialData = draftState.modifiedData;
623
- break;
624
- }
625
- case DELETE_NOT_SAVED_TYPE: {
626
- draftState.contentTypes = state.initialContentTypes;
627
- draftState.components = state.initialComponents;
628
- break;
629
- }
630
- case RELOAD_PLUGIN: {
631
- return initialState$1;
632
- }
633
- case REMOVE_COMPONENT_FROM_DYNAMIC_ZONE: {
634
- const dzAttributeIndex = findAttributeIndex(state.modifiedData.contentType, action.dzName);
635
- draftState.modifiedData.contentType.schema.attributes[dzAttributeIndex].components.splice(
636
- action.componentToRemoveIndex,
637
- 1
638
- );
639
- break;
640
- }
641
- case REMOVE_FIELD: {
642
- const { mainDataKey, attributeToRemoveName } = action;
643
- const pathToAttributes = ["modifiedData", mainDataKey, "schema", "attributes"];
644
- const attributeToRemoveIndex = findAttributeIndex(
645
- state.modifiedData[mainDataKey],
646
- attributeToRemoveName
647
- );
648
- const pathToAttributeToRemove = [...pathToAttributes, attributeToRemoveIndex];
649
- const attributeToRemoveData = get__default.default(state, pathToAttributeToRemove);
650
- const isRemovingRelationAttribute = attributeToRemoveData.type === "relation";
651
- const canTheAttributeToRemoveHaveARelationWithItself = mainDataKey === "contentType";
652
- if (isRemovingRelationAttribute && canTheAttributeToRemoveHaveARelationWithItself) {
653
- const { target, relation, targetAttribute } = attributeToRemoveData;
654
- const relationType = getRelationType(relation, targetAttribute);
655
- const uid = state.modifiedData.contentType?.uid;
656
- const shouldRemoveOppositeAttribute = target === uid && !ONE_SIDE_RELATIONS.includes(relationType);
657
- if (shouldRemoveOppositeAttribute) {
658
- const attributes = state.modifiedData[mainDataKey]?.schema.attributes.slice();
659
- const nextAttributes = attributes.filter((attribute) => {
660
- if (attribute.name === attributeToRemoveName) {
661
- return false;
662
- }
663
- if (attribute.target === uid && attribute.targetAttribute === attributeToRemoveName) {
664
- return false;
665
- }
666
- return true;
667
- });
668
- draftState.modifiedData[mainDataKey].schema.attributes = nextAttributes;
669
- break;
670
- }
671
- }
672
- const uidFieldsToUpdate = state.modifiedData[mainDataKey].schema.attributes.slice().reduce((acc, current2) => {
673
- if (current2.type !== "uid") {
674
- return acc;
675
- }
676
- if (current2.targetField !== attributeToRemoveName) {
677
- return acc;
678
- }
679
- acc.push(current2.name);
680
- return acc;
681
- }, []);
682
- uidFieldsToUpdate.forEach((fieldName) => {
683
- const fieldIndex = findAttributeIndex(state.modifiedData[mainDataKey], fieldName);
684
- delete draftState.modifiedData[mainDataKey]?.schema.attributes[fieldIndex].targetField;
685
- });
686
- draftState.modifiedData[mainDataKey]?.schema.attributes.splice(attributeToRemoveIndex, 1);
687
- break;
688
- }
689
- case REMOVE_FIELD_FROM_DISPLAYED_COMPONENT: {
690
- const { attributeToRemoveName, componentUid } = action;
691
- const attributeToRemoveIndex = findAttributeIndex(
692
- state.modifiedData.components?.[componentUid],
693
- attributeToRemoveName
694
- );
695
- draftState.modifiedData.components?.[componentUid]?.schema?.attributes?.splice(
696
- attributeToRemoveIndex,
697
- 1
698
- );
699
- break;
700
- }
701
- case SET_MODIFIED_DATA: {
702
- draftState.isLoadingForDataToBeSet = false;
703
- draftState.initialData = action.schemaToSet;
704
- draftState.modifiedData = action.schemaToSet;
705
- if (!action.hasJustCreatedSchema) {
706
- draftState.components = state.initialComponents;
707
- draftState.contentTypes = state.initialContentTypes;
708
- }
709
- break;
710
- }
711
- case UPDATE_SCHEMA: {
712
- const {
713
- data: { displayName, category, icon, kind },
714
- schemaType,
715
- uid
716
- } = action;
717
- draftState.modifiedData[schemaType].schema.displayName = displayName;
718
- if (action.schemaType === "component") {
719
- draftState.modifiedData.component.category = category;
720
- draftState.modifiedData.component.schema.icon = icon;
721
- const addedComponent = produce.current(draftState.modifiedData.component);
722
- draftState.components[uid] = addedComponent;
723
- break;
724
- }
725
- draftState.modifiedData.contentType.schema.kind = kind;
726
- break;
727
- }
728
- default:
729
- return draftState;
730
- }
731
- });
732
- const nameToSlug = (name2) => slugify__default.default(name2, { separator: "-" });
733
- const ON_CHANGE = "ContentTypeBuilder/FormModal/ON_CHANGE";
734
- const ON_CHANGE_RELATION_TARGET = "ContentTypeBuilder/FormModal/ON_CHANGE_RELATION_TARGET";
735
- const ON_CHANGE_RELATION_TYPE = "ContentTypeBuilder/FormModal/ON_CHANGE_RELATION_TYPE";
736
- const RESET_PROPS = "ContentTypeBuilder/FormModal/RESET_PROPS";
737
- const RESET_PROPS_AND_SET_FORM_FOR_ADDING_AN_EXISTING_COMPO = "ContentTypeBuilder/FormModal/RESET_PROPS_AND_SET_FORM_FOR_ADDING_AN_EXISTING_COMPO";
738
- const RESET_PROPS_AND_SAVE_CURRENT_DATA = "ContentTypeBuilder/FormModal/RESET_PROPS_AND_SAVE_CURRENT_DATA";
739
- const RESET_PROPS_AND_SET_THE_FORM_FOR_ADDING_A_COMPO_TO_A_DZ = "ContentTypeBuilder/FormModal/RESET_PROPS_AND_SET_THE_FORM_FOR_ADDING_A_COMPO_TO_A_DZ";
740
- const SET_DATA_TO_EDIT = "ContentTypeBuilder/FormModal/SET_DATA_TO_EDIT";
741
- const SET_ATTRIBUTE_DATA_SCHEMA = "ContentTypeBuilder/FormModal/SET_ATTRIBUTE_DATA_SCHEMA";
742
- const SET_CUSTOM_FIELD_DATA_SCHEMA = "ContentTypeBuilder/FormModal/SET_CUSTOM_FIELD_DATA_SCHEMA";
743
- const SET_DYNAMIC_ZONE_DATA_SCHEMA = "ContentTypeBuilder/FormModal/SET_DYNAMIC_ZONE_DATA_SCHEMA";
744
- const SET_ERRORS = "ContentTypeBuilder/FormModal/SET_ERRORS";
745
- const createUid = (name2) => {
746
- const modelName = nameToSlug(name2);
747
- return `api::${modelName}.${modelName}`;
748
- };
749
- const createComponentUid = (name2, category) => {
750
- return `${nameToSlug(category)}.${nameToSlug(name2)}`;
751
- };
752
- const customFieldDefaultOptionsReducer = (acc, option) => {
753
- if (option.items) {
754
- return option.items.reduce(customFieldDefaultOptionsReducer, acc);
755
- }
756
- if ("defaultValue" in option) {
757
- const { name: name2, defaultValue } = option;
758
- acc.push({ name: name2, defaultValue });
759
- }
760
- return acc;
761
- };
762
- const shouldPluralizeName = (nature) => ["manyToMany", "oneToMany", "manyWay"].includes(nature) ? 2 : 1;
763
- const shouldPluralizeTargetAttribute = (nature) => ["manyToMany", "manyToOne"].includes(nature) ? 2 : 1;
764
- const initialState = {
765
- formErrors: {},
766
- modifiedData: {},
767
- initialData: {},
768
- componentToCreate: {},
769
- isCreatingComponentWhileAddingAField: false
770
- };
771
- const reducer = (state = initialState, action) => (
772
- // eslint-disable-next-line consistent-return
773
- produce.produce(state, (draftState) => {
774
- switch (action.type) {
775
- case ON_CHANGE: {
776
- const { keys, value } = action;
777
- const obj = state.modifiedData;
778
- const hasDefaultValue = Boolean(obj.default);
779
- if (hasDefaultValue && keys.length === 1 && keys.includes("type")) {
780
- const previousType = obj.type;
781
- if (previousType && ["date", "datetime", "time"].includes(previousType)) {
782
- delete draftState.modifiedData.default;
783
- }
784
- }
785
- set__default.default(draftState, ["modifiedData", ...keys], value);
786
- break;
787
- }
788
- case ON_CHANGE_RELATION_TARGET: {
789
- const {
790
- target: {
791
- oneThatIsCreatingARelationWithAnother,
792
- selectedContentTypeFriendlyName,
793
- targetContentTypeAllowedRelations,
794
- value
795
- }
796
- } = action;
797
- let didChangeRelationTypeBecauseOfRestrictedRelation = false;
798
- let changedRelationType = null;
799
- set__default.default(draftState, ["modifiedData", "target"], value);
800
- const modifiedData = state.modifiedData;
801
- if (Array.isArray(targetContentTypeAllowedRelations)) {
802
- const currentRelationType = getRelationType(
803
- modifiedData.relation,
804
- modifiedData.targetAttribute
805
- );
806
- if (!targetContentTypeAllowedRelations.includes(currentRelationType)) {
807
- const relationToSet = targetContentTypeAllowedRelations[0];
808
- didChangeRelationTypeBecauseOfRestrictedRelation = true;
809
- changedRelationType = relationToSet;
810
- if (relationToSet === "oneWay") {
811
- set__default.default(draftState, ["modifiedData", "relation"], "oneToOne");
812
- } else if (relationToSet === "manyWay") {
813
- set__default.default(draftState, ["modifiedData", "relation"], "oneToMany");
814
- } else {
815
- set__default.default(draftState, ["modifiedData", "relation"], relationToSet);
816
- }
817
- }
818
- }
819
- let nameToSet;
820
- if (didChangeRelationTypeBecauseOfRestrictedRelation) {
821
- nameToSet = pluralize__default.default(
822
- snakeCase__default.default(nameToSlug(selectedContentTypeFriendlyName)),
823
- shouldPluralizeName(changedRelationType)
824
- );
825
- } else {
826
- nameToSet = pluralize__default.default(
827
- snakeCase__default.default(nameToSlug(selectedContentTypeFriendlyName)),
828
- shouldPluralizeName(modifiedData.relation)
829
- );
830
- }
831
- set__default.default(draftState, ["modifiedData", "name"], nameToSet);
832
- const currentTargetAttribute = state.modifiedData.targetAttribute;
833
- if (currentTargetAttribute === null) {
834
- break;
835
- }
836
- if (didChangeRelationTypeBecauseOfRestrictedRelation && ["oneWay", "manyWay"].includes(changedRelationType)) {
837
- set__default.default(draftState, ["modifiedData", "targetAttribute"], null);
838
- break;
839
- }
840
- const targetAttributeToSet = pluralize__default.default(
841
- snakeCase__default.default(nameToSlug(oneThatIsCreatingARelationWithAnother)),
842
- shouldPluralizeTargetAttribute(modifiedData.relation)
843
- );
844
- set__default.default(draftState, ["modifiedData", "targetAttribute"], targetAttributeToSet);
845
- break;
846
- }
847
- case ON_CHANGE_RELATION_TYPE: {
848
- const {
849
- target: { oneThatIsCreatingARelationWithAnother, value }
850
- } = action;
851
- const currentName = state.modifiedData.name;
852
- if (!["oneWay", "manyWay"].includes(value)) {
853
- set__default.default(draftState, ["modifiedData", "relation"], value);
854
- const currentTargetAttribute = state.modifiedData.targetAttribute;
855
- set__default.default(
856
- draftState,
857
- ["modifiedData", "name"],
858
- pluralize__default.default(snakeCase__default.default(nameToSlug(currentName)), shouldPluralizeName(value))
859
- );
860
- set__default.default(
861
- draftState,
862
- ["modifiedData", "targetAttribute"],
863
- pluralize__default.default(
864
- currentTargetAttribute || snakeCase__default.default(nameToSlug(oneThatIsCreatingARelationWithAnother)),
865
- shouldPluralizeTargetAttribute(value)
866
- )
867
- );
868
- break;
869
- }
870
- if (value === "oneWay") {
871
- set__default.default(draftState, ["modifiedData", "relation"], "oneToOne");
872
- set__default.default(draftState, ["modifiedData", "targetAttribute"], null);
873
- set__default.default(draftState, ["modifiedData", "name"], pluralize__default.default(snakeCase__default.default(currentName), 1));
874
- break;
875
- }
876
- set__default.default(draftState, ["modifiedData", "relation"], "oneToMany");
877
- set__default.default(draftState, ["modifiedData", "targetAttribute"], null);
878
- set__default.default(draftState, ["modifiedData", "name"], pluralize__default.default(snakeCase__default.default(currentName), 2));
879
- break;
880
- }
881
- case RESET_PROPS:
882
- return initialState;
883
- case RESET_PROPS_AND_SET_FORM_FOR_ADDING_AN_EXISTING_COMPO: {
884
- const nextState = {
885
- ...initialState,
886
- modifiedData: {
887
- type: "component",
888
- repeatable: true,
889
- ...action.options
890
- }
891
- };
892
- return nextState;
893
- }
894
- case RESET_PROPS_AND_SAVE_CURRENT_DATA: {
895
- const componentToCreate = state.modifiedData.componentToCreate;
896
- const modifiedData = {
897
- displayName: componentToCreate.displayName,
898
- type: "component",
899
- repeatable: false,
900
- ...action.options,
901
- component: createComponentUid(componentToCreate.displayName, componentToCreate.category)
902
- };
903
- const nextState = {
904
- ...initialState,
905
- componentToCreate,
906
- modifiedData,
907
- isCreatingComponentWhileAddingAField: state.modifiedData.createComponent
908
- };
909
- return nextState;
910
- }
911
- case RESET_PROPS_AND_SET_THE_FORM_FOR_ADDING_A_COMPO_TO_A_DZ: {
912
- const createdDZ = state.modifiedData;
913
- const dataToSet = {
914
- ...createdDZ,
915
- createComponent: true,
916
- componentToCreate: { type: "component" }
917
- };
918
- return { ...initialState, modifiedData: dataToSet };
919
- }
920
- case SET_DATA_TO_EDIT: {
921
- draftState.modifiedData = action.data;
922
- draftState.initialData = action.data;
923
- break;
924
- }
925
- case SET_ATTRIBUTE_DATA_SCHEMA: {
926
- const {
927
- attributeType,
928
- isEditing,
929
- modifiedDataToSetForEditing,
930
- nameToSetForRelation,
931
- targetUid,
932
- step,
933
- options = {}
934
- } = action;
935
- if (isEditing) {
936
- draftState.modifiedData = modifiedDataToSetForEditing;
937
- draftState.initialData = modifiedDataToSetForEditing;
938
- break;
939
- }
940
- let dataToSet;
941
- if (attributeType === "component") {
942
- if (step === "1") {
943
- dataToSet = {
944
- type: "component",
945
- createComponent: true,
946
- componentToCreate: { type: "component" }
947
- };
948
- } else {
949
- dataToSet = {
950
- ...options,
951
- type: "component",
952
- repeatable: true
953
- };
954
- }
955
- } else if (attributeType === "dynamiczone") {
956
- dataToSet = {
957
- ...options,
958
- type: "dynamiczone",
959
- components: []
960
- };
961
- } else if (attributeType === "text") {
962
- dataToSet = { ...options, type: "string" };
963
- } else if (attributeType === "number" || attributeType === "date") {
964
- dataToSet = options;
965
- } else if (attributeType === "media") {
966
- dataToSet = {
967
- allowedTypes: ["images", "files", "videos", "audios"],
968
- type: "media",
969
- multiple: true,
970
- ...options
971
- };
972
- } else if (attributeType === "enumeration") {
973
- dataToSet = { ...options, type: "enumeration", enum: [] };
974
- } else if (attributeType === "relation") {
975
- dataToSet = {
976
- name: snakeCase__default.default(nameToSetForRelation),
977
- relation: "oneToOne",
978
- targetAttribute: null,
979
- target: targetUid,
980
- type: "relation"
981
- };
982
- } else {
983
- dataToSet = { ...options, type: attributeType, default: null };
984
- }
985
- draftState.modifiedData = dataToSet;
986
- break;
987
- }
988
- case SET_CUSTOM_FIELD_DATA_SCHEMA: {
989
- const { customField, isEditing, modifiedDataToSetForEditing, options = {} } = action;
990
- if (isEditing) {
991
- draftState.modifiedData = modifiedDataToSetForEditing;
992
- draftState.initialData = modifiedDataToSetForEditing;
993
- break;
994
- }
995
- draftState.modifiedData = { ...options, type: customField.type };
996
- const allOptions = [
997
- ...customField?.options?.base || [],
998
- ...customField?.options?.advanced || []
999
- ];
1000
- const optionDefaults = allOptions.reduce(customFieldDefaultOptionsReducer, []);
1001
- if (optionDefaults.length) {
1002
- optionDefaults.forEach(
1003
- ({ name: name2, defaultValue }) => set__default.default(draftState.modifiedData, name2, defaultValue)
1004
- );
1005
- }
1006
- break;
1007
- }
1008
- case SET_DYNAMIC_ZONE_DATA_SCHEMA: {
1009
- draftState.modifiedData = action.attributeToEdit;
1010
- draftState.initialData = action.attributeToEdit;
1011
- break;
1012
- }
1013
- case SET_ERRORS: {
1014
- draftState.formErrors = action.errors;
1015
- break;
1016
- }
1017
- default:
1018
- return draftState;
1019
- }
1020
- })
1021
- );
1022
- const reducers = {
1023
- [`${pluginId}_formModal`]: reducer,
1024
- [`${pluginId}_dataManagerProvider`]: reducer$1
1025
- };
1026
- const formsAPI = {
1027
- components: {
1028
- inputs: {},
1029
- add({ id, component }) {
1030
- if (!this.inputs[id]) {
1031
- this.inputs[id] = component;
1032
- }
1033
- }
1034
- },
1035
- types: {
1036
- attribute: {
1037
- // test: {
1038
- // validators: [],
1039
- // form: {
1040
- // advanced: [
1041
- // /* cb */
1042
- // ],
1043
- // base: [
1044
- // /* cb */
1045
- // ],
1046
- // },
1047
- // },
1048
- },
1049
- contentType: {
1050
- validators: [],
1051
- form: {
1052
- advanced: [],
1053
- base: []
1054
- }
1055
- },
1056
- component: {
1057
- validators: [],
1058
- form: {
1059
- advanced: [],
1060
- base: []
1061
- }
1062
- }
1063
- },
1064
- contentTypeSchemaMutations: [],
1065
- addContentTypeSchemaMutation(cb) {
1066
- this.contentTypeSchemaMutations.push(cb);
1067
- },
1068
- extendContentType({ validator, form: { advanced, base } }) {
1069
- const { contentType } = this.types;
1070
- contentType.validators.push(validator);
1071
- contentType.form.advanced.push(advanced);
1072
- contentType.form.base.push(base);
1073
- },
1074
- extendFields(fields, { validator, form: { advanced, base } }) {
1075
- const formType = this.types.attribute;
1076
- fields.forEach((field) => {
1077
- if (!formType[field]) {
1078
- formType[field] = {
1079
- validators: [],
1080
- form: {
1081
- advanced: [
1082
- /* cb */
1083
- ],
1084
- base: [
1085
- /* cb */
1086
- ]
1087
- }
1088
- };
1089
- }
1090
- formType[field].validators.push(validator);
1091
- formType[field].form.advanced.push(advanced);
1092
- formType[field].form.base.push(base);
1093
- });
1094
- },
1095
- getAdvancedForm(target, props = null) {
1096
- const sectionsToAdd = get__default.default(this.types, [...target, "form", "advanced"], []).reduce(
1097
- (acc, current) => {
1098
- const sections = current(props);
1099
- return [...acc, ...sections];
1100
- },
1101
- []
1102
- );
1103
- return sectionsToAdd;
1104
- },
1105
- makeCustomFieldValidator(attributeShape, validator, ...validatorArgs) {
1106
- if (!validator) return attributeShape;
1107
- return attributeShape.shape({ options: yup__namespace.object().shape(validator(validatorArgs)) });
1108
- },
1109
- makeValidator(target, initShape, ...args) {
1110
- const validators = get__default.default(this.types, [...target, "validators"], []);
1111
- const pluginOptionsShape = validators.reduce((acc, current) => {
1112
- const pluginOptionShape = current(args);
1113
- return { ...acc, ...pluginOptionShape };
1114
- }, {});
1115
- return initShape.shape({ pluginOptions: yup__namespace.object().shape(pluginOptionsShape) });
1116
- },
1117
- mutateContentTypeSchema(data, initialData) {
1118
- let enhancedData = cloneDeep__default.default(data);
1119
- const refData = cloneDeep__default.default(initialData);
1120
- this.contentTypeSchemaMutations.forEach((cb) => {
1121
- enhancedData = cb(enhancedData, refData);
1122
- });
1123
- return enhancedData;
1124
- }
1125
- };
1126
- const prefixPluginTranslations = (trad, pluginId2) => {
1127
- if (!pluginId2) {
1128
- throw new TypeError("pluginId can't be empty");
1129
- }
1130
- return Object.keys(trad).reduce((acc, current) => {
1131
- acc[`${pluginId2}.${current}`] = trad[current];
1132
- return acc;
1133
- }, {});
1134
- };
1135
- const AutoReloadOverlayBlockerContext = React__namespace.createContext(
1136
- {}
1137
- );
1138
- const MAX_ELAPSED_TIME = 30 * 1e3;
1139
- const AutoReloadOverlayBlockerProvider = ({ children }) => {
1140
- const [isOpen, setIsOpen] = React__namespace.useState(false);
1141
- const [config, setConfig] = React__namespace.useState({});
1142
- const [failed, setFailed] = React__namespace.useState(false);
1143
- const lockAppWithAutoreload = React__namespace.useCallback((config2 = {}) => {
1144
- setIsOpen(true);
1145
- setConfig(config2);
1146
- }, []);
1147
- const unlockAppWithAutoreload = React__namespace.useCallback(() => {
1148
- setIsOpen(false);
1149
- setConfig({});
1150
- }, []);
1151
- React__namespace.useEffect(() => {
1152
- if (isOpen) {
1153
- const timeout = setTimeout(() => {
1154
- setFailed(true);
1155
- }, MAX_ELAPSED_TIME);
1156
- return () => {
1157
- clearTimeout(timeout);
1158
- };
1159
- }
1160
- }, [isOpen]);
1161
- let displayedIcon = config?.icon || "reload";
1162
- let description2 = {
1163
- id: config?.description || "components.OverlayBlocker.description",
1164
- defaultMessage: "You're using a feature that needs the server to restart. The page will reload automatically."
1165
- };
1166
- let title = {
1167
- id: config?.title || "components.OverlayBlocker.title",
1168
- defaultMessage: "Waiting for restart"
1169
- };
1170
- if (failed) {
1171
- displayedIcon = "time";
1172
- description2 = {
1173
- id: "components.OverlayBlocker.description.serverError",
1174
- defaultMessage: "The server should have restarted, please check your logs in the terminal."
1175
- };
1176
- title = {
1177
- id: "components.OverlayBlocker.title.serverError",
1178
- defaultMessage: "The restart is taking longer than expected"
1179
- };
1180
- }
1181
- const autoReloadValue = React__namespace.useMemo(
1182
- () => ({
1183
- lockAppWithAutoreload,
1184
- unlockAppWithAutoreload
1185
- }),
1186
- [lockAppWithAutoreload, unlockAppWithAutoreload]
1187
- );
1188
- return /* @__PURE__ */ jsxRuntime.jsxs(AutoReloadOverlayBlockerContext.Provider, { value: autoReloadValue, children: [
1189
- /* @__PURE__ */ jsxRuntime.jsx(
1190
- Blocker,
1191
- {
1192
- displayedIcon,
1193
- isOpen,
1194
- description: description2,
1195
- title
1196
- }
1197
- ),
1198
- children
1199
- ] });
1200
- };
1201
- const Blocker = ({ displayedIcon, description: description2, title, isOpen }) => {
1202
- const { formatMessage } = reactIntl.useIntl();
1203
- return isOpen && globalThis?.document?.body ? reactDom.createPortal(
1204
- /* @__PURE__ */ jsxRuntime.jsxs(Overlay, { id: "autoReloadOverlayBlocker", direction: "column", alignItems: "center", gap: 6, children: [
1205
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "center", gap: 2, children: [
1206
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "h1", variant: "alpha", children: formatMessage(title) }),
1207
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "h2", textColor: "neutral600", fontSize: 4, fontWeight: "regular", children: formatMessage(description2) })
1208
- ] }),
1209
- displayedIcon === "reload" && /* @__PURE__ */ jsxRuntime.jsx(IconBox, { padding: 6, background: "primary100", borderColor: "primary200", children: /* @__PURE__ */ jsxRuntime.jsx(LoaderReload, { width: "4rem", height: "4rem" }) }),
1210
- displayedIcon === "time" && /* @__PURE__ */ jsxRuntime.jsx(IconBox, { padding: 6, background: "primary100", borderColor: "primary200", children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Clock, { width: "4rem", height: "4rem" }) }),
1211
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginTop: 2, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Link, { href: "https://docs.strapi.io", isExternal: true, children: formatMessage({
1212
- id: "global.documentation",
1213
- defaultMessage: "Read the documentation"
1214
- }) }) })
1215
- ] }),
1216
- // eslint-disable-next-line no-undef
1217
- globalThis.document.body
1218
- ) : null;
1219
- };
1220
- const rotation = styledComponents.keyframes`
1221
- from {
1222
- transform: rotate(0deg);
1223
- }
1224
- to {
1225
- transform: rotate(359deg);
1226
- }
1227
- `;
1228
- const LoaderReload = styledComponents.styled(Icons.ArrowClockwise)`
1229
- animation: ${rotation} 1s infinite linear;
1230
- `;
1231
- const Overlay = styledComponents.styled(designSystem.Flex)`
1232
- position: fixed;
1233
- top: 0;
1234
- right: 0;
1235
- bottom: 0;
1236
- left: 0;
1237
- /* TODO: set this up in the theme for consistence z-index values */
1238
- z-index: 1140;
1239
- padding-top: 16rem;
1240
-
1241
- & > * {
1242
- position: relative;
1243
- z-index: 1;
1244
- }
1245
-
1246
- &:before {
1247
- content: '';
1248
- position: fixed;
1249
- top: 0;
1250
- right: 0;
1251
- bottom: 0;
1252
- left: 0;
1253
- background: ${({ theme }) => theme.colors.neutral0};
1254
- opacity: 0.9;
1255
- }
1256
- `;
1257
- const IconBox = styledComponents.styled(designSystem.Box)`
1258
- border-radius: 50%;
1259
- display: flex;
1260
- align-items: center;
1261
- justify-content: center;
1262
- svg {
1263
- > path {
1264
- fill: ${({ theme }) => theme.colors.primary600} !important;
1265
- }
1266
- }
1267
- `;
1268
- const useAutoReloadOverlayBlocker = () => React__namespace.useContext(AutoReloadOverlayBlockerContext);
1269
- const name = pluginPkg.strapi.name;
1270
- const index = {
1271
- register(app) {
1272
- app.addReducers(reducers);
1273
- app.addMenuLink({
1274
- to: `plugins/${pluginId}`,
1275
- icon: Icons.Layout,
1276
- intlLabel: {
1277
- id: `${pluginId}.plugin.name`,
1278
- defaultMessage: "Content Types Builder"
1279
- },
1280
- permissions: PERMISSIONS.main,
1281
- Component: () => Promise.resolve().then(() => require("./index-D79WZLAU.js")).then((n) => n.index),
1282
- position: 5
1283
- });
1284
- app.registerPlugin({
1285
- id: pluginId,
1286
- name,
1287
- // Internal APIs exposed by the CTB for the other plugins to use
1288
- apis: {
1289
- forms: formsAPI
1290
- }
1291
- });
1292
- },
1293
- bootstrap() {
1294
- },
1295
- async registerTrads({ locales }) {
1296
- const importedTrads = await Promise.all(
1297
- locales.map((locale) => {
1298
- return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => Promise.resolve().then(() => require("./ar-OCxhAFUy.js")), "./translations/cs.json": () => Promise.resolve().then(() => require("./cs-Ci3js5EC.js")), "./translations/de.json": () => Promise.resolve().then(() => require("./de-DnlblIOh.js")), "./translations/dk.json": () => Promise.resolve().then(() => require("./dk-D3XnOjYz.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-CXG5y_vo.js")), "./translations/es.json": () => Promise.resolve().then(() => require("./es-DL8lez9W.js")), "./translations/fr.json": () => Promise.resolve().then(() => require("./fr-DnTxugIo.js")), "./translations/id.json": () => Promise.resolve().then(() => require("./id-DYuTgqcc.js")), "./translations/it.json": () => Promise.resolve().then(() => require("./it-DS4sM3km.js")), "./translations/ja.json": () => Promise.resolve().then(() => require("./ja-BjouJgZf.js")), "./translations/ko.json": () => Promise.resolve().then(() => require("./ko-D_71Pdfn.js")), "./translations/ms.json": () => Promise.resolve().then(() => require("./ms-Re1pSHmx.js")), "./translations/nl.json": () => Promise.resolve().then(() => require("./nl-DQjrDEw0.js")), "./translations/pl.json": () => Promise.resolve().then(() => require("./pl-BGwXgwH7.js")), "./translations/pt-BR.json": () => Promise.resolve().then(() => require("./pt-BR-DPd5nRnl.js")), "./translations/pt.json": () => Promise.resolve().then(() => require("./pt-CJoUDTHQ.js")), "./translations/ru.json": () => Promise.resolve().then(() => require("./ru-C8A_4j0w.js")), "./translations/sk.json": () => Promise.resolve().then(() => require("./sk-raWRcmPT.js")), "./translations/sv.json": () => Promise.resolve().then(() => require("./sv-BNN71SFE.js")), "./translations/th.json": () => Promise.resolve().then(() => require("./th-C83Bb_kR.js")), "./translations/tr.json": () => Promise.resolve().then(() => require("./tr-BW20CfcO.js")), "./translations/uk.json": () => Promise.resolve().then(() => require("./uk-VwB0oiuV.js")), "./translations/zh-Hans.json": () => Promise.resolve().then(() => require("./zh-Hans-CLTLm_nt.js")), "./translations/zh.json": () => Promise.resolve().then(() => require("./zh-BiOCwPJu.js")) }), `./translations/${locale}.json`, 3).then(({ default: data }) => {
1299
- return {
1300
- data: prefixPluginTranslations(data, pluginId),
1301
- locale
1302
- };
1303
- }).catch(() => {
1304
- return {
1305
- data: {},
1306
- locale
1307
- };
1308
- });
1309
- })
1310
- );
1311
- return Promise.resolve(importedTrads);
1312
- }
1313
- };
1314
- exports.ADD_ATTRIBUTE = ADD_ATTRIBUTE;
1315
- exports.ADD_CREATED_COMPONENT_TO_DYNAMIC_ZONE = ADD_CREATED_COMPONENT_TO_DYNAMIC_ZONE;
1316
- exports.ADD_CUSTOM_FIELD_ATTRIBUTE = ADD_CUSTOM_FIELD_ATTRIBUTE;
1317
- exports.AutoReloadOverlayBlockerProvider = AutoReloadOverlayBlockerProvider;
1318
- exports.CHANGE_DYNAMIC_ZONE_COMPONENTS = CHANGE_DYNAMIC_ZONE_COMPONENTS;
1319
- exports.CREATE_COMPONENT_SCHEMA = CREATE_COMPONENT_SCHEMA;
1320
- exports.CREATE_SCHEMA = CREATE_SCHEMA;
1321
- exports.DELETE_NOT_SAVED_TYPE = DELETE_NOT_SAVED_TYPE;
1322
- exports.EDIT_ATTRIBUTE = EDIT_ATTRIBUTE;
1323
- exports.EDIT_CUSTOM_FIELD_ATTRIBUTE = EDIT_CUSTOM_FIELD_ATTRIBUTE;
1324
- exports.GET_DATA_SUCCEEDED = GET_DATA_SUCCEEDED;
1325
- exports.MAX_COMPONENT_DEPTH = MAX_COMPONENT_DEPTH;
1326
- exports.ON_CHANGE = ON_CHANGE;
1327
- exports.ON_CHANGE_RELATION_TARGET = ON_CHANGE_RELATION_TARGET;
1328
- exports.ON_CHANGE_RELATION_TYPE = ON_CHANGE_RELATION_TYPE;
1329
- exports.PERMISSIONS = PERMISSIONS;
1330
- exports.RELOAD_PLUGIN = RELOAD_PLUGIN;
1331
- exports.REMOVE_COMPONENT_FROM_DYNAMIC_ZONE = REMOVE_COMPONENT_FROM_DYNAMIC_ZONE;
1332
- exports.REMOVE_FIELD = REMOVE_FIELD;
1333
- exports.REMOVE_FIELD_FROM_DISPLAYED_COMPONENT = REMOVE_FIELD_FROM_DISPLAYED_COMPONENT;
1334
- exports.RESET_PROPS = RESET_PROPS;
1335
- exports.RESET_PROPS_AND_SAVE_CURRENT_DATA = RESET_PROPS_AND_SAVE_CURRENT_DATA;
1336
- exports.RESET_PROPS_AND_SET_FORM_FOR_ADDING_AN_EXISTING_COMPO = RESET_PROPS_AND_SET_FORM_FOR_ADDING_AN_EXISTING_COMPO;
1337
- exports.RESET_PROPS_AND_SET_THE_FORM_FOR_ADDING_A_COMPO_TO_A_DZ = RESET_PROPS_AND_SET_THE_FORM_FOR_ADDING_A_COMPO_TO_A_DZ;
1338
- exports.SET_ATTRIBUTE_DATA_SCHEMA = SET_ATTRIBUTE_DATA_SCHEMA;
1339
- exports.SET_CUSTOM_FIELD_DATA_SCHEMA = SET_CUSTOM_FIELD_DATA_SCHEMA;
1340
- exports.SET_DATA_TO_EDIT = SET_DATA_TO_EDIT;
1341
- exports.SET_DYNAMIC_ZONE_DATA_SCHEMA = SET_DYNAMIC_ZONE_DATA_SCHEMA;
1342
- exports.SET_ERRORS = SET_ERRORS;
1343
- exports.SET_MODIFIED_DATA = SET_MODIFIED_DATA;
1344
- exports.UPDATE_INITIAL_STATE = UPDATE_INITIAL_STATE;
1345
- exports.UPDATE_SCHEMA = UPDATE_SCHEMA;
1346
- exports.createComponentUid = createComponentUid;
1347
- exports.createUid = createUid;
1348
- exports.getRelationType = getRelationType;
1349
- exports.index = index;
1350
- exports.initialState = initialState;
1351
- exports.initialState$1 = initialState$1;
1352
- exports.makeUnique = makeUnique;
1353
- exports.nameToSlug = nameToSlug;
1354
- exports.pluginId = pluginId;
1355
- exports.retrieveComponentsFromSchema = retrieveComponentsFromSchema;
1356
- exports.useAutoReloadOverlayBlocker = useAutoReloadOverlayBlocker;
1357
- //# sourceMappingURL=index-AjJmuxjv.js.map