@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
|
@@ -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,
|
|
@@ -242,13 +241,12 @@ function CustomizationScreen({ product, loading, errorReference, errorMessage, b
|
|
|
242
241
|
send,
|
|
243
242
|
syncing
|
|
244
243
|
]);
|
|
245
|
-
const
|
|
244
|
+
const omitPrimaryProduct = 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: "omit",
|
|
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, {
|
|
@@ -334,7 +332,7 @@ function CustomizationScreen({ product, loading, errorReference, errorMessage, b
|
|
|
334
332
|
type: "button",
|
|
335
333
|
className: "hdl-customization-skip",
|
|
336
334
|
disabled: busy || syncing,
|
|
337
|
-
onClick:
|
|
335
|
+
onClick: omitPrimaryProduct
|
|
338
336
|
}, locales.getText("pisell2.hdl-kiosk.customization-skip")));
|
|
339
337
|
}
|
|
340
338
|
//#endregion
|
|
@@ -11,6 +11,25 @@ import Decimal from "decimal.js";
|
|
|
11
11
|
* SkuValue 和“新增或原行发生变化”的最小 receipt/Projection 事实。
|
|
12
12
|
* 边界:页面输入变化不调用本 Operation;OS 内部的加购弹窗与业务判断不属于 HDLKiosk。
|
|
13
13
|
*/
|
|
14
|
+
const productRemovePrimaryProductOperation = defineOperation({
|
|
15
|
+
id: "product.removePrimaryProduct",
|
|
16
|
+
conflictScope: "cart",
|
|
17
|
+
timeoutMs: 15e3,
|
|
18
|
+
retry: "explicit-user",
|
|
19
|
+
execute: function() {
|
|
20
|
+
var _ref = _asyncToGenerator(function* (context, input, signal) {
|
|
21
|
+
if (!input.lineId) return {
|
|
22
|
+
status: "succeeded",
|
|
23
|
+
data: {}
|
|
24
|
+
};
|
|
25
|
+
const mutation = yield context.host.sales.removeLine({ lineId: input.lineId }, signal);
|
|
26
|
+
return finalizeCartMutation(context, mutation, signal, () => mutation.status === "succeeded" && mutation.data.removedLineId === input.lineId || !context.host.sales.getObservedSnapshot().cart.lines.some((item) => item.lineId === input.lineId));
|
|
27
|
+
});
|
|
28
|
+
return function execute(_x, _x2, _x3) {
|
|
29
|
+
return _ref.apply(this, arguments);
|
|
30
|
+
};
|
|
31
|
+
}()
|
|
32
|
+
});
|
|
14
33
|
function hasValidSkuValue(input) {
|
|
15
34
|
const canonical = canonicalizeSkuValue(input.skuValue);
|
|
16
35
|
return Boolean(input.productId && canonical && canonical.productId === input.productId);
|
|
@@ -29,7 +48,7 @@ const productSyncPrimaryWeightedProductOperation = defineOperation({
|
|
|
29
48
|
conflictScope: "cart",
|
|
30
49
|
retry: "explicit-user",
|
|
31
50
|
execute: function() {
|
|
32
|
-
var
|
|
51
|
+
var _ref2 = _asyncToGenerator(function* (context, input, signal) {
|
|
33
52
|
if (!hasValidSkuValue(input)) return operationFailed("customizationInputInvalid", "back");
|
|
34
53
|
const beforeLines = new Map(context.host.sales.getObservedSnapshot().cart.lines.map((line) => [line.lineId, line.quantity]));
|
|
35
54
|
const before = context.host.sales.getObservedSnapshot();
|
|
@@ -52,10 +71,10 @@ const productSyncPrimaryWeightedProductOperation = defineOperation({
|
|
|
52
71
|
return Boolean(confirmedLine && confirmedLine.productId === input.productId && (!(successfulOutcome === null || successfulOutcome === void 0 ? void 0 : successfulOutcome.affectedLineId) || confirmedLine.lineId === successfulOutcome.affectedLineId) && (!input.existingLineId || (successfulOutcome === null || successfulOutcome === void 0 ? void 0 : successfulOutcome.affectedLineId) === input.existingLineId && confirmedLine.lineId === input.existingLineId) && sameWeight(confirmedLine.quantity, input.measurement.netWeightKg) && sameSkuValue(input.skuValue, confirmedLine.skuValue) && (Boolean(input.existingLineId) || !beforeLines.has(confirmedLine.lineId) || beforeLines.get(confirmedLine.lineId) !== confirmedLine.quantity)) || projectionMatches;
|
|
53
72
|
});
|
|
54
73
|
});
|
|
55
|
-
return function execute(
|
|
56
|
-
return
|
|
74
|
+
return function execute(_x4, _x5, _x6) {
|
|
75
|
+
return _ref2.apply(this, arguments);
|
|
57
76
|
};
|
|
58
77
|
}()
|
|
59
78
|
});
|
|
60
79
|
//#endregion
|
|
61
|
-
export { productSyncPrimaryWeightedProductOperation };
|
|
80
|
+
export { productRemovePrimaryProductOperation, productSyncPrimaryWeightedProductOperation };
|
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineSlice, effect } from "../../kernel/application/defineSlice.js";
|
|
2
2
|
import { cartRemoveLineOperation } from "../../app/operations/cart.js";
|
|
3
|
-
import { productSyncPrimaryWeightedProductOperation } from "./operation.js";
|
|
3
|
+
import { productRemovePrimaryProductOperation, productSyncPrimaryWeightedProductOperation } from "./operation.js";
|
|
4
4
|
//#region src/components/HDLKiosk/slices/customization/slice.ts
|
|
5
5
|
/** Customization Slice:Next 时才提交本地称重草稿;加购成功后才离开。 */
|
|
6
6
|
const customizationSlice = defineSlice({
|
|
7
7
|
id: "customization",
|
|
8
8
|
screen: { id: "customization" },
|
|
9
9
|
commands: { removePrimaryProduct: cartRemoveLineOperation },
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
when: "inputPresent",
|
|
14
|
-
navigate: "next"
|
|
15
|
-
}),
|
|
16
|
-
back: back()
|
|
10
|
+
intents: {
|
|
11
|
+
complete: effect(productSyncPrimaryWeightedProductOperation, { navigate: "next" }),
|
|
12
|
+
omit: effect(productRemovePrimaryProductOperation, { navigate: "next" })
|
|
17
13
|
}
|
|
18
14
|
});
|
|
19
15
|
//#endregion
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { canNavigateBack } from "../../kernel/workflow/selectors.js";
|
|
1
2
|
import { resolveHDLKioskErrorPresentation } from "../../utils.js";
|
|
2
3
|
import { CustomizationScreen } from "./Screen/index.js";
|
|
3
4
|
import React from "react";
|
|
@@ -16,7 +17,7 @@ function createCustomizationOrderBarModel(sales, primaryProductId) {
|
|
|
16
17
|
}))[0] : void 0
|
|
17
18
|
});
|
|
18
19
|
}
|
|
19
|
-
const renderCustomization = ({
|
|
20
|
+
const renderCustomization = ({ snapshot, viewSnapshot, sales, commandState, customization, scaleMinimumWeightKg, send }) => {
|
|
20
21
|
var _snapshot$activeOpera, _commandState$error, _customization$produc;
|
|
21
22
|
const syncing = snapshot.status === "running" && ((_snapshot$activeOpera = snapshot.activeOperation) === null || _snapshot$activeOpera === void 0 ? void 0 : _snapshot$activeOpera.definitionId) === "product.syncPrimaryWeightedProduct";
|
|
22
23
|
const error = resolveHDLKioskErrorPresentation({
|
|
@@ -31,7 +32,7 @@ const renderCustomization = ({ node, snapshot, viewSnapshot, sales, commandState
|
|
|
31
32
|
errorMessage: error === null || error === void 0 ? void 0 : error.message,
|
|
32
33
|
busy: viewSnapshot.status === "running" && !syncing,
|
|
33
34
|
syncing,
|
|
34
|
-
canGoBack:
|
|
35
|
+
canGoBack: canNavigateBack(snapshot),
|
|
35
36
|
minimumWeightKg: scaleMinimumWeightKg,
|
|
36
37
|
orderBar: createCustomizationOrderBarModel(sales, ((_customization$produc = customization.product) === null || _customization$produc === void 0 ? void 0 : _customization$produc.id) == null ? void 0 : String(customization.product.id)),
|
|
37
38
|
send
|
|
@@ -186,8 +186,8 @@ function FulfillmentScreen({ model, orderBar, send }) {
|
|
|
186
186
|
className: "hdl-floating-bar__button",
|
|
187
187
|
disabled: model.busy,
|
|
188
188
|
onClick: () => send({
|
|
189
|
-
kind: "
|
|
190
|
-
|
|
189
|
+
kind: "navigation",
|
|
190
|
+
direction: "back"
|
|
191
191
|
})
|
|
192
192
|
}, /* @__PURE__ */ React.createElement(BackIcon, null), /* @__PURE__ */ React.createElement("span", null, locales.getText("pisell2.hdl-kiosk.back"))) : void 0,
|
|
193
193
|
summary: /* @__PURE__ */ React.createElement(HDLKioskOrderSummary, {
|
|
@@ -223,8 +223,8 @@ function FulfillmentScreen({ model, orderBar, send }) {
|
|
|
223
223
|
className: "hdl-fulfillment-card",
|
|
224
224
|
disabled: model.busy,
|
|
225
225
|
onClick: () => send({
|
|
226
|
-
kind: "
|
|
227
|
-
|
|
226
|
+
kind: "intent",
|
|
227
|
+
intent: "complete",
|
|
228
228
|
contextPatch: { fulfillment: "dine_in" },
|
|
229
229
|
operationInput: { mode: "dine_in" }
|
|
230
230
|
})
|
|
@@ -233,8 +233,8 @@ function FulfillmentScreen({ model, orderBar, send }) {
|
|
|
233
233
|
className: "hdl-fulfillment-card",
|
|
234
234
|
disabled: model.busy,
|
|
235
235
|
onClick: () => send({
|
|
236
|
-
kind: "
|
|
237
|
-
|
|
236
|
+
kind: "intent",
|
|
237
|
+
intent: "complete",
|
|
238
238
|
contextPatch: { fulfillment: "takeaway" },
|
|
239
239
|
operationInput: { mode: "takeaway" }
|
|
240
240
|
})
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineSlice, effect } from "../../kernel/application/defineSlice.js";
|
|
2
2
|
import { setFulfillmentOperation } from "../../app/operations/fulfillment.js";
|
|
3
3
|
//#region src/components/HDLKiosk/slices/fulfillment/slice.ts
|
|
4
4
|
/** Fulfillment Slice:声明就餐方式完成条件与回退语义;不依赖 React 或 Host 实现。 */
|
|
5
5
|
const fulfillmentSlice = defineSlice({
|
|
6
6
|
id: "fulfillment",
|
|
7
7
|
screen: { id: "fulfillment" },
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}),
|
|
13
|
-
back: back()
|
|
14
|
-
}
|
|
8
|
+
intents: { complete: effect(setFulfillmentOperation, {
|
|
9
|
+
precondition: "fulfillment.selected",
|
|
10
|
+
navigate: "next"
|
|
11
|
+
}) }
|
|
15
12
|
});
|
|
16
13
|
//#endregion
|
|
17
14
|
export { fulfillmentSlice };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useHDLKioskBottomBar, useHDLKioskBottomBarController } from "../../../components/shell/HDLKioskBottomBarHost/index.js";
|
|
2
2
|
import { HDLKioskOrderSummary } from "../../../components/shell/HDLKioskOrderSummary/index.js";
|
|
3
|
-
import React, { useMemo } from "react";
|
|
3
|
+
import React, { useCallback, useMemo, useState } from "react";
|
|
4
4
|
import { locales } from "@pisell/utils";
|
|
5
5
|
//#region src/components/HDLKiosk/slices/identity/Screen/index.tsx
|
|
6
6
|
const QR_CELLS = Object.freeze(Array.from({ length: 49 }, (_, index) => index * 8 % 5 < 2));
|
|
@@ -8,21 +8,26 @@ const QR_CELLS = Object.freeze(Array.from({ length: 49 }, (_, index) => index *
|
|
|
8
8
|
* Quick Order 的前置会员提示页。
|
|
9
9
|
*
|
|
10
10
|
* 宿主可注入认证 UI;未注入时保留 QR / SMS 视觉 fallback。Skip 继续产生
|
|
11
|
-
* identity.
|
|
11
|
+
* identity.omit Intent,由本地 Exit Policy 同步访客后进入下一步。
|
|
12
12
|
*/
|
|
13
13
|
function IdentityScreen({ model, orderBar, send, renderIdentityAuth }) {
|
|
14
|
+
const [authBusy, setAuthBusy] = useState(false);
|
|
15
|
+
const busy = model.busy || authBusy;
|
|
16
|
+
const handleAuthBusyChange = useCallback((nextBusy) => {
|
|
17
|
+
setAuthBusy(nextBusy);
|
|
18
|
+
}, []);
|
|
14
19
|
const hasOrder = Boolean(orderBar && orderBar.cartLineCount > 0);
|
|
15
20
|
const { openCart } = useHDLKioskBottomBarController();
|
|
16
21
|
useHDLKioskBottomBar(useMemo(() => ({
|
|
17
22
|
ariaLabel: locales.getText("pisell2.hdl-kiosk.identity-actions-label"),
|
|
18
|
-
cartEnabled: hasOrder && !
|
|
23
|
+
cartEnabled: hasOrder && !busy,
|
|
19
24
|
variant: "composed",
|
|
20
25
|
summary: orderBar ? /* @__PURE__ */ React.createElement(HDLKioskOrderSummary, {
|
|
21
26
|
lineCount: orderBar.cartLineCount,
|
|
22
27
|
totalText: orderBar.totalText,
|
|
23
28
|
detailText: orderBar.totalText ? locales.getText("pisell2.hdl-kiosk.catalog-cart-hint") : orderBar.totalLabel,
|
|
24
29
|
cartAriaLabel: locales.getText("pisell2.hdl-kiosk.cart-drawer-title"),
|
|
25
|
-
disabled:
|
|
30
|
+
disabled: busy || !hasOrder,
|
|
26
31
|
onOpenCart: openCart
|
|
27
32
|
}) : void 0,
|
|
28
33
|
cartOpenBar: hasOrder ? (controller) => ({
|
|
@@ -30,7 +35,7 @@ function IdentityScreen({ model, orderBar, send, renderIdentityAuth }) {
|
|
|
30
35
|
leading: /* @__PURE__ */ React.createElement("button", {
|
|
31
36
|
type: "button",
|
|
32
37
|
className: "hdl-floating-bar__button",
|
|
33
|
-
disabled:
|
|
38
|
+
disabled: busy,
|
|
34
39
|
onClick: controller.onClose
|
|
35
40
|
}, /* @__PURE__ */ React.createElement("svg", {
|
|
36
41
|
viewBox: "0 0 24 24",
|
|
@@ -38,17 +43,18 @@ function IdentityScreen({ model, orderBar, send, renderIdentityAuth }) {
|
|
|
38
43
|
}, /* @__PURE__ */ React.createElement("path", { d: "m15 5-7 7 7 7M8 12h10" })), /* @__PURE__ */ React.createElement("span", null, locales.getText("pisell2.hdl-kiosk.back")))
|
|
39
44
|
}) : void 0
|
|
40
45
|
}), [
|
|
46
|
+
busy,
|
|
41
47
|
hasOrder,
|
|
42
|
-
model.busy,
|
|
43
48
|
openCart,
|
|
44
49
|
orderBar
|
|
45
50
|
]));
|
|
46
51
|
const authContent = renderIdentityAuth === null || renderIdentityAuth === void 0 ? void 0 : renderIdentityAuth({
|
|
47
|
-
busy
|
|
52
|
+
busy,
|
|
48
53
|
disabled: model.busy,
|
|
54
|
+
onBusyChange: handleAuthBusyChange,
|
|
49
55
|
onAuthenticated: (customerId) => send({
|
|
50
|
-
kind: "
|
|
51
|
-
|
|
56
|
+
kind: "intent",
|
|
57
|
+
intent: "complete",
|
|
52
58
|
operationInput: { customerId }
|
|
53
59
|
})
|
|
54
60
|
});
|
|
@@ -71,10 +77,10 @@ function IdentityScreen({ model, orderBar, send, renderIdentityAuth }) {
|
|
|
71
77
|
}, locales.getText("pisell2.hdl-kiosk.login-via-sms"))), /* @__PURE__ */ React.createElement("button", {
|
|
72
78
|
type: "button",
|
|
73
79
|
className: "hdl-identity-screen__skip",
|
|
74
|
-
disabled:
|
|
80
|
+
disabled: busy,
|
|
75
81
|
onClick: () => send({
|
|
76
|
-
kind: "
|
|
77
|
-
|
|
82
|
+
kind: "intent",
|
|
83
|
+
intent: "omit",
|
|
78
84
|
operationInput: {}
|
|
79
85
|
})
|
|
80
86
|
}, locales.getText("pisell2.hdl-kiosk.skip")), model.errorReference ? /* @__PURE__ */ React.createElement("div", {
|
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
import { defineSlice, effect } from "../../kernel/application/defineSlice.js";
|
|
2
2
|
import { identitySyncOperation } from "./operation.js";
|
|
3
3
|
//#region src/components/HDLKiosk/slices/identity/slice.ts
|
|
4
|
-
/** Identity Slice:声明身份节点的
|
|
4
|
+
/** Identity Slice:声明身份节点的 Intent 与客户同步 Effect;不依赖 React 或 Host 实现。 */
|
|
5
5
|
const identitySlice = defineSlice({
|
|
6
6
|
id: "identity",
|
|
7
7
|
screen: { id: "identity" },
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} },
|
|
12
|
-
outcomes: {
|
|
13
|
-
memberRecognized: effect(identitySyncOperation, {
|
|
14
|
-
when: "inputPresent",
|
|
15
|
-
navigate: "next"
|
|
16
|
-
}),
|
|
17
|
-
skipped: effect(identitySyncOperation, { navigate: "next" })
|
|
8
|
+
intents: {
|
|
9
|
+
complete: effect(identitySyncOperation, { navigate: "next" }),
|
|
10
|
+
omit: effect(identitySyncOperation, { navigate: "next" })
|
|
18
11
|
}
|
|
19
12
|
});
|
|
20
13
|
//#endregion
|