@final-commerce/common 2.5.1-preprod.1 → 2.5.1-preprod.3

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
@@ -805,6 +805,21 @@ declare function isConditionOperator(value: string): value is ConditionOperator;
805
805
  type PathMode = 'strict' | 'permissive';
806
806
  declare const PATH_MODES: readonly PathMode[];
807
807
 
808
+ interface OrderStatusDefinition {
809
+ id: string;
810
+ label: string;
811
+ color?: string;
812
+ icon?: string;
813
+ fulfillmentState?: FulfillmentState;
814
+ requiresPaymentState?: PaymentState[];
815
+ }
816
+ interface OrderStatusValidationError {
817
+ index: number;
818
+ field: string;
819
+ message: string;
820
+ }
821
+ declare function validateOrderStatuses(statuses: unknown): OrderStatusValidationError[];
822
+
808
823
  interface OrderPaymentMethod {
809
824
  id?: string;
810
825
  amount?: number;
@@ -978,6 +993,7 @@ interface StoredStateConfig {
978
993
  validInitialStates: StatePair[];
979
994
  enforceValidInitialStates?: boolean;
980
995
  displayStateMap: DisplayStateRule[];
996
+ orderStatuses?: OrderStatusDefinition[];
981
997
  createdAt: Date;
982
998
  updatedAt: Date;
983
999
  }
@@ -1099,6 +1115,16 @@ declare function setOrderState(order: OrderStateWritable, paymentState: PaymentS
1099
1115
 
1100
1116
  declare function inferStatesFromLegacyStatus(order: OrderLikeForLegacyInference): StatePair;
1101
1117
 
1118
+ interface OrderLikeForInCart {
1119
+ inCart?: {
1120
+ active: boolean;
1121
+ } | null;
1122
+ status?: string;
1123
+ fulfillmentState?: string;
1124
+ }
1125
+ declare function hasInCartFlag(order: OrderLikeForInCart): boolean;
1126
+ declare function isInCart(order: OrderLikeForInCart): boolean;
1127
+
1102
1128
  interface OrderMutationData extends OrderStateWritable {
1103
1129
  total?: number;
1104
1130
  balance?: number;
@@ -1402,6 +1428,9 @@ declare const holdExpiresAt: (rule: BookingRulesInput, now: Date) => Date;
1402
1428
 
1403
1429
  declare const ADYEN_ROLLOUT_COUNTRY_CODES: Set<string>;
1404
1430
  declare function isAdyenRolloutCountry(alpha2: string): boolean;
1431
+ declare const AFFIRM_PRICE_PLANS: readonly ["core", "standard", "signature"];
1432
+ type AffirmPricePlan = (typeof AFFIRM_PRICE_PLANS)[number];
1433
+ declare function isAffirmPricePlan(value: unknown): value is AffirmPricePlan;
1405
1434
 
1406
1435
  interface CurrencyRate {
1407
1436
  rate: number;
@@ -1414,4 +1443,4 @@ declare const EUFixedRates: Record<string, CurrencyRate>;
1414
1443
  declare const OtherFixedRates: Record<string, CurrencyRate>;
1415
1444
  declare const COUNTRY_CURRENCIES: Record<string, string>;
1416
1445
 
1417
- export { ADYEN_ROLLOUT_COUNTRY_CODES, 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, 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 };
1446
+ 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 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, 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
@@ -805,6 +805,21 @@ declare function isConditionOperator(value: string): value is ConditionOperator;
805
805
  type PathMode = 'strict' | 'permissive';
806
806
  declare const PATH_MODES: readonly PathMode[];
807
807
 
808
+ interface OrderStatusDefinition {
809
+ id: string;
810
+ label: string;
811
+ color?: string;
812
+ icon?: string;
813
+ fulfillmentState?: FulfillmentState;
814
+ requiresPaymentState?: PaymentState[];
815
+ }
816
+ interface OrderStatusValidationError {
817
+ index: number;
818
+ field: string;
819
+ message: string;
820
+ }
821
+ declare function validateOrderStatuses(statuses: unknown): OrderStatusValidationError[];
822
+
808
823
  interface OrderPaymentMethod {
809
824
  id?: string;
810
825
  amount?: number;
@@ -978,6 +993,7 @@ interface StoredStateConfig {
978
993
  validInitialStates: StatePair[];
979
994
  enforceValidInitialStates?: boolean;
980
995
  displayStateMap: DisplayStateRule[];
996
+ orderStatuses?: OrderStatusDefinition[];
981
997
  createdAt: Date;
982
998
  updatedAt: Date;
983
999
  }
@@ -1099,6 +1115,16 @@ declare function setOrderState(order: OrderStateWritable, paymentState: PaymentS
1099
1115
 
1100
1116
  declare function inferStatesFromLegacyStatus(order: OrderLikeForLegacyInference): StatePair;
1101
1117
 
1118
+ interface OrderLikeForInCart {
1119
+ inCart?: {
1120
+ active: boolean;
1121
+ } | null;
1122
+ status?: string;
1123
+ fulfillmentState?: string;
1124
+ }
1125
+ declare function hasInCartFlag(order: OrderLikeForInCart): boolean;
1126
+ declare function isInCart(order: OrderLikeForInCart): boolean;
1127
+
1102
1128
  interface OrderMutationData extends OrderStateWritable {
1103
1129
  total?: number;
1104
1130
  balance?: number;
@@ -1402,6 +1428,9 @@ declare const holdExpiresAt: (rule: BookingRulesInput, now: Date) => Date;
1402
1428
 
1403
1429
  declare const ADYEN_ROLLOUT_COUNTRY_CODES: Set<string>;
1404
1430
  declare function isAdyenRolloutCountry(alpha2: string): boolean;
1431
+ declare const AFFIRM_PRICE_PLANS: readonly ["core", "standard", "signature"];
1432
+ type AffirmPricePlan = (typeof AFFIRM_PRICE_PLANS)[number];
1433
+ declare function isAffirmPricePlan(value: unknown): value is AffirmPricePlan;
1405
1434
 
1406
1435
  interface CurrencyRate {
1407
1436
  rate: number;
@@ -1414,4 +1443,4 @@ declare const EUFixedRates: Record<string, CurrencyRate>;
1414
1443
  declare const OtherFixedRates: Record<string, CurrencyRate>;
1415
1444
  declare const COUNTRY_CURRENCIES: Record<string, string>;
1416
1445
 
1417
- export { ADYEN_ROLLOUT_COUNTRY_CODES, 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, 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 };
1446
+ 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 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, 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,6 +20,7 @@ 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_PRICE_PLANS: () => AFFIRM_PRICE_PLANS,
23
24
  AttributeType: () => AttributeType,
24
25
  BookingRatePeriod: () => BookingRatePeriod,
25
26
  BookingResourceKind: () => BookingResourceKind,
@@ -145,11 +146,14 @@ __export(index_exports, {
145
146
  getPricingRegionFromCountry: () => getPricingRegionFromCountry,
146
147
  getSettlementTotal: () => getSettlementTotal,
147
148
  getTotalCollected: () => getTotalCollected,
149
+ hasInCartFlag: () => hasInCartFlag,
148
150
  holdExpiresAt: () => holdExpiresAt,
149
151
  inferStatesFromLegacyStatus: () => inferStatesFromLegacyStatus,
150
152
  isAdyenRolloutCountry: () => isAdyenRolloutCountry,
153
+ isAffirmPricePlan: () => isAffirmPricePlan,
151
154
  isConditionOperator: () => isConditionOperator,
152
155
  isFulfillmentState: () => isFulfillmentState,
156
+ isInCart: () => isInCart,
153
157
  isPaymentState: () => isPaymentState,
154
158
  isSupportedCurrency: () => isSupportedCurrency,
155
159
  isSystemFamilyCode: () => isSystemFamilyCode,
@@ -183,6 +187,7 @@ __export(index_exports, {
183
187
  toMinorUnits: () => toMinorUnits,
184
188
  validateConfig: () => validateConfig,
185
189
  validateFragmentCompatibility: () => validateFragmentCompatibility,
190
+ validateOrderStatuses: () => validateOrderStatuses,
186
191
  violatesFinancialInvariant: () => violatesFinancialInvariant,
187
192
  windowEndsAt: () => windowEndsAt,
188
193
  withinPresence: () => withinPresence
@@ -2683,6 +2688,51 @@ function inferStatesFromLegacyStatus(order) {
2683
2688
  return { payment: "unpaid", fulfillment: "pending" };
2684
2689
  }
2685
2690
 
2691
+ // order-state-machine/in-cart.ts
2692
+ function hasInCartFlag(order) {
2693
+ return order.inCart != null;
2694
+ }
2695
+ function isInCart(order) {
2696
+ if (order.inCart != null) return order.inCart.active === true;
2697
+ if (order.fulfillmentState) return order.fulfillmentState === "draft";
2698
+ return (order.status ?? "").trim().toLowerCase() === "in-cart";
2699
+ }
2700
+
2701
+ // order-state-machine/order-status.ts
2702
+ function validateOrderStatuses(statuses) {
2703
+ if (!Array.isArray(statuses)) {
2704
+ return [{ index: -1, field: "orderStatuses", message: "must be an array" }];
2705
+ }
2706
+ const errors = [];
2707
+ const seen = /* @__PURE__ */ new Set();
2708
+ statuses.forEach((raw, index) => {
2709
+ const s = raw ?? {};
2710
+ const add = (field, message) => errors.push({ index, field, message });
2711
+ if (typeof s.id !== "string" || !s.id.trim()) add("id", "must be a non-empty string");
2712
+ else if (seen.has(s.id)) add("id", `duplicate id "${s.id}"`);
2713
+ else seen.add(s.id);
2714
+ if (typeof s.label !== "string" || !s.label.trim()) add("label", "must be a non-empty string");
2715
+ for (const field of ["color", "icon"]) {
2716
+ if (s[field] !== void 0 && typeof s[field] !== "string") add(field, "must be a string");
2717
+ }
2718
+ if (s.fulfillmentState !== void 0 && !(typeof s.fulfillmentState === "string" && isFulfillmentState(s.fulfillmentState))) {
2719
+ add("fulfillmentState", `"${String(s.fulfillmentState)}" is not a fulfillment state`);
2720
+ }
2721
+ if (s.requiresPaymentState !== void 0) {
2722
+ if (!Array.isArray(s.requiresPaymentState) || s.requiresPaymentState.length === 0) {
2723
+ add("requiresPaymentState", "must be a non-empty array of payment states");
2724
+ } else {
2725
+ for (const p of s.requiresPaymentState) {
2726
+ if (!(typeof p === "string" && isPaymentState(p))) {
2727
+ add("requiresPaymentState", `"${String(p)}" is not a payment state`);
2728
+ }
2729
+ }
2730
+ }
2731
+ }
2732
+ });
2733
+ return errors;
2734
+ }
2735
+
2686
2736
  // order-state-machine/write-strategy.ts
2687
2737
  var LegacyWriteStrategy = class {
2688
2738
  applyState(_order) {
@@ -3391,9 +3441,14 @@ var ADYEN_ROLLOUT_COUNTRY_CODES = /* @__PURE__ */ new Set(["CA"]);
3391
3441
  function isAdyenRolloutCountry(alpha2) {
3392
3442
  return ADYEN_ROLLOUT_COUNTRY_CODES.has(alpha2);
3393
3443
  }
3444
+ var AFFIRM_PRICE_PLANS = ["core", "standard", "signature"];
3445
+ function isAffirmPricePlan(value) {
3446
+ return typeof value === "string" && AFFIRM_PRICE_PLANS.includes(value);
3447
+ }
3394
3448
  // Annotate the CommonJS export names for ESM import in node:
3395
3449
  0 && (module.exports = {
3396
3450
  ADYEN_ROLLOUT_COUNTRY_CODES,
3451
+ AFFIRM_PRICE_PLANS,
3397
3452
  AttributeType,
3398
3453
  BookingRatePeriod,
3399
3454
  BookingResourceKind,
@@ -3519,11 +3574,14 @@ function isAdyenRolloutCountry(alpha2) {
3519
3574
  getPricingRegionFromCountry,
3520
3575
  getSettlementTotal,
3521
3576
  getTotalCollected,
3577
+ hasInCartFlag,
3522
3578
  holdExpiresAt,
3523
3579
  inferStatesFromLegacyStatus,
3524
3580
  isAdyenRolloutCountry,
3581
+ isAffirmPricePlan,
3525
3582
  isConditionOperator,
3526
3583
  isFulfillmentState,
3584
+ isInCart,
3527
3585
  isPaymentState,
3528
3586
  isSupportedCurrency,
3529
3587
  isSystemFamilyCode,
@@ -3557,6 +3615,7 @@ function isAdyenRolloutCountry(alpha2) {
3557
3615
  toMinorUnits,
3558
3616
  validateConfig,
3559
3617
  validateFragmentCompatibility,
3618
+ validateOrderStatuses,
3560
3619
  violatesFinancialInvariant,
3561
3620
  windowEndsAt,
3562
3621
  withinPresence