@pisell/private-materials 6.12.405 → 6.12.407
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 +2 -2
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +2 -2
- package/es/components/appointmentBooking/components/Cart/ContinueButton/index.js +13 -6
- package/es/components/appointmentBooking/components/Cart/ContinueButton/index.less +6 -0
- package/es/components/appointmentBooking/components/Date/index.js +103 -35
- package/es/components/appointmentBooking/components/Services/index.js +123 -58
- package/es/components/appointmentBooking/context.js +72 -10
- package/es/components/appointmentBooking/hooks.js +227 -172
- package/es/components/appointmentBooking/index.js +3 -2
- package/es/components/appointmentBooking/locales.js +10 -0
- package/es/components/bigSale/components/BookingFloatingPanel/useBookingPanelController.js +0 -1
- package/es/components/bigSale/components/ProductList/index.js +0 -1
- package/es/components/bigSale/components/TimeBar/index.js +0 -1
- package/es/components/bigSale/dialog.js +0 -1
- package/es/components/bigSale/hooks/useBigSaleContext.js +0 -1
- package/es/components/bigSale/hooks/useSelectFloorMapResourceForBigSale.js +0 -1
- package/es/components/bigSale/index.js +0 -1
- package/es/components/bigSale/templates/Kiosk/index.js +0 -1
- package/es/components/sharedSecondaryBigSale/SharedSecondaryBigSaleReceiver.js +0 -1
- package/es/components/vendingMachine/README.md +1 -1
- package/es/components/vendingMachine/customer.less +2 -20
- package/es/components/vendingMachine/dispense.less +1 -3
- package/es/components/vendingMachine/redeem.less +1 -1
- package/es/components/vendingMachine/vendingBottomBar.less +2 -2
- package/es/components/venueBookingSales/checkout/useVenueBookingCheckout.js +0 -1
- package/es/index.js +0 -2
- package/es/plus/multiCurrencySettlement/index.js +1 -1
- package/es/plus/pisellReservation/data/bookingToReservationTables.js +1 -1
- package/es/plus/pisellReservation/floorMap/floorPlanApi.js +1 -1
- package/es/plus/pisellReservation/floorMap/reservationMock.js +1 -1
- package/es/plus/saleDetail/Base.js +0 -1
- package/es/plus/saleDetail/components/Client/hooks/useClientSelectorProps.js +0 -1
- package/es/plus/saleDetail/components/DetailActions/PrintAction.js +0 -1
- package/es/plus/saleDetail/components/DetailActions/index.js +0 -1
- package/es/plus/saleDetail/components/SummaryFinancialSections/index.js +0 -1
- package/es/plus/saleDetail/index.js +0 -1
- package/es/plus/saleDetail/tmpl/B/components/Dish/index.js +0 -1
- package/es/plus/saleDetail/tmpl/B/index.js +0 -1
- package/es/plus/salesSdk/utils/addProductWithFlowDebounced.js +1 -1
- package/es/plus/salesSdk/utils/bookingDate.js +1 -1
- package/es/plus/salesSdk/utils/enrichCartLineHolderDisplay.js +1 -1
- package/es/private-materials/lowcode/authmodal/meta.d.ts +1 -0
- package/es/pro/Login2.0/AuthModal.d.ts +1 -1
- package/es/pro/Login2.0/index.d.ts +2 -2
- package/es/pro/Login2.0/shared/types.d.ts +1 -1
- package/lib/components/appointmentBooking/components/Cart/ContinueButton/index.js +13 -6
- package/lib/components/appointmentBooking/components/Cart/ContinueButton/index.less +6 -0
- package/lib/components/appointmentBooking/components/Date/index.js +102 -34
- package/lib/components/appointmentBooking/components/Services/index.js +122 -57
- package/lib/components/appointmentBooking/context.js +71 -9
- package/lib/components/appointmentBooking/hooks.js +227 -172
- package/lib/components/appointmentBooking/index.js +2 -1
- package/lib/components/appointmentBooking/locales.js +10 -0
- package/lib/components/vendingMachine/README.md +1 -1
- package/lib/components/vendingMachine/customer.less +2 -20
- package/lib/components/vendingMachine/dispense.less +1 -3
- package/lib/components/vendingMachine/redeem.less +1 -1
- package/lib/components/vendingMachine/vendingBottomBar.less +2 -2
- package/package.json +3 -3
- package/es/components/vendingMachine/assets/Bricolage-Grotesque-OFL.txt +0 -93
- package/es/components/vendingMachine/assets/DM-Sans-OFL.txt +0 -93
- package/es/components/vendingMachine/assets/bricolage-grotesque-latin.woff2 +0 -0
- package/es/components/vendingMachine/assets/dm-sans-latin.woff2 +0 -0
- package/es/plus/pisellReservation/index.js +0 -17
- package/es/plus/salesSdk/index.js +0 -54
- package/lib/components/vendingMachine/assets/Bricolage-Grotesque-OFL.txt +0 -93
- package/lib/components/vendingMachine/assets/DM-Sans-OFL.txt +0 -93
- package/lib/components/vendingMachine/assets/bricolage-grotesque-latin.woff2 +0 -0
- package/lib/components/vendingMachine/assets/dm-sans-latin.woff2 +0 -0
|
@@ -2,6 +2,8 @@ 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");
|
|
6
|
+
const require_locales = require("../../locales.js");
|
|
5
7
|
const require_utils = require("../../utils.js");
|
|
6
8
|
const require_hooks = require("../../hooks.js");
|
|
7
9
|
const require_context = require("../../context.js");
|
|
@@ -21,9 +23,13 @@ require("./index.less");
|
|
|
21
23
|
//#region src/components/appointmentBooking/components/Date/index.tsx
|
|
22
24
|
dayjs.default.extend(dayjs_plugin_isSameOrBefore.default);
|
|
23
25
|
const Date = (0, react.forwardRef)((props, ref) => {
|
|
24
|
-
var _context$
|
|
26
|
+
var _context$engine, _context$engine3, _Dayjs$locale;
|
|
25
27
|
const isFetchingDates = (0, react.useRef)(false);
|
|
26
|
-
const
|
|
28
|
+
const requestIdRef = (0, react.useRef)(0);
|
|
29
|
+
const mountedRef = (0, react.useRef)(false);
|
|
30
|
+
const readyMonthRef = (0, react.useRef)("");
|
|
31
|
+
const loadStateRef = (0, react.useRef)("loading");
|
|
32
|
+
const [loadState, setLoadState] = (0, react.useState)("loading");
|
|
27
33
|
const [currentDate, setCurrentDate] = (0, react.useState)();
|
|
28
34
|
const [dateMonthList, setDateMonthList] = (0, react.useState)([]);
|
|
29
35
|
const [currentMonth, setCurrentMonth] = (0, react.useState)();
|
|
@@ -31,6 +37,11 @@ const Date = (0, react.forwardRef)((props, ref) => {
|
|
|
31
37
|
const { isDateSelectedFirst, customPageId, channel } = require_hooks.useAppointmentBookingSetting();
|
|
32
38
|
const { nextStep } = require_hooks.useAppointmentBookingStep();
|
|
33
39
|
const context = require_useEngineContext.default();
|
|
40
|
+
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);
|
|
41
|
+
const updateLoadState = (state) => {
|
|
42
|
+
loadStateRef.current = state;
|
|
43
|
+
setLoadState(state);
|
|
44
|
+
};
|
|
34
45
|
(0, react.useImperativeHandle)(ref, () => ({ next: handleNext }));
|
|
35
46
|
/**
|
|
36
47
|
* @title: 处理进入下一步的逻辑
|
|
@@ -41,9 +52,13 @@ const Date = (0, react.forwardRef)((props, ref) => {
|
|
|
41
52
|
*/
|
|
42
53
|
const handleNext = function() {
|
|
43
54
|
var _ref = require_asyncToGenerator._asyncToGenerator(function* () {
|
|
55
|
+
var _data$;
|
|
56
|
+
if (loadStateRef.current !== "success" || readyMonthRef.current !== (currentMonth === null || currentMonth === void 0 ? void 0 : currentMonth.format("YYYY-MM"))) return;
|
|
57
|
+
const requestId = requestIdRef.current;
|
|
44
58
|
const data = yield appointmentBooking.getDateRange();
|
|
45
|
-
if (!
|
|
46
|
-
|
|
59
|
+
if (!mountedRef.current || requestId !== requestIdRef.current) return;
|
|
60
|
+
if (!(data === null || data === void 0 ? void 0 : data.length) || !currentDate || ((_data$ = data[0]) === null || _data$ === void 0 ? void 0 : _data$.date) !== currentDate) return require_utils.Toast(_pisell_utils.locales.getText("pisell2.appointment.unselect.date"));
|
|
61
|
+
yield nextStep();
|
|
47
62
|
});
|
|
48
63
|
return function handleNext() {
|
|
49
64
|
return _ref.apply(this, arguments);
|
|
@@ -61,21 +76,33 @@ const Date = (0, react.forwardRef)((props, ref) => {
|
|
|
61
76
|
const startingColumn = 0;
|
|
62
77
|
const columns = Array.from({ length: 7 }, (_, index) => (index + 7 - startingColumn) % 7);
|
|
63
78
|
(0, react.useEffect)(() => {
|
|
79
|
+
mountedRef.current = true;
|
|
80
|
+
const requestId = ++requestIdRef.current;
|
|
64
81
|
(function() {
|
|
65
82
|
var _ref2 = require_asyncToGenerator._asyncToGenerator(function* () {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
83
|
+
try {
|
|
84
|
+
var _data$2;
|
|
85
|
+
const data = yield appointmentBooking.getDateRange();
|
|
86
|
+
if (!mountedRef.current || requestId !== requestIdRef.current) return;
|
|
87
|
+
const selectedMonth = (0, dayjs.default)(data === null || data === void 0 || (_data$2 = data[0]) === null || _data$2 === void 0 ? void 0 : _data$2.date);
|
|
88
|
+
setCurrentMonth(selectedMonth.isValid() ? selectedMonth : (0, dayjs.default)());
|
|
89
|
+
} catch (error) {
|
|
90
|
+
if (mountedRef.current && requestId === requestIdRef.current) updateLoadState("error");
|
|
91
|
+
}
|
|
69
92
|
});
|
|
70
93
|
return function getCurrentMonthData() {
|
|
71
94
|
return _ref2.apply(this, arguments);
|
|
72
95
|
};
|
|
73
96
|
})()();
|
|
97
|
+
return () => {
|
|
98
|
+
mountedRef.current = false;
|
|
99
|
+
requestIdRef.current += 1;
|
|
100
|
+
};
|
|
74
101
|
}, []);
|
|
75
102
|
const locale = (0, react.useMemo)(() => {
|
|
76
|
-
var _context$
|
|
77
|
-
return require_state.localeTypes[context === null || context === void 0 || (_context$
|
|
78
|
-
}, [context === null || context === void 0 || (_context$
|
|
103
|
+
var _context$engine2;
|
|
104
|
+
return require_state.localeTypes[context === null || context === void 0 || (_context$engine2 = context.engine) === null || _context$engine2 === void 0 || (_context$engine2 = _context$engine2.props) === null || _context$engine2 === void 0 ? void 0 : _context$engine2.locale] || "en";
|
|
105
|
+
}, [context === null || context === void 0 || (_context$engine3 = context.engine) === null || _context$engine3 === void 0 || (_context$engine3 = _context$engine3.props) === null || _context$engine3 === void 0 ? void 0 : _context$engine3.locale]);
|
|
79
106
|
/**
|
|
80
107
|
* @title: 获取当前月日期
|
|
81
108
|
* @description:
|
|
@@ -120,7 +147,6 @@ const Date = (0, react.forwardRef)((props, ref) => {
|
|
|
120
147
|
*/
|
|
121
148
|
const getDateData = function() {
|
|
122
149
|
var _ref3 = require_asyncToGenerator._asyncToGenerator(function* (params) {
|
|
123
|
-
console.log(isDateSelectedFirst, customPageId, params, channel, "wh7868");
|
|
124
150
|
if (isDateSelectedFirst) return appointmentBooking.loadScheduleAvailableDate(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, params), {}, {
|
|
125
151
|
custom_page_id: customPageId,
|
|
126
152
|
channel
|
|
@@ -132,24 +158,40 @@ const Date = (0, react.forwardRef)((props, ref) => {
|
|
|
132
158
|
};
|
|
133
159
|
}();
|
|
134
160
|
const getDates = function() {
|
|
135
|
-
var _ref4 = require_asyncToGenerator._asyncToGenerator(function* (date) {
|
|
161
|
+
var _ref4 = require_asyncToGenerator._asyncToGenerator(function* (date, retryAborted = true) {
|
|
162
|
+
const requestId = ++requestIdRef.current;
|
|
163
|
+
const isCurrentRequest = () => mountedRef.current && requestId === requestIdRef.current;
|
|
164
|
+
readyMonthRef.current = "";
|
|
165
|
+
updateLoadState("loading");
|
|
166
|
+
setCurrentDate(void 0);
|
|
136
167
|
try {
|
|
137
168
|
const data = yield getDateData({
|
|
138
169
|
startDate: (0, dayjs.default)(date).startOf("month").format("YYYY-MM-DD"),
|
|
139
|
-
endDate: (0, dayjs.default)(date).endOf("month").format("YYYY-MM-DD")
|
|
170
|
+
endDate: (0, dayjs.default)(date).endOf("month").format("YYYY-MM-DD"),
|
|
171
|
+
assertCurrent: () => {
|
|
172
|
+
if (!isCurrentRequest()) {
|
|
173
|
+
const error = /* @__PURE__ */ new Error("Calendar request superseded");
|
|
174
|
+
error.name = "AbortError";
|
|
175
|
+
throw error;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
140
178
|
});
|
|
141
|
-
|
|
179
|
+
if (!isCurrentRequest()) return;
|
|
180
|
+
if (!Array.isArray(data)) throw new Error("Invalid availability response");
|
|
181
|
+
const firstAvailableDate = data.find((d) => d.status === "available");
|
|
142
182
|
if (!firstAvailableDate && !isFetchingDates.current) {
|
|
143
183
|
isFetchingDates.current = true;
|
|
144
184
|
setCurrentMonth((0, dayjs.default)(date).add(1, "month"));
|
|
145
|
-
setLoading(true);
|
|
146
185
|
return;
|
|
147
186
|
}
|
|
148
187
|
const selected = yield appointmentBooking.getDateRange();
|
|
149
|
-
|
|
188
|
+
if (!isCurrentRequest()) return;
|
|
150
189
|
if ((selected === null || selected === void 0 ? void 0 : selected.length) > 0) {
|
|
151
|
-
|
|
152
|
-
|
|
190
|
+
const selectedDay = data.find((day) => {
|
|
191
|
+
var _selected$;
|
|
192
|
+
return day.date === ((_selected$ = selected[0]) === null || _selected$ === void 0 ? void 0 : _selected$.date);
|
|
193
|
+
});
|
|
194
|
+
setCurrentDate(selectedDay && selectedDay.status !== "unavailable" ? selectedDay.date : void 0);
|
|
153
195
|
} else if (!isDateSelectedFirst) {
|
|
154
196
|
if (date.format("YYYY-MM") === (0, dayjs.default)().format("YYYY-MM") || isFetchingDates.current) {
|
|
155
197
|
if (firstAvailableDate) {
|
|
@@ -158,16 +200,21 @@ const Date = (0, react.forwardRef)((props, ref) => {
|
|
|
158
200
|
}
|
|
159
201
|
}
|
|
160
202
|
}
|
|
161
|
-
|
|
203
|
+
setDateMonthList(getMonthData(date.format("YYYY-MM")).map((day) => {
|
|
162
204
|
const matchedDay = data.find((d) => d.date === day.date);
|
|
163
205
|
if (matchedDay) return require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, day), matchedDay), {}, { disabled: matchedDay.status === "unavailable" });
|
|
164
|
-
return day;
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
|
|
206
|
+
return require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, day), {}, { disabled: true });
|
|
207
|
+
}));
|
|
208
|
+
readyMonthRef.current = date.format("YYYY-MM");
|
|
209
|
+
updateLoadState("success");
|
|
168
210
|
} catch (error) {
|
|
169
|
-
|
|
170
|
-
|
|
211
|
+
if (!isCurrentRequest()) return;
|
|
212
|
+
if ((error === null || error === void 0 ? void 0 : error.name) === "AbortError") {
|
|
213
|
+
if (retryAborted) return getDates(date, false);
|
|
214
|
+
updateLoadState("idle");
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
updateLoadState("error");
|
|
171
218
|
}
|
|
172
219
|
});
|
|
173
220
|
return function getDates(_x2) {
|
|
@@ -177,7 +224,27 @@ const Date = (0, react.forwardRef)((props, ref) => {
|
|
|
177
224
|
(0, react.useEffect)(() => {
|
|
178
225
|
if (!currentMonth) return;
|
|
179
226
|
getDates(currentMonth);
|
|
180
|
-
|
|
227
|
+
return () => {
|
|
228
|
+
requestIdRef.current += 1;
|
|
229
|
+
};
|
|
230
|
+
}, [
|
|
231
|
+
currentMonth,
|
|
232
|
+
isDateSelectedFirst,
|
|
233
|
+
customPageId,
|
|
234
|
+
channel,
|
|
235
|
+
appointmentBooking
|
|
236
|
+
]);
|
|
237
|
+
const changeMonth = (month) => {
|
|
238
|
+
requestIdRef.current += 1;
|
|
239
|
+
readyMonthRef.current = "";
|
|
240
|
+
updateLoadState("loading");
|
|
241
|
+
setCurrentMonth(month);
|
|
242
|
+
};
|
|
243
|
+
const retry = () => {
|
|
244
|
+
if (loadStateRef.current === "loading") return;
|
|
245
|
+
if (currentMonth) getDates(currentMonth);
|
|
246
|
+
else changeMonth((0, dayjs.default)());
|
|
247
|
+
};
|
|
181
248
|
/**
|
|
182
249
|
* @title: 切换上个月
|
|
183
250
|
* @description:
|
|
@@ -187,7 +254,7 @@ const Date = (0, react.forwardRef)((props, ref) => {
|
|
|
187
254
|
* @Date: 2024-02-01 19:15
|
|
188
255
|
*/
|
|
189
256
|
const lastMonth = () => {
|
|
190
|
-
|
|
257
|
+
changeMonth((0, dayjs.default)(currentMonth === null || currentMonth === void 0 ? void 0 : currentMonth.format("YYYY-MM")).subtract(1, "month"));
|
|
191
258
|
};
|
|
192
259
|
/**
|
|
193
260
|
* @title: 切换下个月
|
|
@@ -198,8 +265,7 @@ const Date = (0, react.forwardRef)((props, ref) => {
|
|
|
198
265
|
* @Date: 2024-02-01 19:15
|
|
199
266
|
*/
|
|
200
267
|
const nextMonth = () => {
|
|
201
|
-
|
|
202
|
-
setLoading(true);
|
|
268
|
+
changeMonth((0, dayjs.default)(currentMonth === null || currentMonth === void 0 ? void 0 : currentMonth.format("YYYY-MM")).add(1, "month"));
|
|
203
269
|
};
|
|
204
270
|
/**
|
|
205
271
|
* @title: 点击某一天日期
|
|
@@ -211,12 +277,15 @@ const Date = (0, react.forwardRef)((props, ref) => {
|
|
|
211
277
|
* @Date: 2025-04-24 18:36
|
|
212
278
|
*/
|
|
213
279
|
const handleClick = (day, date) => {
|
|
214
|
-
if (day === null || day === void 0 ? void 0 : day.disabled) return;
|
|
280
|
+
if ((day === null || day === void 0 ? void 0 : day.disabled) || loadStateRef.current !== "success") return;
|
|
215
281
|
setCurrentDate(date);
|
|
216
282
|
appointmentBooking.setDateRange([day]);
|
|
217
|
-
if (isDateSelectedFirst)
|
|
283
|
+
if (isDateSelectedFirst) nextStep();
|
|
218
284
|
};
|
|
219
|
-
return /* @__PURE__ */ react.default.createElement("div", {
|
|
285
|
+
return /* @__PURE__ */ react.default.createElement("div", {
|
|
286
|
+
className: `calendar-date-box ${(0, _pisell_utils.isMobile)() ? "calendar-date-mobile-box" : ""}`,
|
|
287
|
+
"aria-busy": loadState === "loading"
|
|
288
|
+
}, loadState === "error" || loadState === "idle" ? /* @__PURE__ */ react.default.createElement("div", null, loadState === "error" && /* @__PURE__ */ react.default.createElement("p", { role: "alert" }, _pisell_utils.locales.getText("pisell2.appointment.availability.load.failed")), /* @__PURE__ */ react.default.createElement(antd.Button, { onClick: retry }, _pisell_utils.locales.getText("pisell2.appointment.retry"))) : loadState === "loading" || !currentMonth ? /* @__PURE__ */ react.default.createElement(antd.Skeleton, {
|
|
220
289
|
loading: true,
|
|
221
290
|
active: true,
|
|
222
291
|
style: { paddingTop: "16px" }
|
|
@@ -240,8 +309,7 @@ const Date = (0, react.forwardRef)((props, ref) => {
|
|
|
240
309
|
className: (0, classnames.default)("calendar-days-items", {
|
|
241
310
|
["disabledDate"]: day === null || day === void 0 ? void 0 : day.disabled,
|
|
242
311
|
["selectDate"]: currentDate === date,
|
|
243
|
-
["other-month-days"]: !isCurrentMonth
|
|
244
|
-
["loading-item"]: loading
|
|
312
|
+
["other-month-days"]: !isCurrentMonth
|
|
245
313
|
}),
|
|
246
314
|
onClick: () => handleClick(day, date)
|
|
247
315
|
}, isCurrentMonth && /* @__PURE__ */ react.default.createElement("div", { className: (0, classnames.default)("day-text") }, (0, dayjs.default)(day.date).format("D")));
|
|
@@ -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 {
|
|
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.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
|
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
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const
|
|
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
|
|
91
|
-
endTime: `${endDate} ${session
|
|
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) || []).
|
|
103
|
-
|
|
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 (
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
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
|
|
185
|
+
return _ref2.apply(this, arguments);
|
|
128
186
|
};
|
|
129
187
|
}()
|
|
130
188
|
});
|
|
131
189
|
});
|
|
132
190
|
return function handleSelectProduct(_x2, _x3) {
|
|
133
|
-
return
|
|
191
|
+
return _ref3.apply(this, arguments);
|
|
134
192
|
};
|
|
135
193
|
}();
|
|
136
194
|
const productListSetting = (0, react.useMemo)(() => {
|
|
137
|
-
var _context$
|
|
138
|
-
const { customPageData } = ((_context$
|
|
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(
|
|
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$
|
|
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$
|
|
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
|
-
|
|
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$
|
|
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,
|