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.esm.js
CHANGED
|
@@ -190,6 +190,7 @@ function WorkflowProvider(props) {
|
|
|
190
190
|
});
|
|
191
191
|
}
|
|
192
192
|
function AssignWorkflow(props) {
|
|
193
|
+
var _a;
|
|
193
194
|
const {
|
|
194
195
|
id
|
|
195
196
|
} = props;
|
|
@@ -221,7 +222,7 @@ function AssignWorkflow(props) {
|
|
|
221
222
|
},
|
|
222
223
|
content: /* @__PURE__ */jsx(UserAssignment, {
|
|
223
224
|
userList,
|
|
224
|
-
assignees: metadata
|
|
225
|
+
assignees: ((_a = metadata == null ? void 0 : metadata.assignees) == null ? void 0 : _a.length) > 0 ? metadata.assignees : [],
|
|
225
226
|
documentId: id
|
|
226
227
|
})
|
|
227
228
|
},
|
|
@@ -324,7 +325,7 @@ function arraysContainMatchingString(one, two) {
|
|
|
324
325
|
return one.some(item => two.includes(item));
|
|
325
326
|
}
|
|
326
327
|
function UpdateWorkflow(props, actionState) {
|
|
327
|
-
var _a, _b, _c;
|
|
328
|
+
var _a, _b, _c, _d;
|
|
328
329
|
const {
|
|
329
330
|
id,
|
|
330
331
|
type
|
|
@@ -385,7 +386,7 @@ function UpdateWorkflow(props, actionState) {
|
|
|
385
386
|
arraysContainMatchingString(user.roles.map(r => r.name), actionState.roles) :
|
|
386
387
|
// No roles specified on the next state, so anyone can update
|
|
387
388
|
((_c = actionState == null ? void 0 : actionState.roles) == null ? void 0 : _c.length) !== 0;
|
|
388
|
-
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) ?
|
|
389
390
|
// If the Current State limits transitions to specific States
|
|
390
391
|
// Check that the Action State is in Current State's transitions array
|
|
391
392
|
currentState.transitions.includes(actionState.id) :
|
|
@@ -394,7 +395,7 @@ function UpdateWorkflow(props, actionState) {
|
|
|
394
395
|
const userAssignmentCanUpdateState = actionState.requireAssignment ?
|
|
395
396
|
// If the Action State requires assigned users
|
|
396
397
|
// Check the current user ID is in the assignees array
|
|
397
|
-
currentUser && assignees.length && assignees.includes(currentUser.id) :
|
|
398
|
+
currentUser && (assignees == null ? void 0 : assignees.length) && assignees.includes(currentUser.id) :
|
|
398
399
|
// Otherwise this isn't a problem
|
|
399
400
|
true;
|
|
400
401
|
let title = "".concat(directionLabel, " State to \"").concat(actionState.title, "\"");
|