@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
|
@@ -118,27 +118,6 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
118
118
|
moduleName: "venueBooking"
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
|
-
safeStringify(value) {
|
|
122
|
-
try {
|
|
123
|
-
return JSON.stringify(value);
|
|
124
|
-
} catch {
|
|
125
|
-
return void 0;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
pickErrorMessage(error) {
|
|
129
|
-
var _a, _b, _c, _d;
|
|
130
|
-
const candidates = [
|
|
131
|
-
error.message,
|
|
132
|
-
(_a = error.data) == null ? void 0 : _a.message,
|
|
133
|
-
(_c = (_b = error.response) == null ? void 0 : _b.data) == null ? void 0 : _c.message,
|
|
134
|
-
(_d = error.error) == null ? void 0 : _d.message
|
|
135
|
-
];
|
|
136
|
-
for (const candidate of candidates) {
|
|
137
|
-
if (typeof candidate === "string" && candidate.trim())
|
|
138
|
-
return candidate;
|
|
139
|
-
}
|
|
140
|
-
return void 0;
|
|
141
|
-
}
|
|
142
121
|
serializeError(error) {
|
|
143
122
|
if (error instanceof Error) {
|
|
144
123
|
return {
|
|
@@ -147,17 +126,6 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
147
126
|
stack: error.stack
|
|
148
127
|
};
|
|
149
128
|
}
|
|
150
|
-
if (error && typeof error === "object") {
|
|
151
|
-
const raw = error;
|
|
152
|
-
const message = this.pickErrorMessage(raw) || this.safeStringify(raw) || String(error);
|
|
153
|
-
return {
|
|
154
|
-
...typeof raw.name === "string" ? { name: raw.name } : {},
|
|
155
|
-
message,
|
|
156
|
-
..."code" in raw ? { code: raw.code } : {},
|
|
157
|
-
..."status" in raw ? { status: raw.status } : {},
|
|
158
|
-
...this.safeStringify(raw) ? { raw: this.safeStringify(raw) } : {}
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
129
|
return {
|
|
162
130
|
message: String(error)
|
|
163
131
|
};
|
|
@@ -373,14 +341,12 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
373
341
|
if (targetModule) {
|
|
374
342
|
this.store[step] = targetModule;
|
|
375
343
|
const initialState = step === "salesSummary" ? {
|
|
344
|
+
// TODO(Order types): VenueBooking should read OrderState.summary instead of tempOrder.summary.
|
|
376
345
|
summary: ((_b2 = (_a2 = this.store.order) == null ? void 0 : _a2.getTempOrder()) == null ? void 0 : _b2.summary) || (0, import_utils.createEmptySummary)()
|
|
377
346
|
} : {};
|
|
378
347
|
const loggerProvider = ((_c2 = this.otherParams) == null ? void 0 : _c2.loggerProvider) || "feishu";
|
|
379
348
|
const loggerConfig = ((_d2 = this.otherParams) == null ? void 0 : _d2.loggerConfig) || {
|
|
380
|
-
feishu: {
|
|
381
|
-
webhook: "https://open.feishu.cn/open-apis/bot/v2/hook/8f069b14-9d39-4728-8f78-b56f393bfde8",
|
|
382
|
-
errorHook: "https://open.feishu.cn/open-apis/bot/v2/hook/bdefae5e-f233-4705-8688-946887d9543d"
|
|
383
|
-
}
|
|
349
|
+
feishu: {}
|
|
384
350
|
};
|
|
385
351
|
this.core.registerModule(targetModule, {
|
|
386
352
|
initialState,
|
|
@@ -558,10 +524,8 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
558
524
|
throw new Error("venueProducts 模块未初始化");
|
|
559
525
|
if (!this.store.addonProducts)
|
|
560
526
|
throw new Error("addonProducts 模块未初始化");
|
|
561
|
-
await this.loadOpenDataConfig();
|
|
562
527
|
const associatedMenus = ((_b = (_a = this.otherParams) == null ? void 0 : _a.openData) == null ? void 0 : _b["menu.associated_menus"]) || [];
|
|
563
528
|
if (!associatedMenus.length) {
|
|
564
|
-
this.logMethodError("loadAllProducts", new Error("未获取到餐牌配置(menu.associated_menus),请检查 OpenData 配置"));
|
|
565
529
|
throw new Error("未获取到餐牌配置(menu.associated_menus),请检查 OpenData 配置");
|
|
566
530
|
}
|
|
567
531
|
const menuListIds = associatedMenus.map((n) => Number(n.value));
|
|
@@ -1025,7 +989,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1025
989
|
form_id: (rawResource == null ? void 0 : rawResource.form_id) ?? mapping.formId,
|
|
1026
990
|
relation_id: resourceId,
|
|
1027
991
|
capacity: 1,
|
|
1028
|
-
metadata:
|
|
992
|
+
metadata: {}
|
|
1029
993
|
};
|
|
1030
994
|
if (childRawResources && childRawResources.length) {
|
|
1031
995
|
resourceEntry.children = childRawResources.map((child) => ({
|
|
@@ -1077,7 +1041,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1077
1041
|
product_variant_id: 0,
|
|
1078
1042
|
num: 1,
|
|
1079
1043
|
product_bundle: [],
|
|
1080
|
-
|
|
1044
|
+
product_option_item: [],
|
|
1081
1045
|
discount_list: [],
|
|
1082
1046
|
custom_deposit_data: customDepositData,
|
|
1083
1047
|
metadata: {}
|
|
@@ -1348,7 +1312,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1348
1312
|
(sum, pd) => sum + (pd.amount || 0),
|
|
1349
1313
|
0
|
|
1350
1314
|
);
|
|
1351
|
-
const optionSum = (0, import_utils3.sumOptionUnitPrice)(
|
|
1315
|
+
const optionSum = (0, import_utils3.sumOptionUnitPrice)(product.product_option_item);
|
|
1352
1316
|
const sourcePrice = ((_d = product.metadata) == null ? void 0 : _d.source_product_price) ?? (((_e = product.metadata) == null ? void 0 : _e.main_product_original_price) != null ? new import_decimal.default(Number(product.metadata.main_product_original_price) || 0).minus(optionSum).toFixed(2) : product.original_price ?? "0");
|
|
1353
1317
|
const newSourceSellingPrice = new import_decimal.default(Number(sourcePrice) || 0).minus(totalPerUnitDiscount).toDecimalPlaces(2).toString();
|
|
1354
1318
|
const newMainSellingPrice = new import_decimal.default(Number(newSourceSellingPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
|
|
@@ -1395,8 +1359,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1395
1359
|
getOrderProducts() {
|
|
1396
1360
|
if (!this.store.order)
|
|
1397
1361
|
throw new Error("order 模块未初始化");
|
|
1398
|
-
|
|
1399
|
-
return products;
|
|
1362
|
+
return this.store.order.getOrderProducts();
|
|
1400
1363
|
}
|
|
1401
1364
|
async getSummary() {
|
|
1402
1365
|
this.logMethodStart("getSummary");
|
|
@@ -1472,23 +1435,23 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1472
1435
|
throw error;
|
|
1473
1436
|
}
|
|
1474
1437
|
}
|
|
1475
|
-
async
|
|
1476
|
-
this.logMethodStart("
|
|
1438
|
+
async updateProductInOrder(params) {
|
|
1439
|
+
this.logMethodStart("updateProductInOrder", {
|
|
1477
1440
|
product_id: params.product_id,
|
|
1478
1441
|
product_variant_id: params.product_variant_id
|
|
1479
1442
|
});
|
|
1480
1443
|
try {
|
|
1481
1444
|
if (!this.store.order)
|
|
1482
1445
|
throw new Error("order 模块未初始化");
|
|
1483
|
-
const products = await this.store.order.
|
|
1446
|
+
const products = await this.store.order.updateProductInOrder(params);
|
|
1484
1447
|
await this.refreshItemRuleQuantityLimits();
|
|
1485
1448
|
await this.refreshCartValidationPassed();
|
|
1486
|
-
this.logMethodSuccess("
|
|
1449
|
+
this.logMethodSuccess("updateProductInOrder", {
|
|
1487
1450
|
productCount: products.length
|
|
1488
1451
|
});
|
|
1489
1452
|
return products;
|
|
1490
1453
|
} catch (error) {
|
|
1491
|
-
this.logMethodError("
|
|
1454
|
+
this.logMethodError("updateProductInOrder", error);
|
|
1492
1455
|
throw error;
|
|
1493
1456
|
}
|
|
1494
1457
|
}
|
|
@@ -1567,19 +1530,18 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1567
1530
|
return cachedData;
|
|
1568
1531
|
}
|
|
1569
1532
|
if (this.loadOpenDataConfigInFlight)
|
|
1570
|
-
return
|
|
1533
|
+
return this.loadOpenDataConfigInFlight;
|
|
1571
1534
|
this.loadOpenDataConfigInFlight = this.store.openData.fetchOpenData({
|
|
1572
1535
|
scope: "board",
|
|
1573
1536
|
target: "venue_booking+online_store",
|
|
1574
1537
|
section_code: [...OPEN_DATA_SECTION_CODES]
|
|
1575
|
-
})
|
|
1576
|
-
try {
|
|
1577
|
-
const openDataConfig = await this.loadOpenDataConfigInFlight;
|
|
1538
|
+
}).then((openDataConfig) => {
|
|
1578
1539
|
this.otherParams.openData = openDataConfig;
|
|
1579
1540
|
return openDataConfig;
|
|
1580
|
-
}
|
|
1541
|
+
}).finally(() => {
|
|
1581
1542
|
this.loadOpenDataConfigInFlight = null;
|
|
1582
|
-
}
|
|
1543
|
+
});
|
|
1544
|
+
return this.loadOpenDataConfigInFlight;
|
|
1583
1545
|
}
|
|
1584
1546
|
async loadRuntimeConfigs() {
|
|
1585
1547
|
await this.loadOpenDataConfig();
|
|
@@ -1755,6 +1717,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1755
1717
|
...targetProduct,
|
|
1756
1718
|
...delta > 0 ? { num: (0, import_utils.getSafeProductNum)(existedQuantity + delta) } : {},
|
|
1757
1719
|
metadata: { ...targetProduct.metadata || {}, item_rule_prefill: true, item_rule_id: prefillItem.ruleId },
|
|
1720
|
+
// TODO(Order types): migrate VenueBooking prefill origin runtime into tempOrder._extend.
|
|
1758
1721
|
_origin: sourceItem ? { ...targetProduct._origin || {}, ...sourceItem } : targetProduct._origin
|
|
1759
1722
|
};
|
|
1760
1723
|
if (delta > 0 || Boolean(
|
|
@@ -71,6 +71,8 @@
|
|
|
71
71
|
"num__comment": "数量;int;↕;必填。统一使用 num,不再使用 product_quantity。",
|
|
72
72
|
"product_variant_id": 0,
|
|
73
73
|
"product_variant_id__comment": "多规格 ID;int;↕;可选。",
|
|
74
|
+
"product_option_item": [],
|
|
75
|
+
"product_option_item__comment": "选项配置;array;↕;可选。",
|
|
74
76
|
"selling_price": "50.00",
|
|
75
77
|
"selling_price__comment": "销售单价(交易快照);string;←;服务端返回,不能依赖基准数据回填。",
|
|
76
78
|
"original_price": "60.00",
|
|
@@ -12,10 +12,6 @@ export declare function buildPriceBreakdown(params: {
|
|
|
12
12
|
}) => number;
|
|
13
13
|
};
|
|
14
14
|
}): PriceBreakdownEntry[];
|
|
15
|
-
export declare function buildVenueResourceMetadata(params: {
|
|
16
|
-
mapping: ResourceProductMapping;
|
|
17
|
-
rawResource: VenueResourceRawData | undefined;
|
|
18
|
-
}): Record<string, any>;
|
|
19
15
|
export interface BuildVenueBookingParams {
|
|
20
16
|
group: MergedSlotGroup;
|
|
21
17
|
resourceId: number | string;
|
|
@@ -32,7 +32,6 @@ __export(slotMerge_exports, {
|
|
|
32
32
|
buildPriceBreakdown: () => buildPriceBreakdown,
|
|
33
33
|
buildVenueBookingEntry: () => buildVenueBookingEntry,
|
|
34
34
|
buildVenueIdentityKey: () => buildVenueIdentityKey,
|
|
35
|
-
buildVenueResourceMetadata: () => buildVenueResourceMetadata,
|
|
36
35
|
expandMergedSlotToIndividual: () => expandMergedSlotToIndividual,
|
|
37
36
|
mergeConsecutiveSlots: () => mergeConsecutiveSlots
|
|
38
37
|
});
|
|
@@ -107,14 +106,6 @@ function buildPriceBreakdown(params) {
|
|
|
107
106
|
}
|
|
108
107
|
return entries;
|
|
109
108
|
}
|
|
110
|
-
function buildVenueResourceMetadata(params) {
|
|
111
|
-
const { mapping, rawResource } = params;
|
|
112
|
-
return {
|
|
113
|
-
form_name: (rawResource == null ? void 0 : rawResource.form_name) ?? "",
|
|
114
|
-
resource_name: (rawResource == null ? void 0 : rawResource.main_field) ?? mapping.resourceName ?? "",
|
|
115
|
-
combined_resource: (rawResource == null ? void 0 : rawResource.combined_resource) ?? null
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
109
|
function buildVenueBookingEntry(params) {
|
|
119
110
|
const { group, resourceId, mapping, rawResource, bookingUuid, productUid, childResources } = params;
|
|
120
111
|
const startMoment = (0, import_dayjs.default)(group.startTime, "YYYY-MM-DD HH:mm");
|
|
@@ -229,7 +220,6 @@ function expandMergedSlotToIndividual(product, slotDurationMinutes) {
|
|
|
229
220
|
buildPriceBreakdown,
|
|
230
221
|
buildVenueBookingEntry,
|
|
231
222
|
buildVenueIdentityKey,
|
|
232
|
-
buildVenueResourceMetadata,
|
|
233
223
|
expandMergedSlotToIndividual,
|
|
234
224
|
mergeConsecutiveSlots
|
|
235
225
|
});
|
package/lib/types/index.d.ts
CHANGED
|
@@ -14,16 +14,6 @@ export interface Module {
|
|
|
14
14
|
name: string;
|
|
15
15
|
version: string;
|
|
16
16
|
initialize: (core: PisellCore, options: ModuleOptions) => Promise<void> | void;
|
|
17
|
-
/**
|
|
18
|
-
* 父级解决方案运行时更新 otherParams 后,显式通知子模块刷新自己的运行态参数。
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* await module.updateOtherParams?.({ channel: 'pos' }, { changedParams: { channel: 'pos' } });
|
|
22
|
-
*/
|
|
23
|
-
updateOtherParams?: (params: Record<string, any>, meta?: {
|
|
24
|
-
changedParams?: Record<string, any>;
|
|
25
|
-
cover?: boolean;
|
|
26
|
-
}) => Promise<void> | void;
|
|
27
17
|
destroy?: () => Promise<void> | void;
|
|
28
18
|
exports?: Record<string, any>;
|
|
29
19
|
isSolution?: boolean;
|
package/package.json
CHANGED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { Module, ModuleOptions, PisellCore } from '../../types';
|
|
2
|
-
import { BaseModule } from '../BaseModule';
|
|
3
|
-
import { BookingContextConfig, BookingContextDateInput, BookingContextModuleAPI, BookingContextResource, BookingContextResourceMap, BookingContextState, InitBookingContextParams, LoadBookingConfigParams, LoadBookingResourcesParams } from './types';
|
|
4
|
-
export * from './types';
|
|
5
|
-
export * from './utils';
|
|
6
|
-
/**
|
|
7
|
-
* 清理跨实例共享缓存,仅供单元测试隔离使用。
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* __clearBookingContextSharedCacheForTest();
|
|
11
|
-
*/
|
|
12
|
-
export declare function __clearBookingContextSharedCacheForTest(): void;
|
|
13
|
-
/** 稳定序列化 config 查询参数,用于判断是否与上次 loadBookingConfig 一致。 */
|
|
14
|
-
export declare function buildBookingConfigQueryKey(params?: LoadBookingConfigParams): string;
|
|
15
|
-
/** 稳定序列化资源列表查询(date + bookingIds),用于跳过重复 loadResources。 */
|
|
16
|
-
export declare function buildBookingResourcesQueryKey(params?: LoadBookingResourcesParams): string;
|
|
17
|
-
export declare class BookingContextModule extends BaseModule implements Module, BookingContextModuleAPI {
|
|
18
|
-
protected defaultName: string;
|
|
19
|
-
protected defaultVersion: string;
|
|
20
|
-
private request;
|
|
21
|
-
private store;
|
|
22
|
-
/** 上次成功 loadBookingConfig 的 query key;命中则不再请求。 */
|
|
23
|
-
private lastConfigQueryKey;
|
|
24
|
-
/** 上次成功 loadResources 的 query key(date|bookingIds);命中则不再请求。 */
|
|
25
|
-
private lastResourcesQueryKey;
|
|
26
|
-
constructor(name?: string, version?: string);
|
|
27
|
-
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
28
|
-
loadBookingConfig(params?: LoadBookingConfigParams, options?: {
|
|
29
|
-
forceRefresh?: boolean;
|
|
30
|
-
}): Promise<BookingContextConfig | null>;
|
|
31
|
-
loadResources(params?: LoadBookingResourcesParams, options?: {
|
|
32
|
-
forceRefresh?: boolean;
|
|
33
|
-
}): Promise<BookingContextResource[]>;
|
|
34
|
-
/**
|
|
35
|
-
* store 内是否已具备与本次 init 入参等价的 config / resources(不再打接口)。
|
|
36
|
-
*/
|
|
37
|
-
isBookingContextReady(params?: InitBookingContextParams): boolean;
|
|
38
|
-
initBookingContext(params?: InitBookingContextParams): Promise<BookingContextState>;
|
|
39
|
-
setBookingConfig(config: BookingContextConfig | null): void;
|
|
40
|
-
getBookingConfig(): BookingContextConfig | null;
|
|
41
|
-
setResources(resources: BookingContextResource[] | null | undefined): void;
|
|
42
|
-
getResourcesOrigin(): BookingContextResource[];
|
|
43
|
-
getResourcesOriginMap(): BookingContextResourceMap;
|
|
44
|
-
setDate(date: BookingContextDateInput): void;
|
|
45
|
-
getDate(): string | null;
|
|
46
|
-
getState(): BookingContextState;
|
|
47
|
-
clear(): void;
|
|
48
|
-
}
|