@pisell/private-materials 6.12.166 → 6.12.167
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +1 -1
- package/es/components/HDLKiosk/app/views.js +2 -1
- package/es/components/HDLKiosk/app/workflow/barcode.js +15 -32
- 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 +46 -37
- package/es/components/HDLKiosk/docs/03-/344/270/232/345/212/241/346/265/201/347/250/213/344/270/216/344/272/244/344/272/222/350/247/204/345/210/231.md +2 -2
- 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 +88 -28
- package/es/components/HDLKiosk/kernel/workflow/compiler.js +28 -29
- package/es/components/HDLKiosk/kernel/workflow/selectors.js +9 -0
- package/es/components/HDLKiosk/runtime/HDLKioskWorkflowView.js +8 -7
- 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 +7 -9
- 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/components/BookingFloatingPanel/useBookingPanelController.js +1 -0
- package/es/components/bigSale/components/TimeBar/index.js +1 -0
- package/es/components/bigSale/dialog.js +1 -0
- package/es/components/bigSale/hooks/useBigSaleContext.js +1 -0
- package/es/components/bigSale/hooks/useSelectFloorMapResourceForBigSale.js +1 -0
- package/es/components/bigSale/index.js +1 -0
- package/es/components/bigSale/templates/HDLKiosk/auth/HDLKioskIdentityAuthPanel.js +17 -2
- package/es/components/bigSale/templates/Kiosk/index.js +1 -0
- package/es/components/sharedSecondaryBigSale/SharedSecondaryBigSaleReceiver.js +1 -0
- package/es/index.js +2 -0
- package/es/plus/pisellReservation/data/bookingToReservationTables.js +1 -1
- package/es/plus/pisellReservation/floorMap/floorPlanApi.js +1 -1
- package/es/plus/pisellReservation/floorMap/reservationMock.js +1 -1
- package/es/plus/pisellReservation/index.js +17 -0
- package/es/plus/saleDetail/Base.js +1 -0
- package/es/plus/saleDetail/components/Client/hooks/useClientSelectorProps.js +1 -0
- package/es/plus/saleDetail/components/DetailActions/index.js +1 -0
- package/es/plus/saleDetail/components/SummaryFinancialSections/index.js +1 -0
- package/es/plus/saleDetail/index.js +1 -0
- package/es/plus/saleDetail/tmpl/B/components/Dish/index.js +1 -0
- package/es/plus/saleDetail/tmpl/B/index.js +1 -0
- package/es/plus/salesSdk/index.js +52 -0
- package/es/plus/salesSdk/utils/addProductWithFlowDebounced.js +1 -1
- package/es/plus/salesSdk/utils/bookingDate.js +1 -1
- package/es/plus/salesSdk/utils/customerAuthGate.js +1 -1
- package/es/plus/salesSdk/utils/enrichCartLineHolderDisplay.js +1 -1
- package/es/pro/Login2.0/AuthModal.d.ts +1 -1
- 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/es/pro/Login2.0/index.d.ts +2 -1
- package/es/pro/Login2.0/shared/types.d.ts +1 -1
- package/lib/components/HDLKiosk/app/ScreenRenderer.js +1 -1
- package/lib/components/HDLKiosk/app/views.js +2 -1
- package/lib/components/HDLKiosk/app/workflow/barcode.js +14 -31
- 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 +46 -37
- package/lib/components/HDLKiosk/docs/03-/344/270/232/345/212/241/346/265/201/347/250/213/344/270/216/344/272/244/344/272/222/350/247/204/345/210/231.md +2 -2
- 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 +88 -28
- package/lib/components/HDLKiosk/kernel/workflow/compiler.js +28 -29
- package/lib/components/HDLKiosk/kernel/workflow/selectors.js +10 -0
- package/lib/components/HDLKiosk/runtime/HDLKioskWorkflowView.js +8 -7
- 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 +7 -9
- 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 +3 -3
- package/es/private-materials/lowcode/authmodal/meta.d.ts +0 -1
|
@@ -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 !== "reuseResolution" && rawStep.visitPolicy !== "once") addIssue(issues, "step.visitPolicy.invalid", `${stepPath}.visitPolicy`, "Step visitPolicy must be always, reuseResolution or once");
|
|
129
131
|
const activityValue = rawStep.activity;
|
|
130
132
|
if (typeof activityValue !== "string" || !activities.has(activityValue)) addIssue(issues, "activity.unknown", `${stepPath}.activity`, `Unknown activity: ${String(activityValue)}`);
|
|
131
133
|
const fallbackActivityId = activities.ids[0];
|
|
@@ -140,11 +142,12 @@ function compileWorkflowStructure(input, options) {
|
|
|
140
142
|
addIssue(issues, "step.useGuards.phase.invalid", phasePath, `Unknown navigation guard phase: ${String(rawPhase)}`);
|
|
141
143
|
return;
|
|
142
144
|
}
|
|
143
|
-
|
|
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,7 +156,7 @@ function compileWorkflowStructure(input, options) {
|
|
|
153
156
|
addIssue(issues, "step.useGuards.guard.unknown", phasePath, `Activity ${activity.id} uses unknown navigation guard ${guardId}`);
|
|
154
157
|
return;
|
|
155
158
|
}
|
|
156
|
-
guardPhases.push(
|
|
159
|
+
guardPhases.push(phase);
|
|
157
160
|
});
|
|
158
161
|
const rawPresentation = rawStep.presentation;
|
|
159
162
|
let presentation = { mode: "page" };
|
|
@@ -170,12 +173,12 @@ function compileWorkflowStructure(input, options) {
|
|
|
170
173
|
}
|
|
171
174
|
if (rawStep.readiness !== void 0 && rawStep.readiness !== "implemented" && rawStep.readiness !== "placeholder") addIssue(issues, "step.readiness.invalid", `${stepPath}.readiness`, "Step readiness must be implemented or placeholder");
|
|
172
175
|
if (rawStep.end !== void 0 && rawStep.end !== "success" && rawStep.end !== "blocked") addIssue(issues, "step.end.invalid", `${stepPath}.end`, "Step end must be success or blocked");
|
|
173
|
-
if (rawStep.on !== void 0 && !isRecord(rawStep.on)) addIssue(issues, "step.
|
|
176
|
+
if (rawStep.on !== void 0 && !isRecord(rawStep.on)) addIssue(issues, "step.intents.invalid", `${stepPath}.on`, "Step intents must be an object");
|
|
174
177
|
const transitions = {};
|
|
175
|
-
const addTransition = (
|
|
178
|
+
const addTransition = (intent, rawTarget, path) => {
|
|
176
179
|
var _activity$exitPolicie;
|
|
177
|
-
if (!activity.
|
|
178
|
-
addIssue(issues, "activity.
|
|
180
|
+
if (!activity.intents.some((availableIntent) => availableIntent === intent)) {
|
|
181
|
+
addIssue(issues, "activity.intent.unknown", path, `Activity ${activity.id} does not expose intent ${intent}`);
|
|
179
182
|
return;
|
|
180
183
|
}
|
|
181
184
|
let targetValue = rawTarget;
|
|
@@ -185,12 +188,12 @@ function compileWorkflowStructure(input, options) {
|
|
|
185
188
|
"target",
|
|
186
189
|
"repeat",
|
|
187
190
|
"operation",
|
|
188
|
-
"
|
|
191
|
+
"precondition",
|
|
189
192
|
"failureTarget"
|
|
190
193
|
], path, issues);
|
|
191
194
|
[
|
|
192
195
|
"operation",
|
|
193
|
-
"
|
|
196
|
+
"precondition",
|
|
194
197
|
"failureTarget"
|
|
195
198
|
].forEach((field) => {
|
|
196
199
|
if (rawTarget[field] !== void 0) addIssue(issues, "transition.untrustedField", `${path}.${field}`, `${field} belongs to the local Activity Contract`);
|
|
@@ -203,15 +206,15 @@ function compileWorkflowStructure(input, options) {
|
|
|
203
206
|
return;
|
|
204
207
|
}
|
|
205
208
|
const symbolicTarget = targetValue.trim();
|
|
206
|
-
const target = symbolicTarget === "$next" ? stepIds[index + 1] : symbolicTarget
|
|
209
|
+
const target = symbolicTarget === "$next" ? stepIds[index + 1] : symbolicTarget;
|
|
207
210
|
if (!target) {
|
|
208
|
-
addIssue(issues,
|
|
211
|
+
addIssue(issues, "transition.next.missing", path, `${symbolicTarget} does not exist for step ${stepId}`);
|
|
209
212
|
return;
|
|
210
213
|
}
|
|
211
|
-
const exitPolicy = (_activity$exitPolicie = activity.exitPolicies) === null || _activity$exitPolicie === void 0 ? void 0 : _activity$exitPolicie[
|
|
212
|
-
if ((exitPolicy === null || exitPolicy === void 0 ? void 0 : exitPolicy.
|
|
214
|
+
const exitPolicy = (_activity$exitPolicie = activity.exitPolicies) === null || _activity$exitPolicie === void 0 ? void 0 : _activity$exitPolicie[intent];
|
|
215
|
+
if ((exitPolicy === null || exitPolicy === void 0 ? void 0 : exitPolicy.precondition) && !predicates.has(exitPolicy.precondition)) addIssue(issues, "activity.precondition.unknown", path, `Activity ${activity.id} uses unknown precondition predicate ${exitPolicy.precondition}`);
|
|
213
216
|
if ((exitPolicy === null || exitPolicy === void 0 ? void 0 : exitPolicy.command) && !options.operations.has(exitPolicy.command.id)) addIssue(issues, "activity.command.unknown", path, `Activity ${activity.id} uses unknown command ${exitPolicy.command.id}`);
|
|
214
|
-
transitions[
|
|
217
|
+
transitions[intent] = Object.freeze({
|
|
215
218
|
target,
|
|
216
219
|
exitPolicy,
|
|
217
220
|
repeat
|
|
@@ -219,15 +222,11 @@ function compileWorkflowStructure(input, options) {
|
|
|
219
222
|
};
|
|
220
223
|
if (index + 1 < rawSteps.length) {
|
|
221
224
|
var _activity$navigation;
|
|
222
|
-
(_activity$navigation = activity.navigation) === null || _activity$navigation === void 0 || (_activity$navigation = _activity$navigation.forward) === null || _activity$navigation === void 0 || _activity$navigation.forEach((
|
|
223
|
-
}
|
|
224
|
-
if (index > 0) {
|
|
225
|
-
var _activity$navigation2;
|
|
226
|
-
(_activity$navigation2 = activity.navigation) === null || _activity$navigation2 === void 0 || (_activity$navigation2 = _activity$navigation2.backward) === null || _activity$navigation2 === void 0 || _activity$navigation2.forEach((outcome) => addTransition(outcome, "$prev", `${stepPath}.navigation.${outcome}`));
|
|
225
|
+
(_activity$navigation = activity.navigation) === null || _activity$navigation === void 0 || (_activity$navigation = _activity$navigation.forward) === null || _activity$navigation === void 0 || _activity$navigation.forEach((intent) => addTransition(intent, "$next", `${stepPath}.navigation.${intent}`));
|
|
227
226
|
}
|
|
228
227
|
const rawTransitions = isRecord(rawStep.on) ? rawStep.on : {};
|
|
229
|
-
Object.entries(rawTransitions).forEach(([
|
|
230
|
-
addTransition(
|
|
228
|
+
Object.entries(rawTransitions).forEach(([intent, transition]) => {
|
|
229
|
+
addTransition(intent, transition, `${stepPath}.on.${intent}`);
|
|
231
230
|
});
|
|
232
231
|
transitionCount += Object.keys(transitions).length;
|
|
233
232
|
nodes[stepId] = Object.freeze({
|
|
@@ -236,6 +235,7 @@ function compileWorkflowStructure(input, options) {
|
|
|
236
235
|
screenId: activity.screenId,
|
|
237
236
|
presentation,
|
|
238
237
|
readiness: rawStep.readiness === "placeholder" ? "placeholder" : void 0,
|
|
238
|
+
visitPolicy: rawStep.visitPolicy === "reuseResolution" || rawStep.visitPolicy === "once" ? rawStep.visitPolicy : "always",
|
|
239
239
|
guardPhases: Object.freeze([...guardPhases]),
|
|
240
240
|
on: Object.freeze(transitions),
|
|
241
241
|
end: rawStep.end === "success" || rawStep.end === "blocked" ? rawStep.end : void 0
|
|
@@ -255,18 +255,17 @@ function compileWorkflowStructure(input, options) {
|
|
|
255
255
|
const transitions = Object.entries(node.on).filter((entry) => entry[1]);
|
|
256
256
|
if (!node.end && transitions.length === 0) addIssue(issues, "step.deadEnd", path, "A step without outgoing transitions must declare its end state");
|
|
257
257
|
if (node.end && transitions.length > 0) addIssue(issues, "step.end.hasTransitions", path, "An end step cannot expose outgoing transitions");
|
|
258
|
-
transitions.forEach(([
|
|
259
|
-
var _stepIndex$get2, _stepIndex$get3
|
|
258
|
+
transitions.forEach(([intent, transition]) => {
|
|
259
|
+
var _stepIndex$get2, _stepIndex$get3;
|
|
260
260
|
if (!transition) return;
|
|
261
261
|
if (!nodes[transition.target]) {
|
|
262
|
-
addIssue(issues, "transition.target.missing", `${path}.on.${
|
|
262
|
+
addIssue(issues, "transition.target.missing", `${path}.on.${intent}`, `Target step does not exist: ${transition.target}`);
|
|
263
263
|
return;
|
|
264
264
|
}
|
|
265
265
|
const sourceIndex = (_stepIndex$get2 = stepIndex.get(stepId)) !== null && _stepIndex$get2 !== void 0 ? _stepIndex$get2 : -1;
|
|
266
|
-
const
|
|
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");
|
|
266
|
+
const needsBound = ((_stepIndex$get3 = stepIndex.get(transition.target)) !== null && _stepIndex$get3 !== void 0 ? _stepIndex$get3 : -1) <= sourceIndex;
|
|
267
|
+
if (needsBound && !transition.repeat) addIssue(issues, "transition.cycle.unbounded", `${path}.on.${intent}`, "A jump to the same or an earlier step requires a repeat limit");
|
|
268
|
+
if (!needsBound && transition.repeat) addIssue(issues, "transition.repeat.unnecessary", `${path}.on.${intent}.repeat`, "Repeat limits are only valid on cyclic jumps");
|
|
270
269
|
});
|
|
271
270
|
});
|
|
272
271
|
const initial = (_stepIds$ = stepIds[0]) !== null && _stepIds$ !== void 0 ? _stepIds$ : "";
|
|
@@ -0,0 +1,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";
|
|
@@ -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 = ((_activeNode$presentat = activeNode.presentation) === null || _activeNode$presentat === void 0 ? void 0 : _activeNode$presentat.mode) === "modal" ? session.definition.nodes[activeNode.presentation.base] : 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,
|
|
@@ -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,
|
|
@@ -13,8 +13,8 @@ function createDomainWorkflowError(code, recovery = "staff", cause) {
|
|
|
13
13
|
cause
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
-
function createHDLKioskTransitionRunner({ host, coordinator,
|
|
17
|
-
const emitError = (error, workflowId, stepId,
|
|
16
|
+
function createHDLKioskTransitionRunner({ host, coordinator, predicates, now = Date.now }) {
|
|
17
|
+
const emitError = (error, workflowId, stepId, intent) => {
|
|
18
18
|
try {
|
|
19
19
|
host.telemetry.emit({
|
|
20
20
|
name: "hdlKiosk.error.reported",
|
|
@@ -26,7 +26,7 @@ function createHDLKioskTransitionRunner({ host, coordinator, guards, now = Date.
|
|
|
26
26
|
recovery: error.recovery,
|
|
27
27
|
workflowId,
|
|
28
28
|
nodeId: stepId,
|
|
29
|
-
|
|
29
|
+
intent
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
32
|
} catch (_unused) {}
|
|
@@ -35,14 +35,14 @@ function createHDLKioskTransitionRunner({ host, coordinator, guards, now = Date.
|
|
|
35
35
|
run: function() {
|
|
36
36
|
var _ref = _asyncToGenerator(function* ({ workflowId, sessionEpoch, stepId, context, event, transition, executionId }) {
|
|
37
37
|
const exitPolicy = transition.exitPolicy;
|
|
38
|
-
if (exitPolicy === null || exitPolicy === void 0 ? void 0 : exitPolicy.
|
|
39
|
-
if (!
|
|
38
|
+
if (exitPolicy === null || exitPolicy === void 0 ? void 0 : exitPolicy.precondition) try {
|
|
39
|
+
if (!predicates.evaluate(exitPolicy.precondition, {
|
|
40
40
|
workflow: context,
|
|
41
41
|
sales: host.sales.getObservedSnapshot()
|
|
42
42
|
})) return { status: "stay" };
|
|
43
43
|
} catch (cause) {
|
|
44
|
-
const error = createDomainWorkflowError("
|
|
45
|
-
emitError(error, workflowId, stepId, event.
|
|
44
|
+
const error = createDomainWorkflowError("workflowPredicateEvaluationFailed", "staff", cause);
|
|
45
|
+
emitError(error, workflowId, stepId, event.intent);
|
|
46
46
|
return {
|
|
47
47
|
status: "blocked",
|
|
48
48
|
lastError: error
|
|
@@ -50,7 +50,7 @@ function createHDLKioskTransitionRunner({ host, coordinator, guards, now = Date.
|
|
|
50
50
|
}
|
|
51
51
|
const operationInput = "operationInput" in event ? event.operationInput : void 0;
|
|
52
52
|
const command = exitPolicy === null || exitPolicy === void 0 ? void 0 : exitPolicy.command;
|
|
53
|
-
if (!command
|
|
53
|
+
if (!command) return { status: "advance" };
|
|
54
54
|
const result = yield coordinator.execute(command.id, {
|
|
55
55
|
operationId: executionId,
|
|
56
56
|
intentId: event.intentId,
|
|
@@ -59,7 +59,7 @@ function createHDLKioskTransitionRunner({ host, coordinator, guards, now = Date.
|
|
|
59
59
|
});
|
|
60
60
|
if (coordinator.currentSessionEpoch() !== sessionEpoch) {
|
|
61
61
|
const error = createDomainWorkflowError("workflowSessionStale");
|
|
62
|
-
emitError(error, workflowId, stepId, event.
|
|
62
|
+
emitError(error, workflowId, stepId, event.intent);
|
|
63
63
|
return {
|
|
64
64
|
status: "blocked",
|
|
65
65
|
lastError: error
|
|
@@ -4,11 +4,16 @@ import { _objectWithoutProperties } from "../../../_virtual/_@oxc-project_runtim
|
|
|
4
4
|
const _excluded = ["kind"];
|
|
5
5
|
function createWorkflowEvent(action, currentActivity, stepId, intentId) {
|
|
6
6
|
if (action.activityId !== currentActivity) return void 0;
|
|
7
|
-
const { kind: _kind } = action,
|
|
8
|
-
return
|
|
9
|
-
type: "
|
|
7
|
+
const { kind: _kind } = action, payload = _objectWithoutProperties(action, _excluded);
|
|
8
|
+
return action.kind === "navigation" ? {
|
|
9
|
+
type: "NAVIGATE_BACK",
|
|
10
|
+
stepId,
|
|
11
|
+
activityId: action.activityId,
|
|
12
|
+
intentId
|
|
13
|
+
} : _objectSpread2(_objectSpread2({
|
|
14
|
+
type: "ACTIVITY_INTENT",
|
|
10
15
|
stepId
|
|
11
|
-
},
|
|
16
|
+
}, payload), {}, { intentId });
|
|
12
17
|
}
|
|
13
18
|
//#endregion
|
|
14
19
|
export { createWorkflowEvent };
|
|
@@ -13,7 +13,7 @@ function createHDLKioskWorkflowLifecycle(host, now = Date.now) {
|
|
|
13
13
|
workflowId: snapshot.workflowId,
|
|
14
14
|
from: fromStepId,
|
|
15
15
|
to: snapshot.nodeId,
|
|
16
|
-
|
|
16
|
+
intent: event.intent
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
} catch (_unused) {}
|
|
@@ -22,7 +22,7 @@ function createHDLKioskWorkflowLifecycle(host, now = Date.now) {
|
|
|
22
22
|
return _ref.apply(this, arguments);
|
|
23
23
|
};
|
|
24
24
|
}(),
|
|
25
|
-
runtimeError: ({ stepId,
|
|
25
|
+
runtimeError: ({ stepId, intent, error }) => {
|
|
26
26
|
try {
|
|
27
27
|
host.telemetry.emit({
|
|
28
28
|
name: "hdlKiosk.error.reported",
|
|
@@ -33,7 +33,7 @@ function createHDLKioskWorkflowLifecycle(host, now = Date.now) {
|
|
|
33
33
|
source: error.source,
|
|
34
34
|
recovery: error.recovery,
|
|
35
35
|
nodeId: stepId,
|
|
36
|
-
|
|
36
|
+
intent
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
39
|
} catch (_unused2) {}
|
|
@@ -4,8 +4,7 @@ import { locales } from "@pisell/utils";
|
|
|
4
4
|
//#region src/components/HDLKiosk/slices/catalog/PrimaryProductPromptDialog/index.tsx
|
|
5
5
|
/**
|
|
6
6
|
* 文件角色:在 Barcode 商品列表结账前询问是否需要称重麻辣烫主商品。
|
|
7
|
-
*
|
|
8
|
-
* Activity 的最终 Outcome。
|
|
7
|
+
* 运行机制:由独立 PrimaryProductPrompt Activity 作为 Modal 渲染在 Catalog 上层。
|
|
9
8
|
* 边界:不判断购物车是否已有主商品,不直接接触 Workflow、查询商品或写购物车。
|
|
10
9
|
*/
|
|
11
10
|
function BagIcon() {
|
|
@@ -3,7 +3,6 @@ import ProductCard from "../../../../../plus/productSelect/ProductCard/index.js"
|
|
|
3
3
|
import List_default from "../../../../list/List.js";
|
|
4
4
|
import KioskCategorySidebar from "../../../../bigSale/components/KioskCategorySidebar/index.js";
|
|
5
5
|
import { useHDLKioskBottomBar, useHDLKioskBottomBarController } from "../../../components/shell/HDLKioskBottomBarHost/index.js";
|
|
6
|
-
import { PrimaryProductPromptDialog } from "../PrimaryProductPromptDialog/index.js";
|
|
7
6
|
import { HDLKioskOrderSummary } from "../../../components/shell/HDLKioskOrderSummary/index.js";
|
|
8
7
|
import { KIOSK_CATALOG_PRODUCT_CARD_CLASS_NAME, createKioskCatalogProductCardConfig } from "../../../../../plus/productSelect/ProductCard/presets/kioskCatalog.js";
|
|
9
8
|
import { createHDLCatalogCategories, filterHDLCatalogProducts } from "./model.js";
|
|
@@ -13,7 +12,7 @@ import { locales } from "@pisell/utils";
|
|
|
13
12
|
/**
|
|
14
13
|
* 文件角色:呈现 retail 风格补充商品目录、分类、搜索和加购反馈。
|
|
15
14
|
* 运行机制:只消费已由 Host 筛选/报价的 Catalog Projection;加购走 Screen Command,
|
|
16
|
-
*
|
|
15
|
+
* Checkout 产生 Activity Intent,Back 产生 Navigation,购物车开合仅为局部 UI。
|
|
17
16
|
* 边界:不调用 loadCatalog/queryProducts,不本地追加订单行,也不计算促销价。
|
|
18
17
|
*/
|
|
19
18
|
/**
|
|
@@ -72,14 +71,13 @@ function PlusIcon() {
|
|
|
72
71
|
"aria-hidden": "true"
|
|
73
72
|
}, /* @__PURE__ */ React.createElement("path", { d: "M12 5v14M5 12h14" }));
|
|
74
73
|
}
|
|
75
|
-
function CatalogScreen({ products, loading, errorReference, errorMessage, busy, canReview, canGoBack,
|
|
74
|
+
function CatalogScreen({ products, loading, errorReference, errorMessage, busy, canReview, canGoBack, orderBar, send }) {
|
|
76
75
|
var _categoryById$get;
|
|
77
76
|
const categories = useMemo(() => createHDLCatalogCategories(products, locales.getText("pisell2.hdl-kiosk.catalog-other")), [locales.getText("pisell2.hdl-kiosk.catalog-other"), products]);
|
|
78
77
|
const categoryMenuDataSource = useMemo(() => createCatalogCategoryMenuDataSource(categories), [categories]);
|
|
79
78
|
const [activeCategoryPath, setActiveCategoryPath] = useState([]);
|
|
80
79
|
const [query, setQuery] = useState("");
|
|
81
80
|
const [sidebarSearchOpen, setSidebarSearchOpen] = useState(false);
|
|
82
|
-
const [primaryProductPromptOpen, setPrimaryProductPromptOpen] = useState(false);
|
|
83
81
|
const catalogMainRef = useRef(null);
|
|
84
82
|
const categoryPathBeforeSearchRef = useRef([]);
|
|
85
83
|
const categoryById = useMemo(() => indexCatalogCategories(categories), [categories]);
|
|
@@ -107,35 +105,28 @@ function CatalogScreen({ products, loading, errorReference, errorMessage, busy,
|
|
|
107
105
|
const productListItems = useMemo(() => visibleProducts.map(createCatalogProductListItem), [visibleProducts]);
|
|
108
106
|
const title = normalizedQuery ? locales.getText("pisell2.hdl-kiosk.catalog-search-results") : (activeCategory === null || activeCategory === void 0 ? void 0 : activeCategory.name) || locales.getText("pisell2.hdl-kiosk.catalog-title");
|
|
109
107
|
const completeCatalog = useCallback(() => {
|
|
110
|
-
if (!busy && canReview) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
send({
|
|
116
|
-
kind: "outcome",
|
|
117
|
-
outcome: "completed"
|
|
118
|
-
});
|
|
119
|
-
}
|
|
108
|
+
if (!busy && canReview) send({
|
|
109
|
+
kind: "intent",
|
|
110
|
+
intent: "complete"
|
|
111
|
+
});
|
|
120
112
|
}, [
|
|
121
113
|
busy,
|
|
122
114
|
canReview,
|
|
123
|
-
promptForPrimaryProduct,
|
|
124
115
|
send
|
|
125
116
|
]);
|
|
126
|
-
const primaryActionLabel =
|
|
117
|
+
const primaryActionLabel = locales.getText("pisell2.hdl-kiosk.checkout");
|
|
127
118
|
const { openCart } = useHDLKioskBottomBarController();
|
|
128
119
|
useHDLKioskBottomBar(useMemo(() => ({
|
|
129
120
|
ariaLabel: locales.getText("pisell2.hdl-kiosk.catalog-actions-label"),
|
|
130
121
|
cartEnabled: canReview,
|
|
131
|
-
overlayActive:
|
|
122
|
+
overlayActive: sidebarSearchOpen,
|
|
132
123
|
leading: canGoBack ? /* @__PURE__ */ React.createElement("button", {
|
|
133
124
|
type: "button",
|
|
134
125
|
className: "hdl-floating-bar__button",
|
|
135
126
|
disabled: busy,
|
|
136
127
|
onClick: () => send({
|
|
137
|
-
kind: "
|
|
138
|
-
|
|
128
|
+
kind: "navigation",
|
|
129
|
+
direction: "back"
|
|
139
130
|
})
|
|
140
131
|
}, /* @__PURE__ */ React.createElement(BackIcon, null), /* @__PURE__ */ React.createElement("span", null, locales.getText("pisell2.hdl-kiosk.back"))) : void 0,
|
|
141
132
|
summary: /* @__PURE__ */ React.createElement(HDLKioskOrderSummary, {
|
|
@@ -176,10 +167,8 @@ function CatalogScreen({ products, loading, errorReference, errorMessage, busy,
|
|
|
176
167
|
canReview,
|
|
177
168
|
openCart,
|
|
178
169
|
orderBar,
|
|
179
|
-
primaryProductPromptOpen,
|
|
180
170
|
sidebarSearchOpen,
|
|
181
171
|
primaryActionLabel,
|
|
182
|
-
primaryAction,
|
|
183
172
|
completeCatalog,
|
|
184
173
|
send
|
|
185
174
|
]));
|
|
@@ -270,23 +259,7 @@ function CatalogScreen({ products, loading, errorReference, errorMessage, busy,
|
|
|
270
259
|
})
|
|
271
260
|
});
|
|
272
261
|
}
|
|
273
|
-
})))))
|
|
274
|
-
busy,
|
|
275
|
-
onDecline: () => {
|
|
276
|
-
setPrimaryProductPromptOpen(false);
|
|
277
|
-
send({
|
|
278
|
-
kind: "outcome",
|
|
279
|
-
outcome: "completed"
|
|
280
|
-
});
|
|
281
|
-
},
|
|
282
|
-
onAccept: () => {
|
|
283
|
-
setPrimaryProductPromptOpen(false);
|
|
284
|
-
send({
|
|
285
|
-
kind: "outcome",
|
|
286
|
-
outcome: "primaryProductRequested"
|
|
287
|
-
});
|
|
288
|
-
}
|
|
289
|
-
}) : null);
|
|
262
|
+
}))))));
|
|
290
263
|
}
|
|
291
264
|
//#endregion
|
|
292
265
|
export { CatalogScreen };
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { _objectSpread2 } from "../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
|
|
2
2
|
//#region src/components/HDLKiosk/slices/catalog/Screen/model.ts
|
|
3
3
|
const HDL_CATALOG_OTHER_CATEGORY_ID = "__other__";
|
|
4
|
-
/** 扫码目录仍需继续确认主商品;普通目录的商品选择完成后可直接 Checkout。 */
|
|
5
|
-
function resolveCatalogPrimaryAction(activity) {
|
|
6
|
-
return activity === "catalogWithPrimaryProductPrompt" ? "next" : "checkout";
|
|
7
|
-
}
|
|
8
4
|
function bySortThenName(left, right) {
|
|
9
5
|
return right.sort - left.sort || left.name.localeCompare(right.name);
|
|
10
6
|
}
|
|
@@ -75,4 +71,4 @@ function filterHDLCatalogProducts(products, input) {
|
|
|
75
71
|
return candidates;
|
|
76
72
|
}
|
|
77
73
|
//#endregion
|
|
78
|
-
export { createHDLCatalogCategories, filterHDLCatalogProducts
|
|
74
|
+
export { createHDLCatalogCategories, filterHDLCatalogProducts };
|
|
@@ -1,24 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineSlice, intentPrecondition } from "../../kernel/application/defineSlice.js";
|
|
2
2
|
import { cartAddProductOperation } from "../../app/operations/cart.js";
|
|
3
3
|
//#region src/components/HDLKiosk/slices/catalog/slice.ts
|
|
4
|
-
/** Catalog Slice
|
|
4
|
+
/** Catalog Slice:声明补充商品加购;商品浏览动作不进入 Workflow。 */
|
|
5
5
|
const catalogSlice = defineSlice({
|
|
6
6
|
id: "catalog",
|
|
7
7
|
screen: { id: "catalog" },
|
|
8
8
|
commands: { addProduct: cartAddProductOperation },
|
|
9
|
-
|
|
10
|
-
completed: guard("cart.notEmpty", { navigate: "next" }),
|
|
11
|
-
back: back()
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
const catalogWithPrimaryProductPromptSlice = defineSlice({
|
|
15
|
-
id: "catalogWithPrimaryProductPrompt",
|
|
16
|
-
screen: { id: "catalog" },
|
|
17
|
-
commands: { addProduct: cartAddProductOperation },
|
|
18
|
-
outcomes: {
|
|
19
|
-
completed: guard("cart.notEmpty", { navigate: "next" }),
|
|
20
|
-
primaryProductRequested: guard("cart.notEmpty", { navigate: "next" })
|
|
21
|
-
}
|
|
9
|
+
intents: { complete: intentPrecondition("cart.notEmpty", { navigate: "next" }) }
|
|
22
10
|
});
|
|
23
11
|
//#endregion
|
|
24
|
-
export { catalogSlice
|
|
12
|
+
export { catalogSlice };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _objectSpread2 } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
|
|
2
|
+
import { canNavigateBack } from "../../kernel/workflow/selectors.js";
|
|
2
3
|
import { createOrderBarModel, resolveHDLKioskErrorPresentation } from "../../utils.js";
|
|
3
|
-
import { resolveCatalogPrimaryAction } from "./Screen/model.js";
|
|
4
4
|
import { CatalogScreen } from "./Screen/index.js";
|
|
5
5
|
import React from "react";
|
|
6
6
|
//#region src/components/HDLKiosk/slices/catalog/view.tsx
|
|
@@ -14,8 +14,8 @@ function createCatalogOrderBarModel(sales) {
|
|
|
14
14
|
}, {});
|
|
15
15
|
return Object.freeze(_objectSpread2(_objectSpread2({}, order), {}, { quantitiesByProduct: Object.freeze(quantitiesByProduct) }));
|
|
16
16
|
}
|
|
17
|
-
const renderCatalog = ({
|
|
18
|
-
var _commandState$error
|
|
17
|
+
const renderCatalog = ({ snapshot, viewSnapshot, sales, commandState, catalog, send }) => {
|
|
18
|
+
var _commandState$error;
|
|
19
19
|
const error = resolveHDLKioskErrorPresentation({
|
|
20
20
|
error: (_commandState$error = commandState.error) !== null && _commandState$error !== void 0 ? _commandState$error : snapshot.lastError,
|
|
21
21
|
reference: catalog.errorReference,
|
|
@@ -28,9 +28,7 @@ const renderCatalog = ({ node, snapshot, viewSnapshot, sales, commandState, cata
|
|
|
28
28
|
errorMessage: error === null || error === void 0 ? void 0 : error.message,
|
|
29
29
|
busy: viewSnapshot.status === "running",
|
|
30
30
|
canReview: sales.cart.lineCount > 0,
|
|
31
|
-
canGoBack:
|
|
32
|
-
promptForPrimaryProduct: node.activity === "catalogWithPrimaryProductPrompt" && !sales.cart.lines.some((line) => line.productId === snapshot.context.primaryWeightedProductId),
|
|
33
|
-
primaryAction: resolveCatalogPrimaryAction(node.activity),
|
|
31
|
+
canGoBack: canNavigateBack(snapshot),
|
|
34
32
|
orderBar: createCatalogOrderBarModel(sales),
|
|
35
33
|
send
|
|
36
34
|
});
|
|
@@ -163,7 +163,6 @@ function CustomizationScreen({ product, loading, errorReference, errorMessage, b
|
|
|
163
163
|
const skuOptionsRef = useRef(null);
|
|
164
164
|
const hydratedDraftKeyRef = useRef();
|
|
165
165
|
const [skuValue, setSkuValue] = useState(() => initialSkuValue(product));
|
|
166
|
-
console.log("xxxxxxxxx", product, skuValue);
|
|
167
166
|
const productFacts = useMemo(() => product ? resolveHDLWeightedProduct(product) : void 0, [product]);
|
|
168
167
|
const draftHydrationKey = JSON.stringify([
|
|
169
168
|
(_productFacts$product = productFacts === null || productFacts === void 0 ? void 0 : productFacts.productId) !== null && _productFacts$product !== void 0 ? _productFacts$product : "",
|
|
@@ -212,8 +211,8 @@ function CustomizationScreen({ product, loading, errorReference, errorMessage, b
|
|
|
212
211
|
}
|
|
213
212
|
const submittedSkuValue = (_skuOptionsRef$curren2 = (_skuOptionsRef$curren3 = skuOptionsRef.current) === null || _skuOptionsRef$curren3 === void 0 ? void 0 : _skuOptionsRef$curren3.getTransformValues()) !== null && _skuOptionsRef$curren2 !== void 0 ? _skuOptionsRef$curren2 : skuValue;
|
|
214
213
|
send({
|
|
215
|
-
kind: "
|
|
216
|
-
|
|
214
|
+
kind: "intent",
|
|
215
|
+
intent: "complete",
|
|
217
216
|
operationInput: {
|
|
218
217
|
productId: productFacts.productId,
|
|
219
218
|
variantId: productFacts.variantId,
|
|
@@ -244,11 +243,10 @@ function CustomizationScreen({ product, loading, errorReference, errorMessage, b
|
|
|
244
243
|
]);
|
|
245
244
|
const skipPrimaryProduct = useCallback(() => {
|
|
246
245
|
var _orderBar$primaryLine10;
|
|
247
|
-
const lineId = (_orderBar$primaryLine10 = orderBar.primaryLine) === null || _orderBar$primaryLine10 === void 0 ? void 0 : _orderBar$primaryLine10.lineId;
|
|
248
246
|
send({
|
|
249
|
-
kind: "
|
|
250
|
-
|
|
251
|
-
operationInput: lineId
|
|
247
|
+
kind: "intent",
|
|
248
|
+
intent: "skip",
|
|
249
|
+
operationInput: { lineId: (_orderBar$primaryLine10 = orderBar.primaryLine) === null || _orderBar$primaryLine10 === void 0 ? void 0 : _orderBar$primaryLine10.lineId }
|
|
252
250
|
});
|
|
253
251
|
}, [(_orderBar$primaryLine11 = orderBar.primaryLine) === null || _orderBar$primaryLine11 === void 0 ? void 0 : _orderBar$primaryLine11.lineId, send]);
|
|
254
252
|
const { openCart } = useHDLKioskBottomBarController();
|
|
@@ -260,8 +258,8 @@ function CustomizationScreen({ product, loading, errorReference, errorMessage, b
|
|
|
260
258
|
className: "hdl-floating-bar__button",
|
|
261
259
|
disabled: busy || syncing,
|
|
262
260
|
onClick: () => send({
|
|
263
|
-
kind: "
|
|
264
|
-
|
|
261
|
+
kind: "navigation",
|
|
262
|
+
direction: "back"
|
|
265
263
|
})
|
|
266
264
|
}, /* @__PURE__ */ React.createElement(BackIcon, null), /* @__PURE__ */ React.createElement("span", null, locales.getText("pisell2.hdl-kiosk.back"))) : void 0,
|
|
267
265
|
summary: /* @__PURE__ */ React.createElement(HDLKioskOrderSummary, {
|