@final-commerce/common 2.12.0-staging.6 → 2.12.0
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/README.md +20 -0
- package/bin/gate-done.mjs +71 -36
- package/bin/lib/budget.mjs +71 -0
- package/dist/index.d.mts +97 -251
- package/dist/index.d.ts +97 -251
- package/dist/index.js +346 -1034
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +331 -1000
- package/dist/index.mjs.map +1 -1
- package/dist/pos-types/index.d.mts +35 -58
- package/dist/pos-types/index.d.ts +35 -58
- package/dist/pos-types/index.js +2 -7
- package/dist/pos-types/index.js.map +1 -1
- package/dist/pos-types/index.mjs +1 -5
- package/dist/pos-types/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -424,29 +424,11 @@ declare enum BookingType {
|
|
|
424
424
|
}
|
|
425
425
|
declare enum BookingRatePeriod {
|
|
426
426
|
SLOT = "slot",
|
|
427
|
-
HOUR = "hour",
|
|
428
|
-
SESSION = "session",
|
|
429
427
|
DAY = "day",
|
|
430
428
|
NIGHT = "night",
|
|
431
429
|
WEEK = "week",
|
|
432
430
|
MONTH = "month"
|
|
433
431
|
}
|
|
434
|
-
declare enum BookingDurationUnit {
|
|
435
|
-
MINUTE = "minute",
|
|
436
|
-
HOUR = "hour",
|
|
437
|
-
DAY = "day",
|
|
438
|
-
NIGHT = "night",
|
|
439
|
-
WEEK = "week",
|
|
440
|
-
MONTH = "month"
|
|
441
|
-
}
|
|
442
|
-
declare enum BookingSessionSale {
|
|
443
|
-
SESSION = "session",
|
|
444
|
-
COURSE = "course"
|
|
445
|
-
}
|
|
446
|
-
declare enum BookingArriveLeave {
|
|
447
|
-
SET_TIMES = "set-times",
|
|
448
|
-
OPENING_HOURS = "opening-hours"
|
|
449
|
-
}
|
|
450
432
|
declare enum BookingResourceKind {
|
|
451
433
|
ASSET = "asset",
|
|
452
434
|
ROOM = "room",
|
|
@@ -1105,6 +1087,78 @@ interface LineStockMove {
|
|
|
1105
1087
|
}
|
|
1106
1088
|
declare function lineStockMoves(item: StockLine, quantity: number, reservations?: readonly StockReservationLink[]): LineStockMove[];
|
|
1107
1089
|
|
|
1090
|
+
interface ShellTipOption {
|
|
1091
|
+
label: string;
|
|
1092
|
+
value: number;
|
|
1093
|
+
}
|
|
1094
|
+
interface ShellTipSettings {
|
|
1095
|
+
enabled?: boolean;
|
|
1096
|
+
tip1?: ShellTipOption;
|
|
1097
|
+
tip2?: ShellTipOption;
|
|
1098
|
+
tip3?: ShellTipOption;
|
|
1099
|
+
customTipLabel?: string;
|
|
1100
|
+
noTipLabel?: string;
|
|
1101
|
+
}
|
|
1102
|
+
interface ShellSettings {
|
|
1103
|
+
pinSwitchUser?: boolean;
|
|
1104
|
+
pinSession?: boolean;
|
|
1105
|
+
stationLock?: number;
|
|
1106
|
+
buildTimeout?: number;
|
|
1107
|
+
lockedAccess?: boolean;
|
|
1108
|
+
cashManagement?: boolean;
|
|
1109
|
+
tips?: ShellTipSettings;
|
|
1110
|
+
}
|
|
1111
|
+
type ShellTipsLevel = Pick<ShellSettings, 'tips'>;
|
|
1112
|
+
|
|
1113
|
+
type ShellSettingsSource = 'station' | 'outlet' | 'flow' | 'company' | 'default';
|
|
1114
|
+
interface ShellSettingsLevels {
|
|
1115
|
+
station?: ShellSettings | null;
|
|
1116
|
+
outlet?: ShellTipsLevel | null;
|
|
1117
|
+
flow?: ShellTipsLevel | null;
|
|
1118
|
+
company?: ShellTipsLevel | null;
|
|
1119
|
+
}
|
|
1120
|
+
type ResolvedShellTipSettings = Required<ShellTipSettings>;
|
|
1121
|
+
interface ResolvedShellSettings {
|
|
1122
|
+
pinSwitchUser: boolean;
|
|
1123
|
+
pinSession: boolean;
|
|
1124
|
+
stationLock: number;
|
|
1125
|
+
buildTimeout: number;
|
|
1126
|
+
lockedAccess: boolean;
|
|
1127
|
+
cashManagement: boolean;
|
|
1128
|
+
tips: ResolvedShellTipSettings;
|
|
1129
|
+
}
|
|
1130
|
+
type TopField = Exclude<keyof ShellSettings, 'tips'>;
|
|
1131
|
+
type TipField = keyof ShellTipSettings;
|
|
1132
|
+
type ShellStationField = TopField;
|
|
1133
|
+
type ShellTipField = TipField;
|
|
1134
|
+
interface ShellSettingsSources {
|
|
1135
|
+
fields: Record<TopField, ShellSettingsSource>;
|
|
1136
|
+
tips: Record<TipField, ShellSettingsSource>;
|
|
1137
|
+
}
|
|
1138
|
+
declare const DEFAULT_SHELL_SETTINGS: ResolvedShellSettings;
|
|
1139
|
+
declare function resolveShellSettingsWithSources(levels: ShellSettingsLevels): {
|
|
1140
|
+
settings: ResolvedShellSettings;
|
|
1141
|
+
sources: ShellSettingsSources;
|
|
1142
|
+
};
|
|
1143
|
+
declare function resolveShellSettings(levels: ShellSettingsLevels): ResolvedShellSettings;
|
|
1144
|
+
declare const SHELL_TIP_PERCENT_MIN = 1;
|
|
1145
|
+
declare const SHELL_TIP_PERCENT_MAX = 100;
|
|
1146
|
+
declare const SHELL_TIP_LABEL_MAX_LENGTH = 20;
|
|
1147
|
+
type ShellSettingsProblemCode = 'boolean' | 'timeout' | 'percent' | 'label' | 'preset';
|
|
1148
|
+
interface ShellSettingsProblem {
|
|
1149
|
+
field: string;
|
|
1150
|
+
code: ShellSettingsProblemCode;
|
|
1151
|
+
}
|
|
1152
|
+
declare const isShellTipPercent: (raw: unknown) => boolean;
|
|
1153
|
+
declare function shellTipSettingsProblems(tips: ShellTipSettings | null | undefined): ShellSettingsProblem[];
|
|
1154
|
+
declare function shellSettingsProblems(settings: ShellSettings | null | undefined): ShellSettingsProblem[];
|
|
1155
|
+
declare const SHELL_FLOW_SETTINGS_PREFIX = "flowSettingsKey";
|
|
1156
|
+
declare const SHELL_FLOW_TIPS_KEY = "flowSettingsKey.tips";
|
|
1157
|
+
declare function readShellTipSettings(raw: unknown): ShellTipSettings | undefined;
|
|
1158
|
+
declare function shellSettingsFromFlowSettings(dict: Record<string, string> | null | undefined): ShellTipsLevel;
|
|
1159
|
+
declare function flowSettingsFromShellSettings(settings: ShellTipsLevel): Record<string, string>;
|
|
1160
|
+
declare function shellSettingsFromCompanyTips(enabled: unknown, options: unknown): ShellTipsLevel;
|
|
1161
|
+
|
|
1108
1162
|
declare const SYSTEM_FAMILY_IDS: {
|
|
1109
1163
|
readonly COUNT: "count";
|
|
1110
1164
|
readonly WEIGHT: "weight-metric";
|
|
@@ -1660,52 +1714,22 @@ interface WeeklyHours {
|
|
|
1660
1714
|
openMinute: number;
|
|
1661
1715
|
closeMinute: number;
|
|
1662
1716
|
}
|
|
1663
|
-
interface BookingDuration {
|
|
1664
|
-
count: number;
|
|
1665
|
-
unit: BookingDurationUnit | `${BookingDurationUnit}`;
|
|
1666
|
-
}
|
|
1667
|
-
interface BookingTimeSlots {
|
|
1668
|
-
length: BookingDuration;
|
|
1669
|
-
weeklyHours?: WeeklyHours[];
|
|
1670
|
-
}
|
|
1671
|
-
interface BookingDateRanges {
|
|
1672
|
-
weeklyHours?: WeeklyHours[];
|
|
1673
|
-
arrivalDays?: number[];
|
|
1674
|
-
arriveLeave?: BookingArriveLeave | `${BookingArriveLeave}`;
|
|
1675
|
-
checkInTime?: string | null;
|
|
1676
|
-
checkOutTime?: string | null;
|
|
1677
|
-
checkTimesByWeekday?: {
|
|
1678
|
-
weekday: number;
|
|
1679
|
-
checkInTime: string;
|
|
1680
|
-
checkOutTime: string;
|
|
1681
|
-
}[] | null;
|
|
1682
|
-
minStay?: BookingDuration;
|
|
1683
|
-
maxStay?: BookingDuration;
|
|
1684
|
-
}
|
|
1685
1717
|
interface BookingRulesInput {
|
|
1686
1718
|
ratePeriod: BookingRatePeriod | `${BookingRatePeriod}`;
|
|
1687
1719
|
slot: {
|
|
1688
|
-
lengthMinutes
|
|
1720
|
+
lengthMinutes: number;
|
|
1689
1721
|
bufferMinutes?: number;
|
|
1690
1722
|
minimumToRun?: number;
|
|
1691
1723
|
minStay?: number;
|
|
1692
1724
|
maxStay?: number;
|
|
1693
1725
|
sharedAcrossProducts?: boolean;
|
|
1694
|
-
maxQtyPerBooking?: number;
|
|
1695
|
-
maxPartySize?: number;
|
|
1696
|
-
wholePeriods?: boolean;
|
|
1697
|
-
buffer?: BookingDuration;
|
|
1698
1726
|
};
|
|
1699
1727
|
window: {
|
|
1700
1728
|
maxAdvanceDays?: number;
|
|
1701
|
-
maxAdvanceMinutes?: number;
|
|
1702
1729
|
minNoticeMinutes?: number;
|
|
1703
1730
|
holdMinutes?: number;
|
|
1704
1731
|
bookableFrom?: Date | string | null;
|
|
1705
1732
|
bookableTo?: Date | string | null;
|
|
1706
|
-
hold?: BookingDuration;
|
|
1707
|
-
minNotice?: BookingDuration;
|
|
1708
|
-
maxAdvance?: BookingDuration;
|
|
1709
1733
|
};
|
|
1710
1734
|
availability: {
|
|
1711
1735
|
weeklyHours?: WeeklyHours[];
|
|
@@ -1716,29 +1740,8 @@ interface BookingRulesInput {
|
|
|
1716
1740
|
arrivalDays?: number[];
|
|
1717
1741
|
availableFrom?: Date | string | null;
|
|
1718
1742
|
};
|
|
1719
|
-
sessions?: {
|
|
1720
|
-
sold: BookingSessionSale | `${BookingSessionSale}`;
|
|
1721
|
-
spots?: number;
|
|
1722
|
-
weekly?: {
|
|
1723
|
-
weekday: number;
|
|
1724
|
-
startMinute: number;
|
|
1725
|
-
endMinute: number;
|
|
1726
|
-
}[];
|
|
1727
|
-
dates?: {
|
|
1728
|
-
date: string;
|
|
1729
|
-
startMinute: number;
|
|
1730
|
-
endMinute: number;
|
|
1731
|
-
}[];
|
|
1732
|
-
} | null;
|
|
1733
|
-
checkTimesByWeekday?: {
|
|
1734
|
-
weekday: number;
|
|
1735
|
-
checkInTime: string;
|
|
1736
|
-
checkOutTime: string;
|
|
1737
|
-
}[] | null;
|
|
1738
1743
|
checkInTime?: string | null;
|
|
1739
1744
|
checkOutTime?: string | null;
|
|
1740
|
-
timeSlots?: BookingTimeSlots | null;
|
|
1741
|
-
dateRanges?: BookingDateRanges | null;
|
|
1742
1745
|
}
|
|
1743
1746
|
interface BusyWindow {
|
|
1744
1747
|
startAt: Date;
|
|
@@ -1750,142 +1753,13 @@ interface GridSlot {
|
|
|
1750
1753
|
bufferEndAt: Date;
|
|
1751
1754
|
canStart: boolean;
|
|
1752
1755
|
}
|
|
1753
|
-
declare const UNLIMITED_PLACES: number;
|
|
1754
1756
|
declare class BookingRulesError extends Error {
|
|
1755
1757
|
constructor(message: string);
|
|
1756
1758
|
}
|
|
1757
1759
|
|
|
1758
1760
|
declare function windowEndsAt(rule: BookingRulesInput, now: Date): Date | null;
|
|
1759
|
-
declare function windowEndsAtInZone(rule: BookingRulesInput, now: Date, timeZone: string | null): Date | null;
|
|
1760
|
-
declare const startsPastMaxAdvance: (rule: BookingRulesInput, startAt: Date, now: Date, timeZone: string) => boolean;
|
|
1761
|
-
declare function maxAdvanceMinutesOf(rule: Pick<BookingRulesInput, 'window'>): number;
|
|
1762
|
-
interface BookingRuleDurations {
|
|
1763
|
-
buffer?: BookingDuration;
|
|
1764
|
-
hold?: BookingDuration;
|
|
1765
|
-
minNotice?: BookingDuration;
|
|
1766
|
-
maxAdvance?: BookingDuration;
|
|
1767
|
-
}
|
|
1768
|
-
declare function ruleDurationsOf(rule: Pick<BookingRulesInput, 'slot' | 'window'>): BookingRuleDurations;
|
|
1769
|
-
declare function oldMaxAdvanceOf({ maxAdvanceMinutes, maxAdvanceDays, }: BookingRulesInput['window']): BookingDuration | undefined;
|
|
1770
|
-
declare function sessionCells(rule: BookingRulesInput, timeZone: string, from: Date, to: Date): GridSlot[];
|
|
1771
|
-
declare function calendarDate(value: string): [number, number, number];
|
|
1772
1761
|
declare function buildGrid(rule: BookingRulesInput, timeZone: string, from: Date, to: Date, now: Date, busy?: BusyWindow[]): GridSlot[];
|
|
1773
|
-
|
|
1774
|
-
declare function cellChainOf(rule: Pick<BookingRulesInput, 'ratePeriod'>, timeZone: string): CellChain;
|
|
1775
|
-
declare function slotsForWindow(grid: GridSlot[], startAt: Date, endAt: Date, chain?: CellChain): GridSlot[];
|
|
1776
|
-
|
|
1777
|
-
type BookingDurationField = 'timeSlots.length' | 'slot.buffer' | 'window.hold' | 'window.minNotice' | 'window.maxAdvance' | 'dateRanges.minStay' | 'dateRanges.maxStay';
|
|
1778
|
-
type Units = readonly BookingDurationUnit[];
|
|
1779
|
-
declare function allowedDurationUnits(rule: Pick<BookingRulesInput, 'ratePeriod'>, field: BookingDurationField): Units;
|
|
1780
|
-
type BookingDurationProblemKind = 'count' | 'unit' | 'not-for-type' | 'min-above-max';
|
|
1781
|
-
interface BookingDurationProblem {
|
|
1782
|
-
field: BookingDurationField;
|
|
1783
|
-
kind: BookingDurationProblemKind;
|
|
1784
|
-
message: string;
|
|
1785
|
-
allowed?: readonly BookingDurationUnit[];
|
|
1786
|
-
min?: BookingDuration;
|
|
1787
|
-
max?: BookingDuration;
|
|
1788
|
-
}
|
|
1789
|
-
declare function durationProblems(rule: BookingRulesInput): BookingDurationProblem[];
|
|
1790
|
-
declare const shortestMinutesOf: ({ count, unit }: BookingDuration) => number;
|
|
1791
|
-
declare const longestMinutesOf: ({ count, unit }: BookingDuration) => number;
|
|
1792
|
-
declare const durationText: ({ count, unit }: BookingDuration) => string;
|
|
1793
|
-
|
|
1794
|
-
interface BookingRentalEnd {
|
|
1795
|
-
periods: number;
|
|
1796
|
-
endAt: string;
|
|
1797
|
-
lastDayKey: string;
|
|
1798
|
-
coveredSlots: {
|
|
1799
|
-
startAt: string;
|
|
1800
|
-
dayKey: string;
|
|
1801
|
-
}[];
|
|
1802
|
-
}
|
|
1803
|
-
|
|
1804
|
-
declare const DEFAULT_HOLD_MINUTES = 10;
|
|
1805
|
-
interface PlanWindowInput {
|
|
1806
|
-
rule: BookingRulesInput;
|
|
1807
|
-
timeZone: string;
|
|
1808
|
-
presence?: WeeklyHours[] | null;
|
|
1809
|
-
startAt: Date;
|
|
1810
|
-
endAt: Date;
|
|
1811
|
-
now: Date;
|
|
1812
|
-
busy?: BusyWindow[];
|
|
1813
|
-
}
|
|
1814
|
-
declare function planWindow({ rule, timeZone, presence, startAt, endAt, now, busy }: PlanWindowInput): {
|
|
1815
|
-
slots: GridSlot[];
|
|
1816
|
-
periods: number;
|
|
1817
|
-
endAt: Date;
|
|
1818
|
-
bufferEndAt: Date;
|
|
1819
|
-
};
|
|
1820
|
-
interface WindowForPeriodsInput {
|
|
1821
|
-
rule: BookingRulesInput;
|
|
1822
|
-
timeZone: string;
|
|
1823
|
-
startAt: Date;
|
|
1824
|
-
periods: number;
|
|
1825
|
-
now: Date;
|
|
1826
|
-
}
|
|
1827
|
-
declare function windowForPeriods({ rule, timeZone, startAt, periods, now }: WindowForPeriodsInput): {
|
|
1828
|
-
startAt: Date;
|
|
1829
|
-
endAt: Date;
|
|
1830
|
-
};
|
|
1831
|
-
interface RentalEndsInput {
|
|
1832
|
-
rule: BookingRulesInput;
|
|
1833
|
-
timeZone: string;
|
|
1834
|
-
startAt: Date;
|
|
1835
|
-
now: Date;
|
|
1836
|
-
untilDay: string;
|
|
1837
|
-
}
|
|
1838
|
-
declare function rentalEnds(input: RentalEndsInput): BookingRentalEnd[];
|
|
1839
|
-
interface PlanCourseInput {
|
|
1840
|
-
rule: BookingRulesInput;
|
|
1841
|
-
timeZone: string;
|
|
1842
|
-
presence?: WeeklyHours[] | null;
|
|
1843
|
-
now: Date;
|
|
1844
|
-
}
|
|
1845
|
-
declare function courseSessions(rule: BookingRulesInput, timeZone: string): GridSlot[];
|
|
1846
|
-
declare function courseSpan(rule: BookingRulesInput, timeZone: string): {
|
|
1847
|
-
from: Date;
|
|
1848
|
-
to: Date;
|
|
1849
|
-
};
|
|
1850
|
-
declare const courseStarted: (rule: BookingRulesInput, sessions: GridSlot[], now: Date) => boolean;
|
|
1851
|
-
declare function courseStartedInZone(rule: BookingRulesInput, sessions: GridSlot[], now: Date, timeZone: string): boolean;
|
|
1852
|
-
declare function planCourse({ rule, timeZone, presence, now }: PlanCourseInput): GridSlot[];
|
|
1853
|
-
declare function holdExpiresAt(rule: BookingRulesInput, now: Date): Date;
|
|
1854
|
-
declare function checkQtyPerBooking(rule: BookingRulesInput, qty: number): void;
|
|
1855
|
-
declare function checkPartySize(rule: BookingRulesInput, partySize: number): void;
|
|
1856
|
-
type BookingMethod = 'time-slots' | 'sessions' | 'date-ranges';
|
|
1857
|
-
declare function bookingMethodOf(rule: Pick<BookingRulesInput, 'ratePeriod'>): BookingMethod;
|
|
1858
|
-
declare const soldAsCourse: (rule: Pick<BookingRulesInput, "ratePeriod" | "sessions">) => boolean;
|
|
1859
|
-
declare function capacityOf(rule: Pick<BookingRulesInput, 'ratePeriod' | 'sessions'>, resource: {
|
|
1860
|
-
seats?: number | null;
|
|
1861
|
-
}): number;
|
|
1862
|
-
type BookingRuleParts = ({
|
|
1863
|
-
method: 'time-slots';
|
|
1864
|
-
} & Required<BookingTimeSlots>) | {
|
|
1865
|
-
method: 'sessions';
|
|
1866
|
-
sessions: NonNullable<BookingRulesInput['sessions']>;
|
|
1867
|
-
} | ({
|
|
1868
|
-
method: 'date-ranges';
|
|
1869
|
-
ratePeriod: BookingRulesInput['ratePeriod'];
|
|
1870
|
-
wholePeriods: boolean;
|
|
1871
|
-
} & BookingDateRanges);
|
|
1872
|
-
declare function bookingRuleParts(rule: BookingRulesInput): BookingRuleParts;
|
|
1873
|
-
interface BookingRuleNewFields {
|
|
1874
|
-
timeSlots?: Required<BookingTimeSlots>;
|
|
1875
|
-
dateRanges?: BookingDateRanges;
|
|
1876
|
-
'slot.buffer'?: BookingDuration;
|
|
1877
|
-
'window.hold': BookingDuration;
|
|
1878
|
-
'window.minNotice'?: BookingDuration;
|
|
1879
|
-
'window.maxAdvance'?: BookingDuration;
|
|
1880
|
-
}
|
|
1881
|
-
interface BookingRuleInNewShape {
|
|
1882
|
-
set: BookingRuleNewFields;
|
|
1883
|
-
unset: string[];
|
|
1884
|
-
problems: BookingDurationProblem[];
|
|
1885
|
-
notes: string[];
|
|
1886
|
-
changesBehaviour?: 'whole-periods';
|
|
1887
|
-
}
|
|
1888
|
-
declare function ruleInNewShape(rule: BookingRulesInput): BookingRuleInNewShape;
|
|
1762
|
+
declare function slotsForWindow(grid: GridSlot[], startAt: Date, endAt: Date): GridSlot[];
|
|
1889
1763
|
|
|
1890
1764
|
interface BookingOccupancy {
|
|
1891
1765
|
resourceId: string;
|
|
@@ -1893,7 +1767,6 @@ interface BookingOccupancy {
|
|
|
1893
1767
|
qty: number;
|
|
1894
1768
|
startAt: Date;
|
|
1895
1769
|
bufferEndAt: Date;
|
|
1896
|
-
outletId?: string;
|
|
1897
1770
|
}
|
|
1898
1771
|
interface BookingResourceInput {
|
|
1899
1772
|
id: string;
|
|
@@ -1908,13 +1781,11 @@ interface ResourceAvailability {
|
|
|
1908
1781
|
capacity: number;
|
|
1909
1782
|
booked: number;
|
|
1910
1783
|
free: number;
|
|
1911
|
-
unlimited?: true;
|
|
1912
1784
|
}
|
|
1913
1785
|
interface AvailabilitySlot extends GridSlot {
|
|
1914
1786
|
capacity: number;
|
|
1915
1787
|
booked: number;
|
|
1916
1788
|
free: number;
|
|
1917
|
-
unlimited?: true;
|
|
1918
1789
|
resources: ResourceAvailability[];
|
|
1919
1790
|
dayKey: string;
|
|
1920
1791
|
}
|
|
@@ -1928,81 +1799,39 @@ interface ResourceInWindow {
|
|
|
1928
1799
|
interface AvailabilityInput {
|
|
1929
1800
|
productId: string;
|
|
1930
1801
|
bookingRulesId?: string;
|
|
1802
|
+
bookingType?: BookingType;
|
|
1931
1803
|
rule: BookingRulesInput;
|
|
1932
1804
|
resources: BookingResourceInput[];
|
|
1933
1805
|
occupied: BookingOccupancy[];
|
|
1934
|
-
outletId?: string;
|
|
1935
1806
|
from: Date;
|
|
1936
1807
|
to: Date;
|
|
1937
1808
|
now: Date;
|
|
1938
|
-
timeZone?: string;
|
|
1939
1809
|
}
|
|
1940
1810
|
declare const withinPresence: (slot: GridSlot, timeZone: string, presence?: WeeklyHours[] | null) => boolean;
|
|
1941
1811
|
declare function occupancyIn(occupied: BookingOccupancy[], productId: string, startAt: Date, bufferEndAt: Date, shared: boolean): {
|
|
1942
1812
|
taken: number;
|
|
1943
1813
|
foreignProductId?: string;
|
|
1944
1814
|
};
|
|
1945
|
-
declare function occupiedAtOutlet<T extends BookingOccupancy>(occupied: T[], rule: Pick<BookingRulesInput, 'ratePeriod'>, outletId?: string): T[];
|
|
1946
1815
|
declare function shopDayKey(instant: Date, timeZone: string): string;
|
|
1947
1816
|
declare function shopDayRange(fromDayKey: string, count: number, timeZone: string): {
|
|
1948
1817
|
from: Date;
|
|
1949
1818
|
to: Date;
|
|
1950
1819
|
};
|
|
1951
|
-
declare function buildAvailability({ productId, bookingRulesId, rule, resources, occupied
|
|
1952
|
-
course: ({
|
|
1953
|
-
sessions: number;
|
|
1954
|
-
alreadyStarted: boolean;
|
|
1955
|
-
beyondWindow: boolean;
|
|
1956
|
-
sessionTimes: {
|
|
1957
|
-
startAt: Date;
|
|
1958
|
-
endAt: Date;
|
|
1959
|
-
}[];
|
|
1960
|
-
startAt: Date;
|
|
1961
|
-
endAt: Date;
|
|
1962
|
-
resources: ({
|
|
1963
|
-
resourceId: string;
|
|
1964
|
-
free: number;
|
|
1965
|
-
unlimited?: undefined;
|
|
1966
|
-
} | {
|
|
1967
|
-
resourceId: string;
|
|
1968
|
-
free: number;
|
|
1969
|
-
unlimited: true;
|
|
1970
|
-
})[];
|
|
1971
|
-
} & {
|
|
1972
|
-
maxQtyNow?: number;
|
|
1973
|
-
}) | undefined;
|
|
1820
|
+
declare function buildAvailability({ productId, bookingRulesId, bookingType, rule, resources, occupied, from, to, now, }: AvailabilityInput): {
|
|
1974
1821
|
resources: ResourceInWindow[];
|
|
1975
|
-
slots:
|
|
1976
|
-
unlimited?: true;
|
|
1977
|
-
} & {
|
|
1978
|
-
maxQtyNow?: number;
|
|
1979
|
-
})[];
|
|
1822
|
+
slots: AvailabilitySlot[];
|
|
1980
1823
|
timeZone: string;
|
|
1981
1824
|
days: string[];
|
|
1982
1825
|
productId: string;
|
|
1983
1826
|
bookingRulesId: string | undefined;
|
|
1984
|
-
|
|
1985
|
-
|
|
1827
|
+
bookingType: BookingType | undefined;
|
|
1828
|
+
ratePeriod: "slot" | "day" | "night" | "week" | "month" | BookingRatePeriod;
|
|
1986
1829
|
minimumToRun: number | undefined;
|
|
1987
1830
|
minStay: number | undefined;
|
|
1988
1831
|
maxStay: number | undefined;
|
|
1989
|
-
minStayLength: BookingDuration | undefined;
|
|
1990
|
-
maxStayLength: BookingDuration | undefined;
|
|
1991
|
-
maxQtyPerBooking: number | undefined;
|
|
1992
|
-
maxPartySize: number | undefined;
|
|
1993
1832
|
bookableUntil: Date | null;
|
|
1994
1833
|
beyondWindow: boolean;
|
|
1995
1834
|
};
|
|
1996
|
-
declare function pickFreeResource<T extends {
|
|
1997
|
-
free: number;
|
|
1998
|
-
}>(slot: {
|
|
1999
|
-
resources: T[];
|
|
2000
|
-
}, qty?: number): T | undefined;
|
|
2001
|
-
declare function fewestFreeOver(slots: {
|
|
2002
|
-
startAt: Date;
|
|
2003
|
-
endAt: Date;
|
|
2004
|
-
resources: ResourceAvailability[];
|
|
2005
|
-
}[], from: Date, to: Date): ResourceAvailability[];
|
|
2006
1835
|
interface ResourcePresenceRow {
|
|
2007
1836
|
resourceId: string;
|
|
2008
1837
|
outletId: string;
|
|
@@ -2015,6 +1844,23 @@ declare function presentAt<T extends {
|
|
|
2015
1844
|
presence?: WeeklyHours[] | null;
|
|
2016
1845
|
}[];
|
|
2017
1846
|
|
|
1847
|
+
declare const DEFAULT_HOLD_MINUTES = 10;
|
|
1848
|
+
interface PlanWindowInput {
|
|
1849
|
+
rule: BookingRulesInput;
|
|
1850
|
+
timeZone: string;
|
|
1851
|
+
presence?: WeeklyHours[] | null;
|
|
1852
|
+
startAt: Date;
|
|
1853
|
+
endAt: Date;
|
|
1854
|
+
now: Date;
|
|
1855
|
+
busy?: BusyWindow[];
|
|
1856
|
+
}
|
|
1857
|
+
declare function planWindow({ rule, timeZone, presence, startAt, endAt, now, busy }: PlanWindowInput): {
|
|
1858
|
+
slots: GridSlot[];
|
|
1859
|
+
endAt: Date;
|
|
1860
|
+
bufferEndAt: Date;
|
|
1861
|
+
};
|
|
1862
|
+
declare const holdExpiresAt: (rule: BookingRulesInput, now: Date) => Date;
|
|
1863
|
+
|
|
2018
1864
|
interface ShippingPlace {
|
|
2019
1865
|
country: string;
|
|
2020
1866
|
province?: string | null;
|
|
@@ -2192,4 +2038,4 @@ declare const EXPENSE_DEFAULT_CATEGORIES: readonly [{
|
|
|
2192
2038
|
}];
|
|
2193
2039
|
type ExpenseDefaultCategoryKey = (typeof EXPENSE_DEFAULT_CATEGORIES)[number]['key'];
|
|
2194
2040
|
|
|
2195
|
-
export { ADYEN_JOB_TITLE_ASSOCIATION_TYPES, ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES, ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES, ADYEN_ROLLOUT_COUNTRY_CODES, ADYEN_STORE_STATE_PROVINCE_COUNTRIES, ADYEN_TAX_NUMBER_FORMATS, ADYEN_TAX_NUMBER_MIN_LENGTH, AFFIRM_COUNTRY_CODES, AFFIRM_PRICE_PLANS, type AddressLike, type AdyenBnplSettings, type AdyenBnplSkippedStore, type AdyenBnplUpdateResult, type AffirmPricePlan, type Amount, type AssignUserChange, AttributeType, type AvailabilityInput, type AvailabilitySlot, type AvailableTransition, BNPL_METHOD_STATUS, BNPL_SKIP_REASON, type BnplMethodStatus, type BnplSkipReason,
|
|
2041
|
+
export { ADYEN_JOB_TITLE_ASSOCIATION_TYPES, ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES, ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES, ADYEN_ROLLOUT_COUNTRY_CODES, ADYEN_STORE_STATE_PROVINCE_COUNTRIES, ADYEN_TAX_NUMBER_FORMATS, ADYEN_TAX_NUMBER_MIN_LENGTH, AFFIRM_COUNTRY_CODES, AFFIRM_PRICE_PLANS, type AddressLike, type AdyenBnplSettings, type AdyenBnplSkippedStore, type AdyenBnplUpdateResult, type AffirmPricePlan, type Amount, type AssignUserChange, AttributeType, type AvailabilityInput, type AvailabilitySlot, type AvailableTransition, BNPL_METHOD_STATUS, BNPL_SKIP_REASON, type BnplMethodStatus, type BnplSkipReason, type BookingOccupancy, BookingRatePeriod, type BookingResourceInput, BookingResourceKind, BookingResourceStatus, BookingRulesError, type BookingRulesInput, BookingType, type BusyWindow, CANADA_PROVINCES, CONDITION_OPERATORS, COUNTRY_CURRENCIES, CURRENCY_CONFIG, type CartDiscountBucket, type CartFeeBucket, type CashDrawer, type CashRoundingTuple, type CategoryModifierRow, type CategoryRow, CompanyType, type CompositeAvailabilityRows, type CompositeMakeable, type CompositeMakeableRow, type CompositePriceItem, type CompositePricePart, type CompositeReservationOrder, type CompositeShelf, type CompositeStockPart, type Condition, type ConditionGroup, type ConditionOperator, type ConfigUpdatedPayload, type ConfigValidationError, type ConfigValidationResult, type ConfigValidationWarning, type CountryOption, type CrossAxisRequires, type CrossAxisRule, type CrossAxisTrigger, CurrencyCode, type CurrencyConfig, type CurrencyRate, CustomTableAvailability, CustomerPlatform, DEFAULT_CONFIG, DEFAULT_CROSS_AXIS_RULES, DEFAULT_DISPLAY_STATE_MAP, DEFAULT_HOLD_MINUTES, DEFAULT_RESOLVED_CONFIG, DEFAULT_SHELL_SETTINGS, DEFAULT_UNIT_ID, type DeleteStateConfigFragmentParams, type DeleteStateConfigFragmentResponse, type DiscountsBreakdown, type DiscountsTuple, type DisplayStateResult, type DisplayStateRule, DualWriteStrategy, EUFixedRates, EUROPE, EVERYWHERE_KEY, EXPENSE_DEFAULT_CATEGORIES, EXPENSE_NAME_MAX_LENGTH, EXPENSE_PAYMENT_METHOD_PRESETS, type EndOfSessionReport, type ExpenseDefaultCategoryKey, ExtensionCategory, FINANCIAL_INVARIANTS, FULFILLMENT_STATES, type FailedCondition, type FeesBreakdown, FeesCustomBillingStatus, type FeesTuple, type FinancialInvariant, type FragmentParam, type FragmentValidationResult, type FulfillmentState, type FulfillmentStateDefinition, type FulfillmentTransitionPath, type GetAvailableTransitionsParams, type GetAvailableTransitionsResponse, type GetOrderDisplayStateParams, type GetOrderDisplayStateResponse, type GetOrderStateConfigParams, type GetOrderStateConfigResponse, type GetStateConfigFragmentParams, type GetStateConfigFragmentResponse, type GridSlot, HttpMethod, InventoryBaseActionEnum, type InventoryBaseActionType, InventorySpecificActionType, InvoiceStatus, LegacyWriteStrategy, LibraryItemType, type LineStockMove, MAX_PRECISION, type Measurable, type MeasurementBase, type MeasurementUnit, type MeasurementUnitFamily, MenuProject, type ModifierChoiceRow, type ModifierRow, type ModifiersBreakdown, type ModifiersTuple, NAFixedRates, NORTH_AMERICA, NonRevenueItemType, type NormalizedAddress, ORDER_STATE_ACTIONS, ORDER_STATE_EVENTS, ORDER_STATE_TOPIC, type OrderContext, type OrderLikeForAssignedUsers, type OrderLikeForContext, type OrderLikeForInCart, type OrderLikeForLegacyInference, type OrderLineItem, type OrderMutationData, type OrderPaymentMethod, OrderPlatform, type OrderRefund, type OrderReservationForContext, type OrderStateEventPayload, type OrderStateWritable, type OrderStatusDefinition, type OrderStatusValidationError, type OrderWriteStrategy, OtherFixedRates, OwnerType, PATH_MODES, PAYMENT_CHANNELS, PAYMENT_STATES, POS_VALID_INITIAL_STATES, type PathMode, type PaymentChannel, PaymentMethod, PaymentProcessor, type PaymentState, type PaymentStateDefinition, type PaymentTransitionPath, type PlanWindowInput, Platform, type PoolDrawing, PreviewImageMode, PricingLevel, PricingPlanEnum, PricingRegionEnum, ProcessorType, type ProductDiscountBucket, type ProductFeeBucket, ProductSalesChartStep, ProductSalesReportCompare, ProductStatus, ProductType, type Province, PublicationAvailability, type PublicationConfig, PublicationStatus, REGION_MAPPING, REPORT_NEGATE_PATHS, ReceiptSendChannel, ReceiptType, type RefundsBreakdown, ReservationStatus, ResidualPaymentMethod, ResidualStatus, type ResolveInputs, type ResolveShippingInput, type ResolveTemplateResult, type ResolvedShellSettings, type ResolvedShellTipSettings, type ResourceAvailability, ResourceAvailabilityState, type ResourceInWindow, type ResourcePresenceRow, SHELL_FLOW_SETTINGS_PREFIX, SHELL_FLOW_TIPS_KEY, SHELL_TIP_LABEL_MAX_LENGTH, SHELL_TIP_PERCENT_MAX, SHELL_TIP_PERCENT_MIN, SHIPPING_COUNTRIES, STATE_SCHEMA, STRIPE_SUPPORTED_COUNTRIES, SYSTEM_FAMILIES, SYSTEM_FAMILY_IDS, SYSTEM_UNITS, SYSTEM_UNIT_IDS, SalesLineAction, SalesLineSourceArray, type SalesSummary, type SaveStateConfigFragmentParams, type SaveStateConfigFragmentResponse, type SettlementBreakdown, type SettlementBuckets, type SettlementCardSection, type SettlementCashSection, type SettlementCustomEntry, type ShellSettings, type ShellSettingsLevels, type ShellSettingsProblem, type ShellSettingsProblemCode, type ShellSettingsSource, type ShellSettingsSources, type ShellStationField, type ShellTipField, type ShellTipOption, type ShellTipSettings, type ShellTipsLevel, ShippingChannel, ShippingNoOptionReason, type ShippingOptionRule, ShippingOptionType, type ShippingPlace, type ShippingPriceTier, type ShippingQuoteOption, ShippingRateType, type ShippingResolution, type ShippingTuple, ShippingZoneError, ShippingZoneKind, type ShippingZoneProblem, type ShippingZoneRule, type SplitPayment, type SplitPaymentPayment, type StaffSales, type StaffSalesEntry, type StateConfig, type StateConfigFragment, type StateDefinition, type StatePair, type StateSchema, type StateTransitionBlockedPayload, type StateTransitionCompletedPayload, StationStatus, type StockLine, type StockLineComponent, type StockReservationLink, type StoredStateConfig, StripeCurrencyCode, StripeStatus, type TaxBreakdown, type TaxBreakdownRateEntry, type TaxBreakdownSection, type TaxBreakdownSubtotal, type TaxesTuple, TimePeriod, type TipEntry, type TipsBreakdown, type TipsTuple, TopMetericsSort, type TransitionBlockedBy, type TransitionConditionSet, type TransitionOrderStateParams, type TransitionOrderStateResponse, type TransitionPath, type TransitionRequest, type TransitionResult, UserTypes, type WeeklyHours, addAmounts, addressPlaceKeys, adyenLegalEntityRequiresStateOrProvince, adyenRequiresJobTitle, adyenStoreRequiresStateOrProvince, adyenSupportsTaxNumberAbsent, adyenTaxNumberFormat, amountToString, ancestorChain, applyAssignment, assertUnitSane, availableIn, baseFor, baseFulfillmentDefinitions, baseOf, basePaymentDefinitions, buildAvailability, buildGrid, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, canTransition, cheapestCompositeItem, cheapestCompositePrice, compositeItemCost, compositeItemUnavailable, compositeMakeable, compositeModifierMismatches, compositeReservationMismatches, compositeVariantInStock, conditionSummary, convertFixedFeeToLocalCurrency, createAmount, crossAxisRuleApplies, currentAssignees, deriveDisplayState, deriveFamilyCode, deriveUnitId, displayRuleMatchesPair, divideAmount, evaluateCondition, evaluateConditionSet, extendPrice, extendPriceFor, flowSettingsFromShellSettings, formatCurrency, formatInUnit, formatMinorUnitsToString, formatQuantity, fromBase, fromMinorUnits, generateMongoID, getAvailableTransitions, getCashAmountDue, getCountriesByRegion, getCurrencyConfig, getCurrentISODate, getFinancialInvariantViolations, getGoodsPortion, getLineSubtotal, getMinorUnitMultiplier, getMinorUnits, getPaymentLegTotal, getPricingRegionFromCountry, getSettlementTotal, getTotalCollected, hasInCartFlag, hasSellableChoice, holdExpiresAt, inferStatesFromLegacyStatus, isAdyenRolloutCountry, isAffirmCountry, isAffirmPricePlan, isChoiceAvailableAtOutlet, isConditionOperator, isFulfillmentState, isInCart, isPaymentState, isShellTipPercent, isSupportedCurrency, isSystemFamilyCode, isValidQuantity, isWhole, lineStockMoves, listCountries, listProvinces, listShippingCountries, mapToLegacyStatus, maxPrecisionFor, mergeFragment, modifiersSellable, multiplyAmount, normalizeAddress, normalizeCityKey, normalizeCountry, normalizeMongoIdString, normalizePostCode, normalizeProvince, occupancyIn, orderAssignments, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, placeKey, planWindow, poolDemand, poolOf, poolShortfall, poolStockAt, postCodeMatchesProvince, presentAt, priceForTotal, provincesForPostCode, readShellTipSettings, removeFragment, resolveFamily, resolveModifiersForProduct, resolveShellSettings, resolveShellSettingsWithSources, resolveShipping, resolveTemplate, resolveUnit, roundToPrecision, sameFamily, setOrderState, shellSettingsFromCompanyTips, shellSettingsFromFlowSettings, shellSettingsProblems, shellTipSettingsProblems, shipsToCountry, shopDayKey, shopDayRange, signReportForDisplay, slotsForWindow, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, validateOrderStatuses, validateShippingZone, violatesFinancialInvariant, windowEndsAt, withinPresence };
|