@pisell/pisellos 0.10.7 → 0.10.9
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/core/index.js +0 -1
- package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +18 -2
- package/dist/model/strategy/adapter/dataVariant/evaluator.js +287 -101
- package/dist/model/strategy/adapter/dataVariant/type.d.ts +25 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -2
- package/dist/model/strategy/adapter/walletPass/type.d.ts +5 -0
- package/dist/model/strategy/adapter/walletPass/utils.js +57 -26
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +18 -12
- package/dist/modules/BookingContext/utils/productExtend.js +5 -9
- package/dist/modules/BookingContext/utils/timeSlices.js +24 -3
- package/dist/modules/Customer/index.d.ts +4 -0
- package/dist/modules/Customer/index.js +91 -59
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Discount/index.d.ts +2 -0
- package/dist/modules/Discount/index.js +38 -5
- package/dist/modules/Discount/types.d.ts +11 -0
- package/dist/modules/Order/index.d.ts +32 -6
- package/dist/modules/Order/index.js +1165 -819
- package/dist/modules/Order/types.d.ts +32 -4
- package/dist/modules/Order/types.js +11 -0
- package/dist/modules/Order/utils/discountProductLineIdentity.d.ts +45 -0
- package/dist/modules/Order/utils/discountProductLineIdentity.js +227 -0
- package/dist/modules/Order/utils/virtualSettlement.d.ts +56 -0
- package/dist/modules/Order/utils/virtualSettlement.js +271 -0
- package/dist/modules/Order/utils.js +89 -48
- package/dist/modules/Payment/types.d.ts +2 -0
- package/dist/modules/Payment/utils.js +4 -1
- package/dist/modules/Payment/walletpass.d.ts +11 -0
- package/dist/modules/Payment/walletpass.js +235 -60
- package/dist/modules/Product/types.d.ts +23 -0
- package/dist/modules/ProductList/index.d.ts +15 -2
- package/dist/modules/ProductList/index.js +92 -13
- package/dist/modules/Rules/index.js +125 -52
- package/dist/modules/SalesSummary/index.d.ts +1 -0
- package/dist/modules/SalesSummary/index.js +4 -3
- package/dist/modules/SalesSummary/types.d.ts +1 -0
- package/dist/modules/SalesSummary/utils.d.ts +1 -0
- package/dist/modules/SalesSummary/utils.js +28 -2
- package/dist/server/index.d.ts +15 -0
- package/dist/server/index.js +894 -781
- package/dist/server/modules/order/index.d.ts +2 -0
- package/dist/server/modules/order/index.js +261 -96
- package/dist/server/modules/order/types.d.ts +1 -1
- package/dist/server/utils/small-ticket.js +2 -1
- package/dist/solution/BaseSales/index.d.ts +41 -7
- package/dist/solution/BaseSales/index.js +1405 -974
- package/dist/solution/BaseSales/utils/cartPromotion.js +26 -3
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +79 -13
- package/dist/solution/BaseSales/utils.js +31 -20
- package/dist/solution/BookingByStep/index.d.ts +3 -3
- package/dist/solution/BookingTicket/index.d.ts +5 -1
- package/dist/solution/BookingTicket/index.js +221 -162
- package/dist/solution/BookingTicket/types.d.ts +3 -0
- package/dist/solution/BookingTicket/utils/addProductDecision.js +2 -1
- package/dist/solution/BookingTicket/utils/cartView.js +44 -32
- package/dist/solution/Sales/index.d.ts +1 -0
- package/dist/solution/Sales/index.js +16 -2
- package/dist/solution/ScanOrder/index.js +25 -64
- package/dist/solution/ScanOrder/utils.js +31 -20
- package/dist/solution/UnifiedBookingSales/index.d.ts +5 -4
- package/dist/solution/UnifiedBookingSales/index.js +51 -39
- package/lib/core/index.js +0 -1
- package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +18 -2
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +170 -7
- package/lib/model/strategy/adapter/dataVariant/type.d.ts +25 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.js +0 -2
- package/lib/model/strategy/adapter/walletPass/type.d.ts +5 -0
- package/lib/model/strategy/adapter/walletPass/utils.js +62 -11
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +6 -1
- package/lib/modules/BookingContext/utils/productExtend.js +4 -3
- package/lib/modules/BookingContext/utils/timeSlices.js +18 -3
- package/lib/modules/Customer/index.d.ts +4 -0
- package/lib/modules/Customer/index.js +11 -0
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Discount/index.d.ts +2 -0
- package/lib/modules/Discount/index.js +37 -3
- package/lib/modules/Discount/types.d.ts +11 -0
- package/lib/modules/Order/index.d.ts +32 -6
- package/lib/modules/Order/index.js +518 -148
- package/lib/modules/Order/types.d.ts +32 -4
- package/lib/modules/Order/utils/discountProductLineIdentity.d.ts +45 -0
- package/lib/modules/Order/utils/discountProductLineIdentity.js +170 -0
- package/lib/modules/Order/utils/virtualSettlement.d.ts +56 -0
- package/lib/modules/Order/utils/virtualSettlement.js +300 -0
- package/lib/modules/Order/utils.js +65 -21
- package/lib/modules/Payment/types.d.ts +2 -0
- package/lib/modules/Payment/utils.js +5 -1
- package/lib/modules/Payment/walletpass.d.ts +11 -0
- package/lib/modules/Payment/walletpass.js +198 -17
- package/lib/modules/Product/types.d.ts +23 -0
- package/lib/modules/ProductList/index.d.ts +15 -2
- package/lib/modules/ProductList/index.js +85 -3
- package/lib/modules/Rules/index.js +100 -20
- package/lib/modules/SalesSummary/index.d.ts +1 -0
- package/lib/modules/SalesSummary/index.js +10 -2
- package/lib/modules/SalesSummary/types.d.ts +1 -0
- package/lib/modules/SalesSummary/utils.d.ts +1 -0
- package/lib/modules/SalesSummary/utils.js +30 -2
- package/lib/server/index.d.ts +15 -0
- package/lib/server/index.js +105 -14
- package/lib/server/modules/order/index.d.ts +2 -0
- package/lib/server/modules/order/index.js +75 -5
- package/lib/server/modules/order/types.d.ts +1 -1
- package/lib/server/utils/small-ticket.js +1 -1
- package/lib/solution/BaseSales/index.d.ts +41 -7
- package/lib/solution/BaseSales/index.js +325 -39
- package/lib/solution/BaseSales/utils/cartPromotion.js +26 -2
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +62 -12
- package/lib/solution/BaseSales/utils.js +29 -18
- package/lib/solution/BookingByStep/index.d.ts +3 -3
- package/lib/solution/BookingTicket/index.d.ts +5 -1
- package/lib/solution/BookingTicket/index.js +31 -6
- package/lib/solution/BookingTicket/types.d.ts +3 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.js +2 -1
- package/lib/solution/BookingTicket/utils/cartView.js +43 -30
- package/lib/solution/Sales/index.d.ts +1 -0
- package/lib/solution/Sales/index.js +15 -3
- package/lib/solution/ScanOrder/index.js +17 -54
- package/lib/solution/ScanOrder/utils.js +29 -18
- package/lib/solution/UnifiedBookingSales/index.d.ts +5 -4
- package/lib/solution/UnifiedBookingSales/index.js +35 -26
- package/package.json +1 -1
|
@@ -357,33 +357,44 @@ function attachItemRuleLimitsToTopLevelProducts(productList, limits) {
|
|
|
357
357
|
return productList;
|
|
358
358
|
}
|
|
359
359
|
function buildProductLineFingerprint(productOptionItem, productBundle) {
|
|
360
|
-
const
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
360
|
+
const normalizeOptions = (options) => {
|
|
361
|
+
const optionArr = Array.isArray(options) ? options : [];
|
|
362
|
+
return optionArr.map((item) => ({
|
|
363
|
+
option_group_item_id: Number(item == null ? void 0 : item.option_group_item_id) || 0,
|
|
364
|
+
option_group_id: Number(item == null ? void 0 : item.option_group_id) || 0,
|
|
365
|
+
num: typeof (item == null ? void 0 : item.num) === "number" && !Number.isNaN(item.num) ? Math.max(1, Math.floor(item.num)) : 1,
|
|
366
|
+
price: String((item == null ? void 0 : item.add_price) ?? (item == null ? void 0 : item.price) ?? "")
|
|
367
|
+
})).sort((p, q) => {
|
|
368
|
+
if (p.option_group_item_id !== q.option_group_item_id) {
|
|
369
|
+
return p.option_group_item_id - q.option_group_item_id;
|
|
370
|
+
}
|
|
371
|
+
if (p.option_group_id !== q.option_group_id) {
|
|
372
|
+
return p.option_group_id - q.option_group_id;
|
|
373
|
+
}
|
|
374
|
+
if (p.num !== q.num)
|
|
375
|
+
return p.num - q.num;
|
|
376
|
+
return p.price.localeCompare(q.price);
|
|
377
|
+
});
|
|
378
|
+
};
|
|
379
|
+
const normalizedOpts = normalizeOptions(productOptionItem);
|
|
376
380
|
const bundleArr = Array.isArray(productBundle) ? productBundle : [];
|
|
377
381
|
const normalizedBundles = bundleArr.map((item) => ({
|
|
378
382
|
bundle_id: Number((item == null ? void 0 : item.bundle_id) ?? (item == null ? void 0 : item.id) ?? 0) || 0,
|
|
379
383
|
product_id: Number(item == null ? void 0 : item.product_id) || 0,
|
|
380
|
-
|
|
384
|
+
product_variant_id: Number((item == null ? void 0 : item.bundle_variant_id) ?? (item == null ? void 0 : item.product_variant_id)) || 0,
|
|
385
|
+
num: typeof (item == null ? void 0 : item.num) === "number" && !Number.isNaN(item.num) ? Math.max(1, Math.floor(item.num)) : 1,
|
|
386
|
+
option: normalizeOptions(item == null ? void 0 : item.option)
|
|
381
387
|
})).sort((p, q) => {
|
|
382
388
|
if (p.bundle_id !== q.bundle_id)
|
|
383
389
|
return p.bundle_id - q.bundle_id;
|
|
384
390
|
if (p.product_id !== q.product_id)
|
|
385
391
|
return p.product_id - q.product_id;
|
|
386
|
-
|
|
392
|
+
if (p.product_variant_id !== q.product_variant_id) {
|
|
393
|
+
return p.product_variant_id - q.product_variant_id;
|
|
394
|
+
}
|
|
395
|
+
if (p.num !== q.num)
|
|
396
|
+
return p.num - q.num;
|
|
397
|
+
return JSON.stringify(p.option).localeCompare(JSON.stringify(q.option));
|
|
387
398
|
});
|
|
388
399
|
return JSON.stringify([normalizedOpts, normalizedBundles]);
|
|
389
400
|
}
|
|
@@ -76,6 +76,11 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
76
76
|
* value 为 undefined 时删除该 key;存储失败不阻断业务流程。
|
|
77
77
|
*/
|
|
78
78
|
setSessionStateValue(key: string, value: unknown): void;
|
|
79
|
+
/**
|
|
80
|
+
* 清除当前 cacheId 的可恢复订单快照,同时保留 Solution UI sessionState。
|
|
81
|
+
* 用于支付跳转等终态场景,避免浏览器返回时恢复已提交订单。
|
|
82
|
+
*/
|
|
83
|
+
clearSessionStorageOrderSnapshot(): void;
|
|
79
84
|
/**
|
|
80
85
|
* Kiosk 不能把已收款订单留在本地等待重试:默认直接等待云端 checkout。
|
|
81
86
|
* 兼容仍需要 WebPOS 待同步模式的入口可显式传 checkoutSyncTaskEnabled: true。
|
|
@@ -122,10 +127,6 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
122
127
|
* Read-only compatibility view for salesSdk skins. It reconnects a booking to its product but
|
|
123
128
|
* must not be used to mutate tempOrder; all writes go through BaseSales / planner APIs.
|
|
124
129
|
*/
|
|
125
|
-
getCart(): {
|
|
126
|
-
items: any[];
|
|
127
|
-
bookings: any[];
|
|
128
|
-
};
|
|
129
130
|
/**
|
|
130
131
|
* Loads the current customer's product coupons and discount cards after planner lines exist,
|
|
131
132
|
* then optionally lets the existing Rules engine select the best valid combination. This is a
|
|
@@ -523,6 +523,14 @@ var UnifiedBookingSalesImpl = class extends import_BookingTicket.BookingTicket {
|
|
|
523
523
|
cacheKey: ["sessionState"]
|
|
524
524
|
});
|
|
525
525
|
}
|
|
526
|
+
/**
|
|
527
|
+
* 清除当前 cacheId 的可恢复订单快照,同时保留 Solution UI sessionState。
|
|
528
|
+
* 用于支付跳转等终态场景,避免浏览器返回时恢复已提交订单。
|
|
529
|
+
*/
|
|
530
|
+
clearSessionStorageOrderSnapshot() {
|
|
531
|
+
var _a, _b;
|
|
532
|
+
(_b = (_a = this.store.order) == null ? void 0 : _a.clearSessionStoragePersistedTempOrder) == null ? void 0 : _b.call(_a);
|
|
533
|
+
}
|
|
526
534
|
/**
|
|
527
535
|
* Kiosk 不能把已收款订单留在本地等待重试:默认直接等待云端 checkout。
|
|
528
536
|
* 兼容仍需要 WebPOS 待同步模式的入口可显式传 checkoutSyncTaskEnabled: true。
|
|
@@ -806,32 +814,33 @@ var UnifiedBookingSalesImpl = class extends import_BookingTicket.BookingTicket {
|
|
|
806
814
|
* Read-only compatibility view for salesSdk skins. It reconnects a booking to its product but
|
|
807
815
|
* must not be used to mutate tempOrder; all writes go through BaseSales / planner APIs.
|
|
808
816
|
*/
|
|
809
|
-
getCart() {
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
}
|
|
817
|
+
// getCart(): BookingTicketCartView {
|
|
818
|
+
// const tempOrder = this.getTempOrder();
|
|
819
|
+
// const salesDetail = this.getSalesOrder();
|
|
820
|
+
// const items = tempOrder?.products || [];
|
|
821
|
+
// const bookings = salesDetail?.bookings || tempOrder?.bookings || [];
|
|
822
|
+
// return {
|
|
823
|
+
// items,
|
|
824
|
+
// bookings: bookings.map((booking: any) => {
|
|
825
|
+
// const productUid = booking?.product_uid;
|
|
826
|
+
// const product = productUid
|
|
827
|
+
// ? items.find((item: any) => {
|
|
828
|
+
// const uid = item?.metadata?.unique_identification_number || item?.unique_identification_number;
|
|
829
|
+
// return String(uid || '') === String(productUid);
|
|
830
|
+
// }) || null
|
|
831
|
+
// : null;
|
|
832
|
+
// return {
|
|
833
|
+
// ...booking,
|
|
834
|
+
// _extend: {
|
|
835
|
+
// ...(booking?._extend || {}),
|
|
836
|
+
// product,
|
|
837
|
+
// addTimeProduct: [],
|
|
838
|
+
// canAddTime: false,
|
|
839
|
+
// },
|
|
840
|
+
// };
|
|
841
|
+
// }),
|
|
842
|
+
// };
|
|
843
|
+
// }
|
|
835
844
|
/**
|
|
836
845
|
* Loads the current customer's product coupons and discount cards after planner lines exist,
|
|
837
846
|
* then optionally lets the existing Rules engine select the best valid combination. This is a
|