@final-commerce/common 2.12.0-staging.4 → 2.12.0-staging.5
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 +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +56 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +54 -10
- package/dist/index.mjs.map +1 -1
- 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
|
@@ -443,6 +443,10 @@ declare enum BookingSessionSale {
|
|
|
443
443
|
SESSION = "session",
|
|
444
444
|
COURSE = "course"
|
|
445
445
|
}
|
|
446
|
+
declare enum BookingArriveLeave {
|
|
447
|
+
SET_TIMES = "set-times",
|
|
448
|
+
OPENING_HOURS = "opening-hours"
|
|
449
|
+
}
|
|
446
450
|
declare enum BookingResourceKind {
|
|
447
451
|
ASSET = "asset",
|
|
448
452
|
ROOM = "room",
|
|
@@ -1667,6 +1671,7 @@ interface BookingTimeSlots {
|
|
|
1667
1671
|
interface BookingDateRanges {
|
|
1668
1672
|
weeklyHours?: WeeklyHours[];
|
|
1669
1673
|
arrivalDays?: number[];
|
|
1674
|
+
arriveLeave?: BookingArriveLeave | `${BookingArriveLeave}`;
|
|
1670
1675
|
checkInTime?: string | null;
|
|
1671
1676
|
checkOutTime?: string | null;
|
|
1672
1677
|
checkTimesByWeekday?: {
|
|
@@ -1752,6 +1757,7 @@ declare class BookingRulesError extends Error {
|
|
|
1752
1757
|
|
|
1753
1758
|
declare function windowEndsAt(rule: BookingRulesInput, now: Date): Date | null;
|
|
1754
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;
|
|
1755
1761
|
declare function maxAdvanceMinutesOf(rule: Pick<BookingRulesInput, 'window'>): number;
|
|
1756
1762
|
interface BookingRuleDurations {
|
|
1757
1763
|
buffer?: BookingDuration;
|
|
@@ -1944,6 +1950,7 @@ declare function buildAvailability({ productId, bookingRulesId, rule, resources,
|
|
|
1944
1950
|
course: ({
|
|
1945
1951
|
sessions: number;
|
|
1946
1952
|
alreadyStarted: boolean;
|
|
1953
|
+
beyondWindow: boolean;
|
|
1947
1954
|
sessionTimes: {
|
|
1948
1955
|
startAt: Date;
|
|
1949
1956
|
endAt: Date;
|
|
@@ -2183,4 +2190,4 @@ declare const EXPENSE_DEFAULT_CATEGORIES: readonly [{
|
|
|
2183
2190
|
}];
|
|
2184
2191
|
type ExpenseDefaultCategoryKey = (typeof EXPENSE_DEFAULT_CATEGORIES)[number]['key'];
|
|
2185
2192
|
|
|
2186
|
-
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 BookingDateRanges, type BookingDuration, type BookingDurationField, type BookingDurationProblem, type BookingDurationProblemKind, BookingDurationUnit, type BookingMethod, type BookingOccupancy, BookingRatePeriod, type BookingResourceInput, BookingResourceKind, BookingResourceStatus, type BookingRuleDurations, type BookingRuleInNewShape, type BookingRuleNewFields, type BookingRuleParts, BookingRulesError, type BookingRulesInput, BookingSessionSale, type BookingTimeSlots, 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_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 PlanCourseInput, 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, type RentalEndsInput, ReservationStatus, ResidualPaymentMethod, ResidualStatus, type ResolveInputs, type ResolveShippingInput, type ResolveTemplateResult, type ResourceAvailability, ResourceAvailabilityState, type ResourceInWindow, type ResourcePresenceRow, 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, 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, UNLIMITED_PLACES, UserTypes, type WeeklyHours, type WindowForPeriodsInput, addAmounts, addressPlaceKeys, adyenLegalEntityRequiresStateOrProvince, adyenRequiresJobTitle, adyenStoreRequiresStateOrProvince, adyenSupportsTaxNumberAbsent, adyenTaxNumberFormat, allowedDurationUnits, amountToString, ancestorChain, applyAssignment, assertUnitSane, availableIn, baseFor, baseFulfillmentDefinitions, baseOf, basePaymentDefinitions, bookingMethodOf, bookingRuleParts, buildAvailability, buildGrid, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, calendarDate, canTransition, capacityOf, cheapestCompositeItem, cheapestCompositePrice, checkPartySize, checkQtyPerBooking, compositeItemCost, compositeItemUnavailable, compositeMakeable, compositeModifierMismatches, compositeReservationMismatches, compositeVariantInStock, conditionSummary, convertFixedFeeToLocalCurrency, courseSessions, courseSpan, courseStarted, courseStartedInZone, createAmount, crossAxisRuleApplies, currentAssignees, deriveDisplayState, deriveFamilyCode, deriveUnitId, displayRuleMatchesPair, divideAmount, durationProblems, durationText, evaluateCondition, evaluateConditionSet, extendPrice, extendPriceFor, fewestFreeOver, 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, isSupportedCurrency, isSystemFamilyCode, isValidQuantity, isWhole, lineStockMoves, listCountries, listProvinces, listShippingCountries, longestMinutesOf, mapToLegacyStatus, maxAdvanceMinutesOf, maxPrecisionFor, mergeFragment, modifiersSellable, multiplyAmount, normalizeAddress, normalizeCityKey, normalizeCountry, normalizeMongoIdString, normalizePostCode, normalizeProvince, occupancyIn, occupiedAtOutlet, oldMaxAdvanceOf, orderAssignments, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, pickFreeResource, placeKey, planCourse, planWindow, poolDemand, poolOf, poolShortfall, poolStockAt, postCodeMatchesProvince, presentAt, priceForTotal, provincesForPostCode, removeFragment, rentalEnds, resolveFamily, resolveModifiersForProduct, resolveShipping, resolveTemplate, resolveUnit, roundToPrecision, ruleDurationsOf, ruleInNewShape, sameFamily, sessionCells, setOrderState, shipsToCountry, shopDayKey, shopDayRange, shortestMinutesOf, signReportForDisplay, slotsForWindow, soldAsCourse, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, validateOrderStatuses, validateShippingZone, violatesFinancialInvariant, windowEndsAt, windowEndsAtInZone, windowForPeriods, withinPresence };
|
|
2193
|
+
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, BookingArriveLeave, type BookingDateRanges, type BookingDuration, type BookingDurationField, type BookingDurationProblem, type BookingDurationProblemKind, BookingDurationUnit, type BookingMethod, type BookingOccupancy, BookingRatePeriod, type BookingResourceInput, BookingResourceKind, BookingResourceStatus, type BookingRuleDurations, type BookingRuleInNewShape, type BookingRuleNewFields, type BookingRuleParts, BookingRulesError, type BookingRulesInput, BookingSessionSale, type BookingTimeSlots, 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_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 PlanCourseInput, 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, type RentalEndsInput, ReservationStatus, ResidualPaymentMethod, ResidualStatus, type ResolveInputs, type ResolveShippingInput, type ResolveTemplateResult, type ResourceAvailability, ResourceAvailabilityState, type ResourceInWindow, type ResourcePresenceRow, 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, 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, UNLIMITED_PLACES, UserTypes, type WeeklyHours, type WindowForPeriodsInput, addAmounts, addressPlaceKeys, adyenLegalEntityRequiresStateOrProvince, adyenRequiresJobTitle, adyenStoreRequiresStateOrProvince, adyenSupportsTaxNumberAbsent, adyenTaxNumberFormat, allowedDurationUnits, amountToString, ancestorChain, applyAssignment, assertUnitSane, availableIn, baseFor, baseFulfillmentDefinitions, baseOf, basePaymentDefinitions, bookingMethodOf, bookingRuleParts, buildAvailability, buildGrid, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, calendarDate, canTransition, capacityOf, cheapestCompositeItem, cheapestCompositePrice, checkPartySize, checkQtyPerBooking, compositeItemCost, compositeItemUnavailable, compositeMakeable, compositeModifierMismatches, compositeReservationMismatches, compositeVariantInStock, conditionSummary, convertFixedFeeToLocalCurrency, courseSessions, courseSpan, courseStarted, courseStartedInZone, createAmount, crossAxisRuleApplies, currentAssignees, deriveDisplayState, deriveFamilyCode, deriveUnitId, displayRuleMatchesPair, divideAmount, durationProblems, durationText, evaluateCondition, evaluateConditionSet, extendPrice, extendPriceFor, fewestFreeOver, 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, isSupportedCurrency, isSystemFamilyCode, isValidQuantity, isWhole, lineStockMoves, listCountries, listProvinces, listShippingCountries, longestMinutesOf, mapToLegacyStatus, maxAdvanceMinutesOf, maxPrecisionFor, mergeFragment, modifiersSellable, multiplyAmount, normalizeAddress, normalizeCityKey, normalizeCountry, normalizeMongoIdString, normalizePostCode, normalizeProvince, occupancyIn, occupiedAtOutlet, oldMaxAdvanceOf, orderAssignments, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, pickFreeResource, placeKey, planCourse, planWindow, poolDemand, poolOf, poolShortfall, poolStockAt, postCodeMatchesProvince, presentAt, priceForTotal, provincesForPostCode, removeFragment, rentalEnds, resolveFamily, resolveModifiersForProduct, resolveShipping, resolveTemplate, resolveUnit, roundToPrecision, ruleDurationsOf, ruleInNewShape, sameFamily, sessionCells, setOrderState, shipsToCountry, shopDayKey, shopDayRange, shortestMinutesOf, signReportForDisplay, slotsForWindow, soldAsCourse, startsPastMaxAdvance, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, validateOrderStatuses, validateShippingZone, violatesFinancialInvariant, windowEndsAt, windowEndsAtInZone, windowForPeriods, withinPresence };
|
package/dist/index.d.ts
CHANGED
|
@@ -443,6 +443,10 @@ declare enum BookingSessionSale {
|
|
|
443
443
|
SESSION = "session",
|
|
444
444
|
COURSE = "course"
|
|
445
445
|
}
|
|
446
|
+
declare enum BookingArriveLeave {
|
|
447
|
+
SET_TIMES = "set-times",
|
|
448
|
+
OPENING_HOURS = "opening-hours"
|
|
449
|
+
}
|
|
446
450
|
declare enum BookingResourceKind {
|
|
447
451
|
ASSET = "asset",
|
|
448
452
|
ROOM = "room",
|
|
@@ -1667,6 +1671,7 @@ interface BookingTimeSlots {
|
|
|
1667
1671
|
interface BookingDateRanges {
|
|
1668
1672
|
weeklyHours?: WeeklyHours[];
|
|
1669
1673
|
arrivalDays?: number[];
|
|
1674
|
+
arriveLeave?: BookingArriveLeave | `${BookingArriveLeave}`;
|
|
1670
1675
|
checkInTime?: string | null;
|
|
1671
1676
|
checkOutTime?: string | null;
|
|
1672
1677
|
checkTimesByWeekday?: {
|
|
@@ -1752,6 +1757,7 @@ declare class BookingRulesError extends Error {
|
|
|
1752
1757
|
|
|
1753
1758
|
declare function windowEndsAt(rule: BookingRulesInput, now: Date): Date | null;
|
|
1754
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;
|
|
1755
1761
|
declare function maxAdvanceMinutesOf(rule: Pick<BookingRulesInput, 'window'>): number;
|
|
1756
1762
|
interface BookingRuleDurations {
|
|
1757
1763
|
buffer?: BookingDuration;
|
|
@@ -1944,6 +1950,7 @@ declare function buildAvailability({ productId, bookingRulesId, rule, resources,
|
|
|
1944
1950
|
course: ({
|
|
1945
1951
|
sessions: number;
|
|
1946
1952
|
alreadyStarted: boolean;
|
|
1953
|
+
beyondWindow: boolean;
|
|
1947
1954
|
sessionTimes: {
|
|
1948
1955
|
startAt: Date;
|
|
1949
1956
|
endAt: Date;
|
|
@@ -2183,4 +2190,4 @@ declare const EXPENSE_DEFAULT_CATEGORIES: readonly [{
|
|
|
2183
2190
|
}];
|
|
2184
2191
|
type ExpenseDefaultCategoryKey = (typeof EXPENSE_DEFAULT_CATEGORIES)[number]['key'];
|
|
2185
2192
|
|
|
2186
|
-
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 BookingDateRanges, type BookingDuration, type BookingDurationField, type BookingDurationProblem, type BookingDurationProblemKind, BookingDurationUnit, type BookingMethod, type BookingOccupancy, BookingRatePeriod, type BookingResourceInput, BookingResourceKind, BookingResourceStatus, type BookingRuleDurations, type BookingRuleInNewShape, type BookingRuleNewFields, type BookingRuleParts, BookingRulesError, type BookingRulesInput, BookingSessionSale, type BookingTimeSlots, 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_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 PlanCourseInput, 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, type RentalEndsInput, ReservationStatus, ResidualPaymentMethod, ResidualStatus, type ResolveInputs, type ResolveShippingInput, type ResolveTemplateResult, type ResourceAvailability, ResourceAvailabilityState, type ResourceInWindow, type ResourcePresenceRow, 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, 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, UNLIMITED_PLACES, UserTypes, type WeeklyHours, type WindowForPeriodsInput, addAmounts, addressPlaceKeys, adyenLegalEntityRequiresStateOrProvince, adyenRequiresJobTitle, adyenStoreRequiresStateOrProvince, adyenSupportsTaxNumberAbsent, adyenTaxNumberFormat, allowedDurationUnits, amountToString, ancestorChain, applyAssignment, assertUnitSane, availableIn, baseFor, baseFulfillmentDefinitions, baseOf, basePaymentDefinitions, bookingMethodOf, bookingRuleParts, buildAvailability, buildGrid, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, calendarDate, canTransition, capacityOf, cheapestCompositeItem, cheapestCompositePrice, checkPartySize, checkQtyPerBooking, compositeItemCost, compositeItemUnavailable, compositeMakeable, compositeModifierMismatches, compositeReservationMismatches, compositeVariantInStock, conditionSummary, convertFixedFeeToLocalCurrency, courseSessions, courseSpan, courseStarted, courseStartedInZone, createAmount, crossAxisRuleApplies, currentAssignees, deriveDisplayState, deriveFamilyCode, deriveUnitId, displayRuleMatchesPair, divideAmount, durationProblems, durationText, evaluateCondition, evaluateConditionSet, extendPrice, extendPriceFor, fewestFreeOver, 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, isSupportedCurrency, isSystemFamilyCode, isValidQuantity, isWhole, lineStockMoves, listCountries, listProvinces, listShippingCountries, longestMinutesOf, mapToLegacyStatus, maxAdvanceMinutesOf, maxPrecisionFor, mergeFragment, modifiersSellable, multiplyAmount, normalizeAddress, normalizeCityKey, normalizeCountry, normalizeMongoIdString, normalizePostCode, normalizeProvince, occupancyIn, occupiedAtOutlet, oldMaxAdvanceOf, orderAssignments, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, pickFreeResource, placeKey, planCourse, planWindow, poolDemand, poolOf, poolShortfall, poolStockAt, postCodeMatchesProvince, presentAt, priceForTotal, provincesForPostCode, removeFragment, rentalEnds, resolveFamily, resolveModifiersForProduct, resolveShipping, resolveTemplate, resolveUnit, roundToPrecision, ruleDurationsOf, ruleInNewShape, sameFamily, sessionCells, setOrderState, shipsToCountry, shopDayKey, shopDayRange, shortestMinutesOf, signReportForDisplay, slotsForWindow, soldAsCourse, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, validateOrderStatuses, validateShippingZone, violatesFinancialInvariant, windowEndsAt, windowEndsAtInZone, windowForPeriods, withinPresence };
|
|
2193
|
+
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, BookingArriveLeave, type BookingDateRanges, type BookingDuration, type BookingDurationField, type BookingDurationProblem, type BookingDurationProblemKind, BookingDurationUnit, type BookingMethod, type BookingOccupancy, BookingRatePeriod, type BookingResourceInput, BookingResourceKind, BookingResourceStatus, type BookingRuleDurations, type BookingRuleInNewShape, type BookingRuleNewFields, type BookingRuleParts, BookingRulesError, type BookingRulesInput, BookingSessionSale, type BookingTimeSlots, 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_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 PlanCourseInput, 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, type RentalEndsInput, ReservationStatus, ResidualPaymentMethod, ResidualStatus, type ResolveInputs, type ResolveShippingInput, type ResolveTemplateResult, type ResourceAvailability, ResourceAvailabilityState, type ResourceInWindow, type ResourcePresenceRow, 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, 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, UNLIMITED_PLACES, UserTypes, type WeeklyHours, type WindowForPeriodsInput, addAmounts, addressPlaceKeys, adyenLegalEntityRequiresStateOrProvince, adyenRequiresJobTitle, adyenStoreRequiresStateOrProvince, adyenSupportsTaxNumberAbsent, adyenTaxNumberFormat, allowedDurationUnits, amountToString, ancestorChain, applyAssignment, assertUnitSane, availableIn, baseFor, baseFulfillmentDefinitions, baseOf, basePaymentDefinitions, bookingMethodOf, bookingRuleParts, buildAvailability, buildGrid, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, calendarDate, canTransition, capacityOf, cheapestCompositeItem, cheapestCompositePrice, checkPartySize, checkQtyPerBooking, compositeItemCost, compositeItemUnavailable, compositeMakeable, compositeModifierMismatches, compositeReservationMismatches, compositeVariantInStock, conditionSummary, convertFixedFeeToLocalCurrency, courseSessions, courseSpan, courseStarted, courseStartedInZone, createAmount, crossAxisRuleApplies, currentAssignees, deriveDisplayState, deriveFamilyCode, deriveUnitId, displayRuleMatchesPair, divideAmount, durationProblems, durationText, evaluateCondition, evaluateConditionSet, extendPrice, extendPriceFor, fewestFreeOver, 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, isSupportedCurrency, isSystemFamilyCode, isValidQuantity, isWhole, lineStockMoves, listCountries, listProvinces, listShippingCountries, longestMinutesOf, mapToLegacyStatus, maxAdvanceMinutesOf, maxPrecisionFor, mergeFragment, modifiersSellable, multiplyAmount, normalizeAddress, normalizeCityKey, normalizeCountry, normalizeMongoIdString, normalizePostCode, normalizeProvince, occupancyIn, occupiedAtOutlet, oldMaxAdvanceOf, orderAssignments, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, pickFreeResource, placeKey, planCourse, planWindow, poolDemand, poolOf, poolShortfall, poolStockAt, postCodeMatchesProvince, presentAt, priceForTotal, provincesForPostCode, removeFragment, rentalEnds, resolveFamily, resolveModifiersForProduct, resolveShipping, resolveTemplate, resolveUnit, roundToPrecision, ruleDurationsOf, ruleInNewShape, sameFamily, sessionCells, setOrderState, shipsToCountry, shopDayKey, shopDayRange, shortestMinutesOf, signReportForDisplay, slotsForWindow, soldAsCourse, startsPastMaxAdvance, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, validateOrderStatuses, validateShippingZone, violatesFinancialInvariant, windowEndsAt, windowEndsAtInZone, windowForPeriods, withinPresence };
|
package/dist/index.js
CHANGED
|
@@ -31,6 +31,7 @@ __export(index_exports, {
|
|
|
31
31
|
AttributeType: () => AttributeType,
|
|
32
32
|
BNPL_METHOD_STATUS: () => BNPL_METHOD_STATUS,
|
|
33
33
|
BNPL_SKIP_REASON: () => BNPL_SKIP_REASON,
|
|
34
|
+
BookingArriveLeave: () => BookingArriveLeave,
|
|
34
35
|
BookingDurationUnit: () => BookingDurationUnit,
|
|
35
36
|
BookingRatePeriod: () => BookingRatePeriod,
|
|
36
37
|
BookingResourceKind: () => BookingResourceKind,
|
|
@@ -280,6 +281,7 @@ __export(index_exports, {
|
|
|
280
281
|
signReportForDisplay: () => signReportForDisplay,
|
|
281
282
|
slotsForWindow: () => slotsForWindow,
|
|
282
283
|
soldAsCourse: () => soldAsCourse,
|
|
284
|
+
startsPastMaxAdvance: () => startsPastMaxAdvance,
|
|
283
285
|
stringifyMinorUnits: () => stringifyMinorUnits,
|
|
284
286
|
subtractAmounts: () => subtractAmounts,
|
|
285
287
|
toBase: () => toBase,
|
|
@@ -783,6 +785,11 @@ var BookingSessionSale = /* @__PURE__ */ ((BookingSessionSale2) => {
|
|
|
783
785
|
BookingSessionSale2["COURSE"] = "course";
|
|
784
786
|
return BookingSessionSale2;
|
|
785
787
|
})(BookingSessionSale || {});
|
|
788
|
+
var BookingArriveLeave = /* @__PURE__ */ ((BookingArriveLeave2) => {
|
|
789
|
+
BookingArriveLeave2["SET_TIMES"] = "set-times";
|
|
790
|
+
BookingArriveLeave2["OPENING_HOURS"] = "opening-hours";
|
|
791
|
+
return BookingArriveLeave2;
|
|
792
|
+
})(BookingArriveLeave || {});
|
|
786
793
|
var BookingResourceKind = /* @__PURE__ */ ((BookingResourceKind2) => {
|
|
787
794
|
BookingResourceKind2["ASSET"] = "asset";
|
|
788
795
|
BookingResourceKind2["ROOM"] = "room";
|
|
@@ -3825,7 +3832,7 @@ function buildAvailability({
|
|
|
3825
3832
|
// The per-booking limits, so a stepper is bounded by the rules (G7) instead of a number in the flow.
|
|
3826
3833
|
maxQtyPerBooking: rule.slot.maxQtyPerBooking,
|
|
3827
3834
|
maxPartySize: rule.slot.maxPartySize,
|
|
3828
|
-
// Why a day can come back empty. Past this instant the rule refuses
|
|
3835
|
+
// Why a day can come back empty. Past this instant the rule refuses every start, so the UI
|
|
3829
3836
|
// can say "beyond the booking window" where it would otherwise claim "nothing free".
|
|
3830
3837
|
bookableUntil,
|
|
3831
3838
|
// The comparison itself, not just the boundary: deciding whether a day lies past the
|
|
@@ -3908,6 +3915,7 @@ function courseAvailability(rule, resources, byResource, productId, shared, now)
|
|
|
3908
3915
|
if (resources.length === 0) return void 0;
|
|
3909
3916
|
const sessions = courseSessions(rule, resources[0].timeZone);
|
|
3910
3917
|
const alreadyStarted = courseStartedInZone(rule, sessions, now, resources[0].timeZone);
|
|
3918
|
+
const beyondWindow = startsPastMaxAdvance(rule, sessions[0].startAt, now, resources[0].timeZone);
|
|
3911
3919
|
const free = resources.map((resource) => {
|
|
3912
3920
|
const mine = byResource.get(resource.id) ?? [];
|
|
3913
3921
|
const everySession = sessions.every((session) => withinPresence(session, resource.timeZone, resource.presence));
|
|
@@ -3915,13 +3923,14 @@ function courseAvailability(rule, resources, byResource, productId, shared, now)
|
|
|
3915
3923
|
const { taken, foreignProductId } = occupancyIn(mine, productId, session.startAt, session.bufferEndAt, shared);
|
|
3916
3924
|
return foreignProductId ? 0 : Math.max(capacityOf(rule, resource) - taken, 0);
|
|
3917
3925
|
});
|
|
3918
|
-
const fewest = everySession && !alreadyStarted ? Math.min(...freePerSession) : 0;
|
|
3926
|
+
const fewest = everySession && !alreadyStarted && !beyondWindow ? Math.min(...freePerSession) : 0;
|
|
3919
3927
|
return Number.isFinite(fewest) ? { resourceId: resource.id, free: fewest } : { resourceId: resource.id, free: UNLIMITED_PLACES, unlimited: true };
|
|
3920
3928
|
});
|
|
3921
3929
|
return withMaxQtyNow(
|
|
3922
3930
|
{
|
|
3923
3931
|
sessions: sessions.length,
|
|
3924
3932
|
alreadyStarted,
|
|
3933
|
+
beyondWindow,
|
|
3925
3934
|
sessionTimes: sessions.map(({ startAt, endAt }) => ({ startAt, endAt })),
|
|
3926
3935
|
startAt: sessions[0].startAt,
|
|
3927
3936
|
endAt: sessions[sessions.length - 1].endAt,
|
|
@@ -4066,6 +4075,7 @@ function noticeAboveAdvance({
|
|
|
4066
4075
|
// booking/plan.ts
|
|
4067
4076
|
var DEFAULT_HOLD_MINUTES = 10;
|
|
4068
4077
|
function planWindow({ rule, timeZone, presence, startAt, endAt, now, busy = [] }) {
|
|
4078
|
+
if (!soldAsCourse(rule)) checkStartWithinMaxAdvance(rule, timeZone, startAt, now);
|
|
4069
4079
|
const grid = buildGrid(rule, timeZone, startAt, endAt, now, busy).filter(
|
|
4070
4080
|
(slot) => withinPresence(slot, timeZone, presence)
|
|
4071
4081
|
);
|
|
@@ -4079,6 +4089,11 @@ function planWindow({ rule, timeZone, presence, startAt, endAt, now, busy = [] }
|
|
|
4079
4089
|
const bufferEndAt = rule.ratePeriod === "hour" /* HOUR */ || wholePeriods ? buffer ? addDuration(last.endAt, buffer, timeZone) : new Date(last.endAt.getTime()) : last.bufferEndAt;
|
|
4080
4090
|
return { slots, periods, endAt: last.endAt, bufferEndAt };
|
|
4081
4091
|
}
|
|
4092
|
+
function checkStartWithinMaxAdvance(rule, timeZone, startAt, now) {
|
|
4093
|
+
if (startsPastMaxAdvance(rule, startAt, now, timeZone)) {
|
|
4094
|
+
throw new BookingRulesError(`${startAt.toISOString()} is past the booking window of these rules`);
|
|
4095
|
+
}
|
|
4096
|
+
}
|
|
4082
4097
|
function checkStay(parts, timeZone, startAt, periods) {
|
|
4083
4098
|
if (parts.method !== "date-ranges") return;
|
|
4084
4099
|
const stay = { count: periods, unit: periodUnitOf(parts) };
|
|
@@ -4111,6 +4126,7 @@ function windowForPeriods({ rule, timeZone, startAt, periods, now }) {
|
|
|
4111
4126
|
if (!Number.isInteger(periods) || periods < 1) {
|
|
4112
4127
|
throw new BookingRulesError(`periods must be a whole number of at least 1, got ${String(periods)}`);
|
|
4113
4128
|
}
|
|
4129
|
+
checkStartWithinMaxAdvance(rule, timeZone, startAt, now);
|
|
4114
4130
|
const parts = bookingRuleParts(rule);
|
|
4115
4131
|
checkStay(parts, timeZone, startAt, periods);
|
|
4116
4132
|
const wholePeriods = parts.method === "date-ranges" && parts.wholePeriods;
|
|
@@ -4137,6 +4153,7 @@ function rentalEnds(input) {
|
|
|
4137
4153
|
const { rule, timeZone, startAt, now, untilDay } = input;
|
|
4138
4154
|
const parts = bookingRuleParts(rule);
|
|
4139
4155
|
if (parts.method !== "date-ranges") throw new BookingRulesError("Only date-range rules book a stay");
|
|
4156
|
+
checkStartWithinMaxAdvance(rule, timeZone, startAt, now);
|
|
4140
4157
|
const horizon = shopDayRange(untilDay, 1, timeZone).to;
|
|
4141
4158
|
if (horizon <= startAt) throw new BookingRulesError(`untilDay ${untilDay} is before the stay starts`);
|
|
4142
4159
|
const gridUntil = (end) => buildGrid(rule, timeZone, startAt, new Date(Math.min(end, startAt.getTime() + 366 * 1440 * 6e4)), now);
|
|
@@ -4255,6 +4272,9 @@ function planCourse({ rule, timeZone, presence, now }) {
|
|
|
4255
4272
|
}
|
|
4256
4273
|
if (courseStartedInZone(rule, sessions, now, timeZone))
|
|
4257
4274
|
throw new BookingRulesError("This course has already started");
|
|
4275
|
+
if (startsPastMaxAdvance(rule, sessions[0].startAt, now, timeZone)) {
|
|
4276
|
+
throw new BookingRulesError("This course starts past the booking window of these rules");
|
|
4277
|
+
}
|
|
4258
4278
|
return sessions;
|
|
4259
4279
|
}
|
|
4260
4280
|
function holdExpiresAt(rule, now) {
|
|
@@ -4412,12 +4432,21 @@ var OLD_FIELDS = [
|
|
|
4412
4432
|
"date-ranges": "dateRanges.weeklyHours"
|
|
4413
4433
|
}
|
|
4414
4434
|
},
|
|
4415
|
-
|
|
4435
|
+
{
|
|
4436
|
+
path: "availability.arrivalDays",
|
|
4437
|
+
home: {
|
|
4438
|
+
"time-slots": { unread: "date ranges only" },
|
|
4439
|
+
sessions: { unread: "date ranges only" },
|
|
4440
|
+
"date-ranges": "dateRanges.arrivalDays"
|
|
4441
|
+
}
|
|
4442
|
+
},
|
|
4443
|
+
// An `opening-hours` night has no check times (FC-1503): switching to it drops the old ones, said in a note.
|
|
4444
|
+
...["checkInTime", "checkOutTime", "checkTimesByWeekday"].map((path) => ({
|
|
4416
4445
|
path,
|
|
4417
4446
|
home: {
|
|
4418
4447
|
"time-slots": { unread: "date ranges only" },
|
|
4419
4448
|
sessions: { unread: "date ranges only" },
|
|
4420
|
-
"date-ranges":
|
|
4449
|
+
"date-ranges": ({ dateRanges }) => dateRanges?.arriveLeave === "opening-hours" /* OPENING_HOURS */ ? { dropped: "opening-hours nights have no check times" } : `dateRanges.${path}`
|
|
4421
4450
|
}
|
|
4422
4451
|
}))
|
|
4423
4452
|
];
|
|
@@ -4530,13 +4559,23 @@ function windowEndsAt(rule, now) {
|
|
|
4530
4559
|
return Number.isFinite(ends) ? new Date(ends) : null;
|
|
4531
4560
|
}
|
|
4532
4561
|
function windowEndsAtInZone(rule, now, timeZone) {
|
|
4533
|
-
const { maxAdvance } = ruleDurationsOf(rule);
|
|
4534
4562
|
const ends = Math.min(
|
|
4535
|
-
|
|
4563
|
+
lastStartOf(rule, now, timeZone),
|
|
4536
4564
|
asTime(rule.window.bookableTo, "window.bookableTo") ?? Number.POSITIVE_INFINITY
|
|
4537
4565
|
);
|
|
4538
4566
|
return Number.isFinite(ends) ? new Date(ends) : null;
|
|
4539
4567
|
}
|
|
4568
|
+
function lastStartOf(rule, now, timeZone) {
|
|
4569
|
+
const { maxAdvance } = ruleDurationsOf(rule);
|
|
4570
|
+
if (!maxAdvance) return Number.POSITIVE_INFINITY;
|
|
4571
|
+
const reached = addInZone(now, maxAdvance, timeZone, "window.maxAdvance");
|
|
4572
|
+
if (maxAdvance.unit === "minute" /* MINUTE */ || maxAdvance.unit === "hour" /* HOUR */) {
|
|
4573
|
+
return reached.getTime();
|
|
4574
|
+
}
|
|
4575
|
+
const zone = timeZone;
|
|
4576
|
+
return nextZonedDay(startOfZonedDay(reached, zone), zone).getTime() - 1;
|
|
4577
|
+
}
|
|
4578
|
+
var startsPastMaxAdvance = (rule, startAt, now, timeZone) => startAt.getTime() > lastStartOf(rule, now, timeZone);
|
|
4540
4579
|
function addInZone(from, duration, timeZone, field) {
|
|
4541
4580
|
if (timeZone) return addDuration(from, duration, timeZone);
|
|
4542
4581
|
if (duration.unit === "minute" /* MINUTE */ || duration.unit === "hour" /* HOUR */) {
|
|
@@ -4584,7 +4623,7 @@ function oldMaxAdvanceOf({
|
|
|
4584
4623
|
function periodSlot(dayStart, timeZone, parts, buffer, openMinute, closeMinute) {
|
|
4585
4624
|
const { ratePeriod } = parts;
|
|
4586
4625
|
const at = (minutes) => atZonedMinute(dayStart, minutes, timeZone);
|
|
4587
|
-
if (ratePeriod === "night" /* NIGHT */) {
|
|
4626
|
+
if (ratePeriod === "night" /* NIGHT */ && parts.arriveLeave !== "opening-hours" /* OPENING_HOURS */) {
|
|
4588
4627
|
const arrival = zonedParts(dayStart, timeZone).weekday;
|
|
4589
4628
|
const departure = (arrival + 1) % 7;
|
|
4590
4629
|
return {
|
|
@@ -4597,7 +4636,7 @@ function periodSlot(dayStart, timeZone, parts, buffer, openMinute, closeMinute)
|
|
|
4597
4636
|
}
|
|
4598
4637
|
const from = ratePeriod === "day" /* DAY */ ? openMinute ?? 0 : 0;
|
|
4599
4638
|
const to = ratePeriod === "day" /* DAY */ ? closeMinute ?? 1440 : 1440;
|
|
4600
|
-
const turnaround = parts.wholePeriods ? void 0 : buffer;
|
|
4639
|
+
const turnaround = parts.wholePeriods || ratePeriod === "night" /* NIGHT */ ? void 0 : buffer;
|
|
4601
4640
|
return {
|
|
4602
4641
|
startAt: at(from),
|
|
4603
4642
|
endAt: at(to),
|
|
@@ -4734,7 +4773,8 @@ function buildGrid(rule, timeZone, from, to, now, busy = []) {
|
|
|
4734
4773
|
asTime(window.bookableFrom, "window.bookableFrom") ?? 0,
|
|
4735
4774
|
asTime(availability.availableFrom, "availability.availableFrom") ?? 0
|
|
4736
4775
|
);
|
|
4737
|
-
const notAfter =
|
|
4776
|
+
const notAfter = asTime(window.bookableTo, "window.bookableTo") ?? Number.POSITIVE_INFINITY;
|
|
4777
|
+
const lastStart = lastStartOf(rule, now, timeZone);
|
|
4738
4778
|
const blocked = offMarketOf(rule);
|
|
4739
4779
|
const slots = cellsOf(rule, bookingRuleParts(rule), timeZone, from, to, busy);
|
|
4740
4780
|
const askedFrom = from.getTime();
|
|
@@ -4744,7 +4784,11 @@ function buildGrid(rule, timeZone, from, to, now, busy = []) {
|
|
|
4744
4784
|
if (start < askedFrom || start >= askedTo) return false;
|
|
4745
4785
|
if (start < notBefore || start > notAfter) return false;
|
|
4746
4786
|
return !isBlocked(blocked, start, bufferEndAt.getTime());
|
|
4747
|
-
}).sort((first, second) => +first.startAt - +second.startAt);
|
|
4787
|
+
}).flatMap((cell) => cell.startAt.getTime() > lastStart ? pastMaxAdvance(cell, rule) : [cell]).sort((first, second) => +first.startAt - +second.startAt);
|
|
4788
|
+
}
|
|
4789
|
+
function pastMaxAdvance(cell, rule) {
|
|
4790
|
+
if (soldAsCourse(rule)) return [cell];
|
|
4791
|
+
return bookingMethodOf(rule) === "date-ranges" ? [{ ...cell, canStart: false }] : [];
|
|
4748
4792
|
}
|
|
4749
4793
|
function slotsForWindow(grid, startAt, endAt) {
|
|
4750
4794
|
const startIndex = grid.findIndex((entry) => entry.startAt.getTime() === startAt.getTime());
|
|
@@ -5203,6 +5247,7 @@ var EXPENSE_DEFAULT_CATEGORIES = [
|
|
|
5203
5247
|
AttributeType,
|
|
5204
5248
|
BNPL_METHOD_STATUS,
|
|
5205
5249
|
BNPL_SKIP_REASON,
|
|
5250
|
+
BookingArriveLeave,
|
|
5206
5251
|
BookingDurationUnit,
|
|
5207
5252
|
BookingRatePeriod,
|
|
5208
5253
|
BookingResourceKind,
|
|
@@ -5452,6 +5497,7 @@ var EXPENSE_DEFAULT_CATEGORIES = [
|
|
|
5452
5497
|
signReportForDisplay,
|
|
5453
5498
|
slotsForWindow,
|
|
5454
5499
|
soldAsCourse,
|
|
5500
|
+
startsPastMaxAdvance,
|
|
5455
5501
|
stringifyMinorUnits,
|
|
5456
5502
|
subtractAmounts,
|
|
5457
5503
|
toBase,
|