@pisell/pisellos 0.10.57 → 0.10.59
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.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/inventory/index.d.ts +92 -0
- package/dist/inventory/index.js +500 -0
- package/dist/modules/Order/index.d.ts +20 -3
- package/dist/modules/Order/index.js +1369 -1021
- package/dist/modules/Order/types.d.ts +5 -0
- package/dist/modules/Order/utils.d.ts +5 -3
- package/dist/modules/Order/utils.js +32 -11
- package/dist/modules/ProductList/index.js +40 -17
- package/dist/solution/BaseSales/index.d.ts +8 -0
- package/dist/solution/BaseSales/index.js +1382 -1207
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/UnifiedBookingSales/index.js +58 -38
- package/lib/index.d.ts +1 -0
- package/lib/index.js +12 -0
- package/lib/inventory/index.d.ts +92 -0
- package/lib/inventory/index.js +280 -0
- package/lib/modules/Order/index.d.ts +20 -3
- package/lib/modules/Order/index.js +111 -19
- package/lib/modules/Order/types.d.ts +5 -0
- package/lib/modules/Order/utils.d.ts +5 -3
- package/lib/modules/Order/utils.js +29 -10
- package/lib/modules/ProductList/index.js +21 -4
- package/lib/solution/BaseSales/index.d.ts +8 -0
- package/lib/solution/BaseSales/index.js +82 -7
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/UnifiedBookingSales/index.js +11 -0
- package/package.json +1 -1
|
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
326
326
|
date: string;
|
|
327
327
|
status: string;
|
|
328
328
|
week: string;
|
|
329
|
-
weekNum: 0 | 2 | 1 | 3 |
|
|
329
|
+
weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
|
|
330
330
|
}[]>;
|
|
331
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
332
|
private getScheduleDataByIds;
|
|
@@ -1655,16 +1655,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1655
1655
|
key: "setOtherParams",
|
|
1656
1656
|
value: function () {
|
|
1657
1657
|
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
|
|
1658
|
-
var _this$otherParams9, _this$otherParams11;
|
|
1658
|
+
var _this$otherParams9, _this$otherParams10, _this$otherParams11, _this$otherParams12, _this$otherParams14;
|
|
1659
1659
|
var _ref31,
|
|
1660
1660
|
_ref31$cover,
|
|
1661
1661
|
cover,
|
|
1662
1662
|
previousScope,
|
|
1663
|
+
previousCatalogScope,
|
|
1663
1664
|
previousItemRuleConfig,
|
|
1664
1665
|
explicitlySetsOpenData,
|
|
1665
1666
|
nextParams,
|
|
1666
1667
|
nextScope,
|
|
1667
|
-
_this$
|
|
1668
|
+
_this$otherParams13,
|
|
1668
1669
|
shouldResetAvailabilityState,
|
|
1669
1670
|
_args3 = arguments;
|
|
1670
1671
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
@@ -1672,33 +1673,42 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1672
1673
|
case 0:
|
|
1673
1674
|
_ref31 = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {}, _ref31$cover = _ref31.cover, cover = _ref31$cover === void 0 ? false : _ref31$cover;
|
|
1674
1675
|
previousScope = this.getAvailabilityScopeDescriptor(this.otherParams || {});
|
|
1675
|
-
|
|
1676
|
+
previousCatalogScope = (_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.catalogScopeKey;
|
|
1677
|
+
previousItemRuleConfig = (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.itemRule;
|
|
1676
1678
|
explicitlySetsOpenData = Object.prototype.hasOwnProperty.call(params, 'openData');
|
|
1677
1679
|
nextParams = cover ? params : _objectSpread(_objectSpread({}, this.otherParams), params);
|
|
1678
1680
|
if (explicitlySetsOpenData || this.getRuntimeOpenDataScope() !== this.getRuntimeOpenDataScope(nextParams)) {
|
|
1679
1681
|
this.clearOpenDataCache();
|
|
1680
1682
|
}
|
|
1681
|
-
_context3.next =
|
|
1683
|
+
_context3.next = 9;
|
|
1682
1684
|
return _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "setOtherParams", this).call(this, params, {
|
|
1683
1685
|
cover: cover
|
|
1684
1686
|
});
|
|
1685
|
-
case
|
|
1687
|
+
case 9:
|
|
1688
|
+
if (!(previousCatalogScope !== ((_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.catalogScopeKey) && (previousCatalogScope || (_this$otherParams12 = this.otherParams) !== null && _this$otherParams12 !== void 0 && _this$otherParams12.catalogScopeKey))) {
|
|
1689
|
+
_context3.next = 13;
|
|
1690
|
+
break;
|
|
1691
|
+
}
|
|
1692
|
+
this.unifiedProductCatalog = [];
|
|
1693
|
+
_context3.next = 13;
|
|
1694
|
+
return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), []);
|
|
1695
|
+
case 13:
|
|
1686
1696
|
nextScope = this.getAvailabilityScopeDescriptor(this.otherParams || {});
|
|
1687
1697
|
if (explicitlySetsOpenData) {
|
|
1688
|
-
this.openDataTarget = (_this$
|
|
1698
|
+
this.openDataTarget = (_this$otherParams13 = this.otherParams) !== null && _this$otherParams13 !== void 0 && _this$otherParams13.openData && nextScope.businessCode && nextScope.channel ? "".concat(nextScope.businessCode, "+").concat(nextScope.channel) : null;
|
|
1689
1699
|
}
|
|
1690
1700
|
shouldResetAvailabilityState = previousScope.cacheId !== nextScope.cacheId || previousScope.businessCode !== nextScope.businessCode || previousScope.channel !== nextScope.channel || previousScope.platform !== nextScope.platform || previousScope.businessTimezone !== nextScope.businessTimezone;
|
|
1691
1701
|
if (!shouldResetAvailabilityState) {
|
|
1692
|
-
_context3.next =
|
|
1702
|
+
_context3.next = 19;
|
|
1693
1703
|
break;
|
|
1694
1704
|
}
|
|
1695
|
-
_context3.next =
|
|
1705
|
+
_context3.next = 19;
|
|
1696
1706
|
return this.resetAvailabilityProjectionState('set_other_params_reset');
|
|
1697
|
-
case
|
|
1698
|
-
if (shouldResetAvailabilityState || explicitlySetsOpenData || previousItemRuleConfig !== ((_this$
|
|
1707
|
+
case 19:
|
|
1708
|
+
if (shouldResetAvailabilityState || explicitlySetsOpenData || previousItemRuleConfig !== ((_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.itemRule)) {
|
|
1699
1709
|
this.resetAllergyItemRuleState();
|
|
1700
1710
|
}
|
|
1701
|
-
case
|
|
1711
|
+
case 20:
|
|
1702
1712
|
case "end":
|
|
1703
1713
|
return _context3.stop();
|
|
1704
1714
|
}
|
|
@@ -1931,8 +1941,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1931
1941
|
}, {
|
|
1932
1942
|
key: "isSessionStoragePersistEnabled",
|
|
1933
1943
|
value: function isSessionStoragePersistEnabled() {
|
|
1934
|
-
var _this$
|
|
1935
|
-
return Boolean(this.cacheId && ((_this$
|
|
1944
|
+
var _this$otherParams15;
|
|
1945
|
+
return Boolean(this.cacheId && ((_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.enableSessionStoragePersist) === true);
|
|
1936
1946
|
}
|
|
1937
1947
|
}, {
|
|
1938
1948
|
key: "shouldUseSessionStorageForSubModule",
|
|
@@ -2001,10 +2011,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2001
2011
|
}, {
|
|
2002
2012
|
key: "shouldUseCheckoutSyncTask",
|
|
2003
2013
|
value: function shouldUseCheckoutSyncTask() {
|
|
2004
|
-
var _this$
|
|
2005
|
-
var configured = (_this$
|
|
2014
|
+
var _this$otherParams16, _this$otherParams17;
|
|
2015
|
+
var configured = (_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.checkoutSyncTaskEnabled;
|
|
2006
2016
|
if (configured === true) return true;
|
|
2007
|
-
var platform = normalizeRuntimePlatform((_this$
|
|
2017
|
+
var platform = normalizeRuntimePlatform((_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.platform);
|
|
2008
2018
|
return !isCustomerUserPlatform(platform) && platform !== 'kiosk';
|
|
2009
2019
|
}
|
|
2010
2020
|
|
|
@@ -2159,8 +2169,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2159
2169
|
}, {
|
|
2160
2170
|
key: "isAuthenticatedCustomerUserPlatform",
|
|
2161
2171
|
value: function isAuthenticatedCustomerUserPlatform() {
|
|
2162
|
-
var _this$
|
|
2163
|
-
return isCustomerUserPlatform((_this$
|
|
2172
|
+
var _this$otherParams18;
|
|
2173
|
+
return isCustomerUserPlatform((_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.platform);
|
|
2164
2174
|
}
|
|
2165
2175
|
}, {
|
|
2166
2176
|
key: "resolveDiscountOrderIdentity",
|
|
@@ -2500,13 +2510,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2500
2510
|
key: "loadPickupTimingOpenData",
|
|
2501
2511
|
value: function () {
|
|
2502
2512
|
var _loadPickupTimingOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(_force) {
|
|
2503
|
-
var _ref34, _this$otherParams$bus2, _this$
|
|
2513
|
+
var _ref34, _this$otherParams$bus2, _this$otherParams19, _this$otherParams20;
|
|
2504
2514
|
var scope, businessCode, config;
|
|
2505
2515
|
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
2506
2516
|
while (1) switch (_context16.prev = _context16.next) {
|
|
2507
2517
|
case 0:
|
|
2508
2518
|
scope = this.getPickupTimingScope();
|
|
2509
|
-
businessCode = String((_ref34 = (_this$otherParams$bus2 = (_this$
|
|
2519
|
+
businessCode = String((_ref34 = (_this$otherParams$bus2 = (_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.businessCode) !== null && _this$otherParams$bus2 !== void 0 ? _this$otherParams$bus2 : (_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.business_code) !== null && _ref34 !== void 0 ? _ref34 : '').trim();
|
|
2510
2520
|
_context16.next = 4;
|
|
2511
2521
|
return this.loadOpenData({
|
|
2512
2522
|
businessCode: businessCode,
|
|
@@ -2669,7 +2679,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2669
2679
|
key: "resolveProductAllergyRequirement",
|
|
2670
2680
|
value: (function () {
|
|
2671
2681
|
var _resolveProductAllergyRequirement = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
|
|
2672
|
-
var _this$
|
|
2682
|
+
var _this$otherParams21, _this$getOrderProduct, _runtimePax$total, _runtimePax$adult, _runtimePax$child, _ref37, _runtimeConfig$servic, _this$otherParams22, _ref38, _ref39, _params$channel, _this$otherParams23, _this$otherParams24, _runtimeConfig$submis;
|
|
2673
2683
|
var productId, strategyConfigs, productVariantId, runtimeConfig, runtimePax, cartItems;
|
|
2674
2684
|
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
2675
2685
|
while (1) switch (_context20.prev = _context20.next) {
|
|
@@ -2692,7 +2702,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2692
2702
|
return _context20.abrupt("return", null);
|
|
2693
2703
|
case 8:
|
|
2694
2704
|
productVariantId = normalizePositiveInteger(params.productVariantId);
|
|
2695
|
-
runtimeConfig = ((_this$
|
|
2705
|
+
runtimeConfig = ((_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.itemRule) || {};
|
|
2696
2706
|
runtimePax = runtimeConfig.pax || {};
|
|
2697
2707
|
cartItems = (((_this$getOrderProduct = this.getOrderProducts) === null || _this$getOrderProduct === void 0 ? void 0 : _this$getOrderProduct.call(this)) || []).map(function (item) {
|
|
2698
2708
|
var _item$product_id, _item$product_variant, _ref36, _item$num;
|
|
@@ -2711,8 +2721,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2711
2721
|
child: Number((_runtimePax$child = runtimePax.child) !== null && _runtimePax$child !== void 0 ? _runtimePax$child : 0) || 0
|
|
2712
2722
|
},
|
|
2713
2723
|
cartItems: cartItems,
|
|
2714
|
-
serviceType: String((_ref37 = (_runtimeConfig$servic = runtimeConfig.serviceType) !== null && _runtimeConfig$servic !== void 0 ? _runtimeConfig$servic : (_this$
|
|
2715
|
-
channel: String((_ref38 = (_ref39 = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : (_this$
|
|
2724
|
+
serviceType: String((_ref37 = (_runtimeConfig$servic = runtimeConfig.serviceType) !== null && _runtimeConfig$servic !== void 0 ? _runtimeConfig$servic : (_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.serviceType) !== null && _ref37 !== void 0 ? _ref37 : ''),
|
|
2725
|
+
channel: String((_ref38 = (_ref39 = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : (_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.channel) !== null && _ref39 !== void 0 ? _ref39 : (_this$otherParams24 = this.otherParams) === null || _this$otherParams24 === void 0 ? void 0 : _this$otherParams24.platform) !== null && _ref38 !== void 0 ? _ref38 : ''),
|
|
2716
2726
|
currentProduct: _objectSpread({
|
|
2717
2727
|
product_id: productId
|
|
2718
2728
|
}, productVariantId ? {
|
|
@@ -2802,9 +2812,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2802
2812
|
}, {
|
|
2803
2813
|
key: "isInvoiceOpenDataCacheCurrent",
|
|
2804
2814
|
value: function isInvoiceOpenDataCacheCurrent() {
|
|
2805
|
-
var _this$
|
|
2806
|
-
var businessCode = String(((_this$
|
|
2807
|
-
var channel = String(((_this$
|
|
2815
|
+
var _this$otherParams25, _this$otherParams26;
|
|
2816
|
+
var businessCode = String(((_this$otherParams25 = this.otherParams) === null || _this$otherParams25 === void 0 ? void 0 : _this$otherParams25.businessCode) || '').trim();
|
|
2817
|
+
var channel = String(((_this$otherParams26 = this.otherParams) === null || _this$otherParams26 === void 0 ? void 0 : _this$otherParams26.channel) || '').trim();
|
|
2808
2818
|
if (!businessCode || !channel) return false;
|
|
2809
2819
|
return this.openDataTarget === "".concat(businessCode, "+").concat(channel) && this.runtimeOpenDataScope === this.getRuntimeOpenDataScope();
|
|
2810
2820
|
}
|
|
@@ -2854,6 +2864,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2854
2864
|
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
|
2855
2865
|
var params,
|
|
2856
2866
|
options,
|
|
2867
|
+
catalogScope,
|
|
2857
2868
|
schedule_date,
|
|
2858
2869
|
schedule_datetime,
|
|
2859
2870
|
result,
|
|
@@ -2869,9 +2880,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2869
2880
|
}
|
|
2870
2881
|
throw new Error('[UnifiedBookingSales] products 模块未初始化');
|
|
2871
2882
|
case 4:
|
|
2883
|
+
catalogScope = this.otherParams.catalogScopeKey;
|
|
2872
2884
|
schedule_date = params.schedule_date || dayjs().format('YYYY-MM-DD');
|
|
2873
2885
|
schedule_datetime = params.schedule_datetime || "".concat(schedule_date, " ").concat(dayjs().format('HH:mm:ss'));
|
|
2874
|
-
_context24.next =
|
|
2886
|
+
_context24.next = 9;
|
|
2875
2887
|
return this.store.products.loadProducts(_objectSpread(_objectSpread({
|
|
2876
2888
|
with_count: ['bundleGroup', 'optionGroup'],
|
|
2877
2889
|
with_schedule: 1
|
|
@@ -2880,14 +2892,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2880
2892
|
schedule_datetime: schedule_datetime,
|
|
2881
2893
|
cacheId: this.cacheId
|
|
2882
2894
|
}), options);
|
|
2883
|
-
case
|
|
2895
|
+
case 9:
|
|
2884
2896
|
result = _context24.sent;
|
|
2897
|
+
if (!(catalogScope !== this.otherParams.catalogScopeKey)) {
|
|
2898
|
+
_context24.next = 12;
|
|
2899
|
+
break;
|
|
2900
|
+
}
|
|
2901
|
+
throw Object.assign(new Error('Product scope changed'), {
|
|
2902
|
+
name: 'AbortError'
|
|
2903
|
+
});
|
|
2904
|
+
case 12:
|
|
2885
2905
|
this.unifiedProductCatalog = Array.isArray(result) ? _toConsumableArray(result) : [];
|
|
2886
|
-
_context24.next =
|
|
2906
|
+
_context24.next = 15;
|
|
2887
2907
|
return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), result);
|
|
2888
|
-
case
|
|
2908
|
+
case 15:
|
|
2889
2909
|
return _context24.abrupt("return", result);
|
|
2890
|
-
case
|
|
2910
|
+
case 16:
|
|
2891
2911
|
case "end":
|
|
2892
2912
|
return _context24.stop();
|
|
2893
2913
|
}
|
|
@@ -4852,7 +4872,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4852
4872
|
value: (function () {
|
|
4853
4873
|
var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(contextId) {
|
|
4854
4874
|
var _this$otherParams$pla,
|
|
4855
|
-
_this$
|
|
4875
|
+
_this$otherParams27,
|
|
4856
4876
|
_this13 = this;
|
|
4857
4877
|
var request,
|
|
4858
4878
|
_yield$this$ensureAva,
|
|
@@ -4873,7 +4893,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4873
4893
|
context = _yield$this$ensureAva.context;
|
|
4874
4894
|
projectionEntry = _yield$this$ensureAva.projectionEntry;
|
|
4875
4895
|
contextVersion = context.activeVersion;
|
|
4876
|
-
isPosAvailabilityRequest = String((_this$otherParams$pla = (_this$
|
|
4896
|
+
isPosAvailabilityRequest = String((_this$otherParams$pla = (_this$otherParams27 = this.otherParams) === null || _this$otherParams27 === void 0 ? void 0 : _this$otherParams27.platform) !== null && _this$otherParams$pla !== void 0 ? _this$otherParams$pla : '').trim().toLowerCase() === 'pos';
|
|
4877
4897
|
allowOutsideOperatingHoursForRequestedStartTimes = isPosAvailabilityRequest && Object.values(request.durationStartTimesByProductId || {}).some(function (startTimes) {
|
|
4878
4898
|
return Array.isArray(startTimes) && startTimes.length > 0;
|
|
4879
4899
|
});
|
|
@@ -4906,7 +4926,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4906
4926
|
key: "queryBookingAvailability",
|
|
4907
4927
|
value: (function () {
|
|
4908
4928
|
var _queryBookingAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(contextId, request) {
|
|
4909
|
-
var _this$otherParams$pla2, _this$
|
|
4929
|
+
var _this$otherParams$pla2, _this$otherParams28;
|
|
4910
4930
|
var _yield$this$ensureAva2, context, projectionEntry, refreshed, isPosAvailabilityRequest, result, contextVersion, contextualResult;
|
|
4911
4931
|
return _regeneratorRuntime().wrap(function _callee47$(_context47) {
|
|
4912
4932
|
while (1) switch (_context47.prev = _context47.next) {
|
|
@@ -4919,7 +4939,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4919
4939
|
projectionEntry = _yield$this$ensureAva2.projectionEntry;
|
|
4920
4940
|
refreshed = _yield$this$ensureAva2.refreshed;
|
|
4921
4941
|
this.assertContextualQueryFreshness(context, request);
|
|
4922
|
-
isPosAvailabilityRequest = String((_this$otherParams$pla2 = (_this$
|
|
4942
|
+
isPosAvailabilityRequest = String((_this$otherParams$pla2 = (_this$otherParams28 = this.otherParams) === null || _this$otherParams28 === void 0 ? void 0 : _this$otherParams28.platform) !== null && _this$otherParams$pla2 !== void 0 ? _this$otherParams$pla2 : '').trim().toLowerCase() === 'pos';
|
|
4923
4943
|
result = queryAvailabilityProjection(projectionEntry.projection, request, {
|
|
4924
4944
|
useExactDurationCandidateMinute: isPosAvailabilityRequest,
|
|
4925
4945
|
allowExcludedScheduleDateOverride: isPosAvailabilityRequest
|
|
@@ -5032,7 +5052,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5032
5052
|
key: "commitAvailabilitySelection",
|
|
5033
5053
|
value: (function () {
|
|
5034
5054
|
var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(contextId, params) {
|
|
5035
|
-
var normalizedContextId, _params$bookingCount, _ref53, _params$orderProduct$, _params$orderProduct, _params$orderProduct2, _params$orderProduct3, _params$orderProduct$2, _params$orderProduct4, _params$orderProduct5, _editingLine$product_, _baseProjection$meta$, _refreshedProjection$, _baseProjection$meta$2, _this$otherParams$pla3, _this$
|
|
5055
|
+
var normalizedContextId, _params$bookingCount, _ref53, _params$orderProduct$, _params$orderProduct, _params$orderProduct2, _params$orderProduct3, _params$orderProduct$2, _params$orderProduct4, _params$orderProduct5, _editingLine$product_, _baseProjection$meta$, _refreshedProjection$, _baseProjection$meta$2, _this$otherParams$pla3, _this$otherParams29, _ref54, _params$orderProduct$3, _params$orderProduct6, _existingBooking$meta, _ref55, _ref56, _params$orderProduct$4, _params$orderProduct7, _params$orderProduct8, _existingBooking$meta2, _existingBooking$hold, bookingCount, orderProductQuantity, partySize, _yield$this$ensureAva3, context, projectionEntry, refreshed, boundEditingUids, orderProductId, editingLine, _editingLine$product_2, baseProjection, commitWriteGuard, prepareParams, fallbackResources, commitSnapshot, refreshedProjection, _baseProjection$meta$3, latestContext, candidateDurationMinutes, candidateStartTime, allowPosAvailabilityOverride, refreshedRanges, refreshedCandidateBase, product, validation, forced, capacityConflict, revalidationEntry, revalidatedContext, refreshedCandidate, existingBooking, existingBookingUid, booking, transformed, productLineUid, bookingUid, productLineUids, bookingUids, _transformed$product_, _transformed$product_2, _transformed$product_3, _ref57, _transformed$product_4, _this$getTempOrder4, _this$getTempOrder5, _params$salesNotes, _this$getTempOrder6, beforeProductLineUids, beforeBookingUids, products, addedLines, addedBookings, nextContext, result;
|
|
5036
5056
|
return _regeneratorRuntime().wrap(function _callee48$(_context48) {
|
|
5037
5057
|
while (1) switch (_context48.prev = _context48.next) {
|
|
5038
5058
|
case 0:
|
|
@@ -5262,7 +5282,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5262
5282
|
this.assertAvailabilityCommitWriteCAS(commitWriteGuard);
|
|
5263
5283
|
candidateDurationMinutes = getCandidateDurationMinutes(params.candidate);
|
|
5264
5284
|
candidateStartTime = getCandidateStartTime(params.candidate);
|
|
5265
|
-
allowPosAvailabilityOverride = String((_this$otherParams$pla3 = (_this$
|
|
5285
|
+
allowPosAvailabilityOverride = String((_this$otherParams$pla3 = (_this$otherParams29 = this.otherParams) === null || _this$otherParams29 === void 0 ? void 0 : _this$otherParams29.platform) !== null && _this$otherParams$pla3 !== void 0 ? _this$otherParams$pla3 : '').trim().toLowerCase() === 'pos';
|
|
5266
5286
|
refreshedRanges = getProjectionProductTimeRanges(refreshedProjection, _objectSpread({
|
|
5267
5287
|
productIds: [params.candidate.productId],
|
|
5268
5288
|
dateRange: {
|
package/lib/index.d.ts
CHANGED
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
|
+
}
|