@final-commerce/common 2.5.1-preprod.2 → 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 +27 -1
- package/dist/index.d.ts +27 -1
- package/dist/index.js +51 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +48 -0
- package/dist/index.mjs.map +1 -1
- package/dist/pos-types/index.d.mts +25 -2
- package/dist/pos-types/index.d.ts +25 -2
- package/dist/pos-types/index.js +1 -0
- package/dist/pos-types/index.js.map +1 -1
- package/dist/pos-types/index.mjs +1 -0
- package/dist/pos-types/index.mjs.map +1 -1
- package/package.json +1 -1
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;
|
|
@@ -1417,4 +1443,4 @@ declare const EUFixedRates: Record<string, CurrencyRate>;
|
|
|
1417
1443
|
declare const OtherFixedRates: Record<string, CurrencyRate>;
|
|
1418
1444
|
declare const COUNTRY_CURRENCIES: Record<string, string>;
|
|
1419
1445
|
|
|
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 };
|
|
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;
|
|
@@ -1417,4 +1443,4 @@ declare const EUFixedRates: Record<string, CurrencyRate>;
|
|
|
1417
1443
|
declare const OtherFixedRates: Record<string, CurrencyRate>;
|
|
1418
1444
|
declare const COUNTRY_CURRENCIES: Record<string, string>;
|
|
1419
1445
|
|
|
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 };
|
|
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
|
@@ -146,12 +146,14 @@ __export(index_exports, {
|
|
|
146
146
|
getPricingRegionFromCountry: () => getPricingRegionFromCountry,
|
|
147
147
|
getSettlementTotal: () => getSettlementTotal,
|
|
148
148
|
getTotalCollected: () => getTotalCollected,
|
|
149
|
+
hasInCartFlag: () => hasInCartFlag,
|
|
149
150
|
holdExpiresAt: () => holdExpiresAt,
|
|
150
151
|
inferStatesFromLegacyStatus: () => inferStatesFromLegacyStatus,
|
|
151
152
|
isAdyenRolloutCountry: () => isAdyenRolloutCountry,
|
|
152
153
|
isAffirmPricePlan: () => isAffirmPricePlan,
|
|
153
154
|
isConditionOperator: () => isConditionOperator,
|
|
154
155
|
isFulfillmentState: () => isFulfillmentState,
|
|
156
|
+
isInCart: () => isInCart,
|
|
155
157
|
isPaymentState: () => isPaymentState,
|
|
156
158
|
isSupportedCurrency: () => isSupportedCurrency,
|
|
157
159
|
isSystemFamilyCode: () => isSystemFamilyCode,
|
|
@@ -185,6 +187,7 @@ __export(index_exports, {
|
|
|
185
187
|
toMinorUnits: () => toMinorUnits,
|
|
186
188
|
validateConfig: () => validateConfig,
|
|
187
189
|
validateFragmentCompatibility: () => validateFragmentCompatibility,
|
|
190
|
+
validateOrderStatuses: () => validateOrderStatuses,
|
|
188
191
|
violatesFinancialInvariant: () => violatesFinancialInvariant,
|
|
189
192
|
windowEndsAt: () => windowEndsAt,
|
|
190
193
|
withinPresence: () => withinPresence
|
|
@@ -2685,6 +2688,51 @@ function inferStatesFromLegacyStatus(order) {
|
|
|
2685
2688
|
return { payment: "unpaid", fulfillment: "pending" };
|
|
2686
2689
|
}
|
|
2687
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
|
+
|
|
2688
2736
|
// order-state-machine/write-strategy.ts
|
|
2689
2737
|
var LegacyWriteStrategy = class {
|
|
2690
2738
|
applyState(_order) {
|
|
@@ -3526,12 +3574,14 @@ function isAffirmPricePlan(value) {
|
|
|
3526
3574
|
getPricingRegionFromCountry,
|
|
3527
3575
|
getSettlementTotal,
|
|
3528
3576
|
getTotalCollected,
|
|
3577
|
+
hasInCartFlag,
|
|
3529
3578
|
holdExpiresAt,
|
|
3530
3579
|
inferStatesFromLegacyStatus,
|
|
3531
3580
|
isAdyenRolloutCountry,
|
|
3532
3581
|
isAffirmPricePlan,
|
|
3533
3582
|
isConditionOperator,
|
|
3534
3583
|
isFulfillmentState,
|
|
3584
|
+
isInCart,
|
|
3535
3585
|
isPaymentState,
|
|
3536
3586
|
isSupportedCurrency,
|
|
3537
3587
|
isSystemFamilyCode,
|
|
@@ -3565,6 +3615,7 @@ function isAffirmPricePlan(value) {
|
|
|
3565
3615
|
toMinorUnits,
|
|
3566
3616
|
validateConfig,
|
|
3567
3617
|
validateFragmentCompatibility,
|
|
3618
|
+
validateOrderStatuses,
|
|
3568
3619
|
violatesFinancialInvariant,
|
|
3569
3620
|
windowEndsAt,
|
|
3570
3621
|
withinPresence
|