@sanity/workflow-studio-plugin 0.24.0 → 0.25.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.
@@ -299,8 +299,8 @@ function workflowsToolAvailable(tools) {
299
299
 
300
300
  const WORKFLOW_INTENT = "workflow";
301
301
 
302
- function pathSegmentTab(args) {
303
- return args.segment === void 0 ? args.fallback : args.tabs.find(tab => tab === args.segment);
302
+ function pathSegmentName(args) {
303
+ return args.names.find(name => name === args.segment);
304
304
  }
305
305
 
306
306
  function handlesWorkflowIntent(intent, params) {
@@ -314,12 +314,16 @@ function workflowIntentState(intent, params) {
314
314
  } : null;
315
315
  }
316
316
 
317
- const pad2 = n => String(n).padStart(2, "0"), DATE_FIELD_KINDS = [ "date", "dueDate", "datetime", "dueDatetime" ], DATE_FIELD_KIND_SET = new Set(DATE_FIELD_KINDS);
317
+ const pad2 = n => String(n).padStart(2, "0"), DUE_DATE_FIELD_KINDS = [ "dueDate", "dueDatetime" ], DATE_FIELD_KINDS = [ "date", "datetime", ...DUE_DATE_FIELD_KINDS ], DATE_FIELD_KIND_SET = new Set(DATE_FIELD_KINDS), DUE_DATE_FIELD_KIND_SET = new Set(DUE_DATE_FIELD_KINDS);
318
318
 
319
319
  function isDateFieldKind(kind) {
320
320
  return DATE_FIELD_KIND_SET.has(kind);
321
321
  }
322
322
 
323
+ function isDueDateFieldKind(kind) {
324
+ return DUE_DATE_FIELD_KIND_SET.has(kind);
325
+ }
326
+
323
327
  function hasTimeOfDay(kind) {
324
328
  return kind === "datetime" || kind === "dueDatetime";
325
329
  }
@@ -986,11 +990,23 @@ function rowAssignControlState(args) {
986
990
 
987
991
  function rowDateControlState(args) {
988
992
  return rowControlState({
989
- kinds: DATE_FIELD_KINDS,
993
+ kinds: DUE_DATE_FIELD_KINDS,
990
994
  ...args
991
995
  });
992
996
  }
993
997
 
998
+ function dateValuesOf(state, matches) {
999
+ return state.filter(entry => matches(entry._type)).map(entry => entry.value).filter(value => typeof value == "string" && value !== "");
1000
+ }
1001
+
1002
+ function datesOf(state) {
1003
+ return dateValuesOf(state, isDateFieldKind);
1004
+ }
1005
+
1006
+ function dueDatesOf(state) {
1007
+ return dateValuesOf(state, isDueDateFieldKind);
1008
+ }
1009
+
994
1010
  function committedRowFace(row) {
995
1011
  return {
996
1012
  activityName: row.activityName,
@@ -1002,7 +1018,11 @@ function committedRowFace(row) {
1002
1018
  }
1003
1019
 
1004
1020
  function activityRowProps(args) {
1005
- const {activityEval: activityEval, activityState: activityState, editableFields: editableFields} = args, state = activityState.get(activityEval.activity.name) ?? [];
1021
+ const {activityEval: activityEval, activityState: activityState, editableFields: editableFields} = args, state = activityState.get(activityEval.activity.name) ?? [], controlArgs = {
1022
+ activity: activityEval.activity,
1023
+ status: activityEval.status,
1024
+ editableFields: editableFields
1025
+ };
1006
1026
  return {
1007
1027
  face: {
1008
1028
  activityName: activityEval.activity.name,
@@ -1011,12 +1031,10 @@ function activityRowProps(args) {
1011
1031
  automated: showsAutomatedPill(activityEval),
1012
1032
  blocked: showsBlockedTag(activityEval)
1013
1033
  },
1014
- assignState: rowAssignControlState({
1015
- activity: activityEval.activity,
1016
- status: activityEval.status,
1017
- editableFields: editableFields
1018
- }),
1034
+ assignState: rowAssignControlState(controlArgs),
1019
1035
  assigneeIds: assigneeUserIdsOf(state),
1036
+ dateState: rowDateControlState(controlArgs),
1037
+ dueDates: dueDatesOf(state),
1020
1038
  terminalActions: rowTerminalActions({
1021
1039
  activityEval: activityEval,
1022
1040
  state: state,
@@ -1026,12 +1044,12 @@ function activityRowProps(args) {
1026
1044
  }
1027
1045
 
1028
1046
  function dateControlKind(state) {
1029
- if (state.kind === "editable" && isDateFieldKind(state.field.type)) return state.field.type;
1047
+ if (state.kind === "editable" && isDueDateFieldKind(state.field.type)) return state.field.type;
1030
1048
  }
1031
1049
 
1032
1050
  function dateControlValue(args) {
1033
- const {state: state, dates: dates} = args;
1034
- return state.kind === "editable" ? typeof state.field.value == "string" && state.field.value !== "" ? state.field.value : void 0 : dates.find(value => parseStoredDateValue(value) !== void 0);
1051
+ const {state: state, dueDates: dueDates} = args;
1052
+ return state.kind === "editable" ? typeof state.field.value == "string" && state.field.value !== "" ? state.field.value : void 0 : dueDates.find(value => parseStoredDateValue(value) !== void 0);
1035
1053
  }
1036
1054
 
1037
1055
  function activityStateOf(instance, activityName) {
@@ -1098,7 +1116,7 @@ function useWorkflowInstanceEntry(instanceId, options = {}) {
1098
1116
 
1099
1117
  const WorkflowToolOpened = telemetry.defineEvent({
1100
1118
  name: "Editorial Workflows Studio Plugin Tool Opened",
1101
- version: 1,
1119
+ version: 2,
1102
1120
  description: "The Workflows tool was opened or its tab was switched"
1103
1121
  }), WorkflowDocumentViewOpened = telemetry.defineEvent({
1104
1122
  name: "Editorial Workflows Studio Plugin Document View Opened",
@@ -1120,14 +1138,14 @@ function definitionFingerprint(definition) {
1120
1138
  const WorkflowDefinitionDetailViewed = telemetry.defineEvent({
1121
1139
  name: "Editorial Workflows Studio Plugin Definition Detail Viewed",
1122
1140
  version: 1,
1123
- description: "The Workflows tool's per-definition detail view was opened"
1141
+ description: "A workflow's definition page was opened in the Workflows tool"
1124
1142
  }), WorkflowFormStripClicked = telemetry.defineEvent({
1125
1143
  name: "Editorial Workflows Studio Plugin Form Strip Clicked",
1126
1144
  version: 1,
1127
1145
  description: "The form strip's instance line was clicked, opening the document view"
1128
1146
  }), WorkflowDocumentLinkClicked = telemetry.defineEvent({
1129
1147
  name: "Editorial Workflows Studio Plugin Document Link Clicked",
1130
- version: 1,
1148
+ version: 2,
1131
1149
  description: "A document link was clicked, opening the referenced document's editor"
1132
1150
  }), WorkflowStartDialogOpened = telemetry.defineEvent({
1133
1151
  name: "Editorial Workflows Studio Plugin Start Dialog Opened",
@@ -1159,12 +1177,8 @@ const WorkflowDefinitionDetailViewed = telemetry.defineEvent({
1159
1177
  description: "The tool's task-filter menu closed with a changed selection"
1160
1178
  }), WorkflowBoardWorkflowSelected = telemetry.defineEvent({
1161
1179
  name: "Editorial Workflows Studio Plugin Board Workflow Selected",
1162
- version: 1,
1163
- description: "The Documents board settled on a workflow to show"
1164
- }), WorkflowBoardLayoutChanged = telemetry.defineEvent({
1165
- name: "Editorial Workflows Studio Plugin Board Layout Changed",
1166
- version: 1,
1167
- description: "The Documents board's layout was switched"
1180
+ version: 2,
1181
+ description: "The workflow documents page settled on the workflow it's showing"
1168
1182
  }), WorkflowTitleSeedDrifted = telemetry.defineEvent({
1169
1183
  name: "Editorial Workflows Studio Plugin Title Seed Drifted",
1170
1184
  version: 1,
@@ -1177,6 +1191,14 @@ const WorkflowDefinitionDetailViewed = telemetry.defineEvent({
1177
1191
  name: "Editorial Workflows Studio Plugin Todo Edited",
1178
1192
  version: 1,
1179
1193
  description: "A non-toggle todo-list write, attributed to its UI surface and gesture"
1194
+ }), WorkflowAbortDialogOpened = telemetry.defineEvent({
1195
+ name: "Editorial Workflows Studio Plugin Abort Dialog Opened",
1196
+ version: 1,
1197
+ description: "The abort-workflow confirm was opened"
1198
+ }), WorkflowAbortDialogSubmitted = telemetry.defineEvent({
1199
+ name: "Editorial Workflows Studio Plugin Abort Dialog Submitted",
1200
+ version: 1,
1201
+ description: "The abort-workflow confirm was submitted, carrying the attempt's outcome"
1180
1202
  });
1181
1203
 
1182
1204
  function useLogEventOnMount(event, data) {
@@ -1411,9 +1433,50 @@ function buildParams(decls, values) {
1411
1433
  };
1412
1434
  }
1413
1435
 
1414
- const NEVER_MS = 2 ** 31 - 1;
1436
+ function useDelayedFlag(active, delayMs) {
1437
+ const [held, setHeld] = react.useState(!1);
1438
+ return react.useEffect(() => {
1439
+ if (!active) {
1440
+ setHeld(!1);
1441
+ return;
1442
+ }
1443
+ const timer = setTimeout(() => setHeld(!0), delayMs);
1444
+ return () => clearTimeout(timer);
1445
+ }, [ active, delayMs ]), held && active;
1446
+ }
1447
+
1448
+ const NEVER_MS = 2 ** 31 - 1, OPEN_DELAY_MS = 300;
1415
1449
 
1416
1450
  function HoverHint(props) {
1451
+ return props.anchor !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(AnchoredHint, {
1452
+ ...props
1453
+ }) : /* @__PURE__ */ jsxRuntime.jsx(WrappingHint, {
1454
+ ...props
1455
+ });
1456
+ }
1457
+
1458
+ function AnchoredHint(props) {
1459
+ const {disabled: disabled = !1} = props, open = useDelayedFlag(props.open === !0 && !disabled, OPEN_DELAY_MS);
1460
+ /* @__PURE__ */
1461
+ return jsxRuntime.jsx(ui.Popover, {
1462
+ animate: !0,
1463
+ content: /* @__PURE__ */ jsxRuntime.jsx(HintBody, {
1464
+ ...props
1465
+ }),
1466
+ open: open,
1467
+ padding: hintPadding(props),
1468
+ placement: props.placement ?? "top",
1469
+ portal: !0,
1470
+ radius: 3,
1471
+ referenceElement: props.anchor
1472
+ });
1473
+ }
1474
+
1475
+ function hintPadding(props) {
1476
+ return props.content !== void 0 && props.flush ? 0 : 2;
1477
+ }
1478
+
1479
+ function WrappingHint(props) {
1417
1480
  const {children: children, disabled: disabled = !1} = props;
1418
1481
  /* @__PURE__ */
1419
1482
  return jsxRuntime.jsx(ui.Tooltip, {
@@ -1423,10 +1486,10 @@ function HoverHint(props) {
1423
1486
  }),
1424
1487
  delay: {
1425
1488
  close: 0,
1426
- open: disabled ? NEVER_MS : 300
1489
+ open: disabled ? NEVER_MS : OPEN_DELAY_MS
1427
1490
  },
1428
- padding: props.content !== void 0 && props.flush ? 0 : 2,
1429
- placement: "top",
1491
+ padding: hintPadding(props),
1492
+ placement: props.placement ?? "top",
1430
1493
  portal: !0,
1431
1494
  radius: 3,
1432
1495
  children: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, {
@@ -2544,18 +2607,6 @@ function FieldInput$1({kind: kind, value: value, onChange: onChange, onEnter: on
2544
2607
  }
2545
2608
  }
2546
2609
 
2547
- function useDelayedFlag(active, delayMs) {
2548
- const [held, setHeld] = react.useState(!1);
2549
- return react.useEffect(() => {
2550
- if (!active) {
2551
- setHeld(!1);
2552
- return;
2553
- }
2554
- const timer = setTimeout(() => setHeld(!0), delayMs);
2555
- return () => clearTimeout(timer);
2556
- }, [ active, delayMs ]), held && active;
2557
- }
2558
-
2559
2610
  function isCompact(layout) {
2560
2611
  return layout === "inline" || layout === "row";
2561
2612
  }
@@ -3933,39 +3984,12 @@ function ActivityStatusIcon({status: status}) {
3933
3984
  });
3934
3985
  }
3935
3986
 
3936
- function LoadingRow({label: label, padding: padding}) {
3937
- /* @__PURE__ */
3938
- return jsxRuntime.jsxs(ui.Flex, {
3939
- align: "center",
3940
- gap: 2,
3941
- ...padding === void 0 ? {} : {
3942
- padding: padding
3943
- },
3944
- children: [
3945
- /* @__PURE__ */ jsxRuntime.jsx(ui.Spinner, {
3946
- muted: !0,
3947
- size: 1
3948
- }),
3949
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, {
3950
- muted: !0,
3951
- size: 1,
3952
- children: label
3953
- }) ]
3954
- });
3955
- }
3956
-
3957
3987
  function useSpaceToken(index) {
3958
3988
  const value = ui.useTheme_v2().space[index];
3959
3989
  if (value === void 0) throw new Error(`theme is missing space token ${index}`);
3960
3990
  return value;
3961
3991
  }
3962
3992
 
3963
- function useRadiusToken(index) {
3964
- const value = ui.useTheme_v2().radius[index];
3965
- if (value === void 0) throw new Error(`theme is missing radius token ${index}`);
3966
- return value;
3967
- }
3968
-
3969
3993
  function useContainerToken(index) {
3970
3994
  const value = ui.useTheme_v2().container[index];
3971
3995
  if (value === void 0) throw new Error(`theme is missing container token ${index}`);
@@ -4006,6 +4030,46 @@ function useBadgeCapTrim() {
4006
4030
  };
4007
4031
  }
4008
4032
 
4033
+ function SpinnerSlot({busy: busy}) {
4034
+ const size = useTextIconSize(), trim = useCapTrimFor(size);
4035
+ /* @__PURE__ */
4036
+ return jsxRuntime.jsx(ui.Flex, {
4037
+ align: "center",
4038
+ flex: "none",
4039
+ justify: "center",
4040
+ style: {
4041
+ height: size,
4042
+ marginBottom: trim,
4043
+ marginTop: trim,
4044
+ width: size
4045
+ },
4046
+ children: busy ? /* @__PURE__ */ jsxRuntime.jsx(ui.Spinner, {
4047
+ muted: !0,
4048
+ size: 1
4049
+ }) : null
4050
+ });
4051
+ }
4052
+
4053
+ function LoadingRow({label: label, padding: padding}) {
4054
+ /* @__PURE__ */
4055
+ return jsxRuntime.jsxs(ui.Flex, {
4056
+ align: "center",
4057
+ gap: 2,
4058
+ ...padding === void 0 ? {} : {
4059
+ padding: padding
4060
+ },
4061
+ children: [
4062
+ /* @__PURE__ */ jsxRuntime.jsx(SpinnerSlot, {
4063
+ busy: !0
4064
+ }),
4065
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, {
4066
+ muted: !0,
4067
+ size: 1,
4068
+ children: label
4069
+ }) ]
4070
+ });
4071
+ }
4072
+
4009
4073
  function AvatarDisplay({avatar: avatar, "aria-label": ariaLabel}) {
4010
4074
  const trim = useAvatarCapTrim();
4011
4075
  /* @__PURE__ */
@@ -5274,26 +5338,6 @@ function CountedLabel({count: count, label: label}) {
5274
5338
  });
5275
5339
  }
5276
5340
 
5277
- function SpinnerSlot({busy: busy}) {
5278
- const size = useTextIconSize(), trim = useCapTrimFor(size);
5279
- /* @__PURE__ */
5280
- return jsxRuntime.jsx(ui.Flex, {
5281
- align: "center",
5282
- flex: "none",
5283
- justify: "center",
5284
- style: {
5285
- height: size,
5286
- marginBottom: trim,
5287
- marginTop: trim,
5288
- width: size
5289
- },
5290
- children: busy ? /* @__PURE__ */ jsxRuntime.jsx(ui.Spinner, {
5291
- muted: !0,
5292
- size: 1
5293
- }) : null
5294
- });
5295
- }
5296
-
5297
5341
  function GroupHeading({busy: busy, count: count, title: title, end: end}) {
5298
5342
  /* @__PURE__ */
5299
5343
  return jsxRuntime.jsxs(ui.Flex, {
@@ -5320,6 +5364,92 @@ function GroupHeading({busy: busy, count: count, title: title, end: end}) {
5320
5364
  });
5321
5365
  }
5322
5366
 
5367
+ function ActivityDateControl({instanceId: instanceId, state: state, surface: surface, dueDates: dueDates}) {
5368
+ const editField = useEditField(surface), {save: save} = useSaveField({
5369
+ instanceId: instanceId
5370
+ }), [open, setOpen] = react.useState(!1), raw = dateControlValue({
5371
+ state: state,
5372
+ dueDates: dueDates
5373
+ }), display = raw === void 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, {
5374
+ muted: !0,
5375
+ size: 1,
5376
+ children: formatDate(raw)
5377
+ });
5378
+ if (state.kind === "none") return display;
5379
+ if (state.kind === "closed") return display === null ? null : /* @__PURE__ */ jsxRuntime.jsx(HoverHint, {
5380
+ text: state.reason,
5381
+ children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, {
5382
+ "aria-label": "Date",
5383
+ as: "span",
5384
+ fontSize: 1,
5385
+ mode: "bleed",
5386
+ onClick: stopRowClick,
5387
+ onMouseDown: stopRowMouseDown,
5388
+ padding: 2,
5389
+ children: display
5390
+ })
5391
+ });
5392
+ const kind = dateControlKind(state), commit = (mode, value) => {
5393
+ state.kind === "editable" && save(() => editField({
5394
+ instanceId: instanceId,
5395
+ field: state.field,
5396
+ ...mode === "set" ? {
5397
+ mode: mode,
5398
+ value: value
5399
+ } : {
5400
+ mode: mode
5401
+ }
5402
+ }));
5403
+ }, handleClick = e => {
5404
+ e.stopPropagation(), setOpen(v => !v);
5405
+ };
5406
+ /* @__PURE__ */
5407
+ return jsxRuntime.jsx(DismissablePopover, {
5408
+ content: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, {
5409
+ onClick: stopRowClick,
5410
+ children: state.kind === "loading" || kind === void 0 ? /* @__PURE__ */ jsxRuntime.jsx(LoadingRow, {
5411
+ label: "Loading…",
5412
+ padding: 3
5413
+ }) : /* @__PURE__ */ jsxRuntime.jsx(workflowComponents.ClearableDatePicker, {
5414
+ clearLabel: "Clear date",
5415
+ onClear: () => {
5416
+ setOpen(!1), commit("unset");
5417
+ },
5418
+ onPick: next => {
5419
+ hasTimeOfDay(kind) || setOpen(!1), commit("set", serializeDateFieldValue(next, kind));
5420
+ },
5421
+ selectTime: hasTimeOfDay(kind),
5422
+ value: parseDateFieldValue(state.field.value, kind)
5423
+ })
5424
+ }),
5425
+ onDismiss: () => setOpen(!1),
5426
+ open: open,
5427
+ children: display ? /* @__PURE__ */ jsxRuntime.jsx(ui.Button, {
5428
+ "aria-label": "Change date",
5429
+ as: "span",
5430
+ fontSize: 1,
5431
+ mode: "bleed",
5432
+ onClick: handleClick,
5433
+ onMouseDown: stopRowMouseDown,
5434
+ padding: 2,
5435
+ children: display
5436
+ }) : /* @__PURE__ */ jsxRuntime.jsx(HoverHint, {
5437
+ disabled: open,
5438
+ text: "Set date",
5439
+ children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, {
5440
+ "aria-label": "Set date",
5441
+ as: "span",
5442
+ fontSize: 1,
5443
+ icon: Calendar.CalendarIcon,
5444
+ mode: "bleed",
5445
+ onClick: handleClick,
5446
+ onMouseDown: stopRowMouseDown,
5447
+ padding: 2
5448
+ })
5449
+ })
5450
+ });
5451
+ }
5452
+
5323
5453
  function settledDim(settled) {
5324
5454
  return settled ? {
5325
5455
  opacity: .66
@@ -5392,7 +5522,7 @@ function TitleTag({hint: hint, tone: tone, children: children}) {
5392
5522
  });
5393
5523
  }
5394
5524
 
5395
- function ActivityRow({face: face, breadcrumb: breadcrumb, assigneeIds: assigneeIds, assignState: assignState, dateControl: dateControl, instanceId: instanceId, onOpen: onOpen, surface: surface, terminalActions: terminalActions = []}) {
5525
+ function ActivityRow({face: face, breadcrumb: breadcrumb, assigneeIds: assigneeIds, assignState: assignState, dateState: dateState, dueDates: dueDates, instanceId: instanceId, onOpen: onOpen, surface: surface, terminalActions: terminalActions = []}) {
5396
5526
  const settled = workflowEngine.isTerminalActivityStatus(face.status), dimmed = settledDim(settled);
5397
5527
  /* @__PURE__ */
5398
5528
  return jsxRuntime.jsxs(WorkRow, {
@@ -5402,7 +5532,13 @@ function ActivityRow({face: face, breadcrumb: breadcrumb, assigneeIds: assigneeI
5402
5532
  activity: face.activityName,
5403
5533
  instanceId: instanceId,
5404
5534
  surface: surface
5405
- }), dateControl,
5535
+ }),
5536
+ /* @__PURE__ */ jsxRuntime.jsx(ActivityDateControl, {
5537
+ dueDates: dueDates,
5538
+ instanceId: instanceId,
5539
+ state: dateState,
5540
+ surface: surface
5541
+ }),
5406
5542
  /* @__PURE__ */ jsxRuntime.jsx(AssignActivityControl, {
5407
5543
  assigneeIds: assigneeIds,
5408
5544
  instanceId: instanceId,
@@ -7096,18 +7232,16 @@ function coveredFieldNames(ctx) {
7096
7232
  return release && names.add(release.name), names;
7097
7233
  }
7098
7234
 
7099
- const OPTIONAL_INIT_KINDS = /* @__PURE__ */ new Set([ "array", "assignees", "doc.refs" ]);
7100
-
7101
7235
  function inputInitFields(args) {
7102
7236
  return (args.definition?.fields ?? []).filter(entry => entry.initialValue?.type === "input" && !args.covered.has(entry.name));
7103
7237
  }
7104
7238
 
7105
- function gatesStart(entry) {
7106
- return !OPTIONAL_INIT_KINDS.has(entry.type);
7239
+ function isRequiredEntry(entry) {
7240
+ return entry.required === !0;
7107
7241
  }
7108
7242
 
7109
7243
  function missingInitFields(initFields, values) {
7110
- return initFields.filter(entry => gatesStart(entry) && !isFieldFilled(entry, values[entry.name] ?? null));
7244
+ return initFields.filter(entry => isRequiredEntry(entry) && !isFieldFilled(entry, values[entry.name] ?? null));
7111
7245
  }
7112
7246
 
7113
7247
  function numericFilled(value) {
@@ -7984,7 +8118,7 @@ function WorkflowsPanel({entries: entries, documentId: documentId, docTypeMappin
7984
8118
  children: /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, {
7985
8119
  direction: "column",
7986
8120
  flex: 1,
7987
- children: view === "overview" ? /* @__PURE__ */ jsxRuntime.jsx(OverviewTab, {
8121
+ children: view === "overview" ? /* @__PURE__ */ jsxRuntime.jsx(OverviewSections, {
7988
8122
  active: active,
7989
8123
  empty: /* @__PURE__ */ jsxRuntime.jsx(OverviewEmptyState, {
7990
8124
  docId: documentId,
@@ -8008,7 +8142,7 @@ function WorkflowsPanel({entries: entries, documentId: documentId, docTypeMappin
8008
8142
  });
8009
8143
  }
8010
8144
 
8011
- function OverviewTab({active: active, empty: empty, finished: finished, sectionFor: sectionFor}) {
8145
+ function OverviewSections({active: active, empty: empty, finished: finished, sectionFor: sectionFor}) {
8012
8146
  /* @__PURE__ */
8013
8147
  return jsxRuntime.jsxs(ui.Stack, {
8014
8148
  gap: 5,
@@ -9229,7 +9363,7 @@ function InitFieldRow({entry: entry, docType: docType, releaseId: releaseId, val
9229
9363
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, {
9230
9364
  size: 1,
9231
9365
  weight: "medium",
9232
- children: gatesStart(entry) ? `${label} (Required)` : label
9366
+ children: isRequiredEntry(entry) ? `${label} (Required)` : label
9233
9367
  }), entry.description ? /* @__PURE__ */ jsxRuntime.jsx(ui.Text, {
9234
9368
  muted: !0,
9235
9369
  size: 1,
@@ -10091,6 +10225,103 @@ function StartWorkflowDialogHost() {
10091
10225
  }, `${startRequest2.definition}:${startRequest2.subjectDocId ?? ""}`) : null;
10092
10226
  }
10093
10227
 
10228
+ const TOOL_TAB_LABELS = {
10229
+ overview: "Workflows",
10230
+ "all-documents": "All documents",
10231
+ "for-me": "For me"
10232
+ }, TOOL_TAB_VALUES = Object.keys(TOOL_TAB_LABELS), TOOL_TABS = TOOL_TAB_VALUES.map(value => ({
10233
+ value: value,
10234
+ label: TOOL_TAB_LABELS[value]
10235
+ })), LANDING_TAB = "overview", TASKS_TAB = "all-documents", WORKFLOW_PAGE_LABELS = {
10236
+ workflow: "Documents",
10237
+ definition: "Definition"
10238
+ }, WORKFLOW_PAGE_VALUES = Object.keys(WORKFLOW_PAGE_LABELS), DEFAULT_WORKFLOW_PAGE = "workflow", WORKFLOW_PAGES = WORKFLOW_PAGE_VALUES.filter(page => page !== DEFAULT_WORKFLOW_PAGE), WORKFLOW_PAGE_TABS = WORKFLOW_PAGE_VALUES.map(value => ({
10239
+ value: value,
10240
+ label: WORKFLOW_PAGE_LABELS[value]
10241
+ })), toolRouter = router.route.create("/", [ router.route.create("/instance/:instanceId"), router.route.create(`/${LANDING_TAB}/:workflowName`, [ router.route.create("/:workflowPage") ]), router.route.create("/:workflowsTab") ]);
10242
+
10243
+ function toolTabState(tab) {
10244
+ return {
10245
+ workflowsTab: tab
10246
+ };
10247
+ }
10248
+
10249
+ function landingState() {
10250
+ return toolTabState(LANDING_TAB);
10251
+ }
10252
+
10253
+ function workflowState(workflowName) {
10254
+ return {
10255
+ workflowName: workflowName
10256
+ };
10257
+ }
10258
+
10259
+ function instanceState(instanceId) {
10260
+ return {
10261
+ instanceId: instanceId
10262
+ };
10263
+ }
10264
+
10265
+ function tabSelectionNavigates(current, tab) {
10266
+ return !(current.kind === "home" && tab === current.tab);
10267
+ }
10268
+
10269
+ function toolTabLabel(tab) {
10270
+ return TOOL_TAB_LABELS[tab];
10271
+ }
10272
+
10273
+ function backToTabLabel(tab) {
10274
+ return `Back to ${toolTabLabel(tab)}`;
10275
+ }
10276
+
10277
+ function workflowPageState(page, workflowName) {
10278
+ return page === DEFAULT_WORKFLOW_PAGE ? workflowState(workflowName) : {
10279
+ ...workflowState(workflowName),
10280
+ workflowPage: page
10281
+ };
10282
+ }
10283
+
10284
+ function toolRoute(state) {
10285
+ const {instanceId: instanceId, workflowName: workflowName} = state;
10286
+ if (typeof instanceId == "string") return {
10287
+ kind: "instance",
10288
+ instanceId: instanceId,
10289
+ tab: TASKS_TAB
10290
+ };
10291
+ if (typeof workflowName == "string") return workflowRoute(workflowName, state.workflowPage);
10292
+ const tab = pathSegmentName({
10293
+ segment: state.workflowsTab,
10294
+ names: TOOL_TAB_VALUES
10295
+ });
10296
+ return tab === void 0 ? {
10297
+ kind: "unnamed",
10298
+ tab: LANDING_TAB
10299
+ } : {
10300
+ kind: "home",
10301
+ tab: tab
10302
+ };
10303
+ }
10304
+
10305
+ function workflowRoute(workflowName, pageSegment) {
10306
+ if (pageSegment === void 0) return {
10307
+ kind: "workflow",
10308
+ workflowName: workflowName,
10309
+ tab: LANDING_TAB
10310
+ };
10311
+ const page = pathSegmentName({
10312
+ segment: pageSegment,
10313
+ names: WORKFLOW_PAGES
10314
+ });
10315
+ return page === void 0 ? {
10316
+ kind: "unnamed",
10317
+ tab: LANDING_TAB
10318
+ } : {
10319
+ kind: page,
10320
+ workflowName: workflowName,
10321
+ tab: LANDING_TAB
10322
+ };
10323
+ }
10324
+
10094
10325
  const WorkflowsToolRoot = react.lazy(() => Promise.resolve().then(function() {
10095
10326
  return require("./workflows-tool-root.cjs");
10096
10327
  }));
@@ -10108,7 +10339,7 @@ const workflowsTool = {
10108
10339
  title: "Workflows",
10109
10340
  icon: Transfer.TransferIcon,
10110
10341
  component: LazyWorkflowsTool,
10111
- router: router.route.create("/", [ router.route.create("/instance/:instanceId"), router.route.create("/definition/:definitionName"), router.route.create("/documents/:boardDefinition"), router.route.create("/:workflowsTab") ]),
10342
+ router: toolRouter,
10112
10343
  canHandleIntent: (intent, params) => handlesWorkflowIntent(intent, params),
10113
10344
  getIntentState: (intent, params) => workflowIntentState(intent, params)
10114
10345
  }, LOCKABLE_ACTIONS = /* @__PURE__ */ new Map([ [ "delete", "delete" ], [ "publish", "publish" ], [ "unpublish", "unpublish" ] ]);
@@ -10224,6 +10455,8 @@ exports.EmptyState = EmptyState;
10224
10455
 
10225
10456
  exports.ForMeEmptyState = ForMeEmptyState;
10226
10457
 
10458
+ exports.Hairline = Hairline;
10459
+
10227
10460
  exports.HintedMenuButton = HintedMenuButton;
10228
10461
 
10229
10462
  exports.HoverHint = HoverHint;
@@ -10240,8 +10473,6 @@ exports.LogEventOnMount = LogEventOnMount;
10240
10473
 
10241
10474
  exports.MetaRow = MetaRow;
10242
10475
 
10243
- exports.NOTICE_PADDING = NOTICE_PADDING;
10244
-
10245
10476
  exports.SpinnerSlot = SpinnerSlot;
10246
10477
 
10247
10478
  exports.StageFace = StageFace;
@@ -10250,6 +10481,8 @@ exports.StaleLock = StaleLock;
10250
10481
 
10251
10482
  exports.TOAST_ID = TOAST_ID;
10252
10483
 
10484
+ exports.TOOL_TABS = TOOL_TABS;
10485
+
10253
10486
  exports.TabSwitch = TabSwitch;
10254
10487
 
10255
10488
  exports.TrailingHairline = TrailingHairline;
@@ -10260,7 +10493,11 @@ exports.UserAvatar = UserAvatar;
10260
10493
 
10261
10494
  exports.WORKFLOW_API_VERSION = WORKFLOW_API_VERSION;
10262
10495
 
10263
- exports.WorkflowBoardLayoutChanged = WorkflowBoardLayoutChanged;
10496
+ exports.WORKFLOW_PAGE_TABS = WORKFLOW_PAGE_TABS;
10497
+
10498
+ exports.WorkflowAbortDialogOpened = WorkflowAbortDialogOpened;
10499
+
10500
+ exports.WorkflowAbortDialogSubmitted = WorkflowAbortDialogSubmitted;
10264
10501
 
10265
10502
  exports.WorkflowBoardWorkflowSelected = WorkflowBoardWorkflowSelected;
10266
10503
 
@@ -10278,15 +10515,13 @@ exports.activityRowProps = activityRowProps;
10278
10515
 
10279
10516
  exports.assigneeUserIdsOf = assigneeUserIdsOf;
10280
10517
 
10281
- exports.chipPadding = chipPadding;
10518
+ exports.backToTabLabel = backToTabLabel;
10282
10519
 
10283
10520
  exports.committedRowFace = committedRowFace;
10284
10521
 
10285
10522
  exports.createSubscribers = createSubscribers;
10286
10523
 
10287
- exports.dateControlKind = dateControlKind;
10288
-
10289
- exports.dateControlValue = dateControlValue;
10524
+ exports.datesOf = datesOf;
10290
10525
 
10291
10526
  exports.definitionFingerprint = definitionFingerprint;
10292
10527
 
@@ -10294,6 +10529,8 @@ exports.definitionSnapshotOf = definitionSnapshotOf;
10294
10529
 
10295
10530
  exports.describeError = describeError;
10296
10531
 
10532
+ exports.dueDatesOf = dueDatesOf;
10533
+
10297
10534
  exports.findActivity = findActivity;
10298
10535
 
10299
10536
  exports.findActivityNode = findActivityNode;
@@ -10310,22 +10547,22 @@ exports.formatTimeAgo = formatTimeAgo;
10310
10547
 
10311
10548
  exports.gdrLocality = gdrLocality;
10312
10549
 
10313
- exports.hasTimeOfDay = hasTimeOfDay;
10314
-
10315
10550
  exports.instanceBreadcrumb = instanceBreadcrumb;
10316
10551
 
10552
+ exports.instanceState = instanceState;
10553
+
10317
10554
  exports.instanceTitle = instanceTitle;
10318
10555
 
10319
10556
  exports.isActivityAssignedTo = isActivityAssignedTo;
10320
10557
 
10321
- exports.isDateFieldKind = isDateFieldKind;
10322
-
10323
10558
  exports.isEvaluationStale = isEvaluationStale;
10324
10559
 
10325
10560
  exports.isLiveEntry = isLiveEntry;
10326
10561
 
10327
10562
  exports.isOpenActivityStatus = isOpenActivityStatus;
10328
10563
 
10564
+ exports.landingState = landingState;
10565
+
10329
10566
  exports.mappingIssueDetail = mappingIssueDetail;
10330
10567
 
10331
10568
  exports.namesNoDeployedDefinition = namesNoDeployedDefinition;
@@ -10334,27 +10571,23 @@ exports.openActivityGone = openActivityGone;
10334
10571
 
10335
10572
  exports.openableSchemaType = openableSchemaType;
10336
10573
 
10337
- exports.parseDateFieldValue = parseDateFieldValue;
10338
-
10339
10574
  exports.parseStoredDateValue = parseStoredDateValue;
10340
10575
 
10341
- exports.pathSegmentTab = pathSegmentTab;
10342
-
10343
10576
  exports.readDeployedDefinitions = readDeployedDefinitions;
10344
10577
 
10345
10578
  exports.rowAssignControlState = rowAssignControlState;
10346
10579
 
10347
10580
  exports.rowDateControlState = rowDateControlState;
10348
10581
 
10349
- exports.serializeDateFieldValue = serializeDateFieldValue;
10350
-
10351
10582
  exports.stageTitle = stageTitle;
10352
10583
 
10353
10584
  exports.stateByActivity = stateByActivity;
10354
10585
 
10355
- exports.stopRowClick = stopRowClick;
10586
+ exports.tabSelectionNavigates = tabSelectionNavigates;
10587
+
10588
+ exports.toolRoute = toolRoute;
10356
10589
 
10357
- exports.stopRowMouseDown = stopRowMouseDown;
10590
+ exports.toolTabState = toolTabState;
10358
10591
 
10359
10592
  exports.useAssignmentIdentity = useAssignmentIdentity;
10360
10593
 
@@ -10368,16 +10601,10 @@ exports.useDefinition = useDefinition;
10368
10601
 
10369
10602
  exports.useDelayedFlag = useDelayedFlag;
10370
10603
 
10371
- exports.useEditField = useEditField;
10372
-
10373
10604
  exports.useLogEventOnMount = useLogEventOnMount;
10374
10605
 
10375
10606
  exports.useProjectMembers = useProjectMembers;
10376
10607
 
10377
- exports.useRadiusToken = useRadiusToken;
10378
-
10379
- exports.useSaveField = useSaveField;
10380
-
10381
10608
  exports.useSpaceToken = useSpaceToken;
10382
10609
 
10383
10610
  exports.useUserDisplay = useUserDisplay;
@@ -10392,6 +10619,10 @@ exports.useWorkflowToast = useWorkflowToast;
10392
10619
 
10393
10620
  exports.workflowDefaultDocumentNode = workflowDefaultDocumentNode;
10394
10621
 
10622
+ exports.workflowPageState = workflowPageState;
10623
+
10624
+ exports.workflowState = workflowState;
10625
+
10395
10626
  exports.workflowStudioPlugin = workflowStudioPlugin;
10396
10627
 
10397
10628
  exports.workflowsView = workflowsView;