@pisell/pisellos 2.2.309 → 2.2.311
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/promotion/index.js +0 -9
- package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +2 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.js +4 -2
- package/dist/modules/BookingContext/index.js +4 -4
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +58 -19
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +24 -12
- package/dist/modules/Customer/index.js +6 -3
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Discount/availability.d.ts +7 -0
- package/dist/modules/Discount/availability.js +49 -0
- package/dist/modules/Discount/entitlementPass.d.ts +34 -0
- package/dist/modules/Discount/entitlementPass.js +147 -0
- package/dist/modules/Discount/index.d.ts +2 -2
- package/dist/modules/Discount/index.js +37 -151
- package/dist/modules/Discount/types.d.ts +36 -5
- package/dist/modules/OpenData/index.d.ts +1 -1
- package/dist/modules/OpenData/index.js +21 -12
- package/dist/modules/Order/index.d.ts +32 -4
- package/dist/modules/Order/index.js +733 -373
- package/dist/modules/Order/types.d.ts +17 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.js +16 -12
- package/dist/modules/Order/utils.d.ts +19 -5
- package/dist/modules/Order/utils.js +306 -86
- package/dist/modules/Payment/index.d.ts +0 -5
- package/dist/modules/Payment/index.js +35 -85
- package/dist/modules/Payment/types.d.ts +21 -1
- package/dist/modules/Payment/types.js +2 -0
- package/dist/modules/Payment/walletpass.d.ts +1 -1
- package/dist/modules/Payment/walletpass.js +80 -47
- package/dist/modules/ProductList/index.js +18 -5
- package/dist/modules/Rules/index.d.ts +2 -2
- package/dist/modules/Rules/index.js +480 -186
- package/dist/modules/Rules/types.d.ts +4 -0
- package/dist/server/index.js +8 -5
- package/dist/server/modules/floor-plan/index.js +34 -3
- package/dist/server/modules/order/index.js +6 -0
- package/dist/server/modules/order/types.d.ts +12 -0
- package/dist/server/modules/payment/index.d.ts +25 -6
- package/dist/server/modules/payment/index.js +660 -133
- package/dist/server/utils/small-ticket.d.ts +8 -5
- package/dist/server/utils/small-ticket.js +1269 -199
- package/dist/solution/BaseSales/index.d.ts +11 -2
- package/dist/solution/BaseSales/index.js +1463 -1173
- package/dist/solution/BaseSales/types.d.ts +7 -3
- package/dist/solution/BaseSales/utils/cartPromotion.js +141 -126
- package/dist/solution/BookingTicket/index.d.ts +11 -2
- package/dist/solution/BookingTicket/index.js +663 -542
- package/dist/solution/BookingTicket/types.d.ts +5 -1
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +2 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +338 -147
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +8 -4
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +6 -0
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +19 -6
- package/dist/solution/ShopDiscount/index.d.ts +2 -0
- package/dist/solution/ShopDiscount/index.js +99 -42
- package/dist/solution/ShopDiscount/utils.d.ts +4 -2
- package/dist/solution/ShopDiscount/utils.js +43 -23
- package/dist/solution/UnifiedBookingSales/index.d.ts +2 -2
- package/dist/solution/UnifiedBookingSales/index.js +5 -5
- package/dist/utils/os-private-payload.d.ts +5 -0
- package/dist/utils/os-private-payload.js +17 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +2 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.js +2 -0
- package/lib/modules/BookingContext/index.js +3 -3
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +35 -6
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +13 -6
- package/lib/modules/Customer/index.js +5 -1
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Discount/availability.d.ts +7 -0
- package/lib/modules/Discount/availability.js +43 -0
- package/lib/modules/Discount/entitlementPass.d.ts +34 -0
- package/lib/modules/Discount/entitlementPass.js +141 -0
- package/lib/modules/Discount/index.d.ts +2 -2
- package/lib/modules/Discount/index.js +23 -129
- package/lib/modules/Discount/types.d.ts +36 -5
- package/lib/modules/OpenData/index.d.ts +1 -1
- package/lib/modules/OpenData/index.js +11 -2
- package/lib/modules/Order/index.d.ts +32 -4
- package/lib/modules/Order/index.js +341 -71
- package/lib/modules/Order/types.d.ts +17 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.js +14 -11
- package/lib/modules/Order/utils.d.ts +19 -5
- package/lib/modules/Order/utils.js +215 -13
- package/lib/modules/Payment/index.d.ts +0 -5
- package/lib/modules/Payment/index.js +3 -28
- package/lib/modules/Payment/types.d.ts +21 -1
- package/lib/modules/Payment/types.js +1 -0
- package/lib/modules/Payment/walletpass.d.ts +1 -1
- package/lib/modules/Payment/walletpass.js +29 -9
- package/lib/modules/ProductList/index.js +14 -1
- package/lib/modules/Rules/index.d.ts +2 -2
- package/lib/modules/Rules/index.js +357 -110
- package/lib/modules/Rules/types.d.ts +4 -0
- package/lib/server/index.js +8 -5
- package/lib/server/modules/floor-plan/index.js +29 -1
- package/lib/server/modules/order/index.js +6 -0
- package/lib/server/modules/order/types.d.ts +12 -0
- package/lib/server/modules/payment/index.d.ts +25 -6
- package/lib/server/modules/payment/index.js +350 -78
- package/lib/server/utils/small-ticket.d.ts +8 -5
- package/lib/server/utils/small-ticket.js +1009 -121
- package/lib/solution/BaseSales/index.d.ts +11 -2
- package/lib/solution/BaseSales/index.js +164 -30
- package/lib/solution/BaseSales/types.d.ts +7 -3
- package/lib/solution/BaseSales/utils/cartPromotion.js +12 -4
- package/lib/solution/BookingTicket/index.d.ts +11 -2
- package/lib/solution/BookingTicket/index.js +103 -41
- package/lib/solution/BookingTicket/types.d.ts +5 -1
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +2 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +174 -42
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +8 -4
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +6 -0
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +11 -3
- package/lib/solution/ShopDiscount/index.d.ts +2 -0
- package/lib/solution/ShopDiscount/index.js +55 -9
- package/lib/solution/ShopDiscount/utils.d.ts +4 -2
- package/lib/solution/ShopDiscount/utils.js +42 -25
- package/lib/solution/UnifiedBookingSales/index.d.ts +2 -2
- package/lib/solution/UnifiedBookingSales/index.js +5 -5
- package/lib/utils/os-private-payload.d.ts +5 -0
- package/lib/utils/os-private-payload.js +22 -0
- package/package.json +1 -1
|
@@ -5,20 +5,25 @@ var _excluded = ["custom_product_bundle_map_id"],
|
|
|
5
5
|
_excluded5 = ["collect_pax", "table_occupancy_duration", "cart_settlement_key", "cart_settlement_snapshot", "legal_currency_snapshot"];
|
|
6
6
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
7
7
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
8
|
-
function
|
|
9
|
-
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."); }
|
|
10
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
11
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
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; } } }; }
|
|
12
9
|
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; }
|
|
13
10
|
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; }
|
|
14
11
|
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
12
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
16
13
|
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
|
-
function
|
|
14
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
15
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
16
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
17
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
18
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
19
|
+
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."); }
|
|
18
20
|
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); }
|
|
21
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
22
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
19
23
|
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; }
|
|
20
24
|
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
25
|
import dayjs from "dayjs";
|
|
26
|
+
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
22
27
|
import Decimal from 'decimal.js';
|
|
23
28
|
import { withOriginalBundleOptionPrices } from "./utils/weighedProduct";
|
|
24
29
|
import { hasManualProductDiscountFlag } from "./utils/manualProductDiscount";
|
|
@@ -26,7 +31,9 @@ import { getProductHolderConfig } from "../Holder/utils";
|
|
|
26
31
|
import { buildProductLineFingerprint, createEmptySummary } from "../../solution/ScanOrder/utils";
|
|
27
32
|
import { createUuidV4 } from "./utils/orderCollectionIdentity";
|
|
28
33
|
import { encodeSalesNotes } from "./salesNotes";
|
|
34
|
+
dayjs.extend(customParseFormat);
|
|
29
35
|
var POINT_CARD_SNAPSHOT_TAG = 'point_card';
|
|
36
|
+
var VIRTUAL_CURRENCY_SNAPSHOT_TAG = 'virtual_currency';
|
|
30
37
|
function isPlainObject(value) {
|
|
31
38
|
return Boolean(value) && _typeof(value) === 'object' && !Array.isArray(value);
|
|
32
39
|
}
|
|
@@ -55,6 +62,10 @@ export function normalizePointCardSnapshotItem(value) {
|
|
|
55
62
|
if (productId !== undefined) {
|
|
56
63
|
snapshot.product_id = productId;
|
|
57
64
|
}
|
|
65
|
+
var code = normalizeSnapshotScalar(value.code);
|
|
66
|
+
if (code !== undefined) {
|
|
67
|
+
snapshot.code = String(code).trim();
|
|
68
|
+
}
|
|
58
69
|
return snapshot;
|
|
59
70
|
}
|
|
60
71
|
export function buildPointCardSnapshotFromWalletPassList(value) {
|
|
@@ -65,6 +76,152 @@ export function buildPointCardSnapshotFromWalletPassList(value) {
|
|
|
65
76
|
return result;
|
|
66
77
|
}, []);
|
|
67
78
|
}
|
|
79
|
+
export function collectPointCardSnapshotCodeCandidates(value) {
|
|
80
|
+
if (!Array.isArray(value)) return [];
|
|
81
|
+
var codeById = new Map();
|
|
82
|
+
value.forEach(function (item) {
|
|
83
|
+
var _item$id;
|
|
84
|
+
if (!isPlainObject(item)) return;
|
|
85
|
+
var id = normalizeSnapshotScalar((_item$id = item.id) !== null && _item$id !== void 0 ? _item$id : item.voucher_id);
|
|
86
|
+
var code = normalizeSnapshotScalar(item.code);
|
|
87
|
+
if (id === undefined || code === undefined) return;
|
|
88
|
+
var identity = String(id).trim();
|
|
89
|
+
var normalizedCode = String(code).trim();
|
|
90
|
+
if (!identity || !normalizedCode || codeById.has(identity)) return;
|
|
91
|
+
codeById.set(identity, normalizedCode);
|
|
92
|
+
});
|
|
93
|
+
return _toConsumableArray(codeById).map(function (_ref) {
|
|
94
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
95
|
+
id = _ref2[0],
|
|
96
|
+
code = _ref2[1];
|
|
97
|
+
return {
|
|
98
|
+
id: id,
|
|
99
|
+
code: code
|
|
100
|
+
};
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Payment 的 WalletPass 列表包含实例 code,而 prepare/config 通常只提供
|
|
106
|
+
* 卡名称和余额。按实例 ID 仅补齐 Snapshot 缺失的 code,避免后到的运行态
|
|
107
|
+
* 数据覆盖下单时已经冻结的卡名称和余额。
|
|
108
|
+
*/
|
|
109
|
+
export function mergePointCardSnapshotCodes(snapshotsValue, walletPassesValue) {
|
|
110
|
+
var snapshots = buildPointCardSnapshotFromWalletPassList(snapshotsValue);
|
|
111
|
+
if (!snapshots.length || !Array.isArray(walletPassesValue)) return snapshots;
|
|
112
|
+
var codeById = new Map(collectPointCardSnapshotCodeCandidates(walletPassesValue).map(function (_ref3) {
|
|
113
|
+
var id = _ref3.id,
|
|
114
|
+
code = _ref3.code;
|
|
115
|
+
return [id, code];
|
|
116
|
+
}));
|
|
117
|
+
return snapshots.map(function (snapshot) {
|
|
118
|
+
if (snapshot.code) return snapshot;
|
|
119
|
+
var code = codeById.get(String(snapshot.id).trim());
|
|
120
|
+
return code ? _objectSpread(_objectSpread({}, snapshot), {}, {
|
|
121
|
+
code: code
|
|
122
|
+
}) : snapshot;
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
function normalizeSnapshotNameMap(value) {
|
|
126
|
+
if (typeof value === 'string' || typeof value === 'number') {
|
|
127
|
+
var normalizedText = String(value).trim();
|
|
128
|
+
return normalizedText ? {
|
|
129
|
+
original: normalizedText
|
|
130
|
+
} : {};
|
|
131
|
+
}
|
|
132
|
+
if (!isPlainObject(value)) return {};
|
|
133
|
+
return Object.entries(value).reduce(function (result, _ref4) {
|
|
134
|
+
var _ref5 = _slicedToArray(_ref4, 2),
|
|
135
|
+
locale = _ref5[0],
|
|
136
|
+
text = _ref5[1];
|
|
137
|
+
if (!locale.trim()) return result;
|
|
138
|
+
if (typeof text !== 'string' && typeof text !== 'number') return result;
|
|
139
|
+
var normalizedText = String(text).trim();
|
|
140
|
+
if (normalizedText) result[locale] = normalizedText;
|
|
141
|
+
return result;
|
|
142
|
+
}, {});
|
|
143
|
+
}
|
|
144
|
+
function buildVirtualCurrencySnapshotName(value) {
|
|
145
|
+
var _value$amount_format;
|
|
146
|
+
if (!isPlainObject(value)) return {};
|
|
147
|
+
var amountFormat = String((_value$amount_format = value.amount_format) !== null && _value$amount_format !== void 0 ? _value$amount_format : '').trim();
|
|
148
|
+
var configuredName;
|
|
149
|
+
if (amountFormat === '{{amount}} {{unit}}') {
|
|
150
|
+
configuredName = value.unit_label;
|
|
151
|
+
} else if (amountFormat === '{{amount}} {{sym}}') {
|
|
152
|
+
configuredName = value.symbol;
|
|
153
|
+
} else {
|
|
154
|
+
return {};
|
|
155
|
+
}
|
|
156
|
+
var configuredNameMap = normalizeSnapshotNameMap(configuredName);
|
|
157
|
+
var shortNameMap = normalizeSnapshotNameMap(value.short_name);
|
|
158
|
+
|
|
159
|
+
// The configured unit/symbol is resolved before short_name. If it already
|
|
160
|
+
// carries a global fallback, keep it authoritative so (for example)
|
|
161
|
+
// short_name.en cannot mask unit_label.original. When it only has explicit
|
|
162
|
+
// locale entries, merge short_name so other receipt locales can still fall
|
|
163
|
+
// back after the configured value has no match.
|
|
164
|
+
var hasConfiguredGlobalFallback = ['original', 'auto', 'default', 'en'].some(function (locale) {
|
|
165
|
+
return Boolean(configuredNameMap[locale]);
|
|
166
|
+
});
|
|
167
|
+
if (hasConfiguredGlobalFallback) return configuredNameMap;
|
|
168
|
+
return _objectSpread(_objectSpread({}, shortNameMap), configuredNameMap);
|
|
169
|
+
}
|
|
170
|
+
export function normalizeVirtualCurrencySnapshotItem(value) {
|
|
171
|
+
var _value$product_name2, _value$par_value2, _value$used_par_value2;
|
|
172
|
+
if (!isPlainObject(value)) return null;
|
|
173
|
+
var id = normalizeSnapshotScalar(value.id);
|
|
174
|
+
if (id === undefined) return null;
|
|
175
|
+
if (String(value.tag || '').trim().toLowerCase() !== VIRTUAL_CURRENCY_SNAPSHOT_TAG) {
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
var snapshot = {
|
|
179
|
+
id: id,
|
|
180
|
+
tag: 'virtual_currency',
|
|
181
|
+
product_name: String((_value$product_name2 = value.product_name) !== null && _value$product_name2 !== void 0 ? _value$product_name2 : ''),
|
|
182
|
+
par_value: String((_value$par_value2 = value.par_value) !== null && _value$par_value2 !== void 0 ? _value$par_value2 : ''),
|
|
183
|
+
used_par_value: String((_value$used_par_value2 = value.used_par_value) !== null && _value$used_par_value2 !== void 0 ? _value$used_par_value2 : ''),
|
|
184
|
+
name: normalizeSnapshotNameMap(value.name)
|
|
185
|
+
};
|
|
186
|
+
var productId = normalizeSnapshotScalar(value.product_id);
|
|
187
|
+
if (productId !== undefined) {
|
|
188
|
+
snapshot.product_id = productId;
|
|
189
|
+
}
|
|
190
|
+
return snapshot;
|
|
191
|
+
}
|
|
192
|
+
function normalizeVirtualCurrencySnapshotList(value) {
|
|
193
|
+
if (!Array.isArray(value)) return [];
|
|
194
|
+
return value.reduce(function (result, item) {
|
|
195
|
+
var normalized = normalizeVirtualCurrencySnapshotItem(item);
|
|
196
|
+
if (normalized) result.push(normalized);
|
|
197
|
+
return result;
|
|
198
|
+
}, []);
|
|
199
|
+
}
|
|
200
|
+
export function buildVirtualCurrencySnapshotFromList(value) {
|
|
201
|
+
if (!Array.isArray(value)) return [];
|
|
202
|
+
return value.reduce(function (result, item) {
|
|
203
|
+
var _item$tag, _item$product_name, _item$par_value, _item$used_par_value;
|
|
204
|
+
if (!isPlainObject(item)) return result;
|
|
205
|
+
var id = normalizeSnapshotScalar(item.id);
|
|
206
|
+
if (id === undefined) return result;
|
|
207
|
+
var sourceTag = String((_item$tag = item.tag) !== null && _item$tag !== void 0 ? _item$tag : '').trim().toLowerCase();
|
|
208
|
+
if (sourceTag !== VIRTUAL_CURRENCY_SNAPSHOT_TAG) return result;
|
|
209
|
+
var snapshot = {
|
|
210
|
+
id: id,
|
|
211
|
+
tag: 'virtual_currency',
|
|
212
|
+
product_name: String((_item$product_name = item.product_name) !== null && _item$product_name !== void 0 ? _item$product_name : ''),
|
|
213
|
+
par_value: String((_item$par_value = item.par_value) !== null && _item$par_value !== void 0 ? _item$par_value : ''),
|
|
214
|
+
used_par_value: String((_item$used_par_value = item.used_par_value) !== null && _item$used_par_value !== void 0 ? _item$used_par_value : ''),
|
|
215
|
+
name: buildVirtualCurrencySnapshotName(item.virtual_currency_display)
|
|
216
|
+
};
|
|
217
|
+
var productId = normalizeSnapshotScalar(item.product_id);
|
|
218
|
+
if (productId !== undefined) {
|
|
219
|
+
snapshot.product_id = productId;
|
|
220
|
+
}
|
|
221
|
+
result.push(snapshot);
|
|
222
|
+
return result;
|
|
223
|
+
}, []);
|
|
224
|
+
}
|
|
68
225
|
export function normalizeOrderMetaList(value) {
|
|
69
226
|
if (value === undefined) return undefined;
|
|
70
227
|
if (!isPlainObject(value)) return undefined;
|
|
@@ -72,6 +229,9 @@ export function normalizeOrderMetaList(value) {
|
|
|
72
229
|
if (Object.prototype.hasOwnProperty.call(value, 'point_cards_snapshot')) {
|
|
73
230
|
normalized.point_cards_snapshot = buildPointCardSnapshotFromWalletPassList(value.point_cards_snapshot);
|
|
74
231
|
}
|
|
232
|
+
if (Object.prototype.hasOwnProperty.call(value, 'virtual_currency_snapshot')) {
|
|
233
|
+
normalized.virtual_currency_snapshot = normalizeVirtualCurrencySnapshotList(value.virtual_currency_snapshot);
|
|
234
|
+
}
|
|
75
235
|
if (Object.keys(normalized).length > 0) return normalized;
|
|
76
236
|
return {};
|
|
77
237
|
}
|
|
@@ -99,13 +259,13 @@ export function composeLinePrice(params) {
|
|
|
99
259
|
_step;
|
|
100
260
|
try {
|
|
101
261
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
102
|
-
var
|
|
262
|
+
var _ref6, _item$num;
|
|
103
263
|
var item = _step.value;
|
|
104
264
|
// markdown(减价)按带符号净额取减;markup/原价维持相加。
|
|
105
265
|
var signedUnit = getBundleSignedUnit(item, {
|
|
106
266
|
useOriginal: useOriginalBundle
|
|
107
267
|
});
|
|
108
|
-
var rawNum = (
|
|
268
|
+
var rawNum = (_ref6 = (_item$num = item === null || item === void 0 ? void 0 : item.num) !== null && _item$num !== void 0 ? _item$num : item === null || item === void 0 ? void 0 : item.quantity) !== null && _ref6 !== void 0 ? _ref6 : 1;
|
|
109
269
|
var num = new Decimal(Number(rawNum) || 0);
|
|
110
270
|
total = total.plus(signedUnit.times(num));
|
|
111
271
|
}
|
|
@@ -169,12 +329,12 @@ function getSafeOrderProductNum(num) {
|
|
|
169
329
|
return Math.floor(parsedNum);
|
|
170
330
|
}
|
|
171
331
|
function getOrderProductDepositUnitTotal(product) {
|
|
172
|
-
var
|
|
332
|
+
var _ref7;
|
|
173
333
|
var metadata = product.metadata || {};
|
|
174
334
|
var paymentPrice = metadata.main_product_attached_bundle_payment_price;
|
|
175
335
|
var mainSellingPrice = metadata.main_product_selling_price;
|
|
176
336
|
var fallbackPrice = product.selling_price;
|
|
177
|
-
return new Decimal(Number((
|
|
337
|
+
return new Decimal(Number((_ref7 = paymentPrice !== null && paymentPrice !== void 0 ? paymentPrice : mainSellingPrice) !== null && _ref7 !== void 0 ? _ref7 : fallbackPrice) || 0);
|
|
178
338
|
}
|
|
179
339
|
function normalizeDepositProtocols(protocols) {
|
|
180
340
|
if (!Array.isArray(protocols)) return [];
|
|
@@ -223,13 +383,13 @@ function handleOrderProductDeposit(params) {
|
|
|
223
383
|
};
|
|
224
384
|
}
|
|
225
385
|
function resolveOrderProductDepositSource(product, runtimeOrigin) {
|
|
226
|
-
var
|
|
386
|
+
var _ref8, _record$custom_deposi, _ref9, _record$variant;
|
|
227
387
|
var record = product;
|
|
228
388
|
var origin = record._origin || runtimeOrigin || {};
|
|
229
389
|
var originProduct = origin.product || {};
|
|
230
390
|
return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, originProduct), origin), record), {}, {
|
|
231
|
-
custom_deposit_data: (
|
|
232
|
-
variant: (
|
|
391
|
+
custom_deposit_data: (_ref8 = (_record$custom_deposi = record.custom_deposit_data) !== null && _record$custom_deposi !== void 0 ? _record$custom_deposi : origin.custom_deposit_data) !== null && _ref8 !== void 0 ? _ref8 : originProduct.custom_deposit_data,
|
|
392
|
+
variant: (_ref9 = (_record$variant = record.variant) !== null && _record$variant !== void 0 ? _record$variant : origin.variant) !== null && _ref9 !== void 0 ? _ref9 : originProduct.variant
|
|
233
393
|
});
|
|
234
394
|
}
|
|
235
395
|
function getOrderProductDeposit(product, runtimeOrigin) {
|
|
@@ -381,12 +541,12 @@ export function isMarkdownBundle(bundle) {
|
|
|
381
541
|
* - markup(加价)/原价子商品:维持 `+(bundle_selling_price ?? price)`,行为不变。
|
|
382
542
|
*/
|
|
383
543
|
export function getBundleSignedUnit(bundle, options) {
|
|
384
|
-
var _options$useOriginal,
|
|
544
|
+
var _options$useOriginal, _ref16, _bundle$original_pric2, _bundle$bundle_sellin;
|
|
385
545
|
if (!bundle || _typeof(bundle) !== 'object') return new Decimal(0);
|
|
386
546
|
var useOriginal = (_options$useOriginal = options === null || options === void 0 ? void 0 : options.useOriginal) !== null && _options$useOriginal !== void 0 ? _options$useOriginal : false;
|
|
387
547
|
if (isMarkdownBundle(bundle)) {
|
|
388
|
-
var
|
|
389
|
-
var catalog = useOriginal ? (
|
|
548
|
+
var _ref10, _ref11, _ref12, _bundle$original_pric, _ref13, _ref14, _ref15, _bundle$custom_price;
|
|
549
|
+
var catalog = useOriginal ? (_ref10 = (_ref11 = (_ref12 = (_bundle$original_pric = bundle.original_price) !== null && _bundle$original_pric !== void 0 ? _bundle$original_pric : bundle.product_price) !== null && _ref12 !== void 0 ? _ref12 : bundle.custom_price) !== null && _ref11 !== void 0 ? _ref11 : bundle.base_price) !== null && _ref10 !== void 0 ? _ref10 : bundle.price : (_ref13 = (_ref14 = (_ref15 = (_bundle$custom_price = bundle.custom_price) !== null && _bundle$custom_price !== void 0 ? _bundle$custom_price : bundle.product_price) !== null && _ref15 !== void 0 ? _ref15 : bundle.original_price) !== null && _ref14 !== void 0 ? _ref14 : bundle.base_price) !== null && _ref13 !== void 0 ? _ref13 : bundle.price;
|
|
390
550
|
if (catalog !== undefined && catalog !== null && catalog !== '') {
|
|
391
551
|
var raw = new Decimal(Number(catalog) || 0);
|
|
392
552
|
// 负值表示价格已是「带符号净额」(如 cart/changePrice 产出的 -3.7),直接取用不再扣 option,
|
|
@@ -397,7 +557,7 @@ export function getBundleSignedUnit(bundle, options) {
|
|
|
397
557
|
// 仅剩净额(无毛价)兜底:直接取负,不再扣 option
|
|
398
558
|
return new Decimal(Number(bundle.bundle_selling_price) || 0).abs().negated();
|
|
399
559
|
}
|
|
400
|
-
var rawPrice = useOriginal ? (
|
|
560
|
+
var rawPrice = useOriginal ? (_ref16 = (_bundle$original_pric2 = bundle.original_price) !== null && _bundle$original_pric2 !== void 0 ? _bundle$original_pric2 : bundle.product_price) !== null && _ref16 !== void 0 ? _ref16 : bundle.price : (_bundle$bundle_sellin = bundle.bundle_selling_price) !== null && _bundle$bundle_sellin !== void 0 ? _bundle$bundle_sellin : bundle.price;
|
|
401
561
|
return new Decimal(Number(rawPrice) || 0);
|
|
402
562
|
}
|
|
403
563
|
|
|
@@ -419,8 +579,9 @@ export function getBundleSellingMagnitude(bundle) {
|
|
|
419
579
|
* = `metadata.main_product_original_price` + Σ(bundle 原价 × num)。
|
|
420
580
|
* - `metadata.source_product_price`:主商品/variant 基础价(已应用报价单),不含 option、
|
|
421
581
|
* 不含折扣。**权威源**。
|
|
422
|
-
* - `
|
|
423
|
-
* - `metadata.
|
|
582
|
+
* - `product_sku.option[].add_price` 保留单规格折前单价;Rules 的 option.price 只用于本次计算。
|
|
583
|
+
* - `metadata.main_product_original_price` = source + Σ(option.add_price × option.num)(含 option、不含折扣)。
|
|
584
|
+
* - `metadata.main_product_selling_price` = main_original − 行内 per-unit amount(含主商品及 option 优惠)。
|
|
424
585
|
* - `payment_price`:出站 payload 中为行 composite 已减整单折扣均摊价(无折扣时与 `selling_price` 同义)。
|
|
425
586
|
*
|
|
426
587
|
* Rules 钩子契约(hook_adapt 方案,Rules 内部保持不变):
|
|
@@ -429,8 +590,9 @@ export function getBundleSellingMagnitude(bundle) {
|
|
|
429
590
|
* `getProductOriginTotalPrice` 会自行叠加 option + bundle,喂 source 可避免 option 双加。
|
|
430
591
|
* - `getProduct.total` = `selling_price × num`(行 composite × num),与 Rules 内部产出的
|
|
431
592
|
* total(source + option + bundle)对齐。
|
|
593
|
+
* - `getProduct.options` 用单规格原价参与重算;主商品折后价从 main_selling 减去 option 折后合计反推。
|
|
432
594
|
* - `setProduct` 反向流程:把 Rules 返回的 source-level `main_product_selling_price` / `price`
|
|
433
|
-
*
|
|
595
|
+
* 加回单规格原价合计,再减去 optionDiscountAmount;保留订单单规格原价供取消折扣及后续重算。
|
|
434
596
|
* 优先级:
|
|
435
597
|
* 1. `values.main_product_selling_price`(券应用分支,per-unit 券后 source-level 主价)
|
|
436
598
|
* 2. `values.price`(还原分支 `restoredPrice`、good_pass 归零)
|
|
@@ -501,6 +663,22 @@ function resolveSubmitBundleMapId(bundle) {
|
|
|
501
663
|
}
|
|
502
664
|
return undefined;
|
|
503
665
|
}
|
|
666
|
+
function ensureSubmitDiscountIdentity(discount) {
|
|
667
|
+
if (!discount || _typeof(discount) !== 'object' || Array.isArray(discount)) {
|
|
668
|
+
return discount;
|
|
669
|
+
}
|
|
670
|
+
var discountRecord = discount;
|
|
671
|
+
var metadata = discountRecord.metadata && _typeof(discountRecord.metadata) === 'object' && !Array.isArray(discountRecord.metadata) ? discountRecord.metadata : {};
|
|
672
|
+
var uniqueIdentificationNumber = metadata.unique_identification_number;
|
|
673
|
+
if (uniqueIdentificationNumber !== undefined && uniqueIdentificationNumber !== null && String(uniqueIdentificationNumber).trim() !== '') {
|
|
674
|
+
return discount;
|
|
675
|
+
}
|
|
676
|
+
return _objectSpread(_objectSpread({}, discountRecord), {}, {
|
|
677
|
+
metadata: _objectSpread(_objectSpread({}, metadata), {}, {
|
|
678
|
+
unique_identification_number: createUuidV4()
|
|
679
|
+
})
|
|
680
|
+
});
|
|
681
|
+
}
|
|
504
682
|
function collectSubmitProductDiscountList(product) {
|
|
505
683
|
var submitDiscountList = Array.isArray(product === null || product === void 0 ? void 0 : product.discount_list) ? _toConsumableArray(product.discount_list) : [];
|
|
506
684
|
var _iterator5 = _createForOfIteratorHelper((product === null || product === void 0 ? void 0 : product.product_bundle) || []),
|
|
@@ -536,7 +714,7 @@ function collectSubmitProductDiscountList(product) {
|
|
|
536
714
|
} finally {
|
|
537
715
|
_iterator5.f();
|
|
538
716
|
}
|
|
539
|
-
return normalizeOrderProductDiscountList(submitDiscountList);
|
|
717
|
+
return normalizeOrderProductDiscountList(submitDiscountList.map(ensureSubmitDiscountIdentity));
|
|
540
718
|
}
|
|
541
719
|
|
|
542
720
|
/**
|
|
@@ -609,14 +787,46 @@ export function resolveEffectivePerUnitDiscount(product) {
|
|
|
609
787
|
if (!Number.isFinite(originalPrice) || !Number.isFinite(finalPrice)) return fromList;
|
|
610
788
|
return fromList + (originalPrice - finalPrice);
|
|
611
789
|
}
|
|
612
|
-
export function createDefaultOrderRulesHooks() {
|
|
790
|
+
export function createDefaultOrderRulesHooks(getBookings) {
|
|
791
|
+
var getProductStartDate = function getProductStartDate(product) {
|
|
792
|
+
var _ref17, _product$metadata$uni, _product$metadata2, _ref18, _product$booking_uid, _product$metadata3, _product$metadata4, _product$metadata5, _product$metadata6;
|
|
793
|
+
var productUid = String((_ref17 = (_product$metadata$uni = (_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2.unique_identification_number) !== null && _product$metadata$uni !== void 0 ? _product$metadata$uni : product.unique_identification_number) !== null && _ref17 !== void 0 ? _ref17 : '');
|
|
794
|
+
var bookingUid = String((_ref18 = (_product$booking_uid = product.booking_uid) !== null && _product$booking_uid !== void 0 ? _product$booking_uid : (_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3.booking_uid) !== null && _ref18 !== void 0 ? _ref18 : '');
|
|
795
|
+
// 每次读取当前 bookings,覆盖改期、订单回显以及直接调用 Rules 的选券入口。
|
|
796
|
+
var bookings = (getBookings === null || getBookings === void 0 ? void 0 : getBookings()) || [];
|
|
797
|
+
var booking = bookings.find(function (item) {
|
|
798
|
+
var _ref19, _item$product_uid, _item$metadata3;
|
|
799
|
+
return productUid && String((_ref19 = (_item$product_uid = item === null || item === void 0 ? void 0 : item.product_uid) !== null && _item$product_uid !== void 0 ? _item$product_uid : item === null || item === void 0 || (_item$metadata3 = item.metadata) === null || _item$metadata3 === void 0 ? void 0 : _item$metadata3.product_uid) !== null && _ref19 !== void 0 ? _ref19 : '') === productUid;
|
|
800
|
+
}) || bookings.find(function (item) {
|
|
801
|
+
var _ref20, _item$metadata$unique, _item$metadata4;
|
|
802
|
+
return bookingUid && String((_ref20 = (_item$metadata$unique = item === null || item === void 0 || (_item$metadata4 = item.metadata) === null || _item$metadata4 === void 0 ? void 0 : _item$metadata4.unique_identification_number) !== null && _item$metadata$unique !== void 0 ? _item$metadata$unique : item === null || item === void 0 ? void 0 : item.booking_uid) !== null && _ref20 !== void 0 ? _ref20 : '') === bookingUid;
|
|
803
|
+
});
|
|
804
|
+
if (booking) {
|
|
805
|
+
// 严格解析并保留 Invalid Date,让公共时间校验拒绝缺失/非法时间,避免回退到当前时间。
|
|
806
|
+
return dayjs("".concat(booking.start_date, " ").concat(booking.start_time), ['YYYY-MM-DD HH:mm', 'YYYY-MM-DD HH:mm:ss', 'YYYY-MM-DD H:mm', 'YYYY-MM-DD H:mm:ss'], true);
|
|
807
|
+
}
|
|
808
|
+
if (getBookings && (bookingUid || product.booking_id || (_product$metadata4 = product.metadata) !== null && _product$metadata4 !== void 0 && _product$metadata4.booking_id)) {
|
|
809
|
+
return dayjs('');
|
|
810
|
+
}
|
|
811
|
+
var legacyStartDate = ((_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.start_date) || ((_product$metadata6 = product.metadata) === null || _product$metadata6 === void 0 ? void 0 : _product$metadata6.startDate);
|
|
812
|
+
return legacyStartDate ? dayjs(legacyStartDate) : undefined;
|
|
813
|
+
};
|
|
613
814
|
var toUnitPriceString = function toUnitPriceString(totalLike, num) {
|
|
614
815
|
var effectiveNum = Number(num) > 0 ? Number(num) : 1;
|
|
615
816
|
return new Decimal(Number(totalLike) || 0).dividedBy(effectiveNum).toDecimalPlaces(2).toString();
|
|
616
817
|
};
|
|
818
|
+
|
|
819
|
+
// optionDiscountAmount 已是每件主商品内的单规格优惠合计,不再乘商品数量。
|
|
820
|
+
var getOptionDiscountAmount = function getOptionDiscountAmount(discountList) {
|
|
821
|
+
return (discountList || []).reduce(function (total, discount) {
|
|
822
|
+
var _discount$metadata, _discount$metadata2;
|
|
823
|
+
if (discount !== null && discount !== void 0 && (_discount$metadata = discount.metadata) !== null && _discount$metadata !== void 0 && _discount$metadata.custom_product_bundle_map_id) return total;
|
|
824
|
+
return total.plus(Number(discount === null || discount === void 0 || (_discount$metadata2 = discount.metadata) === null || _discount$metadata2 === void 0 ? void 0 : _discount$metadata2.optionDiscountAmount) || 0);
|
|
825
|
+
}, new Decimal(0));
|
|
826
|
+
};
|
|
617
827
|
var getBundleIdentity = function getBundleIdentity(bundle) {
|
|
618
|
-
var
|
|
619
|
-
return [(
|
|
828
|
+
var _ref21, _bundle$bundle_id, _ref22, _ref23, _bundle$bundle_produc, _ref24, _ref25, _bundle$bundle_varian, _ref26, _bundle$bundle_group_;
|
|
829
|
+
return [(_ref21 = (_bundle$bundle_id = bundle.bundle_id) !== null && _bundle$bundle_id !== void 0 ? _bundle$bundle_id : bundle.id) !== null && _ref21 !== void 0 ? _ref21 : '', (_ref22 = (_ref23 = (_bundle$bundle_produc = bundle.bundle_product_id) !== null && _bundle$bundle_produc !== void 0 ? _bundle$bundle_produc : bundle._bundle_product_id) !== null && _ref23 !== void 0 ? _ref23 : bundle.product_id) !== null && _ref22 !== void 0 ? _ref22 : '', (_ref24 = (_ref25 = (_bundle$bundle_varian = bundle.bundle_variant_id) !== null && _bundle$bundle_varian !== void 0 ? _bundle$bundle_varian : bundle.variant_id) !== null && _ref25 !== void 0 ? _ref25 : bundle.product_variant_id) !== null && _ref24 !== void 0 ? _ref24 : 0, (_ref26 = (_bundle$bundle_group_ = bundle.bundle_group_id) !== null && _bundle$bundle_group_ !== void 0 ? _bundle$bundle_group_ : bundle.group_id) !== null && _ref26 !== void 0 ? _ref26 : ''].join('|');
|
|
620
830
|
};
|
|
621
831
|
var mergeRulesBundlePrices = function mergeRulesBundlePrices(currentBundle, rulesBundle) {
|
|
622
832
|
if (!Array.isArray(rulesBundle)) return rulesBundle;
|
|
@@ -626,7 +836,7 @@ export function createDefaultOrderRulesHooks() {
|
|
|
626
836
|
currentByIdentity.set(getBundleIdentity(bundle), bundle);
|
|
627
837
|
});
|
|
628
838
|
return rulesBundle.map(function (bundle) {
|
|
629
|
-
var _bundle$price_type_ex2,
|
|
839
|
+
var _bundle$price_type_ex2, _ref27, _ref28, _current$price, _ref29, _ref30, _ref31, _current$original_pri;
|
|
630
840
|
if (!bundle || _typeof(bundle) !== 'object') return bundle;
|
|
631
841
|
var current = currentByIdentity.get(getBundleIdentity(bundle));
|
|
632
842
|
if (!current) return bundle;
|
|
@@ -635,8 +845,8 @@ export function createDefaultOrderRulesHooks() {
|
|
|
635
845
|
} : {});
|
|
636
846
|
var isProductPriceBundle = ((_bundle$price_type_ex2 = bundle.price_type_ext) !== null && _bundle$price_type_ex2 !== void 0 ? _bundle$price_type_ex2 : current.price_type_ext) === 'product_price';
|
|
637
847
|
if (!isProductPriceBundle) return bundleWithDisplayFields;
|
|
638
|
-
var sourcePrice = (
|
|
639
|
-
var originalPrice = (
|
|
848
|
+
var sourcePrice = (_ref27 = (_ref28 = (_current$price = current.price) !== null && _current$price !== void 0 ? _current$price : current.custom_price) !== null && _ref28 !== void 0 ? _ref28 : current.original_price) !== null && _ref27 !== void 0 ? _ref27 : current.bundle_selling_price;
|
|
849
|
+
var originalPrice = (_ref29 = (_ref30 = (_ref31 = (_current$original_pri = current.original_price) !== null && _current$original_pri !== void 0 ? _current$original_pri : current.product_price) !== null && _ref31 !== void 0 ? _ref31 : current.price) !== null && _ref30 !== void 0 ? _ref30 : current.custom_price) !== null && _ref29 !== void 0 ? _ref29 : sourcePrice;
|
|
640
850
|
return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, bundleWithDisplayFields), sourcePrice !== undefined ? {
|
|
641
851
|
price: sourcePrice
|
|
642
852
|
} : {}), originalPrice !== undefined ? {
|
|
@@ -648,15 +858,17 @@ export function createDefaultOrderRulesHooks() {
|
|
|
648
858
|
};
|
|
649
859
|
return {
|
|
650
860
|
getProduct: function getProduct(product) {
|
|
651
|
-
var _product$
|
|
861
|
+
var _product$metadata7, _product$metadata8, _product$metadata9, _metadataAny$_promoti;
|
|
652
862
|
// source_product_price 是权威源;兜底链:source → mainSelling − options(反推)→ 行 selling_price
|
|
653
863
|
var metadataAny = product.metadata || {};
|
|
654
|
-
var
|
|
864
|
+
var productOptions = getProductSkuOptions(product);
|
|
865
|
+
var optionSum = sumOptionUnitPrice(productOptions);
|
|
866
|
+
var optionSellingSum = optionSum.minus(getOptionDiscountAmount(product.discount_list));
|
|
655
867
|
var sourcePrice;
|
|
656
868
|
if (metadataAny.source_product_price !== undefined) {
|
|
657
869
|
sourcePrice = String(metadataAny.source_product_price);
|
|
658
870
|
} else if (metadataAny.main_product_selling_price !== undefined) {
|
|
659
|
-
sourcePrice = new Decimal(Number(metadataAny.main_product_selling_price) || 0).minus(
|
|
871
|
+
sourcePrice = new Decimal(Number(metadataAny.main_product_selling_price) || 0).minus(optionSellingSum).toDecimalPlaces(2).toString();
|
|
660
872
|
} else {
|
|
661
873
|
var _product$selling_pric;
|
|
662
874
|
sourcePrice = String((_product$selling_pric = product.selling_price) !== null && _product$selling_pric !== void 0 ? _product$selling_pric : 0);
|
|
@@ -675,7 +887,7 @@ export function createDefaultOrderRulesHooks() {
|
|
|
675
887
|
// 否则同 SKU 不同小料会在 calcDiscount 重组时互相覆盖。
|
|
676
888
|
// 不透明 identity 契约下,normalizeOrderProduct / hydrate 已保证唯一值存在;
|
|
677
889
|
// 留 fingerprint 分支仅作 Rules 单测里直接传裸 product 时的兜底。
|
|
678
|
-
_id: (_product$
|
|
890
|
+
_id: (_product$metadata7 = product.metadata) !== null && _product$metadata7 !== void 0 && _product$metadata7.unique_identification_number ? "".concat(product.product_id, "_").concat(product.product_variant_id, "_").concat(product.metadata.unique_identification_number) : "".concat(product.product_id, "_").concat(product.product_variant_id, "_").concat(buildProductLineFingerprint(getProductSkuOptions(product), product.product_bundle)),
|
|
679
891
|
// Rules 内部 getProductTotalPrice / getProductOriginTotalPrice 会各自再叠加 bundle + option,
|
|
680
892
|
// 所以这里必须喂 source-level(不含 option、不含 bundle、不含折扣)单价,避免双加 option。
|
|
681
893
|
price: sourcePrice,
|
|
@@ -687,27 +899,35 @@ export function createDefaultOrderRulesHooks() {
|
|
|
687
899
|
num: product.num || 1,
|
|
688
900
|
discount_list: product.discount_list || [],
|
|
689
901
|
bundle: product.product_bundle || [],
|
|
690
|
-
|
|
902
|
+
// 仅在 Rules 入参中映射 price,避免折后价污染订单的 add_price。
|
|
903
|
+
options: productOptions.map(function (option) {
|
|
904
|
+
return _objectSpread(_objectSpread({}, option), {}, {
|
|
905
|
+
price: option.add_price
|
|
906
|
+
});
|
|
907
|
+
}),
|
|
908
|
+
booking_id: ((_product$metadata8 = product.metadata) === null || _product$metadata8 === void 0 ? void 0 : _product$metadata8.booking_id) || null,
|
|
691
909
|
isClient: false,
|
|
692
910
|
// 勿写死 false:否则 Rules 不会走 total≠origin_total 的手动价推断,
|
|
693
911
|
// 无券时会把 bundle 价还原成 original_price(手动改价套餐会从 20 回到 30)。
|
|
694
912
|
isManualDiscount: resolveRulesManualDiscountFlag(metadataAny),
|
|
695
|
-
holder_id: (_product$
|
|
696
|
-
startDate: (
|
|
697
|
-
main_product_selling_price: metadataAny.main_product_selling_price !== undefined ? new Decimal(Number(metadataAny.main_product_selling_price) || 0).minus(
|
|
913
|
+
holder_id: (_product$metadata9 = product.metadata) === null || _product$metadata9 === void 0 ? void 0 : _product$metadata9.holder_id,
|
|
914
|
+
startDate: getProductStartDate(product),
|
|
915
|
+
main_product_selling_price: metadataAny.main_product_selling_price !== undefined ? new Decimal(Number(metadataAny.main_product_selling_price) || 0).minus(optionSellingSum).toDecimalPlaces(2).toString() : undefined,
|
|
698
916
|
inPromotion: ((_metadataAny$_promoti = metadataAny._promotion) === null || _metadataAny$_promoti === void 0 ? void 0 : _metadataAny$_promoti.inPromotion) === true,
|
|
699
917
|
_promotion: metadataAny._promotion
|
|
700
918
|
};
|
|
701
919
|
},
|
|
702
920
|
setProduct: function setProduct(product, values) {
|
|
703
|
-
var
|
|
704
|
-
var nextNum = Number((
|
|
921
|
+
var _ref32, _values$quantity, _ref33, _metadataAny$source_p, _values$discount_list, _product$product_sku, _values$quantity2;
|
|
922
|
+
var nextNum = Number((_ref32 = (_values$quantity = values.quantity) !== null && _values$quantity !== void 0 ? _values$quantity : product.num) !== null && _ref32 !== void 0 ? _ref32 : 1) || 1;
|
|
705
923
|
var metadataAny = product.metadata || {};
|
|
706
|
-
var existedSource = (
|
|
924
|
+
var existedSource = (_ref33 = (_metadataAny$source_p = metadataAny.source_product_price) !== null && _metadataAny$source_p !== void 0 ? _metadataAny$source_p : product.selling_price) !== null && _ref33 !== void 0 ? _ref33 : '0';
|
|
707
925
|
var nextOptions = getProductSkuOptions(product);
|
|
708
926
|
var optionSum = sumOptionUnitPrice(nextOptions);
|
|
927
|
+
var nextDiscountList = (_values$discount_list = values.discount_list) !== null && _values$discount_list !== void 0 ? _values$discount_list : product.discount_list;
|
|
928
|
+
var optionSellingSum = optionSum.minus(getOptionDiscountAmount(nextDiscountList));
|
|
709
929
|
|
|
710
|
-
// Rules 返回的 main_product_selling_price / price
|
|
930
|
+
// Rules 返回的 main_product_selling_price / price 为不含 option 的主商品价。
|
|
711
931
|
// 优先级:main_product_selling_price(per-unit 券后 source)> price(还原/good_pass 分支)>
|
|
712
932
|
// total/num(仅当 Rules 只给 total 时的兜底)> 保留当前 source。
|
|
713
933
|
var nextSourceSellingPrice = values.main_product_selling_price !== undefined ? String(values.main_product_selling_price) : values.price !== undefined ? String(values.price) : values.total !== undefined ? toUnitPriceString(values.total, nextNum) : String(existedSource);
|
|
@@ -716,8 +936,8 @@ export function createDefaultOrderRulesHooks() {
|
|
|
716
936
|
// 缺省时保留现有 source(券前 = 当前 source)。
|
|
717
937
|
var nextSourceOriginalPrice = values.original_price !== undefined ? String(values.original_price) : String(existedSource);
|
|
718
938
|
|
|
719
|
-
//
|
|
720
|
-
var nextMainSellingPrice = new Decimal(Number(nextSourceSellingPrice) || 0).plus(
|
|
939
|
+
// 成交价只加回 option 折后合计;原价仍使用订单中保存的 option 原价。
|
|
940
|
+
var nextMainSellingPrice = new Decimal(Number(nextSourceSellingPrice) || 0).plus(optionSellingSum).toDecimalPlaces(2).toFixed(2);
|
|
721
941
|
var nextMainOriginalPrice = new Decimal(Number(nextSourceOriginalPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
|
|
722
942
|
var nextBundle = values.bundle !== undefined ? mergeRulesBundlePrices(product.product_bundle, values.bundle) : product.product_bundle;
|
|
723
943
|
var composedSellingPrice = composeLinePrice({
|
|
@@ -737,7 +957,7 @@ export function createDefaultOrderRulesHooks() {
|
|
|
737
957
|
return _objectSpread(_objectSpread({}, product), {}, {
|
|
738
958
|
selling_price: composedSellingPrice,
|
|
739
959
|
original_price: finalOriginalPrice,
|
|
740
|
-
discount_list:
|
|
960
|
+
discount_list: nextDiscountList,
|
|
741
961
|
num: (_values$quantity2 = values.quantity) !== null && _values$quantity2 !== void 0 ? _values$quantity2 : product.num,
|
|
742
962
|
product_bundle: nextBundle,
|
|
743
963
|
metadata: _objectSpread(_objectSpread({}, metadataAny), {}, {
|
|
@@ -914,7 +1134,7 @@ function formatSubmitBundleItems(bundle) {
|
|
|
914
1134
|
var formatOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
915
1135
|
if (!Array.isArray(bundle)) return [];
|
|
916
1136
|
return bundle.map(function (b) {
|
|
917
|
-
var
|
|
1137
|
+
var _ref34, _rawBundle$price, _rawBundle$surcharge_, _rawBundle$num, _rawBundle$is_charge_, _rawBundle$bundle_var, _rawBundle$quantity, _rawBundle$extension_, _rawBundle$extension_2, _ref35, _rawBundle$price_type, _ref36, _rawBundle$price_type2, _rawBundle$bundle_gro, _rawBundle$bundle_id, _rawBundle$bundle_pro;
|
|
918
1138
|
var rawBundle = b && _typeof(b) === 'object' ? b : {};
|
|
919
1139
|
var existedMetadata = rawBundle.metadata && _typeof(rawBundle.metadata) === 'object' ? rawBundle.metadata : {};
|
|
920
1140
|
var _customProductBundleMapId = existedMetadata.custom_product_bundle_map_id,
|
|
@@ -925,7 +1145,7 @@ function formatSubmitBundleItems(bundle) {
|
|
|
925
1145
|
var sellingPrice = formatOptions.virtualSettlementMode ? '0.00' : getBundleSellingMagnitude(rawBundle).toFixed(2);
|
|
926
1146
|
// payment 价由整单折扣均摊层产出;缺省(无折扣)时与 selling 净额同义。
|
|
927
1147
|
var paymentPrice = formatOptions.virtualSettlementMode ? '0.00' : rawBundle.bundle_payment_price !== undefined && rawBundle.bundle_payment_price !== null && rawBundle.bundle_payment_price !== '' ? toMoneyString(rawBundle.bundle_payment_price) : sellingPrice;
|
|
928
|
-
var priceValue = formatOptions.virtualSettlementMode ? 0 : (
|
|
1148
|
+
var priceValue = formatOptions.virtualSettlementMode ? 0 : (_ref34 = (_rawBundle$price = rawBundle.price) !== null && _rawBundle$price !== void 0 ? _rawBundle$price : rawBundle.custom_price) !== null && _ref34 !== void 0 ? _ref34 : rawBundle.bundle_selling_price;
|
|
929
1149
|
var relationSurchargeIds = Array.isArray(rawBundle.relation_surcharge_ids) ? rawBundle.relation_surcharge_ids : Array.isArray(existedMetadata.relation_surcharge_ids) ? existedMetadata.relation_surcharge_ids : [];
|
|
930
1150
|
var surchargeFee = toMoneyString((_rawBundle$surcharge_ = rawBundle.surcharge_fee) !== null && _rawBundle$surcharge_ !== void 0 ? _rawBundle$surcharge_ : existedMetadata.surcharge_fee);
|
|
931
1151
|
var productDiscountDifference = toBundleNumber(existedMetadata.product_discount_difference, 0);
|
|
@@ -944,8 +1164,8 @@ function formatSubmitBundleItems(bundle) {
|
|
|
944
1164
|
extension_id: (_rawBundle$extension_ = rawBundle.extension_id) !== null && _rawBundle$extension_ !== void 0 ? _rawBundle$extension_ : 0,
|
|
945
1165
|
extension_type: (_rawBundle$extension_2 = rawBundle.extension_type) !== null && _rawBundle$extension_2 !== void 0 ? _rawBundle$extension_2 : 'normal',
|
|
946
1166
|
price: priceValue,
|
|
947
|
-
price_type: (
|
|
948
|
-
price_type_ext: (
|
|
1167
|
+
price_type: (_ref35 = (_rawBundle$price_type = rawBundle.price_type) !== null && _rawBundle$price_type !== void 0 ? _rawBundle$price_type : rawBundle.custom_price_type) !== null && _ref35 !== void 0 ? _ref35 : '',
|
|
1168
|
+
price_type_ext: (_ref36 = (_rawBundle$price_type2 = rawBundle.price_type_ext) !== null && _rawBundle$price_type2 !== void 0 ? _rawBundle$price_type2 : rawBundle.custom_price_type_ext) !== null && _ref36 !== void 0 ? _ref36 : '',
|
|
949
1169
|
bundle_selling_price: sellingPrice,
|
|
950
1170
|
bundle_payment_price: paymentPrice,
|
|
951
1171
|
option: formatSubmitOptionItems(rawBundle.option, formatOptions),
|
|
@@ -981,11 +1201,11 @@ function formatSubmitBundleItems(bundle) {
|
|
|
981
1201
|
* 法币仅做字段/metadata 裁剪;虚拟币在出站前再次执行零加价与固定单价断言。
|
|
982
1202
|
*/
|
|
983
1203
|
function normalizeSubmitProduct(product) {
|
|
984
|
-
var
|
|
1204
|
+
var _ref38, _submitProduct$bundle, _rawMetadata$product_, _rawMetadata$selected, _rawMetadata$selected2, _submitProduct$produc, _submitProduct$paymen;
|
|
985
1205
|
var formatOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
986
|
-
var
|
|
987
|
-
_runtimeUid =
|
|
988
|
-
submitProduct = _objectWithoutProperties(
|
|
1206
|
+
var _ref37 = product,
|
|
1207
|
+
_runtimeUid = _ref37.unique_identification_number,
|
|
1208
|
+
submitProduct = _objectWithoutProperties(_ref37, _excluded2);
|
|
989
1209
|
var num = submitProduct.num,
|
|
990
1210
|
_productSurchargeFee = submitProduct.surcharge_fee,
|
|
991
1211
|
_deprecatedDiscountAmount = submitProduct.discount_amount,
|
|
@@ -1002,7 +1222,7 @@ function normalizeSubmitProduct(product) {
|
|
|
1002
1222
|
// 兼容历史 BigSale 编辑链路:bundle_edit 曾被写入 metadata,
|
|
1003
1223
|
// 出站时需提升到商品顶层;套餐未编辑时也必须显式提交 0。
|
|
1004
1224
|
var hasProductBundle = Array.isArray(submitProduct.product_bundle) && submitProduct.product_bundle.length > 0;
|
|
1005
|
-
var bundleEdit = (
|
|
1225
|
+
var bundleEdit = (_ref38 = (_submitProduct$bundle = submitProduct.bundle_edit) !== null && _submitProduct$bundle !== void 0 ? _submitProduct$bundle : rawMetadata.bundle_edit) !== null && _ref38 !== void 0 ? _ref38 : hasProductBundle ? 0 : undefined;
|
|
1006
1226
|
var cleanMetadata = {};
|
|
1007
1227
|
if (rawMetadata.unique_identification_number) {
|
|
1008
1228
|
cleanMetadata.unique_identification_number = rawMetadata.unique_identification_number;
|
|
@@ -1233,7 +1453,7 @@ export function resolveSubmitOrderType(params) {
|
|
|
1233
1453
|
return 'virtual';
|
|
1234
1454
|
}
|
|
1235
1455
|
export function buildSubmitPayload(params) {
|
|
1236
|
-
var _tempOrder$metadata2, _tempOrder$customer_i, _tempOrder$country_ca, _tempOrder$phone, _tempOrder$email, _tempOrder$order_numb, _tempOrder$shop_order, _tempOrder$shop_full_,
|
|
1456
|
+
var _tempOrder$metadata2, _tempOrder$customer_i, _tempOrder$country_ca, _tempOrder$phone, _tempOrder$email, _tempOrder$order_numb, _tempOrder$shop_order, _tempOrder$shop_full_, _ref40, _tempOrder$is_price_i, _tempOrder$is_deposit, _tempOrder$_extend, _enhancedPayload$summ;
|
|
1237
1457
|
var tempOrder = params.tempOrder,
|
|
1238
1458
|
cacheId = params.cacheId,
|
|
1239
1459
|
_params$now = params.now,
|
|
@@ -1247,29 +1467,29 @@ export function buildSubmitPayload(params) {
|
|
|
1247
1467
|
var scheduleDate = tempOrder.schedule_date || tempOrder.created_at || formatDateTime(now);
|
|
1248
1468
|
var bookingUuid = createUuidV4();
|
|
1249
1469
|
var virtualSettlementMode = ((_tempOrder$metadata2 = tempOrder.metadata) === null || _tempOrder$metadata2 === void 0 || (_tempOrder$metadata2 = _tempOrder$metadata2.currency_settlement_config) === null || _tempOrder$metadata2 === void 0 ? void 0 : _tempOrder$metadata2.settlement_type) === 'virtual_currency';
|
|
1250
|
-
var
|
|
1251
|
-
_extend =
|
|
1252
|
-
_relationId =
|
|
1253
|
-
_tableFormId =
|
|
1254
|
-
_resourceId =
|
|
1255
|
-
_summary =
|
|
1256
|
-
_lastOrderInfo =
|
|
1257
|
-
_paidAmount =
|
|
1258
|
-
_shopId =
|
|
1259
|
-
_shopNote =
|
|
1260
|
-
_shopServiceType =
|
|
1261
|
-
_startTime =
|
|
1262
|
-
_customer =
|
|
1263
|
-
_discountList =
|
|
1264
|
-
_orderMetaList =
|
|
1265
|
-
_rootTaxFee =
|
|
1266
|
-
_totalAmount =
|
|
1267
|
-
_totalRefundAmount =
|
|
1268
|
-
_createDate =
|
|
1269
|
-
_holderId =
|
|
1270
|
-
_paymentStatus =
|
|
1271
|
-
_notes =
|
|
1272
|
-
tempOrderRest = _objectWithoutProperties(
|
|
1470
|
+
var _ref39 = tempOrder,
|
|
1471
|
+
_extend = _ref39._extend,
|
|
1472
|
+
_relationId = _ref39.relation_id,
|
|
1473
|
+
_tableFormId = _ref39.table_form_id,
|
|
1474
|
+
_resourceId = _ref39.resource_id,
|
|
1475
|
+
_summary = _ref39.summary,
|
|
1476
|
+
_lastOrderInfo = _ref39.lastOrderInfo,
|
|
1477
|
+
_paidAmount = _ref39.paid_amount,
|
|
1478
|
+
_shopId = _ref39.shop_id,
|
|
1479
|
+
_shopNote = _ref39.shop_note,
|
|
1480
|
+
_shopServiceType = _ref39.shop_service_type,
|
|
1481
|
+
_startTime = _ref39.start_time,
|
|
1482
|
+
_customer = _ref39.customer,
|
|
1483
|
+
_discountList = _ref39.discount_list,
|
|
1484
|
+
_orderMetaList = _ref39.order_meta_list,
|
|
1485
|
+
_rootTaxFee = _ref39.tax_fee,
|
|
1486
|
+
_totalAmount = _ref39.total_amount,
|
|
1487
|
+
_totalRefundAmount = _ref39.total_refund_amount,
|
|
1488
|
+
_createDate = _ref39.create_date,
|
|
1489
|
+
_holderId = _ref39.holder_id,
|
|
1490
|
+
_paymentStatus = _ref39.payment_status,
|
|
1491
|
+
_notes = _ref39.notes,
|
|
1492
|
+
tempOrderRest = _objectWithoutProperties(_ref39, _excluded4);
|
|
1273
1493
|
var resolvedBusinessCode = businessCode !== null && businessCode !== void 0 ? businessCode : tempOrder.business_code;
|
|
1274
1494
|
var normalizedOrderMetaList = normalizeOrderMetaList(tempOrder.order_meta_list);
|
|
1275
1495
|
var submitType = resolveSubmitOrderType({
|
|
@@ -1294,7 +1514,7 @@ export function buildSubmitPayload(params) {
|
|
|
1294
1514
|
type: submitType,
|
|
1295
1515
|
business_code: resolvedBusinessCode,
|
|
1296
1516
|
sales_channel: tempOrder.sales_channel || 'my_pisel',
|
|
1297
|
-
order_sales_channel: (
|
|
1517
|
+
order_sales_channel: (_ref40 = channel !== null && channel !== void 0 ? channel : tempOrder.order_sales_channel) !== null && _ref40 !== void 0 ? _ref40 : 'online_store',
|
|
1298
1518
|
status: tempOrder.status || 'normal'
|
|
1299
1519
|
}, params.includePaymentStatus !== false ? {
|
|
1300
1520
|
payment_status: tempOrder.payment_status || 'payment_processing'
|
|
@@ -1322,13 +1542,13 @@ export function buildSubmitPayload(params) {
|
|
|
1322
1542
|
// holder: tempOrder.holder || null,
|
|
1323
1543
|
summary: summary || tempOrder.summary || createEmptySummary(),
|
|
1324
1544
|
metadata: function () {
|
|
1325
|
-
var
|
|
1326
|
-
_collectPax =
|
|
1327
|
-
_tableOccupancyDuration =
|
|
1328
|
-
_cartSettlementKey =
|
|
1329
|
-
_cartSettlementSnapshot =
|
|
1330
|
-
_legalCurrencySnapshot =
|
|
1331
|
-
rest = _objectWithoutProperties(
|
|
1545
|
+
var _ref41 = tempOrder.metadata || {},
|
|
1546
|
+
_collectPax = _ref41.collect_pax,
|
|
1547
|
+
_tableOccupancyDuration = _ref41.table_occupancy_duration,
|
|
1548
|
+
_cartSettlementKey = _ref41.cart_settlement_key,
|
|
1549
|
+
_cartSettlementSnapshot = _ref41.cart_settlement_snapshot,
|
|
1550
|
+
_legalCurrencySnapshot = _ref41.legal_currency_snapshot,
|
|
1551
|
+
rest = _objectWithoutProperties(_ref41, _excluded5);
|
|
1332
1552
|
return _objectSpread({}, rest);
|
|
1333
1553
|
}()
|
|
1334
1554
|
}, (_tempOrder$_extend = tempOrder._extend) !== null && _tempOrder$_extend !== void 0 && (_tempOrder$_extend = _tempOrder$_extend.salesNotesState) !== null && _tempOrder$_extend !== void 0 && _tempOrder$_extend.dirty ? {
|
|
@@ -1532,9 +1752,9 @@ export function clearTempOrderHolderAssignments(tempOrder) {
|
|
|
1532
1752
|
* getOrderProductLineUid({ metadata: { unique_identification_number: 'line-1' } }); // 'line-1'
|
|
1533
1753
|
*/
|
|
1534
1754
|
export function getOrderProductLineUid(product) {
|
|
1535
|
-
var _product$metadata$
|
|
1755
|
+
var _product$metadata$uni2, _product$metadata10;
|
|
1536
1756
|
if (!product || _typeof(product) !== 'object') return null;
|
|
1537
|
-
var uid = (_product$metadata$
|
|
1757
|
+
var uid = (_product$metadata$uni2 = (_product$metadata10 = product.metadata) === null || _product$metadata10 === void 0 ? void 0 : _product$metadata10.unique_identification_number) !== null && _product$metadata$uni2 !== void 0 ? _product$metadata$uni2 : product.unique_identification_number;
|
|
1538
1758
|
if (uid === undefined || uid === null || uid === '') return null;
|
|
1539
1759
|
return String(uid);
|
|
1540
1760
|
}
|
|
@@ -1545,8 +1765,8 @@ export function getRuntimeProductOrigin(tempOrder, product) {
|
|
|
1545
1765
|
return tempOrder._extend.productsByUid[uid].origin;
|
|
1546
1766
|
}
|
|
1547
1767
|
var matchedProduct = ((tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) || []).find(function (item) {
|
|
1548
|
-
var
|
|
1549
|
-
return item === product || getOrderProductLineUid(item) === uid || String((
|
|
1768
|
+
var _ref42, _item$product_id, _ref43, _product$product_id;
|
|
1769
|
+
return item === product || getOrderProductLineUid(item) === uid || String((_ref42 = (_item$product_id = item === null || item === void 0 ? void 0 : item.product_id) !== null && _item$product_id !== void 0 ? _item$product_id : item === null || item === void 0 ? void 0 : item.id) !== null && _ref42 !== void 0 ? _ref42 : '') === String((_ref43 = (_product$product_id = product === null || product === void 0 ? void 0 : product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : product === null || product === void 0 ? void 0 : product.id) !== null && _ref43 !== void 0 ? _ref43 : '');
|
|
1550
1770
|
});
|
|
1551
1771
|
var matchedUid = matchedProduct ? getOrderProductLineUid(matchedProduct) : '';
|
|
1552
1772
|
return matchedUid ? (tempOrder === null || tempOrder === void 0 || (_tempOrder$_extend4 = tempOrder._extend) === null || _tempOrder$_extend4 === void 0 || (_tempOrder$_extend4 = _tempOrder$_extend4.productsByUid) === null || _tempOrder$_extend4 === void 0 || (_tempOrder$_extend4 = _tempOrder$_extend4[matchedUid]) === null || _tempOrder$_extend4 === void 0 ? void 0 : _tempOrder$_extend4.origin) || null : null;
|