@final-commerce/common 2.3.0-staging.7 → 2.3.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/dist/index.d.mts +19 -193
- package/dist/index.d.ts +19 -193
- package/dist/index.js +12 -450
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -432
- package/dist/index.mjs.map +1 -1
- package/dist/pos-types/index.d.mts +101 -144
- package/dist/pos-types/index.d.ts +101 -144
- package/dist/pos-types/index.js.map +1 -1
- package/dist/pos-types/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -389,8 +389,7 @@ declare enum StripeCurrencyCode {
|
|
|
389
389
|
|
|
390
390
|
declare enum ProductType {
|
|
391
391
|
SIMPLE = "simple",
|
|
392
|
-
VARIABLE = "variable"
|
|
393
|
-
BOOKING = "booking"
|
|
392
|
+
VARIABLE = "variable"
|
|
394
393
|
}
|
|
395
394
|
declare enum ProductStatus {
|
|
396
395
|
ACTIVE = "active",
|
|
@@ -404,43 +403,6 @@ declare enum PaymentProcessor {
|
|
|
404
403
|
EXTERNAL = "external"
|
|
405
404
|
}
|
|
406
405
|
|
|
407
|
-
declare enum BookingType {
|
|
408
|
-
RENTAL = "rental",
|
|
409
|
-
APPOINTMENT = "appointment",
|
|
410
|
-
OVERNIGHT = "overnight",
|
|
411
|
-
GROUP = "group"
|
|
412
|
-
}
|
|
413
|
-
declare enum BookingRatePeriod {
|
|
414
|
-
SLOT = "slot",
|
|
415
|
-
DAY = "day",
|
|
416
|
-
NIGHT = "night",
|
|
417
|
-
WEEK = "week",
|
|
418
|
-
MONTH = "month"
|
|
419
|
-
}
|
|
420
|
-
declare enum BookingResourceKind {
|
|
421
|
-
ASSET = "asset",
|
|
422
|
-
ROOM = "room",
|
|
423
|
-
PROPERTY = "property",
|
|
424
|
-
SPACE = "space",
|
|
425
|
-
STAFF = "staff",
|
|
426
|
-
TABLE = "table"
|
|
427
|
-
}
|
|
428
|
-
declare enum ReservationStatus {
|
|
429
|
-
HELD = "held",
|
|
430
|
-
CONFIRMED = "confirmed",
|
|
431
|
-
CANCELLED = "cancelled",
|
|
432
|
-
EXPIRED = "expired"
|
|
433
|
-
}
|
|
434
|
-
declare enum BookingResourceStatus {
|
|
435
|
-
ACTIVE = "active",
|
|
436
|
-
INACTIVE = "inactive"
|
|
437
|
-
}
|
|
438
|
-
declare enum ResourceAvailabilityState {
|
|
439
|
-
AVAILABLE = "available",
|
|
440
|
-
FULLY_BOOKED = "fullyBooked",
|
|
441
|
-
NO_HOURS_IN_RANGE = "noHoursInRange"
|
|
442
|
-
}
|
|
443
|
-
|
|
444
406
|
interface CurrencyConfig {
|
|
445
407
|
minorUnits: number;
|
|
446
408
|
symbol: string;
|
|
@@ -474,6 +436,15 @@ interface FeesBreakdown {
|
|
|
474
436
|
refundedTaxableFees?: number;
|
|
475
437
|
refundedNonTaxableFees?: number;
|
|
476
438
|
}
|
|
439
|
+
interface ModifiersBreakdown {
|
|
440
|
+
grossTotal: number;
|
|
441
|
+
refundTotal: number;
|
|
442
|
+
netTotal: number;
|
|
443
|
+
taxableModifiers?: number;
|
|
444
|
+
nonTaxableModifiers?: number;
|
|
445
|
+
refundedTaxableModifiers?: number;
|
|
446
|
+
refundedNonTaxableModifiers?: number;
|
|
447
|
+
}
|
|
477
448
|
interface ProductDiscountBucket {
|
|
478
449
|
grossProductDiscounts: number;
|
|
479
450
|
refundedProductDiscounts: number;
|
|
@@ -496,6 +467,11 @@ interface FeesTuple {
|
|
|
496
467
|
refundedFees: number;
|
|
497
468
|
netFees: number;
|
|
498
469
|
}
|
|
470
|
+
interface ModifiersTuple {
|
|
471
|
+
grossModifiers: number;
|
|
472
|
+
refundedModifiers: number;
|
|
473
|
+
netModifiers: number;
|
|
474
|
+
}
|
|
499
475
|
interface DiscountsTuple {
|
|
500
476
|
grossDiscounts: number;
|
|
501
477
|
refundedDiscounts: number;
|
|
@@ -521,6 +497,7 @@ interface SalesSummary {
|
|
|
521
497
|
discounts: DiscountsTuple;
|
|
522
498
|
refundsItems: number;
|
|
523
499
|
fees: FeesTuple;
|
|
500
|
+
modifiers?: ModifiersTuple;
|
|
524
501
|
taxes?: TaxesTuple;
|
|
525
502
|
totalSales: number;
|
|
526
503
|
tips: TipsTuple;
|
|
@@ -582,6 +559,7 @@ interface SettlementBreakdown {
|
|
|
582
559
|
interface RefundsBreakdown {
|
|
583
560
|
itemsRefunded: number;
|
|
584
561
|
feesReversed: number;
|
|
562
|
+
modifiersReversed?: number;
|
|
585
563
|
discountsReversed: number;
|
|
586
564
|
taxRefunded: number;
|
|
587
565
|
totalRefunded: number;
|
|
@@ -637,6 +615,7 @@ interface EndOfSessionReport {
|
|
|
637
615
|
staffSales: StaffSales;
|
|
638
616
|
discountsBreakdown: DiscountsBreakdown;
|
|
639
617
|
feesBreakdown: FeesBreakdown;
|
|
618
|
+
modifiersBreakdown?: ModifiersBreakdown;
|
|
640
619
|
tipsBreakdown?: TipsBreakdown;
|
|
641
620
|
sessionNumber?: string;
|
|
642
621
|
stationName?: string;
|
|
@@ -804,13 +783,6 @@ interface OrderLineItem {
|
|
|
804
783
|
returnedQuantity?: number;
|
|
805
784
|
[key: string]: unknown;
|
|
806
785
|
}
|
|
807
|
-
interface OrderReservationForContext {
|
|
808
|
-
internalId?: string;
|
|
809
|
-
quantity?: number;
|
|
810
|
-
fulfilledQuantity?: number;
|
|
811
|
-
returnedQuantity?: number;
|
|
812
|
-
[key: string]: unknown;
|
|
813
|
-
}
|
|
814
786
|
interface SplitPaymentPayment {
|
|
815
787
|
amount?: number;
|
|
816
788
|
[key: string]: unknown;
|
|
@@ -826,7 +798,6 @@ interface OrderContext {
|
|
|
826
798
|
paymentMethods: OrderPaymentMethod[];
|
|
827
799
|
refunds: OrderRefund[];
|
|
828
800
|
lineItems: OrderLineItem[];
|
|
829
|
-
reservations: OrderReservationForContext[];
|
|
830
801
|
};
|
|
831
802
|
computed: {
|
|
832
803
|
balance: number;
|
|
@@ -940,7 +911,6 @@ interface OrderLikeForContext {
|
|
|
940
911
|
refunds?: OrderRefund[];
|
|
941
912
|
refund?: OrderRefund[];
|
|
942
913
|
lineItems?: OrderLineItem[];
|
|
943
|
-
reservations?: OrderReservationForContext[];
|
|
944
914
|
}
|
|
945
915
|
interface OrderLikeForLegacyInference extends OrderLikeForContext {
|
|
946
916
|
status?: string;
|
|
@@ -1230,150 +1200,6 @@ interface ConfigUpdatedPayload {
|
|
|
1230
1200
|
}
|
|
1231
1201
|
type OrderStateEventPayload = StateTransitionCompletedPayload | StateTransitionBlockedPayload | ConfigUpdatedPayload;
|
|
1232
1202
|
|
|
1233
|
-
interface WeeklyHours {
|
|
1234
|
-
weekday: number;
|
|
1235
|
-
openMinute: number;
|
|
1236
|
-
closeMinute: number;
|
|
1237
|
-
}
|
|
1238
|
-
interface BookingRulesInput {
|
|
1239
|
-
ratePeriod: BookingRatePeriod | `${BookingRatePeriod}`;
|
|
1240
|
-
slot: {
|
|
1241
|
-
lengthMinutes: number;
|
|
1242
|
-
bufferMinutes?: number;
|
|
1243
|
-
minimumToRun?: number;
|
|
1244
|
-
minStay?: number;
|
|
1245
|
-
maxStay?: number;
|
|
1246
|
-
sharedAcrossProducts?: boolean;
|
|
1247
|
-
};
|
|
1248
|
-
window: {
|
|
1249
|
-
maxAdvanceDays?: number;
|
|
1250
|
-
minNoticeMinutes?: number;
|
|
1251
|
-
holdMinutes?: number;
|
|
1252
|
-
bookableFrom?: Date | string | null;
|
|
1253
|
-
bookableTo?: Date | string | null;
|
|
1254
|
-
};
|
|
1255
|
-
availability: {
|
|
1256
|
-
weeklyHours?: WeeklyHours[];
|
|
1257
|
-
offMarket?: {
|
|
1258
|
-
from: Date | string;
|
|
1259
|
-
to: Date | string;
|
|
1260
|
-
}[];
|
|
1261
|
-
arrivalDays?: number[];
|
|
1262
|
-
availableFrom?: Date | string | null;
|
|
1263
|
-
};
|
|
1264
|
-
checkInTime?: string | null;
|
|
1265
|
-
checkOutTime?: string | null;
|
|
1266
|
-
}
|
|
1267
|
-
interface BusyWindow {
|
|
1268
|
-
startAt: Date;
|
|
1269
|
-
bufferEndAt: Date;
|
|
1270
|
-
}
|
|
1271
|
-
interface GridSlot {
|
|
1272
|
-
startAt: Date;
|
|
1273
|
-
endAt: Date;
|
|
1274
|
-
bufferEndAt: Date;
|
|
1275
|
-
canStart: boolean;
|
|
1276
|
-
}
|
|
1277
|
-
declare class BookingRulesError extends Error {
|
|
1278
|
-
constructor(message: string);
|
|
1279
|
-
}
|
|
1280
|
-
|
|
1281
|
-
declare function windowEndsAt(rule: BookingRulesInput, now: Date): Date | null;
|
|
1282
|
-
declare function buildGrid(rule: BookingRulesInput, timeZone: string, from: Date, to: Date, now: Date, busy?: BusyWindow[]): GridSlot[];
|
|
1283
|
-
declare function slotsForWindow(grid: GridSlot[], startAt: Date, endAt: Date): GridSlot[];
|
|
1284
|
-
|
|
1285
|
-
interface BookingOccupancy {
|
|
1286
|
-
resourceId: string;
|
|
1287
|
-
productId: string;
|
|
1288
|
-
qty: number;
|
|
1289
|
-
startAt: Date;
|
|
1290
|
-
bufferEndAt: Date;
|
|
1291
|
-
}
|
|
1292
|
-
interface BookingResourceInput {
|
|
1293
|
-
id: string;
|
|
1294
|
-
name: string;
|
|
1295
|
-
seats?: number | null;
|
|
1296
|
-
timeZone: string;
|
|
1297
|
-
presence?: WeeklyHours[] | null;
|
|
1298
|
-
}
|
|
1299
|
-
interface ResourceAvailability {
|
|
1300
|
-
resourceId: string;
|
|
1301
|
-
name: string;
|
|
1302
|
-
capacity: number;
|
|
1303
|
-
booked: number;
|
|
1304
|
-
free: number;
|
|
1305
|
-
}
|
|
1306
|
-
interface AvailabilitySlot extends GridSlot {
|
|
1307
|
-
capacity: number;
|
|
1308
|
-
booked: number;
|
|
1309
|
-
free: number;
|
|
1310
|
-
resources: ResourceAvailability[];
|
|
1311
|
-
}
|
|
1312
|
-
interface ResourceInWindow {
|
|
1313
|
-
resourceId: string;
|
|
1314
|
-
name: string;
|
|
1315
|
-
slots: number;
|
|
1316
|
-
free: number;
|
|
1317
|
-
state: ResourceAvailabilityState;
|
|
1318
|
-
}
|
|
1319
|
-
interface AvailabilityInput {
|
|
1320
|
-
productId: string;
|
|
1321
|
-
bookingRulesId?: string;
|
|
1322
|
-
bookingType?: BookingType;
|
|
1323
|
-
rule: BookingRulesInput;
|
|
1324
|
-
resources: BookingResourceInput[];
|
|
1325
|
-
occupied: BookingOccupancy[];
|
|
1326
|
-
from: Date;
|
|
1327
|
-
to: Date;
|
|
1328
|
-
now: Date;
|
|
1329
|
-
}
|
|
1330
|
-
declare const withinPresence: (slot: GridSlot, timeZone: string, presence?: WeeklyHours[] | null) => boolean;
|
|
1331
|
-
declare function occupancyIn(occupied: BookingOccupancy[], productId: string, startAt: Date, bufferEndAt: Date, shared: boolean): {
|
|
1332
|
-
taken: number;
|
|
1333
|
-
foreignProductId?: string;
|
|
1334
|
-
};
|
|
1335
|
-
declare function buildAvailability({ productId, bookingRulesId, bookingType, rule, resources, occupied, from, to, now, }: AvailabilityInput): {
|
|
1336
|
-
resources: ResourceInWindow[];
|
|
1337
|
-
slots: AvailabilitySlot[];
|
|
1338
|
-
productId: string;
|
|
1339
|
-
bookingRulesId: string | undefined;
|
|
1340
|
-
bookingType: BookingType | undefined;
|
|
1341
|
-
ratePeriod: "slot" | "day" | "night" | "week" | "month" | BookingRatePeriod;
|
|
1342
|
-
minimumToRun: number | undefined;
|
|
1343
|
-
minStay: number | undefined;
|
|
1344
|
-
maxStay: number | undefined;
|
|
1345
|
-
bookableUntil: Date | null;
|
|
1346
|
-
beyondWindow: boolean;
|
|
1347
|
-
};
|
|
1348
|
-
interface ResourcePresenceRow {
|
|
1349
|
-
resourceId: string;
|
|
1350
|
-
outletId: string;
|
|
1351
|
-
weeklyHours?: WeeklyHours[] | null;
|
|
1352
|
-
}
|
|
1353
|
-
declare function presentAt<T extends {
|
|
1354
|
-
id: string;
|
|
1355
|
-
}>(resources: T[], rows: ResourcePresenceRow[], outletId?: string): {
|
|
1356
|
-
resource: T;
|
|
1357
|
-
presence?: WeeklyHours[] | null;
|
|
1358
|
-
}[];
|
|
1359
|
-
|
|
1360
|
-
declare const DEFAULT_HOLD_MINUTES = 10;
|
|
1361
|
-
interface PlanWindowInput {
|
|
1362
|
-
rule: BookingRulesInput;
|
|
1363
|
-
timeZone: string;
|
|
1364
|
-
presence?: WeeklyHours[] | null;
|
|
1365
|
-
startAt: Date;
|
|
1366
|
-
endAt: Date;
|
|
1367
|
-
now: Date;
|
|
1368
|
-
busy?: BusyWindow[];
|
|
1369
|
-
}
|
|
1370
|
-
declare function planWindow({ rule, timeZone, presence, startAt, endAt, now, busy }: PlanWindowInput): {
|
|
1371
|
-
slots: GridSlot[];
|
|
1372
|
-
endAt: Date;
|
|
1373
|
-
bufferEndAt: Date;
|
|
1374
|
-
};
|
|
1375
|
-
declare const holdExpiresAt: (rule: BookingRulesInput, now: Date) => Date;
|
|
1376
|
-
|
|
1377
1203
|
declare const ADYEN_ROLLOUT_COUNTRY_CODES: Set<string>;
|
|
1378
1204
|
declare function isAdyenRolloutCountry(alpha2: string): boolean;
|
|
1379
1205
|
|
|
@@ -1388,4 +1214,4 @@ declare const EUFixedRates: Record<string, CurrencyRate>;
|
|
|
1388
1214
|
declare const OtherFixedRates: Record<string, CurrencyRate>;
|
|
1389
1215
|
declare const COUNTRY_CURRENCIES: Record<string, string>;
|
|
1390
1216
|
|
|
1391
|
-
export { ADYEN_ROLLOUT_COUNTRY_CODES, type Amount, AttributeType, type
|
|
1217
|
+
export { ADYEN_ROLLOUT_COUNTRY_CODES, type Amount, AttributeType, type AvailableTransition, CONDITION_OPERATORS, COUNTRY_CURRENCIES, CURRENCY_CONFIG, type CartDiscountBucket, type CartFeeBucket, type CashDrawer, type CashRoundingTuple, CompanyType, type Condition, type ConditionGroup, type ConditionOperator, type ConfigUpdatedPayload, type ConfigValidationError, type ConfigValidationResult, type ConfigValidationWarning, type CrossAxisRequires, type CrossAxisRule, type CrossAxisTrigger, CurrencyCode, type CurrencyConfig, type CurrencyRate, CustomTableAvailability, CustomerPlatform, DEFAULT_CONFIG, DEFAULT_CROSS_AXIS_RULES, DEFAULT_DISPLAY_STATE_MAP, DEFAULT_RESOLVED_CONFIG, DEFAULT_UNIT_ID, type DeleteStateConfigFragmentParams, type DeleteStateConfigFragmentResponse, type DiscountsBreakdown, type DiscountsTuple, type DisplayStateResult, type DisplayStateRule, DualWriteStrategy, EUFixedRates, EUROPE, type EndOfSessionReport, 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, InventoryBaseActionEnum, type InventoryBaseActionType, InventorySpecificActionType, InvoiceStatus, LegacyWriteStrategy, LibraryItemType, MAX_PRECISION, type Measurable, type MeasurementBase, type MeasurementUnit, type MeasurementUnitFamily, MenuProject, type ModifiersBreakdown, type ModifiersTuple, NAFixedRates, NORTH_AMERICA, NonRevenueItemType, ORDER_STATE_ACTIONS, ORDER_STATE_EVENTS, ORDER_STATE_TOPIC, type OrderContext, type OrderLikeForContext, type OrderLikeForLegacyInference, type OrderLineItem, type OrderMutationData, type OrderPaymentMethod, OrderPlatform, type OrderRefund, type OrderStateEventPayload, type OrderStateWritable, type OrderWriteStrategy, OtherFixedRates, OwnerType, PATH_MODES, PAYMENT_STATES, POS_VALID_INITIAL_STATES, type PathMode, PaymentMethod, PaymentProcessor, type PaymentState, type PaymentStateDefinition, type PaymentTransitionPath, Platform, PreviewImageMode, PricingLevel, PricingPlanEnum, PricingRegionEnum, type ProductDiscountBucket, type ProductFeeBucket, ProductStatus, ProductType, PublicationAvailability, type PublicationConfig, PublicationStatus, REGION_MAPPING, REPORT_NEGATE_PATHS, ReceiptSendChannel, ReceiptType, type RefundsBreakdown, ResidualPaymentMethod, ResidualStatus, type ResolveTemplateResult, STATE_SCHEMA, STRIPE_SUPPORTED_COUNTRIES, SYSTEM_FAMILIES, SYSTEM_FAMILY_IDS, SYSTEM_UNITS, SYSTEM_UNIT_IDS, type SalesSummary, type SaveStateConfigFragmentParams, type SaveStateConfigFragmentResponse, type SettlementBreakdown, type SettlementBuckets, type SettlementCardSection, type SettlementCashSection, type SettlementCustomEntry, type SplitPayment, type SplitPaymentPayment, type StaffSales, type StaffSalesEntry, type StateConfig, type StateConfigFragment, type StateDefinition, type StatePair, type StateSchema, type StateTransitionBlockedPayload, type StateTransitionCompletedPayload, StationStatus, 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, addAmounts, amountToString, assertUnitSane, availableIn, baseFor, baseFulfillmentDefinitions, baseOf, basePaymentDefinitions, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, canTransition, conditionSummary, convertFixedFeeToLocalCurrency, createAmount, crossAxisRuleApplies, deriveDisplayState, deriveFamilyCode, deriveUnitId, displayRuleMatchesPair, divideAmount, evaluateCondition, evaluateConditionSet, extendPrice, extendPriceFor, formatCurrency, formatInUnit, formatMinorUnitsToString, formatQuantity, fromBase, fromMinorUnits, generateMongoID, getAvailableTransitions, getCashAmountDue, getCountriesByRegion, getCurrencyConfig, getCurrentISODate, getFinancialInvariantViolations, getGoodsPortion, getLineSubtotal, getMinorUnitMultiplier, getMinorUnits, getPaymentLegTotal, getPricingRegionFromCountry, getSettlementTotal, getTotalCollected, inferStatesFromLegacyStatus, isAdyenRolloutCountry, isConditionOperator, isFulfillmentState, isPaymentState, isSupportedCurrency, isSystemFamilyCode, isValidQuantity, isWhole, mapToLegacyStatus, maxPrecisionFor, mergeFragment, multiplyAmount, normalizeMongoIdString, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, removeFragment, resolveFamily, resolveTemplate, resolveUnit, roundToPrecision, sameFamily, setOrderState, signReportForDisplay, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, violatesFinancialInvariant };
|
package/dist/index.d.ts
CHANGED
|
@@ -389,8 +389,7 @@ declare enum StripeCurrencyCode {
|
|
|
389
389
|
|
|
390
390
|
declare enum ProductType {
|
|
391
391
|
SIMPLE = "simple",
|
|
392
|
-
VARIABLE = "variable"
|
|
393
|
-
BOOKING = "booking"
|
|
392
|
+
VARIABLE = "variable"
|
|
394
393
|
}
|
|
395
394
|
declare enum ProductStatus {
|
|
396
395
|
ACTIVE = "active",
|
|
@@ -404,43 +403,6 @@ declare enum PaymentProcessor {
|
|
|
404
403
|
EXTERNAL = "external"
|
|
405
404
|
}
|
|
406
405
|
|
|
407
|
-
declare enum BookingType {
|
|
408
|
-
RENTAL = "rental",
|
|
409
|
-
APPOINTMENT = "appointment",
|
|
410
|
-
OVERNIGHT = "overnight",
|
|
411
|
-
GROUP = "group"
|
|
412
|
-
}
|
|
413
|
-
declare enum BookingRatePeriod {
|
|
414
|
-
SLOT = "slot",
|
|
415
|
-
DAY = "day",
|
|
416
|
-
NIGHT = "night",
|
|
417
|
-
WEEK = "week",
|
|
418
|
-
MONTH = "month"
|
|
419
|
-
}
|
|
420
|
-
declare enum BookingResourceKind {
|
|
421
|
-
ASSET = "asset",
|
|
422
|
-
ROOM = "room",
|
|
423
|
-
PROPERTY = "property",
|
|
424
|
-
SPACE = "space",
|
|
425
|
-
STAFF = "staff",
|
|
426
|
-
TABLE = "table"
|
|
427
|
-
}
|
|
428
|
-
declare enum ReservationStatus {
|
|
429
|
-
HELD = "held",
|
|
430
|
-
CONFIRMED = "confirmed",
|
|
431
|
-
CANCELLED = "cancelled",
|
|
432
|
-
EXPIRED = "expired"
|
|
433
|
-
}
|
|
434
|
-
declare enum BookingResourceStatus {
|
|
435
|
-
ACTIVE = "active",
|
|
436
|
-
INACTIVE = "inactive"
|
|
437
|
-
}
|
|
438
|
-
declare enum ResourceAvailabilityState {
|
|
439
|
-
AVAILABLE = "available",
|
|
440
|
-
FULLY_BOOKED = "fullyBooked",
|
|
441
|
-
NO_HOURS_IN_RANGE = "noHoursInRange"
|
|
442
|
-
}
|
|
443
|
-
|
|
444
406
|
interface CurrencyConfig {
|
|
445
407
|
minorUnits: number;
|
|
446
408
|
symbol: string;
|
|
@@ -474,6 +436,15 @@ interface FeesBreakdown {
|
|
|
474
436
|
refundedTaxableFees?: number;
|
|
475
437
|
refundedNonTaxableFees?: number;
|
|
476
438
|
}
|
|
439
|
+
interface ModifiersBreakdown {
|
|
440
|
+
grossTotal: number;
|
|
441
|
+
refundTotal: number;
|
|
442
|
+
netTotal: number;
|
|
443
|
+
taxableModifiers?: number;
|
|
444
|
+
nonTaxableModifiers?: number;
|
|
445
|
+
refundedTaxableModifiers?: number;
|
|
446
|
+
refundedNonTaxableModifiers?: number;
|
|
447
|
+
}
|
|
477
448
|
interface ProductDiscountBucket {
|
|
478
449
|
grossProductDiscounts: number;
|
|
479
450
|
refundedProductDiscounts: number;
|
|
@@ -496,6 +467,11 @@ interface FeesTuple {
|
|
|
496
467
|
refundedFees: number;
|
|
497
468
|
netFees: number;
|
|
498
469
|
}
|
|
470
|
+
interface ModifiersTuple {
|
|
471
|
+
grossModifiers: number;
|
|
472
|
+
refundedModifiers: number;
|
|
473
|
+
netModifiers: number;
|
|
474
|
+
}
|
|
499
475
|
interface DiscountsTuple {
|
|
500
476
|
grossDiscounts: number;
|
|
501
477
|
refundedDiscounts: number;
|
|
@@ -521,6 +497,7 @@ interface SalesSummary {
|
|
|
521
497
|
discounts: DiscountsTuple;
|
|
522
498
|
refundsItems: number;
|
|
523
499
|
fees: FeesTuple;
|
|
500
|
+
modifiers?: ModifiersTuple;
|
|
524
501
|
taxes?: TaxesTuple;
|
|
525
502
|
totalSales: number;
|
|
526
503
|
tips: TipsTuple;
|
|
@@ -582,6 +559,7 @@ interface SettlementBreakdown {
|
|
|
582
559
|
interface RefundsBreakdown {
|
|
583
560
|
itemsRefunded: number;
|
|
584
561
|
feesReversed: number;
|
|
562
|
+
modifiersReversed?: number;
|
|
585
563
|
discountsReversed: number;
|
|
586
564
|
taxRefunded: number;
|
|
587
565
|
totalRefunded: number;
|
|
@@ -637,6 +615,7 @@ interface EndOfSessionReport {
|
|
|
637
615
|
staffSales: StaffSales;
|
|
638
616
|
discountsBreakdown: DiscountsBreakdown;
|
|
639
617
|
feesBreakdown: FeesBreakdown;
|
|
618
|
+
modifiersBreakdown?: ModifiersBreakdown;
|
|
640
619
|
tipsBreakdown?: TipsBreakdown;
|
|
641
620
|
sessionNumber?: string;
|
|
642
621
|
stationName?: string;
|
|
@@ -804,13 +783,6 @@ interface OrderLineItem {
|
|
|
804
783
|
returnedQuantity?: number;
|
|
805
784
|
[key: string]: unknown;
|
|
806
785
|
}
|
|
807
|
-
interface OrderReservationForContext {
|
|
808
|
-
internalId?: string;
|
|
809
|
-
quantity?: number;
|
|
810
|
-
fulfilledQuantity?: number;
|
|
811
|
-
returnedQuantity?: number;
|
|
812
|
-
[key: string]: unknown;
|
|
813
|
-
}
|
|
814
786
|
interface SplitPaymentPayment {
|
|
815
787
|
amount?: number;
|
|
816
788
|
[key: string]: unknown;
|
|
@@ -826,7 +798,6 @@ interface OrderContext {
|
|
|
826
798
|
paymentMethods: OrderPaymentMethod[];
|
|
827
799
|
refunds: OrderRefund[];
|
|
828
800
|
lineItems: OrderLineItem[];
|
|
829
|
-
reservations: OrderReservationForContext[];
|
|
830
801
|
};
|
|
831
802
|
computed: {
|
|
832
803
|
balance: number;
|
|
@@ -940,7 +911,6 @@ interface OrderLikeForContext {
|
|
|
940
911
|
refunds?: OrderRefund[];
|
|
941
912
|
refund?: OrderRefund[];
|
|
942
913
|
lineItems?: OrderLineItem[];
|
|
943
|
-
reservations?: OrderReservationForContext[];
|
|
944
914
|
}
|
|
945
915
|
interface OrderLikeForLegacyInference extends OrderLikeForContext {
|
|
946
916
|
status?: string;
|
|
@@ -1230,150 +1200,6 @@ interface ConfigUpdatedPayload {
|
|
|
1230
1200
|
}
|
|
1231
1201
|
type OrderStateEventPayload = StateTransitionCompletedPayload | StateTransitionBlockedPayload | ConfigUpdatedPayload;
|
|
1232
1202
|
|
|
1233
|
-
interface WeeklyHours {
|
|
1234
|
-
weekday: number;
|
|
1235
|
-
openMinute: number;
|
|
1236
|
-
closeMinute: number;
|
|
1237
|
-
}
|
|
1238
|
-
interface BookingRulesInput {
|
|
1239
|
-
ratePeriod: BookingRatePeriod | `${BookingRatePeriod}`;
|
|
1240
|
-
slot: {
|
|
1241
|
-
lengthMinutes: number;
|
|
1242
|
-
bufferMinutes?: number;
|
|
1243
|
-
minimumToRun?: number;
|
|
1244
|
-
minStay?: number;
|
|
1245
|
-
maxStay?: number;
|
|
1246
|
-
sharedAcrossProducts?: boolean;
|
|
1247
|
-
};
|
|
1248
|
-
window: {
|
|
1249
|
-
maxAdvanceDays?: number;
|
|
1250
|
-
minNoticeMinutes?: number;
|
|
1251
|
-
holdMinutes?: number;
|
|
1252
|
-
bookableFrom?: Date | string | null;
|
|
1253
|
-
bookableTo?: Date | string | null;
|
|
1254
|
-
};
|
|
1255
|
-
availability: {
|
|
1256
|
-
weeklyHours?: WeeklyHours[];
|
|
1257
|
-
offMarket?: {
|
|
1258
|
-
from: Date | string;
|
|
1259
|
-
to: Date | string;
|
|
1260
|
-
}[];
|
|
1261
|
-
arrivalDays?: number[];
|
|
1262
|
-
availableFrom?: Date | string | null;
|
|
1263
|
-
};
|
|
1264
|
-
checkInTime?: string | null;
|
|
1265
|
-
checkOutTime?: string | null;
|
|
1266
|
-
}
|
|
1267
|
-
interface BusyWindow {
|
|
1268
|
-
startAt: Date;
|
|
1269
|
-
bufferEndAt: Date;
|
|
1270
|
-
}
|
|
1271
|
-
interface GridSlot {
|
|
1272
|
-
startAt: Date;
|
|
1273
|
-
endAt: Date;
|
|
1274
|
-
bufferEndAt: Date;
|
|
1275
|
-
canStart: boolean;
|
|
1276
|
-
}
|
|
1277
|
-
declare class BookingRulesError extends Error {
|
|
1278
|
-
constructor(message: string);
|
|
1279
|
-
}
|
|
1280
|
-
|
|
1281
|
-
declare function windowEndsAt(rule: BookingRulesInput, now: Date): Date | null;
|
|
1282
|
-
declare function buildGrid(rule: BookingRulesInput, timeZone: string, from: Date, to: Date, now: Date, busy?: BusyWindow[]): GridSlot[];
|
|
1283
|
-
declare function slotsForWindow(grid: GridSlot[], startAt: Date, endAt: Date): GridSlot[];
|
|
1284
|
-
|
|
1285
|
-
interface BookingOccupancy {
|
|
1286
|
-
resourceId: string;
|
|
1287
|
-
productId: string;
|
|
1288
|
-
qty: number;
|
|
1289
|
-
startAt: Date;
|
|
1290
|
-
bufferEndAt: Date;
|
|
1291
|
-
}
|
|
1292
|
-
interface BookingResourceInput {
|
|
1293
|
-
id: string;
|
|
1294
|
-
name: string;
|
|
1295
|
-
seats?: number | null;
|
|
1296
|
-
timeZone: string;
|
|
1297
|
-
presence?: WeeklyHours[] | null;
|
|
1298
|
-
}
|
|
1299
|
-
interface ResourceAvailability {
|
|
1300
|
-
resourceId: string;
|
|
1301
|
-
name: string;
|
|
1302
|
-
capacity: number;
|
|
1303
|
-
booked: number;
|
|
1304
|
-
free: number;
|
|
1305
|
-
}
|
|
1306
|
-
interface AvailabilitySlot extends GridSlot {
|
|
1307
|
-
capacity: number;
|
|
1308
|
-
booked: number;
|
|
1309
|
-
free: number;
|
|
1310
|
-
resources: ResourceAvailability[];
|
|
1311
|
-
}
|
|
1312
|
-
interface ResourceInWindow {
|
|
1313
|
-
resourceId: string;
|
|
1314
|
-
name: string;
|
|
1315
|
-
slots: number;
|
|
1316
|
-
free: number;
|
|
1317
|
-
state: ResourceAvailabilityState;
|
|
1318
|
-
}
|
|
1319
|
-
interface AvailabilityInput {
|
|
1320
|
-
productId: string;
|
|
1321
|
-
bookingRulesId?: string;
|
|
1322
|
-
bookingType?: BookingType;
|
|
1323
|
-
rule: BookingRulesInput;
|
|
1324
|
-
resources: BookingResourceInput[];
|
|
1325
|
-
occupied: BookingOccupancy[];
|
|
1326
|
-
from: Date;
|
|
1327
|
-
to: Date;
|
|
1328
|
-
now: Date;
|
|
1329
|
-
}
|
|
1330
|
-
declare const withinPresence: (slot: GridSlot, timeZone: string, presence?: WeeklyHours[] | null) => boolean;
|
|
1331
|
-
declare function occupancyIn(occupied: BookingOccupancy[], productId: string, startAt: Date, bufferEndAt: Date, shared: boolean): {
|
|
1332
|
-
taken: number;
|
|
1333
|
-
foreignProductId?: string;
|
|
1334
|
-
};
|
|
1335
|
-
declare function buildAvailability({ productId, bookingRulesId, bookingType, rule, resources, occupied, from, to, now, }: AvailabilityInput): {
|
|
1336
|
-
resources: ResourceInWindow[];
|
|
1337
|
-
slots: AvailabilitySlot[];
|
|
1338
|
-
productId: string;
|
|
1339
|
-
bookingRulesId: string | undefined;
|
|
1340
|
-
bookingType: BookingType | undefined;
|
|
1341
|
-
ratePeriod: "slot" | "day" | "night" | "week" | "month" | BookingRatePeriod;
|
|
1342
|
-
minimumToRun: number | undefined;
|
|
1343
|
-
minStay: number | undefined;
|
|
1344
|
-
maxStay: number | undefined;
|
|
1345
|
-
bookableUntil: Date | null;
|
|
1346
|
-
beyondWindow: boolean;
|
|
1347
|
-
};
|
|
1348
|
-
interface ResourcePresenceRow {
|
|
1349
|
-
resourceId: string;
|
|
1350
|
-
outletId: string;
|
|
1351
|
-
weeklyHours?: WeeklyHours[] | null;
|
|
1352
|
-
}
|
|
1353
|
-
declare function presentAt<T extends {
|
|
1354
|
-
id: string;
|
|
1355
|
-
}>(resources: T[], rows: ResourcePresenceRow[], outletId?: string): {
|
|
1356
|
-
resource: T;
|
|
1357
|
-
presence?: WeeklyHours[] | null;
|
|
1358
|
-
}[];
|
|
1359
|
-
|
|
1360
|
-
declare const DEFAULT_HOLD_MINUTES = 10;
|
|
1361
|
-
interface PlanWindowInput {
|
|
1362
|
-
rule: BookingRulesInput;
|
|
1363
|
-
timeZone: string;
|
|
1364
|
-
presence?: WeeklyHours[] | null;
|
|
1365
|
-
startAt: Date;
|
|
1366
|
-
endAt: Date;
|
|
1367
|
-
now: Date;
|
|
1368
|
-
busy?: BusyWindow[];
|
|
1369
|
-
}
|
|
1370
|
-
declare function planWindow({ rule, timeZone, presence, startAt, endAt, now, busy }: PlanWindowInput): {
|
|
1371
|
-
slots: GridSlot[];
|
|
1372
|
-
endAt: Date;
|
|
1373
|
-
bufferEndAt: Date;
|
|
1374
|
-
};
|
|
1375
|
-
declare const holdExpiresAt: (rule: BookingRulesInput, now: Date) => Date;
|
|
1376
|
-
|
|
1377
1203
|
declare const ADYEN_ROLLOUT_COUNTRY_CODES: Set<string>;
|
|
1378
1204
|
declare function isAdyenRolloutCountry(alpha2: string): boolean;
|
|
1379
1205
|
|
|
@@ -1388,4 +1214,4 @@ declare const EUFixedRates: Record<string, CurrencyRate>;
|
|
|
1388
1214
|
declare const OtherFixedRates: Record<string, CurrencyRate>;
|
|
1389
1215
|
declare const COUNTRY_CURRENCIES: Record<string, string>;
|
|
1390
1216
|
|
|
1391
|
-
export { ADYEN_ROLLOUT_COUNTRY_CODES, type Amount, AttributeType, type
|
|
1217
|
+
export { ADYEN_ROLLOUT_COUNTRY_CODES, type Amount, AttributeType, type AvailableTransition, CONDITION_OPERATORS, COUNTRY_CURRENCIES, CURRENCY_CONFIG, type CartDiscountBucket, type CartFeeBucket, type CashDrawer, type CashRoundingTuple, CompanyType, type Condition, type ConditionGroup, type ConditionOperator, type ConfigUpdatedPayload, type ConfigValidationError, type ConfigValidationResult, type ConfigValidationWarning, type CrossAxisRequires, type CrossAxisRule, type CrossAxisTrigger, CurrencyCode, type CurrencyConfig, type CurrencyRate, CustomTableAvailability, CustomerPlatform, DEFAULT_CONFIG, DEFAULT_CROSS_AXIS_RULES, DEFAULT_DISPLAY_STATE_MAP, DEFAULT_RESOLVED_CONFIG, DEFAULT_UNIT_ID, type DeleteStateConfigFragmentParams, type DeleteStateConfigFragmentResponse, type DiscountsBreakdown, type DiscountsTuple, type DisplayStateResult, type DisplayStateRule, DualWriteStrategy, EUFixedRates, EUROPE, type EndOfSessionReport, 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, InventoryBaseActionEnum, type InventoryBaseActionType, InventorySpecificActionType, InvoiceStatus, LegacyWriteStrategy, LibraryItemType, MAX_PRECISION, type Measurable, type MeasurementBase, type MeasurementUnit, type MeasurementUnitFamily, MenuProject, type ModifiersBreakdown, type ModifiersTuple, NAFixedRates, NORTH_AMERICA, NonRevenueItemType, ORDER_STATE_ACTIONS, ORDER_STATE_EVENTS, ORDER_STATE_TOPIC, type OrderContext, type OrderLikeForContext, type OrderLikeForLegacyInference, type OrderLineItem, type OrderMutationData, type OrderPaymentMethod, OrderPlatform, type OrderRefund, type OrderStateEventPayload, type OrderStateWritable, type OrderWriteStrategy, OtherFixedRates, OwnerType, PATH_MODES, PAYMENT_STATES, POS_VALID_INITIAL_STATES, type PathMode, PaymentMethod, PaymentProcessor, type PaymentState, type PaymentStateDefinition, type PaymentTransitionPath, Platform, PreviewImageMode, PricingLevel, PricingPlanEnum, PricingRegionEnum, type ProductDiscountBucket, type ProductFeeBucket, ProductStatus, ProductType, PublicationAvailability, type PublicationConfig, PublicationStatus, REGION_MAPPING, REPORT_NEGATE_PATHS, ReceiptSendChannel, ReceiptType, type RefundsBreakdown, ResidualPaymentMethod, ResidualStatus, type ResolveTemplateResult, STATE_SCHEMA, STRIPE_SUPPORTED_COUNTRIES, SYSTEM_FAMILIES, SYSTEM_FAMILY_IDS, SYSTEM_UNITS, SYSTEM_UNIT_IDS, type SalesSummary, type SaveStateConfigFragmentParams, type SaveStateConfigFragmentResponse, type SettlementBreakdown, type SettlementBuckets, type SettlementCardSection, type SettlementCashSection, type SettlementCustomEntry, type SplitPayment, type SplitPaymentPayment, type StaffSales, type StaffSalesEntry, type StateConfig, type StateConfigFragment, type StateDefinition, type StatePair, type StateSchema, type StateTransitionBlockedPayload, type StateTransitionCompletedPayload, StationStatus, 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, addAmounts, amountToString, assertUnitSane, availableIn, baseFor, baseFulfillmentDefinitions, baseOf, basePaymentDefinitions, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, canTransition, conditionSummary, convertFixedFeeToLocalCurrency, createAmount, crossAxisRuleApplies, deriveDisplayState, deriveFamilyCode, deriveUnitId, displayRuleMatchesPair, divideAmount, evaluateCondition, evaluateConditionSet, extendPrice, extendPriceFor, formatCurrency, formatInUnit, formatMinorUnitsToString, formatQuantity, fromBase, fromMinorUnits, generateMongoID, getAvailableTransitions, getCashAmountDue, getCountriesByRegion, getCurrencyConfig, getCurrentISODate, getFinancialInvariantViolations, getGoodsPortion, getLineSubtotal, getMinorUnitMultiplier, getMinorUnits, getPaymentLegTotal, getPricingRegionFromCountry, getSettlementTotal, getTotalCollected, inferStatesFromLegacyStatus, isAdyenRolloutCountry, isConditionOperator, isFulfillmentState, isPaymentState, isSupportedCurrency, isSystemFamilyCode, isValidQuantity, isWhole, mapToLegacyStatus, maxPrecisionFor, mergeFragment, multiplyAmount, normalizeMongoIdString, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, removeFragment, resolveFamily, resolveTemplate, resolveUnit, roundToPrecision, sameFamily, setOrderState, signReportForDisplay, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, violatesFinancialInvariant };
|