@strapi/admin 4.13.6 → 4.14.0-beta.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 (73) hide show
  1. package/admin/src/content-manager/components/Wysiwyg/EditorLayout.js +1 -1
  2. package/admin/src/content-manager/pages/ListView/components/BulkActionButtons/ConfirmBulkActionDialog/index.js +3 -0
  3. package/admin/src/content-manager/pages/ListView/components/BulkActionButtons/SelectedEntriesModal/index.js +2 -1
  4. package/admin/src/hooks/useAdminRoles/index.js +17 -7
  5. package/admin/src/hooks/useAdminUsers/useAdminUsers.js +16 -7
  6. package/admin/src/hooks/useContentTypes/useContentTypes.js +18 -7
  7. package/admin/src/index.js +1 -7
  8. package/build/1227.4f48119b.chunk.js +1 -0
  9. package/build/{3483.19381b40.chunk.js → 3483.f6b2439f.chunk.js} +1 -1
  10. package/build/4174.924ebd4c.chunk.js +1 -0
  11. package/build/6266.c652bdb1.chunk.js +146 -0
  12. package/build/7897.cf22d5fe.chunk.js +6 -0
  13. package/build/{Admin-authenticatedApp.69c7ea72.chunk.js → Admin-authenticatedApp.a687d9c6.chunk.js} +1 -1
  14. package/build/{admin-app.1fde8f7a.chunk.js → admin-app.4654dc77.chunk.js} +11 -11
  15. package/build/admin-edit-roles-page.6597d934.chunk.js +267 -0
  16. package/build/admin-edit-users.3014605e.chunk.js +10 -0
  17. package/build/admin-roles-list.ab6fcfb7.chunk.js +22 -0
  18. package/build/admin-users.81bf5f4d.chunk.js +11 -0
  19. package/build/audit-logs-settings-page.4eb6cdf8.chunk.js +1 -0
  20. package/build/{content-manager.f9abb63f.chunk.js → content-manager.9187db78.chunk.js} +37 -37
  21. package/build/index.html +1 -1
  22. package/build/{main.9ed36326.js → main.da000219.js} +17 -17
  23. package/build/review-workflows-settings-create-view.5d8806b2.chunk.js +1 -0
  24. package/build/review-workflows-settings-edit-view.634903ed.chunk.js +1 -0
  25. package/build/review-workflows-settings-list-view.d138c3b5.chunk.js +56 -0
  26. package/build/{runtime~main.562cc892.js → runtime~main.9589b498.js} +2 -2
  27. package/build/sso-settings-page.caa35f7b.chunk.js +1 -0
  28. package/ee/admin/content-manager/pages/EditView/InformationBox/components/StageSelect/StageSelect.js +65 -53
  29. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/actions/index.js +50 -5
  30. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/Stage/Stage.js +257 -21
  31. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/WorkflowAttributes/WorkflowAttributes.js +8 -23
  32. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/constants.js +6 -0
  33. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/hooks/useReviewWorkflows.js +17 -7
  34. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/hooks/useReviewWorkflowsStages.js +36 -0
  35. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/CreateView/CreateView.js +68 -19
  36. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/EditView/EditView.js +105 -35
  37. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/reducer/index.js +68 -27
  38. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/selectors.js +45 -0
  39. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/utils/validateWorkflow.js +20 -0
  40. package/ee/server/config/admin-actions.js +6 -0
  41. package/ee/server/constants/workflows.js +13 -0
  42. package/ee/server/content-types/workflow-stage/index.js +6 -0
  43. package/ee/server/controllers/workflows/index.js +41 -16
  44. package/ee/server/controllers/workflows/stages/index.js +93 -6
  45. package/ee/server/migrations/review-workflows-stages-roles.js +68 -0
  46. package/ee/server/migrations/review-workflows-workflow-name.js +7 -0
  47. package/ee/server/register.js +2 -0
  48. package/ee/server/routes/review-workflows.js +10 -9
  49. package/ee/server/services/index.js +1 -0
  50. package/ee/server/services/review-workflows/stage-permissions.js +60 -0
  51. package/ee/server/services/review-workflows/stages.js +91 -12
  52. package/ee/server/services/review-workflows/workflows/index.js +20 -7
  53. package/ee/server/validation/review-workflows.js +11 -0
  54. package/package.json +8 -8
  55. package/server/content-types/Permission.js +6 -0
  56. package/server/domain/permission/index.js +11 -2
  57. package/server/services/role.js +12 -4
  58. package/server/validation/action-provider.js +1 -1
  59. package/server/validation/common-validators.js +92 -100
  60. package/server/validation/permission.js +0 -3
  61. package/build/1227.c72e74e9.chunk.js +0 -1
  62. package/build/2237.a7992513.chunk.js +0 -114
  63. package/build/4174.6efb0dc6.chunk.js +0 -1
  64. package/build/4724.a0ce68f3.chunk.js +0 -6
  65. package/build/admin-edit-roles-page.f76cb0aa.chunk.js +0 -267
  66. package/build/admin-edit-users.186c9d90.chunk.js +0 -10
  67. package/build/admin-roles-list.3a4edfa2.chunk.js +0 -22
  68. package/build/admin-users.e276bd9a.chunk.js +0 -11
  69. package/build/audit-logs-settings-page.0d9bc0f6.chunk.js +0 -1
  70. package/build/review-workflows-settings-create-view.b96b7be1.chunk.js +0 -1
  71. package/build/review-workflows-settings-edit-view.21a682a0.chunk.js +0 -1
  72. package/build/review-workflows-settings-list-view.14212324.chunk.js +0 -56
  73. package/build/sso-settings-page.d93bd81f.chunk.js +0 -1
@@ -2,7 +2,7 @@
2
2
 
3
3
  const { set, isString, map, get } = require('lodash/fp');
4
4
  const { ApplicationError } = require('@strapi/utils').errors;
5
- const { WORKFLOW_MODEL_UID } = require('../../../constants/workflows');
5
+ const { WORKFLOW_MODEL_UID, WORKFLOW_POPULATE } = require('../../../constants/workflows');
6
6
  const { getService } = require('../../../utils');
7
7
  const { getWorkflowContentTypeFilter } = require('../../../utils/review-workflows');
8
8
  const workflowsContentTypesFactory = require('./content-types');
@@ -17,6 +17,16 @@ const processFilters = ({ strapi }, filters = {}) => {
17
17
  return processedFilters;
18
18
  };
19
19
 
20
+ // TODO: How can we improve this? Maybe using traversePopulate?
21
+ const processPopulate = (populate) => {
22
+ // If it does not exist or it's not an object (like an array) return the default populate
23
+ if (!populate) {
24
+ return populate;
25
+ }
26
+
27
+ return WORKFLOW_POPULATE;
28
+ };
29
+
20
30
  module.exports = ({ strapi }) => {
21
31
  const workflowsContentTypes = workflowsContentTypesFactory({ strapi });
22
32
  const workflowsValidationService = getService('review-workflows-validation', { strapi });
@@ -31,7 +41,9 @@ module.exports = ({ strapi }) => {
31
41
  */
32
42
  async find(opts = {}) {
33
43
  const filters = processFilters({ strapi }, opts.filters);
34
- return strapi.entityService.findMany(WORKFLOW_MODEL_UID, { ...opts, filters });
44
+ const populate = processPopulate(opts.populate);
45
+
46
+ return strapi.entityService.findMany(WORKFLOW_MODEL_UID, { ...opts, filters, populate });
35
47
  },
36
48
 
37
49
  /**
@@ -41,7 +53,8 @@ module.exports = ({ strapi }) => {
41
53
  * @returns {Promise<object>} - Workflow object matching the requested ID.
42
54
  */
43
55
  findById(id, opts) {
44
- return strapi.entityService.findOne(WORKFLOW_MODEL_UID, id, opts);
56
+ const populate = processPopulate(opts.populate);
57
+ return strapi.entityService.findOne(WORKFLOW_MODEL_UID, id, { ...opts, populate });
45
58
  },
46
59
 
47
60
  /**
@@ -51,7 +64,7 @@ module.exports = ({ strapi }) => {
51
64
  * @throws {ValidationError} - If the workflow has no stages.
52
65
  */
53
66
  async create(opts) {
54
- let createOpts = { ...opts, populate: { stages: true } };
67
+ let createOpts = { ...opts, populate: WORKFLOW_POPULATE };
55
68
 
56
69
  workflowsValidationService.validateWorkflowStages(opts.data.stages);
57
70
  await workflowsValidationService.validateWorkflowCount(1);
@@ -87,7 +100,7 @@ module.exports = ({ strapi }) => {
87
100
  */
88
101
  async update(workflow, opts) {
89
102
  const stageService = getService('stages', { strapi });
90
- let updateOpts = { ...opts, populate: { stages: true } };
103
+ let updateOpts = { ...opts, populate: { ...WORKFLOW_POPULATE } };
91
104
  let updatedStageIds;
92
105
 
93
106
  await workflowsValidationService.validateWorkflowCount();
@@ -104,7 +117,7 @@ module.exports = ({ strapi }) => {
104
117
  .replaceStages(workflow.stages, opts.data.stages, workflow.contentTypes)
105
118
  .then((stages) => stages.map((stage) => stage.id));
106
119
 
107
- updateOpts = set('data.stages', updatedStageIds, opts);
120
+ updateOpts = set('data.stages', updatedStageIds, updateOpts);
108
121
  }
109
122
 
110
123
  // Update (un)assigned Content Types
@@ -141,7 +154,7 @@ module.exports = ({ strapi }) => {
141
154
 
142
155
  return strapi.db.transaction(async () => {
143
156
  // Delete stages
144
- await stageService.deleteMany(workflow.stages.map((stage) => stage.id));
157
+ await stageService.deleteMany(workflow.stages);
145
158
 
146
159
  // Unassign all content types, this will migrate the content types to null
147
160
  await workflowsContentTypes.migrate({
@@ -4,11 +4,22 @@
4
4
 
5
5
  const { yup, validateYupSchema } = require('@strapi/utils');
6
6
  const { hasStageAttribute } = require('../utils/review-workflows');
7
+ const { STAGE_TRANSITION_UID } = require('../constants/workflows');
7
8
 
8
9
  const stageObject = yup.object().shape({
9
10
  id: yup.number().integer().min(1),
10
11
  name: yup.string().max(255).required(),
11
12
  color: yup.string().matches(/^#(?:[0-9a-fA-F]{3}){1,2}$/i), // hex color
13
+ permissions: yup.array().of(
14
+ yup.object().shape({
15
+ role: yup.number().integer().min(1).required(),
16
+ action: yup.string().oneOf([STAGE_TRANSITION_UID]).required(),
17
+ actionParameters: yup.object().shape({
18
+ from: yup.number().integer().min(1).required(),
19
+ to: yup.number().integer().min(1),
20
+ }),
21
+ })
22
+ ),
12
23
  });
13
24
 
14
25
  const validateUpdateStageOnEntity = yup
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/admin",
3
- "version": "4.13.6",
3
+ "version": "4.14.0-beta.0",
4
4
  "description": "Strapi Admin",
5
5
  "repository": {
6
6
  "type": "git",
@@ -42,14 +42,14 @@
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.13.6",
45
+ "@strapi/data-transfer": "4.14.0-beta.0",
46
46
  "@strapi/design-system": "1.10.1",
47
- "@strapi/helper-plugin": "4.13.6",
47
+ "@strapi/helper-plugin": "4.14.0-beta.0",
48
48
  "@strapi/icons": "1.10.1",
49
- "@strapi/permissions": "4.13.6",
50
- "@strapi/provider-audit-logs-local": "4.13.6",
51
- "@strapi/typescript-utils": "4.13.6",
52
- "@strapi/utils": "4.13.6",
49
+ "@strapi/permissions": "4.14.0-beta.0",
50
+ "@strapi/provider-audit-logs-local": "4.14.0-beta.0",
51
+ "@strapi/typescript-utils": "4.14.0-beta.0",
52
+ "@strapi/utils": "4.14.0-beta.0",
53
53
  "axios": "1.5.0",
54
54
  "bcryptjs": "2.4.3",
55
55
  "browserslist": "^4.17.3",
@@ -154,5 +154,5 @@
154
154
  }
155
155
  }
156
156
  },
157
- "gitHead": "d44586fa075f638f1953bda9623a985c7060e2ad"
157
+ "gitHead": "8145855e7ada0bf94ce1a2f4d1c34fe647e1af53"
158
158
  }
@@ -29,6 +29,12 @@ module.exports = {
29
29
  configurable: false,
30
30
  required: true,
31
31
  },
32
+ actionParameters: {
33
+ type: 'json',
34
+ configurable: false,
35
+ required: false,
36
+ default: {},
37
+ },
32
38
  subject: {
33
39
  type: 'string',
34
40
  minLength: 1,
@@ -26,8 +26,16 @@ const {
26
26
  * @property {string} subject - The subject on which the permission should applies
27
27
  */
28
28
 
29
- const permissionFields = ['id', 'action', 'subject', 'properties', 'conditions', 'role'];
30
- const sanitizedPermissionFields = ['id', 'action', 'subject', 'properties', 'conditions'];
29
+ const permissionFields = [
30
+ 'id',
31
+ 'action',
32
+ 'actionParameters',
33
+ 'subject',
34
+ 'properties',
35
+ 'conditions',
36
+ 'role',
37
+ ];
38
+ const sanitizedPermissionFields = ['id', 'action', 'actionParameters', 'subject', 'properties', 'conditions'];
31
39
 
32
40
  const sanitizePermissionFields = pick(sanitizedPermissionFields);
33
41
 
@@ -36,6 +44,7 @@ const sanitizePermissionFields = pick(sanitizedPermissionFields);
36
44
  * @return {Permission}
37
45
  */
38
46
  const getDefaultPermission = () => ({
47
+ actionParameters: {},
39
48
  conditions: [],
40
49
  properties: {},
41
50
  subject: null,
@@ -24,7 +24,7 @@ const ACTIONS = {
24
24
 
25
25
  const sanitizeRole = omit(['users', 'permissions']);
26
26
 
27
- const COMPARABLE_FIELDS = ['conditions', 'properties', 'subject', 'action'];
27
+ const COMPARABLE_FIELDS = ['conditions', 'properties', 'subject', 'action', 'actionParameters'];
28
28
  const pickComparableFields = pick(COMPARABLE_FIELDS);
29
29
 
30
30
  const jsonClean = (data) => JSON.parse(JSON.stringify(data));
@@ -323,6 +323,13 @@ const displayWarningIfNoSuperAdmin = async () => {
323
323
  const assignPermissions = async (roleId, permissions = []) => {
324
324
  await validatePermissionsExist(permissions);
325
325
 
326
+ // Internal actions are not handled by the role service, so any permission
327
+ // with an internal action is filtered out
328
+ const internalActions = getService('permission')
329
+ .actionProvider.values()
330
+ .filter((action) => action.section === 'internal')
331
+ .map((action) => action.actionId);
332
+
326
333
  const superAdmin = await getService('role').getSuperAdmin();
327
334
  const isSuperAdmin = superAdmin && superAdmin.id === roleId;
328
335
  const assignRole = set('role', roleId);
@@ -342,13 +349,13 @@ const assignPermissions = async (roleId, permissions = []) => {
342
349
  arePermissionsEqual,
343
350
  permissionsWithRole,
344
351
  existingPermissions
345
- );
352
+ ).filter((permission) => !internalActions.includes(permission.action));
346
353
 
347
354
  const permissionsToDelete = differenceWith(
348
355
  arePermissionsEqual,
349
356
  existingPermissions,
350
357
  permissionsWithRole
351
- );
358
+ ).filter((permission) => !internalActions.includes(permission.action));
352
359
 
353
360
  const permissionsToReturn = differenceBy('id', permissionsToDelete, existingPermissions);
354
361
 
@@ -374,7 +381,8 @@ const addPermissions = async (roleId, permissions) => {
374
381
 
375
382
  const permissionsWithRole = permissions
376
383
  .map(set('role', roleId))
377
- .map(sanitizeConditions(conditionProvider));
384
+ .map(sanitizeConditions(conditionProvider))
385
+ .map(permissionDomain.create);
378
386
 
379
387
  return createMany(permissionsWithRole);
380
388
  };
@@ -17,7 +17,7 @@ const registerProviderActionSchema = yup
17
17
  (v) => `${v.path}: The id can only contain lowercase letters, dots and hyphens.`
18
18
  )
19
19
  .required(),
20
- section: yup.string().oneOf(['contentTypes', 'plugins', 'settings']).required(),
20
+ section: yup.string().oneOf(['contentTypes', 'plugins', 'settings', 'internal']).required(),
21
21
  pluginName: yup.mixed().when('section', {
22
22
  is: 'plugins',
23
23
  then: validators.isAPluginName.required(),
@@ -89,112 +89,103 @@ const fieldsPropertyValidation = (action) =>
89
89
  checkNilFields(action)
90
90
  );
91
91
 
92
+ const permission = yup
93
+ .object()
94
+ .shape({
95
+ action: yup
96
+ .string()
97
+ .required()
98
+ .test('action-validity', 'action is not an existing permission action', function (actionId) {
99
+ // If the action field is Nil, ignore the test and let the required check handle the error
100
+ if (isNil(actionId)) {
101
+ return true;
102
+ }
103
+
104
+ return !!getActionFromProvider(actionId);
105
+ }),
106
+ actionParameters: yup.object().nullable(),
107
+ subject: yup
108
+ .string()
109
+ .nullable()
110
+ .test('subject-validity', 'Invalid subject submitted', function (subject) {
111
+ const action = getActionFromProvider(this.options.parent.action);
112
+
113
+ if (!action) {
114
+ return true;
115
+ }
116
+
117
+ if (isNil(action.subjects)) {
118
+ return isNil(subject);
119
+ }
120
+
121
+ if (isArray(action.subjects)) {
122
+ return action.subjects.includes(subject);
123
+ }
124
+
125
+ return false;
126
+ }),
127
+ properties: yup
128
+ .object()
129
+ .test('properties-structure', 'Invalid property set at ${path}', function (properties) {
130
+ const action = getActionFromProvider(this.options.parent.action);
131
+ const hasNoProperties = isEmpty(properties) || isNil(properties);
132
+
133
+ if (!has('options.applyToProperties', action)) {
134
+ return hasNoProperties;
135
+ }
136
+
137
+ if (hasNoProperties) {
138
+ return true;
139
+ }
140
+
141
+ const { applyToProperties } = action.options;
142
+
143
+ if (!isArray(applyToProperties)) {
144
+ return false;
145
+ }
146
+
147
+ return Object.keys(properties).every((property) => applyToProperties.includes(property));
148
+ })
149
+ .test(
150
+ 'fields-property',
151
+ 'Invalid fields property at ${path}',
152
+ async function (properties = {}) {
153
+ const action = getActionFromProvider(this.options.parent.action);
154
+
155
+ if (!action || !properties) {
156
+ return true;
157
+ }
158
+
159
+ if (!actionDomain.appliesToProperty('fields', action)) {
160
+ return true;
161
+ }
162
+
163
+ try {
164
+ await fieldsPropertyValidation(action).validate(properties.fields, {
165
+ strict: true,
166
+ abortEarly: false,
167
+ });
168
+ return true;
169
+ } catch (e) {
170
+ // Propagate fieldsPropertyValidation error with updated path
171
+ throw this.createError({
172
+ message: e.message,
173
+ path: `${this.path}.fields`,
174
+ });
175
+ }
176
+ }
177
+ ),
178
+ conditions: yup.array().of(yup.string()),
179
+ })
180
+ .noUnknown();
181
+
92
182
  const updatePermissions = yup
93
183
  .object()
94
184
  .shape({
95
185
  permissions: yup
96
186
  .array()
97
187
  .required()
98
- .of(
99
- yup
100
- .object()
101
- .shape({
102
- action: yup
103
- .string()
104
- .required()
105
- .test(
106
- 'action-validity',
107
- 'action is not an existing permission action',
108
- function (actionId) {
109
- // If the action field is Nil, ignore the test and let the required check handle the error
110
- if (isNil(actionId)) {
111
- return true;
112
- }
113
-
114
- return !!getActionFromProvider(actionId);
115
- }
116
- ),
117
- subject: yup
118
- .string()
119
- .nullable()
120
- .test('subject-validity', 'Invalid subject submitted', function (subject) {
121
- const action = getActionFromProvider(this.options.parent.action);
122
-
123
- if (!action) {
124
- return true;
125
- }
126
-
127
- if (isNil(action.subjects)) {
128
- return isNil(subject);
129
- }
130
-
131
- if (isArray(action.subjects)) {
132
- return action.subjects.includes(subject);
133
- }
134
-
135
- return false;
136
- }),
137
- properties: yup
138
- .object()
139
- .test(
140
- 'properties-structure',
141
- 'Invalid property set at ${path}',
142
- function (properties) {
143
- const action = getActionFromProvider(this.options.parent.action);
144
- const hasNoProperties = isEmpty(properties) || isNil(properties);
145
-
146
- if (!has('options.applyToProperties', action)) {
147
- return hasNoProperties;
148
- }
149
-
150
- if (hasNoProperties) {
151
- return true;
152
- }
153
-
154
- const { applyToProperties } = action.options;
155
-
156
- if (!isArray(applyToProperties)) {
157
- return false;
158
- }
159
-
160
- return Object.keys(properties).every((property) =>
161
- applyToProperties.includes(property)
162
- );
163
- }
164
- )
165
- .test(
166
- 'fields-property',
167
- 'Invalid fields property at ${path}',
168
- async function (properties = {}) {
169
- const action = getActionFromProvider(this.options.parent.action);
170
-
171
- if (!action || !properties) {
172
- return true;
173
- }
174
-
175
- if (!actionDomain.appliesToProperty('fields', action)) {
176
- return true;
177
- }
178
-
179
- try {
180
- await fieldsPropertyValidation(action).validate(properties.fields, {
181
- strict: true,
182
- abortEarly: false,
183
- });
184
- return true;
185
- } catch (e) {
186
- // Propagate fieldsPropertyValidation error with updated path
187
- throw this.createError({
188
- message: e.message,
189
- path: `${this.path}.fields`,
190
- });
191
- }
192
- }
193
- ),
194
- conditions: yup.array().of(yup.string()),
195
- })
196
- .noUnknown()
197
- )
188
+ .of(permission)
198
189
  .test(
199
190
  'duplicated-permissions',
200
191
  'Some permissions are duplicated (same action and subject)',
@@ -213,5 +204,6 @@ module.exports = {
213
204
  roles,
214
205
  isAPluginName,
215
206
  arrayOfConditionNames,
207
+ permission,
216
208
  updatePermissions,
217
209
  };
@@ -17,8 +17,6 @@ const checkPermissionsSchema = yup.object().shape({
17
17
  ),
18
18
  });
19
19
 
20
- // validatePermissionsExist
21
-
22
20
  const checkPermissionsExist = function (permissions) {
23
21
  const existingActions = getService('permission').actionProvider.values();
24
22
  const failIndex = permissions.findIndex(
@@ -48,7 +46,6 @@ const actionsExistSchema = yup
48
46
  .test('actions-exist', '', checkPermissionsExist);
49
47
 
50
48
  // exports
51
-
52
49
  module.exports = {
53
50
  validatedUpdatePermissionsInput: validateYupSchema(validators.updatePermissions),
54
51
  validatePermissionsExist: validateYupSchema(actionsExistSchema),
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[1227],{21227:function(g,E,t){t.d(E,{ReviewWorkflowsAssigneeEE:function(){return O},ReviewWorkflowsStageEE:function(){return f}});var e=t(32735),s=t(84642),c=t(77981),i=t(8365),r=t(30126),l=t(60216),n=t.n(l),o=t(2121),u=t(68886);function f({color:a,name:A}){const{themeColorName:R}=(0,u.k)(a);return e.createElement(s.k,{alignItems:"center",gap:2,maxWidth:(0,r.Q1)(300)},e.createElement(c.x,{height:2,background:a,borderColor:R==="neutral0"?"neutral150":"transparent",hasRadius:!0,shrink:0,width:2}),e.createElement(i.Z,{fontWeight:"regular",textColor:"neutral700",ellipsis:!0},A))}f.defaultProps={color:o.FT},f.propTypes={color:n().string,name:n().string.isRequired};var T=t(67879),W=t(69997);function O({user:a}){const{formatMessage:A}=(0,T.Z)();return e.createElement(i.Z,{textColor:"neutral800"},(0,W.Gf)(a,A))}O.propTypes={user:n().shape({firstname:n().string,lastname:n().string,username:n().string}).isRequired}},2121:function(g,E,t){t.d(E,{$k:function(){return o},Ef:function(){return O},FT:function(){return T},Nj:function(){return n},Ot:function(){return l},VS:function(){return u},_X:function(){return a},gu:function(){return c},lv:function(){return f},qZ:function(){return i},sN:function(){return s},uL:function(){return W},x4:function(){return r}});var e=t(41865);const s="settings_review-workflows",c="Settings/Review_Workflows/RESET_WORKFLOW",i="Settings/Review_Workflows/SET_WORKFLOW",r="Settings/Review_Workflows/WORKFLOW_DELETE_STAGE",l="Settings/Review_Workflows/WORKFLOW_ADD_STAGE",n="Settings/Review_Workflows/WORKFLOW_UPDATE_STAGE",o="Settings/Review_Workflows/WORKFLOW_UPDATE_STAGE_POSITION",u="Settings/Review_Workflows/WORKFLOW_UPDATE",f={primary600:"Blue",primary200:"Lilac",alternative600:"Violet",alternative200:"Lavender",success600:"Green",success200:"Pale Green",danger500:"Cherry",danger200:"Pink",warning600:"Orange",warning200:"Yellow",secondary600:"Teal",secondary200:"Baby Blue",neutral400:"Gray",neutral0:"White"},T=e.W.colors.primary600,W={STAGE:"stage"},O="numberOfWorkflows",a="stagesPerWorkflow"},68886:function(g,E,t){t.d(E,{k:function(){return c},s:function(){return i}});var e=t(41865),s=t(2121);function c(r){if(!r)return null;const n=Object.entries(e.W.colors).filter(([,o])=>o.toUpperCase()===r.toUpperCase()).reduce((o,[u])=>(s.lv?.[u]&&(o=u),o),null);return n?{themeColorName:n,name:s.lv[n]}:null}function i(){return Object.entries(s.lv).map(([r,l])=>({hex:e.W.colors[r].toUpperCase(),name:l}))}}}]);
@@ -1,114 +0,0 @@
1
- (self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[2237],{61234:function(T,f,e){"use strict";e.d(f,{v:function(){return r}});var t=e(32735),a=e(15062);function r(c,d){const o=(0,a.oR)();(0,t.useEffect)(()=>{o.injectReducer(c,d)},[o,c,d])}},98866:function(T,f,e){"use strict";e.d(f,{q:function(){return c}});var t=e(32735),a=e(30126),r=e(20108);function c({enabled:d}={enabled:!0}){const{get:o}=(0,a.kY)(),{data:h,isError:u,isLoading:s}=(0,r.useQuery)(["ee","license-limit-info"],async()=>{const{data:{data:v}}=await o("/admin/license-limit-information");return v},{enabled:d}),n=t.useMemo(()=>h??{},[h]),g=t.useCallback(v=>(n?.features??[]).find(i=>i.name===v)?.options??{},[n?.features]);return{license:n,getFeature:g,isError:u,isLoading:s}}},77061:function(T,f,e){"use strict";e.d(f,{CI:function(){return c},FP:function(){return o},Js:function(){return u},_V:function(){return r},fC:function(){return a},rI:function(){return h},xn:function(){return d}});var t=e(2121);function a({status:s,data:n}){return{type:t.qZ,payload:{status:s,workflow:n}}}function r(s){return{type:t.x4,payload:{stageId:s}}}function c(s={}){return{type:t.Ot,payload:s}}function d(s,n){return{type:t.Nj,payload:{stageId:s,...n}}}function o(s,n){return{type:t.$k,payload:{newIndex:n,oldIndex:s}}}function h(s){return{type:t.VS,payload:s}}function u(){return{type:t.gu}}},27187:function(T,f,e){"use strict";e.d(f,{eJ:function(){return w},lx:function(){return A},h4:function(){return S},fC:function(){return D}});var t=e(32735),a=e(99226),r=e(95162),c=e(56932),d=e(64092),o=e(30126),h=e(70788),u=e(67879),s=e(17379),n=e(2121),g=e(84642),v=e(8365),l=e(91917),i=e(60216),E=e.n(i),M=e(8471);const x=(0,M.ZP)(g.k)`
2
- svg path {
3
- fill: ${({theme:m})=>m.colors.neutral600};
4
- }
5
- `;function R({name:m}){return t.createElement(g.k,{background:"primary100",borderStyle:"dashed",borderColor:"primary600",borderWidth:"1px",gap:3,hasRadius:!0,padding:3,shadow:"tableShadow",width:(0,o.Q1)(300)},t.createElement(x,{alignItems:"center",background:"neutral200",borderRadius:"50%",height:6,justifyContent:"center",width:6},t.createElement(l.Z,{width:`${8/16}rem`})),t.createElement(v.Z,{fontWeight:"bold"},m))}R.propTypes={name:E().string.isRequired};function C({type:m,item:P}){switch(m){case n.uL.STAGE:return t.createElement(R,{...P});default:return null}}function A(){return t.createElement(s.r,{renderItem:C})}function D({children:m}){return t.createElement(a.A,null,t.createElement(r.o,{tabIndex:-1},t.createElement(c.D,null,m)))}function w({href:m}){const{formatMessage:P}=(0,u.Z)();return t.createElement(o.rU,{startIcon:t.createElement(h.Z,null),to:m},P({id:"global.back",defaultMessage:"Back"}))}function S({title:m,subtitle:P,navigationAction:W,primaryAction:b}){return t.createElement(t.Fragment,null,t.createElement(o.SL,{name:m}),t.createElement(d.T,{navigationAction:W,primaryAction:b,title:m,subtitle:P}))}},90562:function(T,f,e){"use strict";e.d(f,{uT:function(){return C},fC:function(){return w},Dx:function(){return R}});var t=e(32735),a=e(8365),r=e(84642),c=e(21223),d=e(87674),o=e(77981),h=e(14763),u=e(90431),s=e(98610),n=e(60216),g=e.n(n),v=e(67879),l=e(8471),i=e.p+"0cd5f8915b265d5b1856.png";const E="limits-title",M="https://strapi.io/pricing-cloud",x="https://strapi.io/contact-sales";function R({children:S}){return t.createElement(a.Z,{variant:"alpha",id:E},S)}R.propTypes={children:g().node.isRequired};function C({children:S}){return t.createElement(a.Z,{variant:"omega"},S)}C.propTypes={children:g().node.isRequired};function A(){const{formatMessage:S}=(0,v.Z)();return t.createElement(r.k,{gap:2,paddingTop:4},t.createElement(u.Q,{variant:"default",isExternal:!0,href:M},S({id:"Settings.review-workflows.limit.cta.learn",defaultMessage:"Learn more"})),t.createElement(u.Q,{variant:"tertiary",isExternal:!0,href:x},S({id:"Settings.review-workflows.limit.cta.sales",defaultMessage:"Contact Sales"})))}const D=l.ZP.img`
6
- // Margin top|right reverse the padding of ModalBody
7
- margin-right: ${({theme:S})=>`-${S.spaces[7]}`};
8
- margin-top: ${({theme:S})=>`-${S.spaces[7]}`};
9
- width: 360px;
10
- `;function w({children:S,isOpen:m,onClose:P}){const{formatMessage:W}=(0,v.Z)();return m?t.createElement(c.P,{labelledBy:E},t.createElement(d.f,null,t.createElement(r.k,{gap:2,paddingLeft:7,position:"relative"},t.createElement(r.k,{alignItems:"start",direction:"column",gap:2,width:"60%"},S,t.createElement(A,null)),t.createElement(r.k,{justifyContent:"end",height:"100%",width:"40%"},t.createElement(D,{src:i,"aria-hidden":!0,alt:"",loading:"lazy"}),t.createElement(o.x,{display:"flex",position:"absolute",right:0,top:0},t.createElement(h.h,{icon:t.createElement(s.Z,null),"aria-label":W({id:"global.close",defaultMessage:"Close"}),onClick:P})))))):null}w.defaultProps={isOpen:!1},w.propTypes={children:g().node.isRequired,isOpen:g().bool,onClose:g().func.isRequired}},45594:function(T,f,e){"use strict";e.d(f,{U:function(){return L}});var t=e(32735),a=e(77981),r=e(84642),c=e(30126),d=e(60216),o=e.n(d),h=e(67879),u=e(15062),s=e(8471),n=e(77061),g=e(8365),v=e(3042);const l=(0,s.ZP)(v.Z)`
11
- > circle {
12
- fill: ${({theme:p})=>p.colors.neutral150};
13
- }
14
- > path {
15
- fill: ${({theme:p})=>p.colors.neutral600};
16
- }
17
- `,i=(0,s.ZP)(a.x)`
18
- border-radius: 26px;
19
-
20
- svg {
21
- height: ${({theme:p})=>p.spaces[6]};
22
- width: ${({theme:p})=>p.spaces[6]};
23
-
24
- > path {
25
- fill: ${({theme:p})=>p.colors.neutral600};
26
- }
27
- }
28
-
29
- &:hover {
30
- color: ${({theme:p})=>p.colors.primary600} !important;
31
- ${g.Z} {
32
- color: ${({theme:p})=>p.colors.primary600} !important;
33
- }
34
-
35
- ${l} {
36
- > circle {
37
- fill: ${({theme:p})=>p.colors.primary600};
38
- }
39
- > path {
40
- fill: ${({theme:p})=>p.colors.neutral100};
41
- }
42
- }
43
- }
44
-
45
- &:active {
46
- ${g.Z} {
47
- color: ${({theme:p})=>p.colors.primary600};
48
- }
49
-
50
- ${l} {
51
- > circle {
52
- fill: ${({theme:p})=>p.colors.primary600};
53
- }
54
- > path {
55
- fill: ${({theme:p})=>p.colors.neutral100};
56
- }
57
- }
58
- }
59
- `;function E({children:p,...k}){return t.createElement(i,{as:"button",background:"neutral0",border:"neutral150",paddingBottom:3,paddingLeft:4,paddingRight:4,paddingTop:3,shadow:"filterShadow",...k},t.createElement(r.k,{gap:2},t.createElement(l,{"aria-hidden":!0}),t.createElement(g.Z,{variant:"pi",fontWeight:"bold",textColor:"neutral500"},p)))}E.propTypes={children:o().node.isRequired};var M=e(99320),x=e(9435),R=e(9379),C=e(14763),A=e(79624),D=e(10710),w=e(97037),S=e(2846),m=e(4987),P=e(94997),W=e(37405),b=e(92802),K=e(51968),G=e(69242),B=e(69997),N=e(2121),j=e(68886);const Y=(0,j.s)();function y(){return t.createElement(a.x,{background:"primary100",borderStyle:"dashed",borderColor:"primary600",borderWidth:"1px",display:"block",hasRadius:!0,padding:6,shadow:"tableShadow"})}function I({id:p,index:k,canDelete:U,canReorder:ee,canUpdate:F,isOpen:te=!1,stagesCount:H}){const z=O=>`${O+1} of ${H}`,Q=O=>{J($({id:"dnd.grab-item",defaultMessage:"{item}, grabbed. Current position in list: {position}. Press up and down arrow to change position, Spacebar to drop, Escape to cancel."},{item:Z.value,position:z(O)}))},ie=O=>{J($({id:"dnd.drop-item",defaultMessage:"{item}, dropped. Final position in list: {position}."},{item:Z.value,position:z(O)}))},ce=()=>{J($({id:"dnd.cancel-item",defaultMessage:"{item}, dropped. Re-order cancelled."},{item:Z.value}))},de=(O,X)=>{J($({id:"dnd.reorder",defaultMessage:"{item}, moved. New position in list: {position}."},{item:Z.value,position:z(O)})),_((0,n.FP)(X,O))},[re,J]=t.useState(null),{formatMessage:$}=(0,h.Z)(),{trackUsage:ue}=(0,c.rS)(),_=(0,u.I0)(),[ne,fe]=t.useState(te),[Z,ae,me]=(0,b.U$)(`stages.${k}.name`),[q,oe,ge]=(0,b.U$)(`stages.${k}.color`),[{handlerId:pe,isDragging:ve,handleKeyDown:Ee},he,ye,we,se]=(0,G.Y9)(ee,{index:k,item:{name:Z.value},onGrabItem:Q,onDropItem:ie,onMoveItem:de,onCancel:ce,type:N.uL.STAGE}),Te=(0,B.FE)(he,ye),Se=Y.map(({hex:O,name:X})=>({value:O,label:$({id:"Settings.review-workflows.stage.color.name",defaultMessage:"{name}"},{name:X}),color:O}));t.useEffect(()=>{se((0,K.rX)(),{captureDraggingState:!1})},[se,k]);const{themeColorName:Me}=(0,j.k)(q.value)??{};return t.createElement(a.x,{ref:Te},re&&t.createElement(M.T,{"aria-live":"assertive"},re),ve?t.createElement(y,null):t.createElement(x.U,{size:"S",variant:"primary",onToggle:()=>{fe(!ne),ne||ue("willEditStage")},expanded:ne,shadow:"tableShadow",error:ae.error??oe?.error??!1,hasErrorMessage:!1},t.createElement(R.B,{title:Z.value,togglePosition:"left",action:(U||F)&&t.createElement(r.k,null,U&&t.createElement(C.h,{background:"transparent",icon:t.createElement(P.Z,null),label:$({id:"Settings.review-workflows.stage.delete",defaultMessage:"Delete stage"}),noBorder:!0,onClick:()=>_((0,n._V)(p))}),F&&t.createElement(C.h,{background:"transparent",forwardedAs:"div",role:"button",noBorder:!0,tabIndex:0,"data-handler-id":pe,ref:we,label:$({id:"Settings.review-workflows.stage.drag",defaultMessage:"Drag"}),onClick:O=>O.stopPropagation(),onKeyDown:Ee},t.createElement(W.Z,null)))}),t.createElement(A.v,{padding:6,background:"neutral0",hasRadius:!0},t.createElement(D.r,{gap:4},t.createElement(w.P,{col:6},t.createElement(S.o,{...Z,id:Z.name,disabled:!F,label:$({id:"Settings.review-workflows.stage.name.label",defaultMessage:"Stage name"}),error:ae.error??!1,onChange:O=>{me.setValue(O.target.value),_((0,n.xn)(p,{name:O.target.value}))},required:!0})),t.createElement(w.P,{col:6},t.createElement(m.q4,{disabled:!F,error:oe?.error??!1,id:q.name,required:!0,label:$({id:"content-manager.reviewWorkflows.stage.color",defaultMessage:"Color"}),onChange:O=>{ge.setValue(O),_((0,n.xn)(p,{color:O}))},value:q.value.toUpperCase(),startIcon:t.createElement(r.k,{as:"span",height:2,background:q.value,borderColor:Me==="neutral0"?"neutral150":"transparent",hasRadius:!0,shrink:0,width:2})},Se.map(({value:O,label:X,color:le})=>{const{themeColorName:xe}=(0,j.k)(le);return t.createElement(m.ag,{value:O,key:O,startIcon:t.createElement(r.k,{as:"span",height:2,background:le,borderColor:xe==="neutral0"?"neutral150":"transparent",hasRadius:!0,shrink:0,width:2})},X)})))))))}I.propTypes=o().shape({id:o().number.isRequired,color:o().string.isRequired,canDelete:o().bool.isRequired,canReorder:o().bool.isRequired,canUpdate:o().bool.isRequired,stagesCount:o().number.isRequired}).isRequired;const V=(0,s.ZP)(a.x)`
60
- transform: translateX(-50%);
61
- `;function L({canDelete:p,canUpdate:k,stages:U}){const{formatMessage:ee}=(0,h.Z)(),F=(0,u.I0)(),{trackUsage:te}=(0,c.rS)();return t.createElement(r.k,{direction:"column",gap:6,width:"100%"},t.createElement(a.x,{position:"relative",spacing:4,width:"100%"},t.createElement(V,{background:"neutral200",height:"100%",left:"50%",position:"absolute",top:"0",width:2,zIndex:1}),t.createElement(r.k,{direction:"column",alignItems:"stretch",gap:6,zIndex:2,position:"relative",as:"ol"},U.map((H,z)=>{const Q=H?.id??H.__temp_key__;return t.createElement(a.x,{key:`stage-${Q}`,as:"li"},t.createElement(I,{id:Q,index:z,isOpen:!H.id,canDelete:U.length>1&&p,canReorder:U.length>1,canUpdate:k,stagesCount:U.length}))}))),k&&t.createElement(E,{type:"button",onClick:()=>{F((0,n.CI)({name:""})),te("willCreateStage")}},ee({id:"Settings.review-workflows.stage.add",defaultMessage:"Add new stage"})))}L.defaultProps={canDelete:!0,canUpdate:!0,stages:[]},L.propTypes={canDelete:o().bool,canUpdate:o().bool,stages:o().arrayOf(o().shape({id:o().number,__temp_key__:o().number,name:o().string.isRequired}))}},165:function(T,f,e){"use strict";e.d(f,{Y:function(){return x}});var t=e(32735),a=e(74323),r=e(8365),c=e(10710),d=e(97037),o=e(2846),h=e(30126),u=e(92802),s=e(60216),n=e.n(s),g=e(67879),v=e(15062),l=e(8471),i=e(77061);const E=(0,l.ZP)(a.ML)`
62
- padding-left: ${({theme:C})=>C.spaces[7]};
63
- `,M=(0,l.ZP)(r.Z)`
64
- font-style: italic;
65
- `;function x({canUpdate:C,contentTypes:{collectionTypes:A,singleTypes:D},currentWorkflow:w,workflows:S}){const{formatMessage:m,locale:P}=(0,g.Z)(),W=(0,v.I0)(),[b,K,G]=(0,u.U$)("name"),[B,N,j]=(0,u.U$)("contentTypes"),Y=(0,h.Xe)(P,{sensitivity:"base"});return t.createElement(c.r,{background:"neutral0",hasRadius:!0,gap:4,padding:6,shadow:"tableShadow"},t.createElement(d.P,{col:6},t.createElement(o.o,{...b,id:b.name,disabled:!C,label:m({id:"Settings.review-workflows.workflow.name.label",defaultMessage:"Workflow Name"}),error:K.error??!1,onChange:y=>{W((0,i.rI)({name:y.target.value})),G.setValue(y.target.value)},required:!0})),t.createElement(d.P,{col:6},t.createElement(a.NU,{...B,customizeContent:y=>m({id:"Settings.review-workflows.workflow.contentTypes.displayValue",defaultMessage:"{count} {count, plural, one {content type} other {content types}} selected"},{count:y.length}),disabled:!C,error:N.error??!1,id:B.name,label:m({id:"Settings.review-workflows.workflow.contentTypes.label",defaultMessage:"Associated to"}),onChange:y=>{W((0,i.rI)({contentTypes:y})),j.setValue(y)},placeholder:m({id:"Settings.review-workflows.workflow.contentTypes.placeholder",defaultMessage:"Select"})},[...A.length>0?[{label:m({id:"Settings.review-workflows.workflow.contentTypes.collectionTypes.label",defaultMessage:"Collection Types"}),children:A.sort((y,I)=>Y.compare(y.info.displayName,I.info.displayName)).map(y=>({label:y.info.displayName,value:y.uid}))}]:[],...D.length>0?[{label:m({id:"Settings.review-workflows.workflow.contentTypes.singleTypes.label",defaultMessage:"Single Types"}),children:D.map(y=>({label:y.info.displayName,value:y.uid}))}]:[]].map(y=>"children"in y?t.createElement(a.Ab,{key:y.label,label:y.label,values:y.children.map(I=>I.value.toString())},y.children.map(I=>{const{name:V}=S.find(L=>(w&&L.id!==w.id||!w)&&L.contentTypes.includes(I.value))??{};return t.createElement(E,{key:I.value,value:I.value},m({id:"Settings.review-workflows.workflow.contentTypes.assigned.notice",defaultMessage:"{label} {name, select, undefined {} other {<i>(assigned to <em>{name}</em> workflow)</i>}}"},{label:I.label,name:V,em:(...L)=>t.createElement(r.Z,{as:"em",fontWeight:"bold"},L),i:(...L)=>t.createElement(M,null,L)}))})):t.createElement(a.ML,{key:y.value,value:y.value},y.label)))))}const R=n().shape({uid:n().string.isRequired,info:n().shape({displayName:n().string.isRequired}).isRequired});x.defaultProps={canUpdate:!0,currentWorkflow:void 0},x.propTypes={canUpdate:n().bool,contentTypes:n().shape({collectionTypes:n().arrayOf(R).isRequired,singleTypes:n().arrayOf(R).isRequired}).isRequired,currentWorkflow:n().object,workflows:n().array.isRequired}},2121:function(T,f,e){"use strict";e.d(f,{$k:function(){return u},Ef:function(){return l},FT:function(){return g},Nj:function(){return h},Ot:function(){return o},VS:function(){return s},_X:function(){return i},gu:function(){return r},lv:function(){return n},qZ:function(){return c},sN:function(){return a},uL:function(){return v},x4:function(){return d}});var t=e(41865);const a="settings_review-workflows",r="Settings/Review_Workflows/RESET_WORKFLOW",c="Settings/Review_Workflows/SET_WORKFLOW",d="Settings/Review_Workflows/WORKFLOW_DELETE_STAGE",o="Settings/Review_Workflows/WORKFLOW_ADD_STAGE",h="Settings/Review_Workflows/WORKFLOW_UPDATE_STAGE",u="Settings/Review_Workflows/WORKFLOW_UPDATE_STAGE_POSITION",s="Settings/Review_Workflows/WORKFLOW_UPDATE",n={primary600:"Blue",primary200:"Lilac",alternative600:"Violet",alternative200:"Lavender",success600:"Green",success200:"Pale Green",danger500:"Cherry",danger200:"Pink",warning600:"Orange",warning200:"Yellow",secondary600:"Teal",secondary200:"Baby Blue",neutral400:"Gray",neutral0:"White"},g=t.W.colors.primary600,v={STAGE:"stage"},l="numberOfWorkflows",i="stagesPerWorkflow"},32329:function(T,f,e){"use strict";e.d(f,{n:function(){return r}});var t=e(30126),a=e(20108);function r(c={}){const{get:d}=(0,t.kY)(),{id:o="",...h}=c,u={populate:"stages"},{data:s,isLoading:n,status:g,refetch:v}=(0,a.useQuery)(["review-workflows","workflows",o],async()=>(await d(`/admin/review-workflows/workflows/${o}`,{params:{...u,...h}})).data);let l=[];return o&&s?.data?l=[s.data]:Array.isArray(s?.data)&&(l=s.data),{meta:s?.meta??{},workflows:l,isLoading:n,status:g,refetch:v}}},79989:function(T,f,e){"use strict";e.d(f,{E:function(){return d},I:function(){return o}});var t=e(97889),a=e(89793),r=e.n(a),c=e(2121);const d={status:"loading",serverState:{workflow:null},clientState:{currentWorkflow:{data:{name:"",contentTypes:[],stages:[]},isDirty:!1,hasDeletedServerStages:!1}}};function o(u=d,s){return(0,t.Uy)(u,n=>{const{payload:g}=s;switch(s.type){case c.qZ:{const{status:v,workflow:l}=g;n.status=v,l&&(n.serverState.workflow=l,n.clientState.currentWorkflow.data={...l,stages:l.stages.map(i=>({...i,color:i?.color??c.FT}))}),n.clientState.currentWorkflow.hasDeletedServerStages=!1;break}case c.gu:{n.clientState.currentWorkflow.data=d.clientState.currentWorkflow.data,n.serverState=d.serverState;break}case c.x4:{const{stageId:v}=g,{currentWorkflow:l}=u.clientState;n.clientState.currentWorkflow.data.stages=l.data.stages.filter(i=>(i?.id??i.__temp_key__)!==v),l.hasDeletedServerStages||(n.clientState.currentWorkflow.hasDeletedServerStages=!!(u.serverState.workflow?.stages??[]).find(i=>i.id===v));break}case c.Ot:{const{currentWorkflow:v}=u.clientState;v.data||(n.clientState.currentWorkflow.data={stages:[]});const l=h(n.clientState.currentWorkflow.data.stages);n.clientState.currentWorkflow.data.stages.push({...g,color:g?.color??c.FT,__temp_key__:l});break}case c.Nj:{const{currentWorkflow:v}=u.clientState,{stageId:l,...i}=g;n.clientState.currentWorkflow.data.stages=v.data.stages.map(E=>(E.id??E.__temp_key__)===l?{...E,...i}:E);break}case c.$k:{const{currentWorkflow:{data:{stages:v}}}=u.clientState,{newIndex:l,oldIndex:i}=g;if(l>=0&&l<v.length){const E=v[i];let M=[...v];M.splice(i,1),M.splice(l,0,E),n.clientState.currentWorkflow.data.stages=M}break}case c.VS:{n.clientState.currentWorkflow.data={...n.clientState.currentWorkflow.data,...g};break}default:break}u.clientState.currentWorkflow.data&&n.serverState.workflow?n.clientState.currentWorkflow.isDirty=!r()((0,t.Vk)(n.clientState.currentWorkflow).data,n.serverState.workflow):n.clientState.currentWorkflow.isDirty=!0})}const h=(u=[])=>{const s=u.map(n=>n.id??n.__temp_key__);return Math.max(...s,-1)+1}},68886:function(T,f,e){"use strict";e.d(f,{k:function(){return r},s:function(){return c}});var t=e(41865),a=e(2121);function r(d){if(!d)return null;const h=Object.entries(t.W.colors).filter(([,u])=>u.toUpperCase()===d.toUpperCase()).reduce((u,[s])=>(a.lv?.[s]&&(u=s),u),null);return h?{themeColorName:h,name:a.lv[h]}:null}function c(){return Object.entries(a.lv).map(([d,o])=>({hex:t.W.colors[d].toUpperCase(),name:o}))}},82920:function(T,f,e){"use strict";e.d(f,{V:function(){return c}});var t=e(3040),a=e.n(t),r=e(24346);async function c({values:d,formatMessage:o}){const h=r.Ry({contentTypes:r.IX().of(r.Z_()),name:r.Z_().max(255,o({id:"Settings.review-workflows.validation.name.max-length",defaultMessage:"Name can not be longer than 255 characters"})).required(),stages:r.IX().of(r.Ry().shape({name:r.Z_().required(o({id:"Settings.review-workflows.validation.stage.name",defaultMessage:"Name is required"})).max(255,o({id:"Settings.review-workflows.validation.stage.max-length",defaultMessage:"Name can not be longer than 255 characters"})).test("unique-name",o({id:"Settings.review-workflows.validation.stage.duplicate",defaultMessage:"Stage name must be unique"}),function(u){const{options:{context:s}}=this;return s.stages.filter(n=>n.name===u).length===1}),color:r.Z_().required(o({id:"Settings.review-workflows.validation.stage.color",defaultMessage:"Color is required"})).matches(/^#(?:[0-9a-fA-F]{3}){1,2}$/i)})).min(1)});try{return await h.validate(d,{abortEarly:!1,context:d}),!0}catch(u){let s={};return u instanceof r.p8&&u.inner.forEach(n=>{a()(s,n.path,n.message)}),s}}},51355:function(T,f,e){var t=e(94318),a=e(3387),r="[object Boolean]";function c(d){return d===!0||d===!1||a(d)&&t(d)==r}T.exports=c},95919:function(T,f,e){var t=e(80022);function a(r){return t(r)&&r!=+r}T.exports=a},80022:function(T,f,e){var t=e(94318),a=e(3387),r="[object Number]";function c(d){return typeof d=="number"||a(d)&&t(d)==r}T.exports=c},9435:function(T,f,e){"use strict";e.d(f,{U:function(){return v},y:function(){return n}});var t=e(74512),a=e(32735),r=e(8471),c=e(85612),d=e(37808),o=e(8365),h=e(84642),u=e(77981);const s=({theme:l,expanded:i,variant:E,disabled:M,error:x})=>x?`1px solid ${l.colors.danger600} !important`:M?`1px solid ${l.colors.neutral150}`:i?`1px solid ${l.colors.primary600}`:E==="primary"?`1px solid ${l.colors.neutral0}`:`1px solid ${l.colors.neutral100}`,n=(0,r.ZP)(o.Z)``,g=(0,r.ZP)(u.x)`
66
- border: ${s};
67
-
68
- &:hover:not([aria-disabled='true']) {
69
- border: 1px solid ${({theme:l})=>l.colors.primary600};
70
-
71
- ${n} {
72
- color: ${({theme:l,expanded:i})=>i?void 0:l.colors.primary700};
73
- }
74
-
75
- ${o.Z} {
76
- color: ${({theme:l,expanded:i})=>i?void 0:l.colors.primary600};
77
- }
78
-
79
- & > ${h.k} {
80
- background: ${({theme:l})=>l.colors.primary100};
81
- }
82
-
83
- [data-strapi-dropdown='true'] {
84
- background: ${({theme:l})=>l.colors.primary200};
85
- }
86
- }
87
- `,v=({children:l,disabled:i=!1,error:E,expanded:M=!1,hasErrorMessage:x=!0,id:R,onToggle:C,toggle:A,size:D="M",variant:w="primary",shadow:S})=>{const m=(0,d.M)(R),P=a.useMemo(()=>({expanded:M,onToggle:C,toggle:A,id:m,size:D,variant:w,disabled:i}),[i,M,m,C,D,A,w]);return(0,t.jsxs)(c.S.Provider,{value:P,children:[(0,t.jsx)(g,{"data-strapi-expanded":M,disabled:i,"aria-disabled":i,expanded:M,hasRadius:!0,variant:w,error:E,shadow:S,children:l}),E&&x&&(0,t.jsx)(u.x,{paddingTop:1,children:(0,t.jsx)(o.Z,{variant:"pi",textColor:"danger600",children:E})})]})}},79624:function(T,f,e){"use strict";e.d(f,{v:function(){return c}});var t=e(74512),a=e(85612),r=e(77981);const c=({children:d,...o})=>{const{expanded:h,id:u}=(0,a.A)();if(!h)return null;const s=`accordion-content-${u}`,n=`accordion-label-${u}`,g=`accordion-desc-${u}`;return(0,t.jsx)(r.x,{role:"region",id:s,"aria-labelledby":n,"aria-describedby":g,...o,children:d})}},85612:function(T,f,e){"use strict";e.d(f,{A:function(){return r},S:function(){return a}});var t=e(32735);const a=(0,t.createContext)({disabled:!1,expanded:!1,id:"",size:"M",variant:"primary"}),r=()=>(0,t.useContext)(a)},9379:function(T,f,e){"use strict";e.d(f,{B:function(){return l}});var t=e(74512),a=e(91917),r=e(8471),c=e(9435),d=e(85612);const o=({expanded:i,disabled:E,variant:M})=>{let x="neutral100";return i?x="primary100":E?x="neutral150":M==="primary"&&(x="neutral0"),x};var h=e(43743),u=e(18129),s=e(84642),n=e(8365);const g=(0,r.ZP)(h.A)`
88
- text-align: left;
89
-
90
- // necessary to make the ellipsis prop work on the title
91
- > span {
92
- max-width: 100%;
93
- }
94
-
95
- svg {
96
- width: ${14/16}rem;
97
- height: ${14/16}rem;
98
-
99
- path {
100
- fill: ${({theme:i,expanded:E})=>E?i.colors.primary600:i.colors.neutral500};
101
- }
102
- }
103
- `,v=(0,r.ZP)(s.k)`
104
- min-height: ${({theme:i,size:E})=>i.sizes.accordions[E]};
105
- border-radius: ${({theme:i,expanded:E})=>E?`${i.borderRadius} ${i.borderRadius} 0 0`:i.borderRadius};
106
-
107
- &:hover {
108
- svg {
109
- path {
110
- fill: ${({theme:i})=>i.colors.primary600};
111
- }
112
- }
113
- }
114
- `,l=({title:i,description:E,as:M="span",togglePosition:x="right",action:R,...C})=>{const{onToggle:A,toggle:D,expanded:w,id:S,size:m,variant:P,disabled:W}=(0,d.A)(),b=`accordion-content-${S}`,K=`accordion-label-${S}`,G=`accordion-desc-${S}`,B=m==="M"?6:4,N=m==="M"?B:B-2,j=o({expanded:w,disabled:W,variant:P}),y={as:M,fontWeight:m==="S"?"bold":void 0,id:K,textColor:w?"primary600":"neutral700",ellipsis:!0,variant:m==="M"?"delta":void 0},I=w?"primary600":"neutral600",V=w?"primary200":"neutral200",L=m==="M"?`${32/16}rem`:`${24/16}rem`,p=()=>{W||(D&&!A?(console.warn('Deprecation warning: Usage of "toggle" prop in Accordion component is deprecated. This is discouraged and will be removed in the next major release. Please use "onToggle" instead'),D()):A&&A())},k=(0,t.jsx)(s.k,{justifyContent:"center",borderRadius:"50%",height:L,width:L,transform:w?"rotate(180deg)":void 0,"data-strapi-dropdown":!0,"aria-hidden":!0,as:"span",background:V,cursor:W?"not-allowed":"pointer",onClick:p,shrink:0,children:(0,t.jsx)(u.J,{as:a.Z,width:m==="M"?`${11/16}rem`:`${8/16}rem`,color:w?"primary600":"neutral600"})});return(0,t.jsx)(v,{paddingBottom:N,paddingLeft:B,paddingRight:B,paddingTop:N,background:j,expanded:w,size:m,justifyContent:"space-between",cursor:W?"not-allowed":"",children:(0,t.jsxs)(s.k,{gap:3,flex:1,maxWidth:"100%",children:[x==="left"&&k,(0,t.jsx)(g,{onClick:p,"aria-disabled":W,"aria-expanded":w,"aria-controls":b,"aria-labelledby":K,"data-strapi-accordion-toggle":!0,expanded:w,type:"button",flex:1,minWidth:0,...C,children:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(c.y,{...y,children:i}),E&&(0,t.jsx)(n.Z,{as:"p",id:G,textColor:I,children:E})]})}),x==="right"&&(0,t.jsxs)(s.k,{gap:3,children:[k,R]}),x==="left"&&R]})})}},70788:function(T,f,e){"use strict";e.d(f,{Z:function(){return r}});var t=e(74512);const a=c=>(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1rem",height:"1rem",fill:"none",viewBox:"0 0 24 24",...c,children:(0,t.jsx)("path",{fill:"#212134",d:"M24 13.3a.2.2 0 0 1-.2.2H5.74l8.239 8.239a.2.2 0 0 1 0 .282L12.14 23.86a.2.2 0 0 1-.282 0L.14 12.14a.2.2 0 0 1 0-.282L11.86.14a.2.2 0 0 1 .282 0L13.98 1.98a.2.2 0 0 1 0 .282L5.74 10.5H23.8c.11 0 .2.09.2.2v2.6Z"})}),r=a},37405:function(T,f,e){"use strict";e.d(f,{Z:function(){return r}});var t=e(74512);const a=c=>(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1rem",height:"1rem",fill:"none",viewBox:"0 0 24 24",...c,children:[(0,t.jsx)("path",{fill:"#212134",d:"M16.563 5.587a2.503 2.503 0 1 0 0-5.007 2.503 2.503 0 0 0 0 5.007Z"}),(0,t.jsx)("path",{fill:"#212134",d:"M18.487 3.083c-.012.788-.487 1.513-1.229 1.797a1.954 1.954 0 0 1-2.184-.574A1.943 1.943 0 0 1 14.9 2.11c.4-.684 1.2-1.066 1.981-.927a1.954 1.954 0 0 1 1.606 1.9c.011.748 1.17.748 1.158 0A3.138 3.138 0 0 0 17.565.17c-1.176-.423-2.567-.03-3.36.933-.83 1.002-.968 2.45-.284 3.575.678 1.124 1.993 1.674 3.273 1.431 1.432-.272 2.428-1.593 2.451-3.019.012-.753-1.147-.753-1.158-.006ZM16.563 14.372a2.503 2.503 0 1 0 0-5.007 2.503 2.503 0 0 0 0 5.007Z"}),(0,t.jsx)("path",{fill:"#212134",d:"M18.487 11.867c-.012.789-.487 1.513-1.229 1.797a1.954 1.954 0 0 1-2.184-.574 1.943 1.943 0 0 1-.174-2.196c.4-.684 1.2-1.066 1.981-.927.928.156 1.588.968 1.606 1.9.011.748 1.17.748 1.158 0a3.138 3.138 0 0 0-2.08-2.914c-1.176-.423-2.567-.029-3.36.933-.83 1.002-.968 2.45-.284 3.575.678 1.124 1.993 1.675 3.273 1.431 1.432-.272 2.428-1.593 2.451-3.019.012-.753-1.147-.753-1.158-.005ZM16.563 23.392a2.503 2.503 0 1 0 0-5.006 2.503 2.503 0 0 0 0 5.006Z"}),(0,t.jsx)("path",{fill:"#212134",d:"M18.487 20.89c-.012.787-.487 1.512-1.229 1.796a1.954 1.954 0 0 1-2.184-.574 1.943 1.943 0 0 1-.174-2.196c.4-.684 1.2-1.066 1.981-.927.928.156 1.588.967 1.606 1.9.011.748 1.17.748 1.158 0a3.138 3.138 0 0 0-2.08-2.914c-1.176-.423-2.567-.03-3.36.933-.83 1.002-.968 2.45-.284 3.575.678 1.124 1.993 1.674 3.273 1.431 1.432-.272 2.428-1.593 2.451-3.019.012-.753-1.147-.753-1.158-.006ZM7.378 5.622a2.503 2.503 0 1 0 0-5.007 2.503 2.503 0 0 0 0 5.007Z"}),(0,t.jsx)("path",{fill:"#212134",d:"M9.302 3.119c-.011.788-.486 1.512-1.228 1.796a1.954 1.954 0 0 1-2.185-.574 1.943 1.943 0 0 1-.173-2.196c.4-.684 1.199-1.066 1.981-.927a1.943 1.943 0 0 1 1.605 1.9c.012.748 1.17.748 1.16 0A3.138 3.138 0 0 0 8.38.205c-1.176-.423-2.567-.029-3.36.933-.83 1.002-.968 2.45-.285 3.575.678 1.124 1.994 1.675 3.274 1.431 1.431-.272 2.428-1.593 2.451-3.019.012-.753-1.147-.753-1.159-.005ZM7.378 14.406a2.503 2.503 0 1 0 0-5.006 2.503 2.503 0 0 0 0 5.006Z"}),(0,t.jsx)("path",{fill:"#212134",d:"M9.302 11.902c-.011.788-.486 1.513-1.228 1.797a1.954 1.954 0 0 1-2.185-.574 1.943 1.943 0 0 1-.173-2.196c.4-.684 1.199-1.066 1.981-.927a1.943 1.943 0 0 1 1.605 1.9c.012.748 1.17.748 1.16 0A3.138 3.138 0 0 0 8.38 8.988c-1.176-.423-2.567-.03-3.36.933-.83 1.002-.968 2.45-.285 3.575.678 1.124 1.994 1.674 3.274 1.431 1.431-.272 2.428-1.593 2.451-3.019.012-.753-1.147-.753-1.159-.006ZM7.378 23.427a2.503 2.503 0 1 0 0-5.007 2.503 2.503 0 0 0 0 5.007Z"}),(0,t.jsx)("path",{fill:"#212134",d:"M9.302 20.924c-.011.788-.486 1.513-1.228 1.797a1.954 1.954 0 0 1-2.185-.574 1.943 1.943 0 0 1-.173-2.196c.4-.684 1.199-1.066 1.981-.927.933.156 1.594.967 1.605 1.9.012.748 1.17.748 1.16 0A3.139 3.139 0 0 0 8.38 18.01c-1.176-.423-2.567-.03-3.36.933-.83 1.002-.968 2.45-.285 3.569.678 1.124 1.994 1.675 3.274 1.431 1.431-.272 2.428-1.593 2.451-3.019.012-.747-1.147-.747-1.159 0Z"})]}),r=a},3042:function(T,f,e){"use strict";e.d(f,{Z:function(){return r}});var t=e(74512);const a=c=>(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1rem",height:"1rem",fill:"none",viewBox:"0 0 24 24",...c,children:[(0,t.jsx)("circle",{cx:12,cy:12,r:12,fill:"#212134"}),(0,t.jsx)("path",{fill:"#F6F6F9",d:"M17 12.569c0 .124-.1.224-.225.224h-3.981v3.982c0 .124-.101.225-.226.225h-1.136a.225.225 0 0 1-.226-.225v-3.981H7.226A.225.225 0 0 1 7 12.567v-1.136c0-.125.1-.226.225-.226h3.982V7.226c0-.124.1-.225.224-.225h1.138c.124 0 .224.1.224.225v3.982h3.982c.124 0 .225.1.225.224v1.138Z"})]}),r=a}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[4174],{84174:function(v,i,e){e.r(i),e.d(i,{REVIEW_WORKFLOW_FILTERS:function(){return P}});var l=e(69997),t=e(32735),u=e(70843),c=e(8241),a=e(60216),n=e.n(a),r=e(67879),o=e(48586),s=e(97108);const E=({value:T,onChange:A})=>{const{formatMessage:W}=(0,r.Z)(),{users:p,isLoading:S}=(0,s.R)();return t.createElement(u.hQ,{value:T,"aria-label":W({id:"content-manager.components.Filters.usersSelect.label",defaultMessage:"Search and select an user to filter"}),onChange:A,loading:S},p.map(O=>t.createElement(c.O,{key:O.id,value:O.id.toString()},(0,o.G)(O,W))))};E.propTypes={onChange:n().func.isRequired,value:n().string},E.defaultProps={value:""};var d=e(4987),g=e(84642),f=e(8365),m=e(35547),C=e(32329),y=e(68886);const R=({value:T,onChange:A,uid:W})=>{const{formatMessage:p}=(0,r.Z)(),{workflows:[S],isLoading:O}=(0,C.n)({filters:{contentTypes:W}});return t.createElement(d.q4,{"aria-label":p({id:"content-manager.components.Filters.reviewWorkflows.label",defaultMessage:"Search and select an workflow stage to filter"}),value:T,onChange:A,loading:O,customizeContent:()=>t.createElement(g.k,{as:"span",justifyContent:"space-between",alignItems:"center",width:"100%"},t.createElement(f.Z,{textColor:"neutral800",ellipsis:!0},T),O?t.createElement(m.a,{small:!0,style:{display:"flex"}}):null)},(S?.stages??[]).map(({id:h,color:L,name:w})=>{const{themeColorName:F}=(0,y.k)(L);return t.createElement(d.ag,{key:h,startIcon:t.createElement(g.k,{height:2,background:L,borderColor:F==="neutral0"?"neutral150":"transparent",hasRadius:!0,shrink:0,width:2}),value:w},w)}))};R.defaultProps={value:""},R.propTypes={onChange:n().func.isRequired,uid:n().string.isRequired,value:n().string};const P=[{fieldSchema:{type:"relation",mainField:{name:"name",schema:{type:"string"}}},metadatas:{customInput:R,label:{id:(0,l.OB)("containers.ListPage.table-headers.reviewWorkflows.stage"),defaultMessage:"Review stage"}},name:"strapi_stage"},{fieldSchema:{type:"relation",mainField:{name:"id",schema:{type:"int"}}},metadatas:{customInput:E,customOperators:[{intlLabel:{id:"components.FilterOptions.FILTER_TYPES.$eq",defaultMessage:"is"},value:"$eq"},{intlLabel:{id:"components.FilterOptions.FILTER_TYPES.$ne",defaultMessage:"is not"},value:"$ne"}],label:{id:(0,l.OB)("containers.ListPage.table-headers.reviewWorkflows.assignee.label"),defaultMessage:"Assignee"}},name:"strapi_assignee"}]},2121:function(v,i,e){e.d(i,{$k:function(){return o},Ef:function(){return f},FT:function(){return d},Nj:function(){return r},Ot:function(){return n},VS:function(){return s},_X:function(){return m},gu:function(){return u},lv:function(){return E},qZ:function(){return c},sN:function(){return t},uL:function(){return g},x4:function(){return a}});var l=e(41865);const t="settings_review-workflows",u="Settings/Review_Workflows/RESET_WORKFLOW",c="Settings/Review_Workflows/SET_WORKFLOW",a="Settings/Review_Workflows/WORKFLOW_DELETE_STAGE",n="Settings/Review_Workflows/WORKFLOW_ADD_STAGE",r="Settings/Review_Workflows/WORKFLOW_UPDATE_STAGE",o="Settings/Review_Workflows/WORKFLOW_UPDATE_STAGE_POSITION",s="Settings/Review_Workflows/WORKFLOW_UPDATE",E={primary600:"Blue",primary200:"Lilac",alternative600:"Violet",alternative200:"Lavender",success600:"Green",success200:"Pale Green",danger500:"Cherry",danger200:"Pink",warning600:"Orange",warning200:"Yellow",secondary600:"Teal",secondary200:"Baby Blue",neutral400:"Gray",neutral0:"White"},d=l.W.colors.primary600,g={STAGE:"stage"},f="numberOfWorkflows",m="stagesPerWorkflow"},32329:function(v,i,e){e.d(i,{n:function(){return u}});var l=e(30126),t=e(20108);function u(c={}){const{get:a}=(0,l.kY)(),{id:n="",...r}=c,o={populate:"stages"},{data:s,isLoading:E,status:d,refetch:g}=(0,t.useQuery)(["review-workflows","workflows",n],async()=>(await a(`/admin/review-workflows/workflows/${n}`,{params:{...o,...r}})).data);let f=[];return n&&s?.data?f=[s.data]:Array.isArray(s?.data)&&(f=s.data),{meta:s?.meta??{},workflows:f,isLoading:E,status:d,refetch:g}}},68886:function(v,i,e){e.d(i,{k:function(){return u},s:function(){return c}});var l=e(41865),t=e(2121);function u(a){if(!a)return null;const r=Object.entries(l.W.colors).filter(([,o])=>o.toUpperCase()===a.toUpperCase()).reduce((o,[s])=>(t.lv?.[s]&&(o=s),o),null);return r?{themeColorName:r,name:t.lv[r]}:null}function c(){return Object.entries(t.lv).map(([a,n])=>({hex:l.W.colors[a].toUpperCase(),name:n}))}}}]);