@pisell/private-materials 6.3.177 → 6.3.179
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +9 -9
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +1 -1
- package/es/businessModel/SalesModel/index.d.ts +1 -0
- package/es/components/appointmentBooking/components/Cart/Item/index.js +90 -24
- package/es/components/appointmentBooking/components/ConfirmInformation/index.js +24 -20
- package/es/components/appointmentBooking/components/Guest/components/InformationOptionsModal/index.d.ts +1 -0
- package/es/components/appointmentBooking/components/Header/index.js +4 -24
- package/es/components/appointmentBooking/components/Voucher/index.js +10 -0
- package/es/components/appointmentBooking/hooks.d.ts +1 -17
- package/es/components/appointmentBooking/hooks.js +55 -128
- package/es/components/appointmentBooking/utils.d.ts +1 -0
- package/es/components/appointmentBooking/utils.js +54 -33
- package/es/components/booking/components/TabProduct/index.d.ts +1 -0
- package/es/components/booking/components/formItemChildrenWrap/index.d.ts +1 -0
- package/es/components/booking/forms/table/index.d.ts +1 -0
- package/es/components/booking/info/addServiceVariant/index.d.ts +1 -0
- package/es/components/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.d.ts +1 -0
- package/es/components/booking/info/index.d.ts +1 -0
- package/es/components/booking/info/service/like/index.d.ts +1 -0
- package/es/components/ecocup/components/MoreDropdown/index.d.ts +1 -0
- package/es/components/ecocup/cupList/hooks/useColumns.d.ts +1 -0
- package/es/components/ecocup/cupList/hooks/useSummary.d.ts +1 -0
- package/es/components/eftpos/SettlementModal/Action.d.ts +1 -0
- package/es/components/eftpos/SettlementModal/index.d.ts +1 -0
- package/es/components/eftpos/deviceList/index.d.ts +1 -0
- package/es/components/eftpos/form/index.d.ts +1 -0
- package/es/components/eftpos/group/index.d.ts +1 -0
- package/es/components/eftpos/hooks.d.ts +1 -0
- package/es/components/eftpos/icon/apiKey.d.ts +1 -0
- package/es/components/eftpos/icon/device.d.ts +1 -0
- package/es/components/eftpos/receipt/index.d.ts +1 -0
- package/es/components/eftpos/surcharge/index.d.ts +1 -0
- package/es/components/eftposPay/aggregatePayment/utils/payment.js +1 -2
- package/es/components/eftposPay/app.d.ts +1 -0
- package/es/components/eftposPay/component/alert/warn.d.ts +1 -0
- package/es/components/eftposPay/component/header/titlebar.d.ts +1 -0
- package/es/components/eftposPay/component/step/index.d.ts +1 -0
- package/es/components/eftposPay/component/step/step.d.ts +1 -0
- package/es/components/eftposPay/device.js +4 -11
- package/es/components/eftposPay/hooks.d.ts +1 -1
- package/es/components/eftposPay/mx51/Action.d.ts +1 -0
- package/es/components/eftposPay/store/index.d.ts +1 -1
- package/es/components/eftposPay/tyro/hooks.d.ts +1 -0
- package/es/components/eventBooking/components/ErrorTip/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/InformationOptionsModal/index.d.ts +1 -0
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateStatus/index.d.ts +1 -0
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +1 -0
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +1 -0
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +1 -0
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/DayItem/index.d.ts +1 -0
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/index.d.ts +1 -0
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Status/index.d.ts +1 -0
- package/es/components/eventBooking/components/progressBar/index.d.ts +1 -8
- package/es/components/eventBooking/components/progressBar/index.js +10 -30
- package/es/components/eventBooking/components/scheduleCalendar/calendarItem.d.ts +1 -0
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/Finish/index.d.ts +1 -0
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/SDK.d.ts +1 -0
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/index.d.ts +1 -0
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/PageLoading/index.d.ts +1 -0
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/PaymentRequestForm.d.ts +1 -0
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/index.d.ts +1 -0
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/index.d.ts +1 -0
- package/es/components/pay/toC/WalletPassBlock/components/WalletUseList/index.d.ts +1 -0
- package/es/components/pisellSelectCustomerModal/RightPanel/Add/PhoneField/index.d.ts +1 -0
- package/es/components/productExtension/fields/Actor/index.d.ts +1 -0
- package/es/components/productExtension/fields/Forms/index.d.ts +1 -0
- package/es/components/scanOrder/components/Check/index.js +46 -187
- package/es/components/scanOrder/components/Check/index.less +0 -39
- package/es/components/scanOrder/components/Content/index.js +72 -189
- package/es/components/scanOrder/components/Menu/index.js +5 -11
- package/es/components/scanOrder/hooks.js +0 -7
- package/es/components/scanOrder/locales.d.ts +0 -75
- package/es/components/scanOrder/locales.js +0 -75
- package/es/components/schedules/calendar/calendarItem.d.ts +1 -0
- package/es/components/schedules/components/ScheduleList/RenderScheduleItem/index.d.ts +1 -0
- package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/index.d.ts +1 -0
- package/es/components/schedules/products/ProductDetailDrawer/ProductDetailByDate/index.d.ts +1 -0
- package/es/components/schedules/resources/relationProduct/index.d.ts +1 -0
- package/es/components/shoppingCart/components/Cart/Product.d.ts +1 -0
- package/es/components/shoppingCart/components/Empty/index.d.ts +1 -0
- package/es/components/shoppingCart/components/Render/index.d.ts +1 -0
- package/es/components/systemSettings/registry/components/DataSourceTreeSelect/index.d.ts +1 -0
- package/es/components/ticketBooking/components/addServiceVariant/index.d.ts +1 -0
- package/es/components/venueBooking/components/Cart/index.js +165 -46
- package/es/components/venueBooking/components/Voucher/index.js +1 -6
- package/es/components/venueBooking/context.js +15 -2
- package/es/components/venueBooking/locales.d.ts +5 -0
- package/es/components/venueBooking/locales.js +10 -5
- package/es/components/workSpaceList/components/Modal/index.d.ts +1 -0
- package/es/components/workSpaceList/components/SearchWorkspaceAndBase/index.d.ts +1 -0
- package/es/plus/clientName/index.d.ts +1 -0
- package/es/plus/clinetSearch/Add/PhoneField/index.d.ts +1 -0
- package/es/plus/orderList/components/HandleActions.d.ts +1 -0
- package/es/plus/orderList/components/QuickFilter.d.ts +1 -0
- package/es/plus/orderList/components/Reset.d.ts +1 -0
- package/es/plus/orderList/components/Toolbar.d.ts +1 -0
- package/es/plus/pisellReservation/hooks/useReservationScheduleDebounced.d.ts +1 -0
- package/es/plus/selectHolder/components/ErrorTip/index.d.ts +1 -0
- package/es/plus/skuOptionsSelection/components/NormalCard/index.d.ts +1 -0
- package/es/pro/Login2.0/locales.js +1 -1
- package/es/pro/Selector/demo.d.ts +1 -0
- package/es/pro/pisellPaymentList/example.d.ts +1 -0
- package/es/utils/buildCartHolderParams.d.ts +97 -0
- package/es/utils/buildCartHolderParams.js +200 -0
- package/lib/businessModel/SalesModel/index.d.ts +1 -0
- package/lib/components/appointmentBooking/components/Cart/Item/index.js +70 -9
- package/lib/components/appointmentBooking/components/ConfirmInformation/index.js +6 -2
- package/lib/components/appointmentBooking/components/Guest/components/InformationOptionsModal/index.d.ts +1 -0
- package/lib/components/appointmentBooking/components/Header/index.js +1 -13
- package/lib/components/appointmentBooking/components/Voucher/index.js +10 -0
- package/lib/components/appointmentBooking/hooks.d.ts +1 -17
- package/lib/components/appointmentBooking/hooks.js +17 -91
- package/lib/components/appointmentBooking/utils.d.ts +1 -0
- package/lib/components/appointmentBooking/utils.js +24 -13
- package/lib/components/booking/components/TabProduct/index.d.ts +1 -0
- package/lib/components/booking/components/formItemChildrenWrap/index.d.ts +1 -0
- package/lib/components/booking/forms/table/index.d.ts +1 -0
- package/lib/components/booking/info/addServiceVariant/index.d.ts +1 -0
- package/lib/components/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.d.ts +1 -0
- package/lib/components/booking/info/index.d.ts +1 -0
- package/lib/components/booking/info/service/like/index.d.ts +1 -0
- package/lib/components/ecocup/components/MoreDropdown/index.d.ts +1 -0
- package/lib/components/ecocup/cupList/hooks/useColumns.d.ts +1 -0
- package/lib/components/ecocup/cupList/hooks/useSummary.d.ts +1 -0
- package/lib/components/eftpos/SettlementModal/Action.d.ts +1 -0
- package/lib/components/eftpos/SettlementModal/index.d.ts +1 -0
- package/lib/components/eftpos/deviceList/index.d.ts +1 -0
- package/lib/components/eftpos/form/index.d.ts +1 -0
- package/lib/components/eftpos/group/index.d.ts +1 -0
- package/lib/components/eftpos/hooks.d.ts +1 -0
- package/lib/components/eftpos/icon/apiKey.d.ts +1 -0
- package/lib/components/eftpos/icon/device.d.ts +1 -0
- package/lib/components/eftpos/receipt/index.d.ts +1 -0
- package/lib/components/eftpos/surcharge/index.d.ts +1 -0
- package/lib/components/eftposPay/aggregatePayment/utils/payment.js +1 -2
- package/lib/components/eftposPay/app.d.ts +1 -0
- package/lib/components/eftposPay/component/alert/warn.d.ts +1 -0
- package/lib/components/eftposPay/component/header/titlebar.d.ts +1 -0
- package/lib/components/eftposPay/component/step/index.d.ts +1 -0
- package/lib/components/eftposPay/component/step/step.d.ts +1 -0
- package/lib/components/eftposPay/device.js +4 -6
- package/lib/components/eftposPay/hooks.d.ts +1 -1
- package/lib/components/eftposPay/mx51/Action.d.ts +1 -0
- package/lib/components/eftposPay/store/index.d.ts +1 -1
- package/lib/components/eftposPay/tyro/hooks.d.ts +1 -0
- package/lib/components/eventBooking/components/ErrorTip/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/InformationOptionsModal/index.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateStatus/index.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/DayItem/index.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/index.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Status/index.d.ts +1 -0
- package/lib/components/eventBooking/components/progressBar/index.d.ts +1 -8
- package/lib/components/eventBooking/components/progressBar/index.js +9 -29
- package/lib/components/eventBooking/components/scheduleCalendar/calendarItem.d.ts +1 -0
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/Finish/index.d.ts +1 -0
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/SDK.d.ts +1 -0
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/index.d.ts +1 -0
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/PageLoading/index.d.ts +1 -0
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/PaymentRequestForm.d.ts +1 -0
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/index.d.ts +1 -0
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/index.d.ts +1 -0
- package/lib/components/pay/toC/WalletPassBlock/components/WalletUseList/index.d.ts +1 -0
- package/lib/components/pisellSelectCustomerModal/RightPanel/Add/PhoneField/index.d.ts +1 -0
- package/lib/components/productExtension/fields/Actor/index.d.ts +1 -0
- package/lib/components/productExtension/fields/Forms/index.d.ts +1 -0
- package/lib/components/scanOrder/components/Check/index.js +3 -116
- package/lib/components/scanOrder/components/Check/index.less +0 -39
- package/lib/components/scanOrder/components/Content/index.js +25 -106
- package/lib/components/scanOrder/components/Menu/index.js +0 -2
- package/lib/components/scanOrder/hooks.js +0 -7
- package/lib/components/scanOrder/locales.d.ts +0 -75
- package/lib/components/scanOrder/locales.js +0 -75
- package/lib/components/schedules/calendar/calendarItem.d.ts +1 -0
- package/lib/components/schedules/components/ScheduleList/RenderScheduleItem/index.d.ts +1 -0
- package/lib/components/schedules/products/ProductDetailDrawer/ProductDetail/index.d.ts +1 -0
- package/lib/components/schedules/products/ProductDetailDrawer/ProductDetailByDate/index.d.ts +1 -0
- package/lib/components/schedules/resources/relationProduct/index.d.ts +1 -0
- package/lib/components/shoppingCart/components/Cart/Product.d.ts +1 -0
- package/lib/components/shoppingCart/components/Empty/index.d.ts +1 -0
- package/lib/components/shoppingCart/components/Render/index.d.ts +1 -0
- package/lib/components/systemSettings/registry/components/DataSourceTreeSelect/index.d.ts +1 -0
- package/lib/components/ticketBooking/components/addServiceVariant/index.d.ts +1 -0
- package/lib/components/venueBooking/components/Cart/index.js +93 -14
- package/lib/components/venueBooking/components/Voucher/index.js +1 -5
- package/lib/components/venueBooking/context.js +12 -2
- package/lib/components/venueBooking/locales.d.ts +5 -0
- package/lib/components/venueBooking/locales.js +10 -5
- package/lib/components/workSpaceList/components/Modal/index.d.ts +1 -0
- package/lib/components/workSpaceList/components/SearchWorkspaceAndBase/index.d.ts +1 -0
- package/lib/plus/clientName/index.d.ts +1 -0
- package/lib/plus/clinetSearch/Add/PhoneField/index.d.ts +1 -0
- package/lib/plus/orderList/components/HandleActions.d.ts +1 -0
- package/lib/plus/orderList/components/QuickFilter.d.ts +1 -0
- package/lib/plus/orderList/components/Reset.d.ts +1 -0
- package/lib/plus/orderList/components/Toolbar.d.ts +1 -0
- package/lib/plus/pisellReservation/hooks/useReservationScheduleDebounced.d.ts +1 -0
- package/lib/plus/selectHolder/components/ErrorTip/index.d.ts +1 -0
- package/lib/plus/skuOptionsSelection/components/NormalCard/index.d.ts +1 -0
- package/lib/pro/Login2.0/locales.js +1 -1
- package/lib/pro/Selector/demo.d.ts +1 -0
- package/lib/pro/pisellPaymentList/example.d.ts +1 -0
- package/lib/utils/buildCartHolderParams.d.ts +97 -0
- package/lib/utils/buildCartHolderParams.js +172 -0
- package/package.json +1 -1
|
@@ -125,7 +125,8 @@ export default {
|
|
|
125
125
|
'pisell2.appointment.policy': 'You have read and agreed to this policy',
|
|
126
126
|
'pisell2.appointment.policy.confirm': 'Confirm',
|
|
127
127
|
'pisell2.appointment.booking.empty.data': 'No data',
|
|
128
|
-
'pisell2.product-select.search': 'Search'
|
|
128
|
+
'pisell2.product-select.search': 'Search',
|
|
129
|
+
'pisell2.venue.create.form': 'Create form'
|
|
129
130
|
},
|
|
130
131
|
'zh-CN': {
|
|
131
132
|
'pisell2.venue.step.select': '选择场地',
|
|
@@ -249,7 +250,8 @@ export default {
|
|
|
249
250
|
'pisell2.appointment.policy': '您已仔细阅读并同意此协议',
|
|
250
251
|
'pisell2.appointment.policy.confirm': '确定',
|
|
251
252
|
'pisell2.appointment.booking.empty.data': '暂无数据',
|
|
252
|
-
'pisell2.product-select.search': '搜索'
|
|
253
|
+
'pisell2.product-select.search': '搜索',
|
|
254
|
+
'pisell2.venue.create.form': '创建表单'
|
|
253
255
|
},
|
|
254
256
|
'zh-HK': {
|
|
255
257
|
'pisell2.venue.step.select': '選擇場地',
|
|
@@ -373,7 +375,8 @@ export default {
|
|
|
373
375
|
'pisell2.appointment.policy': '您已仔細閱讀並同意此協議',
|
|
374
376
|
'pisell2.appointment.policy.confirm': '確定',
|
|
375
377
|
'pisell2.appointment.booking.empty.data': '暫無數據',
|
|
376
|
-
'pisell2.product-select.search': '搜索'
|
|
378
|
+
'pisell2.product-select.search': '搜索',
|
|
379
|
+
'pisell2.venue.create.form': '创建表单'
|
|
377
380
|
},
|
|
378
381
|
ja: {
|
|
379
382
|
'pisell2.venue.step.select': 'コートを選択',
|
|
@@ -497,7 +500,8 @@ export default {
|
|
|
497
500
|
'pisell2.appointment.policy': 'このポリシーを読み、同意しました',
|
|
498
501
|
'pisell2.appointment.policy.confirm': '確認',
|
|
499
502
|
'pisell2.appointment.booking.empty.data': 'データなし',
|
|
500
|
-
'pisell2.product-select.search': '検索'
|
|
503
|
+
'pisell2.product-select.search': '検索',
|
|
504
|
+
'pisell2.venue.create.form': 'フォームを作成'
|
|
501
505
|
},
|
|
502
506
|
pt: {
|
|
503
507
|
'pisell2.venue.step.select': 'Escolher quadra',
|
|
@@ -621,6 +625,7 @@ export default {
|
|
|
621
625
|
'pisell2.appointment.policy': 'Você leu e concordou com esta política',
|
|
622
626
|
'pisell2.appointment.policy.confirm': 'Confirmar',
|
|
623
627
|
'pisell2.appointment.booking.empty.data': 'Sem dados',
|
|
624
|
-
'pisell2.product-select.search': 'Pesquisar'
|
|
628
|
+
'pisell2.product-select.search': 'Pesquisar',
|
|
629
|
+
'pisell2.venue.create.form': 'Criar formulário'
|
|
625
630
|
}
|
|
626
631
|
};
|
|
@@ -259,7 +259,7 @@ export default {
|
|
|
259
259
|
'pisell-register2-complete-title': '注册完成!',
|
|
260
260
|
'pisell-register2-redirecting': '正在重定向到您的帐户...',
|
|
261
261
|
'pisell-login2-continue-with-email': '使用邮箱',
|
|
262
|
-
'pisell-login2-continue-with-phone': '
|
|
262
|
+
'pisell-login2-continue-with-phone': '使用手机',
|
|
263
263
|
'pisell-login2-email-not-registered': '该邮箱未注册,请先注册',
|
|
264
264
|
'pisell-login2-check-email-failed': '检查邮箱失败,请重试',
|
|
265
265
|
'pisell-login2-continue-failed': '继续失败,请重试',
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* 这个文件演示了如何使用 PisellPaymentList 和 PisellPaymentListItem 组件
|
|
5
5
|
* 包括如何通过 Context 访问父组件配置
|
|
6
6
|
*/
|
|
7
|
+
/// <reference types="react" />
|
|
7
8
|
export declare const BasicExample: () => JSX.Element;
|
|
8
9
|
export declare const ChildrenExample: () => JSX.Element;
|
|
9
10
|
export declare const CustomItemExample: () => JSX.Element;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/** ProductCard Time 组件所需的 holder 展示字段 */
|
|
2
|
+
export interface CartHolderParams {
|
|
3
|
+
holder_id?: number;
|
|
4
|
+
isErrorHolder?: boolean;
|
|
5
|
+
isShowChangeHolder?: boolean;
|
|
6
|
+
addHolderButtonText?: string;
|
|
7
|
+
holder_title?: string;
|
|
8
|
+
holders?: Array<{
|
|
9
|
+
id: any;
|
|
10
|
+
label: any;
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
}>;
|
|
13
|
+
}
|
|
14
|
+
export interface BuildCartHolderParamsOptions {
|
|
15
|
+
/** 购物车行数据 */
|
|
16
|
+
item: any;
|
|
17
|
+
/** holder 配置,通常来自 item._productInit.holder_config 或 item._origin.product.holder_config */
|
|
18
|
+
holderConfig?: Record<string, any>;
|
|
19
|
+
/** getHolderFormMap 中对应 resource_id 的表单数据 */
|
|
20
|
+
formData?: Record<string, any>;
|
|
21
|
+
/** 多语言翻译函数 */
|
|
22
|
+
translation: (value: any) => string;
|
|
23
|
+
/** 是否注入 holder 字段,由业务侧决定(如预约商品 / 含 duration 的场地商品) */
|
|
24
|
+
enabled?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* holder_config 是否已开启。
|
|
28
|
+
* status 非 enable(如 disable)时,required、resource_id 视为脏数据,不参与校验与展示。
|
|
29
|
+
*/
|
|
30
|
+
export declare const isHolderConfigEnabled: (holderConfig?: Record<string, any>) => boolean;
|
|
31
|
+
/**
|
|
32
|
+
* 从购物车行解析当前选中的 holder form_record_id。
|
|
33
|
+
*
|
|
34
|
+
* venueBooking:以 _origin.holder 为准(SDK 会原地更新 form_record);
|
|
35
|
+
* 顶层 item.holder_id 可能是上一轮 UI 注入或 SDK 回灌的滞后值,不能优先于 _origin.holder。
|
|
36
|
+
*/
|
|
37
|
+
export declare const resolveCartItemHolderId: (item: any) => number | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* 根据 holderMap 与购物车行数据,构建 ProductCard 所需的 holder 展示字段。
|
|
40
|
+
* 供 appointmentBooking、venueBooking 等购物车场景复用。
|
|
41
|
+
*/
|
|
42
|
+
export declare const buildCartHolderParams: ({ item, holderConfig, formData, translation, enabled, }: BuildCartHolderParamsOptions) => CartHolderParams;
|
|
43
|
+
/**
|
|
44
|
+
* 从 appointmentBooking 购物车行读取 holder_config
|
|
45
|
+
*/
|
|
46
|
+
export declare const getAppointmentCartHolderConfig: (item: any) => any;
|
|
47
|
+
/**
|
|
48
|
+
* 从 venueBooking 购物车行读取 holder_config
|
|
49
|
+
*/
|
|
50
|
+
export declare const getVenueCartHolderConfig: (item: any) => any;
|
|
51
|
+
export interface ValidateRequiredCartHoldersOptions {
|
|
52
|
+
items?: any[];
|
|
53
|
+
getHolderConfig?: (item: any) => Record<string, any>;
|
|
54
|
+
/** 是否校验该行,默认全部校验 */
|
|
55
|
+
shouldValidateItem?: (item: any) => boolean;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* 校验购物车中 holder_config.required 的行是否已选择 holder。
|
|
59
|
+
*/
|
|
60
|
+
export declare const validateRequiredCartHolders: ({ items, getHolderConfig, }: ValidateRequiredCartHoldersOptions) => {
|
|
61
|
+
hasError: boolean;
|
|
62
|
+
invalidItems: any[];
|
|
63
|
+
};
|
|
64
|
+
export interface CartHolderFormModule {
|
|
65
|
+
appendFormRecord?: (params: {
|
|
66
|
+
record: any;
|
|
67
|
+
}) => void;
|
|
68
|
+
refreshAllHolderFormRecords?: (params: {
|
|
69
|
+
customer_id?: any;
|
|
70
|
+
}) => void;
|
|
71
|
+
}
|
|
72
|
+
export interface HandleCartHolderFormSuccessOptions {
|
|
73
|
+
res: any;
|
|
74
|
+
formId?: number | string;
|
|
75
|
+
skuRelationFormId: number;
|
|
76
|
+
utils: any;
|
|
77
|
+
module: CartHolderFormModule;
|
|
78
|
+
}
|
|
79
|
+
export interface CartHolderFormSuccessResult {
|
|
80
|
+
formRecordId: any;
|
|
81
|
+
mainField: any;
|
|
82
|
+
formId: any;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* 从 holderMap 解析 minors 表单关联的 sku 关系表单 ID(form_to_form 隐藏字段的 linkedTable)。
|
|
86
|
+
*/
|
|
87
|
+
export declare const getSkuRelationFormId: (holderMap: Record<string, any>, formId?: number | string) => number;
|
|
88
|
+
/**
|
|
89
|
+
* 从 form_to_form_value 中取最新创建的 form_record_id。
|
|
90
|
+
*/
|
|
91
|
+
export declare const getSkuRelationFormRecordId: (res: any) => any;
|
|
92
|
+
/**
|
|
93
|
+
* 处理购物车添加 holder 表单提交成功后的公共逻辑。
|
|
94
|
+
* - minors 关联表单:刷新 holder 列表,取 form_to_form_value 中的 record id
|
|
95
|
+
* - 普通表单:appendFormRecord 并直接使用 form_record_id
|
|
96
|
+
*/
|
|
97
|
+
export declare const handleCartHolderFormSuccess: ({ res, formId, skuRelationFormId, utils, module, }: HandleCartHolderFormSuccessOptions) => CartHolderFormSuccessResult;
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
5
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
7
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
8
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
9
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
10
|
+
import { getCustomer } from "../components/appointmentBooking/utils";
|
|
11
|
+
|
|
12
|
+
/** ProductCard Time 组件所需的 holder 展示字段 */
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* holder_config 是否已开启。
|
|
16
|
+
* status 非 enable(如 disable)时,required、resource_id 视为脏数据,不参与校验与展示。
|
|
17
|
+
*/
|
|
18
|
+
export var isHolderConfigEnabled = function isHolderConfigEnabled(holderConfig) {
|
|
19
|
+
return (holderConfig === null || holderConfig === void 0 ? void 0 : holderConfig.status) === 'enable';
|
|
20
|
+
};
|
|
21
|
+
var toHolderRecordId = function toHolderRecordId(value) {
|
|
22
|
+
if (value == null || value === '') return undefined;
|
|
23
|
+
var id = Number(value);
|
|
24
|
+
return Number.isNaN(id) ? undefined : id;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* 从 _origin.holder 解析 form_record_id。
|
|
29
|
+
* form_record 可能是 number、number[];不能假定一定是数组下标 [0]。
|
|
30
|
+
*/
|
|
31
|
+
var resolveOriginHolderId = function resolveOriginHolderId(holder) {
|
|
32
|
+
var formRecord = holder === null || holder === void 0 ? void 0 : holder.form_record;
|
|
33
|
+
if (Array.isArray(formRecord)) {
|
|
34
|
+
var _iterator = _createForOfIteratorHelper(formRecord),
|
|
35
|
+
_step;
|
|
36
|
+
try {
|
|
37
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
38
|
+
var _value = _step.value;
|
|
39
|
+
var id = toHolderRecordId(_value);
|
|
40
|
+
if (id != null) return id;
|
|
41
|
+
}
|
|
42
|
+
} catch (err) {
|
|
43
|
+
_iterator.e(err);
|
|
44
|
+
} finally {
|
|
45
|
+
_iterator.f();
|
|
46
|
+
}
|
|
47
|
+
} else {
|
|
48
|
+
var _id = toHolderRecordId(formRecord);
|
|
49
|
+
if (_id != null) return _id;
|
|
50
|
+
}
|
|
51
|
+
return toHolderRecordId(holder === null || holder === void 0 ? void 0 : holder.form_record_id);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* 从购物车行解析当前选中的 holder form_record_id。
|
|
56
|
+
*
|
|
57
|
+
* venueBooking:以 _origin.holder 为准(SDK 会原地更新 form_record);
|
|
58
|
+
* 顶层 item.holder_id 可能是上一轮 UI 注入或 SDK 回灌的滞后值,不能优先于 _origin.holder。
|
|
59
|
+
*/
|
|
60
|
+
export var resolveCartItemHolderId = function resolveCartItemHolderId(item) {
|
|
61
|
+
var _item$_origin;
|
|
62
|
+
var originHolder = item === null || item === void 0 || (_item$_origin = item._origin) === null || _item$_origin === void 0 ? void 0 : _item$_origin.holder;
|
|
63
|
+
if (originHolder && _typeof(originHolder) === 'object') {
|
|
64
|
+
return resolveOriginHolderId(originHolder);
|
|
65
|
+
}
|
|
66
|
+
return toHolderRecordId(item === null || item === void 0 ? void 0 : item.holder_id);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* 根据 holderMap 与购物车行数据,构建 ProductCard 所需的 holder 展示字段。
|
|
71
|
+
* 供 appointmentBooking、venueBooking 等购物车场景复用。
|
|
72
|
+
*/
|
|
73
|
+
export var buildCartHolderParams = function buildCartHolderParams(_ref) {
|
|
74
|
+
var _formData$form, _records$find;
|
|
75
|
+
var item = _ref.item,
|
|
76
|
+
_ref$holderConfig = _ref.holderConfig,
|
|
77
|
+
holderConfig = _ref$holderConfig === void 0 ? {} : _ref$holderConfig,
|
|
78
|
+
formData = _ref.formData,
|
|
79
|
+
translation = _ref.translation,
|
|
80
|
+
_ref$enabled = _ref.enabled,
|
|
81
|
+
enabled = _ref$enabled === void 0 ? true : _ref$enabled;
|
|
82
|
+
if (!enabled || !isHolderConfigEnabled(holderConfig)) {
|
|
83
|
+
return {
|
|
84
|
+
isShowChangeHolder: false,
|
|
85
|
+
holders: []
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
var records = (formData === null || formData === void 0 ? void 0 : formData.records) || [];
|
|
89
|
+
var holderId = resolveCartItemHolderId(item);
|
|
90
|
+
return {
|
|
91
|
+
holder_id: holderId,
|
|
92
|
+
isErrorHolder: !!(!holderId && holderConfig !== null && holderConfig !== void 0 && holderConfig.required),
|
|
93
|
+
isShowChangeHolder: true,
|
|
94
|
+
addHolderButtonText: translation(formData === null || formData === void 0 || (_formData$form = formData.form) === null || _formData$form === void 0 || (_formData$form = _formData$form.form) === null || _formData$form === void 0 || (_formData$form = _formData$form.setting) === null || _formData$form === void 0 ? void 0 : _formData$form.title),
|
|
95
|
+
holder_title: holderId ? (_records$find = records.find(function (record) {
|
|
96
|
+
return Number(record === null || record === void 0 ? void 0 : record.form_record_id) === holderId;
|
|
97
|
+
})) === null || _records$find === void 0 ? void 0 : _records$find.main_field : '',
|
|
98
|
+
holders: records.map(function (record) {
|
|
99
|
+
return _objectSpread(_objectSpread({}, record), {}, {
|
|
100
|
+
id: record === null || record === void 0 ? void 0 : record.form_record_id,
|
|
101
|
+
label: record === null || record === void 0 ? void 0 : record.main_field
|
|
102
|
+
});
|
|
103
|
+
})
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* 从 appointmentBooking 购物车行读取 holder_config
|
|
109
|
+
*/
|
|
110
|
+
export var getAppointmentCartHolderConfig = function getAppointmentCartHolderConfig(item) {
|
|
111
|
+
var _item$_productInit;
|
|
112
|
+
return (item === null || item === void 0 || (_item$_productInit = item._productInit) === null || _item$_productInit === void 0 ? void 0 : _item$_productInit.holder_config) || {};
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* 从 venueBooking 购物车行读取 holder_config
|
|
117
|
+
*/
|
|
118
|
+
export var getVenueCartHolderConfig = function getVenueCartHolderConfig(item) {
|
|
119
|
+
var _item$_origin2;
|
|
120
|
+
return (item === null || item === void 0 || (_item$_origin2 = item._origin) === null || _item$_origin2 === void 0 || (_item$_origin2 = _item$_origin2.product) === null || _item$_origin2 === void 0 ? void 0 : _item$_origin2.holder_config) || {};
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* 校验购物车中 holder_config.required 的行是否已选择 holder。
|
|
124
|
+
*/
|
|
125
|
+
export var validateRequiredCartHolders = function validateRequiredCartHolders(_ref2) {
|
|
126
|
+
var _ref2$items = _ref2.items,
|
|
127
|
+
items = _ref2$items === void 0 ? [] : _ref2$items,
|
|
128
|
+
_ref2$getHolderConfig = _ref2.getHolderConfig,
|
|
129
|
+
getHolderConfig = _ref2$getHolderConfig === void 0 ? getVenueCartHolderConfig : _ref2$getHolderConfig;
|
|
130
|
+
console.log(items, 'items1111');
|
|
131
|
+
var invalidItems = items.filter(function (item) {
|
|
132
|
+
var holderConfig = getHolderConfig(item);
|
|
133
|
+
if (!isHolderConfigEnabled(holderConfig) || !(holderConfig !== null && holderConfig !== void 0 && holderConfig.required)) {
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
return !resolveCartItemHolderId(item);
|
|
137
|
+
});
|
|
138
|
+
return {
|
|
139
|
+
hasError: invalidItems.length > 0,
|
|
140
|
+
invalidItems: invalidItems
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* 从 holderMap 解析 minors 表单关联的 sku 关系表单 ID(form_to_form 隐藏字段的 linkedTable)。
|
|
145
|
+
*/
|
|
146
|
+
export var getSkuRelationFormId = function getSkuRelationFormId(holderMap, formId) {
|
|
147
|
+
var _formData$form2, _formData$form3, _detail$setting;
|
|
148
|
+
if (!formId) return 0;
|
|
149
|
+
var formData = holderMap === null || holderMap === void 0 ? void 0 : holderMap[formId];
|
|
150
|
+
if ((formData === null || formData === void 0 || (_formData$form2 = formData.form) === null || _formData$form2 === void 0 || (_formData$form2 = _formData$form2.form) === null || _formData$form2 === void 0 ? void 0 : _formData$form2.form_type) !== 'minors') return 0;
|
|
151
|
+
var detail = formData === null || formData === void 0 || (_formData$form3 = formData.form) === null || _formData$form3 === void 0 || (_formData$form3 = _formData$form3.field) === null || _formData$form3 === void 0 ? void 0 : _formData$form3.find(function (item) {
|
|
152
|
+
return item.filed_type === 'form_to_form' && item.status === 'hide';
|
|
153
|
+
});
|
|
154
|
+
return (detail === null || detail === void 0 || (_detail$setting = detail.setting) === null || _detail$setting === void 0 ? void 0 : _detail$setting.linkedTable) || 0;
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* 从 form_to_form_value 中取最新创建的 form_record_id。
|
|
159
|
+
*/
|
|
160
|
+
export var getSkuRelationFormRecordId = function getSkuRelationFormRecordId(res) {
|
|
161
|
+
var _res$values;
|
|
162
|
+
var formToFormValue = res === null || res === void 0 || (_res$values = res.values) === null || _res$values === void 0 || (_res$values = _res$values.form_to_form_value) === null || _res$values === void 0 ? void 0 : _res$values[0];
|
|
163
|
+
var formDataValue = (formToFormValue === null || formToFormValue === void 0 ? void 0 : formToFormValue.form_data_value) || [];
|
|
164
|
+
return formDataValue[formDataValue.length - 1];
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* 处理购物车添加 holder 表单提交成功后的公共逻辑。
|
|
169
|
+
* - minors 关联表单:刷新 holder 列表,取 form_to_form_value 中的 record id
|
|
170
|
+
* - 普通表单:appendFormRecord 并直接使用 form_record_id
|
|
171
|
+
*/
|
|
172
|
+
export var handleCartHolderFormSuccess = function handleCartHolderFormSuccess(_ref3) {
|
|
173
|
+
var _res$values2, _res$values3, _res$values4;
|
|
174
|
+
var res = _ref3.res,
|
|
175
|
+
formId = _ref3.formId,
|
|
176
|
+
skuRelationFormId = _ref3.skuRelationFormId,
|
|
177
|
+
utils = _ref3.utils,
|
|
178
|
+
module = _ref3.module;
|
|
179
|
+
var formRecordId = res === null || res === void 0 || (_res$values2 = res.values) === null || _res$values2 === void 0 ? void 0 : _res$values2.form_record_id;
|
|
180
|
+
var resolvedFormId = res === null || res === void 0 || (_res$values3 = res.values) === null || _res$values3 === void 0 ? void 0 : _res$values3.form_id;
|
|
181
|
+
if (formId && skuRelationFormId) {
|
|
182
|
+
var _module$refreshAllHol;
|
|
183
|
+
var customer = getCustomer(utils);
|
|
184
|
+
module === null || module === void 0 || (_module$refreshAllHol = module.refreshAllHolderFormRecords) === null || _module$refreshAllHol === void 0 || _module$refreshAllHol.call(module, {
|
|
185
|
+
customer_id: customer === null || customer === void 0 ? void 0 : customer.id
|
|
186
|
+
});
|
|
187
|
+
formRecordId = getSkuRelationFormRecordId(res);
|
|
188
|
+
resolvedFormId = formId;
|
|
189
|
+
} else if (formId) {
|
|
190
|
+
var _module$appendFormRec;
|
|
191
|
+
module === null || module === void 0 || (_module$appendFormRec = module.appendFormRecord) === null || _module$appendFormRec === void 0 || _module$appendFormRec.call(module, {
|
|
192
|
+
record: res === null || res === void 0 ? void 0 : res.values
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
return {
|
|
196
|
+
formRecordId: formRecordId,
|
|
197
|
+
mainField: res === null || res === void 0 || (_res$values4 = res.values) === null || _res$values4 === void 0 ? void 0 : _res$values4.main_field,
|
|
198
|
+
formId: resolvedFormId
|
|
199
|
+
};
|
|
200
|
+
};
|
|
@@ -44,6 +44,7 @@ var import_utils2 = require("../../../utils");
|
|
|
44
44
|
var import_Voucher = __toESM(require("../../Voucher"));
|
|
45
45
|
var import_Deposit = __toESM(require("../../Deposit"));
|
|
46
46
|
var import_utils3 = require("../utils");
|
|
47
|
+
var import_buildCartHolderParams = require("../../../../../utils/buildCartHolderParams");
|
|
47
48
|
var import_index = require("./index.less");
|
|
48
49
|
var CartItem = ({ onNext, renderContactInfo }) => {
|
|
49
50
|
var _a, _b, _c, _d, _e;
|
|
@@ -64,8 +65,26 @@ var CartItem = ({ onNext, renderContactInfo }) => {
|
|
|
64
65
|
const { isFormSubject, bookingSubject, isRetailTemplate } = (0, import_hooks2.useAppointmentBookingSetting)();
|
|
65
66
|
const { isLogin } = (0, import_hooks2.useAppointmentBookingLogin)();
|
|
66
67
|
const utils = (0, import_hooks2.contextUtils)();
|
|
67
|
-
const { businessUtils, translation } = utils;
|
|
68
|
+
const { businessUtils, translation, pisellos } = utils;
|
|
68
69
|
const { taxTitle, totalTaxFee, isPriceIncludeTax, total, deposit } = summary;
|
|
70
|
+
const [holderMap, setHolderMap] = (0, import_react.useState)({});
|
|
71
|
+
(0, import_react.useEffect)(() => {
|
|
72
|
+
var _a2;
|
|
73
|
+
const onHolderChanged = (res) => {
|
|
74
|
+
if ((res == null ? void 0 : res.path) === "holderMap") {
|
|
75
|
+
setHolderMap(res == null ? void 0 : res.value);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
(_a2 = pisellos == null ? void 0 : pisellos.effects) == null ? void 0 : _a2.on("appointmentBooking_holder:changed", onHolderChanged);
|
|
79
|
+
return () => {
|
|
80
|
+
var _a3;
|
|
81
|
+
(_a3 = pisellos == null ? void 0 : pisellos.effects) == null ? void 0 : _a3.off("appointmentBooking_holder:changed", onHolderChanged);
|
|
82
|
+
};
|
|
83
|
+
}, []);
|
|
84
|
+
(0, import_react.useEffect)(() => {
|
|
85
|
+
const _holderMap = (appointmentBooking == null ? void 0 : appointmentBooking.getHolderFormMap()) || {};
|
|
86
|
+
setHolderMap(_holderMap);
|
|
87
|
+
}, []);
|
|
69
88
|
const currentUser = (0, import_react.useMemo)(() => {
|
|
70
89
|
return (0, import_utils2.formatCurrentUser)(utils) || {};
|
|
71
90
|
}, []);
|
|
@@ -119,13 +138,33 @@ var CartItem = ({ onNext, renderContactInfo }) => {
|
|
|
119
138
|
}
|
|
120
139
|
if (type === "add_holder") {
|
|
121
140
|
const relationShipFormId = bookingSubject == null ? void 0 : bookingSubject.relationship_form_id;
|
|
141
|
+
const holderConfig = (0, import_buildCartHolderParams.getAppointmentCartHolderConfig)(e);
|
|
142
|
+
const formId = (0, import_buildCartHolderParams.isHolderConfigEnabled)(holderConfig) ? holderConfig == null ? void 0 : holderConfig.resource_id : void 0;
|
|
143
|
+
const skuRelationFormId = (0, import_buildCartHolderParams.getSkuRelationFormId)(holderMap, formId);
|
|
122
144
|
return (0, import_utils2.openForm)({
|
|
123
|
-
form_id: relationShipFormId || (bookingSubject == null ? void 0 : bookingSubject.form_id),
|
|
145
|
+
form_id: skuRelationFormId || formId || relationShipFormId || (bookingSubject == null ? void 0 : bookingSubject.form_id),
|
|
124
146
|
title: import_utils.locales.getText("pisell2.event.create.form"),
|
|
125
147
|
utils,
|
|
126
148
|
callback: async (res) => {
|
|
127
149
|
if ((res == null ? void 0 : res.status) === "success") {
|
|
128
150
|
let result = void 0;
|
|
151
|
+
if (formId) {
|
|
152
|
+
const { formRecordId, mainField } = (0, import_buildCartHolderParams.handleCartHolderFormSuccess)({
|
|
153
|
+
res,
|
|
154
|
+
formId,
|
|
155
|
+
skuRelationFormId,
|
|
156
|
+
utils,
|
|
157
|
+
module: appointmentBooking
|
|
158
|
+
});
|
|
159
|
+
appointmentBooking.updateCart({
|
|
160
|
+
_id: e == null ? void 0 : e._id,
|
|
161
|
+
account: {
|
|
162
|
+
id: formRecordId,
|
|
163
|
+
username: mainField
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
129
168
|
if (!relationShipFormId) {
|
|
130
169
|
result = await addAccount(res == null ? void 0 : res.values, "holder");
|
|
131
170
|
} else {
|
|
@@ -151,13 +190,26 @@ var CartItem = ({ onNext, renderContactInfo }) => {
|
|
|
151
190
|
};
|
|
152
191
|
const products = (0, import_react.useMemo)(() => {
|
|
153
192
|
if (!(carts == null ? void 0 : carts.length)) return [];
|
|
154
|
-
carts.
|
|
155
|
-
|
|
193
|
+
const enrichedCarts = carts.map((item) => {
|
|
194
|
+
const isNormalProduct = appointmentBooking.isTargetCartIdNormalProduct(
|
|
156
195
|
item == null ? void 0 : item._id
|
|
157
196
|
);
|
|
197
|
+
const holderConfig = (0, import_buildCartHolderParams.getAppointmentCartHolderConfig)(item);
|
|
198
|
+
const formData = (0, import_buildCartHolderParams.isHolderConfigEnabled)(holderConfig) ? holderMap == null ? void 0 : holderMap[holderConfig == null ? void 0 : holderConfig.resource_id] : {};
|
|
199
|
+
const holderParams = (0, import_buildCartHolderParams.buildCartHolderParams)({
|
|
200
|
+
item,
|
|
201
|
+
holderConfig,
|
|
202
|
+
formData,
|
|
203
|
+
translation,
|
|
204
|
+
enabled: !isFormSubject ? false : !isNormalProduct
|
|
205
|
+
});
|
|
206
|
+
return {
|
|
207
|
+
...item,
|
|
208
|
+
...holderParams
|
|
209
|
+
};
|
|
158
210
|
});
|
|
159
211
|
if ((currentSelectedResources == null ? void 0 : currentSelectedResources.length) > 0) {
|
|
160
|
-
const newCarts =
|
|
212
|
+
const newCarts = enrichedCarts.map((item) => {
|
|
161
213
|
const currentResourceData = currentSelectedResources.find(
|
|
162
214
|
(resource) => (resource == null ? void 0 : resource._id) === (item == null ? void 0 : item._id)
|
|
163
215
|
);
|
|
@@ -169,15 +221,22 @@ var CartItem = ({ onNext, renderContactInfo }) => {
|
|
|
169
221
|
return {
|
|
170
222
|
...item,
|
|
171
223
|
isMultipleResource: true,
|
|
172
|
-
multiResources
|
|
173
|
-
isErrorHolder: isErrorHolder || false
|
|
224
|
+
multiResources
|
|
225
|
+
// isErrorHolder: isErrorHolder || false,
|
|
174
226
|
};
|
|
175
227
|
});
|
|
176
228
|
return newCarts;
|
|
177
229
|
} else {
|
|
178
|
-
return
|
|
230
|
+
return enrichedCarts;
|
|
179
231
|
}
|
|
180
|
-
}, [
|
|
232
|
+
}, [
|
|
233
|
+
carts,
|
|
234
|
+
currentSelectedResources,
|
|
235
|
+
currentStepParams == null ? void 0 : currentStepParams.key,
|
|
236
|
+
isErrorHolder,
|
|
237
|
+
holderMap,
|
|
238
|
+
isFormSubject
|
|
239
|
+
]);
|
|
181
240
|
const subTotalList = (0, import_react.useMemo)(() => {
|
|
182
241
|
const hideDeposit = (carts == null ? void 0 : carts.length) === 0 || !(deposit == null ? void 0 : deposit.hasDeposit);
|
|
183
242
|
const surcharge = ((summary == null ? void 0 : summary.surcharge) || []).map(
|
|
@@ -236,7 +295,9 @@ var CartItem = ({ onNext, renderContactInfo }) => {
|
|
|
236
295
|
isShowDelete: ((_e = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _e.key) === "select-service",
|
|
237
296
|
isShowPackageNote: false,
|
|
238
297
|
isShowChangeHolder: isLastStep ? false : isFormSubject && isLogin,
|
|
298
|
+
// isShowChangeHolder: isLastStep ? false : !isRetailTemplate && isLogin,
|
|
239
299
|
isShowHolder: isFormSubject,
|
|
300
|
+
// isShowHolder: !isRetailTemplate,
|
|
240
301
|
isShowAddHolderButton: true
|
|
241
302
|
},
|
|
242
303
|
collapseParams: {
|
|
@@ -61,7 +61,7 @@ var ConfirmInformation = (0, import_react.forwardRef)((props, ref) => {
|
|
|
61
61
|
carts,
|
|
62
62
|
setTimes
|
|
63
63
|
} = (0, import_context.useAppointmentBookingContext)();
|
|
64
|
-
const { isRetailTemplate, bookingSetting } = (0, import_hooks.useAppointmentBookingSetting)();
|
|
64
|
+
const { isRetailTemplate, bookingSetting, isFormSubject } = (0, import_hooks.useAppointmentBookingSetting)();
|
|
65
65
|
console.log(bookingSetting, "bookingSetting");
|
|
66
66
|
const [form] = import_antd.Form.useForm();
|
|
67
67
|
const userInfo = (0, import_useLoginUser.default)();
|
|
@@ -185,8 +185,12 @@ var ConfirmInformation = (0, import_react.forwardRef)((props, ref) => {
|
|
|
185
185
|
};
|
|
186
186
|
const onCheckout = async (extraData) => {
|
|
187
187
|
try {
|
|
188
|
+
const _extraData = {
|
|
189
|
+
...extraData,
|
|
190
|
+
is_add_holder_info: isFormSubject
|
|
191
|
+
};
|
|
188
192
|
const { deposit } = summary;
|
|
189
|
-
const { data } = await appointmentBooking.submitOrder(
|
|
193
|
+
const { data } = await appointmentBooking.submitOrder(_extraData);
|
|
190
194
|
const { is_deposit, deposit_amount, total_amount, order_id } = data || {};
|
|
191
195
|
const _total = is_deposit ? deposit_amount : total_amount;
|
|
192
196
|
if (_total > 0) {
|
|
@@ -56,7 +56,6 @@ var Header = () => {
|
|
|
56
56
|
const { setOtherData, getOtherData } = (0, import_hooks.useAppointmentBookingSetting)();
|
|
57
57
|
const { checkProductType } = (0, import_hooks.useAppointmentBookingProduct)();
|
|
58
58
|
const utils = (0, import_hooks.contextUtils)();
|
|
59
|
-
const progressBarRef = (0, import_react.useRef)(null);
|
|
60
59
|
const stepName = (0, import_react.useMemo)(() => {
|
|
61
60
|
var _a2, _b, _c;
|
|
62
61
|
const key = (_a2 = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _a2.key;
|
|
@@ -132,27 +131,16 @@ var Header = () => {
|
|
|
132
131
|
const utils2 = context.appHelper.utils || {};
|
|
133
132
|
(_b = utils2 == null ? void 0 : utils2.history) == null ? void 0 : _b.replace("/");
|
|
134
133
|
};
|
|
135
|
-
const { restoreBackTrap } = (0, import_hooks.useInterceptBrowserBack)({
|
|
136
|
-
stepIndex: (currentStep == null ? void 0 : currentStep.index) ?? 0,
|
|
137
|
-
canGoBack: () => ((currentStep == null ? void 0 : currentStep.index) ?? 0) > 0,
|
|
138
|
-
onBack: handleBack,
|
|
139
|
-
onExit: () => {
|
|
140
|
-
var _a2;
|
|
141
|
-
return (_a2 = progressBarRef.current) == null ? void 0 : _a2.triggerClose();
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
134
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
145
135
|
import_progressBar.default,
|
|
146
136
|
{
|
|
147
|
-
ref: progressBarRef,
|
|
148
137
|
title: currentStep ? `${import_utils.locales.getText("pisell2.appointment.step")(
|
|
149
138
|
(currentStep == null ? void 0 : currentStep.index) + 1
|
|
150
139
|
)}` : "",
|
|
151
140
|
description: stepName,
|
|
152
141
|
showBack: (currentStep == null ? void 0 : currentStep.index) > 0,
|
|
153
142
|
onBack: () => handleBack(),
|
|
154
|
-
onClose: () => handleClose()
|
|
155
|
-
onConfirmCancel: restoreBackTrap
|
|
143
|
+
onClose: () => handleClose()
|
|
156
144
|
}
|
|
157
145
|
);
|
|
158
146
|
};
|