@final-commerce/common 2.5.1-preprod.5 → 2.5.1-staging2.1

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/bin/gate-done.mjs CHANGED
@@ -4,12 +4,12 @@
4
4
  *
5
5
  * Runs four sweeps inside a 90-second wall-clock budget:
6
6
  *
7
- * 1. npm audit — known CVE check against the installed dependency tree
7
+ * 1. npm audit — known CVE check against the installed dependency tree (warn only)
8
8
  * 2. gitleaks — credential / secret scanning (git log + staged)
9
9
  * 3. vitest — full test suite with coverage threshold enforcement
10
10
  * 4. bundle — size-limit or custom bundle-size script (if configured)
11
11
  *
12
- * Any sweep failure exits 1, blocking the push.
12
+ * Any sweep failure except npm audit exits 1, blocking the push.
13
13
  * Budget overrun also exits 1.
14
14
  *
15
15
  * Install as Husky pre-push hook:
@@ -81,9 +81,10 @@ checkBudget('npm audit');
81
81
 
82
82
  const auditResult = run('npm audit --audit-level=high');
83
83
  if (auditResult.status !== 0) {
84
- fail('npm audit found high or critical vulnerabilities. Run `npm audit` for details.');
84
+ warn('npm audit found high or critical vulnerabilities. Run `npm audit` for details.');
85
+ } else {
86
+ ok('npm audit: no high/critical vulnerabilities.');
85
87
  }
86
- ok('npm audit: no high/critical vulnerabilities.');
87
88
 
88
89
  // ── 2. gitleaks ───────────────────────────────────────────────────────────────
89
90
 
package/dist/index.d.mts CHANGED
@@ -663,43 +663,6 @@ interface EndOfSessionReport {
663
663
  minorUnits?: number;
664
664
  }
665
665
 
666
- declare const ADYEN_ROLLOUT_COUNTRY_CODES: Set<string>;
667
- declare function isAdyenRolloutCountry(alpha2: string): boolean;
668
- declare const AFFIRM_PRICE_PLANS: readonly ["core", "standard", "signature"];
669
- type AffirmPricePlan = (typeof AFFIRM_PRICE_PLANS)[number];
670
- declare function isAffirmPricePlan(value: unknown): value is AffirmPricePlan;
671
- declare const AFFIRM_COUNTRY_CODES: Set<string>;
672
- declare function isAffirmCountry(alpha2: string | undefined): boolean;
673
- declare const BNPL_METHOD_STATUS: {
674
- readonly ACTIVE: "active";
675
- readonly PENDING: "pending";
676
- readonly UNAVAILABLE: "unavailable";
677
- readonly UNKNOWN: "unknown";
678
- };
679
- type BnplMethodStatus = (typeof BNPL_METHOD_STATUS)[keyof typeof BNPL_METHOD_STATUS];
680
- declare const BNPL_SKIP_REASON: {
681
- readonly PENDING: "pending";
682
- readonly NO_SUPPORT_EMAIL: "no_support_email";
683
- readonly NO_CURRENCY: "no_currency";
684
- readonly NO_BUSINESS_LINE: "no_business_line";
685
- };
686
- type BnplSkipReason = (typeof BNPL_SKIP_REASON)[keyof typeof BNPL_SKIP_REASON];
687
-
688
- interface AdyenBnplSettings {
689
- affirmPricePlan?: AffirmPricePlan;
690
- affirm: BnplMethodStatus;
691
- available: boolean;
692
- }
693
- interface AdyenBnplSkippedStore {
694
- storeId: string;
695
- reason: BnplSkipReason;
696
- }
697
- interface AdyenBnplUpdateResult {
698
- updated: string[];
699
- requested: string[];
700
- skipped: AdyenBnplSkippedStore[];
701
- }
702
-
703
666
  declare const CURRENCY_CONFIG: Record<CurrencyCode | string, CurrencyConfig>;
704
667
  declare function getCurrencyConfig(currency: CurrencyCode): CurrencyConfig;
705
668
  declare function getMinorUnitMultiplier(currency: CurrencyCode): number;
@@ -842,21 +805,6 @@ declare function isConditionOperator(value: string): value is ConditionOperator;
842
805
  type PathMode = 'strict' | 'permissive';
843
806
  declare const PATH_MODES: readonly PathMode[];
844
807
 
845
- interface OrderStatusDefinition {
846
- id: string;
847
- label: string;
848
- color?: string;
849
- icon?: string;
850
- fulfillmentState?: FulfillmentState;
851
- requiresPaymentState?: PaymentState[];
852
- }
853
- interface OrderStatusValidationError {
854
- index: number;
855
- field: string;
856
- message: string;
857
- }
858
- declare function validateOrderStatuses(statuses: unknown): OrderStatusValidationError[];
859
-
860
808
  interface OrderPaymentMethod {
861
809
  id?: string;
862
810
  amount?: number;
@@ -896,7 +844,7 @@ interface OrderContext {
896
844
  paymentMethods: OrderPaymentMethod[];
897
845
  refunds: OrderRefund[];
898
846
  lineItems: OrderLineItem[];
899
- reservations: OrderReservationForContext[];
847
+ reservations?: OrderReservationForContext[];
900
848
  };
901
849
  computed: {
902
850
  balance: number;
@@ -1030,7 +978,6 @@ interface StoredStateConfig {
1030
978
  validInitialStates: StatePair[];
1031
979
  enforceValidInitialStates?: boolean;
1032
980
  displayStateMap: DisplayStateRule[];
1033
- orderStatuses?: OrderStatusDefinition[];
1034
981
  createdAt: Date;
1035
982
  updatedAt: Date;
1036
983
  }
@@ -1152,16 +1099,6 @@ declare function setOrderState(order: OrderStateWritable, paymentState: PaymentS
1152
1099
 
1153
1100
  declare function inferStatesFromLegacyStatus(order: OrderLikeForLegacyInference): StatePair;
1154
1101
 
1155
- interface OrderLikeForInCart {
1156
- inCart?: {
1157
- active: boolean;
1158
- } | null;
1159
- status?: string;
1160
- fulfillmentState?: string;
1161
- }
1162
- declare function hasInCartFlag(order: OrderLikeForInCart): boolean;
1163
- declare function isInCart(order: OrderLikeForInCart): boolean;
1164
-
1165
1102
  interface OrderMutationData extends OrderStateWritable {
1166
1103
  total?: number;
1167
1104
  balance?: number;
@@ -1463,6 +1400,26 @@ declare function planWindow({ rule, timeZone, presence, startAt, endAt, now, bus
1463
1400
  };
1464
1401
  declare const holdExpiresAt: (rule: BookingRulesInput, now: Date) => Date;
1465
1402
 
1403
+ declare const ADYEN_ROLLOUT_COUNTRY_CODES: Set<string>;
1404
+ declare function isAdyenRolloutCountry(alpha2: string): boolean;
1405
+ declare const ADYEN_STORE_STATE_PROVINCE_COUNTRIES: Set<string>;
1406
+ declare function adyenStoreRequiresStateOrProvince(alpha2: string | undefined): boolean;
1407
+ declare const ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES: Set<string>;
1408
+ declare function adyenLegalEntityRequiresStateOrProvince(alpha2: string | undefined): boolean;
1409
+ declare const ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES: Set<string>;
1410
+ declare function adyenSupportsTaxNumberAbsent(alpha2: string | undefined): boolean;
1411
+ declare const ADYEN_TAX_NUMBER_FORMATS: Record<string, {
1412
+ pattern: RegExp;
1413
+ length: number;
1414
+ }>;
1415
+ declare function adyenTaxNumberFormat(alpha2: string | undefined): {
1416
+ pattern: RegExp;
1417
+ length: number;
1418
+ } | undefined;
1419
+ declare const ADYEN_TAX_NUMBER_MIN_LENGTH = 5;
1420
+ declare const ADYEN_JOB_TITLE_ASSOCIATION_TYPES: readonly string[];
1421
+ declare function adyenRequiresJobTitle(associationType: string): boolean;
1422
+
1466
1423
  interface CurrencyRate {
1467
1424
  rate: number;
1468
1425
  country: string;
@@ -1474,4 +1431,4 @@ declare const EUFixedRates: Record<string, CurrencyRate>;
1474
1431
  declare const OtherFixedRates: Record<string, CurrencyRate>;
1475
1432
  declare const COUNTRY_CURRENCIES: Record<string, string>;
1476
1433
 
1477
- export { ADYEN_ROLLOUT_COUNTRY_CODES, AFFIRM_COUNTRY_CODES, AFFIRM_PRICE_PLANS, type AdyenBnplSettings, type AdyenBnplSkippedStore, type AdyenBnplUpdateResult, type AffirmPricePlan, type Amount, AttributeType, type AvailabilityInput, type AvailabilitySlot, type AvailableTransition, BNPL_METHOD_STATUS, BNPL_SKIP_REASON, type BnplMethodStatus, type BnplSkipReason, type BookingOccupancy, BookingRatePeriod, type BookingResourceInput, BookingResourceKind, BookingResourceStatus, BookingRulesError, type BookingRulesInput, BookingType, type BusyWindow, CONDITION_OPERATORS, COUNTRY_CURRENCIES, CURRENCY_CONFIG, type CartDiscountBucket, type CartFeeBucket, type CashDrawer, type CashRoundingTuple, CompanyType, type Condition, type ConditionGroup, type ConditionOperator, type ConfigUpdatedPayload, type ConfigValidationError, type ConfigValidationResult, type ConfigValidationWarning, type CrossAxisRequires, type CrossAxisRule, type CrossAxisTrigger, CurrencyCode, type CurrencyConfig, type CurrencyRate, CustomTableAvailability, CustomerPlatform, DEFAULT_CONFIG, DEFAULT_CROSS_AXIS_RULES, DEFAULT_DISPLAY_STATE_MAP, DEFAULT_HOLD_MINUTES, DEFAULT_RESOLVED_CONFIG, DEFAULT_UNIT_ID, type DeleteStateConfigFragmentParams, type DeleteStateConfigFragmentResponse, type DiscountsBreakdown, type DiscountsTuple, type DisplayStateResult, type DisplayStateRule, DualWriteStrategy, EUFixedRates, EUROPE, type EndOfSessionReport, ExtensionCategory, FINANCIAL_INVARIANTS, FULFILLMENT_STATES, type FailedCondition, type FeesBreakdown, FeesCustomBillingStatus, type FeesTuple, type FinancialInvariant, type FragmentParam, type FragmentValidationResult, type FulfillmentState, type FulfillmentStateDefinition, type FulfillmentTransitionPath, type GetAvailableTransitionsParams, type GetAvailableTransitionsResponse, type GetOrderDisplayStateParams, type GetOrderDisplayStateResponse, type GetOrderStateConfigParams, type GetOrderStateConfigResponse, type GetStateConfigFragmentParams, type GetStateConfigFragmentResponse, type GridSlot, InventoryBaseActionEnum, type InventoryBaseActionType, InventorySpecificActionType, InvoiceStatus, LegacyWriteStrategy, LibraryItemType, MAX_PRECISION, type Measurable, type MeasurementBase, type MeasurementUnit, type MeasurementUnitFamily, MenuProject, type ModifiersBreakdown, type ModifiersTuple, NAFixedRates, NORTH_AMERICA, NonRevenueItemType, ORDER_STATE_ACTIONS, ORDER_STATE_EVENTS, ORDER_STATE_TOPIC, type OrderContext, type OrderLikeForContext, type OrderLikeForInCart, type OrderLikeForLegacyInference, type OrderLineItem, type OrderMutationData, type OrderPaymentMethod, OrderPlatform, type OrderRefund, type OrderReservationForContext, type OrderStateEventPayload, type OrderStateWritable, type OrderStatusDefinition, type OrderStatusValidationError, type OrderWriteStrategy, OtherFixedRates, OwnerType, PATH_MODES, PAYMENT_STATES, POS_VALID_INITIAL_STATES, type PathMode, PaymentMethod, PaymentProcessor, type PaymentState, type PaymentStateDefinition, type PaymentTransitionPath, type PlanWindowInput, Platform, PreviewImageMode, PricingLevel, PricingPlanEnum, PricingRegionEnum, type ProductDiscountBucket, type ProductFeeBucket, ProductStatus, ProductType, PublicationAvailability, type PublicationConfig, PublicationStatus, REGION_MAPPING, REPORT_NEGATE_PATHS, ReceiptSendChannel, ReceiptType, type RefundsBreakdown, ReservationStatus, ResidualPaymentMethod, ResidualStatus, type ResolveTemplateResult, type ResourceAvailability, ResourceAvailabilityState, type ResourceInWindow, type ResourcePresenceRow, STATE_SCHEMA, STRIPE_SUPPORTED_COUNTRIES, SYSTEM_FAMILIES, SYSTEM_FAMILY_IDS, SYSTEM_UNITS, SYSTEM_UNIT_IDS, type SalesSummary, type SaveStateConfigFragmentParams, type SaveStateConfigFragmentResponse, type SettlementBreakdown, type SettlementBuckets, type SettlementCardSection, type SettlementCashSection, type SettlementCustomEntry, type SplitPayment, type SplitPaymentPayment, type StaffSales, type StaffSalesEntry, type StateConfig, type StateConfigFragment, type StateDefinition, type StatePair, type StateSchema, type StateTransitionBlockedPayload, type StateTransitionCompletedPayload, StationStatus, type StoredStateConfig, StripeCurrencyCode, StripeStatus, type TaxBreakdown, type TaxBreakdownRateEntry, type TaxBreakdownSection, type TaxBreakdownSubtotal, type TaxesTuple, TimePeriod, type TipEntry, type TipsBreakdown, type TipsTuple, TopMetericsSort, type TransitionBlockedBy, type TransitionConditionSet, type TransitionOrderStateParams, type TransitionOrderStateResponse, type TransitionPath, type TransitionRequest, type TransitionResult, UserTypes, type WeeklyHours, addAmounts, amountToString, assertUnitSane, availableIn, baseFor, baseFulfillmentDefinitions, baseOf, basePaymentDefinitions, buildAvailability, buildGrid, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, canTransition, conditionSummary, convertFixedFeeToLocalCurrency, createAmount, crossAxisRuleApplies, deriveDisplayState, deriveFamilyCode, deriveUnitId, displayRuleMatchesPair, divideAmount, evaluateCondition, evaluateConditionSet, extendPrice, extendPriceFor, formatCurrency, formatInUnit, formatMinorUnitsToString, formatQuantity, fromBase, fromMinorUnits, generateMongoID, getAvailableTransitions, getCashAmountDue, getCountriesByRegion, getCurrencyConfig, getCurrentISODate, getFinancialInvariantViolations, getGoodsPortion, getLineSubtotal, getMinorUnitMultiplier, getMinorUnits, getPaymentLegTotal, getPricingRegionFromCountry, getSettlementTotal, getTotalCollected, hasInCartFlag, holdExpiresAt, inferStatesFromLegacyStatus, isAdyenRolloutCountry, isAffirmCountry, isAffirmPricePlan, isConditionOperator, isFulfillmentState, isInCart, isPaymentState, isSupportedCurrency, isSystemFamilyCode, isValidQuantity, isWhole, mapToLegacyStatus, maxPrecisionFor, mergeFragment, multiplyAmount, normalizeMongoIdString, occupancyIn, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, planWindow, presentAt, removeFragment, resolveFamily, resolveTemplate, resolveUnit, roundToPrecision, sameFamily, setOrderState, shopDayKey, shopDayRange, signReportForDisplay, slotsForWindow, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, validateOrderStatuses, violatesFinancialInvariant, windowEndsAt, withinPresence };
1434
+ export { ADYEN_JOB_TITLE_ASSOCIATION_TYPES, ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES, ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES, ADYEN_ROLLOUT_COUNTRY_CODES, ADYEN_STORE_STATE_PROVINCE_COUNTRIES, ADYEN_TAX_NUMBER_FORMATS, ADYEN_TAX_NUMBER_MIN_LENGTH, 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, adyenLegalEntityRequiresStateOrProvince, adyenRequiresJobTitle, adyenStoreRequiresStateOrProvince, adyenSupportsTaxNumberAbsent, adyenTaxNumberFormat, 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
@@ -663,43 +663,6 @@ interface EndOfSessionReport {
663
663
  minorUnits?: number;
664
664
  }
665
665
 
666
- declare const ADYEN_ROLLOUT_COUNTRY_CODES: Set<string>;
667
- declare function isAdyenRolloutCountry(alpha2: string): boolean;
668
- declare const AFFIRM_PRICE_PLANS: readonly ["core", "standard", "signature"];
669
- type AffirmPricePlan = (typeof AFFIRM_PRICE_PLANS)[number];
670
- declare function isAffirmPricePlan(value: unknown): value is AffirmPricePlan;
671
- declare const AFFIRM_COUNTRY_CODES: Set<string>;
672
- declare function isAffirmCountry(alpha2: string | undefined): boolean;
673
- declare const BNPL_METHOD_STATUS: {
674
- readonly ACTIVE: "active";
675
- readonly PENDING: "pending";
676
- readonly UNAVAILABLE: "unavailable";
677
- readonly UNKNOWN: "unknown";
678
- };
679
- type BnplMethodStatus = (typeof BNPL_METHOD_STATUS)[keyof typeof BNPL_METHOD_STATUS];
680
- declare const BNPL_SKIP_REASON: {
681
- readonly PENDING: "pending";
682
- readonly NO_SUPPORT_EMAIL: "no_support_email";
683
- readonly NO_CURRENCY: "no_currency";
684
- readonly NO_BUSINESS_LINE: "no_business_line";
685
- };
686
- type BnplSkipReason = (typeof BNPL_SKIP_REASON)[keyof typeof BNPL_SKIP_REASON];
687
-
688
- interface AdyenBnplSettings {
689
- affirmPricePlan?: AffirmPricePlan;
690
- affirm: BnplMethodStatus;
691
- available: boolean;
692
- }
693
- interface AdyenBnplSkippedStore {
694
- storeId: string;
695
- reason: BnplSkipReason;
696
- }
697
- interface AdyenBnplUpdateResult {
698
- updated: string[];
699
- requested: string[];
700
- skipped: AdyenBnplSkippedStore[];
701
- }
702
-
703
666
  declare const CURRENCY_CONFIG: Record<CurrencyCode | string, CurrencyConfig>;
704
667
  declare function getCurrencyConfig(currency: CurrencyCode): CurrencyConfig;
705
668
  declare function getMinorUnitMultiplier(currency: CurrencyCode): number;
@@ -842,21 +805,6 @@ declare function isConditionOperator(value: string): value is ConditionOperator;
842
805
  type PathMode = 'strict' | 'permissive';
843
806
  declare const PATH_MODES: readonly PathMode[];
844
807
 
845
- interface OrderStatusDefinition {
846
- id: string;
847
- label: string;
848
- color?: string;
849
- icon?: string;
850
- fulfillmentState?: FulfillmentState;
851
- requiresPaymentState?: PaymentState[];
852
- }
853
- interface OrderStatusValidationError {
854
- index: number;
855
- field: string;
856
- message: string;
857
- }
858
- declare function validateOrderStatuses(statuses: unknown): OrderStatusValidationError[];
859
-
860
808
  interface OrderPaymentMethod {
861
809
  id?: string;
862
810
  amount?: number;
@@ -896,7 +844,7 @@ interface OrderContext {
896
844
  paymentMethods: OrderPaymentMethod[];
897
845
  refunds: OrderRefund[];
898
846
  lineItems: OrderLineItem[];
899
- reservations: OrderReservationForContext[];
847
+ reservations?: OrderReservationForContext[];
900
848
  };
901
849
  computed: {
902
850
  balance: number;
@@ -1030,7 +978,6 @@ interface StoredStateConfig {
1030
978
  validInitialStates: StatePair[];
1031
979
  enforceValidInitialStates?: boolean;
1032
980
  displayStateMap: DisplayStateRule[];
1033
- orderStatuses?: OrderStatusDefinition[];
1034
981
  createdAt: Date;
1035
982
  updatedAt: Date;
1036
983
  }
@@ -1152,16 +1099,6 @@ declare function setOrderState(order: OrderStateWritable, paymentState: PaymentS
1152
1099
 
1153
1100
  declare function inferStatesFromLegacyStatus(order: OrderLikeForLegacyInference): StatePair;
1154
1101
 
1155
- interface OrderLikeForInCart {
1156
- inCart?: {
1157
- active: boolean;
1158
- } | null;
1159
- status?: string;
1160
- fulfillmentState?: string;
1161
- }
1162
- declare function hasInCartFlag(order: OrderLikeForInCart): boolean;
1163
- declare function isInCart(order: OrderLikeForInCart): boolean;
1164
-
1165
1102
  interface OrderMutationData extends OrderStateWritable {
1166
1103
  total?: number;
1167
1104
  balance?: number;
@@ -1463,6 +1400,26 @@ declare function planWindow({ rule, timeZone, presence, startAt, endAt, now, bus
1463
1400
  };
1464
1401
  declare const holdExpiresAt: (rule: BookingRulesInput, now: Date) => Date;
1465
1402
 
1403
+ declare const ADYEN_ROLLOUT_COUNTRY_CODES: Set<string>;
1404
+ declare function isAdyenRolloutCountry(alpha2: string): boolean;
1405
+ declare const ADYEN_STORE_STATE_PROVINCE_COUNTRIES: Set<string>;
1406
+ declare function adyenStoreRequiresStateOrProvince(alpha2: string | undefined): boolean;
1407
+ declare const ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES: Set<string>;
1408
+ declare function adyenLegalEntityRequiresStateOrProvince(alpha2: string | undefined): boolean;
1409
+ declare const ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES: Set<string>;
1410
+ declare function adyenSupportsTaxNumberAbsent(alpha2: string | undefined): boolean;
1411
+ declare const ADYEN_TAX_NUMBER_FORMATS: Record<string, {
1412
+ pattern: RegExp;
1413
+ length: number;
1414
+ }>;
1415
+ declare function adyenTaxNumberFormat(alpha2: string | undefined): {
1416
+ pattern: RegExp;
1417
+ length: number;
1418
+ } | undefined;
1419
+ declare const ADYEN_TAX_NUMBER_MIN_LENGTH = 5;
1420
+ declare const ADYEN_JOB_TITLE_ASSOCIATION_TYPES: readonly string[];
1421
+ declare function adyenRequiresJobTitle(associationType: string): boolean;
1422
+
1466
1423
  interface CurrencyRate {
1467
1424
  rate: number;
1468
1425
  country: string;
@@ -1474,4 +1431,4 @@ declare const EUFixedRates: Record<string, CurrencyRate>;
1474
1431
  declare const OtherFixedRates: Record<string, CurrencyRate>;
1475
1432
  declare const COUNTRY_CURRENCIES: Record<string, string>;
1476
1433
 
1477
- export { ADYEN_ROLLOUT_COUNTRY_CODES, AFFIRM_COUNTRY_CODES, AFFIRM_PRICE_PLANS, type AdyenBnplSettings, type AdyenBnplSkippedStore, type AdyenBnplUpdateResult, type AffirmPricePlan, type Amount, AttributeType, type AvailabilityInput, type AvailabilitySlot, type AvailableTransition, BNPL_METHOD_STATUS, BNPL_SKIP_REASON, type BnplMethodStatus, type BnplSkipReason, type BookingOccupancy, BookingRatePeriod, type BookingResourceInput, BookingResourceKind, BookingResourceStatus, BookingRulesError, type BookingRulesInput, BookingType, type BusyWindow, CONDITION_OPERATORS, COUNTRY_CURRENCIES, CURRENCY_CONFIG, type CartDiscountBucket, type CartFeeBucket, type CashDrawer, type CashRoundingTuple, CompanyType, type Condition, type ConditionGroup, type ConditionOperator, type ConfigUpdatedPayload, type ConfigValidationError, type ConfigValidationResult, type ConfigValidationWarning, type CrossAxisRequires, type CrossAxisRule, type CrossAxisTrigger, CurrencyCode, type CurrencyConfig, type CurrencyRate, CustomTableAvailability, CustomerPlatform, DEFAULT_CONFIG, DEFAULT_CROSS_AXIS_RULES, DEFAULT_DISPLAY_STATE_MAP, DEFAULT_HOLD_MINUTES, DEFAULT_RESOLVED_CONFIG, DEFAULT_UNIT_ID, type DeleteStateConfigFragmentParams, type DeleteStateConfigFragmentResponse, type DiscountsBreakdown, type DiscountsTuple, type DisplayStateResult, type DisplayStateRule, DualWriteStrategy, EUFixedRates, EUROPE, type EndOfSessionReport, ExtensionCategory, FINANCIAL_INVARIANTS, FULFILLMENT_STATES, type FailedCondition, type FeesBreakdown, FeesCustomBillingStatus, type FeesTuple, type FinancialInvariant, type FragmentParam, type FragmentValidationResult, type FulfillmentState, type FulfillmentStateDefinition, type FulfillmentTransitionPath, type GetAvailableTransitionsParams, type GetAvailableTransitionsResponse, type GetOrderDisplayStateParams, type GetOrderDisplayStateResponse, type GetOrderStateConfigParams, type GetOrderStateConfigResponse, type GetStateConfigFragmentParams, type GetStateConfigFragmentResponse, type GridSlot, InventoryBaseActionEnum, type InventoryBaseActionType, InventorySpecificActionType, InvoiceStatus, LegacyWriteStrategy, LibraryItemType, MAX_PRECISION, type Measurable, type MeasurementBase, type MeasurementUnit, type MeasurementUnitFamily, MenuProject, type ModifiersBreakdown, type ModifiersTuple, NAFixedRates, NORTH_AMERICA, NonRevenueItemType, ORDER_STATE_ACTIONS, ORDER_STATE_EVENTS, ORDER_STATE_TOPIC, type OrderContext, type OrderLikeForContext, type OrderLikeForInCart, type OrderLikeForLegacyInference, type OrderLineItem, type OrderMutationData, type OrderPaymentMethod, OrderPlatform, type OrderRefund, type OrderReservationForContext, type OrderStateEventPayload, type OrderStateWritable, type OrderStatusDefinition, type OrderStatusValidationError, type OrderWriteStrategy, OtherFixedRates, OwnerType, PATH_MODES, PAYMENT_STATES, POS_VALID_INITIAL_STATES, type PathMode, PaymentMethod, PaymentProcessor, type PaymentState, type PaymentStateDefinition, type PaymentTransitionPath, type PlanWindowInput, Platform, PreviewImageMode, PricingLevel, PricingPlanEnum, PricingRegionEnum, type ProductDiscountBucket, type ProductFeeBucket, ProductStatus, ProductType, PublicationAvailability, type PublicationConfig, PublicationStatus, REGION_MAPPING, REPORT_NEGATE_PATHS, ReceiptSendChannel, ReceiptType, type RefundsBreakdown, ReservationStatus, ResidualPaymentMethod, ResidualStatus, type ResolveTemplateResult, type ResourceAvailability, ResourceAvailabilityState, type ResourceInWindow, type ResourcePresenceRow, STATE_SCHEMA, STRIPE_SUPPORTED_COUNTRIES, SYSTEM_FAMILIES, SYSTEM_FAMILY_IDS, SYSTEM_UNITS, SYSTEM_UNIT_IDS, type SalesSummary, type SaveStateConfigFragmentParams, type SaveStateConfigFragmentResponse, type SettlementBreakdown, type SettlementBuckets, type SettlementCardSection, type SettlementCashSection, type SettlementCustomEntry, type SplitPayment, type SplitPaymentPayment, type StaffSales, type StaffSalesEntry, type StateConfig, type StateConfigFragment, type StateDefinition, type StatePair, type StateSchema, type StateTransitionBlockedPayload, type StateTransitionCompletedPayload, StationStatus, type StoredStateConfig, StripeCurrencyCode, StripeStatus, type TaxBreakdown, type TaxBreakdownRateEntry, type TaxBreakdownSection, type TaxBreakdownSubtotal, type TaxesTuple, TimePeriod, type TipEntry, type TipsBreakdown, type TipsTuple, TopMetericsSort, type TransitionBlockedBy, type TransitionConditionSet, type TransitionOrderStateParams, type TransitionOrderStateResponse, type TransitionPath, type TransitionRequest, type TransitionResult, UserTypes, type WeeklyHours, addAmounts, amountToString, assertUnitSane, availableIn, baseFor, baseFulfillmentDefinitions, baseOf, basePaymentDefinitions, buildAvailability, buildGrid, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, canTransition, conditionSummary, convertFixedFeeToLocalCurrency, createAmount, crossAxisRuleApplies, deriveDisplayState, deriveFamilyCode, deriveUnitId, displayRuleMatchesPair, divideAmount, evaluateCondition, evaluateConditionSet, extendPrice, extendPriceFor, formatCurrency, formatInUnit, formatMinorUnitsToString, formatQuantity, fromBase, fromMinorUnits, generateMongoID, getAvailableTransitions, getCashAmountDue, getCountriesByRegion, getCurrencyConfig, getCurrentISODate, getFinancialInvariantViolations, getGoodsPortion, getLineSubtotal, getMinorUnitMultiplier, getMinorUnits, getPaymentLegTotal, getPricingRegionFromCountry, getSettlementTotal, getTotalCollected, hasInCartFlag, holdExpiresAt, inferStatesFromLegacyStatus, isAdyenRolloutCountry, isAffirmCountry, isAffirmPricePlan, isConditionOperator, isFulfillmentState, isInCart, isPaymentState, isSupportedCurrency, isSystemFamilyCode, isValidQuantity, isWhole, mapToLegacyStatus, maxPrecisionFor, mergeFragment, multiplyAmount, normalizeMongoIdString, occupancyIn, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, planWindow, presentAt, removeFragment, resolveFamily, resolveTemplate, resolveUnit, roundToPrecision, sameFamily, setOrderState, shopDayKey, shopDayRange, signReportForDisplay, slotsForWindow, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, validateOrderStatuses, violatesFinancialInvariant, windowEndsAt, withinPresence };
1434
+ export { ADYEN_JOB_TITLE_ASSOCIATION_TYPES, ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES, ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES, ADYEN_ROLLOUT_COUNTRY_CODES, ADYEN_STORE_STATE_PROVINCE_COUNTRIES, ADYEN_TAX_NUMBER_FORMATS, ADYEN_TAX_NUMBER_MIN_LENGTH, 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, adyenLegalEntityRequiresStateOrProvince, adyenRequiresJobTitle, adyenStoreRequiresStateOrProvince, adyenSupportsTaxNumberAbsent, adyenTaxNumberFormat, 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.js CHANGED
@@ -19,12 +19,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  // index.ts
20
20
  var index_exports = {};
21
21
  __export(index_exports, {
22
+ ADYEN_JOB_TITLE_ASSOCIATION_TYPES: () => ADYEN_JOB_TITLE_ASSOCIATION_TYPES,
23
+ ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES: () => ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES,
24
+ ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES: () => ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES,
22
25
  ADYEN_ROLLOUT_COUNTRY_CODES: () => ADYEN_ROLLOUT_COUNTRY_CODES,
23
- AFFIRM_COUNTRY_CODES: () => AFFIRM_COUNTRY_CODES,
24
- AFFIRM_PRICE_PLANS: () => AFFIRM_PRICE_PLANS,
26
+ ADYEN_STORE_STATE_PROVINCE_COUNTRIES: () => ADYEN_STORE_STATE_PROVINCE_COUNTRIES,
27
+ ADYEN_TAX_NUMBER_FORMATS: () => ADYEN_TAX_NUMBER_FORMATS,
28
+ ADYEN_TAX_NUMBER_MIN_LENGTH: () => ADYEN_TAX_NUMBER_MIN_LENGTH,
25
29
  AttributeType: () => AttributeType,
26
- BNPL_METHOD_STATUS: () => BNPL_METHOD_STATUS,
27
- BNPL_SKIP_REASON: () => BNPL_SKIP_REASON,
28
30
  BookingRatePeriod: () => BookingRatePeriod,
29
31
  BookingResourceKind: () => BookingResourceKind,
30
32
  BookingResourceStatus: () => BookingResourceStatus,
@@ -101,6 +103,11 @@ __export(index_exports, {
101
103
  TopMetericsSort: () => TopMetericsSort,
102
104
  UserTypes: () => UserTypes,
103
105
  addAmounts: () => addAmounts,
106
+ adyenLegalEntityRequiresStateOrProvince: () => adyenLegalEntityRequiresStateOrProvince,
107
+ adyenRequiresJobTitle: () => adyenRequiresJobTitle,
108
+ adyenStoreRequiresStateOrProvince: () => adyenStoreRequiresStateOrProvince,
109
+ adyenSupportsTaxNumberAbsent: () => adyenSupportsTaxNumberAbsent,
110
+ adyenTaxNumberFormat: () => adyenTaxNumberFormat,
104
111
  amountToString: () => amountToString,
105
112
  assertUnitSane: () => assertUnitSane,
106
113
  availableIn: () => availableIn,
@@ -149,15 +156,11 @@ __export(index_exports, {
149
156
  getPricingRegionFromCountry: () => getPricingRegionFromCountry,
150
157
  getSettlementTotal: () => getSettlementTotal,
151
158
  getTotalCollected: () => getTotalCollected,
152
- hasInCartFlag: () => hasInCartFlag,
153
159
  holdExpiresAt: () => holdExpiresAt,
154
160
  inferStatesFromLegacyStatus: () => inferStatesFromLegacyStatus,
155
161
  isAdyenRolloutCountry: () => isAdyenRolloutCountry,
156
- isAffirmCountry: () => isAffirmCountry,
157
- isAffirmPricePlan: () => isAffirmPricePlan,
158
162
  isConditionOperator: () => isConditionOperator,
159
163
  isFulfillmentState: () => isFulfillmentState,
160
- isInCart: () => isInCart,
161
164
  isPaymentState: () => isPaymentState,
162
165
  isSupportedCurrency: () => isSupportedCurrency,
163
166
  isSystemFamilyCode: () => isSystemFamilyCode,
@@ -191,7 +194,6 @@ __export(index_exports, {
191
194
  toMinorUnits: () => toMinorUnits,
192
195
  validateConfig: () => validateConfig,
193
196
  validateFragmentCompatibility: () => validateFragmentCompatibility,
194
- validateOrderStatuses: () => validateOrderStatuses,
195
197
  violatesFinancialInvariant: () => violatesFinancialInvariant,
196
198
  windowEndsAt: () => windowEndsAt,
197
199
  withinPresence: () => withinPresence
@@ -2692,51 +2694,6 @@ function inferStatesFromLegacyStatus(order) {
2692
2694
  return { payment: "unpaid", fulfillment: "pending" };
2693
2695
  }
2694
2696
 
2695
- // order-state-machine/in-cart.ts
2696
- function hasInCartFlag(order) {
2697
- return order.inCart != null;
2698
- }
2699
- function isInCart(order) {
2700
- if (order.inCart != null) return order.inCart.active === true;
2701
- if (order.fulfillmentState) return order.fulfillmentState === "draft";
2702
- return (order.status ?? "").trim().toLowerCase() === "in-cart";
2703
- }
2704
-
2705
- // order-state-machine/order-status.ts
2706
- function validateOrderStatuses(statuses) {
2707
- if (!Array.isArray(statuses)) {
2708
- return [{ index: -1, field: "orderStatuses", message: "must be an array" }];
2709
- }
2710
- const errors = [];
2711
- const seen = /* @__PURE__ */ new Set();
2712
- statuses.forEach((raw, index) => {
2713
- const s = raw ?? {};
2714
- const add = (field, message) => errors.push({ index, field, message });
2715
- if (typeof s.id !== "string" || !s.id.trim()) add("id", "must be a non-empty string");
2716
- else if (seen.has(s.id)) add("id", `duplicate id "${s.id}"`);
2717
- else seen.add(s.id);
2718
- if (typeof s.label !== "string" || !s.label.trim()) add("label", "must be a non-empty string");
2719
- for (const field of ["color", "icon"]) {
2720
- if (s[field] !== void 0 && typeof s[field] !== "string") add(field, "must be a string");
2721
- }
2722
- if (s.fulfillmentState !== void 0 && !(typeof s.fulfillmentState === "string" && isFulfillmentState(s.fulfillmentState))) {
2723
- add("fulfillmentState", `"${String(s.fulfillmentState)}" is not a fulfillment state`);
2724
- }
2725
- if (s.requiresPaymentState !== void 0) {
2726
- if (!Array.isArray(s.requiresPaymentState) || s.requiresPaymentState.length === 0) {
2727
- add("requiresPaymentState", "must be a non-empty array of payment states");
2728
- } else {
2729
- for (const p of s.requiresPaymentState) {
2730
- if (!(typeof p === "string" && isPaymentState(p))) {
2731
- add("requiresPaymentState", `"${String(p)}" is not a payment state`);
2732
- }
2733
- }
2734
- }
2735
- }
2736
- });
2737
- return errors;
2738
- }
2739
-
2740
2697
  // order-state-machine/write-strategy.ts
2741
2698
  var LegacyWriteStrategy = class {
2742
2699
  applyState(_order) {
@@ -3248,7 +3205,9 @@ function buildGrid(rule, timeZone, from, to, now, busy = []) {
3248
3205
  const start = startAt.getTime();
3249
3206
  if (start < askedFrom || start >= askedTo) return false;
3250
3207
  if (start < notBefore || start > notAfter) return false;
3251
- return !blocked.some(({ from: blockFrom, to: blockTo }) => start < blockTo && bufferEndAt.getTime() > blockFrom);
3208
+ return !blocked.some(
3209
+ ({ from: blockFrom, to: blockTo }) => start < blockTo && bufferEndAt.getTime() > blockFrom
3210
+ );
3252
3211
  }).sort((first, second) => +first.startAt - +second.startAt);
3253
3212
  }
3254
3213
  function slotsForWindow(grid, startAt, endAt) {
@@ -3367,7 +3326,14 @@ function buildAvailability({
3367
3326
  for (const slot of slots2) {
3368
3327
  const { taken, foreignProductId } = occupancyIn(mine, productId, slot.startAt, slot.bufferEndAt, shared);
3369
3328
  const free = foreignProductId ? 0 : Math.max(capacity - taken, 0);
3370
- const entry = byInstant.get(+slot.startAt) ?? { ...slot, capacity: 0, booked: 0, free: 0, resources: [], dayKey: shopDayKey(slot.startAt, resource.timeZone) };
3329
+ const entry = byInstant.get(+slot.startAt) ?? {
3330
+ ...slot,
3331
+ capacity: 0,
3332
+ booked: 0,
3333
+ free: 0,
3334
+ resources: [],
3335
+ dayKey: shopDayKey(slot.startAt, resource.timeZone)
3336
+ };
3371
3337
  entry.capacity += capacity;
3372
3338
  entry.booked += foreignProductId ? capacity : taken;
3373
3339
  entry.free += free;
@@ -3445,34 +3411,39 @@ var ADYEN_ROLLOUT_COUNTRY_CODES = /* @__PURE__ */ new Set(["CA"]);
3445
3411
  function isAdyenRolloutCountry(alpha2) {
3446
3412
  return ADYEN_ROLLOUT_COUNTRY_CODES.has(alpha2);
3447
3413
  }
3448
- var AFFIRM_PRICE_PLANS = ["core", "standard", "signature"];
3449
- function isAffirmPricePlan(value) {
3450
- return typeof value === "string" && AFFIRM_PRICE_PLANS.includes(value);
3414
+ var ADYEN_STORE_STATE_PROVINCE_COUNTRIES = /* @__PURE__ */ new Set(["AU", "BR", "CA", "IN", "MX", "NZ", "US"]);
3415
+ function adyenStoreRequiresStateOrProvince(alpha2) {
3416
+ return !!alpha2 && ADYEN_STORE_STATE_PROVINCE_COUNTRIES.has(alpha2);
3451
3417
  }
3452
- var AFFIRM_COUNTRY_CODES = /* @__PURE__ */ new Set(["CA"]);
3453
- function isAffirmCountry(alpha2) {
3454
- return !!alpha2 && AFFIRM_COUNTRY_CODES.has(alpha2.toUpperCase());
3418
+ var ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES = /* @__PURE__ */ new Set(["AU", "BR", "CA", "IN", "MX", "NZ", "US"]);
3419
+ function adyenLegalEntityRequiresStateOrProvince(alpha2) {
3420
+ return !!alpha2 && ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES.has(alpha2);
3455
3421
  }
3456
- var BNPL_METHOD_STATUS = {
3457
- ACTIVE: "active",
3458
- PENDING: "pending",
3459
- UNAVAILABLE: "unavailable",
3460
- UNKNOWN: "unknown"
3461
- };
3462
- var BNPL_SKIP_REASON = {
3463
- PENDING: "pending",
3464
- NO_SUPPORT_EMAIL: "no_support_email",
3465
- NO_CURRENCY: "no_currency",
3466
- NO_BUSINESS_LINE: "no_business_line"
3422
+ var ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES = /* @__PURE__ */ new Set(["CA"]);
3423
+ function adyenSupportsTaxNumberAbsent(alpha2) {
3424
+ return !!alpha2 && !ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES.has(alpha2);
3425
+ }
3426
+ var ADYEN_TAX_NUMBER_FORMATS = {
3427
+ CA: { pattern: /^\d{9}$/, length: 9 }
3467
3428
  };
3429
+ function adyenTaxNumberFormat(alpha2) {
3430
+ return alpha2 ? ADYEN_TAX_NUMBER_FORMATS[alpha2] : void 0;
3431
+ }
3432
+ var ADYEN_TAX_NUMBER_MIN_LENGTH = 5;
3433
+ var ADYEN_JOB_TITLE_ASSOCIATION_TYPES = ["signatory", "uboThroughControl"];
3434
+ function adyenRequiresJobTitle(associationType) {
3435
+ return ADYEN_JOB_TITLE_ASSOCIATION_TYPES.includes(associationType);
3436
+ }
3468
3437
  // Annotate the CommonJS export names for ESM import in node:
3469
3438
  0 && (module.exports = {
3439
+ ADYEN_JOB_TITLE_ASSOCIATION_TYPES,
3440
+ ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES,
3441
+ ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES,
3470
3442
  ADYEN_ROLLOUT_COUNTRY_CODES,
3471
- AFFIRM_COUNTRY_CODES,
3472
- AFFIRM_PRICE_PLANS,
3443
+ ADYEN_STORE_STATE_PROVINCE_COUNTRIES,
3444
+ ADYEN_TAX_NUMBER_FORMATS,
3445
+ ADYEN_TAX_NUMBER_MIN_LENGTH,
3473
3446
  AttributeType,
3474
- BNPL_METHOD_STATUS,
3475
- BNPL_SKIP_REASON,
3476
3447
  BookingRatePeriod,
3477
3448
  BookingResourceKind,
3478
3449
  BookingResourceStatus,
@@ -3549,6 +3520,11 @@ var BNPL_SKIP_REASON = {
3549
3520
  TopMetericsSort,
3550
3521
  UserTypes,
3551
3522
  addAmounts,
3523
+ adyenLegalEntityRequiresStateOrProvince,
3524
+ adyenRequiresJobTitle,
3525
+ adyenStoreRequiresStateOrProvince,
3526
+ adyenSupportsTaxNumberAbsent,
3527
+ adyenTaxNumberFormat,
3552
3528
  amountToString,
3553
3529
  assertUnitSane,
3554
3530
  availableIn,
@@ -3597,15 +3573,11 @@ var BNPL_SKIP_REASON = {
3597
3573
  getPricingRegionFromCountry,
3598
3574
  getSettlementTotal,
3599
3575
  getTotalCollected,
3600
- hasInCartFlag,
3601
3576
  holdExpiresAt,
3602
3577
  inferStatesFromLegacyStatus,
3603
3578
  isAdyenRolloutCountry,
3604
- isAffirmCountry,
3605
- isAffirmPricePlan,
3606
3579
  isConditionOperator,
3607
3580
  isFulfillmentState,
3608
- isInCart,
3609
3581
  isPaymentState,
3610
3582
  isSupportedCurrency,
3611
3583
  isSystemFamilyCode,
@@ -3639,7 +3611,6 @@ var BNPL_SKIP_REASON = {
3639
3611
  toMinorUnits,
3640
3612
  validateConfig,
3641
3613
  validateFragmentCompatibility,
3642
- validateOrderStatuses,
3643
3614
  violatesFinancialInvariant,
3644
3615
  windowEndsAt,
3645
3616
  withinPresence