@pisell/private-materials 6.12.405 → 6.12.406

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.
Files changed (61) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/meta.js +1 -1
  5. package/build/lowcode/render/default/view.css +1 -1
  6. package/build/lowcode/render/default/view.js +2 -2
  7. package/build/lowcode/view.css +1 -1
  8. package/build/lowcode/view.js +2 -2
  9. package/es/components/appointmentBooking/components/Cart/ContinueButton/index.js +13 -6
  10. package/es/components/appointmentBooking/components/Cart/ContinueButton/index.less +6 -0
  11. package/es/components/appointmentBooking/components/Date/index.js +103 -35
  12. package/es/components/appointmentBooking/components/Services/index.js +123 -58
  13. package/es/components/appointmentBooking/context.js +72 -10
  14. package/es/components/appointmentBooking/hooks.js +227 -172
  15. package/es/components/appointmentBooking/index.js +3 -2
  16. package/es/components/appointmentBooking/locales.js +10 -0
  17. package/es/components/bigSale/components/BookingFloatingPanel/useBookingPanelController.js +0 -1
  18. package/es/components/bigSale/components/ProductList/index.js +0 -1
  19. package/es/components/bigSale/components/TimeBar/index.js +0 -1
  20. package/es/components/bigSale/dialog.js +0 -1
  21. package/es/components/bigSale/hooks/useBigSaleContext.js +0 -1
  22. package/es/components/bigSale/hooks/useBigSaleProductListConfig.js +1 -0
  23. package/es/components/bigSale/hooks/useSelectFloorMapResourceForBigSale.js +0 -1
  24. package/es/components/bigSale/index.js +0 -1
  25. package/es/components/bigSale/templates/Kiosk/index.js +0 -1
  26. package/es/components/sharedSecondaryBigSale/SharedSecondaryBigSaleReceiver.js +0 -1
  27. package/es/components/ticketBooking/components/ProductDisplayAdapter/index.js +3 -0
  28. package/es/components/ticketBooking/components/addServiceVariant/addService.js +1 -0
  29. package/es/components/venueBookingSales/catalogPresentation.js +1 -0
  30. package/es/components/venueBookingSales/checkout/useVenueBookingCheckout.js +0 -1
  31. package/es/index.js +0 -2
  32. package/es/plus/multiCurrencySettlement/index.js +1 -1
  33. package/es/plus/pisellReservation/data/bookingToReservationTables.js +1 -1
  34. package/es/plus/pisellReservation/floorMap/floorPlanApi.js +1 -1
  35. package/es/plus/pisellReservation/floorMap/reservationMock.js +1 -1
  36. package/es/plus/saleDetail/Base.js +0 -1
  37. package/es/plus/saleDetail/components/Client/hooks/useClientSelectorProps.js +0 -1
  38. package/es/plus/saleDetail/components/DetailActions/PrintAction.js +0 -1
  39. package/es/plus/saleDetail/components/DetailActions/index.js +0 -1
  40. package/es/plus/saleDetail/components/SummaryFinancialSections/index.js +0 -1
  41. package/es/plus/saleDetail/index.js +0 -1
  42. package/es/plus/saleDetail/tmpl/B/components/Dish/index.js +0 -1
  43. package/es/plus/saleDetail/tmpl/B/index.js +0 -1
  44. package/es/plus/salesSdk/utils/addProductWithFlowDebounced.js +1 -1
  45. package/es/plus/salesSdk/utils/bookingDate.js +1 -1
  46. package/es/plus/salesSdk/utils/enrichCartLineHolderDisplay.js +1 -1
  47. package/es/private-materials/lowcode/authmodal/meta.d.ts +1 -0
  48. package/es/pro/Login2.0/AuthModal.d.ts +1 -1
  49. package/es/pro/Login2.0/index.d.ts +2 -2
  50. package/es/pro/Login2.0/shared/types.d.ts +1 -1
  51. package/lib/components/appointmentBooking/components/Cart/ContinueButton/index.js +13 -6
  52. package/lib/components/appointmentBooking/components/Cart/ContinueButton/index.less +6 -0
  53. package/lib/components/appointmentBooking/components/Date/index.js +102 -34
  54. package/lib/components/appointmentBooking/components/Services/index.js +122 -57
  55. package/lib/components/appointmentBooking/context.js +71 -9
  56. package/lib/components/appointmentBooking/hooks.js +227 -172
  57. package/lib/components/appointmentBooking/index.js +2 -1
  58. package/lib/components/appointmentBooking/locales.js +10 -0
  59. package/package.json +4 -4
  60. package/es/plus/pisellReservation/index.js +0 -17
  61. package/es/plus/salesSdk/index.js +0 -54
@@ -2,6 +2,8 @@ require("../../_virtual/_rolldown/runtime.js");
2
2
  const require_useEngineContext = require("../../hooks/useEngineContext.js");
3
3
  const require_objectSpread2 = require("../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
4
4
  const require_asyncToGenerator = require("../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
5
+ const require_useInitLocalesOnce = require("../../hooks/useInitLocalesOnce.js");
6
+ const require_locales = require("./locales.js");
5
7
  const require_utils = require("./utils.js");
6
8
  const require_utils$1 = require("./components/Resource/utils.js");
7
9
  const require_context = require("./context.js");
@@ -27,9 +29,11 @@ const contextUtils = () => {
27
29
  * @Date: 2025-04-15 11:11
28
30
  */
29
31
  const useAppointmentBookingStep = () => {
30
- var _appointmentBooking$s;
32
+ var _engineContext$engine, _appointmentBooking$s;
33
+ const engineContext = require_useEngineContext.default();
34
+ require_useInitLocalesOnce.default(require_locales.default, (engineContext === null || engineContext === void 0 || (_engineContext$engine = engineContext.engine) === null || _engineContext$engine === void 0 || (_engineContext$engine = _engineContext$engine.props) === null || _engineContext$engine === void 0 ? void 0 : _engineContext$engine.locale) || "en");
31
35
  const pisellOS = require_useEngineContext.usePisellOS();
32
- const { appointmentBooking, setCurrentStep, carts, openPolicy, setLoading, setCurrentSelectedResources, currentStepParams, setIsErrorHolder } = require_context.useAppointmentBookingContext();
36
+ const { appointmentBooking, setCurrentStep, carts, openPolicy, setLoading, setCurrentSelectedResources, currentStepParams, setIsErrorHolder, runBookingPreparation, bookingPreparationRef, stepTransitionRef, setAvailabilityError } = require_context.useAppointmentBookingContext();
33
37
  const { isRetailTemplate } = useAppointmentBookingSetting();
34
38
  const 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) || [];
35
39
  const { isLogin, openLoginModal } = useAppointmentBookingLogin();
@@ -80,165 +84,216 @@ const useAppointmentBookingStep = () => {
80
84
  isSkip: (step === null || step === void 0 ? void 0 : step.isSkip) || false
81
85
  });
82
86
  };
83
- const nextStep = () => {
84
- var _nextStep$key;
85
- let stepList = appointmentBooking.getStepList() || [];
86
- const currentKey = currentStepParams === null || currentStepParams === void 0 ? void 0 : currentStepParams.key;
87
- const currentSelectedResources = appointmentBooking.getOtherData("current_selected_resources");
88
- if (!isRetailTemplate && currentKey === "select-service") {
89
- var _appointmentBooking$o, _stepList$find;
90
- const { bookingProcess } = (appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$o = appointmentBooking.otherParams) === null || _appointmentBooking$o === void 0 ? void 0 : _appointmentBooking$o.productModuleParams) || {};
91
- const isDateSelectedFirst = bookingProcess === "date_first";
92
- const hasResourceStep = stepList === null || stepList === void 0 ? void 0 : stepList.find((item) => (item === null || item === void 0 ? void 0 : item.key) === "select-resource");
93
- const hasSelectGuestStep = stepList === null || stepList === void 0 || (_stepList$find = stepList.find((item) => (item === null || item === void 0 ? void 0 : item.key) === "select-guest")) === null || _stepList$find === void 0 ? void 0 : _stepList$find.key;
94
- if (appointmentBooking === null || appointmentBooking === void 0 ? void 0 : appointmentBooking.isCartAllNormalProducts()) {
95
- removeStep("select-resource");
96
- removeStep("select-time");
97
- removeStep("fill-form");
98
- if (!isDateSelectedFirst) removeStep("select-date");
99
- } else if (!hasResourceStep) {
100
- let targetKey = hasSelectGuestStep ? hasSelectGuestStep : "select-service";
101
- if (appointmentBooking === null || appointmentBooking === void 0 ? void 0 : appointmentBooking.isCartHasDurationProduct()) {
102
- if (!isDateSelectedFirst) {
87
+ const advanceStep = function() {
88
+ var _ref4 = require_asyncToGenerator._asyncToGenerator(function* (isCurrent) {
89
+ var _appointmentBooking$g, _nextStep$key;
90
+ const goNext = () => {
91
+ if (isCurrent()) appointmentBooking.next();
92
+ };
93
+ let stepList = appointmentBooking.getStepList() || [];
94
+ const currentKey = (_appointmentBooking$g = appointmentBooking.getCurrentStep()) === null || _appointmentBooking$g === void 0 || (_appointmentBooking$g = _appointmentBooking$g.step) === null || _appointmentBooking$g === void 0 ? void 0 : _appointmentBooking$g.key;
95
+ const currentSelectedResources = appointmentBooking.getOtherData("current_selected_resources");
96
+ if (!isRetailTemplate && currentKey === "select-service") {
97
+ var _appointmentBooking$o, _stepList$find;
98
+ const { bookingProcess } = (appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$o = appointmentBooking.otherParams) === null || _appointmentBooking$o === void 0 ? void 0 : _appointmentBooking$o.productModuleParams) || {};
99
+ const isDateSelectedFirst = bookingProcess === "date_first";
100
+ const hasResourceStep = stepList === null || stepList === void 0 ? void 0 : stepList.find((item) => (item === null || item === void 0 ? void 0 : item.key) === "select-resource");
101
+ const hasSelectGuestStep = stepList === null || stepList === void 0 || (_stepList$find = stepList.find((item) => (item === null || item === void 0 ? void 0 : item.key) === "select-guest")) === null || _stepList$find === void 0 ? void 0 : _stepList$find.key;
102
+ if (appointmentBooking === null || appointmentBooking === void 0 ? void 0 : appointmentBooking.isCartAllNormalProducts()) {
103
+ removeStep("select-resource");
104
+ removeStep("select-time");
105
+ removeStep("fill-form");
106
+ if (!isDateSelectedFirst) removeStep("select-date");
107
+ } else if (!hasResourceStep) {
108
+ let targetKey = hasSelectGuestStep ? hasSelectGuestStep : "select-service";
109
+ if (appointmentBooking === null || appointmentBooking === void 0 ? void 0 : appointmentBooking.isCartHasDurationProduct()) {
110
+ if (!isDateSelectedFirst) {
111
+ appointmentBooking.addStep({
112
+ key: "select-date",
113
+ description: _pisell_utils.locales.getText("pisell2.appointment.select.date")
114
+ }, targetKey);
115
+ targetKey = "select-date";
116
+ }
103
117
  appointmentBooking.addStep({
104
- key: "select-date",
105
- description: _pisell_utils.locales.getText("pisell2.appointment.select.date")
118
+ key: "select-resource",
119
+ description: _pisell_utils.locales.getText("pisell2.appointment.select.resource")
106
120
  }, targetKey);
107
- targetKey = "select-date";
108
- }
109
- appointmentBooking.addStep({
121
+ targetKey = "select-resource";
122
+ appointmentBooking.addStep({
123
+ key: "select-time",
124
+ description: _pisell_utils.locales.getText("pisell2.appointment.select.time")
125
+ }, targetKey);
126
+ } else appointmentBooking.addStep({
110
127
  key: "select-resource",
111
128
  description: _pisell_utils.locales.getText("pisell2.appointment.select.resource")
112
129
  }, targetKey);
113
- targetKey = "select-resource";
114
- appointmentBooking.addStep({
115
- key: "select-time",
116
- description: _pisell_utils.locales.getText("pisell2.appointment.select.time")
117
- }, targetKey);
118
- } else appointmentBooking.addStep({
119
- key: "select-resource",
120
- description: _pisell_utils.locales.getText("pisell2.appointment.select.resource")
121
- }, targetKey);
122
- }
123
- stepList = (appointmentBooking === null || appointmentBooking === void 0 ? void 0 : appointmentBooking.getStepList()) || [];
124
- }
125
- let nextStep = stepList[(currentStepParams === null || currentStepParams === void 0 ? void 0 : currentStepParams.index) + 1];
126
- if (!isRetailTemplate && (nextStep === null || nextStep === void 0 ? void 0 : nextStep.key) === "select-resource") {
127
- if (!appointmentBooking.checkResourceListForDate()) return require_utils.Toast(_pisell_utils.locales.getText("pisell2.appointment.unuse.date"));
128
- const capacityResult = appointmentBooking.checkMaxDurationCapacity();
129
- if (!capacityResult.success) {
130
- const getMessage = _pisell_utils.locales.getText("pisell2.appointment.unuse.capacity");
131
- return require_utils.Toast(typeof getMessage === "function" ? getMessage(capacityResult.minAvailableCount) : getMessage);
130
+ }
131
+ stepList = (appointmentBooking === null || appointmentBooking === void 0 ? void 0 : appointmentBooking.getStepList()) || [];
132
132
  }
133
- }
134
- if (!isRetailTemplate && (currentKey === null || currentKey === void 0 ? void 0 : currentKey.startsWith("select-resource"))) {
135
- var _currentSelectedResou;
136
- const { hasError, updatedCartList } = require_utils.checkAndMarkCartRenderError(currentSelectedResources, appointmentBooking, utils);
137
- if (hasError) {
138
- setCurrentSelectedResources(updatedCartList);
139
- require_utils$1.scrollToFirstErrorCard();
140
- return;
133
+ const stepIndex = stepList.findIndex((step) => step.key === currentKey);
134
+ let nextStep = stepList[stepIndex + 1];
135
+ if (!isRetailTemplate && (nextStep === null || nextStep === void 0 ? void 0 : nextStep.key) === "select-resource") {
136
+ yield appointmentBooking.prepareResourcesForCurrentSelection();
137
+ if (!isCurrent()) return;
138
+ if (!appointmentBooking.checkResourceListForDate()) return require_utils.Toast(_pisell_utils.locales.getText("pisell2.appointment.unuse.date"));
139
+ const capacityResult = appointmentBooking.checkMaxDurationCapacity();
140
+ if (!capacityResult.success) {
141
+ const getMessage = _pisell_utils.locales.getText("pisell2.appointment.unuse.capacity");
142
+ return require_utils.Toast(typeof getMessage === "function" ? getMessage(capacityResult.minAvailableCount) : getMessage);
143
+ }
141
144
  }
142
- let preKey = "";
143
- currentSelectedResources === null || currentSelectedResources === void 0 || currentSelectedResources.forEach((cart) => {
144
- var _selectedResource$ren, _selectedResource$ren2;
145
- const selectedResource = cart === null || cart === void 0 ? void 0 : cart.currentSelectedResource;
146
- const resourceItem = (selectedResource === null || selectedResource === void 0 ? void 0 : selectedResource.resourceItem) || {};
147
- const formId = selectedResource === null || selectedResource === void 0 || (_selectedResource$ren = selectedResource.renderItem) === null || _selectedResource$ren === void 0 ? void 0 : _selectedResource$ren.resource_form_id;
148
- const policyId = selectedResource === null || selectedResource === void 0 || (_selectedResource$ren2 = selectedResource.renderItem) === null || _selectedResource$ren2 === void 0 ? void 0 : _selectedResource$ren2.policy_id;
149
- const formKey = `fill-form_@${resourceItem === null || resourceItem === void 0 ? void 0 : resourceItem.form_id}-${resourceItem === null || resourceItem === void 0 ? void 0 : resourceItem.code}-${cart === null || cart === void 0 ? void 0 : cart._id}-${formId}-${policyId}`;
150
- if (formId) {
151
- const description = _pisell_utils.locales.getText("pisell2.appointment.fill-form");
152
- const beforeKey = require_utils.getFormInsertBeforeKey(currentKey, stepList);
153
- appointmentBooking.addStep({
154
- key: formKey,
155
- description
156
- }, preKey || beforeKey);
157
- preKey = formKey;
158
- } else appointmentBooking.removeStep(formKey);
159
- });
160
- stepList = appointmentBooking.getStepList();
161
- const selectedResource = currentSelectedResources === null || currentSelectedResources === void 0 || (_currentSelectedResou = currentSelectedResources[0]) === null || _currentSelectedResou === void 0 ? void 0 : _currentSelectedResou.currentSelectedResource;
162
- if (selectedResource) {
163
- var _selectedResource$res;
164
- const originRenderLists = (selectedResource === null || selectedResource === void 0 || (_selectedResource$res = selectedResource.resourceItem) === null || _selectedResource$res === void 0 ? void 0 : _selectedResource$res.originRenderLists) || [];
165
- const currentResourceIndex = originRenderLists === null || originRenderLists === void 0 ? void 0 : originRenderLists.findIndex((item) => {
166
- var _selectedResource$ren3;
167
- return item.id === (selectedResource === null || selectedResource === void 0 || (_selectedResource$ren3 = selectedResource.renderItem) === null || _selectedResource$ren3 === void 0 ? void 0 : _selectedResource$ren3.form_id);
145
+ if (!isRetailTemplate && (currentKey === null || currentKey === void 0 ? void 0 : currentKey.startsWith("select-resource"))) {
146
+ var _currentSelectedResou;
147
+ const { hasError, updatedCartList } = require_utils.checkAndMarkCartRenderError(currentSelectedResources, appointmentBooking, utils);
148
+ if (hasError) {
149
+ setCurrentSelectedResources(updatedCartList);
150
+ require_utils$1.scrollToFirstErrorCard();
151
+ return;
152
+ }
153
+ let preKey = "";
154
+ currentSelectedResources === null || currentSelectedResources === void 0 || currentSelectedResources.forEach((cart) => {
155
+ var _selectedResource$ren, _selectedResource$ren2;
156
+ const selectedResource = cart === null || cart === void 0 ? void 0 : cart.currentSelectedResource;
157
+ const resourceItem = (selectedResource === null || selectedResource === void 0 ? void 0 : selectedResource.resourceItem) || {};
158
+ const formId = selectedResource === null || selectedResource === void 0 || (_selectedResource$ren = selectedResource.renderItem) === null || _selectedResource$ren === void 0 ? void 0 : _selectedResource$ren.resource_form_id;
159
+ const policyId = selectedResource === null || selectedResource === void 0 || (_selectedResource$ren2 = selectedResource.renderItem) === null || _selectedResource$ren2 === void 0 ? void 0 : _selectedResource$ren2.policy_id;
160
+ const formKey = `fill-form_@${resourceItem === null || resourceItem === void 0 ? void 0 : resourceItem.form_id}-${resourceItem === null || resourceItem === void 0 ? void 0 : resourceItem.code}-${cart === null || cart === void 0 ? void 0 : cart._id}-${formId}-${policyId}`;
161
+ if (formId) {
162
+ const description = _pisell_utils.locales.getText("pisell2.appointment.fill-form");
163
+ const beforeKey = require_utils.getFormInsertBeforeKey(currentKey, stepList);
164
+ appointmentBooking.addStep({
165
+ key: formKey,
166
+ description
167
+ }, preKey || beforeKey);
168
+ preKey = formKey;
169
+ } else appointmentBooking.removeStep(formKey);
168
170
  });
169
- const nextResource = originRenderLists === null || originRenderLists === void 0 ? void 0 : originRenderLists[currentResourceIndex + 1];
170
- const resourceKey = `select-resource_@${nextResource === null || nextResource === void 0 ? void 0 : nextResource.form_id}-${nextResource === null || nextResource === void 0 ? void 0 : nextResource.code}`;
171
- if (nextResource) {
172
- var _stepList;
173
- const beforeKey = (_stepList = stepList[stepList.length - 2]) === null || _stepList === void 0 ? void 0 : _stepList.key;
174
- appointmentBooking.addStep({
175
- key: resourceKey,
176
- description: ""
177
- }, beforeKey);
178
- } else appointmentBooking.removeStep(resourceKey);
171
+ stepList = appointmentBooking.getStepList();
172
+ const selectedResource = currentSelectedResources === null || currentSelectedResources === void 0 || (_currentSelectedResou = currentSelectedResources[0]) === null || _currentSelectedResou === void 0 ? void 0 : _currentSelectedResou.currentSelectedResource;
173
+ if (selectedResource) {
174
+ var _selectedResource$res;
175
+ const originRenderLists = (selectedResource === null || selectedResource === void 0 || (_selectedResource$res = selectedResource.resourceItem) === null || _selectedResource$res === void 0 ? void 0 : _selectedResource$res.originRenderLists) || [];
176
+ const currentResourceIndex = originRenderLists === null || originRenderLists === void 0 ? void 0 : originRenderLists.findIndex((item) => {
177
+ var _selectedResource$ren3;
178
+ return item.id === (selectedResource === null || selectedResource === void 0 || (_selectedResource$ren3 = selectedResource.renderItem) === null || _selectedResource$ren3 === void 0 ? void 0 : _selectedResource$ren3.form_id);
179
+ });
180
+ const nextResource = originRenderLists === null || originRenderLists === void 0 ? void 0 : originRenderLists[currentResourceIndex + 1];
181
+ const resourceKey = `select-resource_@${nextResource === null || nextResource === void 0 ? void 0 : nextResource.form_id}-${nextResource === null || nextResource === void 0 ? void 0 : nextResource.code}`;
182
+ if (nextResource) {
183
+ var _stepList;
184
+ const beforeKey = (_stepList = stepList[stepList.length - 2]) === null || _stepList === void 0 ? void 0 : _stepList.key;
185
+ appointmentBooking.addStep({
186
+ key: resourceKey,
187
+ description: ""
188
+ }, beforeKey);
189
+ } else appointmentBooking.removeStep(resourceKey);
190
+ }
179
191
  }
180
- }
181
- stepList = appointmentBooking.getStepList();
182
- nextStep = stepList[(currentStepParams === null || currentStepParams === void 0 ? void 0 : currentStepParams.index) + 1];
183
- if ((nextStep === null || nextStep === void 0 || (_nextStep$key = nextStep.key) === null || _nextStep$key === void 0 ? void 0 : _nextStep$key.startsWith("select-resource_")) || (nextStep === null || nextStep === void 0 ? void 0 : nextStep.key) === "confirm-information") {
184
- var _currentSelectedResou2;
185
- const selectedResource = (currentSelectedResources === null || currentSelectedResources === void 0 || (_currentSelectedResou2 = currentSelectedResources[0]) === null || _currentSelectedResou2 === void 0 ? void 0 : _currentSelectedResou2.currentSelectedResource) || {};
186
- const renderItem = (selectedResource === null || selectedResource === void 0 ? void 0 : selectedResource.renderItem) || {};
187
- const checkHolder = function() {
188
- var _ref2 = require_asyncToGenerator._asyncToGenerator(function* (isLoginTrigger = false) {
189
- setLoading(false);
190
- if (isRetailTemplate || (appointmentBooking === null || appointmentBooking === void 0 ? void 0 : appointmentBooking.isCartAllNormalProducts())) return appointmentBooking.next();
191
- let cartLists = carts || [];
192
- if (!(carts === null || carts === void 0 ? void 0 : carts.length)) cartLists = (yield appointmentBooking.getCart()) || [];
193
- else cartLists = carts || [];
194
- const { hasError, isEnableSkuHolderRule } = require_utils.checkAndGoNext(isFormSubject, checkAccount, cartLists.filter((n) => !(appointmentBooking === null || appointmentBooking === void 0 ? void 0 : appointmentBooking.isTargetCartIdNormalProduct(n._id))));
195
- setIsErrorHolder(hasError);
196
- if (hasError) {
197
- require_utils$1.scrollToFirstErrorCard(".pisell-lowcode-product-card-select-holder-error");
198
- return;
199
- }
200
- if (isLoginTrigger && isEnableSkuHolderRule) return;
201
- if (!!(renderItem === null || renderItem === void 0 ? void 0 : renderItem.policy_id)) openPolicy({ id: renderItem === null || renderItem === void 0 ? void 0 : renderItem.policy_id }, () => {
202
- return appointmentBooking.next();
192
+ stepList = appointmentBooking.getStepList();
193
+ nextStep = stepList[stepList.findIndex((step) => step.key === currentKey) + 1];
194
+ if ((nextStep === null || nextStep === void 0 || (_nextStep$key = nextStep.key) === null || _nextStep$key === void 0 ? void 0 : _nextStep$key.startsWith("select-resource_")) || (nextStep === null || nextStep === void 0 ? void 0 : nextStep.key) === "confirm-information") {
195
+ var _currentSelectedResou2;
196
+ const selectedResource = (currentSelectedResources === null || currentSelectedResources === void 0 || (_currentSelectedResou2 = currentSelectedResources[0]) === null || _currentSelectedResou2 === void 0 ? void 0 : _currentSelectedResou2.currentSelectedResource) || {};
197
+ const renderItem = (selectedResource === null || selectedResource === void 0 ? void 0 : selectedResource.renderItem) || {};
198
+ const checkHolder = function() {
199
+ var _ref2 = require_asyncToGenerator._asyncToGenerator(function* (isLoginTrigger = false) {
200
+ if (!isCurrent()) return;
201
+ setLoading(false);
202
+ if (isRetailTemplate || (appointmentBooking === null || appointmentBooking === void 0 ? void 0 : appointmentBooking.isCartAllNormalProducts())) return goNext();
203
+ let cartLists = carts || [];
204
+ if (!(carts === null || carts === void 0 ? void 0 : carts.length)) {
205
+ const newCarts = yield appointmentBooking.getCart();
206
+ if (!isCurrent()) return;
207
+ cartLists = newCarts || [];
208
+ } else cartLists = carts || [];
209
+ const { hasError, isEnableSkuHolderRule } = require_utils.checkAndGoNext(isFormSubject, checkAccount, cartLists.filter((n) => !(appointmentBooking === null || appointmentBooking === void 0 ? void 0 : appointmentBooking.isTargetCartIdNormalProduct(n._id))));
210
+ setIsErrorHolder(hasError);
211
+ if (hasError) {
212
+ require_utils$1.scrollToFirstErrorCard(".pisell-lowcode-product-card-select-holder-error");
213
+ return;
214
+ }
215
+ if (isLoginTrigger && isEnableSkuHolderRule) return;
216
+ if (!!(renderItem === null || renderItem === void 0 ? void 0 : renderItem.policy_id)) openPolicy({ id: renderItem === null || renderItem === void 0 ? void 0 : renderItem.policy_id }, () => {
217
+ return goNext();
218
+ });
219
+ else return goNext();
203
220
  });
204
- else return appointmentBooking.next();
205
- });
206
- return function checkHolder() {
207
- return _ref2.apply(this, arguments);
208
- };
209
- }();
210
- const checkLogin = function() {
211
- var _ref3 = require_asyncToGenerator._asyncToGenerator(function* () {
212
- if (!isLogin()) {
213
- const { pubsub } = utils;
214
- pubsub.once("pisell1.login.success", (res) => {
215
- if (res === "success") {
216
- if (isFormSubject && !isRetailTemplate && !(appointmentBooking === null || appointmentBooking === void 0 ? void 0 : appointmentBooking.isCartAllNormalProducts())) {
217
- var _appointmentBooking$r;
218
- const customer = require_utils.getCustomer(utils);
219
- appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$r = appointmentBooking.refreshAllHolderFormRecords) === null || _appointmentBooking$r === void 0 || _appointmentBooking$r.call(appointmentBooking, { customer_id: customer === null || customer === void 0 ? void 0 : customer.id });
221
+ return function checkHolder() {
222
+ return _ref2.apply(this, arguments);
223
+ };
224
+ }();
225
+ const checkLogin = function() {
226
+ var _ref3 = require_asyncToGenerator._asyncToGenerator(function* () {
227
+ if (!isLogin()) {
228
+ const { pubsub } = utils;
229
+ pubsub.once("pisell1.login.success", (res) => {
230
+ if (!isCurrent()) return;
231
+ if (res === "success") {
232
+ if (isFormSubject && !isRetailTemplate && !(appointmentBooking === null || appointmentBooking === void 0 ? void 0 : appointmentBooking.isCartAllNormalProducts())) {
233
+ var _appointmentBooking$r;
234
+ const customer = require_utils.getCustomer(utils);
235
+ appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$r = appointmentBooking.refreshAllHolderFormRecords) === null || _appointmentBooking$r === void 0 || _appointmentBooking$r.call(appointmentBooking, { customer_id: customer === null || customer === void 0 ? void 0 : customer.id });
236
+ }
237
+ checkHolder(true);
220
238
  }
221
- checkHolder(true);
222
- }
223
- if (res === "close") setLoading(false);
224
- });
225
- return openLoginModal({ callback: (status) => {} });
226
- } else return checkHolder();
227
- });
228
- return function checkLogin() {
229
- return _ref3.apply(this, arguments);
230
- };
231
- }();
232
- if ((nextStep === null || nextStep === void 0 ? void 0 : nextStep.key) !== "confirm-information") {
233
- if (!(renderItem === null || renderItem === void 0 ? void 0 : renderItem.policy_id)) return appointmentBooking.next();
234
- return openPolicy({ id: renderItem === null || renderItem === void 0 ? void 0 : renderItem.policy_id }, () => {
235
- const cartItem = carts === null || carts === void 0 ? void 0 : carts[0];
236
- appointmentBooking.updateCart(require_objectSpread2._objectSpread2({ _id: cartItem === null || cartItem === void 0 ? void 0 : cartItem._id }, cartItem));
237
- appointmentBooking.next();
238
- });
239
- } else return checkLogin();
240
- }
241
- appointmentBooking.next();
239
+ if (res === "close") setLoading(false);
240
+ });
241
+ return openLoginModal({ callback: (status) => {} });
242
+ } else return checkHolder();
243
+ });
244
+ return function checkLogin() {
245
+ return _ref3.apply(this, arguments);
246
+ };
247
+ }();
248
+ if ((nextStep === null || nextStep === void 0 ? void 0 : nextStep.key) !== "confirm-information") {
249
+ if (!(renderItem === null || renderItem === void 0 ? void 0 : renderItem.policy_id)) return goNext();
250
+ return openPolicy({ id: renderItem === null || renderItem === void 0 ? void 0 : renderItem.policy_id }, () => {
251
+ if (!isCurrent()) return;
252
+ const cartItem = carts === null || carts === void 0 ? void 0 : carts[0];
253
+ appointmentBooking.updateCart(require_objectSpread2._objectSpread2({ _id: cartItem === null || cartItem === void 0 ? void 0 : cartItem._id }, cartItem));
254
+ goNext();
255
+ });
256
+ } else return checkLogin();
257
+ }
258
+ goNext();
259
+ });
260
+ return function advanceStep(_x2) {
261
+ return _ref4.apply(this, arguments);
262
+ };
263
+ }();
264
+ const nextStep = () => {
265
+ var _appointmentBooking$g2;
266
+ const transition = stepTransitionRef.current;
267
+ const sourceKey = (_appointmentBooking$g2 = appointmentBooking.getCurrentStep()) === null || _appointmentBooking$g2 === void 0 || (_appointmentBooking$g2 = _appointmentBooking$g2.step) === null || _appointmentBooking$g2 === void 0 ? void 0 : _appointmentBooking$g2.key;
268
+ const selectionKey = appointmentBooking.getBookingSelectionKey();
269
+ if (transition.pending && transition.module === appointmentBooking && transition.sourceKey === sourceKey && transition.selectionKey === selectionKey) return transition.pending;
270
+ const generation = ++transition.generation;
271
+ transition.sourceKey = sourceKey;
272
+ transition.selectionKey = selectionKey;
273
+ transition.module = appointmentBooking;
274
+ const isCurrent = () => {
275
+ var _appointmentBooking$g3;
276
+ return transition.generation === generation && transition.module === appointmentBooking && ((_appointmentBooking$g3 = appointmentBooking.getCurrentStep()) === null || _appointmentBooking$g3 === void 0 || (_appointmentBooking$g3 = _appointmentBooking$g3.step) === null || _appointmentBooking$g3 === void 0 ? void 0 : _appointmentBooking$g3.key) === sourceKey && appointmentBooking.getBookingSelectionKey() === selectionKey;
277
+ };
278
+ setAvailabilityError(false);
279
+ setLoading(true);
280
+ const pending = require_asyncToGenerator._asyncToGenerator(function* () {
281
+ try {
282
+ yield runBookingPreparation();
283
+ if (!isCurrent()) return;
284
+ yield advanceStep(isCurrent);
285
+ } catch (error) {
286
+ if (isCurrent() && (error === null || error === void 0 ? void 0 : error.name) !== "AbortError") setAvailabilityError(true);
287
+ } finally {
288
+ if (transition.generation === generation) {
289
+ var _bookingPreparationRe;
290
+ transition.pending = null;
291
+ if (!((_bookingPreparationRe = bookingPreparationRef.current) === null || _bookingPreparationRe === void 0 ? void 0 : _bookingPreparationRe.pending)) setLoading(false);
292
+ }
293
+ }
294
+ })();
295
+ transition.pending = pending;
296
+ return pending;
242
297
  };
243
298
  return {
244
299
  getStepIndex,
@@ -261,7 +316,7 @@ const useAppointmentBookingProduct = () => {
261
316
  const { productModuleParams } = (appointmentBooking === null || appointmentBooking === void 0 ? void 0 : appointmentBooking.otherParams) || {};
262
317
  const { bookingProcess } = productModuleParams || {};
263
318
  const getProducts = function() {
264
- var _ref4 = require_asyncToGenerator._asyncToGenerator(function* () {
319
+ var _ref5 = require_asyncToGenerator._asyncToGenerator(function* () {
265
320
  if (bookingProcess === "date_first") {
266
321
  var _dates$;
267
322
  const dates = yield appointmentBooking.getDateRange();
@@ -273,16 +328,16 @@ const useAppointmentBookingProduct = () => {
273
328
  return yield appointmentBooking.loadProducts(productModuleParams);
274
329
  });
275
330
  return function getProducts() {
276
- return _ref4.apply(this, arguments);
331
+ return _ref5.apply(this, arguments);
277
332
  };
278
333
  }();
279
334
  return {
280
335
  checkProductType: function() {
281
- var _ref5 = require_asyncToGenerator._asyncToGenerator(function* (productId) {
336
+ var _ref6 = require_asyncToGenerator._asyncToGenerator(function* (productId) {
282
337
  return yield appointmentBooking.getProductTypeById(productId);
283
338
  });
284
- return function checkProductType(_x2) {
285
- return _ref5.apply(this, arguments);
339
+ return function checkProductType(_x3) {
340
+ return _ref6.apply(this, arguments);
286
341
  };
287
342
  }(),
288
343
  getProducts
@@ -302,7 +357,7 @@ const useAppointmentBookingCart = () => {
302
357
  const { appointmentBooking, setCarts, setSummary, setIsAgreeDepositPolicy } = require_context.useAppointmentBookingContext();
303
358
  const { bookingSubject } = (appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$o2 = appointmentBooking.otherParams) === null || _appointmentBooking$o2 === void 0 ? void 0 : _appointmentBooking$o2.productModuleParams) || {};
304
359
  const getCartAndSummary = function() {
305
- var _ref6 = require_asyncToGenerator._asyncToGenerator(function* () {
360
+ var _ref7 = require_asyncToGenerator._asyncToGenerator(function* () {
306
361
  var _utils$storage;
307
362
  const locale = (utils === null || utils === void 0 || (_utils$storage = utils.storage) === null || _utils$storage === void 0 ? void 0 : _utils$storage.get("umi_locale")) || "en-US";
308
363
  const symbol = (utils === null || utils === void 0 ? void 0 : utils.getSymbolic()) || "$";
@@ -327,7 +382,7 @@ const useAppointmentBookingCart = () => {
327
382
  if (!carts.length) setIsAgreeDepositPolicy(false);
328
383
  });
329
384
  return function getCartAndSummary() {
330
- return _ref6.apply(this, arguments);
385
+ return _ref7.apply(this, arguments);
331
386
  };
332
387
  }();
333
388
  (0, react.useEffect)(() => {
@@ -381,26 +436,26 @@ const useAppointmentBookingAccount = () => {
381
436
  const { bookingSubject } = (appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$o3 = appointmentBooking.otherParams) === null || _appointmentBooking$o3 === void 0 ? void 0 : _appointmentBooking$o3.productModuleParams) || {};
382
437
  const form_id = bookingSubject === null || bookingSubject === void 0 ? void 0 : bookingSubject.form_id;
383
438
  const getAccountLists = function() {
384
- var _ref7 = require_asyncToGenerator._asyncToGenerator(function* () {
439
+ var _ref8 = require_asyncToGenerator._asyncToGenerator(function* () {
385
440
  setAccountLists((yield appointmentBooking.getAccounts()) || []);
386
441
  });
387
442
  return function getAccountLists() {
388
- return _ref7.apply(this, arguments);
443
+ return _ref8.apply(this, arguments);
389
444
  };
390
445
  }();
391
446
  (0, react.useEffect)(() => {
392
447
  getAccountLists();
393
448
  pisellOS.effects.on("appointmentBooking_accountList:changed", function() {
394
- var _ref8 = require_asyncToGenerator._asyncToGenerator(function* (res) {
449
+ var _ref9 = require_asyncToGenerator._asyncToGenerator(function* (res) {
395
450
  if (res.path === "accounts") getAccountLists();
396
451
  });
397
- return function(_x3) {
398
- return _ref8.apply(this, arguments);
452
+ return function(_x4) {
453
+ return _ref9.apply(this, arguments);
399
454
  };
400
455
  }());
401
456
  }, []);
402
457
  const getHolders = function() {
403
- var _ref9 = require_asyncToGenerator._asyncToGenerator(function* () {
458
+ var _ref10 = require_asyncToGenerator._asyncToGenerator(function* () {
404
459
  var _utils$getStore$getSt, _appointmentBooking$r2;
405
460
  const shop_id = (_utils$getStore$getSt = utils.getStore().getState()) === null || _utils$getStore$getSt === void 0 || (_utils$getStore$getSt = _utils$getStore$getSt.global) === null || _utils$getStore$getSt === void 0 || (_utils$getStore$getSt = _utils$getStore$getSt.shop) === null || _utils$getStore$getSt === void 0 ? void 0 : _utils$getStore$getSt.id;
406
461
  const customer = require_utils.getCustomer(utils);
@@ -426,19 +481,19 @@ const useAppointmentBookingAccount = () => {
426
481
  })) || [];
427
482
  });
428
483
  return function getHolders() {
429
- return _ref9.apply(this, arguments);
484
+ return _ref10.apply(this, arguments);
430
485
  };
431
486
  }();
432
487
  const addAccount = function() {
433
- var _ref10 = require_asyncToGenerator._asyncToGenerator(function* (val, type) {
488
+ var _ref11 = require_asyncToGenerator._asyncToGenerator(function* (val, type) {
434
489
  const customer = require_utils.getCustomer(utils);
435
490
  return yield appointmentBooking.addAccount(val, {
436
491
  type,
437
492
  customerId: customer === null || customer === void 0 ? void 0 : customer.id
438
493
  });
439
494
  });
440
- return function addAccount(_x4, _x5) {
441
- return _ref10.apply(this, arguments);
495
+ return function addAccount(_x5, _x6) {
496
+ return _ref11.apply(this, arguments);
442
497
  };
443
498
  }();
444
499
  const checkAccount = (type) => {
@@ -472,7 +527,7 @@ const useAppointmentBookingResource = () => {
472
527
  };
473
528
  return {
474
529
  getResourceTimeSlot: function() {
475
- var _ref11 = require_asyncToGenerator._asyncToGenerator(function* (index) {
530
+ var _ref12 = require_asyncToGenerator._asyncToGenerator(function* (index) {
476
531
  var _appointmentBooking$o4, _basic$service_time;
477
532
  const { resourceCodes } = getResourceList();
478
533
  let split = 10;
@@ -482,8 +537,8 @@ const useAppointmentBookingResource = () => {
482
537
  const code = resourceCodes === null || resourceCodes === void 0 ? void 0 : resourceCodes[index || 0];
483
538
  setTimes((yield appointmentBooking.getTimeSlotByAllResources(code, split)) || []);
484
539
  });
485
- return function getResourceTimeSlot(_x6) {
486
- return _ref11.apply(this, arguments);
540
+ return function getResourceTimeSlot(_x7) {
541
+ return _ref12.apply(this, arguments);
487
542
  };
488
543
  }(),
489
544
  getResourceList
@@ -503,7 +558,7 @@ const useIsSkipResourceStep = () => {
503
558
  const appointmentBooking = useAppointmentBooking();
504
559
  const { nextStep } = useAppointmentBookingStep();
505
560
  return { checkSkipResourceStep: function() {
506
- var _ref12 = require_asyncToGenerator._asyncToGenerator(function* () {
561
+ var _ref13 = require_asyncToGenerator._asyncToGenerator(function* () {
507
562
  try {
508
563
  const { resources } = getResourceList();
509
564
  const accountLists = yield appointmentBooking.getAccounts();
@@ -528,7 +583,7 @@ const useIsSkipResourceStep = () => {
528
583
  }
529
584
  });
530
585
  return function checkSkipResourceStep() {
531
- return _ref12.apply(this, arguments);
586
+ return _ref13.apply(this, arguments);
532
587
  };
533
588
  }() };
534
589
  };
@@ -1,5 +1,6 @@
1
1
  const require_runtime = require("../../_virtual/_rolldown/runtime.js");
2
2
  const require_useEngineContext = require("../../hooks/useEngineContext.js");
3
+ const require_useInitLocalesOnce = require("../../hooks/useInitLocalesOnce.js");
3
4
  const require_locales = require("./locales.js");
4
5
  const require_utils = require("./utils.js");
5
6
  const require_hooks = require("./hooks.js");
@@ -13,7 +14,7 @@ require("./index.less");
13
14
  const AppointmentBooking = () => {
14
15
  var _context$engine;
15
16
  const context = require_useEngineContext.default();
16
- _pisell_utils.locales.init(require_locales.default, (context === null || context === void 0 || (_context$engine = context.engine) === null || _context$engine === void 0 || (_context$engine = _context$engine.props) === null || _context$engine === void 0 ? void 0 : _context$engine.locale) || "en");
17
+ require_useInitLocalesOnce.default(require_locales.default, (context === null || context === void 0 || (_context$engine = context.engine) === null || _context$engine === void 0 || (_context$engine = _context$engine.props) === null || _context$engine === void 0 ? void 0 : _context$engine.locale) || "en");
17
18
  const utils = require_hooks.contextUtils();
18
19
  const appointmentBooking = require_hooks.useAppointmentBooking();
19
20
  const isMobileLayout = (0, react.useMemo)(() => (0, _pisell_utils.isMobile)() && !(0, _pisell_utils.isIpad)(), []);
@@ -1,6 +1,8 @@
1
1
  //#region src/components/appointmentBooking/locales.ts
2
2
  var locales_default = {
3
3
  en: {
4
+ "pisell2.appointment.availability.load.failed": "Unable to load availability. Please try again.",
5
+ "pisell2.appointment.retry": "Retry",
4
6
  "pisell2.event.calendar.limit.unavailable": "Unavailable",
5
7
  "pisell2.event.calendar.limit.sold.out": "Sold out",
6
8
  "pisell2.event.calendar.limit.call.to.book": "Call to book",
@@ -127,6 +129,8 @@ var locales_default = {
127
129
  "pisell2.text.goodpass.limit.max_per_month": "Used this month"
128
130
  },
129
131
  "zh-CN": {
132
+ "pisell2.appointment.availability.load.failed": "暂时无法获取可预约时间,请重试。",
133
+ "pisell2.appointment.retry": "重试",
130
134
  "pisell2.event.calendar.limit.unavailable": "不可预约",
131
135
  "pisell2.event.calendar.limit.sold.out": "已售罄",
132
136
  "pisell2.event.calendar.limit.call.to.book": "请致电预定",
@@ -253,6 +257,8 @@ var locales_default = {
253
257
  "pisell2.text.goodpass.limit.max_per_month": "本月已用"
254
258
  },
255
259
  "zh-HK": {
260
+ "pisell2.appointment.availability.load.failed": "暫時無法取得可預約時間,請重試。",
261
+ "pisell2.appointment.retry": "重試",
256
262
  "pisell2.event.calendar.limit.unavailable": "不可預約",
257
263
  "pisell2.event.calendar.limit.sold.out": "已售罄",
258
264
  "pisell2.event.calendar.limit.call.to.book": "請致電預訂",
@@ -379,6 +385,8 @@ var locales_default = {
379
385
  "pisell2.text.goodpass.limit.max_per_month": "本月已用"
380
386
  },
381
387
  ja: {
388
+ "pisell2.appointment.availability.load.failed": "予約可能な日時を読み込めませんでした。もう一度お試しください。",
389
+ "pisell2.appointment.retry": "再試行",
382
390
  "pisell2.event.calendar.limit.unavailable": "利用不可",
383
391
  "pisell2.event.calendar.limit.sold.out": "売り切れ",
384
392
  "pisell2.event.calendar.limit.call.to.book": "電話で予約",
@@ -504,6 +512,8 @@ var locales_default = {
504
512
  "pisell2.text.goodpass.limit.max_per_month": "今月利用済み"
505
513
  },
506
514
  pt: {
515
+ "pisell2.appointment.availability.load.failed": "Não foi possível carregar a disponibilidade. Tente novamente.",
516
+ "pisell2.appointment.retry": "Tentar novamente",
507
517
  "pisell2.event.calendar.limit.unavailable": "Indisponível",
508
518
  "pisell2.event.calendar.limit.sold.out": "Esgotado",
509
519
  "pisell2.event.calendar.limit.call.to.book": "Ligar para reservar",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "6.12.405",
3
+ "version": "6.12.406",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -75,10 +75,10 @@
75
75
  "styled-components": "^6.0.0-rc.3",
76
76
  "use-sync-external-store": "^1.6.0",
77
77
  "@pisell/pi-payment-sdk": "0.0.4",
78
- "@pisell/utils": "3.0.7",
79
- "@pisell/materials": "6.12.91",
78
+ "@pisell/date-picker": "3.0.12",
80
79
  "@pisell/icon": "0.0.11",
81
- "@pisell/date-picker": "3.0.12"
80
+ "@pisell/utils": "3.0.7",
81
+ "@pisell/materials": "6.12.91"
82
82
  },
83
83
  "peerDependencies": {
84
84
  "react": "^18.0.0",