@pisell/private-materials 6.12.408 → 6.12.410
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/bigSale/components/ProductList/index.js +179 -26
- package/es/components/bigSale/components/ProductListSettingsModal/index.js +5 -3
- package/es/components/bigSale/templates/Kiosk/payment/index.js +16 -0
- package/es/components/bigSale/utils/productListPreferences.js +5 -2
- package/es/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.js +9 -3
- package/es/components/checkout/components/PaymentOptionsModule/index.js +10 -2
- package/es/components/vendingMachine/README.md +1 -1
- package/es/components/venueBookingSales/BookingComposer.js +44 -8
- package/es/components/venueBookingSales/VenueBookingShared.js +1 -1
- package/es/components/venueBookingSales/VenueExitButton.js +22 -11
- package/es/components/venueBookingSales/availability/BookingSelectionPanel.js +12 -1
- package/es/components/venueBookingSales/checkout/VenueBookingHolderStep.js +6 -1
- package/es/components/venueBookingSales/checkout/useVenueReviewAccess.js +111 -0
- package/es/components/venueBookingSales/extras/VenueExtraDetailModal.js +1 -1
- package/es/components/venueBookingSales/useVenueBookingSteps.js +60 -11
- package/es/pro/bookingProductDetailModal/index.js +7 -7
- package/lib/components/bigSale/components/ProductList/index.js +179 -26
- package/lib/components/bigSale/components/ProductListSettingsModal/index.js +5 -3
- package/lib/components/bigSale/templates/Kiosk/payment/index.js +16 -0
- package/lib/components/bigSale/utils/productListPreferences.js +5 -2
- package/lib/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.js +9 -3
- package/lib/components/checkout/components/PaymentOptionsModule/index.js +10 -2
- package/lib/components/vendingMachine/README.md +1 -1
- package/lib/components/venueBookingSales/BookingComposer.js +43 -7
- package/lib/components/venueBookingSales/VenueBookingShared.js +1 -1
- package/lib/components/venueBookingSales/VenueExitButton.js +21 -10
- package/lib/components/venueBookingSales/availability/BookingSelectionPanel.js +12 -1
- package/lib/components/venueBookingSales/checkout/VenueBookingHolderStep.js +6 -1
- package/lib/components/venueBookingSales/checkout/useVenueReviewAccess.js +112 -0
- package/lib/components/venueBookingSales/extras/VenueExtraDetailModal.js +1 -1
- package/lib/components/venueBookingSales/useVenueBookingSteps.js +60 -11
- package/lib/pro/bookingProductDetailModal/index.js +7 -7
- package/package.json +2 -2
|
@@ -52,6 +52,42 @@ function getCurrentRoutePath() {
|
|
|
52
52
|
const { pathname, search, hash } = window.location;
|
|
53
53
|
return `${pathname}${search}${hash}`;
|
|
54
54
|
}
|
|
55
|
+
function getOperatorMetadata(user) {
|
|
56
|
+
var _user$id, _user$email, _user$pos_id;
|
|
57
|
+
if (!user || typeof user !== "object") return null;
|
|
58
|
+
const name = [user.staff_first_name, user.staff_last_name].filter(Boolean).join(" ").trim() || [user.first_name, user.last_name].filter(Boolean).join(" ").trim() || null;
|
|
59
|
+
const operator = {
|
|
60
|
+
id: (_user$id = user.id) !== null && _user$id !== void 0 ? _user$id : null,
|
|
61
|
+
name,
|
|
62
|
+
email: (_user$email = user.email) !== null && _user$email !== void 0 ? _user$email : null,
|
|
63
|
+
posId: (_user$pos_id = user.pos_id) !== null && _user$pos_id !== void 0 ? _user$pos_id : null
|
|
64
|
+
};
|
|
65
|
+
return Object.values(operator).some(Boolean) ? operator : null;
|
|
66
|
+
}
|
|
67
|
+
function getCurrentOperatorMetadata(engineContext) {
|
|
68
|
+
var _engineContext$appHel;
|
|
69
|
+
const utils = engineContext === null || engineContext === void 0 || (_engineContext$appHel = engineContext.appHelper) === null || _engineContext$appHel === void 0 ? void 0 : _engineContext$appHel.utils;
|
|
70
|
+
const candidates = [];
|
|
71
|
+
if (typeof (utils === null || utils === void 0 ? void 0 : utils.getData) === "function") try {
|
|
72
|
+
candidates.push(utils.getData("account"), utils.getData("customer"));
|
|
73
|
+
} catch (_unused) {}
|
|
74
|
+
let appStorage;
|
|
75
|
+
if (typeof (utils === null || utils === void 0 ? void 0 : utils.getApp) === "function") try {
|
|
76
|
+
var _utils$getApp;
|
|
77
|
+
appStorage = (_utils$getApp = utils.getApp()) === null || _utils$getApp === void 0 ? void 0 : _utils$getApp.storage;
|
|
78
|
+
} catch (_unused2) {}
|
|
79
|
+
[utils === null || utils === void 0 ? void 0 : utils.storage, appStorage].forEach((storage) => {
|
|
80
|
+
if (typeof (storage === null || storage === void 0 ? void 0 : storage.get) !== "function") return;
|
|
81
|
+
try {
|
|
82
|
+
candidates.push(storage.get("account"), storage.get("customer"));
|
|
83
|
+
} catch (_unused3) {}
|
|
84
|
+
});
|
|
85
|
+
for (const candidate of candidates) try {
|
|
86
|
+
const operator = getOperatorMetadata(typeof candidate === "string" ? JSON.parse(candidate) : candidate);
|
|
87
|
+
if (operator) return operator;
|
|
88
|
+
} catch (_unused4) {}
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
55
91
|
function resolvePhoneCartEntryQuantity(value) {
|
|
56
92
|
var _value$_extend$displa, _value$_extend;
|
|
57
93
|
const quantity = Number((_value$_extend$displa = value === null || value === void 0 || (_value$_extend = value._extend) === null || _value$_extend === void 0 ? void 0 : _value$_extend.displayQuantity) !== null && _value$_extend$displa !== void 0 ? _value$_extend$displa : value === null || value === void 0 ? void 0 : value.num);
|
|
@@ -140,7 +176,7 @@ function shouldHideSingleKioskCategoryNavigation(navigation, items) {
|
|
|
140
176
|
* 商品列表只做“加载商品 + 触发加购”,加购决策交给 salesSdk。
|
|
141
177
|
*/
|
|
142
178
|
const BigSaleProductListInner = ({ renderContent, className, renderProductCard, catalog, quantityByProductId, onSelectProduct, onQuantityChange, getProductPresentation, isActive = true, catalogPreparation, osKey, productListPreferencesChannel, mode, context, businessCode, productLoadParams, productDisplayConfig, productCatalogSessionKey, requiredOrderId, categoryResetKey, revealProductRequest, productListPreferences: controlledProductListPreferences, productListPreferencesOverride: controlledProductListPreferencesOverride, defaultProductListPreferences: controlledDefaultProductListPreferences, onProductListPreferencesChange, onProductListPreferencesReset, variant, categoryNavigation = "tabbar", defaultCategorySelection = "first", allCategoryLabel, hideSingleCategoryNavigation = false, categoryDisplayMode = "switch", persistentSearch = false, onScrollActivityChange, showActiveCategoryTitle = false, productListHeaderSlot, productSelectionTrigger = "pointerUp", productCardVersion = "v1", addToCartToastIcon, addToCartToastOptions, showSettings = true }) => {
|
|
143
|
-
var _engineContext$
|
|
179
|
+
var _engineContext$appHel2, _catalog$products, _sales$bookingTicket$, _sales$bookingTicket, _sales$bookingTicket$2, _productLoadParams$me, _sales$defaultProduct, _sales$tempOrder3;
|
|
144
180
|
const isControlledCatalog = catalog !== void 0;
|
|
145
181
|
const hasControlledActions = isControlledCatalog || quantityByProductId !== void 0 || !!onSelectProduct || !!onQuantityChange;
|
|
146
182
|
const scopeKey = catalog === null || catalog === void 0 ? void 0 : catalog.scopeKey;
|
|
@@ -151,7 +187,8 @@ const BigSaleProductListInner = ({ renderContent, className, renderProductCard,
|
|
|
151
187
|
const usesV2ProductCard = variant === "phone" && productCardVersion === "v2";
|
|
152
188
|
const Toast = (0, _pisell_materials.useToast)();
|
|
153
189
|
const engineContext = require_useEngineContext.default();
|
|
154
|
-
const getEngineData = engineContext === null || engineContext === void 0 || (_engineContext$
|
|
190
|
+
const getEngineData = engineContext === null || engineContext === void 0 || (_engineContext$appHel2 = engineContext.appHelper) === null || _engineContext$appHel2 === void 0 || (_engineContext$appHel2 = _engineContext$appHel2.utils) === null || _engineContext$appHel2 === void 0 ? void 0 : _engineContext$appHel2.getData;
|
|
191
|
+
const operator = getCurrentOperatorMetadata(engineContext);
|
|
155
192
|
const addToCartToastApi = (0, react.useMemo)(() => addToCartToastIcon ? { success: (content) => {
|
|
156
193
|
Toast.show({
|
|
157
194
|
content,
|
|
@@ -242,8 +279,60 @@ const BigSaleProductListInner = ({ renderContent, className, renderProductCard,
|
|
|
242
279
|
const [uncontrolledProductListPreferences, setUncontrolledProductListPreferences] = (0, react.useState)(() => require_productListPreferences.readBigSaleProductListPreferences(preferencesKey, defaultProductListPreferences));
|
|
243
280
|
const [uncontrolledProductListPreferencesKey, setUncontrolledProductListPreferencesKey] = (0, react.useState)(preferencesKey);
|
|
244
281
|
const [uncontrolledProductListPreferencesOverride, setUncontrolledProductListPreferencesOverride] = (0, react.useState)(() => Boolean(require_productListPreferences.readStoredBigSaleProductListPreferences(preferencesKey, defaultProductListPreferences)));
|
|
282
|
+
const productListPreferenceStorageLogRef = (0, react.useRef)();
|
|
283
|
+
const productListEntryLogRef = (0, react.useRef)();
|
|
245
284
|
const productListPreferences = controlledProductListPreferences || (uncontrolledProductListPreferencesKey === preferencesKey ? uncontrolledProductListPreferences : defaultProductListPreferences);
|
|
246
285
|
const productListPreferencesOverride = controlledProductListPreferences !== void 0 ? controlledProductListPreferencesOverride !== false : uncontrolledProductListPreferencesOverride;
|
|
286
|
+
(0, react.useEffect)(() => {
|
|
287
|
+
const metadata = {
|
|
288
|
+
eventVersion: 1,
|
|
289
|
+
action: "enter-sales-page",
|
|
290
|
+
mode,
|
|
291
|
+
businessCode: businessCode !== null && businessCode !== void 0 ? businessCode : null,
|
|
292
|
+
osKey: osKey !== null && osKey !== void 0 ? osKey : null,
|
|
293
|
+
channel: productListPreferencesChannel !== null && productListPreferencesChannel !== void 0 ? productListPreferencesChannel : null,
|
|
294
|
+
scopeKey: scopeKey !== null && scopeKey !== void 0 ? scopeKey : null,
|
|
295
|
+
variant: variant !== null && variant !== void 0 ? variant : null,
|
|
296
|
+
pathname: getCurrentRoutePath(),
|
|
297
|
+
operator,
|
|
298
|
+
storageKey: preferencesKey,
|
|
299
|
+
productListPreferencesSource: controlledProductListPreferences ? "controlled" : productListPreferencesOverride ? "local-storage" : "auto",
|
|
300
|
+
productListPreferences,
|
|
301
|
+
catalogProductCount: currentProducts.length
|
|
302
|
+
};
|
|
303
|
+
const entrySignature = JSON.stringify({
|
|
304
|
+
mode,
|
|
305
|
+
businessCode: businessCode !== null && businessCode !== void 0 ? businessCode : null,
|
|
306
|
+
osKey: osKey !== null && osKey !== void 0 ? osKey : null,
|
|
307
|
+
channel: productListPreferencesChannel !== null && productListPreferencesChannel !== void 0 ? productListPreferencesChannel : null,
|
|
308
|
+
scopeKey: scopeKey !== null && scopeKey !== void 0 ? scopeKey : null,
|
|
309
|
+
pathname: metadata.pathname
|
|
310
|
+
});
|
|
311
|
+
if (productListEntryLogRef.current === entrySignature) return;
|
|
312
|
+
productListEntryLogRef.current = entrySignature;
|
|
313
|
+
try {
|
|
314
|
+
var _logger$addLog;
|
|
315
|
+
logger === null || logger === void 0 || (_logger$addLog = logger.addLog) === null || _logger$addLog === void 0 || _logger$addLog.call(logger, {
|
|
316
|
+
type: "info",
|
|
317
|
+
title: "[BigSaleProductList] 商品列表进入销售页",
|
|
318
|
+
metadata
|
|
319
|
+
});
|
|
320
|
+
} catch (_unused5) {}
|
|
321
|
+
}, [
|
|
322
|
+
businessCode,
|
|
323
|
+
controlledProductListPreferences,
|
|
324
|
+
currentProducts.length,
|
|
325
|
+
logger,
|
|
326
|
+
mode,
|
|
327
|
+
operator,
|
|
328
|
+
osKey,
|
|
329
|
+
preferencesKey,
|
|
330
|
+
productListPreferences,
|
|
331
|
+
productListPreferencesChannel,
|
|
332
|
+
productListPreferencesOverride,
|
|
333
|
+
scopeKey,
|
|
334
|
+
variant
|
|
335
|
+
]);
|
|
247
336
|
const productListConfig = require_useBigSaleProductListConfig.useBigSaleProductListConfig({
|
|
248
337
|
products: currentProducts,
|
|
249
338
|
scopeKey,
|
|
@@ -287,11 +376,44 @@ const BigSaleProductListInner = ({ renderContent, className, renderProductCard,
|
|
|
287
376
|
setUncontrolledProductListPreferences(storedPreferences || defaultProductListPreferences);
|
|
288
377
|
setUncontrolledProductListPreferencesKey(preferencesKey);
|
|
289
378
|
setUncontrolledProductListPreferencesOverride(Boolean(storedPreferences));
|
|
379
|
+
const metadata = {
|
|
380
|
+
eventVersion: 1,
|
|
381
|
+
mode,
|
|
382
|
+
businessCode: businessCode !== null && businessCode !== void 0 ? businessCode : null,
|
|
383
|
+
osKey: osKey !== null && osKey !== void 0 ? osKey : null,
|
|
384
|
+
channel: productListPreferencesChannel !== null && productListPreferencesChannel !== void 0 ? productListPreferencesChannel : null,
|
|
385
|
+
operator,
|
|
386
|
+
variant: variant !== null && variant !== void 0 ? variant : null,
|
|
387
|
+
pathname: getCurrentRoutePath(),
|
|
388
|
+
storageKey: preferencesKey,
|
|
389
|
+
cacheHit: Boolean(storedPreferences),
|
|
390
|
+
storedPreferences: storedPreferences !== null && storedPreferences !== void 0 ? storedPreferences : null,
|
|
391
|
+
fallbackPreferences: defaultProductListPreferences
|
|
392
|
+
};
|
|
393
|
+
const signature = JSON.stringify(metadata);
|
|
394
|
+
if (productListPreferenceStorageLogRef.current !== signature) {
|
|
395
|
+
productListPreferenceStorageLogRef.current = signature;
|
|
396
|
+
try {
|
|
397
|
+
var _logger$addLog2;
|
|
398
|
+
logger === null || logger === void 0 || (_logger$addLog2 = logger.addLog) === null || _logger$addLog2 === void 0 || _logger$addLog2.call(logger, {
|
|
399
|
+
type: "info",
|
|
400
|
+
title: "[BigSaleProductList] 商品卡配置本地缓存读取",
|
|
401
|
+
metadata
|
|
402
|
+
});
|
|
403
|
+
} catch (_unused6) {}
|
|
404
|
+
}
|
|
290
405
|
}
|
|
291
406
|
}, [
|
|
407
|
+
businessCode,
|
|
292
408
|
controlledProductListPreferences,
|
|
293
409
|
defaultProductListPreferences,
|
|
294
|
-
|
|
410
|
+
logger,
|
|
411
|
+
mode,
|
|
412
|
+
osKey,
|
|
413
|
+
operator,
|
|
414
|
+
preferencesKey,
|
|
415
|
+
productListPreferencesChannel,
|
|
416
|
+
variant
|
|
295
417
|
]);
|
|
296
418
|
const productListLayoutLogRef = (0, react.useRef)();
|
|
297
419
|
(0, react.useEffect)(() => {
|
|
@@ -313,13 +435,13 @@ const BigSaleProductListInner = ({ renderContent, className, renderProductCard,
|
|
|
313
435
|
if (productListLayoutLogRef.current === signature) return;
|
|
314
436
|
productListLayoutLogRef.current = signature;
|
|
315
437
|
try {
|
|
316
|
-
var _logger$
|
|
317
|
-
logger === null || logger === void 0 || (_logger$
|
|
438
|
+
var _logger$addLog3;
|
|
439
|
+
logger === null || logger === void 0 || (_logger$addLog3 = logger.addLog) === null || _logger$addLog3 === void 0 || _logger$addLog3.call(logger, {
|
|
318
440
|
type: "info",
|
|
319
441
|
title: "[BigSaleProductList] 商品列表布局已解析",
|
|
320
442
|
metadata
|
|
321
443
|
});
|
|
322
|
-
} catch (
|
|
444
|
+
} catch (_unused7) {}
|
|
323
445
|
}, [
|
|
324
446
|
businessCode,
|
|
325
447
|
controlledProductListPreferences,
|
|
@@ -505,13 +627,13 @@ const BigSaleProductListInner = ({ renderContent, className, renderProductCard,
|
|
|
505
627
|
const productId = String((_ref6 = (_product$id = product === null || product === void 0 ? void 0 : product.id) !== null && _product$id !== void 0 ? _product$id : product === null || product === void 0 ? void 0 : product.product_id) !== null && _ref6 !== void 0 ? _ref6 : "");
|
|
506
628
|
const baselineQuantity = phoneCartProductEntries.filter((entry) => resolvePhoneCartProductId(entry.value) === productId).reduce((total, entry) => total + entry.quantity, 0);
|
|
507
629
|
try {
|
|
508
|
-
var _sales$tempOrder4, _logger$
|
|
630
|
+
var _sales$tempOrder4, _logger$addLog4, _cart$items$length, _cart$items, _cart$bookings$length, _cart$bookings, _ref7, _sales$tempOrder$orde, _sales$tempOrder5;
|
|
509
631
|
if (!(yield businessAvailability.ensureCanShop())) return;
|
|
510
632
|
if (!sales.isReady) return;
|
|
511
633
|
if (requiredOrderId !== void 0 && Number((_sales$tempOrder4 = sales.tempOrder) === null || _sales$tempOrder4 === void 0 ? void 0 : _sales$tempOrder4.order_id) !== Number(requiredOrderId)) return;
|
|
512
634
|
const latestProduct = currentProducts.find((currentProduct) => currentProduct.id === product.id);
|
|
513
635
|
latestProduct && require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, product), {}, { cartDetailValue: latestProduct.cartDetailValue });
|
|
514
|
-
logger === null || logger === void 0 || (_logger$
|
|
636
|
+
logger === null || logger === void 0 || (_logger$addLog4 = logger.addLog) === null || _logger$addLog4 === void 0 || _logger$addLog4.call(logger, {
|
|
515
637
|
type: "info",
|
|
516
638
|
title: "[BigSaleProductList] 用户点击商品卡片加入购物车",
|
|
517
639
|
metadata: {
|
|
@@ -1025,39 +1147,68 @@ const BigSaleProductListInner = ({ renderContent, className, renderProductCard,
|
|
|
1025
1147
|
setSettingsOpen(false);
|
|
1026
1148
|
});
|
|
1027
1149
|
const handleSaveSettings = (0, ahooks.useMemoizedFn)((preferences) => {
|
|
1028
|
-
require_productListPreferences.writeBigSaleProductListPreferences(preferencesKey, preferences);
|
|
1150
|
+
const cacheWriteSucceeded = require_productListPreferences.writeBigSaleProductListPreferences(preferencesKey, preferences);
|
|
1151
|
+
const persistedPreferences = cacheWriteSucceeded ? require_productListPreferences.readStoredBigSaleProductListPreferences(preferencesKey, defaultProductListPreferences) : void 0;
|
|
1029
1152
|
setUncontrolledProductListPreferences(preferences);
|
|
1030
1153
|
setUncontrolledProductListPreferencesKey(preferencesKey);
|
|
1031
1154
|
setUncontrolledProductListPreferencesOverride(true);
|
|
1155
|
+
const metadata = {
|
|
1156
|
+
eventVersion: 1,
|
|
1157
|
+
action: "save-completed",
|
|
1158
|
+
mode,
|
|
1159
|
+
businessCode: businessCode !== null && businessCode !== void 0 ? businessCode : null,
|
|
1160
|
+
osKey: osKey !== null && osKey !== void 0 ? osKey : null,
|
|
1161
|
+
channel: productListPreferencesChannel !== null && productListPreferencesChannel !== void 0 ? productListPreferencesChannel : null,
|
|
1162
|
+
operator,
|
|
1163
|
+
variant: variant !== null && variant !== void 0 ? variant : null,
|
|
1164
|
+
pathname: getCurrentRoutePath(),
|
|
1165
|
+
storageKey: preferencesKey,
|
|
1166
|
+
cacheWriteSucceeded,
|
|
1167
|
+
persistedPreferences: persistedPreferences !== null && persistedPreferences !== void 0 ? persistedPreferences : null,
|
|
1168
|
+
preferences
|
|
1169
|
+
};
|
|
1032
1170
|
try {
|
|
1033
|
-
var _logger$
|
|
1034
|
-
logger === null || logger === void 0 || (_logger$
|
|
1171
|
+
var _logger$addLog5;
|
|
1172
|
+
logger === null || logger === void 0 || (_logger$addLog5 = logger.addLog) === null || _logger$addLog5 === void 0 || _logger$addLog5.call(logger, {
|
|
1035
1173
|
type: "info",
|
|
1036
1174
|
title: "[BigSaleProductList] 商品列表布局设置已保存",
|
|
1037
|
-
metadata
|
|
1038
|
-
mode,
|
|
1039
|
-
businessCode: businessCode !== null && businessCode !== void 0 ? businessCode : null,
|
|
1040
|
-
variant: variant !== null && variant !== void 0 ? variant : null,
|
|
1041
|
-
pathname: getCurrentRoutePath(),
|
|
1042
|
-
columns: preferences.columns,
|
|
1043
|
-
cardLayoutDirection: preferences.layoutDirection,
|
|
1044
|
-
showImage: preferences.showImage,
|
|
1045
|
-
imageWidth: preferences.imageWidth,
|
|
1046
|
-
imageHeight: preferences.imageHeight
|
|
1047
|
-
}
|
|
1175
|
+
metadata
|
|
1048
1176
|
});
|
|
1049
|
-
} catch (
|
|
1177
|
+
} catch (_unused8) {}
|
|
1050
1178
|
onProductListPreferencesChange === null || onProductListPreferencesChange === void 0 || onProductListPreferencesChange(preferences);
|
|
1051
1179
|
setSettingsOpen(false);
|
|
1052
1180
|
});
|
|
1181
|
+
const handleSettingsSaveAttempt = (0, ahooks.useMemoizedFn)((preferences) => {
|
|
1182
|
+
const metadata = {
|
|
1183
|
+
eventVersion: 1,
|
|
1184
|
+
action: "save-clicked",
|
|
1185
|
+
mode,
|
|
1186
|
+
businessCode: businessCode !== null && businessCode !== void 0 ? businessCode : null,
|
|
1187
|
+
osKey: osKey !== null && osKey !== void 0 ? osKey : null,
|
|
1188
|
+
channel: productListPreferencesChannel !== null && productListPreferencesChannel !== void 0 ? productListPreferencesChannel : null,
|
|
1189
|
+
variant: variant !== null && variant !== void 0 ? variant : null,
|
|
1190
|
+
pathname: getCurrentRoutePath(),
|
|
1191
|
+
storageKey: preferencesKey,
|
|
1192
|
+
operator,
|
|
1193
|
+
preferences
|
|
1194
|
+
};
|
|
1195
|
+
try {
|
|
1196
|
+
var _logger$addLog6;
|
|
1197
|
+
logger === null || logger === void 0 || (_logger$addLog6 = logger.addLog) === null || _logger$addLog6 === void 0 || _logger$addLog6.call(logger, {
|
|
1198
|
+
type: "info",
|
|
1199
|
+
title: "[BigSaleProductList] 商品卡配置弹窗点击保存",
|
|
1200
|
+
metadata
|
|
1201
|
+
});
|
|
1202
|
+
} catch (_unused9) {}
|
|
1203
|
+
});
|
|
1053
1204
|
const handleResetSettings = (0, ahooks.useMemoizedFn)(() => {
|
|
1054
1205
|
require_productListPreferences.removeBigSaleProductListPreferences(preferencesKey);
|
|
1055
1206
|
setUncontrolledProductListPreferences(defaultProductListPreferences);
|
|
1056
1207
|
setUncontrolledProductListPreferencesKey(preferencesKey);
|
|
1057
1208
|
setUncontrolledProductListPreferencesOverride(false);
|
|
1058
1209
|
try {
|
|
1059
|
-
var _logger$
|
|
1060
|
-
logger === null || logger === void 0 || (_logger$
|
|
1210
|
+
var _logger$addLog7;
|
|
1211
|
+
logger === null || logger === void 0 || (_logger$addLog7 = logger.addLog) === null || _logger$addLog7 === void 0 || _logger$addLog7.call(logger, {
|
|
1061
1212
|
type: "info",
|
|
1062
1213
|
title: "[BigSaleProductList] 商品列表布局设置已重置",
|
|
1063
1214
|
metadata: {
|
|
@@ -1069,7 +1220,7 @@ const BigSaleProductListInner = ({ renderContent, className, renderProductCard,
|
|
|
1069
1220
|
cardLayoutDirection: defaultProductListPreferences.layoutDirection
|
|
1070
1221
|
}
|
|
1071
1222
|
});
|
|
1072
|
-
} catch (
|
|
1223
|
+
} catch (_unused10) {}
|
|
1073
1224
|
onProductListPreferencesReset === null || onProductListPreferencesReset === void 0 || onProductListPreferencesReset(defaultProductListPreferences);
|
|
1074
1225
|
setSettingsOpen(false);
|
|
1075
1226
|
});
|
|
@@ -1279,6 +1430,7 @@ const BigSaleProductListInner = ({ renderContent, className, renderProductCard,
|
|
|
1279
1430
|
variant,
|
|
1280
1431
|
fullWidthActions: categoryNavigation === "sidebar",
|
|
1281
1432
|
onCancel: handleCloseSettings,
|
|
1433
|
+
onSaveAttempt: handleSettingsSaveAttempt,
|
|
1282
1434
|
onSave: handleSaveSettings,
|
|
1283
1435
|
onSaveAuto: handleResetSettings
|
|
1284
1436
|
}) : null), [
|
|
@@ -1296,6 +1448,7 @@ const BigSaleProductListInner = ({ renderContent, className, renderProductCard,
|
|
|
1296
1448
|
handleOpenSettings,
|
|
1297
1449
|
handleResetSettings,
|
|
1298
1450
|
handleSaveSettings,
|
|
1451
|
+
handleSettingsSaveAttempt,
|
|
1299
1452
|
defaultProductListPreferences,
|
|
1300
1453
|
purchaseDisabled,
|
|
1301
1454
|
listData,
|
|
@@ -17,7 +17,7 @@ function getPlatformByVariant(variant) {
|
|
|
17
17
|
/**
|
|
18
18
|
* Big Sale 商品卡片设置弹窗,只负责编辑当前页面本地偏好。
|
|
19
19
|
*/
|
|
20
|
-
const BigSaleProductListSettingsModal = ({ open, preferences, autoPreferences, isAutoMode, variant, fullWidthActions = false, onCancel, onSave, onSaveAuto }) => {
|
|
20
|
+
const BigSaleProductListSettingsModal = ({ open, preferences, autoPreferences, isAutoMode, variant, fullWidthActions = false, onCancel, onSaveAttempt, onSave, onSaveAuto }) => {
|
|
21
21
|
const [form] = antd.Form.useForm();
|
|
22
22
|
const isPhoneVariant = variant === "phone";
|
|
23
23
|
const [preferenceMode, setPreferenceMode] = (0, react.useState)(isAutoMode ? "auto" : "custom");
|
|
@@ -46,7 +46,7 @@ const BigSaleProductListSettingsModal = ({ open, preferences, autoPreferences, i
|
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
48
|
const values = yield form.validateFields();
|
|
49
|
-
|
|
49
|
+
const nextPreferences = {
|
|
50
50
|
columns: values.columns,
|
|
51
51
|
layoutDirection: values.layoutDirection,
|
|
52
52
|
showImage: values.showImage,
|
|
@@ -58,7 +58,9 @@ const BigSaleProductListSettingsModal = ({ open, preferences, autoPreferences, i
|
|
|
58
58
|
imageHeight: values.imageHeight,
|
|
59
59
|
imageObjectFit: values.imageObjectFit,
|
|
60
60
|
saleDetailWidth: values.saleDetailWidth
|
|
61
|
-
}
|
|
61
|
+
};
|
|
62
|
+
onSaveAttempt === null || onSaveAttempt === void 0 || onSaveAttempt(nextPreferences);
|
|
63
|
+
onSave(nextPreferences);
|
|
62
64
|
});
|
|
63
65
|
return function handleSave() {
|
|
64
66
|
return _ref.apply(this, arguments);
|
|
@@ -38,6 +38,8 @@ function KioskPaymentPage({ context, checkoutPreparation, channel, onBack, onPai
|
|
|
38
38
|
const normalizedChannel = String(channel || "").trim().toLowerCase();
|
|
39
39
|
const toast = (0, _pisell_materials.useToast)();
|
|
40
40
|
const runtimeRef = (0, react.useRef)(null);
|
|
41
|
+
const paymentOptionsRef = (0, react.useRef)(null);
|
|
42
|
+
const autoPaymentAttemptedRef = (0, react.useRef)(false);
|
|
41
43
|
const preparationRef = (0, react.useRef)(checkoutPreparation);
|
|
42
44
|
const mountedRef = (0, react.useRef)(true);
|
|
43
45
|
const stateRef = (0, react.useRef)(require_transaction.hasUnresolvedDevicePayment(baseSales) ? "uncertain" : "idle");
|
|
@@ -141,6 +143,7 @@ function KioskPaymentPage({ context, checkoutPreparation, channel, onBack, onPai
|
|
|
141
143
|
if (stateRef.current !== "idle" || !runtimeRef.current) return;
|
|
142
144
|
const method = methods.find((item) => String(item.id) === String(selected.id));
|
|
143
145
|
if (!method) return;
|
|
146
|
+
autoPaymentAttemptedRef.current = true;
|
|
144
147
|
transition("paying");
|
|
145
148
|
try {
|
|
146
149
|
var _utils$businessUtils2, _utils$businessUtils3;
|
|
@@ -178,6 +181,17 @@ function KioskPaymentPage({ context, checkoutPreparation, channel, onBack, onPai
|
|
|
178
181
|
return _ref2.apply(this, arguments);
|
|
179
182
|
};
|
|
180
183
|
}());
|
|
184
|
+
(0, react.useEffect)(() => {
|
|
185
|
+
if (!["vending", "kiosk"].includes(normalizedChannel) || !ready || amount === void 0 || amount <= 0 || methods.length !== 1 || state !== "idle" || autoPaymentAttemptedRef.current || !paymentOptionsRef.current) return;
|
|
186
|
+
autoPaymentAttemptedRef.current = true;
|
|
187
|
+
paymentOptionsRef.current.activateSinglePaymentMethod();
|
|
188
|
+
}, [
|
|
189
|
+
normalizedChannel,
|
|
190
|
+
ready,
|
|
191
|
+
amount,
|
|
192
|
+
methods,
|
|
193
|
+
state
|
|
194
|
+
]);
|
|
181
195
|
const retrySync = (0, ahooks.useMemoizedFn)(require_asyncToGenerator._asyncToGenerator(function* () {
|
|
182
196
|
if (stateRef.current !== "sync-failed" || !retryRef.current) return;
|
|
183
197
|
const retry = retryRef.current;
|
|
@@ -205,6 +219,7 @@ function KioskPaymentPage({ context, checkoutPreparation, channel, onBack, onPai
|
|
|
205
219
|
const beginAuthorization = (0, ahooks.useMemoizedFn)((_source) => {
|
|
206
220
|
var _globalThis$crypto, _globalThis$crypto$ra;
|
|
207
221
|
if (stateRef.current !== "idle") return null;
|
|
222
|
+
autoPaymentAttemptedRef.current = true;
|
|
208
223
|
if (!authorizationAvailableRef.current) {
|
|
209
224
|
toast.fail(_pisell_utils.locales.getText("pisell2.checkout.self-service.empty"));
|
|
210
225
|
return null;
|
|
@@ -318,6 +333,7 @@ function KioskPaymentPage({ context, checkoutPreparation, channel, onBack, onPai
|
|
|
318
333
|
}
|
|
319
334
|
}
|
|
320
335
|
}, /* @__PURE__ */ react.default.createElement(require_index$1.default, {
|
|
336
|
+
ref: paymentOptionsRef,
|
|
321
337
|
appearance: "self-service",
|
|
322
338
|
orderInfo: { remainingAmount: String(amount !== null && amount !== void 0 ? amount : 0) },
|
|
323
339
|
paymentMethods: methods,
|
|
@@ -266,11 +266,14 @@ function readBigSaleProductListPreferences(key, defaultPreferences = DEFAULT_BIG
|
|
|
266
266
|
return readStoredBigSaleProductListPreferences(key, normalizedDefault) || normalizedDefault;
|
|
267
267
|
}
|
|
268
268
|
function writeBigSaleProductListPreferences(key, preferences) {
|
|
269
|
-
if (typeof localStorage === "undefined") return;
|
|
269
|
+
if (typeof localStorage === "undefined") return false;
|
|
270
270
|
const normalized = normalizePreferences(preferences, void 0, true);
|
|
271
271
|
try {
|
|
272
272
|
localStorage.setItem(key, JSON.stringify(normalized || DEFAULT_BIG_SALE_PRODUCT_LIST_PREFERENCES));
|
|
273
|
-
|
|
273
|
+
return true;
|
|
274
|
+
} catch (_unused2) {
|
|
275
|
+
return false;
|
|
276
|
+
}
|
|
274
277
|
}
|
|
275
278
|
function removeBigSaleProductListPreferences(key) {
|
|
276
279
|
if (typeof localStorage === "undefined") return;
|
|
@@ -16,7 +16,7 @@ let classnames = require("classnames");
|
|
|
16
16
|
classnames = require_runtime.__toESM(classnames);
|
|
17
17
|
require("./index.less");
|
|
18
18
|
//#region src/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.tsx
|
|
19
|
-
const PaymentMethodItem = ({ appearance = "default", method, amountSymbol, customAmount, disabled = false, onClick, getText, size = "default", surchargeDisplay, directCustomPayment = false, beginKioskPaymentActivity, currentBaseSales })
|
|
19
|
+
const PaymentMethodItem = react.default.forwardRef(function PaymentMethodItem({ appearance = "default", method, amountSymbol, customAmount, disabled = false, onClick, getText, size = "default", surchargeDisplay, directCustomPayment = false, beginKioskPaymentActivity, currentBaseSales }, ref) {
|
|
20
20
|
var _context$appHelper;
|
|
21
21
|
const context = require_useEngineContext.default();
|
|
22
22
|
const { getData, getApp } = (context === null || context === void 0 || (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {};
|
|
@@ -165,6 +165,12 @@ const PaymentMethodItem = ({ appearance = "default", method, amountSymbol, custo
|
|
|
165
165
|
return _ref.apply(this, arguments);
|
|
166
166
|
};
|
|
167
167
|
}();
|
|
168
|
+
const activate = () => {
|
|
169
|
+
if (disabled) return;
|
|
170
|
+
if (appearance === "self-service" && isEftpos) submitCurrentAmount();
|
|
171
|
+
else showKeyboard();
|
|
172
|
+
};
|
|
173
|
+
react.default.useImperativeHandle(ref, () => ({ activate }));
|
|
168
174
|
const renderLeftContent = () => /* @__PURE__ */ react.default.createElement("div", { className: (0, classnames.default)("payment-options-module-payment-method-left") }, appearance === "self-service" ? renderPaymentIcon(method) : /* @__PURE__ */ react.default.createElement("div", { className: (0, classnames.default)("payment-options-module-icon-container") }, renderPaymentIcon(method)), /* @__PURE__ */ react.default.createElement("div", { className: (0, classnames.default)("payment-options-module-payment-info") }, /* @__PURE__ */ react.default.createElement("div", { className: (0, classnames.default)("payment-options-module-payment-info-inner") }, /* @__PURE__ */ react.default.createElement("div", { className: (0, classnames.default)("payment-options-module-payment-name") }, method.name), /* @__PURE__ */ react.default.createElement("div", { className: (0, classnames.default)("payment-options-module-payment-info-inner-surcharge") }, !!(displaySurchargeConfig === null || displaySurchargeConfig === void 0 ? void 0 : displaySurchargeConfig.is_surcharge) && calculateSurcharge(displaySurchargeConfig) !== 0 && /* @__PURE__ */ react.default.createElement("div", { className: (0, classnames.default)("payment-options-module-surcharge-text") }, (getText === null || getText === void 0 ? void 0 : getText("pisell2.payment-options.surcharge-label", "Surcharge")) || "Surcharge", ":", (0, _pisell_utils.formatAmount)(calculateSurcharge(displaySurchargeConfig), 2, amountSymbol)), false))));
|
|
169
175
|
return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement("button", {
|
|
170
176
|
className: (0, classnames.default)("payment-options-module-payment-method-item", {
|
|
@@ -172,7 +178,7 @@ const PaymentMethodItem = ({ appearance = "default", method, amountSymbol, custo
|
|
|
172
178
|
"payment-options-module-disabled": disabled
|
|
173
179
|
}),
|
|
174
180
|
style: appearance === "self-service" ? void 0 : { height: size === "large" ? "82px" : "62px" },
|
|
175
|
-
onClick:
|
|
181
|
+
onClick: activate,
|
|
176
182
|
type: "button",
|
|
177
183
|
disabled
|
|
178
184
|
}, renderLeftContent(), appearance === "self-service" ? /* @__PURE__ */ react.default.createElement("span", {
|
|
@@ -224,6 +230,6 @@ const PaymentMethodItem = ({ appearance = "default", method, amountSymbol, custo
|
|
|
224
230
|
}
|
|
225
231
|
}
|
|
226
232
|
}));
|
|
227
|
-
};
|
|
233
|
+
});
|
|
228
234
|
//#endregion
|
|
229
235
|
exports.default = PaymentMethodItem;
|
|
@@ -13,7 +13,7 @@ classnames = require_runtime.__toESM(classnames);
|
|
|
13
13
|
let ahooks = require("ahooks");
|
|
14
14
|
require("./index.less");
|
|
15
15
|
//#region src/components/checkout/components/PaymentOptionsModule/index.tsx
|
|
16
|
-
function PaymentOptionsModule({ appearance = "default", amountSymbol, orderInfo, onClick, paymentMethods = [], customAmount, title, disabled = false, showCashPayment = false, channel = "pos", columnCount, sciSurchargeDisplayMap = {}, directCustomPayment = false, isModalOpen = false, paymentMethodsReady = false, autoTriggerSinglePaymentOption = false, beginKioskPaymentActivity, currentBaseSales }) {
|
|
16
|
+
const PaymentOptionsModule = react.default.forwardRef(function PaymentOptionsModule({ appearance = "default", amountSymbol, orderInfo, onClick, paymentMethods = [], customAmount, title, disabled = false, showCashPayment = false, channel = "pos", columnCount, sciSurchargeDisplayMap = {}, directCustomPayment = false, isModalOpen = false, paymentMethodsReady = false, autoTriggerSinglePaymentOption = false, beginKioskPaymentActivity, currentBaseSales }, ref) {
|
|
17
17
|
var _context$appHelper, _context$appHelper$ge, _context$appHelper$ge2, _context$appHelper$ut;
|
|
18
18
|
const context = require_useEngineContext.default();
|
|
19
19
|
require_useInitLocalesOnce.default(require_locales.default, ((_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 || (_context$appHelper = _context$appHelper.utils) === null || _context$appHelper === void 0 || (_context$appHelper$ge = _context$appHelper.getApp) === null || _context$appHelper$ge === void 0 || (_context$appHelper$ge = _context$appHelper$ge.call(_context$appHelper)) === null || _context$appHelper$ge === void 0 || (_context$appHelper$ge = _context$appHelper$ge.locales) === null || _context$appHelper$ge === void 0 || (_context$appHelper$ge2 = _context$appHelper$ge.getLocale) === null || _context$appHelper$ge2 === void 0 ? void 0 : _context$appHelper$ge2.call(_context$appHelper$ge)) || ((_context$appHelper$ut = context.appHelper.utils) === null || _context$appHelper$ut === void 0 || (_context$appHelper$ut = _context$appHelper$ut.storage) === null || _context$appHelper$ut === void 0 ? void 0 : _context$appHelper$ut.get("umi_locale")) || "en");
|
|
@@ -27,6 +27,13 @@ function PaymentOptionsModule({ appearance = "default", amountSymbol, orderInfo,
|
|
|
27
27
|
const normalizedChannel = String(channel || "pos").trim().toLowerCase();
|
|
28
28
|
const resolvedColumnCount = columnCount !== null && columnCount !== void 0 ? columnCount : showCashPayment ? 1 : 2;
|
|
29
29
|
const filteredPaymentMethods = react.default.useMemo(() => require_paymentMethodPolicy.filterPaymentMethodsForChannel(paymentMethods, normalizedChannel), [normalizedChannel, paymentMethods]);
|
|
30
|
+
const singleMethodRef = react.default.useRef(null);
|
|
31
|
+
react.default.useImperativeHandle(ref, () => ({ activateSinglePaymentMethod: () => {
|
|
32
|
+
if (!disabled && filteredPaymentMethods.length === 1) {
|
|
33
|
+
var _singleMethodRef$curr;
|
|
34
|
+
(_singleMethodRef$curr = singleMethodRef.current) === null || _singleMethodRef$curr === void 0 || _singleMethodRef$curr.activate();
|
|
35
|
+
}
|
|
36
|
+
} }));
|
|
30
37
|
const { run: handlePaymentClick } = (0, ahooks.useDebounceFn)((method) => {
|
|
31
38
|
if (disabled) return;
|
|
32
39
|
if (typeof onClick === "function") onClick(method);
|
|
@@ -62,6 +69,7 @@ function PaymentOptionsModule({ appearance = "default", amountSymbol, orderInfo,
|
|
|
62
69
|
paymentMethodsReady
|
|
63
70
|
]);
|
|
64
71
|
const methodItems = filteredPaymentMethods.map((method) => /* @__PURE__ */ react.default.createElement(require_PaymentMethodItem.default, {
|
|
72
|
+
ref: filteredPaymentMethods.length === 1 ? singleMethodRef : void 0,
|
|
65
73
|
appearance,
|
|
66
74
|
size: filteredPaymentMethods.length === 2 ? "large" : "default",
|
|
67
75
|
key: method.id,
|
|
@@ -93,6 +101,6 @@ function PaymentOptionsModule({ appearance = "default", amountSymbol, orderInfo,
|
|
|
93
101
|
paddingBottom: 8
|
|
94
102
|
}
|
|
95
103
|
}, methodItems)));
|
|
96
|
-
}
|
|
104
|
+
});
|
|
97
105
|
//#endregion
|
|
98
106
|
exports.default = PaymentOptionsModule;
|
|
@@ -78,7 +78,7 @@ Home 的 Redeem Socks 入口打开独立 `RedeemPage`,展示扫码指引、扫
|
|
|
78
78
|
- 购物车在 Order 的通用 `onBeforeCartCommit` 入口校验原始规则算出的草稿,不维护另一套订单合并规则;库存异常时允许减少/删除,禁止增加。未注入扩展的业务沿用既有库存与销售规则。
|
|
79
79
|
- 普通与 0 元结账都经过 SalesSdk `prepareCheckout`。本次准备凭据携带不可变 `checkoutSnapshot` 并校验提交前购物车是否变化;正常支付完成或确认完成的 0 元订单再通过 `onPaidCheckout` 交给宿主。库存请求与设备规则不写入 Kiosk 模板。
|
|
80
80
|
- 设备端购物车与支付页共用 `resolveKioskPresentation` 的 `self-service` 外观。Kiosk/Vending 待付金额大于 0 时进入 Kiosk 自身的 `payment` 页面,由 `Kiosk/payment` 负责控制,不经过 SalesSdk `openCheckout`、宿主 PaymentModalPlugin 或 PaymentModal。H5、PC 和 POS 继续使用既有支付入口;设备页的外观不再跨 SDK/宿主透传。
|
|
81
|
-
- 独立页复用公共 `PaymentMethodRuntime`、pending 支付生命周期和 BaseSales 订单 API,直接使用当前购物车/钱包。支付方式按实际 `channel` 和宿主终端偏好筛选,Vending
|
|
81
|
+
- 独立页复用公共 `PaymentMethodRuntime`、pending 支付生命周期和 BaseSales 订单 API,直接使用当前购物车/钱包。支付方式按实际 `channel` 和宿主终端偏好筛选,Vending 排除标准及自定义现金方式,也不开钱箱。Vending 与 Kiosk 支付页在方式加载及筛选完成、待付金额大于 0 且只有一种可用方式时,自动执行一次该支付卡片的操作;取消、失败或部分支付后不再次自动触发,可手动重试,退出后重新进入支付页可再次自动触发。付款结果待确认时锁定操作,已收款后的失败只重试订单同步。Kiosk 自定义支付的自动和手动入口均请求主屏授权并等候结果,不在本机直接记为已付。
|
|
82
82
|
- 仅 Vending 支付页优先复用首页初始化销售模块时已准备的支付方式;读取的是 BaseSales 当前镜像,由其原有配置变更事件更新。镜像缺失/为空时保留异步加载兜底,宿主显示偏好、排序及禁用现金规则仍每次应用。普通 Kiosk 保留原有支付方式加载路径。设备配置缓存及其失效由宿主管理,结账库存刷新和设备状态预检保持实时执行。
|
|
83
83
|
- 付款页面期间锁住销售扫码并暂停屏保,返回购物车保留原订单与券;只有明确足额支付并同步成功后,才冻结订单及原 checkoutSnapshot,再进入现有成功/出货交接。0 元仍使用原有直接确认流程,不进入支付方式页。
|
|
84
84
|
- 隐藏零元金额和显示 Confirm 由 Vending 平台决定,不依赖 `renderCatalog` 是否存在;自定义列表本身不改变其它 Kiosk/H5/PC 的金额展示规则。
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
const require_runtime = require("../../_virtual/_rolldown/runtime.js");
|
|
2
2
|
const require_objectSpread2 = require("../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
|
|
3
|
+
const require_skuSemantics = require("../../plus/skuOptionsSelection/utils/skuSemantics.js");
|
|
4
|
+
const require_prepare = require("../../pro/bookingProductDetailModal/prepare.js");
|
|
3
5
|
const require_index = require("../../pro/NumericStepper/index.js");
|
|
4
6
|
const require_index$1 = require("../../plus/multiCurrencySettlement/index.js");
|
|
7
|
+
const require_context = require("../../plus/venueBookingDesign/context.js");
|
|
5
8
|
const require_Controls = require("../../plus/venueBookingDesign/shared/Controls.js");
|
|
6
9
|
const require_presentation = require("./presentation.js");
|
|
7
10
|
const require_index$2 = require("../../pro/bookingProductDetailModal/index.js");
|
|
8
11
|
const require_BookingSelectionPanel = require("./availability/BookingSelectionPanel.js");
|
|
9
12
|
const require_useBookingComposer = require("./useBookingComposer.js");
|
|
10
13
|
const require_VenueProductIntro = require("./VenueProductIntro.js");
|
|
14
|
+
const require_usePartyConfigurationPrice = require("./usePartyConfigurationPrice.js");
|
|
11
15
|
let react = require("react");
|
|
12
16
|
react = require_runtime.__toESM(react);
|
|
13
17
|
let antd = require("antd");
|
|
@@ -16,11 +20,35 @@ decimal_js = require_runtime.__toESM(decimal_js);
|
|
|
16
20
|
//#region src/components/venueBookingSales/BookingComposer.tsx
|
|
17
21
|
/** Existing reservation view; page compositions can consume the same model independently. */
|
|
18
22
|
function BookingComposer(props) {
|
|
19
|
-
var _props$skuOptions;
|
|
23
|
+
var _draft$plan, _props$skuOptions$con, _props$skuOptions, _draft$plan2, _props$skuOptions2;
|
|
20
24
|
const { mode, draft, locale } = props;
|
|
21
25
|
const text = (en, zh) => locale === "zh" ? zh : en;
|
|
22
26
|
const model = require_useBookingComposer.useBookingComposer(props);
|
|
27
|
+
const bookingUI = require_context.useOptionalBookingUI();
|
|
23
28
|
const { configuration, setConfiguration, quantity, setQuantity, quote, error, working, revision, commit } = model;
|
|
29
|
+
const configurationDetail = mode === "tickets" && ((_draft$plan = draft.plan) === null || _draft$plan === void 0 ? void 0 : _draft$plan.hasConfiguration) ? draft.plan.productDetail : void 0;
|
|
30
|
+
const overSold = require_skuSemantics.isSkuFlagSet((_props$skuOptions$con = (_props$skuOptions = props.skuOptions) === null || _props$skuOptions === void 0 || (_props$skuOptions = _props$skuOptions.config) === null || _props$skuOptions === void 0 ? void 0 : _props$skuOptions.overSold) !== null && _props$skuOptions$con !== void 0 ? _props$skuOptions$con : draft.detail.over_sold);
|
|
31
|
+
const configurationComplete = (0, react.useMemo)(() => Boolean(configurationDetail && require_prepare.validateBookingProductConfiguration(configurationDetail, configuration.skuValue, {
|
|
32
|
+
requiredOptionValidation: props.requiredOptionValidation,
|
|
33
|
+
overSold
|
|
34
|
+
})), [
|
|
35
|
+
configurationDetail,
|
|
36
|
+
configuration.skuValue,
|
|
37
|
+
props.requiredOptionValidation,
|
|
38
|
+
overSold
|
|
39
|
+
]);
|
|
40
|
+
const configurationEstimate = require_usePartyConfigurationPrice.usePartyConfigurationPrice({
|
|
41
|
+
enabled: configurationComplete,
|
|
42
|
+
openId: (_draft$plan2 = draft.plan) === null || _draft$plan2 === void 0 ? void 0 : _draft$plan2.openId,
|
|
43
|
+
scopeKey: props.scopeKey,
|
|
44
|
+
productDetail: configurationDetail,
|
|
45
|
+
skuValue: configuration.skuValue,
|
|
46
|
+
quantity,
|
|
47
|
+
overSold,
|
|
48
|
+
timeZone: bookingUI === null || bookingUI === void 0 ? void 0 : bookingUI.timeZone,
|
|
49
|
+
customerId: props.customerId,
|
|
50
|
+
os: props.priceSource
|
|
51
|
+
});
|
|
24
52
|
const formatAmount = props.formatAmount || ((value) => {
|
|
25
53
|
var _props$context$sales$, _props$context$sales$2, _props$context$sales$3;
|
|
26
54
|
return require_index$1.formatTempOrderSettlementAmount((_props$context$sales$ = (_props$context$sales$2 = props.context.sales.bookingTicket) === null || _props$context$sales$2 === void 0 || (_props$context$sales$3 = _props$context$sales$2.getTempOrder) === null || _props$context$sales$3 === void 0 ? void 0 : _props$context$sales$3.call(_props$context$sales$2)) !== null && _props$context$sales$ !== void 0 ? _props$context$sales$ : props.context.cart.tempOrder, value);
|
|
@@ -28,6 +56,7 @@ function BookingComposer(props) {
|
|
|
28
56
|
const catalogAmount = draft.catalogStartingAmount;
|
|
29
57
|
const startingAmount = mode === "tickets" && catalogAmount !== void 0 && catalogAmount !== null && String(catalogAmount).trim() !== "" && Number.isFinite(Number(catalogAmount)) ? formatAmount(new decimal_js.default(catalogAmount).times(quantity).toString()) : void 0;
|
|
30
58
|
const quoteAmount = quote ? formatAmount(quote.compositeLineTotal) : startingAmount !== void 0 ? draft.catalogPriceQualifier === "from" ? locale === "zh" ? `${startingAmount} 起` : `From ${startingAmount}` : startingAmount : "—";
|
|
59
|
+
const configurationAmount = configurationComplete && configurationEstimate.status === "ready" ? formatAmount(configurationEstimate.subtotal) : startingAmount !== void 0 ? locale === "zh" ? `${startingAmount} 起` : `From ${startingAmount}` : "—";
|
|
31
60
|
const booking = (scrollContainer) => /* @__PURE__ */ react.default.createElement(require_BookingSelectionPanel.default, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({ ref: model.panelRef }, model.bookingProps), {}, {
|
|
32
61
|
scrollContainer,
|
|
33
62
|
renderDatePicker: props.renderDatePicker,
|
|
@@ -36,22 +65,22 @@ function BookingComposer(props) {
|
|
|
36
65
|
return (scrollContainer === null || scrollContainer === void 0 || (_scrollContainer$clos = scrollContainer.closest("[role=\"dialog\"]")) === null || _scrollContainer$clos === void 0 ? void 0 : _scrollContainer$clos.querySelector(".booking-config-actions .booking-primary-action")) || null;
|
|
37
66
|
}
|
|
38
67
|
}));
|
|
39
|
-
const quantityControl = mode === "tickets" && !draft.lineUid ? /* @__PURE__ */ react.default.createElement("div", { className: "reservation-quantity" }, /* @__PURE__ */ react.default.createElement("span", null, text("Number", "数量")), /* @__PURE__ */ react.default.createElement(require_index.default, {
|
|
68
|
+
const quantityControl = (busy = false) => mode === "tickets" && !draft.lineUid ? /* @__PURE__ */ react.default.createElement("div", { className: "reservation-quantity" }, /* @__PURE__ */ react.default.createElement("span", null, text("Number", "数量")), /* @__PURE__ */ react.default.createElement(require_index.default, {
|
|
40
69
|
className: "booking-ticket-quantity",
|
|
41
70
|
variant: "capsule",
|
|
42
71
|
min: 1,
|
|
43
72
|
step: 1,
|
|
44
73
|
value: quantity,
|
|
45
|
-
disabled: working || props.disabled,
|
|
74
|
+
disabled: busy || working || props.disabled,
|
|
46
75
|
commitInputOnClose: false,
|
|
47
76
|
selectAllInputOnOpen: true,
|
|
48
77
|
clearSelectedInputOnDelete: true,
|
|
49
78
|
ignoreEmptyInputConfirm: true,
|
|
50
79
|
onChange: (value) => {
|
|
51
|
-
if (!working && !props.disabled && Number.isSafeInteger(value) && value >= 1) setQuantity(value);
|
|
80
|
+
if (!busy && !working && !props.disabled && Number.isSafeInteger(value) && value >= 1) setQuantity(value);
|
|
52
81
|
}
|
|
53
82
|
})) : null;
|
|
54
|
-
const footer = /* @__PURE__ */ react.default.createElement("div", { className: "venue-booking-sales__booking-footer" }, quantityControl, /* @__PURE__ */ react.default.createElement("div", {
|
|
83
|
+
const footer = /* @__PURE__ */ react.default.createElement("div", { className: "venue-booking-sales__booking-footer" }, quantityControl(), /* @__PURE__ */ react.default.createElement("div", {
|
|
55
84
|
className: mode === "tickets" ? "reservation-subtotal" : "party-total",
|
|
56
85
|
"aria-live": "polite"
|
|
57
86
|
}, /* @__PURE__ */ react.default.createElement("span", null, text("Subtotal", "小计")), /* @__PURE__ */ react.default.createElement("strong", null, quoteAmount)));
|
|
@@ -68,7 +97,7 @@ function BookingComposer(props) {
|
|
|
68
97
|
}),
|
|
69
98
|
configuration,
|
|
70
99
|
onConfigurationChange: setConfiguration,
|
|
71
|
-
skuOptions: require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, props.skuOptions), {}, { priceFormatter: ((_props$
|
|
100
|
+
skuOptions: require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, props.skuOptions), {}, { priceFormatter: ((_props$skuOptions2 = props.skuOptions) === null || _props$skuOptions2 === void 0 ? void 0 : _props$skuOptions2.priceFormatter) || ((value) => String(formatAmount(value))) }),
|
|
72
101
|
requiredOptionValidation: props.requiredOptionValidation,
|
|
73
102
|
onCancel: model.cancel,
|
|
74
103
|
locale,
|
|
@@ -76,7 +105,14 @@ function BookingComposer(props) {
|
|
|
76
105
|
selectionRevision: revision,
|
|
77
106
|
error,
|
|
78
107
|
renderBooking: ({ scrollContainer }) => booking(scrollContainer),
|
|
79
|
-
footerContent: ({
|
|
108
|
+
footerContent: ({ busy }) => quantityControl(busy),
|
|
109
|
+
configurationFooter: {
|
|
110
|
+
label: text("Estimated subtotal", "预计小计"),
|
|
111
|
+
amount: /* @__PURE__ */ react.default.createElement("span", {
|
|
112
|
+
role: "status",
|
|
113
|
+
"aria-live": "polite"
|
|
114
|
+
}, configurationAmount)
|
|
115
|
+
},
|
|
80
116
|
bookingActionAmount: quoteAmount,
|
|
81
117
|
bookingReady: model.bookingReady,
|
|
82
118
|
onConfirm: commit
|
|
@@ -16,10 +16,10 @@ const require_index$2 = require("../../pro/bookingProductDetailModal/index.js");
|
|
|
16
16
|
const require_labels = require("./availability/labels.js");
|
|
17
17
|
const require_prepareProduct = require("./availability/prepareProduct.js");
|
|
18
18
|
const require_VenueProductIntro = require("./VenueProductIntro.js");
|
|
19
|
+
const require_usePartyConfigurationPrice = require("./usePartyConfigurationPrice.js");
|
|
19
20
|
const require_extraCatalogAvailability = require("./extraCatalogAvailability.js");
|
|
20
21
|
const require_holder = require("./extras/holder.js");
|
|
21
22
|
const require_orderBindings = require("./orderBindings.js");
|
|
22
|
-
const require_usePartyConfigurationPrice = require("./usePartyConfigurationPrice.js");
|
|
23
23
|
const require_VenueExtraDetailModal = require("./extras/VenueExtraDetailModal.js");
|
|
24
24
|
const require_catalogPresentation = require("./catalogPresentation.js");
|
|
25
25
|
const require_orderDisplayGroups = require("./orderDisplayGroups.js");
|