@pisell/pisellos 2.2.244 → 2.2.245
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/evaluator.js +3 -2
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/model/strategy/adapter/walletPass/utils.js +7 -4
- package/dist/modules/BookingContext/index.d.ts +48 -0
- package/dist/modules/BookingContext/index.js +566 -0
- package/dist/modules/BookingContext/types.d.ts +102 -0
- package/dist/modules/BookingContext/types.js +51 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +284 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +145 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +218 -0
- package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/dist/modules/BookingContext/utils/flexible.js +56 -0
- package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/dist/modules/BookingContext/utils/formatResourceList.js +38 -0
- package/dist/modules/BookingContext/utils/index.d.ts +11 -0
- package/dist/modules/BookingContext/utils/index.js +11 -0
- package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/dist/modules/BookingContext/utils/noResource.js +77 -0
- package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
- package/dist/modules/BookingContext/utils/orderLineDisplay.js +36 -0
- package/dist/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/dist/modules/BookingContext/utils/productExtend.js +339 -0
- package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/dist/modules/BookingContext/utils/resourceErrors.js +74 -0
- package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/dist/modules/BookingContext/utils/resourceSelection.js +24 -0
- package/dist/modules/BookingContext/utils/resources.d.ts +80 -0
- package/dist/modules/BookingContext/utils/resources.js +486 -0
- package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/dist/modules/BookingContext/utils/serviceTimes.js +151 -0
- package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/dist/modules/BookingContext/utils/timeSlices.js +100 -0
- package/dist/modules/Cart/utils/cartProduct.js +24 -3
- package/dist/modules/Cart/utils/changePrice.js +11 -11
- package/dist/modules/Customer/index.d.ts +20 -0
- package/dist/modules/Customer/index.js +172 -83
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Discount/index.d.ts +1 -1
- package/dist/modules/Discount/index.js +13 -6
- package/dist/modules/Discount/types.d.ts +1 -0
- package/dist/modules/OpenData/index.d.ts +8 -0
- package/dist/modules/OpenData/index.js +37 -17
- package/dist/modules/Order/index.d.ts +275 -19
- package/dist/modules/Order/index.js +3493 -809
- package/dist/modules/Order/types.d.ts +286 -31
- package/dist/modules/Order/types.js +38 -0
- package/dist/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/dist/modules/Order/utils/manualProductDiscount.js +210 -0
- package/dist/modules/Order/utils.d.ts +147 -5
- package/dist/modules/Order/utils.js +750 -104
- package/dist/modules/Payment/index.d.ts +10 -13
- package/dist/modules/Payment/index.js +467 -837
- package/dist/modules/Payment/types.d.ts +2 -0
- package/dist/modules/Payment/utils.js +2 -1
- package/dist/modules/Payment/walletpass.js +41 -25
- package/dist/modules/ProductList/index.d.ts +16 -12
- package/dist/modules/ProductList/index.js +133 -59
- package/dist/modules/ProductList/types.d.ts +14 -0
- package/dist/modules/Quotation/index.d.ts +0 -1
- package/dist/modules/Quotation/index.js +25 -22
- package/dist/modules/Rules/index.d.ts +4 -0
- package/dist/modules/Rules/index.js +97 -70
- package/dist/modules/Rules/types.d.ts +1 -0
- package/dist/modules/SalesSummary/index.d.ts +8 -25
- package/dist/modules/SalesSummary/index.js +86 -35
- package/dist/modules/SalesSummary/types.d.ts +4 -1
- package/dist/modules/SalesSummary/utils.d.ts +2 -25
- package/dist/modules/SalesSummary/utils.js +794 -162
- package/dist/modules/Schedule/index.d.ts +7 -0
- package/dist/modules/Schedule/index.js +24 -2
- package/dist/modules/Summary/index.js +4 -3
- package/dist/modules/SurchargeList/index.d.ts +16 -0
- package/dist/modules/SurchargeList/index.js +162 -0
- package/dist/modules/SurchargeList/types.d.ts +11 -0
- package/dist/modules/SurchargeList/types.js +1 -0
- package/dist/modules/index.d.ts +2 -0
- package/dist/modules/index.js +3 -1
- package/dist/plugins/request.d.ts +1 -0
- package/dist/server/index.d.ts +204 -1
- package/dist/server/index.js +3654 -922
- package/dist/server/modules/index.d.ts +2 -0
- package/dist/server/modules/index.js +2 -0
- package/dist/server/modules/order/index.d.ts +120 -3
- package/dist/server/modules/order/index.js +1758 -448
- package/dist/server/modules/order/types.d.ts +32 -3
- package/dist/server/modules/order/types.js +8 -0
- package/dist/server/modules/order/utils/filterBookings.js +26 -3
- package/dist/server/modules/order/utils/filterOrders.js +23 -8
- package/dist/server/modules/payment/index.d.ts +28 -0
- package/dist/server/modules/payment/index.js +305 -0
- package/dist/server/modules/payment/types.d.ts +9 -0
- package/dist/server/modules/payment/types.js +1 -0
- package/dist/server/modules/products/index.d.ts +34 -7
- package/dist/server/modules/products/index.js +631 -317
- package/dist/server/modules/resource/index.d.ts +2 -0
- package/dist/server/modules/resource/index.js +29 -3
- package/dist/server/modules/schedule/index.d.ts +4 -4
- package/dist/server/modules/schedule/index.js +111 -88
- package/dist/server/test.json +713 -0
- package/dist/server/utils/small-ticket.d.ts +71 -0
- package/dist/server/utils/small-ticket.js +840 -0
- package/dist/solution/BaseSales/index.d.ts +133 -10
- package/dist/solution/BaseSales/index.js +1950 -447
- package/dist/solution/BaseSales/types.d.ts +82 -6
- package/dist/solution/BaseSales/types.js +5 -4
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
- package/dist/solution/BaseSales/utils/cartPromotion.js +1438 -0
- package/dist/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
- package/dist/solution/BaseSales/utils/quotationPrice.js +237 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +105 -24
- package/dist/solution/BaseSales/utils.d.ts +1 -1
- package/dist/solution/BaseSales/utils.js +62 -21
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +271 -11
- package/dist/solution/BookingTicket/index.js +1777 -242
- package/dist/solution/BookingTicket/types.d.ts +118 -1
- package/dist/solution/BookingTicket/types.js +41 -2
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
- package/dist/solution/BookingTicket/utils/addProductDecision.js +346 -0
- package/dist/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
- package/dist/solution/BookingTicket/utils/addTimeAvailability.js +95 -0
- package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +40 -0
- package/dist/solution/BookingTicket/utils/bookingStatus.js +70 -0
- package/dist/solution/BookingTicket/utils/cartView.d.ts +9 -1
- package/dist/solution/BookingTicket/utils/cartView.js +94 -7
- package/dist/solution/BookingTicket/utils/exampleData.d.ts +123 -0
- package/dist/solution/BookingTicket/utils/exampleData.js +183 -0
- package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
- package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.js +438 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +400 -0
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +56 -0
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/dist/solution/BookingTicket/utils/scan/index.js +20 -8
- package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
- package/dist/solution/BookingTicket/utils/scan/scanProductValues.js +150 -0
- package/dist/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
- package/dist/solution/BookingTicket/utils/sessionCatalogStale.js +78 -0
- package/dist/solution/Checkout/index.d.ts +1 -0
- package/dist/solution/Checkout/index.js +10 -9
- package/dist/solution/RegisterAndLogin/config.js +2 -10
- package/dist/solution/ScanOrder/index.d.ts +9 -3
- package/dist/solution/ScanOrder/index.js +241 -134
- package/dist/solution/ScanOrder/types.d.ts +9 -5
- package/dist/solution/ScanOrder/types.js +2 -3
- package/dist/solution/ScanOrder/utils.d.ts +1 -1
- package/dist/solution/ScanOrder/utils.js +84 -22
- package/dist/solution/VenueBooking/index.d.ts +5 -2
- package/dist/solution/VenueBooking/index.js +110 -59
- package/dist/solution/VenueBooking/sales-section-4-annotated.json +0 -2
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +10 -0
- package/dist/types/index.d.ts +10 -0
- package/lib/model/strategy/adapter/promotion/evaluator.js +2 -1
- package/lib/model/strategy/adapter/promotion/index.js +49 -0
- package/lib/model/strategy/adapter/walletPass/utils.js +3 -2
- package/lib/modules/BookingContext/index.d.ts +48 -0
- package/lib/modules/BookingContext/index.js +368 -0
- package/lib/modules/BookingContext/types.d.ts +102 -0
- package/lib/modules/BookingContext/types.js +34 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +276 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +151 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +201 -0
- package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/lib/modules/BookingContext/utils/flexible.js +80 -0
- package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/lib/modules/BookingContext/utils/formatResourceList.js +50 -0
- package/lib/modules/BookingContext/utils/index.d.ts +11 -0
- package/lib/modules/BookingContext/utils/index.js +43 -0
- package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/lib/modules/BookingContext/utils/noResource.js +90 -0
- package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
- package/lib/modules/BookingContext/utils/orderLineDisplay.js +56 -0
- package/lib/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/lib/modules/BookingContext/utils/productExtend.js +283 -0
- package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/lib/modules/BookingContext/utils/resourceErrors.js +80 -0
- package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/lib/modules/BookingContext/utils/resourceSelection.js +46 -0
- package/lib/modules/BookingContext/utils/resources.d.ts +80 -0
- package/lib/modules/BookingContext/utils/resources.js +377 -0
- package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/lib/modules/BookingContext/utils/serviceTimes.js +162 -0
- package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/lib/modules/BookingContext/utils/timeSlices.js +124 -0
- package/lib/modules/Cart/utils/cartProduct.js +20 -3
- package/lib/modules/Cart/utils/changePrice.js +12 -20
- package/lib/modules/Customer/index.d.ts +20 -0
- package/lib/modules/Customer/index.js +64 -11
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Discount/index.d.ts +1 -1
- package/lib/modules/Discount/index.js +9 -1
- package/lib/modules/Discount/types.d.ts +1 -0
- package/lib/modules/OpenData/index.d.ts +8 -0
- package/lib/modules/OpenData/index.js +19 -5
- package/lib/modules/Order/index.d.ts +275 -19
- package/lib/modules/Order/index.js +2245 -336
- package/lib/modules/Order/types.d.ts +286 -31
- package/lib/modules/Order/types.js +1 -0
- package/lib/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/lib/modules/Order/utils/manualProductDiscount.js +206 -0
- package/lib/modules/Order/utils.d.ts +147 -5
- package/lib/modules/Order/utils.js +615 -46
- package/lib/modules/Payment/index.d.ts +10 -13
- package/lib/modules/Payment/index.js +18 -150
- package/lib/modules/Payment/types.d.ts +2 -0
- package/lib/modules/Payment/utils.js +2 -1
- package/lib/modules/Payment/walletpass.js +16 -3
- package/lib/modules/ProductList/index.d.ts +16 -12
- package/lib/modules/ProductList/index.js +41 -4
- package/lib/modules/ProductList/types.d.ts +14 -0
- package/lib/modules/Quotation/index.d.ts +0 -1
- package/lib/modules/Quotation/index.js +19 -16
- package/lib/modules/Rules/index.d.ts +4 -0
- package/lib/modules/Rules/index.js +137 -120
- package/lib/modules/Rules/types.d.ts +1 -0
- package/lib/modules/SalesSummary/index.d.ts +8 -25
- package/lib/modules/SalesSummary/index.js +30 -4
- package/lib/modules/SalesSummary/types.d.ts +4 -1
- package/lib/modules/SalesSummary/utils.d.ts +2 -25
- package/lib/modules/SalesSummary/utils.js +645 -91
- package/lib/modules/Schedule/index.d.ts +7 -0
- package/lib/modules/Schedule/index.js +17 -1
- package/lib/modules/Summary/index.js +5 -4
- package/lib/modules/SurchargeList/index.d.ts +16 -0
- package/lib/modules/SurchargeList/index.js +89 -0
- package/lib/modules/SurchargeList/types.d.ts +11 -0
- package/lib/modules/SurchargeList/types.js +17 -0
- package/lib/modules/index.d.ts +2 -0
- package/lib/modules/index.js +5 -1
- package/lib/plugins/request.d.ts +1 -0
- package/lib/server/index.d.ts +204 -1
- package/lib/server/index.js +1891 -59
- package/lib/server/modules/index.d.ts +2 -0
- package/lib/server/modules/index.js +3 -0
- package/lib/server/modules/order/index.d.ts +120 -3
- package/lib/server/modules/order/index.js +883 -94
- package/lib/server/modules/order/types.d.ts +32 -3
- package/lib/server/modules/order/utils/filterBookings.js +24 -5
- package/lib/server/modules/order/utils/filterOrders.js +15 -6
- package/lib/server/modules/payment/index.d.ts +28 -0
- package/lib/server/modules/payment/index.js +192 -0
- package/lib/server/modules/payment/types.d.ts +9 -0
- package/lib/server/modules/payment/types.js +17 -0
- package/lib/server/modules/products/index.d.ts +34 -7
- package/lib/server/modules/products/index.js +189 -54
- package/lib/server/modules/resource/index.d.ts +2 -0
- package/lib/server/modules/resource/index.js +27 -3
- package/lib/server/modules/schedule/index.d.ts +4 -4
- package/lib/server/modules/schedule/index.js +47 -40
- package/lib/server/test.json +713 -0
- package/lib/server/utils/small-ticket.d.ts +71 -0
- package/lib/server/utils/small-ticket.js +800 -0
- package/lib/solution/BaseSales/index.d.ts +133 -10
- package/lib/solution/BaseSales/index.js +1111 -63
- package/lib/solution/BaseSales/types.d.ts +82 -6
- package/lib/solution/BaseSales/types.js +3 -1
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
- package/lib/solution/BaseSales/utils/cartPromotion.js +992 -0
- package/lib/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
- package/lib/solution/BaseSales/utils/quotationPrice.js +277 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +106 -18
- package/lib/solution/BaseSales/utils.d.ts +1 -1
- package/lib/solution/BaseSales/utils.js +54 -10
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +271 -11
- package/lib/solution/BookingTicket/index.js +922 -29
- package/lib/solution/BookingTicket/types.d.ts +118 -1
- package/lib/solution/BookingTicket/types.js +11 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.js +318 -0
- package/lib/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
- package/lib/solution/BookingTicket/utils/addTimeAvailability.js +125 -0
- package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +40 -0
- package/lib/solution/BookingTicket/utils/bookingStatus.js +44 -2
- package/lib/solution/BookingTicket/utils/cartView.d.ts +9 -1
- package/lib/solution/BookingTicket/utils/cartView.js +61 -6
- package/lib/solution/BookingTicket/utils/exampleData.d.ts +123 -0
- package/lib/solution/BookingTicket/utils/exampleData.js +0 -0
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +254 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +169 -0
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +51 -0
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/lib/solution/BookingTicket/utils/scan/index.js +17 -3
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +127 -0
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +85 -0
- package/lib/solution/Checkout/index.d.ts +1 -0
- package/lib/solution/Checkout/index.js +1 -2
- package/lib/solution/RegisterAndLogin/config.js +2 -10
- package/lib/solution/ScanOrder/index.d.ts +9 -3
- package/lib/solution/ScanOrder/index.js +153 -70
- package/lib/solution/ScanOrder/types.d.ts +9 -5
- package/lib/solution/ScanOrder/utils.d.ts +1 -1
- package/lib/solution/ScanOrder/utils.js +83 -17
- package/lib/solution/VenueBooking/index.d.ts +5 -2
- package/lib/solution/VenueBooking/index.js +54 -17
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +0 -2
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +10 -0
- package/lib/types/index.d.ts +10 -0
- package/package.json +1 -1
- package/dist/solution/Checkout/appointmentDemo.json +0 -1
- package/lib/solution/Checkout/appointmentDemo.json +0 -1
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/modules/BookingContext/utils/buildCacheItemFromOrderLine.ts
|
|
30
|
+
var buildCacheItemFromOrderLine_exports = {};
|
|
31
|
+
__export(buildCacheItemFromOrderLine_exports, {
|
|
32
|
+
buildCacheItemFromOrderLine: () => buildCacheItemFromOrderLine
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(buildCacheItemFromOrderLine_exports);
|
|
35
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
36
|
+
var import_utils = require("../../Order/utils");
|
|
37
|
+
var import_manualProductDiscount = require("../../Order/utils/manualProductDiscount");
|
|
38
|
+
var import_orderLineDisplay = require("./orderLineDisplay");
|
|
39
|
+
function safeFormat(value, fmt) {
|
|
40
|
+
if (value === void 0 || value === null)
|
|
41
|
+
return void 0;
|
|
42
|
+
const d = (0, import_dayjs.default)(value);
|
|
43
|
+
if (!d.isValid())
|
|
44
|
+
return void 0;
|
|
45
|
+
return d.format(fmt);
|
|
46
|
+
}
|
|
47
|
+
function normalizeTimeString(value) {
|
|
48
|
+
if (value === void 0 || value === null)
|
|
49
|
+
return void 0;
|
|
50
|
+
if (typeof value === "string") {
|
|
51
|
+
const t = value.trim();
|
|
52
|
+
const hhmmFromHhmmss = t.match(/^(\d{1,2}:\d{2}):\d{2}$/);
|
|
53
|
+
if (hhmmFromHhmmss)
|
|
54
|
+
return hhmmFromHhmmss[1];
|
|
55
|
+
if (/^\d{1,2}:\d{2}$/.test(t))
|
|
56
|
+
return t;
|
|
57
|
+
}
|
|
58
|
+
const d = (0, import_dayjs.default)(value);
|
|
59
|
+
if (d.isValid())
|
|
60
|
+
return d.format("HH:mm");
|
|
61
|
+
return void 0;
|
|
62
|
+
}
|
|
63
|
+
function unflattenResourceMap(resources) {
|
|
64
|
+
const map = {};
|
|
65
|
+
if (!Array.isArray(resources))
|
|
66
|
+
return map;
|
|
67
|
+
resources.forEach((r) => {
|
|
68
|
+
const formId = r == null ? void 0 : r.form_id;
|
|
69
|
+
if (formId === void 0 || formId === null)
|
|
70
|
+
return;
|
|
71
|
+
const key = String(formId);
|
|
72
|
+
if (!map[key])
|
|
73
|
+
map[key] = [];
|
|
74
|
+
map[key].push({
|
|
75
|
+
form_id: formId,
|
|
76
|
+
relation_id: r.relation_id,
|
|
77
|
+
relation_type: r.relation_type || "form",
|
|
78
|
+
like_status: r.like_status || "common",
|
|
79
|
+
metadata: r.metadata ? { ...r.metadata } : void 0,
|
|
80
|
+
children: r.children
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
return map;
|
|
84
|
+
}
|
|
85
|
+
function resolveCapacityFromBooking(booking) {
|
|
86
|
+
var _a;
|
|
87
|
+
const metaCap = (_a = booking.metadata) == null ? void 0 : _a.capacity;
|
|
88
|
+
if (Array.isArray(metaCap) && metaCap.length > 0) {
|
|
89
|
+
return metaCap.map((item) => {
|
|
90
|
+
if (!item || typeof item !== "object")
|
|
91
|
+
return null;
|
|
92
|
+
if (item.id === void 0 || item.id === null)
|
|
93
|
+
return null;
|
|
94
|
+
const row = {
|
|
95
|
+
id: item.id,
|
|
96
|
+
value: Number(item.value ?? 0)
|
|
97
|
+
};
|
|
98
|
+
if (item.name !== void 0)
|
|
99
|
+
row.name = item.name;
|
|
100
|
+
return row;
|
|
101
|
+
}).filter((item) => item != null);
|
|
102
|
+
}
|
|
103
|
+
if (typeof metaCap === "number" && Number.isFinite(metaCap)) {
|
|
104
|
+
return [{ id: 0, value: metaCap, name: "" }];
|
|
105
|
+
}
|
|
106
|
+
return [];
|
|
107
|
+
}
|
|
108
|
+
function resolveDurationForExtend(booking) {
|
|
109
|
+
const duration = booking.duration;
|
|
110
|
+
if (booking.sub_type === "days" || booking.is_all === 1) {
|
|
111
|
+
return duration;
|
|
112
|
+
}
|
|
113
|
+
if (typeof duration === "number" && Number.isFinite(duration)) {
|
|
114
|
+
return duration;
|
|
115
|
+
}
|
|
116
|
+
return duration;
|
|
117
|
+
}
|
|
118
|
+
function resolveTopLevelDuration(booking, sourceProduct) {
|
|
119
|
+
if ((sourceProduct == null ? void 0 : sourceProduct.duration) !== void 0) {
|
|
120
|
+
return sourceProduct.duration;
|
|
121
|
+
}
|
|
122
|
+
const raw = booking.duration;
|
|
123
|
+
if (raw == null || raw === "")
|
|
124
|
+
return void 0;
|
|
125
|
+
if (typeof raw === "object" && raw.type) {
|
|
126
|
+
return raw;
|
|
127
|
+
}
|
|
128
|
+
const subType = booking.sub_type === "days" ? "days" : "minutes";
|
|
129
|
+
const value = Number(raw);
|
|
130
|
+
if (!Number.isFinite(value) || value <= 0)
|
|
131
|
+
return void 0;
|
|
132
|
+
return { type: subType, value };
|
|
133
|
+
}
|
|
134
|
+
function resolveProductTitle(product, booking, sourceProduct) {
|
|
135
|
+
var _a, _b;
|
|
136
|
+
const metadata = product.metadata || {};
|
|
137
|
+
return (sourceProduct == null ? void 0 : sourceProduct.title) ?? (sourceProduct == null ? void 0 : sourceProduct.name) ?? metadata.product_title ?? metadata.product_name ?? ((_a = booking == null ? void 0 : booking.product) == null ? void 0 : _a.title) ?? ((_b = booking == null ? void 0 : booking.detail) == null ? void 0 : _b.product_title) ?? "";
|
|
138
|
+
}
|
|
139
|
+
function synthesizeProductResourceFromBooking(booking) {
|
|
140
|
+
const rows = booking == null ? void 0 : booking.resources;
|
|
141
|
+
if (!Array.isArray(rows) || rows.length === 0)
|
|
142
|
+
return void 0;
|
|
143
|
+
const relationIdsByForm = /* @__PURE__ */ new Map();
|
|
144
|
+
rows.forEach((row) => {
|
|
145
|
+
const formId = row == null ? void 0 : row.form_id;
|
|
146
|
+
const relationId = Number(row == null ? void 0 : row.relation_id);
|
|
147
|
+
if (formId == null || formId === "" || !Number.isFinite(relationId) || relationId <= 0) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
const list = relationIdsByForm.get(formId) ?? [];
|
|
151
|
+
if (!list.includes(relationId)) {
|
|
152
|
+
list.push(relationId);
|
|
153
|
+
}
|
|
154
|
+
relationIdsByForm.set(formId, list);
|
|
155
|
+
});
|
|
156
|
+
if (relationIdsByForm.size === 0)
|
|
157
|
+
return void 0;
|
|
158
|
+
return {
|
|
159
|
+
resources: Array.from(relationIdsByForm.entries()).map(([formId, relationIds]) => ({
|
|
160
|
+
id: formId,
|
|
161
|
+
status: 1,
|
|
162
|
+
type: "form",
|
|
163
|
+
code: "",
|
|
164
|
+
optional_resource: relationIds,
|
|
165
|
+
default_resource: []
|
|
166
|
+
}))
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
function buildCacheItemFromOrderLine(input) {
|
|
170
|
+
var _a, _b, _c, _d, _e, _f;
|
|
171
|
+
const { product, booking, sourceProduct } = input;
|
|
172
|
+
const resolvedId = product.product_id ?? (sourceProduct == null ? void 0 : sourceProduct.id);
|
|
173
|
+
const selling = Number(product.selling_price ?? 0);
|
|
174
|
+
const original = Number(product.original_price ?? selling);
|
|
175
|
+
const startDate = safeFormat(booking.start_date, "YYYY-MM-DD");
|
|
176
|
+
const endDate = safeFormat(booking.end_date, "YYYY-MM-DD");
|
|
177
|
+
const startTime = normalizeTimeString(booking.start_time);
|
|
178
|
+
const endTime = normalizeTimeString(booking.end_time);
|
|
179
|
+
const resource = unflattenResourceMap(booking.resources);
|
|
180
|
+
const capacity = resolveCapacityFromBooking(booking);
|
|
181
|
+
const holderId = ((_a = booking.metadata) == null ? void 0 : _a.holder_id) ?? booking.holder_id;
|
|
182
|
+
const productTitle = resolveProductTitle(product, booking, sourceProduct);
|
|
183
|
+
const productOptionString = (0, import_orderLineDisplay.buildProductOptionStringFromOrderLine)(product);
|
|
184
|
+
const other = {
|
|
185
|
+
product_variant_id: product.product_variant_id ?? 0,
|
|
186
|
+
option: (0, import_utils.getProductSkuOptions)(product),
|
|
187
|
+
bundle: Array.isArray(product.product_bundle) ? [...product.product_bundle] : []
|
|
188
|
+
};
|
|
189
|
+
const extend = {
|
|
190
|
+
start_date: startDate ? (0, import_dayjs.default)(startDate) : void 0,
|
|
191
|
+
end_date: endDate ? (0, import_dayjs.default)(endDate) : void 0,
|
|
192
|
+
startDate: startDate ? (0, import_dayjs.default)(startDate) : void 0,
|
|
193
|
+
endDate: endDate ? (0, import_dayjs.default)(endDate) : void 0,
|
|
194
|
+
start_time: startTime,
|
|
195
|
+
end_time: endTime,
|
|
196
|
+
duration: resolveDurationForExtend(booking),
|
|
197
|
+
sub_type: booking.sub_type,
|
|
198
|
+
quantity: product.num ?? 1,
|
|
199
|
+
product_name: productTitle,
|
|
200
|
+
note: product.note ?? ((_b = booking == null ? void 0 : booking.detail) == null ? void 0 : _b.note) ?? "",
|
|
201
|
+
price: selling,
|
|
202
|
+
total: selling,
|
|
203
|
+
origin_total: original,
|
|
204
|
+
resource,
|
|
205
|
+
capacity,
|
|
206
|
+
holder_id: holderId,
|
|
207
|
+
other,
|
|
208
|
+
like_status: booking.like_status || "common",
|
|
209
|
+
discount_reason: (0, import_manualProductDiscount.resolveManualDiscountMessage)(
|
|
210
|
+
product.discount_list,
|
|
211
|
+
(_c = product.metadata) == null ? void 0 : _c.product_discount_reason
|
|
212
|
+
) || void 0,
|
|
213
|
+
...productOptionString ? { product_option_string: productOptionString } : {}
|
|
214
|
+
};
|
|
215
|
+
const manualDiscount = (product.discount_list || []).find((d) => (d == null ? void 0 : d.type) === "product");
|
|
216
|
+
if (manualDiscount && extend.origin_total === selling) {
|
|
217
|
+
const manualAmount = Number(manualDiscount.amount ?? 0);
|
|
218
|
+
if (Number.isFinite(manualAmount) && manualAmount > 0) {
|
|
219
|
+
extend.origin_total = selling + manualAmount;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
if (((_d = product.metadata) == null ? void 0 : _d.price_override) != null || manualDiscount) {
|
|
223
|
+
extend.priceOverride = selling;
|
|
224
|
+
}
|
|
225
|
+
if (booking.holder !== void 0) {
|
|
226
|
+
extend.holder = booking.holder;
|
|
227
|
+
}
|
|
228
|
+
if (Array.isArray(booking.relation_forms)) {
|
|
229
|
+
extend.relation_forms = booking.relation_forms;
|
|
230
|
+
}
|
|
231
|
+
const base = {
|
|
232
|
+
...sourceProduct || {},
|
|
233
|
+
id: resolvedId,
|
|
234
|
+
product_id: resolvedId,
|
|
235
|
+
extension_type: (sourceProduct == null ? void 0 : sourceProduct.extension_type) ?? ((_e = booking == null ? void 0 : booking.product) == null ? void 0 : _e.extension_type) ?? (sourceProduct == null ? void 0 : sourceProduct.extension_type),
|
|
236
|
+
title: productTitle || (sourceProduct == null ? void 0 : sourceProduct.title) || ((_f = booking == null ? void 0 : booking.product) == null ? void 0 : _f.title),
|
|
237
|
+
price: (sourceProduct == null ? void 0 : sourceProduct.price) ?? selling,
|
|
238
|
+
selling_price: product.selling_price,
|
|
239
|
+
original_price: product.original_price,
|
|
240
|
+
...productOptionString ? { product_option_string: productOptionString } : {},
|
|
241
|
+
_extend: extend,
|
|
242
|
+
new: 0,
|
|
243
|
+
autoClose: false,
|
|
244
|
+
order_detail_id: product.order_detail_id ?? null,
|
|
245
|
+
booking_id: booking.id ?? booking.booking_id ?? 0
|
|
246
|
+
};
|
|
247
|
+
if ((sourceProduct == null ? void 0 : sourceProduct.capacity) !== void 0) {
|
|
248
|
+
base.capacity = sourceProduct.capacity;
|
|
249
|
+
}
|
|
250
|
+
const topLevelDuration = resolveTopLevelDuration(booking, sourceProduct);
|
|
251
|
+
if (topLevelDuration !== void 0) {
|
|
252
|
+
base.duration = topLevelDuration;
|
|
253
|
+
}
|
|
254
|
+
if ((sourceProduct == null ? void 0 : sourceProduct.product_resource) !== void 0) {
|
|
255
|
+
base.product_resource = sourceProduct.product_resource;
|
|
256
|
+
} else {
|
|
257
|
+
const synthesized = synthesizeProductResourceFromBooking(booking);
|
|
258
|
+
if (synthesized) {
|
|
259
|
+
base.product_resource = synthesized;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
if (Array.isArray(sourceProduct == null ? void 0 : sourceProduct.schedules) && sourceProduct.schedules.length) {
|
|
263
|
+
base.schedules = sourceProduct.schedules;
|
|
264
|
+
}
|
|
265
|
+
if (Array.isArray(sourceProduct == null ? void 0 : sourceProduct["schedule.ids"]) && sourceProduct["schedule.ids"].length) {
|
|
266
|
+
base["schedule.ids"] = sourceProduct["schedule.ids"];
|
|
267
|
+
}
|
|
268
|
+
if (booking.schedule_event_id !== void 0) {
|
|
269
|
+
base.schedule_event_id = booking.schedule_event_id;
|
|
270
|
+
}
|
|
271
|
+
return base;
|
|
272
|
+
}
|
|
273
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
274
|
+
0 && (module.exports = {
|
|
275
|
+
buildCacheItemFromOrderLine
|
|
276
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { OrderProduct } from '../../Order/types';
|
|
2
|
+
export interface BuildNormalProductCacheItemFromOrderLineInput {
|
|
3
|
+
/** tempOrder.products 中的一行(普通商品,无关联 booking) */
|
|
4
|
+
product: OrderProduct;
|
|
5
|
+
/** 商品 catalog / 详情,用于 variant / option / bundle 模板字段 */
|
|
6
|
+
sourceProduct?: Record<string, any> | null;
|
|
7
|
+
}
|
|
8
|
+
export declare function buildNormalProductCacheItemFromOrderLine(input: BuildNormalProductCacheItemFromOrderLineInput): Record<string, any>;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.ts
|
|
20
|
+
var buildNormalProductCacheItemFromOrderLine_exports = {};
|
|
21
|
+
__export(buildNormalProductCacheItemFromOrderLine_exports, {
|
|
22
|
+
buildNormalProductCacheItemFromOrderLine: () => buildNormalProductCacheItemFromOrderLine
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(buildNormalProductCacheItemFromOrderLine_exports);
|
|
25
|
+
var import_utils = require("../../Order/utils");
|
|
26
|
+
var import_orderLineDisplay = require("./orderLineDisplay");
|
|
27
|
+
function resolveSourceProductPrice(product, sourceProduct) {
|
|
28
|
+
var _a, _b, _c;
|
|
29
|
+
const metadata = product.metadata || {};
|
|
30
|
+
if (metadata.source_product_price !== void 0 && metadata.source_product_price !== null) {
|
|
31
|
+
const parsed = Number(metadata.source_product_price);
|
|
32
|
+
if (Number.isFinite(parsed))
|
|
33
|
+
return parsed;
|
|
34
|
+
}
|
|
35
|
+
const variantId = Number(product.product_variant_id || 0);
|
|
36
|
+
if (variantId > 0) {
|
|
37
|
+
const variantList = ((_a = metadata.origin) == null ? void 0 : _a.variant) ?? (sourceProduct == null ? void 0 : sourceProduct.variant);
|
|
38
|
+
if (Array.isArray(variantList)) {
|
|
39
|
+
const matched = variantList.find((v) => Number(v == null ? void 0 : v.id) === variantId);
|
|
40
|
+
const variantPrice = (matched == null ? void 0 : matched.price) ?? (matched == null ? void 0 : matched.base_price);
|
|
41
|
+
if (variantPrice !== void 0 && variantPrice !== null) {
|
|
42
|
+
const parsed = Number(variantPrice);
|
|
43
|
+
if (Number.isFinite(parsed))
|
|
44
|
+
return parsed;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const catalogPrice = (sourceProduct == null ? void 0 : sourceProduct.price) ?? (sourceProduct == null ? void 0 : sourceProduct.base_price);
|
|
49
|
+
if (catalogPrice !== void 0 && catalogPrice !== null) {
|
|
50
|
+
const parsed = Number(catalogPrice);
|
|
51
|
+
if (Number.isFinite(parsed))
|
|
52
|
+
return parsed;
|
|
53
|
+
}
|
|
54
|
+
const originPrice = ((_b = metadata.origin) == null ? void 0 : _b.price) ?? ((_c = metadata.origin) == null ? void 0 : _c.base_price);
|
|
55
|
+
if (originPrice !== void 0 && originPrice !== null) {
|
|
56
|
+
const parsed = Number(originPrice);
|
|
57
|
+
if (Number.isFinite(parsed))
|
|
58
|
+
return parsed;
|
|
59
|
+
}
|
|
60
|
+
return Number(product.selling_price ?? 0);
|
|
61
|
+
}
|
|
62
|
+
function mapOrderBundleToOtherBundle(bundle) {
|
|
63
|
+
return bundle.map((item) => {
|
|
64
|
+
const catalogOriginal = item.original_price ?? item.product_price ?? item.price ?? item.bundle_selling_price;
|
|
65
|
+
const selling = item.bundle_selling_price ?? item.price ?? catalogOriginal;
|
|
66
|
+
const { bundle_selling_price: _omitBundleSelling, ...rest } = item;
|
|
67
|
+
const isMarkupOrMarkdown = (item.price_type === "markdown" || item.price_type === "markup") && (item.price_type_ext === "" || item.price_type_ext === void 0 || item.price_type_ext === null);
|
|
68
|
+
if (isMarkupOrMarkdown)
|
|
69
|
+
delete rest.original_total;
|
|
70
|
+
return {
|
|
71
|
+
...rest,
|
|
72
|
+
price: selling,
|
|
73
|
+
original_price: catalogOriginal,
|
|
74
|
+
...isMarkupOrMarkdown ? {} : { original_total: item.original_total ?? catalogOriginal },
|
|
75
|
+
num: item.num ?? item.quantity ?? 1,
|
|
76
|
+
quantity: item.quantity ?? item.num ?? 1
|
|
77
|
+
};
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
function buildNormalProductCacheItemFromOrderLine(input) {
|
|
81
|
+
var _a, _b, _c, _d;
|
|
82
|
+
const { product, sourceProduct } = input;
|
|
83
|
+
const resolvedId = product.product_id ?? (sourceProduct == null ? void 0 : sourceProduct.id);
|
|
84
|
+
const sourcePrice = resolveSourceProductPrice(product, sourceProduct);
|
|
85
|
+
const selling = Number(product.selling_price ?? 0);
|
|
86
|
+
const original = Number(product.original_price ?? selling);
|
|
87
|
+
const uid = (_a = product.metadata) == null ? void 0 : _a.unique_identification_number;
|
|
88
|
+
const option = (0, import_utils.getProductSkuOptions)(product);
|
|
89
|
+
const bundle = mapOrderBundleToOtherBundle(
|
|
90
|
+
Array.isArray(product.product_bundle) ? product.product_bundle : []
|
|
91
|
+
);
|
|
92
|
+
const originExtend = (_c = (_b = product.metadata) == null ? void 0 : _b.origin) == null ? void 0 : _c._extend;
|
|
93
|
+
const productOptionString = (0, import_orderLineDisplay.buildProductOptionStringFromOrderLine)(product);
|
|
94
|
+
const discountList = product.discount_list || [];
|
|
95
|
+
const other = {
|
|
96
|
+
product_id: resolvedId,
|
|
97
|
+
product_variant_id: product.product_variant_id ?? 0,
|
|
98
|
+
option,
|
|
99
|
+
bundle: ((_d = originExtend == null ? void 0 : originExtend.other) == null ? void 0 : _d.bundle) ? JSON.parse(JSON.stringify(originExtend.other.bundle)) : bundle,
|
|
100
|
+
quantity: product.num ?? 1
|
|
101
|
+
};
|
|
102
|
+
const skuValue = {
|
|
103
|
+
product_id: resolvedId,
|
|
104
|
+
product_variant_id: product.product_variant_id ?? 0,
|
|
105
|
+
option: other.option,
|
|
106
|
+
bundle: other.bundle
|
|
107
|
+
};
|
|
108
|
+
const extend = {
|
|
109
|
+
quantity: product.num ?? 1,
|
|
110
|
+
product_name: (sourceProduct == null ? void 0 : sourceProduct.title) ?? "",
|
|
111
|
+
note: product.note ?? "",
|
|
112
|
+
// v2:_extend.price 为主商品 source 价;行 composite 用 total / origin_total 展示
|
|
113
|
+
price: (originExtend == null ? void 0 : originExtend.price) ?? sourcePrice,
|
|
114
|
+
total: (originExtend == null ? void 0 : originExtend.total) ?? selling,
|
|
115
|
+
origin_total: (originExtend == null ? void 0 : originExtend.origin_total) ?? original,
|
|
116
|
+
other,
|
|
117
|
+
skuValue: JSON.parse(JSON.stringify(skuValue)),
|
|
118
|
+
_skuValue: JSON.parse(JSON.stringify(skuValue)),
|
|
119
|
+
isNormalProduct: true,
|
|
120
|
+
...productOptionString ? { product_option_string: productOptionString } : {},
|
|
121
|
+
...(originExtend == null ? void 0 : originExtend.priceOverride) !== void 0 ? { priceOverride: originExtend.priceOverride } : {},
|
|
122
|
+
...(originExtend == null ? void 0 : originExtend.bundle_edit) !== void 0 ? { bundle_edit: originExtend.bundle_edit } : {}
|
|
123
|
+
};
|
|
124
|
+
if ((originExtend == null ? void 0 : originExtend.skuValue) || (originExtend == null ? void 0 : originExtend._skuValue)) {
|
|
125
|
+
extend.skuValue = JSON.parse(
|
|
126
|
+
JSON.stringify(originExtend.skuValue || originExtend._skuValue)
|
|
127
|
+
);
|
|
128
|
+
extend._skuValue = JSON.parse(JSON.stringify(extend.skuValue));
|
|
129
|
+
}
|
|
130
|
+
return {
|
|
131
|
+
...sourceProduct || {},
|
|
132
|
+
id: resolvedId,
|
|
133
|
+
product_id: resolvedId,
|
|
134
|
+
_id: uid,
|
|
135
|
+
title: sourceProduct == null ? void 0 : sourceProduct.title,
|
|
136
|
+
price: (sourceProduct == null ? void 0 : sourceProduct.price) ?? sourcePrice,
|
|
137
|
+
selling_price: product.selling_price,
|
|
138
|
+
original_price: product.original_price,
|
|
139
|
+
...productOptionString ? { product_option_string: productOptionString } : {},
|
|
140
|
+
note: product.note,
|
|
141
|
+
order_detail_id: product.order_detail_id ?? null,
|
|
142
|
+
discount_list: discountList,
|
|
143
|
+
new: 0,
|
|
144
|
+
autoClose: true,
|
|
145
|
+
_extend: extend
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
149
|
+
0 && (module.exports = {
|
|
150
|
+
buildNormalProductCacheItemFromOrderLine
|
|
151
|
+
});
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 把 info2 `cacheItem` 转换为 OS `addProductToOrder(product, booking)` 所需的 booking 入参。
|
|
3
|
+
*
|
|
4
|
+
* 协议严格对齐 `pisell_os/src/modules/Order/TEMP_ORDER_FIELDS_SUMMARY.md` 的 Bookings 章节:
|
|
5
|
+
* - 顶层只允许出现:schedule_event_id / appointment_status / start_date / start_time / end_date /
|
|
6
|
+
* end_time / select_date / duration / sub_type / like_status / number / resources / relation_forms /
|
|
7
|
+
* holder / metadata / is_all / schedule_id / relation_id / form_id / relation_type / product_uid
|
|
8
|
+
* - bookings[] 不允许出现 `_extend`
|
|
9
|
+
* - bookings[].metadata 走白名单:unique_identification_number / collect_pax / capacity / holder_id / resource_select_type
|
|
10
|
+
* - bookings[].resources[] 只接受协议白名单:form_id / relation_type / relation_id / capacity / like_status / metadata / children
|
|
11
|
+
*
|
|
12
|
+
* `product_uid` / `metadata.unique_identification_number` 不在这里生成:
|
|
13
|
+
* OS `addProductToOrder` 内的 `createLinkedProductAndBooking` 会在最终一步统一改写,
|
|
14
|
+
* 保证商品行 uid 与 booking root 唯一值始终对齐。
|
|
15
|
+
*
|
|
16
|
+
* 复杂 multi-day 展开(createBookingItemsByGroup / concatBookings)首版**不支持**,
|
|
17
|
+
* 由 UI 在 `cart.confirmDetail` 之外通过辅助 API 处理。
|
|
18
|
+
*/
|
|
19
|
+
export interface CacheItemToBookingInputOptions {
|
|
20
|
+
/** booking config,用于推导 metadata.resource_select_type(默认从 cacheItem.\_data.resources[0].select_type.type 推断)。 */
|
|
21
|
+
bookingConfig?: any;
|
|
22
|
+
}
|
|
23
|
+
export interface BookingInput {
|
|
24
|
+
schedule_event_id?: number | string;
|
|
25
|
+
start_date?: string;
|
|
26
|
+
start_time?: string;
|
|
27
|
+
end_date?: string;
|
|
28
|
+
end_time?: string;
|
|
29
|
+
select_date?: string;
|
|
30
|
+
duration?: number;
|
|
31
|
+
sub_type?: 'days' | 'minutes' | string;
|
|
32
|
+
is_all?: 0 | 1;
|
|
33
|
+
number?: number;
|
|
34
|
+
holder?: any;
|
|
35
|
+
like_status?: string;
|
|
36
|
+
relation_forms?: any[];
|
|
37
|
+
resources?: BookingResourceInput[];
|
|
38
|
+
metadata?: BookingMetadataInput;
|
|
39
|
+
schedule_id?: number | string;
|
|
40
|
+
relation_id?: number | string;
|
|
41
|
+
form_id?: number | string;
|
|
42
|
+
relation_type?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface BookingResourceInput {
|
|
45
|
+
form_id?: number | string;
|
|
46
|
+
relation_type?: string;
|
|
47
|
+
relation_id?: number | string;
|
|
48
|
+
capacity?: number;
|
|
49
|
+
like_status?: string;
|
|
50
|
+
metadata?: Record<string, any>;
|
|
51
|
+
children?: any[];
|
|
52
|
+
}
|
|
53
|
+
/** custom / package 人数维度快照,与 info2 `_extend.capacity` / `metadata.capacity` 对齐。 */
|
|
54
|
+
export interface BookingCapacityMetadataItem {
|
|
55
|
+
id: string | number;
|
|
56
|
+
value: number;
|
|
57
|
+
name?: Record<string, any> | string;
|
|
58
|
+
}
|
|
59
|
+
export interface BookingMetadataInput {
|
|
60
|
+
/** 由 OS createLinkedProductAndBooking 统一改写,这里不生成。 */
|
|
61
|
+
unique_identification_number?: string;
|
|
62
|
+
collect_pax?: number;
|
|
63
|
+
/**
|
|
64
|
+
* 资源容量快照:custom 多维度时为 `{ id, value, name? }[]`;
|
|
65
|
+
* 仅总和场景可为 number(capacity_snapshot 兼容)。
|
|
66
|
+
*/
|
|
67
|
+
capacity?: number | BookingCapacityMetadataItem[];
|
|
68
|
+
/** 协议要求始终提交(即使为 null)。 */
|
|
69
|
+
holder_id: any;
|
|
70
|
+
holder?: any;
|
|
71
|
+
resource_select_type?: 'single' | 'multiple' | string;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* 主入口。
|
|
75
|
+
*/
|
|
76
|
+
export declare function cacheItemToBookingInput(cacheItem: any, options?: CacheItemToBookingInputOptions): BookingInput;
|