@final-commerce/common 2.6.0-staging.4 → 2.6.1-staging2
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 +96 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +82 -0
- package/dist/index.mjs.map +1 -1
- package/dist/pos-types/index.d.mts +31 -4
- package/dist/pos-types/index.d.ts +31 -4
- 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;
|
|
@@ -1021,6 +1038,21 @@ declare function isConditionOperator(value: string): value is ConditionOperator;
|
|
|
1021
1038
|
type PathMode = 'strict' | 'permissive';
|
|
1022
1039
|
declare const PATH_MODES: readonly PathMode[];
|
|
1023
1040
|
|
|
1041
|
+
interface OrderStatusDefinition {
|
|
1042
|
+
id: string;
|
|
1043
|
+
label: string;
|
|
1044
|
+
color?: string;
|
|
1045
|
+
icon?: string;
|
|
1046
|
+
fulfillmentState?: FulfillmentState;
|
|
1047
|
+
requiresPaymentState?: PaymentState[];
|
|
1048
|
+
}
|
|
1049
|
+
interface OrderStatusValidationError {
|
|
1050
|
+
index: number;
|
|
1051
|
+
field: string;
|
|
1052
|
+
message: string;
|
|
1053
|
+
}
|
|
1054
|
+
declare function validateOrderStatuses(statuses: unknown): OrderStatusValidationError[];
|
|
1055
|
+
|
|
1024
1056
|
interface OrderPaymentMethod {
|
|
1025
1057
|
id?: string;
|
|
1026
1058
|
amount?: number;
|
|
@@ -1060,7 +1092,7 @@ interface OrderContext {
|
|
|
1060
1092
|
paymentMethods: OrderPaymentMethod[];
|
|
1061
1093
|
refunds: OrderRefund[];
|
|
1062
1094
|
lineItems: OrderLineItem[];
|
|
1063
|
-
reservations
|
|
1095
|
+
reservations?: OrderReservationForContext[];
|
|
1064
1096
|
};
|
|
1065
1097
|
computed: {
|
|
1066
1098
|
balance: number;
|
|
@@ -1194,6 +1226,7 @@ interface StoredStateConfig {
|
|
|
1194
1226
|
validInitialStates: StatePair[];
|
|
1195
1227
|
enforceValidInitialStates?: boolean;
|
|
1196
1228
|
displayStateMap: DisplayStateRule[];
|
|
1229
|
+
orderStatuses?: OrderStatusDefinition[];
|
|
1197
1230
|
createdAt: Date;
|
|
1198
1231
|
updatedAt: Date;
|
|
1199
1232
|
}
|
|
@@ -1315,6 +1348,16 @@ declare function setOrderState(order: OrderStateWritable, paymentState: PaymentS
|
|
|
1315
1348
|
|
|
1316
1349
|
declare function inferStatesFromLegacyStatus(order: OrderLikeForLegacyInference): StatePair;
|
|
1317
1350
|
|
|
1351
|
+
interface OrderLikeForInCart {
|
|
1352
|
+
inCart?: {
|
|
1353
|
+
active: boolean;
|
|
1354
|
+
} | null;
|
|
1355
|
+
status?: string;
|
|
1356
|
+
fulfillmentState?: string;
|
|
1357
|
+
}
|
|
1358
|
+
declare function hasInCartFlag(order: OrderLikeForInCart): boolean;
|
|
1359
|
+
declare function isInCart(order: OrderLikeForInCart): boolean;
|
|
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;
|
|
@@ -1021,6 +1038,21 @@ declare function isConditionOperator(value: string): value is ConditionOperator;
|
|
|
1021
1038
|
type PathMode = 'strict' | 'permissive';
|
|
1022
1039
|
declare const PATH_MODES: readonly PathMode[];
|
|
1023
1040
|
|
|
1041
|
+
interface OrderStatusDefinition {
|
|
1042
|
+
id: string;
|
|
1043
|
+
label: string;
|
|
1044
|
+
color?: string;
|
|
1045
|
+
icon?: string;
|
|
1046
|
+
fulfillmentState?: FulfillmentState;
|
|
1047
|
+
requiresPaymentState?: PaymentState[];
|
|
1048
|
+
}
|
|
1049
|
+
interface OrderStatusValidationError {
|
|
1050
|
+
index: number;
|
|
1051
|
+
field: string;
|
|
1052
|
+
message: string;
|
|
1053
|
+
}
|
|
1054
|
+
declare function validateOrderStatuses(statuses: unknown): OrderStatusValidationError[];
|
|
1055
|
+
|
|
1024
1056
|
interface OrderPaymentMethod {
|
|
1025
1057
|
id?: string;
|
|
1026
1058
|
amount?: number;
|
|
@@ -1060,7 +1092,7 @@ interface OrderContext {
|
|
|
1060
1092
|
paymentMethods: OrderPaymentMethod[];
|
|
1061
1093
|
refunds: OrderRefund[];
|
|
1062
1094
|
lineItems: OrderLineItem[];
|
|
1063
|
-
reservations
|
|
1095
|
+
reservations?: OrderReservationForContext[];
|
|
1064
1096
|
};
|
|
1065
1097
|
computed: {
|
|
1066
1098
|
balance: number;
|
|
@@ -1194,6 +1226,7 @@ interface StoredStateConfig {
|
|
|
1194
1226
|
validInitialStates: StatePair[];
|
|
1195
1227
|
enforceValidInitialStates?: boolean;
|
|
1196
1228
|
displayStateMap: DisplayStateRule[];
|
|
1229
|
+
orderStatuses?: OrderStatusDefinition[];
|
|
1197
1230
|
createdAt: Date;
|
|
1198
1231
|
updatedAt: Date;
|
|
1199
1232
|
}
|
|
@@ -1315,6 +1348,16 @@ declare function setOrderState(order: OrderStateWritable, paymentState: PaymentS
|
|
|
1315
1348
|
|
|
1316
1349
|
declare function inferStatesFromLegacyStatus(order: OrderLikeForLegacyInference): StatePair;
|
|
1317
1350
|
|
|
1351
|
+
interface OrderLikeForInCart {
|
|
1352
|
+
inCart?: {
|
|
1353
|
+
active: boolean;
|
|
1354
|
+
} | null;
|
|
1355
|
+
status?: string;
|
|
1356
|
+
fulfillmentState?: string;
|
|
1357
|
+
}
|
|
1358
|
+
declare function hasInCartFlag(order: OrderLikeForInCart): boolean;
|
|
1359
|
+
declare function isInCart(order: OrderLikeForInCart): boolean;
|
|
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,51 @@ 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
|
+
function validateOrderStatuses(statuses) {
|
|
3042
|
+
if (!Array.isArray(statuses)) {
|
|
3043
|
+
return [{ index: -1, field: "orderStatuses", message: "must be an array" }];
|
|
3044
|
+
}
|
|
3045
|
+
const errors = [];
|
|
3046
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3047
|
+
statuses.forEach((raw, index) => {
|
|
3048
|
+
const s = raw ?? {};
|
|
3049
|
+
const add = (field, message) => errors.push({ index, field, message });
|
|
3050
|
+
if (typeof s.id !== "string" || !s.id.trim()) add("id", "must be a non-empty string");
|
|
3051
|
+
else if (seen.has(s.id)) add("id", `duplicate id "${s.id}"`);
|
|
3052
|
+
else seen.add(s.id);
|
|
3053
|
+
if (typeof s.label !== "string" || !s.label.trim()) add("label", "must be a non-empty string");
|
|
3054
|
+
for (const field of ["color", "icon"]) {
|
|
3055
|
+
if (s[field] !== void 0 && typeof s[field] !== "string") add(field, "must be a string");
|
|
3056
|
+
}
|
|
3057
|
+
if (s.fulfillmentState !== void 0 && !(typeof s.fulfillmentState === "string" && isFulfillmentState(s.fulfillmentState))) {
|
|
3058
|
+
add("fulfillmentState", `"${String(s.fulfillmentState)}" is not a fulfillment state`);
|
|
3059
|
+
}
|
|
3060
|
+
if (s.requiresPaymentState !== void 0) {
|
|
3061
|
+
if (!Array.isArray(s.requiresPaymentState) || s.requiresPaymentState.length === 0) {
|
|
3062
|
+
add("requiresPaymentState", "must be a non-empty array of payment states");
|
|
3063
|
+
} else {
|
|
3064
|
+
for (const p of s.requiresPaymentState) {
|
|
3065
|
+
if (!(typeof p === "string" && isPaymentState(p))) {
|
|
3066
|
+
add("requiresPaymentState", `"${String(p)}" is not a payment state`);
|
|
3067
|
+
}
|
|
3068
|
+
}
|
|
3069
|
+
}
|
|
3070
|
+
}
|
|
3071
|
+
});
|
|
3072
|
+
return errors;
|
|
3073
|
+
}
|
|
3074
|
+
|
|
3016
3075
|
// order-state-machine/write-strategy.ts
|
|
3017
3076
|
var LegacyWriteStrategy = class {
|
|
3018
3077
|
applyState(_order) {
|
|
@@ -3730,6 +3789,29 @@ var ADYEN_ROLLOUT_COUNTRY_CODES = /* @__PURE__ */ new Set(["CA"]);
|
|
|
3730
3789
|
function isAdyenRolloutCountry(alpha2) {
|
|
3731
3790
|
return ADYEN_ROLLOUT_COUNTRY_CODES.has(alpha2);
|
|
3732
3791
|
}
|
|
3792
|
+
var ADYEN_STORE_STATE_PROVINCE_COUNTRIES = /* @__PURE__ */ new Set(["AU", "BR", "CA", "IN", "MX", "NZ", "US"]);
|
|
3793
|
+
function adyenStoreRequiresStateOrProvince(alpha2) {
|
|
3794
|
+
return !!alpha2 && ADYEN_STORE_STATE_PROVINCE_COUNTRIES.has(alpha2);
|
|
3795
|
+
}
|
|
3796
|
+
var ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES = /* @__PURE__ */ new Set(["AU", "BR", "CA", "IN", "MX", "NZ", "US"]);
|
|
3797
|
+
function adyenLegalEntityRequiresStateOrProvince(alpha2) {
|
|
3798
|
+
return !!alpha2 && ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES.has(alpha2);
|
|
3799
|
+
}
|
|
3800
|
+
var ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES = /* @__PURE__ */ new Set(["CA"]);
|
|
3801
|
+
function adyenSupportsTaxNumberAbsent(alpha2) {
|
|
3802
|
+
return !!alpha2 && !ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES.has(alpha2);
|
|
3803
|
+
}
|
|
3804
|
+
var ADYEN_TAX_NUMBER_FORMATS = {
|
|
3805
|
+
CA: { pattern: /^\d{9}$/, length: 9 }
|
|
3806
|
+
};
|
|
3807
|
+
function adyenTaxNumberFormat(alpha2) {
|
|
3808
|
+
return alpha2 ? ADYEN_TAX_NUMBER_FORMATS[alpha2] : void 0;
|
|
3809
|
+
}
|
|
3810
|
+
var ADYEN_TAX_NUMBER_MIN_LENGTH = 5;
|
|
3811
|
+
var ADYEN_JOB_TITLE_ASSOCIATION_TYPES = ["signatory", "uboThroughControl"];
|
|
3812
|
+
function adyenRequiresJobTitle(associationType) {
|
|
3813
|
+
return ADYEN_JOB_TITLE_ASSOCIATION_TYPES.includes(associationType);
|
|
3814
|
+
}
|
|
3733
3815
|
var AFFIRM_PRICE_PLANS = ["core", "standard", "signature"];
|
|
3734
3816
|
function isAffirmPricePlan(value) {
|
|
3735
3817
|
return typeof value === "string" && AFFIRM_PRICE_PLANS.includes(value);
|
|
@@ -3752,7 +3834,13 @@ var BNPL_SKIP_REASON = {
|
|
|
3752
3834
|
};
|
|
3753
3835
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3754
3836
|
0 && (module.exports = {
|
|
3837
|
+
ADYEN_JOB_TITLE_ASSOCIATION_TYPES,
|
|
3838
|
+
ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES,
|
|
3839
|
+
ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES,
|
|
3755
3840
|
ADYEN_ROLLOUT_COUNTRY_CODES,
|
|
3841
|
+
ADYEN_STORE_STATE_PROVINCE_COUNTRIES,
|
|
3842
|
+
ADYEN_TAX_NUMBER_FORMATS,
|
|
3843
|
+
ADYEN_TAX_NUMBER_MIN_LENGTH,
|
|
3756
3844
|
AFFIRM_COUNTRY_CODES,
|
|
3757
3845
|
AFFIRM_PRICE_PLANS,
|
|
3758
3846
|
AttributeType,
|
|
@@ -3834,6 +3922,11 @@ var BNPL_SKIP_REASON = {
|
|
|
3834
3922
|
TopMetericsSort,
|
|
3835
3923
|
UserTypes,
|
|
3836
3924
|
addAmounts,
|
|
3925
|
+
adyenLegalEntityRequiresStateOrProvince,
|
|
3926
|
+
adyenRequiresJobTitle,
|
|
3927
|
+
adyenStoreRequiresStateOrProvince,
|
|
3928
|
+
adyenSupportsTaxNumberAbsent,
|
|
3929
|
+
adyenTaxNumberFormat,
|
|
3837
3930
|
amountToString,
|
|
3838
3931
|
ancestorChain,
|
|
3839
3932
|
assertUnitSane,
|
|
@@ -3891,6 +3984,7 @@ var BNPL_SKIP_REASON = {
|
|
|
3891
3984
|
getPricingRegionFromCountry,
|
|
3892
3985
|
getSettlementTotal,
|
|
3893
3986
|
getTotalCollected,
|
|
3987
|
+
hasInCartFlag,
|
|
3894
3988
|
hasSellableChoice,
|
|
3895
3989
|
holdExpiresAt,
|
|
3896
3990
|
inferStatesFromLegacyStatus,
|
|
@@ -3900,6 +3994,7 @@ var BNPL_SKIP_REASON = {
|
|
|
3900
3994
|
isChoiceAvailableAtOutlet,
|
|
3901
3995
|
isConditionOperator,
|
|
3902
3996
|
isFulfillmentState,
|
|
3997
|
+
isInCart,
|
|
3903
3998
|
isPaymentState,
|
|
3904
3999
|
isSupportedCurrency,
|
|
3905
4000
|
isSystemFamilyCode,
|
|
@@ -3939,6 +4034,7 @@ var BNPL_SKIP_REASON = {
|
|
|
3939
4034
|
toMinorUnits,
|
|
3940
4035
|
validateConfig,
|
|
3941
4036
|
validateFragmentCompatibility,
|
|
4037
|
+
validateOrderStatuses,
|
|
3942
4038
|
violatesFinancialInvariant,
|
|
3943
4039
|
windowEndsAt,
|
|
3944
4040
|
withinPresence
|