@final-commerce/common 2.11.1-online.1 → 2.11.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 +154 -1
- package/dist/index.d.ts +154 -1
- package/dist/index.js +62 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +55 -0
- package/dist/index.mjs.map +1 -1
- package/dist/pos-types/index.d.mts +28 -0
- package/dist/pos-types/index.d.ts +28 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -967,6 +967,28 @@ interface MeasurementUnit {
|
|
|
967
967
|
sellable?: false;
|
|
968
968
|
}
|
|
969
969
|
|
|
970
|
+
declare enum TaxExceptionSource {
|
|
971
|
+
PRODUCT = "product",
|
|
972
|
+
CATEGORY = "category"
|
|
973
|
+
}
|
|
974
|
+
interface TaxException {
|
|
975
|
+
place: string;
|
|
976
|
+
skip: string[];
|
|
977
|
+
reason?: string;
|
|
978
|
+
setBy?: string;
|
|
979
|
+
setAt?: string;
|
|
980
|
+
}
|
|
981
|
+
interface OrderTaxSkip {
|
|
982
|
+
code: string;
|
|
983
|
+
name: string;
|
|
984
|
+
place: string;
|
|
985
|
+
source: TaxExceptionSource | `${TaxExceptionSource}`;
|
|
986
|
+
label: string;
|
|
987
|
+
categoryId?: string;
|
|
988
|
+
reason?: string;
|
|
989
|
+
}
|
|
990
|
+
declare const TAX_EXCEPTION_REASON_MAX = 200;
|
|
991
|
+
|
|
970
992
|
type CompositeItemUnavailable = 'deleted' | 'inactive' | 'hidden' | 'empty' | 'out_of_stock' | 'by_date' | 'fully_booked' | 'marked_sold_out';
|
|
971
993
|
|
|
972
994
|
interface CompositeShelf {
|
|
@@ -1981,6 +2003,137 @@ declare function registrationPlacesByKind(rates: readonly AutomaticTaxRateRow[])
|
|
|
1981
2003
|
|
|
1982
2004
|
declare function sha1Hex(text: string): string;
|
|
1983
2005
|
|
|
2006
|
+
interface CartAddress {
|
|
2007
|
+
firstName?: string;
|
|
2008
|
+
lastName?: string;
|
|
2009
|
+
address1?: string;
|
|
2010
|
+
address2?: string;
|
|
2011
|
+
city?: string;
|
|
2012
|
+
state?: string;
|
|
2013
|
+
postCode?: string;
|
|
2014
|
+
country?: string;
|
|
2015
|
+
fromCustomer?: boolean;
|
|
2016
|
+
}
|
|
2017
|
+
|
|
2018
|
+
type ShopperScope = {
|
|
2019
|
+
kind: 'all';
|
|
2020
|
+
} | {
|
|
2021
|
+
kind: 'store';
|
|
2022
|
+
companyId: string;
|
|
2023
|
+
};
|
|
2024
|
+
interface ShopperIdentity {
|
|
2025
|
+
id: string;
|
|
2026
|
+
emails: string[];
|
|
2027
|
+
scope: ShopperScope;
|
|
2028
|
+
}
|
|
2029
|
+
type ShopperOrderStatus = 'paid' | 'partially_refunded' | 'refunded' | 'cancelled';
|
|
2030
|
+
interface ShopperStoreRef {
|
|
2031
|
+
companyId: string;
|
|
2032
|
+
name: string;
|
|
2033
|
+
logo: string | null;
|
|
2034
|
+
}
|
|
2035
|
+
interface ShopperOrderRow {
|
|
2036
|
+
orderId: string;
|
|
2037
|
+
receiptId: string;
|
|
2038
|
+
placedAt: string;
|
|
2039
|
+
store: ShopperStoreRef;
|
|
2040
|
+
status: ShopperOrderStatus;
|
|
2041
|
+
total: number;
|
|
2042
|
+
currency: CurrencyCode | null;
|
|
2043
|
+
itemCount: number;
|
|
2044
|
+
}
|
|
2045
|
+
interface ShopperOrderItem {
|
|
2046
|
+
lineId: string;
|
|
2047
|
+
name: string;
|
|
2048
|
+
variant: string | null;
|
|
2049
|
+
quantity: number;
|
|
2050
|
+
total: number;
|
|
2051
|
+
}
|
|
2052
|
+
interface ShopperOrderTotals {
|
|
2053
|
+
subtotal: number;
|
|
2054
|
+
discount: number;
|
|
2055
|
+
tax: number;
|
|
2056
|
+
shipping: number;
|
|
2057
|
+
refunded: number;
|
|
2058
|
+
}
|
|
2059
|
+
interface ShopperCard {
|
|
2060
|
+
brand: string;
|
|
2061
|
+
lastFour: string;
|
|
2062
|
+
}
|
|
2063
|
+
interface ShopperOrderDetail extends ShopperOrderRow {
|
|
2064
|
+
items: ShopperOrderItem[];
|
|
2065
|
+
totals: ShopperOrderTotals;
|
|
2066
|
+
card: ShopperCard | null;
|
|
2067
|
+
delivery: {
|
|
2068
|
+
type: 'pickup' | 'shipping';
|
|
2069
|
+
place: string | null;
|
|
2070
|
+
} | null;
|
|
2071
|
+
returnRequestedAt: string | null;
|
|
2072
|
+
}
|
|
2073
|
+
interface ShopperPaymentMethod {
|
|
2074
|
+
id: string;
|
|
2075
|
+
brand: string;
|
|
2076
|
+
lastFour: string;
|
|
2077
|
+
expiryMonth: string;
|
|
2078
|
+
expiryYear: string;
|
|
2079
|
+
holderName: string | null;
|
|
2080
|
+
isDefault: boolean;
|
|
2081
|
+
}
|
|
2082
|
+
interface ShopperStore extends ShopperStoreRef {
|
|
2083
|
+
city: string | null;
|
|
2084
|
+
email: string | null;
|
|
2085
|
+
phone: string | null;
|
|
2086
|
+
website: string | null;
|
|
2087
|
+
returnPolicy: string | null;
|
|
2088
|
+
news: boolean;
|
|
2089
|
+
orderCount: number;
|
|
2090
|
+
}
|
|
2091
|
+
declare const SHOPPER_CONSENT_SOURCES: readonly ["checkout", "my-account", "store-account"];
|
|
2092
|
+
type ShopperConsentSource = (typeof SHOPPER_CONSENT_SOURCES)[number];
|
|
2093
|
+
interface ShopperSavedAddress extends Omit<CartAddress, 'fromCustomer'> {
|
|
2094
|
+
id: string;
|
|
2095
|
+
label: string | null;
|
|
2096
|
+
isDefault: boolean;
|
|
2097
|
+
}
|
|
2098
|
+
type ShopperAddressInput = Omit<ShopperSavedAddress, 'id' | 'isDefault'>;
|
|
2099
|
+
interface ShopperNotificationChoices {
|
|
2100
|
+
sms: boolean;
|
|
2101
|
+
push: boolean;
|
|
2102
|
+
}
|
|
2103
|
+
interface ShopperProfile {
|
|
2104
|
+
phone: string | null;
|
|
2105
|
+
addresses: ShopperSavedAddress[];
|
|
2106
|
+
defaultCardId: string | null;
|
|
2107
|
+
notifications: ShopperNotificationChoices;
|
|
2108
|
+
}
|
|
2109
|
+
declare const SHOPPER_RETURN_METHODS: readonly ["mail", "in-store"];
|
|
2110
|
+
type ShopperReturnMethod = (typeof SHOPPER_RETURN_METHODS)[number];
|
|
2111
|
+
interface ShopperReturnRequestInput {
|
|
2112
|
+
items: {
|
|
2113
|
+
lineId: string;
|
|
2114
|
+
quantity: number;
|
|
2115
|
+
}[];
|
|
2116
|
+
method: ShopperReturnMethod;
|
|
2117
|
+
note?: string;
|
|
2118
|
+
}
|
|
2119
|
+
declare const SHOPPER_ERROR_CODES: {
|
|
2120
|
+
readonly ORDER_NOT_FOUND: "ORDER_NOT_FOUND";
|
|
2121
|
+
readonly RETURN_ALREADY_REQUESTED: "RETURN_ALREADY_REQUESTED";
|
|
2122
|
+
readonly RETURN_NOT_ALLOWED: "RETURN_NOT_ALLOWED";
|
|
2123
|
+
readonly STORE_HAS_NO_SUPPORT_EMAIL: "STORE_HAS_NO_SUPPORT_EMAIL";
|
|
2124
|
+
readonly TOO_MANY_ADDRESSES: "TOO_MANY_ADDRESSES";
|
|
2125
|
+
readonly STORE_NOT_LINKED: "STORE_NOT_LINKED";
|
|
2126
|
+
readonly STORED_METHOD_NOT_FOUND: "STORED_METHOD_NOT_FOUND";
|
|
2127
|
+
};
|
|
2128
|
+
type ShopperErrorCode = (typeof SHOPPER_ERROR_CODES)[keyof typeof SHOPPER_ERROR_CODES];
|
|
2129
|
+
|
|
2130
|
+
declare function normalizeShopperEmail(email: unknown): string | null;
|
|
2131
|
+
|
|
2132
|
+
declare function cardFromProcessorData(processorData: unknown): {
|
|
2133
|
+
cardBrand?: string;
|
|
2134
|
+
cardLastFour?: string;
|
|
2135
|
+
};
|
|
2136
|
+
|
|
1984
2137
|
interface CurrencyRate {
|
|
1985
2138
|
rate: number;
|
|
1986
2139
|
country: string;
|
|
@@ -2049,4 +2202,4 @@ declare const EXPENSE_DEFAULT_CATEGORIES: readonly [{
|
|
|
2049
2202
|
}];
|
|
2050
2203
|
type ExpenseDefaultCategoryKey = (typeof EXPENSE_DEFAULT_CATEGORIES)[number]['key'];
|
|
2051
2204
|
|
|
2052
|
-
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, type AssignUserChange, AttributeType, type AutomaticTaxPart, type AutomaticTaxRateRow, type AutomaticTaxRowStatus, type AutomaticTaxRuleRow, type AutomaticTaxTable, type AutomaticTaxTypeRow, 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, HttpMethod, 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 OrderLikeForAssignedUsers, 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, ProductSalesChartStep, ProductSalesReportCompare, 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, SHIPPING_COUNTRIES, STANDARD_TAX_TYPE, STATE_SCHEMA, STRIPE_SUPPORTED_COUNTRIES, SYSTEM_FAMILIES, SYSTEM_FAMILY_IDS, SYSTEM_UNITS, SYSTEM_UNIT_IDS, SalesLineAction, SalesLineSourceArray, 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, type ShippingTuple, 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, type TaxBreakdown, type TaxBreakdownRateEntry, type TaxBreakdownSection, type TaxBreakdownSubtotal, 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, applyAssignment, assertUnitSane, automaticTaxTableVersion, availableIn, baseFor, baseFulfillmentDefinitions, baseOf, basePaymentDefinitions, buildAutomaticTaxTable, buildAvailability, buildGrid, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, canTransition, cheapestCompositeItem, cheapestCompositePrice, compositeItemCost, compositeItemUnavailable, compositeMakeable, compositeModifierMismatches, compositeReservationMismatches, compositeVariantInStock, conditionSummary, convertFixedFeeToLocalCurrency, createAmount, crossAxisRuleApplies, currentAssignees, 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, listShippingCountries, mapToLegacyStatus, maxPrecisionFor, mergeFragment, modifiersSellable, multiplyAmount, normalizeAddress, normalizeCityKey, normalizeCountry, normalizeMongoIdString, normalizePostCode, normalizeProvince, occupancyIn, orderAssignments, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, placeKey, planWindow, poolDemand, poolOf, poolShortfall, poolStockAt, postCodeMatchesProvince, presentAt, priceForTotal, provincesForPostCode, registrationPlacesByKind, removeFragment, resolveFamily, resolveModifiersForProduct, resolveShipping, resolveTemplate, resolveUnit, roundToPrecision, sameFamily, setOrderState, sha1Hex, shipsToCountry, shopDayKey, shopDayRange, signReportForDisplay, slotsForWindow, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, validateOrderStatuses, validateShippingZone, violatesFinancialInvariant, windowEndsAt, withinPresence };
|
|
2205
|
+
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, type AssignUserChange, AttributeType, type AutomaticTaxPart, type AutomaticTaxRateRow, type AutomaticTaxRowStatus, type AutomaticTaxRuleRow, type AutomaticTaxTable, type AutomaticTaxTypeRow, 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, HttpMethod, 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 OrderLikeForAssignedUsers, 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 OrderTaxSkip, 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, ProductSalesChartStep, ProductSalesReportCompare, 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, SHIPPING_COUNTRIES, SHOPPER_CONSENT_SOURCES, SHOPPER_ERROR_CODES, SHOPPER_RETURN_METHODS, STANDARD_TAX_TYPE, STATE_SCHEMA, STRIPE_SUPPORTED_COUNTRIES, SYSTEM_FAMILIES, SYSTEM_FAMILY_IDS, SYSTEM_UNITS, SYSTEM_UNIT_IDS, SalesLineAction, SalesLineSourceArray, 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, type ShippingTuple, ShippingZoneError, ShippingZoneKind, type ShippingZoneProblem, type ShippingZoneRule, type ShopperAddressInput, type ShopperCard, type ShopperConsentSource, type ShopperErrorCode, type ShopperIdentity, type ShopperNotificationChoices, type ShopperOrderDetail, type ShopperOrderItem, type ShopperOrderRow, type ShopperOrderStatus, type ShopperOrderTotals, type ShopperPaymentMethod, type ShopperProfile, type ShopperReturnMethod, type ShopperReturnRequestInput, type ShopperSavedAddress, type ShopperScope, type ShopperStore, type ShopperStoreRef, 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_EXCEPTION_REASON_MAX, type TaxBreakdown, type TaxBreakdownRateEntry, type TaxBreakdownSection, type TaxBreakdownSubtotal, type TaxException, TaxExceptionSource, 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, applyAssignment, assertUnitSane, automaticTaxTableVersion, availableIn, baseFor, baseFulfillmentDefinitions, baseOf, basePaymentDefinitions, buildAutomaticTaxTable, buildAvailability, buildGrid, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, canTransition, cardFromProcessorData, cheapestCompositeItem, cheapestCompositePrice, compositeItemCost, compositeItemUnavailable, compositeMakeable, compositeModifierMismatches, compositeReservationMismatches, compositeVariantInStock, conditionSummary, convertFixedFeeToLocalCurrency, createAmount, crossAxisRuleApplies, currentAssignees, 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, listShippingCountries, mapToLegacyStatus, maxPrecisionFor, mergeFragment, modifiersSellable, multiplyAmount, normalizeAddress, normalizeCityKey, normalizeCountry, normalizeMongoIdString, normalizePostCode, normalizeProvince, normalizeShopperEmail, occupancyIn, orderAssignments, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, placeKey, planWindow, poolDemand, poolOf, poolShortfall, poolStockAt, postCodeMatchesProvince, presentAt, priceForTotal, provincesForPostCode, registrationPlacesByKind, removeFragment, resolveFamily, resolveModifiersForProduct, resolveShipping, resolveTemplate, resolveUnit, roundToPrecision, sameFamily, setOrderState, sha1Hex, shipsToCountry, shopDayKey, shopDayRange, signReportForDisplay, slotsForWindow, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, validateOrderStatuses, validateShippingZone, violatesFinancialInvariant, windowEndsAt, withinPresence };
|
package/dist/index.d.ts
CHANGED
|
@@ -967,6 +967,28 @@ interface MeasurementUnit {
|
|
|
967
967
|
sellable?: false;
|
|
968
968
|
}
|
|
969
969
|
|
|
970
|
+
declare enum TaxExceptionSource {
|
|
971
|
+
PRODUCT = "product",
|
|
972
|
+
CATEGORY = "category"
|
|
973
|
+
}
|
|
974
|
+
interface TaxException {
|
|
975
|
+
place: string;
|
|
976
|
+
skip: string[];
|
|
977
|
+
reason?: string;
|
|
978
|
+
setBy?: string;
|
|
979
|
+
setAt?: string;
|
|
980
|
+
}
|
|
981
|
+
interface OrderTaxSkip {
|
|
982
|
+
code: string;
|
|
983
|
+
name: string;
|
|
984
|
+
place: string;
|
|
985
|
+
source: TaxExceptionSource | `${TaxExceptionSource}`;
|
|
986
|
+
label: string;
|
|
987
|
+
categoryId?: string;
|
|
988
|
+
reason?: string;
|
|
989
|
+
}
|
|
990
|
+
declare const TAX_EXCEPTION_REASON_MAX = 200;
|
|
991
|
+
|
|
970
992
|
type CompositeItemUnavailable = 'deleted' | 'inactive' | 'hidden' | 'empty' | 'out_of_stock' | 'by_date' | 'fully_booked' | 'marked_sold_out';
|
|
971
993
|
|
|
972
994
|
interface CompositeShelf {
|
|
@@ -1981,6 +2003,137 @@ declare function registrationPlacesByKind(rates: readonly AutomaticTaxRateRow[])
|
|
|
1981
2003
|
|
|
1982
2004
|
declare function sha1Hex(text: string): string;
|
|
1983
2005
|
|
|
2006
|
+
interface CartAddress {
|
|
2007
|
+
firstName?: string;
|
|
2008
|
+
lastName?: string;
|
|
2009
|
+
address1?: string;
|
|
2010
|
+
address2?: string;
|
|
2011
|
+
city?: string;
|
|
2012
|
+
state?: string;
|
|
2013
|
+
postCode?: string;
|
|
2014
|
+
country?: string;
|
|
2015
|
+
fromCustomer?: boolean;
|
|
2016
|
+
}
|
|
2017
|
+
|
|
2018
|
+
type ShopperScope = {
|
|
2019
|
+
kind: 'all';
|
|
2020
|
+
} | {
|
|
2021
|
+
kind: 'store';
|
|
2022
|
+
companyId: string;
|
|
2023
|
+
};
|
|
2024
|
+
interface ShopperIdentity {
|
|
2025
|
+
id: string;
|
|
2026
|
+
emails: string[];
|
|
2027
|
+
scope: ShopperScope;
|
|
2028
|
+
}
|
|
2029
|
+
type ShopperOrderStatus = 'paid' | 'partially_refunded' | 'refunded' | 'cancelled';
|
|
2030
|
+
interface ShopperStoreRef {
|
|
2031
|
+
companyId: string;
|
|
2032
|
+
name: string;
|
|
2033
|
+
logo: string | null;
|
|
2034
|
+
}
|
|
2035
|
+
interface ShopperOrderRow {
|
|
2036
|
+
orderId: string;
|
|
2037
|
+
receiptId: string;
|
|
2038
|
+
placedAt: string;
|
|
2039
|
+
store: ShopperStoreRef;
|
|
2040
|
+
status: ShopperOrderStatus;
|
|
2041
|
+
total: number;
|
|
2042
|
+
currency: CurrencyCode | null;
|
|
2043
|
+
itemCount: number;
|
|
2044
|
+
}
|
|
2045
|
+
interface ShopperOrderItem {
|
|
2046
|
+
lineId: string;
|
|
2047
|
+
name: string;
|
|
2048
|
+
variant: string | null;
|
|
2049
|
+
quantity: number;
|
|
2050
|
+
total: number;
|
|
2051
|
+
}
|
|
2052
|
+
interface ShopperOrderTotals {
|
|
2053
|
+
subtotal: number;
|
|
2054
|
+
discount: number;
|
|
2055
|
+
tax: number;
|
|
2056
|
+
shipping: number;
|
|
2057
|
+
refunded: number;
|
|
2058
|
+
}
|
|
2059
|
+
interface ShopperCard {
|
|
2060
|
+
brand: string;
|
|
2061
|
+
lastFour: string;
|
|
2062
|
+
}
|
|
2063
|
+
interface ShopperOrderDetail extends ShopperOrderRow {
|
|
2064
|
+
items: ShopperOrderItem[];
|
|
2065
|
+
totals: ShopperOrderTotals;
|
|
2066
|
+
card: ShopperCard | null;
|
|
2067
|
+
delivery: {
|
|
2068
|
+
type: 'pickup' | 'shipping';
|
|
2069
|
+
place: string | null;
|
|
2070
|
+
} | null;
|
|
2071
|
+
returnRequestedAt: string | null;
|
|
2072
|
+
}
|
|
2073
|
+
interface ShopperPaymentMethod {
|
|
2074
|
+
id: string;
|
|
2075
|
+
brand: string;
|
|
2076
|
+
lastFour: string;
|
|
2077
|
+
expiryMonth: string;
|
|
2078
|
+
expiryYear: string;
|
|
2079
|
+
holderName: string | null;
|
|
2080
|
+
isDefault: boolean;
|
|
2081
|
+
}
|
|
2082
|
+
interface ShopperStore extends ShopperStoreRef {
|
|
2083
|
+
city: string | null;
|
|
2084
|
+
email: string | null;
|
|
2085
|
+
phone: string | null;
|
|
2086
|
+
website: string | null;
|
|
2087
|
+
returnPolicy: string | null;
|
|
2088
|
+
news: boolean;
|
|
2089
|
+
orderCount: number;
|
|
2090
|
+
}
|
|
2091
|
+
declare const SHOPPER_CONSENT_SOURCES: readonly ["checkout", "my-account", "store-account"];
|
|
2092
|
+
type ShopperConsentSource = (typeof SHOPPER_CONSENT_SOURCES)[number];
|
|
2093
|
+
interface ShopperSavedAddress extends Omit<CartAddress, 'fromCustomer'> {
|
|
2094
|
+
id: string;
|
|
2095
|
+
label: string | null;
|
|
2096
|
+
isDefault: boolean;
|
|
2097
|
+
}
|
|
2098
|
+
type ShopperAddressInput = Omit<ShopperSavedAddress, 'id' | 'isDefault'>;
|
|
2099
|
+
interface ShopperNotificationChoices {
|
|
2100
|
+
sms: boolean;
|
|
2101
|
+
push: boolean;
|
|
2102
|
+
}
|
|
2103
|
+
interface ShopperProfile {
|
|
2104
|
+
phone: string | null;
|
|
2105
|
+
addresses: ShopperSavedAddress[];
|
|
2106
|
+
defaultCardId: string | null;
|
|
2107
|
+
notifications: ShopperNotificationChoices;
|
|
2108
|
+
}
|
|
2109
|
+
declare const SHOPPER_RETURN_METHODS: readonly ["mail", "in-store"];
|
|
2110
|
+
type ShopperReturnMethod = (typeof SHOPPER_RETURN_METHODS)[number];
|
|
2111
|
+
interface ShopperReturnRequestInput {
|
|
2112
|
+
items: {
|
|
2113
|
+
lineId: string;
|
|
2114
|
+
quantity: number;
|
|
2115
|
+
}[];
|
|
2116
|
+
method: ShopperReturnMethod;
|
|
2117
|
+
note?: string;
|
|
2118
|
+
}
|
|
2119
|
+
declare const SHOPPER_ERROR_CODES: {
|
|
2120
|
+
readonly ORDER_NOT_FOUND: "ORDER_NOT_FOUND";
|
|
2121
|
+
readonly RETURN_ALREADY_REQUESTED: "RETURN_ALREADY_REQUESTED";
|
|
2122
|
+
readonly RETURN_NOT_ALLOWED: "RETURN_NOT_ALLOWED";
|
|
2123
|
+
readonly STORE_HAS_NO_SUPPORT_EMAIL: "STORE_HAS_NO_SUPPORT_EMAIL";
|
|
2124
|
+
readonly TOO_MANY_ADDRESSES: "TOO_MANY_ADDRESSES";
|
|
2125
|
+
readonly STORE_NOT_LINKED: "STORE_NOT_LINKED";
|
|
2126
|
+
readonly STORED_METHOD_NOT_FOUND: "STORED_METHOD_NOT_FOUND";
|
|
2127
|
+
};
|
|
2128
|
+
type ShopperErrorCode = (typeof SHOPPER_ERROR_CODES)[keyof typeof SHOPPER_ERROR_CODES];
|
|
2129
|
+
|
|
2130
|
+
declare function normalizeShopperEmail(email: unknown): string | null;
|
|
2131
|
+
|
|
2132
|
+
declare function cardFromProcessorData(processorData: unknown): {
|
|
2133
|
+
cardBrand?: string;
|
|
2134
|
+
cardLastFour?: string;
|
|
2135
|
+
};
|
|
2136
|
+
|
|
1984
2137
|
interface CurrencyRate {
|
|
1985
2138
|
rate: number;
|
|
1986
2139
|
country: string;
|
|
@@ -2049,4 +2202,4 @@ declare const EXPENSE_DEFAULT_CATEGORIES: readonly [{
|
|
|
2049
2202
|
}];
|
|
2050
2203
|
type ExpenseDefaultCategoryKey = (typeof EXPENSE_DEFAULT_CATEGORIES)[number]['key'];
|
|
2051
2204
|
|
|
2052
|
-
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, type AssignUserChange, AttributeType, type AutomaticTaxPart, type AutomaticTaxRateRow, type AutomaticTaxRowStatus, type AutomaticTaxRuleRow, type AutomaticTaxTable, type AutomaticTaxTypeRow, 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, HttpMethod, 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 OrderLikeForAssignedUsers, 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, ProductSalesChartStep, ProductSalesReportCompare, 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, SHIPPING_COUNTRIES, STANDARD_TAX_TYPE, STATE_SCHEMA, STRIPE_SUPPORTED_COUNTRIES, SYSTEM_FAMILIES, SYSTEM_FAMILY_IDS, SYSTEM_UNITS, SYSTEM_UNIT_IDS, SalesLineAction, SalesLineSourceArray, 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, type ShippingTuple, 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, type TaxBreakdown, type TaxBreakdownRateEntry, type TaxBreakdownSection, type TaxBreakdownSubtotal, 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, applyAssignment, assertUnitSane, automaticTaxTableVersion, availableIn, baseFor, baseFulfillmentDefinitions, baseOf, basePaymentDefinitions, buildAutomaticTaxTable, buildAvailability, buildGrid, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, canTransition, cheapestCompositeItem, cheapestCompositePrice, compositeItemCost, compositeItemUnavailable, compositeMakeable, compositeModifierMismatches, compositeReservationMismatches, compositeVariantInStock, conditionSummary, convertFixedFeeToLocalCurrency, createAmount, crossAxisRuleApplies, currentAssignees, 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, listShippingCountries, mapToLegacyStatus, maxPrecisionFor, mergeFragment, modifiersSellable, multiplyAmount, normalizeAddress, normalizeCityKey, normalizeCountry, normalizeMongoIdString, normalizePostCode, normalizeProvince, occupancyIn, orderAssignments, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, placeKey, planWindow, poolDemand, poolOf, poolShortfall, poolStockAt, postCodeMatchesProvince, presentAt, priceForTotal, provincesForPostCode, registrationPlacesByKind, removeFragment, resolveFamily, resolveModifiersForProduct, resolveShipping, resolveTemplate, resolveUnit, roundToPrecision, sameFamily, setOrderState, sha1Hex, shipsToCountry, shopDayKey, shopDayRange, signReportForDisplay, slotsForWindow, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, validateOrderStatuses, validateShippingZone, violatesFinancialInvariant, windowEndsAt, withinPresence };
|
|
2205
|
+
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, type AssignUserChange, AttributeType, type AutomaticTaxPart, type AutomaticTaxRateRow, type AutomaticTaxRowStatus, type AutomaticTaxRuleRow, type AutomaticTaxTable, type AutomaticTaxTypeRow, 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, HttpMethod, 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 OrderLikeForAssignedUsers, 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 OrderTaxSkip, 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, ProductSalesChartStep, ProductSalesReportCompare, 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, SHIPPING_COUNTRIES, SHOPPER_CONSENT_SOURCES, SHOPPER_ERROR_CODES, SHOPPER_RETURN_METHODS, STANDARD_TAX_TYPE, STATE_SCHEMA, STRIPE_SUPPORTED_COUNTRIES, SYSTEM_FAMILIES, SYSTEM_FAMILY_IDS, SYSTEM_UNITS, SYSTEM_UNIT_IDS, SalesLineAction, SalesLineSourceArray, 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, type ShippingTuple, ShippingZoneError, ShippingZoneKind, type ShippingZoneProblem, type ShippingZoneRule, type ShopperAddressInput, type ShopperCard, type ShopperConsentSource, type ShopperErrorCode, type ShopperIdentity, type ShopperNotificationChoices, type ShopperOrderDetail, type ShopperOrderItem, type ShopperOrderRow, type ShopperOrderStatus, type ShopperOrderTotals, type ShopperPaymentMethod, type ShopperProfile, type ShopperReturnMethod, type ShopperReturnRequestInput, type ShopperSavedAddress, type ShopperScope, type ShopperStore, type ShopperStoreRef, 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_EXCEPTION_REASON_MAX, type TaxBreakdown, type TaxBreakdownRateEntry, type TaxBreakdownSection, type TaxBreakdownSubtotal, type TaxException, TaxExceptionSource, 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, applyAssignment, assertUnitSane, automaticTaxTableVersion, availableIn, baseFor, baseFulfillmentDefinitions, baseOf, basePaymentDefinitions, buildAutomaticTaxTable, buildAvailability, buildGrid, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, canTransition, cardFromProcessorData, cheapestCompositeItem, cheapestCompositePrice, compositeItemCost, compositeItemUnavailable, compositeMakeable, compositeModifierMismatches, compositeReservationMismatches, compositeVariantInStock, conditionSummary, convertFixedFeeToLocalCurrency, createAmount, crossAxisRuleApplies, currentAssignees, 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, listShippingCountries, mapToLegacyStatus, maxPrecisionFor, mergeFragment, modifiersSellable, multiplyAmount, normalizeAddress, normalizeCityKey, normalizeCountry, normalizeMongoIdString, normalizePostCode, normalizeProvince, normalizeShopperEmail, occupancyIn, orderAssignments, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, placeKey, planWindow, poolDemand, poolOf, poolShortfall, poolStockAt, postCodeMatchesProvince, presentAt, priceForTotal, provincesForPostCode, registrationPlacesByKind, removeFragment, resolveFamily, resolveModifiersForProduct, resolveShipping, resolveTemplate, resolveUnit, roundToPrecision, sameFamily, setOrderState, sha1Hex, shipsToCountry, shopDayKey, shopDayRange, signReportForDisplay, slotsForWindow, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, validateOrderStatuses, validateShippingZone, violatesFinancialInvariant, windowEndsAt, withinPresence };
|
package/dist/index.js
CHANGED
|
@@ -106,6 +106,9 @@ __export(index_exports, {
|
|
|
106
106
|
ResidualStatus: () => ResidualStatus,
|
|
107
107
|
ResourceAvailabilityState: () => ResourceAvailabilityState,
|
|
108
108
|
SHIPPING_COUNTRIES: () => SHIPPING_COUNTRIES,
|
|
109
|
+
SHOPPER_CONSENT_SOURCES: () => SHOPPER_CONSENT_SOURCES,
|
|
110
|
+
SHOPPER_ERROR_CODES: () => SHOPPER_ERROR_CODES,
|
|
111
|
+
SHOPPER_RETURN_METHODS: () => SHOPPER_RETURN_METHODS,
|
|
109
112
|
STANDARD_TAX_TYPE: () => STANDARD_TAX_TYPE,
|
|
110
113
|
STATE_SCHEMA: () => STATE_SCHEMA,
|
|
111
114
|
STRIPE_SUPPORTED_COUNTRIES: () => STRIPE_SUPPORTED_COUNTRIES,
|
|
@@ -124,6 +127,8 @@ __export(index_exports, {
|
|
|
124
127
|
StationStatus: () => StationStatus,
|
|
125
128
|
StripeCurrencyCode: () => StripeCurrencyCode,
|
|
126
129
|
StripeStatus: () => StripeStatus,
|
|
130
|
+
TAX_EXCEPTION_REASON_MAX: () => TAX_EXCEPTION_REASON_MAX,
|
|
131
|
+
TaxExceptionSource: () => TaxExceptionSource,
|
|
127
132
|
TaxRegistrationKind: () => TaxRegistrationKind,
|
|
128
133
|
TaxSource: () => TaxSource,
|
|
129
134
|
TaxWarningCode: () => TaxWarningCode,
|
|
@@ -155,6 +160,7 @@ __export(index_exports, {
|
|
|
155
160
|
buildResolvedConfig: () => buildResolvedConfig,
|
|
156
161
|
calculatePercentage: () => calculatePercentage,
|
|
157
162
|
canTransition: () => canTransition,
|
|
163
|
+
cardFromProcessorData: () => cardFromProcessorData,
|
|
158
164
|
cheapestCompositeItem: () => cheapestCompositeItem,
|
|
159
165
|
cheapestCompositePrice: () => cheapestCompositePrice,
|
|
160
166
|
compositeItemCost: () => compositeItemCost,
|
|
@@ -229,6 +235,7 @@ __export(index_exports, {
|
|
|
229
235
|
normalizeMongoIdString: () => normalizeMongoIdString,
|
|
230
236
|
normalizePostCode: () => normalizePostCode,
|
|
231
237
|
normalizeProvince: () => normalizeProvince,
|
|
238
|
+
normalizeShopperEmail: () => normalizeShopperEmail,
|
|
232
239
|
occupancyIn: () => occupancyIn,
|
|
233
240
|
orderAssignments: () => orderAssignments,
|
|
234
241
|
parseAmountToMinorUnits: () => parseAmountToMinorUnits,
|
|
@@ -4486,6 +4493,54 @@ function registrationPlacesByKind(rates) {
|
|
|
4486
4493
|
return places;
|
|
4487
4494
|
}
|
|
4488
4495
|
|
|
4496
|
+
// tax/exceptions.ts
|
|
4497
|
+
var TaxExceptionSource = /* @__PURE__ */ ((TaxExceptionSource2) => {
|
|
4498
|
+
TaxExceptionSource2["PRODUCT"] = "product";
|
|
4499
|
+
TaxExceptionSource2["CATEGORY"] = "category";
|
|
4500
|
+
return TaxExceptionSource2;
|
|
4501
|
+
})(TaxExceptionSource || {});
|
|
4502
|
+
var TAX_EXCEPTION_REASON_MAX = 200;
|
|
4503
|
+
|
|
4504
|
+
// shopper/types.ts
|
|
4505
|
+
var SHOPPER_CONSENT_SOURCES = ["checkout", "my-account", "store-account"];
|
|
4506
|
+
var SHOPPER_RETURN_METHODS = ["mail", "in-store"];
|
|
4507
|
+
var SHOPPER_ERROR_CODES = {
|
|
4508
|
+
ORDER_NOT_FOUND: "ORDER_NOT_FOUND",
|
|
4509
|
+
RETURN_ALREADY_REQUESTED: "RETURN_ALREADY_REQUESTED",
|
|
4510
|
+
RETURN_NOT_ALLOWED: "RETURN_NOT_ALLOWED",
|
|
4511
|
+
STORE_HAS_NO_SUPPORT_EMAIL: "STORE_HAS_NO_SUPPORT_EMAIL",
|
|
4512
|
+
TOO_MANY_ADDRESSES: "TOO_MANY_ADDRESSES",
|
|
4513
|
+
STORE_NOT_LINKED: "STORE_NOT_LINKED",
|
|
4514
|
+
STORED_METHOD_NOT_FOUND: "STORED_METHOD_NOT_FOUND"
|
|
4515
|
+
};
|
|
4516
|
+
|
|
4517
|
+
// shopper/email.ts
|
|
4518
|
+
function normalizeShopperEmail(email) {
|
|
4519
|
+
if (typeof email !== "string") return null;
|
|
4520
|
+
const value = email.trim().toLowerCase();
|
|
4521
|
+
return /^[^\s@]+@[^\s@]+$/.test(value) ? value : null;
|
|
4522
|
+
}
|
|
4523
|
+
|
|
4524
|
+
// shopper/card.ts
|
|
4525
|
+
function cardFromProcessorData(processorData) {
|
|
4526
|
+
if (typeof processorData !== "string" || !processorData) return {};
|
|
4527
|
+
let data;
|
|
4528
|
+
try {
|
|
4529
|
+
data = JSON.parse(processorData);
|
|
4530
|
+
} catch {
|
|
4531
|
+
return {};
|
|
4532
|
+
}
|
|
4533
|
+
if (!data || typeof data !== "object") return {};
|
|
4534
|
+
const fields = new Map(Object.entries(data));
|
|
4535
|
+
const text = (...keys) => keys.map((key) => fields.get(key)).find((value) => typeof value === "string" && !!value.trim());
|
|
4536
|
+
const brand = text("Brand", "brand")?.trim();
|
|
4537
|
+
const digits = text("Card Number", "card", "card_number")?.replace(/\D/g, "");
|
|
4538
|
+
return {
|
|
4539
|
+
...brand ? { cardBrand: brand.charAt(0).toUpperCase() + brand.slice(1) } : {},
|
|
4540
|
+
...digits && digits.length >= 4 ? { cardLastFour: digits.slice(-4) } : {}
|
|
4541
|
+
};
|
|
4542
|
+
}
|
|
4543
|
+
|
|
4489
4544
|
// constants/adyen.constants.ts
|
|
4490
4545
|
var ADYEN_ROLLOUT_COUNTRY_CODES = /* @__PURE__ */ new Set(["CA"]);
|
|
4491
4546
|
function isAdyenRolloutCountry(alpha2) {
|
|
@@ -4668,6 +4723,9 @@ var EXPENSE_DEFAULT_CATEGORIES = [
|
|
|
4668
4723
|
ResidualStatus,
|
|
4669
4724
|
ResourceAvailabilityState,
|
|
4670
4725
|
SHIPPING_COUNTRIES,
|
|
4726
|
+
SHOPPER_CONSENT_SOURCES,
|
|
4727
|
+
SHOPPER_ERROR_CODES,
|
|
4728
|
+
SHOPPER_RETURN_METHODS,
|
|
4671
4729
|
STANDARD_TAX_TYPE,
|
|
4672
4730
|
STATE_SCHEMA,
|
|
4673
4731
|
STRIPE_SUPPORTED_COUNTRIES,
|
|
@@ -4686,6 +4744,8 @@ var EXPENSE_DEFAULT_CATEGORIES = [
|
|
|
4686
4744
|
StationStatus,
|
|
4687
4745
|
StripeCurrencyCode,
|
|
4688
4746
|
StripeStatus,
|
|
4747
|
+
TAX_EXCEPTION_REASON_MAX,
|
|
4748
|
+
TaxExceptionSource,
|
|
4689
4749
|
TaxRegistrationKind,
|
|
4690
4750
|
TaxSource,
|
|
4691
4751
|
TaxWarningCode,
|
|
@@ -4717,6 +4777,7 @@ var EXPENSE_DEFAULT_CATEGORIES = [
|
|
|
4717
4777
|
buildResolvedConfig,
|
|
4718
4778
|
calculatePercentage,
|
|
4719
4779
|
canTransition,
|
|
4780
|
+
cardFromProcessorData,
|
|
4720
4781
|
cheapestCompositeItem,
|
|
4721
4782
|
cheapestCompositePrice,
|
|
4722
4783
|
compositeItemCost,
|
|
@@ -4791,6 +4852,7 @@ var EXPENSE_DEFAULT_CATEGORIES = [
|
|
|
4791
4852
|
normalizeMongoIdString,
|
|
4792
4853
|
normalizePostCode,
|
|
4793
4854
|
normalizeProvince,
|
|
4855
|
+
normalizeShopperEmail,
|
|
4794
4856
|
occupancyIn,
|
|
4795
4857
|
orderAssignments,
|
|
4796
4858
|
parseAmountToMinorUnits,
|