@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.
- 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/useBigSaleProductListConfig.js +1 -0
- 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/ticketBooking/components/ProductDisplayAdapter/index.js +3 -0
- package/es/components/ticketBooking/components/addServiceVariant/addService.js +1 -0
- package/es/components/venueBookingSales/catalogPresentation.js +1 -0
- 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/package.json +4 -4
- package/es/plus/pisellReservation/index.js +0 -17
- 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
|
|
84
|
-
var
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
const
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
if (
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
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-
|
|
105
|
-
description: _pisell_utils.locales.getText("pisell2.appointment.select.
|
|
118
|
+
key: "select-resource",
|
|
119
|
+
description: _pisell_utils.locales.getText("pisell2.appointment.select.resource")
|
|
106
120
|
}, targetKey);
|
|
107
|
-
targetKey = "select-
|
|
108
|
-
|
|
109
|
-
|
|
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
|
-
|
|
114
|
-
|
|
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
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
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
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
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
|
-
|
|
170
|
-
const
|
|
171
|
-
if (
|
|
172
|
-
var
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
}
|
|
178
|
-
|
|
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
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
require_utils
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
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
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
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
|
-
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
|
|
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
|
|
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
|
|
331
|
+
return _ref5.apply(this, arguments);
|
|
277
332
|
};
|
|
278
333
|
}();
|
|
279
334
|
return {
|
|
280
335
|
checkProductType: function() {
|
|
281
|
-
var
|
|
336
|
+
var _ref6 = require_asyncToGenerator._asyncToGenerator(function* (productId) {
|
|
282
337
|
return yield appointmentBooking.getProductTypeById(productId);
|
|
283
338
|
});
|
|
284
|
-
return function checkProductType(
|
|
285
|
-
return
|
|
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
|
|
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
|
|
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
|
|
439
|
+
var _ref8 = require_asyncToGenerator._asyncToGenerator(function* () {
|
|
385
440
|
setAccountLists((yield appointmentBooking.getAccounts()) || []);
|
|
386
441
|
});
|
|
387
442
|
return function getAccountLists() {
|
|
388
|
-
return
|
|
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
|
|
449
|
+
var _ref9 = require_asyncToGenerator._asyncToGenerator(function* (res) {
|
|
395
450
|
if (res.path === "accounts") getAccountLists();
|
|
396
451
|
});
|
|
397
|
-
return function(
|
|
398
|
-
return
|
|
452
|
+
return function(_x4) {
|
|
453
|
+
return _ref9.apply(this, arguments);
|
|
399
454
|
};
|
|
400
455
|
}());
|
|
401
456
|
}, []);
|
|
402
457
|
const getHolders = function() {
|
|
403
|
-
var
|
|
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
|
|
484
|
+
return _ref10.apply(this, arguments);
|
|
430
485
|
};
|
|
431
486
|
}();
|
|
432
487
|
const addAccount = function() {
|
|
433
|
-
var
|
|
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(
|
|
441
|
-
return
|
|
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
|
|
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(
|
|
486
|
-
return
|
|
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
|
|
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
|
|
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
|
-
|
|
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.
|
|
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/
|
|
79
|
-
"@pisell/materials": "6.12.91",
|
|
78
|
+
"@pisell/date-picker": "3.0.12",
|
|
80
79
|
"@pisell/icon": "0.0.11",
|
|
81
|
-
"@pisell/
|
|
80
|
+
"@pisell/utils": "3.0.7",
|
|
81
|
+
"@pisell/materials": "6.12.91"
|
|
82
82
|
},
|
|
83
83
|
"peerDependencies": {
|
|
84
84
|
"react": "^18.0.0",
|