@pisell/private-materials 6.6.56 → 6.6.57

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.
@@ -169,7 +169,7 @@ var BookingDashboard = /*#__PURE__*/forwardRef(function (props, ref) {
169
169
  };
170
170
  }();
171
171
  var calcBookingDataCount = function calcBookingDataCount() {
172
- var _statisticData$total_, _statisticData$total_2, _statisticData$ongoin, _statisticData$ongoin2, _statisticData$upcomi, _statisticData$upcomi2;
172
+ var _statisticData$total_, _statisticData$total_2, _statisticData$ongoin, _statisticData$ongoin2, _statisticData$upcomi, _statisticData$upcomi2, _statisticData$comple, _statisticData$comple2;
173
173
  // 当前在场团体
174
174
  var groupsOnSiteNow = statisticData.groups_today_num || 0;
175
175
  // 当前在场人数
@@ -189,9 +189,9 @@ var BookingDashboard = /*#__PURE__*/forwardRef(function (props, ref) {
189
189
  // 超时的游客
190
190
  var overdue = statisticData.overdue_visitors_num || (hasTurnstileApp ? 0 : '-');
191
191
  // 已完成的游客
192
- var completed = statisticData.completed_visitors.num || 0;
192
+ var completed = ((_statisticData$comple = statisticData.completed_visitors) === null || _statisticData$comple === void 0 ? void 0 : _statisticData$comple.num) || 0;
193
193
  // 已完成的游客二级数据
194
- var completedChildren = statisticData.completed_visitors.statistics || [];
194
+ var completedChildren = ((_statisticData$comple2 = statisticData.completed_visitors) === null || _statisticData$comple2 === void 0 ? void 0 : _statisticData$comple2.statistics) || [];
195
195
  // 已离场的游客
196
196
  var departed = statisticData.departed_visitors_num || (hasTurnstileApp ? 0 : '-');
197
197
  onDataChange === null || onDataChange === void 0 || onDataChange({
@@ -29,6 +29,8 @@ import usePaymentLogger from "./usePaymentLogger";
29
29
  import { isWalkIn } from "../../booking/utils";
30
30
  import { useActiveExecute } from "../../ticketBooking/hooks/pisellos";
31
31
  import { useShopDiscountModule } from "../../ticketBooking/hooks/pisellos/useShopDiscountModule";
32
+ import { useOsKey } from "../../ticketBooking/context";
33
+ import { getShopDiscountKey } from "../../ticketBooking/utils";
32
34
 
33
35
  /**
34
36
  * 自定义Hook:使用WalletPass功能
@@ -40,6 +42,10 @@ export var useWalletPass = function useWalletPass(props) {
40
42
  var logger = usePaymentLogger();
41
43
  var _useActiveExecute = useActiveExecute(),
42
44
  executeIfActive = _useActiveExecute.executeIfActive;
45
+ var osKey = useOsKey();
46
+
47
+ // 根据 osKey 生成模块名称
48
+ var moduleKey = getShopDiscountKey(osKey || 'ticket');
43
49
 
44
50
  // 钱包推荐列表
45
51
  var _useState = useState([]),
@@ -673,7 +679,7 @@ export var useWalletPass = function useWalletPass(props) {
673
679
  // 保持初始顺序设置折扣列表
674
680
  var sortedDiscountList = sortDiscountListWithInitialOrder(detail.discountList);
675
681
  setDiscountList(sortedDiscountList);
676
- pisellos === null || pisellos === void 0 || (_pisellos$effects = pisellos.effects) === null || _pisellos$effects === void 0 || _pisellos$effects.emit('shopDiscount:onSelectedDiscountListChange', detail);
682
+ pisellos === null || pisellos === void 0 || (_pisellos$effects = pisellos.effects) === null || _pisellos$effects === void 0 || _pisellos$effects.emit("".concat(moduleKey, ":onSelectedDiscountListChange"), detail);
677
683
  return;
678
684
  }
679
685
  setWalletSelect([]);
@@ -773,23 +779,25 @@ export var useWalletPass = function useWalletPass(props) {
773
779
  }
774
780
  });
775
781
  var handleSelectDiscount = useMemoizedFn(function (value, option) {
776
- var _detail$discountList, _pisellos$effects2;
777
782
  setLoading(true);
778
- var isSelected = value.includes(option.id);
779
- var detail = shopDiscount.setDiscountSelected({
780
- discountId: option.id,
781
- isSelected: isSelected
782
- });
783
- if (!(detail !== null && detail !== void 0 && (_detail$discountList = detail.discountList) !== null && _detail$discountList !== void 0 && (_detail$discountList = _detail$discountList.find(function (item) {
784
- return item.id === option.id;
785
- })) !== null && _detail$discountList !== void 0 && _detail$discountList.isSelected)) {
783
+ try {
784
+ var _pisellos$effects2;
785
+ var isSelected = value.includes(option.id);
786
+ var detail = shopDiscount.setDiscountSelected({
787
+ discountId: option.id,
788
+ isSelected: isSelected
789
+ });
790
+
791
+ // 保持初始顺序设置折扣列表
792
+ var sortedDiscountList = sortDiscountListWithInitialOrder(detail.discountList);
793
+ setDiscountList(sortedDiscountList);
794
+ pisellos === null || pisellos === void 0 || (_pisellos$effects2 = pisellos.effects) === null || _pisellos$effects2 === void 0 || _pisellos$effects2.emit("".concat(moduleKey, ":onSelectedDiscountListChange"), detail);
795
+ } catch (err) {
796
+ console.log(err, '1234err');
797
+ } finally {
798
+ // 商品券选择流程结束后统一回收loading,避免出现转圈不停止
786
799
  setLoading(false);
787
800
  }
788
-
789
- // 保持初始顺序设置折扣列表
790
- var sortedDiscountList = sortDiscountListWithInitialOrder(detail.discountList);
791
- setDiscountList(sortedDiscountList);
792
- pisellos === null || pisellos === void 0 || (_pisellos$effects2 = pisellos.effects) === null || _pisellos$effects2 === void 0 || _pisellos$effects2.emit('shopDiscount:onSelectedDiscountListChange', detail);
793
801
  });
794
802
 
795
803
  // 清空不可用钱包数据
@@ -144,7 +144,7 @@ var BookingDashboard = (0, import_react.forwardRef)((props, ref) => {
144
144
  calcBookingDataCount();
145
145
  };
146
146
  const calcBookingDataCount = () => {
147
- var _a2, _b2, _c, _d, _e, _f;
147
+ var _a2, _b2, _c, _d, _e, _f, _g, _h;
148
148
  let groupsOnSiteNow = statisticData.groups_today_num || 0;
149
149
  let peopleOnSiteNow = statisticData.people_on_site_now_num || (hasTurnstileApp ? 0 : "-");
150
150
  let totalVisitorsToday = ((_a2 = statisticData.total_visitors_today) == null ? void 0 : _a2.num) || 0;
@@ -154,8 +154,8 @@ var BookingDashboard = (0, import_react.forwardRef)((props, ref) => {
154
154
  let upcoming = ((_e = statisticData.upcoming_visitors) == null ? void 0 : _e.num) || 0;
155
155
  let upcomingChildren = ((_f = statisticData.upcoming_visitors) == null ? void 0 : _f.statistics) || [];
156
156
  let overdue = statisticData.overdue_visitors_num || (hasTurnstileApp ? 0 : "-");
157
- let completed = statisticData.completed_visitors.num || 0;
158
- let completedChildren = statisticData.completed_visitors.statistics || [];
157
+ let completed = ((_g = statisticData.completed_visitors) == null ? void 0 : _g.num) || 0;
158
+ let completedChildren = ((_h = statisticData.completed_visitors) == null ? void 0 : _h.statistics) || [];
159
159
  let departed = statisticData.departed_visitors_num || (hasTurnstileApp ? 0 : "-");
160
160
  onDataChange == null ? void 0 : onDataChange(
161
161
  {
@@ -43,10 +43,14 @@ var import_usePaymentLogger = __toESM(require("./usePaymentLogger"));
43
43
  var import_utils3 = require("../../booking/utils");
44
44
  var import_pisellos = require("../../ticketBooking/hooks/pisellos");
45
45
  var import_useShopDiscountModule = require("../../ticketBooking/hooks/pisellos/useShopDiscountModule");
46
+ var import_context = require("../../ticketBooking/context");
47
+ var import_utils4 = require("../../ticketBooking/utils");
46
48
  var useWalletPass = (props) => {
47
49
  const { onSelectChange, customAmount, clientId } = props;
48
50
  const logger = (0, import_usePaymentLogger.default)();
49
51
  const { executeIfActive } = (0, import_pisellos.useActiveExecute)();
52
+ const osKey = (0, import_context.useOsKey)();
53
+ const moduleKey = (0, import_utils4.getShopDiscountKey)(osKey || "ticket");
50
54
  const [walletRecommendList, setWalletRecommendList] = (0, import_react.useState)([]);
51
55
  const [userIdentificationCodes, setUserIdentificationCodes] = (0, import_react.useState)(
52
56
  []
@@ -506,7 +510,7 @@ var useWalletPass = (props) => {
506
510
  );
507
511
  setDiscountList(sortedDiscountList);
508
512
  (_a = pisellos == null ? void 0 : pisellos.effects) == null ? void 0 : _a.emit(
509
- "shopDiscount:onSelectedDiscountListChange",
513
+ `${moduleKey}:onSelectedDiscountListChange`,
510
514
  detail
511
515
  );
512
516
  return;
@@ -603,24 +607,27 @@ var useWalletPass = (props) => {
603
607
  }
604
608
  });
605
609
  const handleSelectDiscount = (0, import_ahooks.useMemoizedFn)((value, option) => {
606
- var _a, _b, _c;
610
+ var _a;
607
611
  setLoading(true);
608
- const isSelected = value.includes(option.id);
609
- const detail = shopDiscount.setDiscountSelected({
610
- discountId: option.id,
611
- isSelected
612
- });
613
- if (!((_b = (_a = detail == null ? void 0 : detail.discountList) == null ? void 0 : _a.find((item) => item.id === option.id)) == null ? void 0 : _b.isSelected)) {
612
+ try {
613
+ const isSelected = value.includes(option.id);
614
+ const detail = shopDiscount.setDiscountSelected({
615
+ discountId: option.id,
616
+ isSelected
617
+ });
618
+ const sortedDiscountList = sortDiscountListWithInitialOrder(
619
+ detail.discountList
620
+ );
621
+ setDiscountList(sortedDiscountList);
622
+ (_a = pisellos == null ? void 0 : pisellos.effects) == null ? void 0 : _a.emit(
623
+ `${moduleKey}:onSelectedDiscountListChange`,
624
+ detail
625
+ );
626
+ } catch (err) {
627
+ console.log(err, "1234err");
628
+ } finally {
614
629
  setLoading(false);
615
630
  }
616
- const sortedDiscountList = sortDiscountListWithInitialOrder(
617
- detail.discountList
618
- );
619
- setDiscountList(sortedDiscountList);
620
- (_c = pisellos == null ? void 0 : pisellos.effects) == null ? void 0 : _c.emit(
621
- "shopDiscount:onSelectedDiscountListChange",
622
- detail
623
- );
624
631
  });
625
632
  const clearDisabledWalletData = (0, import_ahooks.useMemoizedFn)(() => {
626
633
  setDisabledWalletData([]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "6.6.56",
3
+ "version": "6.6.57",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -61,9 +61,9 @@
61
61
  "styled-components": "^6.0.0-rc.3",
62
62
  "@react-spring/web": "^9.6.1",
63
63
  "@use-gesture/react": "^10.3.1",
64
- "@pisell/icon": "0.0.11",
65
64
  "@pisell/utils": "3.0.2",
66
65
  "@pisell/materials": "6.6.14",
66
+ "@pisell/icon": "0.0.11",
67
67
  "@pisell/date-picker": "3.0.7"
68
68
  },
69
69
  "peerDependencies": {