@strapi/admin 4.12.0-beta.0 → 4.12.0-beta.3

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 (226) hide show
  1. package/admin/src/content-manager/components/CollectionTypeFormWrapper/index.js +1 -3
  2. package/admin/src/content-manager/components/RelationInput/components/Option.js +6 -5
  3. package/admin/src/content-manager/components/SingleTypeFormWrapper/index.js +7 -7
  4. package/admin/src/content-manager/pages/EditSettingsView/components/DisplayedFields.js +23 -21
  5. package/admin/src/content-manager/pages/EditSettingsView/components/ModalForm.js +21 -23
  6. package/admin/src/content-manager/pages/EditView/Information/index.js +1 -1
  7. package/admin/src/content-manager/pages/EditView/InformationBox/InformationBoxCE.js +1 -2
  8. package/admin/src/content-manager/pages/EditView/InformationBox/index.js +1 -3
  9. package/admin/src/content-manager/pages/EditView/index.js +14 -2
  10. package/admin/src/content-manager/pages/ListSettingsView/components/SortDisplayedFields.js +24 -22
  11. package/admin/src/content-manager/pages/ListView/components/Body/index.js +191 -0
  12. package/admin/src/content-manager/pages/ListView/components/BulkActionButtons/ConfirmBulkActionDialog/index.js +164 -0
  13. package/admin/src/content-manager/pages/ListView/components/BulkActionButtons/SelectedEntriesModal/index.js +468 -0
  14. package/admin/src/content-manager/{components/DynamicTable/BulkActionsBar → pages/ListView/components/BulkActionButtons}/index.js +56 -132
  15. package/admin/src/content-manager/pages/ListView/components/CellContent/RelationMultiple/index.js +63 -69
  16. package/admin/src/content-manager/pages/ListView/components/CellContent/RepeatableComponent/index.js +28 -21
  17. package/admin/src/content-manager/pages/ListView/index.js +191 -132
  18. package/admin/src/hooks/useSettingsMenu/index.js +35 -21
  19. package/admin/src/layouts/UnauthenticatedLayout/LocaleToggle/index.js +7 -7
  20. package/admin/src/pages/AuthPage/components/Login/index.js +3 -5
  21. package/admin/src/pages/AuthPage/constants.js +3 -2
  22. package/admin/src/pages/AuthPage/index.js +18 -1
  23. package/admin/src/pages/HomePage/index.js +19 -7
  24. package/admin/src/pages/ProfilePage/index.js +6 -11
  25. package/admin/src/pages/SettingsPage/components/SettingsNav/index.js +13 -11
  26. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/index.js +17 -1
  27. package/admin/src/pages/SettingsPage/pages/Users/EditPage/index.js +15 -2
  28. package/admin/src/pages/SettingsPage/pages/Users/ListPage/CreateAction/index.js +2 -4
  29. package/admin/src/pages/SettingsPage/pages/Users/ListPage/ModalForm/index.js +15 -1
  30. package/admin/src/pages/SettingsPage/pages/Users/ListPage/index.js +36 -5
  31. package/admin/src/pages/SettingsPage/pages/Users/components/MagicLink/index.js +3 -5
  32. package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/EventTable/index.js +1 -3
  33. package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/WebhookForm/index.js +16 -1
  34. package/admin/src/translations/ca.json +4 -4
  35. package/admin/src/translations/de.json +4 -4
  36. package/admin/src/translations/dk.json +2 -2
  37. package/admin/src/translations/en.json +23 -4
  38. package/admin/src/translations/es.json +4 -4
  39. package/admin/src/translations/eu.json +4 -4
  40. package/admin/src/translations/fr.json +2 -2
  41. package/admin/src/translations/gu.json +4 -4
  42. package/admin/src/translations/hi.json +4 -4
  43. package/admin/src/translations/hu.json +4 -4
  44. package/admin/src/translations/ja.json +2 -2
  45. package/admin/src/translations/ko.json +2 -2
  46. package/admin/src/translations/ml.json +4 -4
  47. package/admin/src/translations/nl.json +4 -4
  48. package/admin/src/translations/pl.json +4 -4
  49. package/admin/src/translations/pt-BR.json +4 -4
  50. package/admin/src/translations/ru.json +4 -4
  51. package/admin/src/translations/sa.json +4 -4
  52. package/admin/src/translations/sk.json +4 -4
  53. package/admin/src/translations/sv.json +4 -4
  54. package/admin/src/translations/tr.json +4 -4
  55. package/admin/src/translations/zh-Hans.json +4 -4
  56. package/admin/src/translations/zh.json +4 -4
  57. package/build/1049.758a01f5.chunk.js +1 -0
  58. package/build/{3528.4845cf92.chunk.js → 1386.762d6eb8.chunk.js} +1 -1
  59. package/build/1727.b49f0713.chunk.js +1 -0
  60. package/build/{5563.a146acac.chunk.js → 2225.15d1df72.chunk.js} +2 -2
  61. package/build/2379.d33a2e16.chunk.js +1 -0
  62. package/build/2395.b0419a54.chunk.js +26 -0
  63. package/build/2801.18f38baf.chunk.js +1 -0
  64. package/build/{7394.423886bd.chunk.js → 3100.21c343fa.chunk.js} +1 -1
  65. package/build/311.cb0884bb.chunk.js +1 -0
  66. package/build/3483.ddd2d6df.chunk.js +1 -0
  67. package/build/{970.89601f27.chunk.js → 3739.63e352f1.chunk.js} +52 -20
  68. package/build/3984.ea7b8036.chunk.js +1 -0
  69. package/build/4546.ff9fdf30.chunk.js +1 -0
  70. package/build/502.ccb38223.chunk.js +1 -0
  71. package/build/5483.ed2c7efa.chunk.js +6 -0
  72. package/build/{5542.c62d0daf.chunk.js → 5542.2415a393.chunk.js} +6 -6
  73. package/build/6158.c974fd83.chunk.js +1 -0
  74. package/build/6691.f880a0b6.chunk.js +105 -0
  75. package/build/7030.b98dcedf.chunk.js +1 -0
  76. package/build/7464.c6d0565c.chunk.js +1 -0
  77. package/build/8276.23e0763b.chunk.js +26 -0
  78. package/build/8298.fd253c9f.chunk.js +117 -0
  79. package/build/918.54414509.chunk.js +1 -0
  80. package/build/{9932.7e2b71de.chunk.js → 9806.91360bb6.chunk.js} +79 -79
  81. package/build/{9944.29289a16.chunk.js → 9944.7af075a5.chunk.js} +1 -1
  82. package/build/{Admin-authenticatedApp.9d3afb79.chunk.js → Admin-authenticatedApp.36b3826c.chunk.js} +5 -5
  83. package/build/Admin_InternalErrorPage.f45f2462.chunk.js +1 -0
  84. package/build/{Admin_homePage.be30ef4e.chunk.js → Admin_homePage.ac9dfb86.chunk.js} +23 -15
  85. package/build/{Admin_marketplace.74a58e20.chunk.js → Admin_marketplace.f0b87fce.chunk.js} +1 -1
  86. package/build/{Admin_pluginsPage.ce464189.chunk.js → Admin_pluginsPage.8728ff6e.chunk.js} +1 -1
  87. package/build/{Admin_profilePage.2131eb68.chunk.js → Admin_profilePage.a968035f.chunk.js} +2 -2
  88. package/build/Admin_settingsPage.8c600d1a.chunk.js +111 -0
  89. package/build/Upload_ConfigureTheView.345ac1e0.chunk.js +1 -0
  90. package/build/admin-app.1c3f7fd6.chunk.js +36 -0
  91. package/build/{admin-edit-roles-page.3fdd6b9d.chunk.js → admin-edit-roles-page.a49b9f4f.chunk.js} +4 -4
  92. package/build/admin-edit-users.67704088.chunk.js +10 -0
  93. package/build/{admin-roles-list.e17b00d7.chunk.js → admin-roles-list.0c129e98.chunk.js} +1 -1
  94. package/build/admin-users.3279ffb0.chunk.js +11 -0
  95. package/build/api-tokens-create-page.46c2ea84.chunk.js +1 -0
  96. package/build/{api-tokens-edit-page.9a1dd2fa.chunk.js → api-tokens-edit-page.58139df9.chunk.js} +1 -1
  97. package/build/{api-tokens-list-page.a103f526.chunk.js → api-tokens-list-page.505bf7e0.chunk.js} +2 -2
  98. package/build/audit-logs-settings-page.4b422831.chunk.js +1 -0
  99. package/build/{ca-json.1fed5d8b.chunk.js → ca-json.a53c10b6.chunk.js} +1 -1
  100. package/build/content-manager.b8d593d4.chunk.js +1103 -0
  101. package/build/{content-type-builder-list-view.a200a358.chunk.js → content-type-builder-list-view.bf9be456.chunk.js} +9 -9
  102. package/build/{content-type-builder-translation-ar-json.56d8fcf4.chunk.js → content-type-builder-translation-ar-json.3e808e2f.chunk.js} +1 -1
  103. package/build/{content-type-builder-translation-cs-json.a5b299ca.chunk.js → content-type-builder-translation-cs-json.1ef9e106.chunk.js} +1 -1
  104. package/build/{content-type-builder-translation-de-json.393a76c0.chunk.js → content-type-builder-translation-de-json.63fcff7b.chunk.js} +1 -1
  105. package/build/{content-type-builder-translation-dk-json.fbd39bb7.chunk.js → content-type-builder-translation-dk-json.fd626b67.chunk.js} +1 -1
  106. package/build/{content-type-builder-translation-en-json.38e20391.chunk.js → content-type-builder-translation-en-json.ed29ff4d.chunk.js} +1 -1
  107. package/build/{content-type-builder-translation-es-json.9288474b.chunk.js → content-type-builder-translation-es-json.a4a361a9.chunk.js} +1 -1
  108. package/build/{content-type-builder-translation-fr-json.d35e269c.chunk.js → content-type-builder-translation-fr-json.499c3a46.chunk.js} +1 -1
  109. package/build/{content-type-builder-translation-id-json.f0513929.chunk.js → content-type-builder-translation-id-json.65255f93.chunk.js} +1 -1
  110. package/build/{content-type-builder-translation-it-json.aaf16753.chunk.js → content-type-builder-translation-it-json.e268ab74.chunk.js} +1 -1
  111. package/build/{content-type-builder-translation-ko-json.8fe21a7f.chunk.js → content-type-builder-translation-ko-json.04cb309d.chunk.js} +1 -1
  112. package/build/{content-type-builder-translation-ms-json.3b5d2d3e.chunk.js → content-type-builder-translation-ms-json.f6b743b9.chunk.js} +1 -1
  113. package/build/{content-type-builder-translation-nl-json.225ef5d3.chunk.js → content-type-builder-translation-nl-json.997fe8cc.chunk.js} +1 -1
  114. package/build/{content-type-builder-translation-pl-json.92f36be2.chunk.js → content-type-builder-translation-pl-json.634f638b.chunk.js} +1 -1
  115. package/build/{content-type-builder-translation-pt-BR-json.3bd10f89.chunk.js → content-type-builder-translation-pt-BR-json.6a95dc71.chunk.js} +1 -1
  116. package/build/{content-type-builder-translation-ru-json.9bfe47ce.chunk.js → content-type-builder-translation-ru-json.3af65503.chunk.js} +1 -1
  117. package/build/{content-type-builder-translation-sk-json.d03cc18a.chunk.js → content-type-builder-translation-sk-json.c6078082.chunk.js} +1 -1
  118. package/build/{content-type-builder-translation-sv-json.d23dcd32.chunk.js → content-type-builder-translation-sv-json.a6df2462.chunk.js} +1 -1
  119. package/build/{content-type-builder-translation-th-json.7ad256e2.chunk.js → content-type-builder-translation-th-json.122277cc.chunk.js} +1 -1
  120. package/build/{content-type-builder-translation-tr-json.926f6191.chunk.js → content-type-builder-translation-tr-json.41f44f77.chunk.js} +1 -1
  121. package/build/{content-type-builder-translation-uk-json.7bf19546.chunk.js → content-type-builder-translation-uk-json.e1315acd.chunk.js} +1 -1
  122. package/build/{content-type-builder-translation-zh-Hans-json.415577fb.chunk.js → content-type-builder-translation-zh-Hans-json.6ff57db6.chunk.js} +1 -1
  123. package/build/{content-type-builder-translation-zh-json.ad24dbeb.chunk.js → content-type-builder-translation-zh-json.3532b962.chunk.js} +1 -1
  124. package/build/content-type-builder.40534de5.chunk.js +170 -0
  125. package/build/{de-json.fcac7381.chunk.js → de-json.b3be02c7.chunk.js} +1 -1
  126. package/build/{dk-json.e34cad0d.chunk.js → dk-json.842aa391.chunk.js} +1 -1
  127. package/build/{email-settings-page.45695daa.chunk.js → email-settings-page.d494d1eb.chunk.js} +2 -2
  128. package/build/{en-json.fb9f6ddd.chunk.js → en-json.4c733bd1.chunk.js} +1 -1
  129. package/build/{es-json.42096084.chunk.js → es-json.f57b5335.chunk.js} +1 -1
  130. package/build/{eu-json.fb17c8f9.chunk.js → eu-json.633025f0.chunk.js} +1 -1
  131. package/build/{fr-json.69789980.chunk.js → fr-json.aa8839d2.chunk.js} +1 -1
  132. package/build/{gu-json.4d667d0c.chunk.js → gu-json.5bd62812.chunk.js} +1 -1
  133. package/build/{hi-json.323be97d.chunk.js → hi-json.9104eb78.chunk.js} +1 -1
  134. package/build/{hu-json.fe71e6c8.chunk.js → hu-json.9f4aae42.chunk.js} +1 -1
  135. package/build/{i18n-settings-page.29308d0b.chunk.js → i18n-settings-page.47f78016.chunk.js} +1 -1
  136. package/build/index.html +1 -1
  137. package/build/{ja-json.81b6d1e3.chunk.js → ja-json.91286391.chunk.js} +1 -1
  138. package/build/{ko-json.4539f4ba.chunk.js → ko-json.fcf3ec4b.chunk.js} +1 -1
  139. package/build/main.a12c4c0f.js +2856 -0
  140. package/build/{ml-json.8988e374.chunk.js → ml-json.557aa14c.chunk.js} +1 -1
  141. package/build/{nl-json.98345913.chunk.js → nl-json.b2b16eea.chunk.js} +1 -1
  142. package/build/{pl-json.59a5dab3.chunk.js → pl-json.f094a417.chunk.js} +1 -1
  143. package/build/{pt-BR-json.9410688b.chunk.js → pt-BR-json.dec7fb01.chunk.js} +1 -1
  144. package/build/review-workflows-settings-create-view.dfd87e1f.chunk.js +1 -0
  145. package/build/review-workflows-settings-edit-view.53c00afe.chunk.js +1 -0
  146. package/build/review-workflows-settings-list-view.a34be805.chunk.js +56 -0
  147. package/build/{ru-json.678cd48b.chunk.js → ru-json.8193d8c4.chunk.js} +1 -1
  148. package/build/{runtime~main.5e9bf4b3.js → runtime~main.d197f488.js} +2 -2
  149. package/build/{sa-json.6359a11c.chunk.js → sa-json.a56836f1.chunk.js} +1 -1
  150. package/build/{sk-json.2374f129.chunk.js → sk-json.bf2f057a.chunk.js} +1 -1
  151. package/build/sso-settings-page.ed6f3f15.chunk.js +1 -0
  152. package/build/{sv-json.ae6e71ea.chunk.js → sv-json.fd0e86c6.chunk.js} +1 -1
  153. package/build/{tr-json.bac5dbd3.chunk.js → tr-json.56c32cf6.chunk.js} +1 -1
  154. package/build/transfer-tokens-create-page.1597e6ab.chunk.js +1 -0
  155. package/build/transfer-tokens-edit-page.8741529f.chunk.js +1 -0
  156. package/build/{transfer-tokens-list-page.7237443d.chunk.js → transfer-tokens-list-page.22147d2c.chunk.js} +2 -2
  157. package/build/upload-settings.cac210a0.chunk.js +14 -0
  158. package/build/upload.cbfeefa5.chunk.js +58 -0
  159. package/build/{users-advanced-settings-page.750b1f76.chunk.js → users-advanced-settings-page.18379a56.chunk.js} +1 -1
  160. package/build/users-email-settings-page.a87978e5.chunk.js +9 -0
  161. package/build/users-providers-settings-page.8876c1ee.chunk.js +14 -0
  162. package/build/{users-roles-settings-page.d286426a.chunk.js → users-roles-settings-page.0431f48c.chunk.js} +2 -2
  163. package/build/webhook-edit-page.a91f27a1.chunk.js +33 -0
  164. package/build/{webhook-list-page.940a40f1.chunk.js → webhook-list-page.65e1b5bb.chunk.js} +1 -1
  165. package/build/{zh-Hans-json.fada6f40.chunk.js → zh-Hans-json.36d81cdc.chunk.js} +1 -1
  166. package/build/{zh-json.3529f1e5.chunk.js → zh-json.1cc86ff0.chunk.js} +1 -1
  167. package/ee/admin/content-manager/pages/EditView/InformationBox/InformationBoxEE.js +6 -3
  168. package/ee/admin/content-manager/pages/EditView/InformationBox/index.js +1 -3
  169. package/ee/admin/content-manager/pages/ListView/ReviewWorkflowsColumn/constants.js +2 -2
  170. package/ee/admin/pages/AuthPage/components/Login/index.js +3 -5
  171. package/ee/admin/pages/HomePage/index.js +11 -0
  172. package/ee/admin/pages/SettingsPage/pages/ApplicationInfosPage/components/AdminSeatInfo/index.js +1 -3
  173. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/ProtectedPage/ProtectedPage.js +1 -1
  174. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/Stage/Stage.js +1 -1
  175. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/CreateView/CreateView.js +38 -10
  176. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/EditView/EditView.js +57 -8
  177. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/ListView/ListView.js +3 -3
  178. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/utils/{getWorkflowValidationSchema.js → validateWorkflow.js} +33 -2
  179. package/ee/admin/pages/SettingsPage/pages/Users/ListPage/CreateAction/index.js +2 -4
  180. package/ee/admin/pages/SettingsPage/pages/Users/ListPage/index.js +13 -0
  181. package/ee/admin/pages/SettingsPage/pages/Users/components/MagicLink/index.js +3 -5
  182. package/ee/admin/pages/SettingsPage/pages/Webhooks/EditView/components/EventTable/index.js +1 -3
  183. package/ee/server/constants/default-stages.json +1 -1
  184. package/ee/server/constants/workflows.js +1 -0
  185. package/ee/server/services/review-workflows/validation.js +6 -0
  186. package/ee/server/validation/review-workflows.js +6 -2
  187. package/index.js +0 -14
  188. package/package.json +12 -20
  189. package/webpack.alias.js +0 -3
  190. package/webpack.config.js +1 -75
  191. package/admin/src/content-manager/pages/ListView/components/TableRows/index.js +0 -300
  192. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/AdminSeatInfo/index.js +0 -5
  193. package/build/1386.3b2aa6a7.chunk.js +0 -3
  194. package/build/1970.39a2d75e.chunk.js +0 -1
  195. package/build/2799.cf9b491f.chunk.js +0 -1
  196. package/build/3269.1ea0f5a6.chunk.js +0 -1
  197. package/build/4485.d3c6dd1d.chunk.js +0 -6
  198. package/build/539.865446c0.chunk.js +0 -1
  199. package/build/6691.e6d5ac38.chunk.js +0 -105
  200. package/build/7018.f3dad3c1.chunk.js +0 -1
  201. package/build/7259.0e25ab5d.chunk.js +0 -1
  202. package/build/9465.d8fc1377.chunk.js +0 -112
  203. package/build/Admin_InternalErrorPage.8911cb49.chunk.js +0 -1
  204. package/build/Admin_settingsPage.074655f6.chunk.js +0 -79
  205. package/build/Upload_ConfigureTheView.7a1cb9c9.chunk.js +0 -1
  206. package/build/admin-app.3ede71ad.chunk.js +0 -61
  207. package/build/admin-edit-users.78552758.chunk.js +0 -10
  208. package/build/admin-users.c23322fc.chunk.js +0 -11
  209. package/build/api-tokens-create-page.3dd4e921.chunk.js +0 -1
  210. package/build/audit-logs-settings-page.37fe915c.chunk.js +0 -1
  211. package/build/content-manager.08541eeb.chunk.js +0 -1094
  212. package/build/content-type-builder.de22f7c9.chunk.js +0 -166
  213. package/build/main.a8ede50d.js +0 -2927
  214. package/build/review-workflows-settings-create-view.56f61e18.chunk.js +0 -1
  215. package/build/review-workflows-settings-edit-view.912bc9c0.chunk.js +0 -1
  216. package/build/review-workflows-settings-list-view.cf6a08d3.chunk.js +0 -56
  217. package/build/sso-settings-page.0cdb96a6.chunk.js +0 -1
  218. package/build/transfer-tokens-create-page.de14cad4.chunk.js +0 -1
  219. package/build/transfer-tokens-edit-page.4f5e39af.chunk.js +0 -1
  220. package/build/upload-settings.cb6c14c3.chunk.js +0 -14
  221. package/build/upload.7e629643.chunk.js +0 -26
  222. package/build/users-email-settings-page.e9bcd865.chunk.js +0 -9
  223. package/build/users-providers-settings-page.a94253e9.chunk.js +0 -14
  224. package/build/webhook-edit-page.77ef4f1a.chunk.js +0 -33
  225. /package/admin/src/content-manager/components/{DynamicTable → ListViewTable}/CellContent/PublicationState/PublicationState.js +0 -0
  226. /package/admin/src/content-manager/components/{DynamicTable → ListViewTable}/CellContent/PublicationState/index.js +0 -0
@@ -4,6 +4,7 @@ import { Button, Flex, Loader } from '@strapi/design-system';
4
4
  import { useAPIErrorHandler, useFetchClient, useNotification } from '@strapi/helper-plugin';
5
5
  import { Check } from '@strapi/icons';
6
6
  import { useFormik, Form, FormikProvider } from 'formik';
7
+ import set from 'lodash/set';
7
8
  import { useIntl } from 'react-intl';
8
9
  import { useMutation } from 'react-query';
9
10
  import { useDispatch, useSelector } from 'react-redux';
@@ -20,7 +21,7 @@ import { WorkflowAttributes } from '../../components/WorkflowAttributes';
20
21
  import { REDUX_NAMESPACE } from '../../constants';
21
22
  import { useReviewWorkflows } from '../../hooks/useReviewWorkflows';
22
23
  import { reducer, initialState } from '../../reducer';
23
- import { getWorkflowValidationSchema } from '../../utils/getWorkflowValidationSchema';
24
+ import { validateWorkflow } from '../../utils/validateWorkflow';
24
25
 
25
26
  export function ReviewWorkflowsCreateView() {
26
27
  const { formatMessage } = useIntl();
@@ -38,6 +39,7 @@ export function ReviewWorkflowsCreateView() {
38
39
  const [showLimitModal, setShowLimitModal] = React.useState(false);
39
40
  const { isLoading: isLicenseLoading, getFeature } = useLicenseLimits();
40
41
  const { meta, isLoading: isWorkflowLoading } = useReviewWorkflows();
42
+ const [initialErrors, setInitialErrors] = React.useState(null);
41
43
 
42
44
  const { mutateAsync, isLoading } = useMutation(
43
45
  async ({ workflow }) => {
@@ -70,10 +72,33 @@ export function ReviewWorkflowsCreateView() {
70
72
 
71
73
  return workflow;
72
74
  } catch (error) {
73
- toggleNotification({
74
- type: 'warning',
75
- message: formatAPIError(error),
76
- });
75
+ // TODO: the current implementation of `formatAPIError` prints all error messages of all details,
76
+ // which get's hairy when we have duplicated-name errors, because the same error message is printed
77
+ // several times. What we want instead in these scenarios is to print only the error summary and
78
+ // display the individual error messages for each field. This is a workaround, until we change the
79
+ // implementation of `formatAPIError`.
80
+ if (
81
+ error.response.data?.error?.name === 'ValidationError' &&
82
+ error.response.data?.error?.details?.errors?.length > 0
83
+ ) {
84
+ toggleNotification({
85
+ type: 'warning',
86
+ message: error.response.data.error.message,
87
+ });
88
+
89
+ setInitialErrors(
90
+ error.response.data?.error?.details?.errors.reduce((acc, error) => {
91
+ set(acc, error.path, error.message);
92
+
93
+ return acc;
94
+ }, {})
95
+ );
96
+ } else {
97
+ toggleNotification({
98
+ type: 'warning',
99
+ message: formatAPIError(error),
100
+ });
101
+ }
77
102
 
78
103
  return null;
79
104
  }
@@ -83,6 +108,7 @@ export function ReviewWorkflowsCreateView() {
83
108
 
84
109
  const formik = useFormik({
85
110
  enableReinitialize: true,
111
+ initialErrors,
86
112
  initialValues: currentWorkflow,
87
113
  async onSubmit() {
88
114
  /**
@@ -91,7 +117,7 @@ export function ReviewWorkflowsCreateView() {
91
117
  * update, because it would throw an API error.
92
118
  */
93
119
 
94
- if (limits?.workflows && meta?.workflowCount >= limits.workflows) {
120
+ if (limits?.workflows && meta?.workflowCount >= parseInt(limits.workflows, 10)) {
95
121
  setShowLimitModal('workflow');
96
122
 
97
123
  /**
@@ -101,14 +127,16 @@ export function ReviewWorkflowsCreateView() {
101
127
  */
102
128
  } else if (
103
129
  limits?.stagesPerWorkflow &&
104
- currentWorkflow.stages.length >= limits.stagesPerWorkflow
130
+ currentWorkflow.stages.length >= parseInt(limits.stagesPerWorkflow, 10)
105
131
  ) {
106
132
  setShowLimitModal('stage');
107
133
  } else {
108
134
  submitForm();
109
135
  }
110
136
  },
111
- validationSchema: getWorkflowValidationSchema({ formatMessage }),
137
+ validate(values) {
138
+ return validateWorkflow({ values, formatMessage });
139
+ },
112
140
  });
113
141
 
114
142
  useInjectReducer(REDUX_NAMESPACE, reducer);
@@ -132,11 +160,11 @@ export function ReviewWorkflowsCreateView() {
132
160
 
133
161
  React.useEffect(() => {
134
162
  if (!isWorkflowLoading && !isLicenseLoading) {
135
- if (limits.workflows && meta?.workflowsTotal >= limits.workflows) {
163
+ if (limits.workflows && meta?.workflowsTotal >= parseInt(limits.workflows, 10)) {
136
164
  setShowLimitModal('workflow');
137
165
  } else if (
138
166
  limits.stagesPerWorkflow &&
139
- currentWorkflow.stages.length >= limits.stagesPerWorkflow
167
+ currentWorkflow.stages.length >= parseInt(limits.stagesPerWorkflow, 10)
140
168
  ) {
141
169
  setShowLimitModal('stage');
142
170
  }
@@ -9,6 +9,7 @@ import {
9
9
  } from '@strapi/helper-plugin';
10
10
  import { Check } from '@strapi/icons';
11
11
  import { useFormik, Form, FormikProvider } from 'formik';
12
+ import set from 'lodash/set';
12
13
  import { useIntl } from 'react-intl';
13
14
  import { useMutation } from 'react-query';
14
15
  import { useSelector, useDispatch } from 'react-redux';
@@ -25,7 +26,7 @@ import { WorkflowAttributes } from '../../components/WorkflowAttributes';
25
26
  import { REDUX_NAMESPACE } from '../../constants';
26
27
  import { useReviewWorkflows } from '../../hooks/useReviewWorkflows';
27
28
  import { reducer, initialState } from '../../reducer';
28
- import { getWorkflowValidationSchema } from '../../utils/getWorkflowValidationSchema';
29
+ import { validateWorkflow } from '../../utils/validateWorkflow';
29
30
 
30
31
  export function ReviewWorkflowsEditView() {
31
32
  const { workflowId } = useParams();
@@ -55,6 +56,7 @@ export function ReviewWorkflowsEditView() {
55
56
  const [isConfirmDeleteDialogOpen, setIsConfirmDeleteDialogOpen] = React.useState(false);
56
57
  const { getFeature, isLoading: isLicenseLoading } = useLicenseLimits();
57
58
  const [showLimitModal, setShowLimitModal] = React.useState(false);
59
+ const [initialErrors, setInitialErrors] = React.useState(null);
58
60
 
59
61
  const { mutateAsync, isLoading } = useMutation(
60
62
  async ({ workflow }) => {
@@ -77,15 +79,41 @@ export function ReviewWorkflowsEditView() {
77
79
  );
78
80
 
79
81
  const updateWorkflow = async (workflow) => {
82
+ // reset the error messages
83
+ setInitialErrors(null);
84
+
80
85
  try {
81
86
  const res = await mutateAsync({ workflow });
82
87
 
83
88
  return res;
84
89
  } catch (error) {
85
- toggleNotification({
86
- type: 'warning',
87
- message: formatAPIError(error),
88
- });
90
+ // TODO: the current implementation of `formatAPIError` prints all error messages of all details,
91
+ // which get's hairy when we have duplicated-name errors, because the same error message is printed
92
+ // several times. What we want instead in these scenarios is to print only the error summary and
93
+ // display the individual error messages for each field. This is a workaround, until we change the
94
+ // implementation of `formatAPIError`.
95
+ if (
96
+ error.response.data?.error?.name === 'ValidationError' &&
97
+ error.response.data?.error?.details?.errors?.length > 0
98
+ ) {
99
+ toggleNotification({
100
+ type: 'warning',
101
+ message: error.response.data.error.message,
102
+ });
103
+
104
+ setInitialErrors(
105
+ error.response.data?.error?.details?.errors.reduce((acc, error) => {
106
+ set(acc, error.path, error.message);
107
+
108
+ return acc;
109
+ }, {})
110
+ );
111
+ } else {
112
+ toggleNotification({
113
+ type: 'warning',
114
+ message: formatAPIError(error),
115
+ });
116
+ }
89
117
 
90
118
  return null;
91
119
  }
@@ -108,15 +136,36 @@ export function ReviewWorkflowsEditView() {
108
136
 
109
137
  const formik = useFormik({
110
138
  enableReinitialize: true,
139
+ initialErrors,
111
140
  initialValues: currentWorkflow,
112
141
  async onSubmit() {
113
142
  if (currentWorkflowHasDeletedServerStages) {
114
143
  setIsConfirmDeleteDialogOpen(true);
144
+ } else if (limits?.workflows && meta?.workflowCount > parseInt(limits.workflows, 10)) {
145
+ /**
146
+ * If the current license has a limit, check if the total count of workflows
147
+ * exceeds that limit and display the limits modal instead of sending the
148
+ * update, because it would throw an API error.
149
+ */
150
+ setShowLimitModal('workflow');
151
+
152
+ /**
153
+ * If the current license has a limit, check if the total count of stages
154
+ * exceeds that limit and display the limits modal instead of sending the
155
+ * update, because it would throw an API error.
156
+ */
157
+ } else if (
158
+ limits?.stagesPerWorkflow &&
159
+ currentWorkflow.stages.length > parseInt(limits.stagesPerWorkflow, 10)
160
+ ) {
161
+ setShowLimitModal('stage');
115
162
  } else {
116
163
  submitForm();
117
164
  }
118
165
  },
119
- validationSchema: getWorkflowValidationSchema({ formatMessage }),
166
+ validate(values) {
167
+ return validateWorkflow({ values, formatMessage });
168
+ },
120
169
  });
121
170
 
122
171
  useInjectReducer(REDUX_NAMESPACE, reducer);
@@ -142,11 +191,11 @@ export function ReviewWorkflowsEditView() {
142
191
 
143
192
  React.useEffect(() => {
144
193
  if (!isWorkflowLoading && !isLicenseLoading) {
145
- if (limits?.workflows && meta?.workflowCount >= limits.workflows) {
194
+ if (limits?.workflows && meta?.workflowCount > parseInt(limits.workflows, 10)) {
146
195
  setShowLimitModal('workflow');
147
196
  } else if (
148
197
  limits?.stagesPerWorkflow &&
149
- currentWorkflow.stages.length >= limits.stagesPerWorkflow
198
+ currentWorkflow.stages.length > parseInt(limits.stagesPerWorkflow, 10)
150
199
  ) {
151
200
  setShowLimitModal('stage');
152
201
  }
@@ -148,7 +148,7 @@ export function ReviewWorkflowsListView() {
148
148
 
149
149
  React.useEffect(() => {
150
150
  if (!isLoading && !isLicenseLoading) {
151
- if (limits?.workflows && meta?.workflowCount >= limits.workflows) {
151
+ if (limits?.workflows && meta?.workflowCount >= parseInt(limits.workflows, 10)) {
152
152
  setShowLimitModal(true);
153
153
  }
154
154
  }
@@ -180,7 +180,7 @@ export function ReviewWorkflowsListView() {
180
180
  * current hard-limit of 200 they will see an error thrown by the API.
181
181
  */
182
182
 
183
- if (limits?.workflows && meta?.workflowCount >= limits.workflows) {
183
+ if (limits?.workflows && meta?.workflowCount >= parseInt(limits.workflows, 10)) {
184
184
  event.preventDefault();
185
185
  setShowLimitModal(true);
186
186
  } else {
@@ -230,7 +230,7 @@ export function ReviewWorkflowsListView() {
230
230
  * current hard-limit of 200 they will see an error thrown by the API.
231
231
  */
232
232
 
233
- if (limits?.workflows && meta?.workflowCount >= limits.workflows) {
233
+ if (limits?.workflows && meta?.workflowCount >= parseInt(limits.workflows, 10)) {
234
234
  setShowLimitModal(true);
235
235
  } else {
236
236
  push('/settings/review-workflows/create');
@@ -1,7 +1,8 @@
1
+ import set from 'lodash/set';
1
2
  import * as yup from 'yup';
2
3
 
3
- export function getWorkflowValidationSchema({ formatMessage }) {
4
- return yup.object({
4
+ export async function validateWorkflow({ values, formatMessage }) {
5
+ const schema = yup.object({
5
6
  contentTypes: yup.array().of(yup.string()),
6
7
  name: yup
7
8
  .string()
@@ -32,6 +33,20 @@ export function getWorkflowValidationSchema({ formatMessage }) {
32
33
  id: 'Settings.review-workflows.validation.stage.max-length',
33
34
  defaultMessage: 'Name can not be longer than 255 characters',
34
35
  })
36
+ )
37
+ .test(
38
+ 'unique-name',
39
+ formatMessage({
40
+ id: 'Settings.review-workflows.validation.stage.duplicate',
41
+ defaultMessage: 'Stage name must be unique',
42
+ }),
43
+ function (stageName) {
44
+ const {
45
+ options: { context },
46
+ } = this;
47
+
48
+ return context.stages.filter((stage) => stage.name === stageName).length === 1;
49
+ }
35
50
  ),
36
51
  color: yup
37
52
  .string()
@@ -46,4 +61,20 @@ export function getWorkflowValidationSchema({ formatMessage }) {
46
61
  )
47
62
  .min(1),
48
63
  });
64
+
65
+ try {
66
+ await schema.validate(values, { abortEarly: false, context: values });
67
+
68
+ return true;
69
+ } catch (error) {
70
+ let errors = {};
71
+
72
+ if (error instanceof yup.ValidationError) {
73
+ error.inner.forEach((error) => {
74
+ set(errors, error.path, error.message);
75
+ });
76
+ }
77
+
78
+ return errors;
79
+ }
49
80
  }
@@ -8,7 +8,7 @@ import { useIntl } from 'react-intl';
8
8
 
9
9
  import { useLicenseLimits } from '../../../../../../hooks';
10
10
 
11
- const CreateAction = ({ onClick }) => {
11
+ export const CreateActionEE = ({ onClick }) => {
12
12
  const { formatMessage } = useIntl();
13
13
  const {
14
14
  license: { permittedSeats, shouldStopCreate },
@@ -54,8 +54,6 @@ const CreateAction = ({ onClick }) => {
54
54
  );
55
55
  };
56
56
 
57
- CreateAction.propTypes = {
57
+ CreateActionEE.propTypes = {
58
58
  onClick: PropTypes.func.isRequired,
59
59
  };
60
-
61
- export default CreateAction;
@@ -0,0 +1,13 @@
1
+ import * as React from 'react';
2
+
3
+ // eslint-disable-next-line import/no-cycle
4
+ import { UserListPageCE } from '../../../../../../../admin/src/pages/SettingsPage/pages/Users/ListPage';
5
+ import { useLicenseLimitNotification } from '../../../../../hooks';
6
+
7
+ function UserListPageEE() {
8
+ useLicenseLimitNotification();
9
+
10
+ return <UserListPageCE />;
11
+ }
12
+
13
+ export { UserListPageEE };
@@ -7,7 +7,7 @@ import basename from '../../../../../../../../admin/src/core/utils/basename';
7
7
  import MagicLinkWrapper from '../../../../../../../../admin/src/pages/SettingsPage/pages/Users/components/MagicLink/MagicLinkWrapper';
8
8
 
9
9
  // FIXME replace with parts compo when ready
10
- const MagicLink = ({ registrationToken }) => {
10
+ export const MagicLinkEE = ({ registrationToken }) => {
11
11
  const { formatMessage } = useIntl();
12
12
 
13
13
  if (registrationToken) {
@@ -34,12 +34,10 @@ const MagicLink = ({ registrationToken }) => {
34
34
  );
35
35
  };
36
36
 
37
- MagicLink.defaultProps = {
37
+ MagicLinkEE.defaultProps = {
38
38
  registrationToken: '',
39
39
  };
40
40
 
41
- MagicLink.propTypes = {
41
+ MagicLinkEE.propTypes = {
42
42
  registrationToken: PropTypes.string,
43
43
  };
44
-
45
- export default MagicLink;
@@ -1,3 +1 @@
1
- import { EventTableEE } from './EventTableEE';
2
-
3
- export default EventTableEE;
1
+ export * from './EventTableEE';
@@ -9,7 +9,7 @@
9
9
  },
10
10
  {
11
11
  "name": "In progress",
12
- "color": "#FF4945"
12
+ "color": "#EE5E52"
13
13
  },
14
14
  {
15
15
  "name": "Reviewed",
@@ -14,5 +14,6 @@ module.exports = {
14
14
  'You’ve reached the limit of workflows in your plan. Delete a workflow or contact Sales to enable more workflows.',
15
15
  STAGES_LIMIT:
16
16
  'You’ve reached the limit of stages for this workflow in your plan. Try deleting some stages or contact Sales to enable more stages.',
17
+ DUPLICATED_STAGE_NAME: 'Stage names must be unique.',
17
18
  },
18
19
  };
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
 
3
+ const { uniq } = require('lodash/fp');
3
4
  const { ValidationError } = require('@strapi/utils').errors;
4
5
  const { getService } = require('../../utils');
5
6
  const { ERRORS, MAX_WORKFLOWS, MAX_STAGES_PER_WORKFLOW } = require('../../constants/workflows');
@@ -32,6 +33,11 @@ module.exports = ({ strapi }) => {
32
33
  if (stages.length > this.limits.stagesPerWorkflow) {
33
34
  throw new ValidationError(ERRORS.STAGES_LIMIT);
34
35
  }
36
+ // Validate stage names are not duplicated
37
+ const stageNames = stages.map((stage) => stage.name);
38
+ if (uniq(stageNames).length !== stageNames.length) {
39
+ throw new ValidationError(ERRORS.DUPLICATED_STAGE_NAME);
40
+ }
35
41
  },
36
42
 
37
43
  async validateWorkflowCountStages(workflowId, countAddedStages = 0) {
@@ -1,5 +1,7 @@
1
1
  'use strict';
2
2
 
3
+ /* eslint-disable func-names */
4
+
3
5
  const { yup, validateYupSchema } = require('@strapi/utils');
4
6
  const { hasStageAttribute } = require('../utils/review-workflows');
5
7
 
@@ -42,10 +44,11 @@ const validateContentTypes = yup.array().of(
42
44
  );
43
45
 
44
46
  const validateWorkflowCreateSchema = yup.object().shape({
45
- name: yup.string().max(255).required(),
47
+ name: yup.string().max(255).min(1, 'Workflow name can not be empty').required(),
46
48
  stages: yup
47
49
  .array()
48
50
  .of(stageObject)
51
+ .uniqueProperty('name', 'Stage name must be unique')
49
52
  .min(1, 'Can not create a workflow without stages')
50
53
  .max(200, 'Can not have more than 200 stages')
51
54
  .required('Can not create a workflow without stages'),
@@ -53,10 +56,11 @@ const validateWorkflowCreateSchema = yup.object().shape({
53
56
  });
54
57
 
55
58
  const validateWorkflowUpdateSchema = yup.object().shape({
56
- name: yup.string().max(255),
59
+ name: yup.string().max(255).min(1, 'Workflow name can not be empty'),
57
60
  stages: yup
58
61
  .array()
59
62
  .of(stageObject)
63
+ .uniqueProperty('name', 'Stage name must be unique')
60
64
  .min(1, 'Can not update a workflow without stages')
61
65
  .max(200, 'Can not have more than 200 stages'),
62
66
  contentTypes: validateContentTypes,
package/index.js CHANGED
@@ -30,12 +30,6 @@ async function build({ appDir, buildDestDir, env, forceBuild, optimize, options,
30
30
  const entry = path.resolve(cacheDir, 'admin', 'src');
31
31
  const dest = path.resolve(buildDestDir, 'build');
32
32
 
33
- // Roots for the @strapi/babel-plugin-switch-ee-ce
34
- const roots = {
35
- eeRoot: path.resolve(cacheDir, 'ee', 'admin'),
36
- ceRoot: path.resolve(cacheDir, 'admin', 'src'),
37
- };
38
-
39
33
  const pluginsPath = Object.keys(plugins).map((pluginName) => plugins[pluginName].pathToPlugin);
40
34
 
41
35
  // Either use the tsconfig file from the generated app or the one inside the .cache folder
@@ -53,7 +47,6 @@ async function build({ appDir, buildDestDir, env, forceBuild, optimize, options,
53
47
  optimize,
54
48
  options,
55
49
  pluginsPath,
56
- roots,
57
50
  tsConfigFilePath,
58
51
  });
59
52
 
@@ -105,12 +98,6 @@ async function watchAdmin({ appDir, browser, buildDestDir, host, options, plugin
105
98
  const dest = path.join(buildDestDir, 'build');
106
99
  const env = 'development';
107
100
 
108
- // Roots for the @strapi/babel-plugin-switch-ee-ce
109
- const roots = {
110
- eeRoot: path.resolve(cacheDir, 'ee', 'admin'),
111
- ceRoot: path.resolve(cacheDir, 'admin', 'src'),
112
- };
113
-
114
101
  const pluginsPath = Object.keys(plugins).map((pluginName) => plugins[pluginName].pathToPlugin);
115
102
 
116
103
  // Either use the tsconfig file from the generated app or the one inside the .cache folder
@@ -127,7 +114,6 @@ async function watchAdmin({ appDir, browser, buildDestDir, host, options, plugin
127
114
  env,
128
115
  options,
129
116
  pluginsPath,
130
- roots,
131
117
  devServer: {
132
118
  port,
133
119
  client: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/admin",
3
- "version": "4.12.0-beta.0",
3
+ "version": "4.12.0-beta.3",
4
4
  "description": "Strapi Admin",
5
5
  "repository": {
6
6
  "type": "git",
@@ -40,25 +40,17 @@
40
40
  "lint": "run -T eslint ."
41
41
  },
42
42
  "dependencies": {
43
- "@babel/core": "^7.20.12",
44
- "@babel/plugin-transform-runtime": "^7.19.6",
45
- "@babel/preset-env": "^7.20.2",
46
- "@babel/preset-react": "^7.18.6",
47
- "@babel/runtime": "^7.20.13",
48
43
  "@casl/ability": "^5.4.3",
49
44
  "@pmmmwh/react-refresh-webpack-plugin": "0.5.10",
50
- "@strapi/babel-plugin-switch-ee-ce": "4.12.0-beta.0",
51
- "@strapi/data-transfer": "4.12.0-beta.0",
52
- "@strapi/design-system": "1.8.1",
53
- "@strapi/helper-plugin": "4.12.0-beta.0",
54
- "@strapi/icons": "1.8.1",
55
- "@strapi/permissions": "4.12.0-beta.0",
56
- "@strapi/provider-audit-logs-local": "4.12.0-beta.0",
57
- "@strapi/typescript-utils": "4.12.0-beta.0",
58
- "@strapi/utils": "4.12.0-beta.0",
45
+ "@strapi/data-transfer": "4.12.0-beta.3",
46
+ "@strapi/design-system": "1.8.2",
47
+ "@strapi/helper-plugin": "4.12.0-beta.3",
48
+ "@strapi/icons": "1.8.2",
49
+ "@strapi/permissions": "4.12.0-beta.3",
50
+ "@strapi/provider-audit-logs-local": "4.12.0-beta.3",
51
+ "@strapi/typescript-utils": "4.12.0-beta.3",
52
+ "@strapi/utils": "4.12.0-beta.3",
59
53
  "axios": "1.4.0",
60
- "babel-loader": "^9.1.2",
61
- "babel-plugin-styled-components": "2.1.1",
62
54
  "bcryptjs": "2.4.3",
63
55
  "browserslist": "^4.17.3",
64
56
  "browserslist-to-esbuild": "1.2.0",
@@ -116,7 +108,7 @@
116
108
  "react-intl": "6.4.1",
117
109
  "react-is": "^18.2.0",
118
110
  "react-query": "3.39.3",
119
- "react-redux": "8.0.5",
111
+ "react-redux": "8.1.1",
120
112
  "react-refresh": "0.14.0",
121
113
  "react-router-dom": "5.3.4",
122
114
  "react-select": "5.7.0",
@@ -125,7 +117,7 @@
125
117
  "reselect": "^4.1.7",
126
118
  "rimraf": "3.0.2",
127
119
  "sanitize-html": "2.10.0",
128
- "semver": "7.5.1",
120
+ "semver": "7.5.2",
129
121
  "sift": "16.0.1",
130
122
  "style-loader": "3.3.1",
131
123
  "styled-components": "5.3.3",
@@ -162,5 +154,5 @@
162
154
  }
163
155
  }
164
156
  },
165
- "gitHead": "b965b428a445bdbc81fb4b70120237f2d48e7647"
157
+ "gitHead": "e8f4408751727a0104775a23cfa96d4741b1f21b"
166
158
  }
package/webpack.alias.js CHANGED
@@ -1,6 +1,5 @@
1
1
  'use strict';
2
2
 
3
- const path = require('path');
4
3
  const findRoot = require('find-root');
5
4
 
6
5
  const aliasExactMatch = [
@@ -38,6 +37,4 @@ module.exports = {
38
37
  acc[`${moduleName}$`] = findRoot(require.resolve(moduleName));
39
38
  return acc;
40
39
  }, {}),
41
-
42
- ee_else_ce: path.resolve(__dirname),
43
40
  };
package/webpack.config.js CHANGED
@@ -1,7 +1,6 @@
1
1
  'use strict';
2
2
 
3
3
  const path = require('path');
4
- const fse = require('fs-extra');
5
4
  const webpack = require('webpack');
6
5
  const MiniCssExtractPlugin = require('mini-css-extract-plugin');
7
6
  const ForkTsCheckerPlugin = require('fork-ts-checker-webpack-plugin');
@@ -16,8 +15,6 @@ const alias = require('./webpack.alias');
16
15
  const getClientEnvironment = require('./env');
17
16
  const createPluginsExcludePath = require('./utils/create-plugins-exclude-path');
18
17
 
19
- const EE_REGEX = /from.* ['"]ee_else_ce\//;
20
-
21
18
  module.exports = ({
22
19
  cacheDir,
23
20
  dest,
@@ -30,10 +27,6 @@ module.exports = ({
30
27
  adminPath: '/admin/',
31
28
  features: [],
32
29
  },
33
- roots = {
34
- eeRoot: './ee/admin',
35
- ceRoot: './admin/src',
36
- },
37
30
  tsConfigFilePath,
38
31
  }) => {
39
32
  const isProduction = env === 'production';
@@ -99,74 +92,7 @@ module.exports = ({
99
92
  },
100
93
  {
101
94
  test: /\.m?jsx?$/,
102
- include: cacheDir,
103
- oneOf: [
104
- // Use babel-loader for files that distinct the ee and ce code
105
- // These files have an import Something from 'ee_else_ce/
106
- {
107
- test(filePath) {
108
- if (!filePath) {
109
- return false;
110
- }
111
-
112
- try {
113
- const fileContent = fse.readFileSync(filePath).toString();
114
-
115
- if (fileContent.match(/from.* ['"]ee_else_ce\//)) {
116
- return true;
117
- }
118
-
119
- return EE_REGEX.test(fileContent);
120
- } catch (e) {
121
- return false;
122
- }
123
- },
124
- use: {
125
- loader: require.resolve('babel-loader'),
126
- options: {
127
- cacheDirectory: true,
128
- cacheCompression: isProduction,
129
- compact: isProduction,
130
- presets: [
131
- require.resolve('@babel/preset-env'),
132
- require.resolve('@babel/preset-react'),
133
- ],
134
- plugins: [
135
- [
136
- require.resolve('@strapi/babel-plugin-switch-ee-ce'),
137
- {
138
- // Imported this tells the custom plugin where to look for the ee folder
139
- roots,
140
- },
141
- ],
142
-
143
- [
144
- require.resolve('@babel/plugin-transform-runtime'),
145
- {
146
- helpers: true,
147
- regenerator: true,
148
- },
149
- ],
150
- [require.resolve('babel-plugin-styled-components'), { pure: true }],
151
- ],
152
- },
153
- },
154
- },
155
- // Use esbuild-loader for the other files
156
- {
157
- use: {
158
- loader: require.resolve('esbuild-loader'),
159
- options: {
160
- loader: 'jsx',
161
- target: buildTarget,
162
- },
163
- },
164
- },
165
- ],
166
- },
167
- {
168
- test: /\.m?jsx?$/,
169
- include: pluginsPath,
95
+ include: [cacheDir, ...pluginsPath],
170
96
  use: {
171
97
  loader: require.resolve('esbuild-loader'),
172
98
  options: {