@pisell/private-materials 6.12.166 → 6.12.167

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.
Files changed (144) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/meta.js +1 -1
  5. package/build/lowcode/render/default/view.js +11 -11
  6. package/build/lowcode/view.js +11 -11
  7. package/es/components/HDLKiosk/app/ScreenRenderer.js +1 -1
  8. package/es/components/HDLKiosk/app/views.js +2 -1
  9. package/es/components/HDLKiosk/app/workflow/barcode.js +15 -32
  10. package/es/components/HDLKiosk/app/workflow/{guards.js → predicates.js} +9 -9
  11. package/es/components/HDLKiosk/app/workflow/quick.js +3 -6
  12. package/es/components/HDLKiosk/app/workflow/registry.js +1 -1
  13. package/es/components/HDLKiosk/app/workflow/scale.js +3 -12
  14. package/es/components/HDLKiosk/components/shell/HDLKioskBottomBarHost/index.js +12 -10
  15. package/es/components/HDLKiosk/components/shell/HDLKioskShell/index.js +1 -0
  16. package/es/components/HDLKiosk/docs/00-/346/226/207/344/273/266/345/257/274/350/210/252.md +7 -7
  17. package/es/components/HDLKiosk/docs/01-/346/240/270/345/277/203/350/277/220/350/241/214/346/234/272/345/210/266.md +46 -37
  18. package/es/components/HDLKiosk/docs/03-/344/270/232/345/212/241/346/265/201/347/250/213/344/270/216/344/272/244/344/272/222/350/247/204/345/210/231.md +2 -2
  19. package/es/components/HDLKiosk/docs/05-/344/272/244/346/230/223/345/256/211/345/205/250.md +1 -1
  20. package/es/components/HDLKiosk/docs/07-/345/220/216/347/273/255/345/267/245/344/275/234.md +1 -1
  21. package/es/components/HDLKiosk/docs/README.md +2 -2
  22. package/es/components/HDLKiosk/docs//345/256/236/346/226/275/350/277/233/345/272/246.md +3 -3
  23. package/es/components/HDLKiosk/docs//346/236/266/346/236/204/350/256/276/350/256/241.md +11 -11
  24. package/es/components/HDLKiosk/index.js +0 -1
  25. package/es/components/HDLKiosk/kernel/README.md +8 -9
  26. package/es/components/HDLKiosk/kernel/application/defineApplication.js +18 -19
  27. package/es/components/HDLKiosk/kernel/application/defineSlice.js +8 -13
  28. package/es/components/HDLKiosk/kernel/workflow/actor.js +88 -28
  29. package/es/components/HDLKiosk/kernel/workflow/compiler.js +28 -29
  30. package/es/components/HDLKiosk/kernel/workflow/selectors.js +9 -0
  31. package/es/components/HDLKiosk/runtime/HDLKioskWorkflowView.js +8 -7
  32. package/es/components/HDLKiosk/runtime/controllers/useHDLKioskCustomerController.js +1 -1
  33. package/es/components/HDLKiosk/runtime/createWorkflowSession.js +3 -3
  34. package/es/components/HDLKiosk/runtime/domainTransitionRunner.js +9 -9
  35. package/es/components/HDLKiosk/runtime/workflowEvent.js +9 -4
  36. package/es/components/HDLKiosk/runtime/workflowLifecycle.js +3 -3
  37. package/es/components/HDLKiosk/slices/catalog/PrimaryProductPromptDialog/index.js +1 -2
  38. package/es/components/HDLKiosk/slices/catalog/Screen/index.js +11 -38
  39. package/es/components/HDLKiosk/slices/catalog/Screen/model.js +1 -5
  40. package/es/components/HDLKiosk/slices/catalog/slice.js +4 -16
  41. package/es/components/HDLKiosk/slices/catalog/view.js +4 -6
  42. package/es/components/HDLKiosk/slices/customization/Screen/index.js +7 -9
  43. package/es/components/HDLKiosk/slices/customization/operation.js +23 -4
  44. package/es/components/HDLKiosk/slices/customization/slice.js +5 -9
  45. package/es/components/HDLKiosk/slices/customization/view.js +3 -2
  46. package/es/components/HDLKiosk/slices/fulfillment/Screen/index.js +6 -6
  47. package/es/components/HDLKiosk/slices/fulfillment/slice.js +5 -8
  48. package/es/components/HDLKiosk/slices/identity/Screen/index.js +18 -12
  49. package/es/components/HDLKiosk/slices/identity/slice.js +4 -11
  50. package/es/components/HDLKiosk/slices/index.js +3 -2
  51. package/es/components/HDLKiosk/slices/payment/Screen/index.js +5 -5
  52. package/es/components/HDLKiosk/slices/payment/slice.js +7 -8
  53. package/es/components/HDLKiosk/slices/primaryProductPrompt/slice.js +14 -0
  54. package/es/components/HDLKiosk/slices/primaryProductPrompt/view.js +23 -0
  55. package/es/components/HDLKiosk/utils.js +3 -2
  56. package/es/components/bigSale/components/BookingFloatingPanel/useBookingPanelController.js +1 -0
  57. package/es/components/bigSale/components/TimeBar/index.js +1 -0
  58. package/es/components/bigSale/dialog.js +1 -0
  59. package/es/components/bigSale/hooks/useBigSaleContext.js +1 -0
  60. package/es/components/bigSale/hooks/useSelectFloorMapResourceForBigSale.js +1 -0
  61. package/es/components/bigSale/index.js +1 -0
  62. package/es/components/bigSale/templates/HDLKiosk/auth/HDLKioskIdentityAuthPanel.js +17 -2
  63. package/es/components/bigSale/templates/Kiosk/index.js +1 -0
  64. package/es/components/sharedSecondaryBigSale/SharedSecondaryBigSaleReceiver.js +1 -0
  65. package/es/index.js +2 -0
  66. package/es/plus/pisellReservation/data/bookingToReservationTables.js +1 -1
  67. package/es/plus/pisellReservation/floorMap/floorPlanApi.js +1 -1
  68. package/es/plus/pisellReservation/floorMap/reservationMock.js +1 -1
  69. package/es/plus/pisellReservation/index.js +17 -0
  70. package/es/plus/saleDetail/Base.js +1 -0
  71. package/es/plus/saleDetail/components/Client/hooks/useClientSelectorProps.js +1 -0
  72. package/es/plus/saleDetail/components/DetailActions/index.js +1 -0
  73. package/es/plus/saleDetail/components/SummaryFinancialSections/index.js +1 -0
  74. package/es/plus/saleDetail/index.js +1 -0
  75. package/es/plus/saleDetail/tmpl/B/components/Dish/index.js +1 -0
  76. package/es/plus/saleDetail/tmpl/B/index.js +1 -0
  77. package/es/plus/salesSdk/index.js +52 -0
  78. package/es/plus/salesSdk/utils/addProductWithFlowDebounced.js +1 -1
  79. package/es/plus/salesSdk/utils/bookingDate.js +1 -1
  80. package/es/plus/salesSdk/utils/customerAuthGate.js +1 -1
  81. package/es/plus/salesSdk/utils/enrichCartLineHolderDisplay.js +1 -1
  82. package/es/pro/Login2.0/AuthModal.d.ts +1 -1
  83. package/es/pro/Login2.0/Login2.d.ts +2 -0
  84. package/es/pro/Login2.0/Login2.js +9 -1
  85. package/es/pro/Login2.0/Register2.d.ts +2 -0
  86. package/es/pro/Login2.0/Register2.js +9 -1
  87. package/es/pro/Login2.0/index.d.ts +2 -1
  88. package/es/pro/Login2.0/shared/types.d.ts +1 -1
  89. package/lib/components/HDLKiosk/app/ScreenRenderer.js +1 -1
  90. package/lib/components/HDLKiosk/app/views.js +2 -1
  91. package/lib/components/HDLKiosk/app/workflow/barcode.js +14 -31
  92. package/lib/components/HDLKiosk/app/workflow/{guards.js → predicates.js} +9 -9
  93. package/lib/components/HDLKiosk/app/workflow/quick.js +3 -6
  94. package/lib/components/HDLKiosk/app/workflow/registry.js +1 -1
  95. package/lib/components/HDLKiosk/app/workflow/scale.js +3 -12
  96. package/lib/components/HDLKiosk/components/shell/HDLKioskBottomBarHost/index.js +12 -10
  97. package/lib/components/HDLKiosk/components/shell/HDLKioskShell/index.js +1 -0
  98. package/lib/components/HDLKiosk/docs/00-/346/226/207/344/273/266/345/257/274/350/210/252.md +7 -7
  99. package/lib/components/HDLKiosk/docs/01-/346/240/270/345/277/203/350/277/220/350/241/214/346/234/272/345/210/266.md +46 -37
  100. package/lib/components/HDLKiosk/docs/03-/344/270/232/345/212/241/346/265/201/347/250/213/344/270/216/344/272/244/344/272/222/350/247/204/345/210/231.md +2 -2
  101. package/lib/components/HDLKiosk/docs/05-/344/272/244/346/230/223/345/256/211/345/205/250.md +1 -1
  102. package/lib/components/HDLKiosk/docs/07-/345/220/216/347/273/255/345/267/245/344/275/234.md +1 -1
  103. package/lib/components/HDLKiosk/docs/README.md +2 -2
  104. package/lib/components/HDLKiosk/docs//345/256/236/346/226/275/350/277/233/345/272/246.md +3 -3
  105. package/lib/components/HDLKiosk/docs//346/236/266/346/236/204/350/256/276/350/256/241.md +11 -11
  106. package/lib/components/HDLKiosk/index.js +0 -1
  107. package/lib/components/HDLKiosk/kernel/README.md +8 -9
  108. package/lib/components/HDLKiosk/kernel/application/defineApplication.js +18 -19
  109. package/lib/components/HDLKiosk/kernel/application/defineSlice.js +8 -14
  110. package/lib/components/HDLKiosk/kernel/workflow/actor.js +88 -28
  111. package/lib/components/HDLKiosk/kernel/workflow/compiler.js +28 -29
  112. package/lib/components/HDLKiosk/kernel/workflow/selectors.js +10 -0
  113. package/lib/components/HDLKiosk/runtime/HDLKioskWorkflowView.js +8 -7
  114. package/lib/components/HDLKiosk/runtime/controllers/useHDLKioskCustomerController.js +1 -1
  115. package/lib/components/HDLKiosk/runtime/createWorkflowSession.js +3 -3
  116. package/lib/components/HDLKiosk/runtime/domainTransitionRunner.js +9 -9
  117. package/lib/components/HDLKiosk/runtime/workflowEvent.js +9 -4
  118. package/lib/components/HDLKiosk/runtime/workflowLifecycle.js +3 -3
  119. package/lib/components/HDLKiosk/slices/catalog/PrimaryProductPromptDialog/index.js +1 -2
  120. package/lib/components/HDLKiosk/slices/catalog/Screen/index.js +13 -40
  121. package/lib/components/HDLKiosk/slices/catalog/Screen/model.js +0 -5
  122. package/lib/components/HDLKiosk/slices/catalog/slice.js +2 -15
  123. package/lib/components/HDLKiosk/slices/catalog/view.js +4 -6
  124. package/lib/components/HDLKiosk/slices/customization/Screen/index.js +7 -9
  125. package/lib/components/HDLKiosk/slices/customization/operation.js +23 -3
  126. package/lib/components/HDLKiosk/slices/customization/slice.js +3 -7
  127. package/lib/components/HDLKiosk/slices/customization/view.js +3 -2
  128. package/lib/components/HDLKiosk/slices/fulfillment/Screen/index.js +6 -6
  129. package/lib/components/HDLKiosk/slices/fulfillment/slice.js +4 -7
  130. package/lib/components/HDLKiosk/slices/identity/Screen/index.js +17 -11
  131. package/lib/components/HDLKiosk/slices/identity/slice.js +4 -11
  132. package/lib/components/HDLKiosk/slices/index.js +2 -1
  133. package/lib/components/HDLKiosk/slices/payment/Screen/index.js +5 -5
  134. package/lib/components/HDLKiosk/slices/payment/slice.js +6 -7
  135. package/lib/components/HDLKiosk/slices/primaryProductPrompt/slice.js +14 -0
  136. package/lib/components/HDLKiosk/slices/primaryProductPrompt/view.js +25 -0
  137. package/lib/components/HDLKiosk/utils.js +3 -2
  138. package/lib/components/bigSale/templates/HDLKiosk/auth/HDLKioskIdentityAuthPanel.js +16 -1
  139. package/lib/pro/Login2.0/Login2.d.ts +2 -0
  140. package/lib/pro/Login2.0/Login2.js +9 -1
  141. package/lib/pro/Login2.0/Register2.d.ts +2 -0
  142. package/lib/pro/Login2.0/Register2.js +9 -1
  143. package/package.json +3 -3
  144. package/es/private-materials/lowcode/authmodal/meta.d.ts +0 -1
@@ -24,6 +24,15 @@ function createWorkflowActor({ definition, context, sessionEpoch, transitionRunn
24
24
  let navigationTurnLocked = false;
25
25
  const repeatCounts = /* @__PURE__ */ new Map();
26
26
  const completedStepIds = /* @__PURE__ */ new Set();
27
+ const stepResolutions = /* @__PURE__ */ new Map();
28
+ let navigationHistory = [];
29
+ const readStepResolutions = () => {
30
+ const resolutions = {};
31
+ stepResolutions.forEach((resolution, stepId) => {
32
+ resolutions[stepId] = resolution;
33
+ });
34
+ return resolutions;
35
+ };
27
36
  const configuredStartingNodeId = initialNodeId && definition.nodes[initialNodeId] ? initialNodeId : definition.initial;
28
37
  const stepLocation = (stepId) => {
29
38
  const node = definition.nodes[stepId];
@@ -34,6 +43,20 @@ function createWorkflowActor({ definition, context, sessionEpoch, transitionRunn
34
43
  guardPhases: node.guardPhases
35
44
  };
36
45
  };
46
+ const resolveResumableTarget = (initialStepId) => {
47
+ let stepId = initialStepId;
48
+ const visited = /* @__PURE__ */ new Set();
49
+ while (!visited.has(stepId)) {
50
+ visited.add(stepId);
51
+ const node = definition.nodes[stepId];
52
+ const storedResolution = stepResolutions.get(stepId);
53
+ if (!node || !storedResolution || node.visitPolicy !== "reuseResolution" && node.visitPolicy !== "once") return stepId;
54
+ const transition = node.on[storedResolution];
55
+ if (!transition) return stepId;
56
+ stepId = transition.target;
57
+ }
58
+ throw new Error("Workflow resumable Step cycle");
59
+ };
37
60
  const resolveNavigation = ({ target, fromNodeId, candidateContext, candidateCompletedStepIds, intentId, direction: requestedDirection }) => {
38
61
  navigationSequence += 1;
39
62
  const navigationId = `${definition.id}:${sessionEpoch}:navigation:${navigationSequence}`;
@@ -67,7 +90,7 @@ function createWorkflowActor({ definition, context, sessionEpoch, transitionRunn
67
90
  type: "external",
68
91
  to: nextTarget
69
92
  };
70
- if (decision.type === "cancel" || decision.type === "skip") return { type: "cancel" };
93
+ if (decision.type === "cancel" || decision.type === "bypass") return { type: "cancel" };
71
94
  if (decision.type === "redirect") return resolveTarget(decision.to, redirectCount + 1, direction);
72
95
  if (decision.type === "defer") return {
73
96
  type: "defer",
@@ -93,6 +116,7 @@ function createWorkflowActor({ definition, context, sessionEpoch, transitionRunn
93
116
  const direction = !fromNodeId ? "initial" : delta < 0 ? "backward" : "forward";
94
117
  for (let candidateIndex = targetIndex; candidateIndex >= 0 && candidateIndex < definition.stepOrder.length; candidateIndex += delta) {
95
118
  const candidateStepId = definition.stepOrder[candidateIndex];
119
+ if (definition.nodes[candidateStepId].visitPolicy === "once" && stepResolutions.has(candidateStepId)) continue;
96
120
  const decision = beforeEach({
97
121
  navigationId,
98
122
  intentId,
@@ -151,12 +175,16 @@ function createWorkflowActor({ definition, context, sessionEpoch, transitionRunn
151
175
  status: initialError || initialResolutionError || startingNode.end === "blocked" ? "blocked" : startingNode.end === "success" ? "finished" : "idle",
152
176
  context: Object.freeze(require_objectSpread2._objectSpread2({}, context)),
153
177
  completedStepIds: Object.freeze([]),
178
+ stepResolutions: Object.freeze({}),
179
+ navigationHistory: Object.freeze([]),
154
180
  lastError: (_ref2 = initialError !== null && initialError !== void 0 ? initialError : initialResolutionError) !== null && _ref2 !== void 0 ? _ref2 : startingNode.end === "blocked" ? createWorkflowError("workflowEndedBlocked", "staff") : void 0
155
181
  });
156
182
  const publish = (next) => {
157
183
  snapshot = Object.freeze(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, next), {}, {
158
184
  context: Object.freeze(require_objectSpread2._objectSpread2({}, next.context)),
159
185
  completedStepIds: Object.freeze([...next.completedStepIds]),
186
+ stepResolutions: Object.freeze(require_objectSpread2._objectSpread2({}, next.stepResolutions)),
187
+ navigationHistory: Object.freeze([...next.navigationHistory]),
160
188
  pendingNavigation: next.pendingNavigation ? Object.freeze(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, next.pendingNavigation), {}, {
161
189
  to: Object.freeze(require_objectSpread2._objectSpread2({}, next.pendingNavigation.to)),
162
190
  request: Object.freeze(require_objectSpread2._objectSpread2({}, next.pendingNavigation.request))
@@ -174,6 +202,8 @@ function createWorkflowActor({ definition, context, sessionEpoch, transitionRunn
174
202
  status: blocked || node.end === "blocked" ? "blocked" : node.end === "success" ? "finished" : "idle",
175
203
  context: nextContext,
176
204
  completedStepIds: Object.freeze([...completedStepIds]),
205
+ stepResolutions: Object.freeze(readStepResolutions()),
206
+ navigationHistory: Object.freeze([...navigationHistory]),
177
207
  pendingNavigation: void 0,
178
208
  confirmedCheckout: confirmedCheckout !== null && confirmedCheckout !== void 0 ? confirmedCheckout : snapshot.confirmedCheckout,
179
209
  activeOperation: void 0,
@@ -194,7 +224,7 @@ function createWorkflowActor({ definition, context, sessionEpoch, transitionRunn
194
224
  const workflowError = createWorkflowError(code, "staff", cause);
195
225
  lifecycle.runtimeError({
196
226
  stepId: fromNodeId,
197
- outcome: event.outcome,
227
+ intent: event.intent,
198
228
  error: workflowError
199
229
  });
200
230
  yield commit(fromNodeId, fromNodeId, event, snapshot.context, true, workflowError);
@@ -209,10 +239,22 @@ function createWorkflowActor({ definition, context, sessionEpoch, transitionRunn
209
239
  if (disposed || snapshot.status === "finished" || snapshot.status === "blocked") return;
210
240
  const fromNodeId = snapshot.nodeId;
211
241
  const node = definition.nodes[fromNodeId];
212
- if (event.type !== "ACTIVITY_OUTCOME" || event.stepId !== fromNodeId || event.activityId !== node.activity) return;
213
- const transition = node.on[event.outcome];
214
- if (!transition || !event.intentId.trim()) return;
215
- const repeatKey = `${fromNodeId}:${event.outcome}:${transition.target}`;
242
+ if (event.stepId !== fromNodeId || event.activityId !== node.activity) return;
243
+ if (!event.intentId.trim()) return;
244
+ if (event.type === "NAVIGATE_BACK") {
245
+ const previousStepId = navigationHistory[navigationHistory.length - 1];
246
+ yield handleDirectNavigation(previousStepId ? {
247
+ kind: "step",
248
+ stepId: previousStepId
249
+ } : {
250
+ kind: "sessionExit",
251
+ reason: "workflowBoundary"
252
+ }, event.intentId);
253
+ return;
254
+ }
255
+ const transition = node.on[event.intent];
256
+ if (!transition) return;
257
+ const repeatKey = `${fromNodeId}:${event.intent}:${transition.target}`;
216
258
  if (transition.repeat && ((_repeatCounts$get = repeatCounts.get(repeatKey)) !== null && _repeatCounts$get !== void 0 ? _repeatCounts$get : 0) >= transition.repeat.max) {
217
259
  yield blockForRuntimeError(fromNodeId, event, "workflowRepeatLimitExceeded");
218
260
  return;
@@ -222,16 +264,24 @@ function createWorkflowActor({ definition, context, sessionEpoch, transitionRunn
222
264
  if (!transition.repeat) return;
223
265
  repeatCounts.set(repeatKey, ((_repeatCounts$get2 = repeatCounts.get(repeatKey)) !== null && _repeatCounts$get2 !== void 0 ? _repeatCounts$get2 : 0) + 1);
224
266
  };
225
- const nextContext = reduceContext(snapshot.context, event.contextPatch);
267
+ const previousContext = snapshot.context;
268
+ const nextContext = reduceContext(previousContext, event.contextPatch);
269
+ let requestedTarget = transition.target;
270
+ try {
271
+ requestedTarget = resolveResumableTarget(requestedTarget);
272
+ } catch (cause) {
273
+ yield blockForRuntimeError(fromNodeId, event, "workflowResumeCycle", cause);
274
+ return;
275
+ }
226
276
  const fromIndex = definition.stepOrder.indexOf(fromNodeId);
227
- const movesForward = definition.stepOrder.indexOf(transition.target) > fromIndex;
277
+ const movesForward = definition.stepOrder.indexOf(requestedTarget) > fromIndex;
228
278
  const candidateCompletedStepIds = movesForward ? [...new Set([...completedStepIds, fromNodeId])] : [...completedStepIds];
229
279
  let navigationResolution;
230
280
  try {
231
281
  navigationResolution = resolveNavigation({
232
282
  target: {
233
283
  kind: "step",
234
- stepId: transition.target
284
+ stepId: requestedTarget
235
285
  },
236
286
  fromNodeId,
237
287
  candidateContext: nextContext,
@@ -245,10 +295,10 @@ function createWorkflowActor({ definition, context, sessionEpoch, transitionRunn
245
295
  if (navigationResolution.type === "block") {
246
296
  lifecycle.runtimeError({
247
297
  stepId: fromNodeId,
248
- outcome: event.outcome,
298
+ intent: event.intent,
249
299
  error: navigationResolution.error
250
300
  });
251
- yield commit(fromNodeId, fromNodeId, event, snapshot.context, true, navigationResolution.error);
301
+ yield commit(fromNodeId, fromNodeId, event, previousContext, true, navigationResolution.error);
252
302
  return;
253
303
  }
254
304
  if (navigationResolution.type === "cancel") return;
@@ -268,9 +318,9 @@ function createWorkflowActor({ definition, context, sessionEpoch, transitionRunn
268
318
  return;
269
319
  }
270
320
  const resolvedTarget = navigationResolution.stepId;
271
- const operationInput = "operationInput" in event ? event.operationInput : void 0;
321
+ "operationInput" in event && event.operationInput;
272
322
  const command = (_transition$exitPolic = transition.exitPolicy) === null || _transition$exitPolic === void 0 ? void 0 : _transition$exitPolic.command;
273
- const commandWillRun = Boolean(command && (command.when !== "inputPresent" || operationInput != null));
323
+ const commandWillRun = Boolean(command);
274
324
  executionSequence += 1;
275
325
  const executionId = `${definition.id}:${snapshot.sessionEpoch}:${executionSequence}`;
276
326
  if (commandWillRun && command) publish(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, snapshot), {}, {
@@ -303,21 +353,29 @@ function createWorkflowActor({ definition, context, sessionEpoch, transitionRunn
303
353
  if (result.status === "advance") {
304
354
  recordRepeat();
305
355
  if (movesForward) completedStepIds.add(fromNodeId);
356
+ stepResolutions.set(fromNodeId, event.intent);
357
+ if (event.intent === "complete" && node.presentation.mode === "page" && movesForward && node.visitPolicy !== "once") {
358
+ navigationHistory = navigationHistory.filter((stepId) => stepId !== fromNodeId);
359
+ navigationHistory.push(fromNodeId);
360
+ } else if (event.intent === "skip") navigationHistory = navigationHistory.filter((stepId) => stepId !== fromNodeId);
306
361
  yield commit(fromNodeId, resolvedTarget, event, nextContext, false, void 0, result.confirmedCheckout);
307
362
  return;
308
363
  }
309
364
  if (result.status === "blocked") {
310
- yield commit(fromNodeId, fromNodeId, event, nextContext, true, result.lastError);
365
+ yield commit(fromNodeId, fromNodeId, event, previousContext, true, result.lastError);
311
366
  return;
312
367
  }
313
- yield commit(fromNodeId, fromNodeId, event, nextContext, false, result.lastError);
368
+ yield commit(fromNodeId, fromNodeId, event, previousContext, false, result.lastError);
314
369
  });
315
370
  return function handleEvent(_x12) {
316
371
  return _ref5.apply(this, arguments);
317
372
  };
318
373
  }();
319
- const handleDirectNavigation = function() {
320
- var _ref6 = require_asyncToGenerator._asyncToGenerator(function* (target, intentId) {
374
+ function handleDirectNavigation(_x13, _x14) {
375
+ return _handleDirectNavigation.apply(this, arguments);
376
+ }
377
+ function _handleDirectNavigation() {
378
+ _handleDirectNavigation = require_asyncToGenerator._asyncToGenerator(function* (target, intentId) {
321
379
  if (!intentId.trim()) return;
322
380
  const fromNodeId = snapshot.nodeId;
323
381
  let resolution;
@@ -333,7 +391,7 @@ function createWorkflowActor({ definition, context, sessionEpoch, transitionRunn
333
391
  } catch (cause) {
334
392
  yield blockForRuntimeError(fromNodeId, {
335
393
  intentId,
336
- outcome: "directNavigation"
394
+ intent: "directNavigation"
337
395
  }, "workflowBeforeEachGuardFailed", cause);
338
396
  return;
339
397
  }
@@ -341,19 +399,23 @@ function createWorkflowActor({ definition, context, sessionEpoch, transitionRunn
341
399
  if (resolution.type === "block") {
342
400
  lifecycle.runtimeError({
343
401
  stepId: fromNodeId,
344
- outcome: "directNavigation",
402
+ intent: "directNavigation",
345
403
  error: resolution.error
346
404
  });
347
405
  yield commit(fromNodeId, fromNodeId, {
348
406
  intentId,
349
- outcome: "directNavigation"
407
+ intent: "directNavigation"
350
408
  }, snapshot.context, true, resolution.error);
351
409
  return;
352
410
  }
353
411
  if (resolution.type === "step") {
412
+ const fromIndex = definition.stepOrder.indexOf(fromNodeId);
413
+ if (definition.stepOrder.indexOf(resolution.stepId) < fromIndex) stepResolutions.delete(fromNodeId);
414
+ const historyIndex = navigationHistory.lastIndexOf(resolution.stepId);
415
+ if (historyIndex >= 0) navigationHistory = navigationHistory.slice(0, historyIndex);
354
416
  yield commit(fromNodeId, resolution.stepId, {
355
417
  intentId,
356
- outcome: "directNavigation"
418
+ intent: "directNavigation"
357
419
  }, snapshot.context, false);
358
420
  return;
359
421
  }
@@ -370,12 +432,10 @@ function createWorkflowActor({ definition, context, sessionEpoch, transitionRunn
370
432
  lastError: void 0
371
433
  }));
372
434
  });
373
- return function handleDirectNavigation(_x13, _x14) {
374
- return _ref6.apply(this, arguments);
375
- };
376
- }();
435
+ return _handleDirectNavigation.apply(this, arguments);
436
+ }
377
437
  const drain = function() {
378
- var _ref7 = require_asyncToGenerator._asyncToGenerator(function* () {
438
+ var _ref6 = require_asyncToGenerator._asyncToGenerator(function* () {
379
439
  if (processing || disposed) return;
380
440
  processing = true;
381
441
  try {
@@ -388,7 +448,7 @@ function createWorkflowActor({ definition, context, sessionEpoch, transitionRunn
388
448
  }
389
449
  });
390
450
  return function drain() {
391
- return _ref7.apply(this, arguments);
451
+ return _ref6.apply(this, arguments);
392
452
  };
393
453
  }();
394
454
  return {
@@ -430,7 +490,7 @@ function createWorkflowActor({ definition, context, sessionEpoch, transitionRunn
430
490
  const fromNodeId = snapshot.nodeId;
431
491
  commit(fromNodeId, fromNodeId, {
432
492
  intentId,
433
- outcome: "systemBlocked"
493
+ intent: "systemBlocked"
434
494
  }, snapshot.context, true, error);
435
495
  },
436
496
  dispose: () => {
@@ -65,7 +65,7 @@ function compileWorkflowStructure(input, options) {
65
65
  var _options$maxSteps, _options$maxTransitio, _input$id, _stepIds$;
66
66
  const issues = [];
67
67
  const activities = options.activities;
68
- const guards = options.guards;
68
+ const predicates = options.predicates;
69
69
  const maxSteps = (_options$maxSteps = options.maxSteps) !== null && _options$maxSteps !== void 0 ? _options$maxSteps : 32;
70
70
  const maxTransitions = (_options$maxTransitio = options.maxTransitions) !== null && _options$maxTransitio !== void 0 ? _options$maxTransitio : 96;
71
71
  if (!isRecord(input)) return {
@@ -120,12 +120,14 @@ function compileWorkflowStructure(input, options) {
120
120
  "activity",
121
121
  "presentation",
122
122
  "readiness",
123
+ "visitPolicy",
123
124
  "useGuards",
124
125
  "on",
125
126
  "end",
126
127
  "screen"
127
128
  ], stepPath, issues);
128
129
  if (rawStep.screen !== void 0) addIssue(issues, "step.screen.forbidden", `${stepPath}.screen`, "Screen is resolved by the local Activity Contract");
130
+ if (rawStep.visitPolicy !== void 0 && rawStep.visitPolicy !== "always" && rawStep.visitPolicy !== "reuseResolution" && rawStep.visitPolicy !== "once") addIssue(issues, "step.visitPolicy.invalid", `${stepPath}.visitPolicy`, "Step visitPolicy must be always, reuseResolution or once");
129
131
  const activityValue = rawStep.activity;
130
132
  if (typeof activityValue !== "string" || !activities.has(activityValue)) addIssue(issues, "activity.unknown", `${stepPath}.activity`, `Unknown activity: ${String(activityValue)}`);
131
133
  const fallbackActivityId = activities.ids[0];
@@ -140,11 +142,12 @@ function compileWorkflowStructure(input, options) {
140
142
  addIssue(issues, "step.useGuards.phase.invalid", phasePath, `Unknown navigation guard phase: ${String(rawPhase)}`);
141
143
  return;
142
144
  }
143
- if (guardPhases.includes(rawPhase)) {
145
+ const phase = rawPhase;
146
+ if (guardPhases.includes(phase)) {
144
147
  addIssue(issues, "step.useGuards.phase.duplicate", phasePath, `Duplicate navigation guard phase: ${rawPhase}`);
145
148
  return;
146
149
  }
147
- const guardId = (_activity$navigationG = activity.navigationGuards) === null || _activity$navigationG === void 0 ? void 0 : _activity$navigationG[rawPhase];
150
+ const guardId = (_activity$navigationG = activity.navigationGuards) === null || _activity$navigationG === void 0 ? void 0 : _activity$navigationG[phase];
148
151
  if (!guardId) {
149
152
  addIssue(issues, "step.useGuards.unavailable", phasePath, `Activity ${activity.id} does not define ${rawPhase}`);
150
153
  return;
@@ -153,7 +156,7 @@ function compileWorkflowStructure(input, options) {
153
156
  addIssue(issues, "step.useGuards.guard.unknown", phasePath, `Activity ${activity.id} uses unknown navigation guard ${guardId}`);
154
157
  return;
155
158
  }
156
- guardPhases.push(rawPhase);
159
+ guardPhases.push(phase);
157
160
  });
158
161
  const rawPresentation = rawStep.presentation;
159
162
  let presentation = { mode: "page" };
@@ -170,12 +173,12 @@ function compileWorkflowStructure(input, options) {
170
173
  }
171
174
  if (rawStep.readiness !== void 0 && rawStep.readiness !== "implemented" && rawStep.readiness !== "placeholder") addIssue(issues, "step.readiness.invalid", `${stepPath}.readiness`, "Step readiness must be implemented or placeholder");
172
175
  if (rawStep.end !== void 0 && rawStep.end !== "success" && rawStep.end !== "blocked") addIssue(issues, "step.end.invalid", `${stepPath}.end`, "Step end must be success or blocked");
173
- if (rawStep.on !== void 0 && !isRecord(rawStep.on)) addIssue(issues, "step.outcomes.invalid", `${stepPath}.on`, "Step outcomes must be an object");
176
+ if (rawStep.on !== void 0 && !isRecord(rawStep.on)) addIssue(issues, "step.intents.invalid", `${stepPath}.on`, "Step intents must be an object");
174
177
  const transitions = {};
175
- const addTransition = (outcome, rawTarget, path) => {
178
+ const addTransition = (intent, rawTarget, path) => {
176
179
  var _activity$exitPolicie;
177
- if (!activity.outcomes.includes(outcome)) {
178
- addIssue(issues, "activity.outcome.unknown", path, `Activity ${activity.id} does not expose outcome ${outcome}`);
180
+ if (!activity.intents.some((availableIntent) => availableIntent === intent)) {
181
+ addIssue(issues, "activity.intent.unknown", path, `Activity ${activity.id} does not expose intent ${intent}`);
179
182
  return;
180
183
  }
181
184
  let targetValue = rawTarget;
@@ -185,12 +188,12 @@ function compileWorkflowStructure(input, options) {
185
188
  "target",
186
189
  "repeat",
187
190
  "operation",
188
- "guard",
191
+ "precondition",
189
192
  "failureTarget"
190
193
  ], path, issues);
191
194
  [
192
195
  "operation",
193
- "guard",
196
+ "precondition",
194
197
  "failureTarget"
195
198
  ].forEach((field) => {
196
199
  if (rawTarget[field] !== void 0) addIssue(issues, "transition.untrustedField", `${path}.${field}`, `${field} belongs to the local Activity Contract`);
@@ -203,15 +206,15 @@ function compileWorkflowStructure(input, options) {
203
206
  return;
204
207
  }
205
208
  const symbolicTarget = targetValue.trim();
206
- const target = symbolicTarget === "$next" ? stepIds[index + 1] : symbolicTarget === "$prev" ? stepIds[index - 1] : symbolicTarget;
209
+ const target = symbolicTarget === "$next" ? stepIds[index + 1] : symbolicTarget;
207
210
  if (!target) {
208
- addIssue(issues, symbolicTarget === "$prev" ? "transition.prev.missing" : "transition.next.missing", path, `${symbolicTarget} does not exist for step ${stepId}`);
211
+ addIssue(issues, "transition.next.missing", path, `${symbolicTarget} does not exist for step ${stepId}`);
209
212
  return;
210
213
  }
211
- const exitPolicy = (_activity$exitPolicie = activity.exitPolicies) === null || _activity$exitPolicie === void 0 ? void 0 : _activity$exitPolicie[outcome];
212
- if ((exitPolicy === null || exitPolicy === void 0 ? void 0 : exitPolicy.guard) && !guards.has(exitPolicy.guard)) addIssue(issues, "activity.guard.unknown", path, `Activity ${activity.id} uses unknown guard ${exitPolicy.guard}`);
214
+ const exitPolicy = (_activity$exitPolicie = activity.exitPolicies) === null || _activity$exitPolicie === void 0 ? void 0 : _activity$exitPolicie[intent];
215
+ if ((exitPolicy === null || exitPolicy === void 0 ? void 0 : exitPolicy.precondition) && !predicates.has(exitPolicy.precondition)) addIssue(issues, "activity.precondition.unknown", path, `Activity ${activity.id} uses unknown precondition predicate ${exitPolicy.precondition}`);
213
216
  if ((exitPolicy === null || exitPolicy === void 0 ? void 0 : exitPolicy.command) && !options.operations.has(exitPolicy.command.id)) addIssue(issues, "activity.command.unknown", path, `Activity ${activity.id} uses unknown command ${exitPolicy.command.id}`);
214
- transitions[outcome] = Object.freeze({
217
+ transitions[intent] = Object.freeze({
215
218
  target,
216
219
  exitPolicy,
217
220
  repeat
@@ -219,15 +222,11 @@ function compileWorkflowStructure(input, options) {
219
222
  };
220
223
  if (index + 1 < rawSteps.length) {
221
224
  var _activity$navigation;
222
- (_activity$navigation = activity.navigation) === null || _activity$navigation === void 0 || (_activity$navigation = _activity$navigation.forward) === null || _activity$navigation === void 0 || _activity$navigation.forEach((outcome) => addTransition(outcome, "$next", `${stepPath}.navigation.${outcome}`));
223
- }
224
- if (index > 0) {
225
- var _activity$navigation2;
226
- (_activity$navigation2 = activity.navigation) === null || _activity$navigation2 === void 0 || (_activity$navigation2 = _activity$navigation2.backward) === null || _activity$navigation2 === void 0 || _activity$navigation2.forEach((outcome) => addTransition(outcome, "$prev", `${stepPath}.navigation.${outcome}`));
225
+ (_activity$navigation = activity.navigation) === null || _activity$navigation === void 0 || (_activity$navigation = _activity$navigation.forward) === null || _activity$navigation === void 0 || _activity$navigation.forEach((intent) => addTransition(intent, "$next", `${stepPath}.navigation.${intent}`));
227
226
  }
228
227
  const rawTransitions = isRecord(rawStep.on) ? rawStep.on : {};
229
- Object.entries(rawTransitions).forEach(([outcome, transition]) => {
230
- addTransition(outcome, transition, `${stepPath}.on.${outcome}`);
228
+ Object.entries(rawTransitions).forEach(([intent, transition]) => {
229
+ addTransition(intent, transition, `${stepPath}.on.${intent}`);
231
230
  });
232
231
  transitionCount += Object.keys(transitions).length;
233
232
  nodes[stepId] = Object.freeze({
@@ -236,6 +235,7 @@ function compileWorkflowStructure(input, options) {
236
235
  screenId: activity.screenId,
237
236
  presentation,
238
237
  readiness: rawStep.readiness === "placeholder" ? "placeholder" : void 0,
238
+ visitPolicy: rawStep.visitPolicy === "reuseResolution" || rawStep.visitPolicy === "once" ? rawStep.visitPolicy : "always",
239
239
  guardPhases: Object.freeze([...guardPhases]),
240
240
  on: Object.freeze(transitions),
241
241
  end: rawStep.end === "success" || rawStep.end === "blocked" ? rawStep.end : void 0
@@ -255,18 +255,17 @@ function compileWorkflowStructure(input, options) {
255
255
  const transitions = Object.entries(node.on).filter((entry) => entry[1]);
256
256
  if (!node.end && transitions.length === 0) addIssue(issues, "step.deadEnd", path, "A step without outgoing transitions must declare its end state");
257
257
  if (node.end && transitions.length > 0) addIssue(issues, "step.end.hasTransitions", path, "An end step cannot expose outgoing transitions");
258
- transitions.forEach(([outcome, transition]) => {
259
- var _stepIndex$get2, _stepIndex$get3, _activities$require$n;
258
+ transitions.forEach(([intent, transition]) => {
259
+ var _stepIndex$get2, _stepIndex$get3;
260
260
  if (!transition) return;
261
261
  if (!nodes[transition.target]) {
262
- addIssue(issues, "transition.target.missing", `${path}.on.${outcome}`, `Target step does not exist: ${transition.target}`);
262
+ addIssue(issues, "transition.target.missing", `${path}.on.${intent}`, `Target step does not exist: ${transition.target}`);
263
263
  return;
264
264
  }
265
265
  const sourceIndex = (_stepIndex$get2 = stepIndex.get(stepId)) !== null && _stepIndex$get2 !== void 0 ? _stepIndex$get2 : -1;
266
- const targetIndex = (_stepIndex$get3 = stepIndex.get(transition.target)) !== null && _stepIndex$get3 !== void 0 ? _stepIndex$get3 : -1;
267
- const needsBound = !((_activities$require$n = activities.require(node.activity).navigation) === null || _activities$require$n === void 0 || (_activities$require$n = _activities$require$n.backward) === null || _activities$require$n === void 0 ? void 0 : _activities$require$n.includes(outcome)) && targetIndex <= sourceIndex;
268
- if (needsBound && !transition.repeat) addIssue(issues, "transition.cycle.unbounded", `${path}.on.${outcome}`, "A non-backward jump to the same or an earlier step requires a repeat limit");
269
- if (!needsBound && transition.repeat) addIssue(issues, "transition.repeat.unnecessary", `${path}.on.${outcome}.repeat`, "Repeat limits are only valid on cyclic non-backward jumps");
266
+ const needsBound = ((_stepIndex$get3 = stepIndex.get(transition.target)) !== null && _stepIndex$get3 !== void 0 ? _stepIndex$get3 : -1) <= sourceIndex;
267
+ if (needsBound && !transition.repeat) addIssue(issues, "transition.cycle.unbounded", `${path}.on.${intent}`, "A jump to the same or an earlier step requires a repeat limit");
268
+ if (!needsBound && transition.repeat) addIssue(issues, "transition.repeat.unnecessary", `${path}.on.${intent}.repeat`, "Repeat limits are only valid on cyclic jumps");
270
269
  });
271
270
  });
272
271
  const initial = (_stepIds$ = stepIds[0]) !== null && _stepIds$ !== void 0 ? _stepIds$ : "";
@@ -0,0 +1,10 @@
1
+ //#region src/components/HDLKiosk/kernel/workflow/selectors.ts
2
+ function canReopenWorkflowStep(snapshot, stepId) {
3
+ return Boolean(stepId && snapshot.stepResolutions[stepId] === "complete");
4
+ }
5
+ function canNavigateBack(snapshot) {
6
+ return snapshot.navigationHistory.length > 0 || snapshot.stepResolutions[snapshot.nodeId] !== void 0;
7
+ }
8
+ //#endregion
9
+ exports.canNavigateBack = canNavigateBack;
10
+ exports.canReopenWorkflowStep = canReopenWorkflowStep;
@@ -2,6 +2,7 @@ const require_runtime = require("../../../_virtual/_rolldown/runtime.js");
2
2
  const require_asyncToGenerator = require("../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
3
3
  const require_useHDLKioskCustomerController = require("./controllers/useHDLKioskCustomerController.js");
4
4
  const require_useHDLKioskScreenData = require("./controllers/useHDLKioskScreenData.js");
5
+ const require_selectors = require("../kernel/workflow/selectors.js");
5
6
  const require_index = require("../components/overlays/EndOrderDialog/index.js");
6
7
  const require_index$1 = require("../components/shell/HDLKioskHeader/index.js");
7
8
  const require_index$2 = require("../components/overlays/CartDrawer/index.js");
@@ -67,7 +68,7 @@ function HDLKioskWorkflowView({ session, host, sales, config, isActive, renderId
67
68
  var _session$definition$n;
68
69
  return ((_session$definition$n = session.definition.nodes[stepId]) === null || _session$definition$n === void 0 ? void 0 : _session$definition$n.activity) === "customization";
69
70
  });
70
- const screenDataActivity = ((_activeNode$presentat = activeNode.presentation) === null || _activeNode$presentat === void 0 ? void 0 : _activeNode$presentat.mode) === "modal" ? session.definition.nodes[activeNode.presentation.base].activity : activeNode.activity;
71
+ const screenDataNode = ((_activeNode$presentat = activeNode.presentation) === null || _activeNode$presentat === void 0 ? void 0 : _activeNode$presentat.mode) === "modal" ? session.definition.nodes[activeNode.presentation.base] : activeNode;
71
72
  const paymentSafeForReset = sales.payment.status === "idle" || sales.payment.status === "failed";
72
73
  const resetSession = (0, react.useCallback)(require_asyncToGenerator._asyncToGenerator(function* () {
73
74
  if (resetInFlight.current) return;
@@ -145,8 +146,8 @@ function HDLKioskWorkflowView({ session, host, sales, config, isActive, renderId
145
146
  ]);
146
147
  const { catalog, customization, payment } = require_useHDLKioskScreenData.useHDLKioskScreenData({
147
148
  host,
148
- currentScreenId,
149
- activity: screenDataActivity,
149
+ currentScreenId: screenDataNode.screenId,
150
+ activity: screenDataNode.activity,
150
151
  isActive,
151
152
  primaryWeightedProductId: config.primaryWeightedProductId
152
153
  });
@@ -163,7 +164,7 @@ function HDLKioskWorkflowView({ session, host, sales, config, isActive, renderId
163
164
  }
164
165
  sequence.current += 1;
165
166
  const intentId = `ui:${snapshot.sessionEpoch}:${sequence.current}`;
166
- if (action.kind === "outcome") {
167
+ if (action.kind === "intent" || action.kind === "navigation") {
167
168
  const event = require_workflowEvent.createWorkflowEvent(action, activeNode.activity, snapshot.nodeId, intentId);
168
169
  if (event) session.actor.send(event);
169
170
  return;
@@ -193,9 +194,9 @@ function HDLKioskWorkflowView({ session, host, sales, config, isActive, renderId
193
194
  (0, react.useEffect)(() => {
194
195
  if (activeNode.activity !== "paymentMethod" || snapshot.status !== "idle" || sales.payment.status !== "succeeded") return;
195
196
  send({
196
- kind: "outcome",
197
+ kind: "intent",
197
198
  activityId: "paymentMethod",
198
- outcome: "confirmed"
199
+ intent: "complete"
199
200
  });
200
201
  }, [
201
202
  activeNode.activity,
@@ -273,7 +274,7 @@ function HDLKioskWorkflowView({ session, host, sales, config, isActive, renderId
273
274
  memberAction,
274
275
  send,
275
276
  renderCartContent,
276
- onEditPrimaryProduct: customizationStepId && config.primaryWeightedProductId ? editPrimaryProduct : void 0
277
+ onEditPrimaryProduct: customizationStepId && config.primaryWeightedProductId && require_selectors.canReopenWorkflowStep(snapshot, customizationStepId) ? editPrimaryProduct : void 0
277
278
  }), endOrderConfirmationOpen ? /* @__PURE__ */ react.default.createElement(require_index.EndOrderDialog, {
278
279
  onCancel: cancelEndOrder,
279
280
  onConfirm: confirmEndOrder
@@ -12,7 +12,7 @@ const MEMBER_ACTION_ACTIVITIES = new Set([
12
12
  "fulfillment",
13
13
  "customization",
14
14
  "catalog",
15
- "catalogWithPrimaryProductPrompt",
15
+ "primaryProductPrompt",
16
16
  "paymentMethod"
17
17
  ]);
18
18
  /**
@@ -3,7 +3,7 @@ const require_asyncToGenerator = require("../../../_virtual/_@oxc-project_runtim
3
3
  const require_coordinator = require("../app/operations/coordinator.js");
4
4
  const require_manifest = require("../app/manifest.js");
5
5
  const require_registry = require("../app/workflow/registry.js");
6
- const require_guards = require("../app/workflow/guards.js");
6
+ const require_predicates = require("../app/workflow/predicates.js");
7
7
  const require_navigationGuards = require("../app/workflow/navigationGuards.js");
8
8
  const require_policy = require("../app/workflow/policy.js");
9
9
  const require_constants = require("../app/constants.js");
@@ -27,7 +27,7 @@ function createHDLKioskWorkflowSession(entry, host, options = {}) {
27
27
  const structuralCompilation = require_compiler.compileWorkflowStructure(require_registry.getBuiltInWorkflowDefinition(entry), {
28
28
  operations,
29
29
  activities: require_registry.defaultActivityRegistry,
30
- guards: require_guards.defaultGuardRegistry,
30
+ predicates: require_predicates.defaultPredicateRegistry,
31
31
  navigationGuards: require_navigationGuards.defaultNavigationGuardRegistry,
32
32
  workflowIds: require_constants.HDL_WORKFLOW_IDS
33
33
  });
@@ -55,7 +55,7 @@ function createHDLKioskWorkflowSession(entry, host, options = {}) {
55
55
  const transitionRunner = require_domainTransitionRunner.createHDLKioskTransitionRunner({
56
56
  host,
57
57
  coordinator,
58
- guards: require_guards.defaultGuardRegistry
58
+ predicates: require_predicates.defaultPredicateRegistry
59
59
  });
60
60
  const workflowActor = require_actor.createWorkflowActor({
61
61
  definition,
@@ -13,8 +13,8 @@ function createDomainWorkflowError(code, recovery = "staff", cause) {
13
13
  cause
14
14
  };
15
15
  }
16
- function createHDLKioskTransitionRunner({ host, coordinator, guards, now = Date.now }) {
17
- const emitError = (error, workflowId, stepId, outcome) => {
16
+ function createHDLKioskTransitionRunner({ host, coordinator, predicates, now = Date.now }) {
17
+ const emitError = (error, workflowId, stepId, intent) => {
18
18
  try {
19
19
  host.telemetry.emit({
20
20
  name: "hdlKiosk.error.reported",
@@ -26,7 +26,7 @@ function createHDLKioskTransitionRunner({ host, coordinator, guards, now = Date.
26
26
  recovery: error.recovery,
27
27
  workflowId,
28
28
  nodeId: stepId,
29
- outcome
29
+ intent
30
30
  }
31
31
  });
32
32
  } catch (_unused) {}
@@ -35,14 +35,14 @@ function createHDLKioskTransitionRunner({ host, coordinator, guards, now = Date.
35
35
  run: function() {
36
36
  var _ref = require_asyncToGenerator._asyncToGenerator(function* ({ workflowId, sessionEpoch, stepId, context, event, transition, executionId }) {
37
37
  const exitPolicy = transition.exitPolicy;
38
- if (exitPolicy === null || exitPolicy === void 0 ? void 0 : exitPolicy.guard) try {
39
- if (!guards.evaluate(exitPolicy.guard, {
38
+ if (exitPolicy === null || exitPolicy === void 0 ? void 0 : exitPolicy.precondition) try {
39
+ if (!predicates.evaluate(exitPolicy.precondition, {
40
40
  workflow: context,
41
41
  sales: host.sales.getObservedSnapshot()
42
42
  })) return { status: "stay" };
43
43
  } catch (cause) {
44
- const error = createDomainWorkflowError("workflowGuardEvaluationFailed", "staff", cause);
45
- emitError(error, workflowId, stepId, event.outcome);
44
+ const error = createDomainWorkflowError("workflowPredicateEvaluationFailed", "staff", cause);
45
+ emitError(error, workflowId, stepId, event.intent);
46
46
  return {
47
47
  status: "blocked",
48
48
  lastError: error
@@ -50,7 +50,7 @@ function createHDLKioskTransitionRunner({ host, coordinator, guards, now = Date.
50
50
  }
51
51
  const operationInput = "operationInput" in event ? event.operationInput : void 0;
52
52
  const command = exitPolicy === null || exitPolicy === void 0 ? void 0 : exitPolicy.command;
53
- if (!command || command.when === "inputPresent" && operationInput == null) return { status: "advance" };
53
+ if (!command) return { status: "advance" };
54
54
  const result = yield coordinator.execute(command.id, {
55
55
  operationId: executionId,
56
56
  intentId: event.intentId,
@@ -59,7 +59,7 @@ function createHDLKioskTransitionRunner({ host, coordinator, guards, now = Date.
59
59
  });
60
60
  if (coordinator.currentSessionEpoch() !== sessionEpoch) {
61
61
  const error = createDomainWorkflowError("workflowSessionStale");
62
- emitError(error, workflowId, stepId, event.outcome);
62
+ emitError(error, workflowId, stepId, event.intent);
63
63
  return {
64
64
  status: "blocked",
65
65
  lastError: error
@@ -4,11 +4,16 @@ const require_objectWithoutProperties = require("../../../_virtual/_@oxc-project
4
4
  const _excluded = ["kind"];
5
5
  function createWorkflowEvent(action, currentActivity, stepId, intentId) {
6
6
  if (action.activityId !== currentActivity) return void 0;
7
- const { kind: _kind } = action, outcome = require_objectWithoutProperties._objectWithoutProperties(action, _excluded);
8
- return require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({
9
- type: "ACTIVITY_OUTCOME",
7
+ const { kind: _kind } = action, payload = require_objectWithoutProperties._objectWithoutProperties(action, _excluded);
8
+ return action.kind === "navigation" ? {
9
+ type: "NAVIGATE_BACK",
10
+ stepId,
11
+ activityId: action.activityId,
12
+ intentId
13
+ } : require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({
14
+ type: "ACTIVITY_INTENT",
10
15
  stepId
11
- }, outcome), {}, { intentId });
16
+ }, payload), {}, { intentId });
12
17
  }
13
18
  //#endregion
14
19
  exports.createWorkflowEvent = createWorkflowEvent;
@@ -13,7 +13,7 @@ function createHDLKioskWorkflowLifecycle(host, now = Date.now) {
13
13
  workflowId: snapshot.workflowId,
14
14
  from: fromStepId,
15
15
  to: snapshot.nodeId,
16
- outcome: event.outcome
16
+ intent: event.intent
17
17
  }
18
18
  });
19
19
  } catch (_unused) {}
@@ -22,7 +22,7 @@ function createHDLKioskWorkflowLifecycle(host, now = Date.now) {
22
22
  return _ref.apply(this, arguments);
23
23
  };
24
24
  }(),
25
- runtimeError: ({ stepId, outcome, error }) => {
25
+ runtimeError: ({ stepId, intent, error }) => {
26
26
  try {
27
27
  host.telemetry.emit({
28
28
  name: "hdlKiosk.error.reported",
@@ -33,7 +33,7 @@ function createHDLKioskWorkflowLifecycle(host, now = Date.now) {
33
33
  source: error.source,
34
34
  recovery: error.recovery,
35
35
  nodeId: stepId,
36
- outcome
36
+ intent
37
37
  }
38
38
  });
39
39
  } catch (_unused2) {}
@@ -6,8 +6,7 @@ let _pisell_utils = require("@pisell/utils");
6
6
  //#region src/components/HDLKiosk/slices/catalog/PrimaryProductPromptDialog/index.tsx
7
7
  /**
8
8
  * 文件角色:在 Barcode 商品列表结账前询问是否需要称重麻辣烫主商品。
9
- * 运行机制:作为 Catalog Activity 的局部 Dialog,Yes/No 由 Catalog 转换为该
10
- * Activity 的最终 Outcome。
9
+ * 运行机制:由独立 PrimaryProductPrompt Activity 作为 Modal 渲染在 Catalog 上层。
11
10
  * 边界:不判断购物车是否已有主商品,不直接接触 Workflow、查询商品或写购物车。
12
11
  */
13
12
  function BagIcon() {