@pisell/private-materials 6.12.170 → 6.12.172
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.js +18 -18
- package/build/lowcode/view.js +18 -18
- package/es/components/HDLKiosk/app/workflow/predicates.js +1 -1
- package/es/components/HDLKiosk/runtime/operations/coordinator.js +2 -1
- package/es/components/HDLKiosk/runtime/operations/session.js +3 -2
- package/es/components/HDLKiosk/runtime/session/createSession.js +26 -3
- package/es/components/HDLKiosk/runtime/session/transitionRunner.js +6 -2
- package/es/components/HDLKiosk/slices/payment/view.js +13 -4
- package/es/components/bigSale/components/BookingFloatingPanel/useBookingPanelController.js +1 -0
- package/es/components/bigSale/components/TimeBar/index.js +1 -0
- package/es/components/bigSale/dialog.js +1 -0
- package/es/components/bigSale/hooks/useBigSaleContext.js +1 -0
- package/es/components/bigSale/hooks/useSelectFloorMapResourceForBigSale.js +1 -0
- package/es/components/bigSale/index.js +1 -0
- package/es/components/bigSale/templates/HDLKiosk/adapter/host/projection.js +1 -1
- package/es/components/bigSale/templates/HDLKiosk/adapter/sales/session.js +7 -2
- package/es/components/bigSale/templates/HDLKiosk/runtime/HDLKioskPaymentRuntime.js +95 -148
- package/es/components/bigSale/templates/HDLKiosk/runtime/eftposPayment.js +110 -0
- package/es/components/bigSale/templates/HDLKiosk/runtime/staffPaymentAuthorization.js +183 -0
- package/es/components/bigSale/templates/Kiosk/index.js +1 -0
- package/es/components/sharedSecondaryBigSale/SharedSecondaryBigSaleReceiver.js +1 -0
- package/es/index.js +2 -0
- package/es/plus/pisellReservation/data/bookingToReservationTables.js +1 -1
- package/es/plus/pisellReservation/floorMap/floorPlanApi.js +1 -1
- package/es/plus/pisellReservation/floorMap/reservationMock.js +1 -1
- package/es/plus/pisellReservation/index.js +17 -0
- package/es/plus/saleDetail/Base.js +1 -0
- package/es/plus/saleDetail/components/Client/hooks/useClientSelectorProps.js +1 -0
- package/es/plus/saleDetail/components/DetailActions/index.js +1 -0
- package/es/plus/saleDetail/components/SummaryFinancialSections/index.js +1 -0
- package/es/plus/saleDetail/index.js +1 -0
- package/es/plus/saleDetail/tmpl/B/components/Dish/index.js +1 -0
- package/es/plus/saleDetail/tmpl/B/index.js +1 -0
- package/es/plus/salesSdk/index.js +52 -0
- package/es/plus/salesSdk/utils/addProductWithFlowDebounced.js +1 -1
- package/es/plus/salesSdk/utils/bookingDate.js +1 -1
- package/es/plus/salesSdk/utils/customerAuthGate.js +1 -1
- package/es/plus/salesSdk/utils/enrichCartLineHolderDisplay.js +1 -1
- package/es/pro/Login2.0/AuthModal.d.ts +1 -1
- package/es/pro/Login2.0/index.d.ts +2 -1
- package/es/pro/Login2.0/shared/types.d.ts +1 -1
- package/lib/components/HDLKiosk/app/workflow/predicates.js +1 -1
- package/lib/components/HDLKiosk/runtime/operations/coordinator.js +2 -1
- package/lib/components/HDLKiosk/runtime/operations/session.js +3 -2
- package/lib/components/HDLKiosk/runtime/session/createSession.js +26 -3
- package/lib/components/HDLKiosk/runtime/session/transitionRunner.js +6 -2
- package/lib/components/HDLKiosk/slices/payment/view.js +13 -4
- package/lib/components/bigSale/templates/HDLKiosk/adapter/host/projection.js +1 -1
- package/lib/components/bigSale/templates/HDLKiosk/adapter/sales/session.js +7 -2
- package/lib/components/bigSale/templates/HDLKiosk/runtime/HDLKioskPaymentRuntime.js +92 -145
- package/lib/components/bigSale/templates/HDLKiosk/runtime/eftposPayment.js +110 -0
- package/lib/components/bigSale/templates/HDLKiosk/runtime/staffPaymentAuthorization.js +186 -0
- package/package.json +4 -4
- package/es/private-materials/lowcode/authmodal/meta.d.ts +0 -1
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { _asyncToGenerator } from "../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
|
|
2
|
+
import { _objectWithoutProperties } from "../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js";
|
|
3
|
+
import { resolvePiPaymentProvider } from "../../../../checkout/constants.js";
|
|
4
|
+
import { completePendingEftposPayment, discardPendingEftposPayment, preparePendingEftposPayment } from "../../../../checkout/paymentRuntime/pendingEftposLifecycle.js";
|
|
5
|
+
import { getCurrentDeviceNumber } from "../../../../checkout/utils.js";
|
|
6
|
+
import { failed, unknown } from "../adapter/normalize.js";
|
|
7
|
+
//#region src/components/bigSale/templates/HDLKiosk/runtime/eftposPayment.ts
|
|
8
|
+
const _excluded = ["unique_payment_number"];
|
|
9
|
+
function checkoutSuccess(baseSales) {
|
|
10
|
+
var _baseSales$getTempOrd, _baseSales$getOrderId, _ref, _baseSales$getOrderAm, _baseSales$getOrderAm2;
|
|
11
|
+
const order = (baseSales === null || baseSales === void 0 || (_baseSales$getTempOrd = baseSales.getTempOrder) === null || _baseSales$getTempOrd === void 0 ? void 0 : _baseSales$getTempOrd.call(baseSales)) || {};
|
|
12
|
+
const orderId = ((baseSales === null || baseSales === void 0 || (_baseSales$getOrderId = baseSales.getOrderIdentity) === null || _baseSales$getOrderId === void 0 ? void 0 : _baseSales$getOrderId.call(baseSales)) || {}).orderId || order.order_id;
|
|
13
|
+
if (!orderId) return unknown("eftposSuccessMissingOrderId");
|
|
14
|
+
return {
|
|
15
|
+
status: "succeeded",
|
|
16
|
+
data: {
|
|
17
|
+
orderId: String(orderId),
|
|
18
|
+
amount: String((_ref = (_baseSales$getOrderAm = baseSales === null || baseSales === void 0 || (_baseSales$getOrderAm2 = baseSales.getOrderAmountSnapshot) === null || _baseSales$getOrderAm2 === void 0 || (_baseSales$getOrderAm2 = _baseSales$getOrderAm2.call(baseSales)) === null || _baseSales$getOrderAm2 === void 0 ? void 0 : _baseSales$getOrderAm2.expectAmount) !== null && _baseSales$getOrderAm !== void 0 ? _baseSales$getOrderAm : order.expect_amount) !== null && _ref !== void 0 ? _ref : 0)
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function executeEftposPayment(_x) {
|
|
23
|
+
return _executeEftposPayment.apply(this, arguments);
|
|
24
|
+
}
|
|
25
|
+
function _executeEftposPayment() {
|
|
26
|
+
_executeEftposPayment = _asyncToGenerator(function* ({ amount, baseSales, currencySymbol, interaction, isPiPaymentEnabled, loadDetail, method, rawMethod, runtime }) {
|
|
27
|
+
const piProvider = resolvePiPaymentProvider(method.code, isPiPaymentEnabled);
|
|
28
|
+
let prepared;
|
|
29
|
+
let shouldDiscardPrepared = false;
|
|
30
|
+
try {
|
|
31
|
+
var _baseSales$getOrderId2, _baseSales$getTempOrd2;
|
|
32
|
+
if (piProvider) {
|
|
33
|
+
prepared = yield preparePendingEftposPayment({
|
|
34
|
+
amount,
|
|
35
|
+
baseSales,
|
|
36
|
+
method: rawMethod
|
|
37
|
+
});
|
|
38
|
+
shouldDiscardPrepared = true;
|
|
39
|
+
if (!prepared.salesId) throw new Error("Unable to resolve sales id before opening PiPayment.");
|
|
40
|
+
}
|
|
41
|
+
const deviceNumber = yield getCurrentDeviceNumber(interaction);
|
|
42
|
+
const result = yield runtime.execute({
|
|
43
|
+
method: rawMethod,
|
|
44
|
+
amount,
|
|
45
|
+
currencySymbol,
|
|
46
|
+
deviceNumber,
|
|
47
|
+
preparedPayment: prepared ? {
|
|
48
|
+
paymentNumber: prepared.paymentNumber,
|
|
49
|
+
salesId: prepared.salesId
|
|
50
|
+
} : void 0
|
|
51
|
+
});
|
|
52
|
+
if (result.preservePendingPayment) shouldDiscardPrepared = false;
|
|
53
|
+
if (prepared && result.preservePendingPayment && result.status !== "success") return unknown("eftposPendingPaymentUnresolved", result);
|
|
54
|
+
if (result.status === "cancelled" || result.status === "provider-handled") {
|
|
55
|
+
if (prepared && shouldDiscardPrepared) yield discardPendingEftposPayment(baseSales, prepared.paymentNumber);
|
|
56
|
+
return {
|
|
57
|
+
status: "cancelled",
|
|
58
|
+
reason: result.status
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
if (result.status === "cancel-order") {
|
|
62
|
+
if (prepared && shouldDiscardPrepared) yield discardPendingEftposPayment(baseSales, prepared.paymentNumber);
|
|
63
|
+
return {
|
|
64
|
+
status: "cancelled",
|
|
65
|
+
reason: "cancelOrder"
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
if (result.status !== "success") {
|
|
69
|
+
if (prepared && shouldDiscardPrepared) yield discardPendingEftposPayment(baseSales, prepared.paymentNumber);
|
|
70
|
+
return failed("eftposPaymentFailed", "retry", result.message);
|
|
71
|
+
}
|
|
72
|
+
if (prepared) {
|
|
73
|
+
shouldDiscardPrepared = false;
|
|
74
|
+
const _ref2 = result.metadata || {}, { unique_payment_number: transactionNumber } = _ref2, metadata = _objectWithoutProperties(_ref2, _excluded);
|
|
75
|
+
yield completePendingEftposPayment({
|
|
76
|
+
amount: result.amount,
|
|
77
|
+
baseSales,
|
|
78
|
+
paymentNumber: prepared.paymentNumber,
|
|
79
|
+
transactionNumber,
|
|
80
|
+
serviceCharge: result.serviceCharge,
|
|
81
|
+
updates: { metadata }
|
|
82
|
+
});
|
|
83
|
+
} else if (typeof (baseSales === null || baseSales === void 0 ? void 0 : baseSales.commitPaymentMethodPayment) === "function") yield baseSales.commitPaymentMethodPayment({
|
|
84
|
+
paymentMethodId: method.id,
|
|
85
|
+
paymentMethodCode: method.code,
|
|
86
|
+
amount: result.amount,
|
|
87
|
+
serviceCharge: result.serviceCharge,
|
|
88
|
+
metadata: result.metadata
|
|
89
|
+
});
|
|
90
|
+
else return failed("paymentCommitUnavailable", "staff");
|
|
91
|
+
const orderId = (baseSales === null || baseSales === void 0 || (_baseSales$getOrderId2 = baseSales.getOrderIdentity) === null || _baseSales$getOrderId2 === void 0 || (_baseSales$getOrderId2 = _baseSales$getOrderId2.call(baseSales)) === null || _baseSales$getOrderId2 === void 0 ? void 0 : _baseSales$getOrderId2.orderId) || (baseSales === null || baseSales === void 0 || (_baseSales$getTempOrd2 = baseSales.getTempOrder) === null || _baseSales$getTempOrd2 === void 0 || (_baseSales$getTempOrd2 = _baseSales$getTempOrd2.call(baseSales)) === null || _baseSales$getTempOrd2 === void 0 ? void 0 : _baseSales$getTempOrd2.order_id);
|
|
92
|
+
if (orderId && typeof loadDetail === "function") yield loadDetail({
|
|
93
|
+
orderId,
|
|
94
|
+
forceRemote: true
|
|
95
|
+
});
|
|
96
|
+
return checkoutSuccess(baseSales);
|
|
97
|
+
} catch (error) {
|
|
98
|
+
try {
|
|
99
|
+
if (prepared && shouldDiscardPrepared) yield discardPendingEftposPayment(baseSales, prepared.paymentNumber);
|
|
100
|
+
} catch (discardError) {
|
|
101
|
+
return unknown("eftposPendingRollbackFailed", discardError);
|
|
102
|
+
}
|
|
103
|
+
if (prepared && !shouldDiscardPrepared) return unknown("eftposPaymentFinalizationUnresolved", error);
|
|
104
|
+
return failed("eftposPaymentFailed", "retry", error);
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
return _executeEftposPayment.apply(this, arguments);
|
|
108
|
+
}
|
|
109
|
+
//#endregion
|
|
110
|
+
export { executeEftposPayment };
|
|
@@ -0,0 +1,183 @@
|
|
|
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
|
+
//#region src/components/bigSale/templates/HDLKiosk/runtime/staffPaymentAuthorization.ts
|
|
4
|
+
/** One runtime owns at most one staff authorization from dispatch to terminal result. */
|
|
5
|
+
function createStaffPaymentAuthorizationStore() {
|
|
6
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
7
|
+
let active;
|
|
8
|
+
const publish = (result) => {
|
|
9
|
+
listeners.forEach((listener) => {
|
|
10
|
+
try {
|
|
11
|
+
listener(result);
|
|
12
|
+
} catch (_unused) {}
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
const clear = (authorization, phase, result) => {
|
|
16
|
+
if ((active === null || active === void 0 ? void 0 : active.authorization) !== authorization || active.phase !== phase) return false;
|
|
17
|
+
active = void 0;
|
|
18
|
+
publish(result);
|
|
19
|
+
return true;
|
|
20
|
+
};
|
|
21
|
+
return {
|
|
22
|
+
begin: (authorization) => {
|
|
23
|
+
if (active) return void 0;
|
|
24
|
+
active = {
|
|
25
|
+
authorization,
|
|
26
|
+
phase: "waiting"
|
|
27
|
+
};
|
|
28
|
+
publish({ status: "pending" });
|
|
29
|
+
return authorization;
|
|
30
|
+
},
|
|
31
|
+
beginSettlement: () => {
|
|
32
|
+
if (!active || active.phase !== "waiting") return void 0;
|
|
33
|
+
active = _objectSpread2(_objectSpread2({}, active), {}, { phase: "settling" });
|
|
34
|
+
return active.authorization;
|
|
35
|
+
},
|
|
36
|
+
cancel: (authorization = active === null || active === void 0 ? void 0 : active.authorization) => authorization ? clear(authorization, "waiting", { status: "cancelled" }) : false,
|
|
37
|
+
fail: (authorization) => clear(authorization, "waiting", { status: "failed" }),
|
|
38
|
+
complete: (authorization, result) => clear(authorization, "settling", result),
|
|
39
|
+
isSettling: (authorization) => (active === null || active === void 0 ? void 0 : active.authorization) === authorization && active.phase === "settling",
|
|
40
|
+
subscribe: (listener) => {
|
|
41
|
+
listeners.add(listener);
|
|
42
|
+
return () => listeners.delete(listener);
|
|
43
|
+
},
|
|
44
|
+
dispose: () => {
|
|
45
|
+
const hadActiveAuthorization = active !== void 0;
|
|
46
|
+
active = void 0;
|
|
47
|
+
listeners.clear();
|
|
48
|
+
return hadActiveAuthorization;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function firstPresent(...values) {
|
|
53
|
+
return values.find((value) => value !== void 0 && value !== null && value !== "");
|
|
54
|
+
}
|
|
55
|
+
function isSubmitResponseLike(response) {
|
|
56
|
+
return Boolean(response && typeof response === "object" && (response.code !== void 0 || response.status !== void 0 || response.success !== void 0 || response.message !== void 0 || response.msg !== void 0 || response.error !== void 0 || response.errors !== void 0));
|
|
57
|
+
}
|
|
58
|
+
function normalizeSubmitResponse(response) {
|
|
59
|
+
if ((response === null || response === void 0 ? void 0 : response.data) && typeof response.data === "object" && !isSubmitResponseLike(response) && isSubmitResponseLike(response.data)) return response.data;
|
|
60
|
+
return response;
|
|
61
|
+
}
|
|
62
|
+
function isSubmitRejected(response) {
|
|
63
|
+
const normalized = normalizeSubmitResponse(response);
|
|
64
|
+
if (!normalized || typeof normalized !== "object") return false;
|
|
65
|
+
return normalized.code !== void 0 && normalized.code !== 200 && normalized.code !== "200" || normalized.status === false || typeof normalized.status === "number" && normalized.status >= 400 || normalized.success === false;
|
|
66
|
+
}
|
|
67
|
+
function readExternalPaymentOrderId(params, baseSales) {
|
|
68
|
+
var _params$syncResult, _submitResult$data, _submitResult$data2, _submitResult$data3, _params$syncResult2;
|
|
69
|
+
const submitResult = normalizeSubmitResponse((_params$syncResult = params.syncResult) === null || _params$syncResult === void 0 ? void 0 : _params$syncResult.submitResult);
|
|
70
|
+
const submittedOrderId = firstPresent(submitResult === null || submitResult === void 0 || (_submitResult$data = submitResult.data) === null || _submitResult$data === void 0 ? void 0 : _submitResult$data.order_id, submitResult === null || submitResult === void 0 ? void 0 : submitResult.order_id, submitResult === null || submitResult === void 0 || (_submitResult$data2 = submitResult.data) === null || _submitResult$data2 === void 0 || (_submitResult$data2 = _submitResult$data2.order) === null || _submitResult$data2 === void 0 ? void 0 : _submitResult$data2.order_id, submitResult === null || submitResult === void 0 || (_submitResult$data3 = submitResult.data) === null || _submitResult$data3 === void 0 || (_submitResult$data3 = _submitResult$data3.sales) === null || _submitResult$data3 === void 0 ? void 0 : _submitResult$data3.order_id, (_params$syncResult2 = params.syncResult) === null || _params$syncResult2 === void 0 ? void 0 : _params$syncResult2.orderId);
|
|
71
|
+
if (submittedOrderId !== void 0) return String(submittedOrderId);
|
|
72
|
+
try {
|
|
73
|
+
var _baseSales$getOrderId, _baseSales$getTempOrd;
|
|
74
|
+
const localOrderId = firstPresent(baseSales === null || baseSales === void 0 || (_baseSales$getOrderId = baseSales.getOrderIdentity) === null || _baseSales$getOrderId === void 0 || (_baseSales$getOrderId = _baseSales$getOrderId.call(baseSales)) === null || _baseSales$getOrderId === void 0 ? void 0 : _baseSales$getOrderId.orderId, baseSales === null || baseSales === void 0 || (_baseSales$getTempOrd = baseSales.getTempOrder) === null || _baseSales$getTempOrd === void 0 || (_baseSales$getTempOrd = _baseSales$getTempOrd.call(baseSales)) === null || _baseSales$getTempOrd === void 0 ? void 0 : _baseSales$getTempOrd.order_id);
|
|
75
|
+
return localOrderId === void 0 ? void 0 : String(localOrderId);
|
|
76
|
+
} catch (_unused2) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function createStaffPaymentOutcome({ params, baseSales, fallbackAmount, currencySymbol, pickupNumber, member }) {
|
|
81
|
+
var _params$syncResult3, _params$syncResult4;
|
|
82
|
+
if (isSubmitRejected((_params$syncResult3 = params.syncResult) === null || _params$syncResult3 === void 0 ? void 0 : _params$syncResult3.submitResult)) return void 0;
|
|
83
|
+
const rawAmount = firstPresent((_params$syncResult4 = params.syncResult) === null || _params$syncResult4 === void 0 ? void 0 : _params$syncResult4.orderExpectedAmount, fallbackAmount);
|
|
84
|
+
const amount = Number(rawAmount);
|
|
85
|
+
if (!Number.isFinite(amount) || amount < 0) return void 0;
|
|
86
|
+
const orderId = readExternalPaymentOrderId(params, baseSales);
|
|
87
|
+
if (!orderId) return void 0;
|
|
88
|
+
return Object.freeze(_objectSpread2(_objectSpread2(_objectSpread2({
|
|
89
|
+
amount: String(rawAmount),
|
|
90
|
+
orderId
|
|
91
|
+
}, currencySymbol ? { currencySymbol } : {}), pickupNumber ? { pickupNumber } : {}), member !== void 0 ? { member } : {}));
|
|
92
|
+
}
|
|
93
|
+
function readPickupNumber(order, mode) {
|
|
94
|
+
const value = mode === "sale_number" ? order === null || order === void 0 ? void 0 : order.shop_order_number : order === null || order === void 0 ? void 0 : order.shop_full_order_number;
|
|
95
|
+
return value === void 0 || value === null || value === "" ? void 0 : String(value);
|
|
96
|
+
}
|
|
97
|
+
function resolveStaffPaymentPickupNumber(_x, _x2) {
|
|
98
|
+
return _resolveStaffPaymentPickupNumber.apply(this, arguments);
|
|
99
|
+
}
|
|
100
|
+
function _resolveStaffPaymentPickupNumber() {
|
|
101
|
+
_resolveStaffPaymentPickupNumber = _asyncToGenerator(function* (baseSales, detail) {
|
|
102
|
+
var _ref, _detail$header, _detail$data;
|
|
103
|
+
let mode = "short_number";
|
|
104
|
+
try {
|
|
105
|
+
var _baseSales$getOpenDat;
|
|
106
|
+
const openData = yield baseSales === null || baseSales === void 0 || (_baseSales$getOpenDat = baseSales.getOpenData) === null || _baseSales$getOpenDat === void 0 ? void 0 : _baseSales$getOpenDat.call(baseSales);
|
|
107
|
+
if ((openData === null || openData === void 0 ? void 0 : openData["fulfillment.fulfillment_ref_mode"]) === "sale_number") mode = "sale_number";
|
|
108
|
+
} catch (_unused3) {}
|
|
109
|
+
const detailPickupNumber = readPickupNumber((_ref = (_detail$header = detail === null || detail === void 0 ? void 0 : detail.header) !== null && _detail$header !== void 0 ? _detail$header : detail === null || detail === void 0 || (_detail$data = detail.data) === null || _detail$data === void 0 ? void 0 : _detail$data.header) !== null && _ref !== void 0 ? _ref : detail, mode);
|
|
110
|
+
if (detailPickupNumber) return detailPickupNumber;
|
|
111
|
+
try {
|
|
112
|
+
var _baseSales$getTempOrd2;
|
|
113
|
+
return readPickupNumber(baseSales === null || baseSales === void 0 || (_baseSales$getTempOrd2 = baseSales.getTempOrder) === null || _baseSales$getTempOrd2 === void 0 ? void 0 : _baseSales$getTempOrd2.call(baseSales), mode);
|
|
114
|
+
} catch (_unused4) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
return _resolveStaffPaymentPickupNumber.apply(this, arguments);
|
|
119
|
+
}
|
|
120
|
+
function finalizeStaffPaymentOutcome(_x3) {
|
|
121
|
+
return _finalizeStaffPaymentOutcome.apply(this, arguments);
|
|
122
|
+
}
|
|
123
|
+
function _finalizeStaffPaymentOutcome() {
|
|
124
|
+
_finalizeStaffPaymentOutcome = _asyncToGenerator(function* ({ params, baseSales, loadDetail, fallbackAmount, currencySymbol, member }) {
|
|
125
|
+
let outcome = createStaffPaymentOutcome({
|
|
126
|
+
params,
|
|
127
|
+
baseSales,
|
|
128
|
+
fallbackAmount,
|
|
129
|
+
currencySymbol,
|
|
130
|
+
member
|
|
131
|
+
});
|
|
132
|
+
if (!outcome) return void 0;
|
|
133
|
+
let detail;
|
|
134
|
+
try {
|
|
135
|
+
detail = yield loadDetail === null || loadDetail === void 0 ? void 0 : loadDetail({
|
|
136
|
+
orderId: outcome.orderId,
|
|
137
|
+
forceRemote: true
|
|
138
|
+
});
|
|
139
|
+
} catch (_unused5) {}
|
|
140
|
+
const pickupNumber = yield resolveStaffPaymentPickupNumber(baseSales, detail);
|
|
141
|
+
if (pickupNumber) outcome = Object.freeze(_objectSpread2(_objectSpread2({}, outcome), {}, { pickupNumber }));
|
|
142
|
+
return outcome;
|
|
143
|
+
});
|
|
144
|
+
return _finalizeStaffPaymentOutcome.apply(this, arguments);
|
|
145
|
+
}
|
|
146
|
+
function isStaffPaymentAuthorizationCancelled(result) {
|
|
147
|
+
var _record$status, _record$reason;
|
|
148
|
+
if (!result || typeof result !== "object") return false;
|
|
149
|
+
const record = result;
|
|
150
|
+
return [
|
|
151
|
+
"cancelled",
|
|
152
|
+
"canceled",
|
|
153
|
+
"closed"
|
|
154
|
+
].includes(String((_record$status = record.status) !== null && _record$status !== void 0 ? _record$status : "").toLowerCase()) || [
|
|
155
|
+
"cancelled",
|
|
156
|
+
"canceled",
|
|
157
|
+
"cancel"
|
|
158
|
+
].includes(String((_record$reason = record.reason) !== null && _record$reason !== void 0 ? _record$reason : "").toLowerCase());
|
|
159
|
+
}
|
|
160
|
+
function resolveStaffPaymentResult(_x4) {
|
|
161
|
+
return _resolveStaffPaymentResult.apply(this, arguments);
|
|
162
|
+
}
|
|
163
|
+
function _resolveStaffPaymentResult() {
|
|
164
|
+
_resolveStaffPaymentResult = _asyncToGenerator(function* ({ params, closeAuthorization, finalizeOutcome }) {
|
|
165
|
+
try {
|
|
166
|
+
closeAuthorization();
|
|
167
|
+
} catch (_unused6) {}
|
|
168
|
+
const status = params.status;
|
|
169
|
+
if (params.ok !== true || status !== "success") return { status: status === "cancelled" ? "cancelled" : "failed" };
|
|
170
|
+
try {
|
|
171
|
+
const outcome = yield finalizeOutcome();
|
|
172
|
+
return outcome ? {
|
|
173
|
+
status: "succeeded",
|
|
174
|
+
data: outcome
|
|
175
|
+
} : { status: "failed" };
|
|
176
|
+
} catch (_unused7) {
|
|
177
|
+
return { status: "failed" };
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
return _resolveStaffPaymentResult.apply(this, arguments);
|
|
181
|
+
}
|
|
182
|
+
//#endregion
|
|
183
|
+
export { createStaffPaymentAuthorizationStore, finalizeStaffPaymentOutcome, isStaffPaymentAuthorizationCancelled, resolveStaffPaymentResult };
|
|
@@ -6,6 +6,7 @@ import useSalesUserLogin, { isRequireLoginChannel } from "../../../../hooks/useS
|
|
|
6
6
|
import { resolvePaymentResultToastV2ViewModel } from "../../../checkout/components/PaymentResultToastV2/resolve.js";
|
|
7
7
|
import PaymentResultToastV2_default from "../../../checkout/components/PaymentResultToastV2/index.js";
|
|
8
8
|
import { useSalesSdk } from "../../../../plus/salesSdk/hooks/useSalesSdk.js";
|
|
9
|
+
import "../../../../plus/salesSdk/index.js";
|
|
9
10
|
import { usePickSaleDetailContext } from "../../hooks/usePickSaleDetailContext.js";
|
|
10
11
|
import { resolveBigSaleAutoProductListPreferences } from "../../utils/productListPreferences.js";
|
|
11
12
|
import { resolveBigSaleProductDisplayConfig } from "../../hooks/useBigSaleProductListConfig.js";
|
|
@@ -2,6 +2,7 @@ import { _asyncToGenerator } from "../../_virtual/_@oxc-project_runtime@0.122.0/
|
|
|
2
2
|
import useEngineContext from "../../hooks/useEngineContext.js";
|
|
3
3
|
import { useSalesSdk } from "../../plus/salesSdk/hooks/useSalesSdk.js";
|
|
4
4
|
import { getTempOrderSyncPayload, shouldApplySharedTempOrderPayload } from "../../plus/salesSdk/tempOrderSync.js";
|
|
5
|
+
import "../../plus/salesSdk/index.js";
|
|
5
6
|
import { useEffect, useRef } from "react";
|
|
6
7
|
import { useMemoizedFn } from "ahooks";
|
|
7
8
|
//#region src/components/sharedSecondaryBigSale/SharedSecondaryBigSaleReceiver.tsx
|
package/es/index.js
CHANGED
|
@@ -86,6 +86,7 @@ import { useSalesSdkProducts } from "./plus/salesSdk/hooks/useSalesSdkProducts.j
|
|
|
86
86
|
import SalesSdkDemo from "./plus/salesSdk/demo/index.js";
|
|
87
87
|
import { useSalesSdkDish } from "./plus/salesSdk/hooks/useSalesSdkDish.js";
|
|
88
88
|
import { useSyncOsModule } from "./plus/salesSdk/hooks/useSyncOsModule.js";
|
|
89
|
+
import "./plus/salesSdk/index.js";
|
|
89
90
|
import BigSaleRightActionPanel from "./components/BigSaleRightActionPanel/index.js";
|
|
90
91
|
import ResponsiveWrapper from "./components/list/ResponsiveWrapper.js";
|
|
91
92
|
import { resolveBigSaleSelectionFlowConfig } from "./components/bigSale/selectionFlowConfig.js";
|
|
@@ -138,6 +139,7 @@ import PisellVenueControlPage from "./plus/pisellReservation/PisellVenueControlP
|
|
|
138
139
|
import PisellVenueWallPage from "./plus/pisellReservation/PisellVenueWallPage.js";
|
|
139
140
|
import PisellReservationTablePage from "./plus/pisellReservation/PisellReservationTablePage.js";
|
|
140
141
|
import SelectFloorMapResourceDialog from "./plus/pisellReservation/components/SelectFloorMapResourceDialog.js";
|
|
142
|
+
import "./plus/pisellReservation/index.js";
|
|
141
143
|
import { PisellTopology, PisellTopologyCore } from "./plus/pisellTopology/PisellTopology.js";
|
|
142
144
|
import cupProject_default from "./components/ecocup/cupProject/index.js";
|
|
143
145
|
import CupList from "./components/ecocup/cupList/index.js";
|
|
@@ -259,4 +259,4 @@ function bookingListToReservationTableRows(bookings) {
|
|
|
259
259
|
return rows;
|
|
260
260
|
}
|
|
261
261
|
//#endregion
|
|
262
|
-
export { applyHostResourceShellToBaseRow, bookingListToReservationTableRows, customerBrief, extractResourceRecordIds, filterBookingsByResourceIds, hostBookingUiPatchFromRecord, mergeBookingsForResourceRecord };
|
|
262
|
+
export { applyHostResourceShellToBaseRow, bookingListToReservationTableRows, customerBrief, extractResourceRecordIds, filterBookingsByResourceIds, hostBookingStatusToCardStatus, hostBookingUiPatchFromRecord, mergeBookingsForResourceRecord };
|
|
@@ -78,4 +78,4 @@ function toastFloorPlanLoadError(err) {
|
|
|
78
78
|
PisellToast({ content: err instanceof Error ? err.message : String(err) });
|
|
79
79
|
}
|
|
80
80
|
//#endregion
|
|
81
|
-
export { PISELL_RESERVATION_FLOOR_PLAN_CODE, ensureShopFloorPlanByCode, saveViewConfigToShopFloorPlan, shopLayoutToSceneElements$1 as shopLayoutToSceneElements, toastFloorPlanLoadError, toastFloorPlanSaveError, unsubscribeShopFloorPlanCodeQuery };
|
|
81
|
+
export { PISELL_RESERVATION_FLOOR_PLAN_CODE, buildDefaultReservationFloorPlanPostBody, ensureShopFloorPlanByCode, putShopFloorPlan, saveViewConfigToShopFloorPlan, shopLayoutToSceneElements$1 as shopLayoutToSceneElements, toastFloorPlanLoadError, toastFloorPlanSaveError, unsubscribeShopFloorPlanCodeQuery };
|
|
@@ -927,4 +927,4 @@ function getReservationDataSourceFormColumns() {
|
|
|
927
927
|
];
|
|
928
928
|
}
|
|
929
929
|
//#endregion
|
|
930
|
-
export { RESERVATION_BOUND_ROUND_TABLE_ELEMENT_KIND, RESERVATION_BOUND_TABLE_ELEMENT_KIND, applyReservationFloorMapLiveLabels, defaultReservationTableRows, getDefaultReservationFloorMapConfig, getReservationDataSourceFormColumns, getReservationFloorMapShellConfig, mergeFloorMapElementKindCategoriesWithDefaults, mergeFloorMapElementKindsWithDefaults };
|
|
930
|
+
export { RESERVATION_BOUND_ROUND_TABLE_ELEMENT_KIND, RESERVATION_BOUND_TABLE_ELEMENT_KIND, applyReservationFloorMapLiveLabels, defaultReservationSceneElements, defaultReservationTableRows, getDefaultReservationFloorMapConfig, getReservationDataSourceFormColumns, getReservationFloorMapShellConfig, mergeFloorMapElementKindCategoriesWithDefaults, mergeFloorMapElementKindsWithDefaults };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import "./serve/formResourcePage.js";
|
|
2
|
+
import "./floorRoomCard/mapRowToFloorRoomCardData.js";
|
|
3
|
+
import "./floorRoomCard/ReservationFloorRoomCard.js";
|
|
4
|
+
import "./floorMap/reservationMock.js";
|
|
5
|
+
import "./floorMap/floorPlanApi.js";
|
|
6
|
+
import "./reservationConstants.js";
|
|
7
|
+
import "./data/bookingToReservationTables.js";
|
|
8
|
+
import "./data/formResourceToReservationTables.js";
|
|
9
|
+
import "./data/salesEmbeddedResourceToTableRows.js";
|
|
10
|
+
import "./floorMap/reservationCards.js";
|
|
11
|
+
import "./PisellReservation.js";
|
|
12
|
+
import "./PisellReservationBookingPage.js";
|
|
13
|
+
import "./PisellVenueControlPage.js";
|
|
14
|
+
import "./PisellVenueWallPage.js";
|
|
15
|
+
import "./PisellReservationTablePage.js";
|
|
16
|
+
import "./components/SelectFloorMapResourceDialog.js";
|
|
17
|
+
export {};
|
|
@@ -11,6 +11,7 @@ import { useSalesSdkCart } from "../salesSdk/hooks/useSalesSdkCart.js";
|
|
|
11
11
|
import { useSalesSdkCustomer } from "../salesSdk/hooks/useSalesSdkCustomer.js";
|
|
12
12
|
import { useSalesSdkBookingContext } from "../salesSdk/context/SalesSdkBookingContext.js";
|
|
13
13
|
import { useSalesSdkSummary } from "../salesSdk/hooks/useSalesSdkSummary.js";
|
|
14
|
+
import "../salesSdk/index.js";
|
|
14
15
|
import locales_default from "./locales.js";
|
|
15
16
|
import locales_default$1 from "./components/LineItem/locales.js";
|
|
16
17
|
import { SaleOrderActionBoundary } from "./actions/index.js";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { _objectSpread2 } from "../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
|
|
2
2
|
import useEngineContext from "../../../../../hooks/useEngineContext.js";
|
|
3
3
|
import { useSalesSdkBookingContext } from "../../../../salesSdk/context/SalesSdkBookingContext.js";
|
|
4
|
+
import "../../../../salesSdk/index.js";
|
|
4
5
|
import { useMemo } from "react";
|
|
5
6
|
import { useMemoizedFn } from "ahooks";
|
|
6
7
|
//#region src/plus/saleDetail/components/Client/hooks/useClientSelectorProps.ts
|
|
@@ -9,6 +9,7 @@ import { useSalesSdk } from "../../../salesSdk/hooks/useSalesSdk.js";
|
|
|
9
9
|
import { useSalesSdkCart } from "../../../salesSdk/hooks/useSalesSdkCart.js";
|
|
10
10
|
import { useSalesSdkGlobalScanActivity } from "../../../salesSdk/context/SalesSdkGlobalScanActivityContext.js";
|
|
11
11
|
import { useSalesSdkSummary } from "../../../salesSdk/hooks/useSalesSdkSummary.js";
|
|
12
|
+
import "../../../salesSdk/index.js";
|
|
12
13
|
import { getNumericAmount, getSalesHostModule, resolveSaleDetailOrderIdFromSales, resolveSaleDetailOrderIdFromSalesResult, shouldCloseDialogAfterCheckout, updateLocalOrder } from "./utils.js";
|
|
13
14
|
import { getRemotePrintActions, getWristbandList } from "../../serve.js";
|
|
14
15
|
import { deriveSaleOrderSubmitState } from "../../actions/state.js";
|
|
@@ -3,6 +3,7 @@ import { resolvePaymentMethodName, usePaymentMethodNameMap } from "../../../pise
|
|
|
3
3
|
import { useSalesSdk } from "../../../salesSdk/hooks/useSalesSdk.js";
|
|
4
4
|
import { useSalesSdkCart } from "../../../salesSdk/hooks/useSalesSdkCart.js";
|
|
5
5
|
import { useSalesSdkSummary } from "../../../salesSdk/hooks/useSalesSdkSummary.js";
|
|
6
|
+
import "../../../salesSdk/index.js";
|
|
6
7
|
import React, { memo, useMemo } from "react";
|
|
7
8
|
import { formatAmount, locales } from "@pisell/utils";
|
|
8
9
|
import Decimal from "decimal.js";
|
|
@@ -4,6 +4,7 @@ import { useSalesSdk } from "../salesSdk/hooks/useSalesSdk.js";
|
|
|
4
4
|
import { SalesSdkProvider } from "../salesSdk/context/SalesSdkProvider.js";
|
|
5
5
|
import { SalesSdkDishProvider } from "../salesSdk/context/SalesSdkDishContext.js";
|
|
6
6
|
import { SalesSdkBookingContextProvider } from "../salesSdk/context/SalesSdkBookingContext.js";
|
|
7
|
+
import "../salesSdk/index.js";
|
|
7
8
|
import Base_default from "./Base.js";
|
|
8
9
|
import React, { forwardRef, useImperativeHandle } from "react";
|
|
9
10
|
//#region src/plus/saleDetail/index.tsx
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import useStableInstanceId from "../../../../../../hooks/useStableInstanceId.js";
|
|
2
2
|
import { useSalesSdkDish } from "../../../../../salesSdk/hooks/useSalesSdkDish.js";
|
|
3
3
|
import { useCurrentSalesSdkDish } from "../../../../../salesSdk/hooks/useCurrentSalesSdkDish.js";
|
|
4
|
+
import "../../../../../salesSdk/index.js";
|
|
4
5
|
import { SaleDetailStatusOverview } from "../shared/StatusOverview.js";
|
|
5
6
|
import { DishGroupView } from "./DishGroupView.js";
|
|
6
7
|
import dayjs from "dayjs";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { _objectSpread2 } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
|
|
2
2
|
import useEngineContext from "../../../../hooks/useEngineContext.js";
|
|
3
3
|
import { useCurrentSalesSdkDish } from "../../../salesSdk/hooks/useCurrentSalesSdkDish.js";
|
|
4
|
+
import "../../../salesSdk/index.js";
|
|
4
5
|
import { getInternalNotesByScheduleEvent } from "../../serve.js";
|
|
5
6
|
import { TEMPLATE_B_PAY_ACTIONS, TEMPLATE_B_SUMMARY_ACTIONS } from "../../components/DetailActions/configs/index.js";
|
|
6
7
|
import { DetailActions } from "../../components/DetailActions/index.js";
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import "./hosts/createInstanceHostBridge.js";
|
|
2
|
+
import "./holderConfirm/createHolderConfirmBridge.js";
|
|
3
|
+
import "./giftSelect/createGiftSelectBridge.js";
|
|
4
|
+
import "./context/SalesSdkHostBridgesContext.js";
|
|
5
|
+
import "./utils/formatHolderOptions.js";
|
|
6
|
+
import "./utils/enrichCartLineHolderDisplay.js";
|
|
7
|
+
import "./context/SalesSdkHolderContext.js";
|
|
8
|
+
import "./utils/appendPromotionTags.js";
|
|
9
|
+
import "./context/SalesSdkUIHostsContext.js";
|
|
10
|
+
import "./utils/runAddProductFlow.js";
|
|
11
|
+
import "./components/showAddToCartToast.js";
|
|
12
|
+
import "./utils/resolveAddProductDebounceKey.js";
|
|
13
|
+
import "./utils/productSkuOptions.js";
|
|
14
|
+
import "./utils/identity.js";
|
|
15
|
+
import "./utils/resolveInCartQuantityForAddToast.js";
|
|
16
|
+
import "./utils/addProductWithFlowDebounced.js";
|
|
17
|
+
import "./utils/customerAuthGate.js";
|
|
18
|
+
import "./utils/bookingDate.js";
|
|
19
|
+
import "./utils/holderSubmitValidation.js";
|
|
20
|
+
import "./utils/removeOrderProducts.js";
|
|
21
|
+
import "./selectors.js";
|
|
22
|
+
import "./utils/enrich.js";
|
|
23
|
+
import "./giftSelect/createOpenGiftSelectHost.js";
|
|
24
|
+
import "./utils/ensureHoldersBeforeSubmit.js";
|
|
25
|
+
import "./hooks/useSalesSdk.js";
|
|
26
|
+
import "./bookingEditService/BookingEditServiceDrawer.js";
|
|
27
|
+
import "./hosts/BookingEditHostRenderer.js";
|
|
28
|
+
import "./hosts/CustomerAuthHostRenderer.js";
|
|
29
|
+
import "./hooks/useSalesSdkCart.js";
|
|
30
|
+
import "./hooks/useSalesSdkCustomer.js";
|
|
31
|
+
import "./normalProductDetail/NormalProductDetailHostRenderer.js";
|
|
32
|
+
import "./hosts/createOpenBookingEditHost.js";
|
|
33
|
+
import "./hosts/createOpenMultiDaySelectHost.js";
|
|
34
|
+
import "./hosts/createOpenHolderSelectHost.js";
|
|
35
|
+
import "./hosts/createOpenCustomerAuthHost.js";
|
|
36
|
+
import "./demo/hosts/legacyOpenProductDetail.js";
|
|
37
|
+
import "./hosts/createCompositeOpenProductDetailHost.js";
|
|
38
|
+
import "./normalProductDetail/createOpenNormalProductDetailHost.js";
|
|
39
|
+
import "./normalProductDetail/createOpenBookingSelectionFlowHost.js";
|
|
40
|
+
import "./giftSelect/GiftSelectModal.js";
|
|
41
|
+
import "./giftSelect/GiftSelectHostRenderer.js";
|
|
42
|
+
import "./allergy/AllergySelectionModal.js";
|
|
43
|
+
import "./context/SalesSdkProvider.js";
|
|
44
|
+
import "./context/SalesSdkDishContext.js";
|
|
45
|
+
import "./context/SalesSdkBookingContext.js";
|
|
46
|
+
import "./hooks/useSalesSdkSummary.js";
|
|
47
|
+
import "./hooks/useSalesSdkProducts.js";
|
|
48
|
+
import "./demo/index.js";
|
|
49
|
+
import "./hooks/useSalesSdkDish.js";
|
|
50
|
+
import "./hooks/useCurrentSalesSdkDish.js";
|
|
51
|
+
import "./hooks/useSyncOsModule.js";
|
|
52
|
+
export {};
|
|
@@ -31,4 +31,4 @@ function subscribeBookingDateChange(bookingTicket, callback) {
|
|
|
31
31
|
return typeof off === "function" ? off : () => {};
|
|
32
32
|
}
|
|
33
33
|
//#endregion
|
|
34
|
-
export { formatBookingDateTime, subscribeBookingDateChange };
|
|
34
|
+
export { BOOKING_CONTEXT_DATE_EVENT, formatBookingDateTime, subscribeBookingDateChange };
|
|
@@ -62,4 +62,4 @@ function normalizeCustomerAuthCustomer(value) {
|
|
|
62
62
|
return null;
|
|
63
63
|
}
|
|
64
64
|
//#endregion
|
|
65
|
-
export { isValidOrderCustomerId, normalizeCustomerAuthCustomer, resolveCustomerAuthCurrentCustomerId, shouldPromptCustomerAuthForProduct };
|
|
65
|
+
export { isHolderRequiredProduct, isKioskRuntime, isValidOrderCustomerId, normalizeCustomerAuthCustomer, resolveCustomerAuthCurrentCustomerId, shouldPromptCustomerAuthForProduct };
|
|
@@ -71,4 +71,4 @@ function buildHolderListRequestKey(params) {
|
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
//#endregion
|
|
74
|
-
export { buildHolderListRequestKey, buildHolderListRequestParams, enrichCartBookingHolderDisplay, resolveHolderDisplayConfig };
|
|
74
|
+
export { buildHolderListRequestKey, buildHolderListRequestParams, enrichCartBookingHolderDisplay, pickHolderIdFromBooking, resolveHolderDisplayConfig };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AuthMethodType, EmailAuthConfig, EmailRegistrationVerification, LoginFormData, OAuthConfig, PhoneAuthConfig, RegisterFormData, UIConfig, VerificationMethod } from "./shared/types.js";
|
|
1
2
|
import { Login2, Login2Config, Login2Events, Login2Props } from "./Login2.js";
|
|
2
3
|
import { Register2, Register2Config, Register2Events, Register2Props } from "./Register2.js";
|
|
3
|
-
import { AuthModal
|
|
4
|
+
import { AuthModal } from "./AuthModal.js";
|
|
@@ -226,4 +226,4 @@ interface RegisterFormData {
|
|
|
226
226
|
verification_token?: string;
|
|
227
227
|
}
|
|
228
228
|
//#endregion
|
|
229
|
-
export { AuthMethodType, EmailAuthConfig, LegalTermsConfig, LoginFormData, LoginMethodItem, OAuthConfig, PhoneAuthConfig, RegisterFormData, RegistrationMethodItem, UIConfig };
|
|
229
|
+
export { AuthMethodType, EmailAuthConfig, EmailRegistrationVerification, LegalTermsConfig, LoginFormData, LoginMethodItem, OAuthConfig, PhoneAuthConfig, RegisterFormData, RegistrationMethodItem, UIConfig, VerificationMethod };
|
|
@@ -7,7 +7,7 @@ const DEFAULT_PREDICATES = Object.freeze({
|
|
|
7
7
|
"fulfillment.selected": ({ workflow }) => workflow.fulfillment === "dine_in" || workflow.fulfillment === "takeaway",
|
|
8
8
|
"checkout.locallyEligible": ({ sales }) => sales.cart.lineCount > 0 && !sales.cart.consistencyPending && sales.summary.status === "ready" && sales.payment.status !== "pending" && sales.payment.status !== "unknown",
|
|
9
9
|
"payment.notPending": ({ sales }) => sales.payment.status !== "pending" && sales.payment.status !== "unknown",
|
|
10
|
-
"payment.succeeded": ({ sales }) => sales.payment.status === "succeeded"
|
|
10
|
+
"payment.succeeded": ({ sales, receipt }) => sales.payment.status === "succeeded" || receipt != null && typeof receipt === "object" && typeof receipt.orderId === "string" && receipt.orderId.trim() !== "" && Number.isFinite(Number(receipt.amount))
|
|
11
11
|
});
|
|
12
12
|
function createPredicateRegistry(overrides = {}) {
|
|
13
13
|
const predicates = Object.freeze(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, DEFAULT_PREDICATES), overrides));
|
|
@@ -56,7 +56,7 @@ function createOperationCoordinator(host, registry, options = {}) {
|
|
|
56
56
|
} catch (_unused2) {}
|
|
57
57
|
if (event.type === "finished") emitError(event.metadata.definitionId, request, event.result);
|
|
58
58
|
};
|
|
59
|
-
|
|
59
|
+
const coordinator = require_coordinator.createKernelOperationCoordinator(registry, {
|
|
60
60
|
createContext: ({ request }) => {
|
|
61
61
|
var _options$getWorkflowC, _options$getWorkflowC2;
|
|
62
62
|
return {
|
|
@@ -103,6 +103,7 @@ function createOperationCoordinator(host, registry, options = {}) {
|
|
|
103
103
|
matches: (operation) => operation.conflictScope === "cart"
|
|
104
104
|
}
|
|
105
105
|
}, { initialSessionEpoch: options.initialSessionEpoch });
|
|
106
|
+
return Object.freeze(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, coordinator), {}, { confirmPaymentSucceeded: checkoutSafety.markSucceeded }));
|
|
106
107
|
}
|
|
107
108
|
//#endregion
|
|
108
109
|
exports.createOperationCoordinator = createOperationCoordinator;
|
|
@@ -8,9 +8,10 @@ function forwardFailure(result) {
|
|
|
8
8
|
}
|
|
9
9
|
const sessionEnsureOperationBinding = require_types.bindOperation(require_operations.sessionEnsureOperation, { execute: ({ host }, _input, signal) => host.sales.ensureSession(signal) });
|
|
10
10
|
const sessionResetOperationBinding = require_types.bindOperation(require_operations.sessionResetOperation, { execute: function() {
|
|
11
|
-
var _ref = require_asyncToGenerator._asyncToGenerator(function* (
|
|
11
|
+
var _ref = require_asyncToGenerator._asyncToGenerator(function* (context, _input, signal) {
|
|
12
|
+
const { host } = context;
|
|
12
13
|
const before = host.sales.getObservedSnapshot();
|
|
13
|
-
if (before.payment.status === "pending" || before.payment.status === "unknown") return require_errors.operationUnknown("resetBlockedByPaymentState");
|
|
14
|
+
if ((before.payment.status === "pending" || before.payment.status === "unknown") && context.checkoutSafety.state() !== "succeeded") return require_errors.operationUnknown("resetBlockedByPaymentState");
|
|
14
15
|
const reset = yield host.sales.clearAndReset(signal);
|
|
15
16
|
if (reset.status !== "succeeded") return forwardFailure(reset);
|
|
16
17
|
if (!reset.data.cartEmpty) return require_errors.operationUnknown("resetHostResultNotEmpty");
|