@pisell/pisellos 2.2.243 → 2.2.244
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 +2 -3
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/model/strategy/adapter/walletPass/utils.js +4 -7
- package/dist/modules/Cart/utils/cartProduct.js +3 -24
- package/dist/modules/Cart/utils/changePrice.js +11 -11
- package/dist/modules/Customer/index.d.ts +0 -20
- package/dist/modules/Customer/index.js +83 -172
- package/dist/modules/Customer/types.d.ts +0 -2
- package/dist/modules/Discount/index.js +3 -4
- package/dist/modules/Discount/types.d.ts +0 -1
- package/dist/modules/OpenData/index.d.ts +0 -8
- package/dist/modules/OpenData/index.js +17 -37
- package/dist/modules/Order/index.d.ts +18 -268
- package/dist/modules/Order/index.js +757 -3306
- package/dist/modules/Order/types.d.ts +31 -279
- package/dist/modules/Order/types.js +0 -38
- package/dist/modules/Order/utils.d.ts +5 -147
- package/dist/modules/Order/utils.js +103 -746
- package/dist/modules/Payment/index.d.ts +13 -10
- package/dist/modules/Payment/index.js +837 -467
- package/dist/modules/Payment/types.d.ts +0 -2
- package/dist/modules/Payment/utils.js +1 -2
- package/dist/modules/Payment/walletpass.js +7 -14
- package/dist/modules/ProductList/index.d.ts +12 -16
- package/dist/modules/ProductList/index.js +59 -133
- package/dist/modules/ProductList/types.d.ts +0 -14
- package/dist/modules/Quotation/index.d.ts +1 -0
- package/dist/modules/Quotation/index.js +22 -25
- package/dist/modules/Rules/index.d.ts +0 -4
- package/dist/modules/Rules/index.js +69 -93
- package/dist/modules/Rules/types.d.ts +0 -1
- package/dist/modules/SalesSummary/index.d.ts +25 -8
- package/dist/modules/SalesSummary/index.js +35 -86
- package/dist/modules/SalesSummary/types.d.ts +1 -4
- package/dist/modules/SalesSummary/utils.d.ts +25 -2
- package/dist/modules/SalesSummary/utils.js +162 -794
- package/dist/modules/Schedule/index.d.ts +0 -7
- package/dist/modules/Schedule/index.js +2 -24
- package/dist/modules/Summary/index.js +3 -4
- package/dist/modules/index.d.ts +0 -2
- package/dist/modules/index.js +1 -3
- package/dist/plugins/request.d.ts +0 -1
- package/dist/server/index.d.ts +1 -204
- package/dist/server/index.js +928 -3658
- package/dist/server/modules/index.d.ts +0 -2
- package/dist/server/modules/index.js +0 -2
- package/dist/server/modules/order/index.d.ts +4 -120
- package/dist/server/modules/order/index.js +483 -1779
- package/dist/server/modules/order/types.d.ts +3 -32
- package/dist/server/modules/order/types.js +0 -8
- package/dist/server/modules/order/utils/filterBookings.js +3 -26
- package/dist/server/modules/order/utils/filterOrders.js +8 -23
- package/dist/server/modules/products/index.d.ts +7 -34
- package/dist/server/modules/products/index.js +317 -631
- package/dist/server/modules/resource/index.d.ts +0 -2
- package/dist/server/modules/resource/index.js +3 -29
- package/dist/server/modules/schedule/index.d.ts +4 -4
- package/dist/server/modules/schedule/index.js +88 -111
- package/dist/solution/BaseSales/index.d.ts +9 -131
- package/dist/solution/BaseSales/index.js +447 -1944
- package/dist/solution/BaseSales/types.d.ts +6 -76
- package/dist/solution/BaseSales/types.js +4 -5
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +0 -1
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +24 -105
- package/dist/solution/BaseSales/utils.d.ts +1 -1
- package/dist/solution/BaseSales/utils.js +21 -62
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +10 -270
- package/dist/solution/BookingTicket/index.js +237 -1772
- package/dist/solution/BookingTicket/types.d.ts +1 -118
- package/dist/solution/BookingTicket/types.js +2 -41
- package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +0 -40
- package/dist/solution/BookingTicket/utils/bookingStatus.js +0 -70
- package/dist/solution/BookingTicket/utils/cartView.d.ts +1 -9
- package/dist/solution/BookingTicket/utils/cartView.js +7 -94
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +0 -5
- package/dist/solution/BookingTicket/utils/scan/index.js +8 -20
- package/dist/solution/Checkout/appointmentDemo.json +1 -0
- package/dist/solution/Checkout/index.d.ts +0 -1
- package/dist/solution/Checkout/index.js +9 -10
- package/dist/solution/RegisterAndLogin/config.js +10 -2
- package/dist/solution/ScanOrder/index.d.ts +3 -9
- package/dist/solution/ScanOrder/index.js +134 -241
- package/dist/solution/ScanOrder/types.d.ts +5 -9
- package/dist/solution/ScanOrder/types.js +3 -2
- package/dist/solution/ScanOrder/utils.d.ts +1 -1
- package/dist/solution/ScanOrder/utils.js +22 -84
- package/dist/solution/VenueBooking/index.d.ts +2 -5
- package/dist/solution/VenueBooking/index.js +59 -110
- package/dist/solution/VenueBooking/sales-section-4-annotated.json +2 -0
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +0 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +0 -10
- package/dist/types/index.d.ts +0 -10
- package/lib/model/strategy/adapter/promotion/evaluator.js +1 -2
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/model/strategy/adapter/walletPass/utils.js +2 -3
- package/lib/modules/Cart/utils/cartProduct.js +3 -20
- package/lib/modules/Cart/utils/changePrice.js +20 -12
- package/lib/modules/Customer/index.d.ts +0 -20
- package/lib/modules/Customer/index.js +11 -64
- package/lib/modules/Customer/types.d.ts +0 -2
- package/lib/modules/Discount/index.js +1 -5
- package/lib/modules/Discount/types.d.ts +0 -1
- package/lib/modules/OpenData/index.d.ts +0 -8
- package/lib/modules/OpenData/index.js +5 -19
- package/lib/modules/Order/index.d.ts +18 -268
- package/lib/modules/Order/index.js +344 -2149
- package/lib/modules/Order/types.d.ts +31 -279
- package/lib/modules/Order/types.js +0 -1
- package/lib/modules/Order/utils.d.ts +5 -147
- package/lib/modules/Order/utils.js +46 -614
- package/lib/modules/Payment/index.d.ts +13 -10
- package/lib/modules/Payment/index.js +150 -18
- package/lib/modules/Payment/types.d.ts +0 -2
- package/lib/modules/Payment/utils.js +1 -2
- package/lib/modules/Payment/walletpass.js +3 -7
- package/lib/modules/ProductList/index.d.ts +12 -16
- package/lib/modules/ProductList/index.js +4 -41
- package/lib/modules/ProductList/types.d.ts +0 -14
- package/lib/modules/Quotation/index.d.ts +1 -0
- package/lib/modules/Quotation/index.js +16 -19
- package/lib/modules/Rules/index.d.ts +0 -4
- package/lib/modules/Rules/index.js +120 -136
- package/lib/modules/Rules/types.d.ts +0 -1
- package/lib/modules/SalesSummary/index.d.ts +25 -8
- package/lib/modules/SalesSummary/index.js +4 -30
- package/lib/modules/SalesSummary/types.d.ts +1 -4
- package/lib/modules/SalesSummary/utils.d.ts +25 -2
- package/lib/modules/SalesSummary/utils.js +91 -645
- package/lib/modules/Schedule/index.d.ts +0 -7
- package/lib/modules/Schedule/index.js +1 -17
- package/lib/modules/Summary/index.js +4 -5
- package/lib/modules/index.d.ts +0 -2
- package/lib/modules/index.js +1 -5
- package/lib/plugins/request.d.ts +0 -1
- package/lib/server/index.d.ts +1 -204
- package/lib/server/index.js +57 -1888
- package/lib/server/modules/index.d.ts +0 -2
- package/lib/server/modules/index.js +0 -3
- package/lib/server/modules/order/index.d.ts +4 -120
- package/lib/server/modules/order/index.js +142 -919
- package/lib/server/modules/order/types.d.ts +3 -32
- package/lib/server/modules/order/utils/filterBookings.js +5 -24
- package/lib/server/modules/order/utils/filterOrders.js +6 -15
- package/lib/server/modules/products/index.d.ts +7 -34
- package/lib/server/modules/products/index.js +54 -189
- package/lib/server/modules/resource/index.d.ts +0 -2
- package/lib/server/modules/resource/index.js +3 -27
- package/lib/server/modules/schedule/index.d.ts +4 -4
- package/lib/server/modules/schedule/index.js +40 -47
- package/lib/solution/BaseSales/index.d.ts +9 -131
- package/lib/solution/BaseSales/index.js +63 -1106
- package/lib/solution/BaseSales/types.d.ts +6 -76
- package/lib/solution/BaseSales/types.js +1 -3
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +0 -1
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +18 -106
- package/lib/solution/BaseSales/utils.d.ts +1 -1
- package/lib/solution/BaseSales/utils.js +10 -54
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +10 -270
- package/lib/solution/BookingTicket/index.js +29 -922
- package/lib/solution/BookingTicket/types.d.ts +1 -118
- package/lib/solution/BookingTicket/types.js +0 -11
- package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +0 -40
- package/lib/solution/BookingTicket/utils/bookingStatus.js +2 -44
- package/lib/solution/BookingTicket/utils/cartView.d.ts +1 -9
- package/lib/solution/BookingTicket/utils/cartView.js +6 -61
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +0 -5
- package/lib/solution/BookingTicket/utils/scan/index.js +3 -17
- package/lib/solution/Checkout/appointmentDemo.json +1 -0
- package/lib/solution/Checkout/index.d.ts +0 -1
- package/lib/solution/Checkout/index.js +2 -1
- package/lib/solution/RegisterAndLogin/config.js +10 -2
- package/lib/solution/ScanOrder/index.d.ts +3 -9
- package/lib/solution/ScanOrder/index.js +70 -153
- package/lib/solution/ScanOrder/types.d.ts +5 -9
- package/lib/solution/ScanOrder/utils.d.ts +1 -1
- package/lib/solution/ScanOrder/utils.js +17 -83
- package/lib/solution/VenueBooking/index.d.ts +2 -5
- package/lib/solution/VenueBooking/index.js +17 -54
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +2 -0
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +0 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +0 -10
- package/lib/types/index.d.ts +0 -10
- package/package.json +1 -1
- package/dist/modules/BookingContext/index.d.ts +0 -48
- package/dist/modules/BookingContext/index.js +0 -566
- package/dist/modules/BookingContext/types.d.ts +0 -102
- package/dist/modules/BookingContext/types.js +0 -51
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +0 -16
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -284
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +0 -8
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -145
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -76
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +0 -218
- package/dist/modules/BookingContext/utils/flexible.d.ts +0 -28
- package/dist/modules/BookingContext/utils/flexible.js +0 -56
- package/dist/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
- package/dist/modules/BookingContext/utils/formatResourceList.js +0 -38
- package/dist/modules/BookingContext/utils/index.d.ts +0 -11
- package/dist/modules/BookingContext/utils/index.js +0 -11
- package/dist/modules/BookingContext/utils/noResource.d.ts +0 -13
- package/dist/modules/BookingContext/utils/noResource.js +0 -77
- package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +0 -1
- package/dist/modules/BookingContext/utils/orderLineDisplay.js +0 -36
- package/dist/modules/BookingContext/utils/productExtend.d.ts +0 -72
- package/dist/modules/BookingContext/utils/productExtend.js +0 -339
- package/dist/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
- package/dist/modules/BookingContext/utils/resourceErrors.js +0 -74
- package/dist/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
- package/dist/modules/BookingContext/utils/resourceSelection.js +0 -24
- package/dist/modules/BookingContext/utils/resources.d.ts +0 -80
- package/dist/modules/BookingContext/utils/resources.js +0 -486
- package/dist/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
- package/dist/modules/BookingContext/utils/serviceTimes.js +0 -151
- package/dist/modules/BookingContext/utils/timeSlices.d.ts +0 -42
- package/dist/modules/BookingContext/utils/timeSlices.js +0 -100
- package/dist/modules/Order/utils/manualProductDiscount.d.ts +0 -106
- package/dist/modules/Order/utils/manualProductDiscount.js +0 -210
- package/dist/modules/SurchargeList/index.d.ts +0 -16
- package/dist/modules/SurchargeList/index.js +0 -162
- package/dist/modules/SurchargeList/types.d.ts +0 -11
- package/dist/modules/SurchargeList/types.js +0 -1
- package/dist/server/modules/payment/index.d.ts +0 -28
- package/dist/server/modules/payment/index.js +0 -305
- package/dist/server/modules/payment/types.d.ts +0 -9
- package/dist/server/modules/payment/types.js +0 -1
- package/dist/server/test.json +0 -713
- package/dist/server/utils/small-ticket.d.ts +0 -71
- package/dist/server/utils/small-ticket.js +0 -830
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +0 -287
- package/dist/solution/BaseSales/utils/cartPromotion.js +0 -1438
- package/dist/solution/BaseSales/utils/quotationPrice.d.ts +0 -7
- package/dist/solution/BaseSales/utils/quotationPrice.js +0 -237
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +0 -117
- package/dist/solution/BookingTicket/utils/addProductDecision.js +0 -346
- package/dist/solution/BookingTicket/utils/addTimeAvailability.d.ts +0 -35
- package/dist/solution/BookingTicket/utils/addTimeAvailability.js +0 -95
- package/dist/solution/BookingTicket/utils/exampleData.d.ts +0 -123
- package/dist/solution/BookingTicket/utils/exampleData.js +0 -183
- package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +0 -185
- package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.js +0 -438
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -36
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +0 -399
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +0 -32
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +0 -56
- package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +0 -21
- package/dist/solution/BookingTicket/utils/scan/scanProductValues.js +0 -150
- package/dist/solution/BookingTicket/utils/sessionCatalogStale.d.ts +0 -23
- package/dist/solution/BookingTicket/utils/sessionCatalogStale.js +0 -78
- package/lib/modules/BookingContext/index.d.ts +0 -48
- package/lib/modules/BookingContext/index.js +0 -368
- package/lib/modules/BookingContext/types.d.ts +0 -102
- package/lib/modules/BookingContext/types.js +0 -34
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +0 -16
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -276
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +0 -8
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -151
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -76
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +0 -201
- package/lib/modules/BookingContext/utils/flexible.d.ts +0 -28
- package/lib/modules/BookingContext/utils/flexible.js +0 -80
- package/lib/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
- package/lib/modules/BookingContext/utils/formatResourceList.js +0 -50
- package/lib/modules/BookingContext/utils/index.d.ts +0 -11
- package/lib/modules/BookingContext/utils/index.js +0 -43
- package/lib/modules/BookingContext/utils/noResource.d.ts +0 -13
- package/lib/modules/BookingContext/utils/noResource.js +0 -90
- package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +0 -1
- package/lib/modules/BookingContext/utils/orderLineDisplay.js +0 -56
- package/lib/modules/BookingContext/utils/productExtend.d.ts +0 -72
- package/lib/modules/BookingContext/utils/productExtend.js +0 -283
- package/lib/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
- package/lib/modules/BookingContext/utils/resourceErrors.js +0 -80
- package/lib/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
- package/lib/modules/BookingContext/utils/resourceSelection.js +0 -46
- package/lib/modules/BookingContext/utils/resources.d.ts +0 -80
- package/lib/modules/BookingContext/utils/resources.js +0 -377
- package/lib/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
- package/lib/modules/BookingContext/utils/serviceTimes.js +0 -162
- package/lib/modules/BookingContext/utils/timeSlices.d.ts +0 -42
- package/lib/modules/BookingContext/utils/timeSlices.js +0 -124
- package/lib/modules/Order/utils/manualProductDiscount.d.ts +0 -106
- package/lib/modules/Order/utils/manualProductDiscount.js +0 -206
- package/lib/modules/SurchargeList/index.d.ts +0 -16
- package/lib/modules/SurchargeList/index.js +0 -89
- package/lib/modules/SurchargeList/types.d.ts +0 -11
- package/lib/modules/SurchargeList/types.js +0 -17
- package/lib/server/modules/payment/index.d.ts +0 -28
- package/lib/server/modules/payment/index.js +0 -192
- package/lib/server/modules/payment/types.d.ts +0 -9
- package/lib/server/modules/payment/types.js +0 -17
- package/lib/server/test.json +0 -713
- package/lib/server/utils/small-ticket.d.ts +0 -71
- package/lib/server/utils/small-ticket.js +0 -781
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +0 -287
- package/lib/solution/BaseSales/utils/cartPromotion.js +0 -992
- package/lib/solution/BaseSales/utils/quotationPrice.d.ts +0 -7
- package/lib/solution/BaseSales/utils/quotationPrice.js +0 -277
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +0 -117
- package/lib/solution/BookingTicket/utils/addProductDecision.js +0 -318
- package/lib/solution/BookingTicket/utils/addTimeAvailability.d.ts +0 -35
- package/lib/solution/BookingTicket/utils/addTimeAvailability.js +0 -125
- package/lib/solution/BookingTicket/utils/exampleData.d.ts +0 -123
- package/lib/solution/BookingTicket/utils/exampleData.js +0 -0
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +0 -185
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +0 -254
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -36
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +0 -168
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +0 -32
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +0 -51
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +0 -21
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +0 -127
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.d.ts +0 -23
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +0 -85
|
@@ -1,283 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1,41 +0,0 @@
|
|
|
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[];
|
|
@@ -1,80 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1,7 +0,0 @@
|
|
|
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;
|
|
@@ -1,46 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1,80 +0,0 @@
|
|
|
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[];
|