sanity-plugin-workflow 1.0.0-beta.11 → 1.0.0-beta.13

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.js CHANGED
@@ -338,7 +338,7 @@ function arraysContainMatchingString(one, two) {
338
338
  return one.some(item => two.includes(item));
339
339
  }
340
340
  function UpdateWorkflow(props, actionState) {
341
- var _a, _b, _c;
341
+ var _a, _b, _c, _d;
342
342
  const {
343
343
  id,
344
344
  type
@@ -399,7 +399,7 @@ function UpdateWorkflow(props, actionState) {
399
399
  arraysContainMatchingString(user.roles.map(r => r.name), actionState.roles) :
400
400
  // No roles specified on the next state, so anyone can update
401
401
  ((_c = actionState == null ? void 0 : actionState.roles) == null ? void 0 : _c.length) !== 0;
402
- 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) ?
403
403
  // If the Current State limits transitions to specific States
404
404
  // Check that the Action State is in Current State's transitions array
405
405
  currentState.transitions.includes(actionState.id) :
@@ -408,7 +408,7 @@ function UpdateWorkflow(props, actionState) {
408
408
  const userAssignmentCanUpdateState = actionState.requireAssignment ?
409
409
  // If the Action State requires assigned users
410
410
  // Check the current user ID is in the assignees array
411
- currentUser && assignees.length && assignees.includes(currentUser.id) :
411
+ currentUser && (assignees == null ? void 0 : assignees.length) && assignees.includes(currentUser.id) :
412
412
  // Otherwise this isn't a problem
413
413
  true;
414
414
  let title = "".concat(directionLabel, " State to \"").concat(actionState.title, "\"");