@pisell/private-materials 6.12.337 → 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.
Files changed (27) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/meta.js +1 -1
  5. package/build/lowcode/render/default/view.js +3 -3
  6. package/build/lowcode/view.js +3 -3
  7. package/es/components/bigSale/components/ProductList/index.js +49 -29
  8. package/es/components/list/List.js +17 -13
  9. package/es/components/list/types.d.ts +10 -0
  10. package/es/components/shoppingCart/hooks/usePromotionModal.js +10 -5
  11. package/es/components/shoppingCart/hooks/useSkuModal.js +5 -2
  12. package/es/components/shoppingCart/server.js +6 -4
  13. package/es/plus/salesSdk/context/SalesSdkCartContext.js +2 -2
  14. package/es/plus/salesSdk/context/SalesSdkProvider.js +7 -2
  15. package/es/plus/salesSdk/giftSelect/buildGiftOrderProducts.js +6 -5
  16. package/es/plus/salesSdk/giftSelect/createOpenGiftSelectHost.js +5 -3
  17. package/lib/components/bigSale/components/ProductList/index.js +49 -29
  18. package/lib/components/list/List.js +17 -13
  19. package/lib/components/list/types.d.ts +10 -0
  20. package/lib/components/shoppingCart/hooks/usePromotionModal.js +10 -5
  21. package/lib/components/shoppingCart/hooks/useSkuModal.js +5 -2
  22. package/lib/components/shoppingCart/server.js +6 -4
  23. package/lib/plus/salesSdk/context/SalesSdkCartContext.js +2 -2
  24. package/lib/plus/salesSdk/context/SalesSdkProvider.js +7 -2
  25. package/lib/plus/salesSdk/giftSelect/buildGiftOrderProducts.js +6 -5
  26. package/lib/plus/salesSdk/giftSelect/createOpenGiftSelectHost.js +5 -3
  27. package/package.json +3 -3
@@ -14,6 +14,7 @@ import { generateProductTabs } from "../../../ticketBooking/components/ProductDi
14
14
  import { useSalesSdkBusinessAvailability } from "../../../../plus/salesSdk/context/SalesSdkBusinessAvailabilityContext.js";
15
15
  import { showAddToCartToast } from "../../../../plus/salesSdk/components/showAddToCartToast.js";
16
16
  import { mergeBookingsForDisplay } from "../../../../plus/salesSdk/utils/mergeBookingsForDisplay.js";
17
+ import useSalesSdkGlobalScanHandler from "../../../../plus/salesSdk/hooks/useSalesSdkGlobalScanHandler.js";
17
18
  import "../../../../plus/salesSdk/index.js";
18
19
  import { buildBigSaleProductListPreferencesKey, readBigSaleProductListPreferences, readStoredBigSaleProductListPreferences, removeBigSaleProductListPreferences, resolveBigSaleAutoProductListPreferences, writeBigSaleProductListPreferences } from "../../utils/productListPreferences.js";
19
20
  import { resolveBigSaleProductDisplayConfig, useBigSaleProductListConfig } from "../../hooks/useBigSaleProductListConfig.js";
@@ -144,6 +145,7 @@ const BigSaleProductListInner = ({ isActive = true, osKey, productListPreference
144
145
  ]);
145
146
  const locale = useLocale();
146
147
  const businessAvailability = useSalesSdkBusinessAvailability();
148
+ const { handleGlobalScanCode } = useSalesSdkGlobalScanHandler({ businessCode });
147
149
  const purchaseDisabled = businessAvailability.enabled && (businessAvailability.loading || businessAvailability.status !== "open");
148
150
  const logger = useLogger();
149
151
  const { sales, products, cart, customer } = context;
@@ -169,6 +171,23 @@ const BigSaleProductListInner = ({ isActive = true, osKey, productListPreference
169
171
  /** Kiosk 搜索打开时的分类快照,不受 Tabbar 关闭搜索时内部 onChange 影响。 */
170
172
  const kioskSearchCategoryTabRef = useRef(void 0);
171
173
  const [settingsOpen, setSettingsOpen] = useState(false);
174
+ /**
175
+ * 商品分类搜索层打开时,PisellFind 会成为扫码焦点栈顶。
176
+ * 收到商品码后由 List 先关闭该层,再在这里直连既有全局扫码执行器,
177
+ * 使商品进入购物车而不是停留在「按条码文本搜索商品目录」的空结果页。
178
+ */
179
+ const handleTabbarScannerData = useMemoizedFn(function() {
180
+ var _ref3 = _asyncToGenerator(function* (payload) {
181
+ var _payload$data;
182
+ const code = payload === null || payload === void 0 || (_payload$data = payload.data) === null || _payload$data === void 0 ? void 0 : _payload$data.trim();
183
+ if (!isActive || !code || businessAvailability.isCheckoutStarted()) return;
184
+ if (!(yield businessAvailability.ensureCanShop())) return;
185
+ yield handleGlobalScanCode(code);
186
+ });
187
+ return function(_x) {
188
+ return _ref3.apply(this, arguments);
189
+ };
190
+ }());
172
191
  const preferencesKey = useMemo(() => buildBigSaleProductListPreferencesKey({
173
192
  osKey,
174
193
  mode,
@@ -316,13 +335,13 @@ const BigSaleProductListInner = ({ isActive = true, osKey, productListPreference
316
335
  * handleSelectProduct(productItem);
317
336
  */
318
337
  const handleSelectProduct = useMemoizedFn(function() {
319
- var _ref5 = _asyncToGenerator(function* (product) {
320
- var _ref3, _product$id;
338
+ var _ref6 = _asyncToGenerator(function* (product) {
339
+ var _ref4, _product$id;
321
340
  const handlesKioskToastAfterResult = productCardVersion === "v2" && !usesV2ProductCard;
322
- const productId = String((_ref3 = (_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 && _ref3 !== void 0 ? _ref3 : "");
341
+ 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 : "");
323
342
  const baselineQuantity = phoneCartProductEntries.filter((entry) => resolvePhoneCartProductId(entry.value) === productId).reduce((total, entry) => total + entry.quantity, 0);
324
343
  try {
325
- var _sales$tempOrder4, _logger$addLog, _ref4, _sales$tempOrder$orde, _sales$tempOrder5;
344
+ var _sales$tempOrder4, _logger$addLog, _ref5, _sales$tempOrder$orde, _sales$tempOrder5;
326
345
  if (!(yield businessAvailability.ensureCanShop())) return;
327
346
  if (!sales.isReady) return;
328
347
  if (requiredOrderId !== void 0 && Number((_sales$tempOrder4 = sales.tempOrder) === null || _sales$tempOrder4 === void 0 ? void 0 : _sales$tempOrder4.order_id) !== Number(requiredOrderId)) return;
@@ -334,7 +353,7 @@ const BigSaleProductListInner = ({ isActive = true, osKey, productListPreference
334
353
  metadata: {
335
354
  product_id: productId,
336
355
  product_title: resolvePhoneProductTitle(product),
337
- order_id: (_ref4 = (_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 && _ref4 !== void 0 ? _ref4 : null
356
+ 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
338
357
  }
339
358
  });
340
359
  const result = yield cart.addProductWithFlow(product, {
@@ -348,8 +367,8 @@ const BigSaleProductListInner = ({ isActive = true, osKey, productListPreference
348
367
  if (!showVirtualSettlementErrorToast(error, Toast)) console.error(error);
349
368
  }
350
369
  });
351
- return function(_x) {
352
- return _ref5.apply(this, arguments);
370
+ return function(_x2) {
371
+ return _ref6.apply(this, arguments);
353
372
  };
354
373
  }());
355
374
  const phoneCartProductEntries = useMemo(() => {
@@ -363,8 +382,8 @@ const BigSaleProductListInner = ({ isActive = true, osKey, productListPreference
363
382
  const productUid = resolvePhoneCartLineUid(booking === null || booking === void 0 || (_booking$_extend = booking._extend) === null || _booking$_extend === void 0 ? void 0 : _booking$_extend.product);
364
383
  if (productUid) bookingProductUids.add(productUid);
365
384
  ((booking === null || booking === void 0 || (_booking$_extend2 = booking._extend) === null || _booking$_extend2 === void 0 ? void 0 : _booking$_extend2.mergedFrom) || []).forEach((source) => {
366
- var _ref6, _source$booking$produ, _source$booking, _source$booking2;
367
- const sourceUid = (_ref6 = (_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 && _ref6 !== void 0 ? _ref6 : resolvePhoneCartLineUid(source === null || source === void 0 ? void 0 : source.product);
385
+ var _ref7, _source$booking$produ, _source$booking, _source$booking2;
386
+ 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);
368
387
  if (sourceUid !== void 0 && sourceUid !== null && sourceUid !== "") bookingProductUids.add(String(sourceUid));
369
388
  });
370
389
  });
@@ -378,10 +397,10 @@ const BigSaleProductListInner = ({ isActive = true, osKey, productListPreference
378
397
  quantity: resolvePhoneCartEntryQuantity(item)
379
398
  }));
380
399
  displayBookings.forEach((booking) => {
381
- var _booking$_extend3, _ref7, _booking$_extend$disp, _booking$_extend4, _product$_extend, _product$product_id;
400
+ var _booking$_extend3, _ref8, _booking$_extend$disp, _booking$_extend4, _product$_extend, _product$product_id;
382
401
  const product = booking === null || booking === void 0 || (_booking$_extend3 = booking._extend) === null || _booking$_extend3 === void 0 ? void 0 : _booking$_extend3.product;
383
402
  if (!product || (product === null || product === void 0 ? void 0 : product._isGiftPromotion)) return;
384
- const displayQuantity = (_ref7 = (_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 && _ref7 !== void 0 ? _ref7 : product === null || product === void 0 ? void 0 : product.num;
403
+ 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;
385
404
  const displayValue = _objectSpread2(_objectSpread2({}, product), {}, {
386
405
  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,
387
406
  num: displayQuantity
@@ -425,9 +444,9 @@ const BigSaleProductListInner = ({ isActive = true, osKey, productListPreference
425
444
  show();
426
445
  });
427
446
  const addPhoneProductWithToast = useMemoizedFn(function() {
428
- var _ref9 = _asyncToGenerator(function* (product, quantity, type = "select", delayUntilModalClosed = false) {
429
- var _ref8, _product$id2;
430
- const productId = String((_ref8 = (_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 && _ref8 !== void 0 ? _ref8 : "");
447
+ var _ref10 = _asyncToGenerator(function* (product, quantity, type = "select", delayUntilModalClosed = false) {
448
+ var _ref9, _product$id2;
449
+ 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 : "");
431
450
  const currentQuantity = phoneCartProductEntries.filter((entry) => resolvePhoneCartProductId(entry.value) === productId).reduce((total, entry) => total + entry.quantity, 0);
432
451
  const result = yield cart.addProductWithFlow(product, {
433
452
  type,
@@ -437,8 +456,8 @@ const BigSaleProductListInner = ({ isActive = true, osKey, productListPreference
437
456
  if (result.status === "added") showPhoneProductAddedToast(product, resolveAddedProductQuantity(result.products, productId, currentQuantity + quantity), delayUntilModalClosed);
438
457
  return result;
439
458
  });
440
- return function(_x2, _x3) {
441
- return _ref9.apply(this, arguments);
459
+ return function(_x3, _x4) {
460
+ return _ref10.apply(this, arguments);
442
461
  };
443
462
  }());
444
463
  /**
@@ -449,11 +468,11 @@ const BigSaleProductListInner = ({ isActive = true, osKey, productListPreference
449
468
  * 这样不会为了“判断商品类型”预先渲染抽屉,同时保留异常商品数据的兜底能力。
450
469
  */
451
470
  const addPhoneQuantityProductWithToast = useMemoizedFn(function() {
452
- var _ref11 = _asyncToGenerator(function* (product, quantity) {
453
- var _ref10, _product$id3;
471
+ var _ref12 = _asyncToGenerator(function* (product, quantity) {
472
+ var _ref11, _product$id3;
454
473
  if (!(yield businessAvailability.ensureCanShop())) return;
455
474
  if (!isNormalProductByDurationSchedule(product)) return addPhoneProductWithToast(product, quantity);
456
- const productId = String((_ref10 = (_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 && _ref10 !== void 0 ? _ref10 : "");
475
+ 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 : "");
457
476
  const result = yield cart.addProduct(product, {
458
477
  type: "select",
459
478
  quantity
@@ -464,12 +483,12 @@ const BigSaleProductListInner = ({ isActive = true, osKey, productListPreference
464
483
  }
465
484
  return addPhoneProductWithToast(product, quantity);
466
485
  });
467
- return function(_x4, _x5) {
468
- return _ref11.apply(this, arguments);
486
+ return function(_x5, _x6) {
487
+ return _ref12.apply(this, arguments);
469
488
  };
470
489
  }());
471
490
  const handlePhoneProductCardChange = useMemoizedFn(function() {
472
- var _ref12 = _asyncToGenerator(function* (nextValue, _intent, meta) {
491
+ var _ref13 = _asyncToGenerator(function* (nextValue, _intent, meta) {
473
492
  var _product$id4;
474
493
  const product = meta === null || meta === void 0 ? void 0 : meta.product;
475
494
  if (!product) return;
@@ -524,8 +543,8 @@ const BigSaleProductListInner = ({ isActive = true, osKey, productListPreference
524
543
  if (!showVirtualSettlementErrorToast(error, Toast)) console.error(error);
525
544
  }
526
545
  });
527
- return function(_x6, _x7, _x8) {
528
- return _ref12.apply(this, arguments);
546
+ return function(_x7, _x8, _x9) {
547
+ return _ref13.apply(this, arguments);
529
548
  };
530
549
  }());
531
550
  const { data: listData, listProps: configuredListProps, skuCardAllConfig } = productListConfig;
@@ -700,9 +719,9 @@ const BigSaleProductListInner = ({ isActive = true, osKey, productListPreference
700
719
  setActiveTab([]);
701
720
  });
702
721
  const handleKioskSearchClose = useMemoizedFn(() => {
703
- var _ref13, _kioskSearchCategoryT;
722
+ var _ref14, _kioskSearchCategoryT;
704
723
  cancelPendingCategoryTransition();
705
- const categoryTabBeforeSearch = (_ref13 = (_kioskSearchCategoryT = kioskSearchCategoryTabRef.current) !== null && _kioskSearchCategoryT !== void 0 ? _kioskSearchCategoryT : lastCategoryTabRef.current) !== null && _ref13 !== void 0 ? _ref13 : defaultActiveTab;
724
+ const categoryTabBeforeSearch = (_ref14 = (_kioskSearchCategoryT = kioskSearchCategoryTabRef.current) !== null && _kioskSearchCategoryT !== void 0 ? _kioskSearchCategoryT : lastCategoryTabRef.current) !== null && _ref14 !== void 0 ? _ref14 : defaultActiveTab;
706
725
  kioskSearchCategoryTabRef.current = void 0;
707
726
  lastCategoryTabRef.current = categoryTabBeforeSearch;
708
727
  setKeyword("");
@@ -764,10 +783,10 @@ const BigSaleProductListInner = ({ isActive = true, osKey, productListPreference
764
783
  * Choose a price 阶段按详情 Quantity 再次校验。
765
784
  */
766
785
  const resolveSettlementPriceRows = useMemoizedFn((item) => {
767
- var _ref14, _ref15, _cart$tempOrder, _sales$bookingTicket3, _sales$bookingTicket4, _ref16, _customer$selected$id, _customer$selected, _tempOrder$customer, _sales$bookingTicket5, _sales$bookingTicket6, _getEngineData, _getEngineData2, _getEngineData3;
786
+ var _ref15, _ref16, _cart$tempOrder, _sales$bookingTicket3, _sales$bookingTicket4, _ref17, _customer$selected$id, _customer$selected, _tempOrder$customer, _sales$bookingTicket5, _sales$bookingTicket6, _getEngineData, _getEngineData2, _getEngineData3;
768
787
  if (!sales.enableMultiCurrencySettlement) return [];
769
- const tempOrder = (_ref14 = (_ref15 = (_cart$tempOrder = cart.tempOrder) !== null && _cart$tempOrder !== void 0 ? _cart$tempOrder : sales.tempOrder) !== null && _ref15 !== void 0 ? _ref15 : (_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 && _ref14 !== void 0 ? _ref14 : null;
770
- const customerId = (_ref16 = (_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 && _ref16 !== void 0 ? _ref16 : tempOrder === null || tempOrder === void 0 || (_tempOrder$customer = tempOrder.customer) === null || _tempOrder$customer === void 0 ? void 0 : _tempOrder$customer.id;
788
+ 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;
789
+ 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;
771
790
  return buildSettlementPriceRows({
772
791
  product: item,
773
792
  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)) || [],
@@ -848,6 +867,7 @@ const BigSaleProductListInner = ({ isActive = true, osKey, productListPreference
848
867
  deferActiveTabChange: usesDeferredCategoryMotion,
849
868
  syncAnchorOnScroll: categoryDisplayMode === "continuous" && (!Array.isArray(activeTab) || activeTab.length > 0),
850
869
  onTabSearch: setKeyword,
870
+ onTabbarScannerData: handleTabbarScannerData,
851
871
  onActiveTabChange: handleActiveTabChange,
852
872
  loading: listShowsLoading
853
873
  }, listProps), {}, {
@@ -85,6 +85,7 @@ const List$1 = (props, ref) => {
85
85
  const containerRef = useRef(null);
86
86
  const tabbarRef = useRef(null);
87
87
  const template1tabbarRef = useRef(null);
88
+ const onTabbarScannerData = props.onTabbarScannerData;
88
89
  const headerRef = useRef(null);
89
90
  const visibleActiveTabRef = useRef(activeTab);
90
91
  visibleActiveTabRef.current = activeTab;
@@ -92,20 +93,23 @@ const List$1 = (props, ref) => {
92
93
  * BigSale 的分类 Tabbar 搜索弹层复用 ComprehensiveSearch 输入栏。
93
94
  * 保持 PisellFind 默认的实时搜索模式:不展示搜索按钮,输入变化仍由 Lookup 内部防抖触发。
94
95
  */
95
- const tabbarSearchProps = useMemo(() => ({
96
- enableScanner: true,
97
- inputRender: (ctx) => /* @__PURE__ */ React.createElement(LookupSearchInput, {
98
- ctx,
99
- showSearchButton: false,
100
- searchSectionProps: {
101
- className: "pisell-list-tabbar-search-section",
102
- style: {
103
- flex: 1,
104
- minWidth: 0
105
- }
96
+ const tabbarSearchProps = useMemo(() => _objectSpread2(_objectSpread2({ enableScanner: true }, onTabbarScannerData ? { onScannerData: (payload) => {
97
+ var _ref, _ref$closeSearchMode;
98
+ const data = payload === null || payload === void 0 ? void 0 : payload.data;
99
+ if (typeof data !== "string" || data.length === 0) return;
100
+ (_ref = tabbarRef.current || template1tabbarRef.current) === null || _ref === void 0 || (_ref$closeSearchMode = _ref.closeSearchMode) === null || _ref$closeSearchMode === void 0 || _ref$closeSearchMode.call(_ref);
101
+ onTabbarScannerData(payload);
102
+ } } : {}), {}, { inputRender: (ctx) => /* @__PURE__ */ React.createElement(LookupSearchInput, {
103
+ ctx,
104
+ showSearchButton: false,
105
+ searchSectionProps: {
106
+ className: "pisell-list-tabbar-search-section",
107
+ style: {
108
+ flex: 1,
109
+ minWidth: 0
106
110
  }
107
- })
108
- }), []);
111
+ }
112
+ }) }), [onTabbarScannerData]);
109
113
  const matchesFieldValue = (fieldValue, targetValue) => {
110
114
  if (Array.isArray(fieldValue)) return fieldValue.includes(targetValue);
111
115
  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 {
@@ -23,9 +23,10 @@ const FALLBACK_RESPONSIVE_INFO = {
23
23
  };
24
24
  const useFallbackResponsive = () => FALLBACK_RESPONSIVE_INFO;
25
25
  const usePromotionModal = (options) => {
26
- var _context$appHelper, _context$appHelper$ge, _responsive$hooks;
26
+ var _context$appHelper, _context$appHelper2, _context$appHelper2$g, _responsive$hooks;
27
27
  const context = useEngineContext();
28
- const app = context === null || context === void 0 || (_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 ? void 0 : _context$appHelper$ge.call(_context$appHelper);
28
+ 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";
29
+ 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);
29
30
  const responsive = app === null || app === void 0 ? void 0 : app.responsive;
30
31
  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;
31
32
  const currentVariant = responsiveInfo.currentBreakpoint || responsiveInfo.deviceType || "desktop";
@@ -76,7 +77,10 @@ const usePromotionModal = (options) => {
76
77
  suppressProductSelectSkuOpenRef.current = false;
77
78
  });
78
79
  }, [currentItem, selected]);
79
- const { SkuModal } = useSkuModal({ onConfirm: handleSkuConfirmCallback });
80
+ const { SkuModal } = useSkuModal({
81
+ onConfirm: handleSkuConfirmCallback,
82
+ apiPrefix
83
+ });
80
84
  /**
81
85
  * @description: 获取商品列表请求
82
86
  * @return {*}
@@ -113,11 +117,12 @@ const usePromotionModal = (options) => {
113
117
  getProductsRequest.run({
114
118
  ids: (item === null || item === void 0 || (_item$products2 = item.products) === null || _item$products2 === void 0 ? void 0 : _item$products2.map((option) => option.product_id)) || [],
115
119
  isGift: !!(item === null || item === void 0 ? void 0 : item.isGift),
116
- schedule_date: date
120
+ schedule_date: date,
121
+ apiPrefix
117
122
  });
118
123
  }
119
124
  setOpen(true);
120
- }, [getProductsRequest]);
125
+ }, [getProductsRequest, apiPrefix]);
121
126
  /**
122
127
  * @description: 关闭营销弹窗
123
128
  * @param {*} useCallback
@@ -55,8 +55,11 @@ const useSkuModal = (options) => {
55
55
  setSkuValue((product === null || product === void 0 ? void 0 : product._skuValue) || _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 }));
56
56
  setEditingSku(Boolean(product === null || product === void 0 ? void 0 : product._skuValue));
57
57
  setSkuModalOpen(true);
58
- getProductDetailRequest.run({ id: product === null || product === void 0 ? void 0 : product.id });
59
- }, [getProductDetailRequest]);
58
+ getProductDetailRequest.run({
59
+ id: product === null || product === void 0 ? void 0 : product.id,
60
+ apiPrefix: options === null || options === void 0 ? void 0 : options.apiPrefix
61
+ });
62
+ }, [getProductDetailRequest, options === null || options === void 0 ? void 0 : options.apiPrefix]);
60
63
  /**
61
64
  * @description: 关闭 SKU 选择弹窗
62
65
  */
@@ -4,7 +4,7 @@ import { request } from "../../utils/index.js";
4
4
  //#region src/components/shoppingCart/server.ts
5
5
  const getProducts = function() {
6
6
  var _ref = _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 request.getRequest().post("/shop/product/query", queryParams, {
41
+ let { data } = yield 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 = _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 request.getRequest().get(`/shop/product/query/${id}`, queryParams, {
93
+ let { data } = yield request.getRequest().get(`${prefix}/product/${detailPath}/${id}`, queryParams, {
92
94
  fullResult: true,
93
95
  useCache: true
94
96
  });
@@ -1958,7 +1958,7 @@ const SalesSdkCartProvider = ({ children, normalProductDetailConfig, deferHolder
1958
1958
  */
1959
1959
  const selectGiftForItem = useMemoizedFn(function() {
1960
1960
  var _ref43 = _asyncToGenerator(function* (target) {
1961
- var _mainItem$metadata, _mainItem$metadata2, _giftInfo$giftOptions, _promotion$strategyMe, _mainItem$giftData, _mainItem$giftData2;
1961
+ var _mainItem$metadata, _mainItem$metadata2, _giftInfo$giftOptions, _promotion$strategyMe, _mainItem$giftData, _mainItem$giftData2, _engineContext$appHel;
1962
1962
  if (!bookingTicket) throw new Error("[SalesSdk] Cart: bookingTicket 未初始化");
1963
1963
  const mainItem = resolveEditCartLineTarget(target, snapshot.items);
1964
1964
  const promotion = (_mainItem$metadata = mainItem.metadata) === null || _mainItem$metadata === void 0 ? void 0 : _mainItem$metadata._promotion;
@@ -1981,7 +1981,7 @@ const SalesSdkCartProvider = ({ children, normalProductDetailConfig, deferHolder
1981
1981
  };
1982
1982
  const choices = yield hostBridges.giftSelect.request(ctx);
1983
1983
  if (!(choices === null || choices === void 0 ? void 0 : choices.length)) return;
1984
- yield replaceStrategyGiftsForMainItem(bookingTicket, mainItem, choices);
1984
+ yield 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);
1985
1985
  yield syncCartAfterMutation();
1986
1986
  });
1987
1987
  return function(_x41) {
@@ -243,7 +243,7 @@ function SalesSdkBootstrap({ bootstrapKey, onSettled, autoRestoreOnInit, autoBoo
243
243
  return null;
244
244
  }
245
245
  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 }) => {
246
- var _context$appHelper, _osKey$replace;
246
+ var _context$appHelper, _osKey$replace, _context$appHelper3;
247
247
  const context = useEngineContext();
248
248
  const utils = (context === null || context === void 0 || (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {};
249
249
  const Toast = useToast();
@@ -1472,7 +1472,11 @@ const SalesSdkProvider = ({ osKey, enableMultiCurrencySettlement = false, soluti
1472
1472
  bookingTicket.setPromotionEvaluator((_utils$promotionEvalu = utils === null || utils === void 0 ? void 0 : utils.promotionEvaluator) !== null && _utils$promotionEvalu !== void 0 ? _utils$promotionEvalu : null);
1473
1473
  }
1474
1474
  if (typeof bookingTicket.setGiftSelectResolver === "function") {
1475
- const resolver = createOpenGiftSelectHost(hostBridges.giftSelect, () => bookingTicketRef.current, { getUiHosts: () => uiHostsValue });
1475
+ var _context$appHelper2;
1476
+ const resolver = createOpenGiftSelectHost(hostBridges.giftSelect, () => bookingTicketRef.current, {
1477
+ getUiHosts: () => uiHostsValue,
1478
+ 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
1479
+ });
1476
1480
  bookingTicket.setGiftSelectResolver(resolver);
1477
1481
  }
1478
1482
  return () => {
@@ -1482,6 +1486,7 @@ const SalesSdkProvider = ({ osKey, enableMultiCurrencySettlement = false, soluti
1482
1486
  }, [
1483
1487
  bookingTicket,
1484
1488
  utils === null || utils === void 0 ? void 0 : utils.promotionEvaluator,
1489
+ 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,
1485
1490
  hostBridges.giftSelect,
1486
1491
  uiHostsValue
1487
1492
  ]);
@@ -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 = _asyncToGenerator(function* (productIds) {
246
+ _fetchGiftProductMap = _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 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(_x2, _x3, _x4) {
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 fetchGiftProductMap([Number(option.product_id)])).get(Number(option.product_id));
94
+ if (!product) product = (yield 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 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 = _asyncToGenerator(function* (bookingTicket, mainItem, choices) {
140
+ _replaceStrategyGiftsForMainItem = _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 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([]);