@pisell/pisellos 0.10.77 → 0.10.78

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 (34) hide show
  1. package/dist/modules/Product/index.d.ts +1 -1
  2. package/dist/modules/ProductList/index.d.ts +2 -0
  3. package/dist/modules/ProductList/index.js +125 -39
  4. package/dist/modules/ResourcePlanner/planner.js +5 -0
  5. package/dist/solution/BaseSales/index.d.ts +12 -1
  6. package/dist/solution/BaseSales/index.js +275 -185
  7. package/dist/solution/BookingByStep/index.d.ts +2 -2
  8. package/dist/solution/BookingTicket/index.d.ts +1 -13
  9. package/dist/solution/UnifiedBookingSales/index.d.ts +23 -1
  10. package/dist/solution/UnifiedBookingSales/index.js +1307 -635
  11. package/dist/solution/UnifiedBookingSales/sessionResourceCache.d.ts +27 -0
  12. package/dist/solution/UnifiedBookingSales/sessionResourceCache.js +271 -0
  13. package/dist/solution/UnifiedBookingSales/types.d.ts +25 -2
  14. package/dist/solution/UnifiedBookingSales/types.js +2 -0
  15. package/dist/solution/UnifiedBookingSales/venueCatalogSession.d.ts +32 -0
  16. package/dist/solution/UnifiedBookingSales/venueCatalogSession.js +277 -0
  17. package/lib/model/strategy/adapter/promotion/index.js +46 -1
  18. package/lib/modules/Product/index.d.ts +1 -1
  19. package/lib/modules/ProductList/index.d.ts +2 -0
  20. package/lib/modules/ProductList/index.js +56 -0
  21. package/lib/modules/ResourcePlanner/planner.js +4 -0
  22. package/lib/solution/BaseSales/index.d.ts +12 -1
  23. package/lib/solution/BaseSales/index.js +65 -0
  24. package/lib/solution/BookingByStep/index.d.ts +2 -2
  25. package/lib/solution/BookingTicket/index.d.ts +1 -13
  26. package/lib/solution/UnifiedBookingSales/index.d.ts +23 -1
  27. package/lib/solution/UnifiedBookingSales/index.js +359 -5
  28. package/lib/solution/UnifiedBookingSales/sessionResourceCache.d.ts +27 -0
  29. package/lib/solution/UnifiedBookingSales/sessionResourceCache.js +199 -0
  30. package/lib/solution/UnifiedBookingSales/types.d.ts +25 -2
  31. package/lib/solution/UnifiedBookingSales/types.js +1 -0
  32. package/lib/solution/UnifiedBookingSales/venueCatalogSession.d.ts +32 -0
  33. package/lib/solution/UnifiedBookingSales/venueCatalogSession.js +151 -0
  34. package/package.json +1 -1
@@ -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
  }
@@ -37,6 +37,8 @@ export declare class ProductList extends BaseModule implements Module {
37
37
  schedule_date?: string;
38
38
  channel?: string;
39
39
  }): Promise<any>;
40
+ /** Venue-only raw, complete pool load. No date/customer evaluation and no shared catalog publication. */
41
+ loadVenueCatalogPool(params?: Pick<ProductListLoadProductsParams, 'product_ids' | 'collection' | 'category_ids' | 'extension_type' | 'cacheId'>): Promise<ProductData[]>;
40
42
  /**
41
43
  * Remember raw remote product records before client-side Data Variant
42
44
  * evaluation. Quote-only reads can then always start from a clean baseline.
@@ -413,11 +413,97 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
413
413
  return _loadProductsPrice.apply(this, arguments);
414
414
  }
415
415
  return loadProductsPrice;
416
+ }() /** Venue-only raw, complete pool load. No date/customer evaluation and no shared catalog publication. */
417
+ }, {
418
+ key: "loadVenueCatalogPool",
419
+ value: (function () {
420
+ var _loadVenueCatalogPool = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
421
+ var _this$otherParams5, _params$product_ids, _params$category_ids, _params$extension_typ, _ref4, _data$total;
422
+ var params,
423
+ channelMap,
424
+ channel,
425
+ response,
426
+ data,
427
+ total,
428
+ _args7 = arguments;
429
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
430
+ while (1) switch (_context7.prev = _context7.next) {
431
+ case 0:
432
+ params = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {};
433
+ channelMap = {
434
+ online_store: 'online-store',
435
+ scan_to_order: 'online-store',
436
+ 'scan-to-order': 'online-store',
437
+ scan_to_order_2: 'online-store',
438
+ scan_to_order_3: 'scantoorder3'
439
+ };
440
+ channel = (_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.channel;
441
+ _context7.next = 5;
442
+ return this.request.post('/product/query', _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
443
+ // The customer endpoint otherwise filters out future/variant members.
444
+ open_quotation: 0,
445
+ open_bundle: 1,
446
+ with: _toConsumableArray(PRODUCT_QUERY_DATA_VARIANT_RELATIONS),
447
+ with_count: ['bundleGroup', 'optionGroup'],
448
+ with_schedule: 1,
449
+ status: 'published',
450
+ num: 500,
451
+ skip: 1,
452
+ is_eject: 1,
453
+ // Channel is stable for this runtime owner and remains a server publication
454
+ // filter. Date/customer/menu membership and pricing are evaluated locally.
455
+ application_code: typeof channel === 'string' ? channelMap[channel] || channel : channel
456
+ }, (_params$product_ids = params.product_ids) !== null && _params$product_ids !== void 0 && _params$product_ids.length ? {
457
+ ids: params.product_ids
458
+ } : {}), params.collection ? {
459
+ collection: params.collection
460
+ } : {}), (_params$category_ids = params.category_ids) !== null && _params$category_ids !== void 0 && _params$category_ids.length ? {
461
+ category_ids: params.category_ids
462
+ } : {}), (_params$extension_typ = params.extension_type) !== null && _params$extension_typ !== void 0 && _params$extension_typ.length ? {
463
+ extension_type: params.extension_type
464
+ } : {}), {}, {
465
+ front_end_cache_id: params.cacheId
466
+ }), {
467
+ useCache: false,
468
+ customToast: function customToast() {}
469
+ });
470
+ case 5:
471
+ response = _context7.sent;
472
+ data = response === null || response === void 0 ? void 0 : response.data;
473
+ if (!((response === null || response === void 0 ? void 0 : response.status) === false || (response === null || response === void 0 ? void 0 : response.code) != null && Number(response.code) !== 200 || !Array.isArray(data === null || data === void 0 ? void 0 : data.list))) {
474
+ _context7.next = 9;
475
+ break;
476
+ }
477
+ throw Object.assign(new Error((response === null || response === void 0 ? void 0 : response.message) || 'The complete venue product pool could not be loaded.'), {
478
+ code: 'VENUE_CATALOG_LOAD_FAILED'
479
+ });
480
+ case 9:
481
+ total = (_ref4 = (_data$total = data.total) !== null && _data$total !== void 0 ? _data$total : data.total_count) !== null && _ref4 !== void 0 ? _ref4 : data.total_num;
482
+ if (!(total != null && Number.isFinite(Number(total)) && Number(total) > data.list.length || total == null && data.list.length >= 500)) {
483
+ _context7.next = 12;
484
+ break;
485
+ }
486
+ throw Object.assign(new Error('The venue product pool is incomplete. A single complete catalog response is required.'), {
487
+ code: 'VENUE_CATALOG_INCOMPLETE'
488
+ });
489
+ case 12:
490
+ return _context7.abrupt("return", cloneDeep(data.list));
491
+ case 13:
492
+ case "end":
493
+ return _context7.stop();
494
+ }
495
+ }, _callee7, this);
496
+ }));
497
+ function loadVenueCatalogPool() {
498
+ return _loadVenueCatalogPool.apply(this, arguments);
499
+ }
500
+ return loadVenueCatalogPool;
416
501
  }()
417
502
  /**
418
503
  * Remember raw remote product records before client-side Data Variant
419
504
  * evaluation. Quote-only reads can then always start from a clean baseline.
420
505
  */
506
+ )
421
507
  }, {
422
508
  key: "rememberRawProductQueryResult",
423
509
  value: function rememberRawProductQueryResult(products) {
@@ -471,19 +557,19 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
471
557
  }, {
472
558
  key: "getProducts",
473
559
  value: function () {
474
- var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
475
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
476
- while (1) switch (_context7.prev = _context7.next) {
560
+ var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
561
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
562
+ while (1) switch (_context8.prev = _context8.next) {
477
563
  case 0:
478
- _context7.next = 2;
564
+ _context8.next = 2;
479
565
  return this.core.effects.emit("".concat(this.name, ":onGetProducts"), this.store.list);
480
566
  case 2:
481
- return _context7.abrupt("return", cloneDeep(this.store.list));
567
+ return _context8.abrupt("return", cloneDeep(this.store.list));
482
568
  case 3:
483
569
  case "end":
484
- return _context7.stop();
570
+ return _context8.stop();
485
571
  }
486
- }, _callee7, this);
572
+ }, _callee8, this);
487
573
  }));
488
574
  function getProducts() {
489
575
  return _getProducts.apply(this, arguments);
@@ -493,23 +579,23 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
493
579
  }, {
494
580
  key: "getProduct",
495
581
  value: function () {
496
- var _getProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(id) {
582
+ var _getProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(id) {
497
583
  var product;
498
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
499
- while (1) switch (_context8.prev = _context8.next) {
584
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
585
+ while (1) switch (_context9.prev = _context9.next) {
500
586
  case 0:
501
- _context8.next = 2;
587
+ _context9.next = 2;
502
588
  return this.core.effects.emit("".concat(this.name, ":onGetProduct"), this.store.list);
503
589
  case 2:
504
590
  product = this.store.list.find(function (product) {
505
591
  return product.id === id;
506
592
  });
507
- return _context8.abrupt("return", product ? cloneDeep(product) : undefined);
593
+ return _context9.abrupt("return", product ? cloneDeep(product) : undefined);
508
594
  case 4:
509
595
  case "end":
510
- return _context8.stop();
596
+ return _context9.stop();
511
597
  }
512
- }, _callee8, this);
598
+ }, _callee9, this);
513
599
  }));
514
600
  function getProduct(_x7) {
515
601
  return _getProduct.apply(this, arguments);
@@ -519,7 +605,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
519
605
  }, {
520
606
  key: "queryProducts",
521
607
  value: function () {
522
- var _queryProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
608
+ var _queryProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
523
609
  var params,
524
610
  includeIds,
525
611
  excludeIds,
@@ -530,11 +616,11 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
530
616
  channelApplications,
531
617
  codeOrBarcode,
532
618
  products,
533
- _args9 = arguments;
534
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
535
- while (1) switch (_context9.prev = _context9.next) {
619
+ _args10 = arguments;
620
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
621
+ while (1) switch (_context10.prev = _context10.next) {
536
622
  case 0:
537
- params = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : {};
623
+ params = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : {};
538
624
  includeIds = normalizeQuerySet(params.includeIds);
539
625
  excludeIds = normalizeQuerySet(params.excludeIds);
540
626
  categoryIds = normalizeQuerySet(params.categoryIds);
@@ -573,12 +659,12 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
573
659
  }
574
660
  return true;
575
661
  });
576
- return _context9.abrupt("return", cloneDeep(products));
662
+ return _context10.abrupt("return", cloneDeep(products));
577
663
  case 11:
578
664
  case "end":
579
- return _context9.stop();
665
+ return _context10.stop();
580
666
  }
581
- }, _callee9, this);
667
+ }, _callee10, this);
582
668
  }));
583
669
  function queryProducts() {
584
670
  return _queryProducts.apply(this, arguments);
@@ -588,21 +674,21 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
588
674
  }, {
589
675
  key: "getProductByIds",
590
676
  value: function () {
591
- var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(ids) {
592
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
593
- while (1) switch (_context10.prev = _context10.next) {
677
+ var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(ids) {
678
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
679
+ while (1) switch (_context11.prev = _context11.next) {
594
680
  case 0:
595
- _context10.next = 2;
681
+ _context11.next = 2;
596
682
  return this.core.effects.emit("".concat(this.name, ":onGetProductByIds"), this.store.list);
597
683
  case 2:
598
- return _context10.abrupt("return", this.queryProducts({
684
+ return _context11.abrupt("return", this.queryProducts({
599
685
  includeIds: ids
600
686
  }));
601
687
  case 3:
602
688
  case "end":
603
- return _context10.stop();
689
+ return _context11.stop();
604
690
  }
605
- }, _callee10, this);
691
+ }, _callee11, this);
606
692
  }));
607
693
  function getProductByIds(_x8) {
608
694
  return _getProductByIds.apply(this, arguments);
@@ -612,10 +698,10 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
612
698
  }, {
613
699
  key: "addProduct",
614
700
  value: function () {
615
- var _addProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(products) {
701
+ var _addProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(products) {
616
702
  var _this6 = this;
617
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
618
- while (1) switch (_context11.prev = _context11.next) {
703
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
704
+ while (1) switch (_context12.prev = _context12.next) {
619
705
  case 0:
620
706
  // list 需要根据 id 去重
621
707
  if (!this.store.list) {
@@ -638,9 +724,9 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
638
724
  this.core.effects.emit("".concat(this.name, ":changed"), this.store.list);
639
725
  case 4:
640
726
  case "end":
641
- return _context11.stop();
727
+ return _context12.stop();
642
728
  }
643
- }, _callee11, this);
729
+ }, _callee12, this);
644
730
  }));
645
731
  function addProduct(_x9) {
646
732
  return _addProduct.apply(this, arguments);
@@ -650,16 +736,16 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
650
736
  }, {
651
737
  key: "selectProducts",
652
738
  value: function () {
653
- var _selectProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(products) {
654
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
655
- while (1) switch (_context12.prev = _context12.next) {
739
+ var _selectProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(products) {
740
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
741
+ while (1) switch (_context13.prev = _context13.next) {
656
742
  case 0:
657
743
  this.store.selectProducts = products;
658
744
  case 1:
659
745
  case "end":
660
- return _context12.stop();
746
+ return _context13.stop();
661
747
  }
662
- }, _callee12, this);
748
+ }, _callee13, this);
663
749
  }));
664
750
  function selectProducts(_x10) {
665
751
  return _selectProducts.apply(this, arguments);
@@ -560,6 +560,11 @@ function buildCellKey(params) {
560
560
  return [String(params.productId), params.groupId, String(params.resourceId), params.start, params.end].join(':');
561
561
  }
562
562
  function dedupeOccupancyRefKey(occupancy) {
563
+ var _occupancy$raw;
564
+ var sessionKey = (_occupancy$raw = occupancy.raw) === null || _occupancy$raw === void 0 ? void 0 : _occupancy$raw.__availabilitySessionOccupancyKey;
565
+ if (typeof sessionKey === 'string' && sessionKey) {
566
+ return "session:".concat(JSON.stringify([String(occupancy.resourceId), sessionKey]));
567
+ }
563
568
  if (occupancy.scheduleEventId !== undefined && occupancy.scheduleEventId !== null) {
564
569
  return "scheduleEvent:".concat(String(occupancy.resourceId), ":").concat(String(occupancy.scheduleEventId));
565
570
  }
@@ -129,7 +129,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
129
129
  * /product/query 的智能定价评估只读取 strategy_context;
130
130
  * application_code 仅作为接口兼容字段,不能替代 channel / business_code。
131
131
  */
132
- private getPriceQueryStrategyContext;
132
+ protected getPriceQueryStrategyContext(channel?: string): Record<string, any>;
133
133
  /**
134
134
  * 子类可在商品重报价前准备客户维度的策略上下文,例如等待 Wallet/优惠资产加载。
135
135
  */
@@ -156,6 +156,12 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
156
156
  private prepareRawProductForPriceQuery;
157
157
  private resolveLocalProductForPriceQuery;
158
158
  private loadProductsForPriceQuery;
159
+ /** Opt-in subclasses may supply page-owned raw pools; ordinary sales keep remote fallback. */
160
+ protected isVenueCatalogLocalPricingActive(): boolean;
161
+ protected getVenueCatalogLocalPriceSource(_productId: number, _selectedProduct?: Record<string, any>): {
162
+ product: Record<string, any>;
163
+ menuList: Record<string, any>[];
164
+ } | undefined;
159
165
  private resolveProductsForPriceQuery;
160
166
  private getAuthoritativeBundleItems;
161
167
  private findAuthoritativeBundleItem;
@@ -523,6 +529,11 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
523
529
  submitBeforeSend?: boolean;
524
530
  }): Promise<T>;
525
531
  transformBaseProductToOrderProduct(params: TransformBaseProductToOrderProductParams): import("./utils/transformBaseProductToOrderProduct").BaseProductOrderProductInput | null;
532
+ /** Explicit pool source avoids races between two simultaneous Venue pricing contexts. */
533
+ protected calculateVenueCatalogProductBookingPrice(params: BaseSalesCalculateProductBookingPriceParams, source: {
534
+ product: Record<string, any>;
535
+ menuList: Record<string, any>[];
536
+ }): Promise<BaseSalesProductBookingPriceResult>;
526
537
  calculateProductBookingPrice(params: BaseSalesCalculateProductBookingPriceParams): Promise<BaseSalesProductBookingPriceResult>;
527
538
  getQuotationCustomerScopeInfo(): BaseSalesQuotationCustomerScopeInfo;
528
539
  private hasSmartPricingStrategies;