@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,283 @@
|
|
|
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/productExtend.ts
|
|
30
|
+
var productExtend_exports = {};
|
|
31
|
+
__export(productExtend_exports, {
|
|
32
|
+
derivePresetStartTimeFromDate: () => derivePresetStartTimeFromDate,
|
|
33
|
+
getIsAutoClose: () => getIsAutoClose,
|
|
34
|
+
getProductExtend: () => getProductExtend,
|
|
35
|
+
getServiceStartTimeAndEndTime: () => getServiceStartTimeAndEndTime,
|
|
36
|
+
getSumCapacity: () => import_resources.getSumCapacity,
|
|
37
|
+
getTimeObj: () => getTimeObj
|
|
38
|
+
});
|
|
39
|
+
module.exports = __toCommonJS(productExtend_exports);
|
|
40
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
41
|
+
var import_resources = require("./resources");
|
|
42
|
+
var import_resourceSelection = require("./resourceSelection");
|
|
43
|
+
var import_serviceTimes = require("./serviceTimes");
|
|
44
|
+
var import_timeSlices = require("./timeSlices");
|
|
45
|
+
var import_flexible = require("./flexible");
|
|
46
|
+
function derivePresetStartTimeFromDate(date) {
|
|
47
|
+
if (date == null)
|
|
48
|
+
return void 0;
|
|
49
|
+
const d = (0, import_dayjs.default)(date);
|
|
50
|
+
if (!d.isValid())
|
|
51
|
+
return void 0;
|
|
52
|
+
const hhmm = d.format("HH:mm");
|
|
53
|
+
if (hhmm === "00:00")
|
|
54
|
+
return void 0;
|
|
55
|
+
return hhmm;
|
|
56
|
+
}
|
|
57
|
+
function getAppointmentTimingPreference(ctx) {
|
|
58
|
+
var _a, _b, _c;
|
|
59
|
+
return ((_c = (_b = (_a = ctx == null ? void 0 : ctx.bookingConfig) == null ? void 0 : _a.config) == null ? void 0 : _b.information_tab) == null ? void 0 : _c.appointment_timing_preference) || "sequential";
|
|
60
|
+
}
|
|
61
|
+
function getFlexibleOption(params) {
|
|
62
|
+
var _a, _b, _c, _d, _e;
|
|
63
|
+
const { cacheItem, useStartTime } = params;
|
|
64
|
+
const duration = (0, import_flexible.getDurationValue)(cacheItem == null ? void 0 : cacheItem.duration);
|
|
65
|
+
if (duration !== "flexible")
|
|
66
|
+
return null;
|
|
67
|
+
const startDate = (0, import_dayjs.default)(
|
|
68
|
+
`${(0, import_dayjs.default)((_a = cacheItem == null ? void 0 : cacheItem._extend) == null ? void 0 : _a.start_date).format("YYYY-MM-DD")} ${useStartTime || ((_b = cacheItem == null ? void 0 : cacheItem._extend) == null ? void 0 : _b.start_time) || "00:00"}`
|
|
69
|
+
);
|
|
70
|
+
const usable = (0, import_resources.getUsableTime)(cacheItem);
|
|
71
|
+
const usableEndAt = ((_d = (_c = usable == null ? void 0 : usable._extend) == null ? void 0 : _c.usableTime) == null ? void 0 : _d.end_at) ? (0, import_dayjs.default)(usable._extend.usableTime.end_at) : null;
|
|
72
|
+
const endDate = (0, import_timeSlices.getEndDate)(
|
|
73
|
+
startDate,
|
|
74
|
+
"flexible",
|
|
75
|
+
usableEndAt,
|
|
76
|
+
(_e = params.ctx) == null ? void 0 : _e.shopOpeningHours
|
|
77
|
+
);
|
|
78
|
+
const timeValue = endDate.diff(startDate, "minute");
|
|
79
|
+
return { label: String(timeValue), value: import_flexible.flexibleObj.create(timeValue) };
|
|
80
|
+
}
|
|
81
|
+
function getTimeObj(params) {
|
|
82
|
+
var _a, _b, _c;
|
|
83
|
+
const { cacheItem, useStartTime, useDuration, ctx } = params;
|
|
84
|
+
const isMultiDay = (0, import_serviceTimes.isMultiDayProduct)(cacheItem);
|
|
85
|
+
const flexibleOption = getFlexibleOption({ cacheItem, useStartTime, ctx });
|
|
86
|
+
const baseSlices = (0, import_timeSlices.sliceDayIntoFiveMinutes)(
|
|
87
|
+
(_c = (_b = (_a = ctx == null ? void 0 : ctx.bookingConfig) == null ? void 0 : _a.config) == null ? void 0 : _b.basic) == null ? void 0 : _c.service_time,
|
|
88
|
+
isMultiDay
|
|
89
|
+
);
|
|
90
|
+
const timeSlices = [...baseSlices.timeSlices];
|
|
91
|
+
const durationSlicesBasedOnTime = [...baseSlices.durationSlicesBasedOnTime];
|
|
92
|
+
if (flexibleOption) {
|
|
93
|
+
durationSlicesBasedOnTime.unshift(flexibleOption);
|
|
94
|
+
}
|
|
95
|
+
if (useDuration && !durationSlicesBasedOnTime.some((d) => d.value === useDuration)) {
|
|
96
|
+
durationSlicesBasedOnTime.unshift({
|
|
97
|
+
label: String(useDuration),
|
|
98
|
+
value: useDuration
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
return { timeSlices, durationSlicesBasedOnTime };
|
|
102
|
+
}
|
|
103
|
+
function getServiceStartTimeAndEndTime(params) {
|
|
104
|
+
var _a, _b, _c, _d, _e;
|
|
105
|
+
const { cacheItem, timeObj, ctx } = params;
|
|
106
|
+
if (cacheItem == null ? void 0 : cacheItem.isCustomItem) {
|
|
107
|
+
return { duration: null };
|
|
108
|
+
}
|
|
109
|
+
const appointmentTimingPreference = getAppointmentTimingPreference(ctx);
|
|
110
|
+
const lastServer = ctx.previousService || null;
|
|
111
|
+
const resolveDuration = () => {
|
|
112
|
+
var _a2;
|
|
113
|
+
if ((0, import_serviceTimes.isMultiDayProduct)(cacheItem))
|
|
114
|
+
return (0, import_serviceTimes.getDays)(cacheItem, "days");
|
|
115
|
+
return (0, import_timeSlices.findNextDuration)(cacheItem.duration, timeObj.durationSlicesBasedOnTime, (_a2 = cacheItem == null ? void 0 : cacheItem.duration) == null ? void 0 : _a2.value);
|
|
116
|
+
};
|
|
117
|
+
let _extend = { duration: resolveDuration() };
|
|
118
|
+
if (lastServer) {
|
|
119
|
+
const lastStart = (_a = lastServer._extend) == null ? void 0 : _a.startDate;
|
|
120
|
+
const lastEnd = (_b = lastServer._extend) == null ? void 0 : _b.endDate;
|
|
121
|
+
if (appointmentTimingPreference === "parallel") {
|
|
122
|
+
_extend.start_time = (0, import_dayjs.default)(lastStart).format("HH:mm");
|
|
123
|
+
} else if ((0, import_dayjs.default)(lastEnd).isAfter((0, import_dayjs.default)(lastStart), "day")) {
|
|
124
|
+
_extend.start_time = (_c = timeObj.timeSlices[timeObj.timeSlices.length - 1]) == null ? void 0 : _c.value;
|
|
125
|
+
} else {
|
|
126
|
+
_extend.start_time = lastEnd ? (0, import_dayjs.default)(lastEnd).format("HH:mm") : (0, import_dayjs.default)().format("HH:mm");
|
|
127
|
+
}
|
|
128
|
+
} else {
|
|
129
|
+
const presetStartTime = ctx.presetStartTime;
|
|
130
|
+
if (presetStartTime && presetStartTime !== "00:00") {
|
|
131
|
+
_extend.start_time = presetStartTime;
|
|
132
|
+
} else if (cacheItem.currentDefaultTime) {
|
|
133
|
+
_extend.start_time = cacheItem.currentDefaultTime;
|
|
134
|
+
} else {
|
|
135
|
+
_extend.start_time = (0, import_dayjs.default)().format("HH:mm");
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
_extend = { ..._extend, ...cacheItem._extend };
|
|
139
|
+
const { startDate, endDate } = (0, import_serviceTimes.getServiceTimes)({ ...cacheItem, _extend });
|
|
140
|
+
_extend.startDate = startDate;
|
|
141
|
+
_extend.endDate = endDate;
|
|
142
|
+
if ((0, import_serviceTimes.isMultiDayProduct)(cacheItem)) {
|
|
143
|
+
_extend.start_time = _extend.start_time || startDate.format("HH:mm");
|
|
144
|
+
_extend.end_time = _extend.end_time || endDate.format("HH:mm");
|
|
145
|
+
_extend.start_date = _extend.start_date ?? startDate;
|
|
146
|
+
_extend.end_date = _extend.end_date ?? endDate;
|
|
147
|
+
}
|
|
148
|
+
const session = (_e = (_d = cacheItem == null ? void 0 : cacheItem._extend) == null ? void 0 : _d.other) == null ? void 0 : _e.session;
|
|
149
|
+
if ((0, import_serviceTimes.isSessionProduct)(cacheItem) && session) {
|
|
150
|
+
const baseDate = ctx.date ? (0, import_dayjs.default)(ctx.date) : (0, import_dayjs.default)();
|
|
151
|
+
const startAt = (0, import_dayjs.default)(`${baseDate.format("YYYY-MM-DD")} ${(0, import_dayjs.default)(session.start_at).format("HH:mm:ss")}`);
|
|
152
|
+
const endAt = (0, import_dayjs.default)(`${baseDate.format("YYYY-MM-DD")} ${(0, import_dayjs.default)(session.end_at).format("HH:mm:ss")}`);
|
|
153
|
+
_extend.start_date = startAt;
|
|
154
|
+
_extend.startDate = startAt;
|
|
155
|
+
_extend.start_time = session.start_time;
|
|
156
|
+
_extend.end_date = endAt;
|
|
157
|
+
_extend.endDate = endAt;
|
|
158
|
+
_extend.end_time = session.end_time;
|
|
159
|
+
_extend.duration = (0, import_serviceTimes.getDays)({ _extend }, "minutes");
|
|
160
|
+
}
|
|
161
|
+
return _extend;
|
|
162
|
+
}
|
|
163
|
+
function getProductExtend(params) {
|
|
164
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
165
|
+
const { cacheItem, ctx, isDisabledTime } = params;
|
|
166
|
+
const isNew = cacheItem.new || !((_a = cacheItem._extend) == null ? void 0 : _a.endDate);
|
|
167
|
+
const _cacheItem = { ...cacheItem };
|
|
168
|
+
const resourcesOriginMap = ctx.resourcesOriginMap || {};
|
|
169
|
+
_cacheItem._data = {};
|
|
170
|
+
if ((0, import_serviceTimes.isMultiDayProduct)(cacheItem)) {
|
|
171
|
+
_cacheItem._extend = _cacheItem._extend || {};
|
|
172
|
+
_cacheItem._extend.holder_id = ((_b = cacheItem == null ? void 0 : cacheItem._extend) == null ? void 0 : _b.holder_id) || [];
|
|
173
|
+
_cacheItem._extend.sub_type = "days";
|
|
174
|
+
}
|
|
175
|
+
if (isNew) {
|
|
176
|
+
_cacheItem._data.timeObj = getTimeObj({ cacheItem, ctx });
|
|
177
|
+
_cacheItem._extend = getServiceStartTimeAndEndTime({
|
|
178
|
+
cacheItem,
|
|
179
|
+
timeObj: _cacheItem._data.timeObj,
|
|
180
|
+
ctx
|
|
181
|
+
});
|
|
182
|
+
_cacheItem._data.capacitys = cacheItem.capacity;
|
|
183
|
+
_cacheItem._data.resourcesOrigin = (0, import_resources.getResourceByIds)(resourcesOriginMap, cacheItem, {
|
|
184
|
+
resourceTab: (_d = (_c = ctx == null ? void 0 : ctx.bookingConfig) == null ? void 0 : _c.config) == null ? void 0 : _d.resource_tab,
|
|
185
|
+
resourcesOrigin: ctx.resourcesOrigin || []
|
|
186
|
+
});
|
|
187
|
+
_cacheItem._extend.capacity = (0, import_resources.setDefaultCapacitys)({
|
|
188
|
+
capacitys: _cacheItem._data.capacitys,
|
|
189
|
+
cacheItem: _cacheItem
|
|
190
|
+
});
|
|
191
|
+
const { list, maps } = (0, import_resources.formatResources)({
|
|
192
|
+
cacheItem: _cacheItem,
|
|
193
|
+
resourcesOrigin: _cacheItem._data.resourcesOrigin
|
|
194
|
+
});
|
|
195
|
+
_cacheItem._data.resources = list;
|
|
196
|
+
_cacheItem._data.resourceMaps = maps;
|
|
197
|
+
_cacheItem._extend.resource = (0, import_resources.setDefaultResource)({
|
|
198
|
+
cacheItem: _cacheItem,
|
|
199
|
+
resources: _cacheItem._data.resources,
|
|
200
|
+
resourceIdFromCalendar: ctx.resourceIdFromCalendar,
|
|
201
|
+
isAutoAllocationOn: ctx.isAutoAllocationOn
|
|
202
|
+
});
|
|
203
|
+
if ((0, import_flexible.isProductFlexibleDuration)(_cacheItem == null ? void 0 : _cacheItem.duration)) {
|
|
204
|
+
_cacheItem._data.timeObj = getTimeObj({
|
|
205
|
+
cacheItem: _cacheItem,
|
|
206
|
+
useStartTime: _cacheItem._extend.start_time,
|
|
207
|
+
ctx
|
|
208
|
+
});
|
|
209
|
+
_cacheItem._extend.duration = (_g = (_f = (_e = _cacheItem._data.timeObj) == null ? void 0 : _e.durationSlicesBasedOnTime) == null ? void 0 : _f[0]) == null ? void 0 : _g.value;
|
|
210
|
+
const { endDate } = (0, import_serviceTimes.getServiceTimes)(_cacheItem);
|
|
211
|
+
_cacheItem._extend.endDate = endDate;
|
|
212
|
+
}
|
|
213
|
+
_cacheItem.autoClose = getIsAutoClose(_cacheItem, ctx.isAutoAllocationOn || (() => true));
|
|
214
|
+
if (_cacheItem._extend.bundle_edit !== void 0) {
|
|
215
|
+
_cacheItem._extend.bundle_edit = 1;
|
|
216
|
+
}
|
|
217
|
+
if (!isDisabledTime) {
|
|
218
|
+
_cacheItem._time = (/* @__PURE__ */ new Date()).getTime();
|
|
219
|
+
}
|
|
220
|
+
} else {
|
|
221
|
+
if (!_cacheItem._data.capacitys) {
|
|
222
|
+
_cacheItem._data.capacitys = cacheItem.capacity;
|
|
223
|
+
}
|
|
224
|
+
if (!_cacheItem._data.resourcesOrigin) {
|
|
225
|
+
const extraResources = [];
|
|
226
|
+
if (Array.isArray((_h = _cacheItem._extend) == null ? void 0 : _h.event_resources)) {
|
|
227
|
+
_cacheItem._extend.event_resources.forEach((er) => {
|
|
228
|
+
extraResources.push({ form_id: er.form_id, id: er.relation_id });
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
_cacheItem._data.resourcesOrigin = (0, import_resources.getResourceByIds)(resourcesOriginMap, cacheItem, {
|
|
232
|
+
extraResources,
|
|
233
|
+
resourceTab: (_j = (_i = ctx == null ? void 0 : ctx.bookingConfig) == null ? void 0 : _i.config) == null ? void 0 : _j.resource_tab,
|
|
234
|
+
resourcesOrigin: ctx.resourcesOrigin || []
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
if (!_cacheItem._data.resources) {
|
|
238
|
+
const { list, maps } = (0, import_resources.formatResources)({
|
|
239
|
+
cacheItem: _cacheItem,
|
|
240
|
+
resourcesOrigin: _cacheItem._data.resourcesOrigin
|
|
241
|
+
});
|
|
242
|
+
_cacheItem._data.resources = list;
|
|
243
|
+
_cacheItem._data.resourceMaps = maps;
|
|
244
|
+
}
|
|
245
|
+
_cacheItem._data.timeObj = getTimeObj({
|
|
246
|
+
cacheItem: _cacheItem,
|
|
247
|
+
useStartTime: (_k = _cacheItem._extend) == null ? void 0 : _k.start_time,
|
|
248
|
+
ctx
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
return _cacheItem;
|
|
252
|
+
}
|
|
253
|
+
function getIsAutoClose(cacheItem, isAutoAllocationOn) {
|
|
254
|
+
var _a, _b, _c, _d, _e;
|
|
255
|
+
if ((0, import_resourceSelection.productNeedsResourceExtend)(cacheItem) && !(0, import_resourceSelection.hasActualResourceSelection)(cacheItem)) {
|
|
256
|
+
return false;
|
|
257
|
+
}
|
|
258
|
+
if (((_b = (_a = cacheItem._data) == null ? void 0 : _a.capacitys) == null ? void 0 : _b.type) !== "custom") {
|
|
259
|
+
const resources = ((_c = cacheItem == null ? void 0 : cacheItem._data) == null ? void 0 : _c.resources) || [];
|
|
260
|
+
if (resources.length === 1) {
|
|
261
|
+
const first = resources[0];
|
|
262
|
+
if (((_d = first.select_type) == null ? void 0 : _d.type) === "single" && (first.default_resource || []).length > 0) {
|
|
263
|
+
return true;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
const entries = Object.entries(((_e = cacheItem._extend) == null ? void 0 : _e.resource) || {});
|
|
268
|
+
if (entries.length === 0) {
|
|
269
|
+
return !(0, import_resourceSelection.productNeedsResourceExtend)(cacheItem);
|
|
270
|
+
}
|
|
271
|
+
return entries.every(
|
|
272
|
+
([key, value]) => isAutoAllocationOn(key) && Array.isArray(value) && value.length > 0
|
|
273
|
+
);
|
|
274
|
+
}
|
|
275
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
276
|
+
0 && (module.exports = {
|
|
277
|
+
derivePresetStartTimeFromDate,
|
|
278
|
+
getIsAutoClose,
|
|
279
|
+
getProductExtend,
|
|
280
|
+
getServiceStartTimeAndEndTime,
|
|
281
|
+
getSumCapacity,
|
|
282
|
+
getTimeObj
|
|
283
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 结构化的「资源不可用」原因(替代 info2 `getErrorList` 输出的 i18n 文案 + type 字段)。
|
|
3
|
+
*
|
|
4
|
+
* 与 info2 type 字段映射:
|
|
5
|
+
* - `no_product` ↔ type='products'
|
|
6
|
+
* - `time_out_of_range` ↔ type='time'
|
|
7
|
+
* - `count_out_of_range` ↔ type='limit'
|
|
8
|
+
* - `resource_unbound` ↔ type='unbound'
|
|
9
|
+
*
|
|
10
|
+
* OS 这边不耦合 i18n 文案,UI 拿到 reason + params 后自行渲染(参考 docs/SDK 中给出的 i18n key 对照表)。
|
|
11
|
+
*/
|
|
12
|
+
export type ResourceUnavailableReason = 'no_product' | 'time_out_of_range' | 'count_out_of_range' | 'resource_unbound';
|
|
13
|
+
export interface ResourceError {
|
|
14
|
+
reason: ResourceUnavailableReason;
|
|
15
|
+
params: {
|
|
16
|
+
/** 资源名(time / limit 用)。 */
|
|
17
|
+
labelText?: string;
|
|
18
|
+
/** 起始时间(time / limit 用,格式 'hh:mm A')。 */
|
|
19
|
+
startText?: string;
|
|
20
|
+
/** 结束时间(time / limit 用,格式 'hh:mm A')。 */
|
|
21
|
+
endText?: string;
|
|
22
|
+
/**
|
|
23
|
+
* 结束时间是否跨到第二天。UI 收到 true 时可在 endText 前加 'tomorrow' / '明天' 前缀。
|
|
24
|
+
* 与 info2 旧实现「endText = locales.getText('pisell1.text.tomorrow') + endText」等价。
|
|
25
|
+
*/
|
|
26
|
+
isCrossDay?: boolean;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* 替代 info2 `utilsByBooking.ts#getErrorList`,输出结构化错误。
|
|
31
|
+
*
|
|
32
|
+
* 行为对齐:
|
|
33
|
+
* 1. cacheItem 没有 id → `no_product`(与 info2 `!cacheItem?.id` 分支等价)。
|
|
34
|
+
* 2. 资源 null / 无 _extend → 返回 []。
|
|
35
|
+
* 3. resource.usable=false 时:
|
|
36
|
+
* - 没有 _extend.usableTime → `time_out_of_range`
|
|
37
|
+
* - 有 usableTime 但 `_extend.isCountRange=false` → `count_out_of_range`
|
|
38
|
+
* 4. resource.unbound=true → 追加 `resource_unbound`。
|
|
39
|
+
* 5. 不再耦合 `_data.resourceMaps[form_id].type === 'single'` 判断(与 info2 实际未使用此变量一致)。
|
|
40
|
+
*/
|
|
41
|
+
export declare function getResourceErrors(resource: any, cacheItem: any): ResourceError[];
|
|
@@ -0,0 +1,80 @@
|
|
|
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/resourceErrors.ts
|
|
30
|
+
var resourceErrors_exports = {};
|
|
31
|
+
__export(resourceErrors_exports, {
|
|
32
|
+
getResourceErrors: () => getResourceErrors
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(resourceErrors_exports);
|
|
35
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
36
|
+
var import_serviceTimes = require("./serviceTimes");
|
|
37
|
+
function getResourceErrors(resource, cacheItem) {
|
|
38
|
+
var _a, _b, _c, _d;
|
|
39
|
+
if (!(cacheItem == null ? void 0 : cacheItem.id)) {
|
|
40
|
+
return [{ reason: "no_product", params: {} }];
|
|
41
|
+
}
|
|
42
|
+
if (!resource)
|
|
43
|
+
return [];
|
|
44
|
+
const list = [];
|
|
45
|
+
if (!resource.usable) {
|
|
46
|
+
const { startDate, endDate } = (0, import_serviceTimes.getServiceTimes)(cacheItem);
|
|
47
|
+
const startText = startDate.format("hh:mm A");
|
|
48
|
+
const endText = endDate.format("hh:mm A");
|
|
49
|
+
const isCrossDay = (0, import_dayjs.default)(endDate).isAfter(startDate, "day");
|
|
50
|
+
if (!((_a = resource._extend) == null ? void 0 : _a.usableTime)) {
|
|
51
|
+
list.push({
|
|
52
|
+
reason: "time_out_of_range",
|
|
53
|
+
params: {
|
|
54
|
+
labelText: resource.labelText,
|
|
55
|
+
startText,
|
|
56
|
+
endText,
|
|
57
|
+
isCrossDay
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
} else if (!((_d = (_c = (_b = resource._extend) == null ? void 0 : _b.usableTime) == null ? void 0 : _c._extend) == null ? void 0 : _d.isCountRange)) {
|
|
61
|
+
list.push({
|
|
62
|
+
reason: "count_out_of_range",
|
|
63
|
+
params: {
|
|
64
|
+
labelText: resource.labelText,
|
|
65
|
+
startText,
|
|
66
|
+
endText,
|
|
67
|
+
isCrossDay
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (resource.unbound) {
|
|
73
|
+
list.push({ reason: "resource_unbound", params: {} });
|
|
74
|
+
}
|
|
75
|
+
return list;
|
|
76
|
+
}
|
|
77
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
78
|
+
0 && (module.exports = {
|
|
79
|
+
getResourceErrors
|
|
80
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 预约商品资源是否「需要补齐 / 已选中」——供 getProductExtend 门禁与 getIsAutoClose 共用。
|
|
3
|
+
*/
|
|
4
|
+
/** 商品是否挂了生效的资源表单(product_resource.resources status=1)。 */
|
|
5
|
+
export declare function productNeedsResourceExtend(cacheItem: any): boolean;
|
|
6
|
+
/** `_extend.resource` 是否至少有一类表单选中了具体资源。 */
|
|
7
|
+
export declare function hasActualResourceSelection(cacheItem: any): boolean;
|
|
@@ -0,0 +1,46 @@
|
|
|
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/resourceSelection.ts
|
|
20
|
+
var resourceSelection_exports = {};
|
|
21
|
+
__export(resourceSelection_exports, {
|
|
22
|
+
hasActualResourceSelection: () => hasActualResourceSelection,
|
|
23
|
+
productNeedsResourceExtend: () => productNeedsResourceExtend
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(resourceSelection_exports);
|
|
26
|
+
function productNeedsResourceExtend(cacheItem) {
|
|
27
|
+
var _a;
|
|
28
|
+
const forms = (_a = cacheItem == null ? void 0 : cacheItem.product_resource) == null ? void 0 : _a.resources;
|
|
29
|
+
if (!Array.isArray(forms))
|
|
30
|
+
return false;
|
|
31
|
+
return forms.some((d) => Number(d == null ? void 0 : d.status) === 1);
|
|
32
|
+
}
|
|
33
|
+
function hasActualResourceSelection(cacheItem) {
|
|
34
|
+
var _a;
|
|
35
|
+
const resource = (_a = cacheItem == null ? void 0 : cacheItem._extend) == null ? void 0 : _a.resource;
|
|
36
|
+
if (!resource || typeof resource !== "object")
|
|
37
|
+
return false;
|
|
38
|
+
return Object.values(resource).some(
|
|
39
|
+
(rows) => Array.isArray(rows) && rows.length > 0
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
+
0 && (module.exports = {
|
|
44
|
+
hasActualResourceSelection,
|
|
45
|
+
productNeedsResourceExtend
|
|
46
|
+
});
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 资源运行态计算 helper(搬自 info2 `utilsByBooking.ts` + `service/addService/utils.tsx`)。
|
|
3
|
+
*
|
|
4
|
+
* 本文件输入输出全部为 plain object,不依赖 React / locales / @pisell/icon / mini-redux。
|
|
5
|
+
* 调用方传入:resource origin map(`/form/schedule` 返回) / cacheItem(含 `_extend.duration / _extend.start_date / _extend.start_time` 等)。
|
|
6
|
+
*
|
|
7
|
+
* 三个 info2 独有特性保留:
|
|
8
|
+
* 1. `resource_display_scope='all'`:取全部资源
|
|
9
|
+
* 2. `extraResources`:拖入未绑定资源时兼容渲染
|
|
10
|
+
* 3. `getNoResource2()`:占位"无资源"行
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* 从已选资源中取「最早结束」的 usableTime,供灵活时长计算上限。
|
|
14
|
+
* 与 info2 `service/addService/utils.tsx#getUsableTime` 等价。
|
|
15
|
+
*/
|
|
16
|
+
export declare function getUsableTime(cacheItem: any): any | null;
|
|
17
|
+
/** Σ cacheItem._extend.capacity[].value × _extend.quantity。 */
|
|
18
|
+
export declare function getSumCapacity(cacheItem: any, isCalcQuantity?: boolean): number;
|
|
19
|
+
/**
|
|
20
|
+
* 判断单个 time 是否可用,写回 `_extend` 标记位(isDateRange / isCountRange / isUsable / isMaxLimitRange)。
|
|
21
|
+
* 与 info2 `utilsByBooking.ts#getResourceTimeIsUsable` 等价。
|
|
22
|
+
*/
|
|
23
|
+
export declare function getResourceTimeIsUsable(item: any, cacheItem: any, resourceItem: any): any;
|
|
24
|
+
/**
|
|
25
|
+
* 在 resource.times 中找到最佳可用 time,并写回 `_extend.usableTime`。
|
|
26
|
+
* 与 info2 `utilsByBooking.ts#formatTimes` 等价。
|
|
27
|
+
*/
|
|
28
|
+
export declare function formatTimes(resourceItem: any, cacheItem: any): any;
|
|
29
|
+
/**
|
|
30
|
+
* 单个 resource 的整体可用性 + labelText 填充。
|
|
31
|
+
* 与 info2 `utilsByBooking.ts#formatResource` 等价;不再接收 formatLabel 回调(OS 不渲染 JSX)。
|
|
32
|
+
*/
|
|
33
|
+
export declare function formatResource(resourceItem: any, cacheItem?: any): any;
|
|
34
|
+
/**
|
|
35
|
+
* 把单个 resource origin 类型(如「技师」)的 renderList 中每个资源跑一遍 formatResource,
|
|
36
|
+
* 并维护 unbound 标记(拖入未绑定资源时 UI 用)。
|
|
37
|
+
* 与 info2 `service/addService/utils.tsx#formatResources` 等价(剥 JSX)。
|
|
38
|
+
*/
|
|
39
|
+
export declare function formatResources(params: {
|
|
40
|
+
cacheItem: any;
|
|
41
|
+
resourcesOrigin: any[];
|
|
42
|
+
}): {
|
|
43
|
+
list: any[];
|
|
44
|
+
maps: Record<string, any>;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* 计算每类资源的默认值(写入 cacheItem._extend.resource)。
|
|
48
|
+
* 与 info2 `service/addService/utils.tsx#setDefaultResource` 等价;
|
|
49
|
+
* `resourceIdFromCalendar` 替代原版 sessionStorage `serviceParams.resource_id` 读取。
|
|
50
|
+
*/
|
|
51
|
+
export declare function setDefaultResource(params: {
|
|
52
|
+
cacheItem: any;
|
|
53
|
+
resources: any[];
|
|
54
|
+
resourceIdFromCalendar?: number;
|
|
55
|
+
isAutoAllocationOn?: (formId: any) => boolean;
|
|
56
|
+
}): Record<string, any[]>;
|
|
57
|
+
/**
|
|
58
|
+
* 计算默认容量(与 info2 `setDefaultCapacitys` 等价)。
|
|
59
|
+
* package:按 _extend.other.bundle 拆 quantity;custom:按 capacity.custom[].min;其他:[{id:0,value:1}]。
|
|
60
|
+
*/
|
|
61
|
+
export declare function setDefaultCapacitys(params: {
|
|
62
|
+
capacitys: any;
|
|
63
|
+
cacheItem: any;
|
|
64
|
+
}): Array<{
|
|
65
|
+
id: number | string;
|
|
66
|
+
value: number;
|
|
67
|
+
name?: string;
|
|
68
|
+
}>;
|
|
69
|
+
/**
|
|
70
|
+
* 通过商品 `product_resource.resources[]` 关联的 form/resource id,从 resourcesOriginMap 还原资源数据。
|
|
71
|
+
* 与 info2 `service/addService/utils.tsx#getResourceByIds` 等价(保留三特性)。
|
|
72
|
+
*/
|
|
73
|
+
export declare function getResourceByIds(resourcesOriginMap: Record<string, any>, cacheItem: any, extraParams?: {
|
|
74
|
+
extraResources?: Array<{
|
|
75
|
+
form_id: number | string;
|
|
76
|
+
id: number;
|
|
77
|
+
}>;
|
|
78
|
+
resourcesOrigin?: any[];
|
|
79
|
+
resourceTab?: Record<string, any>;
|
|
80
|
+
}): any[];
|