@pisell/pisellos 0.10.88 → 0.10.91
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/dist/model/strategy/adapter/itemRule/adapter.d.ts +3 -1
- package/dist/model/strategy/adapter/itemRule/adapter.js +74 -7
- package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +3 -1
- package/dist/model/strategy/adapter/itemRule/evaluator.js +13 -0
- package/dist/model/strategy/adapter/itemRule/type.d.ts +40 -1
- package/dist/model/strategy/adapter/itemRule/type.js +10 -0
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts +2 -1
- package/dist/model/strategy/adapter/promotion/evaluator.js +103 -112
- package/dist/modules/BookingContext/utils/calendarBooking.d.ts +15 -0
- package/dist/modules/BookingContext/utils/calendarBooking.js +207 -0
- package/dist/modules/BookingContext/utils/index.d.ts +1 -0
- package/dist/modules/BookingContext/utils/index.js +1 -0
- package/dist/modules/BookingContext/utils/productExtend.d.ts +21 -0
- package/dist/modules/BookingContext/utils/productExtend.js +132 -33
- package/dist/modules/BookingContext/utils/resources.js +1 -1
- package/dist/modules/Cart/index.js +4 -3
- package/dist/modules/Cart/types.d.ts +2 -0
- package/dist/modules/Cart/utils/cartProduct.d.ts +3 -1
- package/dist/modules/Cart/utils/cartProduct.js +59 -32
- package/dist/modules/Date/index.d.ts +1 -1
- package/dist/modules/Date/index.js +60 -14
- package/dist/modules/Date/types.d.ts +5 -0
- package/dist/modules/OpenData/salesSettings.js +1 -1
- package/dist/modules/OpenData/types.d.ts +9 -0
- package/dist/modules/OpenData/utils.d.ts +1 -1
- package/dist/modules/OpenData/utils.js +3 -2
- package/dist/modules/Order/index.d.ts +22 -7
- package/dist/modules/Order/index.js +1565 -1161
- package/dist/modules/Order/localEftposState.d.ts +13 -0
- package/dist/modules/Order/localEftposState.js +39 -0
- package/dist/modules/Order/types.d.ts +33 -11
- package/dist/modules/Order/types.js +2 -2
- package/dist/modules/Order/unpaidAmountGap.d.ts +6 -0
- package/dist/modules/Order/unpaidAmountGap.js +72 -0
- package/dist/modules/Order/utils.d.ts +4 -1
- package/dist/modules/Order/utils.js +185 -129
- package/dist/modules/Payment/walletpass.js +32 -6
- package/dist/modules/Product/types.d.ts +16 -0
- package/dist/modules/ProductList/index.js +1 -1
- package/dist/modules/ResourcePlanner/planner.d.ts +2 -0
- package/dist/modules/ResourcePlanner/planner.js +383 -24
- package/dist/modules/ResourcePlanner/types.d.ts +42 -0
- package/dist/modules/Rules/index.js +86 -54
- package/dist/modules/Schedule/index.d.ts +7 -1
- package/dist/modules/Schedule/index.js +155 -39
- package/dist/modules/Schedule/types.d.ts +2 -0
- package/dist/modules/bookingReadValidation.d.ts +6 -0
- package/dist/modules/bookingReadValidation.js +72 -0
- package/dist/plugins/request.d.ts +2 -0
- package/dist/server/index.d.ts +9 -0
- package/dist/server/index.js +1928 -1462
- package/dist/server/modules/form/index.d.ts +19 -0
- package/dist/server/modules/form/index.js +205 -0
- package/dist/server/modules/form/types.d.ts +13 -0
- package/dist/server/modules/form/types.js +3 -0
- package/dist/server/modules/index.d.ts +3 -0
- package/dist/server/modules/index.js +4 -0
- package/dist/server/modules/order/index.d.ts +21 -0
- package/dist/server/modules/order/index.js +1399 -831
- package/dist/server/modules/order/types.d.ts +3 -0
- package/dist/server/modules/order/utils/filterOrders.js +20 -0
- package/dist/server/modules/products/index.d.ts +28 -7
- package/dist/server/modules/products/index.js +1295 -769
- package/dist/server/modules/products/replication.d.ts +8 -0
- package/dist/server/modules/products/replication.js +69 -0
- package/dist/server/modules/products/types.d.ts +12 -1
- package/dist/server/modules/products/types.js +4 -0
- package/dist/shared/receipt/customerInvoiceLanguages.d.ts +1 -1
- package/dist/shared/receipt/customerInvoiceLanguages.js +5 -3
- package/dist/shared/receipt/small-ticket.d.ts +1 -0
- package/dist/shared/receipt/small-ticket.js +58 -26
- package/dist/shared/receipt/templateVisibility.d.ts +3 -0
- package/dist/shared/receipt/templateVisibility.js +6 -2
- package/dist/solution/BaseSales/fulfillmentItemRules.d.ts +27 -0
- package/dist/solution/BaseSales/fulfillmentItemRules.js +750 -0
- package/dist/solution/BaseSales/index.d.ts +22 -6
- package/dist/solution/BaseSales/index.js +1881 -1347
- package/dist/solution/BaseSales/pickupTiming.d.ts +4 -0
- package/dist/solution/BaseSales/pickupTiming.js +35 -8
- package/dist/solution/BaseSales/types.d.ts +4 -0
- package/dist/solution/BaseSales/types.js +1 -0
- package/dist/solution/BaseSales/utils/posDurationPricing.d.ts +21 -0
- package/dist/solution/BaseSales/utils/posDurationPricing.js +174 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +2 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +8 -8
- package/dist/solution/BookingByStep/index.d.ts +19 -3
- package/dist/solution/BookingByStep/index.js +681 -361
- package/dist/solution/BookingByStep/utils/resources.d.ts +10 -0
- package/dist/solution/BookingByStep/utils/resources.js +117 -76
- package/dist/solution/BookingTicket/index.d.ts +6 -0
- package/dist/solution/BookingTicket/index.js +666 -593
- package/dist/solution/BookingTicket/types.d.ts +1 -1
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +2 -1
- package/dist/solution/BookingTicket/utils/addProductDecision.js +35 -8
- package/dist/solution/BookingTicket/utils/redeemArrival.d.ts +7 -7
- package/dist/solution/BookingTicket/utils/resolveUniqueCartDetail.d.ts +8 -0
- package/dist/solution/BookingTicket/utils/resolveUniqueCartDetail.js +188 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +58 -94
- package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +1 -3
- package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +33 -62
- package/dist/solution/OrderInvoicePreview/index.js +4 -3
- package/dist/solution/Sales/index.js +1 -1
- package/dist/solution/ScanOrder/index.d.ts +2 -0
- package/dist/solution/ScanOrder/index.js +230 -97
- package/dist/solution/ScanOrder/menuAvailability.d.ts +24 -0
- package/dist/solution/ScanOrder/menuAvailability.js +363 -0
- package/dist/solution/ScanOrder/types.d.ts +3 -0
- package/dist/solution/UnifiedBookingSales/index.d.ts +42 -10
- package/dist/solution/UnifiedBookingSales/index.js +2493 -1496
- package/dist/solution/UnifiedBookingSales/salesSettings.js +1 -1
- package/dist/solution/UnifiedBookingSales/types.d.ts +20 -5
- package/dist/utils/pos-receipt-auto-print.d.ts +4 -0
- package/dist/utils/pos-receipt-auto-print.js +14 -0
- package/lib/model/strategy/adapter/itemRule/adapter.d.ts +3 -1
- package/lib/model/strategy/adapter/itemRule/adapter.js +54 -4
- package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +3 -1
- package/lib/model/strategy/adapter/itemRule/evaluator.js +9 -0
- package/lib/model/strategy/adapter/itemRule/type.d.ts +40 -1
- package/lib/model/strategy/adapter/itemRule/type.js +10 -0
- package/lib/model/strategy/adapter/promotion/evaluator.d.ts +2 -1
- package/lib/model/strategy/adapter/promotion/evaluator.js +22 -21
- package/lib/modules/BookingContext/utils/calendarBooking.d.ts +15 -0
- package/lib/modules/BookingContext/utils/calendarBooking.js +156 -0
- package/lib/modules/BookingContext/utils/index.d.ts +1 -0
- package/lib/modules/BookingContext/utils/index.js +11 -0
- package/lib/modules/BookingContext/utils/productExtend.d.ts +21 -0
- package/lib/modules/BookingContext/utils/productExtend.js +104 -5
- package/lib/modules/BookingContext/utils/resources.js +1 -1
- package/lib/modules/Cart/index.js +4 -2
- package/lib/modules/Cart/types.d.ts +2 -0
- package/lib/modules/Cart/utils/cartProduct.d.ts +3 -1
- package/lib/modules/Cart/utils/cartProduct.js +39 -20
- package/lib/modules/Date/index.d.ts +1 -1
- package/lib/modules/Date/index.js +28 -5
- package/lib/modules/Date/types.d.ts +5 -0
- package/lib/modules/OpenData/salesSettings.js +1 -1
- package/lib/modules/OpenData/types.d.ts +9 -0
- package/lib/modules/OpenData/utils.d.ts +1 -1
- package/lib/modules/OpenData/utils.js +3 -2
- package/lib/modules/Order/index.d.ts +22 -7
- package/lib/modules/Order/index.js +457 -174
- package/lib/modules/Order/localEftposState.d.ts +13 -0
- package/lib/modules/Order/localEftposState.js +44 -0
- package/lib/modules/Order/types.d.ts +33 -11
- package/lib/modules/Order/types.js +2 -2
- package/lib/modules/Order/unpaidAmountGap.d.ts +6 -0
- package/lib/modules/Order/unpaidAmountGap.js +60 -0
- package/lib/modules/Order/utils.d.ts +4 -1
- package/lib/modules/Order/utils.js +51 -3
- package/lib/modules/Payment/walletpass.js +23 -1
- package/lib/modules/Product/types.d.ts +16 -0
- package/lib/modules/ProductList/index.js +1 -1
- package/lib/modules/ResourcePlanner/planner.d.ts +2 -0
- package/lib/modules/ResourcePlanner/planner.js +299 -9
- package/lib/modules/ResourcePlanner/types.d.ts +42 -0
- package/lib/modules/Rules/index.js +32 -3
- package/lib/modules/Schedule/index.d.ts +7 -1
- package/lib/modules/Schedule/index.js +68 -4
- package/lib/modules/Schedule/types.d.ts +2 -0
- package/lib/modules/bookingReadValidation.d.ts +6 -0
- package/lib/modules/bookingReadValidation.js +56 -0
- package/lib/plugins/request.d.ts +2 -0
- package/lib/server/index.d.ts +9 -0
- package/lib/server/index.js +279 -30
- package/lib/server/modules/form/index.d.ts +19 -0
- package/lib/server/modules/form/index.js +73 -0
- package/lib/server/modules/form/types.d.ts +13 -0
- package/lib/server/modules/form/types.js +9 -0
- package/lib/server/modules/index.d.ts +3 -0
- package/lib/server/modules/index.js +15 -1
- package/lib/server/modules/order/index.d.ts +21 -0
- package/lib/server/modules/order/index.js +344 -35
- package/lib/server/modules/order/types.d.ts +3 -0
- package/lib/server/modules/order/utils/filterOrders.js +18 -0
- package/lib/server/modules/products/index.d.ts +28 -7
- package/lib/server/modules/products/index.js +224 -62
- package/lib/server/modules/products/replication.d.ts +8 -0
- package/lib/server/modules/products/replication.js +30 -0
- package/lib/server/modules/products/types.d.ts +12 -1
- package/lib/server/modules/products/types.js +3 -0
- package/lib/shared/receipt/customerInvoiceLanguages.d.ts +1 -1
- package/lib/shared/receipt/customerInvoiceLanguages.js +5 -3
- package/lib/shared/receipt/small-ticket.d.ts +1 -0
- package/lib/shared/receipt/small-ticket.js +53 -25
- package/lib/shared/receipt/templateVisibility.d.ts +3 -0
- package/lib/shared/receipt/templateVisibility.js +6 -2
- package/lib/solution/BaseSales/fulfillmentItemRules.d.ts +27 -0
- package/lib/solution/BaseSales/fulfillmentItemRules.js +259 -0
- package/lib/solution/BaseSales/index.d.ts +22 -6
- package/lib/solution/BaseSales/index.js +347 -59
- package/lib/solution/BaseSales/pickupTiming.d.ts +4 -0
- package/lib/solution/BaseSales/pickupTiming.js +24 -3
- package/lib/solution/BaseSales/types.d.ts +4 -0
- package/lib/solution/BaseSales/types.js +1 -0
- package/lib/solution/BaseSales/utils/posDurationPricing.d.ts +21 -0
- package/lib/solution/BaseSales/utils/posDurationPricing.js +133 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +2 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +1 -1
- package/lib/solution/BookingByStep/index.d.ts +19 -3
- package/lib/solution/BookingByStep/index.js +229 -17
- package/lib/solution/BookingByStep/utils/resources.d.ts +10 -0
- package/lib/solution/BookingByStep/utils/resources.js +25 -15
- package/lib/solution/BookingTicket/index.d.ts +6 -0
- package/lib/solution/BookingTicket/index.js +40 -5
- package/lib/solution/BookingTicket/types.d.ts +1 -1
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +2 -1
- package/lib/solution/BookingTicket/utils/addProductDecision.js +34 -4
- package/lib/solution/BookingTicket/utils/redeemArrival.d.ts +7 -7
- package/lib/solution/BookingTicket/utils/resolveUniqueCartDetail.d.ts +8 -0
- package/lib/solution/BookingTicket/utils/resolveUniqueCartDetail.js +136 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +2 -14
- package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +1 -3
- package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +17 -34
- package/lib/solution/OrderInvoicePreview/index.js +1 -0
- package/lib/solution/Sales/index.js +1 -1
- package/lib/solution/ScanOrder/index.d.ts +2 -0
- package/lib/solution/ScanOrder/index.js +131 -22
- package/lib/solution/ScanOrder/menuAvailability.d.ts +24 -0
- package/lib/solution/ScanOrder/menuAvailability.js +203 -0
- package/lib/solution/ScanOrder/types.d.ts +3 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +42 -10
- package/lib/solution/UnifiedBookingSales/index.js +717 -144
- package/lib/solution/UnifiedBookingSales/salesSettings.js +1 -1
- package/lib/solution/UnifiedBookingSales/types.d.ts +20 -5
- package/lib/utils/pos-receipt-auto-print.d.ts +4 -0
- package/lib/utils/pos-receipt-auto-print.js +13 -0
- package/package.json +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CommittedProducts, ReplicatedProducts } from './types';
|
|
2
|
+
/** A separate committed view: failed writes must never leak into recovery snapshots. */
|
|
3
|
+
export declare class CommittedProductState {
|
|
4
|
+
private products;
|
|
5
|
+
private revision;
|
|
6
|
+
commit(change: ReplicatedProducts): CommittedProducts;
|
|
7
|
+
snapshot(): CommittedProducts;
|
|
8
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
5
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
6
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
9
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
11
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
12
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
13
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
14
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
15
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
16
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
17
|
+
/** A separate committed view: failed writes must never leak into recovery snapshots. */
|
|
18
|
+
export var CommittedProductState = /*#__PURE__*/function () {
|
|
19
|
+
function CommittedProductState() {
|
|
20
|
+
_classCallCheck(this, CommittedProductState);
|
|
21
|
+
_defineProperty(this, "products", new Map());
|
|
22
|
+
_defineProperty(this, "revision", 0);
|
|
23
|
+
}
|
|
24
|
+
_createClass(CommittedProductState, [{
|
|
25
|
+
key: "commit",
|
|
26
|
+
value: function commit(change) {
|
|
27
|
+
var copy = structuredClone(change);
|
|
28
|
+
if (copy.kind === 'snapshot') this.products.clear();
|
|
29
|
+
var _iterator = _createForOfIteratorHelper(copy.deletedIds),
|
|
30
|
+
_step;
|
|
31
|
+
try {
|
|
32
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
33
|
+
var id = _step.value;
|
|
34
|
+
this.products.delete(id);
|
|
35
|
+
}
|
|
36
|
+
} catch (err) {
|
|
37
|
+
_iterator.e(err);
|
|
38
|
+
} finally {
|
|
39
|
+
_iterator.f();
|
|
40
|
+
}
|
|
41
|
+
var _iterator2 = _createForOfIteratorHelper(copy.upserts),
|
|
42
|
+
_step2;
|
|
43
|
+
try {
|
|
44
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
45
|
+
var product = _step2.value;
|
|
46
|
+
this.products.set(product.id, product);
|
|
47
|
+
}
|
|
48
|
+
} catch (err) {
|
|
49
|
+
_iterator2.e(err);
|
|
50
|
+
} finally {
|
|
51
|
+
_iterator2.f();
|
|
52
|
+
}
|
|
53
|
+
return _objectSpread(_objectSpread({}, copy), {}, {
|
|
54
|
+
revision: ++this.revision
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}, {
|
|
58
|
+
key: "snapshot",
|
|
59
|
+
value: function snapshot() {
|
|
60
|
+
return {
|
|
61
|
+
kind: 'snapshot',
|
|
62
|
+
revision: this.revision,
|
|
63
|
+
upserts: structuredClone(_toConsumableArray(this.products.values())),
|
|
64
|
+
deletedIds: []
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
}]);
|
|
68
|
+
return CommittedProductState;
|
|
69
|
+
}();
|
|
@@ -32,6 +32,15 @@ export interface ProductSnapshot {
|
|
|
32
32
|
cover?: ProductData['cover'];
|
|
33
33
|
holder_config?: ProductData['holder_config'];
|
|
34
34
|
}
|
|
35
|
+
/** Raw product data only; each screen applies its own query/pricing context. */
|
|
36
|
+
export interface ReplicatedProducts {
|
|
37
|
+
kind: 'snapshot' | 'delta';
|
|
38
|
+
upserts: ProductData[];
|
|
39
|
+
deletedIds: number[];
|
|
40
|
+
}
|
|
41
|
+
export interface CommittedProducts extends ReplicatedProducts {
|
|
42
|
+
revision: number;
|
|
43
|
+
}
|
|
35
44
|
/**
|
|
36
45
|
* 加载报价单商品价格参数
|
|
37
46
|
*/
|
|
@@ -96,7 +105,9 @@ export declare enum ProductsHooks {
|
|
|
96
105
|
onProductSelected = "products:onProductSelected",
|
|
97
106
|
onProductsPriceApplied = "products:onProductsPriceApplied",
|
|
98
107
|
/** pubsub 同步批次处理完成后触发,Server 层监听此事件重新计算并推送 */
|
|
99
|
-
onProductsSyncCompleted = "products:onProductsSyncCompleted"
|
|
108
|
+
onProductsSyncCompleted = "products:onProductsSyncCompleted",
|
|
109
|
+
onProductsCommitted = "products:onProductsCommitted",
|
|
110
|
+
onProductSyncDestroyed = "products:onProductSyncDestroyed"
|
|
100
111
|
}
|
|
101
112
|
/** pubsub 商品同步消息结构 */
|
|
102
113
|
export interface ProductSyncMessage {
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
* 商品轻量查询范围
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
+
/** Raw product data only; each screen applies its own query/pricing context. */
|
|
14
|
+
|
|
13
15
|
/**
|
|
14
16
|
* 加载报价单商品价格参数
|
|
15
17
|
*/
|
|
@@ -35,6 +37,8 @@ export var ProductsHooks = /*#__PURE__*/function (ProductsHooks) {
|
|
|
35
37
|
ProductsHooks["onProductSelected"] = "products:onProductSelected";
|
|
36
38
|
ProductsHooks["onProductsPriceApplied"] = "products:onProductsPriceApplied";
|
|
37
39
|
ProductsHooks["onProductsSyncCompleted"] = "products:onProductsSyncCompleted";
|
|
40
|
+
ProductsHooks["onProductsCommitted"] = "products:onProductsCommitted";
|
|
41
|
+
ProductsHooks["onProductSyncDestroyed"] = "products:onProductSyncDestroyed";
|
|
38
42
|
return ProductsHooks;
|
|
39
43
|
}({});
|
|
40
44
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type CustomerInvoiceLanguageCode = 'en' | 'zh_CN' | 'zh_HK' | 'ja' | 'pt' | 'cn_en';
|
|
1
|
+
export type CustomerInvoiceLanguageCode = 'en' | 'zh_CN' | 'zh_HK' | 'ja' | 'pt' | 'cn_en' | 'ja_en';
|
|
2
2
|
export interface CustomerInvoiceLanguageOption {
|
|
3
3
|
code: CustomerInvoiceLanguageCode;
|
|
4
4
|
locales: string[];
|
|
@@ -25,15 +25,17 @@ var aliases = {
|
|
|
25
25
|
pt_br: 'pt',
|
|
26
26
|
pt_pt: 'pt',
|
|
27
27
|
cn_en: 'cn_en',
|
|
28
|
-
en_cn: 'cn_en'
|
|
28
|
+
en_cn: 'cn_en',
|
|
29
|
+
ja_en: 'ja_en'
|
|
29
30
|
};
|
|
30
31
|
export function normalizeCustomerInvoiceLanguage(value) {
|
|
31
32
|
return aliases[value.trim().toLowerCase().replace(/-/g, '_')];
|
|
32
33
|
}
|
|
33
34
|
function option(code) {
|
|
35
|
+
var locales = code === 'cn_en' ? ['en', 'zh_CN'] : code === 'ja_en' ? ['ja', 'en'] : [code];
|
|
34
36
|
return {
|
|
35
37
|
code: code,
|
|
36
|
-
locales:
|
|
38
|
+
locales: locales
|
|
37
39
|
};
|
|
38
40
|
}
|
|
39
41
|
|
|
@@ -55,6 +57,6 @@ export function resolveCustomerInvoiceLanguages(language, pageLocale) {
|
|
|
55
57
|
var normalized = normalizeCustomerInvoiceLanguage(pageLocale);
|
|
56
58
|
// A page locale is a single language, never a bilingual printer mode.
|
|
57
59
|
var requested = pageLocale.toLowerCase().replace(/_/g, '-');
|
|
58
|
-
var fallback = normalized && normalized !== 'cn_en' ? normalized : requested.startsWith('zh-tw') || requested.startsWith('zh-hk') ? 'zh_HK' : requested.startsWith('zh') ? 'zh_CN' : requested.startsWith('ja') ? 'ja' : requested.startsWith('pt') ? 'pt' : 'en';
|
|
60
|
+
var fallback = normalized && normalized !== 'cn_en' && normalized !== 'ja_en' ? normalized : requested.startsWith('zh-tw') || requested.startsWith('zh-hk') ? 'zh_HK' : requested.startsWith('zh') ? 'zh_CN' : requested.startsWith('ja') ? 'ja' : requested.startsWith('pt') ? 'pt' : 'en';
|
|
59
61
|
return [option(fallback)];
|
|
60
62
|
}
|
|
@@ -20,10 +20,12 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
20
20
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
21
21
|
import dayjs from 'dayjs';
|
|
22
22
|
import Decimal from 'decimal.js';
|
|
23
|
+
import { normalizeUnpaidOrderAmountGap } from "../../modules/Order/unpaidAmountGap";
|
|
23
24
|
import { getProductHolderRelations, hasProductBooking } from "../../modules/Order/holderRelations";
|
|
24
25
|
import { isFulfillmentTimingBooking } from "../../modules/Order/pickupTiming";
|
|
25
26
|
import { resolveInvoiceDataVisibility } from "./templateVisibility";
|
|
26
27
|
var DEFAULT_LOCALES = ['en', 'zh_CN'];
|
|
28
|
+
var BOOKING_ID_UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
27
29
|
|
|
28
30
|
// Attach provenance to a private copy BEFORE any locale-dependent filtering.
|
|
29
31
|
// Symbols survive the existing spread-based normalization, never enter JSON,
|
|
@@ -102,6 +104,7 @@ var LABELS = {
|
|
|
102
104
|
cashReceived: 'Cash received',
|
|
103
105
|
changeDue: 'Change due',
|
|
104
106
|
eftpos: 'Eftpos',
|
|
107
|
+
creditCard: 'Credit card',
|
|
105
108
|
wallet: 'Wallet',
|
|
106
109
|
giftCard: 'Gift card',
|
|
107
110
|
pointCard: 'Point card',
|
|
@@ -148,6 +151,7 @@ var LABELS = {
|
|
|
148
151
|
cashReceived: '收取现金',
|
|
149
152
|
changeDue: '找零',
|
|
150
153
|
eftpos: '刷卡支付',
|
|
154
|
+
creditCard: '信用卡',
|
|
151
155
|
wallet: '钱包支付',
|
|
152
156
|
giftCard: '礼品卡',
|
|
153
157
|
pointCard: '积分卡',
|
|
@@ -194,6 +198,7 @@ var LABELS = {
|
|
|
194
198
|
cashReceived: '收取現金',
|
|
195
199
|
changeDue: '找零',
|
|
196
200
|
eftpos: '刷卡支付',
|
|
201
|
+
creditCard: '信用卡',
|
|
197
202
|
wallet: '錢包支付',
|
|
198
203
|
giftCard: '禮品卡',
|
|
199
204
|
pointCard: '積分卡',
|
|
@@ -238,6 +243,7 @@ var LABELS = {
|
|
|
238
243
|
asap: 'できるだけ早く',
|
|
239
244
|
cash: '現金',
|
|
240
245
|
eftpos: 'カード',
|
|
246
|
+
creditCard: 'クレジットカード',
|
|
241
247
|
wallet: 'ウォレット',
|
|
242
248
|
giftCard: 'ギフトカード',
|
|
243
249
|
pointCard: 'ポイントカード',
|
|
@@ -283,6 +289,7 @@ var LABELS = {
|
|
|
283
289
|
asap: 'Assim que possível',
|
|
284
290
|
cash: 'Dinheiro',
|
|
285
291
|
eftpos: 'Cartão',
|
|
292
|
+
creditCard: 'Cartão de crédito',
|
|
286
293
|
wallet: 'Carteira',
|
|
287
294
|
giftCard: 'Cartão-presente',
|
|
288
295
|
pointCard: 'Cartão de pontos',
|
|
@@ -312,7 +319,8 @@ var LABELS = {
|
|
|
312
319
|
}
|
|
313
320
|
};
|
|
314
321
|
export function buildSmallTicketData(params) {
|
|
315
|
-
var
|
|
322
|
+
var normalizedOrder = normalizeUnpaidOrderAmountGap(params.order || {});
|
|
323
|
+
var order = params.includeReceiptKeys ? copyReceiptSource(normalizedOrder) : normalizedOrder;
|
|
316
324
|
var shopInfo = params.shopInfo || {};
|
|
317
325
|
var locales = resolveLocales(shopInfo, params.locales);
|
|
318
326
|
var productMap = params.productMap || {};
|
|
@@ -363,7 +371,7 @@ function buildLocaleData(params) {
|
|
|
363
371
|
financials: financials
|
|
364
372
|
}),
|
|
365
373
|
customer: buildCustomer(order, locale, visibility.customer),
|
|
366
|
-
appointment: buildAppointment(order, locale)
|
|
374
|
+
appointment: buildAppointment(order, locale, visibility.lineGroups.resourceTitle)
|
|
367
375
|
}, delivery.length ? {
|
|
368
376
|
delivery: delivery
|
|
369
377
|
} : {}), {}, {
|
|
@@ -429,7 +437,10 @@ function buildBaseData(params) {
|
|
|
429
437
|
} : {});
|
|
430
438
|
}
|
|
431
439
|
function buildRewardClaimUrl(shopInfo, shopOrderNumber) {
|
|
432
|
-
var
|
|
440
|
+
var default_domain = typeof shopInfo.default_domain === 'string' ? shopInfo.default_domain.trim() : '';
|
|
441
|
+
var private_domain = typeof shopInfo.private_domain === 'string' ? shopInfo.private_domain.trim() : '';
|
|
442
|
+
// 私有域名优先于默认域名
|
|
443
|
+
var domain = default_domain;
|
|
433
444
|
var orderNumber = typeof shopOrderNumber === 'string' ? shopOrderNumber.trim() : typeof shopOrderNumber === 'number' && Number.isFinite(shopOrderNumber) ? String(shopOrderNumber) : '';
|
|
434
445
|
if (!domain || !orderNumber) return undefined;
|
|
435
446
|
try {
|
|
@@ -494,7 +505,7 @@ function buildProducts(order, locale, productMap) {
|
|
|
494
505
|
}).filter(Boolean).join(', ');
|
|
495
506
|
if (holderName) {
|
|
496
507
|
// 复用 Web Invoice / 原生均支持的文本扩展行,不混入金额或商品备注。
|
|
497
|
-
extensionList.push(_objectSpread(_objectSpread({}, receiptKey(rawProduct, 'product-holder'
|
|
508
|
+
extensionList.push(_objectSpread(_objectSpread({}, receiptKey(rawProduct, 'product-holder')), {}, {
|
|
498
509
|
item: "".concat(label(locale, 'productHolder'), ": ").concat(holderName),
|
|
499
510
|
value: ''
|
|
500
511
|
}));
|
|
@@ -1260,23 +1271,19 @@ function buildFees(params) {
|
|
|
1260
1271
|
var isPriceIncludeTax = firstPresentValue(summary.is_price_include_tax, order.is_price_include_tax, shopInfo.is_price_include_tax);
|
|
1261
1272
|
var roundingAmount = firstPresentValue(summary.rounding_amount, order.rounding_amount);
|
|
1262
1273
|
var payProcessingFee = financials.payProcessingFee;
|
|
1263
|
-
if (isNonZero(payProcessingFee)) {
|
|
1264
|
-
fees.push(_objectSpread(_objectSpread({}, receiptKey(order, 'payment-processing-fee')), {}, {
|
|
1265
|
-
item: label(locale, 'payProcessingFee'),
|
|
1266
|
-
value: formatMoney(payProcessingFee, currencySymbol)
|
|
1267
|
-
}));
|
|
1268
|
-
}
|
|
1269
1274
|
var productExpectAmount = firstPresentValue(summary.product_expect_amount, summary.product_amount, order.product_expect_amount);
|
|
1270
1275
|
var productOriginalAmount = (_firstPresentValue2 = firstPresentValue(summary.product_original_amount, order.product_original_amount)) !== null && _firstPresentValue2 !== void 0 ? _firstPresentValue2 : calculateProductOriginalAmount(order);
|
|
1271
1276
|
var totalSavingsAmount = new Decimal(toMoneyNumber(productOriginalAmount)).minus(toMoneyNumber(productExpectAmount)).plus(toMoneyNumber(discountAmount));
|
|
1272
1277
|
var itemDiscountAmount = new Decimal(toMoneyNumber(productExpectAmount !== null && productExpectAmount !== void 0 ? productExpectAmount : 0)).minus(toMoneyNumber(productOriginalAmount));
|
|
1273
1278
|
return {
|
|
1274
1279
|
fees: fees,
|
|
1275
|
-
countFee: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
1280
|
+
countFee: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
1276
1281
|
total_amount: formatMoney((_firstPresentValue3 = firstPresentValue(summary.total_amount, order.total_amount)) !== null && _firstPresentValue3 !== void 0 ? _firstPresentValue3 : 0, currencySymbol),
|
|
1277
1282
|
original_item_amount: formatMoney(productOriginalAmount, currencySymbol),
|
|
1278
|
-
product_expect_amount: formatMoney(productExpectAmount !== null && productExpectAmount !== void 0 ? productExpectAmount : 0, currencySymbol)
|
|
1279
|
-
|
|
1283
|
+
product_expect_amount: formatMoney(productExpectAmount !== null && productExpectAmount !== void 0 ? productExpectAmount : 0, currencySymbol)
|
|
1284
|
+
}, isNonZero(itemDiscountAmount) ? {
|
|
1285
|
+
item_discount_amount: formatCalculatedMoney(itemDiscountAmount, currencySymbol)
|
|
1286
|
+
} : {}), {}, {
|
|
1280
1287
|
expect_amount: formatMoney(financials.totalAmount, currencySymbol),
|
|
1281
1288
|
product_quantity: toNumber(firstPresentValue(summary.product_quantity, products.reduce(function (sum, product) {
|
|
1282
1289
|
return sum + product.product_quantity;
|
|
@@ -1288,7 +1295,7 @@ function buildFees(params) {
|
|
|
1288
1295
|
customer_paid_amount: formatMoney(financials.customerPaidAmount, currencySymbol),
|
|
1289
1296
|
net_payment_applied: formatMoney(financials.netPaymentApplied, currencySymbol)
|
|
1290
1297
|
}, isPresentId(roundingAmount) ? {
|
|
1291
|
-
rounding_amount:
|
|
1298
|
+
rounding_amount: formatCalculatedMoney(roundingAmount, currencySymbol)
|
|
1292
1299
|
} : {}), isNonZero(totalSavingsAmount) ? {
|
|
1293
1300
|
order_total_discount: formatMoney(totalSavingsAmount, currencySymbol)
|
|
1294
1301
|
} : {}), financials.hasPayProcessingFee ? {
|
|
@@ -1421,7 +1428,7 @@ function formatPickupBookingStart(bookings, locale) {
|
|
|
1421
1428
|
var dateText = locale === 'en' ? "".concat(day, "/").concat(month, "/").concat(year) : "".concat(year, "/").concat(month, "/").concat(day);
|
|
1422
1429
|
return "".concat(time.slice(0, 5), " ").concat(dateText);
|
|
1423
1430
|
}
|
|
1424
|
-
function buildAppointment(order, locale) {
|
|
1431
|
+
function buildAppointment(order, locale, showResourceTitle) {
|
|
1425
1432
|
var _order$metadata13, _order$metadata14, _order$metadata15, _order$form_data;
|
|
1426
1433
|
var parentScheduleId = (_order$metadata13 = order.metadata) === null || _order$metadata13 === void 0 ? void 0 : _order$metadata13.appointment_booking_parent_schedule_id;
|
|
1427
1434
|
var bookings = sortBookings(normalizeArray(order.bookings).filter(function (booking) {
|
|
@@ -1434,7 +1441,8 @@ function buildAppointment(order, locale) {
|
|
|
1434
1441
|
booking: booking,
|
|
1435
1442
|
allResources: allResources,
|
|
1436
1443
|
bookingCount: bookings.length,
|
|
1437
|
-
locale: locale
|
|
1444
|
+
locale: locale,
|
|
1445
|
+
showResourceTitle: showResourceTitle
|
|
1438
1446
|
});
|
|
1439
1447
|
});
|
|
1440
1448
|
}
|
|
@@ -1472,11 +1480,12 @@ function buildAppointmentRows(params) {
|
|
|
1472
1480
|
};
|
|
1473
1481
|
var bookingId = stringify(firstPresentValue(booking.booking_id, booking.schedule_event_id, bookingUid)).trim();
|
|
1474
1482
|
var bookingTime = formatBookingRange(booking, locale);
|
|
1475
|
-
var resourceText = formatBookingResources(resolveBookingResourcesForReceipt(booking, allResources, bookingCount), locale);
|
|
1483
|
+
var resourceText = formatBookingResources(resolveBookingResourcesForReceipt(booking, allResources, bookingCount), locale, params.showResourceTitle);
|
|
1476
1484
|
var holder = getLocalizedValue((_booking$holder$name = (_booking$holder = booking.holder) === null || _booking$holder === void 0 ? void 0 : _booking$holder.name) !== null && _booking$holder$name !== void 0 ? _booking$holder$name : (_booking$metadata3 = booking.metadata) === null || _booking$metadata3 === void 0 || (_booking$metadata3 = _booking$metadata3.holder) === null || _booking$metadata3 === void 0 ? void 0 : _booking$metadata3.name, locale).trim();
|
|
1477
1485
|
return [_objectSpread(_objectSpread({}, receiptKey(booking, 'booking-id')), {}, {
|
|
1478
1486
|
item: label(locale, 'bookingId'),
|
|
1479
|
-
|
|
1487
|
+
// 异步落单时可能只有内部关联 UUID;留空后由下方过滤移除整行。
|
|
1488
|
+
value: BOOKING_ID_UUID_PATTERN.test(bookingId) ? '' : bookingId
|
|
1480
1489
|
}, association), _objectSpread(_objectSpread({}, receiptKey(booking, 'booking-time', 'shared')), {}, {
|
|
1481
1490
|
item: label(locale, 'bookingDateTime'),
|
|
1482
1491
|
value: bookingTime
|
|
@@ -1550,10 +1559,10 @@ function resolveBookingResourcesForReceipt(booking, allResources, bookingCount)
|
|
|
1550
1559
|
if (bookingCount === 1 && allResources.length) return allResources;
|
|
1551
1560
|
return [];
|
|
1552
1561
|
}
|
|
1553
|
-
function formatBookingResources(resources, locale) {
|
|
1562
|
+
function formatBookingResources(resources, locale, showResourceTitle) {
|
|
1554
1563
|
return resources.map(function (resource) {
|
|
1555
1564
|
var _resource$metadata, _resource$metadata2, _resource$metadata3, _resource$metadata4;
|
|
1556
|
-
return [getLocalizedValue(resource.form_title || ((_resource$metadata = resource.metadata) === null || _resource$metadata === void 0 ? void 0 : _resource$metadata.form_name) || resource.relation_form_name || ((_resource$metadata2 = resource.metadata) === null || _resource$metadata2 === void 0 ? void 0 : _resource$metadata2.relation_form_name), locale), getLocalizedValue(resource.title || resource.name || resource.main_field || ((_resource$metadata3 = resource.metadata) === null || _resource$metadata3 === void 0 ? void 0 : _resource$metadata3.main_field) || ((_resource$metadata4 = resource.metadata) === null || _resource$metadata4 === void 0 ? void 0 : _resource$metadata4.resource_name), locale)].filter(Boolean).join(' ');
|
|
1565
|
+
return [showResourceTitle ? getLocalizedValue(resource.form_title || ((_resource$metadata = resource.metadata) === null || _resource$metadata === void 0 ? void 0 : _resource$metadata.form_name) || resource.relation_form_name || ((_resource$metadata2 = resource.metadata) === null || _resource$metadata2 === void 0 ? void 0 : _resource$metadata2.relation_form_name), locale) : '', getLocalizedValue(resource.title || resource.name || resource.main_field || ((_resource$metadata3 = resource.metadata) === null || _resource$metadata3 === void 0 ? void 0 : _resource$metadata3.main_field) || ((_resource$metadata4 = resource.metadata) === null || _resource$metadata4 === void 0 ? void 0 : _resource$metadata4.resource_name), locale)].filter(Boolean).join(' ');
|
|
1557
1566
|
}).filter(Boolean).join(', ');
|
|
1558
1567
|
}
|
|
1559
1568
|
function sortBookings(bookings) {
|
|
@@ -2206,7 +2215,7 @@ function buildVirtualCurrencySnapshotAssets(params) {
|
|
|
2206
2215
|
codes: []
|
|
2207
2216
|
})) return [];
|
|
2208
2217
|
var rows = [_objectSpread(_objectSpread({}, receiptKey(virtualCurrency, 'asset-name')), {}, {
|
|
2209
|
-
item: stringify(virtualCurrency.product_name).trim(),
|
|
2218
|
+
item: appendMaskedCardCode(stringify(virtualCurrency.product_name).trim(), virtualCurrency.code),
|
|
2210
2219
|
value: ''
|
|
2211
2220
|
})];
|
|
2212
2221
|
var balance = getVirtualCurrencySnapshotBalance(virtualCurrency);
|
|
@@ -2661,12 +2670,33 @@ function appendMaskedCardCode(name, code) {
|
|
|
2661
2670
|
function trimDecimal(value) {
|
|
2662
2671
|
return value.toDecimalPlaces(2).toFixed(2).replace(/\.?0+$/, '');
|
|
2663
2672
|
}
|
|
2673
|
+
function getLocalizedPaymentName(value, locale) {
|
|
2674
|
+
if (typeof value === 'string') return value.trim();
|
|
2675
|
+
if (!value || _typeof(value) !== 'object' || Array.isArray(value)) return '';
|
|
2676
|
+
var candidates = [value[locale], value[locale.replace('_', '-')], value[locale.replace('-', '_')], value.original, value.auto, value.default, value.en];
|
|
2677
|
+
for (var _i24 = 0, _candidates2 = candidates; _i24 < _candidates2.length; _i24++) {
|
|
2678
|
+
var candidate = _candidates2[_i24];
|
|
2679
|
+
if (typeof candidate === 'string' && candidate.trim()) return candidate.trim();
|
|
2680
|
+
}
|
|
2681
|
+
return '';
|
|
2682
|
+
}
|
|
2683
|
+
function getExplicitPaymentName(payment, locale) {
|
|
2684
|
+
var _payment$metadata4;
|
|
2685
|
+
// Cloud order snapshots retain the localized name in metadata after reload.
|
|
2686
|
+
var candidates = [payment.name, payment.title, payment.payment_method_name, payment.method_name, (_payment$metadata4 = payment.metadata) === null || _payment$metadata4 === void 0 ? void 0 : _payment$metadata4.custom_payment_name];
|
|
2687
|
+
for (var _i25 = 0, _candidates3 = candidates; _i25 < _candidates3.length; _i25++) {
|
|
2688
|
+
var candidate = _candidates3[_i25];
|
|
2689
|
+
var name = getLocalizedPaymentName(candidate, locale);
|
|
2690
|
+
if (name) return name;
|
|
2691
|
+
}
|
|
2692
|
+
return '';
|
|
2693
|
+
}
|
|
2664
2694
|
function getFundRecordPaymentName(payment, locale) {
|
|
2665
2695
|
var fundRecord = getFundRecord(payment);
|
|
2666
2696
|
if (!fundRecord) return '';
|
|
2667
|
-
var name =
|
|
2697
|
+
var name = getLocalizedPaymentName(fundRecord.wallet_pass_name, locale);
|
|
2668
2698
|
if (!name && !maskMachineCode(fundRecord.code)) return '';
|
|
2669
|
-
var fallbackName =
|
|
2699
|
+
var fallbackName = getExplicitPaymentName(payment, locale) || getLocalizedPaymentName(payment.code, locale);
|
|
2670
2700
|
return appendMaskedCardCode(name || fallbackName, fundRecord.code);
|
|
2671
2701
|
}
|
|
2672
2702
|
function appendMachineCodeToName(name, payment) {
|
|
@@ -2676,13 +2706,15 @@ function appendMachineCodeToName(name, payment) {
|
|
|
2676
2706
|
function paymentMethodName(payment, locale) {
|
|
2677
2707
|
var fundRecordName = getFundRecordPaymentName(payment, locale);
|
|
2678
2708
|
if (fundRecordName) return fundRecordName;
|
|
2679
|
-
var
|
|
2680
|
-
if (
|
|
2709
|
+
var name = getExplicitPaymentName(payment, locale);
|
|
2710
|
+
if (name) return appendMachineCodeToName(name, payment);
|
|
2681
2711
|
var code = stringify(payment.code || payment.type || payment.payment_method || payment.method).toLowerCase();
|
|
2682
2712
|
if (code.includes('cash')) return label(locale, 'cash');
|
|
2683
|
-
if (code.includes('eftpos')
|
|
2713
|
+
if (code.includes('eftpos')) return label(locale, 'eftpos');
|
|
2684
2714
|
if (code.includes('wallet')) return label(locale, 'wallet');
|
|
2685
2715
|
if (code.includes('gift')) return label(locale, 'giftCard');
|
|
2716
|
+
if (code === 'credit_card' || code.startsWith('credit_card_')) return label(locale, 'creditCard');
|
|
2717
|
+
if (code.includes('card')) return label(locale, 'eftpos');
|
|
2686
2718
|
return stringify(payment.code || payment.type || payment.payment_method || payment.method);
|
|
2687
2719
|
}
|
|
2688
2720
|
function getSummary(order) {
|
|
@@ -36,6 +36,9 @@ export function resolveInvoiceDataVisibility(settings) {
|
|
|
36
36
|
return typeof tag === 'string' && tag.length > 0;
|
|
37
37
|
})) : null;
|
|
38
38
|
return {
|
|
39
|
+
lineGroups: {
|
|
40
|
+
resourceTitle: field(module('line_groups'), 'resource_title')
|
|
41
|
+
},
|
|
39
42
|
handover: {
|
|
40
43
|
show: invoiceSettingIsVisible(handover === null || handover === void 0 ? void 0 : handover.is_show),
|
|
41
44
|
method: field(handover, 'method'),
|
|
@@ -59,6 +62,7 @@ export function requiresInvoiceDataFiltering(settings) {
|
|
|
59
62
|
var _resolveInvoiceDataVi = resolveInvoiceDataVisibility(settings),
|
|
60
63
|
handover = _resolveInvoiceDataVi.handover,
|
|
61
64
|
customer = _resolveInvoiceDataVi.customer,
|
|
62
|
-
card = _resolveInvoiceDataVi.card
|
|
63
|
-
|
|
65
|
+
card = _resolveInvoiceDataVi.card,
|
|
66
|
+
lineGroups = _resolveInvoiceDataVi.lineGroups;
|
|
67
|
+
return !lineGroups.resourceTitle || !handover.show || !handover.method || !handover.fulfillmentTime || !customer.show || !customer.name || !customer.email || !customer.phone || !card.show || card.passTypes !== null;
|
|
64
68
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { OrderModule } from '../../modules/Order';
|
|
2
|
+
import type { ShopServiceType } from '../../modules/Order/types';
|
|
3
|
+
import type { ProductList } from '../../modules/ProductList';
|
|
4
|
+
import type { OpenDataConfig } from '../../modules/OpenData/types';
|
|
5
|
+
interface FulfillmentItemRulesHost {
|
|
6
|
+
getOrder: () => OrderModule;
|
|
7
|
+
getProducts: () => ProductList | undefined;
|
|
8
|
+
loadOpenData: () => Promise<OpenDataConfig | null>;
|
|
9
|
+
getScope: () => string;
|
|
10
|
+
getOtherParams: () => Record<string, any>;
|
|
11
|
+
fetchStrategyModels: (ids: number[]) => Promise<any>;
|
|
12
|
+
reportError: (error: unknown) => void;
|
|
13
|
+
}
|
|
14
|
+
/** Executes item rules at the sales boundary, independent of the calling template. */
|
|
15
|
+
export declare class FulfillmentItemRulesController {
|
|
16
|
+
private readonly host;
|
|
17
|
+
private sequence;
|
|
18
|
+
private pending;
|
|
19
|
+
private evaluator;
|
|
20
|
+
constructor(host: FulfillmentItemRulesHost);
|
|
21
|
+
invalidate(): void;
|
|
22
|
+
apply(serviceType: ShopServiceType): Promise<void>;
|
|
23
|
+
private loadProducts;
|
|
24
|
+
private getMainProductNumber;
|
|
25
|
+
private loadPrefillSources;
|
|
26
|
+
}
|
|
27
|
+
export {};
|