@final-commerce/common 2.5.1-preprod.2 → 2.5.1-preprod.4

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 CHANGED
@@ -663,6 +663,43 @@ interface EndOfSessionReport {
663
663
  minorUnits?: number;
664
664
  }
665
665
 
666
+ declare const ADYEN_ROLLOUT_COUNTRY_CODES: Set<string>;
667
+ declare function isAdyenRolloutCountry(alpha2: string): boolean;
668
+ declare const AFFIRM_PRICE_PLANS: readonly ["core", "standard", "signature"];
669
+ type AffirmPricePlan = (typeof AFFIRM_PRICE_PLANS)[number];
670
+ declare function isAffirmPricePlan(value: unknown): value is AffirmPricePlan;
671
+ declare const AFFIRM_COUNTRY_CODES: Set<string>;
672
+ declare function isAffirmCountry(alpha2: string | undefined): boolean;
673
+ declare const BNPL_METHOD_STATUS: {
674
+ readonly ACTIVE: "active";
675
+ readonly PENDING: "pending";
676
+ readonly UNAVAILABLE: "unavailable";
677
+ readonly UNKNOWN: "unknown";
678
+ };
679
+ type BnplMethodStatus = (typeof BNPL_METHOD_STATUS)[keyof typeof BNPL_METHOD_STATUS];
680
+ declare const BNPL_SKIP_REASON: {
681
+ readonly PENDING: "pending";
682
+ readonly NO_SUPPORT_EMAIL: "no_support_email";
683
+ readonly NO_CURRENCY: "no_currency";
684
+ readonly NO_BUSINESS_LINE: "no_business_line";
685
+ };
686
+ type BnplSkipReason = (typeof BNPL_SKIP_REASON)[keyof typeof BNPL_SKIP_REASON];
687
+
688
+ interface AdyenBnplSettings {
689
+ affirmPricePlan?: AffirmPricePlan;
690
+ affirm: BnplMethodStatus;
691
+ available: boolean;
692
+ }
693
+ interface AdyenBnplSkippedStore {
694
+ storeId: string;
695
+ reason: BnplSkipReason;
696
+ }
697
+ interface AdyenBnplUpdateResult {
698
+ updated: string[];
699
+ requested: string[];
700
+ skipped: AdyenBnplSkippedStore[];
701
+ }
702
+
666
703
  declare const CURRENCY_CONFIG: Record<CurrencyCode | string, CurrencyConfig>;
667
704
  declare function getCurrencyConfig(currency: CurrencyCode): CurrencyConfig;
668
705
  declare function getMinorUnitMultiplier(currency: CurrencyCode): number;
@@ -805,6 +842,21 @@ declare function isConditionOperator(value: string): value is ConditionOperator;
805
842
  type PathMode = 'strict' | 'permissive';
806
843
  declare const PATH_MODES: readonly PathMode[];
807
844
 
845
+ interface OrderStatusDefinition {
846
+ id: string;
847
+ label: string;
848
+ color?: string;
849
+ icon?: string;
850
+ fulfillmentState?: FulfillmentState;
851
+ requiresPaymentState?: PaymentState[];
852
+ }
853
+ interface OrderStatusValidationError {
854
+ index: number;
855
+ field: string;
856
+ message: string;
857
+ }
858
+ declare function validateOrderStatuses(statuses: unknown): OrderStatusValidationError[];
859
+
808
860
  interface OrderPaymentMethod {
809
861
  id?: string;
810
862
  amount?: number;
@@ -978,6 +1030,7 @@ interface StoredStateConfig {
978
1030
  validInitialStates: StatePair[];
979
1031
  enforceValidInitialStates?: boolean;
980
1032
  displayStateMap: DisplayStateRule[];
1033
+ orderStatuses?: OrderStatusDefinition[];
981
1034
  createdAt: Date;
982
1035
  updatedAt: Date;
983
1036
  }
@@ -1099,6 +1152,16 @@ declare function setOrderState(order: OrderStateWritable, paymentState: PaymentS
1099
1152
 
1100
1153
  declare function inferStatesFromLegacyStatus(order: OrderLikeForLegacyInference): StatePair;
1101
1154
 
1155
+ interface OrderLikeForInCart {
1156
+ inCart?: {
1157
+ active: boolean;
1158
+ } | null;
1159
+ status?: string;
1160
+ fulfillmentState?: string;
1161
+ }
1162
+ declare function hasInCartFlag(order: OrderLikeForInCart): boolean;
1163
+ declare function isInCart(order: OrderLikeForInCart): boolean;
1164
+
1102
1165
  interface OrderMutationData extends OrderStateWritable {
1103
1166
  total?: number;
1104
1167
  balance?: number;
@@ -1400,12 +1463,6 @@ declare function planWindow({ rule, timeZone, presence, startAt, endAt, now, bus
1400
1463
  };
1401
1464
  declare const holdExpiresAt: (rule: BookingRulesInput, now: Date) => Date;
1402
1465
 
1403
- declare const ADYEN_ROLLOUT_COUNTRY_CODES: Set<string>;
1404
- declare function isAdyenRolloutCountry(alpha2: string): boolean;
1405
- declare const AFFIRM_PRICE_PLANS: readonly ["core", "standard", "signature"];
1406
- type AffirmPricePlan = (typeof AFFIRM_PRICE_PLANS)[number];
1407
- declare function isAffirmPricePlan(value: unknown): value is AffirmPricePlan;
1408
-
1409
1466
  interface CurrencyRate {
1410
1467
  rate: number;
1411
1468
  country: string;
@@ -1417,4 +1474,4 @@ declare const EUFixedRates: Record<string, CurrencyRate>;
1417
1474
  declare const OtherFixedRates: Record<string, CurrencyRate>;
1418
1475
  declare const COUNTRY_CURRENCIES: Record<string, string>;
1419
1476
 
1420
- export { ADYEN_ROLLOUT_COUNTRY_CODES, AFFIRM_PRICE_PLANS, type AffirmPricePlan, type Amount, AttributeType, type AvailabilityInput, type AvailabilitySlot, type AvailableTransition, type BookingOccupancy, BookingRatePeriod, type BookingResourceInput, BookingResourceKind, BookingResourceStatus, BookingRulesError, type BookingRulesInput, BookingType, type BusyWindow, 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_HOLD_MINUTES, 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, type GridSlot, 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 OrderReservationForContext, 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, type PlanWindowInput, Platform, PreviewImageMode, PricingLevel, PricingPlanEnum, PricingRegionEnum, type ProductDiscountBucket, type ProductFeeBucket, ProductStatus, ProductType, PublicationAvailability, type PublicationConfig, PublicationStatus, REGION_MAPPING, REPORT_NEGATE_PATHS, ReceiptSendChannel, ReceiptType, type RefundsBreakdown, ReservationStatus, ResidualPaymentMethod, ResidualStatus, type ResolveTemplateResult, type ResourceAvailability, ResourceAvailabilityState, type ResourceInWindow, type ResourcePresenceRow, 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, type WeeklyHours, addAmounts, amountToString, assertUnitSane, availableIn, baseFor, baseFulfillmentDefinitions, baseOf, basePaymentDefinitions, buildAvailability, buildGrid, 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, holdExpiresAt, inferStatesFromLegacyStatus, isAdyenRolloutCountry, isAffirmPricePlan, isConditionOperator, isFulfillmentState, isPaymentState, isSupportedCurrency, isSystemFamilyCode, isValidQuantity, isWhole, mapToLegacyStatus, maxPrecisionFor, mergeFragment, multiplyAmount, normalizeMongoIdString, occupancyIn, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, planWindow, presentAt, removeFragment, resolveFamily, resolveTemplate, resolveUnit, roundToPrecision, sameFamily, setOrderState, shopDayKey, shopDayRange, signReportForDisplay, slotsForWindow, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, violatesFinancialInvariant, windowEndsAt, withinPresence };
1477
+ export { ADYEN_ROLLOUT_COUNTRY_CODES, AFFIRM_COUNTRY_CODES, AFFIRM_PRICE_PLANS, type AdyenBnplSettings, type AdyenBnplSkippedStore, type AdyenBnplUpdateResult, type AffirmPricePlan, type Amount, AttributeType, type AvailabilityInput, type AvailabilitySlot, type AvailableTransition, BNPL_METHOD_STATUS, BNPL_SKIP_REASON, type BnplMethodStatus, type BnplSkipReason, type BookingOccupancy, BookingRatePeriod, type BookingResourceInput, BookingResourceKind, BookingResourceStatus, BookingRulesError, type BookingRulesInput, BookingType, type BusyWindow, 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_HOLD_MINUTES, 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, type GridSlot, 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 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_STATES, POS_VALID_INITIAL_STATES, type PathMode, PaymentMethod, PaymentProcessor, type PaymentState, type PaymentStateDefinition, type PaymentTransitionPath, type PlanWindowInput, Platform, PreviewImageMode, PricingLevel, PricingPlanEnum, PricingRegionEnum, type ProductDiscountBucket, type ProductFeeBucket, ProductStatus, ProductType, PublicationAvailability, type PublicationConfig, PublicationStatus, REGION_MAPPING, REPORT_NEGATE_PATHS, ReceiptSendChannel, ReceiptType, type RefundsBreakdown, ReservationStatus, ResidualPaymentMethod, ResidualStatus, type ResolveTemplateResult, type ResourceAvailability, ResourceAvailabilityState, type ResourceInWindow, type ResourcePresenceRow, 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, type WeeklyHours, addAmounts, amountToString, assertUnitSane, availableIn, baseFor, baseFulfillmentDefinitions, baseOf, basePaymentDefinitions, buildAvailability, buildGrid, 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, hasInCartFlag, holdExpiresAt, inferStatesFromLegacyStatus, isAdyenRolloutCountry, isAffirmCountry, isAffirmPricePlan, isConditionOperator, isFulfillmentState, isInCart, isPaymentState, isSupportedCurrency, isSystemFamilyCode, isValidQuantity, isWhole, mapToLegacyStatus, maxPrecisionFor, mergeFragment, multiplyAmount, normalizeMongoIdString, occupancyIn, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, planWindow, presentAt, removeFragment, resolveFamily, resolveTemplate, resolveUnit, roundToPrecision, sameFamily, setOrderState, shopDayKey, shopDayRange, signReportForDisplay, slotsForWindow, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, validateOrderStatuses, violatesFinancialInvariant, windowEndsAt, withinPresence };
package/dist/index.d.ts CHANGED
@@ -663,6 +663,43 @@ interface EndOfSessionReport {
663
663
  minorUnits?: number;
664
664
  }
665
665
 
666
+ declare const ADYEN_ROLLOUT_COUNTRY_CODES: Set<string>;
667
+ declare function isAdyenRolloutCountry(alpha2: string): boolean;
668
+ declare const AFFIRM_PRICE_PLANS: readonly ["core", "standard", "signature"];
669
+ type AffirmPricePlan = (typeof AFFIRM_PRICE_PLANS)[number];
670
+ declare function isAffirmPricePlan(value: unknown): value is AffirmPricePlan;
671
+ declare const AFFIRM_COUNTRY_CODES: Set<string>;
672
+ declare function isAffirmCountry(alpha2: string | undefined): boolean;
673
+ declare const BNPL_METHOD_STATUS: {
674
+ readonly ACTIVE: "active";
675
+ readonly PENDING: "pending";
676
+ readonly UNAVAILABLE: "unavailable";
677
+ readonly UNKNOWN: "unknown";
678
+ };
679
+ type BnplMethodStatus = (typeof BNPL_METHOD_STATUS)[keyof typeof BNPL_METHOD_STATUS];
680
+ declare const BNPL_SKIP_REASON: {
681
+ readonly PENDING: "pending";
682
+ readonly NO_SUPPORT_EMAIL: "no_support_email";
683
+ readonly NO_CURRENCY: "no_currency";
684
+ readonly NO_BUSINESS_LINE: "no_business_line";
685
+ };
686
+ type BnplSkipReason = (typeof BNPL_SKIP_REASON)[keyof typeof BNPL_SKIP_REASON];
687
+
688
+ interface AdyenBnplSettings {
689
+ affirmPricePlan?: AffirmPricePlan;
690
+ affirm: BnplMethodStatus;
691
+ available: boolean;
692
+ }
693
+ interface AdyenBnplSkippedStore {
694
+ storeId: string;
695
+ reason: BnplSkipReason;
696
+ }
697
+ interface AdyenBnplUpdateResult {
698
+ updated: string[];
699
+ requested: string[];
700
+ skipped: AdyenBnplSkippedStore[];
701
+ }
702
+
666
703
  declare const CURRENCY_CONFIG: Record<CurrencyCode | string, CurrencyConfig>;
667
704
  declare function getCurrencyConfig(currency: CurrencyCode): CurrencyConfig;
668
705
  declare function getMinorUnitMultiplier(currency: CurrencyCode): number;
@@ -805,6 +842,21 @@ declare function isConditionOperator(value: string): value is ConditionOperator;
805
842
  type PathMode = 'strict' | 'permissive';
806
843
  declare const PATH_MODES: readonly PathMode[];
807
844
 
845
+ interface OrderStatusDefinition {
846
+ id: string;
847
+ label: string;
848
+ color?: string;
849
+ icon?: string;
850
+ fulfillmentState?: FulfillmentState;
851
+ requiresPaymentState?: PaymentState[];
852
+ }
853
+ interface OrderStatusValidationError {
854
+ index: number;
855
+ field: string;
856
+ message: string;
857
+ }
858
+ declare function validateOrderStatuses(statuses: unknown): OrderStatusValidationError[];
859
+
808
860
  interface OrderPaymentMethod {
809
861
  id?: string;
810
862
  amount?: number;
@@ -978,6 +1030,7 @@ interface StoredStateConfig {
978
1030
  validInitialStates: StatePair[];
979
1031
  enforceValidInitialStates?: boolean;
980
1032
  displayStateMap: DisplayStateRule[];
1033
+ orderStatuses?: OrderStatusDefinition[];
981
1034
  createdAt: Date;
982
1035
  updatedAt: Date;
983
1036
  }
@@ -1099,6 +1152,16 @@ declare function setOrderState(order: OrderStateWritable, paymentState: PaymentS
1099
1152
 
1100
1153
  declare function inferStatesFromLegacyStatus(order: OrderLikeForLegacyInference): StatePair;
1101
1154
 
1155
+ interface OrderLikeForInCart {
1156
+ inCart?: {
1157
+ active: boolean;
1158
+ } | null;
1159
+ status?: string;
1160
+ fulfillmentState?: string;
1161
+ }
1162
+ declare function hasInCartFlag(order: OrderLikeForInCart): boolean;
1163
+ declare function isInCart(order: OrderLikeForInCart): boolean;
1164
+
1102
1165
  interface OrderMutationData extends OrderStateWritable {
1103
1166
  total?: number;
1104
1167
  balance?: number;
@@ -1400,12 +1463,6 @@ declare function planWindow({ rule, timeZone, presence, startAt, endAt, now, bus
1400
1463
  };
1401
1464
  declare const holdExpiresAt: (rule: BookingRulesInput, now: Date) => Date;
1402
1465
 
1403
- declare const ADYEN_ROLLOUT_COUNTRY_CODES: Set<string>;
1404
- declare function isAdyenRolloutCountry(alpha2: string): boolean;
1405
- declare const AFFIRM_PRICE_PLANS: readonly ["core", "standard", "signature"];
1406
- type AffirmPricePlan = (typeof AFFIRM_PRICE_PLANS)[number];
1407
- declare function isAffirmPricePlan(value: unknown): value is AffirmPricePlan;
1408
-
1409
1466
  interface CurrencyRate {
1410
1467
  rate: number;
1411
1468
  country: string;
@@ -1417,4 +1474,4 @@ declare const EUFixedRates: Record<string, CurrencyRate>;
1417
1474
  declare const OtherFixedRates: Record<string, CurrencyRate>;
1418
1475
  declare const COUNTRY_CURRENCIES: Record<string, string>;
1419
1476
 
1420
- export { ADYEN_ROLLOUT_COUNTRY_CODES, AFFIRM_PRICE_PLANS, type AffirmPricePlan, type Amount, AttributeType, type AvailabilityInput, type AvailabilitySlot, type AvailableTransition, type BookingOccupancy, BookingRatePeriod, type BookingResourceInput, BookingResourceKind, BookingResourceStatus, BookingRulesError, type BookingRulesInput, BookingType, type BusyWindow, 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_HOLD_MINUTES, 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, type GridSlot, 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 OrderReservationForContext, 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, type PlanWindowInput, Platform, PreviewImageMode, PricingLevel, PricingPlanEnum, PricingRegionEnum, type ProductDiscountBucket, type ProductFeeBucket, ProductStatus, ProductType, PublicationAvailability, type PublicationConfig, PublicationStatus, REGION_MAPPING, REPORT_NEGATE_PATHS, ReceiptSendChannel, ReceiptType, type RefundsBreakdown, ReservationStatus, ResidualPaymentMethod, ResidualStatus, type ResolveTemplateResult, type ResourceAvailability, ResourceAvailabilityState, type ResourceInWindow, type ResourcePresenceRow, 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, type WeeklyHours, addAmounts, amountToString, assertUnitSane, availableIn, baseFor, baseFulfillmentDefinitions, baseOf, basePaymentDefinitions, buildAvailability, buildGrid, 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, holdExpiresAt, inferStatesFromLegacyStatus, isAdyenRolloutCountry, isAffirmPricePlan, isConditionOperator, isFulfillmentState, isPaymentState, isSupportedCurrency, isSystemFamilyCode, isValidQuantity, isWhole, mapToLegacyStatus, maxPrecisionFor, mergeFragment, multiplyAmount, normalizeMongoIdString, occupancyIn, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, planWindow, presentAt, removeFragment, resolveFamily, resolveTemplate, resolveUnit, roundToPrecision, sameFamily, setOrderState, shopDayKey, shopDayRange, signReportForDisplay, slotsForWindow, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, violatesFinancialInvariant, windowEndsAt, withinPresence };
1477
+ export { ADYEN_ROLLOUT_COUNTRY_CODES, AFFIRM_COUNTRY_CODES, AFFIRM_PRICE_PLANS, type AdyenBnplSettings, type AdyenBnplSkippedStore, type AdyenBnplUpdateResult, type AffirmPricePlan, type Amount, AttributeType, type AvailabilityInput, type AvailabilitySlot, type AvailableTransition, BNPL_METHOD_STATUS, BNPL_SKIP_REASON, type BnplMethodStatus, type BnplSkipReason, type BookingOccupancy, BookingRatePeriod, type BookingResourceInput, BookingResourceKind, BookingResourceStatus, BookingRulesError, type BookingRulesInput, BookingType, type BusyWindow, 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_HOLD_MINUTES, 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, type GridSlot, 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 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_STATES, POS_VALID_INITIAL_STATES, type PathMode, PaymentMethod, PaymentProcessor, type PaymentState, type PaymentStateDefinition, type PaymentTransitionPath, type PlanWindowInput, Platform, PreviewImageMode, PricingLevel, PricingPlanEnum, PricingRegionEnum, type ProductDiscountBucket, type ProductFeeBucket, ProductStatus, ProductType, PublicationAvailability, type PublicationConfig, PublicationStatus, REGION_MAPPING, REPORT_NEGATE_PATHS, ReceiptSendChannel, ReceiptType, type RefundsBreakdown, ReservationStatus, ResidualPaymentMethod, ResidualStatus, type ResolveTemplateResult, type ResourceAvailability, ResourceAvailabilityState, type ResourceInWindow, type ResourcePresenceRow, 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, type WeeklyHours, addAmounts, amountToString, assertUnitSane, availableIn, baseFor, baseFulfillmentDefinitions, baseOf, basePaymentDefinitions, buildAvailability, buildGrid, 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, hasInCartFlag, holdExpiresAt, inferStatesFromLegacyStatus, isAdyenRolloutCountry, isAffirmCountry, isAffirmPricePlan, isConditionOperator, isFulfillmentState, isInCart, isPaymentState, isSupportedCurrency, isSystemFamilyCode, isValidQuantity, isWhole, mapToLegacyStatus, maxPrecisionFor, mergeFragment, multiplyAmount, normalizeMongoIdString, occupancyIn, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, planWindow, presentAt, removeFragment, resolveFamily, resolveTemplate, resolveUnit, roundToPrecision, sameFamily, setOrderState, shopDayKey, shopDayRange, signReportForDisplay, slotsForWindow, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, validateOrderStatuses, violatesFinancialInvariant, windowEndsAt, withinPresence };
package/dist/index.js CHANGED
@@ -20,8 +20,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  var index_exports = {};
21
21
  __export(index_exports, {
22
22
  ADYEN_ROLLOUT_COUNTRY_CODES: () => ADYEN_ROLLOUT_COUNTRY_CODES,
23
+ AFFIRM_COUNTRY_CODES: () => AFFIRM_COUNTRY_CODES,
23
24
  AFFIRM_PRICE_PLANS: () => AFFIRM_PRICE_PLANS,
24
25
  AttributeType: () => AttributeType,
26
+ BNPL_METHOD_STATUS: () => BNPL_METHOD_STATUS,
27
+ BNPL_SKIP_REASON: () => BNPL_SKIP_REASON,
25
28
  BookingRatePeriod: () => BookingRatePeriod,
26
29
  BookingResourceKind: () => BookingResourceKind,
27
30
  BookingResourceStatus: () => BookingResourceStatus,
@@ -146,12 +149,15 @@ __export(index_exports, {
146
149
  getPricingRegionFromCountry: () => getPricingRegionFromCountry,
147
150
  getSettlementTotal: () => getSettlementTotal,
148
151
  getTotalCollected: () => getTotalCollected,
152
+ hasInCartFlag: () => hasInCartFlag,
149
153
  holdExpiresAt: () => holdExpiresAt,
150
154
  inferStatesFromLegacyStatus: () => inferStatesFromLegacyStatus,
151
155
  isAdyenRolloutCountry: () => isAdyenRolloutCountry,
156
+ isAffirmCountry: () => isAffirmCountry,
152
157
  isAffirmPricePlan: () => isAffirmPricePlan,
153
158
  isConditionOperator: () => isConditionOperator,
154
159
  isFulfillmentState: () => isFulfillmentState,
160
+ isInCart: () => isInCart,
155
161
  isPaymentState: () => isPaymentState,
156
162
  isSupportedCurrency: () => isSupportedCurrency,
157
163
  isSystemFamilyCode: () => isSystemFamilyCode,
@@ -185,6 +191,7 @@ __export(index_exports, {
185
191
  toMinorUnits: () => toMinorUnits,
186
192
  validateConfig: () => validateConfig,
187
193
  validateFragmentCompatibility: () => validateFragmentCompatibility,
194
+ validateOrderStatuses: () => validateOrderStatuses,
188
195
  violatesFinancialInvariant: () => violatesFinancialInvariant,
189
196
  windowEndsAt: () => windowEndsAt,
190
197
  withinPresence: () => withinPresence
@@ -2685,6 +2692,51 @@ function inferStatesFromLegacyStatus(order) {
2685
2692
  return { payment: "unpaid", fulfillment: "pending" };
2686
2693
  }
2687
2694
 
2695
+ // order-state-machine/in-cart.ts
2696
+ function hasInCartFlag(order) {
2697
+ return order.inCart != null;
2698
+ }
2699
+ function isInCart(order) {
2700
+ if (order.inCart != null) return order.inCart.active === true;
2701
+ if (order.fulfillmentState) return order.fulfillmentState === "draft";
2702
+ return (order.status ?? "").trim().toLowerCase() === "in-cart";
2703
+ }
2704
+
2705
+ // order-state-machine/order-status.ts
2706
+ function validateOrderStatuses(statuses) {
2707
+ if (!Array.isArray(statuses)) {
2708
+ return [{ index: -1, field: "orderStatuses", message: "must be an array" }];
2709
+ }
2710
+ const errors = [];
2711
+ const seen = /* @__PURE__ */ new Set();
2712
+ statuses.forEach((raw, index) => {
2713
+ const s = raw ?? {};
2714
+ const add = (field, message) => errors.push({ index, field, message });
2715
+ if (typeof s.id !== "string" || !s.id.trim()) add("id", "must be a non-empty string");
2716
+ else if (seen.has(s.id)) add("id", `duplicate id "${s.id}"`);
2717
+ else seen.add(s.id);
2718
+ if (typeof s.label !== "string" || !s.label.trim()) add("label", "must be a non-empty string");
2719
+ for (const field of ["color", "icon"]) {
2720
+ if (s[field] !== void 0 && typeof s[field] !== "string") add(field, "must be a string");
2721
+ }
2722
+ if (s.fulfillmentState !== void 0 && !(typeof s.fulfillmentState === "string" && isFulfillmentState(s.fulfillmentState))) {
2723
+ add("fulfillmentState", `"${String(s.fulfillmentState)}" is not a fulfillment state`);
2724
+ }
2725
+ if (s.requiresPaymentState !== void 0) {
2726
+ if (!Array.isArray(s.requiresPaymentState) || s.requiresPaymentState.length === 0) {
2727
+ add("requiresPaymentState", "must be a non-empty array of payment states");
2728
+ } else {
2729
+ for (const p of s.requiresPaymentState) {
2730
+ if (!(typeof p === "string" && isPaymentState(p))) {
2731
+ add("requiresPaymentState", `"${String(p)}" is not a payment state`);
2732
+ }
2733
+ }
2734
+ }
2735
+ }
2736
+ });
2737
+ return errors;
2738
+ }
2739
+
2688
2740
  // order-state-machine/write-strategy.ts
2689
2741
  var LegacyWriteStrategy = class {
2690
2742
  applyState(_order) {
@@ -3397,11 +3449,30 @@ var AFFIRM_PRICE_PLANS = ["core", "standard", "signature"];
3397
3449
  function isAffirmPricePlan(value) {
3398
3450
  return typeof value === "string" && AFFIRM_PRICE_PLANS.includes(value);
3399
3451
  }
3452
+ var AFFIRM_COUNTRY_CODES = /* @__PURE__ */ new Set(["CA"]);
3453
+ function isAffirmCountry(alpha2) {
3454
+ return !!alpha2 && AFFIRM_COUNTRY_CODES.has(alpha2.toUpperCase());
3455
+ }
3456
+ var BNPL_METHOD_STATUS = {
3457
+ ACTIVE: "active",
3458
+ PENDING: "pending",
3459
+ UNAVAILABLE: "unavailable",
3460
+ UNKNOWN: "unknown"
3461
+ };
3462
+ var BNPL_SKIP_REASON = {
3463
+ PENDING: "pending",
3464
+ NO_SUPPORT_EMAIL: "no_support_email",
3465
+ NO_CURRENCY: "no_currency",
3466
+ NO_BUSINESS_LINE: "no_business_line"
3467
+ };
3400
3468
  // Annotate the CommonJS export names for ESM import in node:
3401
3469
  0 && (module.exports = {
3402
3470
  ADYEN_ROLLOUT_COUNTRY_CODES,
3471
+ AFFIRM_COUNTRY_CODES,
3403
3472
  AFFIRM_PRICE_PLANS,
3404
3473
  AttributeType,
3474
+ BNPL_METHOD_STATUS,
3475
+ BNPL_SKIP_REASON,
3405
3476
  BookingRatePeriod,
3406
3477
  BookingResourceKind,
3407
3478
  BookingResourceStatus,
@@ -3526,12 +3597,15 @@ function isAffirmPricePlan(value) {
3526
3597
  getPricingRegionFromCountry,
3527
3598
  getSettlementTotal,
3528
3599
  getTotalCollected,
3600
+ hasInCartFlag,
3529
3601
  holdExpiresAt,
3530
3602
  inferStatesFromLegacyStatus,
3531
3603
  isAdyenRolloutCountry,
3604
+ isAffirmCountry,
3532
3605
  isAffirmPricePlan,
3533
3606
  isConditionOperator,
3534
3607
  isFulfillmentState,
3608
+ isInCart,
3535
3609
  isPaymentState,
3536
3610
  isSupportedCurrency,
3537
3611
  isSystemFamilyCode,
@@ -3565,6 +3639,7 @@ function isAffirmPricePlan(value) {
3565
3639
  toMinorUnits,
3566
3640
  validateConfig,
3567
3641
  validateFragmentCompatibility,
3642
+ validateOrderStatuses,
3568
3643
  violatesFinancialInvariant,
3569
3644
  windowEndsAt,
3570
3645
  withinPresence