@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,7 +2,9 @@ const require_runtime = 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");
5
6
  const require_index = require("../../../../plus/productSelect/index.js");
7
+ const require_locales = require("../../locales.js");
6
8
  const require_utils = require("../../utils.js");
7
9
  const require_hooks = require("../../hooks.js");
8
10
  const require_context = require("../../context.js");
@@ -10,36 +12,50 @@ let dayjs = require("dayjs");
10
12
  dayjs = require_runtime.__toESM(dayjs);
11
13
  let react = require("react");
12
14
  react = require_runtime.__toESM(react);
15
+ let antd = require("antd");
13
16
  let _pisell_utils = require("@pisell/utils");
14
17
  require("./index.less");
15
18
  //#region src/components/appointmentBooking/components/Services/index.tsx
16
19
  const Services = (0, react.forwardRef)((props, ref) => {
20
+ var _context$engine;
17
21
  const context = require_useEngineContext.default();
22
+ 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");
18
23
  const { utils } = context.appHelper || {};
19
24
  const appointmentBooking = require_hooks.useAppointmentBooking();
20
25
  const { isDateSelectedFirst, isRetailTemplate } = require_hooks.useAppointmentBookingSetting();
21
26
  const { getProducts, checkProductType } = require_hooks.useAppointmentBookingProduct();
22
27
  const { removeStep, nextStep } = require_hooks.useAppointmentBookingStep();
23
- const { currentStep, setLoading, carts } = require_context.useAppointmentBookingContext();
28
+ const { setLoading, carts, setAvailabilityError, bookingPreparationRef, runBookingPreparation, stepTransitionRef } = require_context.useAppointmentBookingContext();
24
29
  const [products, setProducts] = (0, react.useState)(null);
25
30
  const [productLoading, setProductLoading] = (0, react.useState)(false);
26
- (0, react.useImperativeHandle)(ref, () => ({ next: () => {
27
- setLoading(true);
28
- setTimeout(() => {
29
- nextStep();
30
- setLoading(false);
31
- }, 500);
32
- } }));
31
+ const [productError, setProductError] = (0, react.useState)(false);
32
+ const retryProductRef = (0, react.useRef)(null);
33
+ const openingRequestRef = (0, react.useRef)(0);
34
+ const mountedRef = (0, react.useRef)(true);
33
35
  (0, react.useEffect)(() => {
36
+ mountedRef.current = true;
37
+ return () => {
38
+ mountedRef.current = false;
39
+ openingRequestRef.current += 1;
40
+ };
41
+ }, [appointmentBooking]);
42
+ (0, react.useImperativeHandle)(ref, () => ({ next: nextStep }));
43
+ (0, react.useEffect)(() => {
44
+ let active = true;
34
45
  setProductLoading(true);
35
46
  getProducts().then((res) => {
47
+ if (!active) return;
36
48
  setProducts(res || []);
37
49
  setProductLoading(false);
38
50
  }).catch(() => {
51
+ if (!active) return;
39
52
  setProducts([]);
40
53
  setProductLoading(false);
41
54
  });
42
- }, [isDateSelectedFirst]);
55
+ return () => {
56
+ active = false;
57
+ };
58
+ }, [isDateSelectedFirst, appointmentBooking]);
43
59
  /**
44
60
  * @description: 是否显示商品详情页面的步进器
45
61
  * @param {*} useMemo
@@ -50,15 +66,36 @@ const Services = (0, react.forwardRef)((props, ref) => {
50
66
  return productModuleParams === null || productModuleParams === void 0 ? void 0 : productModuleParams.isShowProductDetailStepper;
51
67
  }, [appointmentBooking === null || appointmentBooking === void 0 ? void 0 : appointmentBooking.otherParams]);
52
68
  const handleSelectProduct = function() {
53
- var _ref2 = require_asyncToGenerator._asyncToGenerator(function* (item, clickType) {
69
+ var _ref3 = require_asyncToGenerator._asyncToGenerator(function* (item, clickType) {
70
+ const requestId = ++openingRequestRef.current;
71
+ setProductError(false);
72
+ setProductLoading(true);
54
73
  let type = "";
55
- if (!isRetailTemplate) {
56
- type = yield checkProductType(item === null || item === void 0 ? void 0 : item.id);
57
- appointmentBooking.openProductDetail(item.id);
74
+ try {
75
+ yield runBookingPreparation();
76
+ if (!mountedRef.current || requestId !== openingRequestRef.current) return;
77
+ if (!isRetailTemplate) {
78
+ yield appointmentBooking.openProductDetail(item.id);
79
+ type = yield checkProductType(item.id);
80
+ }
81
+ if (!mountedRef.current || requestId !== openingRequestRef.current) return;
82
+ } catch (error) {
83
+ if (mountedRef.current && requestId === openingRequestRef.current && (error === null || error === void 0 ? void 0 : error.name) !== "AbortError") {
84
+ appointmentBooking.closeProductDetail();
85
+ retryProductRef.current = () => {
86
+ handleSelectProduct(item, clickType);
87
+ };
88
+ setProductError(true);
89
+ }
90
+ return;
91
+ } finally {
92
+ if (mountedRef.current && requestId === openingRequestRef.current) setProductLoading(false);
58
93
  }
94
+ let added = false;
59
95
  utils === null || utils === void 0 || utils.action({
60
96
  type: "pisell1.productDetail",
61
97
  data: {
98
+ bookingRead: !isRetailTemplate,
62
99
  detail: require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, item), {}, { open_deposit: 1 }),
63
100
  setting: {
64
101
  can_input: true,
@@ -67,75 +104,96 @@ const Services = (0, react.forwardRef)((props, ref) => {
67
104
  }
68
105
  },
69
106
  callback: function() {
70
- var _ref = require_asyncToGenerator._asyncToGenerator(function* (data) {
107
+ var _ref2 = require_asyncToGenerator._asyncToGenerator(function* (data) {
108
+ if (added || !mountedRef.current || requestId !== openingRequestRef.current) return;
71
109
  if (data.isCancel) {
110
+ openingRequestRef.current += 1;
72
111
  appointmentBooking.closeProductDetail();
73
112
  return;
74
113
  }
75
114
  const product = require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, data), {}, { options: (data === null || data === void 0 ? void 0 : data.option) || [] });
76
115
  delete product.option;
77
- if (isRetailTemplate) {
78
- if (data === null || data === void 0 ? void 0 : data.isCancel) return;
79
- const res = appointmentBooking.storeProduct(product);
80
- if (!res.success && res.errorCode === "not_enough_stock") return require_utils.Toast(_pisell_utils.locales.getText("pisell2.appointment.unuse.stock"));
81
- return;
82
- }
83
116
  const session = data === null || data === void 0 ? void 0 : data.session;
84
- if (session) {
85
- const startDate = (0, dayjs.default)(session === null || session === void 0 ? void 0 : session.start_at).format("YYYY-MM-DD");
86
- const endDate = (0, dayjs.default)(session === null || session === void 0 ? void 0 : session.end_at).format("YYYY-MM-DD");
87
- const res = appointmentBooking.addProductToCart({
117
+ let result;
118
+ if (isRetailTemplate) result = appointmentBooking.storeProduct(product);
119
+ else if (session) {
120
+ const startDate = (0, dayjs.default)(session.start_at).format("YYYY-MM-DD");
121
+ const endDate = (0, dayjs.default)(session.end_at).format("YYYY-MM-DD");
122
+ result = appointmentBooking.addProductToCart({
88
123
  product: require_objectSpread2._objectSpread2({}, product),
89
124
  date: {
90
- startTime: `${startDate} ${session === null || session === void 0 ? void 0 : session.start_time}`,
91
- endTime: `${endDate} ${session === null || session === void 0 ? void 0 : session.end_time}`
125
+ startTime: `${startDate} ${session.start_time}`,
126
+ endTime: `${endDate} ${session.end_time}`
92
127
  }
93
128
  });
94
- if (!res.success && res.errorCode === "not_enough_stock") return require_utils.Toast(_pisell_utils.locales.getText("pisell2.appointment.unuse.stock"));
95
- appointmentBooking.closeProductDetail();
96
- yield appointmentBooking.getAvailableDate({
97
- startDate,
98
- endDate
99
- });
100
129
  } else {
101
130
  var _data$origin;
102
- if (!((data === null || data === void 0 || (_data$origin = data.origin) === null || _data$origin === void 0 || (_data$origin = _data$origin.product_resource) === null || _data$origin === void 0 ? void 0 : _data$origin.resources) || []).find((item) => item.status === 1) && !appointmentBooking.isTargetNormalProduct(data === null || data === void 0 ? void 0 : data.origin)) return require_utils.Toast(_pisell_utils.locales.getText("pisell2.appointment.no.available.service"));
103
- const res = appointmentBooking.storeProduct(product);
104
- if (!res.success && res.errorCode === "not_enough_stock") return require_utils.Toast(_pisell_utils.locales.getText("pisell2.appointment.unuse.stock"));
105
- if (type === "duration") yield appointmentBooking.getAvailableDate();
131
+ if (!((data === null || data === void 0 || (_data$origin = data.origin) === null || _data$origin === void 0 || (_data$origin = _data$origin.product_resource) === null || _data$origin === void 0 ? void 0 : _data$origin.resources) || []).some((resource) => resource.status === 1) && !appointmentBooking.isTargetNormalProduct(data === null || data === void 0 ? void 0 : data.origin)) return require_utils.Toast(_pisell_utils.locales.getText("pisell2.appointment.no.available.service"));
132
+ result = appointmentBooking.storeProduct(product);
106
133
  }
134
+ if (!(result === null || result === void 0 ? void 0 : result.success)) return require_utils.Toast(_pisell_utils.locales.getText((result === null || result === void 0 ? void 0 : result.errorCode) === "not_enough_stock" ? "pisell2.appointment.unuse.stock" : "pisell2.appointment.no.available.service"));
135
+ added = true;
107
136
  appointmentBooking.closeProductDetail();
108
- if (isDateSelectedFirst) {
109
- const index = (currentStep === null || currentStep === void 0 ? void 0 : currentStep.index) + 2;
110
- if (type === "duration" || appointmentBooking.isCartHasDurationProduct()) {
111
- const stepList = appointmentBooking.getStepList();
112
- if (stepList === null || stepList === void 0 ? void 0 : stepList.find((item) => (item === null || item === void 0 ? void 0 : item.key) === "select-resource")) {
113
- const description = _pisell_utils.locales.getText("pisell2.appointment.select.time");
114
- appointmentBooking.addStep({
115
- index,
116
- key: "select-time",
117
- description
118
- }, "select-resource");
119
- }
120
- } else removeStep("select-time");
121
- } else if (type === "session") {
122
- removeStep("select-date");
123
- removeStep("select-time");
137
+ if (isRetailTemplate) return;
138
+ const cartIdentity = () => JSON.stringify(appointmentBooking.getCart().map((cart) => cart._id).sort());
139
+ const addedCartIdentity = cartIdentity();
140
+ const job = {
141
+ module: appointmentBooking,
142
+ pending: null,
143
+ run: function() {
144
+ var _ref = require_asyncToGenerator._asyncToGenerator(function* () {
145
+ if (cartIdentity() !== addedCartIdentity) return;
146
+ yield appointmentBooking.prepareResourcesForCurrentSelection();
147
+ if (cartIdentity() !== addedCartIdentity) return;
148
+ if (bookingPreparationRef.current !== job) {
149
+ const error = /* @__PURE__ */ new Error("Booking preparation superseded");
150
+ error.name = "AbortError";
151
+ throw error;
152
+ }
153
+ if (isDateSelectedFirst) if (type === "duration" || appointmentBooking.isCartHasDurationProduct()) {
154
+ if (appointmentBooking.getStepList().some((step) => step.key === "select-resource")) {
155
+ var _appointmentBooking$g;
156
+ appointmentBooking.addStep({
157
+ index: ((_appointmentBooking$g = appointmentBooking.getCurrentStep()) === null || _appointmentBooking$g === void 0 ? void 0 : _appointmentBooking$g.index) + 2,
158
+ key: "select-time",
159
+ description: _pisell_utils.locales.getText("pisell2.appointment.select.time")
160
+ }, "select-resource");
161
+ }
162
+ } else removeStep("select-time");
163
+ else if (type === "session") {
164
+ removeStep("select-date");
165
+ removeStep("select-time");
166
+ }
167
+ });
168
+ return function run() {
169
+ return _ref.apply(this, arguments);
170
+ };
171
+ }()
172
+ };
173
+ bookingPreparationRef.current = job;
174
+ setAvailabilityError(false);
175
+ setLoading(true);
176
+ try {
177
+ yield runBookingPreparation();
178
+ } catch (error) {
179
+ if (mountedRef.current && (error === null || error === void 0 ? void 0 : error.name) !== "AbortError") setAvailabilityError(true);
180
+ } finally {
181
+ if (mountedRef.current && !stepTransitionRef.current.pending) setLoading(false);
124
182
  }
125
183
  });
126
184
  return function callback(_x) {
127
- return _ref.apply(this, arguments);
185
+ return _ref2.apply(this, arguments);
128
186
  };
129
187
  }()
130
188
  });
131
189
  });
132
190
  return function handleSelectProduct(_x2, _x3) {
133
- return _ref2.apply(this, arguments);
191
+ return _ref3.apply(this, arguments);
134
192
  };
135
193
  }();
136
194
  const productListSetting = (0, react.useMemo)(() => {
137
- var _context$engine;
138
- const { customPageData } = ((_context$engine = context.engine) === null || _context$engine === void 0 ? void 0 : _context$engine.props) || {};
195
+ var _context$engine2;
196
+ const { customPageData } = ((_context$engine2 = context.engine) === null || _context$engine2 === void 0 ? void 0 : _context$engine2.props) || {};
139
197
  let productListBlock;
140
198
  if (Array.isArray(customPageData === null || customPageData === void 0 ? void 0 : customPageData.block)) productListBlock = customPageData.block.find((b) => "product_list" === b.type);
141
199
  return (productListBlock === null || productListBlock === void 0 ? void 0 : productListBlock.setting) || {};
@@ -144,7 +202,14 @@ const Services = (0, react.forwardRef)((props, ref) => {
144
202
  if (typeof _pisell_utils.isMobile === "function") return (0, _pisell_utils.isMobile)();
145
203
  return _pisell_utils.isMobile;
146
204
  }, [_pisell_utils.isMobile]);
147
- return /* @__PURE__ */ react.default.createElement("div", { className: "appointment-service-wrap" }, /* @__PURE__ */ react.default.createElement(require_index.default, {
205
+ return /* @__PURE__ */ react.default.createElement("div", { className: "appointment-service-wrap" }, productError && /* @__PURE__ */ react.default.createElement(antd.Alert, {
206
+ type: "error",
207
+ message: _pisell_utils.locales.getText("pisell2.appointment.availability.load.failed"),
208
+ action: /* @__PURE__ */ react.default.createElement(antd.Button, { onClick: () => {
209
+ var _retryProductRef$curr;
210
+ return (_retryProductRef$curr = retryProductRef.current) === null || _retryProductRef$curr === void 0 ? void 0 : _retryProductRef$curr.call(retryProductRef);
211
+ } }, _pisell_utils.locales.getText("pisell2.appointment.retry"))
212
+ }), /* @__PURE__ */ react.default.createElement(require_index.default, {
148
213
  dataSource: products,
149
214
  onChange: handleSelectProduct,
150
215
  scrollDom: _isMobile ? ".parallel-content-wrap" : ".parallel-booking-wrap",
@@ -8,7 +8,7 @@ react = require_runtime.__toESM(react);
8
8
  //#region src/components/appointmentBooking/context.tsx
9
9
  const AppointmentBookingContext = (0, react.createContext)(void 0);
10
10
  const AppointmentBookingProvider = ({ children }) => {
11
- var _appHelper$utils, _currentStep$step, _appointmentBooking$s2, _currentStep$step3, _appointmentBooking$s3, _currentStep$step5;
11
+ var _appHelper$utils, _currentStep$step2, _currentStep$step3, _appointmentBooking$s2, _currentStep$step5, _appointmentBooking$s3, _currentStep$step7;
12
12
  const policyIdsRef = (0, react.useRef)([]);
13
13
  const lastLoggedStepRef = (0, react.useRef)();
14
14
  const appointmentBooking = require_hooks.useAppointmentBooking();
@@ -22,6 +22,27 @@ const AppointmentBookingProvider = ({ children }) => {
22
22
  const [isAgreeDepositPolicy, setIsAgreeDepositPolicy] = (0, react.useState)(false);
23
23
  const [currentResource, setCurrentResource] = (0, react.useState)(null);
24
24
  const [loading, setLoading] = (0, react.useState)(false);
25
+ const [availabilityError, setAvailabilityError] = (0, react.useState)(false);
26
+ const bookingPreparationRef = (0, react.useRef)(null);
27
+ const stepTransitionRef = (0, react.useRef)({
28
+ generation: 0,
29
+ pending: null,
30
+ module: appointmentBooking
31
+ });
32
+ const runBookingPreparation = (0, react.useCallback)(() => {
33
+ const job = bookingPreparationRef.current;
34
+ if (!job) return Promise.resolve();
35
+ if (job.pending) return job.pending;
36
+ const pending = Promise.resolve().then(job.run);
37
+ job.pending = pending;
38
+ pending.then(() => {
39
+ if (bookingPreparationRef.current === job) bookingPreparationRef.current = null;
40
+ job.pending = null;
41
+ }, () => {
42
+ job.pending = null;
43
+ });
44
+ return pending;
45
+ }, []);
25
46
  const [isErrorHolder, setIsErrorHolder] = (0, react.useState)(false);
26
47
  const [tasksManager] = (0, react.useState)(() => new require_index.TasksManager());
27
48
  const [policyParams, setPolicyParams] = (0, react.useState)(null);
@@ -30,7 +51,43 @@ const AppointmentBookingProvider = ({ children }) => {
30
51
  const symbolic = appHelper === null || appHelper === void 0 || (_appHelper$utils = appHelper.utils) === null || _appHelper$utils === void 0 ? void 0 : _appHelper$utils.getSymbolic();
31
52
  (0, react.useEffect)(() => {
32
53
  setCurrentStep(appointmentBooking === null || appointmentBooking === void 0 ? void 0 : appointmentBooking.getCurrentStep());
33
- }, []);
54
+ }, [appointmentBooking]);
55
+ (0, react.useEffect)(() => {
56
+ var _currentStep$step;
57
+ const transition = stepTransitionRef.current;
58
+ const key = currentStep === null || currentStep === void 0 || (_currentStep$step = currentStep.step) === null || _currentStep$step === void 0 ? void 0 : _currentStep$step.key;
59
+ if (transition.sourceKey !== key) {
60
+ var _bookingPreparationRe;
61
+ const hadPendingTransition = !!transition.pending;
62
+ transition.generation += 1;
63
+ transition.pending = null;
64
+ transition.sourceKey = key;
65
+ if (hadPendingTransition && !((_bookingPreparationRe = bookingPreparationRef.current) === null || _bookingPreparationRe === void 0 ? void 0 : _bookingPreparationRe.pending)) setLoading(false);
66
+ }
67
+ setAvailabilityError(false);
68
+ }, [currentStep === null || currentStep === void 0 || (_currentStep$step2 = currentStep.step) === null || _currentStep$step2 === void 0 ? void 0 : _currentStep$step2.key]);
69
+ (0, react.useEffect)(() => {
70
+ var _bookingPreparationRe2;
71
+ const transition = stepTransitionRef.current;
72
+ if (((_bookingPreparationRe2 = bookingPreparationRef.current) === null || _bookingPreparationRe2 === void 0 ? void 0 : _bookingPreparationRe2.module) !== appointmentBooking) bookingPreparationRef.current = null;
73
+ if (transition.module !== appointmentBooking) {
74
+ var _bookingPreparationRe3;
75
+ transition.generation += 1;
76
+ transition.pending = null;
77
+ transition.sourceKey = void 0;
78
+ transition.module = appointmentBooking;
79
+ setAvailabilityError(false);
80
+ if (!((_bookingPreparationRe3 = bookingPreparationRef.current) === null || _bookingPreparationRe3 === void 0 ? void 0 : _bookingPreparationRe3.pending)) setLoading(false);
81
+ }
82
+ return () => {
83
+ var _bookingPreparationRe4;
84
+ if (transition.module === appointmentBooking) {
85
+ transition.generation += 1;
86
+ transition.pending = null;
87
+ }
88
+ if (((_bookingPreparationRe4 = bookingPreparationRef.current) === null || _bookingPreparationRe4 === void 0 ? void 0 : _bookingPreparationRe4.module) === appointmentBooking) bookingPreparationRef.current = null;
89
+ };
90
+ }, [appointmentBooking]);
34
91
  (0, react.useEffect)(() => {
35
92
  var _currentStep$index;
36
93
  const step = currentStep === null || currentStep === void 0 ? void 0 : currentStep.step;
@@ -45,7 +102,7 @@ const AppointmentBookingProvider = ({ children }) => {
45
102
  });
46
103
  }, [
47
104
  currentStep === null || currentStep === void 0 ? void 0 : currentStep.index,
48
- currentStep === null || currentStep === void 0 || (_currentStep$step = currentStep.step) === null || _currentStep$step === void 0 ? void 0 : _currentStep$step.key,
105
+ currentStep === null || currentStep === void 0 || (_currentStep$step3 = currentStep.step) === null || _currentStep$step3 === void 0 ? void 0 : _currentStep$step3.key,
49
106
  carts
50
107
  ]);
51
108
  /**
@@ -104,18 +161,18 @@ const AppointmentBookingProvider = ({ children }) => {
104
161
  * @Date: 2025-05-10 15:18
105
162
  */
106
163
  const isLastStep = (0, react.useMemo)(() => {
107
- var _currentStep$step2;
108
- return (currentStep === null || currentStep === void 0 || (_currentStep$step2 = currentStep.step) === null || _currentStep$step2 === void 0 ? void 0 : _currentStep$step2.key) === "confirm-information";
109
- }, [currentStep === null || currentStep === void 0 || (_currentStep$step3 = currentStep.step) === null || _currentStep$step3 === void 0 ? void 0 : _currentStep$step3.key, 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]);
110
- const currentStepParams = (0, react.useMemo)(() => {
111
164
  var _currentStep$step4;
112
- const key = currentStep === null || currentStep === void 0 || (_currentStep$step4 = currentStep.step) === null || _currentStep$step4 === void 0 ? void 0 : _currentStep$step4.key;
165
+ return (currentStep === null || currentStep === void 0 || (_currentStep$step4 = currentStep.step) === null || _currentStep$step4 === void 0 ? void 0 : _currentStep$step4.key) === "confirm-information";
166
+ }, [currentStep === null || currentStep === void 0 || (_currentStep$step5 = currentStep.step) === null || _currentStep$step5 === void 0 ? void 0 : _currentStep$step5.key, 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]);
167
+ const currentStepParams = (0, react.useMemo)(() => {
168
+ var _currentStep$step6;
169
+ const key = currentStep === null || currentStep === void 0 || (_currentStep$step6 = currentStep.step) === null || _currentStep$step6 === void 0 ? void 0 : _currentStep$step6.key;
113
170
  return {
114
171
  key,
115
172
  index: stepLists.findIndex((item) => item.key === key),
116
173
  stepLists
117
174
  };
118
- }, [currentStep === null || currentStep === void 0 || (_currentStep$step5 = currentStep.step) === null || _currentStep$step5 === void 0 ? void 0 : _currentStep$step5.key, stepLists]);
175
+ }, [currentStep === null || currentStep === void 0 || (_currentStep$step7 = currentStep.step) === null || _currentStep$step7 === void 0 ? void 0 : _currentStep$step7.key, stepLists]);
119
176
  (0, react.useEffect)(() => {
120
177
  var _currentStepParams$ke, _currentStepParams$ke2;
121
178
  if ((currentStepParams === null || currentStepParams === void 0 || (_currentStepParams$ke = currentStepParams.key) === null || _currentStepParams$ke === void 0 ? void 0 : _currentStepParams$ke.startsWith("select-resource")) || (currentStepParams === null || currentStepParams === void 0 || (_currentStepParams$ke2 = currentStepParams.key) === null || _currentStepParams$ke2 === void 0 ? void 0 : _currentStepParams$ke2.startsWith("fill-form"))) {
@@ -163,6 +220,11 @@ const AppointmentBookingProvider = ({ children }) => {
163
220
  setCurrentResource,
164
221
  loading,
165
222
  setLoading,
223
+ availabilityError,
224
+ setAvailabilityError,
225
+ bookingPreparationRef,
226
+ runBookingPreparation,
227
+ stepTransitionRef,
166
228
  isErrorHolder,
167
229
  setIsErrorHolder,
168
230
  isLastStep,