@pisell/pisellos 2.2.314 → 2.2.316
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/index.d.ts +2 -0
- package/dist/index.js +3 -1
- package/dist/model/strategy/adapter/itemRule/adapter.d.ts +3 -1
- package/dist/model/strategy/adapter/itemRule/adapter.js +74 -7
- package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +3 -1
- package/dist/model/strategy/adapter/itemRule/evaluator.js +13 -0
- package/dist/model/strategy/adapter/itemRule/type.d.ts +40 -1
- package/dist/model/strategy/adapter/itemRule/type.js +10 -0
- package/dist/model/strategy/adapter/promotion/evaluator.js +89 -104
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +3 -1
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +28 -4
- package/dist/modules/BookingContext/utils/productExtend.d.ts +7 -0
- package/dist/modules/BookingContext/utils/productExtend.js +62 -18
- package/dist/modules/BookingContext/utils/resources.js +1 -1
- package/dist/modules/BusinessAvailability/index.d.ts +30 -0
- package/dist/modules/BusinessAvailability/index.js +204 -0
- package/dist/modules/Cart/index.js +4 -3
- package/dist/modules/Cart/types.d.ts +2 -0
- package/dist/modules/Cart/utils/cartProduct.d.ts +3 -1
- package/dist/modules/Cart/utils/cartProduct.js +59 -32
- package/dist/modules/FulfillmentTiming/index.d.ts +11 -0
- package/dist/modules/FulfillmentTiming/index.js +407 -0
- package/dist/modules/FulfillmentTiming/types.d.ts +67 -0
- package/dist/modules/FulfillmentTiming/types.js +1 -0
- package/dist/modules/Holder/utils.d.ts +2 -0
- package/dist/modules/Holder/utils.js +32 -2
- package/dist/modules/OpenData/contactInfo.d.ts +20 -0
- package/dist/modules/OpenData/contactInfo.js +70 -0
- package/dist/modules/OpenData/index.d.ts +1 -0
- package/dist/modules/OpenData/index.js +1 -0
- package/dist/modules/OpenData/types.d.ts +23 -0
- package/dist/modules/Order/holderRelations.d.ts +14 -0
- package/dist/modules/Order/holderRelations.js +154 -0
- package/dist/modules/Order/index.d.ts +16 -4
- package/dist/modules/Order/index.js +926 -511
- package/dist/modules/Order/localEftposState.d.ts +13 -0
- package/dist/modules/Order/localEftposState.js +39 -0
- package/dist/modules/Order/pickupTiming.d.ts +46 -0
- package/dist/modules/Order/pickupTiming.js +53 -0
- package/dist/modules/Order/types.d.ts +49 -3
- package/dist/modules/Order/types.js +2 -0
- package/dist/modules/Order/utils/discountProductLineIdentity.d.ts +1 -1
- package/dist/modules/Order/utils/discountProductLineIdentity.js +142 -7
- package/dist/modules/Order/utils/orderCollectionIdentity.js +24 -10
- package/dist/modules/Order/utils.d.ts +2 -1
- package/dist/modules/Order/utils.js +61 -17
- package/dist/modules/Payment/index.js +9 -10
- package/dist/modules/Product/types.d.ts +11 -0
- package/dist/modules/ProductList/index.js +1 -1
- package/dist/modules/ResourcePlanner/planner.d.ts +2 -0
- package/dist/modules/ResourcePlanner/planner.js +332 -23
- package/dist/modules/ResourcePlanner/types.d.ts +29 -0
- package/dist/modules/Rules/index.js +62 -61
- package/dist/modules/Schedule/index.d.ts +8 -0
- package/dist/modules/Schedule/index.js +141 -39
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/index.js +1 -0
- package/dist/plugins/request.d.ts +7 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +1557 -1322
- package/dist/server/modules/form/index.d.ts +19 -0
- package/dist/server/modules/form/index.js +205 -0
- package/dist/server/modules/form/types.d.ts +13 -0
- package/dist/server/modules/form/types.js +3 -0
- package/dist/server/modules/index.d.ts +3 -0
- package/dist/server/modules/index.js +4 -0
- package/dist/server/modules/order/index.d.ts +19 -0
- package/dist/server/modules/order/index.js +1071 -774
- package/dist/server/modules/order/types.d.ts +4 -0
- package/dist/server/modules/products/index.d.ts +28 -7
- package/dist/server/modules/products/index.js +1297 -770
- package/dist/server/modules/products/replication.d.ts +8 -0
- package/dist/server/modules/products/replication.js +69 -0
- package/dist/server/modules/products/types.d.ts +12 -1
- package/dist/server/modules/products/types.js +4 -0
- package/dist/server/test.json +1 -1
- package/dist/server/utils/small-ticket.d.ts +1 -85
- package/dist/server/utils/small-ticket.js +2 -2542
- package/dist/shared/payment/loadPaymentMethods.d.ts +9 -0
- package/dist/shared/payment/loadPaymentMethods.js +66 -0
- package/dist/shared/receipt/customerInvoiceLanguages.d.ts +8 -0
- package/dist/shared/receipt/customerInvoiceLanguages.js +60 -0
- package/dist/shared/receipt/loadCustomerInvoiceLayout.d.ts +27 -0
- package/dist/shared/receipt/loadCustomerInvoiceLayout.js +184 -0
- package/dist/shared/receipt/small-ticket.d.ts +96 -0
- package/dist/shared/receipt/small-ticket.js +2763 -0
- package/dist/shared/receipt/templateVisibility.d.ts +26 -0
- package/dist/shared/receipt/templateVisibility.js +68 -0
- package/dist/shared/sales/loadSalesOrderSnapshot.d.ts +9 -0
- package/dist/shared/sales/loadSalesOrderSnapshot.js +21 -0
- package/dist/solution/BaseSales/fulfillmentItemRules.d.ts +27 -0
- package/dist/solution/BaseSales/fulfillmentItemRules.js +750 -0
- package/dist/solution/BaseSales/index.d.ts +43 -16
- package/dist/solution/BaseSales/index.js +2028 -1247
- package/dist/solution/BaseSales/pickupTiming.d.ts +47 -0
- package/dist/solution/BaseSales/pickupTiming.js +616 -0
- package/dist/solution/BaseSales/types.d.ts +12 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +3 -1
- package/dist/solution/BaseSales/utils/parseSalesResponse.js +10 -3
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +14 -4
- package/dist/solution/BookingByStep/index.d.ts +4 -2
- package/dist/solution/BookingByStep/index.js +8 -3
- package/dist/solution/BookingTicket/index.d.ts +23 -3
- package/dist/solution/BookingTicket/index.js +867 -507
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +0 -1
- package/dist/solution/BookingTicket/utils/addProductDecision.js +1 -1
- package/dist/solution/BookingTicket/utils/cartView.js +3 -1
- package/dist/solution/OrderInvoicePreview/index.d.ts +66 -0
- package/dist/solution/OrderInvoicePreview/index.js +340 -0
- package/dist/solution/RegisterAndLogin/config.js +54 -11
- package/dist/solution/RegisterAndLogin/index.d.ts +2 -0
- package/dist/solution/RegisterAndLogin/index.js +1 -1
- package/dist/solution/RegisterAndLogin/utils.d.ts +12 -4
- package/dist/solution/RegisterAndLogin/utils.js +36 -16
- package/dist/solution/ScanOrder/index.js +65 -31
- package/dist/solution/ScanOrder/types.d.ts +3 -0
- package/dist/solution/UnifiedBookingSales/businessAvailability.d.ts +27 -0
- package/dist/solution/UnifiedBookingSales/businessAvailability.js +292 -0
- package/dist/solution/UnifiedBookingSales/index.d.ts +36 -4
- package/dist/solution/UnifiedBookingSales/index.js +1715 -906
- package/dist/solution/UnifiedBookingSales/types.d.ts +16 -2
- package/dist/solution/VenueBooking/index.d.ts +15 -2
- package/dist/solution/VenueBooking/index.js +1062 -785
- package/dist/solution/VenueBooking/types.d.ts +2 -1
- package/dist/solution/VenueBooking/types.js +1 -0
- package/dist/solution/VenueBooking/utils/dateSummary.d.ts +1 -0
- package/dist/solution/VenueBooking/utils/dateSummary.js +7 -4
- package/dist/solution/VenueBooking/utils/smartPricing.d.ts +71 -0
- package/dist/solution/VenueBooking/utils/smartPricing.js +273 -0
- package/dist/solution/VenueBooking/utils/timeSlot.d.ts +1 -0
- package/dist/solution/VenueBooking/utils/timeSlot.js +6 -3
- package/dist/solution/index.d.ts +1 -0
- package/dist/solution/index.js +2 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +21 -1
- package/lib/model/strategy/adapter/itemRule/adapter.d.ts +3 -1
- package/lib/model/strategy/adapter/itemRule/adapter.js +54 -4
- package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +3 -1
- package/lib/model/strategy/adapter/itemRule/evaluator.js +9 -0
- package/lib/model/strategy/adapter/itemRule/type.d.ts +40 -1
- package/lib/model/strategy/adapter/itemRule/type.js +10 -0
- package/lib/model/strategy/adapter/promotion/evaluator.js +9 -14
- package/lib/model/strategy/adapter/promotion/index.js +46 -1
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +3 -1
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +17 -1
- package/lib/modules/BookingContext/utils/productExtend.d.ts +7 -0
- package/lib/modules/BookingContext/utils/productExtend.js +45 -2
- package/lib/modules/BookingContext/utils/resources.js +1 -1
- package/lib/modules/BusinessAvailability/index.d.ts +30 -0
- package/lib/modules/BusinessAvailability/index.js +146 -0
- package/lib/modules/Cart/index.js +4 -2
- package/lib/modules/Cart/types.d.ts +2 -0
- package/lib/modules/Cart/utils/cartProduct.d.ts +3 -1
- package/lib/modules/Cart/utils/cartProduct.js +39 -20
- package/lib/modules/FulfillmentTiming/index.d.ts +11 -0
- package/lib/modules/FulfillmentTiming/index.js +359 -0
- package/lib/modules/FulfillmentTiming/types.d.ts +67 -0
- package/lib/modules/FulfillmentTiming/types.js +5 -0
- package/lib/modules/Holder/utils.d.ts +2 -0
- package/lib/modules/Holder/utils.js +27 -1
- package/lib/modules/OpenData/contactInfo.d.ts +20 -0
- package/lib/modules/OpenData/contactInfo.js +56 -0
- package/lib/modules/OpenData/index.d.ts +1 -0
- package/lib/modules/OpenData/index.js +12 -0
- package/lib/modules/OpenData/types.d.ts +23 -0
- package/lib/modules/Order/holderRelations.d.ts +14 -0
- package/lib/modules/Order/holderRelations.js +98 -0
- package/lib/modules/Order/index.d.ts +16 -4
- package/lib/modules/Order/index.js +284 -50
- package/lib/modules/Order/localEftposState.d.ts +13 -0
- package/lib/modules/Order/localEftposState.js +44 -0
- package/lib/modules/Order/pickupTiming.d.ts +46 -0
- package/lib/modules/Order/pickupTiming.js +61 -0
- package/lib/modules/Order/types.d.ts +49 -3
- package/lib/modules/Order/types.js +1 -0
- package/lib/modules/Order/utils/discountProductLineIdentity.d.ts +1 -1
- package/lib/modules/Order/utils/discountProductLineIdentity.js +51 -2
- package/lib/modules/Order/utils/orderCollectionIdentity.js +5 -0
- package/lib/modules/Order/utils.d.ts +2 -1
- package/lib/modules/Order/utils.js +49 -11
- package/lib/modules/Payment/index.js +3 -4
- package/lib/modules/Product/types.d.ts +11 -0
- package/lib/modules/ProductList/index.js +1 -1
- package/lib/modules/ResourcePlanner/planner.d.ts +2 -0
- package/lib/modules/ResourcePlanner/planner.js +252 -8
- package/lib/modules/ResourcePlanner/types.d.ts +29 -0
- package/lib/modules/Rules/index.js +2 -1
- package/lib/modules/Schedule/index.d.ts +8 -0
- package/lib/modules/Schedule/index.js +68 -12
- package/lib/modules/index.d.ts +1 -0
- package/lib/modules/index.js +11 -0
- package/lib/plugins/request.d.ts +7 -0
- package/lib/server/index.d.ts +1 -0
- package/lib/server/index.js +166 -39
- package/lib/server/modules/form/index.d.ts +19 -0
- package/lib/server/modules/form/index.js +73 -0
- package/lib/server/modules/form/types.d.ts +13 -0
- package/lib/server/modules/form/types.js +9 -0
- package/lib/server/modules/index.d.ts +3 -0
- package/lib/server/modules/index.js +15 -1
- package/lib/server/modules/order/index.d.ts +19 -0
- package/lib/server/modules/order/index.js +160 -7
- package/lib/server/modules/order/types.d.ts +4 -0
- package/lib/server/modules/products/index.d.ts +28 -7
- package/lib/server/modules/products/index.js +226 -63
- package/lib/server/modules/products/replication.d.ts +8 -0
- package/lib/server/modules/products/replication.js +30 -0
- package/lib/server/modules/products/types.d.ts +12 -1
- package/lib/server/modules/products/types.js +3 -0
- package/lib/server/test.json +1 -1
- package/lib/server/utils/small-ticket.d.ts +1 -85
- package/lib/server/utils/small-ticket.js +9 -2305
- package/lib/shared/payment/loadPaymentMethods.d.ts +9 -0
- package/lib/shared/payment/loadPaymentMethods.js +40 -0
- package/lib/shared/receipt/customerInvoiceLanguages.d.ts +8 -0
- package/lib/shared/receipt/customerInvoiceLanguages.js +58 -0
- package/lib/shared/receipt/loadCustomerInvoiceLayout.d.ts +27 -0
- package/lib/shared/receipt/loadCustomerInvoiceLayout.js +124 -0
- package/lib/shared/receipt/small-ticket.d.ts +96 -0
- package/lib/shared/receipt/small-ticket.js +2555 -0
- package/lib/shared/receipt/templateVisibility.d.ts +26 -0
- package/lib/shared/receipt/templateVisibility.js +67 -0
- package/lib/shared/sales/loadSalesOrderSnapshot.d.ts +9 -0
- package/lib/shared/sales/loadSalesOrderSnapshot.js +22 -0
- package/lib/solution/BaseSales/fulfillmentItemRules.d.ts +27 -0
- package/lib/solution/BaseSales/fulfillmentItemRules.js +259 -0
- package/lib/solution/BaseSales/index.d.ts +43 -16
- package/lib/solution/BaseSales/index.js +401 -33
- package/lib/solution/BaseSales/pickupTiming.d.ts +47 -0
- package/lib/solution/BaseSales/pickupTiming.js +290 -0
- package/lib/solution/BaseSales/types.d.ts +12 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +3 -1
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +7 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +16 -8
- package/lib/solution/BookingByStep/index.d.ts +4 -2
- package/lib/solution/BookingByStep/index.js +7 -3
- package/lib/solution/BookingTicket/index.d.ts +23 -3
- package/lib/solution/BookingTicket/index.js +197 -9
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +0 -1
- package/lib/solution/BookingTicket/utils/addProductDecision.js +1 -1
- package/lib/solution/BookingTicket/utils/cartView.js +3 -1
- package/lib/solution/OrderInvoicePreview/index.d.ts +66 -0
- package/lib/solution/OrderInvoicePreview/index.js +246 -0
- package/lib/solution/RegisterAndLogin/config.js +57 -11
- package/lib/solution/RegisterAndLogin/index.d.ts +2 -0
- package/lib/solution/RegisterAndLogin/index.js +9 -1
- package/lib/solution/RegisterAndLogin/utils.d.ts +12 -4
- package/lib/solution/RegisterAndLogin/utils.js +24 -17
- package/lib/solution/ScanOrder/index.js +59 -20
- package/lib/solution/ScanOrder/types.d.ts +3 -0
- package/lib/solution/UnifiedBookingSales/businessAvailability.d.ts +27 -0
- package/lib/solution/UnifiedBookingSales/businessAvailability.js +138 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +36 -4
- package/lib/solution/UnifiedBookingSales/index.js +562 -75
- package/lib/solution/UnifiedBookingSales/types.d.ts +16 -2
- package/lib/solution/VenueBooking/index.d.ts +15 -2
- package/lib/solution/VenueBooking/index.js +243 -96
- package/lib/solution/VenueBooking/types.d.ts +2 -1
- package/lib/solution/VenueBooking/types.js +1 -0
- package/lib/solution/VenueBooking/utils/dateSummary.d.ts +1 -0
- package/lib/solution/VenueBooking/utils/dateSummary.js +7 -4
- package/lib/solution/VenueBooking/utils/smartPricing.d.ts +71 -0
- package/lib/solution/VenueBooking/utils/smartPricing.js +224 -0
- package/lib/solution/VenueBooking/utils/timeSlot.d.ts +1 -0
- package/lib/solution/VenueBooking/utils/timeSlot.js +5 -2
- package/lib/solution/index.d.ts +1 -0
- package/lib/solution/index.js +11 -0
- package/package.json +1 -1
|
@@ -305,6 +305,30 @@ function withH5AuthPrefix(config) {
|
|
|
305
305
|
return nextConfig;
|
|
306
306
|
}
|
|
307
307
|
const h5OnlineStoreConfig = withH5AuthPrefix(onlineStoreConfig);
|
|
308
|
+
function withKioskSalesChannel(config) {
|
|
309
|
+
return {
|
|
310
|
+
...config,
|
|
311
|
+
options: params => {
|
|
312
|
+
const options = (typeof config.options === 'function' ? config.options(params) : config.options) || {};
|
|
313
|
+
const headers = typeof options.headers === 'function' ? options.headers(params) : options.headers;
|
|
314
|
+
return {
|
|
315
|
+
...options,
|
|
316
|
+
headers: {
|
|
317
|
+
...headers,
|
|
318
|
+
'Sales-Channel': 'kiosk'
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
// Kiosk 复用网店顾客认证接口,通过注册(含验证码登录自动注册)请求头标识会员归属渠道。
|
|
326
|
+
const kioskConfig = {
|
|
327
|
+
...h5OnlineStoreConfig,
|
|
328
|
+
emailCodeRegister: withKioskSalesChannel(h5OnlineStoreConfig.emailCodeRegister),
|
|
329
|
+
phoneCodeRegister: withKioskSalesChannel(h5OnlineStoreConfig.phoneCodeRegister),
|
|
330
|
+
phoneCodeLogin: withKioskSalesChannel(h5OnlineStoreConfig.phoneCodeLogin)
|
|
331
|
+
};
|
|
308
332
|
|
|
309
333
|
/**
|
|
310
334
|
* 默认配置(通用配置)
|
|
@@ -564,6 +588,16 @@ const defaultConfig = {
|
|
|
564
588
|
/**
|
|
565
589
|
* webpos 渠道配置
|
|
566
590
|
*/
|
|
591
|
+
const webposPasswordResetOptions = {
|
|
592
|
+
prefix: false,
|
|
593
|
+
isDefaultSaasDomain: true,
|
|
594
|
+
cache: false,
|
|
595
|
+
noToast: true,
|
|
596
|
+
headers: {
|
|
597
|
+
Accept: 'application/json',
|
|
598
|
+
'Content-Type': 'application/json'
|
|
599
|
+
}
|
|
600
|
+
};
|
|
567
601
|
const webposConfig = {
|
|
568
602
|
sendEmailVerificationCode: {
|
|
569
603
|
url: '/auth/email/register-code',
|
|
@@ -686,13 +720,20 @@ const webposConfig = {
|
|
|
686
720
|
})
|
|
687
721
|
},
|
|
688
722
|
checkEmailCode: {
|
|
689
|
-
url: '/
|
|
690
|
-
method: '
|
|
723
|
+
url: '/tenant/account/reset-password/email-code/verify',
|
|
724
|
+
method: 'POST',
|
|
691
725
|
transformParams: params => ({
|
|
692
726
|
email: params.email,
|
|
693
|
-
code: params.code
|
|
694
|
-
|
|
695
|
-
|
|
727
|
+
code: params.code
|
|
728
|
+
}),
|
|
729
|
+
// SaaS 成功时 data 为 null,统一为既有验证码校验返回结构。
|
|
730
|
+
transformResponse: response => response?.status === true ? {
|
|
731
|
+
...response,
|
|
732
|
+
data: {
|
|
733
|
+
valid: true
|
|
734
|
+
}
|
|
735
|
+
} : response,
|
|
736
|
+
options: webposPasswordResetOptions
|
|
696
737
|
},
|
|
697
738
|
checkMobileCode: {
|
|
698
739
|
url: '/auth/mobile/check-mobile-code',
|
|
@@ -714,11 +755,12 @@ const webposConfig = {
|
|
|
714
755
|
})
|
|
715
756
|
},
|
|
716
757
|
sendPasswordResetEmail: {
|
|
717
|
-
url: '/
|
|
718
|
-
method: '
|
|
758
|
+
url: '/tenant/account/reset-password/email-code/send',
|
|
759
|
+
method: 'POST',
|
|
719
760
|
transformParams: params => ({
|
|
720
761
|
email: params.email
|
|
721
|
-
})
|
|
762
|
+
}),
|
|
763
|
+
options: webposPasswordResetOptions
|
|
722
764
|
},
|
|
723
765
|
sendPasswordResetSms: {
|
|
724
766
|
url: '/auth/mobile/sms-forget',
|
|
@@ -751,13 +793,16 @@ const webposConfig = {
|
|
|
751
793
|
})
|
|
752
794
|
},
|
|
753
795
|
resetPasswordByEmail: {
|
|
754
|
-
url: '/
|
|
796
|
+
url: '/tenant/account/reset-password/email-code',
|
|
755
797
|
method: 'POST',
|
|
756
798
|
transformParams: params => ({
|
|
757
799
|
email: params.email,
|
|
758
800
|
password: params.password,
|
|
759
|
-
code: params.code
|
|
760
|
-
|
|
801
|
+
code: params.code,
|
|
802
|
+
// 页面先校验两次输入完全一致,SDK 保持原有重置参数。
|
|
803
|
+
password_confirmation: params.password
|
|
804
|
+
}),
|
|
805
|
+
options: webposPasswordResetOptions
|
|
761
806
|
},
|
|
762
807
|
resetPasswordByPhone: {
|
|
763
808
|
url: '/auth/mobile/reset-password',
|
|
@@ -1094,6 +1139,7 @@ const shopWebposConfig = {
|
|
|
1094
1139
|
const channelConfigMap = exports.channelConfigMap = {
|
|
1095
1140
|
'online-store': onlineStoreConfig,
|
|
1096
1141
|
'online-store-h5': h5OnlineStoreConfig,
|
|
1142
|
+
'kiosk': kioskConfig,
|
|
1097
1143
|
'default': defaultConfig,
|
|
1098
1144
|
'webpos': webposConfig,
|
|
1099
1145
|
'shop.webpos': shopWebposConfig
|
|
@@ -4,6 +4,8 @@ import { RegisterParams, LoginParams, OAuthLoginParams, SendVerificationCodePara
|
|
|
4
4
|
import { ApiCaller } from './config';
|
|
5
5
|
export * from './types';
|
|
6
6
|
export * from './config';
|
|
7
|
+
export { validatePassword } from './utils';
|
|
8
|
+
export type { PasswordValidationOptions } from './utils';
|
|
7
9
|
/**
|
|
8
10
|
* 注册登录解决方案实现
|
|
9
11
|
*/
|
|
@@ -4,9 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
var _exportNames = {
|
|
7
|
-
RegisterAndLoginImpl: true
|
|
7
|
+
RegisterAndLoginImpl: true,
|
|
8
|
+
validatePassword: true
|
|
8
9
|
};
|
|
9
10
|
exports.RegisterAndLoginImpl = void 0;
|
|
11
|
+
Object.defineProperty(exports, "validatePassword", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () {
|
|
14
|
+
return _utils.validatePassword;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
10
17
|
var _BaseModule = require("../../modules/BaseModule");
|
|
11
18
|
var _types = require("./types");
|
|
12
19
|
Object.keys(_types).forEach(function (key) {
|
|
@@ -32,6 +39,7 @@ Object.keys(_config).forEach(function (key) {
|
|
|
32
39
|
}
|
|
33
40
|
});
|
|
34
41
|
});
|
|
42
|
+
var _utils = require("./utils");
|
|
35
43
|
/**
|
|
36
44
|
* 注册登录解决方案实现
|
|
37
45
|
*/
|
|
@@ -10,10 +10,18 @@ export declare function validateEmail(email: string): boolean;
|
|
|
10
10
|
* 验证手机号格式(支持多种国际格式)
|
|
11
11
|
*/
|
|
12
12
|
export declare function validatePhone(phone: string): boolean;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
export interface PasswordValidationOptions {
|
|
14
|
+
minLength?: number;
|
|
15
|
+
maxLength?: number;
|
|
16
|
+
requireLowercase?: boolean;
|
|
17
|
+
requireUppercase?: boolean;
|
|
18
|
+
requireNumber?: boolean;
|
|
19
|
+
requireSpecialCharacters?: boolean;
|
|
20
|
+
specialCharactersPattern?: RegExp;
|
|
21
|
+
messages?: Partial<Record<'minLength' | 'maxLength' | 'requireLowercase' | 'requireUppercase' | 'requireNumber' | 'requireSpecialCharacters', string>>;
|
|
22
|
+
}
|
|
23
|
+
/** 验证密码强度;不传 options 时保持原有规则与返回格式。 */
|
|
24
|
+
export declare function validatePassword(password: string, options?: PasswordValidationOptions): {
|
|
17
25
|
isValid: boolean;
|
|
18
26
|
errors: string[];
|
|
19
27
|
};
|
|
@@ -49,29 +49,36 @@ function validatePhone(phone) {
|
|
|
49
49
|
const phoneRegex = /^(\+\d{1,3}[- ]?)?\d{10,14}$/;
|
|
50
50
|
return phoneRegex.test(cleanPhone);
|
|
51
51
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
* 验证密码强度
|
|
55
|
-
*/
|
|
56
|
-
function validatePassword(password) {
|
|
52
|
+
/** 验证密码强度;不传 options 时保持原有规则与返回格式。 */
|
|
53
|
+
function validatePassword(password, options = {}) {
|
|
57
54
|
const errors = [];
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
const {
|
|
56
|
+
minLength = 8,
|
|
57
|
+
maxLength = 128,
|
|
58
|
+
requireLowercase = true,
|
|
59
|
+
requireUppercase = true,
|
|
60
|
+
requireNumber = true,
|
|
61
|
+
requireSpecialCharacters = true,
|
|
62
|
+
specialCharactersPattern = /[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/,
|
|
63
|
+
messages = {}
|
|
64
|
+
} = options;
|
|
65
|
+
if (password.length < minLength) {
|
|
66
|
+
errors.push(messages.minLength ?? `密码长度至少为${minLength}位`);
|
|
60
67
|
}
|
|
61
|
-
if (password.length >
|
|
62
|
-
errors.push(
|
|
68
|
+
if (password.length > maxLength) {
|
|
69
|
+
errors.push(messages.maxLength ?? `密码长度不能超过${maxLength}位`);
|
|
63
70
|
}
|
|
64
|
-
if (!/[a-z]/.test(password)) {
|
|
65
|
-
errors.push('密码必须包含至少一个小写字母');
|
|
71
|
+
if (requireLowercase && !/[a-z]/.test(password)) {
|
|
72
|
+
errors.push(messages.requireLowercase ?? '密码必须包含至少一个小写字母');
|
|
66
73
|
}
|
|
67
|
-
if (!/[A-Z]/.test(password)) {
|
|
68
|
-
errors.push('密码必须包含至少一个大写字母');
|
|
74
|
+
if (requireUppercase && !/[A-Z]/.test(password)) {
|
|
75
|
+
errors.push(messages.requireUppercase ?? '密码必须包含至少一个大写字母');
|
|
69
76
|
}
|
|
70
|
-
if (!/\d/.test(password)) {
|
|
71
|
-
errors.push('密码必须包含至少一个数字');
|
|
77
|
+
if (requireNumber && !/\d/.test(password)) {
|
|
78
|
+
errors.push(messages.requireNumber ?? '密码必须包含至少一个数字');
|
|
72
79
|
}
|
|
73
|
-
if (
|
|
74
|
-
errors.push('密码必须包含至少一个特殊字符');
|
|
80
|
+
if (requireSpecialCharacters && !specialCharactersPattern.test(password)) {
|
|
81
|
+
errors.push(messages.requireSpecialCharacters ?? '密码必须包含至少一个特殊字符');
|
|
75
82
|
}
|
|
76
83
|
return {
|
|
77
84
|
isValid: errors.length === 0,
|
|
@@ -797,6 +797,7 @@ class ScanOrderImpl extends _BaseSales.BaseSalesImpl {
|
|
|
797
797
|
}
|
|
798
798
|
|
|
799
799
|
// ScanOrder 提交 payload enhancer:
|
|
800
|
+
// - 新单有桌台上下文但无 booking 时,补建基础预约(通用 Order 已不再自动生成)
|
|
800
801
|
// - 给所有 booking 注入 appointment_status: 'started'(扫码点餐语义)
|
|
801
802
|
// - 给所有 booking 的 metadata 注入 resource_select_type(来自预约规则商品的 resource.type)
|
|
802
803
|
// - 给第一条 booking 补 resources 与 product_uid(仅当存在 resource / rule product)
|
|
@@ -818,7 +819,8 @@ class ScanOrderImpl extends _BaseSales.BaseSalesImpl {
|
|
|
818
819
|
};
|
|
819
820
|
return (payload, {
|
|
820
821
|
bookingUuid,
|
|
821
|
-
tempOrder
|
|
822
|
+
tempOrder,
|
|
823
|
+
now
|
|
822
824
|
}) => {
|
|
823
825
|
const resourceId = String(resourceState?.relationId ?? '').trim();
|
|
824
826
|
const hasReservationBookingContext = Boolean(ruleProduct && resourceState && resourceId && resourceState.relationId && resourceState.tableFormId);
|
|
@@ -855,7 +857,31 @@ class ScanOrderImpl extends _BaseSales.BaseSalesImpl {
|
|
|
855
857
|
} : undefined;
|
|
856
858
|
const ruleProductUid = ruleProduct ? (0, _utils2.createUuidV4)() : undefined;
|
|
857
859
|
const bookingCapacityDimensionId = (0, _utils.pickFirstCustomCapacityDimensionId)(this.enabledReservationRuleProducts) ?? 0;
|
|
858
|
-
|
|
860
|
+
let bookings = payload.bookings || [];
|
|
861
|
+
if (!tempOrder.order_id && bookings.length === 0) {
|
|
862
|
+
const bookingStart = (0, _dayjs.default)(now);
|
|
863
|
+
const bookingDuration = (0, _utils2.resolveTableOccupancyDuration)(tempOrder);
|
|
864
|
+
const bookingEnd = bookingStart.add(bookingDuration, 'minute');
|
|
865
|
+
bookings = [(0, _utils2.normalizeSubmitBooking)({
|
|
866
|
+
relation_id: 0,
|
|
867
|
+
form_id: 0,
|
|
868
|
+
start_time: bookingStart.format('HH:mm'),
|
|
869
|
+
start_date: bookingStart.format('YYYY-MM-DD'),
|
|
870
|
+
end_time: bookingEnd.format('HH:mm'),
|
|
871
|
+
end_date: bookingEnd.format('YYYY-MM-DD'),
|
|
872
|
+
duration: bookingDuration,
|
|
873
|
+
metadata: {
|
|
874
|
+
unique_identification_number: bookingUuid
|
|
875
|
+
},
|
|
876
|
+
select_date: bookingStart.format('YYYY-MM-DD'),
|
|
877
|
+
is_all: false,
|
|
878
|
+
like_status: 'common',
|
|
879
|
+
schedule_id: 0,
|
|
880
|
+
relation_type: '',
|
|
881
|
+
number: 1
|
|
882
|
+
})];
|
|
883
|
+
}
|
|
884
|
+
const nextBookings = bookings.map((booking, idx) => {
|
|
859
885
|
const metadata = {
|
|
860
886
|
...(booking.metadata || {})
|
|
861
887
|
};
|
|
@@ -1273,29 +1299,40 @@ class ScanOrderImpl extends _BaseSales.BaseSalesImpl {
|
|
|
1273
1299
|
if (!Number.isFinite(productId) || targetQuantity <= 0) continue;
|
|
1274
1300
|
if (Number.isNaN(productVariantId)) continue;
|
|
1275
1301
|
const sourceItem = productSourceMap.get((0, _utils.buildProductKey)(productId, productVariantId)) || productSourceMap.get((0, _utils.buildProductKey)(productId, 0)) || null;
|
|
1302
|
+
const sourceTitle = sourceItem?.product_title || sourceItem?.title || sourceItem?.name;
|
|
1303
|
+
const productTitle = typeof sourceTitle === 'string' ? {
|
|
1304
|
+
auto: sourceTitle
|
|
1305
|
+
} : sourceTitle;
|
|
1306
|
+
// 标准标题在归一化后补入,供购物车展示,并由 Order 在折扣重算时保留。
|
|
1307
|
+
const displayFields = productTitle ? {
|
|
1308
|
+
product_title: productTitle
|
|
1309
|
+
} : {};
|
|
1276
1310
|
const productIndex = (0, _utils.getProductIdentityIndex)(tempOrder.products, {
|
|
1277
1311
|
product_id: productId,
|
|
1278
1312
|
product_variant_id: productVariantId
|
|
1279
1313
|
});
|
|
1280
1314
|
if (productIndex === -1) {
|
|
1281
1315
|
const sellingPrice = (0, _utils.toPriceString)(sourceItem?.price ?? sourceItem?.selling_price, '0.00');
|
|
1282
|
-
tempOrder.products.push(
|
|
1283
|
-
...
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1316
|
+
tempOrder.products.push({
|
|
1317
|
+
...(0, _utils.normalizeOrderProduct)({
|
|
1318
|
+
...sourceItem,
|
|
1319
|
+
product_id: productId,
|
|
1320
|
+
product_variant_id: productVariantId,
|
|
1321
|
+
num: targetQuantity,
|
|
1322
|
+
selling_price: sellingPrice,
|
|
1323
|
+
original_price: sellingPrice,
|
|
1324
|
+
metadata: {
|
|
1325
|
+
item_rule_prefill: true,
|
|
1326
|
+
item_rule_id: prefillItem.ruleId
|
|
1327
|
+
},
|
|
1328
|
+
_origin: {
|
|
1329
|
+
...(sourceItem || {}),
|
|
1330
|
+
item_rule_prefill: true,
|
|
1331
|
+
item_rule_id: prefillItem.ruleId
|
|
1332
|
+
}
|
|
1333
|
+
}),
|
|
1334
|
+
...displayFields
|
|
1335
|
+
});
|
|
1299
1336
|
hasChanges = true;
|
|
1300
1337
|
continue;
|
|
1301
1338
|
}
|
|
@@ -1304,6 +1341,7 @@ class ScanOrderImpl extends _BaseSales.BaseSalesImpl {
|
|
|
1304
1341
|
const delta = targetQuantity - existedQuantity;
|
|
1305
1342
|
const nextProduct = {
|
|
1306
1343
|
...targetProduct,
|
|
1344
|
+
...displayFields,
|
|
1307
1345
|
...(delta > 0 ? {
|
|
1308
1346
|
num: (0, _utils.getSafeProductNum)(existedQuantity + delta)
|
|
1309
1347
|
} : {}),
|
|
@@ -1318,8 +1356,9 @@ class ScanOrderImpl extends _BaseSales.BaseSalesImpl {
|
|
|
1318
1356
|
} : targetProduct._origin
|
|
1319
1357
|
};
|
|
1320
1358
|
const hasQuantityChanged = delta > 0;
|
|
1359
|
+
const hasTitleChanged = Boolean(productTitle && JSON.stringify(targetProduct.product_title) !== JSON.stringify(productTitle));
|
|
1321
1360
|
const hasOriginChanged = Boolean(sourceItem && (!targetProduct._origin || targetProduct._origin?.name !== sourceItem?.name || targetProduct._origin?.title !== sourceItem?.title || targetProduct._origin?.price !== sourceItem?.price));
|
|
1322
|
-
if (hasQuantityChanged || hasOriginChanged) {
|
|
1361
|
+
if (hasQuantityChanged || hasTitleChanged || hasOriginChanged) {
|
|
1323
1362
|
tempOrder.products[productIndex] = nextProduct;
|
|
1324
1363
|
hasChanges = true;
|
|
1325
1364
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { OrderModule, ProductList, SalesSummaryModule, ScanOrderLogInput, ScanOrderLoggerModule, ScanOrderLoggerProviderConfig, ScanOrderLoggerProviderType, ScheduleModule } from '../../modules';
|
|
2
2
|
import type { QuantityCheckResult, QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
|
|
3
|
+
import type { OrderLocalizedText } from '../../modules/Order/types';
|
|
3
4
|
/**
|
|
4
5
|
* 扫码下单流程 hook
|
|
5
6
|
*/
|
|
@@ -43,6 +44,8 @@ export interface ScanOrderProductSku {
|
|
|
43
44
|
}
|
|
44
45
|
export interface ScanOrderOrderProduct extends ScanOrderOrderProductIdentity {
|
|
45
46
|
order_detail_id: number | null;
|
|
47
|
+
/** 与 Order 一致的商品展示名称。 */
|
|
48
|
+
product_title?: OrderLocalizedText;
|
|
46
49
|
num: number;
|
|
47
50
|
/** Product 或当前 Variant 的生产编码 */
|
|
48
51
|
production_code?: string;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type BusinessAvailability } from '../../modules/BusinessAvailability';
|
|
2
|
+
import type { ScheduleModule } from '../../modules/Schedule';
|
|
3
|
+
interface BusinessAvailabilityHost {
|
|
4
|
+
loadOpenData: () => Promise<Record<string, unknown> | null>;
|
|
5
|
+
getSchedule: () => ScheduleModule | undefined;
|
|
6
|
+
getTimezone: () => string;
|
|
7
|
+
getScope: () => string;
|
|
8
|
+
now?: () => Date;
|
|
9
|
+
}
|
|
10
|
+
/** Read successful configuration once per business runtime; evaluate the clock on demand. */
|
|
11
|
+
export declare class BusinessAvailabilityController {
|
|
12
|
+
private readonly host;
|
|
13
|
+
private runtime?;
|
|
14
|
+
constructor(host: BusinessAvailabilityHost);
|
|
15
|
+
invalidate(): void;
|
|
16
|
+
private now;
|
|
17
|
+
private getRuntime;
|
|
18
|
+
private assertCurrent;
|
|
19
|
+
private loadConfig;
|
|
20
|
+
private loadSchedules;
|
|
21
|
+
private error;
|
|
22
|
+
/** Synchronous final cart-commit check; deliberately never starts a load. */
|
|
23
|
+
getCachedAvailability(): BusinessAvailability;
|
|
24
|
+
getAvailability(): Promise<BusinessAvailability>;
|
|
25
|
+
assertAvailable(): void;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.BusinessAvailabilityController = void 0;
|
|
7
|
+
var _lodashEs = require("lodash-es");
|
|
8
|
+
var _BusinessAvailability = require("../../modules/BusinessAvailability");
|
|
9
|
+
async function withTimeout(request) {
|
|
10
|
+
let timer;
|
|
11
|
+
try {
|
|
12
|
+
return await Promise.race([request, new Promise((_, reject) => {
|
|
13
|
+
timer = setTimeout(() => reject(new Error('Unable to load business settings. Please try again.')), 30_000);
|
|
14
|
+
})]);
|
|
15
|
+
} finally {
|
|
16
|
+
if (timer !== undefined) clearTimeout(timer);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Read successful configuration once per business runtime; evaluate the clock on demand. */
|
|
21
|
+
class BusinessAvailabilityController {
|
|
22
|
+
runtime;
|
|
23
|
+
constructor(host) {
|
|
24
|
+
this.host = host;
|
|
25
|
+
}
|
|
26
|
+
invalidate() {
|
|
27
|
+
this.runtime = undefined;
|
|
28
|
+
}
|
|
29
|
+
now() {
|
|
30
|
+
return this.host.now?.() ?? new Date();
|
|
31
|
+
}
|
|
32
|
+
getRuntime() {
|
|
33
|
+
const scope = this.host.getScope();
|
|
34
|
+
if (this.runtime?.scope !== scope) this.runtime = {
|
|
35
|
+
scope
|
|
36
|
+
};
|
|
37
|
+
return this.runtime;
|
|
38
|
+
}
|
|
39
|
+
assertCurrent(runtime) {
|
|
40
|
+
if (this.runtime !== runtime || runtime.scope !== this.host.getScope()) {
|
|
41
|
+
throw new Error('Store settings changed. Please try again.');
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
async loadConfig(runtime) {
|
|
45
|
+
if (runtime.config) return runtime.config;
|
|
46
|
+
if (!runtime.configRequest) {
|
|
47
|
+
runtime.configRequest = (async () => {
|
|
48
|
+
const data = await withTimeout(this.host.loadOpenData());
|
|
49
|
+
this.assertCurrent(runtime);
|
|
50
|
+
if (!data) throw new Error('Business settings are unavailable. Please try again.');
|
|
51
|
+
const config = (0, _lodashEs.cloneDeep)((0, _BusinessAvailability.normalizeBusinessAvailabilityConfig)(data));
|
|
52
|
+
runtime.config = config;
|
|
53
|
+
return config;
|
|
54
|
+
})();
|
|
55
|
+
}
|
|
56
|
+
const request = runtime.configRequest;
|
|
57
|
+
try {
|
|
58
|
+
return await request;
|
|
59
|
+
} finally {
|
|
60
|
+
if (runtime.configRequest === request) runtime.configRequest = undefined;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
async loadSchedules(runtime) {
|
|
64
|
+
if (runtime.schedules) return runtime.schedules;
|
|
65
|
+
if (!runtime.scheduleRequest) {
|
|
66
|
+
runtime.scheduleRequest = (async () => {
|
|
67
|
+
const schedule = this.host.getSchedule();
|
|
68
|
+
if (!schedule) throw new Error('Business operating-hours schedule is unavailable. Please try again.');
|
|
69
|
+
await withTimeout(schedule.loadAllSchedule({
|
|
70
|
+
useCache: true
|
|
71
|
+
}));
|
|
72
|
+
this.assertCurrent(runtime);
|
|
73
|
+
const schedules = (0, _lodashEs.cloneDeep)(schedule.getScheduleListByIds(runtime.config.scheduleIds) || []);
|
|
74
|
+
runtime.schedules = schedules;
|
|
75
|
+
return schedules;
|
|
76
|
+
})();
|
|
77
|
+
}
|
|
78
|
+
const request = runtime.scheduleRequest;
|
|
79
|
+
try {
|
|
80
|
+
return await request;
|
|
81
|
+
} finally {
|
|
82
|
+
if (runtime.scheduleRequest === request) runtime.scheduleRequest = undefined;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
error(reason, runtime) {
|
|
86
|
+
return {
|
|
87
|
+
status: 'error',
|
|
88
|
+
behavior: 'hide_all',
|
|
89
|
+
message: null,
|
|
90
|
+
nextChangeAt: this.now().getTime() + 60_000,
|
|
91
|
+
requirePaymentOnSubmit: runtime?.config?.requirePaymentOnSubmit ?? true,
|
|
92
|
+
error: reason instanceof Error ? reason.message : 'Business settings are unavailable. Please try again.'
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** Synchronous final cart-commit check; deliberately never starts a load. */
|
|
97
|
+
getCachedAvailability() {
|
|
98
|
+
const runtime = this.getRuntime();
|
|
99
|
+
try {
|
|
100
|
+
this.assertCurrent(runtime);
|
|
101
|
+
if (!runtime.config) throw new Error('Business settings are still loading. Please try again.');
|
|
102
|
+
return (0, _BusinessAvailability.computeBusinessAvailability)({
|
|
103
|
+
config: runtime.config,
|
|
104
|
+
schedules: runtime.schedules || [],
|
|
105
|
+
timezone: this.host.getTimezone(),
|
|
106
|
+
now: this.now()
|
|
107
|
+
});
|
|
108
|
+
} catch (reason) {
|
|
109
|
+
return this.error(reason, runtime);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
async getAvailability() {
|
|
113
|
+
const runtime = this.getRuntime();
|
|
114
|
+
try {
|
|
115
|
+
const config = await this.loadConfig(runtime);
|
|
116
|
+
this.assertCurrent(runtime);
|
|
117
|
+
if (!config.paused && !config.invalidScheduleIds && config.scheduleIds.length) {
|
|
118
|
+
await this.loadSchedules(runtime);
|
|
119
|
+
}
|
|
120
|
+
this.assertCurrent(runtime);
|
|
121
|
+
return this.getCachedAvailability();
|
|
122
|
+
} catch (reason) {
|
|
123
|
+
return this.error(reason, runtime);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
assertAvailable() {
|
|
127
|
+
const availability = this.getCachedAvailability();
|
|
128
|
+
if (availability.status !== 'open') {
|
|
129
|
+
const error = new Error(availability.error || (availability.status === 'paused' ? 'Ordering is temporarily paused.' : 'Ordering is currently closed.'));
|
|
130
|
+
Object.assign(error, {
|
|
131
|
+
code: 'BUSINESS_UNAVAILABLE',
|
|
132
|
+
businessAvailability: availability
|
|
133
|
+
});
|
|
134
|
+
throw error;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
exports.BusinessAvailabilityController = BusinessAvailabilityController;
|
|
@@ -5,9 +5,11 @@ import type { LoadScheduleAvailableDateParams, ScheduleItem } from '../../module
|
|
|
5
5
|
import type { ProductListLoadProductsParams, ProductListStoreQueryParams } from '../../modules/ProductList';
|
|
6
6
|
import type { AvailabilityDateRange, AvailabilityOccupancy, AvailabilityProduct, AvailabilityResource, GetProductTimeRangesRequest } from '../../modules/ResourcePlanner';
|
|
7
7
|
import type { AvailabilityContextRef, ContextualAvailabilityQuery, ContextualAvailabilityQueryResult, ContextualCommitAvailabilitySelectionParams, ContextualProductTimeRangeGroup, UnifiedBookingSalesAddRetailProductParams, UnifiedBookingSalesApplyPlannerDiscountsParams, UnifiedBookingSalesCommitAvailabilitySelectionResult, UnifiedBookingSalesDiscountResult, UnifiedBookingSalesLoadProductsByScheduleDateParams, UnifiedBookingSalesLoadOpenDataParams, UnifiedBookingSalesPrepareAvailabilityProjectionParams, UnifiedBookingSalesPolicyResponse, UnifiedBookingSalesResolveProductAllergyRequirementParams, UnifiedBookingSalesStageRetailProductsParams, UnifiedBookingSalesState } from './types';
|
|
8
|
+
import type { BusinessAvailability } from '../../modules/BusinessAvailability';
|
|
8
9
|
import { BookingTicket } from '../BookingTicket';
|
|
9
10
|
import type { AllergyRequirement } from '../../model/strategy/adapter/itemRule';
|
|
10
11
|
export * from './types';
|
|
12
|
+
export type { BusinessAvailability, BusinessClosedBehavior } from '../../modules/BusinessAvailability';
|
|
11
13
|
export { AvailabilityError } from '../../modules/ResourcePlanner';
|
|
12
14
|
/**
|
|
13
15
|
* Converts Rules/Order discount internals into a small UI-facing diagnostic. The result keeps
|
|
@@ -59,6 +61,14 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
59
61
|
protected defaultName: string;
|
|
60
62
|
protected defaultVersion: string;
|
|
61
63
|
protected store: UnifiedBookingSalesState;
|
|
64
|
+
protected pickupTimingEnabled: boolean;
|
|
65
|
+
private businessAvailabilityController?;
|
|
66
|
+
private runtimeOpenDataScope;
|
|
67
|
+
private runtimeOpenDataSnapshot;
|
|
68
|
+
private runtimeOpenDataModule;
|
|
69
|
+
private runtimeOpenDataCore;
|
|
70
|
+
private runtimeOpenDataGeneration;
|
|
71
|
+
private runtimeOpenDataDestroyed;
|
|
62
72
|
private unifiedProductCatalog;
|
|
63
73
|
private availabilityRuntimeOffsetMinutes;
|
|
64
74
|
private availabilityScheduleCatalog;
|
|
@@ -79,11 +89,28 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
79
89
|
private allergyItemRuleConfigsPromise;
|
|
80
90
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
81
91
|
protected getSubmitOrderSalesChannel(): string;
|
|
92
|
+
/** Only the explicit Kiosk Sales consumer entry enables this policy; POS stays unchanged. */
|
|
93
|
+
protected isBusinessAvailabilityEnabled(): boolean;
|
|
94
|
+
protected getBusinessAvailabilityScope(): string;
|
|
95
|
+
private getBusinessAvailabilityController;
|
|
96
|
+
getBusinessAvailability(): Promise<BusinessAvailability>;
|
|
97
|
+
/** Internal final-write assertion; does not fetch OpenData or Schedule. */
|
|
98
|
+
assertBusinessAvailability(): void;
|
|
99
|
+
protected getSubModuleHooks(moduleName: string): any;
|
|
82
100
|
private createAvailabilityFacadeError;
|
|
83
101
|
private getAvailabilityScopeDescriptor;
|
|
102
|
+
private usesDurationTimeGrid;
|
|
103
|
+
private getCurrentAvailabilityBusinessDate;
|
|
104
|
+
private getAvailabilityBusinessDateRange;
|
|
84
105
|
private normalizeAvailabilityIdList;
|
|
85
106
|
private normalizeAvailabilityStringList;
|
|
86
107
|
private normalizeAvailabilityPrepareDescriptor;
|
|
108
|
+
/**
|
|
109
|
+
* 列表直加没有经过 SKU availability flow,legacy cacheItem 的灵活时长可能落到
|
|
110
|
+
* 23:59。提交前用同一套营业排期补齐结束时间,保留已选开始时间、资源和 Holder。
|
|
111
|
+
* 仅供直加调用;手动时间选择和 availability candidate 不经过此方法。
|
|
112
|
+
*/
|
|
113
|
+
prepareDirectAddFlexibleBooking(cacheItem: any): Promise<any>;
|
|
87
114
|
private resolveAvailabilityPrepareDefaults;
|
|
88
115
|
private buildAvailabilityPrepareKey;
|
|
89
116
|
private clearAvailabilityRemoteResourceState;
|
|
@@ -126,6 +153,8 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
126
153
|
* 用于支付跳转等终态场景,避免浏览器返回时恢复已提交订单。
|
|
127
154
|
*/
|
|
128
155
|
clearSessionStorageOrderSnapshot(): void;
|
|
156
|
+
/** 在 Kiosk 拉起支付设备前补齐订单号,同一订单重试复用已分配的号码。 */
|
|
157
|
+
ensureLocalOrderNumbersForCheckout(): Promise<void>;
|
|
129
158
|
/**
|
|
130
159
|
* PC/H5/Kiosk 结账默认直接等待云端 checkout;POS/WebPOS 仍保持本地待同步。
|
|
131
160
|
* 显式传 checkoutSyncTaskEnabled: true 时仍可回退到本地同步模式。
|
|
@@ -142,12 +171,14 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
142
171
|
private resolveDiscountAction;
|
|
143
172
|
private resetCachedCustomerDiscountState;
|
|
144
173
|
private refreshLegacySessionCustomerDiscounts;
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
174
|
+
private getRuntimeOpenDataScope;
|
|
175
|
+
private resetRuntimeOpenData;
|
|
176
|
+
protected prepareInvoiceTemplateAtSolutionReady(injectedOpenData?: OpenDataConfig): Promise<void>;
|
|
177
|
+
protected loadOpenDataConfig(): Promise<OpenDataConfig | null>;
|
|
178
|
+
/** A successful configuration belongs to this business runtime until an explicit refresh. */
|
|
149
179
|
loadOpenData(params: UnifiedBookingSalesLoadOpenDataParams): Promise<OpenDataConfig>;
|
|
150
180
|
getOpenData(): Promise<OpenDataConfig | null>;
|
|
181
|
+
protected loadPickupTimingOpenData(_force: boolean): Promise<Record<string, unknown>>;
|
|
151
182
|
private resetAllergyItemRuleState;
|
|
152
183
|
private fetchAllergyItemRuleConfigs;
|
|
153
184
|
private ensureAllergyItemRuleConfigsLoaded;
|
|
@@ -253,6 +284,7 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
253
284
|
private assertAvailabilityCommitWriteCAS;
|
|
254
285
|
private findProductLineByUid;
|
|
255
286
|
private findLinkedBooking;
|
|
287
|
+
removeBookingProductsOutsideStartDate(startDate: unknown): Promise<import("../../modules/Order/types").OrderProduct[]>;
|
|
256
288
|
/** Revalidates against the latest landed occupancy cache, then mutates exactly one product line. */
|
|
257
289
|
commitAvailabilitySelection(contextId: string, params: ContextualCommitAvailabilitySelectionParams): Promise<UnifiedBookingSalesCommitAvailabilitySelectionResult>;
|
|
258
290
|
}
|