@pisell/private-materials 6.12.356 → 6.12.358
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.js +12 -12
- package/build/lowcode/view.js +12 -12
- package/es/components/appointmentBooking/components/Cart/Item/index.js +67 -12
- package/es/components/appointmentBooking/components/ConfirmInformation/index.js +7 -2
- package/es/components/appointmentBooking/components/Content/index.js +6 -4
- package/es/components/appointmentBooking/components/Voucher/index.js +11 -1
- package/es/components/appointmentBooking/hooks.js +33 -18
- package/es/components/appointmentBooking/utils.js +16 -5
- package/es/components/bigSale/components/BookingFloatingPanel/useBookingPanelController.js +1 -0
- package/es/components/bigSale/components/ProductList/index.js +1 -0
- package/es/components/bigSale/components/TimeBar/index.js +1 -0
- package/es/components/bigSale/dialog.js +1 -0
- package/es/components/bigSale/hooks/useBigSaleContext.js +1 -0
- package/es/components/bigSale/hooks/useSelectFloorMapResourceForBigSale.js +1 -0
- package/es/components/bigSale/index.js +1 -0
- package/es/components/bigSale/templates/Kiosk/index.js +1 -0
- package/es/components/sharedSecondaryBigSale/SharedSecondaryBigSaleReceiver.js +1 -0
- package/es/components/venueBooking/components/Cart/index.js +112 -18
- package/es/components/venueBooking/context.js +14 -3
- package/es/components/venueBooking/locales.js +10 -5
- package/es/index.js +2 -0
- 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/pisellReservation/index.js +17 -0
- package/es/plus/saleDetail/Base.js +1 -0
- package/es/plus/saleDetail/components/Client/hooks/useClientSelectorProps.js +1 -0
- package/es/plus/saleDetail/components/DetailActions/PrintAction.js +1 -0
- package/es/plus/saleDetail/components/DetailActions/index.js +1 -0
- package/es/plus/saleDetail/components/SummaryFinancialSections/index.js +1 -0
- package/es/plus/saleDetail/index.js +1 -0
- package/es/plus/saleDetail/tmpl/B/components/Dish/index.js +1 -0
- package/es/plus/saleDetail/tmpl/B/index.js +1 -0
- package/es/plus/salesSdk/index.js +54 -0
- 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/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/es/utils/buildCartHolderParams.js +169 -0
- package/es/utils/holderConfig.js +6 -0
- package/lib/components/appointmentBooking/components/Cart/Item/index.js +66 -11
- package/lib/components/appointmentBooking/components/ConfirmInformation/index.js +7 -2
- package/lib/components/appointmentBooking/components/Content/index.js +6 -4
- package/lib/components/appointmentBooking/components/Voucher/index.js +11 -1
- package/lib/components/appointmentBooking/hooks.js +33 -18
- package/lib/components/appointmentBooking/utils.js +16 -5
- package/lib/components/venueBooking/components/Cart/index.js +111 -17
- package/lib/components/venueBooking/context.js +14 -3
- package/lib/components/venueBooking/locales.js +10 -5
- package/lib/utils/buildCartHolderParams.js +175 -0
- package/lib/utils/holderConfig.js +7 -0
- package/package.json +2 -2
- package/es/private-materials/lowcode/authmodal/meta.d.ts +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { _objectSpread2 } from "../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
|
|
2
2
|
import { _asyncToGenerator } from "../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
|
|
3
3
|
import shoppingCart from "../../../../shoppingCart/index.js";
|
|
4
|
+
import { isHolderConfigEnabled } from "../../../../../utils/holderConfig.js";
|
|
4
5
|
import { formatCurrentUser, formatHolder, getMultiResources, openForm, updateCartResources } from "../../../utils.js";
|
|
5
6
|
import SubTotal from "../../../../subTotal/index.js";
|
|
6
7
|
import { contextUtils, useAppointmentBooking, useAppointmentBookingAccount, useAppointmentBookingLogin, useAppointmentBookingResource, useAppointmentBookingSetting } from "../../../hooks.js";
|
|
@@ -9,7 +10,8 @@ import Deposit from "../../Deposit/index.js";
|
|
|
9
10
|
import { handleAddHolder } from "../utils.js";
|
|
10
11
|
import ContinueButton from "../ContinueButton/index.js";
|
|
11
12
|
import VoucherCard from "../../Voucher/index.js";
|
|
12
|
-
import
|
|
13
|
+
import { buildCartHolderOption, buildCartHolderParams, getAppointmentCartHolderConfig, getSkuRelationFormId, handleCartHolderFormSuccess } from "../../../../../utils/buildCartHolderParams.js";
|
|
14
|
+
import React, { useEffect, useMemo, useState } from "react";
|
|
13
15
|
import { isMobile, locales } from "@pisell/utils";
|
|
14
16
|
import "./index.less";
|
|
15
17
|
//#region src/components/appointmentBooking/components/Cart/Item/index.tsx
|
|
@@ -21,9 +23,29 @@ const CartItem = ({ onNext, renderContactInfo }) => {
|
|
|
21
23
|
const { getResourceList } = useAppointmentBookingResource();
|
|
22
24
|
const { isFormSubject, bookingSubject, isRetailTemplate } = useAppointmentBookingSetting();
|
|
23
25
|
const { isLogin } = useAppointmentBookingLogin();
|
|
26
|
+
const isLoggedIn = isLogin();
|
|
24
27
|
const utils = contextUtils();
|
|
25
|
-
const { businessUtils, translation } = utils;
|
|
28
|
+
const { businessUtils, translation, pisellos } = utils;
|
|
26
29
|
const { taxTitle, totalTaxFee, isPriceIncludeTax, total, deposit } = summary;
|
|
30
|
+
const [holderMap, setHolderMap] = useState({});
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
var _pisellos$effects;
|
|
33
|
+
const onHolderChanged = (res) => {
|
|
34
|
+
if ((res === null || res === void 0 ? void 0 : res.path) === "holderMap") {
|
|
35
|
+
var _appointmentBooking$g;
|
|
36
|
+
setHolderMap((appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$g = appointmentBooking.getHolderFormMap) === null || _appointmentBooking$g === void 0 ? void 0 : _appointmentBooking$g.call(appointmentBooking)) || {});
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
pisellos === null || pisellos === void 0 || (_pisellos$effects = pisellos.effects) === null || _pisellos$effects === void 0 || _pisellos$effects.on("appointmentBooking_holder:changed", onHolderChanged);
|
|
40
|
+
return () => {
|
|
41
|
+
var _pisellos$effects2;
|
|
42
|
+
pisellos === null || pisellos === void 0 || (_pisellos$effects2 = pisellos.effects) === null || _pisellos$effects2 === void 0 || _pisellos$effects2.off("appointmentBooking_holder:changed", onHolderChanged);
|
|
43
|
+
};
|
|
44
|
+
}, [appointmentBooking, pisellos]);
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
var _appointmentBooking$g2;
|
|
47
|
+
setHolderMap((appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$g2 = appointmentBooking.getHolderFormMap) === null || _appointmentBooking$g2 === void 0 ? void 0 : _appointmentBooking$g2.call(appointmentBooking)) || {});
|
|
48
|
+
}, [appointmentBooking, isLoggedIn]);
|
|
27
49
|
/**
|
|
28
50
|
* @title: 当前客户
|
|
29
51
|
* @description:
|
|
@@ -78,14 +100,35 @@ const CartItem = ({ onNext, renderContactInfo }) => {
|
|
|
78
100
|
}
|
|
79
101
|
if (type === "add_holder") {
|
|
80
102
|
const relationShipFormId = bookingSubject === null || bookingSubject === void 0 ? void 0 : bookingSubject.relationship_form_id;
|
|
103
|
+
const holderConfig = getAppointmentCartHolderConfig(e);
|
|
104
|
+
const formId = isHolderConfigEnabled(holderConfig) ? holderConfig === null || holderConfig === void 0 ? void 0 : holderConfig.resource_id : void 0;
|
|
105
|
+
const skuRelationFormId = getSkuRelationFormId(holderMap, formId);
|
|
81
106
|
return openForm({
|
|
82
|
-
form_id: relationShipFormId || (bookingSubject === null || bookingSubject === void 0 ? void 0 : bookingSubject.form_id),
|
|
107
|
+
form_id: skuRelationFormId || formId || relationShipFormId || (bookingSubject === null || bookingSubject === void 0 ? void 0 : bookingSubject.form_id),
|
|
83
108
|
title: locales.getText("pisell2.event.create.form"),
|
|
84
109
|
utils,
|
|
85
110
|
callback: function() {
|
|
86
111
|
var _ref = _asyncToGenerator(function* (res) {
|
|
87
112
|
if ((res === null || res === void 0 ? void 0 : res.status) === "success") {
|
|
88
113
|
let result = void 0;
|
|
114
|
+
if (formId) {
|
|
115
|
+
const { formRecordId, formId: holderFormId } = handleCartHolderFormSuccess({
|
|
116
|
+
res,
|
|
117
|
+
formId,
|
|
118
|
+
skuRelationFormId,
|
|
119
|
+
utils,
|
|
120
|
+
module: appointmentBooking
|
|
121
|
+
});
|
|
122
|
+
result = buildCartHolderOption(_objectSpread2(_objectSpread2({}, res === null || res === void 0 ? void 0 : res.values), {}, {
|
|
123
|
+
formRecordId,
|
|
124
|
+
form_id: holderFormId
|
|
125
|
+
}), utils);
|
|
126
|
+
appointmentBooking.updateCart({
|
|
127
|
+
_id: e === null || e === void 0 ? void 0 : e._id,
|
|
128
|
+
account: result
|
|
129
|
+
});
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
89
132
|
if (!relationShipFormId) result = yield addAccount(res === null || res === void 0 ? void 0 : res.values, "holder");
|
|
90
133
|
else result = yield handleAddHolder({
|
|
91
134
|
res,
|
|
@@ -110,24 +153,36 @@ const CartItem = ({ onNext, renderContactInfo }) => {
|
|
|
110
153
|
};
|
|
111
154
|
const products = useMemo(() => {
|
|
112
155
|
if (!(carts === null || carts === void 0 ? void 0 : carts.length)) return [];
|
|
113
|
-
carts.
|
|
114
|
-
|
|
156
|
+
const enrichedCarts = carts.map((item) => {
|
|
157
|
+
const isNormalProduct = appointmentBooking.isTargetCartIdNormalProduct(item === null || item === void 0 ? void 0 : item._id);
|
|
158
|
+
const holderConfig = getAppointmentCartHolderConfig(item);
|
|
159
|
+
const holderParams = buildCartHolderParams({
|
|
160
|
+
item,
|
|
161
|
+
holderConfig,
|
|
162
|
+
formData: isHolderConfigEnabled(holderConfig) ? holderMap === null || holderMap === void 0 ? void 0 : holderMap[holderConfig === null || holderConfig === void 0 ? void 0 : holderConfig.resource_id] : {},
|
|
163
|
+
translation,
|
|
164
|
+
enabled: isLoggedIn && isFormSubject && !isNormalProduct,
|
|
165
|
+
utils
|
|
166
|
+
});
|
|
167
|
+
return _objectSpread2(_objectSpread2({}, item), holderParams);
|
|
115
168
|
});
|
|
116
|
-
if ((currentSelectedResources === null || currentSelectedResources === void 0 ? void 0 : currentSelectedResources.length) > 0) return
|
|
169
|
+
if ((currentSelectedResources === null || currentSelectedResources === void 0 ? void 0 : currentSelectedResources.length) > 0) return enrichedCarts.map((item) => {
|
|
117
170
|
const currentResourceData = currentSelectedResources.find((resource) => (resource === null || resource === void 0 ? void 0 : resource._id) === (item === null || item === void 0 ? void 0 : item._id));
|
|
118
171
|
const multiResources = getMultiResources(item, currentResourceData === null || currentResourceData === void 0 ? void 0 : currentResourceData.currentSelectedResource, currentStepParams === null || currentStepParams === void 0 ? void 0 : currentStepParams.key);
|
|
119
172
|
return _objectSpread2(_objectSpread2({}, item), {}, {
|
|
120
173
|
isMultipleResource: true,
|
|
121
|
-
multiResources
|
|
122
|
-
isErrorHolder: isErrorHolder || false
|
|
174
|
+
multiResources
|
|
123
175
|
});
|
|
124
176
|
});
|
|
125
|
-
else return
|
|
177
|
+
else return enrichedCarts;
|
|
126
178
|
}, [
|
|
127
179
|
carts,
|
|
128
180
|
currentSelectedResources,
|
|
129
181
|
currentStepParams === null || currentStepParams === void 0 ? void 0 : currentStepParams.key,
|
|
130
|
-
isErrorHolder
|
|
182
|
+
isErrorHolder,
|
|
183
|
+
holderMap,
|
|
184
|
+
isFormSubject,
|
|
185
|
+
isLoggedIn
|
|
131
186
|
]);
|
|
132
187
|
/**
|
|
133
188
|
* @description: 结算列表数据
|
|
@@ -187,8 +242,8 @@ const CartItem = ({ onNext, renderContactInfo }) => {
|
|
|
187
242
|
isShowDelete: (currentStep === null || currentStep === void 0 || (_currentStep$step2 = currentStep.step) === null || _currentStep$step2 === void 0 ? void 0 : _currentStep$step2.key) === "select-service",
|
|
188
243
|
isShowAmountFooter: true,
|
|
189
244
|
isShowPackageNote: false,
|
|
190
|
-
isShowChangeHolder: isLastStep ? false : isFormSubject &&
|
|
191
|
-
isShowHolder: isFormSubject,
|
|
245
|
+
isShowChangeHolder: isLastStep ? false : isFormSubject && isLoggedIn,
|
|
246
|
+
isShowHolder: isFormSubject && isLoggedIn,
|
|
192
247
|
isShowAddHolderButton: true
|
|
193
248
|
},
|
|
194
249
|
collapseParams: {
|
|
@@ -2,6 +2,7 @@ import useEngineContext from "../../../../hooks/useEngineContext.js";
|
|
|
2
2
|
import { _objectSpread2 } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
|
|
3
3
|
import { _asyncToGenerator } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
|
|
4
4
|
import ContactInfoContent from "../../../../plus/contactInfoModal/ContactInfoContent.js";
|
|
5
|
+
import { isHolderConfigEnabled } from "../../../../utils/holderConfig.js";
|
|
5
6
|
import { Toast, formatAppointmentCartSummary, formatAppointmentCustomerInfo, sendAppointmentBookingLog } from "../../utils.js";
|
|
6
7
|
import useLoginUser from "../../../../hooks/useLoginUser.js";
|
|
7
8
|
import productStockCheckModal_default from "../../../productStockCheckModal/index.js";
|
|
@@ -23,7 +24,7 @@ const ConfirmInformation = forwardRef((props, ref) => {
|
|
|
23
24
|
const utils = contextUtils();
|
|
24
25
|
const { pubsub } = context.appHelper.utils;
|
|
25
26
|
const { appointmentBooking, summary, isAgreeDepositPolicy, setLoading, carts, setTimes } = useAppointmentBookingContext();
|
|
26
|
-
const { isRetailTemplate, bookingSetting } = useAppointmentBookingSetting();
|
|
27
|
+
const { isRetailTemplate, bookingSetting, isFormSubject } = useAppointmentBookingSetting();
|
|
27
28
|
console.log(bookingSetting, "bookingSetting");
|
|
28
29
|
const [form] = Form.useForm();
|
|
29
30
|
const userInfo = useLoginUser();
|
|
@@ -179,10 +180,14 @@ const ConfirmInformation = forwardRef((props, ref) => {
|
|
|
179
180
|
const onCheckout = function() {
|
|
180
181
|
var _ref5 = _asyncToGenerator(function* (extraData) {
|
|
181
182
|
try {
|
|
183
|
+
const _extraData = (carts === null || carts === void 0 ? void 0 : carts.some((item) => {
|
|
184
|
+
var _item$_productInit;
|
|
185
|
+
return isHolderConfigEnabled(item === null || item === void 0 || (_item$_productInit = item._productInit) === null || _item$_productInit === void 0 ? void 0 : _item$_productInit.holder_config);
|
|
186
|
+
})) ? _objectSpread2(_objectSpread2({}, extraData), {}, { is_add_holder_info: isFormSubject }) : extraData;
|
|
182
187
|
const { deposit } = summary;
|
|
183
188
|
const customer = formatAppointmentCustomerInfo(_objectSpread2(_objectSpread2({}, userInfo), extraData === null || extraData === void 0 ? void 0 : extraData.contacts_info));
|
|
184
189
|
logCheckout("调用 submitOrder", _objectSpread2({ products: formatAppointmentCartSummary(carts) }, customer));
|
|
185
|
-
const { data } = yield appointmentBooking.submitOrder(
|
|
190
|
+
const { data } = yield appointmentBooking.submitOrder(_extraData);
|
|
186
191
|
const { is_deposit, deposit_amount, total_amount, order_id } = data || {};
|
|
187
192
|
logCheckout("submitOrder 返回", _objectSpread2(_objectSpread2({ products: formatAppointmentCartSummary(carts) }, customer), {}, {
|
|
188
193
|
order_id: order_id || null,
|
|
@@ -27,6 +27,7 @@ const Layout = () => {
|
|
|
27
27
|
const { currentStep, setResourceOtherParams, resourceOtherParams, setIsAgreeDepositPolicy, appointmentBooking, setLoading, policyParams, closePolicy, currentStepParams, setIsErrorHolder } = useAppointmentBookingContext();
|
|
28
28
|
const { isDateSelectedFirst, isFormSubject, isRetailTemplate } = useAppointmentBookingSetting();
|
|
29
29
|
const { isLogin } = useAppointmentBookingLogin();
|
|
30
|
+
const isLoggedIn = isLogin();
|
|
30
31
|
const { getHolders } = useAppointmentBookingAccount();
|
|
31
32
|
const { removeStep } = useAppointmentBookingStep();
|
|
32
33
|
const { shopDiscount } = useShopDiscount();
|
|
@@ -47,7 +48,7 @@ const Layout = () => {
|
|
|
47
48
|
const accountLists = yield appointmentBooking.getAccounts();
|
|
48
49
|
const meAccount = accountLists === null || accountLists === void 0 ? void 0 : accountLists.find((d) => !(d === null || d === void 0 ? void 0 : d.isGuest));
|
|
49
50
|
appointmentBooking.setLoginAccount(meAccount === null || meAccount === void 0 ? void 0 : meAccount.id, currentUser);
|
|
50
|
-
} else if (!isRetailTemplate) getHolders();
|
|
51
|
+
} else if (!isRetailTemplate) yield getHolders();
|
|
51
52
|
});
|
|
52
53
|
return function handleLoginSuccess(_x) {
|
|
53
54
|
return _ref.apply(this, arguments);
|
|
@@ -86,11 +87,12 @@ const Layout = () => {
|
|
|
86
87
|
} catch (error) {}
|
|
87
88
|
}, [isFormSubject, isRetailTemplate]);
|
|
88
89
|
useEffect(() => {
|
|
89
|
-
if (isFormSubject &&
|
|
90
|
+
if (isFormSubject && isLoggedIn && !isRetailTemplate) getHolders();
|
|
90
91
|
}, [
|
|
91
92
|
isFormSubject,
|
|
92
|
-
|
|
93
|
-
isRetailTemplate
|
|
93
|
+
isLoggedIn,
|
|
94
|
+
isRetailTemplate,
|
|
95
|
+
appointmentBooking
|
|
94
96
|
]);
|
|
95
97
|
useEffect(() => {
|
|
96
98
|
var _currentStep$step;
|
|
@@ -2,6 +2,7 @@ import useEngineContext from "../../../../hooks/useEngineContext.js";
|
|
|
2
2
|
import { _objectSpread2 } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
|
|
3
3
|
import { _asyncToGenerator } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
|
|
4
4
|
import { showDiscountScanFailMessage } from "../../../booking/utils.js";
|
|
5
|
+
import { getCustomer } from "../../utils.js";
|
|
5
6
|
import { useAppointmentBooking, useAppointmentBookingAccount, useAppointmentBookingLogin, useShopDiscount } from "../../hooks.js";
|
|
6
7
|
import { useAppointmentBookingContext } from "../../context.js";
|
|
7
8
|
import React, { useEffect, useMemo, useRef, useState } from "react";
|
|
@@ -195,7 +196,16 @@ const VoucherCard = (props) => {
|
|
|
195
196
|
className: "login-btn",
|
|
196
197
|
onClick: () => {
|
|
197
198
|
if (!action) return;
|
|
198
|
-
openLoginModal({
|
|
199
|
+
openLoginModal({
|
|
200
|
+
data: { type: "plugin" },
|
|
201
|
+
callback: (status) => {
|
|
202
|
+
if (status === "success") {
|
|
203
|
+
var _appointmentBooking$r;
|
|
204
|
+
const customer = getCustomer(utils);
|
|
205
|
+
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 });
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
});
|
|
199
209
|
}
|
|
200
210
|
}, locales.getText("pisell2.text.goodpass.login")), /* @__PURE__ */ React.createElement("span", null, locales.getText("pisell2.text.goodpass.login-tip"))));
|
|
201
211
|
};
|
|
@@ -184,15 +184,19 @@ const useAppointmentBookingStep = () => {
|
|
|
184
184
|
const selectedResource = (currentSelectedResources === null || currentSelectedResources === void 0 || (_currentSelectedResou2 = currentSelectedResources[0]) === null || _currentSelectedResou2 === void 0 ? void 0 : _currentSelectedResou2.currentSelectedResource) || {};
|
|
185
185
|
const renderItem = (selectedResource === null || selectedResource === void 0 ? void 0 : selectedResource.renderItem) || {};
|
|
186
186
|
const checkHolder = function() {
|
|
187
|
-
var _ref2 = _asyncToGenerator(function* () {
|
|
187
|
+
var _ref2 = _asyncToGenerator(function* (isLoginTrigger = false) {
|
|
188
188
|
setLoading(false);
|
|
189
189
|
if (isRetailTemplate || (appointmentBooking === null || appointmentBooking === void 0 ? void 0 : appointmentBooking.isCartAllNormalProducts())) return appointmentBooking.next();
|
|
190
190
|
let cartLists = carts || [];
|
|
191
191
|
if (!(carts === null || carts === void 0 ? void 0 : carts.length)) cartLists = (yield appointmentBooking.getCart()) || [];
|
|
192
192
|
else cartLists = carts || [];
|
|
193
|
-
const { hasError } = checkAndGoNext(isFormSubject, checkAccount, cartLists.filter((n) => !(appointmentBooking === null || appointmentBooking === void 0 ? void 0 : appointmentBooking.isTargetCartIdNormalProduct(n._id))));
|
|
193
|
+
const { hasError, isEnableSkuHolderRule } = checkAndGoNext(isFormSubject, checkAccount, cartLists.filter((n) => !(appointmentBooking === null || appointmentBooking === void 0 ? void 0 : appointmentBooking.isTargetCartIdNormalProduct(n._id))));
|
|
194
194
|
setIsErrorHolder(hasError);
|
|
195
|
-
if (hasError)
|
|
195
|
+
if (hasError) {
|
|
196
|
+
scrollToFirstErrorCard(".pisell-lowcode-product-card-select-holder-error");
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
if (isLoginTrigger && isEnableSkuHolderRule) return;
|
|
196
200
|
if (!!(renderItem === null || renderItem === void 0 ? void 0 : renderItem.policy_id)) openPolicy({ id: renderItem === null || renderItem === void 0 ? void 0 : renderItem.policy_id }, () => {
|
|
197
201
|
return appointmentBooking.next();
|
|
198
202
|
});
|
|
@@ -204,10 +208,17 @@ const useAppointmentBookingStep = () => {
|
|
|
204
208
|
}();
|
|
205
209
|
const checkLogin = function() {
|
|
206
210
|
var _ref3 = _asyncToGenerator(function* () {
|
|
207
|
-
if (!isLogin) {
|
|
211
|
+
if (!isLogin()) {
|
|
208
212
|
const { pubsub } = utils;
|
|
209
213
|
pubsub.once("pisell1.login.success", (res) => {
|
|
210
|
-
if (res === "success")
|
|
214
|
+
if (res === "success") {
|
|
215
|
+
if (isFormSubject && !isRetailTemplate && !(appointmentBooking === null || appointmentBooking === void 0 ? void 0 : appointmentBooking.isCartAllNormalProducts())) {
|
|
216
|
+
var _appointmentBooking$r;
|
|
217
|
+
const customer = getCustomer(utils);
|
|
218
|
+
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 });
|
|
219
|
+
}
|
|
220
|
+
checkHolder(true);
|
|
221
|
+
}
|
|
211
222
|
if (res === "close") setLoading(false);
|
|
212
223
|
});
|
|
213
224
|
return openLoginModal({ callback: (status) => {} });
|
|
@@ -341,10 +352,10 @@ const useAppointmentBookingLogin = () => {
|
|
|
341
352
|
return Boolean(utils === null || utils === void 0 || (_utils$token = utils.token) === null || _utils$token === void 0 || (_utils$token$get = _utils$token.get) === null || _utils$token$get === void 0 ? void 0 : _utils$token$get.call(_utils$token));
|
|
342
353
|
}, [utils]);
|
|
343
354
|
const openLoginModal = (params) => {
|
|
344
|
-
const { callback } = params || {};
|
|
355
|
+
const { callback, data = {} } = params || {};
|
|
345
356
|
utils.action({
|
|
346
357
|
type: "pisell1.login",
|
|
347
|
-
data: { type: "plugin" },
|
|
358
|
+
data: _objectSpread2({ type: "plugin" }, data),
|
|
348
359
|
callback
|
|
349
360
|
});
|
|
350
361
|
};
|
|
@@ -389,19 +400,23 @@ const useAppointmentBookingAccount = () => {
|
|
|
389
400
|
}, []);
|
|
390
401
|
const getHolders = function() {
|
|
391
402
|
var _ref9 = _asyncToGenerator(function* () {
|
|
392
|
-
var _utils$getStore$getSt;
|
|
403
|
+
var _utils$getStore$getSt, _appointmentBooking$r2;
|
|
393
404
|
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;
|
|
394
405
|
const customer = getCustomer(utils);
|
|
395
|
-
if (!
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
406
|
+
if (!(customer === null || customer === void 0 ? void 0 : customer.id)) return [];
|
|
407
|
+
let data;
|
|
408
|
+
if (shop_id && form_id) {
|
|
409
|
+
const params = {
|
|
410
|
+
url: "/form/data/v1",
|
|
411
|
+
query: {
|
|
412
|
+
customer_id: customer.id,
|
|
413
|
+
form_id,
|
|
414
|
+
shop_id
|
|
415
|
+
}
|
|
416
|
+
};
|
|
417
|
+
data = yield appointmentBooking.fetchHolderAccountsAsync(params);
|
|
418
|
+
}
|
|
419
|
+
yield appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$r2 = appointmentBooking.refreshAllHolderFormRecords) === null || _appointmentBooking$r2 === void 0 ? void 0 : _appointmentBooking$r2.call(appointmentBooking, { customer_id: customer.id });
|
|
405
420
|
return (data === null || data === void 0 ? void 0 : data.map((item) => {
|
|
406
421
|
return {
|
|
407
422
|
id: item === null || item === void 0 ? void 0 : item.form_record_id,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
|
|
2
2
|
import { _asyncToGenerator } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
|
|
3
|
+
import { isHolderConfigEnabled, isHolderConfigRequired } from "../../utils/holderConfig.js";
|
|
3
4
|
import { getUniqueId, locales } from "@pisell/utils";
|
|
4
5
|
import { PisellToast } from "@pisell/materials";
|
|
5
6
|
//#region src/components/appointmentBooking/utils.ts
|
|
@@ -338,10 +339,19 @@ const getFormInsertBeforeKey = (currentKey, stepList) => {
|
|
|
338
339
|
* @Date: 2025-05-24 22:46
|
|
339
340
|
*/
|
|
340
341
|
const checkAndGoNext = (isFormSubject, checkAccount, carts) => {
|
|
342
|
+
if (!isFormSubject) return {
|
|
343
|
+
hasError: false,
|
|
344
|
+
isEnableSkuHolderRule: false,
|
|
345
|
+
updatedCartList: carts
|
|
346
|
+
};
|
|
341
347
|
let hasError = false;
|
|
348
|
+
let isEnableSkuHolderRule = false;
|
|
342
349
|
let updatedCartList = [...carts];
|
|
343
|
-
|
|
344
|
-
|
|
350
|
+
updatedCartList = carts === null || carts === void 0 ? void 0 : carts.map((item) => {
|
|
351
|
+
var _item$_productInit;
|
|
352
|
+
const holderConfig = (item === null || item === void 0 || (_item$_productInit = item._productInit) === null || _item$_productInit === void 0 ? void 0 : _item$_productInit.holder_config) || {};
|
|
353
|
+
if (!(item === null || item === void 0 ? void 0 : item.holder_id) && isHolderConfigEnabled(holderConfig) && !isHolderConfigRequired(holderConfig)) isEnableSkuHolderRule = true;
|
|
354
|
+
if (!(item === null || item === void 0 ? void 0 : item.holder_id) && isHolderConfigRequired(holderConfig)) {
|
|
345
355
|
hasError = true;
|
|
346
356
|
return _objectSpread2(_objectSpread2({}, item), {}, { isErrorHolder: true });
|
|
347
357
|
}
|
|
@@ -349,7 +359,8 @@ const checkAndGoNext = (isFormSubject, checkAccount, carts) => {
|
|
|
349
359
|
});
|
|
350
360
|
return {
|
|
351
361
|
hasError,
|
|
352
|
-
updatedCartList
|
|
362
|
+
updatedCartList,
|
|
363
|
+
isEnableSkuHolderRule
|
|
353
364
|
};
|
|
354
365
|
};
|
|
355
366
|
const currentAppointmentBoard = (currentKey, resources, appointmentBooking) => {
|
|
@@ -411,8 +422,8 @@ const isSessionProduct = function() {
|
|
|
411
422
|
var _ref2 = _asyncToGenerator(function* (appointmentBooking) {
|
|
412
423
|
const carts = yield appointmentBooking.getCart();
|
|
413
424
|
return carts === null || carts === void 0 ? void 0 : carts.some((item) => {
|
|
414
|
-
var _item$
|
|
415
|
-
return (item === null || item === void 0 || (_item$
|
|
425
|
+
var _item$_productInit2;
|
|
426
|
+
return (item === null || item === void 0 || (_item$_productInit2 = item._productInit) === null || _item$_productInit2 === void 0 || (_item$_productInit2 = _item$_productInit2["schedule.ids"]) === null || _item$_productInit2 === void 0 ? void 0 : _item$_productInit2.length) > 0;
|
|
416
427
|
});
|
|
417
428
|
});
|
|
418
429
|
return function isSessionProduct(_x) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import useEngineContext from "../../../../hooks/useEngineContext.js";
|
|
2
2
|
import { subscribeBookingDateChange } from "../../../../plus/salesSdk/utils/bookingDate.js";
|
|
3
|
+
import "../../../../plus/salesSdk/index.js";
|
|
3
4
|
import dayjs from "dayjs";
|
|
4
5
|
import { useCallback, useEffect, useState } from "react";
|
|
5
6
|
//#region src/components/bigSale/components/BookingFloatingPanel/useBookingPanelController.ts
|
|
@@ -15,6 +15,7 @@ import { useSalesSdkBusinessAvailability } from "../../../../plus/salesSdk/conte
|
|
|
15
15
|
import { showAddToCartToast } from "../../../../plus/salesSdk/components/showAddToCartToast.js";
|
|
16
16
|
import { mergeBookingsForDisplay } from "../../../../plus/salesSdk/utils/mergeBookingsForDisplay.js";
|
|
17
17
|
import useSalesSdkGlobalScanHandler from "../../../../plus/salesSdk/hooks/useSalesSdkGlobalScanHandler.js";
|
|
18
|
+
import "../../../../plus/salesSdk/index.js";
|
|
18
19
|
import { buildBigSaleProductListPreferencesKey, readBigSaleProductListPreferences, readStoredBigSaleProductListPreferences, removeBigSaleProductListPreferences, resolveBigSaleAutoProductListPreferences, writeBigSaleProductListPreferences } from "../../utils/productListPreferences.js";
|
|
19
20
|
import { resolveBigSaleProductDisplayConfig, useBigSaleProductListConfig } from "../../hooks/useBigSaleProductListConfig.js";
|
|
20
21
|
import locales_default from "../../locales/index.js";
|
|
@@ -5,6 +5,7 @@ import useInitLocalesOnce from "../../../../hooks/useInitLocalesOnce.js";
|
|
|
5
5
|
import { subscribeBookingDateChange } from "../../../../plus/salesSdk/utils/bookingDate.js";
|
|
6
6
|
import { setBookingTimeSelectionIntent } from "../../../../plus/salesSdk/utils/bookingTimeSelection.js";
|
|
7
7
|
import { useSalesSdkBookingContext } from "../../../../plus/salesSdk/context/SalesSdkBookingContext.js";
|
|
8
|
+
import "../../../../plus/salesSdk/index.js";
|
|
8
9
|
import locales_default from "../../locales/index.js";
|
|
9
10
|
import { getPosWeekStartsOn, resolvePosCountryCode } from "../../../../utils/posDateLocale.js";
|
|
10
11
|
import dayjs from "dayjs";
|
|
@@ -6,6 +6,7 @@ import { buildInitBookingContextParams, collectBookingIdsFromTempOrder } from ".
|
|
|
6
6
|
import { useSalesSdk } from "../../plus/salesSdk/hooks/useSalesSdk.js";
|
|
7
7
|
import { useSalesSdkCart } from "../../plus/salesSdk/hooks/useSalesSdkCart.js";
|
|
8
8
|
import { SalesSdkPrepareOrderSwitchContext, SalesSdkRootRefreshContext } from "../../plus/salesSdk/context/SalesSdkProvider.js";
|
|
9
|
+
import "../../plus/salesSdk/index.js";
|
|
9
10
|
import { isPersistedBigSaleOrderId } from "./utils/orderIdentity.js";
|
|
10
11
|
import { seedDineInReservationToCart } from "../../plus/pisellReservation/utils/seedDineInReservationToCart.js";
|
|
11
12
|
import BigSale from "./index.js";
|
|
@@ -4,6 +4,7 @@ import { useSalesSdkCustomer } from "../../../plus/salesSdk/hooks/useSalesSdkCus
|
|
|
4
4
|
import { useSalesSdkBookingContext } from "../../../plus/salesSdk/context/SalesSdkBookingContext.js";
|
|
5
5
|
import { useSalesSdkSummary } from "../../../plus/salesSdk/hooks/useSalesSdkSummary.js";
|
|
6
6
|
import { useSalesSdkProducts } from "../../../plus/salesSdk/hooks/useSalesSdkProducts.js";
|
|
7
|
+
import "../../../plus/salesSdk/index.js";
|
|
7
8
|
import { useMemo } from "react";
|
|
8
9
|
//#region src/components/bigSale/hooks/useBigSaleContext.ts
|
|
9
10
|
/**
|
|
@@ -3,6 +3,7 @@ import { _asyncToGenerator } from "../../../_virtual/_@oxc-project_runtime@0.122
|
|
|
3
3
|
import { buildInitBookingContextParams, collectBookingIdsFromTempOrder } from "../../../plus/salesSdk/utils/buildDefaultLoadProductsParams.js";
|
|
4
4
|
import { useSalesSdkUIHosts } from "../../../plus/salesSdk/context/SalesSdkUIHostsContext.js";
|
|
5
5
|
import { SalesSdkRootRefreshContext } from "../../../plus/salesSdk/context/SalesSdkProvider.js";
|
|
6
|
+
import "../../../plus/salesSdk/index.js";
|
|
6
7
|
import { isPersistedBigSaleOrderId } from "../utils/orderIdentity.js";
|
|
7
8
|
import { resolveOrderIdForHostActions } from "../../../plus/pisellReservation/components/bookingDetailModal/bookingDetailHostActions.js";
|
|
8
9
|
import { usePicoCodingOpenData } from "../../../plus/pisellReservation/hooks/usePicoCodingOpenData.js";
|
|
@@ -8,6 +8,7 @@ import { useSalesSdk } from "../../plus/salesSdk/hooks/useSalesSdk.js";
|
|
|
8
8
|
import { useSalesSdkCustomer } from "../../plus/salesSdk/hooks/useSalesSdkCustomer.js";
|
|
9
9
|
import { SalesSdkProvider } from "../../plus/salesSdk/context/SalesSdkProvider.js";
|
|
10
10
|
import { SalesSdkBookingContextProvider } from "../../plus/salesSdk/context/SalesSdkBookingContext.js";
|
|
11
|
+
import "../../plus/salesSdk/index.js";
|
|
11
12
|
import { resolveCustomerDetailAppearance } from "../../pro/skuDetailModal/customerDetailPolicy.js";
|
|
12
13
|
import { ResponsiveBigSaleBase } from "./Base.js";
|
|
13
14
|
import { isBigSaleProductSelectionFlowScene, resolveBigSaleSelectionFlowConfig } from "./selectionFlowConfig.js";
|
|
@@ -12,6 +12,7 @@ import { useSalesSdkBusinessAvailability } from "../../../../plus/salesSdk/conte
|
|
|
12
12
|
import { collectUnassignedHolderLines } from "../../../../plus/salesSdk/utils/holderSubmitValidation.js";
|
|
13
13
|
import { isFulfillmentTimingBooking } from "../../../../plus/salesSdk/utils/fulfillmentTimingBooking.js";
|
|
14
14
|
import { useSalesSdk } from "../../../../plus/salesSdk/hooks/useSalesSdk.js";
|
|
15
|
+
import "../../../../plus/salesSdk/index.js";
|
|
15
16
|
import { usePickSaleDetailContext } from "../../hooks/usePickSaleDetailContext.js";
|
|
16
17
|
import { resolveBigSaleAutoProductListPreferences } from "../../utils/productListPreferences.js";
|
|
17
18
|
import { resolveBigSaleProductDisplayConfig } from "../../hooks/useBigSaleProductListConfig.js";
|
|
@@ -2,6 +2,7 @@ import useEngineContext from "../../hooks/useEngineContext.js";
|
|
|
2
2
|
import { _asyncToGenerator } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
|
|
3
3
|
import { useSalesSdk } from "../../plus/salesSdk/hooks/useSalesSdk.js";
|
|
4
4
|
import { getTempOrderSyncPayload, shouldApplySharedTempOrderPayload } from "../../plus/salesSdk/tempOrderSync.js";
|
|
5
|
+
import "../../plus/salesSdk/index.js";
|
|
5
6
|
import { useEffect, useRef } from "react";
|
|
6
7
|
import { useMemoizedFn } from "ahooks";
|
|
7
8
|
//#region src/components/sharedSecondaryBigSale/SharedSecondaryBigSaleReceiver.tsx
|