@pisell/pisellos 0.0.569 → 0.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/index.js +10 -6
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -3
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.js +7 -5
- package/dist/model/strategy/adapter/walletPass/example.js +26 -3
- package/dist/model/strategy/adapter/walletPass/index.js +5 -5
- package/dist/model/strategy/adapter/walletPass/type.d.ts +0 -3
- package/dist/model/strategy/adapter/walletPass/utils.d.ts +0 -26
- package/dist/model/strategy/adapter/walletPass/utils.js +17 -92
- package/dist/model/strategy/strategy-example.js +19 -5
- package/dist/modules/BaseModule.d.ts +1 -1
- package/dist/modules/BaseModule.js +8 -10
- package/dist/modules/Cart/index.js +3 -0
- package/dist/modules/Cart/utils/cartProduct.js +1 -0
- package/dist/modules/Cart/utils/cartResource.js +0 -2
- package/dist/modules/Cart/utils/changePrice.js +9 -16
- package/dist/modules/Date/index.js +5 -1
- package/dist/modules/Discount/index.d.ts +0 -1
- package/dist/modules/Discount/index.js +7 -22
- package/dist/modules/Discount/types.d.ts +0 -1
- package/dist/modules/OpenData/index.js +2 -0
- package/dist/modules/Order/index.js +70 -40
- package/dist/modules/Payment/index.js +162 -97
- package/dist/modules/Payment/types.d.ts +4 -8
- package/dist/modules/Payment/walletpass.d.ts +0 -2
- package/dist/modules/Payment/walletpass.js +5 -4
- package/dist/modules/ProductList/index.d.ts +1 -1
- package/dist/modules/ProductList/index.js +3 -12
- package/dist/modules/ProductList/types.d.ts +0 -1
- package/dist/modules/Rules/index.js +126 -427
- package/dist/modules/SalesSummary/utils.js +1 -2
- package/dist/modules/Schedule/getDateIsInSchedule.js +0 -5
- package/dist/modules/Schedule/index.js +1 -0
- package/dist/modules/Schedule/utils.js +1 -0
- package/dist/modules/Step/index.js +1 -0
- package/dist/modules/Summary/utils.js +22 -43
- package/dist/plugins/request.js +4 -1
- package/dist/plugins/window.js +6 -2
- package/dist/server/index.js +129 -97
- package/dist/server/modules/menu/index.js +41 -32
- package/dist/server/modules/order/index.js +4 -2
- package/dist/server/modules/products/index.js +42 -24
- package/dist/server/modules/quotation/index.js +38 -29
- package/dist/server/modules/resource/index.js +4 -3
- package/dist/server/modules/schedule/index.js +35 -27
- package/dist/server/utils/product.js +1 -0
- package/dist/solution/BaseSales/index.js +41 -38
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.js +60 -11
- package/dist/solution/BookingByStep/utils/capacity.js +11 -1
- package/dist/solution/BookingByStep/utils/resources.js +3 -1
- package/dist/solution/BookingByStep/utils/timeslots.js +43 -2
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +2 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +7 -6
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +31 -25
- package/dist/solution/BookingTicket/utils/scan/index.js +10 -6
- package/dist/solution/BuyTickets/index.js +12 -9
- package/dist/solution/Checkout/index.js +252 -177
- package/dist/solution/Checkout/utils/index.js +16 -4
- package/dist/solution/RegisterAndLogin/index.js +76 -30
- package/dist/solution/ScanOrder/index.js +60 -50
- package/dist/solution/ShopDiscount/index.js +14 -15
- package/dist/solution/ShopDiscount/types.d.ts +4 -5
- package/dist/solution/ShopDiscount/utils.d.ts +0 -9
- package/dist/solution/ShopDiscount/utils.js +0 -9
- package/dist/solution/VenueBooking/index.d.ts +3 -31
- package/dist/solution/VenueBooking/index.js +496 -651
- package/dist/solution/VenueBooking/types.d.ts +1 -3
- package/dist/solution/VenueBooking/types.js +0 -1
- package/dist/solution/VenueBooking/utils/dateSummary.d.ts +2 -2
- package/dist/solution/VenueBooking/utils/dateSummary.js +25 -12
- package/dist/solution/VenueBooking/utils/timeSlot.d.ts +0 -2
- package/dist/solution/VenueBooking/utils/timeSlot.js +4 -9
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/task.js +18 -15
- package/dist/utils/watch.js +1 -0
- package/lib/apis/picoding.js +0 -2
- package/lib/core/index.js +132 -130
- package/lib/effects/index.js +57 -46
- package/lib/index.d.ts +0 -1
- package/lib/index.js +50 -92
- package/lib/model/index.js +21 -14
- package/lib/model/strategy/adapter/dataVariant/adapter.js +50 -38
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +236 -162
- package/lib/model/strategy/adapter/dataVariant/examples.js +237 -229
- package/lib/model/strategy/adapter/dataVariant/index.js +34 -39
- package/lib/model/strategy/adapter/dataVariant/type.js +28 -57
- package/lib/model/strategy/adapter/index.js +64 -100
- package/lib/model/strategy/adapter/itemRule/adapter.js +144 -156
- package/lib/model/strategy/adapter/itemRule/evaluator.js +48 -36
- package/lib/model/strategy/adapter/itemRule/examples.js +225 -295
- package/lib/model/strategy/adapter/itemRule/index.js +57 -83
- package/lib/model/strategy/adapter/itemRule/type.js +36 -97
- package/lib/model/strategy/adapter/promotion/adapter.js +63 -84
- package/lib/model/strategy/adapter/promotion/evaluator.js +231 -381
- package/lib/model/strategy/adapter/promotion/examples.js +159 -139
- package/lib/model/strategy/adapter/promotion/index.js +49 -1
- package/lib/model/strategy/adapter/promotion/type.js +35 -199
- package/lib/model/strategy/adapter/type.js +16 -4
- package/lib/model/strategy/adapter/walletPass/evaluator.js +152 -180
- package/lib/model/strategy/adapter/walletPass/example.js +190 -217
- package/lib/model/strategy/adapter/walletPass/index.js +51 -75
- package/lib/model/strategy/adapter/walletPass/locales.js +58 -36
- package/lib/model/strategy/adapter/walletPass/type.d.ts +0 -3
- package/lib/model/strategy/adapter/walletPass/type.js +16 -4
- package/lib/model/strategy/adapter/walletPass/utils.d.ts +0 -26
- package/lib/model/strategy/adapter/walletPass/utils.js +383 -678
- package/lib/model/strategy/engine.js +168 -270
- package/lib/model/strategy/index.js +34 -49
- package/lib/model/strategy/strategy-example.js +239 -243
- package/lib/model/strategy/type.js +40 -100
- package/lib/modules/Account/index.js +53 -39
- package/lib/modules/Account/types.js +33 -20
- package/lib/modules/AccountList/index.js +154 -116
- package/lib/modules/AccountList/types.js +31 -30
- package/lib/modules/AccountList/utils.js +30 -18
- package/lib/modules/BaseModule.d.ts +1 -1
- package/lib/modules/BaseModule.js +46 -25
- package/lib/modules/BookingContext/index.js +136 -158
- package/lib/modules/BookingContext/types.js +32 -46
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +143 -131
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +82 -75
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +150 -170
- package/lib/modules/BookingContext/utils/flexible.js +55 -38
- package/lib/modules/BookingContext/utils/formatResourceList.js +34 -19
- package/lib/modules/BookingContext/utils/index.js +41 -124
- package/lib/modules/BookingContext/utils/noResource.js +70 -58
- package/lib/modules/BookingContext/utils/orderLineDisplay.js +41 -14
- package/lib/modules/BookingContext/utils/productExtend.js +155 -202
- package/lib/modules/BookingContext/utils/resourceErrors.js +53 -53
- package/lib/modules/BookingContext/utils/resourceSelection.js +41 -19
- package/lib/modules/BookingContext/utils/resources.js +167 -209
- package/lib/modules/BookingContext/utils/serviceTimes.js +116 -115
- package/lib/modules/BookingContext/utils/timeSlices.js +80 -70
- package/lib/modules/Cart/index.js +124 -170
- package/lib/modules/Cart/types.js +51 -46
- package/lib/modules/Cart/utils/cartAccount.js +39 -40
- package/lib/modules/Cart/utils/cartDate.js +61 -56
- package/lib/modules/Cart/utils/cartDiscount.js +33 -28
- package/lib/modules/Cart/utils/cartNote.js +32 -27
- package/lib/modules/Cart/utils/cartProduct.js +251 -321
- package/lib/modules/Cart/utils/cartRelationForms.js +35 -29
- package/lib/modules/Cart/utils/cartResource.js +78 -72
- package/lib/modules/Cart/utils/changePrice.js +50 -28
- package/lib/modules/Cart/utils/index.js +48 -106
- package/lib/modules/Customer/constants.js +34 -13
- package/lib/modules/Customer/index.js +169 -232
- package/lib/modules/Customer/types.js +35 -38
- package/lib/modules/Date/index.js +115 -116
- package/lib/modules/Date/types.js +28 -16
- package/lib/modules/Date/utils.js +123 -174
- package/lib/modules/Discount/index.d.ts +0 -1
- package/lib/modules/Discount/index.js +128 -130
- package/lib/modules/Discount/types.d.ts +0 -1
- package/lib/modules/Discount/types.js +31 -9
- package/lib/modules/Guests/index.js +56 -30
- package/lib/modules/Guests/types.js +33 -23
- package/lib/modules/Holder/index.js +189 -209
- package/lib/modules/Holder/types.js +16 -4
- package/lib/modules/Holder/utils.js +49 -20
- package/lib/modules/OpenData/index.js +76 -69
- package/lib/modules/OpenData/types.js +16 -4
- package/lib/modules/OpenData/utils.js +78 -44
- package/lib/modules/Order/index.js +1909 -1572
- package/lib/modules/Order/types.js +35 -78
- package/lib/modules/Order/utils/bundleDiscountHydration.js +74 -41
- package/lib/modules/Order/utils/manualProductDiscount.js +123 -124
- package/lib/modules/Order/utils/orderCollectionIdentity.js +210 -148
- package/lib/modules/Order/utils.js +634 -799
- package/lib/modules/Payment/cash.js +33 -20
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +76 -145
- package/lib/modules/Payment/eftpos.js +30 -16
- package/lib/modules/Payment/index.js +378 -518
- package/lib/modules/Payment/mx51.js +0 -1
- package/lib/modules/Payment/types.d.ts +4 -8
- package/lib/modules/Payment/types.js +107 -216
- package/lib/modules/Payment/utils.js +48 -51
- package/lib/modules/Payment/walletpass.d.ts +0 -2
- package/lib/modules/Payment/walletpass.js +211 -226
- package/lib/modules/Product/index.js +46 -51
- package/lib/modules/Product/types.js +16 -4
- package/lib/modules/Product/utils.js +33 -32
- package/lib/modules/ProductList/index.d.ts +1 -1
- package/lib/modules/ProductList/index.js +117 -117
- package/lib/modules/ProductList/types.d.ts +0 -1
- package/lib/modules/ProductList/types.js +31 -9
- package/lib/modules/Quotation/index.js +100 -66
- package/lib/modules/Quotation/types.js +16 -4
- package/lib/modules/Resource/index.js +59 -27
- package/lib/modules/Resource/types.js +32 -22
- package/lib/modules/Resource/utils.js +38 -30
- package/lib/modules/ResourcePlanner/index.js +61 -60
- package/lib/modules/ResourcePlanner/planner.js +384 -346
- package/lib/modules/ResourcePlanner/types.js +16 -4
- package/lib/modules/Rules/index.js +903 -1475
- package/lib/modules/Rules/types.js +40 -17
- package/lib/modules/SalesSummary/index.js +90 -85
- package/lib/modules/SalesSummary/types.js +16 -4
- package/lib/modules/SalesSummary/utils.js +427 -351
- package/lib/modules/ScanOrderLogger/index.js +79 -59
- package/lib/modules/ScanOrderLogger/providers/feishu.js +78 -54
- package/lib/modules/ScanOrderLogger/providers/grafana.js +36 -13
- package/lib/modules/ScanOrderLogger/types.js +16 -4
- package/lib/modules/Schedule/getDateIsInSchedule.js +163 -339
- package/lib/modules/Schedule/index.js +114 -100
- package/lib/modules/Schedule/type.js +16 -4
- package/lib/modules/Schedule/types.js +16 -4
- package/lib/modules/Schedule/utils.js +291 -433
- package/lib/modules/Step/index.js +52 -40
- package/lib/modules/Step/tyeps.js +16 -4
- package/lib/modules/Summary/index.js +71 -66
- package/lib/modules/Summary/types.js +16 -4
- package/lib/modules/Summary/utils.js +418 -791
- package/lib/modules/SurchargeList/index.js +60 -46
- package/lib/modules/SurchargeList/types.js +16 -4
- package/lib/modules/index.js +63 -245
- package/lib/plugins/app.js +16 -4
- package/lib/plugins/index.js +25 -36
- package/lib/plugins/request.js +126 -137
- package/lib/plugins/shopStore.js +16 -4
- package/lib/plugins/user.js +16 -4
- package/lib/plugins/window.js +179 -171
- package/lib/server/index.js +2337 -2675
- package/lib/server/modules/floor-plan/index.js +123 -102
- package/lib/server/modules/floor-plan/types.js +30 -15
- package/lib/server/modules/index.js +68 -106
- package/lib/server/modules/menu/index.js +122 -146
- package/lib/server/modules/menu/types.js +31 -18
- package/lib/server/modules/order/index.js +642 -567
- package/lib/server/modules/order/types.js +32 -117
- package/lib/server/modules/order/utils/filterBookings.js +194 -219
- package/lib/server/modules/order/utils/filterOrders.js +92 -118
- package/lib/server/modules/payment/index.js +83 -59
- package/lib/server/modules/payment/types.js +16 -4
- package/lib/server/modules/products/index.js +459 -575
- package/lib/server/modules/products/types.js +34 -44
- package/lib/server/modules/quotation/index.js +172 -137
- package/lib/server/modules/quotation/types.js +31 -21
- package/lib/server/modules/resource/index.js +184 -213
- package/lib/server/modules/resource/types.js +33 -42
- package/lib/server/modules/schedule/index.js +123 -135
- package/lib/server/modules/schedule/types.js +21 -14
- package/lib/server/modules/schedule/utils.js +163 -334
- package/lib/server/types.js +16 -4
- package/lib/server/utils/index.js +23 -25
- package/lib/server/utils/product.js +139 -196
- package/lib/server/utils/schedule.js +41 -34
- package/lib/server/utils/small-ticket.js +456 -478
- package/lib/server/utils/time.js +49 -40
- package/lib/solution/BaseSales/index.js +1016 -850
- package/lib/solution/BaseSales/types.js +37 -41
- package/lib/solution/BaseSales/utils/cartPromotion.js +460 -611
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +105 -85
- package/lib/solution/BaseSales/utils/quotationPrice.js +114 -56
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +143 -102
- package/lib/solution/BaseSales/utils.js +140 -155
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.js +1340 -1530
- package/lib/solution/BookingByStep/types.js +99 -40
- package/lib/solution/BookingByStep/utils/capacity.js +160 -192
- package/lib/solution/BookingByStep/utils/products.js +52 -42
- package/lib/solution/BookingByStep/utils/resources.js +330 -527
- package/lib/solution/BookingByStep/utils/stock.js +44 -65
- package/lib/solution/BookingByStep/utils/timeslots.js +131 -129
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +459 -543
- package/lib/solution/BookingTicket/types.js +77 -99
- package/lib/solution/BookingTicket/utils/addProductDecision.js +184 -219
- package/lib/solution/BookingTicket/utils/addTimeAvailability.js +89 -58
- package/lib/solution/BookingTicket/utils/bookingStatus.js +78 -107
- package/lib/solution/BookingTicket/utils/cartView.js +94 -110
- package/lib/solution/BookingTicket/utils/exampleData.js +0 -185
- package/lib/solution/BookingTicket/utils/orderCustomer.js +41 -18
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +86 -219
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +93 -144
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +91 -79
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +41 -54
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +81 -84
- package/lib/solution/BookingTicket/utils/scan/index.js +104 -98
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +43 -90
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +64 -52
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +58 -56
- package/lib/solution/BuyTickets/index.js +70 -67
- package/lib/solution/BuyTickets/types.js +38 -22
- package/lib/solution/Checkout/index.js +1158 -1451
- package/lib/solution/Checkout/types.js +61 -91
- package/lib/solution/Checkout/utils/index.js +156 -228
- package/lib/solution/PlaceOrder/index.js +0 -55
- package/lib/solution/RegisterAndLogin/config.js +460 -493
- package/lib/solution/RegisterAndLogin/index.js +630 -633
- package/lib/solution/RegisterAndLogin/types.js +76 -189
- package/lib/solution/RegisterAndLogin/utils.js +125 -183
- package/lib/solution/Sales/index.js +320 -317
- package/lib/solution/Sales/types.js +33 -27
- package/lib/solution/ScanOrder/index.js +862 -831
- package/lib/solution/ScanOrder/types.js +34 -33
- package/lib/solution/ScanOrder/utils.js +371 -406
- package/lib/solution/ShopDiscount/index.js +233 -235
- package/lib/solution/ShopDiscount/types.d.ts +4 -5
- package/lib/solution/ShopDiscount/types.js +37 -15
- package/lib/solution/ShopDiscount/utils.d.ts +0 -9
- package/lib/solution/ShopDiscount/utils.js +172 -309
- package/lib/solution/UnifiedBookingSales/index.js +405 -379
- package/lib/solution/UnifiedBookingSales/types.js +31 -12
- package/lib/solution/VenueBooking/index.d.ts +3 -31
- package/lib/solution/VenueBooking/index.js +916 -967
- package/lib/solution/VenueBooking/types.d.ts +1 -3
- package/lib/solution/VenueBooking/types.js +39 -20
- package/lib/solution/VenueBooking/utils/dateSummary.d.ts +2 -2
- package/lib/solution/VenueBooking/utils/dateSummary.js +62 -25
- package/lib/solution/VenueBooking/utils/resource.js +54 -31
- package/lib/solution/VenueBooking/utils/slotMerge.js +107 -94
- package/lib/solution/VenueBooking/utils/timeSlot.d.ts +0 -2
- package/lib/solution/VenueBooking/utils/timeSlot.js +133 -138
- package/lib/solution/VenueBooking/utils.js +67 -130
- package/lib/solution/index.js +41 -124
- package/lib/store/createStore.js +29 -32
- package/lib/types/index.d.ts +1 -1
- package/lib/types/index.js +16 -4
- package/lib/utils/task.js +36 -36
- package/lib/utils/watch.js +47 -81
- package/package.json +2 -4
- package/dist/solution/VenueBooking/utils/smartPricing.d.ts +0 -70
- package/dist/solution/VenueBooking/utils/smartPricing.js +0 -233
- package/lib/solution/VenueBooking/utils/smartPricing.d.ts +0 -70
- package/lib/solution/VenueBooking/utils/smartPricing.js +0 -192
|
@@ -1,268 +1,221 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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 });
|
|
14
16
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
*
|
|
27
|
-
* 设计原则:所有助手函数都通过 context 显式拿数据,**不读 mini-redux**,
|
|
28
|
-
* 让 OS 这层完全可在 Node 单测下运行(dayjs 在 Node 也是纯函数)。
|
|
29
|
-
*/
|
|
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);
|
|
30
28
|
|
|
31
|
-
|
|
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");
|
|
32
46
|
function derivePresetStartTimeFromDate(date) {
|
|
33
|
-
if (date == null)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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;
|
|
38
55
|
return hhmm;
|
|
39
56
|
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* 取预约时间偏好(sequential / parallel);默认 sequential。
|
|
43
|
-
*/
|
|
44
57
|
function getAppointmentTimingPreference(ctx) {
|
|
45
|
-
|
|
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";
|
|
46
60
|
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* 灵活时长选项(cacheItem.duration.type === 'flexible' 时)。
|
|
50
|
-
*/
|
|
51
61
|
function getFlexibleOption(params) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
const
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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) };
|
|
67
80
|
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* 时间切片对象(含灵活时长选项)。与 info2 `getTimeObj` 等价。
|
|
71
|
-
*/
|
|
72
81
|
function getTimeObj(params) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
cacheItem,
|
|
82
|
-
useStartTime,
|
|
83
|
-
ctx
|
|
84
|
-
});
|
|
85
|
-
const baseSlices = (0, _timeSlices.sliceDayIntoFiveMinutes)(ctx?.bookingConfig?.config?.basic?.service_time, isMultiDay);
|
|
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
|
+
);
|
|
86
90
|
const timeSlices = [...baseSlices.timeSlices];
|
|
87
91
|
const durationSlicesBasedOnTime = [...baseSlices.durationSlicesBasedOnTime];
|
|
88
92
|
if (flexibleOption) {
|
|
89
93
|
durationSlicesBasedOnTime.unshift(flexibleOption);
|
|
90
94
|
}
|
|
91
|
-
if (useDuration && !durationSlicesBasedOnTime.some(d => d.value === useDuration)) {
|
|
95
|
+
if (useDuration && !durationSlicesBasedOnTime.some((d) => d.value === useDuration)) {
|
|
92
96
|
durationSlicesBasedOnTime.unshift({
|
|
93
97
|
label: String(useDuration),
|
|
94
98
|
value: useDuration
|
|
95
99
|
});
|
|
96
100
|
}
|
|
97
|
-
return {
|
|
98
|
-
timeSlices,
|
|
99
|
-
durationSlicesBasedOnTime
|
|
100
|
-
};
|
|
101
|
+
return { timeSlices, durationSlicesBasedOnTime };
|
|
101
102
|
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* 计算商品行 _extend(包含 start_time / endDate / duration / start_date / end_date / sub_type 等)。
|
|
105
|
-
* 与 info2 `utilsByBooking.ts#getServiceStartTimeAndEndTime` 等价;显著差异:
|
|
106
|
-
* - 不读 `state.service.value` / `mini-redux`,由 ctx.previousService 显式注入。
|
|
107
|
-
* - 不读 `sessionStorage.serviceParams`,由 ctx.presetStartTime / ctx.resourceIdFromCalendar 注入。
|
|
108
|
-
* - cacheItem.isCustomItem → 直接返回 `{ duration: null }`。
|
|
109
|
-
*/
|
|
110
103
|
function getServiceStartTimeAndEndTime(params) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
} = params;
|
|
116
|
-
if (cacheItem?.isCustomItem) {
|
|
117
|
-
return {
|
|
118
|
-
duration: null
|
|
119
|
-
};
|
|
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 };
|
|
120
108
|
}
|
|
121
109
|
const appointmentTimingPreference = getAppointmentTimingPreference(ctx);
|
|
122
110
|
const lastServer = ctx.previousService || null;
|
|
123
111
|
const resolveDuration = () => {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
duration: 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);
|
|
129
116
|
};
|
|
117
|
+
let _extend = { duration: resolveDuration() };
|
|
130
118
|
if (lastServer) {
|
|
131
|
-
const lastStart = lastServer._extend
|
|
132
|
-
const lastEnd = lastServer._extend
|
|
133
|
-
if (appointmentTimingPreference ===
|
|
134
|
-
_extend.start_time = (0,
|
|
135
|
-
} else if ((0,
|
|
136
|
-
_extend.start_time = timeObj.timeSlices[timeObj.timeSlices.length - 1]
|
|
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;
|
|
137
125
|
} else {
|
|
138
|
-
_extend.start_time = lastEnd ? (0,
|
|
126
|
+
_extend.start_time = lastEnd ? (0, import_dayjs.default)(lastEnd).format("HH:mm") : (0, import_dayjs.default)().format("HH:mm");
|
|
139
127
|
}
|
|
140
128
|
} else {
|
|
141
129
|
const presetStartTime = ctx.presetStartTime;
|
|
142
|
-
|
|
143
|
-
// 不做 findNextSlice 栅格对齐(否则 01:47 会被抬到 01:50)。
|
|
144
|
-
if (presetStartTime && presetStartTime !== '00:00') {
|
|
130
|
+
if (presetStartTime && presetStartTime !== "00:00") {
|
|
145
131
|
_extend.start_time = presetStartTime;
|
|
146
132
|
} else if (cacheItem.currentDefaultTime) {
|
|
147
133
|
_extend.start_time = cacheItem.currentDefaultTime;
|
|
148
134
|
} else {
|
|
149
|
-
_extend.start_time = (0,
|
|
135
|
+
_extend.start_time = (0, import_dayjs.default)().format("HH:mm");
|
|
150
136
|
}
|
|
151
137
|
}
|
|
152
|
-
_extend = {
|
|
153
|
-
|
|
154
|
-
...cacheItem._extend
|
|
155
|
-
};
|
|
156
|
-
const {
|
|
157
|
-
startDate,
|
|
158
|
-
endDate
|
|
159
|
-
} = (0, _serviceTimes.getServiceTimes)({
|
|
160
|
-
...cacheItem,
|
|
161
|
-
_extend
|
|
162
|
-
});
|
|
138
|
+
_extend = { ..._extend, ...cacheItem._extend };
|
|
139
|
+
const { startDate, endDate } = (0, import_serviceTimes.getServiceTimes)({ ...cacheItem, _extend });
|
|
163
140
|
_extend.startDate = startDate;
|
|
164
141
|
_extend.endDate = endDate;
|
|
165
|
-
if ((0,
|
|
166
|
-
_extend.start_time = _extend.start_time || startDate.format(
|
|
167
|
-
_extend.end_time = _extend.end_time || endDate.format(
|
|
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");
|
|
168
145
|
_extend.start_date = _extend.start_date ?? startDate;
|
|
169
146
|
_extend.end_date = _extend.end_date ?? endDate;
|
|
170
147
|
}
|
|
171
|
-
const session = cacheItem
|
|
172
|
-
if ((0,
|
|
173
|
-
const baseDate = ctx.date ? (0,
|
|
174
|
-
const startAt = (0,
|
|
175
|
-
const endAt = (0,
|
|
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")}`);
|
|
176
153
|
_extend.start_date = startAt;
|
|
177
154
|
_extend.startDate = startAt;
|
|
178
155
|
_extend.start_time = session.start_time;
|
|
179
156
|
_extend.end_date = endAt;
|
|
180
157
|
_extend.endDate = endAt;
|
|
181
158
|
_extend.end_time = session.end_time;
|
|
182
|
-
_extend.duration = (0,
|
|
183
|
-
_extend
|
|
184
|
-
}, 'minutes');
|
|
159
|
+
_extend.duration = (0, import_serviceTimes.getDays)({ _extend }, "minutes");
|
|
185
160
|
}
|
|
186
161
|
return _extend;
|
|
187
162
|
}
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* 综合:把 cacheItem 拼装出完整的 _extend / _data(资源 / 容量 / timeObj),并标记 autoClose。
|
|
191
|
-
* 与 info2 `service/addService/utils.tsx#getProductExtend` 等价;剥 React `console.time` / JSX。
|
|
192
|
-
*
|
|
193
|
-
* 入参 ctx 必须至少给:bookingConfig / resourcesOriginMap / resourcesOrigin / date。
|
|
194
|
-
*/
|
|
195
163
|
function getProductExtend(params) {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
} = params;
|
|
201
|
-
const isNew = cacheItem.new || !cacheItem._extend?.endDate;
|
|
202
|
-
const _cacheItem = {
|
|
203
|
-
...cacheItem
|
|
204
|
-
};
|
|
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 };
|
|
205
168
|
const resourcesOriginMap = ctx.resourcesOriginMap || {};
|
|
206
169
|
_cacheItem._data = {};
|
|
207
|
-
if ((0,
|
|
170
|
+
if ((0, import_serviceTimes.isMultiDayProduct)(cacheItem)) {
|
|
208
171
|
_cacheItem._extend = _cacheItem._extend || {};
|
|
209
|
-
_cacheItem._extend.holder_id = cacheItem
|
|
210
|
-
_cacheItem._extend.sub_type =
|
|
172
|
+
_cacheItem._extend.holder_id = ((_b = cacheItem == null ? void 0 : cacheItem._extend) == null ? void 0 : _b.holder_id) || [];
|
|
173
|
+
_cacheItem._extend.sub_type = "days";
|
|
211
174
|
}
|
|
212
175
|
if (isNew) {
|
|
213
|
-
_cacheItem._data.timeObj = getTimeObj({
|
|
214
|
-
cacheItem,
|
|
215
|
-
ctx
|
|
216
|
-
});
|
|
176
|
+
_cacheItem._data.timeObj = getTimeObj({ cacheItem, ctx });
|
|
217
177
|
_cacheItem._extend = getServiceStartTimeAndEndTime({
|
|
218
178
|
cacheItem,
|
|
219
179
|
timeObj: _cacheItem._data.timeObj,
|
|
220
180
|
ctx
|
|
221
181
|
});
|
|
222
182
|
_cacheItem._data.capacitys = cacheItem.capacity;
|
|
223
|
-
_cacheItem._data.resourcesOrigin = (0,
|
|
224
|
-
resourceTab: ctx
|
|
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,
|
|
225
185
|
resourcesOrigin: ctx.resourcesOrigin || []
|
|
226
186
|
});
|
|
227
|
-
_cacheItem._extend.capacity = (0,
|
|
187
|
+
_cacheItem._extend.capacity = (0, import_resources.setDefaultCapacitys)({
|
|
228
188
|
capacitys: _cacheItem._data.capacitys,
|
|
229
189
|
cacheItem: _cacheItem
|
|
230
190
|
});
|
|
231
|
-
const {
|
|
232
|
-
list,
|
|
233
|
-
maps
|
|
234
|
-
} = (0, _resources.formatResources)({
|
|
191
|
+
const { list, maps } = (0, import_resources.formatResources)({
|
|
235
192
|
cacheItem: _cacheItem,
|
|
236
193
|
resourcesOrigin: _cacheItem._data.resourcesOrigin
|
|
237
194
|
});
|
|
238
195
|
_cacheItem._data.resources = list;
|
|
239
196
|
_cacheItem._data.resourceMaps = maps;
|
|
240
|
-
_cacheItem._extend.resource = (0,
|
|
197
|
+
_cacheItem._extend.resource = (0, import_resources.setDefaultResource)({
|
|
241
198
|
cacheItem: _cacheItem,
|
|
242
199
|
resources: _cacheItem._data.resources,
|
|
243
200
|
resourceIdFromCalendar: ctx.resourceIdFromCalendar,
|
|
244
201
|
isAutoAllocationOn: ctx.isAutoAllocationOn
|
|
245
202
|
});
|
|
246
|
-
|
|
247
|
-
// 灵活时长二次计算(资源默认选中后,按 usableTime 重算 flexible 分钟数)
|
|
248
|
-
if ((0, _flexible.isProductFlexibleDuration)(_cacheItem?.duration)) {
|
|
203
|
+
if ((0, import_flexible.isProductFlexibleDuration)(_cacheItem == null ? void 0 : _cacheItem.duration)) {
|
|
249
204
|
_cacheItem._data.timeObj = getTimeObj({
|
|
250
205
|
cacheItem: _cacheItem,
|
|
251
206
|
useStartTime: _cacheItem._extend.start_time,
|
|
252
207
|
ctx
|
|
253
208
|
});
|
|
254
|
-
_cacheItem._extend.duration = _cacheItem._data.timeObj
|
|
255
|
-
const {
|
|
256
|
-
endDate
|
|
257
|
-
} = (0, _serviceTimes.getServiceTimes)(_cacheItem);
|
|
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);
|
|
258
211
|
_cacheItem._extend.endDate = endDate;
|
|
259
212
|
}
|
|
260
213
|
_cacheItem.autoClose = getIsAutoClose(_cacheItem, ctx.isAutoAllocationOn || (() => true));
|
|
261
|
-
if (_cacheItem._extend.bundle_edit !==
|
|
214
|
+
if (_cacheItem._extend.bundle_edit !== void 0) {
|
|
262
215
|
_cacheItem._extend.bundle_edit = 1;
|
|
263
216
|
}
|
|
264
217
|
if (!isDisabledTime) {
|
|
265
|
-
_cacheItem._time = new Date().getTime();
|
|
218
|
+
_cacheItem._time = (/* @__PURE__ */ new Date()).getTime();
|
|
266
219
|
}
|
|
267
220
|
} else {
|
|
268
221
|
if (!_cacheItem._data.capacitys) {
|
|
@@ -270,25 +223,19 @@ function getProductExtend(params) {
|
|
|
270
223
|
}
|
|
271
224
|
if (!_cacheItem._data.resourcesOrigin) {
|
|
272
225
|
const extraResources = [];
|
|
273
|
-
if (Array.isArray(_cacheItem._extend
|
|
274
|
-
_cacheItem._extend.event_resources.forEach(er => {
|
|
275
|
-
extraResources.push({
|
|
276
|
-
form_id: er.form_id,
|
|
277
|
-
id: er.relation_id
|
|
278
|
-
});
|
|
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 });
|
|
279
229
|
});
|
|
280
230
|
}
|
|
281
|
-
_cacheItem._data.resourcesOrigin = (0,
|
|
231
|
+
_cacheItem._data.resourcesOrigin = (0, import_resources.getResourceByIds)(resourcesOriginMap, cacheItem, {
|
|
282
232
|
extraResources,
|
|
283
|
-
resourceTab: ctx
|
|
233
|
+
resourceTab: (_j = (_i = ctx == null ? void 0 : ctx.bookingConfig) == null ? void 0 : _i.config) == null ? void 0 : _j.resource_tab,
|
|
284
234
|
resourcesOrigin: ctx.resourcesOrigin || []
|
|
285
235
|
});
|
|
286
236
|
}
|
|
287
237
|
if (!_cacheItem._data.resources) {
|
|
288
|
-
const {
|
|
289
|
-
list,
|
|
290
|
-
maps
|
|
291
|
-
} = (0, _resources.formatResources)({
|
|
238
|
+
const { list, maps } = (0, import_resources.formatResources)({
|
|
292
239
|
cacheItem: _cacheItem,
|
|
293
240
|
resourcesOrigin: _cacheItem._data.resourcesOrigin
|
|
294
241
|
});
|
|
@@ -297,34 +244,40 @@ function getProductExtend(params) {
|
|
|
297
244
|
}
|
|
298
245
|
_cacheItem._data.timeObj = getTimeObj({
|
|
299
246
|
cacheItem: _cacheItem,
|
|
300
|
-
useStartTime: _cacheItem._extend
|
|
247
|
+
useStartTime: (_k = _cacheItem._extend) == null ? void 0 : _k.start_time,
|
|
301
248
|
ctx
|
|
302
249
|
});
|
|
303
250
|
}
|
|
304
251
|
return _cacheItem;
|
|
305
252
|
}
|
|
306
|
-
|
|
307
|
-
/**
|
|
308
|
-
* 是否可自动关闭弹窗(不需要用户进 EditService 抽屉)。
|
|
309
|
-
* 与 info2 `service/addService/utils.tsx#getIsAutoClose` 等价;
|
|
310
|
-
* `getAutoAllocationStorage` 抽象为入参 `isAutoAllocationOn(formId)`。
|
|
311
|
-
*/
|
|
312
253
|
function getIsAutoClose(cacheItem, isAutoAllocationOn) {
|
|
313
|
-
|
|
254
|
+
var _a, _b, _c, _d, _e;
|
|
255
|
+
if ((0, import_resourceSelection.productNeedsResourceExtend)(cacheItem) && !(0, import_resourceSelection.hasActualResourceSelection)(cacheItem)) {
|
|
314
256
|
return false;
|
|
315
257
|
}
|
|
316
|
-
if (cacheItem._data
|
|
317
|
-
const resources = cacheItem
|
|
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) || [];
|
|
318
260
|
if (resources.length === 1) {
|
|
319
261
|
const first = resources[0];
|
|
320
|
-
if (first.select_type
|
|
262
|
+
if (((_d = first.select_type) == null ? void 0 : _d.type) === "single" && (first.default_resource || []).length > 0) {
|
|
321
263
|
return true;
|
|
322
264
|
}
|
|
323
265
|
}
|
|
324
266
|
}
|
|
325
|
-
const entries = Object.entries(cacheItem._extend
|
|
267
|
+
const entries = Object.entries(((_e = cacheItem._extend) == null ? void 0 : _e.resource) || {});
|
|
326
268
|
if (entries.length === 0) {
|
|
327
|
-
return !(0,
|
|
269
|
+
return !(0, import_resourceSelection.productNeedsResourceExtend)(cacheItem);
|
|
328
270
|
}
|
|
329
|
-
return entries.every(
|
|
330
|
-
|
|
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,56 +1,55 @@
|
|
|
1
|
-
|
|
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);
|
|
2
28
|
|
|
3
|
-
|
|
4
|
-
|
|
29
|
+
// src/modules/BookingContext/utils/resourceErrors.ts
|
|
30
|
+
var resourceErrors_exports = {};
|
|
31
|
+
__export(resourceErrors_exports, {
|
|
32
|
+
getResourceErrors: () => getResourceErrors
|
|
5
33
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
/**
|
|
11
|
-
* 结构化的「资源不可用」原因(替代 info2 `getErrorList` 输出的 i18n 文案 + type 字段)。
|
|
12
|
-
*
|
|
13
|
-
* 与 info2 type 字段映射:
|
|
14
|
-
* - `no_product` ↔ type='products'
|
|
15
|
-
* - `time_out_of_range` ↔ type='time'
|
|
16
|
-
* - `count_out_of_range` ↔ type='limit'
|
|
17
|
-
* - `resource_unbound` ↔ type='unbound'
|
|
18
|
-
*
|
|
19
|
-
* OS 这边不耦合 i18n 文案,UI 拿到 reason + params 后自行渲染(参考 docs/SDK 中给出的 i18n key 对照表)。
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* 替代 info2 `utilsByBooking.ts#getErrorList`,输出结构化错误。
|
|
24
|
-
*
|
|
25
|
-
* 行为对齐:
|
|
26
|
-
* 1. cacheItem 没有 id → `no_product`(与 info2 `!cacheItem?.id` 分支等价)。
|
|
27
|
-
* 2. 资源 null / 无 _extend → 返回 []。
|
|
28
|
-
* 3. resource.usable=false 时:
|
|
29
|
-
* - 没有 _extend.usableTime → `time_out_of_range`
|
|
30
|
-
* - 有 usableTime 但 `_extend.isCountRange=false` → `count_out_of_range`
|
|
31
|
-
* 4. resource.unbound=true → 追加 `resource_unbound`。
|
|
32
|
-
* 5. 不再耦合 `_data.resourceMaps[form_id].type === 'single'` 判断(与 info2 实际未使用此变量一致)。
|
|
33
|
-
*/
|
|
34
|
+
module.exports = __toCommonJS(resourceErrors_exports);
|
|
35
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
36
|
+
var import_serviceTimes = require("./serviceTimes");
|
|
34
37
|
function getResourceErrors(resource, cacheItem) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
params: {}
|
|
39
|
-
}];
|
|
38
|
+
var _a, _b, _c, _d;
|
|
39
|
+
if (!(cacheItem == null ? void 0 : cacheItem.id)) {
|
|
40
|
+
return [{ reason: "no_product", params: {} }];
|
|
40
41
|
}
|
|
41
|
-
if (!resource)
|
|
42
|
+
if (!resource)
|
|
43
|
+
return [];
|
|
42
44
|
const list = [];
|
|
43
45
|
if (!resource.usable) {
|
|
44
|
-
const {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const endText = endDate.format('hh:mm A');
|
|
50
|
-
const isCrossDay = (0, _dayjs.default)(endDate).isAfter(startDate, 'day');
|
|
51
|
-
if (!resource._extend?.usableTime) {
|
|
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)) {
|
|
52
51
|
list.push({
|
|
53
|
-
reason:
|
|
52
|
+
reason: "time_out_of_range",
|
|
54
53
|
params: {
|
|
55
54
|
labelText: resource.labelText,
|
|
56
55
|
startText,
|
|
@@ -58,9 +57,9 @@ function getResourceErrors(resource, cacheItem) {
|
|
|
58
57
|
isCrossDay
|
|
59
58
|
}
|
|
60
59
|
});
|
|
61
|
-
} else if (!resource._extend
|
|
60
|
+
} else if (!((_d = (_c = (_b = resource._extend) == null ? void 0 : _b.usableTime) == null ? void 0 : _c._extend) == null ? void 0 : _d.isCountRange)) {
|
|
62
61
|
list.push({
|
|
63
|
-
reason:
|
|
62
|
+
reason: "count_out_of_range",
|
|
64
63
|
params: {
|
|
65
64
|
labelText: resource.labelText,
|
|
66
65
|
startText,
|
|
@@ -71,10 +70,11 @@ function getResourceErrors(resource, cacheItem) {
|
|
|
71
70
|
}
|
|
72
71
|
}
|
|
73
72
|
if (resource.unbound) {
|
|
74
|
-
list.push({
|
|
75
|
-
reason: 'resource_unbound',
|
|
76
|
-
params: {}
|
|
77
|
-
});
|
|
73
|
+
list.push({ reason: "resource_unbound", params: {} });
|
|
78
74
|
}
|
|
79
75
|
return list;
|
|
80
|
-
}
|
|
76
|
+
}
|
|
77
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
78
|
+
0 && (module.exports = {
|
|
79
|
+
getResourceErrors
|
|
80
|
+
});
|