@pisell/private-materials 6.12.356 → 6.12.357
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 +64 -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/saasDevice/devicePasscodes/model.js +4 -4
- 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/plus/walletPassGallery/components/timelineSection/index.js +4 -4
- 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 +166 -0
- package/es/utils/holderConfig.js +6 -0
- package/lib/components/appointmentBooking/components/Cart/Item/index.js +63 -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 +172 -0
- package/lib/utils/holderConfig.js +7 -0
- package/package.json +2 -2
- package/es/private-materials/lowcode/authmodal/meta.d.ts +0 -1
|
@@ -3,7 +3,10 @@ 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
5
|
const require_index = require("../../../shoppingCart/index.js");
|
|
6
|
+
const require_holderConfig = require("../../../../utils/holderConfig.js");
|
|
7
|
+
const require_utils = require("../../../appointmentBooking/utils.js");
|
|
6
8
|
const require_index$1 = require("../../../subTotal/index.js");
|
|
9
|
+
const require_buildCartHolderParams = require("../../../../utils/buildCartHolderParams.js");
|
|
7
10
|
const require_orderProductIdentity = require("../../utils/orderProductIdentity.js");
|
|
8
11
|
const require_context = require("../../context.js");
|
|
9
12
|
const require_index$2 = require("../Voucher/index.js");
|
|
@@ -21,24 +24,65 @@ require("./index.less");
|
|
|
21
24
|
* 支持两种模式:embedded(桌面端内嵌)和 drawer(移动端抽屉弹出)
|
|
22
25
|
*/
|
|
23
26
|
function Cart(props) {
|
|
24
|
-
var _engineContext$appHel, _engineContext$appHel2, _engineContext$appHel3, _engineContext$engine, _businessUtils$getApp, _businessUtils$getApp2, _ref, _ref2, _ref3, _summary$total_amount, _summary$deposit3;
|
|
27
|
+
var _engineContext$appHel, _engineContext$appHel2, _engineContext$appHel3, _engineContext$engine, _engineContext$appHel4, _businessUtils$getApp, _businessUtils$getApp2, _ref, _ref2, _ref3, _summary$total_amount, _summary$deposit3;
|
|
25
28
|
const { open, onCancel, onNext, items, summary, embedded = false, confirmLoading = false, extraContent } = props;
|
|
26
|
-
const { currentStep, runModuleAction, refreshViewModel, refreshTimeSlotGrid, venueBookingModule, isAgreeDepositPolicy, setIsAgreeDepositPolicy } = require_context.useVenueBookingContext();
|
|
29
|
+
const { currentStep, runModuleAction, refreshViewModel, refreshTimeSlotGrid, venueBookingModule, isAgreeDepositPolicy, setIsAgreeDepositPolicy, isLoading, isLogin } = require_context.useVenueBookingContext();
|
|
27
30
|
const engineContext = require_useEngineContext.default();
|
|
28
31
|
const businessUtils = engineContext === null || engineContext === void 0 || (_engineContext$appHel = engineContext.appHelper) === null || _engineContext$appHel === void 0 || (_engineContext$appHel = _engineContext$appHel.utils) === null || _engineContext$appHel === void 0 ? void 0 : _engineContext$appHel.businessUtils;
|
|
29
32
|
const symbol = String((engineContext === null || engineContext === void 0 || (_engineContext$appHel2 = engineContext.appHelper) === null || _engineContext$appHel2 === void 0 || (_engineContext$appHel2 = _engineContext$appHel2.utils) === null || _engineContext$appHel2 === void 0 || (_engineContext$appHel3 = _engineContext$appHel2.getSymbolic) === null || _engineContext$appHel3 === void 0 ? void 0 : _engineContext$appHel3.call(_engineContext$appHel2)) || "$");
|
|
30
33
|
const locale = (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";
|
|
34
|
+
const [holderMap, setHolderMap] = (0, react.useState)({});
|
|
35
|
+
const { pisellos, translation } = (engineContext === null || engineContext === void 0 || (_engineContext$appHel4 = engineContext.appHelper) === null || _engineContext$appHel4 === void 0 ? void 0 : _engineContext$appHel4.utils) || {};
|
|
31
36
|
const hasGoodPassApp = !!(businessUtils === null || businessUtils === void 0 || (_businessUtils$getApp = businessUtils.getAppByModal) === null || _businessUtils$getApp === void 0 ? void 0 : _businessUtils$getApp.call(businessUtils, "goodpass"));
|
|
32
37
|
const hasDiscountCardApp = !!(businessUtils === null || businessUtils === void 0 || (_businessUtils$getApp2 = businessUtils.getAppByModal) === null || _businessUtils$getApp2 === void 0 ? void 0 : _businessUtils$getApp2.call(businessUtils, "discountcard"));
|
|
33
38
|
const showVoucher = hasGoodPassApp || hasDiscountCardApp;
|
|
39
|
+
(0, react.useEffect)(() => {
|
|
40
|
+
var _pisellos$effects;
|
|
41
|
+
const onHolderChanged = (res) => {
|
|
42
|
+
if ((res === null || res === void 0 ? void 0 : res.path) === "holderMap") setHolderMap(res === null || res === void 0 ? void 0 : res.value);
|
|
43
|
+
};
|
|
44
|
+
pisellos === null || pisellos === void 0 || (_pisellos$effects = pisellos.effects) === null || _pisellos$effects === void 0 || _pisellos$effects.on("venueBooking_holder:changed", onHolderChanged);
|
|
45
|
+
return () => {
|
|
46
|
+
var _pisellos$effects2;
|
|
47
|
+
pisellos === null || pisellos === void 0 || (_pisellos$effects2 = pisellos.effects) === null || _pisellos$effects2 === void 0 || _pisellos$effects2.off("venueBooking_holder:changed", onHolderChanged);
|
|
48
|
+
};
|
|
49
|
+
}, [pisellos]);
|
|
50
|
+
(0, react.useEffect)(() => {
|
|
51
|
+
if (isLoading || !venueBookingModule) return;
|
|
52
|
+
try {
|
|
53
|
+
var _venueBookingModule$g;
|
|
54
|
+
setHolderMap(((_venueBookingModule$g = venueBookingModule.getHolderFormMap) === null || _venueBookingModule$g === void 0 ? void 0 : _venueBookingModule$g.call(venueBookingModule)) || {});
|
|
55
|
+
} catch (error) {
|
|
56
|
+
console.warn("[venueBooking] Holder data is not ready", error);
|
|
57
|
+
setHolderMap({});
|
|
58
|
+
}
|
|
59
|
+
}, [venueBookingModule, isLoading]);
|
|
34
60
|
const isVisible = embedded || open;
|
|
35
61
|
const totalAmount = (_ref = (_ref2 = (_ref3 = (_summary$total_amount = summary === null || summary === void 0 ? void 0 : summary.total_amount) !== null && _summary$total_amount !== void 0 ? _summary$total_amount : summary === null || summary === void 0 ? void 0 : summary.expect_amount) !== null && _ref3 !== void 0 ? _ref3 : summary === null || summary === void 0 ? void 0 : summary.amount) !== null && _ref2 !== void 0 ? _ref2 : summary === null || summary === void 0 ? void 0 : summary.total) !== null && _ref !== void 0 ? _ref : "0.00";
|
|
36
62
|
const cartProducts = (0, react.useMemo)(() => {
|
|
37
|
-
return (items || []).map((item) =>
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
63
|
+
return (items || []).map((item) => {
|
|
64
|
+
var _item$_origin, _engineContext$appHel5;
|
|
65
|
+
const holderConfig = require_buildCartHolderParams.getVenueCartHolderConfig(item);
|
|
66
|
+
const holderParams = require_buildCartHolderParams.buildCartHolderParams({
|
|
67
|
+
item,
|
|
68
|
+
holderConfig,
|
|
69
|
+
formData: require_holderConfig.isHolderConfigEnabled(holderConfig) ? holderMap === null || holderMap === void 0 ? void 0 : holderMap[holderConfig === null || holderConfig === void 0 ? void 0 : holderConfig.resource_id] : {},
|
|
70
|
+
translation,
|
|
71
|
+
enabled: !!(item === null || item === void 0 || (_item$_origin = item._origin) === null || _item$_origin === void 0 || (_item$_origin = _item$_origin.product) === null || _item$_origin === void 0 ? void 0 : _item$_origin.bookingUuid),
|
|
72
|
+
utils: engineContext === null || engineContext === void 0 || (_engineContext$appHel5 = engineContext.appHelper) === null || _engineContext$appHel5 === void 0 ? void 0 : _engineContext$appHel5.utils
|
|
73
|
+
});
|
|
74
|
+
return require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, item), {}, {
|
|
75
|
+
symbol: (item === null || item === void 0 ? void 0 : item.symbol) || symbol,
|
|
76
|
+
is_hide_like: true,
|
|
77
|
+
allowClearHolder: true
|
|
78
|
+
}, holderParams);
|
|
79
|
+
});
|
|
80
|
+
}, [
|
|
81
|
+
items,
|
|
82
|
+
symbol,
|
|
83
|
+
holderMap,
|
|
84
|
+
translation
|
|
85
|
+
]);
|
|
42
86
|
const confirmOrderText = currentStep === "checkout" ? String(_pisell_utils.locales.getText("pisell2.venue.action.pay.now") || "立即支付") : String(_pisell_utils.locales.getText("pisell2.venue.action.next") || "下一步");
|
|
43
87
|
/**
|
|
44
88
|
* SubTotal 金额明细列表
|
|
@@ -46,12 +90,12 @@ function Cart(props) {
|
|
|
46
90
|
* surcharges 为服务费列表,label 支持多语言对象,按当前 locale 取值
|
|
47
91
|
*/
|
|
48
92
|
const subTotalList = (0, react.useMemo)(() => {
|
|
49
|
-
var _summary$product_amou, _summary$tax_fee, _ref4, _summary$total_amount2, _summary$deposit, _venueBookingModule$
|
|
93
|
+
var _summary$product_amou, _summary$tax_fee, _ref4, _summary$total_amount2, _summary$deposit, _venueBookingModule$g2, _tempSummary$is_price, _summary$deposit$tota, _summary$deposit2;
|
|
50
94
|
const subTotal = Number((_summary$product_amou = summary === null || summary === void 0 ? void 0 : summary.product_amount) !== null && _summary$product_amou !== void 0 ? _summary$product_amou : 0);
|
|
51
95
|
const totalTaxFee = Number((_summary$tax_fee = summary === null || summary === void 0 ? void 0 : summary.tax_fee) !== null && _summary$tax_fee !== void 0 ? _summary$tax_fee : 0);
|
|
52
96
|
const total = Number((_ref4 = (_summary$total_amount2 = summary === null || summary === void 0 ? void 0 : summary.total_amount) !== null && _summary$total_amount2 !== void 0 ? _summary$total_amount2 : summary === null || summary === void 0 ? void 0 : summary.expect_amount) !== null && _ref4 !== void 0 ? _ref4 : 0);
|
|
53
97
|
const hasDeposit = !!(summary === null || summary === void 0 || (_summary$deposit = summary.deposit) === null || _summary$deposit === void 0 ? void 0 : _summary$deposit.hasDeposit);
|
|
54
|
-
const tempOrder = venueBookingModule === null || venueBookingModule === void 0 || (_venueBookingModule$
|
|
98
|
+
const tempOrder = venueBookingModule === null || venueBookingModule === void 0 || (_venueBookingModule$g2 = venueBookingModule.getTempOrder) === null || _venueBookingModule$g2 === void 0 ? void 0 : _venueBookingModule$g2.call(venueBookingModule);
|
|
55
99
|
const tempSummary = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.summary) || {};
|
|
56
100
|
const taxTitle = String((tempSummary === null || tempSummary === void 0 ? void 0 : tempSummary.tax_title) || (summary === null || summary === void 0 ? void 0 : summary.tax_title) || "GST/Tax");
|
|
57
101
|
const rawTaxRate = Number(tempSummary === null || tempSummary === void 0 ? void 0 : tempSummary.tax_rate);
|
|
@@ -113,7 +157,57 @@ function Cart(props) {
|
|
|
113
157
|
return false;
|
|
114
158
|
};
|
|
115
159
|
const handleCartChange = function() {
|
|
116
|
-
var
|
|
160
|
+
var _ref6 = require_asyncToGenerator._asyncToGenerator(function* (item, type, sourceItem) {
|
|
161
|
+
if (type === "add_holder") {
|
|
162
|
+
var _engineContext$appHel6;
|
|
163
|
+
const holderConfig = require_buildCartHolderParams.getVenueCartHolderConfig(item);
|
|
164
|
+
if (!require_holderConfig.isHolderConfigEnabled(holderConfig)) return;
|
|
165
|
+
const formId = holderConfig === null || holderConfig === void 0 ? void 0 : holderConfig.resource_id;
|
|
166
|
+
if (!formId) return;
|
|
167
|
+
const skuRelationFormId = require_buildCartHolderParams.getSkuRelationFormId(holderMap, formId);
|
|
168
|
+
return require_utils.openForm({
|
|
169
|
+
form_id: skuRelationFormId || formId,
|
|
170
|
+
title: _pisell_utils.locales.getText("pisell2.venue.create.form"),
|
|
171
|
+
utils: engineContext === null || engineContext === void 0 || (_engineContext$appHel6 = engineContext.appHelper) === null || _engineContext$appHel6 === void 0 ? void 0 : _engineContext$appHel6.utils,
|
|
172
|
+
callback: function() {
|
|
173
|
+
var _ref5 = require_asyncToGenerator._asyncToGenerator(function* (res) {
|
|
174
|
+
if ((res === null || res === void 0 ? void 0 : res.status) === "success") {
|
|
175
|
+
var _engineContext$appHel7, _engineContext$appHel8, _item$_origin2;
|
|
176
|
+
const { formRecordId, formId: holderFormId } = require_buildCartHolderParams.handleCartHolderFormSuccess({
|
|
177
|
+
res,
|
|
178
|
+
formId,
|
|
179
|
+
skuRelationFormId,
|
|
180
|
+
utils: engineContext === null || engineContext === void 0 || (_engineContext$appHel7 = engineContext.appHelper) === null || _engineContext$appHel7 === void 0 ? void 0 : _engineContext$appHel7.utils,
|
|
181
|
+
module: venueBookingModule
|
|
182
|
+
});
|
|
183
|
+
const customer = require_utils.getCustomer(engineContext === null || engineContext === void 0 || (_engineContext$appHel8 = engineContext.appHelper) === null || _engineContext$appHel8 === void 0 ? void 0 : _engineContext$appHel8.utils);
|
|
184
|
+
venueBookingModule.setBookingHolder(item === null || item === void 0 || (_item$_origin2 = item._origin) === null || _item$_origin2 === void 0 || (_item$_origin2 = _item$_origin2.product) === null || _item$_origin2 === void 0 ? void 0 : _item$_origin2.bookingUuid, {
|
|
185
|
+
customer_id: customer === null || customer === void 0 ? void 0 : customer.id,
|
|
186
|
+
form_id: holderFormId,
|
|
187
|
+
form_record: [formRecordId]
|
|
188
|
+
});
|
|
189
|
+
yield refreshViewModel();
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
return function callback(_x) {
|
|
193
|
+
return _ref5.apply(this, arguments);
|
|
194
|
+
};
|
|
195
|
+
}()
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
if (type === "change_holder") {
|
|
199
|
+
var _engineContext$appHel9, _item$_origin3;
|
|
200
|
+
const customer = require_utils.getCustomer(engineContext === null || engineContext === void 0 || (_engineContext$appHel9 = engineContext.appHelper) === null || _engineContext$appHel9 === void 0 ? void 0 : _engineContext$appHel9.utils);
|
|
201
|
+
const holder = (sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem._origin) || sourceItem;
|
|
202
|
+
const params = !sourceItem ? null : {
|
|
203
|
+
customer_id: customer === null || customer === void 0 ? void 0 : customer.id,
|
|
204
|
+
form_id: holder === null || holder === void 0 ? void 0 : holder.form_id,
|
|
205
|
+
form_record: [holder === null || holder === void 0 ? void 0 : holder.form_record_id]
|
|
206
|
+
};
|
|
207
|
+
venueBookingModule.setBookingHolder(item === null || item === void 0 || (_item$_origin3 = item._origin) === null || _item$_origin3 === void 0 || (_item$_origin3 = _item$_origin3.product) === null || _item$_origin3 === void 0 ? void 0 : _item$_origin3.bookingUuid, params);
|
|
208
|
+
yield refreshViewModel();
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
117
211
|
if (type !== "delete") return;
|
|
118
212
|
const targetItem = sourceItem && typeof sourceItem === "object" ? sourceItem : item;
|
|
119
213
|
if (currentStep !== "select-venue" && isVenueBookingCartItem(targetItem)) {
|
|
@@ -139,8 +233,8 @@ function Cart(props) {
|
|
|
139
233
|
});
|
|
140
234
|
}
|
|
141
235
|
});
|
|
142
|
-
return function handleCartChange(
|
|
143
|
-
return
|
|
236
|
+
return function handleCartChange(_x2, _x3, _x4) {
|
|
237
|
+
return _ref6.apply(this, arguments);
|
|
144
238
|
};
|
|
145
239
|
}();
|
|
146
240
|
(0, react.useEffect)(() => {
|
|
@@ -156,9 +250,9 @@ function Cart(props) {
|
|
|
156
250
|
isShowNote: false,
|
|
157
251
|
isShowDelete: true,
|
|
158
252
|
isShowPackageNote: false,
|
|
159
|
-
isShowChangeHolder: false,
|
|
160
|
-
isShowHolder:
|
|
161
|
-
isShowAddHolderButton:
|
|
253
|
+
isShowChangeHolder: currentStep === "checkout" ? false : !!isLogin,
|
|
254
|
+
isShowHolder: true,
|
|
255
|
+
isShowAddHolderButton: true
|
|
162
256
|
},
|
|
163
257
|
platform: "h5",
|
|
164
258
|
emptyText: _pisell_utils.locales.getText("pisell2.venue.cart.empty"),
|
|
@@ -174,8 +268,8 @@ function Cart(props) {
|
|
|
174
268
|
isAgreePolicy: isAgreeDepositPolicy,
|
|
175
269
|
onChange: setIsAgreeDepositPolicy,
|
|
176
270
|
getProtocol: (id) => {
|
|
177
|
-
var _venueBookingModule$
|
|
178
|
-
return venueBookingModule === null || venueBookingModule === void 0 || (_venueBookingModule$
|
|
271
|
+
var _venueBookingModule$g3;
|
|
272
|
+
return venueBookingModule === null || venueBookingModule === void 0 || (_venueBookingModule$g3 = venueBookingModule.getProtocol) === null || _venueBookingModule$g3 === void 0 ? void 0 : _venueBookingModule$g3.call(venueBookingModule, id);
|
|
179
273
|
}
|
|
180
274
|
}) : null), extraContent ? /* @__PURE__ */ react.default.createElement("div", { className: "pisell-venue-booking-cart-extra-content" }, extraContent) : null);
|
|
181
275
|
if (embedded) return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, cartListContent, /* @__PURE__ */ react.default.createElement("div", { className: "pisell-venue-booking-cart-embedded-footer" }, cartSummaryContent, /* @__PURE__ */ react.default.createElement(_pisell_materials.Button, {
|
|
@@ -2,6 +2,7 @@ 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_buildCartHolderParams = require("../../utils/buildCartHolderParams.js");
|
|
5
6
|
const require_hooks = require("./hooks.js");
|
|
6
7
|
const require_utils = require("./utils.js");
|
|
7
8
|
let dayjs = require("dayjs");
|
|
@@ -504,13 +505,23 @@ function VenueBookingProvider({ entryContext, children }) {
|
|
|
504
505
|
} });
|
|
505
506
|
return;
|
|
506
507
|
}
|
|
508
|
+
if (currentStep === "addons") {
|
|
509
|
+
const { hasError } = require_buildCartHolderParams.validateRequiredCartHolders({
|
|
510
|
+
items: viewModel.cartItems,
|
|
511
|
+
getHolderConfig: require_buildCartHolderParams.getVenueCartHolderConfig
|
|
512
|
+
});
|
|
513
|
+
if (hasError) return;
|
|
514
|
+
}
|
|
507
515
|
goToStep("checkout");
|
|
508
516
|
}, [
|
|
509
517
|
isLogin,
|
|
510
518
|
openLoginModal,
|
|
511
519
|
handleLoginSuccess,
|
|
512
520
|
goToStep,
|
|
513
|
-
venueBookingModule
|
|
521
|
+
venueBookingModule,
|
|
522
|
+
currentStep,
|
|
523
|
+
viewModel.cartItems,
|
|
524
|
+
require_buildCartHolderParams.getVenueCartHolderConfig
|
|
514
525
|
]);
|
|
515
526
|
/** 主操作按钮行为(含登录门禁,自适应 2/3 步流程) */
|
|
516
527
|
const handlePrimaryAction = (0, react.useCallback)(() => {
|
|
@@ -546,9 +557,9 @@ function VenueBookingProvider({ entryContext, children }) {
|
|
|
546
557
|
isAgreeDepositPolicy,
|
|
547
558
|
viewModel.summary,
|
|
548
559
|
stepList,
|
|
549
|
-
proceedToCheckout,
|
|
550
560
|
goToStep,
|
|
551
|
-
handleSubmitOrder
|
|
561
|
+
handleSubmitOrder,
|
|
562
|
+
proceedToCheckout
|
|
552
563
|
]);
|
|
553
564
|
(0, react.useEffect)(() => {
|
|
554
565
|
var _pubsub$subscribe;
|
|
@@ -126,7 +126,8 @@ var locales_default = {
|
|
|
126
126
|
"pisell2.appointment.policy": "You have read and agreed to this policy",
|
|
127
127
|
"pisell2.appointment.policy.confirm": "Confirm",
|
|
128
128
|
"pisell2.appointment.booking.empty.data": "No data",
|
|
129
|
-
"pisell2.product-select.search": "Search"
|
|
129
|
+
"pisell2.product-select.search": "Search",
|
|
130
|
+
"pisell2.venue.create.form": "Create form"
|
|
130
131
|
},
|
|
131
132
|
"zh-CN": {
|
|
132
133
|
"pisell2.venue.step.select": "选择场地",
|
|
@@ -250,7 +251,8 @@ var locales_default = {
|
|
|
250
251
|
"pisell2.appointment.policy": "您已仔细阅读并同意此协议",
|
|
251
252
|
"pisell2.appointment.policy.confirm": "确定",
|
|
252
253
|
"pisell2.appointment.booking.empty.data": "暂无数据",
|
|
253
|
-
"pisell2.product-select.search": "搜索"
|
|
254
|
+
"pisell2.product-select.search": "搜索",
|
|
255
|
+
"pisell2.venue.create.form": "创建表单"
|
|
254
256
|
},
|
|
255
257
|
"zh-HK": {
|
|
256
258
|
"pisell2.venue.step.select": "選擇場地",
|
|
@@ -374,7 +376,8 @@ var locales_default = {
|
|
|
374
376
|
"pisell2.appointment.policy": "您已仔細閱讀並同意此協議",
|
|
375
377
|
"pisell2.appointment.policy.confirm": "確定",
|
|
376
378
|
"pisell2.appointment.booking.empty.data": "暫無數據",
|
|
377
|
-
"pisell2.product-select.search": "搜索"
|
|
379
|
+
"pisell2.product-select.search": "搜索",
|
|
380
|
+
"pisell2.venue.create.form": "创建表单"
|
|
378
381
|
},
|
|
379
382
|
ja: {
|
|
380
383
|
"pisell2.venue.step.select": "コートを選択",
|
|
@@ -498,7 +501,8 @@ var locales_default = {
|
|
|
498
501
|
"pisell2.appointment.policy": "このポリシーを読み、同意しました",
|
|
499
502
|
"pisell2.appointment.policy.confirm": "確認",
|
|
500
503
|
"pisell2.appointment.booking.empty.data": "データなし",
|
|
501
|
-
"pisell2.product-select.search": "検索"
|
|
504
|
+
"pisell2.product-select.search": "検索",
|
|
505
|
+
"pisell2.venue.create.form": "フォームを作成"
|
|
502
506
|
},
|
|
503
507
|
pt: {
|
|
504
508
|
"pisell2.venue.step.select": "Escolher quadra",
|
|
@@ -622,7 +626,8 @@ var locales_default = {
|
|
|
622
626
|
"pisell2.appointment.policy": "Você leu e concordou com esta política",
|
|
623
627
|
"pisell2.appointment.policy.confirm": "Confirmar",
|
|
624
628
|
"pisell2.appointment.booking.empty.data": "Sem dados",
|
|
625
|
-
"pisell2.product-select.search": "Pesquisar"
|
|
629
|
+
"pisell2.product-select.search": "Pesquisar",
|
|
630
|
+
"pisell2.venue.create.form": "Criar formulário"
|
|
626
631
|
}
|
|
627
632
|
};
|
|
628
633
|
//#endregion
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
const require_objectSpread2 = require("../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
|
|
2
|
+
const require_holderConfig = require("./holderConfig.js");
|
|
3
|
+
const require_utils = require("../components/appointmentBooking/utils.js");
|
|
4
|
+
//#region src/utils/buildCartHolderParams.ts
|
|
5
|
+
const toHolderRecordId = (value) => {
|
|
6
|
+
if (value == null || value === "") return void 0;
|
|
7
|
+
const id = Number(value);
|
|
8
|
+
return Number.isNaN(id) ? void 0 : id;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* 从 _origin.holder 解析 form_record_id。
|
|
12
|
+
* form_record 可能是 number、number[];不能假定一定是数组下标 [0]。
|
|
13
|
+
*/
|
|
14
|
+
const resolveOriginHolderId = (holder) => {
|
|
15
|
+
const formRecord = holder === null || holder === void 0 ? void 0 : holder.form_record;
|
|
16
|
+
if (Array.isArray(formRecord)) for (const value of formRecord) {
|
|
17
|
+
const id = toHolderRecordId(value);
|
|
18
|
+
if (id != null) return id;
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
const id = toHolderRecordId(formRecord);
|
|
22
|
+
if (id != null) return id;
|
|
23
|
+
}
|
|
24
|
+
return toHolderRecordId(holder === null || holder === void 0 ? void 0 : holder.form_record_id);
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* 从购物车行解析当前选中的 holder form_record_id。
|
|
28
|
+
*
|
|
29
|
+
* venueBooking:以 _origin.holder 为准(SDK 会原地更新 form_record);
|
|
30
|
+
* 顶层 item.holder_id 可能是上一轮 UI 注入或 SDK 回灌的滞后值,不能优先于 _origin.holder。
|
|
31
|
+
*/
|
|
32
|
+
const resolveCartItemHolderId = (item) => {
|
|
33
|
+
var _item$_origin;
|
|
34
|
+
const originHolder = item === null || item === void 0 || (_item$_origin = item._origin) === null || _item$_origin === void 0 ? void 0 : _item$_origin.holder;
|
|
35
|
+
if (originHolder && typeof originHolder === "object") return resolveOriginHolderId(originHolder);
|
|
36
|
+
return toHolderRecordId(item === null || item === void 0 ? void 0 : item.holder_id);
|
|
37
|
+
};
|
|
38
|
+
const getCurrentCustomerId = (utils) => {
|
|
39
|
+
var _getCustomer;
|
|
40
|
+
return (_getCustomer = require_utils.getCustomer(utils)) === null || _getCustomer === void 0 ? void 0 : _getCustomer.id;
|
|
41
|
+
};
|
|
42
|
+
const createCartHolderOption = (holder, customerId) => {
|
|
43
|
+
const _id = (holder === null || holder === void 0 ? void 0 : holder.formRecordId) || (holder === null || holder === void 0 ? void 0 : holder.form_record_id);
|
|
44
|
+
return {
|
|
45
|
+
key: _id,
|
|
46
|
+
id: _id,
|
|
47
|
+
label: holder === null || holder === void 0 ? void 0 : holder.main_field,
|
|
48
|
+
name: holder === null || holder === void 0 ? void 0 : holder.main_field,
|
|
49
|
+
username: holder === null || holder === void 0 ? void 0 : holder.main_field,
|
|
50
|
+
type: "holder",
|
|
51
|
+
_origin: require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, holder), {}, { customer_id: customerId })
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* 构建 ProductCard Holder 组件使用的单条 holder 数据。
|
|
56
|
+
* 输出字段需要与购物车 ProductCard 消费格式保持一致。
|
|
57
|
+
*/
|
|
58
|
+
const buildCartHolderOption = (holder, utils) => {
|
|
59
|
+
if (!holder) return {};
|
|
60
|
+
return createCartHolderOption(holder, getCurrentCustomerId(utils));
|
|
61
|
+
};
|
|
62
|
+
const buildCartHolderOptions = (records, utils) => {
|
|
63
|
+
const customerId = getCurrentCustomerId(utils);
|
|
64
|
+
return records.map((record) => createCartHolderOption(record, customerId));
|
|
65
|
+
};
|
|
66
|
+
const getCartHolderTitle = (records, holderId) => {
|
|
67
|
+
var _records$find;
|
|
68
|
+
if (!holderId) return "";
|
|
69
|
+
return (_records$find = records.find((record) => Number(record === null || record === void 0 ? void 0 : record.form_record_id) === holderId)) === null || _records$find === void 0 ? void 0 : _records$find.main_field;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* 根据 holderMap 与购物车行数据,构建 ProductCard 所需的 holder 展示字段。
|
|
73
|
+
* 供 appointmentBooking、venueBooking 等购物车场景复用。
|
|
74
|
+
*/
|
|
75
|
+
const buildCartHolderParams = ({ item, holderConfig = {}, formData, translation, enabled = true, utils }) => {
|
|
76
|
+
var _formData$form;
|
|
77
|
+
if (!enabled || !require_holderConfig.isHolderConfigEnabled(holderConfig)) return {
|
|
78
|
+
isShowChangeHolder: false,
|
|
79
|
+
isErrorHolder: false,
|
|
80
|
+
holders: []
|
|
81
|
+
};
|
|
82
|
+
const records = (formData === null || formData === void 0 ? void 0 : formData.records) || [];
|
|
83
|
+
const holderId = resolveCartItemHolderId(item);
|
|
84
|
+
return {
|
|
85
|
+
holder_id: holderId,
|
|
86
|
+
isErrorHolder: !!(!holderId && require_holderConfig.isHolderConfigRequired(holderConfig)),
|
|
87
|
+
isShowChangeHolder: true,
|
|
88
|
+
addHolderButtonText: translation(formData === null || formData === void 0 || (_formData$form = formData.form) === null || _formData$form === void 0 || (_formData$form = _formData$form.form) === null || _formData$form === void 0 || (_formData$form = _formData$form.setting) === null || _formData$form === void 0 ? void 0 : _formData$form.title),
|
|
89
|
+
holder_title: getCartHolderTitle(records, holderId),
|
|
90
|
+
holders: buildCartHolderOptions(records, utils)
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* 从 appointmentBooking 购物车行读取 holder_config
|
|
95
|
+
*/
|
|
96
|
+
const getAppointmentCartHolderConfig = (item) => {
|
|
97
|
+
var _item$_productInit;
|
|
98
|
+
return (item === null || item === void 0 || (_item$_productInit = item._productInit) === null || _item$_productInit === void 0 ? void 0 : _item$_productInit.holder_config) || {};
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* 从 venueBooking 购物车行读取 holder_config
|
|
102
|
+
*/
|
|
103
|
+
const getVenueCartHolderConfig = (item) => {
|
|
104
|
+
var _item$_origin2;
|
|
105
|
+
return (item === null || item === void 0 || (_item$_origin2 = item._origin) === null || _item$_origin2 === void 0 || (_item$_origin2 = _item$_origin2.product) === null || _item$_origin2 === void 0 ? void 0 : _item$_origin2.holder_config) || {};
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* 校验购物车中 holder_config.required 的行是否已选择 holder。
|
|
109
|
+
*/
|
|
110
|
+
const validateRequiredCartHolders = ({ items = [], getHolderConfig = getVenueCartHolderConfig }) => {
|
|
111
|
+
const invalidItems = items.filter((item) => {
|
|
112
|
+
if (!require_holderConfig.isHolderConfigRequired(getHolderConfig(item))) return false;
|
|
113
|
+
return !resolveCartItemHolderId(item);
|
|
114
|
+
});
|
|
115
|
+
return {
|
|
116
|
+
hasError: invalidItems.length > 0,
|
|
117
|
+
invalidItems
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* 从 holderMap 解析 minors 表单关联的 sku 关系表单 ID(form_to_form 隐藏字段的 linkedTable)。
|
|
122
|
+
*/
|
|
123
|
+
const getSkuRelationFormId = (holderMap, formId) => {
|
|
124
|
+
var _formData$form2, _formData$form3, _detail$setting;
|
|
125
|
+
if (!formId) return 0;
|
|
126
|
+
const formData = holderMap === null || holderMap === void 0 ? void 0 : holderMap[formId];
|
|
127
|
+
if ((formData === null || formData === void 0 || (_formData$form2 = formData.form) === null || _formData$form2 === void 0 || (_formData$form2 = _formData$form2.form) === null || _formData$form2 === void 0 ? void 0 : _formData$form2.form_type) !== "minors") return 0;
|
|
128
|
+
const detail = formData === null || formData === void 0 || (_formData$form3 = formData.form) === null || _formData$form3 === void 0 || (_formData$form3 = _formData$form3.field) === null || _formData$form3 === void 0 ? void 0 : _formData$form3.find((item) => (item === null || item === void 0 ? void 0 : item.filed_type) === "form_to_form" && (item === null || item === void 0 ? void 0 : item.status) === "hide");
|
|
129
|
+
return (detail === null || detail === void 0 || (_detail$setting = detail.setting) === null || _detail$setting === void 0 ? void 0 : _detail$setting.linkedTable) || 0;
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* 从 form_to_form_value 中取最新创建的 form_record_id。
|
|
133
|
+
*/
|
|
134
|
+
const getSkuRelationFormRecordId = (res) => {
|
|
135
|
+
var _res$values;
|
|
136
|
+
const formToFormValue = res === null || res === void 0 || (_res$values = res.values) === null || _res$values === void 0 || (_res$values = _res$values.form_to_form_value) === null || _res$values === void 0 ? void 0 : _res$values[0];
|
|
137
|
+
const formDataValue = (formToFormValue === null || formToFormValue === void 0 ? void 0 : formToFormValue.form_data_value) || [];
|
|
138
|
+
return formDataValue[formDataValue.length - 1];
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* 处理购物车添加 holder 表单提交成功后的公共逻辑。
|
|
142
|
+
* - minors 关联表单:刷新 holder 列表,取 form_to_form_value 中的 record id
|
|
143
|
+
* - 普通表单:appendFormRecord 并直接使用 form_record_id
|
|
144
|
+
*/
|
|
145
|
+
const handleCartHolderFormSuccess = ({ res, formId, skuRelationFormId, utils, module }) => {
|
|
146
|
+
var _res$values2, _res$values3, _res$values4;
|
|
147
|
+
let formRecordId = res === null || res === void 0 || (_res$values2 = res.values) === null || _res$values2 === void 0 ? void 0 : _res$values2.form_record_id;
|
|
148
|
+
let resolvedFormId = res === null || res === void 0 || (_res$values3 = res.values) === null || _res$values3 === void 0 ? void 0 : _res$values3.form_id;
|
|
149
|
+
if (formId && skuRelationFormId) {
|
|
150
|
+
var _module$refreshAllHol;
|
|
151
|
+
const customer = require_utils.getCustomer(utils);
|
|
152
|
+
module === null || module === void 0 || (_module$refreshAllHol = module.refreshAllHolderFormRecords) === null || _module$refreshAllHol === void 0 || _module$refreshAllHol.call(module, { customer_id: customer === null || customer === void 0 ? void 0 : customer.id });
|
|
153
|
+
formRecordId = getSkuRelationFormRecordId(res);
|
|
154
|
+
resolvedFormId = formId;
|
|
155
|
+
} else if (formId) {
|
|
156
|
+
var _module$appendFormRec;
|
|
157
|
+
module === null || module === void 0 || (_module$appendFormRec = module.appendFormRecord) === null || _module$appendFormRec === void 0 || _module$appendFormRec.call(module, { record: res === null || res === void 0 ? void 0 : res.values });
|
|
158
|
+
}
|
|
159
|
+
return {
|
|
160
|
+
formRecordId,
|
|
161
|
+
mainField: res === null || res === void 0 || (_res$values4 = res.values) === null || _res$values4 === void 0 ? void 0 : _res$values4.main_field,
|
|
162
|
+
formId: resolvedFormId
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
//#endregion
|
|
166
|
+
exports.buildCartHolderOption = buildCartHolderOption;
|
|
167
|
+
exports.buildCartHolderParams = buildCartHolderParams;
|
|
168
|
+
exports.getAppointmentCartHolderConfig = getAppointmentCartHolderConfig;
|
|
169
|
+
exports.getSkuRelationFormId = getSkuRelationFormId;
|
|
170
|
+
exports.getVenueCartHolderConfig = getVenueCartHolderConfig;
|
|
171
|
+
exports.handleCartHolderFormSuccess = handleCartHolderFormSuccess;
|
|
172
|
+
exports.validateRequiredCartHolders = validateRequiredCartHolders;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
//#region src/utils/holderConfig.ts
|
|
2
|
+
/** Holder selection requires an enabled configuration and a valid form ID. */
|
|
3
|
+
const isHolderConfigEnabled = (config) => (config === null || config === void 0 ? void 0 : config.status) === "enable" && Number.isFinite(Number(config === null || config === void 0 ? void 0 : config.resource_id)) && Number(config === null || config === void 0 ? void 0 : config.resource_id) > 0;
|
|
4
|
+
const isHolderConfigRequired = (config) => isHolderConfigEnabled(config) && Number(config === null || config === void 0 ? void 0 : config.required) === 1;
|
|
5
|
+
//#endregion
|
|
6
|
+
exports.isHolderConfigEnabled = isHolderConfigEnabled;
|
|
7
|
+
exports.isHolderConfigRequired = isHolderConfigRequired;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pisell/private-materials",
|
|
3
|
-
"version": "6.12.
|
|
3
|
+
"version": "6.12.357",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"module": "./es/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -74,9 +74,9 @@
|
|
|
74
74
|
"styled-components": "^6.0.0-rc.3",
|
|
75
75
|
"use-sync-external-store": "^1.6.0",
|
|
76
76
|
"@pisell/pi-payment-sdk": "0.0.4",
|
|
77
|
+
"@pisell/materials": "6.12.86",
|
|
77
78
|
"@pisell/utils": "3.0.7",
|
|
78
79
|
"@pisell/icon": "0.0.11",
|
|
79
|
-
"@pisell/materials": "6.12.86",
|
|
80
80
|
"@pisell/date-picker": "3.0.12"
|
|
81
81
|
},
|
|
82
82
|
"peerDependencies": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|