@pisell/pisellos 2.3.105 → 2.3.107
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/modules/Discount/index.js +4 -1
- package/dist/modules/Discount/types.d.ts +10 -0
- package/dist/modules/OpenData/index.d.ts +15 -2
- package/dist/modules/OpenData/index.js +307 -19
- package/dist/modules/OpenData/types.d.ts +55 -0
- package/dist/modules/OpenData/types.js +7 -1
- package/dist/modules/OpenData/utils.d.ts +21 -1
- package/dist/modules/OpenData/utils.js +138 -0
- package/dist/modules/Order/index.d.ts +3 -1
- package/dist/modules/Order/index.js +89 -16
- package/dist/modules/Order/types.d.ts +13 -0
- package/dist/modules/Order/utils.d.ts +4 -1
- package/dist/modules/Order/utils.js +57 -3
- package/dist/modules/ResourcePlanner/planner.d.ts +2 -2
- package/dist/modules/ResourcePlanner/planner.js +172 -49
- package/dist/modules/ResourcePlanner/types.d.ts +19 -0
- package/dist/modules/Rules/index.js +1 -1
- package/dist/plugins/request.d.ts +2 -1
- package/dist/plugins/request.js +4 -2
- package/dist/server/index.d.ts +15 -0
- package/dist/server/index.js +1734 -1285
- package/dist/server/modules/order/types.d.ts +50 -0
- package/dist/server/modules/order/types.js +2 -0
- package/dist/server/utils/small-ticket.d.ts +4 -1
- package/dist/server/utils/small-ticket.js +461 -96
- package/dist/solution/BaseSales/index.d.ts +5 -1
- package/dist/solution/BaseSales/index.js +120 -45
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +2 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.js +1 -1
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +8 -3
- package/dist/solution/BookingTicket/index.js +558 -443
- package/dist/solution/Sales/index.d.ts +16 -1
- package/dist/solution/Sales/index.js +338 -63
- package/dist/solution/Sales/types.d.ts +10 -0
- package/dist/solution/UnifiedBookingSales/index.d.ts +5 -4
- package/dist/solution/UnifiedBookingSales/index.js +614 -462
- package/dist/solution/UnifiedBookingSales/types.d.ts +7 -1
- package/lib/model/strategy/adapter/promotion/index.js +1 -46
- package/lib/modules/Discount/index.js +4 -1
- package/lib/modules/Discount/types.d.ts +10 -0
- package/lib/modules/OpenData/index.d.ts +15 -2
- package/lib/modules/OpenData/index.js +230 -3
- package/lib/modules/OpenData/types.d.ts +55 -0
- package/lib/modules/OpenData/types.js +9 -1
- package/lib/modules/OpenData/utils.d.ts +21 -1
- package/lib/modules/OpenData/utils.js +126 -0
- package/lib/modules/Order/index.d.ts +3 -1
- package/lib/modules/Order/index.js +69 -1
- package/lib/modules/Order/types.d.ts +13 -0
- package/lib/modules/Order/utils.d.ts +4 -1
- package/lib/modules/Order/utils.js +58 -1
- package/lib/modules/ResourcePlanner/planner.d.ts +2 -2
- package/lib/modules/ResourcePlanner/planner.js +141 -35
- package/lib/modules/ResourcePlanner/types.d.ts +19 -0
- package/lib/modules/Rules/index.js +1 -1
- package/lib/plugins/request.d.ts +2 -1
- package/lib/plugins/request.js +3 -2
- package/lib/server/index.d.ts +15 -0
- package/lib/server/index.js +455 -105
- package/lib/server/modules/order/types.d.ts +50 -0
- package/lib/server/modules/order/types.js +1 -0
- package/lib/server/utils/small-ticket.d.ts +4 -1
- package/lib/server/utils/small-ticket.js +427 -72
- package/lib/solution/BaseSales/index.d.ts +5 -1
- package/lib/solution/BaseSales/index.js +84 -7
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +2 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +1 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +8 -3
- package/lib/solution/BookingTicket/index.js +60 -15
- package/lib/solution/Sales/index.d.ts +16 -1
- package/lib/solution/Sales/index.js +168 -1
- package/lib/solution/Sales/types.d.ts +10 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +5 -4
- package/lib/solution/UnifiedBookingSales/index.js +128 -35
- package/lib/solution/UnifiedBookingSales/types.d.ts +7 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Module, ModuleOptions, PisellCore } from '../../types';
|
|
2
2
|
import type { ProductData } from '../../modules';
|
|
3
|
-
import type
|
|
3
|
+
import { type InvoiceLayoutConfig, type InvoiceTemplateSettings, type OpenDataConfig } from '../../modules/OpenData';
|
|
4
4
|
import type { LoadScheduleAvailableDateParams, ScheduleItem } from '../../modules/Schedule/types';
|
|
5
5
|
import type { ProductListLoadProductsParams, ProductListStoreQueryParams } from '../../modules/ProductList';
|
|
6
6
|
import type { AvailabilityDateRange, AvailabilityOccupancy, AvailabilityProduct, AvailabilityResource, GetProductTimeRangesRequest } from '../../modules/ResourcePlanner';
|
|
@@ -60,9 +60,6 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
60
60
|
protected defaultVersion: string;
|
|
61
61
|
protected store: UnifiedBookingSalesState;
|
|
62
62
|
private unifiedProductCatalog;
|
|
63
|
-
private openDataTarget;
|
|
64
|
-
private loadOpenDataInFlight;
|
|
65
|
-
private loadOpenDataInFlightTarget;
|
|
66
63
|
private availabilityRuntimeOffsetMinutes;
|
|
67
64
|
private availabilityScheduleCatalog;
|
|
68
65
|
private availabilityProjectionSequence;
|
|
@@ -159,6 +156,10 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
159
156
|
* 只返回优先级最高 Action 中当前商品 Target 的 dataSource,不跨商品或 Action 合并。
|
|
160
157
|
*/
|
|
161
158
|
resolveProductAllergyRequirement(params: UnifiedBookingSalesResolveProductAllergyRequirementParams): Promise<AllergyRequirement | null>;
|
|
159
|
+
clearOpenDataCache(): void;
|
|
160
|
+
getInvoiceLayoutConfig(): Promise<InvoiceLayoutConfig>;
|
|
161
|
+
getInvoiceTemplateSettings(): Promise<InvoiceTemplateSettings>;
|
|
162
|
+
protected isInvoiceOpenDataCacheCurrent(): boolean;
|
|
162
163
|
/**
|
|
163
164
|
* Load a resource policy without depending on the legacy appointmentBooking solution.
|
|
164
165
|
*/
|
|
@@ -33,6 +33,7 @@ var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
|
33
33
|
var _lodashEs = require("lodash-es");
|
|
34
34
|
var _modules = require("../../modules");
|
|
35
35
|
var _utils = require("../../modules/BookingContext/utils");
|
|
36
|
+
var _OpenData = require("../../modules/OpenData");
|
|
36
37
|
var _getDateIsInSchedule = require("../../modules/Schedule/getDateIsInSchedule");
|
|
37
38
|
var _ResourcePlanner = require("../../modules/ResourcePlanner");
|
|
38
39
|
var _types = require("./types");
|
|
@@ -53,7 +54,7 @@ var _localClock = require("../../modules/ResourcePlanner/localClock");
|
|
|
53
54
|
var _platform = require("../../utils/platform");
|
|
54
55
|
var _itemRule = require("../../model/strategy/adapter/itemRule");
|
|
55
56
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
56
|
-
const OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow', 'basic', 'checkout', 'availability'];
|
|
57
|
+
const OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow', 'documents', 'basic', 'checkout', 'availability'];
|
|
57
58
|
const OPEN_DATA_CACHE_TTL = 5 * 60 * 1000;
|
|
58
59
|
function normalizePositiveInteger(value) {
|
|
59
60
|
const normalized = Number(value);
|
|
@@ -655,6 +656,22 @@ function normalizeResource(raw, fixedOffsetMinutes = (0, _localClock.captureRunt
|
|
|
655
656
|
const id = raw.resourceId ?? raw.resource_id ?? raw.id;
|
|
656
657
|
if (id === undefined || id === null || id === '') return null;
|
|
657
658
|
const rawWindows = raw.windows || raw.times || [];
|
|
659
|
+
const rawExcludedWindows = raw.excludedWindows || raw.excluded_windows || [];
|
|
660
|
+
const normalizeWindows = windows => (Array.isArray(windows) ? windows : []).flatMap(window => {
|
|
661
|
+
const range = normalizeAvailabilityLocalDateTimeRange({
|
|
662
|
+
startAt: window.startAt || window.start_at || window.start,
|
|
663
|
+
endAt: window.endAt || window.end_at || window.end,
|
|
664
|
+
fixedOffsetMinutes,
|
|
665
|
+
rollOverEnd: true
|
|
666
|
+
});
|
|
667
|
+
if (!range) return [];
|
|
668
|
+
return [{
|
|
669
|
+
startAt: range.startAt,
|
|
670
|
+
endAt: range.endAt,
|
|
671
|
+
source: window.source,
|
|
672
|
+
raw: window
|
|
673
|
+
}];
|
|
674
|
+
});
|
|
658
675
|
return {
|
|
659
676
|
id,
|
|
660
677
|
formId: raw.formId ?? raw.form_id ?? raw.resource_form_id,
|
|
@@ -662,21 +679,8 @@ function normalizeResource(raw, fixedOffsetMinutes = (0, _localClock.captureRunt
|
|
|
662
679
|
code: raw.code,
|
|
663
680
|
resourceType: normalizeResourceType(raw.type || raw.resourceType),
|
|
664
681
|
capacity: Math.max(1, Number(raw.capacity || raw.max_capacity || 1) || 1),
|
|
665
|
-
windows: (
|
|
666
|
-
|
|
667
|
-
startAt: window.startAt || window.start_at || window.start,
|
|
668
|
-
endAt: window.endAt || window.end_at || window.end,
|
|
669
|
-
fixedOffsetMinutes,
|
|
670
|
-
rollOverEnd: true
|
|
671
|
-
});
|
|
672
|
-
if (!range) return [];
|
|
673
|
-
return [{
|
|
674
|
-
startAt: range.startAt,
|
|
675
|
-
endAt: range.endAt,
|
|
676
|
-
source: window.source,
|
|
677
|
-
raw: window
|
|
678
|
-
}];
|
|
679
|
-
}),
|
|
682
|
+
windows: normalizeWindows(rawWindows),
|
|
683
|
+
excludedWindows: normalizeWindows(rawExcludedWindows),
|
|
680
684
|
raw
|
|
681
685
|
};
|
|
682
686
|
}
|
|
@@ -695,6 +699,17 @@ function dateRangeDays(dateRange) {
|
|
|
695
699
|
}
|
|
696
700
|
return dates;
|
|
697
701
|
}
|
|
702
|
+
function getExcludedScheduleDateOverrideTimePoints(date, schedule) {
|
|
703
|
+
if (!schedule.repeat_rule?.excluded_date?.length) return [];
|
|
704
|
+
if ((0, _getDateIsInSchedule.getScheduleStartEndTimePoints)(date, [schedule]).length > 0) return [];
|
|
705
|
+
return (0, _getDateIsInSchedule.getScheduleStartEndTimePoints)(date, [{
|
|
706
|
+
...schedule,
|
|
707
|
+
repeat_rule: {
|
|
708
|
+
...schedule.repeat_rule,
|
|
709
|
+
excluded_date: []
|
|
710
|
+
}
|
|
711
|
+
}]);
|
|
712
|
+
}
|
|
698
713
|
function normalizeResourceOccupancy(rawEvent, resourceId, source = 'remote', fixedOffsetMinutes = (0, _localClock.captureRuntimeOffsetMinutes)()) {
|
|
699
714
|
const range = normalizeAvailabilityLocalDateTimeRange({
|
|
700
715
|
startAt: rawEvent.start_at ?? rawEvent.startAt ?? rawEvent.start_time ?? rawEvent.startTime,
|
|
@@ -787,7 +802,26 @@ function buildAvailabilityResourcesFromV2(params) {
|
|
|
787
802
|
}
|
|
788
803
|
}];
|
|
789
804
|
})));
|
|
805
|
+
const excludedWindows = dates.flatMap(date => schedules.flatMap(schedule => getExcludedScheduleDateOverrideTimePoints(date, schedule).flatMap(slot => {
|
|
806
|
+
const range = normalizeAvailabilityLocalDateTimeRange({
|
|
807
|
+
startAt: slot.start_at,
|
|
808
|
+
endAt: slot.end_at,
|
|
809
|
+
fixedOffsetMinutes,
|
|
810
|
+
rollOverEnd: true
|
|
811
|
+
});
|
|
812
|
+
if (!range) return [];
|
|
813
|
+
return [{
|
|
814
|
+
startAt: range.startAt,
|
|
815
|
+
endAt: range.endAt,
|
|
816
|
+
source: `resource_schedule_excluded:${schedule.id}`,
|
|
817
|
+
raw: {
|
|
818
|
+
scheduleId: schedule.id,
|
|
819
|
+
excludedDate: date
|
|
820
|
+
}
|
|
821
|
+
}];
|
|
822
|
+
})));
|
|
790
823
|
resource.windows = materializedWindows.length > 0 ? materializedWindows : explicitWindows;
|
|
824
|
+
resource.excludedWindows = [...(resource.excludedWindows || []), ...excludedWindows];
|
|
791
825
|
if (resource.windows.length === 0 && missingScheduleIds.length > 0) {
|
|
792
826
|
resource.windows = buildResourceWindowFallbackTimes({
|
|
793
827
|
raw,
|
|
@@ -1028,7 +1062,7 @@ function buildBookingFromAvailabilitySelection(params) {
|
|
|
1028
1062
|
}
|
|
1029
1063
|
};
|
|
1030
1064
|
}
|
|
1031
|
-
const POS_OVERRIDABLE_AVAILABILITY_CONFLICT_CODES = new Set(['past', 'booking_cutoff', 'resource_full', 'resource_unavailable', 'resource_capacity_exceeded',
|
|
1065
|
+
const POS_OVERRIDABLE_AVAILABILITY_CONFLICT_CODES = new Set(['past', 'booking_cutoff', 'schedule_excluded_date', 'resource_full', 'resource_unavailable', 'resource_capacity_exceeded',
|
|
1032
1066
|
// A required group whose selected resource is outside its window is surfaced
|
|
1033
1067
|
// as missing_resource at group level. Structural validation below still
|
|
1034
1068
|
// rejects a genuinely missing selection.
|
|
@@ -1166,9 +1200,6 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
1166
1200
|
defaultVersion = '1.0.0';
|
|
1167
1201
|
store = {};
|
|
1168
1202
|
unifiedProductCatalog = [];
|
|
1169
|
-
openDataTarget = null;
|
|
1170
|
-
loadOpenDataInFlight = null;
|
|
1171
|
-
loadOpenDataInFlightTarget = null;
|
|
1172
1203
|
availabilityRuntimeOffsetMinutes = null;
|
|
1173
1204
|
availabilityScheduleCatalog = null;
|
|
1174
1205
|
availabilityProjectionSequence = 0;
|
|
@@ -1672,6 +1703,9 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
1672
1703
|
const cachedData = this.store.openData.getOpenData();
|
|
1673
1704
|
const lastFetchedAt = this.store.openData.getLastFetchedAt();
|
|
1674
1705
|
if (!params.force && this.openDataTarget === target && cachedData && lastFetchedAt && Date.now() - lastFetchedAt < OPEN_DATA_CACHE_TTL) {
|
|
1706
|
+
if (typeof this.store.openData.ensureInvoiceTemplateSettings === 'function') {
|
|
1707
|
+
await this.store.openData.ensureInvoiceTemplateSettings(target);
|
|
1708
|
+
}
|
|
1675
1709
|
return cachedData;
|
|
1676
1710
|
}
|
|
1677
1711
|
if (this.loadOpenDataInFlight) {
|
|
@@ -1682,30 +1716,32 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
1682
1716
|
return this.loadOpenData(params);
|
|
1683
1717
|
}
|
|
1684
1718
|
this.loadOpenDataInFlightTarget = target;
|
|
1685
|
-
|
|
1719
|
+
const request = this.store.openData.fetchOpenData({
|
|
1686
1720
|
scope: 'board',
|
|
1687
1721
|
target,
|
|
1688
1722
|
section_code: [...OPEN_DATA_SECTION_CODES]
|
|
1689
1723
|
});
|
|
1724
|
+
this.loadOpenDataInFlight = request;
|
|
1690
1725
|
try {
|
|
1691
|
-
const openData = await
|
|
1692
|
-
this.
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1726
|
+
const openData = await request;
|
|
1727
|
+
if (this.loadOpenDataInFlight === request) {
|
|
1728
|
+
this.openDataTarget = target;
|
|
1729
|
+
this.otherParams.openData = openData;
|
|
1730
|
+
this.otherParams.businessCode = businessCode;
|
|
1731
|
+
this.otherParams.channel = channel;
|
|
1732
|
+
}
|
|
1696
1733
|
return openData;
|
|
1697
1734
|
} finally {
|
|
1698
|
-
this.loadOpenDataInFlight
|
|
1699
|
-
|
|
1735
|
+
if (this.loadOpenDataInFlight === request) {
|
|
1736
|
+
this.loadOpenDataInFlight = null;
|
|
1737
|
+
this.loadOpenDataInFlightTarget = null;
|
|
1738
|
+
}
|
|
1700
1739
|
}
|
|
1701
1740
|
}
|
|
1702
1741
|
async getOpenData() {
|
|
1703
1742
|
const businessCode = String(this.otherParams?.businessCode || '').trim();
|
|
1704
1743
|
const channel = String(this.otherParams?.channel || '').trim();
|
|
1705
1744
|
if (!businessCode || !channel) return null;
|
|
1706
|
-
const target = `${businessCode}+${channel}`;
|
|
1707
|
-
const cachedData = this.store.openData?.getOpenData() || null;
|
|
1708
|
-
if (cachedData && this.openDataTarget === target) return cachedData;
|
|
1709
1745
|
return this.loadOpenData({
|
|
1710
1746
|
businessCode,
|
|
1711
1747
|
channel
|
|
@@ -1803,6 +1839,32 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
1803
1839
|
custom: runtimeConfig.custom
|
|
1804
1840
|
});
|
|
1805
1841
|
}
|
|
1842
|
+
clearOpenDataCache() {
|
|
1843
|
+
this.openDataTarget = null;
|
|
1844
|
+
this.loadOpenDataInFlight = null;
|
|
1845
|
+
this.loadOpenDataInFlightTarget = null;
|
|
1846
|
+
super.clearOpenDataCache();
|
|
1847
|
+
}
|
|
1848
|
+
async getInvoiceLayoutConfig() {
|
|
1849
|
+
const openData = await this.getOpenData();
|
|
1850
|
+
if (!openData || !this.store.openData) {
|
|
1851
|
+
return (0, _OpenData.getDefaultInvoiceLayoutConfig)();
|
|
1852
|
+
}
|
|
1853
|
+
return this.store.openData.getInvoiceLayoutConfig();
|
|
1854
|
+
}
|
|
1855
|
+
async getInvoiceTemplateSettings() {
|
|
1856
|
+
const openData = await this.getOpenData();
|
|
1857
|
+
if (!openData || !this.store.openData) {
|
|
1858
|
+
return (0, _OpenData.getDefaultInvoiceTemplateSettings)();
|
|
1859
|
+
}
|
|
1860
|
+
return this.store.openData.getInvoiceTemplateSettings();
|
|
1861
|
+
}
|
|
1862
|
+
isInvoiceOpenDataCacheCurrent() {
|
|
1863
|
+
const businessCode = String(this.otherParams?.businessCode || '').trim();
|
|
1864
|
+
const channel = String(this.otherParams?.channel || '').trim();
|
|
1865
|
+
if (!businessCode || !channel) return false;
|
|
1866
|
+
return this.openDataTarget === `${businessCode}+${channel}`;
|
|
1867
|
+
}
|
|
1806
1868
|
|
|
1807
1869
|
/**
|
|
1808
1870
|
* Load a resource policy without depending on the legacy appointmentBooking solution.
|
|
@@ -2240,11 +2302,31 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
2240
2302
|
source: `operating_schedule:${descriptor.scheduleIds.map(String).join(',')}`
|
|
2241
2303
|
}] : [];
|
|
2242
2304
|
}));
|
|
2305
|
+
const excludedWindows = dateRangeDays(params.dateRange).flatMap(date => schedules.flatMap(schedule => getExcludedScheduleDateOverrideTimePoints(date, schedule).flatMap(slot => {
|
|
2306
|
+
const range = normalizeAvailabilityLocalDateTimeRange({
|
|
2307
|
+
startAt: slot.start_at,
|
|
2308
|
+
endAt: slot.end_at,
|
|
2309
|
+
fixedOffsetMinutes: this.getAvailabilityRuntimeOffsetMinutes(),
|
|
2310
|
+
rollOverEnd: true
|
|
2311
|
+
});
|
|
2312
|
+
return range ? [{
|
|
2313
|
+
startAt: range.startAt,
|
|
2314
|
+
endAt: range.endAt,
|
|
2315
|
+
source: `operating_schedule_excluded:${schedule.id}`,
|
|
2316
|
+
raw: {
|
|
2317
|
+
scheduleId: schedule.id,
|
|
2318
|
+
excludedDate: date
|
|
2319
|
+
}
|
|
2320
|
+
}] : [];
|
|
2321
|
+
})));
|
|
2243
2322
|
return {
|
|
2244
2323
|
source: descriptor.source,
|
|
2245
2324
|
scheduleIds: [...descriptor.scheduleIds],
|
|
2246
2325
|
missingScheduleIds,
|
|
2247
|
-
windows
|
|
2326
|
+
windows,
|
|
2327
|
+
...(excludedWindows.length > 0 ? {
|
|
2328
|
+
excludedWindows
|
|
2329
|
+
} : {})
|
|
2248
2330
|
};
|
|
2249
2331
|
}
|
|
2250
2332
|
async loadAvailabilityProducts(params) {
|
|
@@ -2942,7 +3024,9 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
2942
3024
|
} : {})
|
|
2943
3025
|
}, {
|
|
2944
3026
|
evaluatedAt: this.getAvailabilityRuntimeDateTime(),
|
|
2945
|
-
|
|
3027
|
+
useExactDurationCandidateMinute: isPosAvailabilityRequest,
|
|
3028
|
+
allowSessionCustomRanges: isPosAvailabilityRequest,
|
|
3029
|
+
allowExcludedScheduleDateOverride: isPosAvailabilityRequest
|
|
2946
3030
|
}).map(group => ({
|
|
2947
3031
|
...group,
|
|
2948
3032
|
ranges: group.ranges.map(candidate => this.decorateAvailabilityCandidate(context.contextId, contextVersion, candidate))
|
|
@@ -2957,7 +3041,11 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
2957
3041
|
refreshed
|
|
2958
3042
|
} = await this.ensureAvailabilityContextProjection(contextId, 'query_booking_availability');
|
|
2959
3043
|
this.assertContextualQueryFreshness(context, request);
|
|
2960
|
-
const
|
|
3044
|
+
const isPosAvailabilityRequest = String(this.otherParams?.platform ?? '').trim().toLowerCase() === 'pos';
|
|
3045
|
+
const result = (0, _ResourcePlanner.queryAvailabilityProjection)(projectionEntry.projection, request, {
|
|
3046
|
+
useExactDurationCandidateMinute: isPosAvailabilityRequest,
|
|
3047
|
+
allowExcludedScheduleDateOverride: isPosAvailabilityRequest
|
|
3048
|
+
});
|
|
2961
3049
|
const contextVersion = context.activeVersion;
|
|
2962
3050
|
const contextualResult = result.target === 'time' ? {
|
|
2963
3051
|
...result,
|
|
@@ -3214,7 +3302,9 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
3214
3302
|
} : {})
|
|
3215
3303
|
} : {})
|
|
3216
3304
|
}, {
|
|
3217
|
-
|
|
3305
|
+
useExactDurationCandidateMinute: allowPosAvailabilityOverride,
|
|
3306
|
+
allowSessionCustomRanges: allowPosAvailabilityOverride,
|
|
3307
|
+
allowExcludedScheduleDateOverride: allowPosAvailabilityOverride
|
|
3218
3308
|
}).flatMap(group => group.ranges);
|
|
3219
3309
|
const refreshedCandidateBase = refreshedRanges.find(candidate => candidate.startAt === params.candidate.startAt && candidate.endAt === params.candidate.endAt && candidate.bookingStartAt === params.candidate.bookingStartAt && candidate.bookingEndAt === params.candidate.bookingEndAt);
|
|
3220
3310
|
if (!refreshedCandidateBase) {
|
|
@@ -3235,6 +3325,9 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
3235
3325
|
requirementSelections: params.requirementSelections,
|
|
3236
3326
|
partySize,
|
|
3237
3327
|
bookingCount
|
|
3328
|
+
}, {
|
|
3329
|
+
useExactDurationCandidateMinute: allowPosAvailabilityOverride,
|
|
3330
|
+
allowExcludedScheduleDateOverride: allowPosAvailabilityOverride
|
|
3238
3331
|
});
|
|
3239
3332
|
if (allowPosAvailabilityOverride && !validation.ok && validation.conflicts.every(conflict => POS_OVERRIDABLE_AVAILABILITY_CONFLICT_CODES.has(conflict.code))) {
|
|
3240
3333
|
const forced = buildPosForcedAvailabilityAssignments({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { OpenDataConfig } from '../../modules/OpenData';
|
|
1
|
+
import type { InvoiceLayoutConfig, InvoiceTemplateSettings, OpenDataConfig } from '../../modules/OpenData';
|
|
2
2
|
import type { ProductListLoadProductsParams, ProductListStoreQueryParams } from '../../modules/ProductList';
|
|
3
3
|
import type { ProductData } from '../../modules/Product/types';
|
|
4
4
|
import type { LoadScheduleAvailableDateParams } from '../../modules/Schedule/types';
|
|
@@ -217,7 +217,13 @@ export interface UnifiedBookingSalesDiscountResult {
|
|
|
217
217
|
}
|
|
218
218
|
export interface UnifiedBookingSalesApi {
|
|
219
219
|
loadOpenData: (params: UnifiedBookingSalesLoadOpenDataParams) => Promise<OpenDataConfig>;
|
|
220
|
+
/** Returns the latest OpenData payload cached by this solution instance. */
|
|
220
221
|
getOpenData: () => Promise<OpenDataConfig | null>;
|
|
222
|
+
/** Returns the normalized Documents Invoice layout for the active target. */
|
|
223
|
+
getInvoiceLayoutConfig: () => Promise<InvoiceLayoutConfig>;
|
|
224
|
+
/** Returns the Native Invoice template settings for the active target. */
|
|
225
|
+
getInvoiceTemplateSettings: () => Promise<InvoiceTemplateSettings>;
|
|
226
|
+
/** Date-first calendar availability backed by ScheduleModule. */
|
|
221
227
|
loadScheduleAvailableDate: (params: LoadScheduleAvailableDateParams) => Promise<unknown>;
|
|
222
228
|
loadProductsByScheduleDate: (params: UnifiedBookingSalesLoadProductsByScheduleDateParams) => Promise<unknown[]>;
|
|
223
229
|
queryProducts: (params?: ProductListStoreQueryParams) => Promise<ProductData[]>;
|