@final-commerce/common 2.5.1-staging2.1 → 2.5.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 +4 -5
- package/dist/index.d.mts +39 -22
- package/dist/index.d.ts +39 -22
- package/dist/index.js +31 -53
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -42
- package/dist/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
|
|
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
|
|
12
|
+
* Any sweep failure exits 1, blocking the push.
|
|
13
13
|
* Budget overrun also exits 1.
|
|
14
14
|
*
|
|
15
15
|
* Install as Husky pre-push hook:
|
|
@@ -81,10 +81,9 @@ checkBudget('npm audit');
|
|
|
81
81
|
|
|
82
82
|
const auditResult = run('npm audit --audit-level=high');
|
|
83
83
|
if (auditResult.status !== 0) {
|
|
84
|
-
|
|
85
|
-
} else {
|
|
86
|
-
ok('npm audit: no high/critical vulnerabilities.');
|
|
84
|
+
fail('npm audit found high or critical vulnerabilities. Run `npm audit` for details.');
|
|
87
85
|
}
|
|
86
|
+
ok('npm audit: no high/critical vulnerabilities.');
|
|
88
87
|
|
|
89
88
|
// ── 2. gitleaks ───────────────────────────────────────────────────────────────
|
|
90
89
|
|
package/dist/index.d.mts
CHANGED
|
@@ -663,6 +663,43 @@ interface EndOfSessionReport {
|
|
|
663
663
|
minorUnits?: number;
|
|
664
664
|
}
|
|
665
665
|
|
|
666
|
+
declare const ADYEN_ROLLOUT_COUNTRY_CODES: Set<string>;
|
|
667
|
+
declare function isAdyenRolloutCountry(alpha2: string): boolean;
|
|
668
|
+
declare const AFFIRM_PRICE_PLANS: readonly ["core", "standard", "signature"];
|
|
669
|
+
type AffirmPricePlan = (typeof AFFIRM_PRICE_PLANS)[number];
|
|
670
|
+
declare function isAffirmPricePlan(value: unknown): value is AffirmPricePlan;
|
|
671
|
+
declare const AFFIRM_COUNTRY_CODES: Set<string>;
|
|
672
|
+
declare function isAffirmCountry(alpha2: string | undefined): boolean;
|
|
673
|
+
declare const BNPL_METHOD_STATUS: {
|
|
674
|
+
readonly ACTIVE: "active";
|
|
675
|
+
readonly PENDING: "pending";
|
|
676
|
+
readonly UNAVAILABLE: "unavailable";
|
|
677
|
+
readonly UNKNOWN: "unknown";
|
|
678
|
+
};
|
|
679
|
+
type BnplMethodStatus = (typeof BNPL_METHOD_STATUS)[keyof typeof BNPL_METHOD_STATUS];
|
|
680
|
+
declare const BNPL_SKIP_REASON: {
|
|
681
|
+
readonly PENDING: "pending";
|
|
682
|
+
readonly NO_SUPPORT_EMAIL: "no_support_email";
|
|
683
|
+
readonly NO_CURRENCY: "no_currency";
|
|
684
|
+
readonly NO_BUSINESS_LINE: "no_business_line";
|
|
685
|
+
};
|
|
686
|
+
type BnplSkipReason = (typeof BNPL_SKIP_REASON)[keyof typeof BNPL_SKIP_REASON];
|
|
687
|
+
|
|
688
|
+
interface AdyenBnplSettings {
|
|
689
|
+
affirmPricePlan?: AffirmPricePlan;
|
|
690
|
+
affirm: BnplMethodStatus;
|
|
691
|
+
available: boolean;
|
|
692
|
+
}
|
|
693
|
+
interface AdyenBnplSkippedStore {
|
|
694
|
+
storeId: string;
|
|
695
|
+
reason: BnplSkipReason;
|
|
696
|
+
}
|
|
697
|
+
interface AdyenBnplUpdateResult {
|
|
698
|
+
updated: string[];
|
|
699
|
+
requested: string[];
|
|
700
|
+
skipped: AdyenBnplSkippedStore[];
|
|
701
|
+
}
|
|
702
|
+
|
|
666
703
|
declare const CURRENCY_CONFIG: Record<CurrencyCode | string, CurrencyConfig>;
|
|
667
704
|
declare function getCurrencyConfig(currency: CurrencyCode): CurrencyConfig;
|
|
668
705
|
declare function getMinorUnitMultiplier(currency: CurrencyCode): number;
|
|
@@ -844,7 +881,7 @@ interface OrderContext {
|
|
|
844
881
|
paymentMethods: OrderPaymentMethod[];
|
|
845
882
|
refunds: OrderRefund[];
|
|
846
883
|
lineItems: OrderLineItem[];
|
|
847
|
-
reservations
|
|
884
|
+
reservations: OrderReservationForContext[];
|
|
848
885
|
};
|
|
849
886
|
computed: {
|
|
850
887
|
balance: number;
|
|
@@ -1400,26 +1437,6 @@ declare function planWindow({ rule, timeZone, presence, startAt, endAt, now, bus
|
|
|
1400
1437
|
};
|
|
1401
1438
|
declare const holdExpiresAt: (rule: BookingRulesInput, now: Date) => Date;
|
|
1402
1439
|
|
|
1403
|
-
declare const ADYEN_ROLLOUT_COUNTRY_CODES: Set<string>;
|
|
1404
|
-
declare function isAdyenRolloutCountry(alpha2: string): boolean;
|
|
1405
|
-
declare const ADYEN_STORE_STATE_PROVINCE_COUNTRIES: Set<string>;
|
|
1406
|
-
declare function adyenStoreRequiresStateOrProvince(alpha2: string | undefined): boolean;
|
|
1407
|
-
declare const ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES: Set<string>;
|
|
1408
|
-
declare function adyenLegalEntityRequiresStateOrProvince(alpha2: string | undefined): boolean;
|
|
1409
|
-
declare const ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES: Set<string>;
|
|
1410
|
-
declare function adyenSupportsTaxNumberAbsent(alpha2: string | undefined): boolean;
|
|
1411
|
-
declare const ADYEN_TAX_NUMBER_FORMATS: Record<string, {
|
|
1412
|
-
pattern: RegExp;
|
|
1413
|
-
length: number;
|
|
1414
|
-
}>;
|
|
1415
|
-
declare function adyenTaxNumberFormat(alpha2: string | undefined): {
|
|
1416
|
-
pattern: RegExp;
|
|
1417
|
-
length: number;
|
|
1418
|
-
} | undefined;
|
|
1419
|
-
declare const ADYEN_TAX_NUMBER_MIN_LENGTH = 5;
|
|
1420
|
-
declare const ADYEN_JOB_TITLE_ASSOCIATION_TYPES: readonly string[];
|
|
1421
|
-
declare function adyenRequiresJobTitle(associationType: string): boolean;
|
|
1422
|
-
|
|
1423
1440
|
interface CurrencyRate {
|
|
1424
1441
|
rate: number;
|
|
1425
1442
|
country: string;
|
|
@@ -1431,4 +1448,4 @@ declare const EUFixedRates: Record<string, CurrencyRate>;
|
|
|
1431
1448
|
declare const OtherFixedRates: Record<string, CurrencyRate>;
|
|
1432
1449
|
declare const COUNTRY_CURRENCIES: Record<string, string>;
|
|
1433
1450
|
|
|
1434
|
-
export {
|
|
1451
|
+
export { ADYEN_ROLLOUT_COUNTRY_CODES, AFFIRM_COUNTRY_CODES, AFFIRM_PRICE_PLANS, type AdyenBnplSettings, type AdyenBnplSkippedStore, type AdyenBnplUpdateResult, type AffirmPricePlan, type Amount, AttributeType, type AvailabilityInput, type AvailabilitySlot, type AvailableTransition, BNPL_METHOD_STATUS, BNPL_SKIP_REASON, type BnplMethodStatus, type BnplSkipReason, type BookingOccupancy, BookingRatePeriod, type BookingResourceInput, BookingResourceKind, BookingResourceStatus, BookingRulesError, type BookingRulesInput, BookingType, type BusyWindow, CONDITION_OPERATORS, COUNTRY_CURRENCIES, CURRENCY_CONFIG, type CartDiscountBucket, type CartFeeBucket, type CashDrawer, type CashRoundingTuple, CompanyType, type Condition, type ConditionGroup, type ConditionOperator, type ConfigUpdatedPayload, type ConfigValidationError, type ConfigValidationResult, type ConfigValidationWarning, type CrossAxisRequires, type CrossAxisRule, type CrossAxisTrigger, CurrencyCode, type CurrencyConfig, type CurrencyRate, CustomTableAvailability, CustomerPlatform, DEFAULT_CONFIG, DEFAULT_CROSS_AXIS_RULES, DEFAULT_DISPLAY_STATE_MAP, DEFAULT_HOLD_MINUTES, DEFAULT_RESOLVED_CONFIG, DEFAULT_UNIT_ID, type DeleteStateConfigFragmentParams, type DeleteStateConfigFragmentResponse, type DiscountsBreakdown, type DiscountsTuple, type DisplayStateResult, type DisplayStateRule, DualWriteStrategy, EUFixedRates, EUROPE, type EndOfSessionReport, ExtensionCategory, FINANCIAL_INVARIANTS, FULFILLMENT_STATES, type FailedCondition, type FeesBreakdown, FeesCustomBillingStatus, type FeesTuple, type FinancialInvariant, type FragmentParam, type FragmentValidationResult, type FulfillmentState, type FulfillmentStateDefinition, type FulfillmentTransitionPath, type GetAvailableTransitionsParams, type GetAvailableTransitionsResponse, type GetOrderDisplayStateParams, type GetOrderDisplayStateResponse, type GetOrderStateConfigParams, type GetOrderStateConfigResponse, type GetStateConfigFragmentParams, type GetStateConfigFragmentResponse, type GridSlot, InventoryBaseActionEnum, type InventoryBaseActionType, InventorySpecificActionType, InvoiceStatus, LegacyWriteStrategy, LibraryItemType, MAX_PRECISION, type Measurable, type MeasurementBase, type MeasurementUnit, type MeasurementUnitFamily, MenuProject, type ModifiersBreakdown, type ModifiersTuple, NAFixedRates, NORTH_AMERICA, NonRevenueItemType, ORDER_STATE_ACTIONS, ORDER_STATE_EVENTS, ORDER_STATE_TOPIC, type OrderContext, type OrderLikeForContext, type OrderLikeForLegacyInference, type OrderLineItem, type OrderMutationData, type OrderPaymentMethod, OrderPlatform, type OrderRefund, type OrderReservationForContext, type OrderStateEventPayload, type OrderStateWritable, type OrderWriteStrategy, OtherFixedRates, OwnerType, PATH_MODES, PAYMENT_STATES, POS_VALID_INITIAL_STATES, type PathMode, PaymentMethod, PaymentProcessor, type PaymentState, type PaymentStateDefinition, type PaymentTransitionPath, type PlanWindowInput, Platform, PreviewImageMode, PricingLevel, PricingPlanEnum, PricingRegionEnum, type ProductDiscountBucket, type ProductFeeBucket, ProductStatus, ProductType, PublicationAvailability, type PublicationConfig, PublicationStatus, REGION_MAPPING, REPORT_NEGATE_PATHS, ReceiptSendChannel, ReceiptType, type RefundsBreakdown, ReservationStatus, ResidualPaymentMethod, ResidualStatus, type ResolveTemplateResult, type ResourceAvailability, ResourceAvailabilityState, type ResourceInWindow, type ResourcePresenceRow, STATE_SCHEMA, STRIPE_SUPPORTED_COUNTRIES, SYSTEM_FAMILIES, SYSTEM_FAMILY_IDS, SYSTEM_UNITS, SYSTEM_UNIT_IDS, type SalesSummary, type SaveStateConfigFragmentParams, type SaveStateConfigFragmentResponse, type SettlementBreakdown, type SettlementBuckets, type SettlementCardSection, type SettlementCashSection, type SettlementCustomEntry, type SplitPayment, type SplitPaymentPayment, type StaffSales, type StaffSalesEntry, type StateConfig, type StateConfigFragment, type StateDefinition, type StatePair, type StateSchema, type StateTransitionBlockedPayload, type StateTransitionCompletedPayload, StationStatus, type StoredStateConfig, StripeCurrencyCode, StripeStatus, type TaxBreakdown, type TaxBreakdownRateEntry, type TaxBreakdownSection, type TaxBreakdownSubtotal, type TaxesTuple, TimePeriod, type TipEntry, type TipsBreakdown, type TipsTuple, TopMetericsSort, type TransitionBlockedBy, type TransitionConditionSet, type TransitionOrderStateParams, type TransitionOrderStateResponse, type TransitionPath, type TransitionRequest, type TransitionResult, UserTypes, type WeeklyHours, addAmounts, amountToString, assertUnitSane, availableIn, baseFor, baseFulfillmentDefinitions, baseOf, basePaymentDefinitions, buildAvailability, buildGrid, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, canTransition, conditionSummary, convertFixedFeeToLocalCurrency, createAmount, crossAxisRuleApplies, deriveDisplayState, deriveFamilyCode, deriveUnitId, displayRuleMatchesPair, divideAmount, evaluateCondition, evaluateConditionSet, extendPrice, extendPriceFor, formatCurrency, formatInUnit, formatMinorUnitsToString, formatQuantity, fromBase, fromMinorUnits, generateMongoID, getAvailableTransitions, getCashAmountDue, getCountriesByRegion, getCurrencyConfig, getCurrentISODate, getFinancialInvariantViolations, getGoodsPortion, getLineSubtotal, getMinorUnitMultiplier, getMinorUnits, getPaymentLegTotal, getPricingRegionFromCountry, getSettlementTotal, getTotalCollected, holdExpiresAt, inferStatesFromLegacyStatus, isAdyenRolloutCountry, isAffirmCountry, isAffirmPricePlan, isConditionOperator, isFulfillmentState, isPaymentState, isSupportedCurrency, isSystemFamilyCode, isValidQuantity, isWhole, mapToLegacyStatus, maxPrecisionFor, mergeFragment, multiplyAmount, normalizeMongoIdString, occupancyIn, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, planWindow, presentAt, removeFragment, resolveFamily, resolveTemplate, resolveUnit, roundToPrecision, sameFamily, setOrderState, shopDayKey, shopDayRange, signReportForDisplay, slotsForWindow, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, violatesFinancialInvariant, windowEndsAt, withinPresence };
|
package/dist/index.d.ts
CHANGED
|
@@ -663,6 +663,43 @@ interface EndOfSessionReport {
|
|
|
663
663
|
minorUnits?: number;
|
|
664
664
|
}
|
|
665
665
|
|
|
666
|
+
declare const ADYEN_ROLLOUT_COUNTRY_CODES: Set<string>;
|
|
667
|
+
declare function isAdyenRolloutCountry(alpha2: string): boolean;
|
|
668
|
+
declare const AFFIRM_PRICE_PLANS: readonly ["core", "standard", "signature"];
|
|
669
|
+
type AffirmPricePlan = (typeof AFFIRM_PRICE_PLANS)[number];
|
|
670
|
+
declare function isAffirmPricePlan(value: unknown): value is AffirmPricePlan;
|
|
671
|
+
declare const AFFIRM_COUNTRY_CODES: Set<string>;
|
|
672
|
+
declare function isAffirmCountry(alpha2: string | undefined): boolean;
|
|
673
|
+
declare const BNPL_METHOD_STATUS: {
|
|
674
|
+
readonly ACTIVE: "active";
|
|
675
|
+
readonly PENDING: "pending";
|
|
676
|
+
readonly UNAVAILABLE: "unavailable";
|
|
677
|
+
readonly UNKNOWN: "unknown";
|
|
678
|
+
};
|
|
679
|
+
type BnplMethodStatus = (typeof BNPL_METHOD_STATUS)[keyof typeof BNPL_METHOD_STATUS];
|
|
680
|
+
declare const BNPL_SKIP_REASON: {
|
|
681
|
+
readonly PENDING: "pending";
|
|
682
|
+
readonly NO_SUPPORT_EMAIL: "no_support_email";
|
|
683
|
+
readonly NO_CURRENCY: "no_currency";
|
|
684
|
+
readonly NO_BUSINESS_LINE: "no_business_line";
|
|
685
|
+
};
|
|
686
|
+
type BnplSkipReason = (typeof BNPL_SKIP_REASON)[keyof typeof BNPL_SKIP_REASON];
|
|
687
|
+
|
|
688
|
+
interface AdyenBnplSettings {
|
|
689
|
+
affirmPricePlan?: AffirmPricePlan;
|
|
690
|
+
affirm: BnplMethodStatus;
|
|
691
|
+
available: boolean;
|
|
692
|
+
}
|
|
693
|
+
interface AdyenBnplSkippedStore {
|
|
694
|
+
storeId: string;
|
|
695
|
+
reason: BnplSkipReason;
|
|
696
|
+
}
|
|
697
|
+
interface AdyenBnplUpdateResult {
|
|
698
|
+
updated: string[];
|
|
699
|
+
requested: string[];
|
|
700
|
+
skipped: AdyenBnplSkippedStore[];
|
|
701
|
+
}
|
|
702
|
+
|
|
666
703
|
declare const CURRENCY_CONFIG: Record<CurrencyCode | string, CurrencyConfig>;
|
|
667
704
|
declare function getCurrencyConfig(currency: CurrencyCode): CurrencyConfig;
|
|
668
705
|
declare function getMinorUnitMultiplier(currency: CurrencyCode): number;
|
|
@@ -844,7 +881,7 @@ interface OrderContext {
|
|
|
844
881
|
paymentMethods: OrderPaymentMethod[];
|
|
845
882
|
refunds: OrderRefund[];
|
|
846
883
|
lineItems: OrderLineItem[];
|
|
847
|
-
reservations
|
|
884
|
+
reservations: OrderReservationForContext[];
|
|
848
885
|
};
|
|
849
886
|
computed: {
|
|
850
887
|
balance: number;
|
|
@@ -1400,26 +1437,6 @@ declare function planWindow({ rule, timeZone, presence, startAt, endAt, now, bus
|
|
|
1400
1437
|
};
|
|
1401
1438
|
declare const holdExpiresAt: (rule: BookingRulesInput, now: Date) => Date;
|
|
1402
1439
|
|
|
1403
|
-
declare const ADYEN_ROLLOUT_COUNTRY_CODES: Set<string>;
|
|
1404
|
-
declare function isAdyenRolloutCountry(alpha2: string): boolean;
|
|
1405
|
-
declare const ADYEN_STORE_STATE_PROVINCE_COUNTRIES: Set<string>;
|
|
1406
|
-
declare function adyenStoreRequiresStateOrProvince(alpha2: string | undefined): boolean;
|
|
1407
|
-
declare const ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES: Set<string>;
|
|
1408
|
-
declare function adyenLegalEntityRequiresStateOrProvince(alpha2: string | undefined): boolean;
|
|
1409
|
-
declare const ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES: Set<string>;
|
|
1410
|
-
declare function adyenSupportsTaxNumberAbsent(alpha2: string | undefined): boolean;
|
|
1411
|
-
declare const ADYEN_TAX_NUMBER_FORMATS: Record<string, {
|
|
1412
|
-
pattern: RegExp;
|
|
1413
|
-
length: number;
|
|
1414
|
-
}>;
|
|
1415
|
-
declare function adyenTaxNumberFormat(alpha2: string | undefined): {
|
|
1416
|
-
pattern: RegExp;
|
|
1417
|
-
length: number;
|
|
1418
|
-
} | undefined;
|
|
1419
|
-
declare const ADYEN_TAX_NUMBER_MIN_LENGTH = 5;
|
|
1420
|
-
declare const ADYEN_JOB_TITLE_ASSOCIATION_TYPES: readonly string[];
|
|
1421
|
-
declare function adyenRequiresJobTitle(associationType: string): boolean;
|
|
1422
|
-
|
|
1423
1440
|
interface CurrencyRate {
|
|
1424
1441
|
rate: number;
|
|
1425
1442
|
country: string;
|
|
@@ -1431,4 +1448,4 @@ declare const EUFixedRates: Record<string, CurrencyRate>;
|
|
|
1431
1448
|
declare const OtherFixedRates: Record<string, CurrencyRate>;
|
|
1432
1449
|
declare const COUNTRY_CURRENCIES: Record<string, string>;
|
|
1433
1450
|
|
|
1434
|
-
export {
|
|
1451
|
+
export { ADYEN_ROLLOUT_COUNTRY_CODES, AFFIRM_COUNTRY_CODES, AFFIRM_PRICE_PLANS, type AdyenBnplSettings, type AdyenBnplSkippedStore, type AdyenBnplUpdateResult, type AffirmPricePlan, type Amount, AttributeType, type AvailabilityInput, type AvailabilitySlot, type AvailableTransition, BNPL_METHOD_STATUS, BNPL_SKIP_REASON, type BnplMethodStatus, type BnplSkipReason, type BookingOccupancy, BookingRatePeriod, type BookingResourceInput, BookingResourceKind, BookingResourceStatus, BookingRulesError, type BookingRulesInput, BookingType, type BusyWindow, CONDITION_OPERATORS, COUNTRY_CURRENCIES, CURRENCY_CONFIG, type CartDiscountBucket, type CartFeeBucket, type CashDrawer, type CashRoundingTuple, CompanyType, type Condition, type ConditionGroup, type ConditionOperator, type ConfigUpdatedPayload, type ConfigValidationError, type ConfigValidationResult, type ConfigValidationWarning, type CrossAxisRequires, type CrossAxisRule, type CrossAxisTrigger, CurrencyCode, type CurrencyConfig, type CurrencyRate, CustomTableAvailability, CustomerPlatform, DEFAULT_CONFIG, DEFAULT_CROSS_AXIS_RULES, DEFAULT_DISPLAY_STATE_MAP, DEFAULT_HOLD_MINUTES, DEFAULT_RESOLVED_CONFIG, DEFAULT_UNIT_ID, type DeleteStateConfigFragmentParams, type DeleteStateConfigFragmentResponse, type DiscountsBreakdown, type DiscountsTuple, type DisplayStateResult, type DisplayStateRule, DualWriteStrategy, EUFixedRates, EUROPE, type EndOfSessionReport, ExtensionCategory, FINANCIAL_INVARIANTS, FULFILLMENT_STATES, type FailedCondition, type FeesBreakdown, FeesCustomBillingStatus, type FeesTuple, type FinancialInvariant, type FragmentParam, type FragmentValidationResult, type FulfillmentState, type FulfillmentStateDefinition, type FulfillmentTransitionPath, type GetAvailableTransitionsParams, type GetAvailableTransitionsResponse, type GetOrderDisplayStateParams, type GetOrderDisplayStateResponse, type GetOrderStateConfigParams, type GetOrderStateConfigResponse, type GetStateConfigFragmentParams, type GetStateConfigFragmentResponse, type GridSlot, InventoryBaseActionEnum, type InventoryBaseActionType, InventorySpecificActionType, InvoiceStatus, LegacyWriteStrategy, LibraryItemType, MAX_PRECISION, type Measurable, type MeasurementBase, type MeasurementUnit, type MeasurementUnitFamily, MenuProject, type ModifiersBreakdown, type ModifiersTuple, NAFixedRates, NORTH_AMERICA, NonRevenueItemType, ORDER_STATE_ACTIONS, ORDER_STATE_EVENTS, ORDER_STATE_TOPIC, type OrderContext, type OrderLikeForContext, type OrderLikeForLegacyInference, type OrderLineItem, type OrderMutationData, type OrderPaymentMethod, OrderPlatform, type OrderRefund, type OrderReservationForContext, type OrderStateEventPayload, type OrderStateWritable, type OrderWriteStrategy, OtherFixedRates, OwnerType, PATH_MODES, PAYMENT_STATES, POS_VALID_INITIAL_STATES, type PathMode, PaymentMethod, PaymentProcessor, type PaymentState, type PaymentStateDefinition, type PaymentTransitionPath, type PlanWindowInput, Platform, PreviewImageMode, PricingLevel, PricingPlanEnum, PricingRegionEnum, type ProductDiscountBucket, type ProductFeeBucket, ProductStatus, ProductType, PublicationAvailability, type PublicationConfig, PublicationStatus, REGION_MAPPING, REPORT_NEGATE_PATHS, ReceiptSendChannel, ReceiptType, type RefundsBreakdown, ReservationStatus, ResidualPaymentMethod, ResidualStatus, type ResolveTemplateResult, type ResourceAvailability, ResourceAvailabilityState, type ResourceInWindow, type ResourcePresenceRow, STATE_SCHEMA, STRIPE_SUPPORTED_COUNTRIES, SYSTEM_FAMILIES, SYSTEM_FAMILY_IDS, SYSTEM_UNITS, SYSTEM_UNIT_IDS, type SalesSummary, type SaveStateConfigFragmentParams, type SaveStateConfigFragmentResponse, type SettlementBreakdown, type SettlementBuckets, type SettlementCardSection, type SettlementCashSection, type SettlementCustomEntry, type SplitPayment, type SplitPaymentPayment, type StaffSales, type StaffSalesEntry, type StateConfig, type StateConfigFragment, type StateDefinition, type StatePair, type StateSchema, type StateTransitionBlockedPayload, type StateTransitionCompletedPayload, StationStatus, type StoredStateConfig, StripeCurrencyCode, StripeStatus, type TaxBreakdown, type TaxBreakdownRateEntry, type TaxBreakdownSection, type TaxBreakdownSubtotal, type TaxesTuple, TimePeriod, type TipEntry, type TipsBreakdown, type TipsTuple, TopMetericsSort, type TransitionBlockedBy, type TransitionConditionSet, type TransitionOrderStateParams, type TransitionOrderStateResponse, type TransitionPath, type TransitionRequest, type TransitionResult, UserTypes, type WeeklyHours, addAmounts, amountToString, assertUnitSane, availableIn, baseFor, baseFulfillmentDefinitions, baseOf, basePaymentDefinitions, buildAvailability, buildGrid, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, canTransition, conditionSummary, convertFixedFeeToLocalCurrency, createAmount, crossAxisRuleApplies, deriveDisplayState, deriveFamilyCode, deriveUnitId, displayRuleMatchesPair, divideAmount, evaluateCondition, evaluateConditionSet, extendPrice, extendPriceFor, formatCurrency, formatInUnit, formatMinorUnitsToString, formatQuantity, fromBase, fromMinorUnits, generateMongoID, getAvailableTransitions, getCashAmountDue, getCountriesByRegion, getCurrencyConfig, getCurrentISODate, getFinancialInvariantViolations, getGoodsPortion, getLineSubtotal, getMinorUnitMultiplier, getMinorUnits, getPaymentLegTotal, getPricingRegionFromCountry, getSettlementTotal, getTotalCollected, holdExpiresAt, inferStatesFromLegacyStatus, isAdyenRolloutCountry, isAffirmCountry, isAffirmPricePlan, isConditionOperator, isFulfillmentState, isPaymentState, isSupportedCurrency, isSystemFamilyCode, isValidQuantity, isWhole, mapToLegacyStatus, maxPrecisionFor, mergeFragment, multiplyAmount, normalizeMongoIdString, occupancyIn, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, planWindow, presentAt, removeFragment, resolveFamily, resolveTemplate, resolveUnit, roundToPrecision, sameFamily, setOrderState, shopDayKey, shopDayRange, signReportForDisplay, slotsForWindow, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, violatesFinancialInvariant, windowEndsAt, withinPresence };
|
package/dist/index.js
CHANGED
|
@@ -19,14 +19,12 @@ 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,
|
|
25
22
|
ADYEN_ROLLOUT_COUNTRY_CODES: () => ADYEN_ROLLOUT_COUNTRY_CODES,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
ADYEN_TAX_NUMBER_MIN_LENGTH: () => ADYEN_TAX_NUMBER_MIN_LENGTH,
|
|
23
|
+
AFFIRM_COUNTRY_CODES: () => AFFIRM_COUNTRY_CODES,
|
|
24
|
+
AFFIRM_PRICE_PLANS: () => AFFIRM_PRICE_PLANS,
|
|
29
25
|
AttributeType: () => AttributeType,
|
|
26
|
+
BNPL_METHOD_STATUS: () => BNPL_METHOD_STATUS,
|
|
27
|
+
BNPL_SKIP_REASON: () => BNPL_SKIP_REASON,
|
|
30
28
|
BookingRatePeriod: () => BookingRatePeriod,
|
|
31
29
|
BookingResourceKind: () => BookingResourceKind,
|
|
32
30
|
BookingResourceStatus: () => BookingResourceStatus,
|
|
@@ -103,11 +101,6 @@ __export(index_exports, {
|
|
|
103
101
|
TopMetericsSort: () => TopMetericsSort,
|
|
104
102
|
UserTypes: () => UserTypes,
|
|
105
103
|
addAmounts: () => addAmounts,
|
|
106
|
-
adyenLegalEntityRequiresStateOrProvince: () => adyenLegalEntityRequiresStateOrProvince,
|
|
107
|
-
adyenRequiresJobTitle: () => adyenRequiresJobTitle,
|
|
108
|
-
adyenStoreRequiresStateOrProvince: () => adyenStoreRequiresStateOrProvince,
|
|
109
|
-
adyenSupportsTaxNumberAbsent: () => adyenSupportsTaxNumberAbsent,
|
|
110
|
-
adyenTaxNumberFormat: () => adyenTaxNumberFormat,
|
|
111
104
|
amountToString: () => amountToString,
|
|
112
105
|
assertUnitSane: () => assertUnitSane,
|
|
113
106
|
availableIn: () => availableIn,
|
|
@@ -159,6 +152,8 @@ __export(index_exports, {
|
|
|
159
152
|
holdExpiresAt: () => holdExpiresAt,
|
|
160
153
|
inferStatesFromLegacyStatus: () => inferStatesFromLegacyStatus,
|
|
161
154
|
isAdyenRolloutCountry: () => isAdyenRolloutCountry,
|
|
155
|
+
isAffirmCountry: () => isAffirmCountry,
|
|
156
|
+
isAffirmPricePlan: () => isAffirmPricePlan,
|
|
162
157
|
isConditionOperator: () => isConditionOperator,
|
|
163
158
|
isFulfillmentState: () => isFulfillmentState,
|
|
164
159
|
isPaymentState: () => isPaymentState,
|
|
@@ -3205,9 +3200,7 @@ function buildGrid(rule, timeZone, from, to, now, busy = []) {
|
|
|
3205
3200
|
const start = startAt.getTime();
|
|
3206
3201
|
if (start < askedFrom || start >= askedTo) return false;
|
|
3207
3202
|
if (start < notBefore || start > notAfter) return false;
|
|
3208
|
-
return !blocked.some(
|
|
3209
|
-
({ from: blockFrom, to: blockTo }) => start < blockTo && bufferEndAt.getTime() > blockFrom
|
|
3210
|
-
);
|
|
3203
|
+
return !blocked.some(({ from: blockFrom, to: blockTo }) => start < blockTo && bufferEndAt.getTime() > blockFrom);
|
|
3211
3204
|
}).sort((first, second) => +first.startAt - +second.startAt);
|
|
3212
3205
|
}
|
|
3213
3206
|
function slotsForWindow(grid, startAt, endAt) {
|
|
@@ -3326,14 +3319,7 @@ function buildAvailability({
|
|
|
3326
3319
|
for (const slot of slots2) {
|
|
3327
3320
|
const { taken, foreignProductId } = occupancyIn(mine, productId, slot.startAt, slot.bufferEndAt, shared);
|
|
3328
3321
|
const free = foreignProductId ? 0 : Math.max(capacity - taken, 0);
|
|
3329
|
-
const entry = byInstant.get(+slot.startAt) ?? {
|
|
3330
|
-
...slot,
|
|
3331
|
-
capacity: 0,
|
|
3332
|
-
booked: 0,
|
|
3333
|
-
free: 0,
|
|
3334
|
-
resources: [],
|
|
3335
|
-
dayKey: shopDayKey(slot.startAt, resource.timeZone)
|
|
3336
|
-
};
|
|
3322
|
+
const entry = byInstant.get(+slot.startAt) ?? { ...slot, capacity: 0, booked: 0, free: 0, resources: [], dayKey: shopDayKey(slot.startAt, resource.timeZone) };
|
|
3337
3323
|
entry.capacity += capacity;
|
|
3338
3324
|
entry.booked += foreignProductId ? capacity : taken;
|
|
3339
3325
|
entry.free += free;
|
|
@@ -3411,39 +3397,34 @@ var ADYEN_ROLLOUT_COUNTRY_CODES = /* @__PURE__ */ new Set(["CA"]);
|
|
|
3411
3397
|
function isAdyenRolloutCountry(alpha2) {
|
|
3412
3398
|
return ADYEN_ROLLOUT_COUNTRY_CODES.has(alpha2);
|
|
3413
3399
|
}
|
|
3414
|
-
var
|
|
3415
|
-
function
|
|
3416
|
-
return
|
|
3417
|
-
}
|
|
3418
|
-
var ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES = /* @__PURE__ */ new Set(["AU", "BR", "CA", "IN", "MX", "NZ", "US"]);
|
|
3419
|
-
function adyenLegalEntityRequiresStateOrProvince(alpha2) {
|
|
3420
|
-
return !!alpha2 && ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES.has(alpha2);
|
|
3400
|
+
var AFFIRM_PRICE_PLANS = ["core", "standard", "signature"];
|
|
3401
|
+
function isAffirmPricePlan(value) {
|
|
3402
|
+
return typeof value === "string" && AFFIRM_PRICE_PLANS.includes(value);
|
|
3421
3403
|
}
|
|
3422
|
-
var
|
|
3423
|
-
function
|
|
3424
|
-
return !!alpha2 &&
|
|
3404
|
+
var AFFIRM_COUNTRY_CODES = /* @__PURE__ */ new Set(["CA"]);
|
|
3405
|
+
function isAffirmCountry(alpha2) {
|
|
3406
|
+
return !!alpha2 && AFFIRM_COUNTRY_CODES.has(alpha2.toUpperCase());
|
|
3425
3407
|
}
|
|
3426
|
-
var
|
|
3427
|
-
|
|
3408
|
+
var BNPL_METHOD_STATUS = {
|
|
3409
|
+
ACTIVE: "active",
|
|
3410
|
+
PENDING: "pending",
|
|
3411
|
+
UNAVAILABLE: "unavailable",
|
|
3412
|
+
UNKNOWN: "unknown"
|
|
3413
|
+
};
|
|
3414
|
+
var BNPL_SKIP_REASON = {
|
|
3415
|
+
PENDING: "pending",
|
|
3416
|
+
NO_SUPPORT_EMAIL: "no_support_email",
|
|
3417
|
+
NO_CURRENCY: "no_currency",
|
|
3418
|
+
NO_BUSINESS_LINE: "no_business_line"
|
|
3428
3419
|
};
|
|
3429
|
-
function adyenTaxNumberFormat(alpha2) {
|
|
3430
|
-
return alpha2 ? ADYEN_TAX_NUMBER_FORMATS[alpha2] : void 0;
|
|
3431
|
-
}
|
|
3432
|
-
var ADYEN_TAX_NUMBER_MIN_LENGTH = 5;
|
|
3433
|
-
var ADYEN_JOB_TITLE_ASSOCIATION_TYPES = ["signatory", "uboThroughControl"];
|
|
3434
|
-
function adyenRequiresJobTitle(associationType) {
|
|
3435
|
-
return ADYEN_JOB_TITLE_ASSOCIATION_TYPES.includes(associationType);
|
|
3436
|
-
}
|
|
3437
3420
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3438
3421
|
0 && (module.exports = {
|
|
3439
|
-
ADYEN_JOB_TITLE_ASSOCIATION_TYPES,
|
|
3440
|
-
ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES,
|
|
3441
|
-
ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES,
|
|
3442
3422
|
ADYEN_ROLLOUT_COUNTRY_CODES,
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
ADYEN_TAX_NUMBER_MIN_LENGTH,
|
|
3423
|
+
AFFIRM_COUNTRY_CODES,
|
|
3424
|
+
AFFIRM_PRICE_PLANS,
|
|
3446
3425
|
AttributeType,
|
|
3426
|
+
BNPL_METHOD_STATUS,
|
|
3427
|
+
BNPL_SKIP_REASON,
|
|
3447
3428
|
BookingRatePeriod,
|
|
3448
3429
|
BookingResourceKind,
|
|
3449
3430
|
BookingResourceStatus,
|
|
@@ -3520,11 +3501,6 @@ function adyenRequiresJobTitle(associationType) {
|
|
|
3520
3501
|
TopMetericsSort,
|
|
3521
3502
|
UserTypes,
|
|
3522
3503
|
addAmounts,
|
|
3523
|
-
adyenLegalEntityRequiresStateOrProvince,
|
|
3524
|
-
adyenRequiresJobTitle,
|
|
3525
|
-
adyenStoreRequiresStateOrProvince,
|
|
3526
|
-
adyenSupportsTaxNumberAbsent,
|
|
3527
|
-
adyenTaxNumberFormat,
|
|
3528
3504
|
amountToString,
|
|
3529
3505
|
assertUnitSane,
|
|
3530
3506
|
availableIn,
|
|
@@ -3576,6 +3552,8 @@ function adyenRequiresJobTitle(associationType) {
|
|
|
3576
3552
|
holdExpiresAt,
|
|
3577
3553
|
inferStatesFromLegacyStatus,
|
|
3578
3554
|
isAdyenRolloutCountry,
|
|
3555
|
+
isAffirmCountry,
|
|
3556
|
+
isAffirmPricePlan,
|
|
3579
3557
|
isConditionOperator,
|
|
3580
3558
|
isFulfillmentState,
|
|
3581
3559
|
isPaymentState,
|