@final-commerce/common 2.6.0 → 2.7.0-preprod.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 +5 -4
- package/dist/index.d.mts +45 -2
- package/dist/index.d.ts +45 -2
- package/dist/index.js +104 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +90 -0
- package/dist/index.mjs.map +1 -1
- package/dist/pos-types/index.d.mts +117 -72
- package/dist/pos-types/index.d.ts +117 -72
- package/dist/pos-types/index.js +1 -0
- package/dist/pos-types/index.js.map +1 -1
- package/dist/pos-types/index.mjs +1 -0
- package/dist/pos-types/index.mjs.map +1 -1
- package/package.json +1 -1
package/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
|
@@ -666,6 +666,23 @@ interface EndOfSessionReport {
|
|
|
666
666
|
|
|
667
667
|
declare const ADYEN_ROLLOUT_COUNTRY_CODES: Set<string>;
|
|
668
668
|
declare function isAdyenRolloutCountry(alpha2: string): boolean;
|
|
669
|
+
declare const ADYEN_STORE_STATE_PROVINCE_COUNTRIES: Set<string>;
|
|
670
|
+
declare function adyenStoreRequiresStateOrProvince(alpha2: string | undefined): boolean;
|
|
671
|
+
declare const ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES: Set<string>;
|
|
672
|
+
declare function adyenLegalEntityRequiresStateOrProvince(alpha2: string | undefined): boolean;
|
|
673
|
+
declare const ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES: Set<string>;
|
|
674
|
+
declare function adyenSupportsTaxNumberAbsent(alpha2: string | undefined): boolean;
|
|
675
|
+
declare const ADYEN_TAX_NUMBER_FORMATS: Record<string, {
|
|
676
|
+
pattern: RegExp;
|
|
677
|
+
length: number;
|
|
678
|
+
}>;
|
|
679
|
+
declare function adyenTaxNumberFormat(alpha2: string | undefined): {
|
|
680
|
+
pattern: RegExp;
|
|
681
|
+
length: number;
|
|
682
|
+
} | undefined;
|
|
683
|
+
declare const ADYEN_TAX_NUMBER_MIN_LENGTH = 5;
|
|
684
|
+
declare const ADYEN_JOB_TITLE_ASSOCIATION_TYPES: readonly string[];
|
|
685
|
+
declare function adyenRequiresJobTitle(associationType: string): boolean;
|
|
669
686
|
declare const AFFIRM_PRICE_PLANS: readonly ["core", "standard", "signature"];
|
|
670
687
|
type AffirmPricePlan = (typeof AFFIRM_PRICE_PLANS)[number];
|
|
671
688
|
declare function isAffirmPricePlan(value: unknown): value is AffirmPricePlan;
|
|
@@ -1060,7 +1077,7 @@ interface OrderContext {
|
|
|
1060
1077
|
paymentMethods: OrderPaymentMethod[];
|
|
1061
1078
|
refunds: OrderRefund[];
|
|
1062
1079
|
lineItems: OrderLineItem[];
|
|
1063
|
-
reservations
|
|
1080
|
+
reservations?: OrderReservationForContext[];
|
|
1064
1081
|
};
|
|
1065
1082
|
computed: {
|
|
1066
1083
|
balance: number;
|
|
@@ -1315,6 +1332,32 @@ declare function setOrderState(order: OrderStateWritable, paymentState: PaymentS
|
|
|
1315
1332
|
|
|
1316
1333
|
declare function inferStatesFromLegacyStatus(order: OrderLikeForLegacyInference): StatePair;
|
|
1317
1334
|
|
|
1335
|
+
interface OrderLikeForInCart {
|
|
1336
|
+
inCart?: {
|
|
1337
|
+
active: boolean;
|
|
1338
|
+
} | null;
|
|
1339
|
+
status?: string;
|
|
1340
|
+
fulfillmentState?: string;
|
|
1341
|
+
}
|
|
1342
|
+
declare function hasInCartFlag(order: OrderLikeForInCart): boolean;
|
|
1343
|
+
declare function isInCart(order: OrderLikeForInCart): boolean;
|
|
1344
|
+
|
|
1345
|
+
interface OrderStatusDefinition {
|
|
1346
|
+
id: string;
|
|
1347
|
+
key: string;
|
|
1348
|
+
defaultLabel: string;
|
|
1349
|
+
color?: string;
|
|
1350
|
+
icon?: string;
|
|
1351
|
+
fulfillmentState?: FulfillmentState;
|
|
1352
|
+
requiresPaymentState?: PaymentState[];
|
|
1353
|
+
}
|
|
1354
|
+
interface OrderStatusValidationError {
|
|
1355
|
+
index: number;
|
|
1356
|
+
field: string;
|
|
1357
|
+
message: string;
|
|
1358
|
+
}
|
|
1359
|
+
declare function validateOrderStatuses(statuses: unknown): OrderStatusValidationError[];
|
|
1360
|
+
|
|
1318
1361
|
interface OrderMutationData extends OrderStateWritable {
|
|
1319
1362
|
total?: number;
|
|
1320
1363
|
balance?: number;
|
|
@@ -1627,4 +1670,4 @@ declare const EUFixedRates: Record<string, CurrencyRate>;
|
|
|
1627
1670
|
declare const OtherFixedRates: Record<string, CurrencyRate>;
|
|
1628
1671
|
declare const COUNTRY_CURRENCIES: Record<string, string>;
|
|
1629
1672
|
|
|
1630
|
-
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, type CategoryModifierRow, type CategoryRow, CompanyType, type CompositeAvailabilityRows, type CompositeMakeable, type CompositeMakeableRow, type CompositePriceItem, type CompositePricePart, type CompositeReservationOrder, type CompositeShelf, type CompositeStockPart, type Condition, type ConditionGroup, type ConditionOperator, type ConfigUpdatedPayload, type ConfigValidationError, type ConfigValidationResult, type ConfigValidationWarning, type CrossAxisRequires, type CrossAxisRule, type CrossAxisTrigger, CurrencyCode, type CurrencyConfig, type CurrencyRate, CustomTableAvailability, CustomerPlatform, DEFAULT_CONFIG, DEFAULT_CROSS_AXIS_RULES, DEFAULT_DISPLAY_STATE_MAP, DEFAULT_HOLD_MINUTES, DEFAULT_RESOLVED_CONFIG, DEFAULT_UNIT_ID, type DeleteStateConfigFragmentParams, type DeleteStateConfigFragmentResponse, type DiscountsBreakdown, type DiscountsTuple, type DisplayStateResult, type DisplayStateRule, DualWriteStrategy, EUFixedRates, EUROPE, type EndOfSessionReport, ExtensionCategory, FINANCIAL_INVARIANTS, FULFILLMENT_STATES, type FailedCondition, type FeesBreakdown, FeesCustomBillingStatus, type FeesTuple, type FinancialInvariant, type FragmentParam, type FragmentValidationResult, type FulfillmentState, type FulfillmentStateDefinition, type FulfillmentTransitionPath, type GetAvailableTransitionsParams, type GetAvailableTransitionsResponse, type GetOrderDisplayStateParams, type GetOrderDisplayStateResponse, type GetOrderStateConfigParams, type GetOrderStateConfigResponse, type GetStateConfigFragmentParams, type GetStateConfigFragmentResponse, type GridSlot, InventoryBaseActionEnum, type InventoryBaseActionType, InventorySpecificActionType, InvoiceStatus, LegacyWriteStrategy, LibraryItemType, MAX_PRECISION, type Measurable, type MeasurementBase, type MeasurementUnit, type MeasurementUnitFamily, MenuProject, type ModifierChoiceRow, type ModifierRow, type ModifiersBreakdown, type ModifiersTuple, NAFixedRates, NORTH_AMERICA, NonRevenueItemType, ORDER_STATE_ACTIONS, ORDER_STATE_EVENTS, ORDER_STATE_TOPIC, type OrderContext, type OrderLikeForContext, type OrderLikeForLegacyInference, type OrderLineItem, type OrderMutationData, type OrderPaymentMethod, OrderPlatform, type OrderRefund, type OrderReservationForContext, type OrderStateEventPayload, type OrderStateWritable, type OrderWriteStrategy, OtherFixedRates, OwnerType, PATH_MODES, PAYMENT_STATES, POS_VALID_INITIAL_STATES, type PathMode, PaymentMethod, PaymentProcessor, type PaymentState, type PaymentStateDefinition, type PaymentTransitionPath, type PlanWindowInput, Platform, type PoolDrawing, PreviewImageMode, PricingLevel, PricingPlanEnum, PricingRegionEnum, type ProductDiscountBucket, type ProductFeeBucket, ProductStatus, ProductType, PublicationAvailability, type PublicationConfig, PublicationStatus, REGION_MAPPING, REPORT_NEGATE_PATHS, ReceiptSendChannel, ReceiptType, type RefundsBreakdown, ReservationStatus, ResidualPaymentMethod, ResidualStatus, type ResolveInputs, type ResolveTemplateResult, type ResourceAvailability, ResourceAvailabilityState, type ResourceInWindow, type ResourcePresenceRow, STATE_SCHEMA, STRIPE_SUPPORTED_COUNTRIES, SYSTEM_FAMILIES, SYSTEM_FAMILY_IDS, SYSTEM_UNITS, SYSTEM_UNIT_IDS, type SalesSummary, type SaveStateConfigFragmentParams, type SaveStateConfigFragmentResponse, type SettlementBreakdown, type SettlementBuckets, type SettlementCardSection, type SettlementCashSection, type SettlementCustomEntry, type SplitPayment, type SplitPaymentPayment, type StaffSales, type StaffSalesEntry, type StateConfig, type StateConfigFragment, type StateDefinition, type StatePair, type StateSchema, type StateTransitionBlockedPayload, type StateTransitionCompletedPayload, StationStatus, type StoredStateConfig, StripeCurrencyCode, StripeStatus, type TaxBreakdown, type TaxBreakdownRateEntry, type TaxBreakdownSection, type TaxBreakdownSubtotal, type TaxesTuple, TimePeriod, type TipEntry, type TipsBreakdown, type TipsTuple, TopMetericsSort, type TransitionBlockedBy, type TransitionConditionSet, type TransitionOrderStateParams, type TransitionOrderStateResponse, type TransitionPath, type TransitionRequest, type TransitionResult, UserTypes, type WeeklyHours, addAmounts, amountToString, ancestorChain, assertUnitSane, availableIn, baseFor, baseFulfillmentDefinitions, baseOf, basePaymentDefinitions, buildAvailability, buildGrid, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, canTransition, cheapestCompositeItem, cheapestCompositePrice, compositeItemCost, compositeItemUnavailable, compositeMakeable, compositeModifierMismatches, compositeReservationMismatches, compositeVariantInStock, conditionSummary, convertFixedFeeToLocalCurrency, createAmount, crossAxisRuleApplies, deriveDisplayState, deriveFamilyCode, deriveUnitId, displayRuleMatchesPair, divideAmount, evaluateCondition, evaluateConditionSet, extendPrice, extendPriceFor, formatCurrency, formatInUnit, formatMinorUnitsToString, formatQuantity, fromBase, fromMinorUnits, generateMongoID, getAvailableTransitions, getCashAmountDue, getCountriesByRegion, getCurrencyConfig, getCurrentISODate, getFinancialInvariantViolations, getGoodsPortion, getLineSubtotal, getMinorUnitMultiplier, getMinorUnits, getPaymentLegTotal, getPricingRegionFromCountry, getSettlementTotal, getTotalCollected, hasSellableChoice, holdExpiresAt, inferStatesFromLegacyStatus, isAdyenRolloutCountry, isAffirmCountry, isAffirmPricePlan, isChoiceAvailableAtOutlet, isConditionOperator, isFulfillmentState, isPaymentState, isSupportedCurrency, isSystemFamilyCode, isValidQuantity, isWhole, mapToLegacyStatus, maxPrecisionFor, mergeFragment, modifiersSellable, multiplyAmount, normalizeMongoIdString, occupancyIn, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, planWindow, poolDemand, poolOf, poolShortfall, poolStockAt, presentAt, removeFragment, resolveFamily, resolveModifiersForProduct, resolveTemplate, resolveUnit, roundToPrecision, sameFamily, setOrderState, shopDayKey, shopDayRange, signReportForDisplay, slotsForWindow, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, violatesFinancialInvariant, windowEndsAt, withinPresence };
|
|
1673
|
+
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, type CategoryModifierRow, type CategoryRow, CompanyType, type CompositeAvailabilityRows, type CompositeMakeable, type CompositeMakeableRow, type CompositePriceItem, type CompositePricePart, type CompositeReservationOrder, type CompositeShelf, type CompositeStockPart, type Condition, type ConditionGroup, type ConditionOperator, type ConfigUpdatedPayload, type ConfigValidationError, type ConfigValidationResult, type ConfigValidationWarning, type CrossAxisRequires, type CrossAxisRule, type CrossAxisTrigger, CurrencyCode, type CurrencyConfig, type CurrencyRate, CustomTableAvailability, CustomerPlatform, DEFAULT_CONFIG, DEFAULT_CROSS_AXIS_RULES, DEFAULT_DISPLAY_STATE_MAP, DEFAULT_HOLD_MINUTES, DEFAULT_RESOLVED_CONFIG, DEFAULT_UNIT_ID, type DeleteStateConfigFragmentParams, type DeleteStateConfigFragmentResponse, type DiscountsBreakdown, type DiscountsTuple, type DisplayStateResult, type DisplayStateRule, DualWriteStrategy, EUFixedRates, EUROPE, type EndOfSessionReport, ExtensionCategory, FINANCIAL_INVARIANTS, FULFILLMENT_STATES, type FailedCondition, type FeesBreakdown, FeesCustomBillingStatus, type FeesTuple, type FinancialInvariant, type FragmentParam, type FragmentValidationResult, type FulfillmentState, type FulfillmentStateDefinition, type FulfillmentTransitionPath, type GetAvailableTransitionsParams, type GetAvailableTransitionsResponse, type GetOrderDisplayStateParams, type GetOrderDisplayStateResponse, type GetOrderStateConfigParams, type GetOrderStateConfigResponse, type GetStateConfigFragmentParams, type GetStateConfigFragmentResponse, type GridSlot, InventoryBaseActionEnum, type InventoryBaseActionType, InventorySpecificActionType, InvoiceStatus, LegacyWriteStrategy, LibraryItemType, MAX_PRECISION, type Measurable, type MeasurementBase, type MeasurementUnit, type MeasurementUnitFamily, MenuProject, type ModifierChoiceRow, type ModifierRow, type ModifiersBreakdown, type ModifiersTuple, NAFixedRates, NORTH_AMERICA, NonRevenueItemType, ORDER_STATE_ACTIONS, ORDER_STATE_EVENTS, ORDER_STATE_TOPIC, type OrderContext, type OrderLikeForContext, type 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, type PoolDrawing, PreviewImageMode, PricingLevel, PricingPlanEnum, PricingRegionEnum, type ProductDiscountBucket, type ProductFeeBucket, ProductStatus, ProductType, PublicationAvailability, type PublicationConfig, PublicationStatus, REGION_MAPPING, REPORT_NEGATE_PATHS, ReceiptSendChannel, ReceiptType, type RefundsBreakdown, ReservationStatus, ResidualPaymentMethod, ResidualStatus, type ResolveInputs, type ResolveTemplateResult, type ResourceAvailability, ResourceAvailabilityState, type ResourceInWindow, type ResourcePresenceRow, STATE_SCHEMA, STRIPE_SUPPORTED_COUNTRIES, SYSTEM_FAMILIES, SYSTEM_FAMILY_IDS, SYSTEM_UNITS, SYSTEM_UNIT_IDS, type SalesSummary, type SaveStateConfigFragmentParams, type SaveStateConfigFragmentResponse, type SettlementBreakdown, type SettlementBuckets, type SettlementCardSection, type SettlementCashSection, type SettlementCustomEntry, type SplitPayment, type SplitPaymentPayment, type StaffSales, type StaffSalesEntry, type StateConfig, type StateConfigFragment, type StateDefinition, type StatePair, type StateSchema, type StateTransitionBlockedPayload, type StateTransitionCompletedPayload, StationStatus, type StoredStateConfig, StripeCurrencyCode, StripeStatus, type TaxBreakdown, type TaxBreakdownRateEntry, type TaxBreakdownSection, type TaxBreakdownSubtotal, type TaxesTuple, TimePeriod, type TipEntry, type TipsBreakdown, type TipsTuple, TopMetericsSort, type TransitionBlockedBy, type TransitionConditionSet, type TransitionOrderStateParams, type TransitionOrderStateResponse, type TransitionPath, type TransitionRequest, type TransitionResult, UserTypes, type WeeklyHours, addAmounts, adyenLegalEntityRequiresStateOrProvince, adyenRequiresJobTitle, adyenStoreRequiresStateOrProvince, adyenSupportsTaxNumberAbsent, adyenTaxNumberFormat, amountToString, ancestorChain, assertUnitSane, availableIn, baseFor, baseFulfillmentDefinitions, baseOf, basePaymentDefinitions, buildAvailability, buildGrid, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, canTransition, cheapestCompositeItem, cheapestCompositePrice, compositeItemCost, compositeItemUnavailable, compositeMakeable, compositeModifierMismatches, compositeReservationMismatches, compositeVariantInStock, conditionSummary, convertFixedFeeToLocalCurrency, createAmount, crossAxisRuleApplies, deriveDisplayState, deriveFamilyCode, deriveUnitId, displayRuleMatchesPair, divideAmount, evaluateCondition, evaluateConditionSet, extendPrice, extendPriceFor, formatCurrency, formatInUnit, formatMinorUnitsToString, formatQuantity, fromBase, fromMinorUnits, generateMongoID, getAvailableTransitions, getCashAmountDue, getCountriesByRegion, getCurrencyConfig, getCurrentISODate, getFinancialInvariantViolations, getGoodsPortion, getLineSubtotal, getMinorUnitMultiplier, getMinorUnits, getPaymentLegTotal, getPricingRegionFromCountry, getSettlementTotal, getTotalCollected, hasInCartFlag, hasSellableChoice, holdExpiresAt, inferStatesFromLegacyStatus, isAdyenRolloutCountry, isAffirmCountry, isAffirmPricePlan, isChoiceAvailableAtOutlet, isConditionOperator, isFulfillmentState, isInCart, isPaymentState, isSupportedCurrency, isSystemFamilyCode, isValidQuantity, isWhole, mapToLegacyStatus, maxPrecisionFor, mergeFragment, modifiersSellable, multiplyAmount, normalizeMongoIdString, occupancyIn, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, planWindow, poolDemand, poolOf, poolShortfall, poolStockAt, presentAt, removeFragment, resolveFamily, resolveModifiersForProduct, resolveTemplate, resolveUnit, roundToPrecision, sameFamily, setOrderState, shopDayKey, shopDayRange, signReportForDisplay, slotsForWindow, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, validateOrderStatuses, violatesFinancialInvariant, windowEndsAt, withinPresence };
|
package/dist/index.d.ts
CHANGED
|
@@ -666,6 +666,23 @@ interface EndOfSessionReport {
|
|
|
666
666
|
|
|
667
667
|
declare const ADYEN_ROLLOUT_COUNTRY_CODES: Set<string>;
|
|
668
668
|
declare function isAdyenRolloutCountry(alpha2: string): boolean;
|
|
669
|
+
declare const ADYEN_STORE_STATE_PROVINCE_COUNTRIES: Set<string>;
|
|
670
|
+
declare function adyenStoreRequiresStateOrProvince(alpha2: string | undefined): boolean;
|
|
671
|
+
declare const ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES: Set<string>;
|
|
672
|
+
declare function adyenLegalEntityRequiresStateOrProvince(alpha2: string | undefined): boolean;
|
|
673
|
+
declare const ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES: Set<string>;
|
|
674
|
+
declare function adyenSupportsTaxNumberAbsent(alpha2: string | undefined): boolean;
|
|
675
|
+
declare const ADYEN_TAX_NUMBER_FORMATS: Record<string, {
|
|
676
|
+
pattern: RegExp;
|
|
677
|
+
length: number;
|
|
678
|
+
}>;
|
|
679
|
+
declare function adyenTaxNumberFormat(alpha2: string | undefined): {
|
|
680
|
+
pattern: RegExp;
|
|
681
|
+
length: number;
|
|
682
|
+
} | undefined;
|
|
683
|
+
declare const ADYEN_TAX_NUMBER_MIN_LENGTH = 5;
|
|
684
|
+
declare const ADYEN_JOB_TITLE_ASSOCIATION_TYPES: readonly string[];
|
|
685
|
+
declare function adyenRequiresJobTitle(associationType: string): boolean;
|
|
669
686
|
declare const AFFIRM_PRICE_PLANS: readonly ["core", "standard", "signature"];
|
|
670
687
|
type AffirmPricePlan = (typeof AFFIRM_PRICE_PLANS)[number];
|
|
671
688
|
declare function isAffirmPricePlan(value: unknown): value is AffirmPricePlan;
|
|
@@ -1060,7 +1077,7 @@ interface OrderContext {
|
|
|
1060
1077
|
paymentMethods: OrderPaymentMethod[];
|
|
1061
1078
|
refunds: OrderRefund[];
|
|
1062
1079
|
lineItems: OrderLineItem[];
|
|
1063
|
-
reservations
|
|
1080
|
+
reservations?: OrderReservationForContext[];
|
|
1064
1081
|
};
|
|
1065
1082
|
computed: {
|
|
1066
1083
|
balance: number;
|
|
@@ -1315,6 +1332,32 @@ declare function setOrderState(order: OrderStateWritable, paymentState: PaymentS
|
|
|
1315
1332
|
|
|
1316
1333
|
declare function inferStatesFromLegacyStatus(order: OrderLikeForLegacyInference): StatePair;
|
|
1317
1334
|
|
|
1335
|
+
interface OrderLikeForInCart {
|
|
1336
|
+
inCart?: {
|
|
1337
|
+
active: boolean;
|
|
1338
|
+
} | null;
|
|
1339
|
+
status?: string;
|
|
1340
|
+
fulfillmentState?: string;
|
|
1341
|
+
}
|
|
1342
|
+
declare function hasInCartFlag(order: OrderLikeForInCart): boolean;
|
|
1343
|
+
declare function isInCart(order: OrderLikeForInCart): boolean;
|
|
1344
|
+
|
|
1345
|
+
interface OrderStatusDefinition {
|
|
1346
|
+
id: string;
|
|
1347
|
+
key: string;
|
|
1348
|
+
defaultLabel: string;
|
|
1349
|
+
color?: string;
|
|
1350
|
+
icon?: string;
|
|
1351
|
+
fulfillmentState?: FulfillmentState;
|
|
1352
|
+
requiresPaymentState?: PaymentState[];
|
|
1353
|
+
}
|
|
1354
|
+
interface OrderStatusValidationError {
|
|
1355
|
+
index: number;
|
|
1356
|
+
field: string;
|
|
1357
|
+
message: string;
|
|
1358
|
+
}
|
|
1359
|
+
declare function validateOrderStatuses(statuses: unknown): OrderStatusValidationError[];
|
|
1360
|
+
|
|
1318
1361
|
interface OrderMutationData extends OrderStateWritable {
|
|
1319
1362
|
total?: number;
|
|
1320
1363
|
balance?: number;
|
|
@@ -1627,4 +1670,4 @@ declare const EUFixedRates: Record<string, CurrencyRate>;
|
|
|
1627
1670
|
declare const OtherFixedRates: Record<string, CurrencyRate>;
|
|
1628
1671
|
declare const COUNTRY_CURRENCIES: Record<string, string>;
|
|
1629
1672
|
|
|
1630
|
-
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, type CategoryModifierRow, type CategoryRow, CompanyType, type CompositeAvailabilityRows, type CompositeMakeable, type CompositeMakeableRow, type CompositePriceItem, type CompositePricePart, type CompositeReservationOrder, type CompositeShelf, type CompositeStockPart, type Condition, type ConditionGroup, type ConditionOperator, type ConfigUpdatedPayload, type ConfigValidationError, type ConfigValidationResult, type ConfigValidationWarning, type CrossAxisRequires, type CrossAxisRule, type CrossAxisTrigger, CurrencyCode, type CurrencyConfig, type CurrencyRate, CustomTableAvailability, CustomerPlatform, DEFAULT_CONFIG, DEFAULT_CROSS_AXIS_RULES, DEFAULT_DISPLAY_STATE_MAP, DEFAULT_HOLD_MINUTES, DEFAULT_RESOLVED_CONFIG, DEFAULT_UNIT_ID, type DeleteStateConfigFragmentParams, type DeleteStateConfigFragmentResponse, type DiscountsBreakdown, type DiscountsTuple, type DisplayStateResult, type DisplayStateRule, DualWriteStrategy, EUFixedRates, EUROPE, type EndOfSessionReport, ExtensionCategory, FINANCIAL_INVARIANTS, FULFILLMENT_STATES, type FailedCondition, type FeesBreakdown, FeesCustomBillingStatus, type FeesTuple, type FinancialInvariant, type FragmentParam, type FragmentValidationResult, type FulfillmentState, type FulfillmentStateDefinition, type FulfillmentTransitionPath, type GetAvailableTransitionsParams, type GetAvailableTransitionsResponse, type GetOrderDisplayStateParams, type GetOrderDisplayStateResponse, type GetOrderStateConfigParams, type GetOrderStateConfigResponse, type GetStateConfigFragmentParams, type GetStateConfigFragmentResponse, type GridSlot, InventoryBaseActionEnum, type InventoryBaseActionType, InventorySpecificActionType, InvoiceStatus, LegacyWriteStrategy, LibraryItemType, MAX_PRECISION, type Measurable, type MeasurementBase, type MeasurementUnit, type MeasurementUnitFamily, MenuProject, type ModifierChoiceRow, type ModifierRow, type ModifiersBreakdown, type ModifiersTuple, NAFixedRates, NORTH_AMERICA, NonRevenueItemType, ORDER_STATE_ACTIONS, ORDER_STATE_EVENTS, ORDER_STATE_TOPIC, type OrderContext, type OrderLikeForContext, type OrderLikeForLegacyInference, type OrderLineItem, type OrderMutationData, type OrderPaymentMethod, OrderPlatform, type OrderRefund, type OrderReservationForContext, type OrderStateEventPayload, type OrderStateWritable, type OrderWriteStrategy, OtherFixedRates, OwnerType, PATH_MODES, PAYMENT_STATES, POS_VALID_INITIAL_STATES, type PathMode, PaymentMethod, PaymentProcessor, type PaymentState, type PaymentStateDefinition, type PaymentTransitionPath, type PlanWindowInput, Platform, type PoolDrawing, PreviewImageMode, PricingLevel, PricingPlanEnum, PricingRegionEnum, type ProductDiscountBucket, type ProductFeeBucket, ProductStatus, ProductType, PublicationAvailability, type PublicationConfig, PublicationStatus, REGION_MAPPING, REPORT_NEGATE_PATHS, ReceiptSendChannel, ReceiptType, type RefundsBreakdown, ReservationStatus, ResidualPaymentMethod, ResidualStatus, type ResolveInputs, type ResolveTemplateResult, type ResourceAvailability, ResourceAvailabilityState, type ResourceInWindow, type ResourcePresenceRow, STATE_SCHEMA, STRIPE_SUPPORTED_COUNTRIES, SYSTEM_FAMILIES, SYSTEM_FAMILY_IDS, SYSTEM_UNITS, SYSTEM_UNIT_IDS, type SalesSummary, type SaveStateConfigFragmentParams, type SaveStateConfigFragmentResponse, type SettlementBreakdown, type SettlementBuckets, type SettlementCardSection, type SettlementCashSection, type SettlementCustomEntry, type SplitPayment, type SplitPaymentPayment, type StaffSales, type StaffSalesEntry, type StateConfig, type StateConfigFragment, type StateDefinition, type StatePair, type StateSchema, type StateTransitionBlockedPayload, type StateTransitionCompletedPayload, StationStatus, type StoredStateConfig, StripeCurrencyCode, StripeStatus, type TaxBreakdown, type TaxBreakdownRateEntry, type TaxBreakdownSection, type TaxBreakdownSubtotal, type TaxesTuple, TimePeriod, type TipEntry, type TipsBreakdown, type TipsTuple, TopMetericsSort, type TransitionBlockedBy, type TransitionConditionSet, type TransitionOrderStateParams, type TransitionOrderStateResponse, type TransitionPath, type TransitionRequest, type TransitionResult, UserTypes, type WeeklyHours, addAmounts, amountToString, ancestorChain, assertUnitSane, availableIn, baseFor, baseFulfillmentDefinitions, baseOf, basePaymentDefinitions, buildAvailability, buildGrid, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, canTransition, cheapestCompositeItem, cheapestCompositePrice, compositeItemCost, compositeItemUnavailable, compositeMakeable, compositeModifierMismatches, compositeReservationMismatches, compositeVariantInStock, conditionSummary, convertFixedFeeToLocalCurrency, createAmount, crossAxisRuleApplies, deriveDisplayState, deriveFamilyCode, deriveUnitId, displayRuleMatchesPair, divideAmount, evaluateCondition, evaluateConditionSet, extendPrice, extendPriceFor, formatCurrency, formatInUnit, formatMinorUnitsToString, formatQuantity, fromBase, fromMinorUnits, generateMongoID, getAvailableTransitions, getCashAmountDue, getCountriesByRegion, getCurrencyConfig, getCurrentISODate, getFinancialInvariantViolations, getGoodsPortion, getLineSubtotal, getMinorUnitMultiplier, getMinorUnits, getPaymentLegTotal, getPricingRegionFromCountry, getSettlementTotal, getTotalCollected, hasSellableChoice, holdExpiresAt, inferStatesFromLegacyStatus, isAdyenRolloutCountry, isAffirmCountry, isAffirmPricePlan, isChoiceAvailableAtOutlet, isConditionOperator, isFulfillmentState, isPaymentState, isSupportedCurrency, isSystemFamilyCode, isValidQuantity, isWhole, mapToLegacyStatus, maxPrecisionFor, mergeFragment, modifiersSellable, multiplyAmount, normalizeMongoIdString, occupancyIn, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, planWindow, poolDemand, poolOf, poolShortfall, poolStockAt, presentAt, removeFragment, resolveFamily, resolveModifiersForProduct, resolveTemplate, resolveUnit, roundToPrecision, sameFamily, setOrderState, shopDayKey, shopDayRange, signReportForDisplay, slotsForWindow, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, violatesFinancialInvariant, windowEndsAt, withinPresence };
|
|
1673
|
+
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, type CategoryModifierRow, type CategoryRow, CompanyType, type CompositeAvailabilityRows, type CompositeMakeable, type CompositeMakeableRow, type CompositePriceItem, type CompositePricePart, type CompositeReservationOrder, type CompositeShelf, type CompositeStockPart, type Condition, type ConditionGroup, type ConditionOperator, type ConfigUpdatedPayload, type ConfigValidationError, type ConfigValidationResult, type ConfigValidationWarning, type CrossAxisRequires, type CrossAxisRule, type CrossAxisTrigger, CurrencyCode, type CurrencyConfig, type CurrencyRate, CustomTableAvailability, CustomerPlatform, DEFAULT_CONFIG, DEFAULT_CROSS_AXIS_RULES, DEFAULT_DISPLAY_STATE_MAP, DEFAULT_HOLD_MINUTES, DEFAULT_RESOLVED_CONFIG, DEFAULT_UNIT_ID, type DeleteStateConfigFragmentParams, type DeleteStateConfigFragmentResponse, type DiscountsBreakdown, type DiscountsTuple, type DisplayStateResult, type DisplayStateRule, DualWriteStrategy, EUFixedRates, EUROPE, type EndOfSessionReport, ExtensionCategory, FINANCIAL_INVARIANTS, FULFILLMENT_STATES, type FailedCondition, type FeesBreakdown, FeesCustomBillingStatus, type FeesTuple, type FinancialInvariant, type FragmentParam, type FragmentValidationResult, type FulfillmentState, type FulfillmentStateDefinition, type FulfillmentTransitionPath, type GetAvailableTransitionsParams, type GetAvailableTransitionsResponse, type GetOrderDisplayStateParams, type GetOrderDisplayStateResponse, type GetOrderStateConfigParams, type GetOrderStateConfigResponse, type GetStateConfigFragmentParams, type GetStateConfigFragmentResponse, type GridSlot, InventoryBaseActionEnum, type InventoryBaseActionType, InventorySpecificActionType, InvoiceStatus, LegacyWriteStrategy, LibraryItemType, MAX_PRECISION, type Measurable, type MeasurementBase, type MeasurementUnit, type MeasurementUnitFamily, MenuProject, type ModifierChoiceRow, type ModifierRow, type ModifiersBreakdown, type ModifiersTuple, NAFixedRates, NORTH_AMERICA, NonRevenueItemType, ORDER_STATE_ACTIONS, ORDER_STATE_EVENTS, ORDER_STATE_TOPIC, type OrderContext, type OrderLikeForContext, type 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, type PoolDrawing, PreviewImageMode, PricingLevel, PricingPlanEnum, PricingRegionEnum, type ProductDiscountBucket, type ProductFeeBucket, ProductStatus, ProductType, PublicationAvailability, type PublicationConfig, PublicationStatus, REGION_MAPPING, REPORT_NEGATE_PATHS, ReceiptSendChannel, ReceiptType, type RefundsBreakdown, ReservationStatus, ResidualPaymentMethod, ResidualStatus, type ResolveInputs, type ResolveTemplateResult, type ResourceAvailability, ResourceAvailabilityState, type ResourceInWindow, type ResourcePresenceRow, STATE_SCHEMA, STRIPE_SUPPORTED_COUNTRIES, SYSTEM_FAMILIES, SYSTEM_FAMILY_IDS, SYSTEM_UNITS, SYSTEM_UNIT_IDS, type SalesSummary, type SaveStateConfigFragmentParams, type SaveStateConfigFragmentResponse, type SettlementBreakdown, type SettlementBuckets, type SettlementCardSection, type SettlementCashSection, type SettlementCustomEntry, type SplitPayment, type SplitPaymentPayment, type StaffSales, type StaffSalesEntry, type StateConfig, type StateConfigFragment, type StateDefinition, type StatePair, type StateSchema, type StateTransitionBlockedPayload, type StateTransitionCompletedPayload, StationStatus, type StoredStateConfig, StripeCurrencyCode, StripeStatus, type TaxBreakdown, type TaxBreakdownRateEntry, type TaxBreakdownSection, type TaxBreakdownSubtotal, type TaxesTuple, TimePeriod, type TipEntry, type TipsBreakdown, type TipsTuple, TopMetericsSort, type TransitionBlockedBy, type TransitionConditionSet, type TransitionOrderStateParams, type TransitionOrderStateResponse, type TransitionPath, type TransitionRequest, type TransitionResult, UserTypes, type WeeklyHours, addAmounts, adyenLegalEntityRequiresStateOrProvince, adyenRequiresJobTitle, adyenStoreRequiresStateOrProvince, adyenSupportsTaxNumberAbsent, adyenTaxNumberFormat, amountToString, ancestorChain, assertUnitSane, availableIn, baseFor, baseFulfillmentDefinitions, baseOf, basePaymentDefinitions, buildAvailability, buildGrid, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, canTransition, cheapestCompositeItem, cheapestCompositePrice, compositeItemCost, compositeItemUnavailable, compositeMakeable, compositeModifierMismatches, compositeReservationMismatches, compositeVariantInStock, conditionSummary, convertFixedFeeToLocalCurrency, createAmount, crossAxisRuleApplies, deriveDisplayState, deriveFamilyCode, deriveUnitId, displayRuleMatchesPair, divideAmount, evaluateCondition, evaluateConditionSet, extendPrice, extendPriceFor, formatCurrency, formatInUnit, formatMinorUnitsToString, formatQuantity, fromBase, fromMinorUnits, generateMongoID, getAvailableTransitions, getCashAmountDue, getCountriesByRegion, getCurrencyConfig, getCurrentISODate, getFinancialInvariantViolations, getGoodsPortion, getLineSubtotal, getMinorUnitMultiplier, getMinorUnits, getPaymentLegTotal, getPricingRegionFromCountry, getSettlementTotal, getTotalCollected, hasInCartFlag, hasSellableChoice, holdExpiresAt, inferStatesFromLegacyStatus, isAdyenRolloutCountry, isAffirmCountry, isAffirmPricePlan, isChoiceAvailableAtOutlet, isConditionOperator, isFulfillmentState, isInCart, isPaymentState, isSupportedCurrency, isSystemFamilyCode, isValidQuantity, isWhole, mapToLegacyStatus, maxPrecisionFor, mergeFragment, modifiersSellable, multiplyAmount, normalizeMongoIdString, occupancyIn, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, planWindow, poolDemand, poolOf, poolShortfall, poolStockAt, presentAt, removeFragment, resolveFamily, resolveModifiersForProduct, resolveTemplate, resolveUnit, roundToPrecision, sameFamily, setOrderState, shopDayKey, shopDayRange, signReportForDisplay, slotsForWindow, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, 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
|
ancestorChain: () => ancestorChain,
|
|
106
117
|
assertUnitSane: () => assertUnitSane,
|
|
@@ -158,6 +169,7 @@ __export(index_exports, {
|
|
|
158
169
|
getPricingRegionFromCountry: () => getPricingRegionFromCountry,
|
|
159
170
|
getSettlementTotal: () => getSettlementTotal,
|
|
160
171
|
getTotalCollected: () => getTotalCollected,
|
|
172
|
+
hasInCartFlag: () => hasInCartFlag,
|
|
161
173
|
hasSellableChoice: () => hasSellableChoice,
|
|
162
174
|
holdExpiresAt: () => holdExpiresAt,
|
|
163
175
|
inferStatesFromLegacyStatus: () => inferStatesFromLegacyStatus,
|
|
@@ -167,6 +179,7 @@ __export(index_exports, {
|
|
|
167
179
|
isChoiceAvailableAtOutlet: () => isChoiceAvailableAtOutlet,
|
|
168
180
|
isConditionOperator: () => isConditionOperator,
|
|
169
181
|
isFulfillmentState: () => isFulfillmentState,
|
|
182
|
+
isInCart: () => isInCart,
|
|
170
183
|
isPaymentState: () => isPaymentState,
|
|
171
184
|
isSupportedCurrency: () => isSupportedCurrency,
|
|
172
185
|
isSystemFamilyCode: () => isSystemFamilyCode,
|
|
@@ -206,6 +219,7 @@ __export(index_exports, {
|
|
|
206
219
|
toMinorUnits: () => toMinorUnits,
|
|
207
220
|
validateConfig: () => validateConfig,
|
|
208
221
|
validateFragmentCompatibility: () => validateFragmentCompatibility,
|
|
222
|
+
validateOrderStatuses: () => validateOrderStatuses,
|
|
209
223
|
violatesFinancialInvariant: () => violatesFinancialInvariant,
|
|
210
224
|
windowEndsAt: () => windowEndsAt,
|
|
211
225
|
withinPresence: () => withinPresence
|
|
@@ -3013,6 +3027,59 @@ function inferStatesFromLegacyStatus(order) {
|
|
|
3013
3027
|
return { payment: "unpaid", fulfillment: "pending" };
|
|
3014
3028
|
}
|
|
3015
3029
|
|
|
3030
|
+
// order-state-machine/in-cart.ts
|
|
3031
|
+
function hasInCartFlag(order) {
|
|
3032
|
+
return order.inCart != null;
|
|
3033
|
+
}
|
|
3034
|
+
function isInCart(order) {
|
|
3035
|
+
if (order.inCart != null) return order.inCart.active === true;
|
|
3036
|
+
if (order.fulfillmentState) return order.fulfillmentState === "draft";
|
|
3037
|
+
return (order.status ?? "").trim().toLowerCase() === "in-cart";
|
|
3038
|
+
}
|
|
3039
|
+
|
|
3040
|
+
// order-state-machine/order-status.ts
|
|
3041
|
+
var STATUS_KEY = /^[a-z0-9][a-z0-9_-]*$/;
|
|
3042
|
+
function validateOrderStatuses(statuses) {
|
|
3043
|
+
if (!Array.isArray(statuses)) {
|
|
3044
|
+
return [{ index: -1, field: "orderStatuses", message: "must be an array" }];
|
|
3045
|
+
}
|
|
3046
|
+
const errors = [];
|
|
3047
|
+
const seenIds = /* @__PURE__ */ new Set();
|
|
3048
|
+
const seenKeys = /* @__PURE__ */ new Set();
|
|
3049
|
+
statuses.forEach((raw, index) => {
|
|
3050
|
+
const s = raw ?? {};
|
|
3051
|
+
const add = (field, message) => errors.push({ index, field, message });
|
|
3052
|
+
if (typeof s.id !== "string" || !s.id.trim()) add("id", "must be a non-empty string");
|
|
3053
|
+
else if (seenIds.has(s.id)) add("id", `duplicate id "${s.id}"`);
|
|
3054
|
+
else seenIds.add(s.id);
|
|
3055
|
+
if (typeof s.key !== "string" || !STATUS_KEY.test(s.key)) {
|
|
3056
|
+
add("key", 'must be lowercase letters, digits, "-" or "_"');
|
|
3057
|
+
} else if (seenKeys.has(s.key)) add("key", `duplicate key "${s.key}"`);
|
|
3058
|
+
else seenKeys.add(s.key);
|
|
3059
|
+
if (typeof s.defaultLabel !== "string" || !s.defaultLabel.trim()) {
|
|
3060
|
+
add("defaultLabel", "must be a non-empty string");
|
|
3061
|
+
}
|
|
3062
|
+
for (const field of ["color", "icon"]) {
|
|
3063
|
+
if (s[field] !== void 0 && typeof s[field] !== "string") add(field, "must be a string");
|
|
3064
|
+
}
|
|
3065
|
+
if (s.fulfillmentState !== void 0 && !(typeof s.fulfillmentState === "string" && isFulfillmentState(s.fulfillmentState))) {
|
|
3066
|
+
add("fulfillmentState", `"${String(s.fulfillmentState)}" is not a fulfillment state`);
|
|
3067
|
+
}
|
|
3068
|
+
if (s.requiresPaymentState !== void 0) {
|
|
3069
|
+
if (!Array.isArray(s.requiresPaymentState) || s.requiresPaymentState.length === 0) {
|
|
3070
|
+
add("requiresPaymentState", "must be a non-empty array of payment states");
|
|
3071
|
+
} else {
|
|
3072
|
+
for (const p of s.requiresPaymentState) {
|
|
3073
|
+
if (!(typeof p === "string" && isPaymentState(p))) {
|
|
3074
|
+
add("requiresPaymentState", `"${String(p)}" is not a payment state`);
|
|
3075
|
+
}
|
|
3076
|
+
}
|
|
3077
|
+
}
|
|
3078
|
+
}
|
|
3079
|
+
});
|
|
3080
|
+
return errors;
|
|
3081
|
+
}
|
|
3082
|
+
|
|
3016
3083
|
// order-state-machine/write-strategy.ts
|
|
3017
3084
|
var LegacyWriteStrategy = class {
|
|
3018
3085
|
applyState(_order) {
|
|
@@ -3730,6 +3797,29 @@ var ADYEN_ROLLOUT_COUNTRY_CODES = /* @__PURE__ */ new Set(["CA"]);
|
|
|
3730
3797
|
function isAdyenRolloutCountry(alpha2) {
|
|
3731
3798
|
return ADYEN_ROLLOUT_COUNTRY_CODES.has(alpha2);
|
|
3732
3799
|
}
|
|
3800
|
+
var ADYEN_STORE_STATE_PROVINCE_COUNTRIES = /* @__PURE__ */ new Set(["AU", "BR", "CA", "IN", "MX", "NZ", "US"]);
|
|
3801
|
+
function adyenStoreRequiresStateOrProvince(alpha2) {
|
|
3802
|
+
return !!alpha2 && ADYEN_STORE_STATE_PROVINCE_COUNTRIES.has(alpha2);
|
|
3803
|
+
}
|
|
3804
|
+
var ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES = /* @__PURE__ */ new Set(["AU", "BR", "CA", "IN", "MX", "NZ", "US"]);
|
|
3805
|
+
function adyenLegalEntityRequiresStateOrProvince(alpha2) {
|
|
3806
|
+
return !!alpha2 && ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES.has(alpha2);
|
|
3807
|
+
}
|
|
3808
|
+
var ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES = /* @__PURE__ */ new Set(["CA"]);
|
|
3809
|
+
function adyenSupportsTaxNumberAbsent(alpha2) {
|
|
3810
|
+
return !!alpha2 && !ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES.has(alpha2);
|
|
3811
|
+
}
|
|
3812
|
+
var ADYEN_TAX_NUMBER_FORMATS = {
|
|
3813
|
+
CA: { pattern: /^\d{9}$/, length: 9 }
|
|
3814
|
+
};
|
|
3815
|
+
function adyenTaxNumberFormat(alpha2) {
|
|
3816
|
+
return alpha2 ? ADYEN_TAX_NUMBER_FORMATS[alpha2] : void 0;
|
|
3817
|
+
}
|
|
3818
|
+
var ADYEN_TAX_NUMBER_MIN_LENGTH = 5;
|
|
3819
|
+
var ADYEN_JOB_TITLE_ASSOCIATION_TYPES = ["signatory", "uboThroughControl"];
|
|
3820
|
+
function adyenRequiresJobTitle(associationType) {
|
|
3821
|
+
return ADYEN_JOB_TITLE_ASSOCIATION_TYPES.includes(associationType);
|
|
3822
|
+
}
|
|
3733
3823
|
var AFFIRM_PRICE_PLANS = ["core", "standard", "signature"];
|
|
3734
3824
|
function isAffirmPricePlan(value) {
|
|
3735
3825
|
return typeof value === "string" && AFFIRM_PRICE_PLANS.includes(value);
|
|
@@ -3752,7 +3842,13 @@ var BNPL_SKIP_REASON = {
|
|
|
3752
3842
|
};
|
|
3753
3843
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3754
3844
|
0 && (module.exports = {
|
|
3845
|
+
ADYEN_JOB_TITLE_ASSOCIATION_TYPES,
|
|
3846
|
+
ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES,
|
|
3847
|
+
ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES,
|
|
3755
3848
|
ADYEN_ROLLOUT_COUNTRY_CODES,
|
|
3849
|
+
ADYEN_STORE_STATE_PROVINCE_COUNTRIES,
|
|
3850
|
+
ADYEN_TAX_NUMBER_FORMATS,
|
|
3851
|
+
ADYEN_TAX_NUMBER_MIN_LENGTH,
|
|
3756
3852
|
AFFIRM_COUNTRY_CODES,
|
|
3757
3853
|
AFFIRM_PRICE_PLANS,
|
|
3758
3854
|
AttributeType,
|
|
@@ -3834,6 +3930,11 @@ var BNPL_SKIP_REASON = {
|
|
|
3834
3930
|
TopMetericsSort,
|
|
3835
3931
|
UserTypes,
|
|
3836
3932
|
addAmounts,
|
|
3933
|
+
adyenLegalEntityRequiresStateOrProvince,
|
|
3934
|
+
adyenRequiresJobTitle,
|
|
3935
|
+
adyenStoreRequiresStateOrProvince,
|
|
3936
|
+
adyenSupportsTaxNumberAbsent,
|
|
3937
|
+
adyenTaxNumberFormat,
|
|
3837
3938
|
amountToString,
|
|
3838
3939
|
ancestorChain,
|
|
3839
3940
|
assertUnitSane,
|
|
@@ -3891,6 +3992,7 @@ var BNPL_SKIP_REASON = {
|
|
|
3891
3992
|
getPricingRegionFromCountry,
|
|
3892
3993
|
getSettlementTotal,
|
|
3893
3994
|
getTotalCollected,
|
|
3995
|
+
hasInCartFlag,
|
|
3894
3996
|
hasSellableChoice,
|
|
3895
3997
|
holdExpiresAt,
|
|
3896
3998
|
inferStatesFromLegacyStatus,
|
|
@@ -3900,6 +4002,7 @@ var BNPL_SKIP_REASON = {
|
|
|
3900
4002
|
isChoiceAvailableAtOutlet,
|
|
3901
4003
|
isConditionOperator,
|
|
3902
4004
|
isFulfillmentState,
|
|
4005
|
+
isInCart,
|
|
3903
4006
|
isPaymentState,
|
|
3904
4007
|
isSupportedCurrency,
|
|
3905
4008
|
isSystemFamilyCode,
|
|
@@ -3939,6 +4042,7 @@ var BNPL_SKIP_REASON = {
|
|
|
3939
4042
|
toMinorUnits,
|
|
3940
4043
|
validateConfig,
|
|
3941
4044
|
validateFragmentCompatibility,
|
|
4045
|
+
validateOrderStatuses,
|
|
3942
4046
|
violatesFinancialInvariant,
|
|
3943
4047
|
windowEndsAt,
|
|
3944
4048
|
withinPresence
|