@pisell/pisellos 2.2.244 → 2.2.246
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/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 +148 -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 +277 -18
- package/dist/modules/Order/index.js +3581 -779
- 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 +1762 -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 +154 -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 +277 -18
- package/lib/modules/Order/index.js +2317 -337
- 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 +887 -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,124 @@
|
|
|
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/timeSlices.ts
|
|
30
|
+
var timeSlices_exports = {};
|
|
31
|
+
__export(timeSlices_exports, {
|
|
32
|
+
findNextDuration: () => findNextDuration,
|
|
33
|
+
findNextSlice: () => findNextSlice,
|
|
34
|
+
getDurationValue: () => import_flexible.getDurationValue,
|
|
35
|
+
getEndDate: () => getEndDate,
|
|
36
|
+
sliceDayIntoFiveMinutes: () => sliceDayIntoFiveMinutes
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(timeSlices_exports);
|
|
39
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
40
|
+
var import_flexible = require("./flexible");
|
|
41
|
+
function sliceDayIntoFiveMinutes(config, isDay) {
|
|
42
|
+
const startTime = (0, import_dayjs.default)().startOf("day");
|
|
43
|
+
const endTime = (0, import_dayjs.default)().endOf("day");
|
|
44
|
+
const timeSlice = config && config.value || 5;
|
|
45
|
+
const timeSlices = [];
|
|
46
|
+
const durationSlicesBasedOnTime = [];
|
|
47
|
+
let currentTime = startTime;
|
|
48
|
+
if (isDay) {
|
|
49
|
+
let currentDay = 1;
|
|
50
|
+
while (currentDay <= 30) {
|
|
51
|
+
timeSlices.push({
|
|
52
|
+
label: currentTime.format("hh:mm A"),
|
|
53
|
+
value: currentTime.format("HH:mm")
|
|
54
|
+
});
|
|
55
|
+
durationSlicesBasedOnTime.push({
|
|
56
|
+
label: String(currentDay),
|
|
57
|
+
value: currentDay
|
|
58
|
+
});
|
|
59
|
+
currentDay += 1;
|
|
60
|
+
}
|
|
61
|
+
return { timeSlices, durationSlicesBasedOnTime };
|
|
62
|
+
}
|
|
63
|
+
while (currentTime.isBefore(endTime)) {
|
|
64
|
+
timeSlices.push({
|
|
65
|
+
label: currentTime.format("hh:mm A"),
|
|
66
|
+
value: currentTime.format("HH:mm")
|
|
67
|
+
});
|
|
68
|
+
const nextTime = currentTime.add(timeSlice, "minute");
|
|
69
|
+
const durationValue = nextTime.diff(startTime, "minute");
|
|
70
|
+
durationSlicesBasedOnTime.push({
|
|
71
|
+
label: String(durationValue),
|
|
72
|
+
value: durationValue
|
|
73
|
+
});
|
|
74
|
+
currentTime = nextTime;
|
|
75
|
+
}
|
|
76
|
+
return { timeSlices, durationSlicesBasedOnTime };
|
|
77
|
+
}
|
|
78
|
+
function findNextDuration(current, array, defaultValue) {
|
|
79
|
+
if (defaultValue !== void 0 && defaultValue !== null)
|
|
80
|
+
return defaultValue;
|
|
81
|
+
if (!array || array.length === 0)
|
|
82
|
+
return void 0;
|
|
83
|
+
for (let i = 0; i < array.length; i += 1) {
|
|
84
|
+
if (array[i].value === (current == null ? void 0 : current.value))
|
|
85
|
+
return array[i].value;
|
|
86
|
+
}
|
|
87
|
+
return array[0].value;
|
|
88
|
+
}
|
|
89
|
+
function findNextSlice(params) {
|
|
90
|
+
var _a;
|
|
91
|
+
const { timeSlices, index = 0, date = "" } = params;
|
|
92
|
+
const currentTimeValue = date || (0, import_dayjs.default)().format("HH:mm");
|
|
93
|
+
for (let i = 0; i < timeSlices.length; i += 1) {
|
|
94
|
+
if (timeSlices[i].value !== "now" && timeSlices[i].value >= currentTimeValue) {
|
|
95
|
+
return timeSlices[i].value;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return (_a = timeSlices[index]) == null ? void 0 : _a.value;
|
|
99
|
+
}
|
|
100
|
+
function getEndDate(startDate, duration, endDate, shopOpeningHours) {
|
|
101
|
+
if (duration === "flexible") {
|
|
102
|
+
let openingDate = (0, import_dayjs.default)(
|
|
103
|
+
`${startDate.format("YYYY-MM-DD")} ${shopOpeningHours || "23:59"}`
|
|
104
|
+
);
|
|
105
|
+
if ((0, import_dayjs.default)(startDate).isAfter(openingDate)) {
|
|
106
|
+
openingDate = openingDate.add(1, "day");
|
|
107
|
+
}
|
|
108
|
+
if (!endDate)
|
|
109
|
+
return openingDate;
|
|
110
|
+
const endDateObj = (0, import_dayjs.default)(endDate);
|
|
111
|
+
if (endDateObj.isAfter(openingDate))
|
|
112
|
+
return openingDate;
|
|
113
|
+
return endDateObj;
|
|
114
|
+
}
|
|
115
|
+
return startDate.add(Number(duration), "minute");
|
|
116
|
+
}
|
|
117
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
118
|
+
0 && (module.exports = {
|
|
119
|
+
findNextDuration,
|
|
120
|
+
findNextSlice,
|
|
121
|
+
getDurationValue,
|
|
122
|
+
getEndDate,
|
|
123
|
+
sliceDayIntoFiveMinutes
|
|
124
|
+
});
|
|
@@ -46,6 +46,7 @@ var import_decimal = __toESM(require("decimal.js"));
|
|
|
46
46
|
var import_utils = require("../../Product/utils");
|
|
47
47
|
var import_utils2 = require("../../../solution/ShopDiscount/utils");
|
|
48
48
|
var import_utils3 = require("../../Summary/utils");
|
|
49
|
+
var import_utils4 = require("../../Order/utils");
|
|
49
50
|
var toDiscountPayload = (discountItem) => {
|
|
50
51
|
var _a, _b;
|
|
51
52
|
return {
|
|
@@ -185,7 +186,7 @@ var formatProductToCartItemOrigin = (params) => {
|
|
|
185
186
|
product_id: product.id,
|
|
186
187
|
product_variant_id: product_variant_id || 0,
|
|
187
188
|
product_bundle: ((_b = origin.product) == null ? void 0 : _b.product_bundle) || [],
|
|
188
|
-
|
|
189
|
+
product_sku: ((_c = origin.product) == null ? void 0 : _c.product_sku) || { option: [] },
|
|
189
190
|
metadata: {
|
|
190
191
|
product_discount_difference
|
|
191
192
|
}
|
|
@@ -196,7 +197,14 @@ var formatProductToCartItemOrigin = (params) => {
|
|
|
196
197
|
origin.product.product_bundle = formatBundleToOrigin(bundle);
|
|
197
198
|
}
|
|
198
199
|
if (options == null ? void 0 : options.length) {
|
|
199
|
-
origin.product.
|
|
200
|
+
origin.product.product_sku = {
|
|
201
|
+
...origin.product.product_sku || {},
|
|
202
|
+
option: formatOptionsToOrigin(options).map((option) => {
|
|
203
|
+
const next = { ...option, add_price: option.add_price ?? option.price };
|
|
204
|
+
delete next.price;
|
|
205
|
+
return next;
|
|
206
|
+
})
|
|
207
|
+
};
|
|
200
208
|
}
|
|
201
209
|
}
|
|
202
210
|
return origin;
|
|
@@ -330,6 +338,15 @@ var formatBundleToOrigin = (bundle) => {
|
|
|
330
338
|
var _a;
|
|
331
339
|
return pre + (((_a = cur == null ? void 0 : cur.metadata) == null ? void 0 : _a.product_discount_difference) || 0);
|
|
332
340
|
}, 0);
|
|
341
|
+
const normalizedBundle = {
|
|
342
|
+
...d,
|
|
343
|
+
// 计算 markdown 净额时只传真实毛价;若仅有 bundle_selling_price,则由 helper 当历史净额兜底。
|
|
344
|
+
price: (d == null ? void 0 : d.price) ?? (d == null ? void 0 : d.custom_price),
|
|
345
|
+
bundle_selling_price: d == null ? void 0 : d.bundle_selling_price,
|
|
346
|
+
price_type: (d == null ? void 0 : d.price_type) ?? (d == null ? void 0 : d.custom_price_type),
|
|
347
|
+
price_type_ext: (d == null ? void 0 : d.price_type_ext) ?? (d == null ? void 0 : d.custom_price_type_ext),
|
|
348
|
+
option: getBundleValueByKey("option")
|
|
349
|
+
};
|
|
333
350
|
return {
|
|
334
351
|
bundle_group_id: getBundleValueByKey("group_id"),
|
|
335
352
|
bundle_id: d.id,
|
|
@@ -340,7 +357,7 @@ var formatBundleToOrigin = (bundle) => {
|
|
|
340
357
|
extension_type: getBundleValueByKey("extension_type"),
|
|
341
358
|
option: formatOptionsToOrigin(getBundleValueByKey("option")),
|
|
342
359
|
discount_list: d.discount_list,
|
|
343
|
-
"bundle_selling_price":
|
|
360
|
+
"bundle_selling_price": (0, import_utils4.getBundleSellingMagnitude)(normalizedBundle).toFixed(2),
|
|
344
361
|
"custom_price": d == null ? void 0 : d.price,
|
|
345
362
|
metadata: {
|
|
346
363
|
custom_product_bundle_map_id: d._id,
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
5
|
var __export = (target, all) => {
|
|
8
6
|
for (var name in all)
|
|
@@ -16,14 +14,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
14
|
}
|
|
17
15
|
return to;
|
|
18
16
|
};
|
|
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
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
18
|
|
|
29
19
|
// src/modules/Cart/utils/changePrice.ts
|
|
@@ -32,7 +22,7 @@ __export(changePrice_exports, {
|
|
|
32
22
|
updateAllCartItemPrice: () => updateAllCartItemPrice
|
|
33
23
|
});
|
|
34
24
|
module.exports = __toCommonJS(changePrice_exports);
|
|
35
|
-
var
|
|
25
|
+
var import_utils = require("../../Order/utils");
|
|
36
26
|
async function updateAllCartItemPrice(cartItems, priceData, getProduct, updateCart, updateItemInitInfo) {
|
|
37
27
|
var _a, _b;
|
|
38
28
|
for (const item of cartItems) {
|
|
@@ -57,18 +47,20 @@ async function updateAllCartItemPrice(cartItems, priceData, getProduct, updateCa
|
|
|
57
47
|
const targetBundleItem = targetBundle.bundle_item.find(
|
|
58
48
|
(m) => m.id === n.id
|
|
59
49
|
);
|
|
60
|
-
if (targetBundleItem.price_type === "markdown") {
|
|
61
|
-
targetBundleItem.price = new import_decimal.default(targetBundleItem.price || 0).mul(-1).toNumber();
|
|
62
|
-
}
|
|
63
|
-
if (n.option) {
|
|
64
|
-
targetBundleItem.price = new import_decimal.default(targetBundleItem.price || 0).add(n.option.reduce((pre, cur) => {
|
|
65
|
-
return pre + new import_decimal.default(cur.price || 0).mul(cur.num || 1).toNumber();
|
|
66
|
-
}, 0)).toNumber();
|
|
67
|
-
}
|
|
68
50
|
if (targetBundleItem) {
|
|
69
|
-
|
|
51
|
+
const normalizedBundle = {
|
|
70
52
|
...n,
|
|
71
53
|
price: targetBundleItem.price,
|
|
54
|
+
custom_price: targetBundleItem.price,
|
|
55
|
+
price_type: targetBundleItem.price_type,
|
|
56
|
+
price_type_ext: targetBundleItem.price_type_ext
|
|
57
|
+
};
|
|
58
|
+
const bundleSellingPrice = (0, import_utils.getBundleSellingMagnitude)(normalizedBundle).toFixed(2);
|
|
59
|
+
return {
|
|
60
|
+
...n,
|
|
61
|
+
custom_price: targetBundleItem.price,
|
|
62
|
+
price: targetBundleItem.price_type === "markdown" ? bundleSellingPrice : targetBundleItem.price,
|
|
63
|
+
bundle_selling_price: bundleSellingPrice,
|
|
72
64
|
base_price: targetBundleItem.base_price
|
|
73
65
|
};
|
|
74
66
|
}
|
|
@@ -7,11 +7,25 @@ export declare class CustomerModule extends BaseModule implements Module, Custom
|
|
|
7
7
|
private store;
|
|
8
8
|
private request;
|
|
9
9
|
private cacheId;
|
|
10
|
+
/**
|
|
11
|
+
* 判断两份选中客户的核心展示字段是否一致,用于避免重复 clone / emit。
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* this.isSameSelectedCustomer(currentCustomer, nextCustomer);
|
|
15
|
+
*/
|
|
16
|
+
private isSameSelectedCustomer;
|
|
10
17
|
private openCache;
|
|
11
18
|
private fatherModule;
|
|
12
19
|
private otherParams;
|
|
13
20
|
constructor(name?: string, version?: string);
|
|
14
21
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* 更新父级解决方案透传的运行态参数,并刷新客户模块缓存配置。
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* customerModule.updateOtherParams({ isFranchisee: true, cacheId: 'cache-2' });
|
|
27
|
+
*/
|
|
28
|
+
updateOtherParams(params: Record<string, any>): void;
|
|
15
29
|
/**
|
|
16
30
|
* 获取客户列表数据(内部方法)
|
|
17
31
|
* @param params 查询参数
|
|
@@ -24,6 +38,12 @@ export declare class CustomerModule extends BaseModule implements Module, Custom
|
|
|
24
38
|
* @param operation 操作名称
|
|
25
39
|
*/
|
|
26
40
|
private handleCustomerListError;
|
|
41
|
+
/**
|
|
42
|
+
* 查询客户列表但不写入 customerList / pagination 状态。
|
|
43
|
+
*
|
|
44
|
+
* 用于按 ID 补齐客户等内部查询,避免把临时的 num/searchParams 污染到滚动列表。
|
|
45
|
+
*/
|
|
46
|
+
queryCustomerList(params?: ShopGetCustomerListParams): Promise<ICustomerListResponse>;
|
|
27
47
|
/**
|
|
28
48
|
* 获取客户列表
|
|
29
49
|
* @param params 查询参数
|
|
@@ -48,6 +48,29 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
48
48
|
this.openCache = false;
|
|
49
49
|
this.otherParams = {};
|
|
50
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* 判断两份选中客户的核心展示字段是否一致,用于避免重复 clone / emit。
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* this.isSameSelectedCustomer(currentCustomer, nextCustomer);
|
|
56
|
+
*/
|
|
57
|
+
isSameSelectedCustomer(current, next) {
|
|
58
|
+
const normalizedNext = !next ? import_constants.DEFAULT_CUSTOMER : next;
|
|
59
|
+
const normalizedCurrent = current || null;
|
|
60
|
+
if (!normalizedCurrent)
|
|
61
|
+
return false;
|
|
62
|
+
if (String((normalizedCurrent == null ? void 0 : normalizedCurrent.id) ?? "") === "1" && String((normalizedNext == null ? void 0 : normalizedNext.id) ?? "") === "1") {
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
const keys = [
|
|
66
|
+
"id",
|
|
67
|
+
"name",
|
|
68
|
+
"phone",
|
|
69
|
+
"email",
|
|
70
|
+
"country_calling_code"
|
|
71
|
+
];
|
|
72
|
+
return keys.every((key) => String((normalizedCurrent == null ? void 0 : normalizedCurrent[key]) ?? "") === String((normalizedNext == null ? void 0 : normalizedNext[key]) ?? ""));
|
|
73
|
+
}
|
|
51
74
|
async initialize(core, options) {
|
|
52
75
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
53
76
|
this.core = core;
|
|
@@ -75,7 +98,7 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
75
98
|
} else {
|
|
76
99
|
this.store.currentPage = 1;
|
|
77
100
|
}
|
|
78
|
-
if (typeof ((_e = options == null ? void 0 : options.initialState) == null ? void 0 : _e.pageSize) === "number") {
|
|
101
|
+
if (typeof ((_e = options == null ? void 0 : options.initialState) == null ? void 0 : _e.pageSize) === "number" && options.initialState.pageSize > 1) {
|
|
79
102
|
this.store.pageSize = options.initialState.pageSize;
|
|
80
103
|
} else {
|
|
81
104
|
this.store.pageSize = import_constants.DEFAULT_PAGE_SIZE;
|
|
@@ -91,6 +114,18 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
91
114
|
this.fatherModule = options.otherParams.fatherModule;
|
|
92
115
|
}
|
|
93
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* 更新父级解决方案透传的运行态参数,并刷新客户模块缓存配置。
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* customerModule.updateOtherParams({ isFranchisee: true, cacheId: 'cache-2' });
|
|
122
|
+
*/
|
|
123
|
+
updateOtherParams(params) {
|
|
124
|
+
this.otherParams = params || {};
|
|
125
|
+
this.openCache = this.otherParams.openCache ?? false;
|
|
126
|
+
this.cacheId = this.otherParams.cacheId;
|
|
127
|
+
this.fatherModule = this.otherParams.fatherModule;
|
|
128
|
+
}
|
|
94
129
|
/**
|
|
95
130
|
* 获取客户列表数据(内部方法)
|
|
96
131
|
* @param params 查询参数
|
|
@@ -152,6 +187,20 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
152
187
|
this.store.error
|
|
153
188
|
);
|
|
154
189
|
}
|
|
190
|
+
/**
|
|
191
|
+
* 查询客户列表但不写入 customerList / pagination 状态。
|
|
192
|
+
*
|
|
193
|
+
* 用于按 ID 补齐客户等内部查询,避免把临时的 num/searchParams 污染到滚动列表。
|
|
194
|
+
*/
|
|
195
|
+
async queryCustomerList(params = {}) {
|
|
196
|
+
const { customerList, total, page, pageSize } = await this.fetchCustomerListData(params);
|
|
197
|
+
return {
|
|
198
|
+
list: customerList,
|
|
199
|
+
total,
|
|
200
|
+
page,
|
|
201
|
+
pageSize
|
|
202
|
+
};
|
|
203
|
+
}
|
|
155
204
|
/**
|
|
156
205
|
* 获取客户列表
|
|
157
206
|
* @param params 查询参数
|
|
@@ -169,10 +218,6 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
169
218
|
this.store.total = total;
|
|
170
219
|
this.store.hasMore = page * pageSize < total;
|
|
171
220
|
this.store.customerList = (0, import_lodash_es.cloneDeep)(customerList);
|
|
172
|
-
await this.core.effects.emit(
|
|
173
|
-
`${this.name}:onCustomerListUpdate`,
|
|
174
|
-
this.store
|
|
175
|
-
);
|
|
176
221
|
this.triggerPaginationChange({
|
|
177
222
|
page,
|
|
178
223
|
pageSize,
|
|
@@ -192,6 +237,10 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
192
237
|
} finally {
|
|
193
238
|
this.store.loading = false;
|
|
194
239
|
this.storeChange();
|
|
240
|
+
await this.core.effects.emit(
|
|
241
|
+
`${this.name}:onCustomerListUpdate`,
|
|
242
|
+
this.store
|
|
243
|
+
);
|
|
195
244
|
}
|
|
196
245
|
}
|
|
197
246
|
/**
|
|
@@ -211,6 +260,9 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
211
260
|
* @param customer 选择的客户
|
|
212
261
|
*/
|
|
213
262
|
setSelectedCustomer(customer) {
|
|
263
|
+
if (this.isSameSelectedCustomer(this.store.selectedCustomer, customer)) {
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
214
266
|
this.store.selectedCustomer = !customer ? import_constants.DEFAULT_CUSTOMER : (0, import_lodash_es.cloneDeep)(customer);
|
|
215
267
|
this.core.effects.emit(
|
|
216
268
|
`${this.name}:onCustomerSelected`,
|
|
@@ -352,12 +404,13 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
352
404
|
try {
|
|
353
405
|
this.store.loadingMore = true;
|
|
354
406
|
this.store.error = null;
|
|
355
|
-
const
|
|
407
|
+
const loadMoreParams = {
|
|
356
408
|
skip: nextPage,
|
|
357
409
|
num: this.store.pageSize,
|
|
358
410
|
...this.store.searchParams
|
|
359
411
|
// 使用存储的搜索条件
|
|
360
|
-
}
|
|
412
|
+
};
|
|
413
|
+
const { customerList: newCustomers, total, page, pageSize } = await this.fetchCustomerListData(loadMoreParams);
|
|
361
414
|
const updatedCustomerList = [...this.store.customerList, ...(0, import_lodash_es.cloneDeep)(newCustomers)];
|
|
362
415
|
this.store.customerList = updatedCustomerList;
|
|
363
416
|
this.store.currentPage = page;
|
|
@@ -372,10 +425,6 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
372
425
|
hasMore: this.store.hasMore
|
|
373
426
|
}
|
|
374
427
|
);
|
|
375
|
-
await this.core.effects.emit(
|
|
376
|
-
`${this.name}:onCustomerListUpdate`,
|
|
377
|
-
this.store
|
|
378
|
-
);
|
|
379
428
|
this.triggerPaginationChange({
|
|
380
429
|
page,
|
|
381
430
|
pageSize,
|
|
@@ -396,6 +445,10 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
396
445
|
} finally {
|
|
397
446
|
this.store.loadingMore = false;
|
|
398
447
|
this.storeChange();
|
|
448
|
+
await this.core.effects.emit(
|
|
449
|
+
`${this.name}:onCustomerListUpdate`,
|
|
450
|
+
this.store
|
|
451
|
+
);
|
|
399
452
|
}
|
|
400
453
|
}
|
|
401
454
|
/**
|
|
@@ -110,6 +110,8 @@ export interface CustomerState {
|
|
|
110
110
|
export interface CustomerModuleAPI {
|
|
111
111
|
/** 获取客户列表 */
|
|
112
112
|
getCustomerList: (params?: ShopGetCustomerListParams) => Promise<ICustomerListResponse>;
|
|
113
|
+
/** 查询客户列表但不更新列表分页状态 */
|
|
114
|
+
queryCustomerList: (params?: ShopGetCustomerListParams) => Promise<ICustomerListResponse>;
|
|
113
115
|
/** 设置客户列表 */
|
|
114
116
|
setCustomerList: (customers: ShopCustomer[], total?: number) => void;
|
|
115
117
|
/** 设置当前选择的客户 */
|
|
@@ -23,7 +23,7 @@ export declare class DiscountModule extends BaseModule implements Module, Discou
|
|
|
23
23
|
customer_id: number;
|
|
24
24
|
with_wallet_pass_holder: 0 | 1;
|
|
25
25
|
request_timezone: string;
|
|
26
|
-
order_id?: number;
|
|
26
|
+
order_id?: number | string;
|
|
27
27
|
}): Promise<Discount[]>;
|
|
28
28
|
batchSearch(code: string, options?: {
|
|
29
29
|
customerId?: number;
|
|
@@ -93,12 +93,19 @@ var DiscountModule = class extends import_BaseModule.BaseModule {
|
|
|
93
93
|
}
|
|
94
94
|
async loadPrepareConfig(params) {
|
|
95
95
|
var _a, _b;
|
|
96
|
+
if (typeof params.order_id === "string" && params.order_id.startsWith("LOCAL_")) {
|
|
97
|
+
params.order_id = void 0;
|
|
98
|
+
}
|
|
96
99
|
const prepareConfig = await this.request.post(
|
|
97
100
|
`/order/prepare/config`,
|
|
98
101
|
params
|
|
99
102
|
);
|
|
103
|
+
const rawDiscountList = [
|
|
104
|
+
...((_a = prepareConfig == null ? void 0 : prepareConfig.data) == null ? void 0 : _a.good_pass_list) || [],
|
|
105
|
+
...((_b = prepareConfig == null ? void 0 : prepareConfig.data) == null ? void 0 : _b.discount_card_list) || []
|
|
106
|
+
];
|
|
100
107
|
const goodPassList = this.filterEnabledDiscountList(
|
|
101
|
-
|
|
108
|
+
rawDiscountList
|
|
102
109
|
) || [];
|
|
103
110
|
return goodPassList;
|
|
104
111
|
}
|
|
@@ -249,6 +256,7 @@ var DiscountModule = class extends import_BaseModule.BaseModule {
|
|
|
249
256
|
this.core.effects.offByModuleDestroy(this.name);
|
|
250
257
|
await this.core.effects.emit(`${this.name}:onDestroy`, {});
|
|
251
258
|
console.log("[Discount] 已销毁");
|
|
259
|
+
super.destroy();
|
|
252
260
|
}
|
|
253
261
|
async clear() {
|
|
254
262
|
this.store.discountList = [];
|
|
@@ -140,6 +140,7 @@ export interface Discount {
|
|
|
140
140
|
appliedProductDetails: ApplicableProductDetails[];
|
|
141
141
|
isDisabledForProductUsed?: boolean;
|
|
142
142
|
amount?: number;
|
|
143
|
+
customer_id?: number | string | null;
|
|
143
144
|
extension_data?: ExtensionData[];
|
|
144
145
|
total_order_behavior_count?: number;
|
|
145
146
|
today_order_behavior_count?: number;
|
|
@@ -9,6 +9,7 @@ export declare class OpenDataModule extends BaseModule implements Module {
|
|
|
9
9
|
protected defaultVersion: string;
|
|
10
10
|
private request;
|
|
11
11
|
private window;
|
|
12
|
+
private appPlugin;
|
|
12
13
|
private store;
|
|
13
14
|
private cacheId;
|
|
14
15
|
private openCache;
|
|
@@ -16,6 +17,13 @@ export declare class OpenDataModule extends BaseModule implements Module {
|
|
|
16
17
|
private otherParams;
|
|
17
18
|
constructor(name?: string, version?: string);
|
|
18
19
|
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* 更新父级解决方案透传的运行态参数,并刷新 OpenData 缓存配置。
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* openDataModule.updateOtherParams({ openCache: true, cacheId: 'cache-2' })
|
|
25
|
+
*/
|
|
26
|
+
updateOtherParams(params: Record<string, any>): void;
|
|
19
27
|
fetchOpenData(params: OpenDataFetchParams): Promise<OpenDataConfig>;
|
|
20
28
|
getOpenData(): OpenDataConfig | null;
|
|
21
29
|
getLastFetchedAt(): number | null;
|
|
@@ -52,18 +52,32 @@ var OpenDataModule = class extends import_BaseModule.BaseModule {
|
|
|
52
52
|
}
|
|
53
53
|
this.request = core.getPlugin("request");
|
|
54
54
|
this.window = core.getPlugin("window");
|
|
55
|
+
this.appPlugin = core.getPlugin("app");
|
|
55
56
|
if (!this.request)
|
|
56
57
|
throw new Error("OpenDataModule 需要 request 插件支持");
|
|
57
58
|
if (!this.window)
|
|
58
59
|
throw new Error("OpenDataModule 需要 window 插件支持");
|
|
59
60
|
console.log("[OpenDataModule] 初始化完成");
|
|
60
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* 更新父级解决方案透传的运行态参数,并刷新 OpenData 缓存配置。
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* openDataModule.updateOtherParams({ openCache: true, cacheId: 'cache-2' })
|
|
67
|
+
*/
|
|
68
|
+
updateOtherParams(params) {
|
|
69
|
+
this.otherParams = params || {};
|
|
70
|
+
this.openCache = this.otherParams.openCache ?? false;
|
|
71
|
+
this.cacheId = this.otherParams.cacheId;
|
|
72
|
+
this.fatherModule = this.otherParams.fatherModule;
|
|
73
|
+
}
|
|
61
74
|
async fetchOpenData(params) {
|
|
62
|
-
var _a, _b
|
|
63
|
-
const
|
|
75
|
+
var _a, _b;
|
|
76
|
+
const getData = (_b = (_a = this.appPlugin).getData) == null ? void 0 : _b.call(_a);
|
|
77
|
+
const shopId = getData == null ? void 0 : getData("shop_id");
|
|
64
78
|
if (!shopId)
|
|
65
79
|
throw new Error("[OpenDataModule] 无法获取 shop_id");
|
|
66
|
-
const tenantId =
|
|
80
|
+
const tenantId = getData == null ? void 0 : getData("tenant_id");
|
|
67
81
|
const headers = {};
|
|
68
82
|
if (tenantId)
|
|
69
83
|
headers["Tenant-Id"] = String(tenantId);
|
|
@@ -74,7 +88,7 @@ var OpenDataModule = class extends import_BaseModule.BaseModule {
|
|
|
74
88
|
target: params.target,
|
|
75
89
|
section_code: params.section_code
|
|
76
90
|
},
|
|
77
|
-
{ pisell2: true, headers }
|
|
91
|
+
{ pisell2: true, isPisell2: true, prefix: false, headers }
|
|
78
92
|
);
|
|
79
93
|
if ((response == null ? void 0 : response.status) === false) {
|
|
80
94
|
throw new Error((response == null ? void 0 : response.message) || "获取 OpenData 配置失败");
|
|
@@ -92,7 +106,7 @@ var OpenDataModule = class extends import_BaseModule.BaseModule {
|
|
|
92
106
|
}
|
|
93
107
|
checkAvailability(scheduleModule) {
|
|
94
108
|
var _a;
|
|
95
|
-
const scheduleList = scheduleModule ? scheduleModule.getScheduleListByIds(
|
|
109
|
+
const scheduleList = scheduleModule ? scheduleModule == null ? void 0 : scheduleModule.getScheduleListByIds(
|
|
96
110
|
((_a = this.store.data) == null ? void 0 : _a["availability.operating_hours"]) || []
|
|
97
111
|
) : void 0;
|
|
98
112
|
return (0, import_utils.computeAvailability)({
|