@pisell/pisellos 2.3.170 → 2.3.172

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 (82) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.js +1 -0
  3. package/dist/inventory/index.d.ts +92 -0
  4. package/dist/inventory/index.js +509 -0
  5. package/dist/model/strategy/adapter/promotion/evaluator.js +5 -4
  6. package/dist/modules/Discount/index.js +1 -0
  7. package/dist/modules/Discount/types.d.ts +4 -0
  8. package/dist/modules/Order/index.d.ts +25 -3
  9. package/dist/modules/Order/index.js +1791 -1318
  10. package/dist/modules/Order/types.d.ts +7 -0
  11. package/dist/modules/Order/utils/discountProductLineIdentity.js +2 -2
  12. package/dist/modules/Order/utils/productVoucherGroups.d.ts +15 -0
  13. package/dist/modules/Order/utils/productVoucherGroups.js +115 -0
  14. package/dist/modules/Payment/walletpass.js +32 -6
  15. package/dist/modules/Product/index.d.ts +1 -1
  16. package/dist/modules/ProductList/index.js +33 -12
  17. package/dist/modules/Rules/index.d.ts +5 -10
  18. package/dist/modules/Rules/index.js +197 -107
  19. package/dist/modules/Rules/promotionSelection.d.ts +14 -0
  20. package/dist/modules/Rules/promotionSelection.js +390 -0
  21. package/dist/modules/Rules/types.d.ts +9 -0
  22. package/dist/server/modules/order/index.d.ts +6 -0
  23. package/dist/server/modules/order/index.js +782 -447
  24. package/dist/solution/BaseSales/index.d.ts +16 -1
  25. package/dist/solution/BaseSales/index.js +1545 -1339
  26. package/dist/solution/BaseSales/utils/cartPromotion.js +5 -2
  27. package/dist/solution/BookingByStep/index.d.ts +2 -2
  28. package/dist/solution/BookingTicket/index.js +200 -108
  29. package/dist/solution/BookingTicket/types.d.ts +14 -2
  30. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +1 -1
  31. package/dist/solution/BookingTicket/utils/addProductDecision.js +4 -3
  32. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +94 -58
  33. package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +10 -0
  34. package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +117 -0
  35. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +1 -0
  36. package/dist/solution/BookingTicket/utils/scan/handleScan.js +2 -1
  37. package/dist/solution/UnifiedBookingSales/index.d.ts +1 -1
  38. package/dist/solution/UnifiedBookingSales/index.js +69 -49
  39. package/dist/utils/platform.d.ts +2 -0
  40. package/dist/utils/platform.js +6 -0
  41. package/lib/index.d.ts +1 -0
  42. package/lib/index.js +12 -0
  43. package/lib/inventory/index.d.ts +92 -0
  44. package/lib/inventory/index.js +287 -0
  45. package/lib/model/strategy/adapter/promotion/evaluator.js +5 -4
  46. package/lib/model/strategy/adapter/promotion/index.js +1 -46
  47. package/lib/modules/Discount/index.js +1 -0
  48. package/lib/modules/Discount/types.d.ts +4 -0
  49. package/lib/modules/Order/index.d.ts +25 -3
  50. package/lib/modules/Order/index.js +203 -38
  51. package/lib/modules/Order/types.d.ts +7 -0
  52. package/lib/modules/Order/utils/discountProductLineIdentity.js +1 -1
  53. package/lib/modules/Order/utils/productVoucherGroups.d.ts +15 -0
  54. package/lib/modules/Order/utils/productVoucherGroups.js +64 -0
  55. package/lib/modules/Payment/walletpass.js +23 -1
  56. package/lib/modules/Product/index.d.ts +1 -1
  57. package/lib/modules/ProductList/index.js +15 -0
  58. package/lib/modules/Rules/index.d.ts +5 -10
  59. package/lib/modules/Rules/index.js +68 -22
  60. package/lib/modules/Rules/promotionSelection.d.ts +14 -0
  61. package/lib/modules/Rules/promotionSelection.js +230 -0
  62. package/lib/modules/Rules/types.d.ts +9 -0
  63. package/lib/server/modules/order/index.d.ts +6 -0
  64. package/lib/server/modules/order/index.js +226 -29
  65. package/lib/solution/BaseSales/index.d.ts +16 -1
  66. package/lib/solution/BaseSales/index.js +108 -14
  67. package/lib/solution/BaseSales/utils/cartPromotion.js +5 -2
  68. package/lib/solution/BookingByStep/index.d.ts +2 -2
  69. package/lib/solution/BookingTicket/index.js +38 -2
  70. package/lib/solution/BookingTicket/types.d.ts +14 -2
  71. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +1 -1
  72. package/lib/solution/BookingTicket/utils/addProductDecision.js +4 -3
  73. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +14 -2
  74. package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +10 -0
  75. package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +71 -0
  76. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +1 -0
  77. package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -1
  78. package/lib/solution/UnifiedBookingSales/index.d.ts +1 -1
  79. package/lib/solution/UnifiedBookingSales/index.js +14 -3
  80. package/lib/utils/platform.d.ts +2 -0
  81. package/lib/utils/platform.js +7 -0
  82. package/package.json +1 -1
@@ -47,7 +47,7 @@ import { AvailabilityRemoteOccupancyCache } from "./remoteOccupancyCache";
47
47
  import { BusinessAvailabilityController } from "./businessAvailability";
48
48
  import { BookingTicket } from "../BookingTicket";
49
49
  import { addLocalCalendarDays, captureRuntimeOffsetMinutes, extractFixedOffsetMinutes, formatLocalDate, formatLocalDateTime, formatLocalTime, localDateTimeToScalar, localDateToScalar, localDateToScalarStart, parseLocalDate, parseLocalDateTime } from "../../modules/ResourcePlanner/localClock";
50
- import { isCustomerUserPlatform, normalizeRuntimePlatform } from "../../utils/platform";
50
+ import { isCustomerUserPlatform, isSelfServicePlatform, normalizeRuntimePlatform } from "../../utils/platform";
51
51
  import { ItemRuleEvaluator } from "../../model/strategy/adapter/itemRule";
52
52
  export * from "./types";
53
53
  export { AvailabilityError } from "../../modules/ResourcePlanner";
@@ -1832,16 +1832,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1832
1832
  key: "setOtherParams",
1833
1833
  value: function () {
1834
1834
  var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
1835
- var _this$otherParams10, _this$otherParams12;
1835
+ var _this$otherParams10, _this$otherParams11, _this$otherParams12, _this$otherParams13, _this$otherParams15;
1836
1836
  var _ref31,
1837
1837
  _ref31$cover,
1838
1838
  cover,
1839
1839
  previousScope,
1840
+ previousCatalogScope,
1840
1841
  previousItemRuleConfig,
1841
1842
  explicitlySetsOpenData,
1842
1843
  nextParams,
1843
1844
  nextScope,
1844
- _this$otherParams11,
1845
+ _this$otherParams14,
1845
1846
  shouldResetAvailabilityState,
1846
1847
  _args4 = arguments;
1847
1848
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
@@ -1849,33 +1850,42 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1849
1850
  case 0:
1850
1851
  _ref31 = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {}, _ref31$cover = _ref31.cover, cover = _ref31$cover === void 0 ? false : _ref31$cover;
1851
1852
  previousScope = this.getAvailabilityScopeDescriptor(this.otherParams || {});
1852
- previousItemRuleConfig = (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.itemRule;
1853
+ previousCatalogScope = (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.catalogScopeKey;
1854
+ previousItemRuleConfig = (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.itemRule;
1853
1855
  explicitlySetsOpenData = Object.prototype.hasOwnProperty.call(params, 'openData');
1854
1856
  nextParams = cover ? params : _objectSpread(_objectSpread({}, this.otherParams), params);
1855
1857
  if (explicitlySetsOpenData || this.getRuntimeOpenDataScope() !== this.getRuntimeOpenDataScope(nextParams)) {
1856
1858
  this.clearOpenDataCache();
1857
1859
  }
1858
- _context4.next = 8;
1860
+ _context4.next = 9;
1859
1861
  return _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "setOtherParams", this).call(this, params, {
1860
1862
  cover: cover
1861
1863
  });
1862
- case 8:
1864
+ case 9:
1865
+ if (!(previousCatalogScope !== ((_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.catalogScopeKey) && (previousCatalogScope || (_this$otherParams13 = this.otherParams) !== null && _this$otherParams13 !== void 0 && _this$otherParams13.catalogScopeKey))) {
1866
+ _context4.next = 13;
1867
+ break;
1868
+ }
1869
+ this.unifiedProductCatalog = [];
1870
+ _context4.next = 13;
1871
+ return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), []);
1872
+ case 13:
1863
1873
  nextScope = this.getAvailabilityScopeDescriptor(this.otherParams || {});
1864
1874
  if (explicitlySetsOpenData) {
1865
- this.openDataTarget = (_this$otherParams11 = this.otherParams) !== null && _this$otherParams11 !== void 0 && _this$otherParams11.openData && nextScope.businessCode && nextScope.channel ? "".concat(nextScope.businessCode, "+").concat(nextScope.channel) : null;
1875
+ this.openDataTarget = (_this$otherParams14 = this.otherParams) !== null && _this$otherParams14 !== void 0 && _this$otherParams14.openData && nextScope.businessCode && nextScope.channel ? "".concat(nextScope.businessCode, "+").concat(nextScope.channel) : null;
1866
1876
  }
1867
1877
  shouldResetAvailabilityState = previousScope.cacheId !== nextScope.cacheId || previousScope.businessCode !== nextScope.businessCode || previousScope.channel !== nextScope.channel || previousScope.platform !== nextScope.platform || previousScope.businessTimezone !== nextScope.businessTimezone;
1868
1878
  if (!shouldResetAvailabilityState) {
1869
- _context4.next = 14;
1879
+ _context4.next = 19;
1870
1880
  break;
1871
1881
  }
1872
- _context4.next = 14;
1882
+ _context4.next = 19;
1873
1883
  return this.resetAvailabilityProjectionState('set_other_params_reset');
1874
- case 14:
1875
- if (shouldResetAvailabilityState || explicitlySetsOpenData || previousItemRuleConfig !== ((_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.itemRule)) {
1884
+ case 19:
1885
+ if (shouldResetAvailabilityState || explicitlySetsOpenData || previousItemRuleConfig !== ((_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.itemRule)) {
1876
1886
  this.resetAllergyItemRuleState();
1877
1887
  }
1878
- case 15:
1888
+ case 20:
1879
1889
  case "end":
1880
1890
  return _context4.stop();
1881
1891
  }
@@ -2115,8 +2125,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2115
2125
  }, {
2116
2126
  key: "isSessionStoragePersistEnabled",
2117
2127
  value: function isSessionStoragePersistEnabled() {
2118
- var _this$otherParams13;
2119
- return Boolean(this.cacheId && ((_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.enableSessionStoragePersist) === true);
2128
+ var _this$otherParams16;
2129
+ return Boolean(this.cacheId && ((_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.enableSessionStoragePersist) === true);
2120
2130
  }
2121
2131
  }, {
2122
2132
  key: "shouldUseSessionStorageForSubModule",
@@ -2183,12 +2193,12 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2183
2193
  key: "ensureLocalOrderNumbersForCheckout",
2184
2194
  value: (function () {
2185
2195
  var _ensureLocalOrderNumbersForCheckout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
2186
- var _this$otherParams14, _this$appPlugin, _this$appPlugin$getAp, _this$appPlugin$getAp2;
2196
+ var _this$otherParams17, _this$appPlugin, _this$appPlugin$getAp, _this$appPlugin$getAp2;
2187
2197
  var order, tempOrder, biz, idGenerator;
2188
2198
  return _regeneratorRuntime().wrap(function _callee8$(_context8) {
2189
2199
  while (1) switch (_context8.prev = _context8.next) {
2190
2200
  case 0:
2191
- if (!(normalizeRuntimePlatform((_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.platform) !== 'kiosk')) {
2201
+ if (!(normalizeRuntimePlatform((_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.platform) !== 'kiosk')) {
2192
2202
  _context8.next = 2;
2193
2203
  break;
2194
2204
  }
@@ -2273,18 +2283,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2273
2283
  return ensureLocalOrderNumbersForCheckout;
2274
2284
  }()
2275
2285
  /**
2276
- * PC/H5/Kiosk 结账默认直接等待云端 checkout;POS/WebPOS 仍保持本地待同步。
2286
+ * PC/H5 及自助终端结账默认直接等待云端 checkout;POS/WebPOS 仍保持本地待同步。
2277
2287
  * 显式传 checkoutSyncTaskEnabled: true 时仍可回退到本地同步模式。
2278
2288
  */
2279
2289
  )
2280
2290
  }, {
2281
2291
  key: "shouldUseCheckoutSyncTask",
2282
2292
  value: function shouldUseCheckoutSyncTask() {
2283
- var _this$otherParams15, _this$otherParams16;
2284
- var configured = (_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.checkoutSyncTaskEnabled;
2293
+ var _this$otherParams18, _this$otherParams19;
2294
+ var configured = (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.checkoutSyncTaskEnabled;
2285
2295
  if (configured === true) return true;
2286
- var platform = normalizeRuntimePlatform((_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.platform);
2287
- return !isCustomerUserPlatform(platform) && platform !== 'kiosk';
2296
+ var platform = normalizeRuntimePlatform((_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.platform);
2297
+ return !isCustomerUserPlatform(platform) && !isSelfServicePlatform(platform);
2288
2298
  }
2289
2299
 
2290
2300
  /** UnifiedBookingSales 的真实结账默认请求收据数据,供云端确认后再本地打印。 */
@@ -2438,8 +2448,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2438
2448
  }, {
2439
2449
  key: "isAuthenticatedCustomerUserPlatform",
2440
2450
  value: function isAuthenticatedCustomerUserPlatform() {
2441
- var _this$otherParams17;
2442
- return isCustomerUserPlatform((_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.platform);
2451
+ var _this$otherParams20;
2452
+ return isCustomerUserPlatform((_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.platform);
2443
2453
  }
2444
2454
  }, {
2445
2455
  key: "resolveDiscountOrderIdentity",
@@ -2779,13 +2789,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2779
2789
  key: "loadPickupTimingOpenData",
2780
2790
  value: function () {
2781
2791
  var _loadPickupTimingOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(_force) {
2782
- var _ref34, _this$otherParams$bus2, _this$otherParams18, _this$otherParams19;
2792
+ var _ref34, _this$otherParams$bus2, _this$otherParams21, _this$otherParams22;
2783
2793
  var scope, businessCode, config;
2784
2794
  return _regeneratorRuntime().wrap(function _callee18$(_context18) {
2785
2795
  while (1) switch (_context18.prev = _context18.next) {
2786
2796
  case 0:
2787
2797
  scope = this.getPickupTimingScope();
2788
- businessCode = String((_ref34 = (_this$otherParams$bus2 = (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.businessCode) !== null && _this$otherParams$bus2 !== void 0 ? _this$otherParams$bus2 : (_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.business_code) !== null && _ref34 !== void 0 ? _ref34 : '').trim();
2798
+ businessCode = String((_ref34 = (_this$otherParams$bus2 = (_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.businessCode) !== null && _this$otherParams$bus2 !== void 0 ? _this$otherParams$bus2 : (_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.business_code) !== null && _ref34 !== void 0 ? _ref34 : '').trim();
2789
2799
  _context18.next = 4;
2790
2800
  return this.loadOpenData({
2791
2801
  businessCode: businessCode,
@@ -2950,7 +2960,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2950
2960
  key: "resolveProductAllergyRequirement",
2951
2961
  value: (function () {
2952
2962
  var _resolveProductAllergyRequirement = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
2953
- var _this$otherParams20, _this$getOrderProduct, _runtimePax$total, _runtimePax$adult, _runtimePax$child, _ref37, _runtimeConfig$servic, _this$otherParams21, _ref38, _ref39, _params$channel, _this$otherParams22, _this$otherParams23, _runtimeConfig$submis;
2963
+ var _this$otherParams23, _this$getOrderProduct, _runtimePax$total, _runtimePax$adult, _runtimePax$child, _ref37, _runtimeConfig$servic, _this$otherParams24, _ref38, _ref39, _params$channel, _this$otherParams25, _this$otherParams26, _runtimeConfig$submis;
2954
2964
  var productId, strategyConfigs, productVariantId, runtimeConfig, runtimePax, cartItems;
2955
2965
  return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2956
2966
  while (1) switch (_context22.prev = _context22.next) {
@@ -2973,7 +2983,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2973
2983
  return _context22.abrupt("return", null);
2974
2984
  case 8:
2975
2985
  productVariantId = normalizePositiveInteger(params.productVariantId);
2976
- runtimeConfig = ((_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.itemRule) || {};
2986
+ runtimeConfig = ((_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.itemRule) || {};
2977
2987
  runtimePax = runtimeConfig.pax || {};
2978
2988
  cartItems = (((_this$getOrderProduct = this.getOrderProducts) === null || _this$getOrderProduct === void 0 ? void 0 : _this$getOrderProduct.call(this)) || []).map(function (item) {
2979
2989
  var _item$product_id, _item$product_variant, _ref36, _item$num;
@@ -2992,8 +3002,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2992
3002
  child: Number((_runtimePax$child = runtimePax.child) !== null && _runtimePax$child !== void 0 ? _runtimePax$child : 0) || 0
2993
3003
  },
2994
3004
  cartItems: cartItems,
2995
- serviceType: String((_ref37 = (_runtimeConfig$servic = runtimeConfig.serviceType) !== null && _runtimeConfig$servic !== void 0 ? _runtimeConfig$servic : (_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.serviceType) !== null && _ref37 !== void 0 ? _ref37 : ''),
2996
- channel: String((_ref38 = (_ref39 = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : (_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.channel) !== null && _ref39 !== void 0 ? _ref39 : (_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.platform) !== null && _ref38 !== void 0 ? _ref38 : ''),
3005
+ serviceType: String((_ref37 = (_runtimeConfig$servic = runtimeConfig.serviceType) !== null && _runtimeConfig$servic !== void 0 ? _runtimeConfig$servic : (_this$otherParams24 = this.otherParams) === null || _this$otherParams24 === void 0 ? void 0 : _this$otherParams24.serviceType) !== null && _ref37 !== void 0 ? _ref37 : ''),
3006
+ channel: String((_ref38 = (_ref39 = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : (_this$otherParams25 = this.otherParams) === null || _this$otherParams25 === void 0 ? void 0 : _this$otherParams25.channel) !== null && _ref39 !== void 0 ? _ref39 : (_this$otherParams26 = this.otherParams) === null || _this$otherParams26 === void 0 ? void 0 : _this$otherParams26.platform) !== null && _ref38 !== void 0 ? _ref38 : ''),
2997
3007
  currentProduct: _objectSpread({
2998
3008
  product_id: productId
2999
3009
  }, productVariantId ? {
@@ -3083,9 +3093,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3083
3093
  }, {
3084
3094
  key: "isInvoiceOpenDataCacheCurrent",
3085
3095
  value: function isInvoiceOpenDataCacheCurrent() {
3086
- var _this$otherParams24, _this$otherParams25;
3087
- var businessCode = String(((_this$otherParams24 = this.otherParams) === null || _this$otherParams24 === void 0 ? void 0 : _this$otherParams24.businessCode) || '').trim();
3088
- var channel = String(((_this$otherParams25 = this.otherParams) === null || _this$otherParams25 === void 0 ? void 0 : _this$otherParams25.channel) || '').trim();
3096
+ var _this$otherParams27, _this$otherParams28;
3097
+ var businessCode = String(((_this$otherParams27 = this.otherParams) === null || _this$otherParams27 === void 0 ? void 0 : _this$otherParams27.businessCode) || '').trim();
3098
+ var channel = String(((_this$otherParams28 = this.otherParams) === null || _this$otherParams28 === void 0 ? void 0 : _this$otherParams28.channel) || '').trim();
3089
3099
  if (!businessCode || !channel) return false;
3090
3100
  return this.openDataTarget === "".concat(businessCode, "+").concat(channel) && this.runtimeOpenDataScope === this.getRuntimeOpenDataScope();
3091
3101
  }
@@ -3109,7 +3119,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3109
3119
  throw new Error('[UnifiedBookingSales] getProtocol 需要 policyId');
3110
3120
  case 3:
3111
3121
  policyUrl = 'shop-policy';
3112
- if (this.otherParams.platform === 'kiosk' || this.otherParams.platform === 'pos' || this.otherParams.platform === 'shop') {
3122
+ if (isSelfServicePlatform(this.otherParams.platform) || this.otherParams.platform === 'pos' || this.otherParams.platform === 'shop') {
3113
3123
  policyUrl = 'policy';
3114
3124
  }
3115
3125
  return _context25.abrupt("return", this.request.get("/".concat(policyUrl, "/").concat(encodeURIComponent(normalizedPolicyId))));
@@ -3135,6 +3145,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3135
3145
  var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
3136
3146
  var params,
3137
3147
  options,
3148
+ catalogScope,
3138
3149
  schedule_date,
3139
3150
  schedule_datetime,
3140
3151
  result,
@@ -3150,9 +3161,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3150
3161
  }
3151
3162
  throw new Error('[UnifiedBookingSales] products 模块未初始化');
3152
3163
  case 4:
3164
+ catalogScope = this.otherParams.catalogScopeKey;
3153
3165
  schedule_date = params.schedule_date || dayjs().format('YYYY-MM-DD');
3154
3166
  schedule_datetime = params.schedule_datetime || "".concat(schedule_date, " ").concat(dayjs().format('HH:mm:ss'));
3155
- _context26.next = 8;
3167
+ _context26.next = 9;
3156
3168
  return this.store.products.loadProducts(_objectSpread(_objectSpread({
3157
3169
  with_count: ['bundleGroup', 'optionGroup'],
3158
3170
  with_schedule: 1
@@ -3161,14 +3173,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
3161
3173
  schedule_datetime: schedule_datetime,
3162
3174
  cacheId: this.cacheId
3163
3175
  }), options);
3164
- case 8:
3176
+ case 9:
3165
3177
  result = _context26.sent;
3178
+ if (!(catalogScope !== this.otherParams.catalogScopeKey)) {
3179
+ _context26.next = 12;
3180
+ break;
3181
+ }
3182
+ throw Object.assign(new Error('Product scope changed'), {
3183
+ name: 'AbortError'
3184
+ });
3185
+ case 12:
3166
3186
  this.unifiedProductCatalog = Array.isArray(result) ? _toConsumableArray(result) : [];
3167
- _context26.next = 12;
3187
+ _context26.next = 15;
3168
3188
  return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), result);
3169
- case 12:
3189
+ case 15:
3170
3190
  return _context26.abrupt("return", result);
3171
- case 13:
3191
+ case 16:
3172
3192
  case "end":
3173
3193
  return _context26.stop();
3174
3194
  }
@@ -5161,7 +5181,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5161
5181
  value: (function () {
5162
5182
  var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(contextId) {
5163
5183
  var _this$otherParams$pla2,
5164
- _this$otherParams26,
5184
+ _this$otherParams29,
5165
5185
  _context$prepareParam,
5166
5186
  _extractFixedOffsetMi,
5167
5187
  _this13 = this;
@@ -5191,7 +5211,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5191
5211
  context = _yield$this$ensureAva.context;
5192
5212
  projectionEntry = _yield$this$ensureAva.projectionEntry;
5193
5213
  contextVersion = context.activeVersion;
5194
- isPosAvailabilityRequest = String((_this$otherParams$pla2 = (_this$otherParams26 = this.otherParams) === null || _this$otherParams26 === void 0 ? void 0 : _this$otherParams26.platform) !== null && _this$otherParams$pla2 !== void 0 ? _this$otherParams$pla2 : '').trim().toLowerCase() === 'pos';
5214
+ isPosAvailabilityRequest = String((_this$otherParams$pla2 = (_this$otherParams29 = this.otherParams) === null || _this$otherParams29 === void 0 ? void 0 : _this$otherParams29.platform) !== null && _this$otherParams$pla2 !== void 0 ? _this$otherParams$pla2 : '').trim().toLowerCase() === 'pos';
5195
5215
  isEditingContext = Boolean((_context$prepareParam = context.prepareParams.editingProductLineUids) === null || _context$prepareParam === void 0 ? void 0 : _context$prepareParam.length);
5196
5216
  editingOffset = (_extractFixedOffsetMi = extractFixedOffsetMinutes(projectionEntry.projection.meta.now)) !== null && _extractFixedOffsetMi !== void 0 ? _extractFixedOffsetMi : this.getAvailabilityRuntimeOffsetMinutes(); // This new editing input represents an absolute instant. Normalize it once
5197
5217
  // to the projection's fixed business clock before the wall-clock planner.
@@ -5259,7 +5279,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5259
5279
  key: "queryBookingAvailability",
5260
5280
  value: (function () {
5261
5281
  var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(contextId, request) {
5262
- var _this$otherParams$pla3, _this$otherParams27, _context$prepareParam2;
5282
+ var _this$otherParams$pla3, _this$otherParams30, _context$prepareParam2;
5263
5283
  var _yield$this$ensureAva2, context, projectionEntry, refreshed, isPosAvailabilityRequest, queryRequest, result, contextVersion, contextualResult;
5264
5284
  return _regeneratorRuntime().wrap(function _callee49$(_context49) {
5265
5285
  while (1) switch (_context49.prev = _context49.next) {
@@ -5272,7 +5292,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5272
5292
  projectionEntry = _yield$this$ensureAva2.projectionEntry;
5273
5293
  refreshed = _yield$this$ensureAva2.refreshed;
5274
5294
  this.assertContextualQueryFreshness(context, request);
5275
- isPosAvailabilityRequest = String((_this$otherParams$pla3 = (_this$otherParams27 = this.otherParams) === null || _this$otherParams27 === void 0 ? void 0 : _this$otherParams27.platform) !== null && _this$otherParams$pla3 !== void 0 ? _this$otherParams$pla3 : '').trim().toLowerCase() === 'pos';
5295
+ isPosAvailabilityRequest = String((_this$otherParams$pla3 = (_this$otherParams30 = this.otherParams) === null || _this$otherParams30 === void 0 ? void 0 : _this$otherParams30.platform) !== null && _this$otherParams$pla3 !== void 0 ? _this$otherParams$pla3 : '').trim().toLowerCase() === 'pos';
5276
5296
  queryRequest = request.target === 'date' || request.target === 'product' ? _objectSpread(_objectSpread({}, request), {}, {
5277
5297
  dateRange: request.dateRange || this.getAvailabilityBusinessDateRange(projectionEntry.projection)
5278
5298
  }) : request;
@@ -5389,14 +5409,14 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5389
5409
  value: function () {
5390
5410
  var _removeBookingProductsOutsideStartDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(startDate) {
5391
5411
  var _this$getTempOrder4,
5392
- _this$otherParams28,
5412
+ _this$otherParams31,
5393
5413
  _this14 = this;
5394
5414
  var products, targetDate, identities;
5395
5415
  return _regeneratorRuntime().wrap(function _callee50$(_context50) {
5396
5416
  while (1) switch (_context50.prev = _context50.next) {
5397
5417
  case 0:
5398
5418
  products = ((_this$getTempOrder4 = this.getTempOrder()) === null || _this$getTempOrder4 === void 0 ? void 0 : _this$getTempOrder4.products) || [];
5399
- if (!(((_this$otherParams28 = this.otherParams) === null || _this$otherParams28 === void 0 ? void 0 : _this$otherParams28.enforceSingleBookingStartDate) !== true)) {
5419
+ if (!(((_this$otherParams31 = this.otherParams) === null || _this$otherParams31 === void 0 ? void 0 : _this$otherParams31.enforceSingleBookingStartDate) !== true)) {
5400
5420
  _context50.next = 3;
5401
5421
  break;
5402
5422
  }
@@ -5436,12 +5456,12 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5436
5456
  value: (function () {
5437
5457
  var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(contextId, params) {
5438
5458
  var _this$otherParams$pla4,
5439
- _this$otherParams29,
5459
+ _this$otherParams32,
5440
5460
  _params$availabilityC,
5441
5461
  _this$store$order11,
5442
5462
  _this$store$order11$e,
5443
5463
  _this15 = this;
5444
- var normalizedContextId, isRememberedSelection, hasCommitGuard, rememberedOrder, getRememberedCommitIdentity, rememberedCommitIdentity, availabilityCommitTargetGuard, guardedCommitPublished, _params$bookingCount, _ref55, _params$orderProduct$, _params$orderProduct, _params$orderProduct2, _params$orderProduct3, _params$orderProduct$2, _params$orderProduct4, _params$orderProduct5, _editingLine$product_, _this$otherParams$pla5, _this$otherParams30, _baseProjection$meta$, _refreshedProjection$, _baseProjection$meta$2, _this$otherParams$pla6, _this$otherParams31, _ref56, _params$orderProduct$3, _params$orderProduct6, _existingBooking$meta, _ref57, _ref58, _params$orderProduct$4, _params$orderProduct7, _params$orderProduct8, _existingBooking$meta2, _existingBooking$hold, _params$orderProduct9, _nextContext$activeVe, bookingCount, orderProductQuantity, partySize, _yield$this$ensureAva3, context, projectionEntry, refreshed, boundEditingUids, orderProductId, editingLine, _editingLine$product_2, baseProjection, selectedProduct, commitWriteGuard, prepareParams, fallbackResources, commitSnapshot, refreshedProjection, _baseProjection$meta$3, latestContext, candidateDurationMinutes, candidateStartTime, allowPosAvailabilityOverride, candidateBusinessDate, refreshedRanges, refreshedCandidateBase, product, validation, forced, capacityConflict, revalidationEntry, revalidatedContext, refreshedCandidate, availabilityCommitGuard, existingBooking, existingBookingUid, booking, legacyBooking, legacyResources, selectedResources, resourceKeys, transformed, productLineUid, bookingUid, productLineUids, bookingUids, _transformed$product_, _transformed$product_2, _transformed$product_3, _ref59, _transformed$product_4, _this$getTempOrder5, _this$getTempOrder6, _params$salesNotes, _params$salesNotes2, _ref60, beforeProductLineUids, beforeBookingUids, products, addedLines, addedBookings, targetStillCurrent, nextContext, result, emit, release;
5464
+ var normalizedContextId, isRememberedSelection, hasCommitGuard, rememberedOrder, getRememberedCommitIdentity, rememberedCommitIdentity, availabilityCommitTargetGuard, guardedCommitPublished, _params$bookingCount, _ref55, _params$orderProduct$, _params$orderProduct, _params$orderProduct2, _params$orderProduct3, _params$orderProduct$2, _params$orderProduct4, _params$orderProduct5, _editingLine$product_, _this$otherParams$pla5, _this$otherParams33, _baseProjection$meta$, _refreshedProjection$, _baseProjection$meta$2, _this$otherParams$pla6, _this$otherParams34, _ref56, _params$orderProduct$3, _params$orderProduct6, _existingBooking$meta, _ref57, _ref58, _params$orderProduct$4, _params$orderProduct7, _params$orderProduct8, _existingBooking$meta2, _existingBooking$hold, _params$orderProduct9, _nextContext$activeVe, bookingCount, orderProductQuantity, partySize, _yield$this$ensureAva3, context, projectionEntry, refreshed, boundEditingUids, orderProductId, editingLine, _editingLine$product_2, baseProjection, selectedProduct, commitWriteGuard, prepareParams, fallbackResources, commitSnapshot, refreshedProjection, _baseProjection$meta$3, latestContext, candidateDurationMinutes, candidateStartTime, allowPosAvailabilityOverride, candidateBusinessDate, refreshedRanges, refreshedCandidateBase, product, validation, forced, capacityConflict, revalidationEntry, revalidatedContext, refreshedCandidate, availabilityCommitGuard, existingBooking, existingBookingUid, booking, legacyBooking, legacyResources, selectedResources, resourceKeys, transformed, productLineUid, bookingUid, productLineUids, bookingUids, _transformed$product_, _transformed$product_2, _transformed$product_3, _ref59, _transformed$product_4, _this$getTempOrder5, _this$getTempOrder6, _params$salesNotes, _params$salesNotes2, _ref60, beforeProductLineUids, beforeBookingUids, products, addedLines, addedBookings, targetStillCurrent, nextContext, result, emit, release;
5445
5465
  return _regeneratorRuntime().wrap(function _callee51$(_context51) {
5446
5466
  while (1) switch (_context51.prev = _context51.next) {
5447
5467
  case 0:
@@ -5455,7 +5475,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5455
5475
  });
5456
5476
  case 3:
5457
5477
  isRememberedSelection = params.selectionIntent === 'remembered';
5458
- if (!(isRememberedSelection && (String((_this$otherParams$pla4 = (_this$otherParams29 = this.otherParams) === null || _this$otherParams29 === void 0 ? void 0 : _this$otherParams29.platform) !== null && _this$otherParams$pla4 !== void 0 ? _this$otherParams$pla4 : '').trim().toLowerCase() !== 'pos' || params.mode !== 'add'))) {
5478
+ if (!(isRememberedSelection && (String((_this$otherParams$pla4 = (_this$otherParams32 = this.otherParams) === null || _this$otherParams32 === void 0 ? void 0 : _this$otherParams32.platform) !== null && _this$otherParams$pla4 !== void 0 ? _this$otherParams$pla4 : '').trim().toLowerCase() !== 'pos' || params.mode !== 'add'))) {
5459
5479
  _context51.next = 6;
5460
5480
  break;
5461
5481
  }
@@ -5644,7 +5664,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5644
5664
  selectedProduct = baseProjection.products.find(function (item) {
5645
5665
  return sameAvailabilityId(item.id, params.candidate.productId);
5646
5666
  });
5647
- if (!(isRememberedSelection && (String((_this$otherParams$pla5 = (_this$otherParams30 = this.otherParams) === null || _this$otherParams30 === void 0 ? void 0 : _this$otherParams30.platform) !== null && _this$otherParams$pla5 !== void 0 ? _this$otherParams$pla5 : '').trim().toLowerCase() !== 'pos' || params.mode !== 'add' || (selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.kind) !== 'duration'))) {
5667
+ if (!(isRememberedSelection && (String((_this$otherParams$pla5 = (_this$otherParams33 = this.otherParams) === null || _this$otherParams33 === void 0 ? void 0 : _this$otherParams33.platform) !== null && _this$otherParams$pla5 !== void 0 ? _this$otherParams$pla5 : '').trim().toLowerCase() !== 'pos' || params.mode !== 'add' || (selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.kind) !== 'duration'))) {
5648
5668
  _context51.next = 67;
5649
5669
  break;
5650
5670
  }
@@ -5707,7 +5727,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
5707
5727
  this.assertAvailabilityCommitWriteCAS(commitWriteGuard);
5708
5728
  candidateDurationMinutes = getCandidateDurationMinutes(params.candidate);
5709
5729
  candidateStartTime = getCandidateStartTime(params.candidate);
5710
- allowPosAvailabilityOverride = String((_this$otherParams$pla6 = (_this$otherParams31 = this.otherParams) === null || _this$otherParams31 === void 0 ? void 0 : _this$otherParams31.platform) !== null && _this$otherParams$pla6 !== void 0 ? _this$otherParams$pla6 : '').trim().toLowerCase() === 'pos' && !isRememberedSelection;
5730
+ allowPosAvailabilityOverride = String((_this$otherParams$pla6 = (_this$otherParams34 = this.otherParams) === null || _this$otherParams34 === void 0 ? void 0 : _this$otherParams34.platform) !== null && _this$otherParams$pla6 !== void 0 ? _this$otherParams$pla6 : '').trim().toLowerCase() === 'pos' && !isRememberedSelection;
5711
5731
  candidateBusinessDate = params.candidate.businessDate || ((selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.kind) === 'duration' && this.usesDurationTimeGrid(refreshedProjection) ? getDurationBusinessDate(refreshedProjection, params.candidate.startAt) : params.candidate.startAt.slice(0, 10));
5712
5732
  refreshedRanges = getProjectionProductTimeRanges(refreshedProjection, _objectSpread({
5713
5733
  productIds: [params.candidate.productId],
@@ -6,3 +6,5 @@ export declare function normalizeRuntimePlatform(platform: unknown): string;
6
6
  * PC and H5 are authenticated-customer clients rather than staff terminals.
7
7
  */
8
8
  export declare function isCustomerUserPlatform(platform: unknown): boolean;
9
+ /** Kiosk and vending retain distinct channels but share self-service checkout behavior. */
10
+ export declare function isSelfServicePlatform(platform: unknown): boolean;
@@ -1,4 +1,5 @@
1
1
  var CUSTOMER_USER_PLATFORMS = new Set(['pc', 'h5']);
2
+ var SELF_SERVICE_PLATFORMS = new Set(['kiosk', 'vending']);
2
3
 
3
4
  /**
4
5
  * Normalize the runtime platform passed through solution/module otherParams.
@@ -12,4 +13,9 @@ export function normalizeRuntimePlatform(platform) {
12
13
  */
13
14
  export function isCustomerUserPlatform(platform) {
14
15
  return CUSTOMER_USER_PLATFORMS.has(normalizeRuntimePlatform(platform));
16
+ }
17
+
18
+ /** Kiosk and vending retain distinct channels but share self-service checkout behavior. */
19
+ export function isSelfServicePlatform(platform) {
20
+ return SELF_SERVICE_PLATFORMS.has(normalizeRuntimePlatform(platform));
15
21
  }
package/lib/index.d.ts CHANGED
@@ -7,6 +7,7 @@ export * from './modules';
7
7
  export * from './plugins';
8
8
  export * from './solution';
9
9
  export * from './model';
10
+ export * from './inventory';
10
11
  export { PisellOSCore } from './core';
11
12
  import PisellOSCore from './core';
12
13
  export default PisellOSCore;
package/lib/index.js CHANGED
@@ -80,6 +80,18 @@ Object.keys(_model).forEach(function (key) {
80
80
  }
81
81
  });
82
82
  });
83
+ var _inventory = require("./inventory");
84
+ Object.keys(_inventory).forEach(function (key) {
85
+ if (key === "default" || key === "__esModule") return;
86
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
87
+ if (key in exports && exports[key] === _inventory[key]) return;
88
+ Object.defineProperty(exports, key, {
89
+ enumerable: true,
90
+ get: function () {
91
+ return _inventory[key];
92
+ }
93
+ });
94
+ });
83
95
  var _core = _interopRequireWildcard(require("./core"));
84
96
  var _smallTicket = require("./shared/receipt/small-ticket");
85
97
  Object.keys(_smallTicket).forEach(function (key) {
@@ -0,0 +1,92 @@
1
+ /** Optional, instance-scoped sales inventory. Never stored in ProductData or order payloads. */
2
+ export type InventoryRecord = Record<string, any>;
3
+ export type InventoryRefreshReason = 'catalog-entry' | 'detail-open' | 'checkout' | 'manual';
4
+ export interface InventoryAvailability {
5
+ status: 'ready' | 'loading' | 'stale' | 'error' | 'unmapped';
6
+ quantity?: number;
7
+ message?: string;
8
+ }
9
+ export interface InventorySelectionAvailability {
10
+ availability: InventoryAvailability;
11
+ /** Stock remaining after other cart lines using the same inventory key. */
12
+ availableQuantity: number;
13
+ /** The existing line can still be reduced when stock is unavailable. */
14
+ retainedQuantity: number;
15
+ maxQuantity: number;
16
+ }
17
+ export interface InventorySource {
18
+ readonly scopeKey: string;
19
+ assertCurrent(): void;
20
+ keyOf(product: InventoryRecord, variant?: InventoryRecord): string | undefined;
21
+ read(context: {
22
+ reason: InventoryRefreshReason;
23
+ signal: AbortSignal;
24
+ }): Promise<ReadonlyMap<string, {
25
+ quantity: number | null;
26
+ message?: string;
27
+ }>>;
28
+ message(reason: 'unavailable' | 'unmapped' | 'insufficient', values?: {
29
+ key: string;
30
+ quantity: number;
31
+ }): string;
32
+ }
33
+ export interface CheckoutInventoryLine {
34
+ readonly lineId: string;
35
+ readonly productId: string | number;
36
+ readonly variantId: string | number;
37
+ readonly quantity: number;
38
+ readonly inventoryKey: string;
39
+ }
40
+ export interface CheckoutRuntimeSnapshot {
41
+ readonly scopeKey: string;
42
+ readonly revision: number;
43
+ readonly lines: readonly CheckoutInventoryLine[];
44
+ }
45
+ export interface SalesCheckoutHooks {
46
+ beforeCheckout?(context: {
47
+ items: readonly InventoryRecord[];
48
+ signal?: AbortSignal;
49
+ }): Promise<void>;
50
+ }
51
+ export declare const salesGuardError: (message: string) => Error & {
52
+ code: string;
53
+ };
54
+ export declare class InventoryController {
55
+ private readonly source;
56
+ readonly identity: symbol;
57
+ readonly scopeKey: string;
58
+ private entries;
59
+ private lastQuantities;
60
+ private products;
61
+ private keys;
62
+ private catalogProducts;
63
+ private listeners;
64
+ private revision;
65
+ private state;
66
+ private pending?;
67
+ private disposed;
68
+ constructor(source: InventorySource);
69
+ getRevision: () => number;
70
+ subscribe: (listener: () => void) => () => void;
71
+ private publish;
72
+ private assertCurrent;
73
+ activate(): void;
74
+ dispose(): void;
75
+ invalidate(): void;
76
+ /** Catalog replaces identities; partial detail only merges its variants, never its prices. */
77
+ registerProducts(products: readonly InventoryRecord[], complete?: boolean): void;
78
+ /** Consumers share I/O; cancelling one detail does not cancel another consumer. */
79
+ refresh(context: {
80
+ reason: InventoryRefreshReason;
81
+ signal?: AbortSignal;
82
+ force?: boolean;
83
+ }): Promise<void>;
84
+ availabilityForKey(key?: string): InventoryAvailability;
85
+ availability(product: InventoryRecord, variantId?: string | number): InventoryAvailability;
86
+ private keyForLine;
87
+ /** Advisory UI limit only. The serialized cart guard remains authoritative. */
88
+ selectionAvailability(product: InventoryRecord, variantId: string | number, items: readonly InventoryRecord[], editingItem?: InventoryRecord): InventorySelectionAvailability;
89
+ private totals;
90
+ validate(proposed: readonly InventoryRecord[], current?: readonly InventoryRecord[], allowReductions?: boolean): void;
91
+ freezeCheckout(items: readonly InventoryRecord[]): CheckoutRuntimeSnapshot;
92
+ }