@final-commerce/common 2.5.1-preprod.6 → 2.5.1-preprod.8
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 +5 -4
- package/dist/index.d.mts +35 -18
- package/dist/index.d.ts +35 -18
- package/dist/index.js +68 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +57 -6
- package/dist/index.mjs.map +1 -1
- package/dist/pos-types/index.d.mts +81 -68
- package/dist/pos-types/index.d.ts +81 -68
- package/package.json +1 -1
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
|
-
|
|
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
|
@@ -665,6 +665,23 @@ interface EndOfSessionReport {
|
|
|
665
665
|
|
|
666
666
|
declare const ADYEN_ROLLOUT_COUNTRY_CODES: Set<string>;
|
|
667
667
|
declare function isAdyenRolloutCountry(alpha2: string): boolean;
|
|
668
|
+
declare const ADYEN_STORE_STATE_PROVINCE_COUNTRIES: Set<string>;
|
|
669
|
+
declare function adyenStoreRequiresStateOrProvince(alpha2: string | undefined): boolean;
|
|
670
|
+
declare const ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES: Set<string>;
|
|
671
|
+
declare function adyenLegalEntityRequiresStateOrProvince(alpha2: string | undefined): boolean;
|
|
672
|
+
declare const ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES: Set<string>;
|
|
673
|
+
declare function adyenSupportsTaxNumberAbsent(alpha2: string | undefined): boolean;
|
|
674
|
+
declare const ADYEN_TAX_NUMBER_FORMATS: Record<string, {
|
|
675
|
+
pattern: RegExp;
|
|
676
|
+
length: number;
|
|
677
|
+
}>;
|
|
678
|
+
declare function adyenTaxNumberFormat(alpha2: string | undefined): {
|
|
679
|
+
pattern: RegExp;
|
|
680
|
+
length: number;
|
|
681
|
+
} | undefined;
|
|
682
|
+
declare const ADYEN_TAX_NUMBER_MIN_LENGTH = 5;
|
|
683
|
+
declare const ADYEN_JOB_TITLE_ASSOCIATION_TYPES: readonly string[];
|
|
684
|
+
declare function adyenRequiresJobTitle(associationType: string): boolean;
|
|
668
685
|
declare const AFFIRM_PRICE_PLANS: readonly ["core", "standard", "signature"];
|
|
669
686
|
type AffirmPricePlan = (typeof AFFIRM_PRICE_PLANS)[number];
|
|
670
687
|
declare function isAffirmPricePlan(value: unknown): value is AffirmPricePlan;
|
|
@@ -842,21 +859,6 @@ declare function isConditionOperator(value: string): value is ConditionOperator;
|
|
|
842
859
|
type PathMode = 'strict' | 'permissive';
|
|
843
860
|
declare const PATH_MODES: readonly PathMode[];
|
|
844
861
|
|
|
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
862
|
interface OrderPaymentMethod {
|
|
861
863
|
id?: string;
|
|
862
864
|
amount?: number;
|
|
@@ -896,7 +898,7 @@ interface OrderContext {
|
|
|
896
898
|
paymentMethods: OrderPaymentMethod[];
|
|
897
899
|
refunds: OrderRefund[];
|
|
898
900
|
lineItems: OrderLineItem[];
|
|
899
|
-
reservations
|
|
901
|
+
reservations?: OrderReservationForContext[];
|
|
900
902
|
};
|
|
901
903
|
computed: {
|
|
902
904
|
balance: number;
|
|
@@ -1030,7 +1032,6 @@ interface StoredStateConfig {
|
|
|
1030
1032
|
validInitialStates: StatePair[];
|
|
1031
1033
|
enforceValidInitialStates?: boolean;
|
|
1032
1034
|
displayStateMap: DisplayStateRule[];
|
|
1033
|
-
orderStatuses?: OrderStatusDefinition[];
|
|
1034
1035
|
createdAt: Date;
|
|
1035
1036
|
updatedAt: Date;
|
|
1036
1037
|
}
|
|
@@ -1162,6 +1163,22 @@ interface OrderLikeForInCart {
|
|
|
1162
1163
|
declare function hasInCartFlag(order: OrderLikeForInCart): boolean;
|
|
1163
1164
|
declare function isInCart(order: OrderLikeForInCart): boolean;
|
|
1164
1165
|
|
|
1166
|
+
interface OrderStatusDefinition {
|
|
1167
|
+
id: string;
|
|
1168
|
+
key: string;
|
|
1169
|
+
defaultLabel: string;
|
|
1170
|
+
color?: string;
|
|
1171
|
+
icon?: string;
|
|
1172
|
+
fulfillmentState?: FulfillmentState;
|
|
1173
|
+
requiresPaymentState?: PaymentState[];
|
|
1174
|
+
}
|
|
1175
|
+
interface OrderStatusValidationError {
|
|
1176
|
+
index: number;
|
|
1177
|
+
field: string;
|
|
1178
|
+
message: string;
|
|
1179
|
+
}
|
|
1180
|
+
declare function validateOrderStatuses(statuses: unknown): OrderStatusValidationError[];
|
|
1181
|
+
|
|
1165
1182
|
interface OrderMutationData extends OrderStateWritable {
|
|
1166
1183
|
total?: number;
|
|
1167
1184
|
balance?: number;
|
|
@@ -1474,4 +1491,4 @@ declare const EUFixedRates: Record<string, CurrencyRate>;
|
|
|
1474
1491
|
declare const OtherFixedRates: Record<string, CurrencyRate>;
|
|
1475
1492
|
declare const COUNTRY_CURRENCIES: Record<string, string>;
|
|
1476
1493
|
|
|
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 };
|
|
1494
|
+
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, 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, 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, hasInCartFlag, holdExpiresAt, inferStatesFromLegacyStatus, isAdyenRolloutCountry, isAffirmCountry, isAffirmPricePlan, isConditionOperator, isFulfillmentState, isInCart, isPaymentState, isSupportedCurrency, isSystemFamilyCode, isValidQuantity, isWhole, mapToLegacyStatus, maxPrecisionFor, mergeFragment, multiplyAmount, normalizeMongoIdString, occupancyIn, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, planWindow, presentAt, removeFragment, resolveFamily, resolveTemplate, resolveUnit, roundToPrecision, sameFamily, setOrderState, shopDayKey, shopDayRange, signReportForDisplay, slotsForWindow, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, validateOrderStatuses, violatesFinancialInvariant, windowEndsAt, withinPresence };
|
package/dist/index.d.ts
CHANGED
|
@@ -665,6 +665,23 @@ interface EndOfSessionReport {
|
|
|
665
665
|
|
|
666
666
|
declare const ADYEN_ROLLOUT_COUNTRY_CODES: Set<string>;
|
|
667
667
|
declare function isAdyenRolloutCountry(alpha2: string): boolean;
|
|
668
|
+
declare const ADYEN_STORE_STATE_PROVINCE_COUNTRIES: Set<string>;
|
|
669
|
+
declare function adyenStoreRequiresStateOrProvince(alpha2: string | undefined): boolean;
|
|
670
|
+
declare const ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES: Set<string>;
|
|
671
|
+
declare function adyenLegalEntityRequiresStateOrProvince(alpha2: string | undefined): boolean;
|
|
672
|
+
declare const ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES: Set<string>;
|
|
673
|
+
declare function adyenSupportsTaxNumberAbsent(alpha2: string | undefined): boolean;
|
|
674
|
+
declare const ADYEN_TAX_NUMBER_FORMATS: Record<string, {
|
|
675
|
+
pattern: RegExp;
|
|
676
|
+
length: number;
|
|
677
|
+
}>;
|
|
678
|
+
declare function adyenTaxNumberFormat(alpha2: string | undefined): {
|
|
679
|
+
pattern: RegExp;
|
|
680
|
+
length: number;
|
|
681
|
+
} | undefined;
|
|
682
|
+
declare const ADYEN_TAX_NUMBER_MIN_LENGTH = 5;
|
|
683
|
+
declare const ADYEN_JOB_TITLE_ASSOCIATION_TYPES: readonly string[];
|
|
684
|
+
declare function adyenRequiresJobTitle(associationType: string): boolean;
|
|
668
685
|
declare const AFFIRM_PRICE_PLANS: readonly ["core", "standard", "signature"];
|
|
669
686
|
type AffirmPricePlan = (typeof AFFIRM_PRICE_PLANS)[number];
|
|
670
687
|
declare function isAffirmPricePlan(value: unknown): value is AffirmPricePlan;
|
|
@@ -842,21 +859,6 @@ declare function isConditionOperator(value: string): value is ConditionOperator;
|
|
|
842
859
|
type PathMode = 'strict' | 'permissive';
|
|
843
860
|
declare const PATH_MODES: readonly PathMode[];
|
|
844
861
|
|
|
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
862
|
interface OrderPaymentMethod {
|
|
861
863
|
id?: string;
|
|
862
864
|
amount?: number;
|
|
@@ -896,7 +898,7 @@ interface OrderContext {
|
|
|
896
898
|
paymentMethods: OrderPaymentMethod[];
|
|
897
899
|
refunds: OrderRefund[];
|
|
898
900
|
lineItems: OrderLineItem[];
|
|
899
|
-
reservations
|
|
901
|
+
reservations?: OrderReservationForContext[];
|
|
900
902
|
};
|
|
901
903
|
computed: {
|
|
902
904
|
balance: number;
|
|
@@ -1030,7 +1032,6 @@ interface StoredStateConfig {
|
|
|
1030
1032
|
validInitialStates: StatePair[];
|
|
1031
1033
|
enforceValidInitialStates?: boolean;
|
|
1032
1034
|
displayStateMap: DisplayStateRule[];
|
|
1033
|
-
orderStatuses?: OrderStatusDefinition[];
|
|
1034
1035
|
createdAt: Date;
|
|
1035
1036
|
updatedAt: Date;
|
|
1036
1037
|
}
|
|
@@ -1162,6 +1163,22 @@ interface OrderLikeForInCart {
|
|
|
1162
1163
|
declare function hasInCartFlag(order: OrderLikeForInCart): boolean;
|
|
1163
1164
|
declare function isInCart(order: OrderLikeForInCart): boolean;
|
|
1164
1165
|
|
|
1166
|
+
interface OrderStatusDefinition {
|
|
1167
|
+
id: string;
|
|
1168
|
+
key: string;
|
|
1169
|
+
defaultLabel: string;
|
|
1170
|
+
color?: string;
|
|
1171
|
+
icon?: string;
|
|
1172
|
+
fulfillmentState?: FulfillmentState;
|
|
1173
|
+
requiresPaymentState?: PaymentState[];
|
|
1174
|
+
}
|
|
1175
|
+
interface OrderStatusValidationError {
|
|
1176
|
+
index: number;
|
|
1177
|
+
field: string;
|
|
1178
|
+
message: string;
|
|
1179
|
+
}
|
|
1180
|
+
declare function validateOrderStatuses(statuses: unknown): OrderStatusValidationError[];
|
|
1181
|
+
|
|
1165
1182
|
interface OrderMutationData extends OrderStateWritable {
|
|
1166
1183
|
total?: number;
|
|
1167
1184
|
balance?: number;
|
|
@@ -1474,4 +1491,4 @@ declare const EUFixedRates: Record<string, CurrencyRate>;
|
|
|
1474
1491
|
declare const OtherFixedRates: Record<string, CurrencyRate>;
|
|
1475
1492
|
declare const COUNTRY_CURRENCIES: Record<string, string>;
|
|
1476
1493
|
|
|
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 };
|
|
1494
|
+
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, 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, 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, hasInCartFlag, holdExpiresAt, inferStatesFromLegacyStatus, isAdyenRolloutCountry, isAffirmCountry, isAffirmPricePlan, isConditionOperator, isFulfillmentState, isInCart, isPaymentState, isSupportedCurrency, isSystemFamilyCode, isValidQuantity, isWhole, mapToLegacyStatus, maxPrecisionFor, mergeFragment, multiplyAmount, normalizeMongoIdString, occupancyIn, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, planWindow, presentAt, removeFragment, resolveFamily, resolveTemplate, resolveUnit, roundToPrecision, sameFamily, setOrderState, shopDayKey, shopDayRange, signReportForDisplay, slotsForWindow, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, validateOrderStatuses, violatesFinancialInvariant, windowEndsAt, withinPresence };
|
package/dist/index.js
CHANGED
|
@@ -19,7 +19,13 @@ 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,
|
|
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,
|
|
23
29
|
AFFIRM_COUNTRY_CODES: () => AFFIRM_COUNTRY_CODES,
|
|
24
30
|
AFFIRM_PRICE_PLANS: () => AFFIRM_PRICE_PLANS,
|
|
25
31
|
AttributeType: () => AttributeType,
|
|
@@ -101,6 +107,11 @@ __export(index_exports, {
|
|
|
101
107
|
TopMetericsSort: () => TopMetericsSort,
|
|
102
108
|
UserTypes: () => UserTypes,
|
|
103
109
|
addAmounts: () => addAmounts,
|
|
110
|
+
adyenLegalEntityRequiresStateOrProvince: () => adyenLegalEntityRequiresStateOrProvince,
|
|
111
|
+
adyenRequiresJobTitle: () => adyenRequiresJobTitle,
|
|
112
|
+
adyenStoreRequiresStateOrProvince: () => adyenStoreRequiresStateOrProvince,
|
|
113
|
+
adyenSupportsTaxNumberAbsent: () => adyenSupportsTaxNumberAbsent,
|
|
114
|
+
adyenTaxNumberFormat: () => adyenTaxNumberFormat,
|
|
104
115
|
amountToString: () => amountToString,
|
|
105
116
|
assertUnitSane: () => assertUnitSane,
|
|
106
117
|
availableIn: () => availableIn,
|
|
@@ -2703,19 +2714,27 @@ function isInCart(order) {
|
|
|
2703
2714
|
}
|
|
2704
2715
|
|
|
2705
2716
|
// order-state-machine/order-status.ts
|
|
2717
|
+
var STATUS_KEY = /^[a-z0-9][a-z0-9_-]*$/;
|
|
2706
2718
|
function validateOrderStatuses(statuses) {
|
|
2707
2719
|
if (!Array.isArray(statuses)) {
|
|
2708
2720
|
return [{ index: -1, field: "orderStatuses", message: "must be an array" }];
|
|
2709
2721
|
}
|
|
2710
2722
|
const errors = [];
|
|
2711
|
-
const
|
|
2723
|
+
const seenIds = /* @__PURE__ */ new Set();
|
|
2724
|
+
const seenKeys = /* @__PURE__ */ new Set();
|
|
2712
2725
|
statuses.forEach((raw, index) => {
|
|
2713
2726
|
const s = raw ?? {};
|
|
2714
2727
|
const add = (field, message) => errors.push({ index, field, message });
|
|
2715
2728
|
if (typeof s.id !== "string" || !s.id.trim()) add("id", "must be a non-empty string");
|
|
2716
|
-
else if (
|
|
2717
|
-
else
|
|
2718
|
-
if (typeof s.
|
|
2729
|
+
else if (seenIds.has(s.id)) add("id", `duplicate id "${s.id}"`);
|
|
2730
|
+
else seenIds.add(s.id);
|
|
2731
|
+
if (typeof s.key !== "string" || !STATUS_KEY.test(s.key)) {
|
|
2732
|
+
add("key", 'must be lowercase letters, digits, "-" or "_"');
|
|
2733
|
+
} else if (seenKeys.has(s.key)) add("key", `duplicate key "${s.key}"`);
|
|
2734
|
+
else seenKeys.add(s.key);
|
|
2735
|
+
if (typeof s.defaultLabel !== "string" || !s.defaultLabel.trim()) {
|
|
2736
|
+
add("defaultLabel", "must be a non-empty string");
|
|
2737
|
+
}
|
|
2719
2738
|
for (const field of ["color", "icon"]) {
|
|
2720
2739
|
if (s[field] !== void 0 && typeof s[field] !== "string") add(field, "must be a string");
|
|
2721
2740
|
}
|
|
@@ -3248,7 +3267,9 @@ function buildGrid(rule, timeZone, from, to, now, busy = []) {
|
|
|
3248
3267
|
const start = startAt.getTime();
|
|
3249
3268
|
if (start < askedFrom || start >= askedTo) return false;
|
|
3250
3269
|
if (start < notBefore || start > notAfter) return false;
|
|
3251
|
-
return !blocked.some(
|
|
3270
|
+
return !blocked.some(
|
|
3271
|
+
({ from: blockFrom, to: blockTo }) => start < blockTo && bufferEndAt.getTime() > blockFrom
|
|
3272
|
+
);
|
|
3252
3273
|
}).sort((first, second) => +first.startAt - +second.startAt);
|
|
3253
3274
|
}
|
|
3254
3275
|
function slotsForWindow(grid, startAt, endAt) {
|
|
@@ -3367,7 +3388,14 @@ function buildAvailability({
|
|
|
3367
3388
|
for (const slot of slots2) {
|
|
3368
3389
|
const { taken, foreignProductId } = occupancyIn(mine, productId, slot.startAt, slot.bufferEndAt, shared);
|
|
3369
3390
|
const free = foreignProductId ? 0 : Math.max(capacity - taken, 0);
|
|
3370
|
-
const entry = byInstant.get(+slot.startAt) ?? {
|
|
3391
|
+
const entry = byInstant.get(+slot.startAt) ?? {
|
|
3392
|
+
...slot,
|
|
3393
|
+
capacity: 0,
|
|
3394
|
+
booked: 0,
|
|
3395
|
+
free: 0,
|
|
3396
|
+
resources: [],
|
|
3397
|
+
dayKey: shopDayKey(slot.startAt, resource.timeZone)
|
|
3398
|
+
};
|
|
3371
3399
|
entry.capacity += capacity;
|
|
3372
3400
|
entry.booked += foreignProductId ? capacity : taken;
|
|
3373
3401
|
entry.free += free;
|
|
@@ -3445,6 +3473,29 @@ var ADYEN_ROLLOUT_COUNTRY_CODES = /* @__PURE__ */ new Set(["CA"]);
|
|
|
3445
3473
|
function isAdyenRolloutCountry(alpha2) {
|
|
3446
3474
|
return ADYEN_ROLLOUT_COUNTRY_CODES.has(alpha2);
|
|
3447
3475
|
}
|
|
3476
|
+
var ADYEN_STORE_STATE_PROVINCE_COUNTRIES = /* @__PURE__ */ new Set(["AU", "BR", "CA", "IN", "MX", "NZ", "US"]);
|
|
3477
|
+
function adyenStoreRequiresStateOrProvince(alpha2) {
|
|
3478
|
+
return !!alpha2 && ADYEN_STORE_STATE_PROVINCE_COUNTRIES.has(alpha2);
|
|
3479
|
+
}
|
|
3480
|
+
var ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES = /* @__PURE__ */ new Set(["AU", "BR", "CA", "IN", "MX", "NZ", "US"]);
|
|
3481
|
+
function adyenLegalEntityRequiresStateOrProvince(alpha2) {
|
|
3482
|
+
return !!alpha2 && ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES.has(alpha2);
|
|
3483
|
+
}
|
|
3484
|
+
var ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES = /* @__PURE__ */ new Set(["CA"]);
|
|
3485
|
+
function adyenSupportsTaxNumberAbsent(alpha2) {
|
|
3486
|
+
return !!alpha2 && !ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES.has(alpha2);
|
|
3487
|
+
}
|
|
3488
|
+
var ADYEN_TAX_NUMBER_FORMATS = {
|
|
3489
|
+
CA: { pattern: /^\d{9}$/, length: 9 }
|
|
3490
|
+
};
|
|
3491
|
+
function adyenTaxNumberFormat(alpha2) {
|
|
3492
|
+
return alpha2 ? ADYEN_TAX_NUMBER_FORMATS[alpha2] : void 0;
|
|
3493
|
+
}
|
|
3494
|
+
var ADYEN_TAX_NUMBER_MIN_LENGTH = 5;
|
|
3495
|
+
var ADYEN_JOB_TITLE_ASSOCIATION_TYPES = ["signatory", "uboThroughControl"];
|
|
3496
|
+
function adyenRequiresJobTitle(associationType) {
|
|
3497
|
+
return ADYEN_JOB_TITLE_ASSOCIATION_TYPES.includes(associationType);
|
|
3498
|
+
}
|
|
3448
3499
|
var AFFIRM_PRICE_PLANS = ["core", "standard", "signature"];
|
|
3449
3500
|
function isAffirmPricePlan(value) {
|
|
3450
3501
|
return typeof value === "string" && AFFIRM_PRICE_PLANS.includes(value);
|
|
@@ -3467,7 +3518,13 @@ var BNPL_SKIP_REASON = {
|
|
|
3467
3518
|
};
|
|
3468
3519
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3469
3520
|
0 && (module.exports = {
|
|
3521
|
+
ADYEN_JOB_TITLE_ASSOCIATION_TYPES,
|
|
3522
|
+
ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES,
|
|
3523
|
+
ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES,
|
|
3470
3524
|
ADYEN_ROLLOUT_COUNTRY_CODES,
|
|
3525
|
+
ADYEN_STORE_STATE_PROVINCE_COUNTRIES,
|
|
3526
|
+
ADYEN_TAX_NUMBER_FORMATS,
|
|
3527
|
+
ADYEN_TAX_NUMBER_MIN_LENGTH,
|
|
3471
3528
|
AFFIRM_COUNTRY_CODES,
|
|
3472
3529
|
AFFIRM_PRICE_PLANS,
|
|
3473
3530
|
AttributeType,
|
|
@@ -3549,6 +3606,11 @@ var BNPL_SKIP_REASON = {
|
|
|
3549
3606
|
TopMetericsSort,
|
|
3550
3607
|
UserTypes,
|
|
3551
3608
|
addAmounts,
|
|
3609
|
+
adyenLegalEntityRequiresStateOrProvince,
|
|
3610
|
+
adyenRequiresJobTitle,
|
|
3611
|
+
adyenStoreRequiresStateOrProvince,
|
|
3612
|
+
adyenSupportsTaxNumberAbsent,
|
|
3613
|
+
adyenTaxNumberFormat,
|
|
3552
3614
|
amountToString,
|
|
3553
3615
|
assertUnitSane,
|
|
3554
3616
|
availableIn,
|