@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.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.js +11 -11
- package/build/lowcode/view.js +11 -11
- package/es/components/HDLKiosk/app/ScreenRenderer.js +7 -7
- package/es/components/HDLKiosk/app/views.js +2 -1
- package/es/components/HDLKiosk/app/workflow/barcode.js +12 -35
- package/es/components/HDLKiosk/app/workflow/{guards.js → predicates.js} +9 -9
- package/es/components/HDLKiosk/app/workflow/quick.js +3 -6
- package/es/components/HDLKiosk/app/workflow/registry.js +1 -1
- package/es/components/HDLKiosk/app/workflow/scale.js +3 -12
- package/es/components/HDLKiosk/components/shell/HDLKioskBottomBarHost/index.js +12 -10
- package/es/components/HDLKiosk/components/shell/HDLKioskShell/index.js +1 -0
- package/es/components/HDLKiosk/docs/00-/346/226/207/344/273/266/345/257/274/350/210/252.md +7 -7
- 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
- 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
- package/es/components/HDLKiosk/docs/05-/344/272/244/346/230/223/345/256/211/345/205/250.md +1 -1
- package/es/components/HDLKiosk/docs/07-/345/220/216/347/273/255/345/267/245/344/275/234.md +1 -1
- package/es/components/HDLKiosk/docs/README.md +2 -2
- package/es/components/HDLKiosk/docs//345/256/236/346/226/275/350/277/233/345/272/246.md +3 -3
- package/es/components/HDLKiosk/docs//346/236/266/346/236/204/350/256/276/350/256/241.md +11 -11
- package/es/components/HDLKiosk/index.js +0 -1
- package/es/components/HDLKiosk/kernel/README.md +8 -9
- package/es/components/HDLKiosk/kernel/application/defineApplication.js +18 -19
- package/es/components/HDLKiosk/kernel/application/defineSlice.js +8 -13
- package/es/components/HDLKiosk/kernel/workflow/actor.js +118 -28
- package/es/components/HDLKiosk/kernel/workflow/compiler.js +35 -41
- package/es/components/HDLKiosk/kernel/workflow/selectors.js +9 -0
- package/es/components/HDLKiosk/runtime/HDLKioskWorkflowView.js +10 -9
- package/es/components/HDLKiosk/runtime/controllers/useHDLKioskCustomerController.js +1 -1
- package/es/components/HDLKiosk/runtime/createWorkflowSession.js +3 -3
- package/es/components/HDLKiosk/runtime/domainTransitionRunner.js +9 -9
- package/es/components/HDLKiosk/runtime/workflowEvent.js +9 -4
- package/es/components/HDLKiosk/runtime/workflowLifecycle.js +3 -3
- package/es/components/HDLKiosk/slices/catalog/PrimaryProductPromptDialog/index.js +1 -2
- package/es/components/HDLKiosk/slices/catalog/Screen/index.js +11 -38
- package/es/components/HDLKiosk/slices/catalog/Screen/model.js +1 -5
- package/es/components/HDLKiosk/slices/catalog/slice.js +4 -16
- package/es/components/HDLKiosk/slices/catalog/view.js +4 -6
- package/es/components/HDLKiosk/slices/customization/Screen/index.js +9 -11
- package/es/components/HDLKiosk/slices/customization/operation.js +23 -4
- package/es/components/HDLKiosk/slices/customization/slice.js +5 -9
- package/es/components/HDLKiosk/slices/customization/view.js +3 -2
- package/es/components/HDLKiosk/slices/fulfillment/Screen/index.js +6 -6
- package/es/components/HDLKiosk/slices/fulfillment/slice.js +5 -8
- package/es/components/HDLKiosk/slices/identity/Screen/index.js +18 -12
- package/es/components/HDLKiosk/slices/identity/slice.js +4 -11
- package/es/components/HDLKiosk/slices/index.js +3 -2
- package/es/components/HDLKiosk/slices/payment/Screen/index.js +5 -5
- package/es/components/HDLKiosk/slices/payment/slice.js +7 -8
- package/es/components/HDLKiosk/slices/primaryProductPrompt/slice.js +14 -0
- package/es/components/HDLKiosk/slices/primaryProductPrompt/view.js +23 -0
- package/es/components/HDLKiosk/utils.js +3 -2
- package/es/components/bigSale/templates/HDLKiosk/auth/HDLKioskIdentityAuthPanel.js +17 -2
- package/es/pro/Login2.0/Login2.d.ts +2 -0
- package/es/pro/Login2.0/Login2.js +9 -1
- package/es/pro/Login2.0/Register2.d.ts +2 -0
- package/es/pro/Login2.0/Register2.js +9 -1
- package/lib/components/HDLKiosk/app/ScreenRenderer.js +7 -7
- package/lib/components/HDLKiosk/app/views.js +2 -1
- package/lib/components/HDLKiosk/app/workflow/barcode.js +11 -34
- package/lib/components/HDLKiosk/app/workflow/{guards.js → predicates.js} +9 -9
- package/lib/components/HDLKiosk/app/workflow/quick.js +3 -6
- package/lib/components/HDLKiosk/app/workflow/registry.js +1 -1
- package/lib/components/HDLKiosk/app/workflow/scale.js +3 -12
- package/lib/components/HDLKiosk/components/shell/HDLKioskBottomBarHost/index.js +12 -10
- package/lib/components/HDLKiosk/components/shell/HDLKioskShell/index.js +1 -0
- package/lib/components/HDLKiosk/docs/00-/346/226/207/344/273/266/345/257/274/350/210/252.md +7 -7
- 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
- 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
- package/lib/components/HDLKiosk/docs/05-/344/272/244/346/230/223/345/256/211/345/205/250.md +1 -1
- package/lib/components/HDLKiosk/docs/07-/345/220/216/347/273/255/345/267/245/344/275/234.md +1 -1
- package/lib/components/HDLKiosk/docs/README.md +2 -2
- package/lib/components/HDLKiosk/docs//345/256/236/346/226/275/350/277/233/345/272/246.md +3 -3
- package/lib/components/HDLKiosk/docs//346/236/266/346/236/204/350/256/276/350/256/241.md +11 -11
- package/lib/components/HDLKiosk/index.js +0 -1
- package/lib/components/HDLKiosk/kernel/README.md +8 -9
- package/lib/components/HDLKiosk/kernel/application/defineApplication.js +18 -19
- package/lib/components/HDLKiosk/kernel/application/defineSlice.js +8 -14
- package/lib/components/HDLKiosk/kernel/workflow/actor.js +118 -28
- package/lib/components/HDLKiosk/kernel/workflow/compiler.js +35 -41
- package/lib/components/HDLKiosk/kernel/workflow/selectors.js +10 -0
- package/lib/components/HDLKiosk/runtime/HDLKioskWorkflowView.js +10 -9
- package/lib/components/HDLKiosk/runtime/controllers/useHDLKioskCustomerController.js +1 -1
- package/lib/components/HDLKiosk/runtime/createWorkflowSession.js +3 -3
- package/lib/components/HDLKiosk/runtime/domainTransitionRunner.js +9 -9
- package/lib/components/HDLKiosk/runtime/workflowEvent.js +9 -4
- package/lib/components/HDLKiosk/runtime/workflowLifecycle.js +3 -3
- package/lib/components/HDLKiosk/slices/catalog/PrimaryProductPromptDialog/index.js +1 -2
- package/lib/components/HDLKiosk/slices/catalog/Screen/index.js +13 -40
- package/lib/components/HDLKiosk/slices/catalog/Screen/model.js +0 -5
- package/lib/components/HDLKiosk/slices/catalog/slice.js +2 -15
- package/lib/components/HDLKiosk/slices/catalog/view.js +4 -6
- package/lib/components/HDLKiosk/slices/customization/Screen/index.js +9 -11
- package/lib/components/HDLKiosk/slices/customization/operation.js +23 -3
- package/lib/components/HDLKiosk/slices/customization/slice.js +3 -7
- package/lib/components/HDLKiosk/slices/customization/view.js +3 -2
- package/lib/components/HDLKiosk/slices/fulfillment/Screen/index.js +6 -6
- package/lib/components/HDLKiosk/slices/fulfillment/slice.js +4 -7
- package/lib/components/HDLKiosk/slices/identity/Screen/index.js +17 -11
- package/lib/components/HDLKiosk/slices/identity/slice.js +4 -11
- package/lib/components/HDLKiosk/slices/index.js +2 -1
- package/lib/components/HDLKiosk/slices/payment/Screen/index.js +5 -5
- package/lib/components/HDLKiosk/slices/payment/slice.js +6 -7
- package/lib/components/HDLKiosk/slices/primaryProductPrompt/slice.js +14 -0
- package/lib/components/HDLKiosk/slices/primaryProductPrompt/view.js +25 -0
- package/lib/components/HDLKiosk/utils.js +3 -2
- package/lib/components/bigSale/templates/HDLKiosk/auth/HDLKioskIdentityAuthPanel.js +16 -1
- package/lib/pro/Login2.0/Login2.d.ts +2 -0
- package/lib/pro/Login2.0/Login2.js +9 -1
- package/lib/pro/Login2.0/Register2.d.ts +2 -0
- package/lib/pro/Login2.0/Register2.js +9 -1
- package/package.json +4 -4
|
@@ -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 === "
|
|
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(_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(_objectSpread2(_objectSpread2({}, next), {}, {
|
|
158
197
|
context: Object.freeze(_objectSpread2({}, next.context)),
|
|
159
198
|
completedStepIds: Object.freeze([...next.completedStepIds]),
|
|
199
|
+
stepResolutions: Object.freeze(_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(_objectSpread2(_objectSpread2({}, next.pendingNavigation), {}, {
|
|
161
206
|
to: Object.freeze(_objectSpread2({}, next.pendingNavigation.to)),
|
|
162
207
|
request: Object.freeze(_objectSpread2({}, next.pendingNavigation.request))
|
|
@@ -169,11 +214,21 @@ function createWorkflowActor({ definition, context, sessionEpoch, transitionRunn
|
|
|
169
214
|
const commit = function() {
|
|
170
215
|
var _ref3 = _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(_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
|
-
|
|
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.
|
|
213
|
-
|
|
214
|
-
if (
|
|
215
|
-
|
|
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
|
|
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(
|
|
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:
|
|
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
|
-
|
|
323
|
+
intent: event.intent,
|
|
249
324
|
error: navigationResolution.error
|
|
250
325
|
});
|
|
251
|
-
yield commit(fromNodeId, fromNodeId, event,
|
|
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
|
-
|
|
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
|
|
348
|
+
const commandWillRun = Boolean(command);
|
|
274
349
|
executionSequence += 1;
|
|
275
350
|
const executionId = `${definition.id}:${snapshot.sessionEpoch}:${executionSequence}`;
|
|
276
351
|
if (commandWillRun && command) publish(_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,
|
|
390
|
+
yield commit(fromNodeId, fromNodeId, event, previousContext, true, result.lastError);
|
|
311
391
|
return;
|
|
312
392
|
}
|
|
313
|
-
yield commit(fromNodeId, fromNodeId, event,
|
|
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
|
-
|
|
320
|
-
|
|
399
|
+
function handleDirectNavigation(_x13, _x14) {
|
|
400
|
+
return _handleDirectNavigation.apply(this, arguments);
|
|
401
|
+
}
|
|
402
|
+
function _handleDirectNavigation() {
|
|
403
|
+
_handleDirectNavigation = _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
|
-
|
|
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
|
-
|
|
427
|
+
intent: "directNavigation",
|
|
345
428
|
error: resolution.error
|
|
346
429
|
});
|
|
347
430
|
yield commit(fromNodeId, fromNodeId, {
|
|
348
431
|
intentId,
|
|
349
|
-
|
|
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
|
-
|
|
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
|
|
374
|
-
|
|
375
|
-
};
|
|
376
|
-
}();
|
|
465
|
+
return _handleDirectNavigation.apply(this, arguments);
|
|
466
|
+
}
|
|
377
467
|
const drain = function() {
|
|
378
|
-
var
|
|
468
|
+
var _ref6 = _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
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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[
|
|
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(
|
|
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"
|
|
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")
|
|
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.
|
|
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 = (
|
|
174
|
+
const addTransition = (intent, rawTarget, path) => {
|
|
176
175
|
var _activity$exitPolicie;
|
|
177
|
-
if (!activity.
|
|
178
|
-
addIssue(issues, "activity.
|
|
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
|
-
"
|
|
187
|
+
"precondition",
|
|
189
188
|
"failureTarget"
|
|
190
189
|
], path, issues);
|
|
191
190
|
[
|
|
192
191
|
"operation",
|
|
193
|
-
"
|
|
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
|
|
205
|
+
const target = symbolicTarget === "$next" ? stepIds[index + 1] : symbolicTarget;
|
|
207
206
|
if (!target) {
|
|
208
|
-
addIssue(issues,
|
|
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[
|
|
212
|
-
if ((exitPolicy === null || exitPolicy === void 0 ? void 0 : exitPolicy.
|
|
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[
|
|
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((
|
|
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(([
|
|
230
|
-
addTransition(
|
|
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(([
|
|
259
|
-
var _stepIndex$get2, _stepIndex$get3
|
|
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.${
|
|
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
|
|
267
|
-
|
|
268
|
-
if (needsBound &&
|
|
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,9 @@
|
|
|
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
|
+
export { canNavigateBack, canReopenWorkflowStep };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { _asyncToGenerator } from "../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
|
|
2
2
|
import { useHDLKioskCustomerController } from "./controllers/useHDLKioskCustomerController.js";
|
|
3
3
|
import { useHDLKioskScreenData } from "./controllers/useHDLKioskScreenData.js";
|
|
4
|
+
import { canReopenWorkflowStep } from "../kernel/workflow/selectors.js";
|
|
4
5
|
import { EndOrderDialog } from "../components/overlays/EndOrderDialog/index.js";
|
|
5
6
|
import { HDLKioskHeader } from "../components/shell/HDLKioskHeader/index.js";
|
|
6
7
|
import { CartDrawer } from "../components/overlays/CartDrawer/index.js";
|
|
@@ -46,7 +47,7 @@ function HDLKioskWorkflowCartOverlay({ model, busy, memberAction, send, renderCa
|
|
|
46
47
|
* Host、Workflow Actor 或会话计时器。
|
|
47
48
|
*/
|
|
48
49
|
function HDLKioskWorkflowView({ session, host, sales, config, isActive, renderIdentityAuth, renderCartContent, cartOverlayActions, returnToEntry }) {
|
|
49
|
-
var _snapshot$pendingNavi, _snapshot$pendingNavi2,
|
|
50
|
+
var _snapshot$pendingNavi, _snapshot$pendingNavi2, _session$definition$n2, _customer$error, _activeNode$presentat;
|
|
50
51
|
const snapshot = useWorkflowSnapshot(session.actor);
|
|
51
52
|
const sequence = useRef(0);
|
|
52
53
|
const resetInFlight = useRef(false);
|
|
@@ -65,7 +66,7 @@ function HDLKioskWorkflowView({ session, host, sales, config, isActive, renderId
|
|
|
65
66
|
var _session$definition$n;
|
|
66
67
|
return ((_session$definition$n = session.definition.nodes[stepId]) === null || _session$definition$n === void 0 ? void 0 : _session$definition$n.activity) === "customization";
|
|
67
68
|
});
|
|
68
|
-
const
|
|
69
|
+
const screenDataNode = (_session$definition$n2 = session.definition.nodes[snapshot.surface.pageStepId]) !== null && _session$definition$n2 !== void 0 ? _session$definition$n2 : activeNode;
|
|
69
70
|
const paymentSafeForReset = sales.payment.status === "idle" || sales.payment.status === "failed";
|
|
70
71
|
const resetSession = useCallback(_asyncToGenerator(function* () {
|
|
71
72
|
if (resetInFlight.current) return;
|
|
@@ -143,8 +144,8 @@ function HDLKioskWorkflowView({ session, host, sales, config, isActive, renderId
|
|
|
143
144
|
]);
|
|
144
145
|
const { catalog, customization, payment } = useHDLKioskScreenData({
|
|
145
146
|
host,
|
|
146
|
-
currentScreenId,
|
|
147
|
-
activity:
|
|
147
|
+
currentScreenId: screenDataNode.screenId,
|
|
148
|
+
activity: screenDataNode.activity,
|
|
148
149
|
isActive,
|
|
149
150
|
primaryWeightedProductId: config.primaryWeightedProductId
|
|
150
151
|
});
|
|
@@ -161,7 +162,7 @@ function HDLKioskWorkflowView({ session, host, sales, config, isActive, renderId
|
|
|
161
162
|
}
|
|
162
163
|
sequence.current += 1;
|
|
163
164
|
const intentId = `ui:${snapshot.sessionEpoch}:${sequence.current}`;
|
|
164
|
-
if (action.kind === "
|
|
165
|
+
if (action.kind === "intent" || action.kind === "navigation") {
|
|
165
166
|
const event = createWorkflowEvent(action, activeNode.activity, snapshot.nodeId, intentId);
|
|
166
167
|
if (event) session.actor.send(event);
|
|
167
168
|
return;
|
|
@@ -191,9 +192,9 @@ function HDLKioskWorkflowView({ session, host, sales, config, isActive, renderId
|
|
|
191
192
|
useEffect(() => {
|
|
192
193
|
if (activeNode.activity !== "paymentMethod" || snapshot.status !== "idle" || sales.payment.status !== "succeeded") return;
|
|
193
194
|
send({
|
|
194
|
-
kind: "
|
|
195
|
+
kind: "intent",
|
|
195
196
|
activityId: "paymentMethod",
|
|
196
|
-
|
|
197
|
+
intent: "complete"
|
|
197
198
|
});
|
|
198
199
|
}, [
|
|
199
200
|
activeNode.activity,
|
|
@@ -243,7 +244,7 @@ function HDLKioskWorkflowView({ session, host, sales, config, isActive, renderId
|
|
|
243
244
|
memberAction,
|
|
244
245
|
variant: currentScreenId === "identity" ? "identityGate" : "default"
|
|
245
246
|
}, /* @__PURE__ */ React.createElement(HDLKioskBottomBarHost, {
|
|
246
|
-
mode: ((_activeNode$
|
|
247
|
+
mode: ((_activeNode$presentat = activeNode.presentation) === null || _activeNode$presentat === void 0 ? void 0 : _activeNode$presentat.mode) === "modal" || endOrderConfirmationOpen || memberLoginOpen ? "masked" : "visible",
|
|
247
248
|
fallback: endOrderBottomBar,
|
|
248
249
|
cartOverlayActions,
|
|
249
250
|
promotionsAvailable: Boolean(renderCartContent)
|
|
@@ -271,7 +272,7 @@ function HDLKioskWorkflowView({ session, host, sales, config, isActive, renderId
|
|
|
271
272
|
memberAction,
|
|
272
273
|
send,
|
|
273
274
|
renderCartContent,
|
|
274
|
-
onEditPrimaryProduct: customizationStepId && config.primaryWeightedProductId ? editPrimaryProduct : void 0
|
|
275
|
+
onEditPrimaryProduct: customizationStepId && config.primaryWeightedProductId && canReopenWorkflowStep(snapshot, customizationStepId) ? editPrimaryProduct : void 0
|
|
275
276
|
}), endOrderConfirmationOpen ? /* @__PURE__ */ React.createElement(EndOrderDialog, {
|
|
276
277
|
onCancel: cancelEndOrder,
|
|
277
278
|
onConfirm: confirmEndOrder
|
|
@@ -2,7 +2,7 @@ import { _asyncToGenerator } from "../../../_virtual/_@oxc-project_runtime@0.122
|
|
|
2
2
|
import { createOperationCoordinator } from "../app/operations/coordinator.js";
|
|
3
3
|
import { createHDLKioskOperationRegistry } from "../app/manifest.js";
|
|
4
4
|
import { defaultActivityRegistry, getBuiltInWorkflowDefinition } from "../app/workflow/registry.js";
|
|
5
|
-
import {
|
|
5
|
+
import { defaultPredicateRegistry } from "../app/workflow/predicates.js";
|
|
6
6
|
import { createHDLKioskBeforeEachGuard, defaultNavigationGuardRegistry } from "../app/workflow/navigationGuards.js";
|
|
7
7
|
import { validateHDLKioskWorkflowPolicy } from "../app/workflow/policy.js";
|
|
8
8
|
import { HDL_WORKFLOW_IDS } from "../app/constants.js";
|
|
@@ -26,7 +26,7 @@ function createHDLKioskWorkflowSession(entry, host, options = {}) {
|
|
|
26
26
|
const structuralCompilation = compileWorkflowStructure(getBuiltInWorkflowDefinition(entry), {
|
|
27
27
|
operations,
|
|
28
28
|
activities: defaultActivityRegistry,
|
|
29
|
-
|
|
29
|
+
predicates: defaultPredicateRegistry,
|
|
30
30
|
navigationGuards: defaultNavigationGuardRegistry,
|
|
31
31
|
workflowIds: HDL_WORKFLOW_IDS
|
|
32
32
|
});
|
|
@@ -54,7 +54,7 @@ function createHDLKioskWorkflowSession(entry, host, options = {}) {
|
|
|
54
54
|
const transitionRunner = createHDLKioskTransitionRunner({
|
|
55
55
|
host,
|
|
56
56
|
coordinator,
|
|
57
|
-
|
|
57
|
+
predicates: defaultPredicateRegistry
|
|
58
58
|
});
|
|
59
59
|
const workflowActor = createWorkflowActor({
|
|
60
60
|
definition,
|