@pisell/private-materials 6.12.166 → 6.12.168

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 (115) 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 +7 -7
  8. package/es/components/HDLKiosk/app/views.js +2 -1
  9. package/es/components/HDLKiosk/app/workflow/barcode.js +12 -35
  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 +47 -40
  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 +3 -3
  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 +118 -28
  29. package/es/components/HDLKiosk/kernel/workflow/compiler.js +35 -41
  30. package/es/components/HDLKiosk/kernel/workflow/selectors.js +9 -0
  31. package/es/components/HDLKiosk/runtime/HDLKioskWorkflowView.js +10 -9
  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 +9 -11
  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/templates/HDLKiosk/auth/HDLKioskIdentityAuthPanel.js +17 -2
  57. package/es/pro/Login2.0/Login2.d.ts +2 -0
  58. package/es/pro/Login2.0/Login2.js +9 -1
  59. package/es/pro/Login2.0/Register2.d.ts +2 -0
  60. package/es/pro/Login2.0/Register2.js +9 -1
  61. package/lib/components/HDLKiosk/app/ScreenRenderer.js +7 -7
  62. package/lib/components/HDLKiosk/app/views.js +2 -1
  63. package/lib/components/HDLKiosk/app/workflow/barcode.js +11 -34
  64. package/lib/components/HDLKiosk/app/workflow/{guards.js → predicates.js} +9 -9
  65. package/lib/components/HDLKiosk/app/workflow/quick.js +3 -6
  66. package/lib/components/HDLKiosk/app/workflow/registry.js +1 -1
  67. package/lib/components/HDLKiosk/app/workflow/scale.js +3 -12
  68. package/lib/components/HDLKiosk/components/shell/HDLKioskBottomBarHost/index.js +12 -10
  69. package/lib/components/HDLKiosk/components/shell/HDLKioskShell/index.js +1 -0
  70. package/lib/components/HDLKiosk/docs/00-/346/226/207/344/273/266/345/257/274/350/210/252.md +7 -7
  71. 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 +47 -40
  72. 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 +3 -3
  73. package/lib/components/HDLKiosk/docs/05-/344/272/244/346/230/223/345/256/211/345/205/250.md +1 -1
  74. package/lib/components/HDLKiosk/docs/07-/345/220/216/347/273/255/345/267/245/344/275/234.md +1 -1
  75. package/lib/components/HDLKiosk/docs/README.md +2 -2
  76. package/lib/components/HDLKiosk/docs//345/256/236/346/226/275/350/277/233/345/272/246.md +3 -3
  77. package/lib/components/HDLKiosk/docs//346/236/266/346/236/204/350/256/276/350/256/241.md +11 -11
  78. package/lib/components/HDLKiosk/index.js +0 -1
  79. package/lib/components/HDLKiosk/kernel/README.md +8 -9
  80. package/lib/components/HDLKiosk/kernel/application/defineApplication.js +18 -19
  81. package/lib/components/HDLKiosk/kernel/application/defineSlice.js +8 -14
  82. package/lib/components/HDLKiosk/kernel/workflow/actor.js +118 -28
  83. package/lib/components/HDLKiosk/kernel/workflow/compiler.js +35 -41
  84. package/lib/components/HDLKiosk/kernel/workflow/selectors.js +10 -0
  85. package/lib/components/HDLKiosk/runtime/HDLKioskWorkflowView.js +10 -9
  86. package/lib/components/HDLKiosk/runtime/controllers/useHDLKioskCustomerController.js +1 -1
  87. package/lib/components/HDLKiosk/runtime/createWorkflowSession.js +3 -3
  88. package/lib/components/HDLKiosk/runtime/domainTransitionRunner.js +9 -9
  89. package/lib/components/HDLKiosk/runtime/workflowEvent.js +9 -4
  90. package/lib/components/HDLKiosk/runtime/workflowLifecycle.js +3 -3
  91. package/lib/components/HDLKiosk/slices/catalog/PrimaryProductPromptDialog/index.js +1 -2
  92. package/lib/components/HDLKiosk/slices/catalog/Screen/index.js +13 -40
  93. package/lib/components/HDLKiosk/slices/catalog/Screen/model.js +0 -5
  94. package/lib/components/HDLKiosk/slices/catalog/slice.js +2 -15
  95. package/lib/components/HDLKiosk/slices/catalog/view.js +4 -6
  96. package/lib/components/HDLKiosk/slices/customization/Screen/index.js +9 -11
  97. package/lib/components/HDLKiosk/slices/customization/operation.js +23 -3
  98. package/lib/components/HDLKiosk/slices/customization/slice.js +3 -7
  99. package/lib/components/HDLKiosk/slices/customization/view.js +3 -2
  100. package/lib/components/HDLKiosk/slices/fulfillment/Screen/index.js +6 -6
  101. package/lib/components/HDLKiosk/slices/fulfillment/slice.js +4 -7
  102. package/lib/components/HDLKiosk/slices/identity/Screen/index.js +17 -11
  103. package/lib/components/HDLKiosk/slices/identity/slice.js +4 -11
  104. package/lib/components/HDLKiosk/slices/index.js +2 -1
  105. package/lib/components/HDLKiosk/slices/payment/Screen/index.js +5 -5
  106. package/lib/components/HDLKiosk/slices/payment/slice.js +6 -7
  107. package/lib/components/HDLKiosk/slices/primaryProductPrompt/slice.js +14 -0
  108. package/lib/components/HDLKiosk/slices/primaryProductPrompt/view.js +25 -0
  109. package/lib/components/HDLKiosk/utils.js +3 -2
  110. package/lib/components/bigSale/templates/HDLKiosk/auth/HDLKioskIdentityAuthPanel.js +16 -1
  111. package/lib/pro/Login2.0/Login2.d.ts +2 -0
  112. package/lib/pro/Login2.0/Login2.js +9 -1
  113. package/lib/pro/Login2.0/Register2.d.ts +2 -0
  114. package/lib/pro/Login2.0/Register2.js +9 -1
  115. package/package.json +4 -4
@@ -1,27 +1,22 @@
1
1
  const require_objectSpread2 = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
2
2
  //#region src/components/HDLKiosk/kernel/application/defineSlice.ts
3
- const back = () => Object.freeze({
4
- kind: "complete",
5
- navigate: "previous"
6
- });
7
- const guard = (guardId, options = {}) => Object.freeze({
8
- kind: "guard",
9
- guard: guardId,
3
+ const intentPrecondition = (predicate, options = {}) => Object.freeze({
4
+ kind: "precondition",
5
+ predicate,
10
6
  navigate: options.navigate
11
7
  });
12
8
  const effect = (operation, options = {}) => Object.freeze({
13
9
  kind: "effect",
14
10
  operation,
15
- when: options.when,
16
- guard: options.guard,
11
+ precondition: options.precondition,
17
12
  navigate: options.navigate
18
13
  });
19
14
  function defineSlice(slice) {
20
15
  var _slice$guards;
21
16
  if (!slice.id.trim()) throw new Error("Kiosk Slice id cannot be empty");
22
17
  if (!slice.screen.id.trim()) throw new Error(`Kiosk Slice ${slice.id} screen id cannot be empty`);
23
- Object.entries(slice.outcomes).forEach(([outcome]) => {
24
- if (!outcome.trim()) throw new Error(`Kiosk Slice ${slice.id} has an empty outcome`);
18
+ Object.entries(slice.intents).forEach(([intent]) => {
19
+ if (!intent.trim()) throw new Error(`Kiosk Slice ${slice.id} has an empty intent`);
25
20
  });
26
21
  Object.entries((_slice$guards = slice.guards) !== null && _slice$guards !== void 0 ? _slice$guards : {}).forEach(([phase, navigationGuard]) => {
27
22
  if (phase !== "beforeEnter") throw new Error(`Kiosk Slice ${slice.id} has an unknown navigation guard phase: ${phase}`);
@@ -29,14 +24,13 @@ function defineSlice(slice) {
29
24
  });
30
25
  return Object.freeze(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, slice), {}, {
31
26
  screen: Object.freeze(require_objectSpread2._objectSpread2({}, slice.screen)),
32
- outcomes: Object.freeze(require_objectSpread2._objectSpread2({}, slice.outcomes)),
27
+ intents: Object.freeze(require_objectSpread2._objectSpread2({}, slice.intents)),
33
28
  guards: slice.guards ? Object.freeze(require_objectSpread2._objectSpread2({}, slice.guards)) : void 0,
34
29
  commands: slice.commands ? Object.freeze(require_objectSpread2._objectSpread2({}, slice.commands)) : void 0,
35
30
  requirements: slice.requirements ? Object.freeze([...slice.requirements]) : void 0
36
31
  }));
37
32
  }
38
33
  //#endregion
39
- exports.back = back;
40
34
  exports.defineSlice = defineSlice;
41
35
  exports.effect = effect;
42
- exports.guard = guard;
36
+ exports.intentPrecondition = intentPrecondition;
@@ -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 || storedResolution !== "omit" && 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,16 @@ 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
+ const candidateNode = definition.nodes[candidateStepId];
120
+ if (candidateNode.presentation.mode === "modal") {
121
+ const fromNode = fromNodeId ? definition.nodes[fromNodeId] : void 0;
122
+ if (!fromNode || fromNode.presentation.mode === "modal") return {
123
+ type: "block",
124
+ error: createWorkflowError(fromNode ? "workflowNestedModalUnsupported" : "workflowModalRequiresPage", "staff")
125
+ };
126
+ }
127
+ const candidateResolution = stepResolutions.get(candidateStepId);
128
+ if (candidateResolution === "omit" || candidateNode.visitPolicy === "once" && candidateResolution) continue;
96
129
  const decision = beforeEach({
97
130
  navigationId,
98
131
  intentId,
@@ -151,12 +184,24 @@ function createWorkflowActor({ definition, context, sessionEpoch, transitionRunn
151
184
  status: initialError || initialResolutionError || startingNode.end === "blocked" ? "blocked" : startingNode.end === "success" ? "finished" : "idle",
152
185
  context: Object.freeze(require_objectSpread2._objectSpread2({}, context)),
153
186
  completedStepIds: Object.freeze([]),
187
+ stepResolutions: Object.freeze({}),
188
+ surface: Object.freeze({
189
+ pageStepId: startingNodeId,
190
+ overlays: Object.freeze([])
191
+ }),
192
+ navigationHistory: Object.freeze([]),
154
193
  lastError: (_ref2 = initialError !== null && initialError !== void 0 ? initialError : initialResolutionError) !== null && _ref2 !== void 0 ? _ref2 : startingNode.end === "blocked" ? createWorkflowError("workflowEndedBlocked", "staff") : void 0
155
194
  });
156
195
  const publish = (next) => {
157
196
  snapshot = Object.freeze(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, next), {}, {
158
197
  context: Object.freeze(require_objectSpread2._objectSpread2({}, next.context)),
159
198
  completedStepIds: Object.freeze([...next.completedStepIds]),
199
+ stepResolutions: Object.freeze(require_objectSpread2._objectSpread2({}, next.stepResolutions)),
200
+ surface: Object.freeze({
201
+ pageStepId: next.surface.pageStepId,
202
+ overlays: Object.freeze([...next.surface.overlays])
203
+ }),
204
+ navigationHistory: Object.freeze([...next.navigationHistory]),
160
205
  pendingNavigation: next.pendingNavigation ? Object.freeze(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, next.pendingNavigation), {}, {
161
206
  to: Object.freeze(require_objectSpread2._objectSpread2({}, next.pendingNavigation.to)),
162
207
  request: Object.freeze(require_objectSpread2._objectSpread2({}, next.pendingNavigation.request))
@@ -169,11 +214,21 @@ function createWorkflowActor({ definition, context, sessionEpoch, transitionRunn
169
214
  const commit = function() {
170
215
  var _ref3 = require_asyncToGenerator._asyncToGenerator(function* (fromNodeId, nodeId, event, nextContext, blocked, lastError, confirmedCheckout) {
171
216
  const node = definition.nodes[nodeId];
217
+ const surface = node.presentation.mode === "modal" ? Object.freeze({
218
+ pageStepId: snapshot.surface.pageStepId,
219
+ overlays: Object.freeze([nodeId])
220
+ }) : Object.freeze({
221
+ pageStepId: nodeId,
222
+ overlays: Object.freeze([])
223
+ });
172
224
  publish(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, snapshot), {}, {
173
225
  nodeId,
174
226
  status: blocked || node.end === "blocked" ? "blocked" : node.end === "success" ? "finished" : "idle",
175
227
  context: nextContext,
176
228
  completedStepIds: Object.freeze([...completedStepIds]),
229
+ stepResolutions: Object.freeze(readStepResolutions()),
230
+ surface,
231
+ navigationHistory: Object.freeze([...navigationHistory]),
177
232
  pendingNavigation: void 0,
178
233
  confirmedCheckout: confirmedCheckout !== null && confirmedCheckout !== void 0 ? confirmedCheckout : snapshot.confirmedCheckout,
179
234
  activeOperation: void 0,
@@ -194,7 +249,7 @@ function createWorkflowActor({ definition, context, sessionEpoch, transitionRunn
194
249
  const workflowError = createWorkflowError(code, "staff", cause);
195
250
  lifecycle.runtimeError({
196
251
  stepId: fromNodeId,
197
- outcome: event.outcome,
252
+ intent: event.intent,
198
253
  error: workflowError
199
254
  });
200
255
  yield commit(fromNodeId, fromNodeId, event, snapshot.context, true, workflowError);
@@ -209,10 +264,22 @@ function createWorkflowActor({ definition, context, sessionEpoch, transitionRunn
209
264
  if (disposed || snapshot.status === "finished" || snapshot.status === "blocked") return;
210
265
  const fromNodeId = snapshot.nodeId;
211
266
  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}`;
267
+ if (event.stepId !== fromNodeId || event.activityId !== node.activity) return;
268
+ if (!event.intentId.trim()) return;
269
+ if (event.type === "NAVIGATE_BACK") {
270
+ const previousStepId = navigationHistory[navigationHistory.length - 1];
271
+ yield handleDirectNavigation(previousStepId ? {
272
+ kind: "step",
273
+ stepId: previousStepId
274
+ } : {
275
+ kind: "sessionExit",
276
+ reason: "workflowBoundary"
277
+ }, event.intentId);
278
+ return;
279
+ }
280
+ const transition = node.on[event.intent];
281
+ if (!transition) return;
282
+ const repeatKey = `${fromNodeId}:${event.intent}:${transition.target}`;
216
283
  if (transition.repeat && ((_repeatCounts$get = repeatCounts.get(repeatKey)) !== null && _repeatCounts$get !== void 0 ? _repeatCounts$get : 0) >= transition.repeat.max) {
217
284
  yield blockForRuntimeError(fromNodeId, event, "workflowRepeatLimitExceeded");
218
285
  return;
@@ -222,16 +289,24 @@ function createWorkflowActor({ definition, context, sessionEpoch, transitionRunn
222
289
  if (!transition.repeat) return;
223
290
  repeatCounts.set(repeatKey, ((_repeatCounts$get2 = repeatCounts.get(repeatKey)) !== null && _repeatCounts$get2 !== void 0 ? _repeatCounts$get2 : 0) + 1);
224
291
  };
225
- const nextContext = reduceContext(snapshot.context, event.contextPatch);
292
+ const previousContext = snapshot.context;
293
+ const nextContext = reduceContext(previousContext, event.contextPatch);
294
+ let requestedTarget = transition.target;
295
+ try {
296
+ requestedTarget = resolveResumableTarget(requestedTarget);
297
+ } catch (cause) {
298
+ yield blockForRuntimeError(fromNodeId, event, "workflowResumeCycle", cause);
299
+ return;
300
+ }
226
301
  const fromIndex = definition.stepOrder.indexOf(fromNodeId);
227
- const movesForward = definition.stepOrder.indexOf(transition.target) > fromIndex;
302
+ const movesForward = definition.stepOrder.indexOf(requestedTarget) > fromIndex;
228
303
  const candidateCompletedStepIds = movesForward ? [...new Set([...completedStepIds, fromNodeId])] : [...completedStepIds];
229
304
  let navigationResolution;
230
305
  try {
231
306
  navigationResolution = resolveNavigation({
232
307
  target: {
233
308
  kind: "step",
234
- stepId: transition.target
309
+ stepId: requestedTarget
235
310
  },
236
311
  fromNodeId,
237
312
  candidateContext: nextContext,
@@ -245,10 +320,10 @@ function createWorkflowActor({ definition, context, sessionEpoch, transitionRunn
245
320
  if (navigationResolution.type === "block") {
246
321
  lifecycle.runtimeError({
247
322
  stepId: fromNodeId,
248
- outcome: event.outcome,
323
+ intent: event.intent,
249
324
  error: navigationResolution.error
250
325
  });
251
- yield commit(fromNodeId, fromNodeId, event, snapshot.context, true, navigationResolution.error);
326
+ yield commit(fromNodeId, fromNodeId, event, previousContext, true, navigationResolution.error);
252
327
  return;
253
328
  }
254
329
  if (navigationResolution.type === "cancel") return;
@@ -268,9 +343,9 @@ function createWorkflowActor({ definition, context, sessionEpoch, transitionRunn
268
343
  return;
269
344
  }
270
345
  const resolvedTarget = navigationResolution.stepId;
271
- const operationInput = "operationInput" in event ? event.operationInput : void 0;
346
+ "operationInput" in event && event.operationInput;
272
347
  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));
348
+ const commandWillRun = Boolean(command);
274
349
  executionSequence += 1;
275
350
  const executionId = `${definition.id}:${snapshot.sessionEpoch}:${executionSequence}`;
276
351
  if (commandWillRun && command) publish(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, snapshot), {}, {
@@ -303,21 +378,29 @@ function createWorkflowActor({ definition, context, sessionEpoch, transitionRunn
303
378
  if (result.status === "advance") {
304
379
  recordRepeat();
305
380
  if (movesForward) completedStepIds.add(fromNodeId);
381
+ stepResolutions.set(fromNodeId, event.intent);
382
+ if (event.intent === "complete" && node.presentation.mode === "page" && movesForward && node.visitPolicy !== "once") {
383
+ navigationHistory = navigationHistory.filter((stepId) => stepId !== fromNodeId);
384
+ navigationHistory.push(fromNodeId);
385
+ } else if (event.intent === "omit") navigationHistory = navigationHistory.filter((stepId) => stepId !== fromNodeId);
306
386
  yield commit(fromNodeId, resolvedTarget, event, nextContext, false, void 0, result.confirmedCheckout);
307
387
  return;
308
388
  }
309
389
  if (result.status === "blocked") {
310
- yield commit(fromNodeId, fromNodeId, event, nextContext, true, result.lastError);
390
+ yield commit(fromNodeId, fromNodeId, event, previousContext, true, result.lastError);
311
391
  return;
312
392
  }
313
- yield commit(fromNodeId, fromNodeId, event, nextContext, false, result.lastError);
393
+ yield commit(fromNodeId, fromNodeId, event, previousContext, false, result.lastError);
314
394
  });
315
395
  return function handleEvent(_x12) {
316
396
  return _ref5.apply(this, arguments);
317
397
  };
318
398
  }();
319
- const handleDirectNavigation = function() {
320
- var _ref6 = require_asyncToGenerator._asyncToGenerator(function* (target, intentId) {
399
+ function handleDirectNavigation(_x13, _x14) {
400
+ return _handleDirectNavigation.apply(this, arguments);
401
+ }
402
+ function _handleDirectNavigation() {
403
+ _handleDirectNavigation = require_asyncToGenerator._asyncToGenerator(function* (target, intentId) {
321
404
  if (!intentId.trim()) return;
322
405
  const fromNodeId = snapshot.nodeId;
323
406
  let resolution;
@@ -333,7 +416,7 @@ function createWorkflowActor({ definition, context, sessionEpoch, transitionRunn
333
416
  } catch (cause) {
334
417
  yield blockForRuntimeError(fromNodeId, {
335
418
  intentId,
336
- outcome: "directNavigation"
419
+ intent: "directNavigation"
337
420
  }, "workflowBeforeEachGuardFailed", cause);
338
421
  return;
339
422
  }
@@ -341,19 +424,28 @@ function createWorkflowActor({ definition, context, sessionEpoch, transitionRunn
341
424
  if (resolution.type === "block") {
342
425
  lifecycle.runtimeError({
343
426
  stepId: fromNodeId,
344
- outcome: "directNavigation",
427
+ intent: "directNavigation",
345
428
  error: resolution.error
346
429
  });
347
430
  yield commit(fromNodeId, fromNodeId, {
348
431
  intentId,
349
- outcome: "directNavigation"
432
+ intent: "directNavigation"
350
433
  }, snapshot.context, true, resolution.error);
351
434
  return;
352
435
  }
353
436
  if (resolution.type === "step") {
437
+ const fromIndex = definition.stepOrder.indexOf(fromNodeId);
438
+ if (definition.stepOrder.indexOf(resolution.stepId) < fromIndex) stepResolutions.delete(fromNodeId);
439
+ if (definition.nodes[resolution.stepId].presentation.mode === "modal" && definition.nodes[fromNodeId].presentation.mode === "page") {
440
+ navigationHistory = navigationHistory.filter((stepId) => stepId !== fromNodeId);
441
+ navigationHistory.push(fromNodeId);
442
+ } else {
443
+ const historyIndex = navigationHistory.lastIndexOf(resolution.stepId);
444
+ if (historyIndex >= 0) navigationHistory = navigationHistory.slice(0, historyIndex);
445
+ }
354
446
  yield commit(fromNodeId, resolution.stepId, {
355
447
  intentId,
356
- outcome: "directNavigation"
448
+ intent: "directNavigation"
357
449
  }, snapshot.context, false);
358
450
  return;
359
451
  }
@@ -370,12 +462,10 @@ function createWorkflowActor({ definition, context, sessionEpoch, transitionRunn
370
462
  lastError: void 0
371
463
  }));
372
464
  });
373
- return function handleDirectNavigation(_x13, _x14) {
374
- return _ref6.apply(this, arguments);
375
- };
376
- }();
465
+ return _handleDirectNavigation.apply(this, arguments);
466
+ }
377
467
  const drain = function() {
378
- var _ref7 = require_asyncToGenerator._asyncToGenerator(function* () {
468
+ var _ref6 = require_asyncToGenerator._asyncToGenerator(function* () {
379
469
  if (processing || disposed) return;
380
470
  processing = true;
381
471
  try {
@@ -388,7 +478,7 @@ function createWorkflowActor({ definition, context, sessionEpoch, transitionRunn
388
478
  }
389
479
  });
390
480
  return function drain() {
391
- return _ref7.apply(this, arguments);
481
+ return _ref6.apply(this, arguments);
392
482
  };
393
483
  }();
394
484
  return {
@@ -430,7 +520,7 @@ function createWorkflowActor({ definition, context, sessionEpoch, transitionRunn
430
520
  const fromNodeId = snapshot.nodeId;
431
521
  commit(fromNodeId, fromNodeId, {
432
522
  intentId,
433
- outcome: "systemBlocked"
523
+ intent: "systemBlocked"
434
524
  }, snapshot.context, true, error);
435
525
  },
436
526
  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 !== "once") addIssue(issues, "step.visitPolicy.invalid", `${stepPath}.visitPolicy`, "Step visitPolicy must be always 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,29 +156,25 @@ 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" };
160
163
  if (rawPresentation !== void 0) {
161
- if (isRecord(rawPresentation)) rejectUnknownFields(rawPresentation, ["mode", "base"], `${stepPath}.presentation`, issues);
164
+ if (isRecord(rawPresentation)) rejectUnknownFields(rawPresentation, ["mode"], `${stepPath}.presentation`, issues);
162
165
  if (!isRecord(rawPresentation)) addIssue(issues, "step.presentation.invalid", `${stepPath}.presentation`, "Step presentation must be an object");
163
166
  else if (rawPresentation.mode !== "page" && rawPresentation.mode !== "modal") addIssue(issues, "step.presentation.mode.invalid", `${stepPath}.presentation.mode`, "Presentation mode must be page or modal");
164
167
  else if (!activity.allowedPresentations.includes(rawPresentation.mode)) addIssue(issues, "activity.presentation.unsupported", `${stepPath}.presentation.mode`, `Activity ${activity.id} does not support ${rawPresentation.mode}`);
165
- else if (rawPresentation.mode === "modal") if (typeof rawPresentation.base !== "string" || !rawPresentation.base.trim()) addIssue(issues, "step.presentation.base.invalid", `${stepPath}.presentation.base`, "Modal base must be a non-empty step id");
166
- else presentation = {
167
- mode: "modal",
168
- base: rawPresentation.base.trim()
169
- };
168
+ else if (rawPresentation.mode === "modal") presentation = { mode: "modal" };
170
169
  }
171
170
  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
171
  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");
172
+ if (rawStep.on !== void 0 && !isRecord(rawStep.on)) addIssue(issues, "step.intents.invalid", `${stepPath}.on`, "Step intents must be an object");
174
173
  const transitions = {};
175
- const addTransition = (outcome, rawTarget, path) => {
174
+ const addTransition = (intent, rawTarget, path) => {
176
175
  var _activity$exitPolicie;
177
- if (!activity.outcomes.includes(outcome)) {
178
- addIssue(issues, "activity.outcome.unknown", path, `Activity ${activity.id} does not expose outcome ${outcome}`);
176
+ if (!activity.intents.some((availableIntent) => availableIntent === intent)) {
177
+ addIssue(issues, "activity.intent.unknown", path, `Activity ${activity.id} does not expose intent ${intent}`);
179
178
  return;
180
179
  }
181
180
  let targetValue = rawTarget;
@@ -185,12 +184,12 @@ function compileWorkflowStructure(input, options) {
185
184
  "target",
186
185
  "repeat",
187
186
  "operation",
188
- "guard",
187
+ "precondition",
189
188
  "failureTarget"
190
189
  ], path, issues);
191
190
  [
192
191
  "operation",
193
- "guard",
192
+ "precondition",
194
193
  "failureTarget"
195
194
  ].forEach((field) => {
196
195
  if (rawTarget[field] !== void 0) addIssue(issues, "transition.untrustedField", `${path}.${field}`, `${field} belongs to the local Activity Contract`);
@@ -203,15 +202,15 @@ function compileWorkflowStructure(input, options) {
203
202
  return;
204
203
  }
205
204
  const symbolicTarget = targetValue.trim();
206
- const target = symbolicTarget === "$next" ? stepIds[index + 1] : symbolicTarget === "$prev" ? stepIds[index - 1] : symbolicTarget;
205
+ const target = symbolicTarget === "$next" ? stepIds[index + 1] : symbolicTarget;
207
206
  if (!target) {
208
- addIssue(issues, symbolicTarget === "$prev" ? "transition.prev.missing" : "transition.next.missing", path, `${symbolicTarget} does not exist for step ${stepId}`);
207
+ addIssue(issues, "transition.next.missing", path, `${symbolicTarget} does not exist for step ${stepId}`);
209
208
  return;
210
209
  }
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}`);
210
+ const exitPolicy = (_activity$exitPolicie = activity.exitPolicies) === null || _activity$exitPolicie === void 0 ? void 0 : _activity$exitPolicie[intent];
211
+ 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
212
  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({
213
+ transitions[intent] = Object.freeze({
215
214
  target,
216
215
  exitPolicy,
217
216
  repeat
@@ -219,15 +218,11 @@ function compileWorkflowStructure(input, options) {
219
218
  };
220
219
  if (index + 1 < rawSteps.length) {
221
220
  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}`));
221
+ (_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
222
  }
228
223
  const rawTransitions = isRecord(rawStep.on) ? rawStep.on : {};
229
- Object.entries(rawTransitions).forEach(([outcome, transition]) => {
230
- addTransition(outcome, transition, `${stepPath}.on.${outcome}`);
224
+ Object.entries(rawTransitions).forEach(([intent, transition]) => {
225
+ addTransition(intent, transition, `${stepPath}.on.${intent}`);
231
226
  });
232
227
  transitionCount += Object.keys(transitions).length;
233
228
  nodes[stepId] = Object.freeze({
@@ -236,6 +231,7 @@ function compileWorkflowStructure(input, options) {
236
231
  screenId: activity.screenId,
237
232
  presentation,
238
233
  readiness: rawStep.readiness === "placeholder" ? "placeholder" : void 0,
234
+ visitPolicy: rawStep.visitPolicy === "once" ? "once" : "always",
239
235
  guardPhases: Object.freeze([...guardPhases]),
240
236
  on: Object.freeze(transitions),
241
237
  end: rawStep.end === "success" || rawStep.end === "blocked" ? rawStep.end : void 0
@@ -246,27 +242,25 @@ function compileWorkflowStructure(input, options) {
246
242
  Object.entries(nodes).forEach(([stepId, node]) => {
247
243
  var _stepIndex$get;
248
244
  const path = `steps.${(_stepIndex$get = stepIndex.get(stepId)) !== null && _stepIndex$get !== void 0 ? _stepIndex$get : 0}`;
249
- if (node.presentation.mode === "modal") {
250
- const base = nodes[node.presentation.base];
251
- if (!base) addIssue(issues, "step.presentation.base.missing", `${path}.presentation.base`, `Modal base step does not exist: ${node.presentation.base}`);
252
- else if (node.presentation.base === stepId) addIssue(issues, "step.presentation.base.self", `${path}.presentation.base`, "Modal step cannot use itself as its base");
253
- else if (base.presentation.mode === "modal") addIssue(issues, "step.presentation.base.modal", `${path}.presentation.base`, "Modal step cannot use another modal step as its base");
254
- }
245
+ if (node.presentation.mode === "modal" && stepId === stepIds[0]) addIssue(issues, "workflow.initial.modal", `${path}.presentation.mode`, "Workflow initial step must provide a page surface");
255
246
  const transitions = Object.entries(node.on).filter((entry) => entry[1]);
247
+ transitions.forEach(([intent, transition]) => {
248
+ var _nodes$transition$tar;
249
+ if (node.presentation.mode === "modal" && transition && ((_nodes$transition$tar = nodes[transition.target]) === null || _nodes$transition$tar === void 0 ? void 0 : _nodes$transition$tar.presentation.mode) === "modal") addIssue(issues, "transition.modal.nested", `${path}.on.${intent}`, "A modal step cannot navigate directly to another modal step");
250
+ });
256
251
  if (!node.end && transitions.length === 0) addIssue(issues, "step.deadEnd", path, "A step without outgoing transitions must declare its end state");
257
252
  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;
253
+ transitions.forEach(([intent, transition]) => {
254
+ var _stepIndex$get2, _stepIndex$get3;
260
255
  if (!transition) return;
261
256
  if (!nodes[transition.target]) {
262
- addIssue(issues, "transition.target.missing", `${path}.on.${outcome}`, `Target step does not exist: ${transition.target}`);
257
+ addIssue(issues, "transition.target.missing", `${path}.on.${intent}`, `Target step does not exist: ${transition.target}`);
263
258
  return;
264
259
  }
265
260
  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");
261
+ const needsBound = ((_stepIndex$get3 = stepIndex.get(transition.target)) !== null && _stepIndex$get3 !== void 0 ? _stepIndex$get3 : -1) <= sourceIndex;
262
+ 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");
263
+ if (!needsBound && transition.repeat) addIssue(issues, "transition.repeat.unnecessary", `${path}.on.${intent}.repeat`, "Repeat limits are only valid on cyclic jumps");
270
264
  });
271
265
  });
272
266
  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");
@@ -48,7 +49,7 @@ function HDLKioskWorkflowCartOverlay({ model, busy, memberAction, send, renderCa
48
49
  * Host、Workflow Actor 或会话计时器。
49
50
  */
50
51
  function HDLKioskWorkflowView({ session, host, sales, config, isActive, renderIdentityAuth, renderCartContent, cartOverlayActions, returnToEntry }) {
51
- var _snapshot$pendingNavi, _snapshot$pendingNavi2, _activeNode$presentat, _customer$error, _activeNode$presentat2;
52
+ var _snapshot$pendingNavi, _snapshot$pendingNavi2, _session$definition$n2, _customer$error, _activeNode$presentat;
52
53
  const snapshot = require_useWorkflowSnapshot.useWorkflowSnapshot(session.actor);
53
54
  const sequence = (0, react.useRef)(0);
54
55
  const resetInFlight = (0, react.useRef)(false);
@@ -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 = (_session$definition$n2 = session.definition.nodes[snapshot.surface.pageStepId]) !== null && _session$definition$n2 !== void 0 ? _session$definition$n2 : 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,
@@ -245,7 +246,7 @@ function HDLKioskWorkflowView({ session, host, sales, config, isActive, renderId
245
246
  memberAction,
246
247
  variant: currentScreenId === "identity" ? "identityGate" : "default"
247
248
  }, /* @__PURE__ */ react.default.createElement(require_index$5.HDLKioskBottomBarHost, {
248
- mode: ((_activeNode$presentat2 = activeNode.presentation) === null || _activeNode$presentat2 === void 0 ? void 0 : _activeNode$presentat2.mode) === "modal" || endOrderConfirmationOpen || memberLoginOpen ? "masked" : "visible",
249
+ mode: ((_activeNode$presentat = activeNode.presentation) === null || _activeNode$presentat === void 0 ? void 0 : _activeNode$presentat.mode) === "modal" || endOrderConfirmationOpen || memberLoginOpen ? "masked" : "visible",
249
250
  fallback: endOrderBottomBar,
250
251
  cartOverlayActions,
251
252
  promotionsAvailable: Boolean(renderCartContent)
@@ -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
  /**