@akemona-org/strapi-admin 3.7.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 (616) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +41 -0
  3. package/admin/src/app.js +242 -0
  4. package/admin/src/assets/icons/icon_auth-permissions.svg +1 -0
  5. package/admin/src/assets/icons/icon_content-manager.svg +1 -0
  6. package/admin/src/assets/icons/icon_content-type-builder.svg +1 -0
  7. package/admin/src/assets/icons/icon_settings-manager.svg +1 -0
  8. package/admin/src/assets/icons/icon_success.svg +19 -0
  9. package/admin/src/assets/images/background_empty.svg +1 -0
  10. package/admin/src/assets/images/background_welcome_homepage.png +0 -0
  11. package/admin/src/assets/images/banner_strapi-rocket.png +0 -0
  12. package/admin/src/assets/images/banner_t-shirt.png +0 -0
  13. package/admin/src/assets/images/bg_hp_tee_shirt.png +0 -0
  14. package/admin/src/assets/images/logo-strapi.png +0 -0
  15. package/admin/src/assets/images/logo-t-shirt.svg +1 -0
  16. package/admin/src/assets/images/logo_github.png +0 -0
  17. package/admin/src/assets/images/logo_slack.png +0 -0
  18. package/admin/src/assets/images/logo_stack_overflow.png +0 -0
  19. package/admin/src/assets/images/logo_strapi.png +0 -0
  20. package/admin/src/assets/images/oops.png +0 -0
  21. package/admin/src/assets/images/social_discord.png +0 -0
  22. package/admin/src/assets/images/social_gh.png +0 -0
  23. package/admin/src/assets/images/social_reddit.png +0 -0
  24. package/admin/src/assets/images/social_strapi.png +0 -0
  25. package/admin/src/assets/images/social_twitter.png +0 -0
  26. package/admin/src/components/BaselineAlignement/index.js +33 -0
  27. package/admin/src/components/Bloc/index.js +9 -0
  28. package/admin/src/components/ContainerFluid/index.js +13 -0
  29. package/admin/src/components/Fonts/index.js +76 -0
  30. package/admin/src/components/FormBloc/index.js +60 -0
  31. package/admin/src/components/FullWidthButton/index.js +15 -0
  32. package/admin/src/components/GlobalStyle/index.js +175 -0
  33. package/admin/src/components/Header/index.js +40 -0
  34. package/admin/src/components/HeaderSearch/HeaderSearch.js +8 -0
  35. package/admin/src/components/HeaderSearch/index.js +99 -0
  36. package/admin/src/components/IntlInput/index.js +38 -0
  37. package/admin/src/components/LeftMenu/LeftMenuFooter/Wrapper.js +51 -0
  38. package/admin/src/components/LeftMenu/LeftMenuFooter/index.js +44 -0
  39. package/admin/src/components/LeftMenu/LeftMenuHeader/Wrapper.js +50 -0
  40. package/admin/src/components/LeftMenu/LeftMenuHeader/index.js +14 -0
  41. package/admin/src/components/LeftMenu/LeftMenuLink/A.js +39 -0
  42. package/admin/src/components/LeftMenu/LeftMenuLink/LeftMenuIcon.js +23 -0
  43. package/admin/src/components/LeftMenu/LeftMenuLink/LeftMenuLinkContent.js +97 -0
  44. package/admin/src/components/LeftMenu/LeftMenuLink/NotificationCount.js +32 -0
  45. package/admin/src/components/LeftMenu/LeftMenuLink/index.js +41 -0
  46. package/admin/src/components/LeftMenu/LeftMenuLinkHeader/Search.js +11 -0
  47. package/admin/src/components/LeftMenu/LeftMenuLinkHeader/SearchButton.js +11 -0
  48. package/admin/src/components/LeftMenu/LeftMenuLinkHeader/SearchWrapper.js +11 -0
  49. package/admin/src/components/LeftMenu/LeftMenuLinkHeader/Title.js +30 -0
  50. package/admin/src/components/LeftMenu/LeftMenuLinkHeader/index.js +81 -0
  51. package/admin/src/components/LeftMenu/LeftMenuLinkHeader/messages.json +38 -0
  52. package/admin/src/components/LeftMenu/LeftMenuLinkSection/EmptyLinksList.js +21 -0
  53. package/admin/src/components/LeftMenu/LeftMenuLinkSection/EmptyLinksListWrapper.js +9 -0
  54. package/admin/src/components/LeftMenu/LeftMenuLinkSection/LeftMenuListLink.js +10 -0
  55. package/admin/src/components/LeftMenu/LeftMenuLinkSection/index.js +84 -0
  56. package/admin/src/components/LeftMenu/LinksContainer/index.js +31 -0
  57. package/admin/src/components/LeftMenu/index.js +4 -0
  58. package/admin/src/components/NavTopRightWrapper/index.js +11 -0
  59. package/admin/src/components/Notifications/Notification/Li.js +168 -0
  60. package/admin/src/components/Notifications/Notification/index.js +104 -0
  61. package/admin/src/components/Notifications/NotificationsContainer/Wrapper.js +17 -0
  62. package/admin/src/components/Notifications/NotificationsContainer/index.js +56 -0
  63. package/admin/src/components/Notifications/index.js +2 -0
  64. package/admin/src/components/PageTitle/index.js +15 -0
  65. package/admin/src/components/Roles/ButtonWithNumber/NumberCard.js +10 -0
  66. package/admin/src/components/Roles/ButtonWithNumber/index.js +42 -0
  67. package/admin/src/components/Roles/CheckboxWithCondition/index.js +41 -0
  68. package/admin/src/components/Roles/Chevron/index.js +11 -0
  69. package/admin/src/components/Roles/CollapseLabel/index.js +11 -0
  70. package/admin/src/components/Roles/ConditionsButton/Wrapper.js +28 -0
  71. package/admin/src/components/Roles/ConditionsButton/index.js +49 -0
  72. package/admin/src/components/Roles/ConditionsModal/ActionRow/Wrapper.js +12 -0
  73. package/admin/src/components/Roles/ConditionsModal/ActionRow/index.js +88 -0
  74. package/admin/src/components/Roles/ConditionsModal/ConditionsSelect/ClearIndicator.js +15 -0
  75. package/admin/src/components/Roles/ConditionsModal/ConditionsSelect/CustomDropdownIndicator.js +39 -0
  76. package/admin/src/components/Roles/ConditionsModal/ConditionsSelect/IndicatorSeparator.js +3 -0
  77. package/admin/src/components/Roles/ConditionsModal/ConditionsSelect/MenuList/SubUl.js +48 -0
  78. package/admin/src/components/Roles/ConditionsModal/ConditionsSelect/MenuList/Ul.js +80 -0
  79. package/admin/src/components/Roles/ConditionsModal/ConditionsSelect/MenuList/UpperFirst.js +6 -0
  80. package/admin/src/components/Roles/ConditionsModal/ConditionsSelect/MenuList/index.js +140 -0
  81. package/admin/src/components/Roles/ConditionsModal/ConditionsSelect/MenuList/utils/constants.js +3 -0
  82. package/admin/src/components/Roles/ConditionsModal/ConditionsSelect/MenuList/utils/createCollapsesObject.js +14 -0
  83. package/admin/src/components/Roles/ConditionsModal/ConditionsSelect/SingleValue.js +46 -0
  84. package/admin/src/components/Roles/ConditionsModal/ConditionsSelect/index.js +67 -0
  85. package/admin/src/components/Roles/ConditionsModal/Separator.js +9 -0
  86. package/admin/src/components/Roles/ConditionsModal/index.js +150 -0
  87. package/admin/src/components/Roles/ConditionsModal/utils/createDefaultConditionsForm.js +47 -0
  88. package/admin/src/components/Roles/ConditionsModal/utils/selectStyle.js +95 -0
  89. package/admin/src/components/Roles/ContentTypeCollapse/Collapse/Wrapper.js +38 -0
  90. package/admin/src/components/Roles/ContentTypeCollapse/Collapse/index.js +156 -0
  91. package/admin/src/components/Roles/ContentTypeCollapse/Collapse/utils/constants.js +3 -0
  92. package/admin/src/components/Roles/ContentTypeCollapse/Collapse/utils/generateCheckboxesActions.js +55 -0
  93. package/admin/src/components/Roles/ContentTypeCollapse/CollapsePropertyMatrix/ActionRow/Wrapper.js +28 -0
  94. package/admin/src/components/Roles/ContentTypeCollapse/CollapsePropertyMatrix/ActionRow/index.js +162 -0
  95. package/admin/src/components/Roles/ContentTypeCollapse/CollapsePropertyMatrix/ActionRow/utils/constants.js +3 -0
  96. package/admin/src/components/Roles/ContentTypeCollapse/CollapsePropertyMatrix/ActionRow/utils/getRowLabelCheckboxeState.js +59 -0
  97. package/admin/src/components/Roles/ContentTypeCollapse/CollapsePropertyMatrix/Header/index.js +65 -0
  98. package/admin/src/components/Roles/ContentTypeCollapse/CollapsePropertyMatrix/SubActionRow/Wrapper.js +8 -0
  99. package/admin/src/components/Roles/ContentTypeCollapse/CollapsePropertyMatrix/SubActionRow/index.js +176 -0
  100. package/admin/src/components/Roles/ContentTypeCollapse/CollapsePropertyMatrix/SubActionRow/row.js +37 -0
  101. package/admin/src/components/Roles/ContentTypeCollapse/CollapsePropertyMatrix/SubActionRow/timeline.js +15 -0
  102. package/admin/src/components/Roles/ContentTypeCollapse/CollapsePropertyMatrix/SubActionRow/utils/constants.js +3 -0
  103. package/admin/src/components/Roles/ContentTypeCollapse/CollapsePropertyMatrix/Wrapper.js +21 -0
  104. package/admin/src/components/Roles/ContentTypeCollapse/CollapsePropertyMatrix/index.js +55 -0
  105. package/admin/src/components/Roles/ContentTypeCollapse/CollapsePropertyMatrix/utils/generateHeadersFromActions.js +12 -0
  106. package/admin/src/components/Roles/ContentTypeCollapse/Wrapper.js +17 -0
  107. package/admin/src/components/Roles/ContentTypeCollapse/index.js +72 -0
  108. package/admin/src/components/Roles/ContentTypeCollapse/utils/activeStyle.js +15 -0
  109. package/admin/src/components/Roles/ContentTypeCollapse/utils/getAvailableActions.js +10 -0
  110. package/admin/src/components/Roles/ContentTypeCollapse/utils/index.js +2 -0
  111. package/admin/src/components/Roles/ContentTypeCollapses/index.js +50 -0
  112. package/admin/src/components/Roles/ContentTypes/Wrapper.js +13 -0
  113. package/admin/src/components/Roles/ContentTypes/index.js +39 -0
  114. package/admin/src/components/Roles/Curve/index.js +35 -0
  115. package/admin/src/components/Roles/EmptyRole/index.js +31 -0
  116. package/admin/src/components/Roles/GlobalActions/Wrapper.js +18 -0
  117. package/admin/src/components/Roles/GlobalActions/index.js +66 -0
  118. package/admin/src/components/Roles/GlobalActions/utils/constants.js +3 -0
  119. package/admin/src/components/Roles/GlobalActions/utils/findDisplayedActions.js +4 -0
  120. package/admin/src/components/Roles/GlobalActions/utils/getRowLabelCheckboxesState.js +38 -0
  121. package/admin/src/components/Roles/GlobalActions/utils/index.js +2 -0
  122. package/admin/src/components/Roles/HiddenAction/index.js +9 -0
  123. package/admin/src/components/Roles/Permissions/README.md +372 -0
  124. package/admin/src/components/Roles/Permissions/index.js +155 -0
  125. package/admin/src/components/Roles/Permissions/init.js +41 -0
  126. package/admin/src/components/Roles/Permissions/reducer.js +177 -0
  127. package/admin/src/components/Roles/Permissions/utils/createDefaultCTFormFromLayout.js +178 -0
  128. package/admin/src/components/Roles/Permissions/utils/createDefaultPluginsFormFromLayout.js +49 -0
  129. package/admin/src/components/Roles/Permissions/utils/findMatchingPermissions.js +4 -0
  130. package/admin/src/components/Roles/Permissions/utils/formatContentTypesPermissionToAPI.js +122 -0
  131. package/admin/src/components/Roles/Permissions/utils/formatLayoutForSettingsAndPlugins.js +23 -0
  132. package/admin/src/components/Roles/Permissions/utils/formatPermissionsToAPI.js +21 -0
  133. package/admin/src/components/Roles/Permissions/utils/formatSettingsPermissionsToAPI.js +59 -0
  134. package/admin/src/components/Roles/Permissions/utils/tabLabels.js +24 -0
  135. package/admin/src/components/Roles/Permissions/utils/updateConditionsToFalse.js +39 -0
  136. package/admin/src/components/Roles/Permissions/utils/updateValues.js +31 -0
  137. package/admin/src/components/Roles/PermissionsDataManagerProvider/index.js +26 -0
  138. package/admin/src/components/Roles/PluginsAndSettings/ListWrapper.js +10 -0
  139. package/admin/src/components/Roles/PluginsAndSettings/Row/Wrapper.js +28 -0
  140. package/admin/src/components/Roles/PluginsAndSettings/Row/index.js +82 -0
  141. package/admin/src/components/Roles/PluginsAndSettings/SubCategory/CheckboxWrapper.js +22 -0
  142. package/admin/src/components/Roles/PluginsAndSettings/SubCategory/ConditionsButtonWrapper.js +13 -0
  143. package/admin/src/components/Roles/PluginsAndSettings/SubCategory/Wrapper.js +26 -0
  144. package/admin/src/components/Roles/PluginsAndSettings/SubCategory/index.js +136 -0
  145. package/admin/src/components/Roles/PluginsAndSettings/SubCategory/utils/constants.js +3 -0
  146. package/admin/src/components/Roles/PluginsAndSettings/SubCategory/utils/formatActions.js +32 -0
  147. package/admin/src/components/Roles/PluginsAndSettings/SubCategory/utils/getConditionsButtonState.js +17 -0
  148. package/admin/src/components/Roles/PluginsAndSettings/SubCategory/utils/index.js +2 -0
  149. package/admin/src/components/Roles/PluginsAndSettings/index.js +53 -0
  150. package/admin/src/components/Roles/RequiredSign/index.js +11 -0
  151. package/admin/src/components/Roles/RoleForm/NameInput.js +6 -0
  152. package/admin/src/components/Roles/RoleForm/RoleForm.js +94 -0
  153. package/admin/src/components/Roles/RoleForm/index.js +2 -0
  154. package/admin/src/components/Roles/RoleList/RoleDescription.js +9 -0
  155. package/admin/src/components/Roles/RoleList/RoleListWrapper.js +17 -0
  156. package/admin/src/components/Roles/RoleList/RoleRow.js +48 -0
  157. package/admin/src/components/Roles/RoleList/index.js +3 -0
  158. package/admin/src/components/Roles/RowLabelWithCheckbox/Wrapper.js +29 -0
  159. package/admin/src/components/Roles/RowLabelWithCheckbox/index.js +76 -0
  160. package/admin/src/components/Roles/Tabs/Tab.js +22 -0
  161. package/admin/src/components/Roles/Tabs/TabsWrapper.js +17 -0
  162. package/admin/src/components/Roles/Tabs/index.js +65 -0
  163. package/admin/src/components/Roles/index.js +6 -0
  164. package/admin/src/components/Roles/utils/createArrayOfValues.js +19 -0
  165. package/admin/src/components/Roles/utils/getCheckboxState.js +19 -0
  166. package/admin/src/components/Roles/utils/index.js +3 -0
  167. package/admin/src/components/Roles/utils/removeConditionKeyFromData.js +15 -0
  168. package/admin/src/components/Settings/Header/index.js +73 -0
  169. package/admin/src/components/Settings/index.js +2 -0
  170. package/admin/src/components/SettingsPageTitle/index.js +17 -0
  171. package/admin/src/components/SizedInput/index.js +25 -0
  172. package/admin/src/components/UpgradePlanModal/components/Arrow/arrow.png +0 -0
  173. package/admin/src/components/UpgradePlanModal/components/Arrow/index.js +16 -0
  174. package/admin/src/components/UpgradePlanModal/components/Download/index.js +13 -0
  175. package/admin/src/components/UpgradePlanModal/components/Option/Wrapper.js +12 -0
  176. package/admin/src/components/UpgradePlanModal/components/Option/index.js +18 -0
  177. package/admin/src/components/UpgradePlanModal/components/Wrapper/balloon.png +0 -0
  178. package/admin/src/components/UpgradePlanModal/components/Wrapper/index.js +14 -0
  179. package/admin/src/components/UpgradePlanModal/components/index.js +4 -0
  180. package/admin/src/components/UpgradePlanModal/index.js +76 -0
  181. package/admin/src/components/Users/Filter/index.js +41 -0
  182. package/admin/src/components/Users/FilterPicker/Button.js +14 -0
  183. package/admin/src/components/Users/FilterPicker/Card/Input.js +35 -0
  184. package/admin/src/components/Users/FilterPicker/Card/Wrapper.js +8 -0
  185. package/admin/src/components/Users/FilterPicker/Card/index.js +91 -0
  186. package/admin/src/components/Users/FilterPicker/Card/init.js +5 -0
  187. package/admin/src/components/Users/FilterPicker/Card/reducer.js +39 -0
  188. package/admin/src/components/Users/FilterPicker/Card/utils/form.js +57 -0
  189. package/admin/src/components/Users/FilterPicker/Card/utils/formatInputValue.js +9 -0
  190. package/admin/src/components/Users/FilterPicker/Card/utils/getInputValue.js +9 -0
  191. package/admin/src/components/Users/FilterPicker/Card/utils/index.js +3 -0
  192. package/admin/src/components/Users/FilterPicker/index.js +35 -0
  193. package/admin/src/components/Users/Footer/Wrapper.js +7 -0
  194. package/admin/src/components/Users/Footer/index.js +40 -0
  195. package/admin/src/components/Users/LinkNotification/Envelope.js +20 -0
  196. package/admin/src/components/Users/LinkNotification/IconWrapper.js +15 -0
  197. package/admin/src/components/Users/LinkNotification/Wrapper.js +26 -0
  198. package/admin/src/components/Users/LinkNotification/index.js +47 -0
  199. package/admin/src/components/Users/List/ActiveStatus.js +20 -0
  200. package/admin/src/components/Users/List/Wrapper.js +34 -0
  201. package/admin/src/components/Users/List/index.js +151 -0
  202. package/admin/src/components/Users/List/init.js +5 -0
  203. package/admin/src/components/Users/List/reducer.js +56 -0
  204. package/admin/src/components/Users/List/utils/checkIfAllEntriesAreSelected.js +3 -0
  205. package/admin/src/components/Users/List/utils/getSelectedIds.js +19 -0
  206. package/admin/src/components/Users/List/utils/headers.js +42 -0
  207. package/admin/src/components/Users/List/utils/index.js +4 -0
  208. package/admin/src/components/Users/List/utils/updateRows.js +6 -0
  209. package/admin/src/components/Users/MagicLink/index.js +27 -0
  210. package/admin/src/components/Users/ModalCreateBody/Wrapper.js +12 -0
  211. package/admin/src/components/Users/ModalCreateBody/index.js +153 -0
  212. package/admin/src/components/Users/ModalCreateBody/init.js +5 -0
  213. package/admin/src/components/Users/ModalCreateBody/reducer.js +27 -0
  214. package/admin/src/components/Users/ModalCreateBody/utils/form.js +29 -0
  215. package/admin/src/components/Users/ModalCreateBody/utils/formDataModel.js +8 -0
  216. package/admin/src/components/Users/ModalCreateBody/utils/roleSettingsForm.js +10 -0
  217. package/admin/src/components/Users/ModalCreateBody/utils/schema.js +17 -0
  218. package/admin/src/components/Users/RoleSettingsModalSection/RolesSelectComponent.js +53 -0
  219. package/admin/src/components/Users/RoleSettingsModalSection/index.js +76 -0
  220. package/admin/src/components/Users/SelectRoles/ClearIndicator.js +15 -0
  221. package/admin/src/components/Users/SelectRoles/DropdownIndicator.js +39 -0
  222. package/admin/src/components/Users/SelectRoles/ErrorMessage.js +10 -0
  223. package/admin/src/components/Users/SelectRoles/IndicatorSeparator.js +3 -0
  224. package/admin/src/components/Users/SelectRoles/MultiValueContainer.js +43 -0
  225. package/admin/src/components/Users/SelectRoles/StyledOption.js +11 -0
  226. package/admin/src/components/Users/SelectRoles/index.js +68 -0
  227. package/admin/src/components/Users/SelectRoles/utils/styles.js +99 -0
  228. package/admin/src/components/Users/SortPicker/Button.js +14 -0
  229. package/admin/src/components/Users/SortPicker/List.js +46 -0
  230. package/admin/src/components/Users/SortPicker/ListItem.js +37 -0
  231. package/admin/src/components/Users/SortPicker/ListWrapper.js +18 -0
  232. package/admin/src/components/Users/SortPicker/StyledListItem.js +30 -0
  233. package/admin/src/components/Users/SortPicker/index.js +34 -0
  234. package/admin/src/components/Users/index.js +8 -0
  235. package/admin/src/components/Webhooks/EventInput/EventRow.js +66 -0
  236. package/admin/src/components/Webhooks/EventInput/Wrapper.js +77 -0
  237. package/admin/src/components/Webhooks/EventInput/index.js +128 -0
  238. package/admin/src/components/Webhooks/EventInput/utils/formatValue.js +13 -0
  239. package/admin/src/components/Webhooks/HeadersInput/Wrapper.js +102 -0
  240. package/admin/src/components/Webhooks/HeadersInput/index.js +143 -0
  241. package/admin/src/components/Webhooks/HeadersInput/keys.js +39 -0
  242. package/admin/src/components/Webhooks/HeadersInput/utils/getBorderColor.js +12 -0
  243. package/admin/src/components/Webhooks/Inputs/Wrapper.js +34 -0
  244. package/admin/src/components/Webhooks/Inputs/index.js +110 -0
  245. package/admin/src/components/Webhooks/ListRow/StyledListRow.js +49 -0
  246. package/admin/src/components/Webhooks/ListRow/index.js +113 -0
  247. package/admin/src/components/Webhooks/Switch/Toggle.js +30 -0
  248. package/admin/src/components/Webhooks/Switch/Wrapper.js +67 -0
  249. package/admin/src/components/Webhooks/Switch/index.js +51 -0
  250. package/admin/src/components/Webhooks/TriggerContainer/Wrapper.js +64 -0
  251. package/admin/src/components/Webhooks/TriggerContainer/index.js +103 -0
  252. package/admin/src/components/Webhooks/index.js +4 -0
  253. package/admin/src/config.js +13 -0
  254. package/admin/src/configureStore.js +60 -0
  255. package/admin/src/containers/Admin/Content.js +30 -0
  256. package/admin/src/containers/Admin/Logout/components.js +128 -0
  257. package/admin/src/containers/Admin/Logout/index.js +60 -0
  258. package/admin/src/containers/Admin/Wrapper.js +27 -0
  259. package/admin/src/containers/Admin/actions.js +21 -0
  260. package/admin/src/containers/Admin/constants.js +9 -0
  261. package/admin/src/containers/Admin/index.js +364 -0
  262. package/admin/src/containers/Admin/reducer.js +39 -0
  263. package/admin/src/containers/Admin/selectors.js +22 -0
  264. package/admin/src/containers/App/actions.js +87 -0
  265. package/admin/src/containers/App/components.js +15 -0
  266. package/admin/src/containers/App/constants.js +18 -0
  267. package/admin/src/containers/App/index.js +157 -0
  268. package/admin/src/containers/App/reducer.js +86 -0
  269. package/admin/src/containers/App/selectors.js +38 -0
  270. package/admin/src/containers/App/styles/website.css +25 -0
  271. package/admin/src/containers/App/utils/customRoutes.js +3 -0
  272. package/admin/src/containers/App/utils/defaultRoutes.js +3 -0
  273. package/admin/src/containers/App/utils/index.js +3 -0
  274. package/admin/src/containers/App/utils/routes.js +4 -0
  275. package/admin/src/containers/App/utils/unique-identifier.js +10 -0
  276. package/admin/src/containers/ApplicationInfosPage/components/Detail/index.js +30 -0
  277. package/admin/src/containers/ApplicationInfosPage/components/InfoText/index.js +19 -0
  278. package/admin/src/containers/ApplicationInfosPage/components/Link/components.js +22 -0
  279. package/admin/src/containers/ApplicationInfosPage/components/Link/index.js +26 -0
  280. package/admin/src/containers/ApplicationInfosPage/components/Wrapper/index.js +7 -0
  281. package/admin/src/containers/ApplicationInfosPage/components/index.js +4 -0
  282. package/admin/src/containers/ApplicationInfosPage/index.js +89 -0
  283. package/admin/src/containers/AuthPage/components/AuthLink/Link.js +13 -0
  284. package/admin/src/containers/AuthPage/components/AuthLink/Wrapper.js +8 -0
  285. package/admin/src/containers/AuthPage/components/AuthLink/index.js +35 -0
  286. package/admin/src/containers/AuthPage/components/Box/Wrapper.js +13 -0
  287. package/admin/src/containers/AuthPage/components/Box/index.js +28 -0
  288. package/admin/src/containers/AuthPage/components/ForgotPassword/index.js +65 -0
  289. package/admin/src/containers/AuthPage/components/ForgotPasswordSuccess/Envelope.js +20 -0
  290. package/admin/src/containers/AuthPage/components/ForgotPasswordSuccess/index.js +77 -0
  291. package/admin/src/containers/AuthPage/components/Input/index.js +32 -0
  292. package/admin/src/containers/AuthPage/components/Login/BaseLogin.js +84 -0
  293. package/admin/src/containers/AuthPage/components/Login/index.js +23 -0
  294. package/admin/src/containers/AuthPage/components/Logo/Img.js +7 -0
  295. package/admin/src/containers/AuthPage/components/Logo/index.js +7 -0
  296. package/admin/src/containers/AuthPage/components/Oops/Img.js +7 -0
  297. package/admin/src/containers/AuthPage/components/Oops/index.js +63 -0
  298. package/admin/src/containers/AuthPage/components/Register/CustomLabel.js +28 -0
  299. package/admin/src/containers/AuthPage/components/Register/InputWrapper.js +8 -0
  300. package/admin/src/containers/AuthPage/components/Register/Span.js +13 -0
  301. package/admin/src/containers/AuthPage/components/Register/index.js +173 -0
  302. package/admin/src/containers/AuthPage/components/ResetPassword/index.js +73 -0
  303. package/admin/src/containers/AuthPage/components/Section/index.js +22 -0
  304. package/admin/src/containers/AuthPage/index.js +321 -0
  305. package/admin/src/containers/AuthPage/init.js +5 -0
  306. package/admin/src/containers/AuthPage/reducer.js +41 -0
  307. package/admin/src/containers/AuthPage/utils/forms.js +124 -0
  308. package/admin/src/containers/AuthPage/utils/index.js +2 -0
  309. package/admin/src/containers/HomePage/BlogPost.js +48 -0
  310. package/admin/src/containers/HomePage/SocialLink.js +52 -0
  311. package/admin/src/containers/HomePage/components.js +260 -0
  312. package/admin/src/containers/HomePage/hooks.js +54 -0
  313. package/admin/src/containers/HomePage/index.js +239 -0
  314. package/admin/src/containers/InstalledPluginsPage/ListWrapper.js +7 -0
  315. package/admin/src/containers/InstalledPluginsPage/Logo.js +36 -0
  316. package/admin/src/containers/InstalledPluginsPage/Row.js +98 -0
  317. package/admin/src/containers/InstalledPluginsPage/index.js +73 -0
  318. package/admin/src/containers/InstalledPluginsPage/utils/generateRows.js +19 -0
  319. package/admin/src/containers/LanguageProvider/actions.js +16 -0
  320. package/admin/src/containers/LanguageProvider/constants.js +8 -0
  321. package/admin/src/containers/LanguageProvider/hooks/useChangeLanguage.js +14 -0
  322. package/admin/src/containers/LanguageProvider/index.js +49 -0
  323. package/admin/src/containers/LanguageProvider/reducer.js +52 -0
  324. package/admin/src/containers/LanguageProvider/selectors.js +25 -0
  325. package/admin/src/containers/LeftMenu/Loader.js +34 -0
  326. package/admin/src/containers/LeftMenu/LoaderWrapper.js +13 -0
  327. package/admin/src/containers/LeftMenu/Wrapper.js +61 -0
  328. package/admin/src/containers/LeftMenu/actions.js +24 -0
  329. package/admin/src/containers/LeftMenu/constants.js +4 -0
  330. package/admin/src/containers/LeftMenu/index.js +101 -0
  331. package/admin/src/containers/LeftMenu/reducer.js +79 -0
  332. package/admin/src/containers/LeftMenu/selectors.js +3 -0
  333. package/admin/src/containers/LeftMenu/useMenuSections.js +62 -0
  334. package/admin/src/containers/LeftMenu/utils/checkPermissions.js +13 -0
  335. package/admin/src/containers/LeftMenu/utils/generateModelsLinks.js +61 -0
  336. package/admin/src/containers/LeftMenu/utils/getCtOrStLinks.js +49 -0
  337. package/admin/src/containers/LeftMenu/utils/getGeneralLinks.js +42 -0
  338. package/admin/src/containers/LeftMenu/utils/getPluginSectionLinks.js +17 -0
  339. package/admin/src/containers/LeftMenu/utils/getSettingsMenuLinksPermissions.js +20 -0
  340. package/admin/src/containers/LeftMenu/utils/index.js +2 -0
  341. package/admin/src/containers/LeftMenu/utils/toPluginLinks.js +19 -0
  342. package/admin/src/containers/LocaleToggle/Wrapper.js +147 -0
  343. package/admin/src/containers/LocaleToggle/actions.js +19 -0
  344. package/admin/src/containers/LocaleToggle/constants.js +8 -0
  345. package/admin/src/containers/LocaleToggle/index.js +84 -0
  346. package/admin/src/containers/LocaleToggle/reducer.js +25 -0
  347. package/admin/src/containers/LocaleToggle/selectors.js +25 -0
  348. package/admin/src/containers/MarketplacePage/MarketplaceBanner/Wrapper.js +29 -0
  349. package/admin/src/containers/MarketplacePage/MarketplaceBanner/index.js +37 -0
  350. package/admin/src/containers/MarketplacePage/PluginCard/Wrapper.js +148 -0
  351. package/admin/src/containers/MarketplacePage/PluginCard/index.js +184 -0
  352. package/admin/src/containers/MarketplacePage/Wrapper.js +10 -0
  353. package/admin/src/containers/MarketplacePage/index.js +103 -0
  354. package/admin/src/containers/NewNotification/Notification/index.js +181 -0
  355. package/admin/src/containers/NewNotification/Notification/styledComponents.js +66 -0
  356. package/admin/src/containers/NewNotification/Wrapper.js +19 -0
  357. package/admin/src/containers/NewNotification/actions.js +9 -0
  358. package/admin/src/containers/NewNotification/constants.js +2 -0
  359. package/admin/src/containers/NewNotification/index.js +35 -0
  360. package/admin/src/containers/NewNotification/reducer.js +49 -0
  361. package/admin/src/containers/NotFoundPage/index.js +24 -0
  362. package/admin/src/containers/NotificationProvider/actions.js +37 -0
  363. package/admin/src/containers/NotificationProvider/constants.js +8 -0
  364. package/admin/src/containers/NotificationProvider/index.js +45 -0
  365. package/admin/src/containers/NotificationProvider/reducer.js +48 -0
  366. package/admin/src/containers/NotificationProvider/selectors.js +27 -0
  367. package/admin/src/containers/Onboarding/Li.js +150 -0
  368. package/admin/src/containers/Onboarding/StaticLinks/StyledLink.js +23 -0
  369. package/admin/src/containers/Onboarding/StaticLinks/index.js +45 -0
  370. package/admin/src/containers/Onboarding/Video.js +180 -0
  371. package/admin/src/containers/Onboarding/Wrapper.js +131 -0
  372. package/admin/src/containers/Onboarding/index.js +134 -0
  373. package/admin/src/containers/Onboarding/init.js +5 -0
  374. package/admin/src/containers/Onboarding/reducer.js +62 -0
  375. package/admin/src/containers/Onboarding/utils/formatAndStoreVideoArray.js +27 -0
  376. package/admin/src/containers/PermissionsManager/actions.js +25 -0
  377. package/admin/src/containers/PermissionsManager/constants.js +5 -0
  378. package/admin/src/containers/PermissionsManager/index.js +49 -0
  379. package/admin/src/containers/PermissionsManager/reducer.js +66 -0
  380. package/admin/src/containers/PluginDispatcher/index.js +69 -0
  381. package/admin/src/containers/PrivateRoute/index.js +39 -0
  382. package/admin/src/containers/ProfilePage/components.js +9 -0
  383. package/admin/src/containers/ProfilePage/index.js +170 -0
  384. package/admin/src/containers/ProfilePage/utils/form.js +36 -0
  385. package/admin/src/containers/ProfilePage/utils/index.js +2 -0
  386. package/admin/src/containers/ProfilePage/utils/schema.js +16 -0
  387. package/admin/src/containers/Roles/CreatePage/index.js +8 -0
  388. package/admin/src/containers/Roles/EditPage/index.js +172 -0
  389. package/admin/src/containers/Roles/EditPage/utils/schema.js +8 -0
  390. package/admin/src/containers/Roles/ListPage/BaselineAlignment.js +8 -0
  391. package/admin/src/containers/Roles/ListPage/index.js +149 -0
  392. package/admin/src/containers/Roles/ProtectedEditPage/index.js +31 -0
  393. package/admin/src/containers/Roles/ProtectedListPage/index.js +12 -0
  394. package/admin/src/containers/SettingsHeaderSearchContextProvider/index.js +17 -0
  395. package/admin/src/containers/SettingsPage/components/ApplicationDetailLink/Icon.js +13 -0
  396. package/admin/src/containers/SettingsPage/components/ApplicationDetailLink/Link.js +25 -0
  397. package/admin/src/containers/SettingsPage/components/ApplicationDetailLink/Notif.js +17 -0
  398. package/admin/src/containers/SettingsPage/components/ApplicationDetailLink/Wrapper.js +9 -0
  399. package/admin/src/containers/SettingsPage/components/ApplicationDetailLink/index.js +26 -0
  400. package/admin/src/containers/SettingsPage/components/MenuWrapper/index.js +9 -0
  401. package/admin/src/containers/SettingsPage/components/SettingDispatcher/index.js +27 -0
  402. package/admin/src/containers/SettingsPage/components/StyledLeftMenu/index.js +13 -0
  403. package/admin/src/containers/SettingsPage/components/Wrapper/index.js +19 -0
  404. package/admin/src/containers/SettingsPage/components/index.js +5 -0
  405. package/admin/src/containers/SettingsPage/index.js +132 -0
  406. package/admin/src/containers/SettingsPage/utils/createPluginsLinksRoutes.js +23 -0
  407. package/admin/src/containers/SettingsPage/utils/createRoute.js +8 -0
  408. package/admin/src/containers/SettingsPage/utils/customRoutes.js +3 -0
  409. package/admin/src/containers/SettingsPage/utils/defaultRoutes.js +65 -0
  410. package/admin/src/containers/SettingsPage/utils/findFirstAllowedEndpoint.js +14 -0
  411. package/admin/src/containers/SettingsPage/utils/getSectionsToDisplay.js +5 -0
  412. package/admin/src/containers/SettingsPage/utils/index.js +6 -0
  413. package/admin/src/containers/SettingsPage/utils/makeUniqueRoutes.js +6 -0
  414. package/admin/src/containers/SettingsPage/utils/routes.js +4 -0
  415. package/admin/src/containers/Theme/index.js +14 -0
  416. package/admin/src/containers/Users/EditPage/index.js +137 -0
  417. package/admin/src/containers/Users/EditPage/utils/form.js +52 -0
  418. package/admin/src/containers/Users/ListPage/Header.js +78 -0
  419. package/admin/src/containers/Users/ListPage/ModalForm.js +101 -0
  420. package/admin/src/containers/Users/ListPage/index.js +289 -0
  421. package/admin/src/containers/Users/ListPage/init.js +3 -0
  422. package/admin/src/containers/Users/ListPage/reducer.js +57 -0
  423. package/admin/src/containers/Users/ListPage/stepper.js +18 -0
  424. package/admin/src/containers/Users/ListPage/utils/getFilters.js +30 -0
  425. package/admin/src/containers/Users/ProtectedEditPage/index.js +45 -0
  426. package/admin/src/containers/Users/ProtectedListPage/index.js +12 -0
  427. package/admin/src/containers/Webhooks/EditView/Wrapper.js +61 -0
  428. package/admin/src/containers/Webhooks/EditView/index.js +448 -0
  429. package/admin/src/containers/Webhooks/EditView/reducer.js +76 -0
  430. package/admin/src/containers/Webhooks/EditView/utils/fieldsRegex.js +4 -0
  431. package/admin/src/containers/Webhooks/EditView/utils/form.js +38 -0
  432. package/admin/src/containers/Webhooks/EditView/utils/formatData.js +26 -0
  433. package/admin/src/containers/Webhooks/EditView/utils/index.js +3 -0
  434. package/admin/src/containers/Webhooks/EditView/utils/schema.js +35 -0
  435. package/admin/src/containers/Webhooks/ListView/Wrapper.js +31 -0
  436. package/admin/src/containers/Webhooks/ListView/index.js +320 -0
  437. package/admin/src/containers/Webhooks/ListView/reducer.js +43 -0
  438. package/admin/src/containers/Webhooks/ProtectedCreateView/index.js +12 -0
  439. package/admin/src/containers/Webhooks/ProtectedEditView/index.js +12 -0
  440. package/admin/src/containers/Webhooks/ProtectedListView/index.js +12 -0
  441. package/admin/src/contexts/MarketPlace/index.js +25 -0
  442. package/admin/src/contexts/PermisssionsDataManagerContext/index.js +5 -0
  443. package/admin/src/contexts/SettingsHeaderSearchContext/index.js +5 -0
  444. package/admin/src/contexts/index.js +2 -0
  445. package/admin/src/favicon.png +0 -0
  446. package/admin/src/hooks/index.js +9 -0
  447. package/admin/src/hooks/useFetchPermissionsLayout/index.js +32 -0
  448. package/admin/src/hooks/useFetchPermissionsLayout/reducer.js +35 -0
  449. package/admin/src/hooks/useFetchPluginsFromMarketPlace/index.js +49 -0
  450. package/admin/src/hooks/useFetchRole/index.js +58 -0
  451. package/admin/src/hooks/useFetchRole/reducer.js +33 -0
  452. package/admin/src/hooks/useModels/index.js +47 -0
  453. package/admin/src/hooks/useModels/reducer.js +45 -0
  454. package/admin/src/hooks/usePermissionsDataManager/index.js +6 -0
  455. package/admin/src/hooks/useRolesList/index.js +49 -0
  456. package/admin/src/hooks/useRolesList/init.js +5 -0
  457. package/admin/src/hooks/useRolesList/reducer.js +31 -0
  458. package/admin/src/hooks/useSettingsForm/index.js +136 -0
  459. package/admin/src/hooks/useSettingsForm/init.js +5 -0
  460. package/admin/src/hooks/useSettingsForm/reducer.js +60 -0
  461. package/admin/src/hooks/useSettingsHeaderSearchContext/index.js +6 -0
  462. package/admin/src/hooks/useSettingsMenu/index.js +56 -0
  463. package/admin/src/hooks/useSettingsMenu/init.js +49 -0
  464. package/admin/src/hooks/useSettingsMenu/reducer.js +41 -0
  465. package/admin/src/hooks/useSettingsMenu/utils/customGlobalLinks.js +1 -0
  466. package/admin/src/hooks/useSettingsMenu/utils/defaultGlobalLinks.js +14 -0
  467. package/admin/src/hooks/useSettingsMenu/utils/formatLinks.js +12 -0
  468. package/admin/src/hooks/useSettingsMenu/utils/globalLinks.js +4 -0
  469. package/admin/src/i18n.js +17 -0
  470. package/admin/src/index.html +16 -0
  471. package/admin/src/permissions/customPermissions.js +1 -0
  472. package/admin/src/permissions/defaultPermissions.js +60 -0
  473. package/admin/src/permissions/index.js +7 -0
  474. package/admin/src/plugins.js +37 -0
  475. package/admin/src/public-path.js +40 -0
  476. package/admin/src/reducers.js +28 -0
  477. package/admin/src/themes/colors.js +51 -0
  478. package/admin/src/themes/fontWeights.js +8 -0
  479. package/admin/src/themes/index.js +13 -0
  480. package/admin/src/themes/sizes.js +31 -0
  481. package/admin/src/translations/ar.json +146 -0
  482. package/admin/src/translations/cs.json +183 -0
  483. package/admin/src/translations/de.json +371 -0
  484. package/admin/src/translations/dk.json +348 -0
  485. package/admin/src/translations/en.json +375 -0
  486. package/admin/src/translations/es.json +338 -0
  487. package/admin/src/translations/fr.json +232 -0
  488. package/admin/src/translations/he.json +364 -0
  489. package/admin/src/translations/id.json +337 -0
  490. package/admin/src/translations/index.js +86 -0
  491. package/admin/src/translations/it.json +347 -0
  492. package/admin/src/translations/ja.json +288 -0
  493. package/admin/src/translations/ko.json +179 -0
  494. package/admin/src/translations/ms.json +223 -0
  495. package/admin/src/translations/nl.json +221 -0
  496. package/admin/src/translations/no.json +349 -0
  497. package/admin/src/translations/pl.json +372 -0
  498. package/admin/src/translations/pt-BR.json +228 -0
  499. package/admin/src/translations/pt.json +225 -0
  500. package/admin/src/translations/ru.json +368 -0
  501. package/admin/src/translations/sk.json +337 -0
  502. package/admin/src/translations/sv.json +127 -0
  503. package/admin/src/translations/th.json +332 -0
  504. package/admin/src/translations/tr.json +371 -0
  505. package/admin/src/translations/uk.json +223 -0
  506. package/admin/src/translations/vi.json +179 -0
  507. package/admin/src/translations/zh-Hans.json +372 -0
  508. package/admin/src/translations/zh.json +152 -0
  509. package/admin/src/utils/ComponentApi.js +42 -0
  510. package/admin/src/utils/FieldApi.js +48 -0
  511. package/admin/src/utils/MiddlewareApi.js +15 -0
  512. package/admin/src/utils/Plugin.js +50 -0
  513. package/admin/src/utils/Strapi.js +28 -0
  514. package/admin/src/utils/basename.js +3 -0
  515. package/admin/src/utils/checkFormValidity.js +15 -0
  516. package/admin/src/utils/checkLatestStrapiVersion.js +11 -0
  517. package/admin/src/utils/checkStore.js +24 -0
  518. package/admin/src/utils/constants.js +3 -0
  519. package/admin/src/utils/formatAPIErrors.js +17 -0
  520. package/admin/src/utils/getAttributesToDisplay.js +21 -0
  521. package/admin/src/utils/getExistingActions.js +34 -0
  522. package/admin/src/utils/getRequestUrl.js +3 -0
  523. package/admin/src/utils/history.js +6 -0
  524. package/admin/src/utils/index.js +9 -0
  525. package/admin/src/utils/injectReducer.js +56 -0
  526. package/admin/src/utils/injectSaga.js +76 -0
  527. package/admin/src/utils/reducerInjectors.js +38 -0
  528. package/admin/src/utils/retrieveGlobalLinks.js +17 -0
  529. package/admin/src/utils/retrievePluginsMenu.js +17 -0
  530. package/admin/src/utils/sagaInjectors.js +94 -0
  531. package/admin/src/utils/sortLinks.js +5 -0
  532. package/admin/src/validations/users/edit.js +11 -0
  533. package/admin/src/validations/users/index.js +3 -0
  534. package/admin/src/validations/users/profile.js +29 -0
  535. package/admin/src/validations/users/roles.js +11 -0
  536. package/config/admin-actions.js +122 -0
  537. package/config/admin-conditions.js +26 -0
  538. package/config/email-templates/forgot-password.js +25 -0
  539. package/config/functions/bootstrap.js +67 -0
  540. package/config/functions/register.js +7 -0
  541. package/config/layout.js +10 -0
  542. package/config/migrations/permissions-fields-to-properties.js +104 -0
  543. package/config/policies/hasPermissions.js +51 -0
  544. package/config/policies/isAuthenticatedAdmin.js +9 -0
  545. package/config/routes.json +320 -0
  546. package/config/settings.js +9 -0
  547. package/controllers/Webhooks.js +150 -0
  548. package/controllers/admin.js +101 -0
  549. package/controllers/authenticated-user.js +56 -0
  550. package/controllers/authentication.js +181 -0
  551. package/controllers/formatters/conditions.js +12 -0
  552. package/controllers/formatters/format-actions-by-sections.js +37 -0
  553. package/controllers/formatters/index.js +9 -0
  554. package/controllers/permission.js +51 -0
  555. package/controllers/role.js +148 -0
  556. package/controllers/user.js +136 -0
  557. package/doc/change-the-login-page-logo.md +28 -0
  558. package/doc/customize-menu.md +17 -0
  559. package/doc/disable-tracking.md +16 -0
  560. package/domain/action/index.js +142 -0
  561. package/domain/action/provider.js +83 -0
  562. package/domain/condition/index.js +92 -0
  563. package/domain/condition/provider.js +42 -0
  564. package/domain/permission/index.js +140 -0
  565. package/domain/role.js +29 -0
  566. package/domain/user.js +25 -0
  567. package/index.html +16 -0
  568. package/index.js +374 -0
  569. package/middlewares/auth/defaults.json +5 -0
  570. package/middlewares/auth/index.js +39 -0
  571. package/models/Permission.js +7 -0
  572. package/models/Permission.settings.json +49 -0
  573. package/models/Role.js +7 -0
  574. package/models/Role.settings.json +50 -0
  575. package/models/User.config.js +12 -0
  576. package/models/User.js +7 -0
  577. package/models/User.settings.json +88 -0
  578. package/package.json +129 -0
  579. package/services/action.js +34 -0
  580. package/services/auth.js +113 -0
  581. package/services/condition.js +14 -0
  582. package/services/constants.js +12 -0
  583. package/services/content-type.js +208 -0
  584. package/services/metrics.js +18 -0
  585. package/services/passport/local-strategy.js +21 -0
  586. package/services/passport.js +47 -0
  587. package/services/permission/engine-hooks.js +82 -0
  588. package/services/permission/engine.js +275 -0
  589. package/services/permission/permissions-manager/index.js +87 -0
  590. package/services/permission/permissions-manager/query-builers.js +86 -0
  591. package/services/permission/queries.js +241 -0
  592. package/services/permission/sections-builder/builder.js +84 -0
  593. package/services/permission/sections-builder/handlers.js +156 -0
  594. package/services/permission/sections-builder/index.js +50 -0
  595. package/services/permission/sections-builder/section.js +71 -0
  596. package/services/permission/sections-builder/utils.js +26 -0
  597. package/services/permission.js +30 -0
  598. package/services/role.js +470 -0
  599. package/services/token.js +57 -0
  600. package/services/user.js +348 -0
  601. package/utils/index.js +11 -0
  602. package/validation/action-provider.js +79 -0
  603. package/validation/authentication/forgot-password.js +20 -0
  604. package/validation/authentication/index.js +17 -0
  605. package/validation/authentication/register.js +63 -0
  606. package/validation/authentication/reset-password.js +21 -0
  607. package/validation/common-functions/check-fields-are-correctly-nested.js +26 -0
  608. package/validation/common-functions/check-fields-dont-have-duplicates.js +16 -0
  609. package/validation/common-functions/index.js +9 -0
  610. package/validation/common-validators.js +217 -0
  611. package/validation/permission.js +153 -0
  612. package/validation/policies/hasPermissions.js +33 -0
  613. package/validation/role.js +21 -0
  614. package/validation/user.js +85 -0
  615. package/webpack.alias.js +64 -0
  616. package/webpack.config.js +212 -0
@@ -0,0 +1,41 @@
1
+ import createDefaultCTFormFromLayout from './utils/createDefaultCTFormFromLayout';
2
+ import createDefaultPluginsFormFromLayout from './utils/createDefaultPluginsFormFromLayout';
3
+ import formatLayoutForSettingsAndPlugins from './utils/formatLayoutForSettingsAndPlugins';
4
+
5
+ const init = (layout, permissions) => {
6
+ const {
7
+ conditions,
8
+ sections: { collectionTypes, singleTypes, plugins, settings },
9
+ } = layout;
10
+
11
+ const layouts = {
12
+ collectionTypes,
13
+ singleTypes,
14
+ plugins: formatLayoutForSettingsAndPlugins(plugins, 'plugin'),
15
+ settings: formatLayoutForSettingsAndPlugins(settings, 'category'),
16
+ };
17
+ const defaultForm = {
18
+ collectionTypes: createDefaultCTFormFromLayout(
19
+ collectionTypes,
20
+ collectionTypes.actions || [],
21
+ conditions,
22
+ permissions
23
+ ),
24
+ singleTypes: createDefaultCTFormFromLayout(
25
+ singleTypes,
26
+ singleTypes.actions || [],
27
+ conditions,
28
+ permissions
29
+ ),
30
+ plugins: createDefaultPluginsFormFromLayout(layouts.plugins, conditions, permissions),
31
+ settings: createDefaultPluginsFormFromLayout(layouts.settings, conditions, permissions),
32
+ };
33
+
34
+ return {
35
+ initialData: defaultForm,
36
+ modifiedData: defaultForm,
37
+ layouts,
38
+ };
39
+ };
40
+
41
+ export default init;
@@ -0,0 +1,177 @@
1
+ import produce from 'immer';
2
+ import { cloneDeep, has, isObject, get, set } from 'lodash';
3
+ import updateConditionsToFalse from './utils/updateConditionsToFalse';
4
+ import updateValues from './utils/updateValues';
5
+
6
+ const initialState = {
7
+ initialData: {},
8
+ modifiedData: {},
9
+ layouts: {},
10
+ };
11
+
12
+ /* eslint-disable consistent-return */
13
+ const reducer = (state, action) =>
14
+ produce(state, draftState => {
15
+ switch (action.type) {
16
+ // This action is called when a checkbox in the <GlobalActions />
17
+ // changes
18
+ case 'ON_CHANGE_COLLECTION_TYPE_GLOBAL_ACTION_CHECKBOX': {
19
+ const { collectionTypeKind, actionId, value } = action;
20
+ const pathToData = ['modifiedData', collectionTypeKind];
21
+
22
+ Object.keys(get(state, pathToData)).forEach(collectionType => {
23
+ const collectionTypeActionData = get(
24
+ state,
25
+ [...pathToData, collectionType, actionId],
26
+ undefined
27
+ );
28
+
29
+ if (collectionTypeActionData) {
30
+ let updatedValues = updateValues(collectionTypeActionData, value);
31
+
32
+ // We need to remove the applied conditions
33
+ if (!value && updatedValues.conditions) {
34
+ const updatedConditions = updateValues(updatedValues.conditions, false);
35
+
36
+ updatedValues = { ...updatedValues, conditions: updatedConditions };
37
+ }
38
+
39
+ set(draftState, [...pathToData, collectionType, actionId], updatedValues);
40
+ }
41
+ });
42
+
43
+ break;
44
+ }
45
+ case 'ON_CHANGE_COLLECTION_TYPE_ROW_LEFT_CHECKBOX': {
46
+ const { pathToCollectionType, propertyName, rowName, value } = action;
47
+ let nextModifiedDataState = cloneDeep(state.modifiedData);
48
+ const pathToModifiedDataCollectionType = pathToCollectionType.split('..');
49
+
50
+ const objToUpdate = get(nextModifiedDataState, pathToModifiedDataCollectionType, {});
51
+
52
+ Object.keys(objToUpdate).forEach(actionId => {
53
+ // When a ct has multiple properties (ex: locales, field)
54
+ // We need to make sure that we add any new property to the modifiedData
55
+ // object.
56
+ if (has(objToUpdate[actionId], `properties.${propertyName}`)) {
57
+ const objValue = get(objToUpdate, [actionId, 'properties', propertyName, rowName]);
58
+ const pathToDataToSet = [
59
+ ...pathToModifiedDataCollectionType,
60
+ actionId,
61
+ 'properties',
62
+ propertyName,
63
+ rowName,
64
+ ];
65
+
66
+ if (!isObject(objValue)) {
67
+ set(nextModifiedDataState, pathToDataToSet, value);
68
+ } else {
69
+ const updatedValue = updateValues(objValue, value);
70
+
71
+ set(nextModifiedDataState, pathToDataToSet, updatedValue);
72
+ }
73
+ }
74
+ });
75
+
76
+ // When we uncheck a row, we need to check if we also need to disable the conditions
77
+ if (!value) {
78
+ nextModifiedDataState = updateConditionsToFalse(nextModifiedDataState);
79
+ }
80
+
81
+ set(draftState, 'modifiedData', nextModifiedDataState);
82
+
83
+ break;
84
+ }
85
+ case 'ON_CHANGE_CONDITIONS': {
86
+ Object.entries(action.conditions).forEach(array => {
87
+ const [stringPathToData, conditionsToUpdate] = array;
88
+
89
+ set(
90
+ draftState,
91
+ ['modifiedData', ...stringPathToData.split('..'), 'conditions'],
92
+ conditionsToUpdate
93
+ );
94
+ });
95
+
96
+ break;
97
+ }
98
+ case 'ON_CHANGE_SIMPLE_CHECKBOX': {
99
+ let nextModifiedDataState = cloneDeep(state.modifiedData);
100
+
101
+ set(nextModifiedDataState, [...action.keys.split('..')], action.value);
102
+
103
+ // When we uncheck a single checkbox we need to remove the conditions from the parent
104
+ if (!action.value) {
105
+ nextModifiedDataState = updateConditionsToFalse(nextModifiedDataState);
106
+ }
107
+
108
+ set(draftState, 'modifiedData', nextModifiedDataState);
109
+
110
+ break;
111
+ }
112
+ /*
113
+ * Here the idea is to retrieve a specific value of the modifiedObject
114
+ * then update all the boolean values of the retrieved one
115
+ * and update the drafState.
116
+ *
117
+ * For instance in order to enable create action for all the fields and locales
118
+ * of the restaurant content type we need to :
119
+ * 1. Retrieve the modifiedData.collectionTypes.restaurant.create object
120
+ * 2. Toggle all the end boolean values to the desired one
121
+ * 3. Update the draftState
122
+ *
123
+ * Since the case works well in order to update what we called "parent" checkbox. We can
124
+ * reuse the action when we need to toggle change all the values that depends on this one.
125
+ * A parent checkbox is a checkbox which value is not a boolean but depends on its children ones, therefore,
126
+ * a parent checkbox does not have a represented value in the draftState, they are just helpers.
127
+ *
128
+ * Given the following data:
129
+ *
130
+ * const data = {
131
+ * restaurant: {
132
+ * create: {
133
+ * fields: { name: true },
134
+ * locales: { en: false }
135
+ * }
136
+ * }
137
+ * }
138
+ *
139
+ * The value of the create checkbox for the restaurant will be ƒalse since not all its children have
140
+ * truthy values and in order to set its value to true when need to have all the values of its children set to true.
141
+ *
142
+ * Similarly, we can reuse the logic for the components attributes
143
+ *
144
+ */
145
+ case 'ON_CHANGE_TOGGLE_PARENT_CHECKBOX': {
146
+ const { keys, value } = action;
147
+ const pathToValue = [...keys.split('..')];
148
+ let nextModifiedDataState = cloneDeep(state.modifiedData);
149
+ const oldValues = get(nextModifiedDataState, pathToValue, {});
150
+
151
+ const updatedValues = updateValues(oldValues, value);
152
+ set(nextModifiedDataState, pathToValue, updatedValues);
153
+
154
+ // When we uncheck a parent checkbox we need to remove the associated conditions
155
+ if (!value) {
156
+ nextModifiedDataState = updateConditionsToFalse(nextModifiedDataState);
157
+ }
158
+
159
+ set(draftState, ['modifiedData'], nextModifiedDataState);
160
+
161
+ break;
162
+ }
163
+ case 'RESET_FORM': {
164
+ draftState.modifiedData = state.initialData;
165
+ break;
166
+ }
167
+ case 'SET_FORM_AFTER_SUBMIT': {
168
+ draftState.initialData = state.modifiedData;
169
+ break;
170
+ }
171
+ default:
172
+ return draftState;
173
+ }
174
+ });
175
+
176
+ export default reducer;
177
+ export { initialState };
@@ -0,0 +1,178 @@
1
+ import { merge, get, isEmpty, set } from 'lodash';
2
+ import findMatchingPermission from './findMatchingPermissions';
3
+ /**
4
+ * Creates the default condition form: { [conditionId]: false }
5
+ * @param {object} conditions.id Id of the condition
6
+ * @returns {object}
7
+ */
8
+ const createDefaultConditionsForm = (conditions, initialConditions = []) =>
9
+ conditions.reduce((acc, current) => {
10
+ acc[current.id] = initialConditions.indexOf(current.id) !== -1;
11
+
12
+ return acc;
13
+ }, {});
14
+
15
+ /**
16
+ * Create the default form a property (fields, locales) with all the values
17
+ * set to false
18
+ * @param {object} property.children ex: {children: [{value: 'foo',}]}
19
+ * @param {array<string>} The found property values retrieved from the role associated permissions
20
+ * @returns {object} ex: { foo: false }
21
+ *
22
+ */
23
+ const createDefaultPropertyForms = ({ children }, propertyValues, prefix = '') => {
24
+ return children.reduce((acc, current) => {
25
+ if (current.children) {
26
+ return {
27
+ ...acc,
28
+ [current.value]: createDefaultPropertyForms(
29
+ current,
30
+ propertyValues,
31
+ `${prefix}${current.value}.`
32
+ ),
33
+ };
34
+ }
35
+
36
+ const hasProperty = propertyValues.indexOf(`${prefix}${current.value}`) !== -1;
37
+
38
+ acc[current.value] = hasProperty;
39
+
40
+ return acc;
41
+ }, {});
42
+ };
43
+
44
+ /**
45
+ * Creates the default form for all the properties found in a content type's layout
46
+ * @param {array<string>} propertiesArray ex; ['fields', 'locales']
47
+ * @param {object} ctLayout layout of the content type ex:
48
+ * ctLayout = {
49
+ * properties: [{
50
+ * value: 'fields',
51
+ * children: [{value: 'name'}]
52
+ * }
53
+ * }
54
+ * @returns {object} In this case it will return { fields: { name: false } }
55
+ */
56
+ const createDefaultPropertiesForm = (propertiesArray, ctLayout, matchingPermission) => {
57
+ return propertiesArray.reduce(
58
+ (acc, currentPropertyName) => {
59
+ const foundProperty = ctLayout.properties.find(({ value }) => value === currentPropertyName);
60
+
61
+ if (foundProperty) {
62
+ const matchingPermissionPropertyValues = get(
63
+ matchingPermission,
64
+ ['properties', foundProperty.value],
65
+ []
66
+ );
67
+ const propertyForm = createDefaultPropertyForms(
68
+ foundProperty,
69
+ matchingPermissionPropertyValues
70
+ );
71
+
72
+ acc.properties[currentPropertyName] = propertyForm;
73
+ }
74
+
75
+ return acc;
76
+ },
77
+ { properties: {} }
78
+ );
79
+ };
80
+
81
+ /**
82
+ * Return an object of content types layout of an action's subject ex: { adress: {uid, label, properties } }
83
+ * @param {array<object>} allLayouts All the content types' layout
84
+ * @param {object} subjects
85
+ */
86
+ const findLayouts = (allLayouts, subjects) => {
87
+ return subjects.reduce((acc, current) => {
88
+ const foundLayout = allLayouts.find(({ uid }) => uid === current) || null;
89
+
90
+ if (foundLayout) {
91
+ acc[current] = foundLayout;
92
+ }
93
+
94
+ return acc;
95
+ }, {});
96
+ };
97
+
98
+ /**
99
+ * Creates the default for for a content type
100
+ * @param {object} layout.subjects All the content types to display
101
+ * @param {array<object>} actionArray An action has the following shape:
102
+ * action = {label: 'string', actionId: 'string', subjects: [object], applyToProperties: ['string]}
103
+ * @param {array<object>} conditionArray Ex: { id: 'string', category: 'string' }
104
+ * @returns {object} Ex:
105
+ * {
106
+ * ctUId: {
107
+ * [actionId]: {
108
+ * [propertyName]: { enabled: false, conditions: { [id]: false } }
109
+ * }
110
+ * }
111
+ * }
112
+ */
113
+ const createDefaultCTFormFromLayout = (
114
+ { subjects },
115
+ actionArray,
116
+ conditionArray,
117
+ initialPermissions = []
118
+ ) => {
119
+ return actionArray.reduce((defaultForm, current) => {
120
+ const actionSubjects = current.subjects;
121
+
122
+ const subjectLayouts = findLayouts(subjects, actionSubjects);
123
+
124
+ // This can happen when an action is not related to a content type
125
+ // for instance the D&P permission is applied only with the cts that
126
+ // have the D&P features enabled
127
+ if (isEmpty(subjectLayouts)) {
128
+ return defaultForm;
129
+ }
130
+
131
+ // The object has the following shape: { [ctUID]: { [actionId]: { [property]: { enabled: false } } } }
132
+ const contentTypesActions = Object.keys(subjectLayouts).reduce((acc, currentCTUID) => {
133
+ const { actionId, applyToProperties } = current;
134
+ const currentSubjectLayout = subjectLayouts[currentCTUID];
135
+ const properties = currentSubjectLayout.properties.map(({ value }) => value);
136
+ const doesNothaveProperty = properties.every(
137
+ property => (applyToProperties || []).indexOf(property) === -1
138
+ );
139
+
140
+ const matchingPermission = findMatchingPermission(initialPermissions, actionId, currentCTUID);
141
+ const conditionsForm = createDefaultConditionsForm(
142
+ conditionArray,
143
+ get(matchingPermission, 'conditions', [])
144
+ );
145
+
146
+ if (isEmpty(applyToProperties) || doesNothaveProperty) {
147
+ set(acc, [currentCTUID, actionId], {
148
+ properties: {
149
+ enabled: matchingPermission !== undefined,
150
+ },
151
+ conditions: conditionsForm,
152
+ });
153
+
154
+ return acc;
155
+ }
156
+
157
+ const propertiesForm = createDefaultPropertiesForm(
158
+ applyToProperties,
159
+ subjectLayouts[currentCTUID],
160
+ matchingPermission
161
+ );
162
+
163
+ set(acc, [currentCTUID, actionId], { ...propertiesForm, conditions: conditionsForm });
164
+
165
+ return acc;
166
+ }, {});
167
+
168
+ return merge(defaultForm, contentTypesActions);
169
+ }, {});
170
+ };
171
+
172
+ export default createDefaultCTFormFromLayout;
173
+ export {
174
+ createDefaultConditionsForm,
175
+ createDefaultPropertyForms,
176
+ createDefaultPropertiesForm,
177
+ findLayouts,
178
+ };
@@ -0,0 +1,49 @@
1
+ import { get } from 'lodash';
2
+ import { createDefaultConditionsForm } from './createDefaultCTFormFromLayout';
3
+ import findMatchingPermission from './findMatchingPermissions';
4
+
5
+ const createSubCategoryForm = (actions, conditions, permissions) => {
6
+ return actions.reduce((acc, current) => {
7
+ const foundMatchingPermission = findMatchingPermission(permissions, current.action, null);
8
+
9
+ acc[current.action] = {
10
+ properties: {
11
+ enabled: foundMatchingPermission !== undefined,
12
+ },
13
+ conditions: createDefaultConditionsForm(
14
+ conditions,
15
+ get(foundMatchingPermission, 'conditions', [])
16
+ ),
17
+ };
18
+
19
+ return acc;
20
+ }, {});
21
+ };
22
+
23
+ const createChildrenDefaultForm = (childrenForm, conditions, initialPermissions) => {
24
+ return childrenForm.reduce((acc, current) => {
25
+ acc[current.subCategoryId] = createSubCategoryForm(
26
+ current.actions,
27
+ conditions,
28
+ initialPermissions
29
+ );
30
+
31
+ return acc;
32
+ }, {});
33
+ };
34
+
35
+ const createDefaultPluginsFormFromLayout = (pluginsLayout, conditions, initialPermissions = []) => {
36
+ return pluginsLayout.reduce((acc, { categoryId, childrenForm }) => {
37
+ const childrenDefaultForm = createChildrenDefaultForm(
38
+ childrenForm,
39
+ conditions,
40
+ initialPermissions
41
+ );
42
+ acc[categoryId] = childrenDefaultForm;
43
+
44
+ return acc;
45
+ }, {});
46
+ };
47
+
48
+ export default createDefaultPluginsFormFromLayout;
49
+ export { createSubCategoryForm, createChildrenDefaultForm };
@@ -0,0 +1,4 @@
1
+ const findMatchingPermission = (permissions, action, subject) =>
2
+ permissions.find(perm => perm.action === action && perm.subject === subject);
3
+
4
+ export default findMatchingPermission;
@@ -0,0 +1,122 @@
1
+ import { has, isObject } from 'lodash';
2
+ import { createArrayOfValues } from '../../utils';
3
+ import { createConditionsArray } from './formatSettingsPermissionsToAPI';
4
+
5
+ /**
6
+ * Returns an array of property values
7
+ * @param {object} propertyValue
8
+ * @param {string} prefix
9
+ * @returns {array<string>}
10
+ */
11
+ const createPropertyArray = (propertyValue, prefix = '') => {
12
+ return Object.entries(propertyValue).reduce((acc, current) => {
13
+ const [name, value] = current;
14
+
15
+ if (isObject(value)) {
16
+ return [...acc, ...createPropertyArray(value, `${prefix}${name}.`)];
17
+ }
18
+
19
+ if (value && !isObject(value)) {
20
+ acc.push(`${prefix}${name}`);
21
+ }
22
+
23
+ return acc;
24
+ }, []);
25
+ };
26
+
27
+ /**
28
+ *
29
+ * @param {string} action
30
+ * @param {string} subject
31
+ * @param {object} param2
32
+ * @config {object} conditions
33
+ * @config {object} the name of the properties array we need to fill
34
+ * @returns {object}
35
+ */
36
+ const createPermissionWithProperties = (action, subject, { conditions, properties }) => {
37
+ return Object.entries(properties).reduce(
38
+ (acc, current) => {
39
+ const [propertyName, propertyValue] = current;
40
+
41
+ acc.properties[propertyName] = createPropertyArray(propertyValue);
42
+
43
+ return acc;
44
+ },
45
+ { action, subject, conditions: createConditionsArray(conditions), properties: {} }
46
+ );
47
+ };
48
+
49
+ /**
50
+ *
51
+ * @param {string} action The name of the action
52
+ * @param {string} subject The name of the subject
53
+ * @param {object} param2
54
+ * @returns {object}
55
+ */
56
+ const createPermissionWithoutProperties = (action, subject, { conditions }) => {
57
+ return {
58
+ action,
59
+ subject,
60
+ properties: {},
61
+ conditions: createConditionsArray(conditions),
62
+ };
63
+ };
64
+
65
+ /**
66
+ *
67
+ * @param {string} subject The name of the subject
68
+ * @param {object} actions The subject's actions
69
+ * @returns {array<object>}
70
+ */
71
+ const createSubjectPermissions = (subject, actions) => {
72
+ const permissions = Object.entries(actions).reduce((acc, current) => {
73
+ const [actionName, permissions] = current;
74
+ const shouldCreatePermission = createArrayOfValues(permissions).some(val => val);
75
+
76
+ if (!shouldCreatePermission) {
77
+ return acc;
78
+ }
79
+
80
+ if (!has(permissions, 'properties.enabled')) {
81
+ const createdPermissionsArray = createPermissionWithProperties(
82
+ actionName,
83
+ subject,
84
+ permissions
85
+ );
86
+
87
+ return [...acc, createdPermissionsArray];
88
+ }
89
+
90
+ if (!permissions.properties.enabled) {
91
+ return acc;
92
+ }
93
+
94
+ const permission = createPermissionWithoutProperties(actionName, subject, permissions);
95
+
96
+ acc.push(permission);
97
+
98
+ return acc;
99
+ }, []);
100
+
101
+ return permissions;
102
+ };
103
+
104
+ /**
105
+ *
106
+ * @param {object} contentTypesPermissions
107
+ * @returns {array<object>}
108
+ */
109
+ const formatContentTypesPermissionToAPI = contentTypesPermissions => {
110
+ const permissions = Object.entries(contentTypesPermissions).reduce((allPermissions, current) => {
111
+ const [subject, currentSubjectActions] = current;
112
+
113
+ const permissions = createSubjectPermissions(subject, currentSubjectActions);
114
+
115
+ return [...allPermissions, ...permissions];
116
+ }, []);
117
+
118
+ return permissions;
119
+ };
120
+
121
+ export default formatContentTypesPermissionToAPI;
122
+ export { createPropertyArray, createPermissionWithProperties };
@@ -0,0 +1,23 @@
1
+ import { chain } from 'lodash';
2
+
3
+ const replaceName = name => name.split(' ').join('-');
4
+
5
+ const formatLayout = (layout, groupByKey) => {
6
+ return chain(layout)
7
+ .groupBy(groupByKey)
8
+ .map((item, itemName) => ({
9
+ category: itemName,
10
+ categoryId: replaceName(itemName),
11
+ childrenForm: chain(item)
12
+ .groupBy('subCategory')
13
+ .map((actions, subCategoryName) => ({
14
+ subCategoryName,
15
+ subCategoryId: replaceName(subCategoryName),
16
+ actions,
17
+ }))
18
+ .value(),
19
+ }))
20
+ .value();
21
+ };
22
+
23
+ export default formatLayout;
@@ -0,0 +1,21 @@
1
+ import formatContentTypesPermissionToAPI from './formatContentTypesPermissionToAPI';
2
+ import formatSettingsPermissionsToAPI from './formatSettingsPermissionsToAPI';
3
+
4
+ const formatPermissionsToAPI = modifiedData => {
5
+ const pluginsPermissions = formatSettingsPermissionsToAPI(modifiedData.plugins);
6
+ const settingsPermissions = formatSettingsPermissionsToAPI(modifiedData.settings);
7
+ const collectionTypesPermissions = formatContentTypesPermissionToAPI(
8
+ modifiedData.collectionTypes
9
+ );
10
+
11
+ const singleTypesPermissions = formatContentTypesPermissionToAPI(modifiedData.singleTypes);
12
+
13
+ return [
14
+ ...pluginsPermissions,
15
+ ...settingsPermissions,
16
+ ...collectionTypesPermissions,
17
+ ...singleTypesPermissions,
18
+ ];
19
+ };
20
+
21
+ export default formatPermissionsToAPI;
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Returns an array of condition names when a condition is enabled
3
+ * @param {object} conditions
4
+ * @config {boolean}
5
+ */
6
+ const createConditionsArray = conditions => {
7
+ return Object.entries(conditions)
8
+ .filter(([, conditionValue]) => {
9
+ return conditionValue;
10
+ })
11
+ .map(([conditionName]) => conditionName);
12
+ };
13
+
14
+ const createPermission = array => {
15
+ const [actionName, { conditions }] = array;
16
+
17
+ return {
18
+ action: actionName,
19
+ subject: null,
20
+ conditions: createConditionsArray(conditions),
21
+ properties: {},
22
+ };
23
+ };
24
+
25
+ const createPermissionsArrayFromCategory = categoryPermissions => {
26
+ return Object.values(categoryPermissions).reduce((acc, current) => {
27
+ const permissions = Object.entries(current).reduce((acc1, current1) => {
28
+ const [
29
+ ,
30
+ {
31
+ properties: { enabled },
32
+ },
33
+ ] = current1;
34
+
35
+ if (!enabled) {
36
+ return acc1;
37
+ }
38
+
39
+ const permission = createPermission(current1);
40
+
41
+ acc1.push(permission);
42
+
43
+ return acc1;
44
+ }, []);
45
+
46
+ return [...acc, ...permissions];
47
+ }, []);
48
+ };
49
+
50
+ const formatSettingsPermissionsToAPI = settingsPermissionsObject => {
51
+ return Object.values(settingsPermissionsObject).reduce((acc, current) => {
52
+ const currentCategoryPermissions = createPermissionsArrayFromCategory(current);
53
+
54
+ return [...acc, ...currentCategoryPermissions];
55
+ }, []);
56
+ };
57
+
58
+ export default formatSettingsPermissionsToAPI;
59
+ export { createConditionsArray, createPermission, createPermissionsArrayFromCategory };