@pisell/pisellos 0.0.567 → 0.0.569
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 +6 -9
- package/dist/model/strategy/adapter/promotion/evaluator.js +3 -2
- package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -2
- package/dist/model/strategy/adapter/walletPass/example.js +3 -26
- package/dist/model/strategy/adapter/walletPass/utils.js +7 -7
- package/dist/model/strategy/strategy-example.js +5 -19
- package/dist/modules/BaseModule.d.ts +2 -2
- package/dist/modules/BaseModule.js +4 -4
- package/dist/modules/BookingContext/index.d.ts +48 -0
- package/dist/modules/BookingContext/index.js +566 -0
- package/dist/modules/BookingContext/types.d.ts +102 -0
- package/dist/modules/BookingContext/types.js +51 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +302 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +149 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +249 -0
- package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/dist/modules/BookingContext/utils/flexible.js +56 -0
- package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/dist/modules/BookingContext/utils/formatResourceList.js +38 -0
- package/dist/modules/BookingContext/utils/index.d.ts +11 -0
- package/dist/modules/BookingContext/utils/index.js +11 -0
- package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/dist/modules/BookingContext/utils/noResource.js +77 -0
- package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
- package/dist/modules/BookingContext/utils/orderLineDisplay.js +36 -0
- package/dist/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/dist/modules/BookingContext/utils/productExtend.js +339 -0
- package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/dist/modules/BookingContext/utils/resourceErrors.js +74 -0
- package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/dist/modules/BookingContext/utils/resourceSelection.js +24 -0
- package/dist/modules/BookingContext/utils/resources.d.ts +80 -0
- package/dist/modules/BookingContext/utils/resources.js +486 -0
- package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/dist/modules/BookingContext/utils/serviceTimes.js +151 -0
- package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/dist/modules/BookingContext/utils/timeSlices.js +100 -0
- package/dist/modules/Cart/index.js +0 -3
- package/dist/modules/Cart/utils/cartProduct.js +26 -6
- package/dist/modules/Cart/utils/changePrice.js +27 -20
- package/dist/modules/Customer/index.d.ts +20 -0
- package/dist/modules/Customer/index.js +172 -83
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Date/index.js +1 -5
- package/dist/modules/Discount/index.d.ts +2 -1
- package/dist/modules/Discount/index.js +37 -12
- package/dist/modules/Discount/types.d.ts +1 -0
- package/dist/modules/OpenData/index.d.ts +8 -0
- package/dist/modules/OpenData/index.js +35 -17
- package/dist/modules/Order/index.d.ts +449 -24
- package/dist/modules/Order/index.js +5437 -608
- package/dist/modules/Order/types.d.ts +693 -88
- package/dist/modules/Order/types.js +68 -1
- package/dist/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
- package/dist/modules/Order/utils/bundleDiscountHydration.js +144 -0
- package/dist/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/dist/modules/Order/utils/manualProductDiscount.js +210 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.js +405 -0
- package/dist/modules/Order/utils.d.ts +167 -18
- package/dist/modules/Order/utils.js +960 -165
- package/dist/modules/Payment/index.d.ts +10 -9
- package/dist/modules/Payment/index.js +508 -874
- package/dist/modules/Payment/types.d.ts +40 -16
- package/dist/modules/Payment/utils.d.ts +1 -1
- package/dist/modules/Payment/utils.js +4 -3
- package/dist/modules/Payment/walletpass.js +48 -34
- package/dist/modules/Product/types.d.ts +29 -7
- package/dist/modules/ProductList/index.d.ts +17 -13
- package/dist/modules/ProductList/index.js +184 -74
- package/dist/modules/ProductList/types.d.ts +17 -0
- package/dist/modules/Quotation/index.d.ts +22 -2
- package/dist/modules/Quotation/index.js +108 -42
- package/dist/modules/Quotation/types.d.ts +19 -0
- package/dist/modules/ResourcePlanner/index.d.ts +24 -0
- package/dist/modules/ResourcePlanner/index.js +181 -0
- package/dist/modules/ResourcePlanner/planner.d.ts +14 -0
- package/dist/modules/ResourcePlanner/planner.js +1069 -0
- package/dist/modules/ResourcePlanner/types.d.ts +227 -0
- package/dist/modules/ResourcePlanner/types.js +1 -0
- package/dist/modules/Rules/index.d.ts +8 -10
- package/dist/modules/Rules/index.js +219 -114
- package/dist/modules/Rules/types.d.ts +14 -3
- package/dist/modules/SalesSummary/index.d.ts +23 -26
- package/dist/modules/SalesSummary/index.js +152 -46
- package/dist/modules/SalesSummary/types.d.ts +9 -1
- package/dist/modules/SalesSummary/utils.d.ts +3 -22
- package/dist/modules/SalesSummary/utils.js +803 -163
- package/dist/modules/Schedule/getDateIsInSchedule.js +14 -7
- package/dist/modules/Schedule/index.d.ts +18 -5
- package/dist/modules/Schedule/index.js +78 -24
- package/dist/modules/Schedule/types.d.ts +2 -0
- package/dist/modules/Schedule/utils.js +0 -1
- package/dist/modules/Step/index.js +0 -1
- package/dist/modules/Summary/index.js +4 -3
- package/dist/modules/SurchargeList/index.d.ts +18 -0
- package/dist/modules/SurchargeList/index.js +185 -0
- package/dist/modules/SurchargeList/types.d.ts +15 -0
- package/dist/modules/SurchargeList/types.js +1 -0
- package/dist/modules/index.d.ts +3 -0
- package/dist/modules/index.js +4 -1
- package/dist/plugins/app.d.ts +2 -0
- package/dist/plugins/request.d.ts +1 -0
- package/dist/plugins/request.js +1 -4
- package/dist/plugins/window.js +2 -6
- package/dist/server/index.d.ts +462 -8
- package/dist/server/index.js +6137 -714
- package/dist/server/modules/floor-plan/index.d.ts +39 -0
- package/dist/server/modules/floor-plan/index.js +595 -0
- package/dist/server/modules/floor-plan/types.d.ts +43 -0
- package/dist/server/modules/floor-plan/types.js +13 -0
- package/dist/server/modules/index.d.ts +7 -2
- package/dist/server/modules/index.js +6 -0
- package/dist/server/modules/menu/index.js +32 -41
- package/dist/server/modules/order/index.d.ts +207 -14
- package/dist/server/modules/order/index.js +2326 -379
- package/dist/server/modules/order/types.d.ts +76 -5
- package/dist/server/modules/order/types.js +14 -1
- package/dist/server/modules/order/utils/filterBookings.d.ts +7 -1
- package/dist/server/modules/order/utils/filterBookings.js +118 -11
- package/dist/server/modules/order/utils/filterOrders.js +242 -14
- package/dist/server/modules/payment/index.d.ts +28 -0
- package/dist/server/modules/payment/index.js +305 -0
- package/dist/server/modules/payment/types.d.ts +9 -0
- package/dist/server/modules/payment/types.js +1 -0
- package/dist/server/modules/products/index.d.ts +105 -14
- package/dist/server/modules/products/index.js +1397 -540
- package/dist/server/modules/products/types.d.ts +34 -1
- package/dist/server/modules/products/types.js +4 -0
- package/dist/server/modules/quotation/index.d.ts +39 -0
- package/dist/server/modules/quotation/index.js +289 -86
- package/dist/server/modules/resource/index.d.ts +2 -3
- package/dist/server/modules/resource/index.js +105 -84
- package/dist/server/modules/schedule/index.d.ts +6 -4
- package/dist/server/modules/schedule/index.js +137 -114
- package/dist/server/test.json +713 -0
- package/dist/server/types.d.ts +2 -0
- package/dist/server/utils/product.js +2 -3
- package/dist/server/utils/small-ticket.d.ts +71 -0
- package/dist/server/utils/small-ticket.js +963 -0
- package/dist/solution/BaseSales/index.d.ts +378 -0
- package/dist/solution/BaseSales/index.js +4006 -0
- package/dist/solution/BaseSales/types.d.ts +394 -0
- package/dist/solution/BaseSales/types.js +40 -0
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
- package/dist/solution/BaseSales/utils/cartPromotion.js +1450 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +144 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.js +157 -0
- package/dist/solution/BaseSales/utils/quotationPrice.d.ts +18 -0
- package/dist/solution/BaseSales/utils/quotationPrice.js +250 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +63 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +218 -0
- package/dist/solution/BaseSales/utils.d.ts +40 -0
- package/dist/solution/BaseSales/utils.js +263 -0
- package/dist/solution/BookingByStep/index.js +7 -59
- package/dist/solution/BookingByStep/utils/capacity.js +1 -11
- package/dist/solution/BookingByStep/utils/resources.js +1 -3
- package/dist/solution/BookingByStep/utils/timeslots.js +2 -43
- package/dist/solution/BookingTicket/index.d.ts +393 -24
- package/dist/solution/BookingTicket/index.js +2506 -445
- package/dist/solution/BookingTicket/types.d.ts +191 -6
- package/dist/solution/BookingTicket/types.js +83 -10
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
- package/dist/solution/BookingTicket/utils/addProductDecision.js +346 -0
- package/dist/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
- package/dist/solution/BookingTicket/utils/addTimeAvailability.js +95 -0
- package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +77 -0
- package/dist/solution/BookingTicket/utils/bookingStatus.js +136 -0
- package/dist/solution/BookingTicket/utils/cartView.d.ts +29 -0
- package/dist/solution/BookingTicket/utils/cartView.js +209 -0
- package/dist/solution/BookingTicket/utils/exampleData.d.ts +123 -0
- package/dist/solution/BookingTicket/utils/exampleData.js +183 -0
- package/dist/solution/BookingTicket/utils/orderCustomer.d.ts +4 -0
- package/dist/solution/BookingTicket/utils/orderCustomer.js +31 -0
- package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
- package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.js +438 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +400 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +4 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +41 -1
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +56 -0
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +36 -34
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/dist/solution/BookingTicket/utils/scan/index.js +26 -18
- package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
- package/dist/solution/BookingTicket/utils/scan/scanProductValues.js +150 -0
- package/dist/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
- package/dist/solution/BookingTicket/utils/sessionCatalogStale.js +78 -0
- package/dist/solution/BuyTickets/index.js +9 -12
- package/dist/solution/Checkout/index.d.ts +1 -0
- package/dist/solution/Checkout/index.js +199 -277
- package/dist/solution/Checkout/utils/index.js +8 -20
- package/dist/solution/RegisterAndLogin/config.js +2 -10
- package/dist/solution/RegisterAndLogin/index.js +30 -76
- package/dist/solution/Sales/index.d.ts +50 -5
- package/dist/solution/Sales/index.js +484 -92
- package/dist/solution/Sales/types.d.ts +26 -2
- package/dist/solution/ScanOrder/index.d.ts +27 -21
- package/dist/solution/ScanOrder/index.js +509 -454
- package/dist/solution/ScanOrder/types.d.ts +33 -11
- package/dist/solution/ScanOrder/types.js +4 -5
- package/dist/solution/ScanOrder/utils.d.ts +4 -1
- package/dist/solution/ScanOrder/utils.js +109 -34
- package/dist/solution/ShopDiscount/index.js +6 -11
- package/dist/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/dist/solution/UnifiedBookingSales/index.js +1871 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/dist/solution/UnifiedBookingSales/types.js +11 -0
- package/dist/solution/VenueBooking/index.d.ts +34 -20
- package/dist/solution/VenueBooking/index.js +630 -505
- package/dist/solution/VenueBooking/sales-section-4-annotated.json +0 -2
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +6 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +9 -3
- package/dist/solution/index.d.ts +2 -0
- package/dist/solution/index.js +3 -1
- package/dist/types/index.d.ts +11 -1
- package/dist/utils/task.js +15 -18
- package/dist/utils/watch.js +0 -1
- package/lib/apis/picoding.js +2 -0
- package/lib/core/index.js +130 -131
- package/lib/effects/index.js +46 -57
- package/lib/index.js +92 -53
- package/lib/model/index.js +14 -21
- package/lib/model/strategy/adapter/dataVariant/adapter.js +38 -50
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +162 -236
- package/lib/model/strategy/adapter/dataVariant/examples.js +229 -237
- package/lib/model/strategy/adapter/dataVariant/index.js +39 -34
- package/lib/model/strategy/adapter/dataVariant/type.js +57 -28
- package/lib/model/strategy/adapter/index.js +100 -64
- package/lib/model/strategy/adapter/itemRule/adapter.js +156 -144
- package/lib/model/strategy/adapter/itemRule/evaluator.js +36 -48
- package/lib/model/strategy/adapter/itemRule/examples.js +295 -225
- package/lib/model/strategy/adapter/itemRule/index.js +83 -57
- package/lib/model/strategy/adapter/itemRule/type.js +97 -36
- package/lib/model/strategy/adapter/promotion/adapter.js +84 -63
- package/lib/model/strategy/adapter/promotion/evaluator.js +383 -232
- package/lib/model/strategy/adapter/promotion/examples.js +139 -159
- package/lib/model/strategy/adapter/promotion/index.js +1 -49
- package/lib/model/strategy/adapter/promotion/type.js +199 -35
- package/lib/model/strategy/adapter/type.js +4 -16
- package/lib/model/strategy/adapter/walletPass/evaluator.js +180 -152
- package/lib/model/strategy/adapter/walletPass/example.js +217 -190
- package/lib/model/strategy/adapter/walletPass/index.js +75 -51
- package/lib/model/strategy/adapter/walletPass/locales.js +36 -58
- package/lib/model/strategy/adapter/walletPass/type.js +4 -16
- package/lib/model/strategy/adapter/walletPass/utils.js +654 -402
- package/lib/model/strategy/engine.js +270 -168
- package/lib/model/strategy/index.js +49 -34
- package/lib/model/strategy/strategy-example.js +243 -239
- package/lib/model/strategy/type.js +100 -40
- package/lib/modules/Account/index.js +39 -53
- package/lib/modules/Account/types.js +20 -33
- package/lib/modules/AccountList/index.js +116 -154
- package/lib/modules/AccountList/types.js +30 -31
- package/lib/modules/AccountList/utils.js +18 -30
- package/lib/modules/BaseModule.d.ts +2 -2
- package/lib/modules/BaseModule.js +26 -49
- package/lib/modules/BookingContext/index.d.ts +48 -0
- package/lib/modules/BookingContext/index.js +390 -0
- package/lib/modules/BookingContext/types.d.ts +102 -0
- package/lib/modules/BookingContext/types.js +48 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +286 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +148 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +242 -0
- package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/lib/modules/BookingContext/utils/flexible.js +63 -0
- package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/lib/modules/BookingContext/utils/formatResourceList.js +35 -0
- package/lib/modules/BookingContext/utils/index.d.ts +11 -0
- package/lib/modules/BookingContext/utils/index.js +126 -0
- package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/lib/modules/BookingContext/utils/noResource.js +78 -0
- package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
- package/lib/modules/BookingContext/utils/orderLineDisplay.js +29 -0
- package/lib/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/lib/modules/BookingContext/utils/productExtend.js +330 -0
- package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/lib/modules/BookingContext/utils/resourceErrors.js +80 -0
- package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/lib/modules/BookingContext/utils/resourceSelection.js +24 -0
- package/lib/modules/BookingContext/utils/resources.d.ts +80 -0
- package/lib/modules/BookingContext/utils/resources.js +419 -0
- package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/lib/modules/BookingContext/utils/serviceTimes.js +161 -0
- package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/lib/modules/BookingContext/utils/timeSlices.js +114 -0
- package/lib/modules/Cart/index.js +170 -124
- package/lib/modules/Cart/types.js +46 -51
- package/lib/modules/Cart/utils/cartAccount.js +40 -39
- package/lib/modules/Cart/utils/cartDate.js +56 -61
- package/lib/modules/Cart/utils/cartDiscount.js +28 -33
- package/lib/modules/Cart/utils/cartNote.js +27 -32
- package/lib/modules/Cart/utils/cartProduct.js +331 -244
- package/lib/modules/Cart/utils/cartRelationForms.js +29 -35
- package/lib/modules/Cart/utils/cartResource.js +72 -78
- package/lib/modules/Cart/utils/changePrice.js +37 -67
- package/lib/modules/Cart/utils/index.js +106 -48
- package/lib/modules/Customer/constants.js +13 -34
- package/lib/modules/Customer/index.d.ts +20 -0
- package/lib/modules/Customer/index.js +270 -154
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Customer/types.js +38 -35
- package/lib/modules/Date/index.js +116 -115
- package/lib/modules/Date/types.js +16 -28
- package/lib/modules/Date/utils.js +174 -123
- package/lib/modules/Discount/index.d.ts +2 -1
- package/lib/modules/Discount/index.js +133 -113
- package/lib/modules/Discount/types.d.ts +1 -0
- package/lib/modules/Discount/types.js +9 -31
- package/lib/modules/Guests/index.js +30 -56
- package/lib/modules/Guests/types.js +23 -33
- package/lib/modules/Holder/index.js +209 -189
- package/lib/modules/Holder/types.js +4 -16
- package/lib/modules/Holder/utils.js +20 -49
- package/lib/modules/OpenData/index.d.ts +8 -0
- package/lib/modules/OpenData/index.js +81 -74
- package/lib/modules/OpenData/types.js +4 -16
- package/lib/modules/OpenData/utils.js +44 -78
- package/lib/modules/Order/index.d.ts +449 -24
- package/lib/modules/Order/index.js +3834 -489
- package/lib/modules/Order/types.d.ts +693 -88
- package/lib/modules/Order/types.js +78 -33
- package/lib/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
- package/lib/modules/Order/utils/bundleDiscountHydration.js +106 -0
- package/lib/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/lib/modules/Order/utils/manualProductDiscount.js +207 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.js +353 -0
- package/lib/modules/Order/utils.d.ts +167 -18
- package/lib/modules/Order/utils.js +1247 -345
- package/lib/modules/Payment/cash.js +20 -33
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +145 -76
- package/lib/modules/Payment/eftpos.js +16 -30
- package/lib/modules/Payment/index.d.ts +10 -9
- package/lib/modules/Payment/index.js +542 -502
- package/lib/modules/Payment/mx51.js +1 -0
- package/lib/modules/Payment/types.d.ts +40 -16
- package/lib/modules/Payment/types.js +216 -107
- package/lib/modules/Payment/utils.d.ts +1 -1
- package/lib/modules/Payment/utils.js +53 -49
- package/lib/modules/Payment/walletpass.js +231 -203
- package/lib/modules/Product/index.js +51 -46
- package/lib/modules/Product/types.d.ts +29 -7
- package/lib/modules/Product/types.js +4 -16
- package/lib/modules/Product/utils.js +32 -33
- package/lib/modules/ProductList/index.d.ts +17 -13
- package/lib/modules/ProductList/index.js +160 -118
- package/lib/modules/ProductList/types.d.ts +17 -0
- package/lib/modules/ProductList/types.js +9 -31
- package/lib/modules/Quotation/index.d.ts +22 -2
- package/lib/modules/Quotation/index.js +123 -89
- package/lib/modules/Quotation/types.d.ts +19 -0
- package/lib/modules/Quotation/types.js +4 -16
- package/lib/modules/Resource/index.js +27 -59
- package/lib/modules/Resource/types.js +22 -32
- package/lib/modules/Resource/utils.js +30 -38
- package/lib/modules/ResourcePlanner/index.d.ts +24 -0
- package/lib/modules/ResourcePlanner/index.js +147 -0
- package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
- package/lib/modules/ResourcePlanner/planner.js +895 -0
- package/lib/modules/ResourcePlanner/types.d.ts +227 -0
- package/lib/modules/ResourcePlanner/types.js +5 -0
- package/lib/modules/Rules/index.d.ts +8 -10
- package/lib/modules/Rules/index.js +1286 -894
- package/lib/modules/Rules/types.d.ts +14 -3
- package/lib/modules/Rules/types.js +17 -40
- package/lib/modules/SalesSummary/index.d.ts +23 -26
- package/lib/modules/SalesSummary/index.js +130 -71
- package/lib/modules/SalesSummary/types.d.ts +9 -1
- package/lib/modules/SalesSummary/types.js +4 -16
- package/lib/modules/SalesSummary/utils.d.ts +3 -22
- package/lib/modules/SalesSummary/utils.js +738 -250
- package/lib/modules/ScanOrderLogger/index.js +59 -79
- package/lib/modules/ScanOrderLogger/providers/feishu.js +54 -78
- package/lib/modules/ScanOrderLogger/providers/grafana.js +13 -36
- package/lib/modules/ScanOrderLogger/types.js +4 -16
- package/lib/modules/Schedule/getDateIsInSchedule.js +345 -171
- package/lib/modules/Schedule/index.d.ts +18 -5
- package/lib/modules/Schedule/index.js +139 -114
- package/lib/modules/Schedule/type.js +4 -16
- package/lib/modules/Schedule/types.d.ts +2 -0
- package/lib/modules/Schedule/types.js +4 -16
- package/lib/modules/Schedule/utils.js +433 -291
- package/lib/modules/Step/index.js +40 -52
- package/lib/modules/Step/tyeps.js +4 -16
- package/lib/modules/Summary/index.js +66 -70
- package/lib/modules/Summary/types.js +4 -16
- package/lib/modules/Summary/utils.js +782 -429
- package/lib/modules/SurchargeList/index.d.ts +18 -0
- package/lib/modules/SurchargeList/index.js +95 -0
- package/lib/modules/SurchargeList/types.d.ts +15 -0
- package/lib/modules/SurchargeList/types.js +5 -0
- package/lib/modules/index.d.ts +3 -0
- package/lib/modules/index.js +245 -57
- package/lib/plugins/app.d.ts +2 -0
- package/lib/plugins/app.js +4 -16
- package/lib/plugins/index.js +36 -25
- package/lib/plugins/request.d.ts +1 -0
- package/lib/plugins/request.js +137 -126
- package/lib/plugins/shopStore.js +4 -16
- package/lib/plugins/user.js +4 -16
- package/lib/plugins/window.js +171 -179
- package/lib/server/index.d.ts +462 -8
- package/lib/server/index.js +4668 -713
- package/lib/server/modules/floor-plan/index.d.ts +39 -0
- package/lib/server/modules/floor-plan/index.js +306 -0
- package/lib/server/modules/floor-plan/types.d.ts +43 -0
- package/lib/server/modules/floor-plan/types.js +19 -0
- package/lib/server/modules/index.d.ts +7 -2
- package/lib/server/modules/index.js +106 -59
- package/lib/server/modules/menu/index.js +146 -122
- package/lib/server/modules/menu/types.js +18 -31
- package/lib/server/modules/order/index.d.ts +207 -14
- package/lib/server/modules/order/index.js +1463 -316
- package/lib/server/modules/order/types.d.ts +76 -5
- package/lib/server/modules/order/types.js +117 -32
- package/lib/server/modules/order/utils/filterBookings.d.ts +7 -1
- package/lib/server/modules/order/utils/filterBookings.js +288 -146
- package/lib/server/modules/order/utils/filterOrders.js +318 -64
- package/lib/server/modules/payment/index.d.ts +28 -0
- package/lib/server/modules/payment/index.js +168 -0
- package/lib/server/modules/payment/types.d.ts +9 -0
- package/lib/server/modules/payment/types.js +5 -0
- package/lib/server/modules/products/index.d.ts +105 -14
- package/lib/server/modules/products/index.js +969 -383
- package/lib/server/modules/products/types.d.ts +34 -1
- package/lib/server/modules/products/types.js +44 -34
- package/lib/server/modules/quotation/index.d.ts +39 -0
- package/lib/server/modules/quotation/index.js +220 -77
- package/lib/server/modules/quotation/types.js +21 -31
- package/lib/server/modules/resource/index.d.ts +2 -3
- package/lib/server/modules/resource/index.js +269 -214
- package/lib/server/modules/resource/types.js +42 -33
- package/lib/server/modules/schedule/index.d.ts +6 -4
- package/lib/server/modules/schedule/index.js +158 -132
- package/lib/server/modules/schedule/types.js +14 -21
- package/lib/server/modules/schedule/utils.js +334 -163
- package/lib/server/test.json +713 -0
- package/lib/server/types.d.ts +2 -0
- package/lib/server/types.js +4 -16
- package/lib/server/utils/index.js +25 -23
- package/lib/server/utils/product.js +197 -140
- package/lib/server/utils/schedule.js +34 -41
- package/lib/server/utils/small-ticket.d.ts +71 -0
- package/lib/server/utils/small-ticket.js +926 -0
- package/lib/server/utils/time.js +40 -49
- package/lib/solution/BaseSales/index.d.ts +378 -0
- package/lib/solution/BaseSales/index.js +2367 -0
- package/lib/solution/BaseSales/types.d.ts +394 -0
- package/lib/solution/BaseSales/types.js +47 -0
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
- package/lib/solution/BaseSales/utils/cartPromotion.js +1155 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +144 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +140 -0
- package/lib/solution/BaseSales/utils/quotationPrice.d.ts +18 -0
- package/lib/solution/BaseSales/utils/quotationPrice.js +231 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +63 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +215 -0
- package/lib/solution/BaseSales/utils.d.ts +40 -0
- package/lib/solution/BaseSales/utils.js +259 -0
- package/lib/solution/BookingByStep/index.js +1530 -1343
- package/lib/solution/BookingByStep/types.js +40 -99
- package/lib/solution/BookingByStep/utils/capacity.js +192 -160
- package/lib/solution/BookingByStep/utils/products.js +42 -52
- package/lib/solution/BookingByStep/utils/resources.js +527 -330
- package/lib/solution/BookingByStep/utils/stock.js +65 -44
- package/lib/solution/BookingByStep/utils/timeslots.js +129 -131
- package/lib/solution/BookingTicket/index.d.ts +393 -24
- package/lib/solution/BookingTicket/index.js +1459 -160
- package/lib/solution/BookingTicket/types.d.ts +191 -6
- package/lib/solution/BookingTicket/types.js +101 -66
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.js +353 -0
- package/lib/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
- package/lib/solution/BookingTicket/utils/addTimeAvailability.js +94 -0
- package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +77 -0
- package/lib/solution/BookingTicket/utils/bookingStatus.js +136 -0
- package/lib/solution/BookingTicket/utils/cartView.d.ts +29 -0
- package/lib/solution/BookingTicket/utils/cartView.js +200 -0
- package/lib/solution/BookingTicket/utils/exampleData.d.ts +123 -0
- package/lib/solution/BookingTicket/utils/exampleData.js +185 -0
- package/lib/solution/BookingTicket/utils/orderCustomer.d.ts +4 -0
- package/lib/solution/BookingTicket/utils/orderCustomer.js +35 -0
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +387 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +220 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +4 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +85 -80
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +64 -0
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +84 -80
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/lib/solution/BookingTicket/utils/scan/index.js +103 -95
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +90 -43
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +115 -0
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +83 -0
- package/lib/solution/BuyTickets/index.js +67 -70
- package/lib/solution/BuyTickets/types.js +22 -38
- package/lib/solution/Checkout/index.d.ts +1 -0
- package/lib/solution/Checkout/index.js +1461 -1169
- package/lib/solution/Checkout/types.js +91 -61
- package/lib/solution/Checkout/utils/index.js +228 -159
- package/lib/solution/PlaceOrder/index.js +55 -0
- package/lib/solution/RegisterAndLogin/config.js +495 -470
- package/lib/solution/RegisterAndLogin/index.js +633 -630
- package/lib/solution/RegisterAndLogin/types.js +189 -76
- package/lib/solution/RegisterAndLogin/utils.js +183 -125
- package/lib/solution/Sales/index.d.ts +50 -5
- package/lib/solution/Sales/index.js +495 -220
- package/lib/solution/Sales/types.d.ts +26 -2
- package/lib/solution/Sales/types.js +27 -33
- package/lib/solution/ScanOrder/index.d.ts +27 -21
- package/lib/solution/ScanOrder/index.js +908 -904
- package/lib/solution/ScanOrder/types.d.ts +33 -11
- package/lib/solution/ScanOrder/types.js +33 -34
- package/lib/solution/ScanOrder/utils.d.ts +4 -1
- package/lib/solution/ScanOrder/utils.js +457 -344
- package/lib/solution/ShopDiscount/index.js +230 -236
- package/lib/solution/ShopDiscount/types.js +15 -37
- package/lib/solution/ShopDiscount/utils.js +309 -172
- package/lib/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/lib/solution/UnifiedBookingSales/index.js +1050 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/lib/solution/UnifiedBookingSales/types.js +14 -0
- package/lib/solution/VenueBooking/index.d.ts +34 -20
- package/lib/solution/VenueBooking/index.js +982 -950
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +0 -2
- package/lib/solution/VenueBooking/types.js +20 -40
- package/lib/solution/VenueBooking/utils/dateSummary.js +22 -54
- package/lib/solution/VenueBooking/utils/resource.js +31 -54
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +6 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +96 -108
- package/lib/solution/VenueBooking/utils/smartPricing.js +112 -100
- package/lib/solution/VenueBooking/utils/timeSlot.js +133 -132
- package/lib/solution/VenueBooking/utils.js +130 -67
- package/lib/solution/index.d.ts +2 -0
- package/lib/solution/index.js +124 -37
- package/lib/store/createStore.js +32 -29
- package/lib/types/index.d.ts +11 -1
- package/lib/types/index.js +4 -16
- package/lib/utils/task.js +36 -36
- package/lib/utils/watch.js +81 -47
- package/package.json +2 -1
- package/dist/solution/Checkout/appointmentDemo.json +0 -1
- package/lib/solution/Checkout/appointmentDemo.json +0 -1
|
@@ -1,87 +1,100 @@
|
|
|
1
|
-
|
|
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
"use strict";
|
|
19
2
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
HolderModule: true
|
|
8
|
+
};
|
|
9
|
+
exports.HolderModule = void 0;
|
|
10
|
+
var _lodashEs = require("lodash-es");
|
|
11
|
+
var _BaseModule = require("../BaseModule");
|
|
12
|
+
var _utils = require("./utils");
|
|
13
|
+
Object.keys(_utils).forEach(function (key) {
|
|
14
|
+
if (key === "default" || key === "__esModule") return;
|
|
15
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
16
|
+
if (key in exports && exports[key] === _utils[key]) return;
|
|
17
|
+
Object.defineProperty(exports, key, {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () {
|
|
20
|
+
return _utils[key];
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
var _types = require("./types");
|
|
25
|
+
Object.keys(_types).forEach(function (key) {
|
|
26
|
+
if (key === "default" || key === "__esModule") return;
|
|
27
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
28
|
+
if (key in exports && exports[key] === _types[key]) return;
|
|
29
|
+
Object.defineProperty(exports, key, {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function () {
|
|
32
|
+
return _types[key];
|
|
33
|
+
}
|
|
34
|
+
});
|
|
24
35
|
});
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
36
|
+
class HolderModule extends _BaseModule.BaseModule {
|
|
37
|
+
defaultName = 'holder';
|
|
38
|
+
defaultVersion = '1.0.0';
|
|
39
|
+
store;
|
|
40
|
+
request;
|
|
41
|
+
cacheId;
|
|
42
|
+
openCache = false;
|
|
43
|
+
fatherModule;
|
|
44
|
+
isLoading = false;
|
|
45
|
+
error = null;
|
|
46
|
+
/** 已加载过表单数据的 form_id 缓存标记 */
|
|
47
|
+
loadedFormIds = new Set();
|
|
48
|
+
window;
|
|
32
49
|
constructor(name, version) {
|
|
33
50
|
super(name, version);
|
|
34
|
-
this.defaultName = "holder";
|
|
35
|
-
this.defaultVersion = "1.0.0";
|
|
36
|
-
this.openCache = false;
|
|
37
|
-
this.isLoading = false;
|
|
38
|
-
this.error = null;
|
|
39
|
-
/** 已加载过表单数据的 form_id 缓存标记 */
|
|
40
|
-
this.loadedFormIds = /* @__PURE__ */ new Set();
|
|
41
51
|
}
|
|
42
52
|
async initialize(core, options) {
|
|
43
|
-
var _a, _b, _c;
|
|
44
53
|
this.core = core;
|
|
45
54
|
this.store = options.store;
|
|
46
|
-
this.request = this.core.getPlugin(
|
|
47
|
-
this.window = this.core.getPlugin(
|
|
48
|
-
if (
|
|
49
|
-
this.commitFormMap((0,
|
|
50
|
-
Object.keys(this.store.holderMap).forEach(
|
|
55
|
+
this.request = this.core.getPlugin('request');
|
|
56
|
+
this.window = this.core.getPlugin('window');
|
|
57
|
+
if (options.initialState?.holderMap) {
|
|
58
|
+
this.commitFormMap((0, _lodashEs.cloneDeep)(options.initialState.holderMap));
|
|
59
|
+
Object.keys(this.store.holderMap).forEach(formId => {
|
|
51
60
|
if (this.hasFormData(formId)) {
|
|
52
61
|
this.loadedFormIds.add(formId);
|
|
53
62
|
}
|
|
54
63
|
});
|
|
55
64
|
}
|
|
56
|
-
if (!this.store.holderMap || typeof this.store.holderMap !==
|
|
65
|
+
if (!this.store.holderMap || typeof this.store.holderMap !== 'object') {
|
|
57
66
|
this.store.holderMap = {};
|
|
58
67
|
}
|
|
59
|
-
if (
|
|
68
|
+
if (options.otherParams?.cacheId) {
|
|
60
69
|
this.openCache = options.otherParams.openCache;
|
|
61
70
|
this.cacheId = options.otherParams.cacheId;
|
|
62
71
|
}
|
|
63
|
-
if (
|
|
72
|
+
if (options.otherParams?.fatherModule) {
|
|
64
73
|
this.fatherModule = options.otherParams.fatherModule;
|
|
65
74
|
}
|
|
66
75
|
}
|
|
76
|
+
|
|
67
77
|
/** 统一提交 formMap,仅此处触发 store changed */
|
|
68
78
|
commitFormMap(holderMap) {
|
|
69
79
|
this.store.holderMap = holderMap;
|
|
70
80
|
}
|
|
81
|
+
|
|
71
82
|
/** 通知 UI 刷新(数据未变但需要 re-read 的场景) */
|
|
72
83
|
notifyFormMapChanged() {
|
|
73
|
-
this.commitFormMap({
|
|
84
|
+
this.commitFormMap({
|
|
85
|
+
...this.store.holderMap
|
|
86
|
+
});
|
|
74
87
|
}
|
|
75
88
|
getHolderFormMap() {
|
|
76
|
-
return (0,
|
|
89
|
+
return (0, _lodashEs.cloneDeep)(this.store.holderMap);
|
|
77
90
|
}
|
|
78
91
|
getHolderFormData(formId) {
|
|
79
|
-
const formData = this.store.holderMap[(0,
|
|
80
|
-
return formData ? (0,
|
|
92
|
+
const formData = this.store.holderMap[(0, _utils.normalizeFormId)(formId)];
|
|
93
|
+
return formData ? (0, _lodashEs.cloneDeep)(formData) : undefined;
|
|
81
94
|
}
|
|
82
95
|
setFormData(formId, data) {
|
|
83
|
-
const key = (0,
|
|
84
|
-
const current = this.store.holderMap[key] || (0,
|
|
96
|
+
const key = (0, _utils.normalizeFormId)(formId);
|
|
97
|
+
const current = this.store.holderMap[key] || (0, _utils.createEmptyFormItemData)();
|
|
85
98
|
this.commitFormMap({
|
|
86
99
|
...this.store.holderMap,
|
|
87
100
|
[key]: {
|
|
@@ -91,9 +104,9 @@ var HolderModule = class extends import_BaseModule.BaseModule {
|
|
|
91
104
|
});
|
|
92
105
|
}
|
|
93
106
|
ensureFormItem(formId, holderMap = this.store.holderMap) {
|
|
94
|
-
const key = (0,
|
|
107
|
+
const key = (0, _utils.normalizeFormId)(formId);
|
|
95
108
|
if (!holderMap[key]) {
|
|
96
|
-
holderMap[key] = (0,
|
|
109
|
+
holderMap[key] = (0, _utils.createEmptyFormItemData)();
|
|
97
110
|
}
|
|
98
111
|
return holderMap[key];
|
|
99
112
|
}
|
|
@@ -109,23 +122,33 @@ var HolderModule = class extends import_BaseModule.BaseModule {
|
|
|
109
122
|
};
|
|
110
123
|
}
|
|
111
124
|
async fetchFormInfo(params) {
|
|
112
|
-
const {
|
|
125
|
+
const {
|
|
126
|
+
form_id
|
|
127
|
+
} = params.query || {};
|
|
113
128
|
const url = params.url || `/form/${form_id}`;
|
|
114
129
|
const useCache = params.useCache !== false;
|
|
115
130
|
this.isLoading = true;
|
|
116
131
|
this.error = null;
|
|
117
132
|
try {
|
|
118
|
-
const res = await this.request.get(url, {}, {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
const
|
|
122
|
-
formList.
|
|
123
|
-
|
|
124
|
-
this.
|
|
133
|
+
const res = await this.request.get(url, {}, {
|
|
134
|
+
useCache
|
|
135
|
+
});
|
|
136
|
+
const formData = res?.data;
|
|
137
|
+
const formList = Array.isArray(formData?.list) ? formData.list : formData ? [formData] : [];
|
|
138
|
+
const nextFormMap = {
|
|
139
|
+
...this.store.holderMap
|
|
140
|
+
};
|
|
141
|
+
formList.forEach(form => {
|
|
142
|
+
const key = (0, _utils.normalizeFormId)(form.form_id ?? form_id ?? form.id);
|
|
143
|
+
this.patchFormMap(nextFormMap, key, {
|
|
144
|
+
form
|
|
145
|
+
});
|
|
125
146
|
});
|
|
126
|
-
if (!formList.length && form_id !==
|
|
127
|
-
const key = (0,
|
|
128
|
-
this.patchFormMap(nextFormMap, key, {
|
|
147
|
+
if (!formList.length && form_id !== undefined) {
|
|
148
|
+
const key = (0, _utils.normalizeFormId)(form_id);
|
|
149
|
+
this.patchFormMap(nextFormMap, key, {
|
|
150
|
+
form: formData || {}
|
|
151
|
+
});
|
|
129
152
|
}
|
|
130
153
|
this.commitFormMap(nextFormMap);
|
|
131
154
|
return formList.length === 1 ? formList[0] : formList;
|
|
@@ -137,34 +160,41 @@ var HolderModule = class extends import_BaseModule.BaseModule {
|
|
|
137
160
|
}
|
|
138
161
|
}
|
|
139
162
|
async fetchRecords(params) {
|
|
140
|
-
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
|
|
163
|
+
const url = params.url || '/form/data/v1';
|
|
164
|
+
const {
|
|
165
|
+
form_id,
|
|
166
|
+
shop_id,
|
|
167
|
+
num,
|
|
168
|
+
skip,
|
|
169
|
+
customer_id,
|
|
170
|
+
...rest
|
|
171
|
+
} = params.query || {};
|
|
172
|
+
const formId = (0, _utils.normalizeFormId)(form_id);
|
|
144
173
|
const useCache = params.useCache !== false;
|
|
145
|
-
const customer = JSON.parse(
|
|
174
|
+
const customer = JSON.parse(this.window?.getLocalStorage?.('customer') || '{}');
|
|
146
175
|
const customerId = customer_id ?? customer.id;
|
|
147
|
-
if (!customerId)
|
|
148
|
-
return [];
|
|
176
|
+
if (!customerId) return [];
|
|
149
177
|
this.isLoading = true;
|
|
150
178
|
this.error = null;
|
|
151
179
|
try {
|
|
152
|
-
const res = await this.request.get(
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
this.patchFormMap(nextFormMap, formId, {
|
|
180
|
+
const res = await this.request.get(url, {
|
|
181
|
+
customer_id: customerId,
|
|
182
|
+
form_id,
|
|
183
|
+
shop_id,
|
|
184
|
+
num: num || 100,
|
|
185
|
+
skip: skip || 1,
|
|
186
|
+
front_end_cache_id: useCache && this.cacheId,
|
|
187
|
+
...rest
|
|
188
|
+
}, {
|
|
189
|
+
useCache
|
|
190
|
+
});
|
|
191
|
+
const records = res?.data?.list || [];
|
|
192
|
+
const nextFormMap = {
|
|
193
|
+
...this.store.holderMap
|
|
194
|
+
};
|
|
195
|
+
this.patchFormMap(nextFormMap, formId, {
|
|
196
|
+
records
|
|
197
|
+
});
|
|
168
198
|
this.commitFormMap(nextFormMap);
|
|
169
199
|
return records;
|
|
170
200
|
} catch (error) {
|
|
@@ -175,7 +205,7 @@ var HolderModule = class extends import_BaseModule.BaseModule {
|
|
|
175
205
|
}
|
|
176
206
|
}
|
|
177
207
|
async ensureFormData(params) {
|
|
178
|
-
const formId = (0,
|
|
208
|
+
const formId = (0, _utils.normalizeFormId)(params.form_id);
|
|
179
209
|
const useCache = params.useCache !== false;
|
|
180
210
|
if (useCache && !params.forceRefresh && this.loadedFormIds.has(formId)) {
|
|
181
211
|
this.notifyFormMapChanged();
|
|
@@ -184,28 +214,24 @@ var HolderModule = class extends import_BaseModule.BaseModule {
|
|
|
184
214
|
const current = this.ensureFormItem(formId);
|
|
185
215
|
const tasks = [];
|
|
186
216
|
if (params.forceRefresh || !Object.keys(current.form || {}).length) {
|
|
187
|
-
tasks.push(
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
})
|
|
195
|
-
);
|
|
217
|
+
tasks.push(this.fetchFormInfo({
|
|
218
|
+
url: params.formInfoUrl,
|
|
219
|
+
query: {
|
|
220
|
+
form_id: params.form_id
|
|
221
|
+
},
|
|
222
|
+
useCache
|
|
223
|
+
}));
|
|
196
224
|
}
|
|
197
225
|
if (params.forceRefresh || !current.records.length) {
|
|
198
|
-
tasks.push(
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
})
|
|
208
|
-
);
|
|
226
|
+
tasks.push(this.fetchRecords({
|
|
227
|
+
url: params.recordsUrl,
|
|
228
|
+
query: {
|
|
229
|
+
form_id: params.form_id,
|
|
230
|
+
shop_id: params.shop_id,
|
|
231
|
+
customer_id: params.customer_id
|
|
232
|
+
},
|
|
233
|
+
useCache
|
|
234
|
+
}));
|
|
209
235
|
}
|
|
210
236
|
if (!tasks.length) {
|
|
211
237
|
this.notifyFormMapChanged();
|
|
@@ -216,10 +242,9 @@ var HolderModule = class extends import_BaseModule.BaseModule {
|
|
|
216
242
|
return this.ensureFormItem(formId);
|
|
217
243
|
}
|
|
218
244
|
async ensureFormByProduct(params) {
|
|
219
|
-
const holderConfig = (0,
|
|
220
|
-
if (!holderConfig)
|
|
221
|
-
|
|
222
|
-
const formId = (0, import_utils.getFormIdFromHolderConfig)(holderConfig);
|
|
245
|
+
const holderConfig = (0, _utils.getProductHolderConfig)(params.product);
|
|
246
|
+
if (!holderConfig) return null;
|
|
247
|
+
const formId = (0, _utils.getFormIdFromHolderConfig)(holderConfig);
|
|
223
248
|
const shopId = params.shop_id ?? params.product.shop_id;
|
|
224
249
|
return this.ensureFormData({
|
|
225
250
|
form_id: formId,
|
|
@@ -231,8 +256,8 @@ var HolderModule = class extends import_BaseModule.BaseModule {
|
|
|
231
256
|
});
|
|
232
257
|
}
|
|
233
258
|
async addFormRecord(params) {
|
|
234
|
-
const url = params.url ||
|
|
235
|
-
const formId = (0,
|
|
259
|
+
const url = params.url || '/form/record';
|
|
260
|
+
const formId = (0, _utils.normalizeFormId)(params.body.form_id);
|
|
236
261
|
this.isLoading = true;
|
|
237
262
|
this.error = null;
|
|
238
263
|
try {
|
|
@@ -254,55 +279,57 @@ var HolderModule = class extends import_BaseModule.BaseModule {
|
|
|
254
279
|
this.isLoading = false;
|
|
255
280
|
}
|
|
256
281
|
}
|
|
282
|
+
|
|
257
283
|
/**
|
|
258
284
|
* UI 层自行请求添加接口后,将返回记录合并到 holderMap 对应 form_id 的 records 中
|
|
259
285
|
*/
|
|
260
286
|
appendFormRecord(params) {
|
|
261
287
|
let record = params.record;
|
|
262
|
-
if (
|
|
288
|
+
if (record?.data && record.form_record_id === undefined) {
|
|
263
289
|
record = record.data;
|
|
264
290
|
}
|
|
265
|
-
const normalizedRecord = (0,
|
|
266
|
-
const formId = (0,
|
|
267
|
-
params.form_id ?? normalizedRecord.form_id
|
|
268
|
-
);
|
|
291
|
+
const normalizedRecord = (0, _lodashEs.cloneDeep)(record);
|
|
292
|
+
const formId = (0, _utils.normalizeFormId)(params.form_id ?? normalizedRecord.form_id);
|
|
269
293
|
if (!formId) {
|
|
270
|
-
throw new Error(
|
|
294
|
+
throw new Error('[HolderModule] appendFormRecord: form_id is required');
|
|
271
295
|
}
|
|
272
296
|
if (!normalizedRecord.form_record_id) {
|
|
273
|
-
throw new Error(
|
|
274
|
-
"[HolderModule] appendFormRecord: form_record_id is required"
|
|
275
|
-
);
|
|
297
|
+
throw new Error('[HolderModule] appendFormRecord: form_record_id is required');
|
|
276
298
|
}
|
|
277
299
|
normalizedRecord.form_id = Number(formId) || normalizedRecord.form_id;
|
|
278
|
-
const nextFormMap = {
|
|
300
|
+
const nextFormMap = {
|
|
301
|
+
...this.store.holderMap
|
|
302
|
+
};
|
|
279
303
|
const current = this.ensureFormItem(formId, nextFormMap);
|
|
280
|
-
const recordIndex = current.records.findIndex(
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
304
|
+
const recordIndex = current.records.findIndex(item => item.form_record_id === normalizedRecord.form_record_id);
|
|
305
|
+
const records = recordIndex >= 0 ? current.records.map((item, index) => index === recordIndex ? {
|
|
306
|
+
...item,
|
|
307
|
+
...normalizedRecord
|
|
308
|
+
} : item) : [...current.records, normalizedRecord];
|
|
309
|
+
this.patchFormMap(nextFormMap, formId, {
|
|
310
|
+
records
|
|
311
|
+
});
|
|
287
312
|
this.commitFormMap(nextFormMap);
|
|
288
313
|
this.loadedFormIds.add(formId);
|
|
289
314
|
return normalizedRecord;
|
|
290
315
|
}
|
|
291
316
|
removeFormRecord(formId, formRecordId) {
|
|
292
|
-
const key = (0,
|
|
293
|
-
const current = this.store.holderMap[key] || (0,
|
|
294
|
-
const nextFormMap = {
|
|
317
|
+
const key = (0, _utils.normalizeFormId)(formId);
|
|
318
|
+
const current = this.store.holderMap[key] || (0, _utils.createEmptyFormItemData)();
|
|
319
|
+
const nextFormMap = {
|
|
320
|
+
...this.store.holderMap
|
|
321
|
+
};
|
|
295
322
|
this.patchFormMap(nextFormMap, key, {
|
|
296
|
-
records: current.records.filter(
|
|
297
|
-
(record) => record.form_record_id !== formRecordId
|
|
298
|
-
)
|
|
323
|
+
records: current.records.filter(record => record.form_record_id !== formRecordId)
|
|
299
324
|
});
|
|
300
325
|
this.commitFormMap(nextFormMap);
|
|
301
326
|
}
|
|
302
327
|
clearFormData(formId) {
|
|
303
|
-
if (formId !==
|
|
304
|
-
const key = (0,
|
|
305
|
-
const nextFormMap = {
|
|
328
|
+
if (formId !== undefined) {
|
|
329
|
+
const key = (0, _utils.normalizeFormId)(formId);
|
|
330
|
+
const nextFormMap = {
|
|
331
|
+
...this.store.holderMap
|
|
332
|
+
};
|
|
306
333
|
delete nextFormMap[key];
|
|
307
334
|
this.loadedFormIds.delete(key);
|
|
308
335
|
this.commitFormMap(nextFormMap);
|
|
@@ -311,12 +338,18 @@ var HolderModule = class extends import_BaseModule.BaseModule {
|
|
|
311
338
|
this.commitFormMap({});
|
|
312
339
|
}
|
|
313
340
|
}
|
|
341
|
+
|
|
314
342
|
/**
|
|
315
343
|
* 登录后按当前 holderMap 批量刷新所有表单的 records。
|
|
316
344
|
* 遍历 holderMap,从 form.form 中读取 form_id、shop_id,结合 customer_id 重新拉取记录。
|
|
317
345
|
*/
|
|
318
346
|
async refreshAllFormRecords(params = {}) {
|
|
319
|
-
const {
|
|
347
|
+
const {
|
|
348
|
+
customer_id,
|
|
349
|
+
recordsUrl,
|
|
350
|
+
num,
|
|
351
|
+
skip
|
|
352
|
+
} = params;
|
|
320
353
|
const useCache = params.useCache ?? false;
|
|
321
354
|
if (!customer_id) {
|
|
322
355
|
return this.getHolderFormMap();
|
|
@@ -325,53 +358,45 @@ var HolderModule = class extends import_BaseModule.BaseModule {
|
|
|
325
358
|
if (!entries.length) {
|
|
326
359
|
return this.getHolderFormMap();
|
|
327
360
|
}
|
|
328
|
-
const url = recordsUrl ||
|
|
361
|
+
const url = recordsUrl || '/form/data/v1';
|
|
329
362
|
this.isLoading = true;
|
|
330
363
|
this.error = null;
|
|
331
364
|
try {
|
|
332
|
-
const results = await Promise.all(
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
return null;
|
|
361
|
-
}
|
|
362
|
-
})
|
|
363
|
-
);
|
|
364
|
-
const nextFormMap = { ...this.store.holderMap };
|
|
365
|
-
results.forEach((result) => {
|
|
366
|
-
if (!result)
|
|
367
|
-
return;
|
|
365
|
+
const results = await Promise.all(entries.map(async ([mapKey, item]) => {
|
|
366
|
+
const meta = (0, _utils.resolveFormMetaFromHolderItem)(mapKey, item);
|
|
367
|
+
if (!meta) return null;
|
|
368
|
+
try {
|
|
369
|
+
const res = await this.request.get(url, {
|
|
370
|
+
customer_id,
|
|
371
|
+
form_id: meta.form_id,
|
|
372
|
+
shop_id: meta.shop_id,
|
|
373
|
+
num: num || 100,
|
|
374
|
+
skip: skip || 1,
|
|
375
|
+
front_end_cache_id: useCache && this.cacheId
|
|
376
|
+
}, {
|
|
377
|
+
useCache
|
|
378
|
+
});
|
|
379
|
+
return {
|
|
380
|
+
formId: meta.form_id,
|
|
381
|
+
records: res?.data?.list || []
|
|
382
|
+
};
|
|
383
|
+
} catch (error) {
|
|
384
|
+
console.error(`[HolderModule] refreshAllFormRecords failed for form ${meta.form_id}`, error);
|
|
385
|
+
return null;
|
|
386
|
+
}
|
|
387
|
+
}));
|
|
388
|
+
const nextFormMap = {
|
|
389
|
+
...this.store.holderMap
|
|
390
|
+
};
|
|
391
|
+
results.forEach(result => {
|
|
392
|
+
if (!result) return;
|
|
368
393
|
this.patchFormMap(nextFormMap, result.formId, {
|
|
369
394
|
records: result.records
|
|
370
395
|
});
|
|
371
396
|
this.loadedFormIds.add(result.formId);
|
|
372
397
|
});
|
|
373
398
|
this.commitFormMap(nextFormMap);
|
|
374
|
-
return (0,
|
|
399
|
+
return (0, _lodashEs.cloneDeep)(nextFormMap);
|
|
375
400
|
} catch (error) {
|
|
376
401
|
this.error = error instanceof Error ? error.message : String(error);
|
|
377
402
|
throw error;
|
|
@@ -380,23 +405,18 @@ var HolderModule = class extends import_BaseModule.BaseModule {
|
|
|
380
405
|
}
|
|
381
406
|
}
|
|
382
407
|
storeChange(path) {
|
|
383
|
-
if (path !==
|
|
408
|
+
if (path !== 'holderMap' && path !== undefined) {
|
|
384
409
|
return;
|
|
385
410
|
}
|
|
386
411
|
if (this.openCache) {
|
|
387
|
-
const store = (0,
|
|
412
|
+
const store = (0, _lodashEs.cloneDeep)(this.store);
|
|
388
413
|
this.checkSaveCache({
|
|
389
414
|
cacheId: this.cacheId,
|
|
390
415
|
fatherModule: this.fatherModule,
|
|
391
416
|
store,
|
|
392
|
-
cacheKey: [
|
|
417
|
+
cacheKey: ['holderMap']
|
|
393
418
|
});
|
|
394
419
|
}
|
|
395
420
|
}
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
0 && (module.exports = {
|
|
399
|
-
HolderModule,
|
|
400
|
-
...require("./types"),
|
|
401
|
-
...require("./utils")
|
|
402
|
-
});
|
|
421
|
+
}
|
|
422
|
+
exports.HolderModule = HolderModule;
|
|
@@ -1,17 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
-
for (let key of __getOwnPropNames(from))
|
|
8
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
-
}
|
|
11
|
-
return to;
|
|
12
|
-
};
|
|
13
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
"use strict";
|
|
14
2
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|