sanity-plugin-workflow 1.0.0-beta.11 → 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 CHANGED
@@ -325,7 +325,7 @@ function arraysContainMatchingString(one, two) {
325
325
  return one.some(item => two.includes(item));
326
326
  }
327
327
  function UpdateWorkflow(props, actionState) {
328
- var _a, _b, _c;
328
+ var _a, _b, _c, _d;
329
329
  const {
330
330
  id,
331
331
  type
@@ -386,7 +386,7 @@ function UpdateWorkflow(props, actionState) {
386
386
  arraysContainMatchingString(user.roles.map(r => r.name), actionState.roles) :
387
387
  // No roles specified on the next state, so anyone can update
388
388
  ((_c = actionState == null ? void 0 : actionState.roles) == null ? void 0 : _c.length) !== 0;
389
- const actionStateIsAValidTransition = (currentState == null ? void 0 : currentState.id) && currentState.transitions.length ?
389
+ const actionStateIsAValidTransition = (currentState == null ? void 0 : currentState.id) && ((_d = currentState == null ? void 0 : currentState.transitions) == null ? void 0 : _d.length) ?
390
390
  // If the Current State limits transitions to specific States
391
391
  // Check that the Action State is in Current State's transitions array
392
392
  currentState.transitions.includes(actionState.id) :
@@ -395,7 +395,7 @@ function UpdateWorkflow(props, actionState) {
395
395
  const userAssignmentCanUpdateState = actionState.requireAssignment ?
396
396
  // If the Action State requires assigned users
397
397
  // Check the current user ID is in the assignees array
398
- currentUser && assignees.length && assignees.includes(currentUser.id) :
398
+ currentUser && (assignees == null ? void 0 : assignees.length) && assignees.includes(currentUser.id) :
399
399
  // Otherwise this isn't a problem
400
400
  true;
401
401
  let title = "".concat(directionLabel, " State to \"").concat(actionState.title, "\"");