sanity-plugin-workflow 1.0.0-beta.10 → 1.0.0-beta.12
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/lib/index.esm.js +5 -4
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +5 -4
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/actions/AssignWorkflow.tsx +1 -3
- package/src/actions/UpdateWorkflow.tsx +2 -2
package/lib/index.js
CHANGED
|
@@ -203,6 +203,7 @@ function WorkflowProvider(props) {
|
|
|
203
203
|
});
|
|
204
204
|
}
|
|
205
205
|
function AssignWorkflow(props) {
|
|
206
|
+
var _a;
|
|
206
207
|
const {
|
|
207
208
|
id
|
|
208
209
|
} = props;
|
|
@@ -234,7 +235,7 @@ function AssignWorkflow(props) {
|
|
|
234
235
|
},
|
|
235
236
|
content: /* @__PURE__ */jsxRuntime.jsx(UserAssignment, {
|
|
236
237
|
userList,
|
|
237
|
-
assignees: metadata
|
|
238
|
+
assignees: ((_a = metadata == null ? void 0 : metadata.assignees) == null ? void 0 : _a.length) > 0 ? metadata.assignees : [],
|
|
238
239
|
documentId: id
|
|
239
240
|
})
|
|
240
241
|
},
|
|
@@ -337,7 +338,7 @@ function arraysContainMatchingString(one, two) {
|
|
|
337
338
|
return one.some(item => two.includes(item));
|
|
338
339
|
}
|
|
339
340
|
function UpdateWorkflow(props, actionState) {
|
|
340
|
-
var _a, _b, _c;
|
|
341
|
+
var _a, _b, _c, _d;
|
|
341
342
|
const {
|
|
342
343
|
id,
|
|
343
344
|
type
|
|
@@ -398,7 +399,7 @@ function UpdateWorkflow(props, actionState) {
|
|
|
398
399
|
arraysContainMatchingString(user.roles.map(r => r.name), actionState.roles) :
|
|
399
400
|
// No roles specified on the next state, so anyone can update
|
|
400
401
|
((_c = actionState == null ? void 0 : actionState.roles) == null ? void 0 : _c.length) !== 0;
|
|
401
|
-
const actionStateIsAValidTransition = (currentState == null ? void 0 : currentState.id) && currentState.transitions.length ?
|
|
402
|
+
const actionStateIsAValidTransition = (currentState == null ? void 0 : currentState.id) && ((_d = currentState == null ? void 0 : currentState.transitions) == null ? void 0 : _d.length) ?
|
|
402
403
|
// If the Current State limits transitions to specific States
|
|
403
404
|
// Check that the Action State is in Current State's transitions array
|
|
404
405
|
currentState.transitions.includes(actionState.id) :
|
|
@@ -407,7 +408,7 @@ function UpdateWorkflow(props, actionState) {
|
|
|
407
408
|
const userAssignmentCanUpdateState = actionState.requireAssignment ?
|
|
408
409
|
// If the Action State requires assigned users
|
|
409
410
|
// Check the current user ID is in the assignees array
|
|
410
|
-
currentUser && assignees.length && assignees.includes(currentUser.id) :
|
|
411
|
+
currentUser && (assignees == null ? void 0 : assignees.length) && assignees.includes(currentUser.id) :
|
|
411
412
|
// Otherwise this isn't a problem
|
|
412
413
|
true;
|
|
413
414
|
let title = "".concat(directionLabel, " State to \"").concat(actionState.title, "\"");
|