@pisell/private-materials 6.3.98 → 6.3.99

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.
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { SendModalValues } from './index';
3
2
  declare const useSendModal: (bookingId?: number) => {
4
3
  open: boolean;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  interface LogData {
3
2
  key: string;
4
3
  value: any;
@@ -5,7 +5,6 @@ interface PassDetailProps {
5
5
  platform?: 'pc' | 'h5';
6
6
  buttonGroupList?: any[][];
7
7
  showTimeLine?: boolean;
8
- onDetailRefresh?: (passId: number | string, patch: any) => void;
9
8
  onListRefresh?: () => void;
10
9
  }
11
10
  declare const PassDetail: (props: PassDetailProps) => React.JSX.Element | null;
@@ -41,7 +41,6 @@ var PassDetail = function PassDetail(props) {
41
41
  platform = _props$platform === void 0 ? 'pc' : _props$platform,
42
42
  _props$showTimeLine = props.showTimeLine,
43
43
  showTimeLine = _props$showTimeLine === void 0 ? true : _props$showTimeLine,
44
- onDetailRefresh = props.onDetailRefresh,
45
44
  onListRefresh = props.onListRefresh;
46
45
  var _useState = useState('detail'),
47
46
  _useState2 = _slicedToArray(_useState, 2),
@@ -111,38 +110,15 @@ var PassDetail = function PassDetail(props) {
111
110
  var _interaction$utils, _interaction$utils$mo;
112
111
  interaction === null || interaction === void 0 || (_interaction$utils = interaction.utils) === null || _interaction$utils === void 0 || (_interaction$utils$mo = _interaction$utils.mountFunction) === null || _interaction$utils$mo === void 0 || _interaction$utils$mo.call(_interaction$utils, 'customer', 'recharge', /*#__PURE__*/function () {
113
112
  var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(strVal) {
114
- var _getDetail$refreshAsy, latest, patch;
115
113
  return _regeneratorRuntime().wrap(function _callee$(_context) {
116
114
  while (1) switch (_context.prev = _context.next) {
117
115
  case 0:
118
- if (strVal) {
119
- _context.next = 2;
120
- break;
121
- }
122
116
  return _context.abrupt("return", onListRefresh === null || onListRefresh === void 0 ? void 0 : onListRefresh());
123
- case 2:
124
- _context.prev = 2;
125
- _context.next = 5;
126
- return (_getDetail$refreshAsy = _getDetail.refreshAsync) === null || _getDetail$refreshAsy === void 0 ? void 0 : _getDetail$refreshAsy.call(_getDetail);
127
- case 5:
128
- latest = _context.sent;
129
- patch = {
130
- balance: (latest === null || latest === void 0 ? void 0 : latest.balance) !== undefined ? latest.balance : balance !== null && balance !== void 0 ? balance : undefined,
131
- expire_date: (latest === null || latest === void 0 ? void 0 : latest.expire_date) !== undefined ? latest.expire_date : expire_date !== null && expire_date !== void 0 ? expire_date : undefined,
132
- unified_available_status: latest === null || latest === void 0 ? void 0 : latest.unified_available_status
133
- };
134
- onDetailRefresh === null || onDetailRefresh === void 0 || onDetailRefresh(id, patch);
135
- _context.next = 13;
136
- break;
137
- case 10:
138
- _context.prev = 10;
139
- _context.t0 = _context["catch"](2);
140
- console.error(_context.t0);
141
- case 13:
117
+ case 1:
142
118
  case "end":
143
119
  return _context.stop();
144
120
  }
145
- }, _callee, null, [[2, 10]]);
121
+ }, _callee);
146
122
  }));
147
123
  return function (_x) {
148
124
  return _ref4.apply(this, arguments);
@@ -6,7 +6,9 @@ import React from 'react';
6
6
  import { Button, List } from 'antd';
7
7
  import { PisellWalletPassCard } from '@pisell/materials';
8
8
  import { locales } from '@pisell/utils';
9
+ import useEngineContext from "../../../../hooks/useEngineContext";
9
10
  var PassList = function PassList(props) {
11
+ var _context$appHelper;
10
12
  var _props$dataSource = props.dataSource,
11
13
  dataSource = _props$dataSource === void 0 ? [] : _props$dataSource,
12
14
  value = props.value,
@@ -17,6 +19,11 @@ var PassList = function PassList(props) {
17
19
  onLoadMore = props.onLoadMore,
18
20
  loading = props.loading,
19
21
  onEditHolder = props.onEditHolder;
22
+ var context = useEngineContext();
23
+ var utils = (context === null || context === void 0 || (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {};
24
+ var isTerminal = utils.isTerminal,
25
+ isApp = utils.isApp;
26
+ var isTerminalEnv = (typeof isTerminal === 'function' ? isTerminal() : !!isTerminal) || (isApp === null || isApp === void 0 ? void 0 : isApp());
20
27
  var _loadMore = /*#__PURE__*/React.createElement("div", {
21
28
  style: {
22
29
  textAlign: 'center',
@@ -112,7 +119,7 @@ var PassList = function PassList(props) {
112
119
  code: encoded,
113
120
  validDate: expire_date,
114
121
  holder: holder,
115
- onSetHolder: function onSetHolder() {
122
+ onSetHolder: isTerminalEnv ? undefined : function () {
116
123
  var _holder$metadata;
117
124
  onEditHolder === null || onEditHolder === void 0 || onEditHolder({
118
125
  wallet_pass_detail_id: id,
@@ -498,34 +498,6 @@ var WalletPassGallery = function WalletPassGallery(props) {
498
498
  console.log('pass not found', passId);
499
499
  }
500
500
  };
501
- var _handleDetailRefresh = function _handleDetailRefresh(passId, patch) {
502
- if (_avaliable.find(function (item) {
503
- return item.id === passId;
504
- })) {
505
- _getAvailableList.mutate(function (data) {
506
- var newList = data.list.map(function (item) {
507
- return item.id === passId ? _objectSpread(_objectSpread({}, item), patch) : item;
508
- });
509
- return _objectSpread(_objectSpread({}, data), {}, {
510
- list: newList
511
- });
512
- });
513
- return;
514
- }
515
- if (_unavailable.find(function (item) {
516
- return item.id === passId;
517
- })) {
518
- _getUnavailableList.mutate(function (data) {
519
- var newList = data.list.map(function (item) {
520
- return item.id === passId ? _objectSpread(_objectSpread({}, item), patch) : item;
521
- });
522
- return _objectSpread(_objectSpread({}, data), {}, {
523
- list: newList
524
- });
525
- });
526
- return;
527
- }
528
- };
529
501
  var _handleBindHolder = /*#__PURE__*/function () {
530
502
  var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(holderId) {
531
503
  var passId, res;
@@ -618,7 +590,6 @@ var WalletPassGallery = function WalletPassGallery(props) {
618
590
  }, /*#__PURE__*/React.createElement(PassDetail, {
619
591
  dataSource: _currentItem,
620
592
  platform: platform,
621
- onDetailRefresh: _handleDetailRefresh,
622
593
  onListRefresh: listReload
623
594
  })));
624
595
  };
@@ -656,7 +627,6 @@ var WalletPassGallery = function WalletPassGallery(props) {
656
627
  }, /*#__PURE__*/React.createElement(PassDetail, {
657
628
  dataSource: _currentItem,
658
629
  platform: platform,
659
- onDetailRefresh: _handleDetailRefresh,
660
630
  onListRefresh: listReload
661
631
  })));
662
632
  };
@@ -815,7 +785,6 @@ var WalletPassGallery = function WalletPassGallery(props) {
815
785
  }, /*#__PURE__*/React.createElement(PassDetail, {
816
786
  dataSource: _currentItem,
817
787
  platform: platform,
818
- onDetailRefresh: _handleDetailRefresh,
819
788
  onListRefresh: listReload
820
789
  })));
821
790
  };
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { SendModalValues } from './index';
3
2
  declare const useSendModal: (bookingId?: number) => {
4
3
  open: boolean;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  interface LogData {
3
2
  key: string;
4
3
  value: any;
@@ -5,7 +5,6 @@ interface PassDetailProps {
5
5
  platform?: 'pc' | 'h5';
6
6
  buttonGroupList?: any[][];
7
7
  showTimeLine?: boolean;
8
- onDetailRefresh?: (passId: number | string, patch: any) => void;
9
8
  onListRefresh?: () => void;
10
9
  }
11
10
  declare const PassDetail: (props: PassDetailProps) => React.JSX.Element | null;
@@ -59,7 +59,6 @@ var PassDetail = (props) => {
59
59
  dataSource,
60
60
  platform = "pc",
61
61
  showTimeLine = true,
62
- onDetailRefresh,
63
62
  onListRefresh
64
63
  } = props;
65
64
  const [activeKey, setActiveKey] = (0, import_react.useState)("detail");
@@ -110,21 +109,7 @@ var PassDetail = (props) => {
110
109
  "customer",
111
110
  "recharge",
112
111
  async (strVal) => {
113
- var _a3;
114
- if (!strVal) {
115
- return onListRefresh == null ? void 0 : onListRefresh();
116
- }
117
- try {
118
- const latest = await ((_a3 = _getDetail.refreshAsync) == null ? void 0 : _a3.call(_getDetail));
119
- const patch = {
120
- balance: (latest == null ? void 0 : latest.balance) !== void 0 ? latest.balance : balance ?? void 0,
121
- expire_date: (latest == null ? void 0 : latest.expire_date) !== void 0 ? latest.expire_date : expire_date ?? void 0,
122
- unified_available_status: latest == null ? void 0 : latest.unified_available_status
123
- };
124
- onDetailRefresh == null ? void 0 : onDetailRefresh(id, patch);
125
- } catch (err) {
126
- console.error(err);
127
- }
112
+ return onListRefresh == null ? void 0 : onListRefresh();
128
113
  }
129
114
  );
130
115
  }, [id]);
@@ -36,7 +36,9 @@ var import_react = __toESM(require("react"));
36
36
  var import_antd = require("antd");
37
37
  var import_materials = require("@pisell/materials");
38
38
  var import_utils = require("@pisell/utils");
39
+ var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContext"));
39
40
  var PassList = (props) => {
41
+ var _a;
40
42
  const {
41
43
  dataSource = [],
42
44
  value,
@@ -47,6 +49,10 @@ var PassList = (props) => {
47
49
  loading,
48
50
  onEditHolder
49
51
  } = props;
52
+ const context = (0, import_useEngineContext.default)();
53
+ const utils = ((_a = context == null ? void 0 : context.appHelper) == null ? void 0 : _a.utils) || {};
54
+ const { isTerminal, isApp } = utils;
55
+ const isTerminalEnv = (typeof isTerminal === "function" ? isTerminal() : !!isTerminal) || (isApp == null ? void 0 : isApp());
50
56
  const _loadMore = /* @__PURE__ */ import_react.default.createElement(
51
57
  "div",
52
58
  {
@@ -130,12 +136,12 @@ var PassList = (props) => {
130
136
  code: encoded,
131
137
  validDate: expire_date,
132
138
  holder,
133
- onSetHolder: () => {
134
- var _a;
139
+ onSetHolder: isTerminalEnv ? void 0 : () => {
140
+ var _a2;
135
141
  onEditHolder == null ? void 0 : onEditHolder({
136
142
  wallet_pass_detail_id: id,
137
143
  customer_id: holder == null ? void 0 : holder.customer_id,
138
- form_id: (_a = holder == null ? void 0 : holder.metadata) == null ? void 0 : _a.custom_id
144
+ form_id: (_a2 = holder == null ? void 0 : holder.metadata) == null ? void 0 : _a2.custom_id
139
145
  });
140
146
  }
141
147
  }
@@ -385,32 +385,6 @@ var WalletPassGallery = (props) => {
385
385
  console.log("pass not found", passId);
386
386
  }
387
387
  };
388
- const _handleDetailRefresh = (passId, patch) => {
389
- if (_avaliable.find((item) => item.id === passId)) {
390
- _getAvailableList.mutate((data) => {
391
- const newList = data.list.map(
392
- (item) => item.id === passId ? { ...item, ...patch } : item
393
- );
394
- return {
395
- ...data,
396
- list: newList
397
- };
398
- });
399
- return;
400
- }
401
- if (_unavailable.find((item) => item.id === passId)) {
402
- _getUnavailableList.mutate((data) => {
403
- const newList = data.list.map(
404
- (item) => item.id === passId ? { ...item, ...patch } : item
405
- );
406
- return {
407
- ...data,
408
- list: newList
409
- };
410
- });
411
- return;
412
- }
413
- };
414
388
  const _handleBindHolder = async (holderId) => {
415
389
  setUpdateHolderLoading(true);
416
390
  const { wallet_pass_detail_id: passId } = editHolderData;
@@ -476,7 +450,6 @@ var WalletPassGallery = (props) => {
476
450
  {
477
451
  dataSource: _currentItem,
478
452
  platform,
479
- onDetailRefresh: _handleDetailRefresh,
480
453
  onListRefresh: listReload
481
454
  }
482
455
  )));
@@ -512,7 +485,6 @@ var WalletPassGallery = (props) => {
512
485
  {
513
486
  dataSource: _currentItem,
514
487
  platform,
515
- onDetailRefresh: _handleDetailRefresh,
516
488
  onListRefresh: listReload
517
489
  }
518
490
  )));
@@ -660,7 +632,6 @@ var WalletPassGallery = (props) => {
660
632
  {
661
633
  dataSource: _currentItem,
662
634
  platform,
663
- onDetailRefresh: _handleDetailRefresh,
664
635
  onListRefresh: listReload
665
636
  }
666
637
  )
@@ -9,7 +9,7 @@ const EcoCupListMeta: ComponentMetadata = {
9
9
  "devMode": "proCode",
10
10
  "npm": {
11
11
  "package": "@pisell/private-materials",
12
- "version": "6.3.97",
12
+ "version": "1.1.2037",
13
13
  "exportName": "EcoCupList",
14
14
  "main": "src/index.ts",
15
15
  "destructuring": true,
@@ -9,7 +9,7 @@ const EcoCustomerListMeta: ComponentMetadata = {
9
9
  "devMode": "proCode",
10
10
  "npm": {
11
11
  "package": "@pisell/private-materials",
12
- "version": "6.3.97",
12
+ "version": "1.1.2037",
13
13
  "exportName": "EcoCustomerList",
14
14
  "main": "src/index.ts",
15
15
  "destructuring": true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "6.3.98",
3
+ "version": "6.3.99",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",