@final-commerce/common 2.4.0-staging.1 → 2.4.1-staging2.1
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 +53 -448
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +41 -430
- package/dist/index.mjs.map +1 -1
- package/dist/pos-types/index.d.mts +18 -144
- package/dist/pos-types/index.d.ts +18 -144
- 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;
|
|
@@ -821,13 +783,6 @@ interface OrderLineItem {
|
|
|
821
783
|
returnedQuantity?: number;
|
|
822
784
|
[key: string]: unknown;
|
|
823
785
|
}
|
|
824
|
-
interface OrderReservationForContext {
|
|
825
|
-
internalId?: string;
|
|
826
|
-
quantity?: number;
|
|
827
|
-
fulfilledQuantity?: number;
|
|
828
|
-
returnedQuantity?: number;
|
|
829
|
-
[key: string]: unknown;
|
|
830
|
-
}
|
|
831
786
|
interface SplitPaymentPayment {
|
|
832
787
|
amount?: number;
|
|
833
788
|
[key: string]: unknown;
|
|
@@ -843,7 +798,6 @@ interface OrderContext {
|
|
|
843
798
|
paymentMethods: OrderPaymentMethod[];
|
|
844
799
|
refunds: OrderRefund[];
|
|
845
800
|
lineItems: OrderLineItem[];
|
|
846
|
-
reservations: OrderReservationForContext[];
|
|
847
801
|
};
|
|
848
802
|
computed: {
|
|
849
803
|
balance: number;
|
|
@@ -957,7 +911,6 @@ interface OrderLikeForContext {
|
|
|
957
911
|
refunds?: OrderRefund[];
|
|
958
912
|
refund?: OrderRefund[];
|
|
959
913
|
lineItems?: OrderLineItem[];
|
|
960
|
-
reservations?: OrderReservationForContext[];
|
|
961
914
|
}
|
|
962
915
|
interface OrderLikeForLegacyInference extends OrderLikeForContext {
|
|
963
916
|
status?: string;
|
|
@@ -1247,152 +1200,25 @@ interface ConfigUpdatedPayload {
|
|
|
1247
1200
|
}
|
|
1248
1201
|
type OrderStateEventPayload = StateTransitionCompletedPayload | StateTransitionBlockedPayload | ConfigUpdatedPayload;
|
|
1249
1202
|
|
|
1250
|
-
interface WeeklyHours {
|
|
1251
|
-
weekday: number;
|
|
1252
|
-
openMinute: number;
|
|
1253
|
-
closeMinute: number;
|
|
1254
|
-
}
|
|
1255
|
-
interface BookingRulesInput {
|
|
1256
|
-
ratePeriod: BookingRatePeriod | `${BookingRatePeriod}`;
|
|
1257
|
-
slot: {
|
|
1258
|
-
lengthMinutes: number;
|
|
1259
|
-
bufferMinutes?: number;
|
|
1260
|
-
minimumToRun?: number;
|
|
1261
|
-
minStay?: number;
|
|
1262
|
-
maxStay?: number;
|
|
1263
|
-
sharedAcrossProducts?: boolean;
|
|
1264
|
-
};
|
|
1265
|
-
window: {
|
|
1266
|
-
maxAdvanceDays?: number;
|
|
1267
|
-
minNoticeMinutes?: number;
|
|
1268
|
-
holdMinutes?: number;
|
|
1269
|
-
bookableFrom?: Date | string | null;
|
|
1270
|
-
bookableTo?: Date | string | null;
|
|
1271
|
-
};
|
|
1272
|
-
availability: {
|
|
1273
|
-
weeklyHours?: WeeklyHours[];
|
|
1274
|
-
offMarket?: {
|
|
1275
|
-
from: Date | string;
|
|
1276
|
-
to: Date | string;
|
|
1277
|
-
}[];
|
|
1278
|
-
arrivalDays?: number[];
|
|
1279
|
-
availableFrom?: Date | string | null;
|
|
1280
|
-
};
|
|
1281
|
-
checkInTime?: string | null;
|
|
1282
|
-
checkOutTime?: string | null;
|
|
1283
|
-
}
|
|
1284
|
-
interface BusyWindow {
|
|
1285
|
-
startAt: Date;
|
|
1286
|
-
bufferEndAt: Date;
|
|
1287
|
-
}
|
|
1288
|
-
interface GridSlot {
|
|
1289
|
-
startAt: Date;
|
|
1290
|
-
endAt: Date;
|
|
1291
|
-
bufferEndAt: Date;
|
|
1292
|
-
canStart: boolean;
|
|
1293
|
-
}
|
|
1294
|
-
declare class BookingRulesError extends Error {
|
|
1295
|
-
constructor(message: string);
|
|
1296
|
-
}
|
|
1297
|
-
|
|
1298
|
-
declare function windowEndsAt(rule: BookingRulesInput, now: Date): Date | null;
|
|
1299
|
-
declare function buildGrid(rule: BookingRulesInput, timeZone: string, from: Date, to: Date, now: Date, busy?: BusyWindow[]): GridSlot[];
|
|
1300
|
-
declare function slotsForWindow(grid: GridSlot[], startAt: Date, endAt: Date): GridSlot[];
|
|
1301
|
-
|
|
1302
|
-
interface BookingOccupancy {
|
|
1303
|
-
resourceId: string;
|
|
1304
|
-
productId: string;
|
|
1305
|
-
qty: number;
|
|
1306
|
-
startAt: Date;
|
|
1307
|
-
bufferEndAt: Date;
|
|
1308
|
-
}
|
|
1309
|
-
interface BookingResourceInput {
|
|
1310
|
-
id: string;
|
|
1311
|
-
name: string;
|
|
1312
|
-
seats?: number | null;
|
|
1313
|
-
timeZone: string;
|
|
1314
|
-
presence?: WeeklyHours[] | null;
|
|
1315
|
-
}
|
|
1316
|
-
interface ResourceAvailability {
|
|
1317
|
-
resourceId: string;
|
|
1318
|
-
name: string;
|
|
1319
|
-
capacity: number;
|
|
1320
|
-
booked: number;
|
|
1321
|
-
free: number;
|
|
1322
|
-
}
|
|
1323
|
-
interface AvailabilitySlot extends GridSlot {
|
|
1324
|
-
capacity: number;
|
|
1325
|
-
booked: number;
|
|
1326
|
-
free: number;
|
|
1327
|
-
resources: ResourceAvailability[];
|
|
1328
|
-
}
|
|
1329
|
-
interface ResourceInWindow {
|
|
1330
|
-
resourceId: string;
|
|
1331
|
-
name: string;
|
|
1332
|
-
slots: number;
|
|
1333
|
-
free: number;
|
|
1334
|
-
state: ResourceAvailabilityState;
|
|
1335
|
-
}
|
|
1336
|
-
interface AvailabilityInput {
|
|
1337
|
-
productId: string;
|
|
1338
|
-
bookingRulesId?: string;
|
|
1339
|
-
bookingType?: BookingType;
|
|
1340
|
-
rule: BookingRulesInput;
|
|
1341
|
-
resources: BookingResourceInput[];
|
|
1342
|
-
occupied: BookingOccupancy[];
|
|
1343
|
-
from: Date;
|
|
1344
|
-
to: Date;
|
|
1345
|
-
now: Date;
|
|
1346
|
-
}
|
|
1347
|
-
declare const withinPresence: (slot: GridSlot, timeZone: string, presence?: WeeklyHours[] | null) => boolean;
|
|
1348
|
-
declare function occupancyIn(occupied: BookingOccupancy[], productId: string, startAt: Date, bufferEndAt: Date, shared: boolean): {
|
|
1349
|
-
taken: number;
|
|
1350
|
-
foreignProductId?: string;
|
|
1351
|
-
};
|
|
1352
|
-
declare function buildAvailability({ productId, bookingRulesId, bookingType, rule, resources, occupied, from, to, now, }: AvailabilityInput): {
|
|
1353
|
-
resources: ResourceInWindow[];
|
|
1354
|
-
slots: AvailabilitySlot[];
|
|
1355
|
-
productId: string;
|
|
1356
|
-
bookingRulesId: string | undefined;
|
|
1357
|
-
bookingType: BookingType | undefined;
|
|
1358
|
-
ratePeriod: "slot" | "day" | "night" | "week" | "month" | BookingRatePeriod;
|
|
1359
|
-
minimumToRun: number | undefined;
|
|
1360
|
-
minStay: number | undefined;
|
|
1361
|
-
maxStay: number | undefined;
|
|
1362
|
-
bookableUntil: Date | null;
|
|
1363
|
-
beyondWindow: boolean;
|
|
1364
|
-
};
|
|
1365
|
-
interface ResourcePresenceRow {
|
|
1366
|
-
resourceId: string;
|
|
1367
|
-
outletId: string;
|
|
1368
|
-
weeklyHours?: WeeklyHours[] | null;
|
|
1369
|
-
}
|
|
1370
|
-
declare function presentAt<T extends {
|
|
1371
|
-
id: string;
|
|
1372
|
-
}>(resources: T[], rows: ResourcePresenceRow[], outletId?: string): {
|
|
1373
|
-
resource: T;
|
|
1374
|
-
presence?: WeeklyHours[] | null;
|
|
1375
|
-
}[];
|
|
1376
|
-
|
|
1377
|
-
declare const DEFAULT_HOLD_MINUTES = 10;
|
|
1378
|
-
interface PlanWindowInput {
|
|
1379
|
-
rule: BookingRulesInput;
|
|
1380
|
-
timeZone: string;
|
|
1381
|
-
presence?: WeeklyHours[] | null;
|
|
1382
|
-
startAt: Date;
|
|
1383
|
-
endAt: Date;
|
|
1384
|
-
now: Date;
|
|
1385
|
-
busy?: BusyWindow[];
|
|
1386
|
-
}
|
|
1387
|
-
declare function planWindow({ rule, timeZone, presence, startAt, endAt, now, busy }: PlanWindowInput): {
|
|
1388
|
-
slots: GridSlot[];
|
|
1389
|
-
endAt: Date;
|
|
1390
|
-
bufferEndAt: Date;
|
|
1391
|
-
};
|
|
1392
|
-
declare const holdExpiresAt: (rule: BookingRulesInput, now: Date) => Date;
|
|
1393
|
-
|
|
1394
1203
|
declare const ADYEN_ROLLOUT_COUNTRY_CODES: Set<string>;
|
|
1395
1204
|
declare function isAdyenRolloutCountry(alpha2: string): boolean;
|
|
1205
|
+
declare const ADYEN_STORE_STATE_PROVINCE_COUNTRIES: Set<string>;
|
|
1206
|
+
declare function adyenStoreRequiresStateOrProvince(alpha2: string | undefined): boolean;
|
|
1207
|
+
declare const ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES: Set<string>;
|
|
1208
|
+
declare function adyenLegalEntityRequiresStateOrProvince(alpha2: string | undefined): boolean;
|
|
1209
|
+
declare const ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES: Set<string>;
|
|
1210
|
+
declare function adyenSupportsTaxNumberAbsent(alpha2: string | undefined): boolean;
|
|
1211
|
+
declare const ADYEN_TAX_NUMBER_FORMATS: Record<string, {
|
|
1212
|
+
pattern: RegExp;
|
|
1213
|
+
length: number;
|
|
1214
|
+
}>;
|
|
1215
|
+
declare function adyenTaxNumberFormat(alpha2: string | undefined): {
|
|
1216
|
+
pattern: RegExp;
|
|
1217
|
+
length: number;
|
|
1218
|
+
} | undefined;
|
|
1219
|
+
declare const ADYEN_TAX_NUMBER_MIN_LENGTH = 5;
|
|
1220
|
+
declare const ADYEN_JOB_TITLE_ASSOCIATION_TYPES: readonly string[];
|
|
1221
|
+
declare function adyenRequiresJobTitle(associationType: string): boolean;
|
|
1396
1222
|
|
|
1397
1223
|
interface CurrencyRate {
|
|
1398
1224
|
rate: number;
|
|
@@ -1405,4 +1231,4 @@ declare const EUFixedRates: Record<string, CurrencyRate>;
|
|
|
1405
1231
|
declare const OtherFixedRates: Record<string, CurrencyRate>;
|
|
1406
1232
|
declare const COUNTRY_CURRENCIES: Record<string, string>;
|
|
1407
1233
|
|
|
1408
|
-
export {
|
|
1234
|
+
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, 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, adyenLegalEntityRequiresStateOrProvince, adyenRequiresJobTitle, adyenStoreRequiresStateOrProvince, adyenSupportsTaxNumberAbsent, adyenTaxNumberFormat, 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;
|
|
@@ -821,13 +783,6 @@ interface OrderLineItem {
|
|
|
821
783
|
returnedQuantity?: number;
|
|
822
784
|
[key: string]: unknown;
|
|
823
785
|
}
|
|
824
|
-
interface OrderReservationForContext {
|
|
825
|
-
internalId?: string;
|
|
826
|
-
quantity?: number;
|
|
827
|
-
fulfilledQuantity?: number;
|
|
828
|
-
returnedQuantity?: number;
|
|
829
|
-
[key: string]: unknown;
|
|
830
|
-
}
|
|
831
786
|
interface SplitPaymentPayment {
|
|
832
787
|
amount?: number;
|
|
833
788
|
[key: string]: unknown;
|
|
@@ -843,7 +798,6 @@ interface OrderContext {
|
|
|
843
798
|
paymentMethods: OrderPaymentMethod[];
|
|
844
799
|
refunds: OrderRefund[];
|
|
845
800
|
lineItems: OrderLineItem[];
|
|
846
|
-
reservations: OrderReservationForContext[];
|
|
847
801
|
};
|
|
848
802
|
computed: {
|
|
849
803
|
balance: number;
|
|
@@ -957,7 +911,6 @@ interface OrderLikeForContext {
|
|
|
957
911
|
refunds?: OrderRefund[];
|
|
958
912
|
refund?: OrderRefund[];
|
|
959
913
|
lineItems?: OrderLineItem[];
|
|
960
|
-
reservations?: OrderReservationForContext[];
|
|
961
914
|
}
|
|
962
915
|
interface OrderLikeForLegacyInference extends OrderLikeForContext {
|
|
963
916
|
status?: string;
|
|
@@ -1247,152 +1200,25 @@ interface ConfigUpdatedPayload {
|
|
|
1247
1200
|
}
|
|
1248
1201
|
type OrderStateEventPayload = StateTransitionCompletedPayload | StateTransitionBlockedPayload | ConfigUpdatedPayload;
|
|
1249
1202
|
|
|
1250
|
-
interface WeeklyHours {
|
|
1251
|
-
weekday: number;
|
|
1252
|
-
openMinute: number;
|
|
1253
|
-
closeMinute: number;
|
|
1254
|
-
}
|
|
1255
|
-
interface BookingRulesInput {
|
|
1256
|
-
ratePeriod: BookingRatePeriod | `${BookingRatePeriod}`;
|
|
1257
|
-
slot: {
|
|
1258
|
-
lengthMinutes: number;
|
|
1259
|
-
bufferMinutes?: number;
|
|
1260
|
-
minimumToRun?: number;
|
|
1261
|
-
minStay?: number;
|
|
1262
|
-
maxStay?: number;
|
|
1263
|
-
sharedAcrossProducts?: boolean;
|
|
1264
|
-
};
|
|
1265
|
-
window: {
|
|
1266
|
-
maxAdvanceDays?: number;
|
|
1267
|
-
minNoticeMinutes?: number;
|
|
1268
|
-
holdMinutes?: number;
|
|
1269
|
-
bookableFrom?: Date | string | null;
|
|
1270
|
-
bookableTo?: Date | string | null;
|
|
1271
|
-
};
|
|
1272
|
-
availability: {
|
|
1273
|
-
weeklyHours?: WeeklyHours[];
|
|
1274
|
-
offMarket?: {
|
|
1275
|
-
from: Date | string;
|
|
1276
|
-
to: Date | string;
|
|
1277
|
-
}[];
|
|
1278
|
-
arrivalDays?: number[];
|
|
1279
|
-
availableFrom?: Date | string | null;
|
|
1280
|
-
};
|
|
1281
|
-
checkInTime?: string | null;
|
|
1282
|
-
checkOutTime?: string | null;
|
|
1283
|
-
}
|
|
1284
|
-
interface BusyWindow {
|
|
1285
|
-
startAt: Date;
|
|
1286
|
-
bufferEndAt: Date;
|
|
1287
|
-
}
|
|
1288
|
-
interface GridSlot {
|
|
1289
|
-
startAt: Date;
|
|
1290
|
-
endAt: Date;
|
|
1291
|
-
bufferEndAt: Date;
|
|
1292
|
-
canStart: boolean;
|
|
1293
|
-
}
|
|
1294
|
-
declare class BookingRulesError extends Error {
|
|
1295
|
-
constructor(message: string);
|
|
1296
|
-
}
|
|
1297
|
-
|
|
1298
|
-
declare function windowEndsAt(rule: BookingRulesInput, now: Date): Date | null;
|
|
1299
|
-
declare function buildGrid(rule: BookingRulesInput, timeZone: string, from: Date, to: Date, now: Date, busy?: BusyWindow[]): GridSlot[];
|
|
1300
|
-
declare function slotsForWindow(grid: GridSlot[], startAt: Date, endAt: Date): GridSlot[];
|
|
1301
|
-
|
|
1302
|
-
interface BookingOccupancy {
|
|
1303
|
-
resourceId: string;
|
|
1304
|
-
productId: string;
|
|
1305
|
-
qty: number;
|
|
1306
|
-
startAt: Date;
|
|
1307
|
-
bufferEndAt: Date;
|
|
1308
|
-
}
|
|
1309
|
-
interface BookingResourceInput {
|
|
1310
|
-
id: string;
|
|
1311
|
-
name: string;
|
|
1312
|
-
seats?: number | null;
|
|
1313
|
-
timeZone: string;
|
|
1314
|
-
presence?: WeeklyHours[] | null;
|
|
1315
|
-
}
|
|
1316
|
-
interface ResourceAvailability {
|
|
1317
|
-
resourceId: string;
|
|
1318
|
-
name: string;
|
|
1319
|
-
capacity: number;
|
|
1320
|
-
booked: number;
|
|
1321
|
-
free: number;
|
|
1322
|
-
}
|
|
1323
|
-
interface AvailabilitySlot extends GridSlot {
|
|
1324
|
-
capacity: number;
|
|
1325
|
-
booked: number;
|
|
1326
|
-
free: number;
|
|
1327
|
-
resources: ResourceAvailability[];
|
|
1328
|
-
}
|
|
1329
|
-
interface ResourceInWindow {
|
|
1330
|
-
resourceId: string;
|
|
1331
|
-
name: string;
|
|
1332
|
-
slots: number;
|
|
1333
|
-
free: number;
|
|
1334
|
-
state: ResourceAvailabilityState;
|
|
1335
|
-
}
|
|
1336
|
-
interface AvailabilityInput {
|
|
1337
|
-
productId: string;
|
|
1338
|
-
bookingRulesId?: string;
|
|
1339
|
-
bookingType?: BookingType;
|
|
1340
|
-
rule: BookingRulesInput;
|
|
1341
|
-
resources: BookingResourceInput[];
|
|
1342
|
-
occupied: BookingOccupancy[];
|
|
1343
|
-
from: Date;
|
|
1344
|
-
to: Date;
|
|
1345
|
-
now: Date;
|
|
1346
|
-
}
|
|
1347
|
-
declare const withinPresence: (slot: GridSlot, timeZone: string, presence?: WeeklyHours[] | null) => boolean;
|
|
1348
|
-
declare function occupancyIn(occupied: BookingOccupancy[], productId: string, startAt: Date, bufferEndAt: Date, shared: boolean): {
|
|
1349
|
-
taken: number;
|
|
1350
|
-
foreignProductId?: string;
|
|
1351
|
-
};
|
|
1352
|
-
declare function buildAvailability({ productId, bookingRulesId, bookingType, rule, resources, occupied, from, to, now, }: AvailabilityInput): {
|
|
1353
|
-
resources: ResourceInWindow[];
|
|
1354
|
-
slots: AvailabilitySlot[];
|
|
1355
|
-
productId: string;
|
|
1356
|
-
bookingRulesId: string | undefined;
|
|
1357
|
-
bookingType: BookingType | undefined;
|
|
1358
|
-
ratePeriod: "slot" | "day" | "night" | "week" | "month" | BookingRatePeriod;
|
|
1359
|
-
minimumToRun: number | undefined;
|
|
1360
|
-
minStay: number | undefined;
|
|
1361
|
-
maxStay: number | undefined;
|
|
1362
|
-
bookableUntil: Date | null;
|
|
1363
|
-
beyondWindow: boolean;
|
|
1364
|
-
};
|
|
1365
|
-
interface ResourcePresenceRow {
|
|
1366
|
-
resourceId: string;
|
|
1367
|
-
outletId: string;
|
|
1368
|
-
weeklyHours?: WeeklyHours[] | null;
|
|
1369
|
-
}
|
|
1370
|
-
declare function presentAt<T extends {
|
|
1371
|
-
id: string;
|
|
1372
|
-
}>(resources: T[], rows: ResourcePresenceRow[], outletId?: string): {
|
|
1373
|
-
resource: T;
|
|
1374
|
-
presence?: WeeklyHours[] | null;
|
|
1375
|
-
}[];
|
|
1376
|
-
|
|
1377
|
-
declare const DEFAULT_HOLD_MINUTES = 10;
|
|
1378
|
-
interface PlanWindowInput {
|
|
1379
|
-
rule: BookingRulesInput;
|
|
1380
|
-
timeZone: string;
|
|
1381
|
-
presence?: WeeklyHours[] | null;
|
|
1382
|
-
startAt: Date;
|
|
1383
|
-
endAt: Date;
|
|
1384
|
-
now: Date;
|
|
1385
|
-
busy?: BusyWindow[];
|
|
1386
|
-
}
|
|
1387
|
-
declare function planWindow({ rule, timeZone, presence, startAt, endAt, now, busy }: PlanWindowInput): {
|
|
1388
|
-
slots: GridSlot[];
|
|
1389
|
-
endAt: Date;
|
|
1390
|
-
bufferEndAt: Date;
|
|
1391
|
-
};
|
|
1392
|
-
declare const holdExpiresAt: (rule: BookingRulesInput, now: Date) => Date;
|
|
1393
|
-
|
|
1394
1203
|
declare const ADYEN_ROLLOUT_COUNTRY_CODES: Set<string>;
|
|
1395
1204
|
declare function isAdyenRolloutCountry(alpha2: string): boolean;
|
|
1205
|
+
declare const ADYEN_STORE_STATE_PROVINCE_COUNTRIES: Set<string>;
|
|
1206
|
+
declare function adyenStoreRequiresStateOrProvince(alpha2: string | undefined): boolean;
|
|
1207
|
+
declare const ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES: Set<string>;
|
|
1208
|
+
declare function adyenLegalEntityRequiresStateOrProvince(alpha2: string | undefined): boolean;
|
|
1209
|
+
declare const ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES: Set<string>;
|
|
1210
|
+
declare function adyenSupportsTaxNumberAbsent(alpha2: string | undefined): boolean;
|
|
1211
|
+
declare const ADYEN_TAX_NUMBER_FORMATS: Record<string, {
|
|
1212
|
+
pattern: RegExp;
|
|
1213
|
+
length: number;
|
|
1214
|
+
}>;
|
|
1215
|
+
declare function adyenTaxNumberFormat(alpha2: string | undefined): {
|
|
1216
|
+
pattern: RegExp;
|
|
1217
|
+
length: number;
|
|
1218
|
+
} | undefined;
|
|
1219
|
+
declare const ADYEN_TAX_NUMBER_MIN_LENGTH = 5;
|
|
1220
|
+
declare const ADYEN_JOB_TITLE_ASSOCIATION_TYPES: readonly string[];
|
|
1221
|
+
declare function adyenRequiresJobTitle(associationType: string): boolean;
|
|
1396
1222
|
|
|
1397
1223
|
interface CurrencyRate {
|
|
1398
1224
|
rate: number;
|
|
@@ -1405,4 +1231,4 @@ declare const EUFixedRates: Record<string, CurrencyRate>;
|
|
|
1405
1231
|
declare const OtherFixedRates: Record<string, CurrencyRate>;
|
|
1406
1232
|
declare const COUNTRY_CURRENCIES: Record<string, string>;
|
|
1407
1233
|
|
|
1408
|
-
export {
|
|
1234
|
+
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, 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, adyenLegalEntityRequiresStateOrProvince, adyenRequiresJobTitle, adyenStoreRequiresStateOrProvince, adyenSupportsTaxNumberAbsent, adyenTaxNumberFormat, 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 };
|