@strapi/admin 4.12.0-beta.4 → 4.12.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.
- package/admin/src/content-manager/pages/ListView/components/BulkActionButtons/ConfirmBulkActionDialog/index.js +2 -0
- package/admin/src/content-manager/pages/ListView/components/BulkActionButtons/SelectedEntriesModal/index.js +83 -36
- package/admin/src/pages/AuthPage/components/Register/index.js +0 -4
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/Events/index.js +1 -1
- package/admin/src/translations/en.json +1 -0
- package/build/7065.ec811562.chunk.js +114 -0
- package/build/{9806.91360bb6.chunk.js → 9806.aa25371d.chunk.js} +10 -10
- package/build/{Admin-authenticatedApp.24998de8.chunk.js → Admin-authenticatedApp.376233ff.chunk.js} +1 -1
- package/build/{admin-app.c2e4e128.chunk.js → admin-app.1c3f7fd6.chunk.js} +8 -8
- package/build/{content-manager.8772445b.chunk.js → content-manager.e9205db1.chunk.js} +95 -95
- package/build/{en-json.4c733bd1.chunk.js → en-json.e34140fc.chunk.js} +1 -1
- package/build/index.html +1 -1
- package/build/{main.ef5fb1a8.js → main.1e3b0985.js} +281 -281
- package/build/review-workflows-settings-create-view.05758184.chunk.js +1 -0
- package/build/review-workflows-settings-edit-view.c33f7c58.chunk.js +1 -0
- package/build/{review-workflows-settings-list-view.3ee9190d.chunk.js → review-workflows-settings-list-view.f055e1be.chunk.js} +8 -8
- package/build/{runtime~main.c99f4c36.js → runtime~main.58ec8df6.js} +2 -2
- package/build/sso-settings-page.7c9b2fd9.chunk.js +1 -0
- package/build/{webhook-edit-page.a91f27a1.chunk.js → webhook-edit-page.6cb479ff.chunk.js} +2 -2
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/WorkflowAttributes/WorkflowAttributes.js +85 -9
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/CreateView/CreateView.js +61 -4
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/EditView/EditView.js +71 -21
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/ListView/ListView.js +1 -2
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/reducer/index.js +1 -1
- package/ee/admin/pages/SettingsPage/pages/SingleSignOn/index.js +2 -8
- package/ee/server/bootstrap.js +2 -0
- package/ee/server/services/auth.js +1 -1
- package/ee/server/services/index.js +1 -0
- package/ee/server/services/review-workflows/metrics/index.js +51 -0
- package/ee/server/services/review-workflows/metrics/weekly-metrics.js +76 -0
- package/ee/server/services/review-workflows/workflows/index.js +5 -0
- package/ee/server/validation/authentication.js +6 -1
- package/package.json +9 -9
- package/build/7065.99ca8ab1.chunk.js +0 -112
- package/build/review-workflows-settings-create-view.d4b5dbb8.chunk.js +0 -1
- package/build/review-workflows-settings-edit-view.77299c63.chunk.js +0 -1
- package/build/sso-settings-page.3a1ed8c9.chunk.js +0 -1
- package/ee/server/services/review-workflows/metrics.js +0 -24
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
import { Button, Flex, Loader } from '@strapi/design-system';
|
|
3
|
+
import { Button, Flex, Loader, Typography } from '@strapi/design-system';
|
|
4
4
|
import {
|
|
5
5
|
ConfirmDialog,
|
|
6
6
|
useAPIErrorHandler,
|
|
@@ -45,10 +45,10 @@ export function ReviewWorkflowsEditView() {
|
|
|
45
45
|
const {
|
|
46
46
|
isLoading: isWorkflowLoading,
|
|
47
47
|
meta,
|
|
48
|
-
workflows
|
|
48
|
+
workflows,
|
|
49
49
|
status: workflowStatus,
|
|
50
50
|
refetch,
|
|
51
|
-
} = useReviewWorkflows(
|
|
51
|
+
} = useReviewWorkflows();
|
|
52
52
|
const { collectionTypes, singleTypes, isLoading: isLoadingModels } = useContentTypes();
|
|
53
53
|
const {
|
|
54
54
|
status,
|
|
@@ -56,18 +56,23 @@ export function ReviewWorkflowsEditView() {
|
|
|
56
56
|
currentWorkflow: {
|
|
57
57
|
data: currentWorkflow,
|
|
58
58
|
isDirty: currentWorkflowIsDirty,
|
|
59
|
-
hasDeletedServerStages
|
|
59
|
+
hasDeletedServerStages,
|
|
60
60
|
},
|
|
61
61
|
},
|
|
62
62
|
} = useSelector((state) => state?.[REDUX_NAMESPACE] ?? initialState);
|
|
63
63
|
const {
|
|
64
64
|
allowedActions: { canDelete, canUpdate },
|
|
65
65
|
} = useRBAC(permissions.settings['review-workflows']);
|
|
66
|
-
const [
|
|
66
|
+
const [savePrompts, setSavePrompts] = React.useState({});
|
|
67
67
|
const { getFeature, isLoading: isLicenseLoading } = useLicenseLimits();
|
|
68
68
|
const [showLimitModal, setShowLimitModal] = React.useState(false);
|
|
69
69
|
const [initialErrors, setInitialErrors] = React.useState(null);
|
|
70
70
|
|
|
71
|
+
const workflow = workflows.find((workflow) => workflow.id === parseInt(workflowId, 10));
|
|
72
|
+
const contentTypesFromOtherWorkflows = workflows
|
|
73
|
+
.filter((workflow) => workflow.id !== parseInt(workflowId, 10))
|
|
74
|
+
.flatMap((workflow) => workflow.contentTypes);
|
|
75
|
+
|
|
71
76
|
const { mutateAsync, isLoading } = useMutation(
|
|
72
77
|
async ({ workflow }) => {
|
|
73
78
|
const {
|
|
@@ -125,15 +130,15 @@ export function ReviewWorkflowsEditView() {
|
|
|
125
130
|
await updateWorkflow(currentWorkflow);
|
|
126
131
|
await refetch();
|
|
127
132
|
|
|
128
|
-
|
|
133
|
+
setSavePrompts({});
|
|
129
134
|
};
|
|
130
135
|
|
|
131
136
|
const handleConfirmDeleteDialog = async () => {
|
|
132
137
|
await submitForm();
|
|
133
138
|
};
|
|
134
139
|
|
|
135
|
-
const
|
|
136
|
-
|
|
140
|
+
const handleConfirmClose = () => {
|
|
141
|
+
setSavePrompts({});
|
|
137
142
|
};
|
|
138
143
|
|
|
139
144
|
const formik = useFormik({
|
|
@@ -141,9 +146,11 @@ export function ReviewWorkflowsEditView() {
|
|
|
141
146
|
initialErrors,
|
|
142
147
|
initialValues: currentWorkflow,
|
|
143
148
|
async onSubmit() {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
149
|
+
const isContentTypeReassignment = currentWorkflow.contentTypes.some((contentType) =>
|
|
150
|
+
contentTypesFromOtherWorkflows.includes(contentType)
|
|
151
|
+
);
|
|
152
|
+
|
|
153
|
+
if (
|
|
147
154
|
limits?.[CHARGEBEE_WORKFLOW_ENTITLEMENT_NAME] &&
|
|
148
155
|
meta?.workflowCount > parseInt(limits[CHARGEBEE_WORKFLOW_ENTITLEMENT_NAME], 10)
|
|
149
156
|
) {
|
|
@@ -165,6 +172,14 @@ export function ReviewWorkflowsEditView() {
|
|
|
165
172
|
parseInt(limits[CHARGEBEE_STAGES_PER_WORKFLOW_ENTITLEMENT_NAME], 10)
|
|
166
173
|
) {
|
|
167
174
|
setShowLimitModal('stage');
|
|
175
|
+
} else if (hasDeletedServerStages || isContentTypeReassignment) {
|
|
176
|
+
if (hasDeletedServerStages) {
|
|
177
|
+
setSavePrompts((prev) => ({ ...prev, hasDeletedServerStages: true }));
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
if (isContentTypeReassignment) {
|
|
181
|
+
setSavePrompts((prev) => ({ ...prev, hasReassignedContentTypes: true }));
|
|
182
|
+
}
|
|
168
183
|
} else {
|
|
169
184
|
submitForm();
|
|
170
185
|
}
|
|
@@ -243,7 +258,7 @@ export function ReviewWorkflowsEditView() {
|
|
|
243
258
|
disabled={!currentWorkflowIsDirty || !canUpdate}
|
|
244
259
|
// if the confirm dialog is open the loading state is on
|
|
245
260
|
// the confirm button already
|
|
246
|
-
loading={!
|
|
261
|
+
loading={!Object.keys(savePrompts).length > 0 && isLoading}
|
|
247
262
|
>
|
|
248
263
|
{formatMessage({
|
|
249
264
|
id: 'global.save',
|
|
@@ -279,6 +294,8 @@ export function ReviewWorkflowsEditView() {
|
|
|
279
294
|
<WorkflowAttributes
|
|
280
295
|
canUpdate={canUpdate}
|
|
281
296
|
contentTypes={{ collectionTypes, singleTypes }}
|
|
297
|
+
currentWorkflow={currentWorkflow}
|
|
298
|
+
workflows={workflows}
|
|
282
299
|
/>
|
|
283
300
|
<Stages
|
|
284
301
|
canDelete={canDelete}
|
|
@@ -291,17 +308,50 @@ export function ReviewWorkflowsEditView() {
|
|
|
291
308
|
</Form>
|
|
292
309
|
</FormikProvider>
|
|
293
310
|
|
|
294
|
-
<ConfirmDialog
|
|
295
|
-
bodyText={{
|
|
296
|
-
id: 'Settings.review-workflows.page.delete.confirm.body',
|
|
297
|
-
defaultMessage:
|
|
298
|
-
'All entries assigned to deleted stages will be moved to the previous stage. Are you sure you want to save?',
|
|
299
|
-
}}
|
|
311
|
+
<ConfirmDialog.Root
|
|
300
312
|
isConfirmButtonLoading={isLoading}
|
|
301
|
-
isOpen={
|
|
302
|
-
onToggleDialog={
|
|
313
|
+
isOpen={Object.keys(savePrompts).length > 0}
|
|
314
|
+
onToggleDialog={handleConfirmClose}
|
|
303
315
|
onConfirm={handleConfirmDeleteDialog}
|
|
304
|
-
|
|
316
|
+
>
|
|
317
|
+
<ConfirmDialog.Body>
|
|
318
|
+
<Flex direction="column" gap={5}>
|
|
319
|
+
{savePrompts.hasDeletedServerStages && (
|
|
320
|
+
<Typography textAlign="center" variant="omega">
|
|
321
|
+
{formatMessage({
|
|
322
|
+
id: 'Settings.review-workflows.page.delete.confirm.stages.body',
|
|
323
|
+
defaultMessage:
|
|
324
|
+
'All entries assigned to deleted stages will be moved to the previous stage.',
|
|
325
|
+
})}
|
|
326
|
+
</Typography>
|
|
327
|
+
)}
|
|
328
|
+
|
|
329
|
+
{savePrompts.hasReassignedContentTypes && (
|
|
330
|
+
<Typography textAlign="center" variant="omega">
|
|
331
|
+
{formatMessage(
|
|
332
|
+
{
|
|
333
|
+
id: 'Settings.review-workflows.page.delete.confirm.contentType.body',
|
|
334
|
+
defaultMessage:
|
|
335
|
+
'{count} {count, plural, one {content-type} other {content-types}} {count, plural, one {is} other {are}} already mapped to {count, plural, one {another workflow} other {other workflows}}. If you save changes, {count, plural, one {this} other {these}} {count, plural, one {content-type} other {{count} content-types}} will no more be mapped to the {count, plural, one {another workflow} other {other workflows}} and all corresponding information will be removed.',
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
count: contentTypesFromOtherWorkflows.filter((contentType) =>
|
|
339
|
+
currentWorkflow.contentTypes.includes(contentType)
|
|
340
|
+
).length,
|
|
341
|
+
}
|
|
342
|
+
)}
|
|
343
|
+
</Typography>
|
|
344
|
+
)}
|
|
345
|
+
|
|
346
|
+
<Typography textAlign="center" variant="omega">
|
|
347
|
+
{formatMessage({
|
|
348
|
+
id: 'Settings.review-workflows.page.delete.confirm.confirm',
|
|
349
|
+
defaultMessage: 'Are you sure you want to save?',
|
|
350
|
+
})}
|
|
351
|
+
</Typography>
|
|
352
|
+
</Flex>
|
|
353
|
+
</ConfirmDialog.Body>
|
|
354
|
+
</ConfirmDialog.Root>
|
|
305
355
|
|
|
306
356
|
<LimitsModal.Root
|
|
307
357
|
isOpen={showLimitModal === 'workflow'}
|
|
@@ -204,8 +204,7 @@ export function ReviewWorkflowsListView() {
|
|
|
204
204
|
}
|
|
205
205
|
subtitle={formatMessage({
|
|
206
206
|
id: 'Settings.review-workflows.list.page.subtitle',
|
|
207
|
-
defaultMessage:
|
|
208
|
-
'Manage content review stages and collaborate during content creation from draft to publication',
|
|
207
|
+
defaultMessage: 'Manage your content review process',
|
|
209
208
|
})}
|
|
210
209
|
title={formatMessage({
|
|
211
210
|
id: 'Settings.review-workflows.list.page.title',
|
|
@@ -73,7 +73,7 @@ export function reducer(state = initialState, action) {
|
|
|
73
73
|
|
|
74
74
|
if (!currentWorkflow.hasDeletedServerStages) {
|
|
75
75
|
draft.clientState.currentWorkflow.hasDeletedServerStages = !!(
|
|
76
|
-
state.serverState.
|
|
76
|
+
state.serverState.workflow?.stages ?? []
|
|
77
77
|
).find((stage) => stage.id === stageId);
|
|
78
78
|
}
|
|
79
79
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
Button,
|
|
@@ -62,13 +62,7 @@ export const SingleSignOn = () => {
|
|
|
62
62
|
|
|
63
63
|
const showLoader = isLoadingForPermissions || isLoading;
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
if (formErrors.defaultRole) {
|
|
67
|
-
const selector = `[name="defaultRole"]`;
|
|
68
|
-
|
|
69
|
-
document.querySelector(selector).focus();
|
|
70
|
-
}
|
|
71
|
-
}, [formErrors]);
|
|
65
|
+
// TODO: focus() first error field, but it looks like that requires refactoring from useSettingsForm to Formik
|
|
72
66
|
|
|
73
67
|
const isHeaderButtonDisabled = isEqual(initialData, modifiedData);
|
|
74
68
|
|
package/ee/server/bootstrap.js
CHANGED
|
@@ -31,6 +31,8 @@ module.exports = async () => {
|
|
|
31
31
|
// Decorate the entity service with review workflow logic
|
|
32
32
|
const { decorator } = getService('review-workflows-decorator');
|
|
33
33
|
strapi.entityService.decorate(decorator);
|
|
34
|
+
|
|
35
|
+
await getService('review-workflows-weekly-metrics').registerCron();
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
await getService('seat-enforcement').seatEnforcementWorkflow();
|
|
@@ -59,7 +59,7 @@ const resetPassword = async ({ resetPasswordToken, password } = {}) => {
|
|
|
59
59
|
.query('admin::user')
|
|
60
60
|
.findOne({ where: { resetPasswordToken, isActive: true } });
|
|
61
61
|
|
|
62
|
-
if (!matchingUser || isSsoLocked(matchingUser)) {
|
|
62
|
+
if (!matchingUser || (await isSsoLocked(matchingUser))) {
|
|
63
63
|
throw new ApplicationError();
|
|
64
64
|
}
|
|
65
65
|
|
|
@@ -12,4 +12,5 @@ module.exports = {
|
|
|
12
12
|
'review-workflows-validation': require('./review-workflows/validation'),
|
|
13
13
|
'review-workflows-decorator': require('./review-workflows/entity-service-decorator'),
|
|
14
14
|
'review-workflows-metrics': require('./review-workflows/metrics'),
|
|
15
|
+
'review-workflows-weekly-metrics': require('./review-workflows/metrics/weekly-metrics'),
|
|
15
16
|
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const sendDidCreateStage = async () => {
|
|
4
|
+
strapi.telemetry.send('didCreateStage', {});
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
const sendDidEditStage = async () => {
|
|
8
|
+
strapi.telemetry.send('didEditStage', {});
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const sendDidDeleteStage = async () => {
|
|
12
|
+
strapi.telemetry.send('didDeleteStage', {});
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const sendDidChangeEntryStage = async () => {
|
|
16
|
+
strapi.telemetry.send('didChangeEntryStage', {});
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const sendDidCreateWorkflow = async () => {
|
|
20
|
+
strapi.telemetry.send('didCreateWorkflow', {});
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const sendDidEditWorkflow = async () => {
|
|
24
|
+
strapi.telemetry.send('didEditWorkflow', {});
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const sendDidSendReviewWorkflowPropertiesOnceAWeek = async (
|
|
28
|
+
numberOfActiveWorkflows,
|
|
29
|
+
avgStagesCount,
|
|
30
|
+
maxStagesCount,
|
|
31
|
+
activatedContentTypes
|
|
32
|
+
) => {
|
|
33
|
+
strapi.telemetry.send('didSendReviewWorkflowPropertiesOnceAWeek', {
|
|
34
|
+
groupProperties: {
|
|
35
|
+
numberOfActiveWorkflows,
|
|
36
|
+
avgStagesCount,
|
|
37
|
+
maxStagesCount,
|
|
38
|
+
activatedContentTypes,
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
module.exports = {
|
|
44
|
+
sendDidCreateStage,
|
|
45
|
+
sendDidEditStage,
|
|
46
|
+
sendDidDeleteStage,
|
|
47
|
+
sendDidChangeEntryStage,
|
|
48
|
+
sendDidCreateWorkflow,
|
|
49
|
+
sendDidEditWorkflow,
|
|
50
|
+
sendDidSendReviewWorkflowPropertiesOnceAWeek,
|
|
51
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { flow, map, sum, size, mean, max, defaultTo } = require('lodash/fp');
|
|
4
|
+
const { add } = require('date-fns');
|
|
5
|
+
const { getService } = require('../../../../../server/utils');
|
|
6
|
+
|
|
7
|
+
const ONE_WEEK = 7 * 24 * 60 * 60 * 1000;
|
|
8
|
+
|
|
9
|
+
const getWeeklyCronScheduleAt = (date) =>
|
|
10
|
+
`${date.getSeconds()} ${date.getMinutes()} ${date.getHours()} * * ${date.getDay()}`;
|
|
11
|
+
|
|
12
|
+
const getMetricsStoreValue = async () => {
|
|
13
|
+
const value = await strapi.store.get({ type: 'plugin', name: 'ee', key: 'metrics' });
|
|
14
|
+
return defaultTo({}, value);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const setMetricsStoreValue = (value) =>
|
|
18
|
+
strapi.store.set({ type: 'plugin', name: 'ee', key: 'metrics', value });
|
|
19
|
+
|
|
20
|
+
module.exports = ({ strapi }) => {
|
|
21
|
+
const metrics = getService('review-workflows-metrics', { strapi });
|
|
22
|
+
const workflowsService = getService('workflows', { strapi });
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
async computeMetrics() {
|
|
26
|
+
// There will never be more than 200 workflow, so we can safely fetch them all
|
|
27
|
+
const workflows = await workflowsService.find({ populate: 'stages' });
|
|
28
|
+
|
|
29
|
+
const stagesCount = flow(
|
|
30
|
+
map('stages'), // Number of stages per workflow
|
|
31
|
+
map(size)
|
|
32
|
+
)(workflows);
|
|
33
|
+
|
|
34
|
+
const contentTypesCount = flow(
|
|
35
|
+
map('contentTypes'), // Number of content types per workflow
|
|
36
|
+
map(size)
|
|
37
|
+
)(workflows);
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
numberOfActiveWorkflows: size(workflows),
|
|
41
|
+
avgStagesCount: mean(stagesCount),
|
|
42
|
+
maxStagesCount: max(stagesCount),
|
|
43
|
+
activatedContentTypes: sum(contentTypesCount),
|
|
44
|
+
};
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
async sendMetrics() {
|
|
48
|
+
const computedMetrics = await this.computeMetrics();
|
|
49
|
+
metrics.sendDidSendReviewWorkflowPropertiesOnceAWeek(computedMetrics);
|
|
50
|
+
|
|
51
|
+
const metricsInfoStored = await getMetricsStoreValue();
|
|
52
|
+
await setMetricsStoreValue({ ...metricsInfoStored, lastWeeklyUpdate: new Date().getTime() });
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
async ensureWeeklyStoredCronSchedule() {
|
|
56
|
+
const metricsInfoStored = await getMetricsStoreValue();
|
|
57
|
+
const { weeklySchedule: currentSchedule, lastWeeklyUpdate } = metricsInfoStored;
|
|
58
|
+
|
|
59
|
+
const now = new Date();
|
|
60
|
+
let weeklySchedule = currentSchedule;
|
|
61
|
+
|
|
62
|
+
if (!currentSchedule || !lastWeeklyUpdate || lastWeeklyUpdate + ONE_WEEK < now.getTime()) {
|
|
63
|
+
weeklySchedule = getWeeklyCronScheduleAt(add(now, { seconds: 10 }));
|
|
64
|
+
await setMetricsStoreValue({ ...metricsInfoStored, weeklySchedule });
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return weeklySchedule;
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
async registerCron() {
|
|
71
|
+
const weeklySchedule = await this.ensureWeeklyStoredCronSchedule();
|
|
72
|
+
|
|
73
|
+
strapi.cron.add({ [weeklySchedule]: this.sendMetrics.bind(this) });
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
};
|
|
@@ -20,6 +20,7 @@ const processFilters = ({ strapi }, filters = {}) => {
|
|
|
20
20
|
module.exports = ({ strapi }) => {
|
|
21
21
|
const workflowsContentTypes = workflowsContentTypesFactory({ strapi });
|
|
22
22
|
const workflowsValidationService = getService('review-workflows-validation', { strapi });
|
|
23
|
+
const metrics = getService('review-workflows-metrics', { strapi });
|
|
23
24
|
|
|
24
25
|
return {
|
|
25
26
|
/**
|
|
@@ -70,6 +71,8 @@ module.exports = ({ strapi }) => {
|
|
|
70
71
|
});
|
|
71
72
|
}
|
|
72
73
|
|
|
74
|
+
metrics.sendDidCreateWorkflow();
|
|
75
|
+
|
|
73
76
|
// Create Workflow
|
|
74
77
|
return strapi.entityService.create(WORKFLOW_MODEL_UID, createOpts);
|
|
75
78
|
});
|
|
@@ -113,6 +116,8 @@ module.exports = ({ strapi }) => {
|
|
|
113
116
|
});
|
|
114
117
|
}
|
|
115
118
|
|
|
119
|
+
metrics.sendDidEditWorkflow();
|
|
120
|
+
|
|
116
121
|
// Update Workflow
|
|
117
122
|
return strapi.entityService.update(WORKFLOW_MODEL_UID, workflow.id, updateOpts);
|
|
118
123
|
});
|
|
@@ -6,8 +6,13 @@ const providerOptionsUpdateSchema = yup.object().shape({
|
|
|
6
6
|
autoRegister: yup.boolean().required(),
|
|
7
7
|
defaultRole: yup
|
|
8
8
|
.strapiID()
|
|
9
|
-
.
|
|
9
|
+
.when('autoRegister', (value, initSchema) => {
|
|
10
|
+
return value ? initSchema.required() : initSchema.nullable();
|
|
11
|
+
})
|
|
10
12
|
.test('is-valid-role', 'You must submit a valid default role', (roleId) => {
|
|
13
|
+
if (roleId === null) {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
11
16
|
return strapi.admin.services.role.exists({ id: roleId });
|
|
12
17
|
}),
|
|
13
18
|
ssoLockedRoles: yup
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/admin",
|
|
3
|
-
"version": "4.12.0
|
|
3
|
+
"version": "4.12.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.12.0
|
|
45
|
+
"@strapi/data-transfer": "4.12.0",
|
|
46
46
|
"@strapi/design-system": "1.8.2",
|
|
47
|
-
"@strapi/helper-plugin": "4.12.0
|
|
47
|
+
"@strapi/helper-plugin": "4.12.0",
|
|
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.0",
|
|
50
|
+
"@strapi/provider-audit-logs-local": "4.12.0",
|
|
51
|
+
"@strapi/typescript-utils": "4.12.0",
|
|
52
|
+
"@strapi/utils": "4.12.0",
|
|
53
53
|
"axios": "1.4.0",
|
|
54
54
|
"bcryptjs": "2.4.3",
|
|
55
55
|
"browserslist": "^4.17.3",
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
"redux": "^4.2.1",
|
|
117
117
|
"reselect": "^4.1.7",
|
|
118
118
|
"rimraf": "3.0.2",
|
|
119
|
-
"sanitize-html": "2.
|
|
119
|
+
"sanitize-html": "2.11.0",
|
|
120
120
|
"semver": "7.5.2",
|
|
121
121
|
"sift": "16.0.1",
|
|
122
122
|
"style-loader": "3.3.1",
|
|
@@ -154,5 +154,5 @@
|
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
},
|
|
157
|
-
"gitHead": "
|
|
157
|
+
"gitHead": "7f8109a1a736c1d997fbb445469b3b59550c7aeb"
|
|
158
158
|
}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[7065],{61234:function(S,f,e){"use strict";e.d(f,{v:function(){return n}});var t=e(32735),o=e(15062);function n(c,u){const s=(0,o.oR)();(0,t.useEffect)(()=>{s.injectReducer(c,u)},[s,c,u])}},50337:function(S,f,e){"use strict";e.d(f,{pl:function(){return a},aY:function(){return P},q5:function(){return d.q}});var t=e(32735),o=e(19565),n=e(86209),c=e(97889);const u={data:[],isLoading:!0};var E=(x,A)=>(0,c.ZP)(x,h=>{switch(A.type){case"GET_DATA_SUCCEEDED":{h.data=A.data,h.isLoading=!1;break}case"GET_DATA_ERROR":{h.isLoading=!1;break}default:return h}}),a=({ssoEnabled:x})=>{const[A,h]=(0,t.useReducer)(E,u),T=(0,o.lm)(),{get:g}=(0,o.kY)();return(0,t.useEffect)(()=>{(async()=>{try{if(!x){h({type:"GET_DATA_SUCCEEDED",data:[]});return}const{data:L}=await g((0,n.IF)("providers"));h({type:"GET_DATA_SUCCEEDED",data:L})}catch(L){console.error(L),h({type:"GET_DATA_ERROR"}),T({type:"warning",message:{id:"notification.error"}})}})()},[g,x,T]),A},r=e(36866),p=e.n(r),v=e(67879),l=e(53038),d=e(53104);const m="strapi-notification-seat-limit",w="https://cloud.strapi.io/profile/billing",O="https://strapi.io/billing/request-seats";var P=()=>{const{formatMessage:x}=(0,v.Z)();let{license:A,isError:h,isLoading:T}=(0,d.q)();const g=(0,o.lm)(),{pathname:D}=(0,l.TH)(),{enforcementUserCount:L,permittedSeats:I,licenseLimitStatus:M,isHostedOnStrapiCloud:W}=A;(0,t.useEffect)(()=>{if(h||T)return;const $=!p()(I)&&!window.sessionStorage.getItem(`${m}-${D}`)&&(M==="AT_LIMIT"||M==="OVER_LIMIT");let B;M==="OVER_LIMIT"?B="warning":M==="AT_LIMIT"&&(B="softWarning"),$&&g({type:B,message:x({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:x({id:"notification.ee.warning.at-seat-limit.title",defaultMessage:"{licenseLimitStatus, select, OVER_LIMIT {Over} other {At}} seat limit ({enforcementUserCount}/{permittedSeats})"},{licenseLimitStatus:M,enforcementUserCount:L,permittedSeats:I}),link:{url:W?w:O,label:x({id:"notification.ee.warning.seat-limit.link",defaultMessage:"{isHostedOnStrapiCloud, select, true {ADD SEATS} other {CONTACT SALES}}"},{isHostedOnStrapiCloud:W})},blockTransition:!0,onClose(){window.sessionStorage.setItem(`${m}-${D}`,!0)}})},[g,A,D,x,T,I,M,L,W,h])}},53104:function(S,f,e){"use strict";e.d(f,{q:function(){return c}});var t=e(32735),o=e(19565),n=e(20108);function c({enabled:u}={enabled:!0}){const{get:s}=(0,o.kY)(),{data:E,isError:i,isLoading:a}=(0,n.useQuery)(["ee","license-limit-info"],async()=>{const{data:{data:v}}=await s("/admin/license-limit-information");return v},{enabled:u}),r=E??{},p=t.useCallback(v=>(r?.features??[]).find(d=>d.name===v)?.options??{},[r?.features]);return{license:r,getFeature:p,isError:i,isLoading:a}}},77061:function(S,f,e){"use strict";e.d(f,{CI:function(){return c},FP:function(){return s},Js:function(){return i},_V:function(){return n},fC:function(){return o},rI:function(){return E},xn:function(){return u}});var t=e(2121);function o({status:a,data:r}){return{type:t.qZ,payload:{status:a,workflow:r}}}function n(a){return{type:t.x4,payload:{stageId:a}}}function c(a={}){return{type:t.Ot,payload:a}}function u(a,r){return{type:t.Nj,payload:{stageId:a,...r}}}function s(a,r){return{type:t.$k,payload:{newIndex:r,oldIndex:a}}}function E(a){return{type:t.VS,payload:a}}function i(){return{type:t.gu}}},27187:function(S,f,e){"use strict";e.d(f,{eJ:function(){return h},lx:function(){return x},h4:function(){return T},fC:function(){return A}});var t=e(32735),o=e(96709),n=e(27649),c=e(17e3),u=e(82055),s=e(19565),E=e(29439),i=e(67879),a=e(17379),r=e(2121),p=e(87933),v=e(49372),l=e(16899),d=e(60216),m=e.n(d),w=e(8471);const O=(0,w.ZP)(p.k)`
|
|
2
|
-
svg path {
|
|
3
|
-
fill: ${({theme:g})=>g.colors.neutral600};
|
|
4
|
-
}
|
|
5
|
-
`;function R({name:g}){return t.createElement(p.k,{background:"primary100",borderStyle:"dashed",borderColor:"primary600",borderWidth:"1px",gap:3,hasRadius:!0,padding:3,shadow:"tableShadow",width:(0,s.Q1)(300)},t.createElement(O,{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"},g))}R.propTypes={name:m().string.isRequired};function P({type:g,item:D}){switch(g){case r.uL.STAGE:return t.createElement(R,{...D});default:return null}}function x(){return t.createElement(a.r,{renderItem:P})}function A({children:g}){return t.createElement(o.A,null,t.createElement(n.o,{tabIndex:-1},t.createElement(c.D,null,g)))}function h({href:g}){const{formatMessage:D}=(0,i.Z)();return t.createElement(s.rU,{startIcon:t.createElement(E.Z,null),to:g},D({id:"global.back",defaultMessage:"Back"}))}function T({title:g,subtitle:D,navigationAction:L,primaryAction:I}){return t.createElement(t.Fragment,null,t.createElement(s.SL,{name:g}),t.createElement(u.T,{navigationAction:L,primaryAction:I,title:g,subtitle:D}))}},90562:function(S,f,e){"use strict";e.d(f,{uT:function(){return P},fC:function(){return h},Dx:function(){return R}});var t=e(32735),o=e(49372),n=e(87933),c=e(85025),u=e(31600),s=e(72850),E=e(50563),i=e(95489),a=e(35331),r=e(60216),p=e.n(r),v=e(67879),l=e(8471),d=e.p+"0cd5f8915b265d5b1856.png";const m="limits-title",w="https://strapi.io/pricing-cloud",O="https://strapi.io/contact-sales";function R({children:T}){return t.createElement(o.Z,{variant:"alpha",id:m},T)}R.propTypes={children:p().node.isRequired};function P({children:T}){return t.createElement(o.Z,{variant:"omega"},T)}P.propTypes={children:p().node.isRequired};function x(){const{formatMessage:T}=(0,v.Z)();return t.createElement(n.k,{gap:2,paddingTop:4},t.createElement(i.Q,{variant:"default",isExternal:!0,href:w},T({id:"Settings.review-workflows.limit.cta.learn",defaultMessage:"Learn more"})),t.createElement(i.Q,{variant:"tertiary",isExternal:!0,href:O},T({id:"Settings.review-workflows.limit.cta.sales",defaultMessage:"Contact Sales"})))}const A=l.ZP.img`
|
|
6
|
-
// Margin top|right reverse the padding of ModalBody
|
|
7
|
-
margin-right: ${({theme:T})=>`-${T.spaces[7]}`};
|
|
8
|
-
margin-top: ${({theme:T})=>`-${T.spaces[7]}`};
|
|
9
|
-
width: 360px;
|
|
10
|
-
`;function h({children:T,isOpen:g,onClose:D}){const{formatMessage:L}=(0,v.Z)();return g?t.createElement(c.P,{labelledBy:m},t.createElement(u.f,null,t.createElement(n.k,{gap:2,paddingLeft:7,position:"relative"},t.createElement(n.k,{alignItems:"start",direction:"column",gap:2,width:"60%"},T,t.createElement(x,null)),t.createElement(n.k,{justifyContent:"end",height:"100%",width:"40%"},t.createElement(A,{src:d,"aria-hidden":!0,alt:"",loading:"lazy"}),t.createElement(s.x,{display:"flex",position:"absolute",right:0,top:0},t.createElement(E.h,{icon:t.createElement(a.Z,null),"aria-label":L({id:"global.close",defaultMessage:"Close"}),onClick:D})))))):null}h.defaultProps={isOpen:!1},h.propTypes={children:p().node.isRequired,isOpen:p().bool,onClose:p().func.isRequired}},45594:function(S,f,e){"use strict";e.d(f,{U:function(){return U}});var t=e(32735),o=e(72850),n=e(87933),c=e(19565),u=e(60216),s=e.n(u),E=e(67879),i=e(15062),a=e(8471),r=e(77061),p=e(49372),v=e(86308);const l=(0,a.ZP)(v.Z)`
|
|
11
|
-
> circle {
|
|
12
|
-
fill: ${({theme:y})=>y.colors.neutral150};
|
|
13
|
-
}
|
|
14
|
-
> path {
|
|
15
|
-
fill: ${({theme:y})=>y.colors.neutral600};
|
|
16
|
-
}
|
|
17
|
-
`,d=(0,a.ZP)(o.x)`
|
|
18
|
-
border-radius: 26px;
|
|
19
|
-
|
|
20
|
-
svg {
|
|
21
|
-
height: ${({theme:y})=>y.spaces[6]};
|
|
22
|
-
width: ${({theme:y})=>y.spaces[6]};
|
|
23
|
-
|
|
24
|
-
> path {
|
|
25
|
-
fill: ${({theme:y})=>y.colors.neutral600};
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
&:hover {
|
|
30
|
-
color: ${({theme:y})=>y.colors.primary600} !important;
|
|
31
|
-
${p.Z} {
|
|
32
|
-
color: ${({theme:y})=>y.colors.primary600} !important;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
${l} {
|
|
36
|
-
> circle {
|
|
37
|
-
fill: ${({theme:y})=>y.colors.primary600};
|
|
38
|
-
}
|
|
39
|
-
> path {
|
|
40
|
-
fill: ${({theme:y})=>y.colors.neutral100};
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
&:active {
|
|
46
|
-
${p.Z} {
|
|
47
|
-
color: ${({theme:y})=>y.colors.primary600};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
${l} {
|
|
51
|
-
> circle {
|
|
52
|
-
fill: ${({theme:y})=>y.colors.primary600};
|
|
53
|
-
}
|
|
54
|
-
> path {
|
|
55
|
-
fill: ${({theme:y})=>y.colors.neutral100};
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
`;function m({children:y,...k}){return t.createElement(d,{as:"button",background:"neutral0",border:"neutral150",paddingBottom:3,paddingLeft:4,paddingRight:4,paddingTop:3,shadow:"filterShadow",...k},t.createElement(n.k,{gap:2},t.createElement(l,{"aria-hidden":!0}),t.createElement(p.Z,{variant:"pi",fontWeight:"bold",textColor:"neutral500"},y)))}m.propTypes={children:s().node.isRequired};var w=e(3685),O=e(83828),R=e(61762),P=e(50563),x=e(89966),A=e(15335),h=e(5803),T=e(10369),g=e(77035),D=e(4038),L=e(47081),I=e(92802),M=e(51968),W=e(69242),$=e(97724),B=e(2121),N=e(68886);const _=(0,N.s)();function q(){return t.createElement(o.x,{background:"primary100",borderStyle:"dashed",borderColor:"primary600",borderWidth:"1px",display:"block",hasRadius:!0,padding:6,shadow:"tableShadow"})}function H({id:y,index:k,canDelete:Z,canReorder:ee,canUpdate:K,isOpen:te=!1,stagesCount:F}){const G=C=>`${C+1} of ${F}`,Q=C=>{Y(b({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:j.value,position:G(C)}))},le=C=>{Y(b({id:"dnd.drop-item",defaultMessage:"{item}, dropped. Final position in list: {position}."},{item:j.value,position:G(C)}))},de=()=>{Y(b({id:"dnd.cancel-item",defaultMessage:"{item}, dropped. Re-order cancelled."},{item:j.value}))},ce=(C,V)=>{Y(b({id:"dnd.reorder",defaultMessage:"{item}, moved. New position in list: {position}."},{item:j.value,position:G(C)})),X((0,r.FP)(V,C))},[ae,Y]=t.useState(null),{formatMessage:b}=(0,E.Z)(),{trackUsage:ue}=(0,c.rS)(),X=(0,i.I0)(),[ne,fe]=t.useState(te),[j,re,me]=(0,I.U$)(`stages.${k}.name`),[J,oe,ge]=(0,I.U$)(`stages.${k}.color`),[{handlerId:pe,isDragging:ve,handleKeyDown:he},Ee,ye,Te,se]=(0,W.Y9)(ee,{index:k,item:{name:j.value},onGrabItem:Q,onDropItem:le,onMoveItem:ce,onCancel:de,type:B.uL.STAGE}),Se=(0,$.FE)(Ee,ye),Me=_.map(({hex:C,name:V})=>({value:C,label:b({id:"Settings.review-workflows.stage.color.name",defaultMessage:"{name}"},{name:V}),color:C}));t.useEffect(()=>{se((0,M.rX)(),{captureDraggingState:!1})},[se,k]);const{themeColorName:we}=(0,N.k)(J.value)??{};return t.createElement(o.x,{ref:Se},ae&&t.createElement(w.T,{"aria-live":"assertive"},ae),ve?t.createElement(q,null):t.createElement(O.U,{size:"S",variant:"primary",onToggle:()=>{fe(!ne),ne||ue("willEditStage")},expanded:ne,shadow:"tableShadow",error:re.error??oe?.error??!1,hasErrorMessage:!1},t.createElement(R.B,{title:j.value,togglePosition:"left",action:t.createElement(n.k,null,Z&&t.createElement(P.h,{background:"transparent",icon:t.createElement(D.Z,null),label:b({id:"Settings.review-workflows.stage.delete",defaultMessage:"Delete stage"}),noBorder:!0,onClick:()=>X((0,r._V)(y))}),t.createElement(P.h,{background:"transparent",disabled:!K,forwardedAs:"div",role:"button",noBorder:!0,tabIndex:0,"data-handler-id":pe,ref:Te,label:b({id:"Settings.review-workflows.stage.drag",defaultMessage:"Drag"}),onClick:C=>C.stopPropagation(),onKeyDown:he},t.createElement(L.Z,null)))}),t.createElement(x.v,{padding:6,background:"neutral0",hasRadius:!0},t.createElement(A.r,{gap:4},t.createElement(h.P,{col:6},t.createElement(T.o,{...j,id:j.name,disabled:!K,label:b({id:"Settings.review-workflows.stage.name.label",defaultMessage:"Stage name"}),error:re.error??!1,onChange:C=>{me.setValue(C.target.value),X((0,r.xn)(y,{name:C.target.value}))},required:!0})),t.createElement(h.P,{col:6},t.createElement(g.q4,{disabled:!K,error:oe?.error??!1,id:J.name,required:!0,label:b({id:"content-manager.reviewWorkflows.stage.color",defaultMessage:"Color"}),onChange:C=>{ge.setValue(C),X((0,r.xn)(y,{color:C}))},value:J.value.toUpperCase(),startIcon:t.createElement(n.k,{as:"span",height:2,background:J.value,borderColor:we==="neutral0"?"neutral150":"transparent",hasRadius:!0,shrink:0,width:2})},Me.map(({value:C,label:V,color:ie})=>{const{themeColorName:xe}=(0,N.k)(ie);return t.createElement(g.ag,{value:C,key:C,startIcon:t.createElement(n.k,{as:"span",height:2,background:ie,borderColor:xe==="neutral0"?"neutral150":"transparent",hasRadius:!0,shrink:0,width:2})},V)})))))))}H.propTypes=s().shape({id:s().number.isRequired,color:s().string.isRequired,canDelete:s().bool.isRequired,canReorder:s().bool.isRequired,canUpdate:s().bool.isRequired,stagesCount:s().number.isRequired}).isRequired;const z=(0,a.ZP)(o.x)`
|
|
60
|
-
transform: translateX(-50%);
|
|
61
|
-
`;function U({canDelete:y,canUpdate:k,stages:Z}){const{formatMessage:ee}=(0,E.Z)(),K=(0,i.I0)(),{trackUsage:te}=(0,c.rS)();return t.createElement(n.k,{direction:"column",gap:6,width:"100%"},t.createElement(o.x,{position:"relative",spacing:4,width:"100%"},t.createElement(z,{background:"neutral200",height:"100%",left:"50%",position:"absolute",top:"0",width:2,zIndex:1}),t.createElement(n.k,{direction:"column",alignItems:"stretch",gap:6,zIndex:2,position:"relative",as:"ol"},Z.map((F,G)=>{const Q=F?.id??F.__temp_key__;return t.createElement(o.x,{key:`stage-${Q}`,as:"li"},t.createElement(H,{id:Q,index:G,isOpen:!F.id,canDelete:Z.length>1&&y,canReorder:Z.length>1,canUpdate:k,stagesCount:Z.length}))}))),k&&t.createElement(m,{type:"button",onClick:()=>{K((0,r.CI)({name:""})),te("willCreateStage")}},ee({id:"Settings.review-workflows.stage.add",defaultMessage:"Add new stage"})))}U.defaultProps={canDelete:!0,canUpdate:!0,stages:[]},U.propTypes={canDelete:s().bool,canUpdate:s().bool,stages:s().arrayOf(s().shape({id:s().number,__temp_key__:s().number,name:s().string.isRequired}))}},165:function(S,f,e){"use strict";e.d(f,{Y:function(){return l}});var t=e(32735),o=e(15335),n=e(5803),c=e(10369),u=e(27799),s=e(19565),E=e(92802),i=e(60216),a=e.n(i),r=e(67879),p=e(15062),v=e(77061);function l({canUpdate:m,contentTypes:{collectionTypes:w,singleTypes:O}}){const{formatMessage:R,locale:P}=(0,r.Z)(),x=(0,p.I0)(),[A,h,T]=(0,E.U$)("name"),[g,D,L]=(0,E.U$)("contentTypes"),I=(0,s.Xe)(P,{sensitivity:"base"});return t.createElement(o.r,{background:"neutral0",hasRadius:!0,gap:4,padding:6,shadow:"tableShadow"},t.createElement(n.P,{col:6},t.createElement(c.o,{...A,id:A.name,disabled:!m,label:R({id:"Settings.review-workflows.workflow.name.label",defaultMessage:"Workflow Name"}),error:h.error??!1,onChange:M=>{x((0,v.rI)({name:M.target.value})),T.setValue(M.target.value)},required:!0})),t.createElement(n.P,{col:6},t.createElement(u.Q,{...g,customizeContent:M=>R({id:"Settings.review-workflows.workflow.contentTypes.displayValue",defaultMessage:"{count} {count, plural, one {content type} other {content types}} selected"},{count:M.length}),disabled:!m,error:D.error??!1,id:g.name,label:R({id:"Settings.review-workflows.workflow.contentTypes.label",defaultMessage:"Associated to"}),onChange:M=>{x((0,v.rI)({contentTypes:M})),L.setValue(M)},options:[...w.length>0?[{label:R({id:"Settings.review-workflows.workflow.contentTypes.collectionTypes.label",defaultMessage:"Collection Types"}),children:w.sort((M,W)=>I.compare(M.info.displayName,W.info.displayName)).map(M=>({label:M.info.displayName,value:M.uid}))}]:[],...O.length>0?[{label:R({id:"Settings.review-workflows.workflow.contentTypes.singleTypes.label",defaultMessage:"Single Types"}),children:O.map(M=>({label:M.info.displayName,value:M.uid}))}]:[]],placeholder:R({id:"Settings.review-workflows.workflow.contentTypes.placeholder",defaultMessage:"Select"})})))}const d=a().shape({uid:a().string.isRequired,info:a().shape({displayName:a().string.isRequired}).isRequired});l.defaultProps={canUpdate:!0},l.propTypes={canUpdate:a().bool,contentTypes:a().shape({collectionTypes:a().arrayOf(d).isRequired,singleTypes:a().arrayOf(d).isRequired}).isRequired}},2121:function(S,f,e){"use strict";e.d(f,{$k:function(){return i},Ef:function(){return l},FT:function(){return p},Nj:function(){return E},Ot:function(){return s},VS:function(){return a},_X:function(){return d},gu:function(){return n},lv:function(){return r},qZ:function(){return c},sN:function(){return o},uL:function(){return v},x4:function(){return u}});var t=e(12301);const o="settings_review-workflows",n="Settings/Review_Workflows/RESET_WORKFLOW",c="Settings/Review_Workflows/SET_WORKFLOW",u="Settings/Review_Workflows/WORKFLOW_DELETE_STAGE",s="Settings/Review_Workflows/WORKFLOW_ADD_STAGE",E="Settings/Review_Workflows/WORKFLOW_UPDATE_STAGE",i="Settings/Review_Workflows/WORKFLOW_UPDATE_STAGE_POSITION",a="Settings/Review_Workflows/WORKFLOW_UPDATE",r={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"},p=t.W.colors.primary600,v={STAGE:"stage"},l="numberOfWorkflows",d="stagesPerWorkflow"},32329:function(S,f,e){"use strict";e.d(f,{n:function(){return n}});var t=e(19565),o=e(20108);function n(c={}){const{get:u}=(0,t.kY)(),{id:s="",...E}=c,i={populate:"stages"},{data:a,isLoading:r,status:p,refetch:v}=(0,o.useQuery)(["review-workflows","workflows",s],async()=>(await u(`/admin/review-workflows/workflows/${s}`,{params:{...i,...E}})).data);let l=[];return s&&a?.data?l=[a.data]:Array.isArray(a?.data)&&(l=a.data),{meta:a?.meta??{},workflows:l,isLoading:r,status:p,refetch:v}}},79989:function(S,f,e){"use strict";e.d(f,{E:function(){return u},I:function(){return s}});var t=e(97889),o=e(89793),n=e.n(o),c=e(2121);const u={status:"loading",serverState:{workflow:null},clientState:{currentWorkflow:{data:{name:"",contentTypes:[],stages:[]},isDirty:!1,hasDeletedServerStages:!1}}};function s(i=u,a){return(0,t.Uy)(i,r=>{const{payload:p}=a;switch(a.type){case c.qZ:{const{status:v,workflow:l}=p;r.status=v,l&&(r.serverState.workflow=l,r.clientState.currentWorkflow.data={...l,stages:l.stages.map(d=>({...d,color:d?.color??c.FT}))}),r.clientState.currentWorkflow.hasDeletedServerStages=!1;break}case c.gu:{r.clientState.currentWorkflow.data=u.clientState.currentWorkflow.data,r.serverState=u.serverState;break}case c.x4:{const{stageId:v}=p,{currentWorkflow:l}=i.clientState;r.clientState.currentWorkflow.data.stages=l.data.stages.filter(d=>(d?.id??d.__temp_key__)!==v),l.hasDeletedServerStages||(r.clientState.currentWorkflow.hasDeletedServerStages=!!(i.serverState.currentWorkflow?.stages??[]).find(d=>d.id===v));break}case c.Ot:{const{currentWorkflow:v}=i.clientState;v.data||(r.clientState.currentWorkflow.data={stages:[]});const l=E(r.clientState.currentWorkflow.data.stages);r.clientState.currentWorkflow.data.stages.push({...p,color:p?.color??c.FT,__temp_key__:l});break}case c.Nj:{const{currentWorkflow:v}=i.clientState,{stageId:l,...d}=p;r.clientState.currentWorkflow.data.stages=v.data.stages.map(m=>(m.id??m.__temp_key__)===l?{...m,...d}:m);break}case c.$k:{const{currentWorkflow:{data:{stages:v}}}=i.clientState,{newIndex:l,oldIndex:d}=p;if(l>=0&&l<v.length){const m=v[d];let w=[...v];w.splice(d,1),w.splice(l,0,m),r.clientState.currentWorkflow.data.stages=w}break}case c.VS:{r.clientState.currentWorkflow.data={...r.clientState.currentWorkflow.data,...p};break}default:break}i.clientState.currentWorkflow.data&&r.serverState.workflow?r.clientState.currentWorkflow.isDirty=!n()((0,t.Vk)(r.clientState.currentWorkflow).data,r.serverState.workflow):r.clientState.currentWorkflow.isDirty=!0})}const E=(i=[])=>{const a=i.map(r=>r.id??r.__temp_key__);return Math.max(...a,-1)+1}},68886:function(S,f,e){"use strict";e.d(f,{k:function(){return n},s:function(){return c}});var t=e(12301),o=e(2121);function n(u){if(!u)return null;const E=Object.entries(t.W.colors).filter(([,i])=>i.toUpperCase()===u.toUpperCase()).reduce((i,[a])=>(o.lv?.[a]&&(i=a),i),null);return E?{themeColorName:E,name:o.lv[E]}:null}function c(){return Object.entries(o.lv).map(([u,s])=>({hex:t.W.colors[u].toUpperCase(),name:s}))}},82920:function(S,f,e){"use strict";e.d(f,{V:function(){return c}});var t=e(3040),o=e.n(t),n=e(24346);async function c({values:u,formatMessage:s}){const E=n.Ry({contentTypes:n.IX().of(n.Z_()),name:n.Z_().max(255,s({id:"Settings.review-workflows.validation.name.max-length",defaultMessage:"Name can not be longer than 255 characters"})).required(),stages:n.IX().of(n.Ry().shape({name:n.Z_().required(s({id:"Settings.review-workflows.validation.stage.name",defaultMessage:"Name is required"})).max(255,s({id:"Settings.review-workflows.validation.stage.max-length",defaultMessage:"Name can not be longer than 255 characters"})).test("unique-name",s({id:"Settings.review-workflows.validation.stage.duplicate",defaultMessage:"Stage name must be unique"}),function(i){const{options:{context:a}}=this;return a.stages.filter(r=>r.name===i).length===1}),color:n.Z_().required(s({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 E.validate(u,{abortEarly:!1,context:u}),!0}catch(i){let a={};return i instanceof n.p8&&i.inner.forEach(r=>{o()(a,r.path,r.message)}),a}}},51355:function(S,f,e){var t=e(94318),o=e(3387),n="[object Boolean]";function c(u){return u===!0||u===!1||o(u)&&t(u)==n}S.exports=c},95919:function(S,f,e){var t=e(80022);function o(n){return t(n)&&n!=+n}S.exports=o},80022:function(S,f,e){var t=e(94318),o=e(3387),n="[object Number]";function c(u){return typeof u=="number"||o(u)&&t(u)==n}S.exports=c},59578:function(S,f,e){var t=e(41119);function o(n){return t(n).toLowerCase()}S.exports=o},83828:function(S,f,e){"use strict";e.d(f,{U:function(){return v},y:function(){return r}});var t=e(74512),o=e(32735),n=e(8471),c=e(91045),u=e(74971),s=e(49372),E=e(87933),i=e(72850);const a=({theme:l,expanded:d,variant:m,disabled:w,error:O})=>O?`1px solid ${l.colors.danger600} !important`:w?`1px solid ${l.colors.neutral150}`:d?`1px solid ${l.colors.primary600}`:m==="primary"?`1px solid ${l.colors.neutral0}`:`1px solid ${l.colors.neutral100}`,r=(0,n.ZP)(s.Z)``,p=(0,n.ZP)(i.x)`
|
|
62
|
-
border: ${a};
|
|
63
|
-
|
|
64
|
-
&:hover:not([aria-disabled='true']) {
|
|
65
|
-
border: 1px solid ${({theme:l})=>l.colors.primary600};
|
|
66
|
-
|
|
67
|
-
${r} {
|
|
68
|
-
color: ${({theme:l,expanded:d})=>d?void 0:l.colors.primary700};
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
${s.Z} {
|
|
72
|
-
color: ${({theme:l,expanded:d})=>d?void 0:l.colors.primary600};
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
& > ${E.k} {
|
|
76
|
-
background: ${({theme:l})=>l.colors.primary100};
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
[data-strapi-dropdown='true'] {
|
|
80
|
-
background: ${({theme:l})=>l.colors.primary200};
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
`,v=({children:l,disabled:d=!1,error:m,expanded:w=!1,hasErrorMessage:O=!0,id:R,onToggle:P,toggle:x,size:A="M",variant:h="primary",shadow:T})=>{const g=(0,u.M)(R),D=o.useMemo(()=>({expanded:w,onToggle:P,toggle:x,id:g,size:A,variant:h,disabled:d}),[d,w,g,P,A,x,h]);return(0,t.jsxs)(c.S.Provider,{value:D,children:[(0,t.jsx)(p,{"data-strapi-expanded":w,disabled:d,"aria-disabled":d,expanded:w,hasRadius:!0,variant:h,error:m,shadow:T,children:l}),m&&O&&(0,t.jsx)(i.x,{paddingTop:1,children:(0,t.jsx)(s.Z,{variant:"pi",textColor:"danger600",children:m})})]})}},89966:function(S,f,e){"use strict";e.d(f,{v:function(){return c}});var t=e(74512),o=e(91045),n=e(72850);const c=({children:u,...s})=>{const{expanded:E,id:i}=(0,o.A)();if(!E)return null;const a=`accordion-content-${i}`,r=`accordion-label-${i}`,p=`accordion-desc-${i}`;return(0,t.jsx)(n.x,{role:"region",id:a,"aria-labelledby":r,"aria-describedby":p,...s,children:u})}},91045:function(S,f,e){"use strict";e.d(f,{A:function(){return n},S:function(){return o}});var t=e(32735);const o=(0,t.createContext)({disabled:!1,expanded:!1,id:"",size:"M",variant:"primary"}),n=()=>(0,t.useContext)(o)},61762:function(S,f,e){"use strict";e.d(f,{B:function(){return l}});var t=e(74512),o=e(16899),n=e(8471),c=e(83828),u=e(91045);const s=({expanded:d,disabled:m,variant:w})=>{let O="neutral100";return d?O="primary100":m?O="neutral150":w==="primary"&&(O="neutral0"),O};var E=e(7563),i=e(99140),a=e(87933),r=e(49372);const p=(0,n.ZP)(E.A)`
|
|
84
|
-
text-align: left;
|
|
85
|
-
|
|
86
|
-
// necessary to make the ellipsis prop work on the title
|
|
87
|
-
> span {
|
|
88
|
-
max-width: 100%;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
svg {
|
|
92
|
-
width: ${14/16}rem;
|
|
93
|
-
height: ${14/16}rem;
|
|
94
|
-
|
|
95
|
-
path {
|
|
96
|
-
fill: ${({theme:d,expanded:m})=>m?d.colors.primary600:d.colors.neutral500};
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
`,v=(0,n.ZP)(a.k)`
|
|
100
|
-
min-height: ${({theme:d,size:m})=>d.sizes.accordions[m]};
|
|
101
|
-
border-radius: ${({theme:d,expanded:m})=>m?`${d.borderRadius} ${d.borderRadius} 0 0`:d.borderRadius};
|
|
102
|
-
|
|
103
|
-
&:hover {
|
|
104
|
-
svg {
|
|
105
|
-
path {
|
|
106
|
-
fill: ${({theme:d})=>d.colors.primary600};
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
`,l=({title:d,description:m,as:w="span",togglePosition:O="right",action:R,...P})=>{const{onToggle:x,toggle:A,expanded:h,id:T,size:g,variant:D,disabled:L}=(0,u.A)(),I=`accordion-content-${T}`,M=`accordion-label-${T}`,W=`accordion-desc-${T}`,$=g==="M"?6:4,B=g==="M"?$:$-2,N=s({expanded:h,disabled:L,variant:D}),_={as:w,fontWeight:g==="S"?"bold":void 0,id:M,textColor:h?"primary600":"neutral700",ellipsis:!0,variant:g==="M"?"delta":void 0},q=h?"primary600":"neutral600",H=h?"primary200":"neutral200",z=g==="M"?`${32/16}rem`:`${24/16}rem`,U=()=>{L||(A&&!x?(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'),A()):x&&x())},y=(0,t.jsx)(a.k,{justifyContent:"center",borderRadius:"50%",height:z,width:z,transform:h?"rotate(180deg)":void 0,"data-strapi-dropdown":!0,"aria-hidden":!0,as:"span",background:H,cursor:L?"not-allowed":"pointer",onClick:U,shrink:0,children:(0,t.jsx)(i.J,{as:o.Z,width:g==="M"?`${11/16}rem`:`${8/16}rem`,color:h?"primary600":"neutral600"})});return(0,t.jsx)(v,{paddingBottom:B,paddingLeft:$,paddingRight:$,paddingTop:B,background:N,expanded:h,size:g,justifyContent:"space-between",cursor:L?"not-allowed":"",children:(0,t.jsxs)(a.k,{gap:3,flex:1,maxWidth:"100%",children:[O==="left"&&y,(0,t.jsx)(p,{onClick:U,"aria-disabled":L,"aria-expanded":h,"aria-controls":I,"aria-labelledby":M,"data-strapi-accordion-toggle":!0,expanded:h,type:"button",flex:1,minWidth:0,...P,children:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(c.y,{..._,children:d}),m&&(0,t.jsx)(r.Z,{as:"p",id:W,textColor:q,children:m})]})}),O==="right"&&(0,t.jsxs)(a.k,{gap:3,children:[y,R]}),O==="left"&&R]})})}},27799:function(S,f,e){"use strict";e.d(f,{Q:function(){return c}});var t=e(74512),o=e(8471),n=e(6407);const c=({options:s,...E})=>(0,t.jsx)(n.NU,{...E,children:s.map(i=>"children"in i?(0,t.jsx)(n.Ab,{label:i.label,values:i.children.map(a=>a.value.toString()),children:i.children.map(a=>(0,t.jsx)(u,{value:a.value,children:a.label},a.value))},i.label):(0,t.jsx)(n.ML,{value:i.value,children:i.label},i.value))}),u=(0,o.ZP)(n.ML)`
|
|
111
|
-
padding-left: ${({theme:s})=>s.spaces[7]};
|
|
112
|
-
`},29439:function(S,f,e){"use strict";e.d(f,{Z:function(){return n}});var t=e(74512);const o=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"})}),n=o},47081:function(S,f,e){"use strict";e.d(f,{Z:function(){return n}});var t=e(74512);const o=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"})]}),n=o},86308:function(S,f,e){"use strict";e.d(f,{Z:function(){return n}});var t=e(74512);const o=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"})]}),n=o}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[8936],{80252:function(ne,E,e){e.r(E),e.d(E,{default:function(){return B}});var t=e(32735),f=e(19565),c=e(15062),h=e(30305),W=e(41415),k=e(87933),T=e(23866),A=e(66456),u=e(92802),D=e(3040),R=e.n(D),V=e(67879),F=e(20108),X=e(53038),Y=e(90769),x=e(61234),z=e(50337),y=e(77061),g=e(27187),l=e(90562),N=e(45594),O=e(165),a=e(2121),J=e(32329),S=e(79989),Z=e(82920);function j(){const{formatMessage:o}=(0,V.Z)(),{post:G}=(0,f.kY)(),{push:H}=(0,X.k6)(),{formatAPIError:P}=(0,f.So)(),w=(0,c.I0)(),U=(0,c.v9)(h._),p=(0,f.lm)(),{collectionTypes:$,singleTypes:K,isLoading:Q}=(0,Y.G)(),{clientState:{currentWorkflow:{data:r,isDirty:b}}}=(0,c.v9)(s=>s?.[a.sN]??S.E),{allowedActions:{canCreate:q}}=(0,f.ss)(U.settings["review-workflows"]),[M,i]=t.useState(!1),{isLoading:C,getFeature:_}=(0,z.q5)(),{meta:m,isLoading:I}=(0,J.n)(),[ee,te]=t.useState(null),{mutateAsync:se,isLoading:oe}=(0,F.useMutation)(async({workflow:s})=>{const{data:{data:d}}=await G("/admin/review-workflows/workflows",{data:s});return d},{onSuccess(){p({type:"success",message:{id:"Settings.review-workflows.create.page.notification.success",defaultMessage:"Workflow successfully created"}})}}),ae=async()=>{try{const s=await se({workflow:r});return H(`/settings/review-workflows/${s.id}`),s}catch(s){return s.response.data?.error?.name==="ValidationError"&&s.response.data?.error?.details?.errors?.length>0&&te(s.response.data?.error?.details?.errors.reduce((d,L)=>(R()(d,L.path,L.message),d),{})),p({type:"warning",message:P(s)}),null}},n=_("review-workflows"),v=(0,u.TA)({enableReinitialize:!0,initialErrors:ee,initialValues:r,async onSubmit(){n?.[a.Ef]&&m?.workflowCount>=parseInt(n[a.Ef],10)?i("workflow"):n?.[a._X]&&r.stages.length>=parseInt(n[a._X],10)?i("stage"):ae()},validate(s){return(0,Z.V)({values:s,formatMessage:o})}});return(0,x.v)(a.sN,S.I),t.useEffect(()=>{w((0,y.Js)()),w((0,y.CI)({name:""}))},[w]),t.useEffect(()=>{!I&&!C&&(n?.[a.Ef]&&m?.workflowsTotal>=parseInt(n[a.Ef],10)?i("workflow"):n?.[a._X]&&r.stages.length>=parseInt(n[a._X],10)&&i("stage"))},[C,I,n,m?.workflowsTotal,r.stages.length]),t.createElement(t.Fragment,null,t.createElement(g.lx,null),t.createElement(u.Hy,{value:v},t.createElement(u.l0,{onSubmit:v.handleSubmit},t.createElement(g.h4,{navigationAction:t.createElement(g.eJ,{href:"/settings/review-workflows"}),primaryAction:t.createElement(W.z,{startIcon:t.createElement(A.Z,null),type:"submit",size:"M",disabled:!b||!q,isLoading:oe},o({id:"global.save",defaultMessage:"Save"})),title:o({id:"Settings.review-workflows.create.page.title",defaultMessage:"Create Review Workflow"}),subtitle:o({id:"Settings.review-workflows.page.subtitle",defaultMessage:"{count, plural, one {# stage} other {# stages}}"},{count:r?.stages?.length??0})}),t.createElement(g.fC,null,t.createElement(k.k,{alignItems:"stretch",direction:"column",gap:7},Q?t.createElement(T.a,null,o({id:"Settings.review-workflows.page.isLoading",defaultMessage:"Workflow is loading"})):t.createElement(k.k,{alignItems:"stretch",direction:"column",gap:7},t.createElement(O.Y,{contentTypes:{collectionTypes:$,singleTypes:K}}),t.createElement(N.U,{stages:v.values?.stages})))))),t.createElement(l.fC,{isOpen:M==="workflow",onClose:()=>i(!1)},t.createElement(l.Dx,null,o({id:"Settings.review-workflows.create.page.workflows.limit.title",defaultMessage:"You\u2019ve reached the limit of workflows in your plan"})),t.createElement(l.uT,null,o({id:"Settings.review-workflows.create.page.workflows.limit.body",defaultMessage:"Delete a workflow or contact Sales to enable more workflows."}))),t.createElement(l.fC,{isOpen:M==="stage",onClose:()=>i(!1)},t.createElement(l.Dx,null,o({id:"Settings.review-workflows.create.page.stages.limit.title",defaultMessage:"You have reached the limit of stages for this workflow in your plan"})),t.createElement(l.uT,null,o({id:"Settings.review-workflows.create.page.stages.limit.body",defaultMessage:"Try deleting some stages or contact Sales to enable more stages."}))))}function B(){const o=(0,c.v9)(h._);return t.createElement(f.O4,{permissions:o.settings["review-workflows"].create},t.createElement(j,null))}}}]);
|