@pisell/private-materials 6.12.336 → 6.12.338
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 +49 -29
- package/es/components/list/List.js +17 -13
- package/es/components/list/types.d.ts +10 -0
- package/es/components/shoppingCart/hooks/usePromotionModal.js +10 -5
- package/es/components/shoppingCart/hooks/useSkuModal.js +5 -2
- package/es/components/shoppingCart/server.js +6 -4
- package/es/plus/saleDetail/hooks/useAdjustTimeModal.js +21 -5
- package/es/plus/saleDetail/locales.js +5 -0
- package/es/plus/saleDetail/utils/adjustTimeAdapter.js +8 -4
- package/es/plus/salesSdk/context/SalesSdkCartContext.js +2 -2
- package/es/plus/salesSdk/context/SalesSdkProvider.js +7 -2
- package/es/plus/salesSdk/giftSelect/buildGiftOrderProducts.js +6 -5
- package/es/plus/salesSdk/giftSelect/createOpenGiftSelectHost.js +5 -3
- package/lib/components/bigSale/components/ProductList/index.js +49 -29
- package/lib/components/list/List.js +17 -13
- package/lib/components/list/types.d.ts +10 -0
- package/lib/components/shoppingCart/hooks/usePromotionModal.js +10 -5
- package/lib/components/shoppingCart/hooks/useSkuModal.js +5 -2
- package/lib/components/shoppingCart/server.js +6 -4
- package/lib/plus/saleDetail/hooks/useAdjustTimeModal.js +20 -4
- package/lib/plus/saleDetail/locales.js +5 -0
- package/lib/plus/saleDetail/utils/adjustTimeAdapter.js +9 -3
- package/lib/plus/salesSdk/context/SalesSdkCartContext.js +2 -2
- package/lib/plus/salesSdk/context/SalesSdkProvider.js +7 -2
- package/lib/plus/salesSdk/giftSelect/buildGiftOrderProducts.js +6 -5
- package/lib/plus/salesSdk/giftSelect/createOpenGiftSelectHost.js +5 -3
- package/package.json +3 -3
|
@@ -15,6 +15,7 @@ const require_utils$1 = require("../../../ticketBooking/components/ProductDispla
|
|
|
15
15
|
const require_SalesSdkBusinessAvailabilityContext = require("../../../../plus/salesSdk/context/SalesSdkBusinessAvailabilityContext.js");
|
|
16
16
|
const require_showAddToCartToast = require("../../../../plus/salesSdk/components/showAddToCartToast.js");
|
|
17
17
|
const require_mergeBookingsForDisplay = require("../../../../plus/salesSdk/utils/mergeBookingsForDisplay.js");
|
|
18
|
+
const require_useSalesSdkGlobalScanHandler = require("../../../../plus/salesSdk/hooks/useSalesSdkGlobalScanHandler.js");
|
|
18
19
|
const require_productListPreferences = require("../../utils/productListPreferences.js");
|
|
19
20
|
const require_useBigSaleProductListConfig = require("../../hooks/useBigSaleProductListConfig.js");
|
|
20
21
|
const require_index$2 = require("../../locales/index.js");
|
|
@@ -146,6 +147,7 @@ const BigSaleProductListInner = ({ isActive = true, osKey, productListPreference
|
|
|
146
147
|
]);
|
|
147
148
|
const locale = require_useLocale.default();
|
|
148
149
|
const businessAvailability = require_SalesSdkBusinessAvailabilityContext.useSalesSdkBusinessAvailability();
|
|
150
|
+
const { handleGlobalScanCode } = require_useSalesSdkGlobalScanHandler.default({ businessCode });
|
|
149
151
|
const purchaseDisabled = businessAvailability.enabled && (businessAvailability.loading || businessAvailability.status !== "open");
|
|
150
152
|
const logger = require_useLogger.default();
|
|
151
153
|
const { sales, products, cart, customer } = context;
|
|
@@ -171,6 +173,23 @@ const BigSaleProductListInner = ({ isActive = true, osKey, productListPreference
|
|
|
171
173
|
/** Kiosk 搜索打开时的分类快照,不受 Tabbar 关闭搜索时内部 onChange 影响。 */
|
|
172
174
|
const kioskSearchCategoryTabRef = (0, react.useRef)(void 0);
|
|
173
175
|
const [settingsOpen, setSettingsOpen] = (0, react.useState)(false);
|
|
176
|
+
/**
|
|
177
|
+
* 商品分类搜索层打开时,PisellFind 会成为扫码焦点栈顶。
|
|
178
|
+
* 收到商品码后由 List 先关闭该层,再在这里直连既有全局扫码执行器,
|
|
179
|
+
* 使商品进入购物车而不是停留在「按条码文本搜索商品目录」的空结果页。
|
|
180
|
+
*/
|
|
181
|
+
const handleTabbarScannerData = (0, ahooks.useMemoizedFn)(function() {
|
|
182
|
+
var _ref3 = require_asyncToGenerator._asyncToGenerator(function* (payload) {
|
|
183
|
+
var _payload$data;
|
|
184
|
+
const code = payload === null || payload === void 0 || (_payload$data = payload.data) === null || _payload$data === void 0 ? void 0 : _payload$data.trim();
|
|
185
|
+
if (!isActive || !code || businessAvailability.isCheckoutStarted()) return;
|
|
186
|
+
if (!(yield businessAvailability.ensureCanShop())) return;
|
|
187
|
+
yield handleGlobalScanCode(code);
|
|
188
|
+
});
|
|
189
|
+
return function(_x) {
|
|
190
|
+
return _ref3.apply(this, arguments);
|
|
191
|
+
};
|
|
192
|
+
}());
|
|
174
193
|
const preferencesKey = (0, react.useMemo)(() => require_productListPreferences.buildBigSaleProductListPreferencesKey({
|
|
175
194
|
osKey,
|
|
176
195
|
mode,
|
|
@@ -318,13 +337,13 @@ const BigSaleProductListInner = ({ isActive = true, osKey, productListPreference
|
|
|
318
337
|
* handleSelectProduct(productItem);
|
|
319
338
|
*/
|
|
320
339
|
const handleSelectProduct = (0, ahooks.useMemoizedFn)(function() {
|
|
321
|
-
var
|
|
322
|
-
var
|
|
340
|
+
var _ref6 = require_asyncToGenerator._asyncToGenerator(function* (product) {
|
|
341
|
+
var _ref4, _product$id;
|
|
323
342
|
const handlesKioskToastAfterResult = productCardVersion === "v2" && !usesV2ProductCard;
|
|
324
|
-
const productId = String((
|
|
343
|
+
const productId = String((_ref4 = (_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 && _ref4 !== void 0 ? _ref4 : "");
|
|
325
344
|
const baselineQuantity = phoneCartProductEntries.filter((entry) => resolvePhoneCartProductId(entry.value) === productId).reduce((total, entry) => total + entry.quantity, 0);
|
|
326
345
|
try {
|
|
327
|
-
var _sales$tempOrder4, _logger$addLog,
|
|
346
|
+
var _sales$tempOrder4, _logger$addLog, _ref5, _sales$tempOrder$orde, _sales$tempOrder5;
|
|
328
347
|
if (!(yield businessAvailability.ensureCanShop())) return;
|
|
329
348
|
if (!sales.isReady) return;
|
|
330
349
|
if (requiredOrderId !== void 0 && Number((_sales$tempOrder4 = sales.tempOrder) === null || _sales$tempOrder4 === void 0 ? void 0 : _sales$tempOrder4.order_id) !== Number(requiredOrderId)) return;
|
|
@@ -336,7 +355,7 @@ const BigSaleProductListInner = ({ isActive = true, osKey, productListPreference
|
|
|
336
355
|
metadata: {
|
|
337
356
|
product_id: productId,
|
|
338
357
|
product_title: resolvePhoneProductTitle(product),
|
|
339
|
-
order_id: (
|
|
358
|
+
order_id: (_ref5 = (_sales$tempOrder$orde = (_sales$tempOrder5 = sales.tempOrder) === null || _sales$tempOrder5 === void 0 ? void 0 : _sales$tempOrder5.order_id) !== null && _sales$tempOrder$orde !== void 0 ? _sales$tempOrder$orde : requiredOrderId) !== null && _ref5 !== void 0 ? _ref5 : null
|
|
340
359
|
}
|
|
341
360
|
});
|
|
342
361
|
const result = yield cart.addProductWithFlow(product, {
|
|
@@ -350,8 +369,8 @@ const BigSaleProductListInner = ({ isActive = true, osKey, productListPreference
|
|
|
350
369
|
if (!require_index$1.showVirtualSettlementErrorToast(error, Toast)) console.error(error);
|
|
351
370
|
}
|
|
352
371
|
});
|
|
353
|
-
return function(
|
|
354
|
-
return
|
|
372
|
+
return function(_x2) {
|
|
373
|
+
return _ref6.apply(this, arguments);
|
|
355
374
|
};
|
|
356
375
|
}());
|
|
357
376
|
const phoneCartProductEntries = (0, react.useMemo)(() => {
|
|
@@ -365,8 +384,8 @@ const BigSaleProductListInner = ({ isActive = true, osKey, productListPreference
|
|
|
365
384
|
const productUid = resolvePhoneCartLineUid(booking === null || booking === void 0 || (_booking$_extend = booking._extend) === null || _booking$_extend === void 0 ? void 0 : _booking$_extend.product);
|
|
366
385
|
if (productUid) bookingProductUids.add(productUid);
|
|
367
386
|
((booking === null || booking === void 0 || (_booking$_extend2 = booking._extend) === null || _booking$_extend2 === void 0 ? void 0 : _booking$_extend2.mergedFrom) || []).forEach((source) => {
|
|
368
|
-
var
|
|
369
|
-
const sourceUid = (
|
|
387
|
+
var _ref7, _source$booking$produ, _source$booking, _source$booking2;
|
|
388
|
+
const sourceUid = (_ref7 = (_source$booking$produ = source === null || source === void 0 || (_source$booking = source.booking) === null || _source$booking === void 0 ? void 0 : _source$booking.product_uid) !== null && _source$booking$produ !== void 0 ? _source$booking$produ : source === null || source === void 0 || (_source$booking2 = source.booking) === null || _source$booking2 === void 0 || (_source$booking2 = _source$booking2.metadata) === null || _source$booking2 === void 0 ? void 0 : _source$booking2.product_uid) !== null && _ref7 !== void 0 ? _ref7 : resolvePhoneCartLineUid(source === null || source === void 0 ? void 0 : source.product);
|
|
370
389
|
if (sourceUid !== void 0 && sourceUid !== null && sourceUid !== "") bookingProductUids.add(String(sourceUid));
|
|
371
390
|
});
|
|
372
391
|
});
|
|
@@ -380,10 +399,10 @@ const BigSaleProductListInner = ({ isActive = true, osKey, productListPreference
|
|
|
380
399
|
quantity: resolvePhoneCartEntryQuantity(item)
|
|
381
400
|
}));
|
|
382
401
|
displayBookings.forEach((booking) => {
|
|
383
|
-
var _booking$_extend3,
|
|
402
|
+
var _booking$_extend3, _ref8, _booking$_extend$disp, _booking$_extend4, _product$_extend, _product$product_id;
|
|
384
403
|
const product = booking === null || booking === void 0 || (_booking$_extend3 = booking._extend) === null || _booking$_extend3 === void 0 ? void 0 : _booking$_extend3.product;
|
|
385
404
|
if (!product || (product === null || product === void 0 ? void 0 : product._isGiftPromotion)) return;
|
|
386
|
-
const displayQuantity = (
|
|
405
|
+
const displayQuantity = (_ref8 = (_booking$_extend$disp = booking === null || booking === void 0 || (_booking$_extend4 = booking._extend) === null || _booking$_extend4 === void 0 ? void 0 : _booking$_extend4.displayQuantity) !== null && _booking$_extend$disp !== void 0 ? _booking$_extend$disp : product === null || product === void 0 || (_product$_extend = product._extend) === null || _product$_extend === void 0 ? void 0 : _product$_extend.displayQuantity) !== null && _ref8 !== void 0 ? _ref8 : product === null || product === void 0 ? void 0 : product.num;
|
|
387
406
|
const displayValue = require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, product), {}, {
|
|
388
407
|
product_id: (_product$product_id = product === null || product === void 0 ? void 0 : product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : product === null || product === void 0 ? void 0 : product.id,
|
|
389
408
|
num: displayQuantity
|
|
@@ -427,9 +446,9 @@ const BigSaleProductListInner = ({ isActive = true, osKey, productListPreference
|
|
|
427
446
|
show();
|
|
428
447
|
});
|
|
429
448
|
const addPhoneProductWithToast = (0, ahooks.useMemoizedFn)(function() {
|
|
430
|
-
var
|
|
431
|
-
var
|
|
432
|
-
const productId = String((
|
|
449
|
+
var _ref10 = require_asyncToGenerator._asyncToGenerator(function* (product, quantity, type = "select", delayUntilModalClosed = false) {
|
|
450
|
+
var _ref9, _product$id2;
|
|
451
|
+
const productId = String((_ref9 = (_product$id2 = product === null || product === void 0 ? void 0 : product.id) !== null && _product$id2 !== void 0 ? _product$id2 : product === null || product === void 0 ? void 0 : product.product_id) !== null && _ref9 !== void 0 ? _ref9 : "");
|
|
433
452
|
const currentQuantity = phoneCartProductEntries.filter((entry) => resolvePhoneCartProductId(entry.value) === productId).reduce((total, entry) => total + entry.quantity, 0);
|
|
434
453
|
const result = yield cart.addProductWithFlow(product, {
|
|
435
454
|
type,
|
|
@@ -439,8 +458,8 @@ const BigSaleProductListInner = ({ isActive = true, osKey, productListPreference
|
|
|
439
458
|
if (result.status === "added") showPhoneProductAddedToast(product, resolveAddedProductQuantity(result.products, productId, currentQuantity + quantity), delayUntilModalClosed);
|
|
440
459
|
return result;
|
|
441
460
|
});
|
|
442
|
-
return function(
|
|
443
|
-
return
|
|
461
|
+
return function(_x3, _x4) {
|
|
462
|
+
return _ref10.apply(this, arguments);
|
|
444
463
|
};
|
|
445
464
|
}());
|
|
446
465
|
/**
|
|
@@ -451,11 +470,11 @@ const BigSaleProductListInner = ({ isActive = true, osKey, productListPreference
|
|
|
451
470
|
* 这样不会为了“判断商品类型”预先渲染抽屉,同时保留异常商品数据的兜底能力。
|
|
452
471
|
*/
|
|
453
472
|
const addPhoneQuantityProductWithToast = (0, ahooks.useMemoizedFn)(function() {
|
|
454
|
-
var
|
|
455
|
-
var
|
|
473
|
+
var _ref12 = require_asyncToGenerator._asyncToGenerator(function* (product, quantity) {
|
|
474
|
+
var _ref11, _product$id3;
|
|
456
475
|
if (!(yield businessAvailability.ensureCanShop())) return;
|
|
457
476
|
if (!require_utils.isNormalProductByDurationSchedule(product)) return addPhoneProductWithToast(product, quantity);
|
|
458
|
-
const productId = String((
|
|
477
|
+
const productId = String((_ref11 = (_product$id3 = product === null || product === void 0 ? void 0 : product.id) !== null && _product$id3 !== void 0 ? _product$id3 : product === null || product === void 0 ? void 0 : product.product_id) !== null && _ref11 !== void 0 ? _ref11 : "");
|
|
459
478
|
const result = yield cart.addProduct(product, {
|
|
460
479
|
type: "select",
|
|
461
480
|
quantity
|
|
@@ -466,12 +485,12 @@ const BigSaleProductListInner = ({ isActive = true, osKey, productListPreference
|
|
|
466
485
|
}
|
|
467
486
|
return addPhoneProductWithToast(product, quantity);
|
|
468
487
|
});
|
|
469
|
-
return function(
|
|
470
|
-
return
|
|
488
|
+
return function(_x5, _x6) {
|
|
489
|
+
return _ref12.apply(this, arguments);
|
|
471
490
|
};
|
|
472
491
|
}());
|
|
473
492
|
const handlePhoneProductCardChange = (0, ahooks.useMemoizedFn)(function() {
|
|
474
|
-
var
|
|
493
|
+
var _ref13 = require_asyncToGenerator._asyncToGenerator(function* (nextValue, _intent, meta) {
|
|
475
494
|
var _product$id4;
|
|
476
495
|
const product = meta === null || meta === void 0 ? void 0 : meta.product;
|
|
477
496
|
if (!product) return;
|
|
@@ -526,8 +545,8 @@ const BigSaleProductListInner = ({ isActive = true, osKey, productListPreference
|
|
|
526
545
|
if (!require_index$1.showVirtualSettlementErrorToast(error, Toast)) console.error(error);
|
|
527
546
|
}
|
|
528
547
|
});
|
|
529
|
-
return function(
|
|
530
|
-
return
|
|
548
|
+
return function(_x7, _x8, _x9) {
|
|
549
|
+
return _ref13.apply(this, arguments);
|
|
531
550
|
};
|
|
532
551
|
}());
|
|
533
552
|
const { data: listData, listProps: configuredListProps, skuCardAllConfig } = productListConfig;
|
|
@@ -702,9 +721,9 @@ const BigSaleProductListInner = ({ isActive = true, osKey, productListPreference
|
|
|
702
721
|
setActiveTab([]);
|
|
703
722
|
});
|
|
704
723
|
const handleKioskSearchClose = (0, ahooks.useMemoizedFn)(() => {
|
|
705
|
-
var
|
|
724
|
+
var _ref14, _kioskSearchCategoryT;
|
|
706
725
|
cancelPendingCategoryTransition();
|
|
707
|
-
const categoryTabBeforeSearch = (
|
|
726
|
+
const categoryTabBeforeSearch = (_ref14 = (_kioskSearchCategoryT = kioskSearchCategoryTabRef.current) !== null && _kioskSearchCategoryT !== void 0 ? _kioskSearchCategoryT : lastCategoryTabRef.current) !== null && _ref14 !== void 0 ? _ref14 : defaultActiveTab;
|
|
708
727
|
kioskSearchCategoryTabRef.current = void 0;
|
|
709
728
|
lastCategoryTabRef.current = categoryTabBeforeSearch;
|
|
710
729
|
setKeyword("");
|
|
@@ -766,10 +785,10 @@ const BigSaleProductListInner = ({ isActive = true, osKey, productListPreference
|
|
|
766
785
|
* Choose a price 阶段按详情 Quantity 再次校验。
|
|
767
786
|
*/
|
|
768
787
|
const resolveSettlementPriceRows = (0, ahooks.useMemoizedFn)((item) => {
|
|
769
|
-
var
|
|
788
|
+
var _ref15, _ref16, _cart$tempOrder, _sales$bookingTicket3, _sales$bookingTicket4, _ref17, _customer$selected$id, _customer$selected, _tempOrder$customer, _sales$bookingTicket5, _sales$bookingTicket6, _getEngineData, _getEngineData2, _getEngineData3;
|
|
770
789
|
if (!sales.enableMultiCurrencySettlement) return [];
|
|
771
|
-
const tempOrder = (
|
|
772
|
-
const customerId = (
|
|
790
|
+
const tempOrder = (_ref15 = (_ref16 = (_cart$tempOrder = cart.tempOrder) !== null && _cart$tempOrder !== void 0 ? _cart$tempOrder : sales.tempOrder) !== null && _ref16 !== void 0 ? _ref16 : (_sales$bookingTicket3 = sales.bookingTicket) === null || _sales$bookingTicket3 === void 0 || (_sales$bookingTicket4 = _sales$bookingTicket3.getTempOrder) === null || _sales$bookingTicket4 === void 0 ? void 0 : _sales$bookingTicket4.call(_sales$bookingTicket3)) !== null && _ref15 !== void 0 ? _ref15 : null;
|
|
791
|
+
const customerId = (_ref17 = (_customer$selected$id = (_customer$selected = customer.selected) === null || _customer$selected === void 0 ? void 0 : _customer$selected.id) !== null && _customer$selected$id !== void 0 ? _customer$selected$id : tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.customer_id) !== null && _ref17 !== void 0 ? _ref17 : tempOrder === null || tempOrder === void 0 || (_tempOrder$customer = tempOrder.customer) === null || _tempOrder$customer === void 0 ? void 0 : _tempOrder$customer.id;
|
|
773
792
|
return require_index$1.buildSettlementPriceRows({
|
|
774
793
|
product: item,
|
|
775
794
|
assets: ((_sales$bookingTicket5 = sales.bookingTicket) === null || _sales$bookingTicket5 === void 0 || (_sales$bookingTicket6 = _sales$bookingTicket5.getVirtualCurrencyList) === null || _sales$bookingTicket6 === void 0 ? void 0 : _sales$bookingTicket6.call(_sales$bookingTicket5)) || [],
|
|
@@ -850,6 +869,7 @@ const BigSaleProductListInner = ({ isActive = true, osKey, productListPreference
|
|
|
850
869
|
deferActiveTabChange: usesDeferredCategoryMotion,
|
|
851
870
|
syncAnchorOnScroll: categoryDisplayMode === "continuous" && (!Array.isArray(activeTab) || activeTab.length > 0),
|
|
852
871
|
onTabSearch: setKeyword,
|
|
872
|
+
onTabbarScannerData: handleTabbarScannerData,
|
|
853
873
|
onActiveTabChange: handleActiveTabChange,
|
|
854
874
|
loading: listShowsLoading
|
|
855
875
|
}, listProps), {}, {
|
|
@@ -88,6 +88,7 @@ const List = (props, ref) => {
|
|
|
88
88
|
const containerRef = (0, react.useRef)(null);
|
|
89
89
|
const tabbarRef = (0, react.useRef)(null);
|
|
90
90
|
const template1tabbarRef = (0, react.useRef)(null);
|
|
91
|
+
const onTabbarScannerData = props.onTabbarScannerData;
|
|
91
92
|
const headerRef = (0, react.useRef)(null);
|
|
92
93
|
const visibleActiveTabRef = (0, react.useRef)(activeTab);
|
|
93
94
|
visibleActiveTabRef.current = activeTab;
|
|
@@ -95,20 +96,23 @@ const List = (props, ref) => {
|
|
|
95
96
|
* BigSale 的分类 Tabbar 搜索弹层复用 ComprehensiveSearch 输入栏。
|
|
96
97
|
* 保持 PisellFind 默认的实时搜索模式:不展示搜索按钮,输入变化仍由 Lookup 内部防抖触发。
|
|
97
98
|
*/
|
|
98
|
-
const tabbarSearchProps = (0, react.useMemo)(() => ({
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
99
|
+
const tabbarSearchProps = (0, react.useMemo)(() => require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({ enableScanner: true }, onTabbarScannerData ? { onScannerData: (payload) => {
|
|
100
|
+
var _ref, _ref$closeSearchMode;
|
|
101
|
+
const data = payload === null || payload === void 0 ? void 0 : payload.data;
|
|
102
|
+
if (typeof data !== "string" || data.length === 0) return;
|
|
103
|
+
(_ref = tabbarRef.current || template1tabbarRef.current) === null || _ref === void 0 || (_ref$closeSearchMode = _ref.closeSearchMode) === null || _ref$closeSearchMode === void 0 || _ref$closeSearchMode.call(_ref);
|
|
104
|
+
onTabbarScannerData(payload);
|
|
105
|
+
} } : {}), {}, { inputRender: (ctx) => /* @__PURE__ */ react.default.createElement(require_index.default, {
|
|
106
|
+
ctx,
|
|
107
|
+
showSearchButton: false,
|
|
108
|
+
searchSectionProps: {
|
|
109
|
+
className: "pisell-list-tabbar-search-section",
|
|
110
|
+
style: {
|
|
111
|
+
flex: 1,
|
|
112
|
+
minWidth: 0
|
|
109
113
|
}
|
|
110
|
-
}
|
|
111
|
-
}), []);
|
|
114
|
+
}
|
|
115
|
+
}) }), [onTabbarScannerData]);
|
|
112
116
|
const matchesFieldValue = (fieldValue, targetValue) => {
|
|
113
117
|
if (Array.isArray(fieldValue)) return fieldValue.includes(targetValue);
|
|
114
118
|
return fieldValue === targetValue;
|
|
@@ -167,6 +167,16 @@ interface ListProps<TItem extends BaseListItem = BaseListItem> {
|
|
|
167
167
|
};
|
|
168
168
|
renderSearch?: () => ReactNode;
|
|
169
169
|
onTabSearch?: (val: string) => void;
|
|
170
|
+
/**
|
|
171
|
+
* 分类 Tabbar 搜索层收到硬件扫码后的业务接管入口。
|
|
172
|
+
*
|
|
173
|
+
* List 会先关闭搜索层并释放扫码焦点,再调用此回调;适用于扫码应直接
|
|
174
|
+
* 进入商品加购链路、而不是把条码当作目录关键字搜索的销售页。
|
|
175
|
+
*/
|
|
176
|
+
onTabbarScannerData?: (payload: {
|
|
177
|
+
code: string;
|
|
178
|
+
data: string;
|
|
179
|
+
}) => void;
|
|
170
180
|
onActiveTabChange?: (tab: ListTabValue, source?: ListActiveTabChangeSource) => void;
|
|
171
181
|
}
|
|
172
182
|
interface TabItem {
|
|
@@ -25,9 +25,10 @@ const FALLBACK_RESPONSIVE_INFO = {
|
|
|
25
25
|
};
|
|
26
26
|
const useFallbackResponsive = () => FALLBACK_RESPONSIVE_INFO;
|
|
27
27
|
const usePromotionModal = (options) => {
|
|
28
|
-
var _context$appHelper, _context$
|
|
28
|
+
var _context$appHelper, _context$appHelper2, _context$appHelper2$g, _responsive$hooks;
|
|
29
29
|
const context = require_useEngineContext.default();
|
|
30
|
-
const
|
|
30
|
+
const apiPrefix = (context === null || context === void 0 || (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 || (_context$appHelper = _context$appHelper.constants) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.apiPrefix) || "/shop";
|
|
31
|
+
const app = context === null || context === void 0 || (_context$appHelper2 = context.appHelper) === null || _context$appHelper2 === void 0 || (_context$appHelper2 = _context$appHelper2.utils) === null || _context$appHelper2 === void 0 || (_context$appHelper2$g = _context$appHelper2.getApp) === null || _context$appHelper2$g === void 0 ? void 0 : _context$appHelper2$g.call(_context$appHelper2);
|
|
31
32
|
const responsive = app === null || app === void 0 ? void 0 : app.responsive;
|
|
32
33
|
const responsiveInfo = (typeof (responsive === null || responsive === void 0 || (_responsive$hooks = responsive.hooks) === null || _responsive$hooks === void 0 ? void 0 : _responsive$hooks.useResponsive) === "function" ? responsive.hooks.useResponsive : useFallbackResponsive)() || FALLBACK_RESPONSIVE_INFO;
|
|
33
34
|
const currentVariant = responsiveInfo.currentBreakpoint || responsiveInfo.deviceType || "desktop";
|
|
@@ -78,7 +79,10 @@ const usePromotionModal = (options) => {
|
|
|
78
79
|
suppressProductSelectSkuOpenRef.current = false;
|
|
79
80
|
});
|
|
80
81
|
}, [currentItem, selected]);
|
|
81
|
-
const { SkuModal } = require_useSkuModal.useSkuModal({
|
|
82
|
+
const { SkuModal } = require_useSkuModal.useSkuModal({
|
|
83
|
+
onConfirm: handleSkuConfirmCallback,
|
|
84
|
+
apiPrefix
|
|
85
|
+
});
|
|
82
86
|
/**
|
|
83
87
|
* @description: 获取商品列表请求
|
|
84
88
|
* @return {*}
|
|
@@ -115,11 +119,12 @@ const usePromotionModal = (options) => {
|
|
|
115
119
|
getProductsRequest.run({
|
|
116
120
|
ids: (item === null || item === void 0 || (_item$products2 = item.products) === null || _item$products2 === void 0 ? void 0 : _item$products2.map((option) => option.product_id)) || [],
|
|
117
121
|
isGift: !!(item === null || item === void 0 ? void 0 : item.isGift),
|
|
118
|
-
schedule_date: date
|
|
122
|
+
schedule_date: date,
|
|
123
|
+
apiPrefix
|
|
119
124
|
});
|
|
120
125
|
}
|
|
121
126
|
setOpen(true);
|
|
122
|
-
}, [getProductsRequest]);
|
|
127
|
+
}, [getProductsRequest, apiPrefix]);
|
|
123
128
|
/**
|
|
124
129
|
* @description: 关闭营销弹窗
|
|
125
130
|
* @param {*} useCallback
|
|
@@ -57,8 +57,11 @@ const useSkuModal = (options) => {
|
|
|
57
57
|
setSkuValue((product === null || product === void 0 ? void 0 : product._skuValue) || require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, defaultSkuValue), {}, { product_id: (_ref = (_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 && _ref !== void 0 ? _ref : 0 }));
|
|
58
58
|
setEditingSku(Boolean(product === null || product === void 0 ? void 0 : product._skuValue));
|
|
59
59
|
setSkuModalOpen(true);
|
|
60
|
-
getProductDetailRequest.run({
|
|
61
|
-
|
|
60
|
+
getProductDetailRequest.run({
|
|
61
|
+
id: product === null || product === void 0 ? void 0 : product.id,
|
|
62
|
+
apiPrefix: options === null || options === void 0 ? void 0 : options.apiPrefix
|
|
63
|
+
});
|
|
64
|
+
}, [getProductDetailRequest, options === null || options === void 0 ? void 0 : options.apiPrefix]);
|
|
62
65
|
/**
|
|
63
66
|
* @description: 关闭 SKU 选择弹窗
|
|
64
67
|
*/
|
|
@@ -4,7 +4,7 @@ const require_index = require("../../utils/index.js");
|
|
|
4
4
|
//#region src/components/shoppingCart/server.ts
|
|
5
5
|
const getProducts = function() {
|
|
6
6
|
var _ref = require_asyncToGenerator._asyncToGenerator(function* (params) {
|
|
7
|
-
const { ids, isGift = false, schedule_date } = params;
|
|
7
|
+
const { ids, isGift = false, schedule_date, apiPrefix = "/shop" } = params;
|
|
8
8
|
const queryParams = {
|
|
9
9
|
skip: 1,
|
|
10
10
|
num: (ids === null || ids === void 0 ? void 0 : ids.length) || 100,
|
|
@@ -38,7 +38,7 @@ const getProducts = function() {
|
|
|
38
38
|
"variantGroup.variantItem"
|
|
39
39
|
]
|
|
40
40
|
};
|
|
41
|
-
let { data } = yield require_index.request.getRequest().post("/
|
|
41
|
+
let { data } = yield require_index.request.getRequest().post(`${apiPrefix.replace(/\/+$/, "")}/product/query`, queryParams, {
|
|
42
42
|
fullResult: true,
|
|
43
43
|
useCache: true
|
|
44
44
|
});
|
|
@@ -86,9 +86,11 @@ const getProducts = function() {
|
|
|
86
86
|
}();
|
|
87
87
|
const getProductDetail = function() {
|
|
88
88
|
var _ref2 = require_asyncToGenerator._asyncToGenerator(function* (params) {
|
|
89
|
-
const { id, is_eject = 1 } = params;
|
|
89
|
+
const { id, is_eject = 1, apiPrefix = "/shop" } = params;
|
|
90
|
+
const prefix = apiPrefix.replace(/\/+$/, "");
|
|
91
|
+
const detailPath = prefix === "/h5" ? "show" : "query";
|
|
90
92
|
const queryParams = { is_eject };
|
|
91
|
-
let { data } = yield require_index.request.getRequest().get(
|
|
93
|
+
let { data } = yield require_index.request.getRequest().get(`${prefix}/product/${detailPath}/${id}`, queryParams, {
|
|
92
94
|
fullResult: true,
|
|
93
95
|
useCache: true
|
|
94
96
|
});
|
|
@@ -21,6 +21,7 @@ dayjs = require_runtime.__toESM(dayjs);
|
|
|
21
21
|
let react = require("react");
|
|
22
22
|
react = require_runtime.__toESM(react);
|
|
23
23
|
let antd = require("antd");
|
|
24
|
+
let _pisell_utils = require("@pisell/utils");
|
|
24
25
|
let decimal_js = require("decimal.js");
|
|
25
26
|
decimal_js = require_runtime.__toESM(decimal_js);
|
|
26
27
|
let lodash = require("lodash");
|
|
@@ -343,6 +344,19 @@ function useAdjustTimeModal(options) {
|
|
|
343
344
|
return acc;
|
|
344
345
|
}, []);
|
|
345
346
|
}, []);
|
|
347
|
+
/** 在任何逐票写入前整组校验,也阻止重新选票前的旧结果被提交。 */
|
|
348
|
+
const assertAddTimeProductsUsable = (0, ahooks.useMemoizedFn)((result) => {
|
|
349
|
+
if (result.actionType === "restart" || result.actionType === "changeTime") return;
|
|
350
|
+
const cacheItems = selectedBookings.map(resolveCacheItem);
|
|
351
|
+
const usableProductIds = new Set(products.filter((product) => require_adjustTimeAdapter.isSaleDetailAddTimeProductUsableForBookings(product._originalProduct, cacheItems)).map((product) => String(product.id)));
|
|
352
|
+
const lines = buildPreviewAddTimeLines(result);
|
|
353
|
+
const invalidSelectedProduct = result.actionType === "product" && (result.selectedProductId == null || !usableProductIds.has(String(result.selectedProductId)));
|
|
354
|
+
const invalidLines = lines.length !== (result.autoPricing.lines || []).length || lines.some((line) => {
|
|
355
|
+
var _line$product$id;
|
|
356
|
+
return !usableProductIds.has(String((_line$product$id = line.product.id) !== null && _line$product$id !== void 0 ? _line$product$id : line.product.product_id)) || !require_adjustTimeAdapter.isSaleDetailAddTimeProductUsableForBookings(line.product, cacheItems);
|
|
357
|
+
});
|
|
358
|
+
if (invalidSelectedProduct || invalidLines) throw new Error(_pisell_utils.locales.getText("pisell2.sale-detail.add-time-products-not-applicable"));
|
|
359
|
+
});
|
|
346
360
|
const buildChangeTimePreviewQueries = (0, ahooks.useMemoizedFn)((result) => {
|
|
347
361
|
var _bookingTicket$getTem, _bookingTicket$getTem2;
|
|
348
362
|
const bookingTicket = sales === null || sales === void 0 ? void 0 : sales.bookingTicket;
|
|
@@ -424,6 +438,7 @@ function useAdjustTimeModal(options) {
|
|
|
424
438
|
return;
|
|
425
439
|
}
|
|
426
440
|
const addTimeLines = buildPreviewAddTimeLines(result);
|
|
441
|
+
assertAddTimeProductsUsable(result);
|
|
427
442
|
if (!addTimeLines.length) return;
|
|
428
443
|
for (const selectedBooking of selectedBookings) yield salesSdkCart.addAddTimeProducts({
|
|
429
444
|
booking: selectedBooking,
|
|
@@ -524,7 +539,7 @@ function useAdjustTimeModal(options) {
|
|
|
524
539
|
yield ensureAdjustTimeResourcesReady(sales, primaryItem);
|
|
525
540
|
const cacheItem = resolveCacheItem(primaryItem);
|
|
526
541
|
const quotationSchedule = resolveBookingQuotationSchedule(primaryItem, cacheItem);
|
|
527
|
-
const mappedProducts = require_adjustTimeAdapter.
|
|
542
|
+
const mappedProducts = require_adjustTimeAdapter.mapSaleDetailAdjustTimeProductsForBookings((quotationSchedule.schedule_date ? yield getAddTimeProductsWithCache(quotationSchedule) : rawAddTimeProducts) || [], items.map(resolveCacheItem));
|
|
528
543
|
const relationId = (_ref17 = (_cacheItem$_extend$re = cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend3 = cacheItem._extend) === null || _cacheItem$_extend3 === void 0 ? void 0 : _cacheItem$_extend3.relation_id) !== null && _cacheItem$_extend$re !== void 0 ? _cacheItem$_extend$re : (_primaryItem$resource = primaryItem.resources) === null || _primaryItem$resource === void 0 || (_primaryItem$resource = _primaryItem$resource[0]) === null || _primaryItem$resource === void 0 ? void 0 : _primaryItem$resource.relation_id) !== null && _ref17 !== void 0 ? _ref17 : primaryItem.relation_id;
|
|
529
544
|
const resourcesOrigin = (booking === null || booking === void 0 || (_booking$getResources = booking.getResourcesOrigin) === null || _booking$getResources === void 0 ? void 0 : _booking$getResources.call(booking)) || [];
|
|
530
545
|
const nextSnapshot = combineBookingSnapshots(items.map((item) => require_adjustTimeAdapter.mapSaleDetailAdjustTimeBooking(item, resolveCacheItem(item))));
|
|
@@ -657,14 +672,15 @@ function useAdjustTimeModal(options) {
|
|
|
657
672
|
* await submitAdjustTimeResult(result, 'save');
|
|
658
673
|
*/
|
|
659
674
|
const submitAdjustTimeResult = (0, ahooks.useMemoizedFn)(function() {
|
|
660
|
-
var _ref24 = require_asyncToGenerator._asyncToGenerator(function* (
|
|
675
|
+
var _ref24 = require_asyncToGenerator._asyncToGenerator(function* (result, mode) {
|
|
661
676
|
if (!selectedBookings.length) return;
|
|
662
677
|
try {
|
|
678
|
+
yield previewQueueRef.current;
|
|
679
|
+
yield salesSdkCart.waitForCartConsistency();
|
|
680
|
+
assertAddTimeProductsUsable(result);
|
|
663
681
|
if (yield function() {
|
|
664
682
|
var _ref23 = require_asyncToGenerator._asyncToGenerator(function* () {
|
|
665
683
|
if (mode === "checkout") {
|
|
666
|
-
yield previewQueueRef.current;
|
|
667
|
-
yield salesSdkCart.waitForCartConsistency();
|
|
668
684
|
const checkoutResult = yield sales === null || sales === void 0 ? void 0 : sales.openCheckout();
|
|
669
685
|
const isBackWithPaymentChanged = (checkoutResult === null || checkoutResult === void 0 ? void 0 : checkoutResult.reason) === "back" && (checkoutResult === null || checkoutResult === void 0 ? void 0 : checkoutResult.isChangePaymentNotIncludeVoucher) === true;
|
|
670
686
|
const isBackWithoutPayment = (checkoutResult === null || checkoutResult === void 0 ? void 0 : checkoutResult.reason) === "back" && !isBackWithPaymentChanged;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
//#region src/plus/saleDetail/locales.ts
|
|
2
2
|
var locales_default = {
|
|
3
3
|
en: {
|
|
4
|
+
"pisell2.sale-detail.add-time-products-not-applicable": "These time extension products are not available for all selected tickets. Please select tickets again.",
|
|
4
5
|
"pisell2.text.checkout": "Checkout",
|
|
5
6
|
"pisell2.text.add-order-notes": "Add Order Note",
|
|
6
7
|
"pisell1.text.edit-status-success": "Edit status successfully",
|
|
@@ -396,6 +397,7 @@ var locales_default = {
|
|
|
396
397
|
"pisell2.sale-detail.order-saved-success": "Order saved. You can find it in Order List."
|
|
397
398
|
},
|
|
398
399
|
"zh-CN": {
|
|
400
|
+
"pisell2.sale-detail.add-time-products-not-applicable": "加时商品不适用于全部已选票,请重新选票。",
|
|
399
401
|
"pisell2.text.checkout": "结账",
|
|
400
402
|
"pisell2.text.add-order-notes": "添加订单备注",
|
|
401
403
|
"pisell1.text.edit-status-success": "编辑状态成功",
|
|
@@ -791,6 +793,7 @@ var locales_default = {
|
|
|
791
793
|
"pisell2.sale-detail.order-saved-success": "订单已保存。您可以在订单列表中找到它。"
|
|
792
794
|
},
|
|
793
795
|
"zh-HK": {
|
|
796
|
+
"pisell2.sale-detail.add-time-products-not-applicable": "加時商品不適用於全部已選票,請重新選票。",
|
|
794
797
|
"pisell2.text.checkout": "結賬",
|
|
795
798
|
"pisell2.text.add-order-notes": "添加訂單備注",
|
|
796
799
|
"pisell1.text.edit-status-success": "編輯狀態成功",
|
|
@@ -1186,6 +1189,7 @@ var locales_default = {
|
|
|
1186
1189
|
"pisell2.sale-detail.order-saved-success": "訂單已保存。 您可以在訂單清單中找到它。"
|
|
1187
1190
|
},
|
|
1188
1191
|
ja: {
|
|
1192
|
+
"pisell2.sale-detail.add-time-products-not-applicable": "選択したすべてのチケットに適用できない延長商品があります。チケットを選択し直してください。",
|
|
1189
1193
|
"pisell2.text.checkout": "チェックアウト",
|
|
1190
1194
|
"pisell2.text.add-order-notes": "注文メモを追加",
|
|
1191
1195
|
"pisell1.text.edit-status-success": "ステータスの編集に成功",
|
|
@@ -1581,6 +1585,7 @@ var locales_default = {
|
|
|
1581
1585
|
"pisell2.sale-detail.order-saved-success": "注文が保存されました。注文リストで確認できます。"
|
|
1582
1586
|
},
|
|
1583
1587
|
pt: {
|
|
1588
|
+
"pisell2.sale-detail.add-time-products-not-applicable": "Estes produtos de extensão de tempo não se aplicam a todos os bilhetes selecionados. Selecione os bilhetes novamente.",
|
|
1584
1589
|
"pisell2.text.checkout": "Checkout",
|
|
1585
1590
|
"pisell2.text.add-order-notes": "Adicionar Nota do Pedido",
|
|
1586
1591
|
"pisell1.text.edit-status-success": "Status editado com sucesso",
|
|
@@ -75,9 +75,13 @@ function buildAddTimeMatchingCacheItem(cacheItem) {
|
|
|
75
75
|
collection
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
|
-
const mapSaleDetailAdjustTimeProducts = (rawProducts, cacheItem) =>
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
const mapSaleDetailAdjustTimeProducts = (rawProducts, cacheItem) => mapSaleDetailAdjustTimeProductsForBookings(rawProducts, [cacheItem]);
|
|
79
|
+
/** 批量加时商品必须适用于每张票,不能用第一张票代表整组。 */
|
|
80
|
+
const isSaleDetailAddTimeProductUsableForBookings = (product, cacheItems) => {
|
|
81
|
+
return cacheItems.length > 0 && Boolean(product === null || product === void 0 ? void 0 : product.add_time) && cacheItems.every((cacheItem) => Boolean(cacheItem) && require_utils.isUsableProduct(product.add_time, buildAddTimeMatchingCacheItem(cacheItem)));
|
|
82
|
+
};
|
|
83
|
+
const mapSaleDetailAdjustTimeProductsForBookings = (rawProducts, cacheItems) => {
|
|
84
|
+
return (rawProducts || []).filter((item) => isSaleDetailAddTimeProductUsableForBookings(item, cacheItems)).map((item) => {
|
|
81
85
|
var _item$add_time, _item$add_time2, _item$add_time3, _item$add_time4, _item$add_time5, _item$add_time6;
|
|
82
86
|
return {
|
|
83
87
|
id: item.id,
|
|
@@ -93,5 +97,7 @@ const mapSaleDetailAdjustTimeProducts = (rawProducts, cacheItem) => {
|
|
|
93
97
|
};
|
|
94
98
|
//#endregion
|
|
95
99
|
exports.getResourceEndTimeFromOrigin = getResourceEndTimeFromOrigin;
|
|
100
|
+
exports.isSaleDetailAddTimeProductUsableForBookings = isSaleDetailAddTimeProductUsableForBookings;
|
|
96
101
|
exports.mapSaleDetailAdjustTimeBooking = mapSaleDetailAdjustTimeBooking;
|
|
97
102
|
exports.mapSaleDetailAdjustTimeProducts = mapSaleDetailAdjustTimeProducts;
|
|
103
|
+
exports.mapSaleDetailAdjustTimeProductsForBookings = mapSaleDetailAdjustTimeProductsForBookings;
|
|
@@ -1961,7 +1961,7 @@ const SalesSdkCartProvider = ({ children, normalProductDetailConfig, deferHolder
|
|
|
1961
1961
|
*/
|
|
1962
1962
|
const selectGiftForItem = (0, ahooks.useMemoizedFn)(function() {
|
|
1963
1963
|
var _ref43 = require_asyncToGenerator._asyncToGenerator(function* (target) {
|
|
1964
|
-
var _mainItem$metadata, _mainItem$metadata2, _giftInfo$giftOptions, _promotion$strategyMe, _mainItem$giftData, _mainItem$giftData2;
|
|
1964
|
+
var _mainItem$metadata, _mainItem$metadata2, _giftInfo$giftOptions, _promotion$strategyMe, _mainItem$giftData, _mainItem$giftData2, _engineContext$appHel;
|
|
1965
1965
|
if (!bookingTicket) throw new Error("[SalesSdk] Cart: bookingTicket 未初始化");
|
|
1966
1966
|
const mainItem = require_editCartLine.resolveEditCartLineTarget(target, snapshot.items);
|
|
1967
1967
|
const promotion = (_mainItem$metadata = mainItem.metadata) === null || _mainItem$metadata === void 0 ? void 0 : _mainItem$metadata._promotion;
|
|
@@ -1984,7 +1984,7 @@ const SalesSdkCartProvider = ({ children, normalProductDetailConfig, deferHolder
|
|
|
1984
1984
|
};
|
|
1985
1985
|
const choices = yield hostBridges.giftSelect.request(ctx);
|
|
1986
1986
|
if (!(choices === null || choices === void 0 ? void 0 : choices.length)) return;
|
|
1987
|
-
yield require_createOpenGiftSelectHost.replaceStrategyGiftsForMainItem(bookingTicket, mainItem, choices);
|
|
1987
|
+
yield require_createOpenGiftSelectHost.replaceStrategyGiftsForMainItem(bookingTicket, mainItem, choices, engineContext === null || engineContext === void 0 || (_engineContext$appHel = engineContext.appHelper) === null || _engineContext$appHel === void 0 || (_engineContext$appHel = _engineContext$appHel.constants) === null || _engineContext$appHel === void 0 ? void 0 : _engineContext$appHel.apiPrefix);
|
|
1988
1988
|
yield syncCartAfterMutation();
|
|
1989
1989
|
});
|
|
1990
1990
|
return function(_x41) {
|
|
@@ -246,7 +246,7 @@ function SalesSdkBootstrap({ bootstrapKey, onSettled, autoRestoreOnInit, autoBoo
|
|
|
246
246
|
return null;
|
|
247
247
|
}
|
|
248
248
|
const SalesSdkProvider = ({ osKey, enableMultiCurrencySettlement = false, solution = "bookingTicket", moduleAccess = "ensure", lifecycleOwner = "provider", businessCode, bookingConfigParams, autoInitBookingContext = true, otherParams, deferHolderAuthOnClose = false, enableCustomerAuthHost = false, shouldMergeProductLines, rulesHooks, orderId, preloadedSalesDetail, autoBootstrap = true, autoRestoreOnInit = true, restoreOrderAfterPaidCheckout = true, destroyOnUnmount = true, uiHosts, awaitAllergyConfirmation, normalProductDetailConfig, mergeBookingLinesForDisplay = true, legacyOpenProductDetail, enableTempOrderSync = false, enableTempOrderPersist = false, syncDetailOnOrderChange = false, isActive = true, preserveProductCatalogOnInactiveCustomerClear = false, enableGlobalScanListener = false, suppressCartIneligibleScanToast = false, promotionScanSuccessMessageKey, promotionItemIncreaseMessageKey, defaultProductLoadParams, children }) => {
|
|
249
|
-
var _context$appHelper, _osKey$replace;
|
|
249
|
+
var _context$appHelper, _osKey$replace, _context$appHelper3;
|
|
250
250
|
const context = require_useEngineContext.default();
|
|
251
251
|
const utils = (context === null || context === void 0 || (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {};
|
|
252
252
|
const Toast = (0, _pisell_materials.useToast)();
|
|
@@ -1475,7 +1475,11 @@ const SalesSdkProvider = ({ osKey, enableMultiCurrencySettlement = false, soluti
|
|
|
1475
1475
|
bookingTicket.setPromotionEvaluator((_utils$promotionEvalu = utils === null || utils === void 0 ? void 0 : utils.promotionEvaluator) !== null && _utils$promotionEvalu !== void 0 ? _utils$promotionEvalu : null);
|
|
1476
1476
|
}
|
|
1477
1477
|
if (typeof bookingTicket.setGiftSelectResolver === "function") {
|
|
1478
|
-
|
|
1478
|
+
var _context$appHelper2;
|
|
1479
|
+
const resolver = require_createOpenGiftSelectHost.createOpenGiftSelectHost(hostBridges.giftSelect, () => bookingTicketRef.current, {
|
|
1480
|
+
getUiHosts: () => uiHostsValue,
|
|
1481
|
+
apiPrefix: context === null || context === void 0 || (_context$appHelper2 = context.appHelper) === null || _context$appHelper2 === void 0 || (_context$appHelper2 = _context$appHelper2.constants) === null || _context$appHelper2 === void 0 ? void 0 : _context$appHelper2.apiPrefix
|
|
1482
|
+
});
|
|
1479
1483
|
bookingTicket.setGiftSelectResolver(resolver);
|
|
1480
1484
|
}
|
|
1481
1485
|
return () => {
|
|
@@ -1485,6 +1489,7 @@ const SalesSdkProvider = ({ osKey, enableMultiCurrencySettlement = false, soluti
|
|
|
1485
1489
|
}, [
|
|
1486
1490
|
bookingTicket,
|
|
1487
1491
|
utils === null || utils === void 0 ? void 0 : utils.promotionEvaluator,
|
|
1492
|
+
context === null || context === void 0 || (_context$appHelper3 = context.appHelper) === null || _context$appHelper3 === void 0 || (_context$appHelper3 = _context$appHelper3.constants) === null || _context$appHelper3 === void 0 ? void 0 : _context$appHelper3.apiPrefix,
|
|
1488
1493
|
hostBridges.giftSelect,
|
|
1489
1494
|
uiHostsValue
|
|
1490
1495
|
]);
|
|
@@ -239,11 +239,11 @@ function collectMissingProductIds(choices, productMap) {
|
|
|
239
239
|
* @example
|
|
240
240
|
* const map = await fetchGiftProductMap([{ product_id: 1, product_variant_id: 0, quantity: 1 }]);
|
|
241
241
|
*/
|
|
242
|
-
function fetchGiftProductMap(_x) {
|
|
242
|
+
function fetchGiftProductMap(_x, _x2) {
|
|
243
243
|
return _fetchGiftProductMap.apply(this, arguments);
|
|
244
244
|
}
|
|
245
245
|
function _fetchGiftProductMap() {
|
|
246
|
-
_fetchGiftProductMap = require_asyncToGenerator._asyncToGenerator(function* (productIds) {
|
|
246
|
+
_fetchGiftProductMap = require_asyncToGenerator._asyncToGenerator(function* (productIds, apiPrefix) {
|
|
247
247
|
const ids = Array.from(new Set(productIds.filter((id) => Number.isFinite(id) && id > 0)));
|
|
248
248
|
if (!ids.length) return /* @__PURE__ */ new Map();
|
|
249
249
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -256,7 +256,8 @@ function _fetchGiftProductMap() {
|
|
|
256
256
|
if (!missingIds.length) return map;
|
|
257
257
|
((yield require_server.getProducts({
|
|
258
258
|
ids: missingIds,
|
|
259
|
-
isGift: true
|
|
259
|
+
isGift: true,
|
|
260
|
+
apiPrefix
|
|
260
261
|
})) || []).forEach((p) => {
|
|
261
262
|
const id = resolveProductId(p);
|
|
262
263
|
if (!id) return;
|
|
@@ -274,7 +275,7 @@ function _fetchGiftProductMap() {
|
|
|
274
275
|
* @example
|
|
275
276
|
* const lines = await buildGiftOrderProductsFromChoices(choices, ctx, (ids) => ticket.getProductByIds(ids));
|
|
276
277
|
*/
|
|
277
|
-
function buildGiftOrderProductsFromChoices(
|
|
278
|
+
function buildGiftOrderProductsFromChoices(_x3, _x4, _x5) {
|
|
278
279
|
return _buildGiftOrderProductsFromChoices.apply(this, arguments);
|
|
279
280
|
}
|
|
280
281
|
function _buildGiftOrderProductsFromChoices() {
|
|
@@ -296,7 +297,7 @@ function _buildGiftOrderProductsFromChoices() {
|
|
|
296
297
|
}
|
|
297
298
|
missingIds = collectMissingProductIds(choices, productMap);
|
|
298
299
|
if (missingIds.length) try {
|
|
299
|
-
(yield fetchGiftProductMap(missingIds)).forEach((product, id) => {
|
|
300
|
+
(yield fetchGiftProductMap(missingIds, options === null || options === void 0 ? void 0 : options.apiPrefix)).forEach((product, id) => {
|
|
300
301
|
if (!productMap.has(id)) productMap.set(id, product);
|
|
301
302
|
});
|
|
302
303
|
} catch (error) {
|
|
@@ -91,7 +91,7 @@ function createOpenGiftSelectHost(bridge, getBookingTicket, options) {
|
|
|
91
91
|
const option = ctx.giftOptions[0];
|
|
92
92
|
const products = yield (_bookingTicket$getPro = bookingTicket.getProductByIds) === null || _bookingTicket$getPro === void 0 ? void 0 : _bookingTicket$getPro.call(bookingTicket, [Number(option.product_id)]);
|
|
93
93
|
let product = products === null || products === void 0 ? void 0 : products[0];
|
|
94
|
-
if (!product) product = (yield require_buildGiftOrderProducts.fetchGiftProductMap([Number(option.product_id)])).get(Number(option.product_id));
|
|
94
|
+
if (!product) product = (yield require_buildGiftOrderProducts.fetchGiftProductMap([Number(option.product_id)], options === null || options === void 0 ? void 0 : options.apiPrefix)).get(Number(option.product_id));
|
|
95
95
|
if (isBookingGiftCandidate(product)) {
|
|
96
96
|
var _options$getUiHosts;
|
|
97
97
|
const choice = yield resolveSingleBookingGiftChoice(product, option, ctx, bookingTicket, options === null || options === void 0 || (_options$getUiHosts = options.getUiHosts) === null || _options$getUiHosts === void 0 ? void 0 : _options$getUiHosts.call(options));
|
|
@@ -114,6 +114,7 @@ function createOpenGiftSelectHost(bridge, getBookingTicket, options) {
|
|
|
114
114
|
if (!choices) return null;
|
|
115
115
|
return require_buildGiftOrderProducts.buildGiftOrderProductsFromChoices(choices, ctx, {
|
|
116
116
|
bookingTicket,
|
|
117
|
+
apiPrefix: options === null || options === void 0 ? void 0 : options.apiPrefix,
|
|
117
118
|
fallbackFetcher: (ids) => {
|
|
118
119
|
var _bookingTicket$getPro2, _bookingTicket$getPro3;
|
|
119
120
|
return (_bookingTicket$getPro2 = (_bookingTicket$getPro3 = bookingTicket.getProductByIds) === null || _bookingTicket$getPro3 === void 0 ? void 0 : _bookingTicket$getPro3.call(bookingTicket, ids)) !== null && _bookingTicket$getPro2 !== void 0 ? _bookingTicket$getPro2 : Promise.resolve([]);
|
|
@@ -132,11 +133,11 @@ function createOpenGiftSelectHost(bridge, getBookingTicket, options) {
|
|
|
132
133
|
* @example
|
|
133
134
|
* await replaceStrategyGiftsForMainItem(bookingTicket, mainItem, choices);
|
|
134
135
|
*/
|
|
135
|
-
function replaceStrategyGiftsForMainItem(_x7, _x8, _x9) {
|
|
136
|
+
function replaceStrategyGiftsForMainItem(_x7, _x8, _x9, _x10) {
|
|
136
137
|
return _replaceStrategyGiftsForMainItem.apply(this, arguments);
|
|
137
138
|
}
|
|
138
139
|
function _replaceStrategyGiftsForMainItem() {
|
|
139
|
-
_replaceStrategyGiftsForMainItem = require_asyncToGenerator._asyncToGenerator(function* (bookingTicket, mainItem, choices) {
|
|
140
|
+
_replaceStrategyGiftsForMainItem = require_asyncToGenerator._asyncToGenerator(function* (bookingTicket, mainItem, choices, apiPrefix) {
|
|
140
141
|
var _mainItem$metadata, _mainItem$metadata2, _giftInfo$giftOptions, _promotion$strategyMe, _bookingTicket$getTem3;
|
|
141
142
|
const sourceUid = (_mainItem$metadata = mainItem.metadata) === null || _mainItem$metadata === void 0 ? void 0 : _mainItem$metadata.unique_identification_number;
|
|
142
143
|
const promotion = (_mainItem$metadata2 = mainItem.metadata) === null || _mainItem$metadata2 === void 0 ? void 0 : _mainItem$metadata2._promotion;
|
|
@@ -162,6 +163,7 @@ function _replaceStrategyGiftsForMainItem() {
|
|
|
162
163
|
});
|
|
163
164
|
const newGifts = yield require_buildGiftOrderProducts.buildGiftOrderProductsFromChoices(choices, ctx, {
|
|
164
165
|
bookingTicket,
|
|
166
|
+
apiPrefix,
|
|
165
167
|
fallbackFetcher: (ids) => {
|
|
166
168
|
var _bookingTicket$getPro4, _bookingTicket$getPro5;
|
|
167
169
|
return (_bookingTicket$getPro4 = (_bookingTicket$getPro5 = bookingTicket.getProductByIds) === null || _bookingTicket$getPro5 === void 0 ? void 0 : _bookingTicket$getPro5.call(bookingTicket, ids)) !== null && _bookingTicket$getPro4 !== void 0 ? _bookingTicket$getPro4 : Promise.resolve([]);
|