@pisell/private-materials 6.12.169 → 6.12.170
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.css +1 -1
- package/build/lowcode/render/default/view.js +10 -10
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +10 -10
- package/es/components/HDLKiosk/components/common/HDLKioskSkuOptionsSelection/index.less +1 -1
- package/es/components/HDLKiosk/components/overlays/HDLKioskModal/index.less +1 -1
- package/es/components/HDLKiosk/components/shell/HDLKioskBottomBarHost/index.js +4 -1
- package/es/components/HDLKiosk/docs/02-Host/351/200/202/351/205/215/344/270/216/344/270/232/345/212/241/346/225/260/346/215/256.md +20 -19
- package/es/components/HDLKiosk/index.js +10 -2
- package/es/components/HDLKiosk/index.less +7 -2
- package/es/components/HDLKiosk/slices/identity/Screen/index.less +1 -1
- package/es/components/HDLKiosk/slices/payment/Screen/index.less +1 -1
- package/es/components/HDLKiosk/ui/HDLKioskWorkflowView.js +26 -1
- package/es/components/HDLKiosk/ui/collaborationStatus.js +11 -0
- package/es/components/bigSale/components/BookingFloatingPanel/useBookingPanelController.js +0 -1
- package/es/components/bigSale/components/TimeBar/index.js +0 -1
- package/es/components/bigSale/dialog.js +0 -1
- package/es/components/bigSale/hooks/useBigSaleContext.js +0 -1
- package/es/components/bigSale/hooks/useSelectFloorMapResourceForBigSale.js +0 -1
- package/es/components/bigSale/index.js +0 -1
- package/es/components/bigSale/templates/HDLKiosk/README.md +43 -0
- package/es/components/bigSale/templates/HDLKiosk/adapter/createHost.js +7 -7
- package/es/components/bigSale/templates/HDLKiosk/adapter/{devices.js → devices/devicePort.js} +10 -38
- package/es/components/bigSale/templates/HDLKiosk/adapter/{capabilities.js → host/capabilities.js} +1 -1
- package/es/components/bigSale/templates/HDLKiosk/adapter/{fulfillment.js → host/fulfillmentWriter.js} +3 -3
- package/es/components/bigSale/templates/HDLKiosk/adapter/{projection.js → host/projection.js} +3 -3
- package/es/components/bigSale/templates/HDLKiosk/adapter/{telemetry.js → host/telemetry.js} +1 -1
- package/es/components/bigSale/templates/HDLKiosk/adapter/sales/cart.js +187 -0
- package/es/components/bigSale/templates/HDLKiosk/adapter/sales/catalog.js +160 -0
- package/es/components/bigSale/templates/HDLKiosk/adapter/{customizationProduct.js → sales/customizationProduct.js} +3 -3
- package/es/components/bigSale/templates/HDLKiosk/adapter/sales/fulfillment.js +31 -0
- package/es/components/bigSale/templates/HDLKiosk/adapter/sales/identity.js +57 -0
- package/es/components/bigSale/templates/HDLKiosk/adapter/sales/index.js +18 -0
- package/es/components/bigSale/templates/HDLKiosk/adapter/sales/payment.js +123 -0
- package/es/components/bigSale/templates/HDLKiosk/adapter/sales/session.js +71 -0
- package/es/components/bigSale/templates/HDLKiosk/adapter/sales/weightedOperations.js +124 -0
- package/es/components/bigSale/templates/HDLKiosk/adapter/{weightedProduct.js → sales/weightedProduct.js} +2 -2
- package/es/components/bigSale/templates/HDLKiosk/adapter/useBigSaleHDLKioskAdapter.js +41 -0
- package/es/components/bigSale/templates/HDLKiosk/adapter/useBigSaleHDLKioskHost.js +7 -7
- package/es/components/bigSale/templates/HDLKiosk/cart/useBigSaleHDLKioskCart.js +122 -0
- package/es/components/bigSale/templates/HDLKiosk/{adapter → hooks}/useHDLKioskEntryPreparationToast.js +2 -1
- package/es/components/bigSale/templates/HDLKiosk/index.js +40 -146
- package/es/components/bigSale/templates/HDLKiosk/{adapter/scaleTrigger.js → runtime/BigSaleScaleRuntimeOwner.js} +15 -59
- package/es/components/bigSale/templates/HDLKiosk/{adapter → runtime}/HDLKioskPaymentRuntime.js +2 -2
- package/es/components/bigSale/templates/HDLKiosk/runtime/scaleBridge.js +44 -0
- package/es/components/bigSale/templates/Kiosk/index.js +0 -1
- package/es/components/sharedSecondaryBigSale/SharedSecondaryBigSaleReceiver.js +0 -1
- package/es/index.js +0 -2
- 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/saleDetail/Base.js +0 -1
- package/es/plus/saleDetail/components/Client/hooks/useClientSelectorProps.js +0 -1
- package/es/plus/saleDetail/components/DetailActions/index.js +0 -1
- package/es/plus/saleDetail/components/SummaryFinancialSections/index.js +0 -1
- package/es/plus/saleDetail/index.js +0 -1
- package/es/plus/saleDetail/tmpl/B/components/Dish/index.js +0 -1
- package/es/plus/saleDetail/tmpl/B/index.js +0 -1
- 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/private-materials/lowcode/authmodal/meta.d.ts +1 -0
- package/es/pro/Login2.0/AuthModal.d.ts +1 -1
- package/es/pro/Login2.0/index.d.ts +1 -2
- package/es/pro/Login2.0/shared/types.d.ts +1 -1
- package/lib/components/HDLKiosk/components/common/HDLKioskSkuOptionsSelection/index.less +1 -1
- package/lib/components/HDLKiosk/components/overlays/HDLKioskModal/index.less +1 -1
- package/lib/components/HDLKiosk/components/shell/HDLKioskBottomBarHost/index.js +4 -1
- package/lib/components/HDLKiosk/docs/02-Host/351/200/202/351/205/215/344/270/216/344/270/232/345/212/241/346/225/260/346/215/256.md +20 -19
- package/lib/components/HDLKiosk/index.js +10 -2
- package/lib/components/HDLKiosk/index.less +7 -2
- package/lib/components/HDLKiosk/slices/identity/Screen/index.less +1 -1
- package/lib/components/HDLKiosk/slices/payment/Screen/index.less +1 -1
- package/lib/components/HDLKiosk/ui/HDLKioskWorkflowView.js +26 -1
- package/lib/components/HDLKiosk/ui/collaborationStatus.js +11 -0
- package/lib/components/bigSale/templates/HDLKiosk/README.md +43 -0
- package/lib/components/bigSale/templates/HDLKiosk/adapter/createHost.js +9 -9
- package/lib/components/bigSale/templates/HDLKiosk/adapter/{devices.js → devices/devicePort.js} +10 -38
- package/lib/components/bigSale/templates/HDLKiosk/adapter/{capabilities.js → host/capabilities.js} +1 -1
- package/lib/components/bigSale/templates/HDLKiosk/adapter/{fulfillment.js → host/fulfillmentWriter.js} +3 -3
- package/lib/components/bigSale/templates/HDLKiosk/adapter/{projection.js → host/projection.js} +4 -4
- package/lib/components/bigSale/templates/HDLKiosk/adapter/{telemetry.js → host/telemetry.js} +1 -1
- package/lib/components/bigSale/templates/HDLKiosk/adapter/sales/cart.js +189 -0
- package/lib/components/bigSale/templates/HDLKiosk/adapter/sales/catalog.js +162 -0
- package/lib/components/bigSale/templates/HDLKiosk/adapter/{customizationProduct.js → sales/customizationProduct.js} +4 -4
- package/lib/components/bigSale/templates/HDLKiosk/adapter/sales/fulfillment.js +31 -0
- package/lib/components/bigSale/templates/HDLKiosk/adapter/sales/identity.js +57 -0
- package/lib/components/bigSale/templates/HDLKiosk/adapter/sales/index.js +18 -0
- package/lib/components/bigSale/templates/HDLKiosk/adapter/sales/payment.js +123 -0
- package/lib/components/bigSale/templates/HDLKiosk/adapter/sales/session.js +71 -0
- package/lib/components/bigSale/templates/HDLKiosk/adapter/sales/weightedOperations.js +126 -0
- package/lib/components/bigSale/templates/HDLKiosk/adapter/{weightedProduct.js → sales/weightedProduct.js} +3 -3
- package/lib/components/bigSale/templates/HDLKiosk/adapter/useBigSaleHDLKioskAdapter.js +42 -0
- package/lib/components/bigSale/templates/HDLKiosk/adapter/useBigSaleHDLKioskHost.js +7 -7
- package/lib/components/bigSale/templates/HDLKiosk/cart/useBigSaleHDLKioskCart.js +124 -0
- package/lib/components/bigSale/templates/HDLKiosk/{adapter → hooks}/useHDLKioskEntryPreparationToast.js +2 -1
- package/lib/components/bigSale/templates/HDLKiosk/index.js +41 -147
- package/lib/components/bigSale/templates/HDLKiosk/{adapter/scaleTrigger.js → runtime/BigSaleScaleRuntimeOwner.js} +14 -59
- package/lib/components/bigSale/templates/HDLKiosk/{adapter → runtime}/HDLKioskPaymentRuntime.js +2 -2
- package/lib/components/bigSale/templates/HDLKiosk/runtime/scaleBridge.js +44 -0
- package/package.json +3 -3
- package/es/components/bigSale/templates/HDLKiosk/adapter/sales.js +0 -710
- package/es/plus/pisellReservation/index.js +0 -17
- package/es/plus/salesSdk/index.js +0 -52
- package/lib/components/bigSale/templates/HDLKiosk/adapter/sales.js +0 -712
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { _objectSpread2 } from "../../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
|
|
2
|
+
import { _asyncToGenerator } from "../../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
|
|
3
|
+
import { buildProductSkuPatch, resolvePatchProductOptions } from "../../../../../../plus/salesSdk/utils/productSkuOptions.js";
|
|
4
|
+
import { pickIdentity } from "../../../../../../plus/salesSdk/utils/identity.js";
|
|
5
|
+
import { buildProductLineUpdates } from "../../../../../../plus/salesSdk/utils/buildProductLineUpdates.js";
|
|
6
|
+
import { resolveHDLWeightedProduct } from "../../../../../HDLKiosk/product.js";
|
|
7
|
+
import { failed, partialFailure, unknown } from "../normalize.js";
|
|
8
|
+
import { queryPrimaryProduct } from "./catalog.js";
|
|
9
|
+
import { findCartLine, projectConfirmedMutationLine } from "./cart.js";
|
|
10
|
+
import { createHDLPrimaryWeightedPreparedProduct } from "./customizationProduct.js";
|
|
11
|
+
import Decimal from "decimal.js";
|
|
12
|
+
//#region src/components/bigSale/templates/HDLKiosk/adapter/sales/weightedOperations.ts
|
|
13
|
+
/** Primary weighted-product add/update operations. */
|
|
14
|
+
function resolveCartProduct(line) {
|
|
15
|
+
var _line$_extend;
|
|
16
|
+
return "product_id" in line ? line : (_line$_extend = line._extend) === null || _line$_extend === void 0 ? void 0 : _line$_extend.product;
|
|
17
|
+
}
|
|
18
|
+
function hasRequestedWeight(product, requestedWeightKg) {
|
|
19
|
+
var _product$product_sku$, _product$product_sku;
|
|
20
|
+
const actual = new Decimal((_product$product_sku$ = (_product$product_sku = product.product_sku) === null || _product$product_sku === void 0 ? void 0 : _product$product_sku.net_weight) !== null && _product$product_sku$ !== void 0 ? _product$product_sku$ : NaN);
|
|
21
|
+
const expected = new Decimal(requestedWeightKg || NaN);
|
|
22
|
+
return actual.isFinite() && expected.isFinite() && actual.equals(expected);
|
|
23
|
+
}
|
|
24
|
+
function findConfirmedMutationLine(products, productId, requestedWeightKg, uniqueId) {
|
|
25
|
+
return [...products].reverse().find((candidate) => {
|
|
26
|
+
var _candidate$product_id, _candidate$metadata$u, _candidate$metadata;
|
|
27
|
+
if (String((_candidate$product_id = candidate.product_id) !== null && _candidate$product_id !== void 0 ? _candidate$product_id : "") !== productId) return false;
|
|
28
|
+
if (!hasRequestedWeight(candidate, requestedWeightKg)) return false;
|
|
29
|
+
if (uniqueId == null || uniqueId === "") return true;
|
|
30
|
+
return String((_candidate$metadata$u = (_candidate$metadata = candidate.metadata) === null || _candidate$metadata === void 0 ? void 0 : _candidate$metadata.unique_identification_number) !== null && _candidate$metadata$u !== void 0 ? _candidate$metadata$u : "") === String(uniqueId);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function findOrderProduct(context, product) {
|
|
34
|
+
var _product$_identity, _context$sales$tempOr, _products$find;
|
|
35
|
+
const uniqueId = ((_product$_identity = product._identity) !== null && _product$_identity !== void 0 ? _product$_identity : pickIdentity(product)).unique_identification_number;
|
|
36
|
+
return (_products$find = (((_context$sales$tempOr = context.sales.tempOrder) === null || _context$sales$tempOr === void 0 ? void 0 : _context$sales$tempOr.products) || []).find((candidate) => {
|
|
37
|
+
var _candidate$metadata$u2, _candidate$metadata2;
|
|
38
|
+
return uniqueId != null && String((_candidate$metadata$u2 = (_candidate$metadata2 = candidate.metadata) === null || _candidate$metadata2 === void 0 ? void 0 : _candidate$metadata2.unique_identification_number) !== null && _candidate$metadata$u2 !== void 0 ? _candidate$metadata$u2 : "") === String(uniqueId);
|
|
39
|
+
})) !== null && _products$find !== void 0 ? _products$find : product;
|
|
40
|
+
}
|
|
41
|
+
function createBigSaleWeightedProductOperations({ getContext }) {
|
|
42
|
+
return { syncPrimaryWeightedProduct: function() {
|
|
43
|
+
var _ref2 = _asyncToGenerator(function* (input, signal) {
|
|
44
|
+
if (signal.aborted) return { status: "cancelled" };
|
|
45
|
+
const productId = Number(input.productId);
|
|
46
|
+
if (!Number.isFinite(productId)) return failed("primaryWeightedProductInputInvalid", "staff");
|
|
47
|
+
try {
|
|
48
|
+
const context = getContext();
|
|
49
|
+
const productResult = yield queryPrimaryProduct(context, String(productId), signal);
|
|
50
|
+
if (productResult.status !== "succeeded") return productResult;
|
|
51
|
+
const product = productResult.data;
|
|
52
|
+
const resolved = resolveHDLWeightedProduct(product);
|
|
53
|
+
if (!resolved) return failed("primaryWeightedProductConfigInvalid", "staff");
|
|
54
|
+
const prepared = createHDLPrimaryWeightedPreparedProduct(resolved, input);
|
|
55
|
+
if (!prepared) return failed("primaryWeightedProductSelectionInvalid", "retry");
|
|
56
|
+
if (input.existingLineId) {
|
|
57
|
+
var _cartProduct$_identit, _identity$product_var, _ref, _productPatch$product;
|
|
58
|
+
const displayLine = findCartLine(context, input.existingLineId);
|
|
59
|
+
const cartProduct = displayLine ? resolveCartProduct(displayLine) : void 0;
|
|
60
|
+
const bookingTicket = context.sales.bookingTicket;
|
|
61
|
+
if (!cartProduct) return failed("primaryWeightedProductLineNotFound", "back");
|
|
62
|
+
if (typeof context.cart.updateItem !== "function" || typeof (bookingTicket === null || bookingTicket === void 0 ? void 0 : bookingTicket.transformDetailToProductAndBooking) !== "function") return failed("primaryWeightedProductUpdateUnavailable", "staff");
|
|
63
|
+
const orderLine = findOrderProduct(context, cartProduct);
|
|
64
|
+
const identity = (_cartProduct$_identit = cartProduct._identity) !== null && _cartProduct$_identit !== void 0 ? _cartProduct$_identit : pickIdentity(orderLine);
|
|
65
|
+
const preparedForUpdate = _objectSpread2(_objectSpread2({}, prepared), {}, { _extend: _objectSpread2(_objectSpread2({}, prepared._extend || {}), identity.unique_identification_number != null ? { unique_identification_number: identity.unique_identification_number } : {}) });
|
|
66
|
+
const transformed = bookingTicket.transformDetailToProductAndBooking({
|
|
67
|
+
item: resolved.product,
|
|
68
|
+
cacheItem: preparedForUpdate
|
|
69
|
+
});
|
|
70
|
+
const productPatch = transformed === null || transformed === void 0 ? void 0 : transformed.product;
|
|
71
|
+
if (!productPatch) return failed("primaryWeightedProductUpdateInvalid", "retry");
|
|
72
|
+
const patchVariantId = Number(productPatch.product_variant_id);
|
|
73
|
+
const nextVariantId = Number.isFinite(patchVariantId) && patchVariantId > 0 ? patchVariantId : Number((_identity$product_var = identity.product_variant_id) !== null && _identity$product_var !== void 0 ? _identity$product_var : 0);
|
|
74
|
+
const nextOptions = resolvePatchProductOptions(orderLine, productPatch);
|
|
75
|
+
const lineUpdates = buildProductLineUpdates(orderLine, productPatch);
|
|
76
|
+
lineUpdates.metadata = _objectSpread2(_objectSpread2({}, lineUpdates.metadata || {}), identity.unique_identification_number != null ? { unique_identification_number: identity.unique_identification_number } : {});
|
|
77
|
+
const updatedProducts = yield context.cart.updateItem({
|
|
78
|
+
product_id: identity.product_id,
|
|
79
|
+
product_variant_id: nextVariantId,
|
|
80
|
+
unique_identification_number: identity.unique_identification_number,
|
|
81
|
+
identity_key: identity.identity_key,
|
|
82
|
+
product_sku: buildProductSkuPatch(orderLine, nextOptions, productPatch.product_sku),
|
|
83
|
+
product_option_item: nextOptions,
|
|
84
|
+
product_bundle: (_ref = (_productPatch$product = productPatch.product_bundle) !== null && _productPatch$product !== void 0 ? _productPatch$product : identity.product_bundle) !== null && _ref !== void 0 ? _ref : [],
|
|
85
|
+
updates: lineUpdates
|
|
86
|
+
});
|
|
87
|
+
if (signal.aborted) return unknown("primaryProductUpdateAbortedAfterDispatch");
|
|
88
|
+
const confirmedLine = projectConfirmedMutationLine(findConfirmedMutationLine(updatedProducts, input.productId, input.measurement.netWeightKg, identity.unique_identification_number));
|
|
89
|
+
return {
|
|
90
|
+
status: "succeeded",
|
|
91
|
+
data: _objectSpread2({ affectedLineId: input.existingLineId }, confirmedLine ? { confirmedLine } : {})
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
const result = yield context.cart.addProductWithFlow(product, {
|
|
95
|
+
quantity: 1,
|
|
96
|
+
debounceMs: 0,
|
|
97
|
+
notShowToast: true,
|
|
98
|
+
preparedCacheItem: prepared
|
|
99
|
+
});
|
|
100
|
+
if (signal.aborted) return unknown("primaryProductAddAbortedAfterDispatch");
|
|
101
|
+
if (result.status === "cancelled") return {
|
|
102
|
+
status: "cancelled",
|
|
103
|
+
reason: "userCancelled"
|
|
104
|
+
};
|
|
105
|
+
if (result.status !== "added") return unknown("primaryProductAddAmbiguous");
|
|
106
|
+
const confirmedLine = projectConfirmedMutationLine(findConfirmedMutationLine(result.products, input.productId, input.measurement.netWeightKg));
|
|
107
|
+
return {
|
|
108
|
+
status: "succeeded",
|
|
109
|
+
data: confirmedLine ? {
|
|
110
|
+
affectedLineId: confirmedLine.lineId,
|
|
111
|
+
confirmedLine
|
|
112
|
+
} : {}
|
|
113
|
+
};
|
|
114
|
+
} catch (error) {
|
|
115
|
+
return partialFailure("primaryWeightedProductSyncFailed", error);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
return function syncPrimaryWeightedProduct(_x, _x2) {
|
|
119
|
+
return _ref2.apply(this, arguments);
|
|
120
|
+
};
|
|
121
|
+
}() };
|
|
122
|
+
}
|
|
123
|
+
//#endregion
|
|
124
|
+
export { createBigSaleWeightedProductOperations };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { _objectSpread2 } from "
|
|
1
|
+
import { _objectSpread2 } from "../../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
|
|
2
2
|
import { getWeightUnitSymbol } from "@pisell/utils";
|
|
3
3
|
import Decimal from "decimal.js";
|
|
4
|
-
//#region src/components/bigSale/templates/HDLKiosk/adapter/weightedProduct.ts
|
|
4
|
+
//#region src/components/bigSale/templates/HDLKiosk/adapter/sales/weightedProduct.ts
|
|
5
5
|
/**
|
|
6
6
|
* 文件角色:根据已验证的标准称重商品生成 SalesSDK 写入结构。
|
|
7
7
|
* 运行机制:提交时校验稳定净重,并生成 prepared product 及 OS 可识别的
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { createBigSaleScaleBridge } from "../runtime/scaleBridge.js";
|
|
2
|
+
import { createHDLKioskFulfillmentWriter } from "./host/fulfillmentWriter.js";
|
|
3
|
+
import { useBigSaleHDLKioskHost } from "./useBigSaleHDLKioskHost.js";
|
|
4
|
+
import { useCallback, useEffect, useMemo, useRef } from "react";
|
|
5
|
+
//#region src/components/bigSale/templates/HDLKiosk/adapter/useBigSaleHDLKioskAdapter.ts
|
|
6
|
+
/**
|
|
7
|
+
* 文件角色:集中装配 BigSale 模板接入 HDLKiosk 所需的稳定 Host、支付控制器、
|
|
8
|
+
* 秤 Runtime 与认证客户暂存。
|
|
9
|
+
* 运行机制:React refs 隔离晚到能力,Host 保持稳定引用;Template 只消费装配结果。
|
|
10
|
+
* 边界:不渲染 UI,不承载商品目录加载、购物车展示或 Workflow 业务规则。
|
|
11
|
+
*/
|
|
12
|
+
function useBigSaleHDLKioskAdapter({ context, businessCode, isActive, nativeScaleSourceAvailable }) {
|
|
13
|
+
var _context$customer$sel;
|
|
14
|
+
const scaleBridge = useMemo(createBigSaleScaleBridge, []);
|
|
15
|
+
const authenticatedCustomerRef = useRef();
|
|
16
|
+
const paymentControllerRef = useRef();
|
|
17
|
+
const fulfillmentWriter = useMemo(() => createHDLKioskFulfillmentWriter(context.sales.bookingTicket), [context.sales.bookingTicket]);
|
|
18
|
+
const host = useBigSaleHDLKioskHost(context, businessCode, useMemo(() => ({
|
|
19
|
+
writeFulfillment: fulfillmentWriter,
|
|
20
|
+
getPaymentController: () => paymentControllerRef.current,
|
|
21
|
+
subscribeScaleEvents: scaleBridge.subscribeDeviceEvents,
|
|
22
|
+
getAuthenticatedCustomer: (customerId) => {
|
|
23
|
+
const customer = authenticatedCustomerRef.current;
|
|
24
|
+
return customer && String(customer.id) === customerId ? customer : void 0;
|
|
25
|
+
}
|
|
26
|
+
}), [fulfillmentWriter, scaleBridge]), nativeScaleSourceAvailable);
|
|
27
|
+
const selectedCustomerId = (_context$customer$sel = context.customer.selected) === null || _context$customer$sel === void 0 ? void 0 : _context$customer$sel.id;
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (!isActive || selectedCustomerId == null) authenticatedCustomerRef.current = void 0;
|
|
30
|
+
}, [isActive, selectedCustomerId]);
|
|
31
|
+
return {
|
|
32
|
+
host,
|
|
33
|
+
paymentControllerRef,
|
|
34
|
+
rememberAuthenticatedCustomer: useCallback((customer) => {
|
|
35
|
+
authenticatedCustomerRef.current = customer;
|
|
36
|
+
}, []),
|
|
37
|
+
scaleBridge
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { useBigSaleHDLKioskAdapter };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import useSalesSdkGlobalScanHandler from "../../../../../plus/salesSdk/hooks/useSalesSdkGlobalScanHandler.js";
|
|
2
|
-
import { resolveHDLKioskPickupReferenceMode } from "./projection.js";
|
|
2
|
+
import { resolveHDLKioskPickupReferenceMode } from "./host/projection.js";
|
|
3
3
|
import { createBigSaleHDLKioskHost } from "./createHost.js";
|
|
4
4
|
import { useEffect, useRef } from "react";
|
|
5
5
|
//#region src/components/bigSale/templates/HDLKiosk/adapter/useBigSaleHDLKioskHost.ts
|
|
@@ -18,6 +18,7 @@ function useBigSaleHDLKioskHost(context, businessCode, bridge, scaleSourceAvaila
|
|
|
18
18
|
const bridgeRef = useRef(bridge);
|
|
19
19
|
const scaleSourceAvailableRef = useRef(scaleSourceAvailable);
|
|
20
20
|
const projectionListenersRef = useRef(/* @__PURE__ */ new Set());
|
|
21
|
+
const publishedObservationIdRef = useRef();
|
|
21
22
|
const pickupReferenceModeRef = useRef("short_number");
|
|
22
23
|
contextRef.current = context;
|
|
23
24
|
scanRef.current = scan.handleGlobalScanCode;
|
|
@@ -65,17 +66,16 @@ function useBigSaleHDLKioskHost(context, businessCode, bridge, scaleSourceAvaila
|
|
|
65
66
|
devices: {
|
|
66
67
|
getPubsub: () => getPubsubRef.current(),
|
|
67
68
|
getAcquireScanFocus: () => getAcquireScanFocusRef.current(),
|
|
68
|
-
|
|
69
|
+
getSubscribeScaleEvents: () => {
|
|
69
70
|
var _bridgeRef$current4;
|
|
70
|
-
return scaleSourceAvailableRef.current ? (_bridgeRef$current4 = bridgeRef.current) === null || _bridgeRef$current4 === void 0 ? void 0 : _bridgeRef$current4.
|
|
71
|
-
},
|
|
72
|
-
getSubscribeScaleConnection: () => {
|
|
73
|
-
var _bridgeRef$current5;
|
|
74
|
-
return scaleSourceAvailableRef.current ? (_bridgeRef$current5 = bridgeRef.current) === null || _bridgeRef$current5 === void 0 ? void 0 : _bridgeRef$current5.subscribeScaleConnection : void 0;
|
|
71
|
+
return scaleSourceAvailableRef.current ? (_bridgeRef$current4 = bridgeRef.current) === null || _bridgeRef$current4 === void 0 ? void 0 : _bridgeRef$current4.subscribeScaleEvents : void 0;
|
|
75
72
|
}
|
|
76
73
|
}
|
|
77
74
|
});
|
|
78
75
|
useEffect(() => {
|
|
76
|
+
const observationId = hostRef.current.sales.getObservedSnapshot().observationId;
|
|
77
|
+
if (publishedObservationIdRef.current === observationId) return;
|
|
78
|
+
publishedObservationIdRef.current = observationId;
|
|
79
79
|
projectionListenersRef.current.forEach((listener) => listener());
|
|
80
80
|
});
|
|
81
81
|
return hostRef.current;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { _objectSpread2 } from "../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
|
|
2
|
+
import { usePickSaleDetailContext } from "../../../hooks/usePickSaleDetailContext.js";
|
|
3
|
+
import { useOrderNoteModal } from "../../../../../plus/saleDetail/hooks/useOrderNoteModal.js";
|
|
4
|
+
import { buildVoucherViews } from "../../../../../plus/saleDetail/components/PromotionWalletPanels/adapters.js";
|
|
5
|
+
import { createSaleWalletAssetsCleanupCoordinator } from "../../../../../plus/saleDetail/components/PromotionWalletPanels/useSaleWalletAssets.js";
|
|
6
|
+
import Base_default from "../../../../../plus/saleDetail/Base.js";
|
|
7
|
+
import React, { useCallback, useMemo, useRef } from "react";
|
|
8
|
+
//#region src/components/bigSale/templates/HDLKiosk/cart/useBigSaleHDLKioskCart.tsx
|
|
9
|
+
/**
|
|
10
|
+
* 文件角色:封装 HDLKiosk 复用 SaleDetail 时的购物车展示、备注和优惠券配置。
|
|
11
|
+
* 边界:只负责 Cart Overlay 的 BigSale UI 接入,不创建 Host 或执行 Workflow。
|
|
12
|
+
*/
|
|
13
|
+
const HIDDEN_MODULES = [
|
|
14
|
+
"overview",
|
|
15
|
+
"customer",
|
|
16
|
+
"contact",
|
|
17
|
+
"cartActions",
|
|
18
|
+
"orderActions",
|
|
19
|
+
"promotionAlert"
|
|
20
|
+
];
|
|
21
|
+
const CART_ITEM_PRESENTATION = {
|
|
22
|
+
density: "comfortable",
|
|
23
|
+
optionColumns: 2,
|
|
24
|
+
mediaFit: "cover",
|
|
25
|
+
contentAlign: "center",
|
|
26
|
+
tokens: {
|
|
27
|
+
background: "#ffffff",
|
|
28
|
+
borderColor: "#e4e7ec",
|
|
29
|
+
borderRadius: "18px",
|
|
30
|
+
minHeight: "164px",
|
|
31
|
+
mediaWidth: "228px",
|
|
32
|
+
actionRailWidth: "174px",
|
|
33
|
+
contentPadding: "20px 22px",
|
|
34
|
+
actionRailPadding: "18px 20px",
|
|
35
|
+
accentColor: "#b20d12",
|
|
36
|
+
titleColor: "#101828",
|
|
37
|
+
titleFontSize: "32px",
|
|
38
|
+
titleFontWeight: 800,
|
|
39
|
+
priceColor: "#b20d12",
|
|
40
|
+
priceFontSize: "30px",
|
|
41
|
+
optionBackground: "#f5f6f8",
|
|
42
|
+
optionLabelColor: "#667085",
|
|
43
|
+
optionValueColor: "#101828",
|
|
44
|
+
optionGap: "6px",
|
|
45
|
+
shadow: "0 12px 28px rgba(16, 24, 40, 0.08)"
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
function useBigSaleHDLKioskCart({ context, onOrderComplete, primaryWeightedProductId, saleDetailModuleConfig, variant }) {
|
|
49
|
+
var _note, _ref, _context$sales$tempOr, _context$sales$bookin, _context$sales$bookin2;
|
|
50
|
+
const walletAssetsCleanupCoordinatorRef = useRef(createSaleWalletAssetsCleanupCoordinator());
|
|
51
|
+
const saleDetailContext = usePickSaleDetailContext(context, onOrderComplete);
|
|
52
|
+
const { openOrderNoteModal, orderNoteModal } = useOrderNoteModal({
|
|
53
|
+
context: saleDetailContext,
|
|
54
|
+
modalClassName: "pisell-kiosk-modal pisell-kiosk-note-modal"
|
|
55
|
+
});
|
|
56
|
+
const hasOrderNote = Boolean(String((_note = (_ref = (_context$sales$tempOr = context.sales.tempOrder) !== null && _context$sales$tempOr !== void 0 ? _context$sales$tempOr : (_context$sales$bookin = context.sales.bookingTicket) === null || _context$sales$bookin === void 0 || (_context$sales$bookin2 = _context$sales$bookin.getTempOrder) === null || _context$sales$bookin2 === void 0 ? void 0 : _context$sales$bookin2.call(_context$sales$bookin)) === null || _ref === void 0 ? void 0 : _ref.note) !== null && _note !== void 0 ? _note : "").trim());
|
|
57
|
+
const selectedPromotionCount = useMemo(() => buildVoucherViews(context.cart.discountList || []).filter((voucher) => voucher.selected).length, [context.cart.discountList]);
|
|
58
|
+
const cartOverlayActions = useMemo(() => ({
|
|
59
|
+
hasNote: hasOrderNote,
|
|
60
|
+
onAddNote: openOrderNoteModal,
|
|
61
|
+
promotionAppliedCount: selectedPromotionCount
|
|
62
|
+
}), [
|
|
63
|
+
hasOrderNote,
|
|
64
|
+
openOrderNoteModal,
|
|
65
|
+
selectedPromotionCount
|
|
66
|
+
]);
|
|
67
|
+
const moduleConfig = useMemo(() => _objectSpread2(_objectSpread2({}, saleDetailModuleConfig), {}, {
|
|
68
|
+
hidden: HIDDEN_MODULES,
|
|
69
|
+
cartItems: _objectSpread2(_objectSpread2({}, saleDetailModuleConfig === null || saleDetailModuleConfig === void 0 ? void 0 : saleDetailModuleConfig.cartItems), {}, {
|
|
70
|
+
rightActionsDisplay: "inline",
|
|
71
|
+
bookingQuantityMode: "hidden",
|
|
72
|
+
lineNoteEditingEnabled: true,
|
|
73
|
+
showInlineRemoveButton: false,
|
|
74
|
+
showQuantityBadge: false,
|
|
75
|
+
showRemoveButton: true,
|
|
76
|
+
clearSelectedQuantityOnDelete: true,
|
|
77
|
+
productLineItemType: "a12",
|
|
78
|
+
productLineItemPresentation: CART_ITEM_PRESENTATION
|
|
79
|
+
}),
|
|
80
|
+
amountDetails: _objectSpread2(_objectSpread2({}, saleDetailModuleConfig === null || saleDetailModuleConfig === void 0 ? void 0 : saleDetailModuleConfig.amountDetails), {}, { defaultExpanded: true }),
|
|
81
|
+
promotionWalletPanels: typeof (saleDetailModuleConfig === null || saleDetailModuleConfig === void 0 ? void 0 : saleDetailModuleConfig.promotionWalletPanels) === "object" ? saleDetailModuleConfig.promotionWalletPanels : void 0,
|
|
82
|
+
promotionWalletPanelsAppearance: "light",
|
|
83
|
+
promotionWalletPanelsBehavior: _objectSpread2(_objectSpread2({}, saleDetailModuleConfig === null || saleDetailModuleConfig === void 0 ? void 0 : saleDetailModuleConfig.promotionWalletPanelsBehavior), {}, {
|
|
84
|
+
walletAssetsCleanupCoordinator: walletAssetsCleanupCoordinatorRef.current,
|
|
85
|
+
enableManualPromotionCode: true,
|
|
86
|
+
enablePromotionBanner: true,
|
|
87
|
+
enableVoucherProductAdd: true,
|
|
88
|
+
enableWalletAssets: true,
|
|
89
|
+
preserveWalletAssetsWhileRefreshing: true
|
|
90
|
+
})
|
|
91
|
+
}), [saleDetailModuleConfig]);
|
|
92
|
+
const isPrimaryProductLine = useCallback((item) => {
|
|
93
|
+
var _ref2, _item$_extend$product, _item$_extend;
|
|
94
|
+
return String((_ref2 = (_item$_extend$product = item === null || item === void 0 || (_item$_extend = item._extend) === null || _item$_extend === void 0 || (_item$_extend = _item$_extend.product) === null || _item$_extend === void 0 ? void 0 : _item$_extend.product_id) !== null && _item$_extend$product !== void 0 ? _item$_extend$product : item === null || item === void 0 ? void 0 : item.product_id) !== null && _ref2 !== void 0 ? _ref2 : "") === String(primaryWeightedProductId !== null && primaryWeightedProductId !== void 0 ? primaryWeightedProductId : "");
|
|
95
|
+
}, [primaryWeightedProductId]);
|
|
96
|
+
return {
|
|
97
|
+
cartOverlayActions,
|
|
98
|
+
orderNoteModal,
|
|
99
|
+
renderCartContent: useCallback(({ promotionsVisible, onEditPrimaryProduct }) => /* @__PURE__ */ React.createElement(Base_default, {
|
|
100
|
+
className: "hdl-kiosk-voucher-wallet",
|
|
101
|
+
context: saleDetailContext,
|
|
102
|
+
mobilePresentation: "inline",
|
|
103
|
+
moduleConfig: _objectSpread2(_objectSpread2({}, moduleConfig), {}, {
|
|
104
|
+
hidden: [...HIDDEN_MODULES, ...promotionsVisible ? [] : ["promotionWalletPanels"]],
|
|
105
|
+
cartItems: _objectSpread2(_objectSpread2({}, moduleConfig.cartItems), {}, {
|
|
106
|
+
isProductLineItemEditable: isPrimaryProductLine,
|
|
107
|
+
onProductLineItemEdit: onEditPrimaryProduct ? () => onEditPrimaryProduct() : void 0
|
|
108
|
+
})
|
|
109
|
+
}),
|
|
110
|
+
renderType: "current",
|
|
111
|
+
template: "A",
|
|
112
|
+
variant
|
|
113
|
+
}), [
|
|
114
|
+
isPrimaryProductLine,
|
|
115
|
+
moduleConfig,
|
|
116
|
+
saleDetailContext,
|
|
117
|
+
variant
|
|
118
|
+
])
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
//#endregion
|
|
122
|
+
export { useBigSaleHDLKioskCart };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useEffect } from "react";
|
|
2
|
-
//#region src/components/bigSale/templates/HDLKiosk/
|
|
2
|
+
//#region src/components/bigSale/templates/HDLKiosk/hooks/useHDLKioskEntryPreparationToast.ts
|
|
3
|
+
/** React 层入口准备提示;不属于 BigSale Host/Port 适配。 */
|
|
3
4
|
function useHDLKioskEntryPreparationToast({ active, message, preparing, toast }) {
|
|
4
5
|
useEffect(() => {
|
|
5
6
|
if (!active || !preparing || !(toast === null || toast === void 0 ? void 0 : toast.loading)) return;
|
|
@@ -1,22 +1,16 @@
|
|
|
1
1
|
import { _objectSpread2 } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
|
|
2
2
|
import useEngineContext from "../../../../hooks/useEngineContext.js";
|
|
3
|
-
import { usePickSaleDetailContext } from "../../hooks/usePickSaleDetailContext.js";
|
|
4
|
-
import { useOrderNoteModal } from "../../../../plus/saleDetail/hooks/useOrderNoteModal.js";
|
|
5
|
-
import { buildVoucherViews } from "../../../../plus/saleDetail/components/PromotionWalletPanels/adapters.js";
|
|
6
|
-
import { createSaleWalletAssetsCleanupCoordinator } from "../../../../plus/saleDetail/components/PromotionWalletPanels/useSaleWalletAssets.js";
|
|
7
|
-
import Base_default from "../../../../plus/saleDetail/Base.js";
|
|
8
3
|
import localeTexts from "../../../HDLKiosk/locales.js";
|
|
9
|
-
import { createHDLScaleRuntime } from "../../../HDLKiosk/runtime/devices/scaleStore.js";
|
|
10
4
|
import HDLKiosk from "../../../HDLKiosk/index.js";
|
|
11
5
|
import { resolveHDLKioskConfig } from "../../../HDLKiosk/app/contracts/config.js";
|
|
12
|
-
import {
|
|
13
|
-
import { useHDLKioskEntryPreparationToast } from "./
|
|
14
|
-
import { HDLKioskPaymentRuntime } from "./
|
|
15
|
-
import { createHDLKioskFulfillmentWriter } from "./adapter/fulfillment.js";
|
|
6
|
+
import { useBigSaleHDLKioskAdapter } from "./adapter/useBigSaleHDLKioskAdapter.js";
|
|
7
|
+
import { useHDLKioskEntryPreparationToast } from "./hooks/useHDLKioskEntryPreparationToast.js";
|
|
8
|
+
import { HDLKioskPaymentRuntime } from "./runtime/HDLKioskPaymentRuntime.js";
|
|
16
9
|
import { HDLKioskIdentityAuthPanel } from "./auth/HDLKioskIdentityAuthPanel.js";
|
|
17
10
|
import { useHDLKioskH5AuthModule } from "./auth/useHDLKioskH5AuthModule.js";
|
|
18
|
-
import { BigSaleScaleRuntimeOwner
|
|
11
|
+
import { BigSaleScaleRuntimeOwner } from "./runtime/BigSaleScaleRuntimeOwner.js";
|
|
19
12
|
import { resolvePrimaryWeightedProductId } from "./primaryWeightedProduct.js";
|
|
13
|
+
import { useBigSaleHDLKioskCart } from "./cart/useBigSaleHDLKioskCart.js";
|
|
20
14
|
import React, { useCallback, useEffect, useMemo, useRef } from "react";
|
|
21
15
|
import { locales } from "@pisell/utils";
|
|
22
16
|
//#region src/components/bigSale/templates/HDLKiosk/index.tsx
|
|
@@ -26,41 +20,6 @@ import { locales } from "@pisell/utils";
|
|
|
26
20
|
* NativeScale owner,再将独立 HDLKiosk 作为物料渲染。
|
|
27
21
|
* 边界:兼容代码限制在本目录,不修改 HDLKiosk Core,也不要求 BigSale 上层传专用 props。
|
|
28
22
|
*/
|
|
29
|
-
const HDL_KIOSK_CART_HIDDEN_MODULES = [
|
|
30
|
-
"overview",
|
|
31
|
-
"customer",
|
|
32
|
-
"contact",
|
|
33
|
-
"cartActions",
|
|
34
|
-
"orderActions",
|
|
35
|
-
"promotionAlert"
|
|
36
|
-
];
|
|
37
|
-
const HDL_KIOSK_A12_PRESENTATION = {
|
|
38
|
-
density: "comfortable",
|
|
39
|
-
optionColumns: 2,
|
|
40
|
-
mediaFit: "cover",
|
|
41
|
-
contentAlign: "center",
|
|
42
|
-
tokens: {
|
|
43
|
-
background: "#ffffff",
|
|
44
|
-
borderColor: "#e4e7ec",
|
|
45
|
-
borderRadius: "18px",
|
|
46
|
-
minHeight: "164px",
|
|
47
|
-
mediaWidth: "228px",
|
|
48
|
-
actionRailWidth: "174px",
|
|
49
|
-
contentPadding: "20px 22px",
|
|
50
|
-
actionRailPadding: "18px 20px",
|
|
51
|
-
accentColor: "#b20d12",
|
|
52
|
-
titleColor: "#101828",
|
|
53
|
-
titleFontSize: "32px",
|
|
54
|
-
titleFontWeight: 800,
|
|
55
|
-
priceColor: "#b20d12",
|
|
56
|
-
priceFontSize: "30px",
|
|
57
|
-
optionBackground: "#f5f6f8",
|
|
58
|
-
optionLabelColor: "#667085",
|
|
59
|
-
optionValueColor: "#101828",
|
|
60
|
-
optionGap: "6px",
|
|
61
|
-
shadow: "0 12px 28px rgba(16, 24, 40, 0.08)"
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
23
|
function resolveHDLKioskBigSaleConfig(primaryWeightedProductId) {
|
|
65
24
|
return resolveHDLKioskConfig({ primaryWeightedProductId });
|
|
66
25
|
}
|
|
@@ -69,7 +28,7 @@ function resolveHDLKioskBigSaleConfig(primaryWeightedProductId) {
|
|
|
69
28
|
* 仅负责装配 Host 和配置,不承载流程或页面语义。
|
|
70
29
|
*/
|
|
71
30
|
function HDLKioskBigSaleTemplate({ isActive = true, context, businessCode, locale, productLoadParams, productCatalogSessionKey, productCatalogReady = true, saleDetailModuleConfig, onOrderComplete, variant }) {
|
|
72
|
-
var _engineContext$appHel, _engineContext$appHel2, _engineContext$appHel4, _engineContext$
|
|
31
|
+
var _engineContext$appHel, _engineContext$appHel2, _engineContext$appHel4, _engineContext$appHel9, _engineContext$appHel10, _engineContext$appHel11, _engineContext$appHel12, _context$sales$bookin, _context$sales$bookin2, _context$sales$bookin3, _productLoadParams$me, _context$sales$defaul, _context$sales$tempOr, _context$sales$tempOr2, _context$sales$tempOr3, _context$sales$tempOr4, _ref;
|
|
73
32
|
const entryDataPreparing = !productCatalogReady || context.products.loading || context.sales.catalogState === "pending";
|
|
74
33
|
const primaryWeightedProductId = !entryDataPreparing && !context.products.error && context.sales.catalogState === "ready" ? resolvePrimaryWeightedProductId(context.products.products) : void 0;
|
|
75
34
|
const config = useMemo(() => resolveHDLKioskBigSaleConfig(primaryWeightedProductId), [primaryWeightedProductId]);
|
|
@@ -90,113 +49,49 @@ function HDLKioskBigSaleTemplate({ isActive = true, context, businessCode, local
|
|
|
90
49
|
const app = engineContext === null || engineContext === void 0 || (_engineContext$appHel3 = engineContext.appHelper) === null || _engineContext$appHel3 === void 0 || (_engineContext$appHel3 = _engineContext$appHel3.utils) === null || _engineContext$appHel3 === void 0 ? void 0 : _engineContext$appHel3.getApp();
|
|
91
50
|
app === null || app === void 0 || (_app$history = app.history) === null || _app$history === void 0 || _app$history.push("/admin-entry");
|
|
92
51
|
}, [engineContext === null || engineContext === void 0 || (_engineContext$appHel4 = engineContext.appHelper) === null || _engineContext$appHel4 === void 0 ? void 0 : _engineContext$appHel4.utils]);
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
const scaleRuntimeOwnerId = useMemo(() => `hdl-kiosk-scale-runtime:${Date.now()}`, []);
|
|
100
|
-
const nativeScaleTools = engineContext === null || engineContext === void 0 || (_engineContext$appHel5 = engineContext.appHelper) === null || _engineContext$appHel5 === void 0 || (_engineContext$appHel5 = _engineContext$appHel5.utils) === null || _engineContext$appHel5 === void 0 || (_engineContext$appHel6 = _engineContext$appHel5.getApp) === null || _engineContext$appHel6 === void 0 || (_engineContext$appHel6 = _engineContext$appHel6.call(_engineContext$appHel5)) === null || _engineContext$appHel6 === void 0 || (_engineContext$appHel6 = _engineContext$appHel6.plugins) === null || _engineContext$appHel6 === void 0 || (_engineContext$appHel7 = _engineContext$appHel6.get) === null || _engineContext$appHel7 === void 0 ? void 0 : _engineContext$appHel7.call(_engineContext$appHel6, "nativeScaleTools");
|
|
101
|
-
const nativeScaleSourceAvailable = typeof (nativeScaleTools === null || nativeScaleTools === void 0 ? void 0 : nativeScaleTools.useNativeScale) === "function";
|
|
102
|
-
const fulfillmentWriter = useMemo(() => createHDLKioskFulfillmentWriter(context.sales.bookingTicket), [context.sales.bookingTicket]);
|
|
103
|
-
const host = useBigSaleHDLKioskHost(context, businessCode, useMemo(() => ({
|
|
104
|
-
writeFulfillment: fulfillmentWriter,
|
|
105
|
-
getPaymentController: () => paymentControllerRef.current,
|
|
106
|
-
subscribeWeightChange: scaleTriggerHub.subscribeWeightChange,
|
|
107
|
-
subscribeScaleConnection: scaleTriggerHub.subscribeConnection,
|
|
108
|
-
getAuthenticatedCustomer: (customerId) => {
|
|
109
|
-
const customer = authenticatedCustomerRef.current;
|
|
110
|
-
return customer && String(customer.id) === customerId ? customer : void 0;
|
|
52
|
+
const publishCollaborationStatus = useCallback((status) => {
|
|
53
|
+
try {
|
|
54
|
+
var _engineContext$appHel5, _engineContext$appHel6, _engineContext$appHel7, _engineContext$appHel8;
|
|
55
|
+
engineContext === null || engineContext === void 0 || (_engineContext$appHel5 = engineContext.appHelper) === null || _engineContext$appHel5 === void 0 || (_engineContext$appHel5 = _engineContext$appHel5.utils) === null || _engineContext$appHel5 === void 0 || (_engineContext$appHel6 = _engineContext$appHel5.getApp) === null || _engineContext$appHel6 === void 0 || (_engineContext$appHel6 = _engineContext$appHel6.call(_engineContext$appHel5)) === null || _engineContext$appHel6 === void 0 || (_engineContext$appHel6 = _engineContext$appHel6.applicationManager) === null || _engineContext$appHel6 === void 0 || (_engineContext$appHel7 = _engineContext$appHel6.get) === null || _engineContext$appHel7 === void 0 || (_engineContext$appHel7 = _engineContext$appHel7.call(_engineContext$appHel6, "kioskCollaborationPreview")) === null || _engineContext$appHel7 === void 0 || (_engineContext$appHel8 = _engineContext$appHel7.runFunction) === null || _engineContext$appHel8 === void 0 || _engineContext$appHel8.call(_engineContext$appHel7, "publishStatus", { status });
|
|
56
|
+
} catch (error) {
|
|
57
|
+
console.warn("[HDLKiosk] 协同预览状态上报失败,不影响销售流程", error);
|
|
111
58
|
}
|
|
112
|
-
}
|
|
59
|
+
}, [engineContext === null || engineContext === void 0 || (_engineContext$appHel9 = engineContext.appHelper) === null || _engineContext$appHel9 === void 0 ? void 0 : _engineContext$appHel9.utils]);
|
|
60
|
+
const h5AuthModuleName = useHDLKioskH5AuthModule(engineContext, context.sales);
|
|
61
|
+
const nativeScaleTools = engineContext === null || engineContext === void 0 || (_engineContext$appHel10 = engineContext.appHelper) === null || _engineContext$appHel10 === void 0 || (_engineContext$appHel10 = _engineContext$appHel10.utils) === null || _engineContext$appHel10 === void 0 || (_engineContext$appHel11 = _engineContext$appHel10.getApp) === null || _engineContext$appHel11 === void 0 || (_engineContext$appHel11 = _engineContext$appHel11.call(_engineContext$appHel10)) === null || _engineContext$appHel11 === void 0 || (_engineContext$appHel11 = _engineContext$appHel11.plugins) === null || _engineContext$appHel11 === void 0 || (_engineContext$appHel12 = _engineContext$appHel11.get) === null || _engineContext$appHel12 === void 0 ? void 0 : _engineContext$appHel12.call(_engineContext$appHel11, "nativeScaleTools");
|
|
62
|
+
const { host, paymentControllerRef, rememberAuthenticatedCustomer, scaleBridge } = useBigSaleHDLKioskAdapter({
|
|
63
|
+
context,
|
|
64
|
+
businessCode,
|
|
65
|
+
isActive,
|
|
66
|
+
nativeScaleSourceAvailable: typeof (nativeScaleTools === null || nativeScaleTools === void 0 ? void 0 : nativeScaleTools.useNativeScale) === "function"
|
|
67
|
+
});
|
|
113
68
|
const catalogLoadAttemptRef = useRef(void 0);
|
|
114
69
|
const renderIdentityAuth = useCallback((props) => /* @__PURE__ */ React.createElement(HDLKioskIdentityAuthPanel, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
115
70
|
context,
|
|
116
71
|
registerAndLoginModuleName: h5AuthModuleName,
|
|
117
|
-
onCustomerResolved:
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
const { openOrderNoteModal, orderNoteModal } = useOrderNoteModal({
|
|
123
|
-
context: saleDetailContext,
|
|
124
|
-
modalClassName: "pisell-kiosk-modal pisell-kiosk-note-modal"
|
|
125
|
-
});
|
|
126
|
-
const hasOrderNote = Boolean(String((_note = (_ref = (_context$sales$tempOr = context.sales.tempOrder) !== null && _context$sales$tempOr !== void 0 ? _context$sales$tempOr : (_context$sales$bookin = context.sales.bookingTicket) === null || _context$sales$bookin === void 0 || (_context$sales$bookin2 = _context$sales$bookin.getTempOrder) === null || _context$sales$bookin2 === void 0 ? void 0 : _context$sales$bookin2.call(_context$sales$bookin)) === null || _ref === void 0 ? void 0 : _ref.note) !== null && _note !== void 0 ? _note : "").trim());
|
|
127
|
-
const selectedPromotionCount = useMemo(() => buildVoucherViews(context.cart.discountList || []).filter((voucher) => voucher.selected).length, [context.cart.discountList]);
|
|
128
|
-
const cartOverlayActions = useMemo(() => ({
|
|
129
|
-
hasNote: hasOrderNote,
|
|
130
|
-
onAddNote: openOrderNoteModal,
|
|
131
|
-
promotionAppliedCount: selectedPromotionCount
|
|
132
|
-
}), [
|
|
133
|
-
hasOrderNote,
|
|
134
|
-
openOrderNoteModal,
|
|
135
|
-
selectedPromotionCount
|
|
72
|
+
onCustomerResolved: rememberAuthenticatedCustomer
|
|
73
|
+
})), [
|
|
74
|
+
context,
|
|
75
|
+
h5AuthModuleName,
|
|
76
|
+
rememberAuthenticatedCustomer
|
|
136
77
|
]);
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
lineNoteEditingEnabled: true,
|
|
143
|
-
showInlineRemoveButton: false,
|
|
144
|
-
showQuantityBadge: false,
|
|
145
|
-
showRemoveButton: true,
|
|
146
|
-
clearSelectedQuantityOnDelete: true,
|
|
147
|
-
productLineItemType: "a12",
|
|
148
|
-
productLineItemPresentation: HDL_KIOSK_A12_PRESENTATION
|
|
149
|
-
}),
|
|
150
|
-
amountDetails: _objectSpread2(_objectSpread2({}, saleDetailModuleConfig === null || saleDetailModuleConfig === void 0 ? void 0 : saleDetailModuleConfig.amountDetails), {}, { defaultExpanded: true }),
|
|
151
|
-
promotionWalletPanels: typeof (saleDetailModuleConfig === null || saleDetailModuleConfig === void 0 ? void 0 : saleDetailModuleConfig.promotionWalletPanels) === "object" ? saleDetailModuleConfig.promotionWalletPanels : void 0,
|
|
152
|
-
promotionWalletPanelsAppearance: "light",
|
|
153
|
-
promotionWalletPanelsBehavior: _objectSpread2(_objectSpread2({}, saleDetailModuleConfig === null || saleDetailModuleConfig === void 0 ? void 0 : saleDetailModuleConfig.promotionWalletPanelsBehavior), {}, {
|
|
154
|
-
walletAssetsCleanupCoordinator: walletAssetsCleanupCoordinatorRef.current,
|
|
155
|
-
enableManualPromotionCode: true,
|
|
156
|
-
enablePromotionBanner: true,
|
|
157
|
-
enableVoucherProductAdd: true,
|
|
158
|
-
enableWalletAssets: true,
|
|
159
|
-
preserveWalletAssetsWhileRefreshing: true
|
|
160
|
-
})
|
|
161
|
-
}), [saleDetailModuleConfig]);
|
|
162
|
-
const isPrimaryProductLine = useCallback((item) => {
|
|
163
|
-
var _ref2, _item$_extend$product, _item$_extend, _config$primaryWeight;
|
|
164
|
-
return String((_ref2 = (_item$_extend$product = item === null || item === void 0 || (_item$_extend = item._extend) === null || _item$_extend === void 0 || (_item$_extend = _item$_extend.product) === null || _item$_extend === void 0 ? void 0 : _item$_extend.product_id) !== null && _item$_extend$product !== void 0 ? _item$_extend$product : item === null || item === void 0 ? void 0 : item.product_id) !== null && _ref2 !== void 0 ? _ref2 : "") === String((_config$primaryWeight = config.primaryWeightedProductId) !== null && _config$primaryWeight !== void 0 ? _config$primaryWeight : "");
|
|
165
|
-
}, [config.primaryWeightedProductId]);
|
|
166
|
-
const renderCartContent = useCallback(({ promotionsVisible, onEditPrimaryProduct }) => /* @__PURE__ */ React.createElement(Base_default, {
|
|
167
|
-
className: "hdl-kiosk-voucher-wallet",
|
|
168
|
-
context: saleDetailContext,
|
|
169
|
-
mobilePresentation: "inline",
|
|
170
|
-
moduleConfig: _objectSpread2(_objectSpread2({}, voucherWalletModuleConfig), {}, {
|
|
171
|
-
hidden: [...HDL_KIOSK_CART_HIDDEN_MODULES, ...promotionsVisible ? [] : ["promotionWalletPanels"]],
|
|
172
|
-
cartItems: _objectSpread2(_objectSpread2({}, voucherWalletModuleConfig.cartItems), {}, {
|
|
173
|
-
isProductLineItemEditable: isPrimaryProductLine,
|
|
174
|
-
onProductLineItemEdit: onEditPrimaryProduct ? () => onEditPrimaryProduct() : void 0
|
|
175
|
-
})
|
|
176
|
-
}),
|
|
177
|
-
renderType: "current",
|
|
178
|
-
template: "A",
|
|
78
|
+
const { cartOverlayActions, orderNoteModal, renderCartContent } = useBigSaleHDLKioskCart({
|
|
79
|
+
context,
|
|
80
|
+
onOrderComplete,
|
|
81
|
+
primaryWeightedProductId: config.primaryWeightedProductId,
|
|
82
|
+
saleDetailModuleConfig,
|
|
179
83
|
variant
|
|
180
|
-
})
|
|
181
|
-
isPrimaryProductLine,
|
|
182
|
-
saleDetailContext,
|
|
183
|
-
variant,
|
|
184
|
-
voucherWalletModuleConfig
|
|
185
|
-
]);
|
|
186
|
-
const selectedCustomerId = (_context$customer$sel = context.customer.selected) === null || _context$customer$sel === void 0 ? void 0 : _context$customer$sel.id;
|
|
187
|
-
useEffect(() => {
|
|
188
|
-
if (!isActive || selectedCustomerId == null) authenticatedCustomerRef.current = void 0;
|
|
189
|
-
}, [isActive, selectedCustomerId]);
|
|
84
|
+
});
|
|
190
85
|
const catalogProductCount = context.products.products.length;
|
|
191
|
-
const osCatalogProductCount = (_context$sales$
|
|
86
|
+
const osCatalogProductCount = (_context$sales$bookin = (_context$sales$bookin2 = context.sales.bookingTicket) === null || _context$sales$bookin2 === void 0 || (_context$sales$bookin3 = _context$sales$bookin2.getProductCatalog) === null || _context$sales$bookin3 === void 0 || (_context$sales$bookin3 = _context$sales$bookin3.call(_context$sales$bookin2)) === null || _context$sales$bookin3 === void 0 || (_context$sales$bookin3 = _context$sales$bookin3.products) === null || _context$sales$bookin3 === void 0 ? void 0 : _context$sales$bookin3.length) !== null && _context$sales$bookin !== void 0 ? _context$sales$bookin : 0;
|
|
192
87
|
const menuListIds = (_productLoadParams$me = productLoadParams === null || productLoadParams === void 0 ? void 0 : productLoadParams.menu_list_ids) !== null && _productLoadParams$me !== void 0 ? _productLoadParams$me : (_context$sales$defaul = context.sales.defaultProductLoadParams) === null || _context$sales$defaul === void 0 ? void 0 : _context$sales$defaul.menu_list_ids;
|
|
193
88
|
const hasCatalogSource = catalogProductCount > 0 || osCatalogProductCount > 0 || Array.isArray(menuListIds) && menuListIds.length > 0;
|
|
194
89
|
const skipsCatalogLoad = typeof productCatalogSessionKey === "string" && /-p0$/.test(productCatalogSessionKey);
|
|
195
90
|
const catalogLoadKey = JSON.stringify({
|
|
196
91
|
sessionKey: productCatalogSessionKey !== null && productCatalogSessionKey !== void 0 ? productCatalogSessionKey : "",
|
|
197
|
-
orderId: (_context$sales$
|
|
198
|
-
customerId: (_context$sales$
|
|
199
|
-
params: (
|
|
92
|
+
orderId: (_context$sales$tempOr = (_context$sales$tempOr2 = context.sales.tempOrder) === null || _context$sales$tempOr2 === void 0 ? void 0 : _context$sales$tempOr2.order_id) !== null && _context$sales$tempOr !== void 0 ? _context$sales$tempOr : null,
|
|
93
|
+
customerId: (_context$sales$tempOr3 = (_context$sales$tempOr4 = context.sales.tempOrder) === null || _context$sales$tempOr4 === void 0 ? void 0 : _context$sales$tempOr4.customer_id) !== null && _context$sales$tempOr3 !== void 0 ? _context$sales$tempOr3 : null,
|
|
94
|
+
params: (_ref = productLoadParams !== null && productLoadParams !== void 0 ? productLoadParams : context.sales.defaultProductLoadParams) !== null && _ref !== void 0 ? _ref : {}
|
|
200
95
|
});
|
|
201
96
|
useEffect(() => {
|
|
202
97
|
if (!isActive || !productCatalogReady || skipsCatalogLoad || !context.sales.isReady || context.sales.catalogState !== "ready" || !context.sales.bookingTicket || !hasCatalogSource || catalogLoadAttemptRef.current === catalogLoadKey) return;
|
|
@@ -220,11 +115,9 @@ function HDLKioskBigSaleTemplate({ isActive = true, context, businessCode, local
|
|
|
220
115
|
]);
|
|
221
116
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(BigSaleScaleRuntimeOwner, {
|
|
222
117
|
active: isActive && (config.enabledEntries.includes("scale") || config.enabledEntries.includes("quick") || config.enabledEntries.includes("barcode")) && Boolean(config.primaryWeightedProductId),
|
|
223
|
-
|
|
118
|
+
bridge: scaleBridge,
|
|
224
119
|
nativeScaleTools,
|
|
225
|
-
minimumWeightKg: config.scaleTriggerMinimumWeightKg
|
|
226
|
-
ownerId: scaleRuntimeOwnerId,
|
|
227
|
-
runtime: scaleRuntime
|
|
120
|
+
minimumWeightKg: config.scaleTriggerMinimumWeightKg
|
|
228
121
|
}), /* @__PURE__ */ React.createElement(HDLKiosk, {
|
|
229
122
|
host,
|
|
230
123
|
config,
|
|
@@ -232,8 +125,9 @@ function HDLKioskBigSaleTemplate({ isActive = true, context, businessCode, local
|
|
|
232
125
|
isActive,
|
|
233
126
|
locale,
|
|
234
127
|
onTechnicalSupportClick: handleTechnicalSupportClick,
|
|
128
|
+
onCollaborationStatusChange: publishCollaborationStatus,
|
|
235
129
|
onLocaleChange: typeof updateLocaleRuntime === "function" ? handleLocaleChange : void 0,
|
|
236
|
-
scaleRuntime,
|
|
130
|
+
scaleRuntime: scaleBridge.runtime,
|
|
237
131
|
renderIdentityAuth: h5AuthModuleName ? renderIdentityAuth : void 0,
|
|
238
132
|
renderCartContent,
|
|
239
133
|
cartOverlayActions
|