@strapi/admin 4.12.0 → 4.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. package/admin/src/components/LeftMenu/index.js +1 -1
  2. package/admin/src/components/PluginsInitializer/index.js +23 -0
  3. package/admin/src/content-manager/components/CollectionTypeFormWrapper/index.js +9 -14
  4. package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/cleanData.js +1 -1
  5. package/admin/src/content-manager/components/InputUID/index.js +2 -3
  6. package/admin/src/content-manager/components/RelationInput/RelationInput.js +1 -1
  7. package/admin/src/content-manager/components/RelationInputDataManager/utils/getRelationLink.js +1 -3
  8. package/admin/src/content-manager/components/RelationInputDataManager/utils/select.js +4 -6
  9. package/admin/src/content-manager/components/SingleTypeFormWrapper/index.js +7 -9
  10. package/admin/src/content-manager/pages/App/utils/getContentTypeLinks.js +1 -3
  11. package/admin/src/content-manager/pages/EditSettingsView/index.js +31 -18
  12. package/admin/src/content-manager/pages/ListSettingsView/components/EditFieldForm.js +1 -3
  13. package/admin/src/content-manager/pages/ListSettingsView/components/Settings.js +1 -3
  14. package/admin/src/content-manager/pages/ListSettingsView/components/SortDisplayedFields.js +14 -32
  15. package/admin/src/content-manager/pages/ListSettingsView/index.js +50 -40
  16. package/admin/src/content-manager/pages/ListView/components/CellContent/RelationMultiple/index.js +2 -2
  17. package/admin/src/content-manager/pages/ListView/index.js +3 -3
  18. package/admin/src/content-manager/sharedReducers/crudReducer/reducer.js +1 -1
  19. package/admin/src/content-manager/utils/checkIfAttributeIsDisplayable.js +2 -4
  20. package/admin/src/content-manager/utils/index.js +0 -1
  21. package/admin/src/pages/AuthPage/components/Register/index.js +4 -0
  22. package/admin/src/pages/AuthPage/constants.js +2 -2
  23. package/admin/src/translations/ar.json +9 -3
  24. package/admin/src/translations/ca.json +8 -2
  25. package/admin/src/translations/de.json +8 -2
  26. package/admin/src/translations/dk.json +8 -2
  27. package/admin/src/translations/en.json +8 -2
  28. package/admin/src/translations/es.json +9 -3
  29. package/admin/src/translations/eu.json +8 -2
  30. package/admin/src/translations/fr.json +9 -2
  31. package/admin/src/translations/gu.json +8 -2
  32. package/admin/src/translations/hi.json +9 -3
  33. package/admin/src/translations/hu.json +9 -3
  34. package/admin/src/translations/ja.json +12 -6
  35. package/admin/src/translations/ko.json +12 -6
  36. package/admin/src/translations/ml.json +8 -2
  37. package/admin/src/translations/nl.json +8 -2
  38. package/admin/src/translations/pl.json +8 -2
  39. package/admin/src/translations/pt-BR.json +8 -2
  40. package/admin/src/translations/ru.json +8 -2
  41. package/admin/src/translations/sa.json +9 -3
  42. package/admin/src/translations/sk.json +8 -2
  43. package/admin/src/translations/sv.json +7 -2
  44. package/admin/src/translations/tr.json +8 -2
  45. package/admin/src/translations/zh-Hans.json +8 -2
  46. package/admin/src/translations/zh.json +8 -2
  47. package/admin/src/utils/index.js +0 -1
  48. package/build/{1049.758a01f5.chunk.js → 1049.c3d082e9.chunk.js} +1 -1
  49. package/build/1386.879bcd90.chunk.js +7 -0
  50. package/build/{2225.15d1df72.chunk.js → 2225.0e4f8c77.chunk.js} +1 -1
  51. package/build/2379.f1641312.chunk.js +1 -0
  52. package/build/2395.46f8d0c1.chunk.js +26 -0
  53. package/build/2801.5cef5ec8.chunk.js +1 -0
  54. package/build/{3483.e2ee2547.chunk.js → 3483.03c24f96.chunk.js} +1 -1
  55. package/build/3929.5632f24d.chunk.js +114 -0
  56. package/build/4546.cfafae68.chunk.js +1 -0
  57. package/build/6691.4985ef22.chunk.js +105 -0
  58. package/build/7464.3e64a1d5.chunk.js +1 -0
  59. package/build/8276.10a3f883.chunk.js +26 -0
  60. package/build/{9806.aa25371d.chunk.js → 9806.3392505e.chunk.js} +2 -2
  61. package/build/{Admin-authenticatedApp.376233ff.chunk.js → Admin-authenticatedApp.8dfbc48d.chunk.js} +3 -3
  62. package/build/{Admin_profilePage.a968035f.chunk.js → Admin_profilePage.ca82c67b.chunk.js} +1 -1
  63. package/build/{Admin_settingsPage.8c600d1a.chunk.js → Admin_settingsPage.50c867bf.chunk.js} +1 -1
  64. package/build/admin-app.041dcd81.chunk.js +36 -0
  65. package/build/{admin-edit-users.67704088.chunk.js → admin-edit-users.79eeb125.chunk.js} +1 -1
  66. package/build/{admin-users.3279ffb0.chunk.js → admin-users.123aa08e.chunk.js} +1 -1
  67. package/build/ar-json.74e40bc7.chunk.js +1 -0
  68. package/build/{ca-json.a53c10b6.chunk.js → ca-json.fc6001d3.chunk.js} +1 -1
  69. package/build/content-manager.098eb004.chunk.js +1099 -0
  70. package/build/content-type-builder.64f4d6ac.chunk.js +170 -0
  71. package/build/{de-json.b3be02c7.chunk.js → de-json.e72545cf.chunk.js} +1 -1
  72. package/build/dk-json.e77140ef.chunk.js +1 -0
  73. package/build/{en-json.e34140fc.chunk.js → en-json.01456e61.chunk.js} +1 -1
  74. package/build/es-json.b1f2284b.chunk.js +1 -0
  75. package/build/{eu-json.633025f0.chunk.js → eu-json.63d0a898.chunk.js} +1 -1
  76. package/build/{fr-json.aa8839d2.chunk.js → fr-json.33c6428b.chunk.js} +1 -1
  77. package/build/{gu-json.5bd62812.chunk.js → gu-json.7efe8cc2.chunk.js} +1 -1
  78. package/build/{hi-json.9104eb78.chunk.js → hi-json.0d633692.chunk.js} +1 -1
  79. package/build/{hu-json.9f4aae42.chunk.js → hu-json.c74b6a1e.chunk.js} +1 -1
  80. package/build/index.html +1 -1
  81. package/build/{ja-json.91286391.chunk.js → ja-json.e1959a1c.chunk.js} +1 -1
  82. package/build/{ko-json.fcf3ec4b.chunk.js → ko-json.ce5d6d94.chunk.js} +1 -1
  83. package/build/{main.1e3b0985.js → main.1f8cc299.js} +429 -429
  84. package/build/{ml-json.557aa14c.chunk.js → ml-json.940d7ace.chunk.js} +1 -1
  85. package/build/{nl-json.b2b16eea.chunk.js → nl-json.fe38f0fb.chunk.js} +1 -1
  86. package/build/{pl-json.f094a417.chunk.js → pl-json.d55e8e78.chunk.js} +1 -1
  87. package/build/{pt-BR-json.dec7fb01.chunk.js → pt-BR-json.ae0a0d2e.chunk.js} +1 -1
  88. package/build/review-workflows-settings-create-view.cb08cfa2.chunk.js +1 -0
  89. package/build/review-workflows-settings-edit-view.3c7cbe63.chunk.js +1 -0
  90. package/build/review-workflows-settings-list-view.1611dc1f.chunk.js +56 -0
  91. package/build/{ru-json.8193d8c4.chunk.js → ru-json.1c976644.chunk.js} +1 -1
  92. package/build/{runtime~main.58ec8df6.js → runtime~main.80a43c16.js} +2 -2
  93. package/build/{sa-json.a56836f1.chunk.js → sa-json.2c03ef4e.chunk.js} +1 -1
  94. package/build/sk-json.b41847e8.chunk.js +1 -0
  95. package/build/sso-settings-page.81152e62.chunk.js +1 -0
  96. package/build/{sv-json.fd0e86c6.chunk.js → sv-json.568cb7ae.chunk.js} +1 -1
  97. package/build/{tr-json.56c32cf6.chunk.js → tr-json.c9f22432.chunk.js} +1 -1
  98. package/build/transfer-tokens-list-page.692eee77.chunk.js +16 -0
  99. package/build/upload-settings.7f93d4c0.chunk.js +14 -0
  100. package/build/upload.77d8a64c.chunk.js +58 -0
  101. package/build/users-advanced-settings-page.f0760eb8.chunk.js +9 -0
  102. package/build/users-email-settings-page.ff4b32f3.chunk.js +9 -0
  103. package/build/users-providers-settings-page.48de0306.chunk.js +14 -0
  104. package/build/users-roles-settings-page.3f9f063e.chunk.js +30 -0
  105. package/build/{zh-Hans-json.36d81cdc.chunk.js → zh-Hans-json.937b395b.chunk.js} +1 -1
  106. package/build/{zh-json.1cc86ff0.chunk.js → zh-json.bfc2e036.chunk.js} +1 -1
  107. package/ee/admin/hooks/useAuthProviders/index.js +1 -3
  108. package/ee/admin/pages/AuthResponse/index.js +1 -3
  109. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/Stage/Stage.js +35 -32
  110. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/CreateView/CreateView.js +1 -7
  111. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/EditView/EditView.js +16 -14
  112. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/ListView/ListView.js +32 -31
  113. package/ee/admin/pages/SettingsPage/pages/SingleSignOn/index.js +1 -2
  114. package/ee/server/config/admin-actions.js +6 -6
  115. package/ee/server/services/review-workflows/entity-service-decorator.js +4 -3
  116. package/package.json +16 -16
  117. package/server/middlewares/rateLimit.js +6 -2
  118. package/server/services/transfer/token.js +27 -4
  119. package/server/validation/authentication/register.js +2 -2
  120. package/admin/src/content-manager/components/SingleTypeFormWrapper/utils/getRequestUrl.js +0 -5
  121. package/admin/src/content-manager/components/SingleTypeFormWrapper/utils/index.js +0 -2
  122. package/admin/src/content-manager/pages/EditSettingsView/utils/api.js +0 -16
  123. package/admin/src/content-manager/pages/ListSettingsView/init.js +0 -9
  124. package/admin/src/content-manager/utils/getRequestUrl.js +0 -4
  125. package/admin/src/utils/getRequestUrl.js +0 -3
  126. package/build/1386.762d6eb8.chunk.js +0 -7
  127. package/build/2379.0ca87a89.chunk.js +0 -1
  128. package/build/2395.df7a044a.chunk.js +0 -26
  129. package/build/2801.b1140c9b.chunk.js +0 -1
  130. package/build/4546.ff9fdf30.chunk.js +0 -1
  131. package/build/6691.f880a0b6.chunk.js +0 -105
  132. package/build/7065.ec811562.chunk.js +0 -114
  133. package/build/7464.8a6c1e6c.chunk.js +0 -1
  134. package/build/8276.6c7b8e6e.chunk.js +0 -26
  135. package/build/admin-app.1c3f7fd6.chunk.js +0 -36
  136. package/build/ar-json.f530bc3f.chunk.js +0 -1
  137. package/build/content-manager.e9205db1.chunk.js +0 -1103
  138. package/build/content-type-builder.40534de5.chunk.js +0 -170
  139. package/build/dk-json.842aa391.chunk.js +0 -1
  140. package/build/es-json.f57b5335.chunk.js +0 -1
  141. package/build/review-workflows-settings-create-view.05758184.chunk.js +0 -1
  142. package/build/review-workflows-settings-edit-view.c33f7c58.chunk.js +0 -1
  143. package/build/review-workflows-settings-list-view.f055e1be.chunk.js +0 -56
  144. package/build/sk-json.bf2f057a.chunk.js +0 -1
  145. package/build/sso-settings-page.7c9b2fd9.chunk.js +0 -1
  146. package/build/transfer-tokens-list-page.22147d2c.chunk.js +0 -16
  147. package/build/upload-settings.cac210a0.chunk.js +0 -14
  148. package/build/upload.cbfeefa5.chunk.js +0 -58
  149. package/build/users-advanced-settings-page.18379a56.chunk.js +0 -9
  150. package/build/users-email-settings-page.a87978e5.chunk.js +0 -9
  151. package/build/users-providers-settings-page.8876c1ee.chunk.js +0 -14
  152. package/build/users-roles-settings-page.0431f48c.chunk.js +0 -30
@@ -169,38 +169,39 @@ export function ReviewWorkflowsListView() {
169
169
  <>
170
170
  <Layout.Header
171
171
  primaryAction={
172
- <LinkButton
173
- disabled={!canCreate}
174
- startIcon={<Plus />}
175
- size="S"
176
- to="/settings/review-workflows/create"
177
- onClick={(event) => {
178
- /**
179
- * If the current license has a workflow limit:
180
- * check if the total count of workflows exceeds that limit. If so,
181
- * prevent the navigation and show the limits overlay.
182
- *
183
- * If the current license does not have a limit (e.g. offline license):
184
- * allow the user to navigate to the create-view. In case they exceed the
185
- * current hard-limit of 200 they will see an error thrown by the API.
186
- */
172
+ canCreate && (
173
+ <LinkButton
174
+ startIcon={<Plus />}
175
+ size="S"
176
+ to="/settings/review-workflows/create"
177
+ onClick={(event) => {
178
+ /**
179
+ * If the current license has a workflow limit:
180
+ * check if the total count of workflows exceeds that limit. If so,
181
+ * prevent the navigation and show the limits overlay.
182
+ *
183
+ * If the current license does not have a limit (e.g. offline license):
184
+ * allow the user to navigate to the create-view. In case they exceed the
185
+ * current hard-limit of 200 they will see an error thrown by the API.
186
+ */
187
187
 
188
- if (
189
- limits?.[CHARGEBEE_WORKFLOW_ENTITLEMENT_NAME] &&
190
- meta?.workflowCount >= parseInt(limits[CHARGEBEE_WORKFLOW_ENTITLEMENT_NAME], 10)
191
- ) {
192
- event.preventDefault();
193
- setShowLimitModal(true);
194
- } else {
195
- trackUsage('willCreateWorkflow');
196
- }
197
- }}
198
- >
199
- {formatMessage({
200
- id: 'Settings.review-workflows.list.page.create',
201
- defaultMessage: 'Create new workflow',
202
- })}
203
- </LinkButton>
188
+ if (
189
+ limits?.[CHARGEBEE_WORKFLOW_ENTITLEMENT_NAME] &&
190
+ meta?.workflowCount >= parseInt(limits[CHARGEBEE_WORKFLOW_ENTITLEMENT_NAME], 10)
191
+ ) {
192
+ event.preventDefault();
193
+ setShowLimitModal(true);
194
+ } else {
195
+ trackUsage('willCreateWorkflow');
196
+ }
197
+ }}
198
+ >
199
+ {formatMessage({
200
+ id: 'Settings.review-workflows.list.page.create',
201
+ defaultMessage: 'Create new workflow',
202
+ })}
203
+ </LinkButton>
204
+ )
204
205
  }
205
206
  subtitle={formatMessage({
206
207
  id: 'Settings.review-workflows.list.page.subtitle',
@@ -30,7 +30,6 @@ import { useSelector } from 'react-redux';
30
30
 
31
31
  import { useRolesList, useSettingsForm } from '../../../../../../admin/src/hooks';
32
32
  import { selectAdminPermissions } from '../../../../../../admin/src/pages/App/selectors';
33
- import { getRequestUrl } from '../../../../../../admin/src/utils';
34
33
 
35
34
  import schema from './utils/schema';
36
35
 
@@ -51,7 +50,7 @@ export const SingleSignOn = () => {
51
50
  // eslint-disable-next-line no-unused-vars
52
51
  dispatch,
53
52
  { handleChange, handleSubmit },
54
- ] = useSettingsForm(getRequestUrl('providers/options'), schema, () => {}, [
53
+ ] = useSettingsForm('/admin/providers/options', schema, () => {}, [
55
54
  'autoRegister',
56
55
  'defaultRole',
57
56
  'ssoLockedRoles',
@@ -39,24 +39,24 @@ module.exports = {
39
39
  subCategory: 'options',
40
40
  },
41
41
  {
42
- uid: 'review-workflows.update',
43
- displayName: 'Update',
42
+ uid: 'review-workflows.read',
43
+ displayName: 'Read',
44
44
  pluginName: 'admin',
45
45
  section: 'settings',
46
46
  category: 'review workflows',
47
47
  subCategory: 'options',
48
48
  },
49
49
  {
50
- uid: 'review-workflows.delete',
51
- displayName: 'Delete',
50
+ uid: 'review-workflows.update',
51
+ displayName: 'Update',
52
52
  pluginName: 'admin',
53
53
  section: 'settings',
54
54
  category: 'review workflows',
55
55
  subCategory: 'options',
56
56
  },
57
57
  {
58
- uid: 'review-workflows.read',
59
- displayName: 'Read',
58
+ uid: 'review-workflows.delete',
59
+ displayName: 'Delete',
60
60
  pluginName: 'admin',
61
61
  section: 'settings',
62
62
  category: 'review workflows',
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const { isNil, isNull } = require('lodash/fp');
3
+ const { isNil } = require('lodash/fp');
4
4
  const { ENTITY_STAGE_ATTRIBUTE } = require('../../constants/workflows');
5
5
  const { WORKFLOW_UPDATE_STAGE } = require('../../constants/webhookEvents');
6
6
  const { getService } = require('../../utils');
@@ -56,7 +56,7 @@ const decorator = (service) => ({
56
56
  async update(uid, entityId, opts = {}) {
57
57
  // Prevents the stage from being set to null
58
58
  const data = { ...opts.data };
59
- if (isNull(data[ENTITY_STAGE_ATTRIBUTE])) {
59
+ if (isNil(data[ENTITY_STAGE_ATTRIBUTE])) {
60
60
  delete data[ENTITY_STAGE_ATTRIBUTE];
61
61
  return service.update.call(this, uid, entityId, { ...opts, data });
62
62
  }
@@ -66,7 +66,8 @@ const decorator = (service) => ({
66
66
  const updatedEntity = await service.update.call(this, uid, entityId, { ...opts, data });
67
67
  const updatedStage = updatedEntity[ENTITY_STAGE_ATTRIBUTE];
68
68
 
69
- if (previousStage?.id && previousStage.id !== updatedStage.id) {
69
+ // Stage might be null if field is not populated
70
+ if (updatedStage && previousStage?.id && previousStage.id !== updatedStage.id) {
70
71
  const model = strapi.getModel(uid);
71
72
 
72
73
  strapi.eventHub.emit(WORKFLOW_UPDATE_STAGE, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/admin",
3
- "version": "4.12.0",
3
+ "version": "4.12.1",
4
4
  "description": "Strapi Admin",
5
5
  "repository": {
6
6
  "type": "git",
@@ -42,31 +42,31 @@
42
42
  "dependencies": {
43
43
  "@casl/ability": "^5.4.3",
44
44
  "@pmmmwh/react-refresh-webpack-plugin": "0.5.10",
45
- "@strapi/data-transfer": "4.12.0",
45
+ "@strapi/data-transfer": "4.12.1",
46
46
  "@strapi/design-system": "1.8.2",
47
- "@strapi/helper-plugin": "4.12.0",
47
+ "@strapi/helper-plugin": "4.12.1",
48
48
  "@strapi/icons": "1.8.2",
49
- "@strapi/permissions": "4.12.0",
50
- "@strapi/provider-audit-logs-local": "4.12.0",
51
- "@strapi/typescript-utils": "4.12.0",
52
- "@strapi/utils": "4.12.0",
49
+ "@strapi/permissions": "4.12.1",
50
+ "@strapi/provider-audit-logs-local": "4.12.1",
51
+ "@strapi/typescript-utils": "4.12.1",
52
+ "@strapi/utils": "4.12.1",
53
53
  "axios": "1.4.0",
54
54
  "bcryptjs": "2.4.3",
55
55
  "browserslist": "^4.17.3",
56
56
  "browserslist-to-esbuild": "1.2.0",
57
57
  "chalk": "^4.1.2",
58
- "chokidar": "^3.5.1",
58
+ "chokidar": "3.5.3",
59
59
  "codemirror5": "npm:codemirror@^5.65.11",
60
60
  "cross-env": "^7.0.3",
61
61
  "css-loader": "^6.8.1",
62
62
  "date-fns": "2.30.0",
63
- "dotenv": "8.5.1",
63
+ "dotenv": "14.2.0",
64
64
  "esbuild-loader": "^2.21.0",
65
- "execa": "^1.0.0",
65
+ "execa": "5.1.1",
66
66
  "fast-deep-equal": "3.1.3",
67
67
  "find-root": "1.1.0",
68
68
  "fork-ts-checker-webpack-plugin": "7.3.0",
69
- "formik": "^2.4.0",
69
+ "formik": "2.4.0",
70
70
  "fractional-indexing": "3.2.0",
71
71
  "fs-extra": "10.0.0",
72
72
  "highlight.js": "^10.4.1",
@@ -114,10 +114,10 @@
114
114
  "react-select": "5.7.0",
115
115
  "react-window": "1.8.8",
116
116
  "redux": "^4.2.1",
117
- "reselect": "^4.1.7",
117
+ "reselect": "4.1.7",
118
118
  "rimraf": "3.0.2",
119
119
  "sanitize-html": "2.11.0",
120
- "semver": "7.5.2",
120
+ "semver": "7.5.4",
121
121
  "sift": "16.0.1",
122
122
  "style-loader": "3.3.1",
123
123
  "styled-components": "5.3.3",
@@ -126,7 +126,7 @@
126
126
  "webpack-cli": "^5.1.0",
127
127
  "webpack-dev-server": "^4.15.0",
128
128
  "webpackbar": "^5.0.2",
129
- "yup": "^0.32.9"
129
+ "yup": "0.32.9"
130
130
  },
131
131
  "devDependencies": {
132
132
  "@testing-library/dom": "9.2.0",
@@ -142,7 +142,7 @@
142
142
  "@strapi/strapi": "^4.3.4"
143
143
  },
144
144
  "engines": {
145
- "node": ">=14.19.1 <=18.x.x",
145
+ "node": ">=16.0.0 <=20.x.x",
146
146
  "npm": ">=6.0.0"
147
147
  },
148
148
  "nx": {
@@ -154,5 +154,5 @@
154
154
  }
155
155
  }
156
156
  },
157
- "gitHead": "7f8109a1a736c1d997fbb445469b3b59550c7aeb"
157
+ "gitHead": "be8985fa20cb357981bca97bc65ee5c1b843f801"
158
158
  }
@@ -1,7 +1,8 @@
1
1
  'use strict';
2
2
 
3
+ const path = require('path');
3
4
  const utils = require('@strapi/utils');
4
- const { has, toLower } = require('lodash/fp');
5
+ const { isString, has, toLower } = require('lodash/fp');
5
6
 
6
7
  const { RateLimitError } = utils.errors;
7
8
 
@@ -24,11 +25,14 @@ module.exports =
24
25
  const rateLimit = require('koa2-ratelimit').RateLimit;
25
26
 
26
27
  const userEmail = toLower(ctx.request.body.email) || 'unknownEmail';
28
+ const requestPath = isString(ctx.request.path)
29
+ ? toLower(path.normalize(ctx.request.path)).replace(/\/$/, '')
30
+ : 'invalidPath';
27
31
 
28
32
  const loadConfig = {
29
33
  interval: { min: 5 },
30
34
  max: 5,
31
- prefixKey: `${userEmail}:${ctx.request.path}:${ctx.request.ip}`,
35
+ prefixKey: `${userEmail}:${requestPath}:${ctx.request.ip}`,
32
36
  handler() {
33
37
  throw new RateLimitError();
34
38
  },
@@ -1,7 +1,8 @@
1
1
  'use strict';
2
2
 
3
- const { map, isArray, omit, uniq, isNil, difference, isEmpty } = require('lodash/fp');
4
3
  const crypto = require('crypto');
4
+ const assert = require('assert');
5
+ const { map, isArray, omit, uniq, isNil, difference, isEmpty } = require('lodash/fp');
5
6
 
6
7
  const {
7
8
  errors: { ValidationError, NotFoundError },
@@ -65,6 +66,24 @@ const list = async () => {
65
66
  return tokens.map((token) => flattenTokenPermissions(token));
66
67
  };
67
68
 
69
+ /**
70
+ * Create a random token's access key
71
+ * @returns {string}
72
+ */
73
+ const generateRandomAccessKey = () => crypto.randomBytes(128).toString('hex');
74
+
75
+ /**
76
+ * Validate the given access key's format and returns it if valid
77
+ * @param {string} accessKey
78
+ * @return {string}
79
+ */
80
+ const validateAccessKey = (accessKey) => {
81
+ assert(typeof accessKey === 'string', 'Access key needs to be a string');
82
+ assert(accessKey.length >= 15, 'Access key needs to have at least 15 characters');
83
+
84
+ return accessKey;
85
+ };
86
+
68
87
  /**
69
88
  * Create a token and its permissions
70
89
  *
@@ -73,11 +92,16 @@ const list = async () => {
73
92
  * @param {string} attributes.description
74
93
  * @param {number} attributes.lifespan
75
94
  * @param {string[]} attributes.permissions
95
+ * @param {string} [attributes.accessKey]
76
96
  *
77
97
  * @returns {Promise<TransferToken>}
78
98
  */
79
99
  const create = async (attributes) => {
80
- const accessKey = crypto.randomBytes(128).toString('hex');
100
+ const accessKey =
101
+ 'accessKey' in attributes ? validateAccessKey(attributes.accessKey) : generateRandomAccessKey();
102
+
103
+ // Make sure the access key isn't picked up directly from the attributes for the next steps
104
+ delete attributes.accessKey;
81
105
 
82
106
  assertTokenPermissionsValidity(attributes);
83
107
  assertValidLifespan(attributes);
@@ -380,8 +404,7 @@ const flattenTokenPermissions = (token) => {
380
404
 
381
405
  /**
382
406
  * Assert that a token's permissions are valid
383
- *
384
- * @param {TransferToken} token
407
+ * @param {object} attributes
385
408
  */
386
409
  const assertTokenPermissionsValidity = (attributes) => {
387
410
  const permissionService = strapi.admin.services.transfer.permission;
@@ -11,7 +11,7 @@ const registrationSchema = yup
11
11
  .object()
12
12
  .shape({
13
13
  firstname: validators.firstname.required(),
14
- lastname: validators.lastname,
14
+ lastname: validators.lastname.nullable(),
15
15
  password: validators.password.required(),
16
16
  })
17
17
  .required()
@@ -32,7 +32,7 @@ const adminRegistrationSchema = yup
32
32
  .shape({
33
33
  email: validators.email.required(),
34
34
  firstname: validators.firstname.required(),
35
- lastname: validators.lastname,
35
+ lastname: validators.lastname.nullable(),
36
36
  password: validators.password.required(),
37
37
  })
38
38
  .required()
@@ -1,5 +0,0 @@
1
- import { getRequestUrl } from '../../../utils';
2
-
3
- const requestURL = (path) => getRequestUrl(`single-types/${path}`);
4
-
5
- export default requestURL;
@@ -1,2 +0,0 @@
1
- // eslint-disable-next-line import/prefer-default-export
2
- export { default as getRequestUrl } from './getRequestUrl';
@@ -1,16 +0,0 @@
1
- import { getFetchClient } from '@strapi/helper-plugin';
2
-
3
- import { getRequestUrl } from '../../../utils';
4
-
5
- const putCMSettingsEV = (body, slug, isContentTypeView) => {
6
- const { put } = getFetchClient();
7
-
8
- return put(
9
- getRequestUrl(
10
- isContentTypeView ? `content-types/${slug}/configuration` : `components/${slug}/configuration`
11
- ),
12
- body
13
- );
14
- };
15
-
16
- export default putCMSettingsEV;
@@ -1,9 +0,0 @@
1
- const init = (initialState, layout) => {
2
- return {
3
- ...initialState,
4
- initialData: layout,
5
- modifiedData: layout,
6
- };
7
- };
8
-
9
- export default init;
@@ -1,4 +0,0 @@
1
- // FIXME when back-end ready
2
- const getRequestUrl = (path) => `/content-manager/${path}`;
3
-
4
- export default getRequestUrl;
@@ -1,3 +0,0 @@
1
- const getRequestUrl = (path) => `/admin/${path}`;
2
-
3
- export default getRequestUrl;
@@ -1,7 +0,0 @@
1
- (self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[1386],{31386:function(R,m,c){"use strict";c.r(m),c.d(m,{ROUTES_EE:function(){return t}});var u=c(32735),a=c(19565),l=c(49189),d=c.n(l),h=c(67879),n=c(53038),r=c(86209);const g=()=>{const{params:{authResponse:o}}=(0,n.$B)("/auth/login/:authResponse"),{formatMessage:e}=(0,h.Z)(),{push:f}=(0,n.k6)(),p=(0,u.useRef)(e);let i=(0,u.useCallback)(()=>{f(`/auth/oops?info=${encodeURIComponent(p.current({id:"Auth.form.button.login.providers.error",defaultMessage:"We cannot connect you through the selected provider."}))}`)},[f]);const{get:s}=(0,a.kY)(),v=(0,u.useCallback)(async()=>{try{const E=d().get("jwtToken");if(a.I8.clearAppStorage(),E){a.I8.setToken(E,!0);const I=(0,r.IF)("users/me"),{data:{data:A}}=await s(I);a.I8.setUserInfo(A,!0),d().remove("jwtToken"),f("/auth/login")}}catch{i()}},[s,f,i]);return(0,u.useEffect)(()=>{o==="error"&&i(),o==="success"&&v()},[o,v,i]),u.createElement(a.dO,null)};var C=null;const t=[{Component:()=>({default:g}),to:"/auth/login/:authResponse",exact:!0}]},49189:function(R,m,c){var u,a;/*!
2
- * JavaScript Cookie v2.2.1
3
- * https://github.com/js-cookie/js-cookie
4
- *
5
- * Copyright 2006, 2015 Klaus Hartl & Fagner Brack
6
- * Released under the MIT license
7
- */(function(l){var d;if(u=l,a=typeof u=="function"?u.call(m,c,m,R):u,a!==void 0&&(R.exports=a),d=!0,R.exports=l(),d=!0,!d){var h=window.Cookies,n=window.Cookies=l();n.noConflict=function(){return window.Cookies=h,n}}})(function(){function l(){for(var n=0,r={};n<arguments.length;n++){var g=arguments[n];for(var C in g)r[C]=g[C]}return r}function d(n){return n.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}function h(n){function r(){}function g(t,o,e){if(!(typeof document>"u")){e=l({path:"/"},r.defaults,e),typeof e.expires=="number"&&(e.expires=new Date(new Date*1+e.expires*864e5)),e.expires=e.expires?e.expires.toUTCString():"";try{var f=JSON.stringify(o);/^[\{\[]/.test(f)&&(o=f)}catch{}o=n.write?n.write(o,t):encodeURIComponent(String(o)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=encodeURIComponent(String(t)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var p="";for(var i in e)e[i]&&(p+="; "+i,e[i]!==!0&&(p+="="+e[i].split(";")[0]));return document.cookie=t+"="+o+p}}function C(t,o){if(!(typeof document>"u")){for(var e={},f=document.cookie?document.cookie.split("; "):[],p=0;p<f.length;p++){var i=f[p].split("="),s=i.slice(1).join("=");!o&&s.charAt(0)==='"'&&(s=s.slice(1,-1));try{var v=d(i[0]);if(s=(n.read||n)(s,v)||d(s),o)try{s=JSON.parse(s)}catch{}if(e[v]=s,t===v)break}catch{}}return t?e[t]:e}}return r.set=g,r.get=function(t){return C(t,!1)},r.getJSON=function(t){return C(t,!0)},r.remove=function(t,o){g(t,"",l(o,{expires:-1}))},r.defaults={},r.withConverter=h,r}return h(function(){})})}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[2379],{50337:function(U,c,t){t.d(c,{pl:function(){return g},aY:function(){return R},q5:function(){return r.q}});var e=t(32735),n=t(19565),E=t(86209),f=t(97889);const m={data:[],isLoading:!0};var L=(s,l)=>(0,f.ZP)(s,i=>{switch(l.type){case"GET_DATA_SUCCEEDED":{i.data=l.data,i.isLoading=!1;break}case"GET_DATA_ERROR":{i.isLoading=!1;break}default:return i}}),g=({ssoEnabled:s})=>{const[l,i]=(0,e.useReducer)(L,m),D=(0,n.lm)(),{get:T}=(0,n.kY)();return(0,e.useEffect)(()=>{(async()=>{try{if(!s){i({type:"GET_DATA_SUCCEEDED",data:[]});return}const{data:u}=await T((0,E.IF)("providers"));i({type:"GET_DATA_SUCCEEDED",data:u})}catch(u){console.error(u),i({type:"GET_DATA_ERROR"}),D({type:"warning",message:{id:"notification.error"}})}})()},[T,s,D]),l},a=t(36866),A=t.n(a),o=t(67879),O=t(53038),r=t(53104);const I="strapi-notification-seat-limit",P="https://cloud.strapi.io/profile/billing",C="https://strapi.io/billing/request-seats";var R=()=>{const{formatMessage:s}=(0,o.Z)();let{license:l,isError:i,isLoading:D}=(0,r.q)();const T=(0,n.lm)(),{pathname:p}=(0,O.TH)(),{enforcementUserCount:u,permittedSeats:_,licenseLimitStatus:d,isHostedOnStrapiCloud:S}=l;(0,e.useEffect)(()=>{if(i||D)return;const B=!A()(_)&&!window.sessionStorage.getItem(`${I}-${p}`)&&(d==="AT_LIMIT"||d==="OVER_LIMIT");let y;d==="OVER_LIMIT"?y="warning":d==="AT_LIMIT"&&(y="softWarning"),B&&T({type:y,message:s({id:"notification.ee.warning.over-.message",defaultMessage:"Add seats to {licenseLimitStatus, select, OVER_LIMIT {invite} other {re-enable}} Users. If you already did it but it's not reflected in Strapi yet, make sure to restart your app."},{licenseLimitStatus:d}),title:s({id:"notification.ee.warning.at-seat-limit.title",defaultMessage:"{licenseLimitStatus, select, OVER_LIMIT {Over} other {At}} seat limit ({enforcementUserCount}/{permittedSeats})"},{licenseLimitStatus:d,enforcementUserCount:u,permittedSeats:_}),link:{url:S?P:C,label:s({id:"notification.ee.warning.seat-limit.link",defaultMessage:"{isHostedOnStrapiCloud, select, true {ADD SEATS} other {CONTACT SALES}}"},{isHostedOnStrapiCloud:S})},blockTransition:!0,onClose(){window.sessionStorage.setItem(`${I}-${p}`,!0)}})},[T,l,p,s,D,_,d,u,S,i])}},53104:function(U,c,t){t.d(c,{q:function(){return f}});var e=t(32735),n=t(19565),E=t(20108);function f({enabled:m}={enabled:!0}){const{get:v}=(0,n.kY)(),{data:L,isError:M,isLoading:g}=(0,E.useQuery)(["ee","license-limit-info"],async()=>{const{data:{data:o}}=await v("/admin/license-limit-information");return o},{enabled:m}),a=L??{},A=e.useCallback(o=>(a?.features??[]).find(r=>r.name===o)?.options??{},[a?.features]);return{license:a,getFeature:A,isError:M,isLoading:g}}},42379:function(U,c,t){t.r(c),t.d(c,{CreateActionEE:function(){return r}});var e=t(32735),n=t(87933),E=t(63919),f=t(99140),m=t(41415),v=t(69932),L=t(7961),M=t(36866),g=t.n(M),a=t(60216),A=t.n(a),o=t(67879),O=t(50337);const r=({onClick:I})=>{const{formatMessage:P}=(0,o.Z)(),{license:{permittedSeats:C,shouldStopCreate:h},isError:R,isLoading:s}=(0,O.q5)();return R||s?null:e.createElement(n.k,{gap:2},!g()(C)&&h&&e.createElement(E.u,{description:P({id:"Settings.application.admin-seats.at-limit-tooltip",defaultMessage:"At limit: add seats to invite more users"}),position:"left"},e.createElement(f.J,{width:`${14/16}rem`,height:`${14/16}rem`,color:"danger500",as:v.Z})),e.createElement(m.z,{"data-testid":"create-user-button",onClick:I,startIcon:e.createElement(L.Z,null),size:"S",disabled:h},P({id:"Settings.permissions.users.create",defaultMessage:"Invite new user"})))};r.propTypes={onClick:A().func.isRequired}}}]);
@@ -1,26 +0,0 @@
1
- "use strict";(self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[2395],{50337:function(I,f,t){t.d(f,{pl:function(){return D},aY:function(){return n},q5:function(){return a.q}});var e=t(32735),u=t(19565),m=t(86209),g=t(97889);const P={data:[],isLoading:!0};var r=(o,p)=>(0,g.ZP)(o,l=>{switch(p.type){case"GET_DATA_SUCCEEDED":{l.data=p.data,l.isLoading=!1;break}case"GET_DATA_ERROR":{l.isLoading=!1;break}default:return l}}),D=({ssoEnabled:o})=>{const[p,l]=(0,e.useReducer)(r,P),A=(0,u.lm)(),{get:h}=(0,u.kY)();return(0,e.useEffect)(()=>{(async()=>{try{if(!o){l({type:"GET_DATA_SUCCEEDED",data:[]});return}const{data:v}=await h((0,m.IF)("providers"));l({type:"GET_DATA_SUCCEEDED",data:v})}catch(v){console.error(v),l({type:"GET_DATA_ERROR"}),A({type:"warning",message:{id:"notification.error"}})}})()},[h,o,A]),p},d=t(36866),_=t.n(d),c=t(67879),T=t(53038),a=t(53104);const E="strapi-notification-seat-limit",s="https://cloud.strapi.io/profile/billing",L="https://strapi.io/billing/request-seats";var n=()=>{const{formatMessage:o}=(0,c.Z)();let{license:p,isError:l,isLoading:A}=(0,a.q)();const h=(0,u.lm)(),{pathname:y}=(0,T.TH)(),{enforcementUserCount:v,permittedSeats:C,licenseLimitStatus:M,isHostedOnStrapiCloud:U}=p;(0,e.useEffect)(()=>{if(l||A)return;const B=!_()(C)&&!window.sessionStorage.getItem(`${E}-${y}`)&&(M==="AT_LIMIT"||M==="OVER_LIMIT");let S;M==="OVER_LIMIT"?S="warning":M==="AT_LIMIT"&&(S="softWarning"),B&&h({type:S,message:o({id:"notification.ee.warning.over-.message",defaultMessage:"Add seats to {licenseLimitStatus, select, OVER_LIMIT {invite} other {re-enable}} Users. If you already did it but it's not reflected in Strapi yet, make sure to restart your app."},{licenseLimitStatus:M}),title:o({id:"notification.ee.warning.at-seat-limit.title",defaultMessage:"{licenseLimitStatus, select, OVER_LIMIT {Over} other {At}} seat limit ({enforcementUserCount}/{permittedSeats})"},{licenseLimitStatus:M,enforcementUserCount:v,permittedSeats:C}),link:{url:U?s:L,label:o({id:"notification.ee.warning.seat-limit.link",defaultMessage:"{isHostedOnStrapiCloud, select, true {ADD SEATS} other {CONTACT SALES}}"},{isHostedOnStrapiCloud:U})},blockTransition:!0,onClose(){window.sessionStorage.setItem(`${E}-${y}`,!0)}})},[h,p,y,o,A,C,M,v,U,l])}},53104:function(I,f,t){t.d(f,{q:function(){return g}});var e=t(32735),u=t(19565),m=t(20108);function g({enabled:P}={enabled:!0}){const{get:O}=(0,u.kY)(),{data:r,isError:i,isLoading:D}=(0,m.useQuery)(["ee","license-limit-info"],async()=>{const{data:{data:c}}=await O("/admin/license-limit-information");return c},{enabled:P}),d=r??{},_=e.useCallback(c=>(d?.features??[]).find(a=>a.name===c)?.options??{},[d?.features]);return{license:d,getFeature:_,isError:i,isLoading:D}}},82395:function(I,f,t){t.r(f),t.d(f,{LoginEE:function(){return E}});var e=t(32735),u=t(9026),m=t(72850),g=t(87933),P=t(49372),O=t(60216),r=t.n(O),i=t(67879),D=t(8471),d=t(11060),_=t(24436),c=t(50337),T=t(68726);const a=(0,D.ZP)(u.i)`
2
- flex: 1;
3
- `,E=s=>{const L=window.strapi.features.isEnabled(window.strapi.features.SSO),{isLoading:R,data:n}=(0,c.pl)({ssoEnabled:L}),{formatMessage:o}=(0,i.Z)();return!L||!R&&n.length===0?e.createElement(d.ZP,null,e.createElement(_.Z,{...s})):e.createElement(d.ZP,null,e.createElement(_.Z,{...s},e.createElement(m.x,{paddingTop:7},e.createElement(g.k,{direction:"column",alignItems:"stretch",gap:7},e.createElement(g.k,null,e.createElement(a,null),e.createElement(m.x,{paddingLeft:3,paddingRight:3},e.createElement(P.Z,{variant:"sigma",textColor:"neutral600"},o({id:"Auth.login.sso.divider"}))),e.createElement(a,null)),e.createElement(T.Z,{providers:n,displayAllProviders:!1})))))};E.defaultProps={onSubmit:s=>s.preventDefault(),requestError:null},E.propTypes={formErrors:r().object.isRequired,modifiedData:r().object.isRequired,onChange:r().func.isRequired,onSubmit:r().func,requestError:r().object}},68726:function(I,f,t){var e=t(32735),u=t(87933),m=t(63919),g=t(49372),P=t(15335),O=t(5803),r=t(60216),i=t.n(r),D=t(67879),d=t(14911),_=t(8471);const c=_.ZP.a`
4
- width: ${136/16}rem;
5
- display: flex;
6
- justify-content: center;
7
- align-items: center;
8
- height: ${48/16}rem;
9
- border: 1px solid ${({theme:s})=>s.colors.neutral150};
10
- border-radius: ${({theme:s})=>s.borderRadius};
11
- text-decoration: inherit;
12
- &:link {
13
- text-decoration: none;
14
- }
15
- color: ${({theme:s})=>s.colors.neutral600};
16
- `,T=(0,_.ZP)(u.k)`
17
- & a:not(:first-child):not(:last-child) {
18
- margin: 0 ${({theme:s})=>s.spaces[2]};
19
- }
20
- & a:first-child {
21
- margin-right: ${({theme:s})=>s.spaces[2]};
22
- }
23
- & a:last-child {
24
- margin-left: ${({theme:s})=>s.spaces[2]};
25
- }
26
- `,a=({provider:s})=>e.createElement(m.u,{label:s.displayName},e.createElement(c,{href:`${window.strapi.backendURL}/admin/connect/${s.uid}`},s.icon?e.createElement("img",{src:s.icon,"aria-hidden":!0,alt:"",height:"32px"}):e.createElement(g.Z,null,s.displayName)));a.propTypes={provider:i().shape({icon:i().string,displayName:i().string.isRequired,uid:i().string.isRequired}).isRequired};const E=({providers:s,displayAllProviders:L})=>{const{formatMessage:R}=(0,D.Z)();return L?e.createElement(P.r,{gap:4},s.map(n=>e.createElement(O.P,{key:n.uid,col:4},e.createElement(a,{provider:n})))):s.length>2&&!L?e.createElement(P.r,{gap:4},s.slice(0,2).map(n=>e.createElement(O.P,{key:n.uid,col:4},e.createElement(a,{provider:n}))),e.createElement(O.P,{col:4},e.createElement(m.u,{label:R({id:"global.see-more"})},e.createElement(c,{as:d.rU,to:"/auth/providers"},e.createElement("span",{"aria-hidden":!0},"\u2022\u2022\u2022"))))):e.createElement(T,{justifyContent:"center"},s.map(n=>e.createElement(a,{key:n.uid,provider:n})))};E.defaultProps={displayAllProviders:!0},E.propTypes={providers:i().arrayOf(i().object).isRequired,displayAllProviders:i().bool},f.Z=E}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[2801],{50337:function(C,r,t){t.d(r,{pl:function(){return v},aY:function(){return U},q5:function(){return g.q}});var s=t(32735),n=t(19565),c=t(86209),l=t(97889);const T={data:[],isLoading:!0};var A=(i,a)=>(0,l.ZP)(i,e=>{switch(a.type){case"GET_DATA_SUCCEEDED":{e.data=a.data,e.isLoading=!1;break}case"GET_DATA_ERROR":{e.isLoading=!1;break}default:return e}}),v=({ssoEnabled:i})=>{const[a,e]=(0,s.useReducer)(A,T),E=(0,n.lm)(),{get:m}=(0,n.kY)();return(0,s.useEffect)(()=>{(async()=>{try{if(!i){e({type:"GET_DATA_SUCCEEDED",data:[]});return}const{data:u}=await m((0,c.IF)("providers"));e({type:"GET_DATA_SUCCEEDED",data:u})}catch(u){console.error(u),e({type:"GET_DATA_ERROR"}),E({type:"warning",message:{id:"notification.error"}})}})()},[m,i,E]),a},d=t(36866),h=t.n(d),f=t(67879),P=t(53038),g=t(53104);const R="strapi-notification-seat-limit",y="https://cloud.strapi.io/profile/billing",M="https://strapi.io/billing/request-seats";var U=()=>{const{formatMessage:i}=(0,f.Z)();let{license:a,isError:e,isLoading:E}=(0,g.q)();const m=(0,n.lm)(),{pathname:L}=(0,P.TH)(),{enforcementUserCount:u,permittedSeats:I,licenseLimitStatus:o,isHostedOnStrapiCloud:p}=a;(0,s.useEffect)(()=>{if(e||E)return;const N=!h()(I)&&!window.sessionStorage.getItem(`${R}-${L}`)&&(o==="AT_LIMIT"||o==="OVER_LIMIT");let D;o==="OVER_LIMIT"?D="warning":o==="AT_LIMIT"&&(D="softWarning"),N&&m({type:D,message:i({id:"notification.ee.warning.over-.message",defaultMessage:"Add seats to {licenseLimitStatus, select, OVER_LIMIT {invite} other {re-enable}} Users. If you already did it but it's not reflected in Strapi yet, make sure to restart your app."},{licenseLimitStatus:o}),title:i({id:"notification.ee.warning.at-seat-limit.title",defaultMessage:"{licenseLimitStatus, select, OVER_LIMIT {Over} other {At}} seat limit ({enforcementUserCount}/{permittedSeats})"},{licenseLimitStatus:o,enforcementUserCount:u,permittedSeats:I}),link:{url:p?y:M,label:i({id:"notification.ee.warning.seat-limit.link",defaultMessage:"{isHostedOnStrapiCloud, select, true {ADD SEATS} other {CONTACT SALES}}"},{isHostedOnStrapiCloud:p})},blockTransition:!0,onClose(){window.sessionStorage.setItem(`${R}-${L}`,!0)}})},[m,a,L,i,E,I,o,u,p,e])}},53104:function(C,r,t){t.d(r,{q:function(){return l}});var s=t(32735),n=t(19565),c=t(20108);function l({enabled:T}={enabled:!0}){const{get:S}=(0,n.kY)(),{data:A,isError:O,isLoading:v}=(0,c.useQuery)(["ee","license-limit-info"],async()=>{const{data:{data:f}}=await S("/admin/license-limit-information");return f},{enabled:T}),d=A??{},h=s.useCallback(f=>(d?.features??[]).find(g=>g.name===f)?.options??{},[d?.features]);return{license:d,getFeature:h,isError:O,isLoading:v}}},12801:function(C,r,t){t.r(r),t.d(r,{UserListPageEE:function(){return l}});var s=t(32735),n=t(99528),c=t(50337);function l(){return(0,c.aY)(),s.createElement(n.W,null)}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[4546],{17379:function(j,D,s){s.d(D,{r:function(){return C}});var f=s(32735),p=s(72850),O=s(60216),A=s.n(O),F=s(74506);function k(L,M,y){if(!L||!M)return{display:"none"};const{x:I,y:x}=y;return{transform:`translate(${I}px, ${x}px)`}}function C({renderItem:L}){const{itemType:M,isDragging:y,item:I,initialOffset:x,currentOffset:W,mouseOffset:Z}=(0,F.useDragLayer)(E=>({item:E.getItem(),itemType:E.getItemType(),initialOffset:E.getInitialSourceClientOffset(),currentOffset:E.getSourceClientOffset(),isDragging:E.isDragging(),mouseOffset:E.getClientOffset()}));return y?f.createElement(p.x,{height:"100%",left:0,position:"fixed",pointerEvents:"none",top:0,zIndex:100,width:"100%"},f.createElement(p.x,{style:k(x,W,Z)},L({type:M,item:I}))):null}C.propTypes={renderItem:A().func.isRequired}},75430:function(j,D,s){var f=s(32735);const p=(0,f.createContext)();var O=null},69242:function(j,D,s){s.d(D,{PL:function(){return F},Y9:function(){return k.Y},zE:function(){return se},Ky:function(){return ce},fi:function(){return z},zH:function(){return de},r5:function(){return me}});var f=s(32735),p=s(15062),O=s(53634),F=()=>{const e=(0,p.v9)(O.Z),t=(0,f.useCallback)(n=>e?.components?.[n]??{},[e]);return{...e,getComponentLayout:t}},k=s(77622),C=s(19565),L=s(84306),M=s(20716),y=s(97889);const I={error:null,isLoading:!0,layout:{},layouts:{}};var W=(e,t)=>(0,y.ZP)(e,n=>{switch(t.type){case"GET_DATA":{n.isLoading=!0,n.error=null,n.layout={};break}case"GET_DATA_SUCCEEDED":{const r=t.data.contentType.uid;n.layout=t.data,n.layouts[r]=t.data,n.isLoading=!1;break}case"GET_DATA_ERROR":{n.isLoading=!1,n.error=t.error;break}case"SET_LAYOUT_FROM_STATE":{n.error=null,n.layout=e.layouts[t.uid];break}case"UPDATE_LAYOUT":{const r=e.layout;n.layout={...r,contentType:{uid:r.contentType.uid,...t.newLayout.contentType}},n.layouts[r.contentType.uid]={...r,contentType:{uid:r.contentType.uid,...t.newLayout.contentType}};break}default:return n}}),Z=s(99381),E=s.n(Z),G=s(33795),R=s.n(G),w=s(3040),S=s.n(w),re=s(97724);const Q=(e,t)=>t.find(n=>n.uid===e),H=(e,t)=>{const n=X(e,t),r=P(n.contentType,t),i=J(n.contentType,n.components);return S()(n,["contentType","layouts","edit"],r),S()(n,["contentType","layouts","list"],i),Object.keys(n.components).forEach(u=>{const c=P(n.components[u],t);S()(n,["components",u,"layouts","edit"],c)}),n},X=(e,t)=>{const n=(0,re.w8)(E()(e),t,"contentType"),{components:r,contentType:i}=n,u=c=>Object.keys(c.metadatas).reduce((d,h)=>{const T=R()(c,["attributes",h],{});let v=c.metadatas[h];if(T.type==="relation"){const b=Q(T.targetModel,t),N=v.edit.mainField,V={name:N,schema:R()(b,["attributes",N])};v={list:{...v.list,mainField:V},edit:{...v.edit,mainField:V}}}return d[h]=v,d},{});return S()(n,["contentType","metadatas"],u(i)),Object.keys(r).forEach(c=>{const d=r[c],h=u(d);S()(n,["components",c,"metadatas"],h)}),n},P=(e,t)=>e.layouts.edit.reduce((n,r)=>{const i=r.map(u=>{const c=R()(e,["attributes",u.name],{}),d={...u,fieldSchema:c,metadatas:R()(e,["metadatas",u.name,"edit"],{})};if(c.type==="relation"){const T=Q(c.targetModel,t).pluginOptions||{};S()(d,"targetModelPluginOptions",T),S()(d,"queryInfos",{shouldDisplayRelationLink:Y(e,u.name,t)})}return d});return n.push(i),n},[]),J=(e,t)=>e.layouts.list.reduce((r,i)=>{const u=R()(e,["attributes",i],{}),c=R()(e,["metadatas",i,"list"],{}),d=u.type;if(d==="relation")return r.push({key:`__${i}_key__`,name:i,fieldSchema:u,metadatas:c}),r;if(d==="component"){const h=t[u.component],T=h.settings.mainField,v=h.attributes[T];return r.push({key:`__${i}_key__`,name:i,fieldSchema:u,metadatas:{...c,mainField:{...v,name:T}}}),r}return r.push({key:`__${i}_key__`,name:i,fieldSchema:u,metadatas:c}),r},[]),Y=(e,t,n)=>{const r=R()(e,["attributes",t,"targetModel"],"");return K(n).includes(r)},K=e=>e.filter(t=>t.isDisplayed).map(({uid:t})=>t);var $=H,se=e=>{const[{error:t,isLoading:n,layout:r,layouts:i},u]=(0,f.useReducer)(W,I),c=(0,f.useMemo)(M.Vo,[]),{schemas:d}=(0,p.v9)(N=>c(N),p.wU),h=(0,f.useRef)(!0),{get:T}=(0,C.kY)(),v=(0,f.useCallback)(async(N,V)=>{if(i[N]){u({type:"SET_LAYOUT_FROM_STATE",uid:N});return}u({type:"GET_DATA"});try{const{data:{data:ne}}=await T(`/content-manager/content-types/${N}/configuration`,{cancelToken:V.token});u({type:"GET_DATA_SUCCEEDED",data:$(ne,d)})}catch(ne){if(L.default.isCancel(ne))return;h.current&&console.error(ne),h.current&&u({type:"GET_DATA_ERROR",error:ne})}},[i,d,T]);(0,f.useEffect)(()=>()=>{h.current=!1},[]),(0,f.useEffect)(()=>{const V=L.default.CancelToken.source();return v(e,V),()=>{V.cancel("Operation canceled by the user.")}},[e,v]);const b=(0,f.useCallback)(N=>{u({type:"UPDATE_LAYOUT",newLayout:$(N,d)})},[d]);return{error:t,isLoading:n,layout:r,updateLayout:b}},oe=e=>e["content-manager_app"].collectionTypeLinks,ie=s(85973),ae=s.n(ie),B=s(33348);const ue=(e,t)=>Object.keys(e).reduce((n,r)=>{const i=e[r],u=R()(t,[r],i);return ae()(i)?{...n,[r]:ue(i,u)}:(n[r]=u,n)},{});var m=(e,t,n)=>{const r=e.find(({to:v})=>v.includes(t));if(!r)return"/";const{to:i,search:u}=r,c=(0,B.parse)(u),d=(0,B.parse)(n.substring(1)),h=ue(c,d);return`${i}?${(0,B.stringify)(h,{encode:!1})}`},ce=e=>{const[{rawQuery:t}]=(0,C.Kx)(),n=(0,p.v9)(oe);return m(n,e,t)},ge=s(15655),le=s(53038),z=()=>{const{search:e}=(0,le.TH)(),t=e?(0,B.parse)(e.substring(1)):{};return t.plugins?(0,B.stringify)({plugins:t.plugins},{encode:!1}):""};const de=e=>{const t=(0,f.useRef)();return(0,f.useEffect)(()=>{t.current=e},[e]),t.current};var U=s(85149);const g=(e,t,n)=>({type:U.m,permissions:e,__meta__:{plugins:t,containerName:n}}),ee=()=>({type:U.Q}),fe=e=>e["content-manager_rbacManager"].permissions,te=e=>e.rbacProvider.collectionTypesRelatedPermissions;var me=(e,t,n="listView")=>{const r=(0,p.v9)(te),i=(0,p.v9)(fe),u=(0,p.I0)(),c=r[t];return(0,f.useEffect)(()=>c?(u(g(c,e?e.plugins:null,n)),()=>{u(ee())}):()=>{},[c,u,e,n]),i},o=s(75430);const l=()=>useContext(WysiwygContext);var a=null},77622:function(j,D,s){s.d(D,{Y:function(){return F}});var f=s(32735),p=s(74506),O=s.n(p),A=s(15655);const F=(k,{type:C="STRAPI_DND",index:L,item:M={},onStart:y,onEnd:I,onGrabItem:x,onDropItem:W,onCancel:Z,onMoveItem:E,dropSensitivity:G="regular"})=>{const R=(0,f.useRef)(null),[{handlerId:w},S]=(0,p.useDrop)({accept:C,collect(P){return{handlerId:P.getHandlerId()}},hover(P,J){if(!R.current)return;const Y=P.index,K=L;if(Y!==K){if(G==="regular"){const $=R.current.getBoundingClientRect(),q=($.bottom-$.top)/2,_=J.getClientOffset().y-$.top;if(Y<K&&_<q||Y>K&&_>q)return}E(K,Y),P.index=K}}}),[{isDragging:re},Q,H]=(0,p.useDrag)({type:C,item(){y&&y();const{width:P}=R.current?.getBoundingClientRect()??{};return{index:L,width:P,...M}},end(){I&&I()},canDrag:k,isDragging:M.id?P=>M.id===P.getItem().id:void 0,collect:P=>({isDragging:P.isDragging()})}),X=(0,A.A)(k,L,{onGrabItem:x,onDropItem:W,onCancel:Z,onMoveItem:E});return[{handlerId:w,isDragging:re,handleKeyDown:X},R,S,Q,H]}},15655:function(j,D,s){s.d(D,{A:function(){return p}});var f=s(32735);const p=(O,A,{onCancel:F,onDropItem:k,onGrabItem:C,onMoveItem:L})=>{const[M,y]=(0,f.useState)(!1),I=E=>{M&&(E==="UP"?L(A-1,A):E==="DOWN"&&L(A+1,A))},x=()=>{M?(k&&k(A),y(!1)):(C&&C(A),y(!0))},W=()=>{M&&(y(!1),F&&F(A))};return E=>{if(O&&!(E.key==="Tab"&&!M))switch(E.preventDefault(),E.key){case" ":case"Enter":x();break;case"Escape":W();break;case"ArrowDown":case"ArrowRight":I("DOWN");break;case"ArrowUp":case"ArrowLeft":I("UP");break;default:}}}},20716:function(j,D,s){s.d(D,{Jg:function(){return L},KQ:function(){return k},Vo:function(){return C},Yg:function(){return O}});var f=s(98178),p=s(60371);const O=()=>y=>y["content-manager_app"]||p.E,A=()=>createSelector(O(),y=>y),F=()=>createSelector(O(),y=>y.models),k=()=>(0,f.P1)(O(),y=>({collectionTypeLinks:y.collectionTypeLinks,singleTypeLinks:y.singleTypeLinks})),C=()=>(0,f.P1)(O(),({components:y,models:I})=>({schemas:[...y,...I]})),L=(0,f.P1)(O(),y=>y.fieldSizes);var M=null},53634:function(j,D){const s=f=>f["content-manager_editViewLayoutManager"].currentLayout;D.Z=s},24381:function(j,D){D.Z={COMPONENT:"component",EDIT_FIELD:"editField",FIELD:"field",DYNAMIC_ZONE:"dynamicZone",RELATION:"relation"}},7921:function(j,D){const s=f=>`content-manager.${f}`;D.Z=s},97724:function(j,D,s){s.d(D,{_Q:function(){return _.Z},W3:function(){return A},ko:function(){return L},FE:function(){return y},Di:function(){return Z},Ex:function(){return me},du:function(){return w},TA:function(){return Q},Ts:function(){return J},Uo:function(){return K},IF:function(){return q},OB:function(){return se.Z},w8:function(){return ye},kc:function(){return ce}});var f=s(99381),p=s.n(f),A=(o,l,a)=>{if(Array.isArray(o)&&l>=0&&a>=0&&l<=o.length-1&&a<=o.length-1){const e=p()(o),t=e.splice(l,1);return e.splice(a,0,t[0]),e}return o},F=s(59578),k=s.n(F),L=o=>{const l=o.type;return l==="relation"?!k()(o.relationType).includes("morph"):!["json","dynamiczone","richtext","password"].includes(l)&&!!l};const M=(o,l)=>{typeof o=="function"?o(l):o!=null&&(o.current=l)},y=(...o)=>l=>o.forEach(a=>M(a,l));var I=s(33795),x=s.n(I);const W=(o,l)=>Object.keys(o).reduce((a,e)=>{const t=x()(o,[e],{}),{default:n,component:r,type:i,required:u,min:c,repeatable:d}=t;if(n!==void 0&&(a[e]=n),i==="component"){const h=l?.[r]?.attributes??{},T=W(h,l);if(u===!0&&(a[e]=d===!0?[]:T),c&&d===!0&&u){a[e]=[];for(let v=0;v<c;v+=1)a[e].push(T)}}return i==="dynamiczone"&&u===!0&&(a[e]=[]),a},{});var Z=W,E=s(9086),G=s.n(E),w=({layouts:o,metadatas:l,...a})=>{const e=o.list.map(r=>r.name?r.name:r),t=Object.keys(l).reduce((r,i)=>{const u=x()(l,[i],{});let c=u.edit;return c.mainField&&(c={...c,mainField:u.edit.mainField.name}),{...r,[i]:{edit:c,list:G()(u.list,["mainField"])}}},{}),n=o.edit.map(r=>r.map(({name:i,size:u})=>({name:i,size:u})));return{...a,layouts:{edit:n,list:e},metadatas:t}};const S=(o,l)=>o.map(a=>({...a,subject:l}));var Q=o=>{const l={create:[{action:"plugin::content-manager.explorer.create",subject:null}],delete:[{action:"plugin::content-manager.explorer.delete",subject:null}],publish:[{action:"plugin::content-manager.explorer.publish",subject:null}],read:[{action:"plugin::content-manager.explorer.read",subject:null}],update:[{action:"plugin::content-manager.explorer.update",subject:null}]};return Object.keys(l).reduce((a,e)=>(a[e]=S(l[e],o),a),{})},H=s(95919),X=s.n(H),J=o=>o.split(".").filter(l=>X()(parseInt(l,10))),K=o=>{if(o.length===0)return-1;const l=Math.max.apply(Math,o.map(a=>a.__temp_key__??0));return Number.isNaN(l)?-1:l},q=o=>`/content-manager/${o}`,se=s(7921),_=s(24381),oe=s(86349),ie=s.n(oe),ae=s(3040),B=s.n(ae),ye=(o,l,a)=>{const e=i=>l.find(u=>u.uid===i),t=Object.assign({},o),n=o[a].uid,r=e(n);return B()(t,[a],ie()({},r,o[a])),Object.keys(o.components).forEach(i=>{const u=e(i);B()(t,["components",i],{...o.components[i],...u})}),t},m=s(19565),ce=(o,l,a)=>{const e=(t,n)=>Object.keys(t).reduce((r,i)=>{const u=(0,m.UN)(n,i),c=x()(t,i),d=(0,m.k2)(n,[i,"component"]),h=(0,m.k2)(n,[i,"repeatable"]);return u==="dynamiczone"?(r[i]=c.map(T=>e(T,a[T.__component])),r):u==="component"?(h?r[i]=c&&c.map(T=>e(T,a[d])):r[i]=c&&e(c,a[d]),r):(u!=="password"&&(r[i]=c),r)},{});return e(o,l)},ge=s(51355),le=s.n(ge),pe=s(86834),z=s.n(pe),de=s(78746),U=s.n(de),g=s(24346),ee=s(73347);g.kM(g.nK,"defined",function(){return this.test("defined",m.I0.required,o=>o!==void 0)}),g.kM(g.IX,"notEmptyMin",function(o){return this.test("notEmptyMin",m.I0.min,l=>z()(l)?!0:l.length>=o)}),g.kM(g.Z_,"isInferior",function(o,l){return this.test("isInferior",o,function(a){return!a||Number.isNaN(U()(a))?!0:U()(l)>=U()(a)})}),g.kM(g.Z_,"isSuperior",function(o,l){return this.test("isSuperior",o,function(a){return!a||Number.isNaN(U()(a))?!0:U()(a)>=U()(l)})});const fe=o=>x()(o,["attributes"],{}),te=(o,{components:l},a={isCreatingEntry:!0,isDraft:!0,isFromComponent:!1})=>{const e=fe(o);return g.Ry().shape(Object.keys(e).reduce((t,n)=>{const r=e[n];if(r.type!=="relation"&&r.type!=="component"&&r.type!=="dynamiczone"){const i=he(r.type,r,a);t[n]=i}if(r.type==="relation"&&(t[n]=["oneWay","oneToOne","manyToOne","oneToManyMorph","oneToOneMorph"].includes(r.relationType)?g.Ry().nullable():g.IX().nullable()),r.type==="component"){const i=te(l[r.component],{components:l},{...a,isFromComponent:!0});if(r.repeatable===!0){const{min:c,max:d,required:h}=r;let T=g.Vo(v=>{let b=g.IX().of(i);return c?h?b=b.min(c,m.I0.min):h!==!0&&z()(v)?b=b.nullable():b=b.min(c,m.I0.min):h&&!a.isDraft&&(b=b.min(1,m.I0.required)),d&&(b=b.max(d,m.I0.max)),b});return t[n]=T,t}const u=g.Vo(c=>c!==void 0?r.required===!0&&!a.isDraft?i.defined():i.nullable():r.required===!0?g.Ry().defined():g.Ry().nullable());return t[n]=u,t}if(r.type==="dynamiczone"){let i=g.IX().of(g.Vo(({__component:d})=>te(l[d],{components:l},{...a,isFromComponent:!0})));const{max:u,min:c}=r;c?r.required?i=i.test("min",m.I0.min,d=>a.isCreatingEntry?d&&d.length>=c:d===void 0?!0:d!==null&&d.length>=c).test("required",m.I0.required,d=>a.isCreatingEntry?d!==null||d!==void 0:d===void 0?!0:d!==null):i=i.notEmptyMin(c):r.required&&!a.isDraft&&(i=i.test("required",m.I0.required,d=>a.isCreatingEntry?d!==null||d!==void 0:d===void 0?!0:d!==null)),u&&(i=i.max(u,m.I0.max)),t[n]=i}return t},{}))},he=(o,l,a)=>{let e=g.nK();return["string","uid","text","richtext","email","password","enumeration"].includes(o)&&(e=g.Z_()),o==="json"&&(e=g.nK(m.I0.json).test("isJSON",m.I0.json,t=>{if(!t||!t.length)return!0;try{return JSON.parse(t),!0}catch{return!1}}).nullable().test("required",m.I0.required,t=>!(l.required&&(!t||!t.length)))),o==="email"&&(e=e.email(m.I0.email)),["number","integer","float","decimal"].includes(o)&&(e=g.Rx().transform(t=>X()(t)?void 0:t).typeError()),o==="biginteger"&&(e=g.Z_().matches(/^-?\d*$/)),["date","datetime"].includes(o)&&(e=g.hT()),Object.keys(l).forEach(t=>{const n=l[t];if(n||!le()(n)&&Number.isInteger(Math.floor(n))||n===0)switch(t){case"required":{a.isDraft||(o==="password"&&a.isCreatingEntry&&(e=e.required(m.I0.required)),o!=="password"&&(a.isCreatingEntry?e=e.required(m.I0.required):e=e.test("required",m.I0.required,r=>r===void 0&&!a.isFromComponent?!0:(0,ee.Z)(o)?r===0?!0:!!r:o==="boolean"?r!=null:o==="date"||o==="datetime"?typeof r=="string"?!z()(r):!z()(r?.toString()):!z()(r))));break}case"max":{o==="biginteger"?e=e.isInferior(m.I0.max,n):e=e.max(n,m.I0.max);break}case"maxLength":e=e.max(n,m.I0.maxLength);break;case"min":{o==="biginteger"?e=e.isSuperior(m.I0.min,n):e=e.min(n,m.I0.min);break}case"minLength":{a.isDraft||(e=e.min(n,m.I0.minLength));break}case"regex":e=e.matches(new RegExp(n),{message:m.I0.regex,excludeEmptyString:!l.required});break;case"lowercase":["text","textarea","email","string"].includes(o)&&(e=e.strict().lowercase());break;case"uppercase":["text","textarea","email","string"].includes(o)&&(e=e.strict().uppercase());break;case"positive":(0,ee.Z)(o)&&(e=e.positive());break;case"negative":(0,ee.Z)(o)&&(e=e.negative());break;default:e=e.nullable()}}),e};var me=te},73347:function(j,D,s){s.d(D,{Z:function(){return f}});function f(p){return["integer","biginteger","decimal","float","number"].includes(p)}}}]);