@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,186 @@
|
|
|
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
|
+
//#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 = require_objectSpread2._objectSpread2(require_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(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2(require_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 = require_asyncToGenerator._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 = require_asyncToGenerator._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(require_objectSpread2._objectSpread2(require_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 = require_asyncToGenerator._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
|
+
exports.createStaffPaymentAuthorizationStore = createStaffPaymentAuthorizationStore;
|
|
184
|
+
exports.finalizeStaffPaymentOutcome = finalizeStaffPaymentOutcome;
|
|
185
|
+
exports.isStaffPaymentAuthorizationCancelled = isStaffPaymentAuthorizationCancelled;
|
|
186
|
+
exports.resolveStaffPaymentResult = resolveStaffPaymentResult;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pisell/private-materials",
|
|
3
|
-
"version": "6.12.
|
|
3
|
+
"version": "6.12.172",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"module": "./es/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -70,10 +70,10 @@
|
|
|
70
70
|
"styled-components": "^6.0.0-rc.3",
|
|
71
71
|
"use-sync-external-store": "^1.6.0",
|
|
72
72
|
"@pisell/pi-payment-sdk": "0.0.3",
|
|
73
|
-
"@pisell/utils": "3.0.4",
|
|
74
73
|
"@pisell/date-picker": "3.0.10",
|
|
75
|
-
"@pisell/
|
|
76
|
-
"@pisell/materials": "6.12.50"
|
|
74
|
+
"@pisell/utils": "3.0.4",
|
|
75
|
+
"@pisell/materials": "6.12.50",
|
|
76
|
+
"@pisell/icon": "0.0.11"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
79
|
"react": "^18.0.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|