@pisell/private-materials 6.6.60 → 6.6.62

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 (133) 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/index.js +1 -1
  5. package/build/lowcode/meta.js +2 -2
  6. package/build/lowcode/preview.js +8 -8
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +10 -10
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +10 -10
  11. package/es/components/booking/components/footer/amount.js +3 -4
  12. package/es/components/booking/components/footer/utils.js +82 -85
  13. package/es/components/booking/components/voucher/index.js +1 -1
  14. package/es/components/booking/dashboard/index.d.ts +5 -0
  15. package/es/components/booking/dashboard/index.js +9 -6
  16. package/es/components/booking/info/service2/Group/utils.js +30 -1
  17. package/es/components/booking/info2/service/editService/index.js +6 -49
  18. package/es/components/booking/info2/service/editService/utils.d.ts +0 -1
  19. package/es/components/booking/info2/service/editService/utils.js +0 -16
  20. package/es/components/booking/payments/index.js +1 -1
  21. package/es/components/checkout/hooks/useWalletPass.d.ts +1 -1
  22. package/es/components/checkout/hooks/useWalletPass.js +23 -15
  23. package/es/components/index.d.ts +2 -1
  24. package/es/components/index.js +2 -1
  25. package/es/components/pisellCashCounting/PisellCashCounting.d.ts +5 -0
  26. package/es/components/pisellCashCounting/PisellCashCounting.js +121 -0
  27. package/es/components/pisellCashCounting/PisellCashCounting.less +263 -0
  28. package/es/components/pisellCashCounting/components/CashCountingModal/index.d.ts +20 -0
  29. package/es/components/pisellCashCounting/components/CashCountingModal/index.js +250 -0
  30. package/es/components/pisellCashCounting/components/CashCountingModal/index.less +279 -0
  31. package/es/components/pisellCashCounting/hooks.d.ts +21 -0
  32. package/es/components/pisellCashCounting/hooks.js +193 -0
  33. package/es/components/pisellCashCounting/index.d.ts +2 -0
  34. package/es/components/pisellCashCounting/index.js +1 -0
  35. package/es/components/pisellCashCounting/locales.d.ts +118 -0
  36. package/es/components/pisellCashCounting/locales.js +117 -0
  37. package/es/components/pisellCashCounting/types.d.ts +85 -0
  38. package/es/components/pisellCashCounting/types.js +1 -0
  39. package/es/components/pisellCashCounting/utils.d.ts +10 -0
  40. package/es/components/pisellCashCounting/utils.js +40 -0
  41. package/es/components/ticketBooking/components/addServiceVariant/addService.js +0 -1
  42. package/es/components/ticketBooking/components/bookingDataPanel/bookingDashboard/index.d.ts +2 -0
  43. package/es/components/ticketBooking/components/bookingDataPanel/bookingDashboard/index.js +5 -2
  44. package/es/components/ticketBooking/components/bookingDataPanel/index.d.ts +2 -0
  45. package/es/components/ticketBooking/components/bookingDataPanel/index.js +5 -2
  46. package/es/components/ticketBooking/components/bookingDataPanel/pisellFloatingPanel/index.js +2 -1
  47. package/es/components/ticketBooking/components/ticketBooking/index.js +156 -37
  48. package/es/components/ticketBooking/index.js +7 -1
  49. package/es/components/ticketBooking/utils/formatProductMessage.js +47 -2
  50. package/es/hooks/useResponsive.d.ts +8 -0
  51. package/es/hooks/useResponsive.js +43 -0
  52. package/es/hooks/useThemeTokens.d.ts +7 -0
  53. package/es/hooks/useThemeTokens.js +20 -0
  54. package/es/index.d.ts +1 -0
  55. package/es/index.js +2 -1
  56. package/es/pro/Login2.0/components/phoneValidation.js +65 -58
  57. package/es/pro/NumericStepper/index.d.ts +75 -0
  58. package/es/pro/NumericStepper/index.js +301 -0
  59. package/es/pro/NumericStepper/index.less +364 -0
  60. package/es/pro/keyboards/index.d.ts +2 -0
  61. package/es/pro/keyboards/index.js +1 -0
  62. package/es/pro/keyboards/locales.d.ts +38 -0
  63. package/es/pro/keyboards/locales.js +57 -0
  64. package/es/pro/keyboards/numberKeyboard/index.d.ts +16 -0
  65. package/es/pro/keyboards/numberKeyboard/index.js +523 -0
  66. package/es/pro/keyboards/numberKeyboard/index.less +59 -0
  67. package/es/pro/keyboards/numberKeyboard/types.d.ts +63 -0
  68. package/es/pro/keyboards/numberKeyboard/types.js +1 -0
  69. package/es/pro/pisellPriceKeyboardModal/PisellPriceKeyboardModal.js +3 -1
  70. package/es/pro/pisellPriceKeyboardModal/types.d.ts +2 -0
  71. package/lib/components/booking/components/footer/amount.js +3 -3
  72. package/lib/components/booking/components/footer/utils.js +11 -15
  73. package/lib/components/booking/components/voucher/index.js +1 -1
  74. package/lib/components/booking/dashboard/index.d.ts +5 -0
  75. package/lib/components/booking/dashboard/index.js +6 -5
  76. package/lib/components/booking/info/service2/Group/utils.js +42 -3
  77. package/lib/components/booking/info2/service/editService/index.js +5 -39
  78. package/lib/components/booking/info2/service/editService/utils.d.ts +0 -1
  79. package/lib/components/booking/info2/service/editService/utils.js +0 -16
  80. package/lib/components/booking/payments/index.js +1 -1
  81. package/lib/components/checkout/hooks/useWalletPass.d.ts +1 -1
  82. package/lib/components/checkout/hooks/useWalletPass.js +23 -16
  83. package/lib/components/index.d.ts +2 -1
  84. package/lib/components/index.js +3 -0
  85. package/lib/components/pisellCashCounting/PisellCashCounting.d.ts +5 -0
  86. package/lib/components/pisellCashCounting/PisellCashCounting.js +168 -0
  87. package/lib/components/pisellCashCounting/PisellCashCounting.less +263 -0
  88. package/lib/components/pisellCashCounting/components/CashCountingModal/index.d.ts +20 -0
  89. package/lib/components/pisellCashCounting/components/CashCountingModal/index.js +171 -0
  90. package/lib/components/pisellCashCounting/components/CashCountingModal/index.less +279 -0
  91. package/lib/components/pisellCashCounting/hooks.d.ts +21 -0
  92. package/lib/components/pisellCashCounting/hooks.js +189 -0
  93. package/lib/components/pisellCashCounting/index.d.ts +2 -0
  94. package/lib/components/pisellCashCounting/index.js +35 -0
  95. package/lib/components/pisellCashCounting/locales.d.ts +118 -0
  96. package/lib/components/pisellCashCounting/locales.js +141 -0
  97. package/lib/components/pisellCashCounting/types.d.ts +85 -0
  98. package/lib/components/pisellCashCounting/types.js +17 -0
  99. package/lib/components/pisellCashCounting/utils.d.ts +10 -0
  100. package/lib/components/pisellCashCounting/utils.js +59 -0
  101. package/lib/components/ticketBooking/components/addServiceVariant/addService.js +0 -1
  102. package/lib/components/ticketBooking/components/bookingDataPanel/bookingDashboard/index.d.ts +2 -0
  103. package/lib/components/ticketBooking/components/bookingDataPanel/bookingDashboard/index.js +3 -2
  104. package/lib/components/ticketBooking/components/bookingDataPanel/index.d.ts +2 -0
  105. package/lib/components/ticketBooking/components/bookingDataPanel/index.js +10 -3
  106. package/lib/components/ticketBooking/components/bookingDataPanel/pisellFloatingPanel/index.js +10 -1
  107. package/lib/components/ticketBooking/components/ticketBooking/index.js +114 -14
  108. package/lib/components/ticketBooking/index.js +11 -1
  109. package/lib/components/ticketBooking/utils/formatProductMessage.js +44 -2
  110. package/lib/hooks/useResponsive.d.ts +8 -0
  111. package/lib/hooks/useResponsive.js +48 -0
  112. package/lib/hooks/useThemeTokens.d.ts +7 -0
  113. package/lib/hooks/useThemeTokens.js +40 -0
  114. package/lib/index.d.ts +1 -0
  115. package/lib/index.js +3 -0
  116. package/lib/pro/Login2.0/components/phoneValidation.js +4 -2
  117. package/lib/pro/NumericStepper/index.d.ts +75 -0
  118. package/lib/pro/NumericStepper/index.js +338 -0
  119. package/lib/pro/NumericStepper/index.less +364 -0
  120. package/lib/pro/keyboards/index.d.ts +2 -0
  121. package/lib/pro/keyboards/index.js +39 -0
  122. package/lib/pro/keyboards/locales.d.ts +38 -0
  123. package/lib/pro/keyboards/locales.js +61 -0
  124. package/lib/pro/keyboards/numberKeyboard/index.d.ts +16 -0
  125. package/lib/pro/keyboards/numberKeyboard/index.js +400 -0
  126. package/lib/pro/keyboards/numberKeyboard/index.less +59 -0
  127. package/lib/pro/keyboards/numberKeyboard/types.d.ts +63 -0
  128. package/lib/pro/keyboards/numberKeyboard/types.js +17 -0
  129. package/lib/pro/pisellPriceKeyboardModal/PisellPriceKeyboardModal.js +3 -1
  130. package/lib/pro/pisellPriceKeyboardModal/types.d.ts +2 -0
  131. package/lowcode/pisell-cash-counting/meta.ts +167 -0
  132. package/lowcode/pisell-cash-counting/snippets.ts +13 -0
  133. package/package.json +4 -4
@@ -9,7 +9,9 @@ import "./index.less";
9
9
  var BookingDataPanel = /*#__PURE__*/forwardRef(function (props, ref) {
10
10
  var currentDate = props.currentDate,
11
11
  onBookingClick = props.onBookingClick,
12
- bookingId = props.bookingId;
12
+ bookingId = props.bookingId,
13
+ _props$isVisible = props.isVisible,
14
+ isVisible = _props$isVisible === void 0 ? true : _props$isVisible;
13
15
  var Toast = useToast();
14
16
  var bookingListRef = useRef(null);
15
17
  var bookingDashboardRef = useRef(null);
@@ -22,6 +24,7 @@ var BookingDataPanel = /*#__PURE__*/forwardRef(function (props, ref) {
22
24
  key: 'data-board',
23
25
  children: /*#__PURE__*/React.createElement(BookingDashboard, {
24
26
  bookingTimeStartBetween: bookingTimeStartBetween,
27
+ isVisible: isVisible,
25
28
  ref: bookingDashboardRef
26
29
  })
27
30
  }, {
@@ -34,7 +37,7 @@ var BookingDataPanel = /*#__PURE__*/forwardRef(function (props, ref) {
34
37
  ref: bookingListRef
35
38
  })
36
39
  }];
37
- }, [currentDate, bookingId]);
40
+ }, [currentDate, bookingId, isVisible]);
38
41
  useImperativeHandle(ref, function () {
39
42
  return {
40
43
  refresh: function refresh() {
@@ -61,10 +61,11 @@ var PisellFloatingPanel = /*#__PURE__*/forwardRef(function (props, ref) {
61
61
  });
62
62
  return /*#__PURE__*/React.createElement(PisellFloatingPanelComponent, _extends({}, floationgPanelProps, {
63
63
  open: isOpen
64
- }), /*#__PURE__*/React.createElement(BookingDataPanel, {
64
+ }), isOpen && /*#__PURE__*/React.createElement(BookingDataPanel, {
65
65
  currentDate: currentDate,
66
66
  bookingId: bookingId,
67
67
  onBookingClick: onBookingClick,
68
+ isVisible: isOpen,
68
69
  ref: bookingDataPanelRef
69
70
  }));
70
71
  });
@@ -52,6 +52,28 @@ import { useDebounceFn } from 'ahooks';
52
52
  import { useOsKey } from "../../context";
53
53
  import { useIsActive } from "../../context/IsActiveContext";
54
54
  import { useShopDiscountModule } from "../../hooks/pisellos/useShopDiscountModule";
55
+ // ============= 内存监控埋点(不影响业务逻辑) =============
56
+ var MEM_STATS_KEY = '__pisellTicketBookingMemStats';
57
+ var getMemStats = function getMemStats() {
58
+ var g = globalThis;
59
+ if (!g[MEM_STATS_KEY]) {
60
+ g[MEM_STATS_KEY] = {
61
+ mountedAt: Date.now(),
62
+ storeCreateCount: 0,
63
+ intervalDateSetCount: 0,
64
+ intervalDateTickCount: 0,
65
+ postCartUpdateCount: 0,
66
+ postCartUpdateBytes: 0,
67
+ lastHeartbeatHeapMB: 0,
68
+ crossedThresholdsMB: []
69
+ };
70
+ }
71
+ return g[MEM_STATS_KEY];
72
+ };
73
+ // 水位越线阈值(MB),由低到高,单页面周期内每个阈值只触发一次
74
+ var HEAP_CROSS_THRESHOLDS_MB = [800, 1200, 1500, 2000, 2500];
75
+ // ========================================================
76
+
55
77
  export var _formatBookingDetail = function _formatBookingDetail(data, modalState) {
56
78
  var _bookings$list, _bookings$list2;
57
79
  var customer_id = data.customer_id,
@@ -249,6 +271,9 @@ var TicketBooking = function TicketBooking(props) {
249
271
  var Toast = useToast();
250
272
  var _persistentRef = useRef(false);
251
273
  var _initStateRef = useRef({});
274
+ // 内存监控埋点:镜像最新 state,供心跳定时器读取,避免闭包钉在初次 render
275
+ var _memStateRef = useRef(null);
276
+ _memStateRef.current = state;
252
277
  var _listTimerRef = useRef();
253
278
  var _timerRef = useRef();
254
279
  var _callbackFnRef = useRef();
@@ -466,6 +491,96 @@ var TicketBooking = function TicketBooking(props) {
466
491
  };
467
492
  }, []);
468
493
 
494
+ // ============= 内存监控心跳:每 5 分钟上报一次;水位跨越阈值即时上报 =============
495
+ useEffect(function () {
496
+ var stats = getMemStats();
497
+ // 新页面周期开始,重置 mountedAt 和 crossedThresholds(仅当此单例首次用于本组件)
498
+ if (!stats.mountedAt || Date.now() - stats.mountedAt > 24 * 60 * 60 * 1000) {
499
+ stats.mountedAt = Date.now();
500
+ stats.crossedThresholdsMB = [];
501
+ }
502
+ var buildPayload = function buildPayload(extra) {
503
+ var _store$getState$globa, _store$getState4, _s$modalState$service, _s$modalState, _s$list$bookingList$l, _s$list, _s$bookingId;
504
+ var s = _memStateRef.current || {};
505
+ var perfMem = performance.memory || {};
506
+ var shopId = (_store$getState$globa = store === null || store === void 0 || (_store$getState4 = store.getState) === null || _store$getState4 === void 0 || (_store$getState4 = _store$getState4.call(store)) === null || _store$getState4 === void 0 || (_store$getState4 = _store$getState4.global) === null || _store$getState4 === void 0 || (_store$getState4 = _store$getState4.globalConfig) === null || _store$getState4 === void 0 ? void 0 : _store$getState4.id) !== null && _store$getState$globa !== void 0 ? _store$getState$globa : '';
507
+ var jsHeapUsedMB = perfMem.usedJSHeapSize ? +(perfMem.usedJSHeapSize / 1024 / 1024).toFixed(2) : -1;
508
+ var jsHeapTotalMB = perfMem.totalJSHeapSize ? +(perfMem.totalJSHeapSize / 1024 / 1024).toFixed(2) : -1;
509
+ var jsHeapLimitMB = perfMem.jsHeapSizeLimit ? +(perfMem.jsHeapSizeLimit / 1024 / 1024).toFixed(2) : -1;
510
+ var payload = {
511
+ page_alive_sec: Math.round((Date.now() - stats.mountedAt) / 1000),
512
+ shop_id: shopId,
513
+ url: typeof location !== 'undefined' ? location.href.slice(0, 200) : '',
514
+ js_heap_used_mb: jsHeapUsedMB,
515
+ js_heap_total_mb: jsHeapTotalMB,
516
+ js_heap_limit_mb: jsHeapLimitMB,
517
+ dom_nodes_count: typeof document !== 'undefined' ? document.getElementsByTagName('*').length : -1,
518
+ cart_items_count: (_s$modalState$service = s === null || s === void 0 || (_s$modalState = s.modalState) === null || _s$modalState === void 0 || (_s$modalState = _s$modalState.service) === null || _s$modalState === void 0 || (_s$modalState = _s$modalState.value) === null || _s$modalState === void 0 ? void 0 : _s$modalState.length) !== null && _s$modalState$service !== void 0 ? _s$modalState$service : 0,
519
+ booking_list_count: (_s$list$bookingList$l = s === null || s === void 0 || (_s$list = s.list) === null || _s$list === void 0 || (_s$list = _s$list.bookingList) === null || _s$list === void 0 ? void 0 : _s$list.length) !== null && _s$list$bookingList$l !== void 0 ? _s$list$bookingList$l : 0,
520
+ modal_open: !!(s !== null && s !== void 0 && s.open),
521
+ booking_id: (_s$bookingId = s === null || s === void 0 ? void 0 : s.bookingId) !== null && _s$bookingId !== void 0 ? _s$bookingId : 0,
522
+ board_config_loaded: !!(s !== null && s !== void 0 && s.bookingConfig),
523
+ store_create_count: stats.storeCreateCount,
524
+ interval_date_set_count: stats.intervalDateSetCount,
525
+ interval_date_tick_count: stats.intervalDateTickCount,
526
+ post_cart_update_count: stats.postCartUpdateCount,
527
+ post_cart_update_mb: +(stats.postCartUpdateBytes / 1024 / 1024).toFixed(2),
528
+ ua: typeof navigator !== 'undefined' ? navigator.userAgent.slice(0, 120) : ''
529
+ };
530
+ if (extra) Object.assign(payload, extra);
531
+ return payload;
532
+ };
533
+ var doSend = function doSend(title, extra) {
534
+ try {
535
+ var payload = buildPayload(extra);
536
+ sendWarningLog({
537
+ title: title,
538
+ content: Object.entries(payload).map(function (_ref) {
539
+ var _ref2 = _slicedToArray(_ref, 2),
540
+ key = _ref2[0],
541
+ value = _ref2[1];
542
+ return {
543
+ key: key,
544
+ value: String(value !== null && value !== void 0 ? value : '')
545
+ };
546
+ })
547
+ });
548
+ } catch (e) {}
549
+ };
550
+
551
+ // 心跳:立即发一次(记录进入时基线),然后每 5 分钟发一次
552
+ doSend('TicketBookingMemHeartbeat', {
553
+ reason: 'mounted'
554
+ });
555
+ var heartbeatTimer = setInterval(function () {
556
+ var perfMem = performance.memory || {};
557
+ var heapMB = perfMem.usedJSHeapSize ? perfMem.usedJSHeapSize / 1024 / 1024 : -1;
558
+ stats.lastHeartbeatHeapMB = heapMB;
559
+ doSend('TicketBookingMemHeartbeat', {
560
+ reason: 'heartbeat'
561
+ });
562
+
563
+ // 水位越线检测:本轮心跳时发现某阈值被跨越且之前未上报过
564
+ if (heapMB > 0) {
565
+ for (var _i = 0, _HEAP_CROSS_THRESHOLD = HEAP_CROSS_THRESHOLDS_MB; _i < _HEAP_CROSS_THRESHOLD.length; _i++) {
566
+ var th = _HEAP_CROSS_THRESHOLD[_i];
567
+ if (heapMB >= th && !stats.crossedThresholdsMB.includes(th)) {
568
+ stats.crossedThresholdsMB.push(th);
569
+ doSend('TicketBookingMemHeapCross', {
570
+ reason: 'heap_cross',
571
+ threshold_mb: th,
572
+ current_heap_mb: +heapMB.toFixed(2)
573
+ });
574
+ }
575
+ }
576
+ }
577
+ }, 5 * 60 * 1000);
578
+ return function () {
579
+ clearInterval(heartbeatTimer);
580
+ };
581
+ }, []);
582
+ // ================================================================================
583
+
469
584
  // 日期选择变更事件
470
585
  var _onDateChange = function _onDateChange(date, dateString) {
471
586
  _setIntervalTime(false);
@@ -479,6 +594,10 @@ var TicketBooking = function TicketBooking(props) {
479
594
  var _setIntervalTime = function _setIntervalTime(isInterval) {
480
595
  clearInterval(_timerRef.current);
481
596
  if (isInterval) {
597
+ try {
598
+ var _s = getMemStats();
599
+ _s.intervalDateSetCount = (_s.intervalDateSetCount || 0) + 1;
600
+ } catch (e) {}
482
601
  setState({
483
602
  isTimeChange: false,
484
603
  isDateChange: false
@@ -488,6 +607,10 @@ var TicketBooking = function TicketBooking(props) {
488
607
  }
489
608
  _setDataChange(dayjs());
490
609
  _timerRef.current = setInterval(function () {
610
+ try {
611
+ var _s2 = getMemStats();
612
+ _s2.intervalDateTickCount = (_s2.intervalDateTickCount || 0) + 1;
613
+ } catch (e) {}
491
614
  _setDataChange(dayjs());
492
615
  }, 1000 * 60);
493
616
  }
@@ -561,7 +684,6 @@ var TicketBooking = function TicketBooking(props) {
561
684
  } catch (error) {
562
685
  console.error(error);
563
686
  }
564
- console.log('formatedProducts', total, formatedProducts);
565
687
  var fees = [];
566
688
  var products = [];
567
689
  var _iterator3 = _createForOfIteratorHelper(formatedProducts),
@@ -625,42 +747,41 @@ var TicketBooking = function TicketBooking(props) {
625
747
  message: (_locales$getText2 = locales.getText('pisell2.product.card.cart-items')) === null || _locales$getText2 === void 0 ? void 0 : _locales$getText2(products.length)
626
748
  });
627
749
  }
628
- console.log('start post message, config:', {
750
+ interaction === null || interaction === void 0 || (_interaction$utils4 = interaction.utils) === null || _interaction$utils4 === void 0 || (_interaction$utils4$p = _interaction$utils4.postMessageToApp) === null || _interaction$utils4$p === void 0 || _interaction$utils4$p.call(_interaction$utils4, {
629
751
  module: 'cds',
630
752
  key: 'cartUpdate',
631
753
  data: {
632
754
  currency_symbol: getSymbolic(),
633
- total: total.productAmount,
755
+ total: total.expectAmount,
634
756
  // 小计
635
757
  products: products,
636
758
  fees: fees
637
759
  }
638
760
  });
639
- interaction === null || interaction === void 0 || (_interaction$utils4 = interaction.utils) === null || _interaction$utils4 === void 0 || (_interaction$utils4$p = _interaction$utils4.postMessageToApp) === null || _interaction$utils4$p === void 0 || _interaction$utils4$p.call(_interaction$utils4, {
640
- module: 'cds',
641
- key: 'cartUpdate',
642
- data: {
761
+ // 内存监控埋点:统计 cartUpdate 消息的累计次数和字节数
762
+ try {
763
+ var _s = getMemStats();
764
+ _s.postCartUpdateCount = (_s.postCartUpdateCount || 0) + 1;
765
+ var _payload = {
643
766
  currency_symbol: getSymbolic(),
644
767
  total: total.expectAmount,
645
- // 小计
646
768
  products: products,
647
769
  fees: fees
648
- }
649
- });
770
+ };
771
+ _s.postCartUpdateBytes = (_s.postCartUpdateBytes || 0) + JSON.stringify(_payload).length;
772
+ } catch (e) {}
650
773
  }, [state === null || state === void 0 || (_state$modalState2 = state.modalState) === null || _state$modalState2 === void 0 || (_state$modalState2 = _state$modalState2.service) === null || _state$modalState2 === void 0 ? void 0 : _state$modalState2.value]);
651
774
 
652
775
  /**
653
776
  * 设置弹窗内的状态
654
777
  */
655
778
  var _setModalState = function _setModalState(props) {
656
- var _newVal$service2;
657
779
  console.log('同步state到外层', props);
658
780
  var newVal = _objectSpread({}, props);
659
781
  if (newVal.service) {
660
782
  var _newVal$service;
661
783
  newVal.service.value = (newVal === null || newVal === void 0 || (_newVal$service = newVal.service) === null || _newVal$service === void 0 ? void 0 : _newVal$service.value) || [];
662
784
  }
663
- console.log(newVal === null || newVal === void 0 || (_newVal$service2 = newVal.service) === null || _newVal$service2 === void 0 ? void 0 : _newVal$service2.value, 'newVal.service.value');
664
785
  setState({
665
786
  modalState: _objectSpread(_objectSpread({}, state.modalState), newVal)
666
787
  });
@@ -696,14 +817,14 @@ var TicketBooking = function TicketBooking(props) {
696
817
  }, 100);
697
818
  };
698
819
  var _setShopOpeningHours = function _setShopOpeningHours() {
699
- var _getData, _store$getState4;
700
- var time = (getData === null || getData === void 0 || (_getData = getData('operating_day_boundary')) === null || _getData === void 0 ? void 0 : _getData.time) || (store === null || store === void 0 || (_store$getState4 = store.getState) === null || _store$getState4 === void 0 || (_store$getState4 = _store$getState4.call(store)) === null || _store$getState4 === void 0 || (_store$getState4 = _store$getState4.global) === null || _store$getState4 === void 0 || (_store$getState4 = _store$getState4.shopDetail) === null || _store$getState4 === void 0 || (_store$getState4 = _store$getState4.operating_day_boundary) === null || _store$getState4 === void 0 ? void 0 : _store$getState4.time);
820
+ var _getData, _store$getState5;
821
+ var time = (getData === null || getData === void 0 || (_getData = getData('operating_day_boundary')) === null || _getData === void 0 ? void 0 : _getData.time) || (store === null || store === void 0 || (_store$getState5 = store.getState) === null || _store$getState5 === void 0 || (_store$getState5 = _store$getState5.call(store)) === null || _store$getState5 === void 0 || (_store$getState5 = _store$getState5.global) === null || _store$getState5 === void 0 || (_store$getState5 = _store$getState5.shopDetail) === null || _store$getState5 === void 0 || (_store$getState5 = _store$getState5.operating_day_boundary) === null || _store$getState5 === void 0 ? void 0 : _store$getState5.time);
701
822
  if (time) {
702
823
  localStorage.setItem('shopOpeningHours', time);
703
824
  }
704
825
  };
705
826
  var _getAddTimeProducts = /*#__PURE__*/function () {
706
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
827
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
707
828
  var data;
708
829
  return _regeneratorRuntime().wrap(function _callee$(_context) {
709
830
  while (1) switch (_context.prev = _context.next) {
@@ -726,7 +847,7 @@ var TicketBooking = function TicketBooking(props) {
726
847
  }, _callee);
727
848
  }));
728
849
  return function _getAddTimeProducts() {
729
- return _ref.apply(this, arguments);
850
+ return _ref3.apply(this, arguments);
730
851
  };
731
852
  }();
732
853
 
@@ -734,7 +855,7 @@ var TicketBooking = function TicketBooking(props) {
734
855
  * 获取board配置
735
856
  */
736
857
  var _getBoardConfig = /*#__PURE__*/function () {
737
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
858
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
738
859
  var bookingConfigParams, isHasCache, cachedBoardConfig, _cachedBoardConfig$co, data;
739
860
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
740
861
  while (1) switch (_context2.prev = _context2.next) {
@@ -788,7 +909,7 @@ var TicketBooking = function TicketBooking(props) {
788
909
  }, _callee2, null, [[3, 11]]);
789
910
  }));
790
911
  return function _getBoardConfig() {
791
- return _ref2.apply(this, arguments);
912
+ return _ref4.apply(this, arguments);
792
913
  };
793
914
  }();
794
915
  var _addVisibilityListener = function _addVisibilityListener(callback) {
@@ -914,9 +1035,9 @@ var TicketBooking = function TicketBooking(props) {
914
1035
  // 储存参数, 添加服务商品时使用
915
1036
  sessionStorage.setItem('pisell2.booking.serviceParams', JSON.stringify(data));
916
1037
  } else {
917
- var _store$getState5;
1038
+ var _store$getState6;
918
1039
  // 当前时区的时间
919
- var timezone = store === null || store === void 0 || (_store$getState5 = store.getState) === null || _store$getState5 === void 0 || (_store$getState5 = _store$getState5.call(store)) === null || _store$getState5 === void 0 || (_store$getState5 = _store$getState5.global) === null || _store$getState5 === void 0 || (_store$getState5 = _store$getState5.globalConfig) === null || _store$getState5 === void 0 ? void 0 : _store$getState5.timezone;
1040
+ var timezone = store === null || store === void 0 || (_store$getState6 = store.getState) === null || _store$getState6 === void 0 || (_store$getState6 = _store$getState6.call(store)) === null || _store$getState6 === void 0 || (_store$getState6 = _store$getState6.global) === null || _store$getState6 === void 0 || (_store$getState6 = _store$getState6.globalConfig) === null || _store$getState6 === void 0 ? void 0 : _store$getState6.timezone;
920
1041
  initState.modalState.date.value = dayjs.tz(new Date(), timezone);
921
1042
  // 兜底, 没有传递则清空下
922
1043
  sessionStorage.removeItem('pisell2.booking.serviceParams');
@@ -926,7 +1047,6 @@ var TicketBooking = function TicketBooking(props) {
926
1047
  }
927
1048
  if (data !== null && data !== void 0 && data.eventBookingServiceParams) {}
928
1049
  }
929
- console.log(initState, 'initState');
930
1050
  setState(_objectSpread(_objectSpread({}, initState), {}, _defineProperty(_defineProperty({}, state.renderType === 'eventBooking' ? 'eventOpen' : 'open', true), "bookingId", state.bookingId)));
931
1051
  };
932
1052
  var _rebook = useMemoizedFn(function () {
@@ -945,7 +1065,7 @@ var TicketBooking = function TicketBooking(props) {
945
1065
  *
946
1066
  */
947
1067
  var _getBookingDetail = /*#__PURE__*/function () {
948
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(bookingId) {
1068
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(bookingId) {
949
1069
  var renderType, openRebook, getDetail, data;
950
1070
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
951
1071
  while (1) switch (_context3.prev = _context3.next) {
@@ -967,7 +1087,6 @@ var TicketBooking = function TicketBooking(props) {
967
1087
  })
968
1088
  });
969
1089
  }
970
- console.log('getBookingDetail', data);
971
1090
 
972
1091
  // 格式化储存
973
1092
  _initBookingData('edit', data);
@@ -976,14 +1095,14 @@ var TicketBooking = function TicketBooking(props) {
976
1095
  _rebook();
977
1096
  });
978
1097
  }
979
- case 10:
1098
+ case 9:
980
1099
  case "end":
981
1100
  return _context3.stop();
982
1101
  }
983
1102
  }, _callee3);
984
1103
  }));
985
1104
  return function _getBookingDetail(_x) {
986
- return _ref3.apply(this, arguments);
1105
+ return _ref5.apply(this, arguments);
987
1106
  };
988
1107
  }();
989
1108
  /**
@@ -991,16 +1110,16 @@ var TicketBooking = function TicketBooking(props) {
991
1110
  *
992
1111
  */
993
1112
  var _openModal = function _openModal(props) {
994
- var _ref4 = props || {},
995
- bookingId = _ref4.bookingId,
996
- serviceParams = _ref4.serviceParams,
997
- params = _ref4.params,
998
- eventBookingServiceParams = _ref4.eventBookingServiceParams,
999
- _ref4$renderType = _ref4.renderType,
1000
- renderType = _ref4$renderType === void 0 ? 'booking' : _ref4$renderType,
1001
- openRebook = _ref4.openRebook,
1002
- _ref4$isParallelResou = _ref4.isParallelResourcesBooking,
1003
- isParallelResourcesBooking = _ref4$isParallelResou === void 0 ? true : _ref4$isParallelResou;
1113
+ var _ref6 = props || {},
1114
+ bookingId = _ref6.bookingId,
1115
+ serviceParams = _ref6.serviceParams,
1116
+ params = _ref6.params,
1117
+ eventBookingServiceParams = _ref6.eventBookingServiceParams,
1118
+ _ref6$renderType = _ref6.renderType,
1119
+ renderType = _ref6$renderType === void 0 ? 'booking' : _ref6$renderType,
1120
+ openRebook = _ref6.openRebook,
1121
+ _ref6$isParallelResou = _ref6.isParallelResourcesBooking,
1122
+ isParallelResourcesBooking = _ref6$isParallelResou === void 0 ? true : _ref6$isParallelResou;
1004
1123
  setState({
1005
1124
  isShowInfo: false
1006
1125
  });
@@ -1037,7 +1156,7 @@ var TicketBooking = function TicketBooking(props) {
1037
1156
  });
1038
1157
  };
1039
1158
  var _scanBookingDetailResult = /*#__PURE__*/function () {
1040
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(detail) {
1159
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(detail) {
1041
1160
  var _Toast$loading, _result;
1042
1161
  var result, objDetail;
1043
1162
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
@@ -1091,7 +1210,7 @@ var TicketBooking = function TicketBooking(props) {
1091
1210
  }, _callee4);
1092
1211
  }));
1093
1212
  return function _scanBookingDetailResult(_x2) {
1094
- return _ref5.apply(this, arguments);
1213
+ return _ref7.apply(this, arguments);
1095
1214
  };
1096
1215
  }();
1097
1216
  /**
@@ -206,12 +206,18 @@ export default (function (props) {
206
206
  request.setRequest(context.appHelper.utils.request);
207
207
  }, []);
208
208
  useMemo(function () {
209
+ try {
210
+ var g = globalThis;
211
+ if (g.__pisellTicketBookingMemStats) {
212
+ g.__pisellTicketBookingMemStats.storeCreateCount = (g.__pisellTicketBookingMemStats.storeCreateCount || 0) + 1;
213
+ }
214
+ } catch (e) {}
209
215
  var store = createStore(_objectSpread(_objectSpread({}, cloneDeep(initialState)), {}, {
210
216
  bookingConfigParams: bookingConfigParams,
211
217
  productExtensionType: productExtensionType
212
218
  }));
213
219
  storeRef.current = store;
214
- }, [bookingConfigParams, productExtensionType]);
220
+ }, [JSON.stringify(bookingConfigParams), JSON.stringify(productExtensionType)]);
215
221
  useMemo(function () {
216
222
  if (BookingTicket) {
217
223
  var _businessUtils$getApp;
@@ -1,6 +1,20 @@
1
1
  import { formatAmount } from '@pisell/utils';
2
2
  import { getServiceTime } from "./formatTime";
3
+ import { locales } from '@pisell/utils';
4
+ var UNIT_LABEL = {
5
+ KILOGRAMS: 'kg',
6
+ GRAMS: 'g',
7
+ POUNDS: 'lb',
8
+ OUNCES: 'oz'
9
+ };
10
+ var DEFAULT_WEIGHT_PRECISION = 3;
11
+ var formatWeightValue = function formatWeightValue(value) {
12
+ var parsedValue = Number(value);
13
+ var displayValue = Number.isFinite(parsedValue) ? parsedValue : 0;
14
+ return displayValue.toFixed(DEFAULT_WEIGHT_PRECISION);
15
+ };
3
16
  var formatProductMessage = function formatProductMessage(product, utils) {
17
+ var _product$_origin;
4
18
  var product_option_string = product.product_option_string,
5
19
  options = product.options,
6
20
  bundle = product.bundle,
@@ -42,6 +56,32 @@ var formatProductMessage = function formatProductMessage(product, utils) {
42
56
  });
43
57
  }
44
58
 
59
+ // 重量信息
60
+ var weighing = product === null || product === void 0 || (_product$_origin = product._origin) === null || _product$_origin === void 0 || (_product$_origin = _product$_origin._extend) === null || _product$_origin === void 0 ? void 0 : _product$_origin.weighing;
61
+ if (weighing) {
62
+ var mode = weighing.mode,
63
+ unit_price = weighing.unit_price,
64
+ unit = weighing.unit,
65
+ weight = weighing.weight,
66
+ tare = weighing.tare,
67
+ net_weight = weighing.net_weight;
68
+ var unitLabel = UNIT_LABEL[unit] || unit;
69
+ var weightText = formatWeightValue(weight);
70
+ var tareText = formatWeightValue(tare === null || tare === void 0 ? void 0 : tare.value);
71
+ var netWeightText = formatWeightValue(net_weight);
72
+ var tareValue = Number((tare === null || tare === void 0 ? void 0 : tare.value) || 0);
73
+ var isManualWeight = mode === 'manual';
74
+ var unitPriceText = "".concat(currency_symbol || '').concat(unit_price !== null && unit_price !== void 0 ? unit_price : '0.00');
75
+ var manualPrefix = isManualWeight ? '(M) ' : '';
76
+ if (tareValue > 0) {
77
+ str += "".concat(manualPrefix).concat(locales.getText('pisell2.cart.sku-card.weighing.gross'), ": ").concat(weightText, " ").concat(unitLabel, " \n");
78
+ }
79
+ if (tareValue > 0) {
80
+ str += "".concat(locales.getText('pisell2.cart.sku-card.weighing.tare'), ": ").concat(tareText, " ").concat(UNIT_LABEL[tare === null || tare === void 0 ? void 0 : tare.unit] || (tare === null || tare === void 0 ? void 0 : tare.unit) || unitLabel, " \n");
81
+ }
82
+ str += "".concat(tareValue > 0 ? '' : manualPrefix).concat(netWeightText, " ").concat(unitLabel, " ").concat(locales.getText('pisell2.cart.sku-card.weighing.net'), " @ ").concat(unitPriceText, "/").concat(unitLabel, " \n");
83
+ }
84
+
45
85
  // 组合规格 单规格
46
86
  if (product_option_string) str += "".concat(product_option_string, "\n");
47
87
  if (Array.isArray(options) && options.length) {
@@ -53,8 +93,13 @@ var formatProductMessage = function formatProductMessage(product, utils) {
53
93
  // 套餐
54
94
  if (Array.isArray(bundle) && bundle.length) {
55
95
  bundle.forEach(function (item) {
56
- str += "".concat(item.title, " \n");
57
- str += "".concat(formatAmount(item.price, 2, currency_symbol), " x ").concat(item.num);
96
+ str += "".concat(item.title, " ").concat(formatAmount(item.price, 2, currency_symbol), " x ").concat(item.num, "\n");
97
+ var bundleOptions = item === null || item === void 0 ? void 0 : item.options;
98
+ if (Array.isArray(bundleOptions) && bundleOptions.length) {
99
+ bundleOptions.forEach(function (opt) {
100
+ str += " ".concat(opt === null || opt === void 0 ? void 0 : opt.name, " ").concat(formatAmount(opt === null || opt === void 0 ? void 0 : opt.price, 2, currency_symbol), " x ").concat(opt === null || opt === void 0 ? void 0 : opt.num, "\n");
101
+ });
102
+ }
58
103
  });
59
104
  }
60
105
  return str;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * 响应式监听 Hook
3
+ * 监听窗口大小变化,返回当前是否为移动端
4
+ *
5
+ * @param breakpoint - 断点宽度(默认 768px)
6
+ * @returns 是否为移动端
7
+ */
8
+ export declare function useResponsive(breakpoint?: number): boolean;
@@ -0,0 +1,43 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import { useEffect, useState } from 'react';
8
+
9
+ /**
10
+ * 响应式监听 Hook
11
+ * 监听窗口大小变化,返回当前是否为移动端
12
+ *
13
+ * @param breakpoint - 断点宽度(默认 768px)
14
+ * @returns 是否为移动端
15
+ */
16
+ export function useResponsive() {
17
+ var breakpoint = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 768;
18
+ var _useState = useState(typeof window !== 'undefined' ? window.innerWidth < breakpoint : false),
19
+ _useState2 = _slicedToArray(_useState, 2),
20
+ isMobile = _useState2[0],
21
+ setIsMobile = _useState2[1];
22
+ useEffect(function () {
23
+ // 服务端渲染时不执行
24
+ if (typeof window === 'undefined') {
25
+ return;
26
+ }
27
+ var handleResize = function handleResize() {
28
+ setIsMobile(window.innerWidth < breakpoint);
29
+ };
30
+
31
+ // 添加监听器
32
+ window.addEventListener('resize', handleResize);
33
+
34
+ // 初始化检查
35
+ handleResize();
36
+
37
+ // 清理监听器
38
+ return function () {
39
+ window.removeEventListener('resize', handleResize);
40
+ };
41
+ }, [breakpoint]);
42
+ return isMobile;
43
+ }
@@ -0,0 +1,7 @@
1
+ declare type ThemeInput = {
2
+ token?: {
3
+ colorPrimary?: string;
4
+ };
5
+ };
6
+ declare const useThemeTokens: (themeInput?: ThemeInput) => any;
7
+ export default useThemeTokens;
@@ -0,0 +1,20 @@
1
+ import { theme } from 'antd';
2
+ var themeTokenCache = new Map();
3
+ var useThemeTokens = function useThemeTokens(themeInput) {
4
+ var _themeInput$token;
5
+ var useToken = theme.useToken,
6
+ getDesignToken = theme.getDesignToken;
7
+ var _useToken = useToken(),
8
+ antdToken = _useToken.token;
9
+ var overrideColorPrimary = (themeInput === null || themeInput === void 0 || (_themeInput$token = themeInput.token) === null || _themeInput$token === void 0 ? void 0 : _themeInput$token.colorPrimary) || antdToken.colorPrimary;
10
+ var cached = themeTokenCache.get(overrideColorPrimary);
11
+ if (cached) return cached;
12
+ var computed = getDesignToken({
13
+ token: {
14
+ colorPrimary: overrideColorPrimary
15
+ }
16
+ });
17
+ themeTokenCache.set(overrideColorPrimary, computed);
18
+ return computed;
19
+ };
20
+ export default useThemeTokens;
package/es/index.d.ts CHANGED
@@ -77,3 +77,4 @@ export { default as SaasRole } from './plus/saasRole';
77
77
  export { default as SaasTeamMembers } from './plus/saasTeamMembers';
78
78
  export type { SaasTeamMembersProps } from './plus/saasTeamMembers/type';
79
79
  export { default as SaasAttendance } from './plus/saasAttendance';
80
+ export { default as PisellCashCounting } from './components/pisellCashCounting';
package/es/index.js CHANGED
@@ -78,4 +78,5 @@ export { default as HolderList } from "./plus/selectHolder/components/HolderList
78
78
  export { default as SettingsRegistry } from "./components/systemSettings/registry";
79
79
  export { default as SaasRole } from "./plus/saasRole";
80
80
  export { default as SaasTeamMembers } from "./plus/saasTeamMembers";
81
- export { default as SaasAttendance } from "./plus/saasAttendance";
81
+ export { default as SaasAttendance } from "./plus/saasAttendance";
82
+ export { default as PisellCashCounting } from "./components/pisellCashCounting";