@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
|
@@ -199,12 +199,27 @@ export interface PointCardSnapshotItem {
|
|
|
199
199
|
id: number | string;
|
|
200
200
|
tag: 'point_card';
|
|
201
201
|
product_id?: number | string;
|
|
202
|
+
code?: string;
|
|
202
203
|
product_name: string;
|
|
203
204
|
par_value: string;
|
|
204
205
|
used_par_value: string;
|
|
205
206
|
}
|
|
207
|
+
export interface PointCardSnapshotMergeContext {
|
|
208
|
+
customerId?: number | string | null;
|
|
209
|
+
orderIdentity?: OrderIdentitySnapshot | null;
|
|
210
|
+
}
|
|
211
|
+
export interface VirtualCurrencySnapshotItem {
|
|
212
|
+
id: number | string;
|
|
213
|
+
tag: 'virtual_currency';
|
|
214
|
+
product_id?: number | string;
|
|
215
|
+
product_name: string;
|
|
216
|
+
par_value: string;
|
|
217
|
+
used_par_value: string;
|
|
218
|
+
name: Record<string, string>;
|
|
219
|
+
}
|
|
206
220
|
export interface OrderMetaList {
|
|
207
221
|
point_cards_snapshot?: PointCardSnapshotItem[];
|
|
222
|
+
virtual_currency_snapshot?: VirtualCurrencySnapshotItem[];
|
|
208
223
|
}
|
|
209
224
|
export interface OrderProduct extends OrderProductIdentity {
|
|
210
225
|
order_detail_id: number | null;
|
|
@@ -964,6 +979,8 @@ export interface OrderModuleAPI {
|
|
|
964
979
|
}) => Promise<Discount[]>;
|
|
965
980
|
getDiscountList: () => Discount[];
|
|
966
981
|
getAvailableWalletIds: () => number[];
|
|
982
|
+
getCustomerWalletPrepareConfigEpoch: () => number;
|
|
983
|
+
mergePointCardSnapshotCodes: (walletPassList: unknown, context?: PointCardSnapshotMergeContext) => PointCardSnapshotItem[];
|
|
967
984
|
applyDiscount: () => void;
|
|
968
985
|
/**
|
|
969
986
|
* 注入促销评估器。
|
|
@@ -12,6 +12,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
12
12
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
13
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); }
|
|
14
14
|
import { cloneDeep } from 'lodash-es';
|
|
15
|
+
import { isFullCoveragePass } from "../../Discount/entitlementPass";
|
|
15
16
|
var IDENTITY_CONFIG = {
|
|
16
17
|
product: {
|
|
17
18
|
persistentIdField: 'order_detail_id',
|
|
@@ -74,22 +75,25 @@ export function setOrderCollectionUid(kind, item, uid) {
|
|
|
74
75
|
delete record[uidField];
|
|
75
76
|
return record;
|
|
76
77
|
}
|
|
77
|
-
function
|
|
78
|
-
var _ref, _ref2,
|
|
79
|
-
var
|
|
80
|
-
|
|
81
|
-
var type = (item === null || item === void 0 ? void 0 : item.type) || (item === null || item === void 0 ? void 0 : item.tag) || (item === null || item === void 0 || (_item$discount = item.discount) === null || _item$discount === void 0 ? void 0 : _item$discount.type) || (item === null || item === void 0 || (_item$discount2 = item.discount) === null || _item$discount2 === void 0 ? void 0 : _item$discount2.tag);
|
|
82
|
-
return type === 'good_pass';
|
|
78
|
+
function getFullCoveragePassIdentity(product) {
|
|
79
|
+
var _ref, _ref2, _pass$discount$resour, _pass$discount;
|
|
80
|
+
var pass = (product.discount_list || []).find(function (item) {
|
|
81
|
+
return isFullCoveragePass(item);
|
|
83
82
|
});
|
|
84
|
-
if (!
|
|
85
|
-
var resourceId = (_ref = (_ref2 = (
|
|
86
|
-
|
|
83
|
+
if (!pass) return null;
|
|
84
|
+
var resourceId = (_ref = (_ref2 = (_pass$discount$resour = (_pass$discount = pass.discount) === null || _pass$discount === void 0 ? void 0 : _pass$discount.resource_id) !== null && _pass$discount$resour !== void 0 ? _pass$discount$resour : pass.resource_id) !== null && _ref2 !== void 0 ? _ref2 : pass.discount_id) !== null && _ref !== void 0 ? _ref : pass.id;
|
|
85
|
+
if (isBlankOrderCollectionIdentity(resourceId)) return null;
|
|
86
|
+
return {
|
|
87
|
+
type: String(pass.type || pass.tag),
|
|
88
|
+
resourceId: String(resourceId)
|
|
89
|
+
};
|
|
87
90
|
}
|
|
88
91
|
function buildSplitProductUid(originalUid, product, duplicateOrdinal) {
|
|
89
92
|
var encodedOriginalUid = encodeURIComponent(originalUid);
|
|
90
|
-
var
|
|
91
|
-
if (
|
|
92
|
-
|
|
93
|
+
var passIdentity = getFullCoveragePassIdentity(product);
|
|
94
|
+
if (passIdentity) {
|
|
95
|
+
var passType = passIdentity.type === 'good_pass' ? 'good-pass' : 'entitlement-pass';
|
|
96
|
+
return "os-split:product:".concat(encodedOriginalUid, ":").concat(passType, ":").concat(encodeURIComponent(passIdentity.resourceId), ":").concat(duplicateOrdinal);
|
|
93
97
|
}
|
|
94
98
|
return "os-split:product:".concat(encodedOriginalUid, ":duplicate:").concat(duplicateOrdinal);
|
|
95
99
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Decimal from 'decimal.js';
|
|
2
2
|
import type { CartItem } from "../Cart";
|
|
3
|
-
import type { OrderProductDiscountItem, OrderMetaList, OrderProduct, OrderSubmitPayload, OrderSubmitProduct, OrderSummary, OrderTempOrder, PointCardSnapshotItem } from './types';
|
|
3
|
+
import type { OrderProductDiscountItem, OrderMetaList, OrderProduct, OrderSubmitPayload, OrderSubmitProduct, OrderSummary, OrderTempOrder, PointCardSnapshotItem, VirtualCurrencySnapshotItem } from './types';
|
|
4
4
|
import type { RulesParamsHooks } from '../Rules/types';
|
|
5
5
|
import type { MapOrderPaymentsOptions, OrderPaymentData, OrderPaymentSource } from './types';
|
|
6
6
|
import { createUuidV4 } from './utils/orderCollectionIdentity';
|
|
@@ -18,6 +18,18 @@ export interface OrderProductsDepositSummary {
|
|
|
18
18
|
import type { WindowPlugin } from '../../plugins';
|
|
19
19
|
export declare function normalizePointCardSnapshotItem(value: unknown): PointCardSnapshotItem | null;
|
|
20
20
|
export declare function buildPointCardSnapshotFromWalletPassList(value: unknown): PointCardSnapshotItem[];
|
|
21
|
+
export declare function collectPointCardSnapshotCodeCandidates(value: unknown): Array<{
|
|
22
|
+
id: string;
|
|
23
|
+
code: string;
|
|
24
|
+
}>;
|
|
25
|
+
/**
|
|
26
|
+
* Payment 的 WalletPass 列表包含实例 code,而 prepare/config 通常只提供
|
|
27
|
+
* 卡名称和余额。按实例 ID 仅补齐 Snapshot 缺失的 code,避免后到的运行态
|
|
28
|
+
* 数据覆盖下单时已经冻结的卡名称和余额。
|
|
29
|
+
*/
|
|
30
|
+
export declare function mergePointCardSnapshotCodes(snapshotsValue: unknown, walletPassesValue: unknown): PointCardSnapshotItem[];
|
|
31
|
+
export declare function normalizeVirtualCurrencySnapshotItem(value: unknown): VirtualCurrencySnapshotItem | null;
|
|
32
|
+
export declare function buildVirtualCurrencySnapshotFromList(value: unknown): VirtualCurrencySnapshotItem[];
|
|
21
33
|
export declare function normalizeOrderMetaList(value: unknown): OrderMetaList | undefined;
|
|
22
34
|
/**
|
|
23
35
|
* 把"含 option 的主商品单价"与 bundle 合成"单行 composite 单价"。
|
|
@@ -109,8 +121,9 @@ export declare function getBundleSellingMagnitude(bundle: Record<string, any> |
|
|
|
109
121
|
* = `metadata.main_product_original_price` + Σ(bundle 原价 × num)。
|
|
110
122
|
* - `metadata.source_product_price`:主商品/variant 基础价(已应用报价单),不含 option、
|
|
111
123
|
* 不含折扣。**权威源**。
|
|
112
|
-
* - `
|
|
113
|
-
* - `metadata.
|
|
124
|
+
* - `product_sku.option[].add_price` 保留单规格折前单价;Rules 的 option.price 只用于本次计算。
|
|
125
|
+
* - `metadata.main_product_original_price` = source + Σ(option.add_price × option.num)(含 option、不含折扣)。
|
|
126
|
+
* - `metadata.main_product_selling_price` = main_original − 行内 per-unit amount(含主商品及 option 优惠)。
|
|
114
127
|
* - `payment_price`:出站 payload 中为行 composite 已减整单折扣均摊价(无折扣时与 `selling_price` 同义)。
|
|
115
128
|
*
|
|
116
129
|
* Rules 钩子契约(hook_adapt 方案,Rules 内部保持不变):
|
|
@@ -119,8 +132,9 @@ export declare function getBundleSellingMagnitude(bundle: Record<string, any> |
|
|
|
119
132
|
* `getProductOriginTotalPrice` 会自行叠加 option + bundle,喂 source 可避免 option 双加。
|
|
120
133
|
* - `getProduct.total` = `selling_price × num`(行 composite × num),与 Rules 内部产出的
|
|
121
134
|
* total(source + option + bundle)对齐。
|
|
135
|
+
* - `getProduct.options` 用单规格原价参与重算;主商品折后价从 main_selling 减去 option 折后合计反推。
|
|
122
136
|
* - `setProduct` 反向流程:把 Rules 返回的 source-level `main_product_selling_price` / `price`
|
|
123
|
-
*
|
|
137
|
+
* 加回单规格原价合计,再减去 optionDiscountAmount;保留订单单规格原价供取消折扣及后续重算。
|
|
124
138
|
* 优先级:
|
|
125
139
|
* 1. `values.main_product_selling_price`(券应用分支,per-unit 券后 source-level 主价)
|
|
126
140
|
* 2. `values.price`(还原分支 `restoredPrice`、good_pass 归零)
|
|
@@ -159,7 +173,7 @@ export declare function resolveManualOverrideLineOriginalPrice(params: {
|
|
|
159
173
|
* // => -4
|
|
160
174
|
*/
|
|
161
175
|
export declare function resolveEffectivePerUnitDiscount(product: Record<string, any>): number;
|
|
162
|
-
export declare function createDefaultOrderRulesHooks(): RulesParamsHooks;
|
|
176
|
+
export declare function createDefaultOrderRulesHooks(getBookings?: () => OrderTempOrder['bookings']): RulesParamsHooks;
|
|
163
177
|
/**
|
|
164
178
|
* 通过 session 类商品的开始时间结束时间生成商品的时长
|
|
165
179
|
* @param {CartItem} cartItem
|