@pisell/private-materials 3.3.19 → 3.3.21
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 +3 -3
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +3 -3
- package/es/components/appointmentBooking/components/ConfirmInformation/index.js +3 -2
- package/es/components/appointmentBooking/components/Content/index.js +19 -22
- package/es/components/appointmentBooking/components/Date/index.js +66 -42
- package/es/components/appointmentBooking/components/Date/state.js +5 -0
- package/es/components/appointmentBooking/components/Form/index.js +12 -4
- package/es/components/appointmentBooking/components/Guest/index.js +4 -2
- package/es/components/appointmentBooking/components/Resource/index.js +7 -4
- package/es/components/appointmentBooking/components/Services/index.js +3 -2
- package/es/components/appointmentBooking/components/TimeSlicing/index.js +4 -2
- package/es/components/appointmentBooking/context.js +63 -6
- package/es/components/appointmentBooking/deposit/components/PolicyModal/index.js +35 -11
- package/es/components/appointmentBooking/deposit/components/PolicyModal/index.less +9 -0
- package/es/components/appointmentBooking/hooks.js +48 -8
- package/es/components/appointmentBooking/index.d.ts +0 -1
- package/es/components/appointmentBooking/locales.js +6 -0
- package/es/components/appointmentBooking/utils.js +10 -4
- package/es/components/booking/components/footer/index.d.ts +1 -0
- package/es/components/booking/components/footer/utils.js +1 -1
- package/es/components/booking/deposit/index.js +1 -1
- package/es/components/ticketBooking/components/ticketBooking/index.d.ts +1 -0
- package/lib/components/appointmentBooking/components/ConfirmInformation/index.js +1 -0
- package/lib/components/appointmentBooking/components/Content/index.js +11 -11
- package/lib/components/appointmentBooking/components/Date/index.js +29 -12
- package/lib/components/appointmentBooking/components/Date/state.js +7 -0
- package/lib/components/appointmentBooking/components/Form/index.js +6 -3
- package/lib/components/appointmentBooking/components/Guest/index.js +2 -1
- package/lib/components/appointmentBooking/components/Resource/index.js +6 -4
- package/lib/components/appointmentBooking/components/Services/index.js +2 -2
- package/lib/components/appointmentBooking/components/TimeSlicing/index.js +2 -1
- package/lib/components/appointmentBooking/context.js +28 -7
- package/lib/components/appointmentBooking/deposit/components/PolicyModal/index.js +39 -4
- package/lib/components/appointmentBooking/deposit/components/PolicyModal/index.less +9 -0
- package/lib/components/appointmentBooking/hooks.js +29 -5
- package/lib/components/appointmentBooking/index.d.ts +0 -1
- package/lib/components/appointmentBooking/locales.js +6 -0
- package/lib/components/appointmentBooking/utils.js +8 -4
- package/lib/components/booking/components/footer/index.d.ts +1 -0
- package/lib/components/booking/components/footer/utils.js +1 -1
- package/lib/components/booking/deposit/index.js +1 -1
- package/lib/components/ticketBooking/components/ticketBooking/index.d.ts +1 -0
- package/package.json +2 -2
- package/es/components/appointmentBooking/components/ConfirmInformation/index.d.ts +0 -4
- package/es/components/appointmentBooking/components/Content/index.d.ts +0 -3
- package/es/components/appointmentBooking/components/Date/index.d.ts +0 -4
- package/es/components/appointmentBooking/components/Date/state.d.ts +0 -62
- package/es/components/appointmentBooking/components/Form/index.d.ts +0 -4
- package/es/components/appointmentBooking/components/Guest/index.d.ts +0 -4
- package/es/components/appointmentBooking/components/Resource/index.d.ts +0 -7
- package/es/components/appointmentBooking/components/Services/index.d.ts +0 -4
- package/es/components/appointmentBooking/components/TimeSlicing/index.d.ts +0 -4
- package/es/components/appointmentBooking/context.d.ts +0 -33
- package/es/components/appointmentBooking/deposit/components/PolicyModal/index.d.ts +0 -3
- package/es/components/appointmentBooking/hooks.d.ts +0 -106
- package/es/components/appointmentBooking/locales.d.ts +0 -348
- package/es/components/appointmentBooking/utils.d.ts +0 -114
- package/es/components/booking/deposit/index.d.ts +0 -3
- package/es/components/eftposPay/payo/config.d.ts +0 -12
- package/es/components/eftposPay/payo/hooks.d.ts +0 -10
- package/lib/components/appointmentBooking/components/ConfirmInformation/index.d.ts +0 -4
- package/lib/components/appointmentBooking/components/Content/index.d.ts +0 -3
- package/lib/components/appointmentBooking/components/Date/index.d.ts +0 -4
- package/lib/components/appointmentBooking/components/Date/state.d.ts +0 -62
- package/lib/components/appointmentBooking/components/Form/index.d.ts +0 -4
- package/lib/components/appointmentBooking/components/Guest/index.d.ts +0 -4
- package/lib/components/appointmentBooking/components/Resource/index.d.ts +0 -7
- package/lib/components/appointmentBooking/components/Services/index.d.ts +0 -4
- package/lib/components/appointmentBooking/components/TimeSlicing/index.d.ts +0 -4
- package/lib/components/appointmentBooking/context.d.ts +0 -33
- package/lib/components/appointmentBooking/deposit/components/PolicyModal/index.d.ts +0 -3
- package/lib/components/appointmentBooking/hooks.d.ts +0 -106
- package/lib/components/appointmentBooking/locales.d.ts +0 -348
- package/lib/components/appointmentBooking/utils.d.ts +0 -114
- package/lib/components/booking/deposit/index.d.ts +0 -3
- package/lib/components/eftposPay/payo/config.d.ts +0 -12
- package/lib/components/eftposPay/payo/hooks.d.ts +0 -10
|
@@ -47,7 +47,9 @@ export var useAppointmentBookingStep = function useAppointmentBookingStep() {
|
|
|
47
47
|
var pisellOS = usePisellOS();
|
|
48
48
|
var _useAppointmentBookin = useAppointmentBookingContext(),
|
|
49
49
|
appointmentBooking = _useAppointmentBookin.appointmentBooking,
|
|
50
|
-
setCurrentStep = _useAppointmentBookin.setCurrentStep
|
|
50
|
+
setCurrentStep = _useAppointmentBookin.setCurrentStep,
|
|
51
|
+
policyIdsRef = _useAppointmentBookin.policyIdsRef,
|
|
52
|
+
openPolicy = _useAppointmentBookin.openPolicy;
|
|
51
53
|
var stepList = (appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$s = appointmentBooking.store) === null || _appointmentBooking$s === void 0 || (_appointmentBooking$s = _appointmentBooking$s.step) === null || _appointmentBooking$s === void 0 || (_appointmentBooking$s = _appointmentBooking$s.store) === null || _appointmentBooking$s === void 0 ? void 0 : _appointmentBooking$s.stepList) || [];
|
|
52
54
|
|
|
53
55
|
// 判断是否是最后一步
|
|
@@ -117,12 +119,46 @@ export var useAppointmentBookingStep = function useAppointmentBookingStep() {
|
|
|
117
119
|
isSkip: (step === null || step === void 0 ? void 0 : step.isSkip) || false
|
|
118
120
|
});
|
|
119
121
|
};
|
|
122
|
+
|
|
123
|
+
// 下一步
|
|
124
|
+
var nextStep = function nextStep() {
|
|
125
|
+
var _appointmentBooking$s2;
|
|
126
|
+
var currentStep = appointmentBooking === null || appointmentBooking === void 0 ? void 0 : appointmentBooking.getCurrentStep();
|
|
127
|
+
var stepList = (appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$s2 = appointmentBooking.store) === null || _appointmentBooking$s2 === void 0 || (_appointmentBooking$s2 = _appointmentBooking$s2.step) === null || _appointmentBooking$s2 === void 0 || (_appointmentBooking$s2 = _appointmentBooking$s2.store) === null || _appointmentBooking$s2 === void 0 ? void 0 : _appointmentBooking$s2.stepList) || [];
|
|
128
|
+
|
|
129
|
+
// 倒数第二步
|
|
130
|
+
if ((currentStep === null || currentStep === void 0 ? void 0 : currentStep.index) + 2 === (stepList === null || stepList === void 0 ? void 0 : stepList.length)) {
|
|
131
|
+
var _policyIdsRef$current;
|
|
132
|
+
// 如果没有同意资源上挂接的协议,则打开协议弹窗
|
|
133
|
+
if (policyIdsRef !== null && policyIdsRef !== void 0 && (_policyIdsRef$current = policyIdsRef.current) !== null && _policyIdsRef$current !== void 0 && _policyIdsRef$current.length) {
|
|
134
|
+
// 依次弹出所有协议
|
|
135
|
+
var idx = 0;
|
|
136
|
+
var showNextPolicy = function showNextPolicy() {
|
|
137
|
+
if (idx < policyIdsRef.current.length) {
|
|
138
|
+
openPolicy({
|
|
139
|
+
id: policyIdsRef.current[idx]
|
|
140
|
+
}, function () {
|
|
141
|
+
idx++;
|
|
142
|
+
showNextPolicy();
|
|
143
|
+
});
|
|
144
|
+
} else {
|
|
145
|
+
// 全部同意后,进入下一步
|
|
146
|
+
appointmentBooking.next();
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
showNextPolicy();
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
appointmentBooking.next();
|
|
154
|
+
};
|
|
120
155
|
return {
|
|
121
156
|
getStepIndex: getStepIndex,
|
|
122
157
|
stepList: stepList,
|
|
123
158
|
removeStep: removeStep,
|
|
124
159
|
addStep: addStep,
|
|
125
|
-
updateStep: updateStep
|
|
160
|
+
updateStep: updateStep,
|
|
161
|
+
nextStep: nextStep
|
|
126
162
|
};
|
|
127
163
|
};
|
|
128
164
|
|
|
@@ -575,23 +611,26 @@ export var useAppointmentBookingResource = function useAppointmentBookingResourc
|
|
|
575
611
|
* @Date: 2025-04-21 11:47
|
|
576
612
|
*/
|
|
577
613
|
export var useIsSkipResourceStep = function useIsSkipResourceStep() {
|
|
578
|
-
var _appointmentBooking$
|
|
614
|
+
var _appointmentBooking$s3;
|
|
579
615
|
var _useAppointmentBookin5 = useAppointmentBookingContext(),
|
|
580
616
|
currentStep = _useAppointmentBookin5.currentStep,
|
|
581
|
-
setCarts = _useAppointmentBookin5.setCarts
|
|
617
|
+
setCarts = _useAppointmentBookin5.setCarts,
|
|
618
|
+
setPolicyIds = _useAppointmentBookin5.setPolicyIds;
|
|
582
619
|
var _useAppointmentBookin6 = useAppointmentBookingResource(),
|
|
583
620
|
getResourceList = _useAppointmentBookin6.getResourceList,
|
|
584
621
|
autoSelectAllProductResources = _useAppointmentBookin6.autoSelectAllProductResources;
|
|
585
622
|
var _useAppointmentBookin7 = useAppointmentBookingSetting(),
|
|
586
623
|
isFormSubject = _useAppointmentBookin7.isFormSubject;
|
|
587
624
|
var appointmentBooking = useAppointmentBooking();
|
|
588
|
-
var stepList = (appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$
|
|
625
|
+
var stepList = (appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$s3 = appointmentBooking.store) === null || _appointmentBooking$s3 === void 0 || (_appointmentBooking$s3 = _appointmentBooking$s3.step) === null || _appointmentBooking$s3 === void 0 || (_appointmentBooking$s3 = _appointmentBooking$s3.store) === null || _appointmentBooking$s3 === void 0 ? void 0 : _appointmentBooking$s3.stepList) || [];
|
|
589
626
|
var _useAppointmentBookin8 = useAppointmentBookingLogin(),
|
|
590
627
|
isLogin = _useAppointmentBookin8.isLogin,
|
|
591
628
|
openLoginModal = _useAppointmentBookin8.openLoginModal;
|
|
592
629
|
var _useAppointmentBookin9 = useAppointmentBookingAccount(),
|
|
593
630
|
getHolders = _useAppointmentBookin9.getHolders,
|
|
594
631
|
checkAccount = _useAppointmentBookin9.checkAccount;
|
|
632
|
+
var _useAppointmentBookin10 = useAppointmentBookingStep(),
|
|
633
|
+
nextStep = _useAppointmentBookin10.nextStep;
|
|
595
634
|
var utils = contextUtils();
|
|
596
635
|
var checkSkipResourceStep = /*#__PURE__*/function () {
|
|
597
636
|
var _ref20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(isSkipUpdateFormStep) {
|
|
@@ -622,8 +661,9 @@ export var useIsSkipResourceStep = function useIsSkipResourceStep() {
|
|
|
622
661
|
break;
|
|
623
662
|
}
|
|
624
663
|
if (!isSkipUpdateFormStep) {
|
|
625
|
-
resultCarts = formatCartsResources(carts, resources); // 如果当前资源有表单,则添加表单步骤,否则删除表单步骤
|
|
664
|
+
resultCarts = formatCartsResources(carts, resources, setPolicyIds); // 如果当前资源有表单,则添加表单步骤,否则删除表单步骤
|
|
626
665
|
checkHasFormStep({
|
|
666
|
+
nextStep: nextStep,
|
|
627
667
|
isSkip: true,
|
|
628
668
|
openLoginModal: openLoginModal,
|
|
629
669
|
utils: utils,
|
|
@@ -683,8 +723,8 @@ export var useIsSkipResourceStep = function useIsSkipResourceStep() {
|
|
|
683
723
|
export var useAppointmentBookingSetting = function useAppointmentBookingSetting() {
|
|
684
724
|
var _appointmentBooking$o3;
|
|
685
725
|
var utils = contextUtils();
|
|
686
|
-
var
|
|
687
|
-
appointmentBooking =
|
|
726
|
+
var _useAppointmentBookin11 = useAppointmentBookingContext(),
|
|
727
|
+
appointmentBooking = _useAppointmentBookin11.appointmentBooking;
|
|
688
728
|
var _ref21 = (appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$o3 = appointmentBooking.otherParams) === null || _appointmentBooking$o3 === void 0 ? void 0 : _appointmentBooking$o3.productModuleParams) || {},
|
|
689
729
|
bookingProcess = _ref21.bookingProcess,
|
|
690
730
|
bookingSubject = _ref21.bookingSubject,
|
|
@@ -120,6 +120,8 @@ export default {
|
|
|
120
120
|
'pisell2.appointment.unselect.date': 'Please select date',
|
|
121
121
|
'pisell2.appointment.unuse.date': 'This date is not available, please change the date.',
|
|
122
122
|
'pisell2.appointment.add-guests': 'Add guests',
|
|
123
|
+
'pisell2.appointment.policy': 'You have read and agreed to this policy',
|
|
124
|
+
'pisell2.appointment.policy.confirm': 'Confirm',
|
|
123
125
|
'pisell2.text.apply': 'Apply',
|
|
124
126
|
'pisell2.text.goodpass': 'GoodPass',
|
|
125
127
|
'pisell2.text.goodpass.product-vouchers': 'Product Vouchers',
|
|
@@ -251,6 +253,8 @@ export default {
|
|
|
251
253
|
'pisell2.appointment.unselect.date': '请选择日期',
|
|
252
254
|
'pisell2.appointment.unuse.date': '此日期不可用,请更换日期。',
|
|
253
255
|
'pisell2.appointment.add-guests': '添加预约人',
|
|
256
|
+
'pisell2.appointment.policy': '您已仔细阅读并同意此协议',
|
|
257
|
+
'pisell2.appointment.policy.confirm': '确定',
|
|
254
258
|
'pisell2.text.apply': '应用',
|
|
255
259
|
'pisell2.text.goodpass': '商品券',
|
|
256
260
|
'pisell2.text.goodpass.product-vouchers': '商品兑换券',
|
|
@@ -382,6 +386,8 @@ export default {
|
|
|
382
386
|
'pisell2.appointment.unselect.date': '請選擇日期',
|
|
383
387
|
'pisell2.appointment.unuse.date': '此日期不可用,請更換日期。',
|
|
384
388
|
'pisell2.appointment.add-guests': '添加預約人',
|
|
389
|
+
'pisell2.appointment.policy': '您已仔細閱讀並同意此協議',
|
|
390
|
+
'pisell2.appointment.policy.confirm': '確定',
|
|
385
391
|
'pisell2.text.apply': '應用',
|
|
386
392
|
'pisell2.text.goodpass': '商品券',
|
|
387
393
|
'pisell2.text.goodpass.product-vouchers': '商品兌換券',
|
|
@@ -57,8 +57,9 @@ export var formatGuest = function formatGuest(data, products) {
|
|
|
57
57
|
* @Author: WangHan
|
|
58
58
|
* @Date: 2025-05-06 22:22
|
|
59
59
|
*/
|
|
60
|
-
export var formatCartsResources = function formatCartsResources(carts, resources) {
|
|
60
|
+
export var formatCartsResources = function formatCartsResources(carts, resources, setPolicyIds) {
|
|
61
61
|
try {
|
|
62
|
+
var policyIds = [];
|
|
62
63
|
var newCarts = carts === null || carts === void 0 ? void 0 : carts.map(function (d) {
|
|
63
64
|
var _currentResource$reso;
|
|
64
65
|
var currentResource = resources === null || resources === void 0 ? void 0 : resources.find(function (r) {
|
|
@@ -77,9 +78,13 @@ export var formatCartsResources = function formatCartsResources(carts, resources
|
|
|
77
78
|
return _objectSpread(_objectSpread({}, d), {}, {
|
|
78
79
|
resource_form_id: foundResource === null || foundResource === void 0 ? void 0 : foundResource.resource_form_id
|
|
79
80
|
});
|
|
81
|
+
} else if (foundResource !== null && foundResource !== void 0 && foundResource.policy_id && !policyIds.includes(foundResource === null || foundResource === void 0 ? void 0 : foundResource.policy_id)) {
|
|
82
|
+
// 资源上没有挂接表单,但是有协议,则在触发按钮的时候需要同意协议才能继续
|
|
83
|
+
policyIds.push(foundResource === null || foundResource === void 0 ? void 0 : foundResource.policy_id);
|
|
80
84
|
}
|
|
81
85
|
return false;
|
|
82
86
|
}).filter(Boolean);
|
|
87
|
+
setPolicyIds(policyIds);
|
|
83
88
|
return newCarts || [];
|
|
84
89
|
} catch (error) {
|
|
85
90
|
console.log(error, 'formatCarts');
|
|
@@ -371,7 +376,8 @@ export var Toast = function Toast(text) {
|
|
|
371
376
|
*/
|
|
372
377
|
export var checkHasFormStep = function checkHasFormStep(_ref2) {
|
|
373
378
|
var _appointmentBooking$s;
|
|
374
|
-
var
|
|
379
|
+
var nextStep = _ref2.nextStep,
|
|
380
|
+
isSkip = _ref2.isSkip,
|
|
375
381
|
checkHolder = _ref2.checkHolder,
|
|
376
382
|
checkAccount = _ref2.checkAccount,
|
|
377
383
|
carts = _ref2.carts,
|
|
@@ -453,14 +459,14 @@ export var checkHasFormStep = function checkHasFormStep(_ref2) {
|
|
|
453
459
|
isNext = true;
|
|
454
460
|
}
|
|
455
461
|
if (isNext && !_checkHolder()) {
|
|
456
|
-
|
|
462
|
+
nextStep();
|
|
457
463
|
} else {
|
|
458
464
|
return true;
|
|
459
465
|
}
|
|
460
466
|
} else {
|
|
461
467
|
// 如果只有一个资源执行跳过
|
|
462
468
|
if (isSkip) {
|
|
463
|
-
|
|
469
|
+
nextStep();
|
|
464
470
|
}
|
|
465
471
|
}
|
|
466
472
|
};
|
|
@@ -165,7 +165,7 @@ var checkResourcesFormat = function checkResourcesFormat(resources, service, isC
|
|
|
165
165
|
children: (_resource$children = resource.children) !== null && _resource$children !== void 0 && _resource$children.length ? checkResourcesFormat(resource.children, service, true) : undefined,
|
|
166
166
|
form_id: resource.form_id,
|
|
167
167
|
relation_type: resource.relation_type || 'form',
|
|
168
|
-
relation_id: resource.relation_id ||
|
|
168
|
+
relation_id: resource.relation_id || 0,
|
|
169
169
|
capacity: resource.capacity,
|
|
170
170
|
like_status: resource.like_status || 'common',
|
|
171
171
|
metadata: resource.metadata || {}
|
|
@@ -97,7 +97,7 @@ var Deposit = function Deposit(props) {
|
|
|
97
97
|
}, [globalState]);
|
|
98
98
|
var depositList = useMemo(function () {
|
|
99
99
|
if (!bookingId) return [];
|
|
100
|
-
if (
|
|
100
|
+
if ((bookingDetail === null || bookingDetail === void 0 ? void 0 : bookingDetail.is_deposit) === 0) return [];
|
|
101
101
|
return [{
|
|
102
102
|
customer: bookingDetail === null || bookingDetail === void 0 ? void 0 : bookingDetail.customer,
|
|
103
103
|
status: bookingDetail === null || bookingDetail === void 0 ? void 0 : bookingDetail.deposit_payment_status,
|
|
@@ -58,15 +58,15 @@ var Layout = () => {
|
|
|
58
58
|
resourceOtherParams,
|
|
59
59
|
setIsAgreeDepositPolicy,
|
|
60
60
|
appointmentBooking,
|
|
61
|
-
setLoading
|
|
61
|
+
setLoading,
|
|
62
|
+
policyParams,
|
|
63
|
+
closePolicy
|
|
62
64
|
} = (0, import_context.useAppointmentBookingContext)();
|
|
63
65
|
const { getLoadAllSchedule, isDateSelectedFirst, isFormSubject } = (0, import_hooks.useAppointmentBookingSetting)();
|
|
64
66
|
const { isLogin } = (0, import_hooks.useAppointmentBookingLogin)();
|
|
65
67
|
const { getHolders } = (0, import_hooks.useAppointmentBookingAccount)();
|
|
66
68
|
const { removeStep, stepList } = (0, import_hooks.useAppointmentBookingStep)();
|
|
67
69
|
const { shopDiscount } = (0, import_hooks.useShopDiscount)();
|
|
68
|
-
const [showAgreement, setShowAgreement] = (0, import_react.useState)(false);
|
|
69
|
-
const [agreementContent, setAgreementContent] = (0, import_react.useState)({});
|
|
70
70
|
(0, import_hooks.useAppointmentBookingCart)();
|
|
71
71
|
(0, import_hooks.useAppointmentBookingStep)();
|
|
72
72
|
const [params, setParams] = (0, import_react.useState)({});
|
|
@@ -172,9 +172,6 @@ var Layout = () => {
|
|
|
172
172
|
if (isDateSelectedFirst && key === "select-date") return false;
|
|
173
173
|
return key !== "confirm-information";
|
|
174
174
|
}, [isDateSelectedFirst, (_e = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _e.key]);
|
|
175
|
-
const handleAgreementOk = () => {
|
|
176
|
-
setShowAgreement(false);
|
|
177
|
-
};
|
|
178
175
|
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_Header.default, null), /* @__PURE__ */ import_react.default.createElement(
|
|
179
176
|
"div",
|
|
180
177
|
{
|
|
@@ -190,13 +187,16 @@ var Layout = () => {
|
|
|
190
187
|
return (_b2 = (_a2 = stepRef == null ? void 0 : stepRef.current) == null ? void 0 : _a2.next) == null ? void 0 : _b2.call(_a2);
|
|
191
188
|
}
|
|
192
189
|
}
|
|
193
|
-
) : null,
|
|
190
|
+
) : null, (policyParams == null ? void 0 : policyParams.open) ? /* @__PURE__ */ import_react.default.createElement(
|
|
194
191
|
import_PolicyModal.default,
|
|
195
192
|
{
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
193
|
+
key: policyParams == null ? void 0 : policyParams._ts,
|
|
194
|
+
open: policyParams == null ? void 0 : policyParams.open,
|
|
195
|
+
onCancel: () => closePolicy(false),
|
|
196
|
+
onConfirm: () => closePolicy(true),
|
|
197
|
+
item: policyParams == null ? void 0 : policyParams.content,
|
|
198
|
+
onChange: () => setLoading(false),
|
|
199
|
+
isHideCheckout: false
|
|
200
200
|
}
|
|
201
201
|
) : null);
|
|
202
202
|
};
|
|
@@ -41,25 +41,37 @@ var import_utils = require("@pisell/utils");
|
|
|
41
41
|
var import_icons = require("@ant-design/icons");
|
|
42
42
|
var import_context = require("../../context");
|
|
43
43
|
var import_utils2 = require("../../utils");
|
|
44
|
+
var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContext"));
|
|
44
45
|
var import_hooks = require("../../hooks");
|
|
46
|
+
var import_state = require("./state");
|
|
45
47
|
var import_index = require("./index.less");
|
|
46
48
|
import_dayjs.default.extend(import_isSameOrBefore.default);
|
|
47
49
|
var Date = (0, import_react.forwardRef)((props, ref) => {
|
|
50
|
+
var _a, _b, _c;
|
|
48
51
|
const [loading, setLoading] = (0, import_react.useState)(false);
|
|
49
52
|
const [currentDate, setCurrentDate] = (0, import_react.useState)();
|
|
50
53
|
const [dateMonthList, setDateMonthList] = (0, import_react.useState)([]);
|
|
51
54
|
const [currentMonth, setCurrentMonth] = (0, import_react.useState)();
|
|
52
55
|
const { appointmentBooking } = (0, import_context.useAppointmentBookingContext)();
|
|
53
56
|
const { isDateSelectedFirst, customPageId, getLoadAllSchedule, channel } = (0, import_hooks.useAppointmentBookingSetting)();
|
|
57
|
+
const { nextStep } = (0, import_hooks.useAppointmentBookingStep)();
|
|
58
|
+
const context = (0, import_useEngineContext.default)();
|
|
54
59
|
(0, import_react.useImperativeHandle)(ref, () => ({
|
|
55
|
-
next:
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
60
|
+
next: handleNext
|
|
61
|
+
}));
|
|
62
|
+
const handleNext = async () => {
|
|
63
|
+
const data = await appointmentBooking.getDateRange();
|
|
64
|
+
if (!(data == null ? void 0 : data.length)) {
|
|
65
|
+
return (0, import_utils2.Toast)(import_utils.locales.getText("pisell2.appointment.unselect.date"));
|
|
66
|
+
}
|
|
67
|
+
if (!isDateSelectedFirst) {
|
|
68
|
+
const result = appointmentBooking.checkResourceListForDate();
|
|
69
|
+
if (!result) {
|
|
70
|
+
return (0, import_utils2.Toast)(import_utils.locales.getText("pisell2.appointment.unuse.date"));
|
|
59
71
|
}
|
|
60
|
-
appointmentBooking.next();
|
|
61
72
|
}
|
|
62
|
-
|
|
73
|
+
nextStep();
|
|
74
|
+
};
|
|
63
75
|
const weekListText = [
|
|
64
76
|
import_utils.locales.getText("pisell2.appointment.sunday"),
|
|
65
77
|
import_utils.locales.getText("pisell2.appointment.monday"),
|
|
@@ -76,12 +88,17 @@ var Date = (0, import_react.forwardRef)((props, ref) => {
|
|
|
76
88
|
);
|
|
77
89
|
(0, import_react.useEffect)(() => {
|
|
78
90
|
const getCurrentMonthData = async () => {
|
|
79
|
-
var
|
|
91
|
+
var _a2;
|
|
80
92
|
const data = await appointmentBooking.getDateRange();
|
|
81
|
-
setCurrentMonth((0, import_dayjs.default)((
|
|
93
|
+
setCurrentMonth((0, import_dayjs.default)((_a2 = data == null ? void 0 : data[0]) == null ? void 0 : _a2.date) || (0, import_dayjs.default)());
|
|
82
94
|
};
|
|
83
95
|
getCurrentMonthData();
|
|
84
96
|
}, []);
|
|
97
|
+
const locale = (0, import_react.useMemo)(() => {
|
|
98
|
+
var _a2, _b2;
|
|
99
|
+
const currentLocale = (_b2 = (_a2 = context == null ? void 0 : context.engine) == null ? void 0 : _a2.props) == null ? void 0 : _b2.locale;
|
|
100
|
+
return import_state.localeTypes[currentLocale] || "en";
|
|
101
|
+
}, [(_b = (_a = context == null ? void 0 : context.engine) == null ? void 0 : _a.props) == null ? void 0 : _b.locale]);
|
|
85
102
|
const getMonthData = (date) => {
|
|
86
103
|
const firstDay = (0, import_dayjs.default)(`${date}-01`);
|
|
87
104
|
const startDay = firstDay.day();
|
|
@@ -119,7 +136,7 @@ var Date = (0, import_react.forwardRef)((props, ref) => {
|
|
|
119
136
|
return await appointmentBooking.getAvailableDate(params);
|
|
120
137
|
};
|
|
121
138
|
const getDates = async (date) => {
|
|
122
|
-
var
|
|
139
|
+
var _a2;
|
|
123
140
|
try {
|
|
124
141
|
const startDate = (0, import_dayjs.default)(date).startOf("month").format("YYYY-MM-DD");
|
|
125
142
|
const endDate = (0, import_dayjs.default)(date).endOf("month").format("YYYY-MM-DD");
|
|
@@ -131,7 +148,7 @@ var Date = (0, import_react.forwardRef)((props, ref) => {
|
|
|
131
148
|
const selected = await appointmentBooking.getDateRange();
|
|
132
149
|
console.log(data, selected, customPageId, "getDates");
|
|
133
150
|
if ((selected == null ? void 0 : selected.length) > 0) {
|
|
134
|
-
setCurrentDate((
|
|
151
|
+
setCurrentDate((_a2 = selected == null ? void 0 : selected[0]) == null ? void 0 : _a2.date);
|
|
135
152
|
} else if (!isDateSelectedFirst) {
|
|
136
153
|
if (date.format("YYYY-MM") === (0, import_dayjs.default)().format("YYYY-MM")) {
|
|
137
154
|
const firstAvailableDate = (data || []).find(
|
|
@@ -183,7 +200,7 @@ var Date = (0, import_react.forwardRef)((props, ref) => {
|
|
|
183
200
|
setCurrentDate(date);
|
|
184
201
|
appointmentBooking.setDateRange([day]);
|
|
185
202
|
if (isDateSelectedFirst) {
|
|
186
|
-
|
|
203
|
+
handleNext();
|
|
187
204
|
}
|
|
188
205
|
};
|
|
189
206
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
@@ -203,7 +220,7 @@ var Date = (0, import_react.forwardRef)((props, ref) => {
|
|
|
203
220
|
}
|
|
204
221
|
},
|
|
205
222
|
/* @__PURE__ */ import_react.default.createElement(import_icons.CaretLeftOutlined, null)
|
|
206
|
-
), /* @__PURE__ */ import_react.default.createElement("div", { className: "calendar-current-month" }, currentMonth == null ? void 0 :
|
|
223
|
+
), /* @__PURE__ */ import_react.default.createElement("div", { className: "calendar-current-month" }, (_c = (0, import_dayjs.default)(currentMonth).locale(locale)) == null ? void 0 : _c.format("MMMM YYYY")), /* @__PURE__ */ import_react.default.createElement("div", { className: "calendar-next-month", onClick: nextMonth }, /* @__PURE__ */ import_react.default.createElement(import_icons.CaretRightOutlined, null))), /* @__PURE__ */ import_react.default.createElement("div", { className: "calendar-content" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "calendar-weeks" }, columns.map((col) => /* @__PURE__ */ import_react.default.createElement("div", { key: col, className: "calendar-weeks-items" }, weekListText[Number(col)]))), /* @__PURE__ */ import_react.default.createElement("div", { className: "calendar-days" }, dateMonthList.map((day, index) => {
|
|
207
224
|
const date = (0, import_dayjs.default)(day.date).format("YYYY-MM-DD");
|
|
208
225
|
const isCurrentMonth = (0, import_dayjs.default)(day.date).isSame(
|
|
209
226
|
currentMonth,
|
|
@@ -33,6 +33,7 @@ __export(state_exports, {
|
|
|
33
33
|
getCallToBookStatus: () => getCallToBookStatus,
|
|
34
34
|
getNextSevenDaysList: () => getNextSevenDaysList,
|
|
35
35
|
getStatus: () => getStatus,
|
|
36
|
+
localeTypes: () => localeTypes,
|
|
36
37
|
statusColor: () => statusColor,
|
|
37
38
|
weekListText: () => weekListText
|
|
38
39
|
});
|
|
@@ -184,12 +185,18 @@ var getCallToBookStatus = (currentDate, dateLimitData, cutTime) => {
|
|
|
184
185
|
}
|
|
185
186
|
return isShowCallToBook;
|
|
186
187
|
};
|
|
188
|
+
var localeTypes = {
|
|
189
|
+
"en-US": "en",
|
|
190
|
+
"zh-CN": "zh-cn",
|
|
191
|
+
"zh-TW": "zh-tw"
|
|
192
|
+
};
|
|
187
193
|
// Annotate the CommonJS export names for ESM import in node:
|
|
188
194
|
0 && (module.exports = {
|
|
189
195
|
ShowDayOnly,
|
|
190
196
|
getCallToBookStatus,
|
|
191
197
|
getNextSevenDaysList,
|
|
192
198
|
getStatus,
|
|
199
|
+
localeTypes,
|
|
193
200
|
statusColor,
|
|
194
201
|
weekListText
|
|
195
202
|
});
|
|
@@ -50,6 +50,7 @@ var Form = (0, import_react.forwardRef)((props, ref) => {
|
|
|
50
50
|
const { carts, appointmentBooking, setLoading } = (0, import_context.useAppointmentBookingContext)();
|
|
51
51
|
const { getResourceList } = (0, import_hooks.useAppointmentBookingResource)();
|
|
52
52
|
const { setOtherData, getOtherData } = (0, import_hooks.useAppointmentBookingSetting)();
|
|
53
|
+
const { nextStep } = (0, import_hooks.useAppointmentBookingStep)();
|
|
53
54
|
(0, import_react.useImperativeHandle)(ref, () => ({
|
|
54
55
|
next: () => {
|
|
55
56
|
var _a, _b;
|
|
@@ -90,7 +91,7 @@ var Form = (0, import_react.forwardRef)((props, ref) => {
|
|
|
90
91
|
setLoading(false);
|
|
91
92
|
}
|
|
92
93
|
} else {
|
|
93
|
-
|
|
94
|
+
nextStep();
|
|
94
95
|
}
|
|
95
96
|
};
|
|
96
97
|
const updateFormStatus = (status) => {
|
|
@@ -166,9 +167,11 @@ var Form = (0, import_react.forwardRef)((props, ref) => {
|
|
|
166
167
|
import_PolicyModal.default,
|
|
167
168
|
{
|
|
168
169
|
open: showAgreement,
|
|
169
|
-
onCancel:
|
|
170
|
+
onCancel: () => setShowAgreement(false),
|
|
171
|
+
onConfirm: () => handleAgreementOk(),
|
|
170
172
|
item: agreementContent,
|
|
171
|
-
onChange: () => setLoading(false)
|
|
173
|
+
onChange: () => setLoading(false),
|
|
174
|
+
isHideCheckout: false
|
|
172
175
|
}
|
|
173
176
|
) : null);
|
|
174
177
|
});
|
|
@@ -46,9 +46,10 @@ var Guest = (0, import_react.forwardRef)((props, ref) => {
|
|
|
46
46
|
const [holderItem, setHolderItem] = (0, import_react.useState)(null);
|
|
47
47
|
const { carts, appointmentBooking } = (0, import_context.useAppointmentBookingContext)();
|
|
48
48
|
const { accountLists } = (0, import_hooks.useAppointmentBookingAccount)();
|
|
49
|
+
const { nextStep } = (0, import_hooks.useAppointmentBookingStep)();
|
|
49
50
|
(0, import_react.useImperativeHandle)(ref, () => ({
|
|
50
51
|
next: () => {
|
|
51
|
-
|
|
52
|
+
nextStep();
|
|
52
53
|
}
|
|
53
54
|
}));
|
|
54
55
|
const lists = (0, import_react.useMemo)(() => {
|
|
@@ -53,7 +53,8 @@ var Resource = (0, import_react.forwardRef)((props, ref) => {
|
|
|
53
53
|
setCarts,
|
|
54
54
|
currentStep,
|
|
55
55
|
setResourceOtherParams,
|
|
56
|
-
setIsErrorHolder
|
|
56
|
+
setIsErrorHolder,
|
|
57
|
+
setPolicyIds
|
|
57
58
|
} = (0, import_context.useAppointmentBookingContext)();
|
|
58
59
|
const {
|
|
59
60
|
getResourceList,
|
|
@@ -61,7 +62,7 @@ var Resource = (0, import_react.forwardRef)((props, ref) => {
|
|
|
61
62
|
getResourceTimeSlot
|
|
62
63
|
} = (0, import_hooks.useAppointmentBookingResource)();
|
|
63
64
|
const { checkSkipResourceStep } = (0, import_hooks.useIsSkipResourceStep)();
|
|
64
|
-
const { updateStep } = (0, import_hooks.useAppointmentBookingStep)();
|
|
65
|
+
const { updateStep, nextStep } = (0, import_hooks.useAppointmentBookingStep)();
|
|
65
66
|
const { openLoginModal, isLogin } = (0, import_hooks.useAppointmentBookingLogin)();
|
|
66
67
|
const { getHolders, checkAccount } = (0, import_hooks.useAppointmentBookingAccount)();
|
|
67
68
|
const { isFormSubject } = (0, import_hooks.useAppointmentBookingSetting)();
|
|
@@ -78,10 +79,11 @@ var Resource = (0, import_react.forwardRef)((props, ref) => {
|
|
|
78
79
|
(0, import_utils3.scrollToFirstErrorCard)();
|
|
79
80
|
return;
|
|
80
81
|
}
|
|
81
|
-
const resultCarts = (0, import_utils.formatCartsResources)(carts, resources);
|
|
82
|
+
const resultCarts = (0, import_utils.formatCartsResources)(carts, resources, setPolicyIds);
|
|
82
83
|
const stepList = ((_c = (_b = (_a = appointmentBooking == null ? void 0 : appointmentBooking.store) == null ? void 0 : _a.step) == null ? void 0 : _b.store) == null ? void 0 : _c.stepList) || [];
|
|
83
84
|
const accountLists = await appointmentBooking.getAccounts();
|
|
84
85
|
const checkResult = (0, import_utils.checkHasFormStep)({
|
|
86
|
+
nextStep,
|
|
85
87
|
hasResourceFormId: (resultCarts == null ? void 0 : resultCarts.length) > 0,
|
|
86
88
|
currentStep,
|
|
87
89
|
stepList,
|
|
@@ -104,7 +106,7 @@ var Resource = (0, import_react.forwardRef)((props, ref) => {
|
|
|
104
106
|
errorList: null
|
|
105
107
|
});
|
|
106
108
|
getResourceTimeSlot();
|
|
107
|
-
|
|
109
|
+
nextStep();
|
|
108
110
|
}
|
|
109
111
|
}));
|
|
110
112
|
const resources = (0, import_react.useMemo)(() => {
|
|
@@ -47,13 +47,13 @@ var Services = (0, import_react.forwardRef)((props, ref) => {
|
|
|
47
47
|
const appointmentBooking = (0, import_hooks.useAppointmentBooking)();
|
|
48
48
|
const { isDateSelectedFirst } = (0, import_hooks.useAppointmentBookingSetting)();
|
|
49
49
|
const { getProducts, checkProductType } = (0, import_hooks.useAppointmentBookingProduct)();
|
|
50
|
-
const { removeStep } = (0, import_hooks.useAppointmentBookingStep)();
|
|
50
|
+
const { removeStep, nextStep } = (0, import_hooks.useAppointmentBookingStep)();
|
|
51
51
|
const { currentStep } = (0, import_context.useAppointmentBookingContext)();
|
|
52
52
|
const [products, setProducts] = (0, import_react.useState)(null);
|
|
53
53
|
const [loading, setLoading] = (0, import_react.useState)(false);
|
|
54
54
|
(0, import_react.useImperativeHandle)(ref, () => ({
|
|
55
55
|
next: () => {
|
|
56
|
-
|
|
56
|
+
nextStep();
|
|
57
57
|
}
|
|
58
58
|
}));
|
|
59
59
|
(0, import_react.useEffect)(() => {
|
|
@@ -49,6 +49,7 @@ var TimeSlicing = (0, import_react.forwardRef)((props, ref) => {
|
|
|
49
49
|
carts
|
|
50
50
|
} = (0, import_context.useAppointmentBookingContext)();
|
|
51
51
|
const { getResourceTimeSlot, getResourceList } = (0, import_hooks.useAppointmentBookingResource)();
|
|
52
|
+
const { nextStep } = (0, import_hooks.useAppointmentBookingStep)();
|
|
52
53
|
(0, import_react.useImperativeHandle)(ref, () => ({
|
|
53
54
|
next: () => {
|
|
54
55
|
const isUnSelectedTimes = appointmentBooking.checkCartItems("date");
|
|
@@ -56,7 +57,7 @@ var TimeSlicing = (0, import_react.forwardRef)((props, ref) => {
|
|
|
56
57
|
(0, import_utils2.Toast)(import_utils.locales.getText("pisell2.appointment.unselect.time"));
|
|
57
58
|
return;
|
|
58
59
|
}
|
|
59
|
-
|
|
60
|
+
nextStep();
|
|
60
61
|
}
|
|
61
62
|
}));
|
|
62
63
|
(0, import_react.useEffect)(() => {
|
|
@@ -42,6 +42,7 @@ var AppointmentBookingProvider = ({
|
|
|
42
42
|
children
|
|
43
43
|
}) => {
|
|
44
44
|
var _a, _b, _c, _d, _e;
|
|
45
|
+
const policyIdsRef = (0, import_react.useRef)([]);
|
|
45
46
|
const appointmentBooking = (0, import_hooks.useAppointmentBooking)();
|
|
46
47
|
const [summary, setSummary] = (0, import_react.useState)({});
|
|
47
48
|
const [times, setTimes] = (0, import_react.useState)([]);
|
|
@@ -62,6 +63,18 @@ var AppointmentBookingProvider = ({
|
|
|
62
63
|
const currentStep2 = appointmentBooking == null ? void 0 : appointmentBooking.getCurrentStep();
|
|
63
64
|
setCurrentStep(currentStep2);
|
|
64
65
|
}, []);
|
|
66
|
+
const setPolicyIds = (ids) => {
|
|
67
|
+
policyIdsRef.current = ids;
|
|
68
|
+
};
|
|
69
|
+
const openPolicy = (content, callback) => {
|
|
70
|
+
setPolicyParams({ open: true, content, callback, _ts: Date.now() });
|
|
71
|
+
};
|
|
72
|
+
const closePolicy = (isCallback) => {
|
|
73
|
+
setPolicyParams({ open: false, content: {}, callback: null });
|
|
74
|
+
if ((policyParams == null ? void 0 : policyParams.callback) && isCallback) {
|
|
75
|
+
policyParams.callback();
|
|
76
|
+
}
|
|
77
|
+
};
|
|
65
78
|
const isLastStep = (0, import_react.useMemo)(() => {
|
|
66
79
|
var _a2;
|
|
67
80
|
const key = (_a2 = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _a2.key;
|
|
@@ -99,18 +112,26 @@ var AppointmentBookingProvider = ({
|
|
|
99
112
|
isLastStep,
|
|
100
113
|
tasksManager,
|
|
101
114
|
policyParams,
|
|
102
|
-
setPolicyParams
|
|
115
|
+
setPolicyParams,
|
|
116
|
+
policyIdsRef,
|
|
117
|
+
setPolicyIds,
|
|
118
|
+
openPolicy,
|
|
119
|
+
closePolicy
|
|
103
120
|
};
|
|
104
121
|
return /* @__PURE__ */ import_react.default.createElement(AppointmentBookingContext.Provider, { value }, children);
|
|
105
122
|
};
|
|
106
123
|
var useAppointmentBookingContext = () => {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
124
|
+
try {
|
|
125
|
+
const context = (0, import_react.useContext)(AppointmentBookingContext);
|
|
126
|
+
if (context === void 0) {
|
|
127
|
+
throw new Error(
|
|
128
|
+
"useAppointmentBookingContext must be used within a AppointmentBookingProvider"
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
return context;
|
|
132
|
+
} catch (error) {
|
|
133
|
+
console.log(error, "useAppointmentBookingContext");
|
|
112
134
|
}
|
|
113
|
-
return context;
|
|
114
135
|
};
|
|
115
136
|
// Annotate the CommonJS export names for ESM import in node:
|
|
116
137
|
0 && (module.exports = {
|