@final-commerce/common 2.8.1-online.1 → 2.8.1-online.3
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/dist/index.d.mts +73 -1
- package/dist/index.d.ts +73 -1
- package/dist/index.js +93 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +86 -0
- package/dist/index.mjs.map +1 -1
- package/dist/pos-types/index.d.mts +41 -12
- package/dist/pos-types/index.d.ts +41 -12
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -481,6 +481,30 @@ declare enum ShippingZoneError {
|
|
|
481
481
|
MISSING_NAME = "MISSING_NAME"
|
|
482
482
|
}
|
|
483
483
|
|
|
484
|
+
declare enum TaxProductType {
|
|
485
|
+
STANDARD = "standard",
|
|
486
|
+
BASIC_FOOD = "basic_food",
|
|
487
|
+
CHILDRENS_CLOTHING = "childrens_clothing",
|
|
488
|
+
EXEMPT = "exempt"
|
|
489
|
+
}
|
|
490
|
+
declare enum TaxRegistrationKind {
|
|
491
|
+
GST_HST = "GST_HST",
|
|
492
|
+
PST = "PST",
|
|
493
|
+
QST = "QST"
|
|
494
|
+
}
|
|
495
|
+
declare enum TaxSource {
|
|
496
|
+
MERCHANT = "merchant",
|
|
497
|
+
AUTOMATIC = "automatic"
|
|
498
|
+
}
|
|
499
|
+
declare enum OutOfProvinceTaxes {
|
|
500
|
+
AUTOMATIC = "automatic",
|
|
501
|
+
HOME = "home"
|
|
502
|
+
}
|
|
503
|
+
declare enum TaxWarningCode {
|
|
504
|
+
NOT_REGISTERED = "NOT_REGISTERED",
|
|
505
|
+
NO_RULES_FOR_PLACE = "NO_RULES_FOR_PLACE"
|
|
506
|
+
}
|
|
507
|
+
|
|
484
508
|
interface CurrencyConfig {
|
|
485
509
|
minorUnits: number;
|
|
486
510
|
symbol: string;
|
|
@@ -1014,6 +1038,46 @@ declare function compositeModifierMismatches(lineItems: readonly {
|
|
|
1014
1038
|
}[]): string[];
|
|
1015
1039
|
declare function compositeReservationMismatches(order: CompositeReservationOrder): string[];
|
|
1016
1040
|
|
|
1041
|
+
type IdLike = string | {
|
|
1042
|
+
toString(): string;
|
|
1043
|
+
};
|
|
1044
|
+
interface StockLineComponent {
|
|
1045
|
+
productId: IdLike;
|
|
1046
|
+
variantId: IdLike;
|
|
1047
|
+
quantity: number;
|
|
1048
|
+
stockQuantity?: number | null;
|
|
1049
|
+
unitId?: IdLike | null;
|
|
1050
|
+
stockVariantId?: IdLike | null;
|
|
1051
|
+
}
|
|
1052
|
+
interface StockLine {
|
|
1053
|
+
internalId?: string | null;
|
|
1054
|
+
productId?: IdLike | null;
|
|
1055
|
+
variantId?: IdLike | null;
|
|
1056
|
+
name?: string | null;
|
|
1057
|
+
stockQuantity?: number | null;
|
|
1058
|
+
unitId?: IdLike | null;
|
|
1059
|
+
stockVariantId?: IdLike | null;
|
|
1060
|
+
components?: readonly StockLineComponent[] | null;
|
|
1061
|
+
}
|
|
1062
|
+
interface StockReservationLink {
|
|
1063
|
+
lineItemInternalId?: string | null;
|
|
1064
|
+
componentIndex?: number | null;
|
|
1065
|
+
}
|
|
1066
|
+
interface LineStockMove {
|
|
1067
|
+
productId: string;
|
|
1068
|
+
variantId: string;
|
|
1069
|
+
fields: {
|
|
1070
|
+
quantity: number;
|
|
1071
|
+
stockQuantity?: number;
|
|
1072
|
+
unitId?: string;
|
|
1073
|
+
stockVariantId?: string;
|
|
1074
|
+
compositeProductId?: string;
|
|
1075
|
+
compositeName?: string;
|
|
1076
|
+
};
|
|
1077
|
+
componentIndex?: number;
|
|
1078
|
+
}
|
|
1079
|
+
declare function lineStockMoves(item: StockLine, quantity: number, reservations?: readonly StockReservationLink[]): LineStockMove[];
|
|
1080
|
+
|
|
1017
1081
|
declare const SYSTEM_FAMILY_IDS: {
|
|
1018
1082
|
readonly COUNT: "count";
|
|
1019
1083
|
readonly WEIGHT: "weight-metric";
|
|
@@ -1803,6 +1867,14 @@ interface ShippingZoneProblem {
|
|
|
1803
1867
|
}
|
|
1804
1868
|
declare function validateShippingZone(zone: ShippingZoneRule): ShippingZoneProblem[];
|
|
1805
1869
|
|
|
1870
|
+
interface TaxRegistration {
|
|
1871
|
+
kind: TaxRegistrationKind | `${TaxRegistrationKind}`;
|
|
1872
|
+
place: string;
|
|
1873
|
+
number?: string | null;
|
|
1874
|
+
from?: string | null;
|
|
1875
|
+
}
|
|
1876
|
+
declare const TAX_REGISTRATION_PLACES: Readonly<Record<TaxRegistrationKind, readonly string[]>>;
|
|
1877
|
+
|
|
1806
1878
|
interface CurrencyRate {
|
|
1807
1879
|
rate: number;
|
|
1808
1880
|
country: string;
|
|
@@ -1871,4 +1943,4 @@ declare const EXPENSE_DEFAULT_CATEGORIES: readonly [{
|
|
|
1871
1943
|
}];
|
|
1872
1944
|
type ExpenseDefaultCategoryKey = (typeof EXPENSE_DEFAULT_CATEGORIES)[number]['key'];
|
|
1873
1945
|
|
|
1874
|
-
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 AddressLike, 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, CANADA_PROVINCES, 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 CountryOption, 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, EVERYWHERE_KEY, EXPENSE_DEFAULT_CATEGORIES, EXPENSE_NAME_MAX_LENGTH, EXPENSE_PAYMENT_METHOD_PRESETS, type EndOfSessionReport, type ExpenseDefaultCategoryKey, 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, type NormalizedAddress, 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_CHANNELS, PAYMENT_STATES, POS_VALID_INITIAL_STATES, type PathMode, type PaymentChannel, PaymentMethod, PaymentProcessor, type PaymentState, type PaymentStateDefinition, type PaymentTransitionPath, type PlanWindowInput, Platform, type PoolDrawing, PreviewImageMode, PricingLevel, PricingPlanEnum, PricingRegionEnum, ProcessorType, type ProductDiscountBucket, type ProductFeeBucket, ProductStatus, ProductType, type Province, PublicationAvailability, type PublicationConfig, PublicationStatus, REGION_MAPPING, REPORT_NEGATE_PATHS, ReceiptSendChannel, ReceiptType, type RefundsBreakdown, ReservationStatus, ResidualPaymentMethod, ResidualStatus, type ResolveInputs, type ResolveShippingInput, 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, ShippingChannel, ShippingNoOptionReason, type ShippingOptionRule, ShippingOptionType, type ShippingPlace, type ShippingPriceTier, type ShippingQuoteOption, ShippingRateType, type ShippingResolution, ShippingZoneError, ShippingZoneKind, type ShippingZoneProblem, type ShippingZoneRule, 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, addressPlaceKeys, 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, listCountries, listProvinces, mapToLegacyStatus, maxPrecisionFor, mergeFragment, modifiersSellable, multiplyAmount, normalizeAddress, normalizeCityKey, normalizeCountry, normalizeMongoIdString, normalizePostCode, normalizeProvince, occupancyIn, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, placeKey, planWindow, poolDemand, poolOf, poolShortfall, poolStockAt, postCodeMatchesProvince, presentAt, priceForTotal, provincesForPostCode, removeFragment, resolveFamily, resolveModifiersForProduct, resolveShipping, resolveTemplate, resolveUnit, roundToPrecision, sameFamily, setOrderState, shopDayKey, shopDayRange, signReportForDisplay, slotsForWindow, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, validateOrderStatuses, validateShippingZone, violatesFinancialInvariant, windowEndsAt, withinPresence };
|
|
1946
|
+
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 AddressLike, 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, CANADA_PROVINCES, 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 CountryOption, 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, EVERYWHERE_KEY, EXPENSE_DEFAULT_CATEGORIES, EXPENSE_NAME_MAX_LENGTH, EXPENSE_PAYMENT_METHOD_PRESETS, type EndOfSessionReport, type ExpenseDefaultCategoryKey, 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, type LineStockMove, MAX_PRECISION, type Measurable, type MeasurementBase, type MeasurementUnit, type MeasurementUnitFamily, MenuProject, type ModifierChoiceRow, type ModifierRow, type ModifiersBreakdown, type ModifiersTuple, NAFixedRates, NORTH_AMERICA, NonRevenueItemType, type NormalizedAddress, 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, OutOfProvinceTaxes, OwnerType, PATH_MODES, PAYMENT_CHANNELS, PAYMENT_STATES, POS_VALID_INITIAL_STATES, type PathMode, type PaymentChannel, PaymentMethod, PaymentProcessor, type PaymentState, type PaymentStateDefinition, type PaymentTransitionPath, type PlanWindowInput, Platform, type PoolDrawing, PreviewImageMode, PricingLevel, PricingPlanEnum, PricingRegionEnum, ProcessorType, type ProductDiscountBucket, type ProductFeeBucket, ProductStatus, ProductType, type Province, PublicationAvailability, type PublicationConfig, PublicationStatus, REGION_MAPPING, REPORT_NEGATE_PATHS, ReceiptSendChannel, ReceiptType, type RefundsBreakdown, ReservationStatus, ResidualPaymentMethod, ResidualStatus, type ResolveInputs, type ResolveShippingInput, 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, ShippingChannel, ShippingNoOptionReason, type ShippingOptionRule, ShippingOptionType, type ShippingPlace, type ShippingPriceTier, type ShippingQuoteOption, ShippingRateType, type ShippingResolution, ShippingZoneError, ShippingZoneKind, type ShippingZoneProblem, type ShippingZoneRule, type SplitPayment, type SplitPaymentPayment, type StaffSales, type StaffSalesEntry, type StateConfig, type StateConfigFragment, type StateDefinition, type StatePair, type StateSchema, type StateTransitionBlockedPayload, type StateTransitionCompletedPayload, StationStatus, type StockLine, type StockLineComponent, type StockReservationLink, type StoredStateConfig, StripeCurrencyCode, StripeStatus, TAX_REGISTRATION_PLACES, type TaxBreakdown, type TaxBreakdownRateEntry, type TaxBreakdownSection, type TaxBreakdownSubtotal, TaxProductType, type TaxRegistration, TaxRegistrationKind, TaxSource, TaxWarningCode, 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, addressPlaceKeys, 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, lineStockMoves, listCountries, listProvinces, mapToLegacyStatus, maxPrecisionFor, mergeFragment, modifiersSellable, multiplyAmount, normalizeAddress, normalizeCityKey, normalizeCountry, normalizeMongoIdString, normalizePostCode, normalizeProvince, occupancyIn, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, placeKey, planWindow, poolDemand, poolOf, poolShortfall, poolStockAt, postCodeMatchesProvince, presentAt, priceForTotal, provincesForPostCode, removeFragment, resolveFamily, resolveModifiersForProduct, resolveShipping, resolveTemplate, resolveUnit, roundToPrecision, sameFamily, setOrderState, shopDayKey, shopDayRange, signReportForDisplay, slotsForWindow, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, validateOrderStatuses, validateShippingZone, violatesFinancialInvariant, windowEndsAt, withinPresence };
|
package/dist/index.d.ts
CHANGED
|
@@ -481,6 +481,30 @@ declare enum ShippingZoneError {
|
|
|
481
481
|
MISSING_NAME = "MISSING_NAME"
|
|
482
482
|
}
|
|
483
483
|
|
|
484
|
+
declare enum TaxProductType {
|
|
485
|
+
STANDARD = "standard",
|
|
486
|
+
BASIC_FOOD = "basic_food",
|
|
487
|
+
CHILDRENS_CLOTHING = "childrens_clothing",
|
|
488
|
+
EXEMPT = "exempt"
|
|
489
|
+
}
|
|
490
|
+
declare enum TaxRegistrationKind {
|
|
491
|
+
GST_HST = "GST_HST",
|
|
492
|
+
PST = "PST",
|
|
493
|
+
QST = "QST"
|
|
494
|
+
}
|
|
495
|
+
declare enum TaxSource {
|
|
496
|
+
MERCHANT = "merchant",
|
|
497
|
+
AUTOMATIC = "automatic"
|
|
498
|
+
}
|
|
499
|
+
declare enum OutOfProvinceTaxes {
|
|
500
|
+
AUTOMATIC = "automatic",
|
|
501
|
+
HOME = "home"
|
|
502
|
+
}
|
|
503
|
+
declare enum TaxWarningCode {
|
|
504
|
+
NOT_REGISTERED = "NOT_REGISTERED",
|
|
505
|
+
NO_RULES_FOR_PLACE = "NO_RULES_FOR_PLACE"
|
|
506
|
+
}
|
|
507
|
+
|
|
484
508
|
interface CurrencyConfig {
|
|
485
509
|
minorUnits: number;
|
|
486
510
|
symbol: string;
|
|
@@ -1014,6 +1038,46 @@ declare function compositeModifierMismatches(lineItems: readonly {
|
|
|
1014
1038
|
}[]): string[];
|
|
1015
1039
|
declare function compositeReservationMismatches(order: CompositeReservationOrder): string[];
|
|
1016
1040
|
|
|
1041
|
+
type IdLike = string | {
|
|
1042
|
+
toString(): string;
|
|
1043
|
+
};
|
|
1044
|
+
interface StockLineComponent {
|
|
1045
|
+
productId: IdLike;
|
|
1046
|
+
variantId: IdLike;
|
|
1047
|
+
quantity: number;
|
|
1048
|
+
stockQuantity?: number | null;
|
|
1049
|
+
unitId?: IdLike | null;
|
|
1050
|
+
stockVariantId?: IdLike | null;
|
|
1051
|
+
}
|
|
1052
|
+
interface StockLine {
|
|
1053
|
+
internalId?: string | null;
|
|
1054
|
+
productId?: IdLike | null;
|
|
1055
|
+
variantId?: IdLike | null;
|
|
1056
|
+
name?: string | null;
|
|
1057
|
+
stockQuantity?: number | null;
|
|
1058
|
+
unitId?: IdLike | null;
|
|
1059
|
+
stockVariantId?: IdLike | null;
|
|
1060
|
+
components?: readonly StockLineComponent[] | null;
|
|
1061
|
+
}
|
|
1062
|
+
interface StockReservationLink {
|
|
1063
|
+
lineItemInternalId?: string | null;
|
|
1064
|
+
componentIndex?: number | null;
|
|
1065
|
+
}
|
|
1066
|
+
interface LineStockMove {
|
|
1067
|
+
productId: string;
|
|
1068
|
+
variantId: string;
|
|
1069
|
+
fields: {
|
|
1070
|
+
quantity: number;
|
|
1071
|
+
stockQuantity?: number;
|
|
1072
|
+
unitId?: string;
|
|
1073
|
+
stockVariantId?: string;
|
|
1074
|
+
compositeProductId?: string;
|
|
1075
|
+
compositeName?: string;
|
|
1076
|
+
};
|
|
1077
|
+
componentIndex?: number;
|
|
1078
|
+
}
|
|
1079
|
+
declare function lineStockMoves(item: StockLine, quantity: number, reservations?: readonly StockReservationLink[]): LineStockMove[];
|
|
1080
|
+
|
|
1017
1081
|
declare const SYSTEM_FAMILY_IDS: {
|
|
1018
1082
|
readonly COUNT: "count";
|
|
1019
1083
|
readonly WEIGHT: "weight-metric";
|
|
@@ -1803,6 +1867,14 @@ interface ShippingZoneProblem {
|
|
|
1803
1867
|
}
|
|
1804
1868
|
declare function validateShippingZone(zone: ShippingZoneRule): ShippingZoneProblem[];
|
|
1805
1869
|
|
|
1870
|
+
interface TaxRegistration {
|
|
1871
|
+
kind: TaxRegistrationKind | `${TaxRegistrationKind}`;
|
|
1872
|
+
place: string;
|
|
1873
|
+
number?: string | null;
|
|
1874
|
+
from?: string | null;
|
|
1875
|
+
}
|
|
1876
|
+
declare const TAX_REGISTRATION_PLACES: Readonly<Record<TaxRegistrationKind, readonly string[]>>;
|
|
1877
|
+
|
|
1806
1878
|
interface CurrencyRate {
|
|
1807
1879
|
rate: number;
|
|
1808
1880
|
country: string;
|
|
@@ -1871,4 +1943,4 @@ declare const EXPENSE_DEFAULT_CATEGORIES: readonly [{
|
|
|
1871
1943
|
}];
|
|
1872
1944
|
type ExpenseDefaultCategoryKey = (typeof EXPENSE_DEFAULT_CATEGORIES)[number]['key'];
|
|
1873
1945
|
|
|
1874
|
-
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 AddressLike, 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, CANADA_PROVINCES, 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 CountryOption, 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, EVERYWHERE_KEY, EXPENSE_DEFAULT_CATEGORIES, EXPENSE_NAME_MAX_LENGTH, EXPENSE_PAYMENT_METHOD_PRESETS, type EndOfSessionReport, type ExpenseDefaultCategoryKey, 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, type NormalizedAddress, 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_CHANNELS, PAYMENT_STATES, POS_VALID_INITIAL_STATES, type PathMode, type PaymentChannel, PaymentMethod, PaymentProcessor, type PaymentState, type PaymentStateDefinition, type PaymentTransitionPath, type PlanWindowInput, Platform, type PoolDrawing, PreviewImageMode, PricingLevel, PricingPlanEnum, PricingRegionEnum, ProcessorType, type ProductDiscountBucket, type ProductFeeBucket, ProductStatus, ProductType, type Province, PublicationAvailability, type PublicationConfig, PublicationStatus, REGION_MAPPING, REPORT_NEGATE_PATHS, ReceiptSendChannel, ReceiptType, type RefundsBreakdown, ReservationStatus, ResidualPaymentMethod, ResidualStatus, type ResolveInputs, type ResolveShippingInput, 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, ShippingChannel, ShippingNoOptionReason, type ShippingOptionRule, ShippingOptionType, type ShippingPlace, type ShippingPriceTier, type ShippingQuoteOption, ShippingRateType, type ShippingResolution, ShippingZoneError, ShippingZoneKind, type ShippingZoneProblem, type ShippingZoneRule, 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, addressPlaceKeys, 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, listCountries, listProvinces, mapToLegacyStatus, maxPrecisionFor, mergeFragment, modifiersSellable, multiplyAmount, normalizeAddress, normalizeCityKey, normalizeCountry, normalizeMongoIdString, normalizePostCode, normalizeProvince, occupancyIn, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, placeKey, planWindow, poolDemand, poolOf, poolShortfall, poolStockAt, postCodeMatchesProvince, presentAt, priceForTotal, provincesForPostCode, removeFragment, resolveFamily, resolveModifiersForProduct, resolveShipping, resolveTemplate, resolveUnit, roundToPrecision, sameFamily, setOrderState, shopDayKey, shopDayRange, signReportForDisplay, slotsForWindow, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, validateOrderStatuses, validateShippingZone, violatesFinancialInvariant, windowEndsAt, withinPresence };
|
|
1946
|
+
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 AddressLike, 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, CANADA_PROVINCES, 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 CountryOption, 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, EVERYWHERE_KEY, EXPENSE_DEFAULT_CATEGORIES, EXPENSE_NAME_MAX_LENGTH, EXPENSE_PAYMENT_METHOD_PRESETS, type EndOfSessionReport, type ExpenseDefaultCategoryKey, 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, type LineStockMove, MAX_PRECISION, type Measurable, type MeasurementBase, type MeasurementUnit, type MeasurementUnitFamily, MenuProject, type ModifierChoiceRow, type ModifierRow, type ModifiersBreakdown, type ModifiersTuple, NAFixedRates, NORTH_AMERICA, NonRevenueItemType, type NormalizedAddress, 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, OutOfProvinceTaxes, OwnerType, PATH_MODES, PAYMENT_CHANNELS, PAYMENT_STATES, POS_VALID_INITIAL_STATES, type PathMode, type PaymentChannel, PaymentMethod, PaymentProcessor, type PaymentState, type PaymentStateDefinition, type PaymentTransitionPath, type PlanWindowInput, Platform, type PoolDrawing, PreviewImageMode, PricingLevel, PricingPlanEnum, PricingRegionEnum, ProcessorType, type ProductDiscountBucket, type ProductFeeBucket, ProductStatus, ProductType, type Province, PublicationAvailability, type PublicationConfig, PublicationStatus, REGION_MAPPING, REPORT_NEGATE_PATHS, ReceiptSendChannel, ReceiptType, type RefundsBreakdown, ReservationStatus, ResidualPaymentMethod, ResidualStatus, type ResolveInputs, type ResolveShippingInput, 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, ShippingChannel, ShippingNoOptionReason, type ShippingOptionRule, ShippingOptionType, type ShippingPlace, type ShippingPriceTier, type ShippingQuoteOption, ShippingRateType, type ShippingResolution, ShippingZoneError, ShippingZoneKind, type ShippingZoneProblem, type ShippingZoneRule, type SplitPayment, type SplitPaymentPayment, type StaffSales, type StaffSalesEntry, type StateConfig, type StateConfigFragment, type StateDefinition, type StatePair, type StateSchema, type StateTransitionBlockedPayload, type StateTransitionCompletedPayload, StationStatus, type StockLine, type StockLineComponent, type StockReservationLink, type StoredStateConfig, StripeCurrencyCode, StripeStatus, TAX_REGISTRATION_PLACES, type TaxBreakdown, type TaxBreakdownRateEntry, type TaxBreakdownSection, type TaxBreakdownSubtotal, TaxProductType, type TaxRegistration, TaxRegistrationKind, TaxSource, TaxWarningCode, 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, addressPlaceKeys, 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, lineStockMoves, listCountries, listProvinces, mapToLegacyStatus, maxPrecisionFor, mergeFragment, modifiersSellable, multiplyAmount, normalizeAddress, normalizeCityKey, normalizeCountry, normalizeMongoIdString, normalizePostCode, normalizeProvince, occupancyIn, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, placeKey, planWindow, poolDemand, poolOf, poolShortfall, poolStockAt, postCodeMatchesProvince, presentAt, priceForTotal, provincesForPostCode, removeFragment, resolveFamily, resolveModifiersForProduct, resolveShipping, resolveTemplate, resolveUnit, roundToPrecision, sameFamily, setOrderState, shopDayKey, shopDayRange, signReportForDisplay, slotsForWindow, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, validateOrderStatuses, validateShippingZone, violatesFinancialInvariant, windowEndsAt, withinPresence };
|
package/dist/index.js
CHANGED
|
@@ -76,6 +76,7 @@ __export(index_exports, {
|
|
|
76
76
|
ORDER_STATE_TOPIC: () => ORDER_STATE_TOPIC,
|
|
77
77
|
OrderPlatform: () => OrderPlatform,
|
|
78
78
|
OtherFixedRates: () => OtherFixedRates,
|
|
79
|
+
OutOfProvinceTaxes: () => OutOfProvinceTaxes,
|
|
79
80
|
OwnerType: () => OwnerType,
|
|
80
81
|
PATH_MODES: () => PATH_MODES,
|
|
81
82
|
PAYMENT_CHANNELS: () => PAYMENT_CHANNELS,
|
|
@@ -116,6 +117,11 @@ __export(index_exports, {
|
|
|
116
117
|
StationStatus: () => StationStatus,
|
|
117
118
|
StripeCurrencyCode: () => StripeCurrencyCode,
|
|
118
119
|
StripeStatus: () => StripeStatus,
|
|
120
|
+
TAX_REGISTRATION_PLACES: () => TAX_REGISTRATION_PLACES,
|
|
121
|
+
TaxProductType: () => TaxProductType,
|
|
122
|
+
TaxRegistrationKind: () => TaxRegistrationKind,
|
|
123
|
+
TaxSource: () => TaxSource,
|
|
124
|
+
TaxWarningCode: () => TaxWarningCode,
|
|
119
125
|
TimePeriod: () => TimePeriod,
|
|
120
126
|
TopMetericsSort: () => TopMetericsSort,
|
|
121
127
|
UserTypes: () => UserTypes,
|
|
@@ -199,6 +205,7 @@ __export(index_exports, {
|
|
|
199
205
|
isSystemFamilyCode: () => isSystemFamilyCode,
|
|
200
206
|
isValidQuantity: () => isValidQuantity,
|
|
201
207
|
isWhole: () => isWhole,
|
|
208
|
+
lineStockMoves: () => lineStockMoves,
|
|
202
209
|
listCountries: () => listCountries,
|
|
203
210
|
listProvinces: () => listProvinces,
|
|
204
211
|
mapToLegacyStatus: () => mapToLegacyStatus,
|
|
@@ -786,6 +793,36 @@ var ShippingZoneError = /* @__PURE__ */ ((ShippingZoneError2) => {
|
|
|
786
793
|
return ShippingZoneError2;
|
|
787
794
|
})(ShippingZoneError || {});
|
|
788
795
|
|
|
796
|
+
// enums/tax.enum.ts
|
|
797
|
+
var TaxProductType = /* @__PURE__ */ ((TaxProductType2) => {
|
|
798
|
+
TaxProductType2["STANDARD"] = "standard";
|
|
799
|
+
TaxProductType2["BASIC_FOOD"] = "basic_food";
|
|
800
|
+
TaxProductType2["CHILDRENS_CLOTHING"] = "childrens_clothing";
|
|
801
|
+
TaxProductType2["EXEMPT"] = "exempt";
|
|
802
|
+
return TaxProductType2;
|
|
803
|
+
})(TaxProductType || {});
|
|
804
|
+
var TaxRegistrationKind = /* @__PURE__ */ ((TaxRegistrationKind2) => {
|
|
805
|
+
TaxRegistrationKind2["GST_HST"] = "GST_HST";
|
|
806
|
+
TaxRegistrationKind2["PST"] = "PST";
|
|
807
|
+
TaxRegistrationKind2["QST"] = "QST";
|
|
808
|
+
return TaxRegistrationKind2;
|
|
809
|
+
})(TaxRegistrationKind || {});
|
|
810
|
+
var TaxSource = /* @__PURE__ */ ((TaxSource2) => {
|
|
811
|
+
TaxSource2["MERCHANT"] = "merchant";
|
|
812
|
+
TaxSource2["AUTOMATIC"] = "automatic";
|
|
813
|
+
return TaxSource2;
|
|
814
|
+
})(TaxSource || {});
|
|
815
|
+
var OutOfProvinceTaxes = /* @__PURE__ */ ((OutOfProvinceTaxes2) => {
|
|
816
|
+
OutOfProvinceTaxes2["AUTOMATIC"] = "automatic";
|
|
817
|
+
OutOfProvinceTaxes2["HOME"] = "home";
|
|
818
|
+
return OutOfProvinceTaxes2;
|
|
819
|
+
})(OutOfProvinceTaxes || {});
|
|
820
|
+
var TaxWarningCode = /* @__PURE__ */ ((TaxWarningCode2) => {
|
|
821
|
+
TaxWarningCode2["NOT_REGISTERED"] = "NOT_REGISTERED";
|
|
822
|
+
TaxWarningCode2["NO_RULES_FOR_PLACE"] = "NO_RULES_FOR_PLACE";
|
|
823
|
+
return TaxWarningCode2;
|
|
824
|
+
})(TaxWarningCode || {});
|
|
825
|
+
|
|
789
826
|
// utils/currency.util.ts
|
|
790
827
|
var CURRENCY_CONFIG = {
|
|
791
828
|
// Major currencies with 2 decimal places
|
|
@@ -1961,6 +1998,48 @@ function compositeReservationMismatches(order) {
|
|
|
1961
1998
|
});
|
|
1962
1999
|
}
|
|
1963
2000
|
|
|
2001
|
+
// utils/line-stock-moves.util.ts
|
|
2002
|
+
function lineStockMoves(item, quantity, reservations = []) {
|
|
2003
|
+
const sign = Math.sign(quantity);
|
|
2004
|
+
const pool = (stockVariantId) => stockVariantId ? { stockVariantId: stockVariantId.toString() } : {};
|
|
2005
|
+
if (!item.components?.length)
|
|
2006
|
+
return [
|
|
2007
|
+
{
|
|
2008
|
+
productId: item.productId.toString(),
|
|
2009
|
+
variantId: item.variantId.toString(),
|
|
2010
|
+
fields: {
|
|
2011
|
+
quantity,
|
|
2012
|
+
...item.stockQuantity != null ? { stockQuantity: sign * item.stockQuantity, unitId: item.unitId?.toString() } : {},
|
|
2013
|
+
...pool(item.stockVariantId)
|
|
2014
|
+
}
|
|
2015
|
+
}
|
|
2016
|
+
];
|
|
2017
|
+
const booked = new Set(
|
|
2018
|
+
reservations.filter((reservation) => reservation.lineItemInternalId && reservation.lineItemInternalId === item.internalId).map((reservation) => reservation.componentIndex)
|
|
2019
|
+
);
|
|
2020
|
+
return item.components.flatMap((component, componentIndex) => {
|
|
2021
|
+
if (booked.has(componentIndex)) return [];
|
|
2022
|
+
if (component.unitId && component.stockQuantity == null)
|
|
2023
|
+
throw new Error(
|
|
2024
|
+
`Composite ${item.productId?.toString()} component ${component.variantId.toString()} is sold in ${component.unitId.toString()} but carries no stockQuantity`
|
|
2025
|
+
);
|
|
2026
|
+
return [
|
|
2027
|
+
{
|
|
2028
|
+
productId: component.productId.toString(),
|
|
2029
|
+
variantId: component.variantId.toString(),
|
|
2030
|
+
componentIndex,
|
|
2031
|
+
fields: {
|
|
2032
|
+
quantity: component.quantity * quantity,
|
|
2033
|
+
...component.stockQuantity != null ? { stockQuantity: component.stockQuantity * quantity, unitId: component.unitId?.toString() } : {},
|
|
2034
|
+
...pool(component.stockVariantId),
|
|
2035
|
+
...item.productId ? { compositeProductId: item.productId.toString() } : {},
|
|
2036
|
+
...item.name ? { compositeName: item.name } : {}
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2039
|
+
];
|
|
2040
|
+
});
|
|
2041
|
+
}
|
|
2042
|
+
|
|
1964
2043
|
// units/family-code.ts
|
|
1965
2044
|
var MAX_SLUG_LENGTH = 32;
|
|
1966
2045
|
var FALLBACK_SLUG = "family";
|
|
@@ -4179,6 +4258,13 @@ function tiersAreValid(option) {
|
|
|
4179
4258
|
return tiers.every((tier) => Number.isInteger(tier.from) && tier.from > 0 && isAmount(tier.price)) && new Set(froms).size === froms.length;
|
|
4180
4259
|
}
|
|
4181
4260
|
|
|
4261
|
+
// tax/registrations.ts
|
|
4262
|
+
var TAX_REGISTRATION_PLACES = {
|
|
4263
|
+
["GST_HST" /* GST_HST */]: ["CA"],
|
|
4264
|
+
["PST" /* PST */]: ["CA-BC", "CA-SK", "CA-MB"],
|
|
4265
|
+
["QST" /* QST */]: ["CA-QC"]
|
|
4266
|
+
};
|
|
4267
|
+
|
|
4182
4268
|
// constants/adyen.constants.ts
|
|
4183
4269
|
var ADYEN_ROLLOUT_COUNTRY_CODES = /* @__PURE__ */ new Set(["CA"]);
|
|
4184
4270
|
function isAdyenRolloutCountry(alpha2) {
|
|
@@ -4331,6 +4417,7 @@ var EXPENSE_DEFAULT_CATEGORIES = [
|
|
|
4331
4417
|
ORDER_STATE_TOPIC,
|
|
4332
4418
|
OrderPlatform,
|
|
4333
4419
|
OtherFixedRates,
|
|
4420
|
+
OutOfProvinceTaxes,
|
|
4334
4421
|
OwnerType,
|
|
4335
4422
|
PATH_MODES,
|
|
4336
4423
|
PAYMENT_CHANNELS,
|
|
@@ -4371,6 +4458,11 @@ var EXPENSE_DEFAULT_CATEGORIES = [
|
|
|
4371
4458
|
StationStatus,
|
|
4372
4459
|
StripeCurrencyCode,
|
|
4373
4460
|
StripeStatus,
|
|
4461
|
+
TAX_REGISTRATION_PLACES,
|
|
4462
|
+
TaxProductType,
|
|
4463
|
+
TaxRegistrationKind,
|
|
4464
|
+
TaxSource,
|
|
4465
|
+
TaxWarningCode,
|
|
4374
4466
|
TimePeriod,
|
|
4375
4467
|
TopMetericsSort,
|
|
4376
4468
|
UserTypes,
|
|
@@ -4454,6 +4546,7 @@ var EXPENSE_DEFAULT_CATEGORIES = [
|
|
|
4454
4546
|
isSystemFamilyCode,
|
|
4455
4547
|
isValidQuantity,
|
|
4456
4548
|
isWhole,
|
|
4549
|
+
lineStockMoves,
|
|
4457
4550
|
listCountries,
|
|
4458
4551
|
listProvinces,
|
|
4459
4552
|
mapToLegacyStatus,
|