@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,31 @@
|
|
|
1
|
+
const require_asyncToGenerator = require("../../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
|
|
2
|
+
const require_normalize = require("../normalize.js");
|
|
3
|
+
//#region src/components/bigSale/templates/HDLKiosk/adapter/sales/fulfillment.ts
|
|
4
|
+
function createBigSaleFulfillmentOperations({ writeFulfillment, getWriteFulfillment, allowSimulatedFulfillment = false, onSimulatedFulfillment }) {
|
|
5
|
+
return { setFulfillment: function() {
|
|
6
|
+
var _ref = require_asyncToGenerator._asyncToGenerator(function* (input, signal) {
|
|
7
|
+
if (signal.aborted) return { status: "cancelled" };
|
|
8
|
+
const currentWriteFulfillment = getWriteFulfillment ? getWriteFulfillment() : writeFulfillment;
|
|
9
|
+
if (!currentWriteFulfillment) {
|
|
10
|
+
if (allowSimulatedFulfillment) {
|
|
11
|
+
onSimulatedFulfillment === null || onSimulatedFulfillment === void 0 || onSimulatedFulfillment(input);
|
|
12
|
+
return {
|
|
13
|
+
status: "succeeded",
|
|
14
|
+
data: void 0
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
return require_normalize.failed("fulfillmentHostWriterUnavailable", "staff");
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
return yield currentWriteFulfillment(input, signal);
|
|
21
|
+
} catch (error) {
|
|
22
|
+
return require_normalize.partialFailure("fulfillmentWriteFailed", error);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
return function setFulfillment(_x, _x2) {
|
|
26
|
+
return _ref.apply(this, arguments);
|
|
27
|
+
};
|
|
28
|
+
}() };
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
exports.createBigSaleFulfillmentOperations = createBigSaleFulfillmentOperations;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
const require_objectSpread2 = require("../../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
|
|
2
|
+
const require_asyncToGenerator = require("../../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
|
|
3
|
+
const require_normalize = require("../normalize.js");
|
|
4
|
+
//#region src/components/bigSale/templates/HDLKiosk/adapter/sales/identity.ts
|
|
5
|
+
function projectConfirmedCustomer(customer) {
|
|
6
|
+
var _customer$id;
|
|
7
|
+
if (!customer || [
|
|
8
|
+
"0",
|
|
9
|
+
"1",
|
|
10
|
+
""
|
|
11
|
+
].includes(String((_customer$id = customer.id) !== null && _customer$id !== void 0 ? _customer$id : ""))) return;
|
|
12
|
+
return Object.freeze(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({
|
|
13
|
+
customerId: String(customer.id),
|
|
14
|
+
displayName: typeof customer.name === "string" ? customer.name : void 0
|
|
15
|
+
}, typeof customer.avatar === "string" && customer.avatar.trim() ? { avatarUrl: customer.avatar.trim() } : {}), {}, { member: true }));
|
|
16
|
+
}
|
|
17
|
+
function createBigSaleIdentityOperations({ getContext, getAuthenticatedCustomer }) {
|
|
18
|
+
return { selectIdentity: function() {
|
|
19
|
+
var _ref = require_asyncToGenerator._asyncToGenerator(function* (input, signal) {
|
|
20
|
+
if (signal.aborted) return { status: "cancelled" };
|
|
21
|
+
try {
|
|
22
|
+
var _input$customerId, _currentCustomer$id, _selected$id;
|
|
23
|
+
const context = getContext();
|
|
24
|
+
const customerId = (_input$customerId = input.customerId) === null || _input$customerId === void 0 ? void 0 : _input$customerId.trim();
|
|
25
|
+
if (!customerId) {
|
|
26
|
+
context.customer.select(null);
|
|
27
|
+
if (signal.aborted) return require_normalize.unknown("identityAbortedAfterDispatch");
|
|
28
|
+
return {
|
|
29
|
+
status: "succeeded",
|
|
30
|
+
data: {}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const authenticatedCustomer = getAuthenticatedCustomer === null || getAuthenticatedCustomer === void 0 ? void 0 : getAuthenticatedCustomer(customerId);
|
|
34
|
+
const currentCustomer = context.customer.selected;
|
|
35
|
+
const selected = authenticatedCustomer !== null && authenticatedCustomer !== void 0 ? authenticatedCustomer : String((_currentCustomer$id = currentCustomer === null || currentCustomer === void 0 ? void 0 : currentCustomer.id) !== null && _currentCustomer$id !== void 0 ? _currentCustomer$id : "") === customerId ? currentCustomer : void 0;
|
|
36
|
+
if (!selected || String(selected.id) !== customerId || [
|
|
37
|
+
"0",
|
|
38
|
+
"1",
|
|
39
|
+
""
|
|
40
|
+
].includes(String((_selected$id = selected.id) !== null && _selected$id !== void 0 ? _selected$id : ""))) return require_normalize.failed("authenticatedCustomerUnavailable", "back");
|
|
41
|
+
context.customer.select(selected);
|
|
42
|
+
if (signal.aborted) return require_normalize.unknown("identityAbortedAfterDispatch");
|
|
43
|
+
return {
|
|
44
|
+
status: "succeeded",
|
|
45
|
+
data: { customer: projectConfirmedCustomer(selected) }
|
|
46
|
+
};
|
|
47
|
+
} catch (error) {
|
|
48
|
+
return require_normalize.partialFailure("identitySelectionFailed", error);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
return function selectIdentity(_x, _x2) {
|
|
52
|
+
return _ref.apply(this, arguments);
|
|
53
|
+
};
|
|
54
|
+
}() };
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
exports.createBigSaleIdentityOperations = createBigSaleIdentityOperations;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const require_objectSpread2 = require("../../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
|
|
2
|
+
const require_catalog = require("./catalog.js");
|
|
3
|
+
const require_cart = require("./cart.js");
|
|
4
|
+
const require_fulfillment = require("./fulfillment.js");
|
|
5
|
+
const require_identity = require("./identity.js");
|
|
6
|
+
const require_payment = require("./payment.js");
|
|
7
|
+
const require_session = require("./session.js");
|
|
8
|
+
const require_weightedOperations = require("./weightedOperations.js");
|
|
9
|
+
//#region src/components/bigSale/templates/HDLKiosk/adapter/sales/index.ts
|
|
10
|
+
function createBigSaleSalesPort(dependencies) {
|
|
11
|
+
const { getContext, getSnapshot, subscribeProjection } = dependencies;
|
|
12
|
+
return require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({ getObservedSnapshot: getSnapshot }, require_catalog.createBigSaleCatalogOperations({ getContext })), {}, { subscribe: (listener) => {
|
|
13
|
+
var _subscribeProjection;
|
|
14
|
+
return (_subscribeProjection = subscribeProjection === null || subscribeProjection === void 0 ? void 0 : subscribeProjection(listener)) !== null && _subscribeProjection !== void 0 ? _subscribeProjection : (() => void 0);
|
|
15
|
+
} }, require_session.createBigSaleSessionOperations({ getContext })), require_identity.createBigSaleIdentityOperations(dependencies)), require_fulfillment.createBigSaleFulfillmentOperations(dependencies)), require_weightedOperations.createBigSaleWeightedProductOperations({ getContext })), require_cart.createBigSaleCartOperations(dependencies)), require_payment.createBigSalePaymentOperations(dependencies));
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
exports.createBigSaleSalesPort = createBigSaleSalesPort;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
const require_asyncToGenerator = require("../../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
|
|
2
|
+
const require_normalize = require("../normalize.js");
|
|
3
|
+
//#region src/components/bigSale/templates/HDLKiosk/adapter/sales/payment.ts
|
|
4
|
+
function cancelled(reason) {
|
|
5
|
+
return {
|
|
6
|
+
status: "cancelled",
|
|
7
|
+
reason
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
function normalizeCheckoutResult(result, snapshot) {
|
|
11
|
+
var _readPath, _result$orderId, _snapshot$orderId, _snapshot$customer;
|
|
12
|
+
const status = require_normalize.isRecord(result) ? result.status : void 0;
|
|
13
|
+
const reason = require_normalize.isRecord(result) ? result.reason : void 0;
|
|
14
|
+
const type = require_normalize.isRecord(result) ? result.type : void 0;
|
|
15
|
+
if (status === "cancelled" || reason === "back" || reason === "cancel") return {
|
|
16
|
+
status: "cancelled",
|
|
17
|
+
reason: String(reason !== null && reason !== void 0 ? reason : "cancelled")
|
|
18
|
+
};
|
|
19
|
+
const paymentStatus = (_readPath = require_normalize.readPath(result, [
|
|
20
|
+
"payload",
|
|
21
|
+
"paymentResult",
|
|
22
|
+
"paymentResultViewModel",
|
|
23
|
+
"status"
|
|
24
|
+
])) !== null && _readPath !== void 0 ? _readPath : require_normalize.readPath(result, [
|
|
25
|
+
"data",
|
|
26
|
+
"paymentResult",
|
|
27
|
+
"paymentResultViewModel",
|
|
28
|
+
"status"
|
|
29
|
+
]);
|
|
30
|
+
if (paymentStatus === "failed" || paymentStatus === "wallet-pass-failed") return require_normalize.failed("checkoutFailed", "retry");
|
|
31
|
+
if (type === "error" || status === "failed") return require_normalize.failed("checkoutFailed", "retry");
|
|
32
|
+
if (!(paymentStatus === "success" || paymentStatus === "paid" || paymentStatus === "deposit-paid" || status === "success" || status === "paid")) return require_normalize.unknown("checkoutResultAmbiguous");
|
|
33
|
+
const resultOrderId = require_normalize.isRecord(result) && ((_result$orderId = result.orderId) !== null && _result$orderId !== void 0 ? _result$orderId : result.order_id) || require_normalize.readPath(result, ["payload", "order_id"]) || require_normalize.readPath(result, ["payload", "orderId"]);
|
|
34
|
+
const orderId = (_snapshot$orderId = snapshot.orderId) !== null && _snapshot$orderId !== void 0 ? _snapshot$orderId : resultOrderId;
|
|
35
|
+
if (!orderId || snapshot.summary.status !== "ready") return require_normalize.unknown("checkoutSuccessMissingOrderFacts");
|
|
36
|
+
return {
|
|
37
|
+
status: "succeeded",
|
|
38
|
+
data: {
|
|
39
|
+
orderId: String(orderId),
|
|
40
|
+
amount: snapshot.summary.due,
|
|
41
|
+
member: ((_snapshot$customer = snapshot.customer) === null || _snapshot$customer === void 0 ? void 0 : _snapshot$customer.member) === true
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function refreshCheckoutOrderProjection(_x, _x2, _x3) {
|
|
46
|
+
return _refreshCheckoutOrderProjection.apply(this, arguments);
|
|
47
|
+
}
|
|
48
|
+
function _refreshCheckoutOrderProjection() {
|
|
49
|
+
_refreshCheckoutOrderProjection = require_asyncToGenerator._asyncToGenerator(function* (getContext, getSnapshot, result) {
|
|
50
|
+
if (result.status !== "succeeded" || getSnapshot().pickupNumber) return;
|
|
51
|
+
const loadDetail = getContext().sales.loadDetail;
|
|
52
|
+
if (typeof loadDetail !== "function") return;
|
|
53
|
+
try {
|
|
54
|
+
yield loadDetail({
|
|
55
|
+
orderId: result.data.orderId,
|
|
56
|
+
forceRemote: true
|
|
57
|
+
});
|
|
58
|
+
} catch (_unused) {}
|
|
59
|
+
});
|
|
60
|
+
return _refreshCheckoutOrderProjection.apply(this, arguments);
|
|
61
|
+
}
|
|
62
|
+
function createBigSalePaymentOperations({ getContext, getSnapshot, getPaymentController }) {
|
|
63
|
+
return {
|
|
64
|
+
loadPaymentMethods: function() {
|
|
65
|
+
var _ref = require_asyncToGenerator._asyncToGenerator(function* (signal) {
|
|
66
|
+
if (signal.aborted) return cancelled("paymentMethodsAborted");
|
|
67
|
+
const controller = getPaymentController === null || getPaymentController === void 0 ? void 0 : getPaymentController();
|
|
68
|
+
return controller ? controller.loadPaymentMethods() : require_normalize.failed("paymentRuntimeUnavailable", "staff");
|
|
69
|
+
});
|
|
70
|
+
return function loadPaymentMethods(_x4) {
|
|
71
|
+
return _ref.apply(this, arguments);
|
|
72
|
+
};
|
|
73
|
+
}(),
|
|
74
|
+
payEftpos: function() {
|
|
75
|
+
var _ref2 = require_asyncToGenerator._asyncToGenerator(function* (input, signal) {
|
|
76
|
+
if (signal.aborted) return cancelled("eftposAborted");
|
|
77
|
+
const controller = getPaymentController === null || getPaymentController === void 0 ? void 0 : getPaymentController();
|
|
78
|
+
return controller ? controller.payEftpos(input) : require_normalize.failed("paymentRuntimeUnavailable", "staff");
|
|
79
|
+
});
|
|
80
|
+
return function payEftpos(_x5, _x6) {
|
|
81
|
+
return _ref2.apply(this, arguments);
|
|
82
|
+
};
|
|
83
|
+
}(),
|
|
84
|
+
requestStaffPaymentApproval: function() {
|
|
85
|
+
var _ref3 = require_asyncToGenerator._asyncToGenerator(function* (input, signal) {
|
|
86
|
+
if (signal.aborted) return cancelled("staffPaymentApprovalAborted");
|
|
87
|
+
const controller = getPaymentController === null || getPaymentController === void 0 ? void 0 : getPaymentController();
|
|
88
|
+
return controller ? controller.requestStaffPaymentApproval(input) : require_normalize.failed("paymentRuntimeUnavailable", "staff");
|
|
89
|
+
});
|
|
90
|
+
return function requestStaffPaymentApproval(_x7, _x8) {
|
|
91
|
+
return _ref3.apply(this, arguments);
|
|
92
|
+
};
|
|
93
|
+
}(),
|
|
94
|
+
subscribeStaffPaymentAuthorizationResult: (listener) => {
|
|
95
|
+
var _controller$subscribe;
|
|
96
|
+
const controller = getPaymentController === null || getPaymentController === void 0 ? void 0 : getPaymentController();
|
|
97
|
+
return (_controller$subscribe = controller === null || controller === void 0 ? void 0 : controller.subscribeStaffPaymentAuthorizationResult(listener)) !== null && _controller$subscribe !== void 0 ? _controller$subscribe : (() => void 0);
|
|
98
|
+
},
|
|
99
|
+
openCheckout: function() {
|
|
100
|
+
var _ref4 = require_asyncToGenerator._asyncToGenerator(function* (signal) {
|
|
101
|
+
if (signal.aborted) return { status: "cancelled" };
|
|
102
|
+
try {
|
|
103
|
+
const snapshotBeforeCheckout = getSnapshot();
|
|
104
|
+
const result = yield getContext().sales.openCheckout({
|
|
105
|
+
paymentResultDisplayMode: "page",
|
|
106
|
+
walletPassMode: "shared"
|
|
107
|
+
});
|
|
108
|
+
if (signal.aborted) return require_normalize.unknown("checkoutAbortedAfterDispatch");
|
|
109
|
+
const checkoutResult = normalizeCheckoutResult(result, snapshotBeforeCheckout);
|
|
110
|
+
yield refreshCheckoutOrderProjection(getContext, getSnapshot, checkoutResult);
|
|
111
|
+
return checkoutResult;
|
|
112
|
+
} catch (error) {
|
|
113
|
+
return require_normalize.unknown("checkoutInvocationFailed", error);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
return function openCheckout(_x9) {
|
|
117
|
+
return _ref4.apply(this, arguments);
|
|
118
|
+
};
|
|
119
|
+
}()
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
//#endregion
|
|
123
|
+
exports.createBigSalePaymentOperations = createBigSalePaymentOperations;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
const require_asyncToGenerator = require("../../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
|
|
2
|
+
const require_normalize = require("../normalize.js");
|
|
3
|
+
const require_projection = require("../host/projection.js");
|
|
4
|
+
//#region src/components/bigSale/templates/HDLKiosk/adapter/sales/session.ts
|
|
5
|
+
const PAYMENT_WRITE_FROZEN_STATUSES = new Set(["payment_pending", "processing"]);
|
|
6
|
+
function readPaymentStatus(order) {
|
|
7
|
+
var _order$payment_status;
|
|
8
|
+
return String((_order$payment_status = order === null || order === void 0 ? void 0 : order.payment_status) !== null && _order$payment_status !== void 0 ? _order$payment_status : "").trim().toLowerCase();
|
|
9
|
+
}
|
|
10
|
+
function hasCommittedOrderIdentity(order) {
|
|
11
|
+
const orderId = order === null || order === void 0 ? void 0 : order.order_id;
|
|
12
|
+
return orderId !== null && orderId !== void 0 && String(orderId).trim() !== "";
|
|
13
|
+
}
|
|
14
|
+
function isCommittedPaidOrder(order) {
|
|
15
|
+
return readPaymentStatus(order) === "paid" && hasCommittedOrderIdentity(order);
|
|
16
|
+
}
|
|
17
|
+
function createBigSaleSessionOperations({ getContext }) {
|
|
18
|
+
return {
|
|
19
|
+
ensureSession: function() {
|
|
20
|
+
var _ref = require_asyncToGenerator._asyncToGenerator(function* (signal) {
|
|
21
|
+
if (signal.aborted) return { status: "cancelled" };
|
|
22
|
+
const context = getContext();
|
|
23
|
+
const currentOrder = require_projection.resolveBigSaleLiveTempOrder(context);
|
|
24
|
+
const currentPaymentStatus = readPaymentStatus(currentOrder);
|
|
25
|
+
if (PAYMENT_WRITE_FROZEN_STATUSES.has(currentPaymentStatus)) return require_normalize.unknown("ensureSessionPaymentInProgress");
|
|
26
|
+
if (currentOrder && !isCommittedPaidOrder(currentOrder)) return {
|
|
27
|
+
status: "succeeded",
|
|
28
|
+
data: void 0
|
|
29
|
+
};
|
|
30
|
+
try {
|
|
31
|
+
const createdOrder = isCommittedPaidOrder(currentOrder) ? yield context.sales.clearCartAndReset() : yield context.sales.createNew();
|
|
32
|
+
if (signal.aborted) return require_normalize.unknown("ensureSessionAbortedAfterDispatch");
|
|
33
|
+
const liveCreatedOrder = require_projection.resolveBigSaleLiveTempOrder(getContext());
|
|
34
|
+
const createdPaymentStatus = readPaymentStatus(liveCreatedOrder !== null && liveCreatedOrder !== void 0 ? liveCreatedOrder : createdOrder);
|
|
35
|
+
if (isCommittedPaidOrder(liveCreatedOrder !== null && liveCreatedOrder !== void 0 ? liveCreatedOrder : createdOrder) || PAYMENT_WRITE_FROZEN_STATUSES.has(createdPaymentStatus)) return require_normalize.unknown("ensureSessionNotWritable");
|
|
36
|
+
return {
|
|
37
|
+
status: "succeeded",
|
|
38
|
+
data: void 0
|
|
39
|
+
};
|
|
40
|
+
} catch (error) {
|
|
41
|
+
return require_normalize.partialFailure("ensureSessionFailed", error);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
return function ensureSession(_x) {
|
|
45
|
+
return _ref.apply(this, arguments);
|
|
46
|
+
};
|
|
47
|
+
}(),
|
|
48
|
+
clearAndReset: function() {
|
|
49
|
+
var _ref2 = require_asyncToGenerator._asyncToGenerator(function* (signal) {
|
|
50
|
+
if (signal.aborted) return { status: "cancelled" };
|
|
51
|
+
try {
|
|
52
|
+
var _resetOrder$products$, _resetOrder$products, _resetOrder$bookings$, _resetOrder$bookings;
|
|
53
|
+
const resetOrder = yield getContext().sales.clearCartAndReset();
|
|
54
|
+
if (signal.aborted) return require_normalize.unknown("resetAbortedAfterDispatch");
|
|
55
|
+
if (!(((_resetOrder$products$ = (_resetOrder$products = resetOrder.products) === null || _resetOrder$products === void 0 ? void 0 : _resetOrder$products.length) !== null && _resetOrder$products$ !== void 0 ? _resetOrder$products$ : 0) === 0 && ((_resetOrder$bookings$ = (_resetOrder$bookings = resetOrder.bookings) === null || _resetOrder$bookings === void 0 ? void 0 : _resetOrder$bookings.length) !== null && _resetOrder$bookings$ !== void 0 ? _resetOrder$bookings$ : 0) === 0)) return require_normalize.unknown("resetHostResultNotEmpty");
|
|
56
|
+
return {
|
|
57
|
+
status: "succeeded",
|
|
58
|
+
data: { cartEmpty: true }
|
|
59
|
+
};
|
|
60
|
+
} catch (error) {
|
|
61
|
+
return require_normalize.partialFailure("resetFailed", error);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
return function clearAndReset(_x2) {
|
|
65
|
+
return _ref2.apply(this, arguments);
|
|
66
|
+
};
|
|
67
|
+
}()
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
71
|
+
exports.createBigSaleSessionOperations = createBigSaleSessionOperations;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
const require_runtime = require("../../../../../../_virtual/_rolldown/runtime.js");
|
|
2
|
+
const require_objectSpread2 = require("../../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
|
|
3
|
+
const require_asyncToGenerator = require("../../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
|
|
4
|
+
const require_productSkuOptions = require("../../../../../../plus/salesSdk/utils/productSkuOptions.js");
|
|
5
|
+
const require_identity = require("../../../../../../plus/salesSdk/utils/identity.js");
|
|
6
|
+
const require_buildProductLineUpdates = require("../../../../../../plus/salesSdk/utils/buildProductLineUpdates.js");
|
|
7
|
+
const require_product = require("../../../../../HDLKiosk/product.js");
|
|
8
|
+
const require_normalize = require("../normalize.js");
|
|
9
|
+
const require_catalog = require("./catalog.js");
|
|
10
|
+
const require_cart = require("./cart.js");
|
|
11
|
+
const require_customizationProduct = require("./customizationProduct.js");
|
|
12
|
+
let decimal_js = require("decimal.js");
|
|
13
|
+
decimal_js = require_runtime.__toESM(decimal_js);
|
|
14
|
+
//#region src/components/bigSale/templates/HDLKiosk/adapter/sales/weightedOperations.ts
|
|
15
|
+
/** Primary weighted-product add/update operations. */
|
|
16
|
+
function resolveCartProduct(line) {
|
|
17
|
+
var _line$_extend;
|
|
18
|
+
return "product_id" in line ? line : (_line$_extend = line._extend) === null || _line$_extend === void 0 ? void 0 : _line$_extend.product;
|
|
19
|
+
}
|
|
20
|
+
function hasRequestedWeight(product, requestedWeightKg) {
|
|
21
|
+
var _product$product_sku$, _product$product_sku;
|
|
22
|
+
const actual = new decimal_js.default((_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);
|
|
23
|
+
const expected = new decimal_js.default(requestedWeightKg || NaN);
|
|
24
|
+
return actual.isFinite() && expected.isFinite() && actual.equals(expected);
|
|
25
|
+
}
|
|
26
|
+
function findConfirmedMutationLine(products, productId, requestedWeightKg, uniqueId) {
|
|
27
|
+
return [...products].reverse().find((candidate) => {
|
|
28
|
+
var _candidate$product_id, _candidate$metadata$u, _candidate$metadata;
|
|
29
|
+
if (String((_candidate$product_id = candidate.product_id) !== null && _candidate$product_id !== void 0 ? _candidate$product_id : "") !== productId) return false;
|
|
30
|
+
if (!hasRequestedWeight(candidate, requestedWeightKg)) return false;
|
|
31
|
+
if (uniqueId == null || uniqueId === "") return true;
|
|
32
|
+
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);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function findOrderProduct(context, product) {
|
|
36
|
+
var _product$_identity, _context$sales$tempOr, _products$find;
|
|
37
|
+
const uniqueId = ((_product$_identity = product._identity) !== null && _product$_identity !== void 0 ? _product$_identity : require_identity.pickIdentity(product)).unique_identification_number;
|
|
38
|
+
return (_products$find = (((_context$sales$tempOr = context.sales.tempOrder) === null || _context$sales$tempOr === void 0 ? void 0 : _context$sales$tempOr.products) || []).find((candidate) => {
|
|
39
|
+
var _candidate$metadata$u2, _candidate$metadata2;
|
|
40
|
+
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);
|
|
41
|
+
})) !== null && _products$find !== void 0 ? _products$find : product;
|
|
42
|
+
}
|
|
43
|
+
function createBigSaleWeightedProductOperations({ getContext }) {
|
|
44
|
+
return { syncPrimaryWeightedProduct: function() {
|
|
45
|
+
var _ref2 = require_asyncToGenerator._asyncToGenerator(function* (input, signal) {
|
|
46
|
+
if (signal.aborted) return { status: "cancelled" };
|
|
47
|
+
const productId = Number(input.productId);
|
|
48
|
+
if (!Number.isFinite(productId)) return require_normalize.failed("primaryWeightedProductInputInvalid", "staff");
|
|
49
|
+
try {
|
|
50
|
+
const context = getContext();
|
|
51
|
+
const productResult = yield require_catalog.queryPrimaryProduct(context, String(productId), signal);
|
|
52
|
+
if (productResult.status !== "succeeded") return productResult;
|
|
53
|
+
const product = productResult.data;
|
|
54
|
+
const resolved = require_product.resolveHDLWeightedProduct(product);
|
|
55
|
+
if (!resolved) return require_normalize.failed("primaryWeightedProductConfigInvalid", "staff");
|
|
56
|
+
const prepared = require_customizationProduct.createHDLPrimaryWeightedPreparedProduct(resolved, input);
|
|
57
|
+
if (!prepared) return require_normalize.failed("primaryWeightedProductSelectionInvalid", "retry");
|
|
58
|
+
if (input.existingLineId) {
|
|
59
|
+
var _cartProduct$_identit, _identity$product_var, _ref, _productPatch$product;
|
|
60
|
+
const displayLine = require_cart.findCartLine(context, input.existingLineId);
|
|
61
|
+
const cartProduct = displayLine ? resolveCartProduct(displayLine) : void 0;
|
|
62
|
+
const bookingTicket = context.sales.bookingTicket;
|
|
63
|
+
if (!cartProduct) return require_normalize.failed("primaryWeightedProductLineNotFound", "back");
|
|
64
|
+
if (typeof context.cart.updateItem !== "function" || typeof (bookingTicket === null || bookingTicket === void 0 ? void 0 : bookingTicket.transformDetailToProductAndBooking) !== "function") return require_normalize.failed("primaryWeightedProductUpdateUnavailable", "staff");
|
|
65
|
+
const orderLine = findOrderProduct(context, cartProduct);
|
|
66
|
+
const identity = (_cartProduct$_identit = cartProduct._identity) !== null && _cartProduct$_identit !== void 0 ? _cartProduct$_identit : require_identity.pickIdentity(orderLine);
|
|
67
|
+
const preparedForUpdate = require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, prepared), {}, { _extend: require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, prepared._extend || {}), identity.unique_identification_number != null ? { unique_identification_number: identity.unique_identification_number } : {}) });
|
|
68
|
+
const transformed = bookingTicket.transformDetailToProductAndBooking({
|
|
69
|
+
item: resolved.product,
|
|
70
|
+
cacheItem: preparedForUpdate
|
|
71
|
+
});
|
|
72
|
+
const productPatch = transformed === null || transformed === void 0 ? void 0 : transformed.product;
|
|
73
|
+
if (!productPatch) return require_normalize.failed("primaryWeightedProductUpdateInvalid", "retry");
|
|
74
|
+
const patchVariantId = Number(productPatch.product_variant_id);
|
|
75
|
+
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);
|
|
76
|
+
const nextOptions = require_productSkuOptions.resolvePatchProductOptions(orderLine, productPatch);
|
|
77
|
+
const lineUpdates = require_buildProductLineUpdates.buildProductLineUpdates(orderLine, productPatch);
|
|
78
|
+
lineUpdates.metadata = require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, lineUpdates.metadata || {}), identity.unique_identification_number != null ? { unique_identification_number: identity.unique_identification_number } : {});
|
|
79
|
+
const updatedProducts = yield context.cart.updateItem({
|
|
80
|
+
product_id: identity.product_id,
|
|
81
|
+
product_variant_id: nextVariantId,
|
|
82
|
+
unique_identification_number: identity.unique_identification_number,
|
|
83
|
+
identity_key: identity.identity_key,
|
|
84
|
+
product_sku: require_productSkuOptions.buildProductSkuPatch(orderLine, nextOptions, productPatch.product_sku),
|
|
85
|
+
product_option_item: nextOptions,
|
|
86
|
+
product_bundle: (_ref = (_productPatch$product = productPatch.product_bundle) !== null && _productPatch$product !== void 0 ? _productPatch$product : identity.product_bundle) !== null && _ref !== void 0 ? _ref : [],
|
|
87
|
+
updates: lineUpdates
|
|
88
|
+
});
|
|
89
|
+
if (signal.aborted) return require_normalize.unknown("primaryProductUpdateAbortedAfterDispatch");
|
|
90
|
+
const confirmedLine = require_cart.projectConfirmedMutationLine(findConfirmedMutationLine(updatedProducts, input.productId, input.measurement.netWeightKg, identity.unique_identification_number));
|
|
91
|
+
return {
|
|
92
|
+
status: "succeeded",
|
|
93
|
+
data: require_objectSpread2._objectSpread2({ affectedLineId: input.existingLineId }, confirmedLine ? { confirmedLine } : {})
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
const result = yield context.cart.addProductWithFlow(product, {
|
|
97
|
+
quantity: 1,
|
|
98
|
+
debounceMs: 0,
|
|
99
|
+
notShowToast: true,
|
|
100
|
+
preparedCacheItem: prepared
|
|
101
|
+
});
|
|
102
|
+
if (signal.aborted) return require_normalize.unknown("primaryProductAddAbortedAfterDispatch");
|
|
103
|
+
if (result.status === "cancelled") return {
|
|
104
|
+
status: "cancelled",
|
|
105
|
+
reason: "userCancelled"
|
|
106
|
+
};
|
|
107
|
+
if (result.status !== "added") return require_normalize.unknown("primaryProductAddAmbiguous");
|
|
108
|
+
const confirmedLine = require_cart.projectConfirmedMutationLine(findConfirmedMutationLine(result.products, input.productId, input.measurement.netWeightKg));
|
|
109
|
+
return {
|
|
110
|
+
status: "succeeded",
|
|
111
|
+
data: confirmedLine ? {
|
|
112
|
+
affectedLineId: confirmedLine.lineId,
|
|
113
|
+
confirmedLine
|
|
114
|
+
} : {}
|
|
115
|
+
};
|
|
116
|
+
} catch (error) {
|
|
117
|
+
return require_normalize.partialFailure("primaryWeightedProductSyncFailed", error);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
return function syncPrimaryWeightedProduct(_x, _x2) {
|
|
121
|
+
return _ref2.apply(this, arguments);
|
|
122
|
+
};
|
|
123
|
+
}() };
|
|
124
|
+
}
|
|
125
|
+
//#endregion
|
|
126
|
+
exports.createBigSaleWeightedProductOperations = createBigSaleWeightedProductOperations;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const require_runtime = require("
|
|
2
|
-
const require_objectSpread2 = require("
|
|
1
|
+
const require_runtime = require("../../../../../../_virtual/_rolldown/runtime.js");
|
|
2
|
+
const require_objectSpread2 = require("../../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
|
|
3
3
|
let _pisell_utils = require("@pisell/utils");
|
|
4
4
|
let decimal_js = require("decimal.js");
|
|
5
5
|
decimal_js = require_runtime.__toESM(decimal_js);
|
|
6
|
-
//#region src/components/bigSale/templates/HDLKiosk/adapter/weightedProduct.ts
|
|
6
|
+
//#region src/components/bigSale/templates/HDLKiosk/adapter/sales/weightedProduct.ts
|
|
7
7
|
/**
|
|
8
8
|
* 文件角色:根据已验证的标准称重商品生成 SalesSDK 写入结构。
|
|
9
9
|
* 运行机制:提交时校验稳定净重,并生成 prepared product 及 OS 可识别的
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
require("../../../../../_virtual/_rolldown/runtime.js");
|
|
2
|
+
const require_scaleBridge = require("../runtime/scaleBridge.js");
|
|
3
|
+
const require_fulfillmentWriter = require("./host/fulfillmentWriter.js");
|
|
4
|
+
const require_useBigSaleHDLKioskHost = require("./useBigSaleHDLKioskHost.js");
|
|
5
|
+
let react = require("react");
|
|
6
|
+
//#region src/components/bigSale/templates/HDLKiosk/adapter/useBigSaleHDLKioskAdapter.ts
|
|
7
|
+
/**
|
|
8
|
+
* 文件角色:集中装配 BigSale 模板接入 HDLKiosk 所需的稳定 Host、支付控制器、
|
|
9
|
+
* 秤 Runtime 与认证客户暂存。
|
|
10
|
+
* 运行机制:React refs 隔离晚到能力,Host 保持稳定引用;Template 只消费装配结果。
|
|
11
|
+
* 边界:不渲染 UI,不承载商品目录加载、购物车展示或 Workflow 业务规则。
|
|
12
|
+
*/
|
|
13
|
+
function useBigSaleHDLKioskAdapter({ context, businessCode, isActive, nativeScaleSourceAvailable }) {
|
|
14
|
+
var _context$customer$sel;
|
|
15
|
+
const scaleBridge = (0, react.useMemo)(require_scaleBridge.createBigSaleScaleBridge, []);
|
|
16
|
+
const authenticatedCustomerRef = (0, react.useRef)();
|
|
17
|
+
const paymentControllerRef = (0, react.useRef)();
|
|
18
|
+
const fulfillmentWriter = (0, react.useMemo)(() => require_fulfillmentWriter.createHDLKioskFulfillmentWriter(context.sales.bookingTicket), [context.sales.bookingTicket]);
|
|
19
|
+
const host = require_useBigSaleHDLKioskHost.useBigSaleHDLKioskHost(context, businessCode, (0, react.useMemo)(() => ({
|
|
20
|
+
writeFulfillment: fulfillmentWriter,
|
|
21
|
+
getPaymentController: () => paymentControllerRef.current,
|
|
22
|
+
subscribeScaleEvents: scaleBridge.subscribeDeviceEvents,
|
|
23
|
+
getAuthenticatedCustomer: (customerId) => {
|
|
24
|
+
const customer = authenticatedCustomerRef.current;
|
|
25
|
+
return customer && String(customer.id) === customerId ? customer : void 0;
|
|
26
|
+
}
|
|
27
|
+
}), [fulfillmentWriter, scaleBridge]), nativeScaleSourceAvailable);
|
|
28
|
+
const selectedCustomerId = (_context$customer$sel = context.customer.selected) === null || _context$customer$sel === void 0 ? void 0 : _context$customer$sel.id;
|
|
29
|
+
(0, react.useEffect)(() => {
|
|
30
|
+
if (!isActive || selectedCustomerId == null) authenticatedCustomerRef.current = void 0;
|
|
31
|
+
}, [isActive, selectedCustomerId]);
|
|
32
|
+
return {
|
|
33
|
+
host,
|
|
34
|
+
paymentControllerRef,
|
|
35
|
+
rememberAuthenticatedCustomer: (0, react.useCallback)((customer) => {
|
|
36
|
+
authenticatedCustomerRef.current = customer;
|
|
37
|
+
}, []),
|
|
38
|
+
scaleBridge
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
exports.useBigSaleHDLKioskAdapter = useBigSaleHDLKioskAdapter;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require("../../../../../_virtual/_rolldown/runtime.js");
|
|
2
2
|
const require_useSalesSdkGlobalScanHandler = require("../../../../../plus/salesSdk/hooks/useSalesSdkGlobalScanHandler.js");
|
|
3
|
-
const require_projection = require("./projection.js");
|
|
3
|
+
const require_projection = require("./host/projection.js");
|
|
4
4
|
const require_createHost = require("./createHost.js");
|
|
5
5
|
let react = require("react");
|
|
6
6
|
//#region src/components/bigSale/templates/HDLKiosk/adapter/useBigSaleHDLKioskHost.ts
|
|
@@ -19,6 +19,7 @@ function useBigSaleHDLKioskHost(context, businessCode, bridge, scaleSourceAvaila
|
|
|
19
19
|
const bridgeRef = (0, react.useRef)(bridge);
|
|
20
20
|
const scaleSourceAvailableRef = (0, react.useRef)(scaleSourceAvailable);
|
|
21
21
|
const projectionListenersRef = (0, react.useRef)(/* @__PURE__ */ new Set());
|
|
22
|
+
const publishedObservationIdRef = (0, react.useRef)();
|
|
22
23
|
const pickupReferenceModeRef = (0, react.useRef)("short_number");
|
|
23
24
|
contextRef.current = context;
|
|
24
25
|
scanRef.current = scan.handleGlobalScanCode;
|
|
@@ -66,17 +67,16 @@ function useBigSaleHDLKioskHost(context, businessCode, bridge, scaleSourceAvaila
|
|
|
66
67
|
devices: {
|
|
67
68
|
getPubsub: () => getPubsubRef.current(),
|
|
68
69
|
getAcquireScanFocus: () => getAcquireScanFocusRef.current(),
|
|
69
|
-
|
|
70
|
+
getSubscribeScaleEvents: () => {
|
|
70
71
|
var _bridgeRef$current4;
|
|
71
|
-
return scaleSourceAvailableRef.current ? (_bridgeRef$current4 = bridgeRef.current) === null || _bridgeRef$current4 === void 0 ? void 0 : _bridgeRef$current4.
|
|
72
|
-
},
|
|
73
|
-
getSubscribeScaleConnection: () => {
|
|
74
|
-
var _bridgeRef$current5;
|
|
75
|
-
return scaleSourceAvailableRef.current ? (_bridgeRef$current5 = bridgeRef.current) === null || _bridgeRef$current5 === void 0 ? void 0 : _bridgeRef$current5.subscribeScaleConnection : void 0;
|
|
72
|
+
return scaleSourceAvailableRef.current ? (_bridgeRef$current4 = bridgeRef.current) === null || _bridgeRef$current4 === void 0 ? void 0 : _bridgeRef$current4.subscribeScaleEvents : void 0;
|
|
76
73
|
}
|
|
77
74
|
}
|
|
78
75
|
});
|
|
79
76
|
(0, react.useEffect)(() => {
|
|
77
|
+
const observationId = hostRef.current.sales.getObservedSnapshot().observationId;
|
|
78
|
+
if (publishedObservationIdRef.current === observationId) return;
|
|
79
|
+
publishedObservationIdRef.current = observationId;
|
|
80
80
|
projectionListenersRef.current.forEach((listener) => listener());
|
|
81
81
|
});
|
|
82
82
|
return hostRef.current;
|