@pisell/pisellos 2.2.107 → 2.2.108

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.
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
49
49
  getCategories(): ProductCategory[];
50
50
  setOtherParams(key: string, value: any): void;
51
51
  getOtherParams(): any;
52
- getProductType(): "normal" | "duration" | "session";
52
+ getProductType(): "duration" | "session" | "normal";
53
53
  }
@@ -34,6 +34,7 @@ export declare class ProductList extends BaseModule implements Module {
34
34
  }): Promise<any>;
35
35
  getProducts(): Promise<ProductData[]>;
36
36
  getProduct(id: number): Promise<ProductData | undefined>;
37
+ getProductByIds(ids: number[]): Promise<ProductData[] | undefined>;
37
38
  addProduct(products: ProductData[]): Promise<void>;
38
39
  selectProducts(products: ProductData[]): Promise<void>;
39
40
  /**
@@ -243,12 +243,38 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
243
243
  return getProduct;
244
244
  }()
245
245
  }, {
246
- key: "addProduct",
246
+ key: "getProductByIds",
247
247
  value: function () {
248
- var _addProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(products) {
249
- var _this2 = this;
248
+ var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(ids) {
249
+ var products;
250
250
  return _regeneratorRuntime().wrap(function _callee7$(_context7) {
251
251
  while (1) switch (_context7.prev = _context7.next) {
252
+ case 0:
253
+ _context7.next = 2;
254
+ return this.core.effects.emit("".concat(this.name, ":onGetProductByIds"), this.store.list);
255
+ case 2:
256
+ products = this.store.list.filter(function (product) {
257
+ return ids.includes(product.id);
258
+ });
259
+ return _context7.abrupt("return", products);
260
+ case 4:
261
+ case "end":
262
+ return _context7.stop();
263
+ }
264
+ }, _callee7, this);
265
+ }));
266
+ function getProductByIds(_x9) {
267
+ return _getProductByIds.apply(this, arguments);
268
+ }
269
+ return getProductByIds;
270
+ }()
271
+ }, {
272
+ key: "addProduct",
273
+ value: function () {
274
+ var _addProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(products) {
275
+ var _this2 = this;
276
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
277
+ while (1) switch (_context8.prev = _context8.next) {
252
278
  case 0:
253
279
  // list 需要根据 id 去重
254
280
  if (!this.store.list) {
@@ -271,11 +297,11 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
271
297
  this.core.effects.emit("".concat(this.name, ":changed"), this.store.list);
272
298
  case 4:
273
299
  case "end":
274
- return _context7.stop();
300
+ return _context8.stop();
275
301
  }
276
- }, _callee7, this);
302
+ }, _callee8, this);
277
303
  }));
278
- function addProduct(_x9) {
304
+ function addProduct(_x10) {
279
305
  return _addProduct.apply(this, arguments);
280
306
  }
281
307
  return addProduct;
@@ -283,18 +309,18 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
283
309
  }, {
284
310
  key: "selectProducts",
285
311
  value: function () {
286
- var _selectProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(products) {
287
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
288
- while (1) switch (_context8.prev = _context8.next) {
312
+ var _selectProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(products) {
313
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
314
+ while (1) switch (_context9.prev = _context9.next) {
289
315
  case 0:
290
316
  this.store.selectProducts = products;
291
317
  case 1:
292
318
  case "end":
293
- return _context8.stop();
319
+ return _context9.stop();
294
320
  }
295
- }, _callee8, this);
321
+ }, _callee9, this);
296
322
  }));
297
- function selectProducts(_x10) {
323
+ function selectProducts(_x11) {
298
324
  return _selectProducts.apply(this, arguments);
299
325
  }
300
326
  return selectProducts;
@@ -39,6 +39,11 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
39
39
  * @returns 商品列表
40
40
  */
41
41
  getProducts(): Promise<ProductData[]>;
42
+ /**
43
+ * 通过 ids 获取商品列表(不加载到模块中)
44
+ * @returns 商品列表
45
+ */
46
+ getProductByIds(ids: number[]): Promise<ProductData[] | undefined>;
42
47
  /**
43
48
  * 获取日程时间段点
44
49
  * @param params 参数
@@ -216,6 +216,30 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
216
216
  }
217
217
  return getProducts;
218
218
  }()
219
+ /**
220
+ * 通过 ids 获取商品列表(不加载到模块中)
221
+ * @returns 商品列表
222
+ */
223
+ )
224
+ }, {
225
+ key: "getProductByIds",
226
+ value: (function () {
227
+ var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(ids) {
228
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
229
+ while (1) switch (_context4.prev = _context4.next) {
230
+ case 0:
231
+ return _context4.abrupt("return", this.store.products.getProductByIds(ids));
232
+ case 1:
233
+ case "end":
234
+ return _context4.stop();
235
+ }
236
+ }, _callee4, this);
237
+ }));
238
+ function getProductByIds(_x3) {
239
+ return _getProductByIds.apply(this, arguments);
240
+ }
241
+ return getProductByIds;
242
+ }()
219
243
  /**
220
244
  * 获取日程时间段点
221
245
  * @param params 参数
@@ -225,27 +249,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
225
249
  }, {
226
250
  key: "getScheduleTimePoints",
227
251
  value: (function () {
228
- var _getScheduleTimePoints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
252
+ var _getScheduleTimePoints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(params) {
229
253
  var result;
230
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
231
- while (1) switch (_context4.prev = _context4.next) {
254
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
255
+ while (1) switch (_context5.prev = _context5.next) {
232
256
  case 0:
233
- _context4.next = 2;
257
+ _context5.next = 2;
234
258
  return this.request.post('/menu/schedule-time-points', {
235
259
  menu_list_ids: params.menu_list_ids
236
260
  }, {
237
261
  osServer: true
238
262
  });
239
263
  case 2:
240
- result = _context4.sent;
241
- return _context4.abrupt("return", result.data || []);
264
+ result = _context5.sent;
265
+ return _context5.abrupt("return", result.data || []);
242
266
  case 4:
243
267
  case "end":
244
- return _context4.stop();
268
+ return _context5.stop();
245
269
  }
246
- }, _callee4, this);
270
+ }, _callee5, this);
247
271
  }));
248
- function getScheduleTimePoints(_x3) {
272
+ function getScheduleTimePoints(_x4) {
249
273
  return _getScheduleTimePoints.apply(this, arguments);
250
274
  }
251
275
  return getScheduleTimePoints;
@@ -259,30 +283,30 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
259
283
  }, {
260
284
  key: "getCustomerList",
261
285
  value: (function () {
262
- var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
286
+ var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
263
287
  var params,
264
288
  _result2,
265
- _args5 = arguments;
266
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
267
- while (1) switch (_context5.prev = _context5.next) {
289
+ _args6 = arguments;
290
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
291
+ while (1) switch (_context6.prev = _context6.next) {
268
292
  case 0:
269
- params = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {};
270
- _context5.prev = 1;
271
- _context5.next = 4;
293
+ params = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {};
294
+ _context6.prev = 1;
295
+ _context6.next = 4;
272
296
  return this.store.customer.getCustomerList(params);
273
297
  case 4:
274
- _result2 = _context5.sent;
275
- return _context5.abrupt("return", _result2);
298
+ _result2 = _context6.sent;
299
+ return _context6.abrupt("return", _result2);
276
300
  case 8:
277
- _context5.prev = 8;
278
- _context5.t0 = _context5["catch"](1);
279
- console.error('Failed to get customer list:', _context5.t0);
280
- throw _context5.t0;
301
+ _context6.prev = 8;
302
+ _context6.t0 = _context6["catch"](1);
303
+ console.error('Failed to get customer list:', _context6.t0);
304
+ throw _context6.t0;
281
305
  case 12:
282
306
  case "end":
283
- return _context5.stop();
307
+ return _context6.stop();
284
308
  }
285
- }, _callee5, this, [[1, 8]]);
309
+ }, _callee6, this, [[1, 8]]);
286
310
  }));
287
311
  function getCustomerList() {
288
312
  return _getCustomerList.apply(this, arguments);
@@ -409,29 +433,29 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
409
433
  }, {
410
434
  key: "changeCustomerPage",
411
435
  value: (function () {
412
- var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(page, pageSize) {
436
+ var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(page, pageSize) {
413
437
  var _result3;
414
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
415
- while (1) switch (_context6.prev = _context6.next) {
438
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
439
+ while (1) switch (_context7.prev = _context7.next) {
416
440
  case 0:
417
- _context6.prev = 0;
418
- _context6.next = 3;
441
+ _context7.prev = 0;
442
+ _context7.next = 3;
419
443
  return this.store.customer.changeCustomerPage(page, pageSize);
420
444
  case 3:
421
- _result3 = _context6.sent;
422
- return _context6.abrupt("return", _result3);
445
+ _result3 = _context7.sent;
446
+ return _context7.abrupt("return", _result3);
423
447
  case 7:
424
- _context6.prev = 7;
425
- _context6.t0 = _context6["catch"](0);
426
- console.error('Failed to change customer page:', _context6.t0);
427
- throw _context6.t0;
448
+ _context7.prev = 7;
449
+ _context7.t0 = _context7["catch"](0);
450
+ console.error('Failed to change customer page:', _context7.t0);
451
+ throw _context7.t0;
428
452
  case 11:
429
453
  case "end":
430
- return _context6.stop();
454
+ return _context7.stop();
431
455
  }
432
- }, _callee6, this, [[0, 7]]);
456
+ }, _callee7, this, [[0, 7]]);
433
457
  }));
434
- function changeCustomerPage(_x4, _x5) {
458
+ function changeCustomerPage(_x5, _x6) {
435
459
  return _changeCustomerPage.apply(this, arguments);
436
460
  }
437
461
  return changeCustomerPage;
@@ -444,28 +468,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
444
468
  }, {
445
469
  key: "loadMoreCustomers",
446
470
  value: (function () {
447
- var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
471
+ var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
448
472
  var _result4;
449
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
450
- while (1) switch (_context7.prev = _context7.next) {
473
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
474
+ while (1) switch (_context8.prev = _context8.next) {
451
475
  case 0:
452
- _context7.prev = 0;
453
- _context7.next = 3;
476
+ _context8.prev = 0;
477
+ _context8.next = 3;
454
478
  return this.store.customer.loadMoreCustomers();
455
479
  case 3:
456
- _result4 = _context7.sent;
480
+ _result4 = _context8.sent;
457
481
  this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), _result4);
458
- return _context7.abrupt("return", _result4);
482
+ return _context8.abrupt("return", _result4);
459
483
  case 8:
460
- _context7.prev = 8;
461
- _context7.t0 = _context7["catch"](0);
462
- console.error('Failed to load more customers:', _context7.t0);
463
- throw _context7.t0;
484
+ _context8.prev = 8;
485
+ _context8.t0 = _context8["catch"](0);
486
+ console.error('Failed to load more customers:', _context8.t0);
487
+ throw _context8.t0;
464
488
  case 12:
465
489
  case "end":
466
- return _context7.stop();
490
+ return _context8.stop();
467
491
  }
468
- }, _callee7, this, [[0, 8]]);
492
+ }, _callee8, this, [[0, 8]]);
469
493
  }));
470
494
  function loadMoreCustomers() {
471
495
  return _loadMoreCustomers.apply(this, arguments);
@@ -481,31 +505,31 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
481
505
  }, {
482
506
  key: "resetAndLoadCustomers",
483
507
  value: (function () {
484
- var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
508
+ var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
485
509
  var params,
486
510
  _result5,
487
- _args8 = arguments;
488
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
489
- while (1) switch (_context8.prev = _context8.next) {
511
+ _args9 = arguments;
512
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
513
+ while (1) switch (_context9.prev = _context9.next) {
490
514
  case 0:
491
- params = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {};
492
- _context8.prev = 1;
493
- _context8.next = 4;
515
+ params = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : {};
516
+ _context9.prev = 1;
517
+ _context9.next = 4;
494
518
  return this.store.customer.resetAndLoadCustomers(params);
495
519
  case 4:
496
- _result5 = _context8.sent;
520
+ _result5 = _context9.sent;
497
521
  this.core.effects.emit("".concat(this.name, ":onCustomerListReset"), _result5);
498
- return _context8.abrupt("return", _result5);
522
+ return _context9.abrupt("return", _result5);
499
523
  case 9:
500
- _context8.prev = 9;
501
- _context8.t0 = _context8["catch"](1);
502
- console.error('Failed to reset and load customers:', _context8.t0);
503
- throw _context8.t0;
524
+ _context9.prev = 9;
525
+ _context9.t0 = _context9["catch"](1);
526
+ console.error('Failed to reset and load customers:', _context9.t0);
527
+ throw _context9.t0;
504
528
  case 13:
505
529
  case "end":
506
- return _context8.stop();
530
+ return _context9.stop();
507
531
  }
508
- }, _callee8, this, [[1, 9]]);
532
+ }, _callee9, this, [[1, 9]]);
509
533
  }));
510
534
  function resetAndLoadCustomers() {
511
535
  return _resetAndLoadCustomers.apply(this, arguments);
@@ -667,15 +691,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
667
691
  }, {
668
692
  key: "setOtherParams",
669
693
  value: (function () {
670
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(params) {
694
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params) {
671
695
  var _ref,
672
696
  _ref$cover,
673
697
  cover,
674
- _args9 = arguments;
675
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
676
- while (1) switch (_context9.prev = _context9.next) {
698
+ _args10 = arguments;
699
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
700
+ while (1) switch (_context10.prev = _context10.next) {
677
701
  case 0:
678
- _ref = _args9.length > 1 && _args9[1] !== undefined ? _args9[1] : {}, _ref$cover = _ref.cover, cover = _ref$cover === void 0 ? false : _ref$cover;
702
+ _ref = _args10.length > 1 && _args10[1] !== undefined ? _args10[1] : {}, _ref$cover = _ref.cover, cover = _ref$cover === void 0 ? false : _ref$cover;
679
703
  if (cover) {
680
704
  this.otherParams = params;
681
705
  } else {
@@ -683,11 +707,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
683
707
  }
684
708
  case 2:
685
709
  case "end":
686
- return _context9.stop();
710
+ return _context10.stop();
687
711
  }
688
- }, _callee9, this);
712
+ }, _callee10, this);
689
713
  }));
690
- function setOtherParams(_x6) {
714
+ function setOtherParams(_x7) {
691
715
  return _setOtherParams.apply(this, arguments);
692
716
  }
693
717
  return setOtherParams;
@@ -700,16 +724,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
700
724
  }, {
701
725
  key: "getOtherParams",
702
726
  value: (function () {
703
- var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
704
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
705
- while (1) switch (_context10.prev = _context10.next) {
727
+ var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
728
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
729
+ while (1) switch (_context11.prev = _context11.next) {
706
730
  case 0:
707
- return _context10.abrupt("return", this.otherParams);
731
+ return _context11.abrupt("return", this.otherParams);
708
732
  case 1:
709
733
  case "end":
710
- return _context10.stop();
734
+ return _context11.stop();
711
735
  }
712
- }, _callee10, this);
736
+ }, _callee11, this);
713
737
  }));
714
738
  function getOtherParams() {
715
739
  return _getOtherParams.apply(this, arguments);
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
49
49
  getCategories(): ProductCategory[];
50
50
  setOtherParams(key: string, value: any): void;
51
51
  getOtherParams(): any;
52
- getProductType(): "normal" | "duration" | "session";
52
+ getProductType(): "duration" | "session" | "normal";
53
53
  }
@@ -34,6 +34,7 @@ export declare class ProductList extends BaseModule implements Module {
34
34
  }): Promise<any>;
35
35
  getProducts(): Promise<ProductData[]>;
36
36
  getProduct(id: number): Promise<ProductData | undefined>;
37
+ getProductByIds(ids: number[]): Promise<ProductData[] | undefined>;
37
38
  addProduct(products: ProductData[]): Promise<void>;
38
39
  selectProducts(products: ProductData[]): Promise<void>;
39
40
  /**
@@ -139,6 +139,14 @@ var ProductList = class extends import_BaseModule.BaseModule {
139
139
  const product = this.store.list.find((product2) => product2.id === id);
140
140
  return product ? (0, import_lodash_es.cloneDeep)(product) : void 0;
141
141
  }
142
+ async getProductByIds(ids) {
143
+ await this.core.effects.emit(
144
+ `${this.name}:onGetProductByIds`,
145
+ this.store.list
146
+ );
147
+ const products = this.store.list.filter((product) => ids.includes(product.id));
148
+ return products;
149
+ }
142
150
  async addProduct(products) {
143
151
  if (!this.store.list) {
144
152
  this.store.list = [];
@@ -39,6 +39,11 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
39
39
  * @returns 商品列表
40
40
  */
41
41
  getProducts(): Promise<ProductData[]>;
42
+ /**
43
+ * 通过 ids 获取商品列表(不加载到模块中)
44
+ * @returns 商品列表
45
+ */
46
+ getProductByIds(ids: number[]): Promise<ProductData[] | undefined>;
42
47
  /**
43
48
  * 获取日程时间段点
44
49
  * @param params 参数
@@ -143,6 +143,13 @@ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
143
143
  async getProducts() {
144
144
  return this.store.products.getProducts();
145
145
  }
146
+ /**
147
+ * 通过 ids 获取商品列表(不加载到模块中)
148
+ * @returns 商品列表
149
+ */
150
+ async getProductByIds(ids) {
151
+ return this.store.products.getProductByIds(ids);
152
+ }
146
153
  /**
147
154
  * 获取日程时间段点
148
155
  * @param params 参数
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.2.107",
4
+ "version": "2.2.108",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",