@pisell/private-materials 6.5.9 → 6.5.10

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.
@@ -0,0 +1,3 @@
1
+ import './index.less';
2
+ declare const VoucherCard: (props: any) => JSX.Element | null;
3
+ export default VoucherCard;
@@ -165,7 +165,7 @@ var VoucherCard = function VoucherCard(props) {
165
165
  productListToValue(val.productList);
166
166
  }
167
167
  }, {
168
- wait: 500
168
+ wait: 1000
169
169
  }),
170
170
  run = _useDebounceFn.run;
171
171
 
@@ -47,7 +47,7 @@ var productListSetting = {
47
47
  isStock: 0
48
48
  };
49
49
  var AddSerivce = function AddSerivce(props) {
50
- var _context$appHelper, _context$appHelper$ge, _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _state$service, _state$service3, _state$bookingConfig2, _state$client2;
50
+ var _context$appHelper, _context$appHelper$ge, _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _state$service, _state$bookingConfig2, _state$client2;
51
51
  var onEdit = props.onEdit,
52
52
  state = props.state,
53
53
  dispatch = props.dispatch,
@@ -79,7 +79,7 @@ var AddSerivce = function AddSerivce(props) {
79
79
  var lastOperationTimeRef = useRef(0);
80
80
  var isInFastClickMode = function isInFastClickMode() {
81
81
  var now = Date.now();
82
- return now - lastOperationTimeRef.current < 1000;
82
+ return now - lastOperationTimeRef.current < 2000;
83
83
  };
84
84
  var getCurrentServiceValue = function getCurrentServiceValue() {
85
85
  if (isInFastClickMode()) {
@@ -92,11 +92,13 @@ var AddSerivce = function AddSerivce(props) {
92
92
  return stateValue;
93
93
  }
94
94
  };
95
- useEffect(function () {
96
- if (!isInFastClickMode()) {
97
- latestServiceValueRef.current = null;
98
- }
99
- }, [state === null || state === void 0 || (_state$service3 = state.service) === null || _state$service3 === void 0 ? void 0 : _state$service3.value]);
95
+
96
+ // useEffect(() => {
97
+ // if (!isInFastClickMode()) {
98
+ // latestServiceValueRef.current = null;
99
+ // }
100
+ // }, [state?.service?.value]);
101
+
100
102
  var _useProducts = useProducts(),
101
103
  getProducts = _useProducts.getProducts,
102
104
  products = _useProducts.products,
@@ -300,8 +302,8 @@ var AddSerivce = function AddSerivce(props) {
300
302
  var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'select';
301
303
  console.log('handleSelectProduct');
302
304
  if (!isNormalProductByDurationSchedule(item)) {
303
- var _state$service4;
304
- if (!Array.isArray((_state$service4 = state.service) === null || _state$service4 === void 0 ? void 0 : _state$service4.resourcesOrigin) || !state.service.resourcesOrigin.length) {
305
+ var _state$service3;
306
+ if (!Array.isArray((_state$service3 = state.service) === null || _state$service3 === void 0 ? void 0 : _state$service3.resourcesOrigin) || !state.service.resourcesOrigin.length) {
305
307
  dispatch({
306
308
  type: 'setService',
307
309
  payload: _objectSpread(_objectSpread({}, stateRef.current.service), {}, {
@@ -339,7 +341,7 @@ var AddSerivce = function AddSerivce(props) {
339
341
  }
340
342
  var callback = /*#__PURE__*/function () {
341
343
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(e, extension_type, detail, notShowToast) {
342
- var data, _currentItem, _detail, other, cacheItem, _total, _isEdit, _state$service$cacheI, _addService2, _list, quantity, _context$appHelper$ut4, _context$appHelper$ut5, val, sendData, _window$openBookingEd, _window;
344
+ var data, _currentItem, _detail, other, cacheItem, _total, _isEdit, _state$service$cacheI, val, _addService2, _list, quantity, _context$appHelper$ut4, _context$appHelper$ut5, _val, sendData, _window$openBookingEd, _window;
343
345
  return _regeneratorRuntime().wrap(function _callee$(_context) {
344
346
  while (1) switch (_context.prev = _context.next) {
345
347
  case 0:
@@ -415,7 +417,8 @@ var AddSerivce = function AddSerivce(props) {
415
417
  if (cacheItem.autoClose) {
416
418
  cacheItem.autoClose = false;
417
419
  cacheItem._serviceKey = genServiceKey(cacheItem);
418
- _addService2 = addService(_toConsumableArray(getCurrentServiceValue()), cacheItem, state), _list = _addService2.list, quantity = _addService2.quantity; // 更新ref以确保后续快速操作时使用最新值
420
+ val = getCurrentServiceValue();
421
+ _addService2 = addService(_toConsumableArray(val), cacheItem, state), _list = _addService2.list, quantity = _addService2.quantity; // 更新ref以确保后续快速操作时使用最新值
419
422
  latestServiceValueRef.current = _list;
420
423
  lastOperationTimeRef.current = Date.now();
421
424
  if (!notShowToast) {
@@ -428,7 +431,7 @@ var AddSerivce = function AddSerivce(props) {
428
431
  }));
429
432
  try {
430
433
  if (((_context$appHelper$ut4 = context.appHelper.utils.store) === null || _context$appHelper$ut4 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut4.getState) === null || _context$appHelper$ut5 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut5.call(_context$appHelper$ut4)) === null || _context$appHelper$ut5 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut5.global) === null || _context$appHelper$ut5 === void 0 || (_context$appHelper$ut5 = _context$appHelper$ut5.globalConfig) === null || _context$appHelper$ut5 === void 0 ? void 0 : _context$appHelper$ut5.id) === 2155) {
431
- val = _list === null || _list === void 0 ? void 0 : _list.map(function (s) {
434
+ _val = _list === null || _list === void 0 ? void 0 : _list.map(function (s) {
432
435
  return {
433
436
  product_id: s === null || s === void 0 ? void 0 : s.product_id,
434
437
  detailId: s === null || s === void 0 ? void 0 : s.id,
@@ -446,7 +449,7 @@ var AddSerivce = function AddSerivce(props) {
446
449
  detailProductId: _detail === null || _detail === void 0 ? void 0 : _detail.product_id,
447
450
  product_name: _currentItem === null || _currentItem === void 0 ? void 0 : _currentItem.title,
448
451
  price: _detail === null || _detail === void 0 ? void 0 : _detail.price,
449
- serviceVal: val
452
+ serviceVal: _val
450
453
  };
451
454
  sendWarningLog({
452
455
  title: 'addService',
@@ -0,0 +1,3 @@
1
+ import './index.less';
2
+ declare const VoucherCard: (props: any) => JSX.Element | null;
3
+ export default VoucherCard;
@@ -170,7 +170,7 @@ var VoucherCard = (props) => {
170
170
  productListToValue(val.productList);
171
171
  }
172
172
  },
173
- { wait: 500 }
173
+ { wait: 1e3 }
174
174
  );
175
175
  (0, import_react.useEffect)(() => {
176
176
  run();
@@ -62,7 +62,7 @@ var productListSetting = {
62
62
  isStock: 0
63
63
  };
64
64
  var AddSerivce = (props) => {
65
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
65
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
66
66
  const { onEdit, state, dispatch, renderMode = "current", onPrerenderComplete } = props;
67
67
  const context = (0, import_useEngineContext.default)();
68
68
  const notAvailableRef = (0, import_react.useRef)(null);
@@ -88,7 +88,7 @@ var AddSerivce = (props) => {
88
88
  const lastOperationTimeRef = (0, import_react.useRef)(0);
89
89
  const isInFastClickMode = () => {
90
90
  const now = Date.now();
91
- return now - lastOperationTimeRef.current < 1e3;
91
+ return now - lastOperationTimeRef.current < 2e3;
92
92
  };
93
93
  const getCurrentServiceValue = () => {
94
94
  var _a2, _b2, _c2;
@@ -100,11 +100,6 @@ var AddSerivce = (props) => {
100
100
  return stateValue;
101
101
  }
102
102
  };
103
- (0, import_react.useEffect)(() => {
104
- if (!isInFastClickMode()) {
105
- latestServiceValueRef.current = null;
106
- }
107
- }, [(_k = state == null ? void 0 : state.service) == null ? void 0 : _k.value]);
108
103
  const { getProducts, products, loading } = (0, import_pisellos.useProducts)();
109
104
  (0, import_react.useEffect)(() => {
110
105
  return () => {
@@ -139,11 +134,11 @@ var AddSerivce = (props) => {
139
134
  const menuList = (0, import_react.useMemo)(() => {
140
135
  var _a2, _b2, _c2;
141
136
  return ((_c2 = (_b2 = (_a2 = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _a2.config) == null ? void 0 : _b2.menu_list_tab) == null ? void 0 : _c2.menu_list) || [];
142
- }, [(_l = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _l.config]);
137
+ }, [(_k = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _k.config]);
143
138
  const customerId = (0, import_react.useMemo)(() => {
144
139
  var _a2, _b2;
145
140
  return ((_b2 = (_a2 = state.client) == null ? void 0 : _a2.value) == null ? void 0 : _b2.id) || void 0;
146
- }, [(_n = (_m = state.client) == null ? void 0 : _m.value) == null ? void 0 : _n.id]);
141
+ }, [(_m = (_l = state.client) == null ? void 0 : _l.value) == null ? void 0 : _m.id]);
147
142
  const scanAddService = (0, import_ahooks.useMemoizedFn)((list, code) => {
148
143
  let newService = [...state.service.value];
149
144
  list.forEach((item) => {
@@ -300,8 +295,9 @@ var AddSerivce = (props) => {
300
295
  if (cacheItem.autoClose) {
301
296
  cacheItem.autoClose = false;
302
297
  cacheItem._serviceKey = (0, import_utils6.genServiceKey)(cacheItem);
298
+ const val = getCurrentServiceValue();
303
299
  let { list: _list, quantity } = (0, import_utils6.addService)(
304
- [...getCurrentServiceValue()],
300
+ [...val],
305
301
  cacheItem,
306
302
  state
307
303
  );
@@ -319,7 +315,7 @@ var AddSerivce = (props) => {
319
315
  );
320
316
  try {
321
317
  if (((_f2 = (_e2 = (_d3 = (_c3 = (_b3 = context.appHelper.utils.store) == null ? void 0 : _b3.getState) == null ? void 0 : _c3.call(_b3)) == null ? void 0 : _d3.global) == null ? void 0 : _e2.globalConfig) == null ? void 0 : _f2.id) === 2155) {
322
- const val = _list == null ? void 0 : _list.map((s) => {
318
+ const val2 = _list == null ? void 0 : _list.map((s) => {
323
319
  return {
324
320
  product_id: s == null ? void 0 : s.product_id,
325
321
  detailId: s == null ? void 0 : s.id,
@@ -337,7 +333,7 @@ var AddSerivce = (props) => {
337
333
  detailProductId: _detail == null ? void 0 : _detail.product_id,
338
334
  product_name: _currentItem == null ? void 0 : _currentItem.title,
339
335
  price: _detail == null ? void 0 : _detail.price,
340
- serviceVal: val
336
+ serviceVal: val2
341
337
  };
342
338
  (0, import_utils.sendWarningLog)({
343
339
  title: "addService",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "6.5.9",
3
+ "version": "6.5.10",
4
4
  "scripts": {
5
5
  "dev": "father dev",
6
6
  "build": "father build",