@final-commerce/common 2.5.0-staging.1 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -224,7 +224,8 @@ declare enum InventorySpecificActionType {
224
224
  APPLIED_FROM_WOO = "APPLIED_FROM_WOO",
225
225
  PO_RECEIVED = "PO_RECEIVED",
226
226
  EXTERNAL_SALE = "EXTERNAL_SALE",
227
- EXTERNAL_RESTOCK = "EXTERNAL_RESTOCK"
227
+ EXTERNAL_RESTOCK = "EXTERNAL_RESTOCK",
228
+ CUSTOM = "CUSTOM"
228
229
  }
229
230
  declare enum ExtensionCategory {
230
231
  SYNC = "sync",
@@ -390,8 +391,7 @@ declare enum StripeCurrencyCode {
390
391
  declare enum ProductType {
391
392
  SIMPLE = "simple",
392
393
  VARIABLE = "variable",
393
- BOOKING = "booking",
394
- COMPOSITE = "composite"
394
+ BOOKING = "booking"
395
395
  }
396
396
  declare enum ProductStatus {
397
397
  ACTIVE = "active",
@@ -713,85 +713,6 @@ declare function generateMongoID(): string;
713
713
  declare function getCurrentISODate(): string;
714
714
  declare function normalizeMongoIdString(value: unknown): string | null;
715
715
 
716
- interface CompositePriceItem {
717
- extraCharge: number;
718
- quantity: number;
719
- available: boolean;
720
- }
721
- interface CompositePricePart {
722
- min: number;
723
- items: CompositePriceItem[];
724
- }
725
- declare const compositeItemCost: (item: CompositePriceItem) => number;
726
- declare function cheapestCompositeItem(items: CompositePriceItem[]): number | undefined;
727
- declare function cheapestCompositePrice(parts: CompositePricePart[]): number | undefined;
728
-
729
- type ModifierSelectionType = 'single' | 'multiple' | 'quantity';
730
- interface ResolvedModifierChoice {
731
- _id: string;
732
- name: string;
733
- price: number;
734
- isDefault?: boolean;
735
- defaultQuantity?: number;
736
- unavailableOutletIds?: string[];
737
- sortOrder: number;
738
- }
739
- interface ResolvedModifier {
740
- _id: string;
741
- name: string;
742
- selectionType: ModifierSelectionType;
743
- allowQuantity?: boolean;
744
- required: boolean;
745
- min?: number | null;
746
- max?: number | null;
747
- sortOrder: number;
748
- choices: ResolvedModifierChoice[];
749
- }
750
-
751
- interface ModifierChoiceRow {
752
- _id: string;
753
- name: string;
754
- price?: number;
755
- sortOrder?: number;
756
- isDefault?: boolean;
757
- defaultQuantity?: number;
758
- unavailableOutletIds?: string[];
759
- }
760
- interface ModifierRow {
761
- _id: string;
762
- name: string;
763
- selectionType: ModifierSelectionType;
764
- allowQuantity?: boolean;
765
- choices?: ModifierChoiceRow[];
766
- isDeleted?: boolean;
767
- }
768
- interface CategoryModifierRow {
769
- _id: string;
770
- modifierId: string;
771
- categoryId: string;
772
- required?: boolean;
773
- min?: number | null;
774
- max?: number | null;
775
- sortOrder?: number;
776
- isDeleted?: boolean;
777
- }
778
- interface CategoryRow {
779
- _id: string;
780
- parentId?: string | null;
781
- isDeleted?: boolean;
782
- }
783
- declare function ancestorChain(categoryId: string, categoriesById: Map<string, CategoryRow>): string[];
784
- interface ResolveInputs {
785
- categoryIds: string[];
786
- modifiers: ModifierRow[];
787
- categoryModifiers: CategoryModifierRow[];
788
- categories: CategoryRow[];
789
- }
790
- declare function resolveModifiersForProduct(inputs: ResolveInputs): ResolvedModifier[];
791
- declare function isChoiceAvailableAtOutlet(choice: ResolvedModifierChoice, outletId: string): boolean;
792
- declare function hasSellableChoice(modifier: ResolvedModifier, outletId: string): boolean;
793
- declare const modifiersSellable: (modifiers: ResolvedModifier[], outletId: string) => boolean;
794
-
795
716
  interface Measurable {
796
717
  name: string;
797
718
  abbreviation: string;
@@ -822,104 +743,6 @@ interface MeasurementUnit {
822
743
  sellable?: false;
823
744
  }
824
745
 
825
- type CompositeItemUnavailable = 'deleted' | 'inactive' | 'hidden' | 'empty' | 'out_of_stock' | 'by_date' | 'fully_booked';
826
-
827
- interface CompositeShelf {
828
- pool: string;
829
- unit?: Measurable;
830
- backorder: boolean;
831
- unresolved?: boolean;
832
- }
833
- interface CompositeAvailabilityRows {
834
- variantProducts: ReadonlyMap<string, string>;
835
- productStatuses: ReadonlyMap<string, string | undefined>;
836
- categoryVariants: ReadonlyMap<string, readonly string[]>;
837
- bookableProductIds: ReadonlySet<string>;
838
- outlet?: {
839
- hiddenProductIds: ReadonlySet<string>;
840
- unsellableProductIds: ReadonlySet<string>;
841
- shelves: ReadonlyMap<string, CompositeShelf>;
842
- poolStock: ReadonlyMap<string, number | null>;
843
- bookableSeats?: ReadonlyMap<string, number>;
844
- };
845
- }
846
- declare function poolStockAt(rows: readonly {
847
- outletId: unknown;
848
- manageStock?: boolean;
849
- quantity?: number;
850
- }[], outletId: string): number | null;
851
- declare function compositeVariantInStock(variantId: string, quantity: number, outlet: NonNullable<CompositeAvailabilityRows['outlet']>): boolean;
852
- declare function compositeItemUnavailable(item: {
853
- variantId?: unknown;
854
- categoryId?: unknown;
855
- quantity: number;
856
- }, rows: CompositeAvailabilityRows): CompositeItemUnavailable | null;
857
- interface CompositeStockPart {
858
- min: number;
859
- items: readonly {
860
- id: string;
861
- variantId?: unknown;
862
- categoryId?: unknown;
863
- quantity: number;
864
- }[];
865
- }
866
- interface CompositeMakeableRow {
867
- itemIds: string[];
868
- partIndex?: number;
869
- uses: number;
870
- has: number | null;
871
- makes: number | null;
872
- }
873
- type CompositeMakeable = {
874
- byDate: true;
875
- } | {
876
- count: number | null;
877
- rows: CompositeMakeableRow[];
878
- limitedBy?: number;
879
- };
880
- declare function compositeMakeable(parts: readonly CompositeStockPart[], rows: CompositeAvailabilityRows): CompositeMakeable;
881
- interface PoolDrawing {
882
- variantId: string;
883
- stockVariantId?: string;
884
- quantity: number;
885
- unit?: Measurable;
886
- }
887
- declare const poolOf: (line: PoolDrawing) => string;
888
- declare function poolDemand(lines: readonly (PoolDrawing & {
889
- components?: readonly PoolDrawing[];
890
- })[]): Map<string, number>;
891
- declare function poolShortfall(demand: ReadonlyMap<string, number>, poolStock: ReadonlyMap<string, number | null>, backordered?: ReadonlySet<string>): {
892
- poolId: string;
893
- available: number;
894
- wanted: number;
895
- } | null;
896
-
897
- interface CompositeReservationOrder {
898
- lineItems?: readonly {
899
- internalId?: string;
900
- components?: readonly {
901
- productId: unknown;
902
- }[];
903
- }[];
904
- reservations?: readonly {
905
- bookingId?: unknown;
906
- productId: unknown;
907
- lineItemInternalId?: string;
908
- componentIndex?: number;
909
- price?: number;
910
- total?: number;
911
- }[];
912
- }
913
- declare function compositeModifierMismatches(lineItems: readonly {
914
- internalId?: string;
915
- components?: readonly unknown[];
916
- modifiers?: readonly {
917
- modifierName?: string;
918
- componentIndex?: number;
919
- }[];
920
- }[]): string[];
921
- declare function compositeReservationMismatches(order: CompositeReservationOrder): string[];
922
-
923
746
  declare const SYSTEM_FAMILY_IDS: {
924
747
  readonly COUNT: "count";
925
748
  readonly WEIGHT: "weight-metric";
@@ -1591,4 +1414,4 @@ declare const EUFixedRates: Record<string, CurrencyRate>;
1591
1414
  declare const OtherFixedRates: Record<string, CurrencyRate>;
1592
1415
  declare const COUNTRY_CURRENCIES: Record<string, string>;
1593
1416
 
1594
- 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, 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 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 ModifierChoiceRow, type ModifierRow, 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, type PoolDrawing, 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 ResolveInputs, 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, ancestorChain, assertUnitSane, availableIn, baseFor, baseFulfillmentDefinitions, baseOf, basePaymentDefinitions, buildAvailability, buildGrid, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, canTransition, cheapestCompositeItem, cheapestCompositePrice, compositeItemCost, compositeItemUnavailable, compositeMakeable, compositeModifierMismatches, compositeReservationMismatches, compositeVariantInStock, 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, hasSellableChoice, holdExpiresAt, inferStatesFromLegacyStatus, isAdyenRolloutCountry, isChoiceAvailableAtOutlet, isConditionOperator, isFulfillmentState, isPaymentState, isSupportedCurrency, isSystemFamilyCode, isValidQuantity, isWhole, mapToLegacyStatus, maxPrecisionFor, mergeFragment, modifiersSellable, multiplyAmount, normalizeMongoIdString, occupancyIn, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, planWindow, poolDemand, poolOf, poolShortfall, poolStockAt, presentAt, removeFragment, resolveFamily, resolveModifiersForProduct, resolveTemplate, resolveUnit, roundToPrecision, sameFamily, setOrderState, shopDayKey, shopDayRange, signReportForDisplay, slotsForWindow, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, violatesFinancialInvariant, windowEndsAt, withinPresence };
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 };
package/dist/index.d.ts CHANGED
@@ -224,7 +224,8 @@ declare enum InventorySpecificActionType {
224
224
  APPLIED_FROM_WOO = "APPLIED_FROM_WOO",
225
225
  PO_RECEIVED = "PO_RECEIVED",
226
226
  EXTERNAL_SALE = "EXTERNAL_SALE",
227
- EXTERNAL_RESTOCK = "EXTERNAL_RESTOCK"
227
+ EXTERNAL_RESTOCK = "EXTERNAL_RESTOCK",
228
+ CUSTOM = "CUSTOM"
228
229
  }
229
230
  declare enum ExtensionCategory {
230
231
  SYNC = "sync",
@@ -390,8 +391,7 @@ declare enum StripeCurrencyCode {
390
391
  declare enum ProductType {
391
392
  SIMPLE = "simple",
392
393
  VARIABLE = "variable",
393
- BOOKING = "booking",
394
- COMPOSITE = "composite"
394
+ BOOKING = "booking"
395
395
  }
396
396
  declare enum ProductStatus {
397
397
  ACTIVE = "active",
@@ -713,85 +713,6 @@ declare function generateMongoID(): string;
713
713
  declare function getCurrentISODate(): string;
714
714
  declare function normalizeMongoIdString(value: unknown): string | null;
715
715
 
716
- interface CompositePriceItem {
717
- extraCharge: number;
718
- quantity: number;
719
- available: boolean;
720
- }
721
- interface CompositePricePart {
722
- min: number;
723
- items: CompositePriceItem[];
724
- }
725
- declare const compositeItemCost: (item: CompositePriceItem) => number;
726
- declare function cheapestCompositeItem(items: CompositePriceItem[]): number | undefined;
727
- declare function cheapestCompositePrice(parts: CompositePricePart[]): number | undefined;
728
-
729
- type ModifierSelectionType = 'single' | 'multiple' | 'quantity';
730
- interface ResolvedModifierChoice {
731
- _id: string;
732
- name: string;
733
- price: number;
734
- isDefault?: boolean;
735
- defaultQuantity?: number;
736
- unavailableOutletIds?: string[];
737
- sortOrder: number;
738
- }
739
- interface ResolvedModifier {
740
- _id: string;
741
- name: string;
742
- selectionType: ModifierSelectionType;
743
- allowQuantity?: boolean;
744
- required: boolean;
745
- min?: number | null;
746
- max?: number | null;
747
- sortOrder: number;
748
- choices: ResolvedModifierChoice[];
749
- }
750
-
751
- interface ModifierChoiceRow {
752
- _id: string;
753
- name: string;
754
- price?: number;
755
- sortOrder?: number;
756
- isDefault?: boolean;
757
- defaultQuantity?: number;
758
- unavailableOutletIds?: string[];
759
- }
760
- interface ModifierRow {
761
- _id: string;
762
- name: string;
763
- selectionType: ModifierSelectionType;
764
- allowQuantity?: boolean;
765
- choices?: ModifierChoiceRow[];
766
- isDeleted?: boolean;
767
- }
768
- interface CategoryModifierRow {
769
- _id: string;
770
- modifierId: string;
771
- categoryId: string;
772
- required?: boolean;
773
- min?: number | null;
774
- max?: number | null;
775
- sortOrder?: number;
776
- isDeleted?: boolean;
777
- }
778
- interface CategoryRow {
779
- _id: string;
780
- parentId?: string | null;
781
- isDeleted?: boolean;
782
- }
783
- declare function ancestorChain(categoryId: string, categoriesById: Map<string, CategoryRow>): string[];
784
- interface ResolveInputs {
785
- categoryIds: string[];
786
- modifiers: ModifierRow[];
787
- categoryModifiers: CategoryModifierRow[];
788
- categories: CategoryRow[];
789
- }
790
- declare function resolveModifiersForProduct(inputs: ResolveInputs): ResolvedModifier[];
791
- declare function isChoiceAvailableAtOutlet(choice: ResolvedModifierChoice, outletId: string): boolean;
792
- declare function hasSellableChoice(modifier: ResolvedModifier, outletId: string): boolean;
793
- declare const modifiersSellable: (modifiers: ResolvedModifier[], outletId: string) => boolean;
794
-
795
716
  interface Measurable {
796
717
  name: string;
797
718
  abbreviation: string;
@@ -822,104 +743,6 @@ interface MeasurementUnit {
822
743
  sellable?: false;
823
744
  }
824
745
 
825
- type CompositeItemUnavailable = 'deleted' | 'inactive' | 'hidden' | 'empty' | 'out_of_stock' | 'by_date' | 'fully_booked';
826
-
827
- interface CompositeShelf {
828
- pool: string;
829
- unit?: Measurable;
830
- backorder: boolean;
831
- unresolved?: boolean;
832
- }
833
- interface CompositeAvailabilityRows {
834
- variantProducts: ReadonlyMap<string, string>;
835
- productStatuses: ReadonlyMap<string, string | undefined>;
836
- categoryVariants: ReadonlyMap<string, readonly string[]>;
837
- bookableProductIds: ReadonlySet<string>;
838
- outlet?: {
839
- hiddenProductIds: ReadonlySet<string>;
840
- unsellableProductIds: ReadonlySet<string>;
841
- shelves: ReadonlyMap<string, CompositeShelf>;
842
- poolStock: ReadonlyMap<string, number | null>;
843
- bookableSeats?: ReadonlyMap<string, number>;
844
- };
845
- }
846
- declare function poolStockAt(rows: readonly {
847
- outletId: unknown;
848
- manageStock?: boolean;
849
- quantity?: number;
850
- }[], outletId: string): number | null;
851
- declare function compositeVariantInStock(variantId: string, quantity: number, outlet: NonNullable<CompositeAvailabilityRows['outlet']>): boolean;
852
- declare function compositeItemUnavailable(item: {
853
- variantId?: unknown;
854
- categoryId?: unknown;
855
- quantity: number;
856
- }, rows: CompositeAvailabilityRows): CompositeItemUnavailable | null;
857
- interface CompositeStockPart {
858
- min: number;
859
- items: readonly {
860
- id: string;
861
- variantId?: unknown;
862
- categoryId?: unknown;
863
- quantity: number;
864
- }[];
865
- }
866
- interface CompositeMakeableRow {
867
- itemIds: string[];
868
- partIndex?: number;
869
- uses: number;
870
- has: number | null;
871
- makes: number | null;
872
- }
873
- type CompositeMakeable = {
874
- byDate: true;
875
- } | {
876
- count: number | null;
877
- rows: CompositeMakeableRow[];
878
- limitedBy?: number;
879
- };
880
- declare function compositeMakeable(parts: readonly CompositeStockPart[], rows: CompositeAvailabilityRows): CompositeMakeable;
881
- interface PoolDrawing {
882
- variantId: string;
883
- stockVariantId?: string;
884
- quantity: number;
885
- unit?: Measurable;
886
- }
887
- declare const poolOf: (line: PoolDrawing) => string;
888
- declare function poolDemand(lines: readonly (PoolDrawing & {
889
- components?: readonly PoolDrawing[];
890
- })[]): Map<string, number>;
891
- declare function poolShortfall(demand: ReadonlyMap<string, number>, poolStock: ReadonlyMap<string, number | null>, backordered?: ReadonlySet<string>): {
892
- poolId: string;
893
- available: number;
894
- wanted: number;
895
- } | null;
896
-
897
- interface CompositeReservationOrder {
898
- lineItems?: readonly {
899
- internalId?: string;
900
- components?: readonly {
901
- productId: unknown;
902
- }[];
903
- }[];
904
- reservations?: readonly {
905
- bookingId?: unknown;
906
- productId: unknown;
907
- lineItemInternalId?: string;
908
- componentIndex?: number;
909
- price?: number;
910
- total?: number;
911
- }[];
912
- }
913
- declare function compositeModifierMismatches(lineItems: readonly {
914
- internalId?: string;
915
- components?: readonly unknown[];
916
- modifiers?: readonly {
917
- modifierName?: string;
918
- componentIndex?: number;
919
- }[];
920
- }[]): string[];
921
- declare function compositeReservationMismatches(order: CompositeReservationOrder): string[];
922
-
923
746
  declare const SYSTEM_FAMILY_IDS: {
924
747
  readonly COUNT: "count";
925
748
  readonly WEIGHT: "weight-metric";
@@ -1591,4 +1414,4 @@ declare const EUFixedRates: Record<string, CurrencyRate>;
1591
1414
  declare const OtherFixedRates: Record<string, CurrencyRate>;
1592
1415
  declare const COUNTRY_CURRENCIES: Record<string, string>;
1593
1416
 
1594
- 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, 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 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 ModifierChoiceRow, type ModifierRow, 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, type PoolDrawing, 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 ResolveInputs, 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, ancestorChain, assertUnitSane, availableIn, baseFor, baseFulfillmentDefinitions, baseOf, basePaymentDefinitions, buildAvailability, buildGrid, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, canTransition, cheapestCompositeItem, cheapestCompositePrice, compositeItemCost, compositeItemUnavailable, compositeMakeable, compositeModifierMismatches, compositeReservationMismatches, compositeVariantInStock, 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, hasSellableChoice, holdExpiresAt, inferStatesFromLegacyStatus, isAdyenRolloutCountry, isChoiceAvailableAtOutlet, isConditionOperator, isFulfillmentState, isPaymentState, isSupportedCurrency, isSystemFamilyCode, isValidQuantity, isWhole, mapToLegacyStatus, maxPrecisionFor, mergeFragment, modifiersSellable, multiplyAmount, normalizeMongoIdString, occupancyIn, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, planWindow, poolDemand, poolOf, poolShortfall, poolStockAt, presentAt, removeFragment, resolveFamily, resolveModifiersForProduct, resolveTemplate, resolveUnit, roundToPrecision, sameFamily, setOrderState, shopDayKey, shopDayRange, signReportForDisplay, slotsForWindow, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, violatesFinancialInvariant, windowEndsAt, withinPresence };
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 };