@final-commerce/common 2.11.1-online.1 → 2.11.1-online.2
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 +132 -1
- package/dist/index.d.ts +132 -1
- package/dist/index.js +50 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +45 -0
- package/dist/index.mjs.map +1 -1
- package/dist/pos-types/index.d.mts +1 -0
- package/dist/pos-types/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1981,6 +1981,137 @@ declare function registrationPlacesByKind(rates: readonly AutomaticTaxRateRow[])
|
|
|
1981
1981
|
|
|
1982
1982
|
declare function sha1Hex(text: string): string;
|
|
1983
1983
|
|
|
1984
|
+
interface CartAddress {
|
|
1985
|
+
firstName?: string;
|
|
1986
|
+
lastName?: string;
|
|
1987
|
+
address1?: string;
|
|
1988
|
+
address2?: string;
|
|
1989
|
+
city?: string;
|
|
1990
|
+
state?: string;
|
|
1991
|
+
postCode?: string;
|
|
1992
|
+
country?: string;
|
|
1993
|
+
fromCustomer?: boolean;
|
|
1994
|
+
}
|
|
1995
|
+
|
|
1996
|
+
type ShopperScope = {
|
|
1997
|
+
kind: 'all';
|
|
1998
|
+
} | {
|
|
1999
|
+
kind: 'store';
|
|
2000
|
+
companyId: string;
|
|
2001
|
+
};
|
|
2002
|
+
interface ShopperIdentity {
|
|
2003
|
+
id: string;
|
|
2004
|
+
emails: string[];
|
|
2005
|
+
scope: ShopperScope;
|
|
2006
|
+
}
|
|
2007
|
+
type ShopperOrderStatus = 'paid' | 'partially_refunded' | 'refunded' | 'cancelled';
|
|
2008
|
+
interface ShopperStoreRef {
|
|
2009
|
+
companyId: string;
|
|
2010
|
+
name: string;
|
|
2011
|
+
logo: string | null;
|
|
2012
|
+
}
|
|
2013
|
+
interface ShopperOrderRow {
|
|
2014
|
+
orderId: string;
|
|
2015
|
+
receiptId: string;
|
|
2016
|
+
placedAt: string;
|
|
2017
|
+
store: ShopperStoreRef;
|
|
2018
|
+
status: ShopperOrderStatus;
|
|
2019
|
+
total: number;
|
|
2020
|
+
currency: CurrencyCode | null;
|
|
2021
|
+
itemCount: number;
|
|
2022
|
+
}
|
|
2023
|
+
interface ShopperOrderItem {
|
|
2024
|
+
lineId: string;
|
|
2025
|
+
name: string;
|
|
2026
|
+
variant: string | null;
|
|
2027
|
+
quantity: number;
|
|
2028
|
+
total: number;
|
|
2029
|
+
}
|
|
2030
|
+
interface ShopperOrderTotals {
|
|
2031
|
+
subtotal: number;
|
|
2032
|
+
discount: number;
|
|
2033
|
+
tax: number;
|
|
2034
|
+
shipping: number;
|
|
2035
|
+
refunded: number;
|
|
2036
|
+
}
|
|
2037
|
+
interface ShopperCard {
|
|
2038
|
+
brand: string;
|
|
2039
|
+
lastFour: string;
|
|
2040
|
+
}
|
|
2041
|
+
interface ShopperOrderDetail extends ShopperOrderRow {
|
|
2042
|
+
items: ShopperOrderItem[];
|
|
2043
|
+
totals: ShopperOrderTotals;
|
|
2044
|
+
card: ShopperCard | null;
|
|
2045
|
+
delivery: {
|
|
2046
|
+
type: 'pickup' | 'shipping';
|
|
2047
|
+
place: string | null;
|
|
2048
|
+
} | null;
|
|
2049
|
+
returnRequestedAt: string | null;
|
|
2050
|
+
}
|
|
2051
|
+
interface ShopperPaymentMethod {
|
|
2052
|
+
id: string;
|
|
2053
|
+
brand: string;
|
|
2054
|
+
lastFour: string;
|
|
2055
|
+
expiryMonth: string;
|
|
2056
|
+
expiryYear: string;
|
|
2057
|
+
holderName: string | null;
|
|
2058
|
+
isDefault: boolean;
|
|
2059
|
+
}
|
|
2060
|
+
interface ShopperStore extends ShopperStoreRef {
|
|
2061
|
+
city: string | null;
|
|
2062
|
+
email: string | null;
|
|
2063
|
+
phone: string | null;
|
|
2064
|
+
website: string | null;
|
|
2065
|
+
returnPolicy: string | null;
|
|
2066
|
+
news: boolean;
|
|
2067
|
+
orderCount: number;
|
|
2068
|
+
}
|
|
2069
|
+
declare const SHOPPER_CONSENT_SOURCES: readonly ["checkout", "my-account", "store-account"];
|
|
2070
|
+
type ShopperConsentSource = (typeof SHOPPER_CONSENT_SOURCES)[number];
|
|
2071
|
+
interface ShopperSavedAddress extends Omit<CartAddress, 'fromCustomer'> {
|
|
2072
|
+
id: string;
|
|
2073
|
+
label: string | null;
|
|
2074
|
+
isDefault: boolean;
|
|
2075
|
+
}
|
|
2076
|
+
type ShopperAddressInput = Omit<ShopperSavedAddress, 'id' | 'isDefault'>;
|
|
2077
|
+
interface ShopperNotificationChoices {
|
|
2078
|
+
sms: boolean;
|
|
2079
|
+
push: boolean;
|
|
2080
|
+
}
|
|
2081
|
+
interface ShopperProfile {
|
|
2082
|
+
phone: string | null;
|
|
2083
|
+
addresses: ShopperSavedAddress[];
|
|
2084
|
+
defaultCardId: string | null;
|
|
2085
|
+
notifications: ShopperNotificationChoices;
|
|
2086
|
+
}
|
|
2087
|
+
declare const SHOPPER_RETURN_METHODS: readonly ["mail", "in-store"];
|
|
2088
|
+
type ShopperReturnMethod = (typeof SHOPPER_RETURN_METHODS)[number];
|
|
2089
|
+
interface ShopperReturnRequestInput {
|
|
2090
|
+
items: {
|
|
2091
|
+
lineId: string;
|
|
2092
|
+
quantity: number;
|
|
2093
|
+
}[];
|
|
2094
|
+
method: ShopperReturnMethod;
|
|
2095
|
+
note?: string;
|
|
2096
|
+
}
|
|
2097
|
+
declare const SHOPPER_ERROR_CODES: {
|
|
2098
|
+
readonly ORDER_NOT_FOUND: "ORDER_NOT_FOUND";
|
|
2099
|
+
readonly RETURN_ALREADY_REQUESTED: "RETURN_ALREADY_REQUESTED";
|
|
2100
|
+
readonly RETURN_NOT_ALLOWED: "RETURN_NOT_ALLOWED";
|
|
2101
|
+
readonly STORE_HAS_NO_SUPPORT_EMAIL: "STORE_HAS_NO_SUPPORT_EMAIL";
|
|
2102
|
+
readonly TOO_MANY_ADDRESSES: "TOO_MANY_ADDRESSES";
|
|
2103
|
+
readonly STORE_NOT_LINKED: "STORE_NOT_LINKED";
|
|
2104
|
+
readonly STORED_METHOD_NOT_FOUND: "STORED_METHOD_NOT_FOUND";
|
|
2105
|
+
};
|
|
2106
|
+
type ShopperErrorCode = (typeof SHOPPER_ERROR_CODES)[keyof typeof SHOPPER_ERROR_CODES];
|
|
2107
|
+
|
|
2108
|
+
declare function normalizeShopperEmail(email: unknown): string | null;
|
|
2109
|
+
|
|
2110
|
+
declare function cardFromProcessorData(processorData: unknown): {
|
|
2111
|
+
cardBrand?: string;
|
|
2112
|
+
cardLastFour?: string;
|
|
2113
|
+
};
|
|
2114
|
+
|
|
1984
2115
|
interface CurrencyRate {
|
|
1985
2116
|
rate: number;
|
|
1986
2117
|
country: string;
|
|
@@ -2049,4 +2180,4 @@ declare const EXPENSE_DEFAULT_CATEGORIES: readonly [{
|
|
|
2049
2180
|
}];
|
|
2050
2181
|
type ExpenseDefaultCategoryKey = (typeof EXPENSE_DEFAULT_CATEGORIES)[number]['key'];
|
|
2051
2182
|
|
|
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 };
|
|
2183
|
+
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, 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, 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, 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
|
@@ -1981,6 +1981,137 @@ declare function registrationPlacesByKind(rates: readonly AutomaticTaxRateRow[])
|
|
|
1981
1981
|
|
|
1982
1982
|
declare function sha1Hex(text: string): string;
|
|
1983
1983
|
|
|
1984
|
+
interface CartAddress {
|
|
1985
|
+
firstName?: string;
|
|
1986
|
+
lastName?: string;
|
|
1987
|
+
address1?: string;
|
|
1988
|
+
address2?: string;
|
|
1989
|
+
city?: string;
|
|
1990
|
+
state?: string;
|
|
1991
|
+
postCode?: string;
|
|
1992
|
+
country?: string;
|
|
1993
|
+
fromCustomer?: boolean;
|
|
1994
|
+
}
|
|
1995
|
+
|
|
1996
|
+
type ShopperScope = {
|
|
1997
|
+
kind: 'all';
|
|
1998
|
+
} | {
|
|
1999
|
+
kind: 'store';
|
|
2000
|
+
companyId: string;
|
|
2001
|
+
};
|
|
2002
|
+
interface ShopperIdentity {
|
|
2003
|
+
id: string;
|
|
2004
|
+
emails: string[];
|
|
2005
|
+
scope: ShopperScope;
|
|
2006
|
+
}
|
|
2007
|
+
type ShopperOrderStatus = 'paid' | 'partially_refunded' | 'refunded' | 'cancelled';
|
|
2008
|
+
interface ShopperStoreRef {
|
|
2009
|
+
companyId: string;
|
|
2010
|
+
name: string;
|
|
2011
|
+
logo: string | null;
|
|
2012
|
+
}
|
|
2013
|
+
interface ShopperOrderRow {
|
|
2014
|
+
orderId: string;
|
|
2015
|
+
receiptId: string;
|
|
2016
|
+
placedAt: string;
|
|
2017
|
+
store: ShopperStoreRef;
|
|
2018
|
+
status: ShopperOrderStatus;
|
|
2019
|
+
total: number;
|
|
2020
|
+
currency: CurrencyCode | null;
|
|
2021
|
+
itemCount: number;
|
|
2022
|
+
}
|
|
2023
|
+
interface ShopperOrderItem {
|
|
2024
|
+
lineId: string;
|
|
2025
|
+
name: string;
|
|
2026
|
+
variant: string | null;
|
|
2027
|
+
quantity: number;
|
|
2028
|
+
total: number;
|
|
2029
|
+
}
|
|
2030
|
+
interface ShopperOrderTotals {
|
|
2031
|
+
subtotal: number;
|
|
2032
|
+
discount: number;
|
|
2033
|
+
tax: number;
|
|
2034
|
+
shipping: number;
|
|
2035
|
+
refunded: number;
|
|
2036
|
+
}
|
|
2037
|
+
interface ShopperCard {
|
|
2038
|
+
brand: string;
|
|
2039
|
+
lastFour: string;
|
|
2040
|
+
}
|
|
2041
|
+
interface ShopperOrderDetail extends ShopperOrderRow {
|
|
2042
|
+
items: ShopperOrderItem[];
|
|
2043
|
+
totals: ShopperOrderTotals;
|
|
2044
|
+
card: ShopperCard | null;
|
|
2045
|
+
delivery: {
|
|
2046
|
+
type: 'pickup' | 'shipping';
|
|
2047
|
+
place: string | null;
|
|
2048
|
+
} | null;
|
|
2049
|
+
returnRequestedAt: string | null;
|
|
2050
|
+
}
|
|
2051
|
+
interface ShopperPaymentMethod {
|
|
2052
|
+
id: string;
|
|
2053
|
+
brand: string;
|
|
2054
|
+
lastFour: string;
|
|
2055
|
+
expiryMonth: string;
|
|
2056
|
+
expiryYear: string;
|
|
2057
|
+
holderName: string | null;
|
|
2058
|
+
isDefault: boolean;
|
|
2059
|
+
}
|
|
2060
|
+
interface ShopperStore extends ShopperStoreRef {
|
|
2061
|
+
city: string | null;
|
|
2062
|
+
email: string | null;
|
|
2063
|
+
phone: string | null;
|
|
2064
|
+
website: string | null;
|
|
2065
|
+
returnPolicy: string | null;
|
|
2066
|
+
news: boolean;
|
|
2067
|
+
orderCount: number;
|
|
2068
|
+
}
|
|
2069
|
+
declare const SHOPPER_CONSENT_SOURCES: readonly ["checkout", "my-account", "store-account"];
|
|
2070
|
+
type ShopperConsentSource = (typeof SHOPPER_CONSENT_SOURCES)[number];
|
|
2071
|
+
interface ShopperSavedAddress extends Omit<CartAddress, 'fromCustomer'> {
|
|
2072
|
+
id: string;
|
|
2073
|
+
label: string | null;
|
|
2074
|
+
isDefault: boolean;
|
|
2075
|
+
}
|
|
2076
|
+
type ShopperAddressInput = Omit<ShopperSavedAddress, 'id' | 'isDefault'>;
|
|
2077
|
+
interface ShopperNotificationChoices {
|
|
2078
|
+
sms: boolean;
|
|
2079
|
+
push: boolean;
|
|
2080
|
+
}
|
|
2081
|
+
interface ShopperProfile {
|
|
2082
|
+
phone: string | null;
|
|
2083
|
+
addresses: ShopperSavedAddress[];
|
|
2084
|
+
defaultCardId: string | null;
|
|
2085
|
+
notifications: ShopperNotificationChoices;
|
|
2086
|
+
}
|
|
2087
|
+
declare const SHOPPER_RETURN_METHODS: readonly ["mail", "in-store"];
|
|
2088
|
+
type ShopperReturnMethod = (typeof SHOPPER_RETURN_METHODS)[number];
|
|
2089
|
+
interface ShopperReturnRequestInput {
|
|
2090
|
+
items: {
|
|
2091
|
+
lineId: string;
|
|
2092
|
+
quantity: number;
|
|
2093
|
+
}[];
|
|
2094
|
+
method: ShopperReturnMethod;
|
|
2095
|
+
note?: string;
|
|
2096
|
+
}
|
|
2097
|
+
declare const SHOPPER_ERROR_CODES: {
|
|
2098
|
+
readonly ORDER_NOT_FOUND: "ORDER_NOT_FOUND";
|
|
2099
|
+
readonly RETURN_ALREADY_REQUESTED: "RETURN_ALREADY_REQUESTED";
|
|
2100
|
+
readonly RETURN_NOT_ALLOWED: "RETURN_NOT_ALLOWED";
|
|
2101
|
+
readonly STORE_HAS_NO_SUPPORT_EMAIL: "STORE_HAS_NO_SUPPORT_EMAIL";
|
|
2102
|
+
readonly TOO_MANY_ADDRESSES: "TOO_MANY_ADDRESSES";
|
|
2103
|
+
readonly STORE_NOT_LINKED: "STORE_NOT_LINKED";
|
|
2104
|
+
readonly STORED_METHOD_NOT_FOUND: "STORED_METHOD_NOT_FOUND";
|
|
2105
|
+
};
|
|
2106
|
+
type ShopperErrorCode = (typeof SHOPPER_ERROR_CODES)[keyof typeof SHOPPER_ERROR_CODES];
|
|
2107
|
+
|
|
2108
|
+
declare function normalizeShopperEmail(email: unknown): string | null;
|
|
2109
|
+
|
|
2110
|
+
declare function cardFromProcessorData(processorData: unknown): {
|
|
2111
|
+
cardBrand?: string;
|
|
2112
|
+
cardLastFour?: string;
|
|
2113
|
+
};
|
|
2114
|
+
|
|
1984
2115
|
interface CurrencyRate {
|
|
1985
2116
|
rate: number;
|
|
1986
2117
|
country: string;
|
|
@@ -2049,4 +2180,4 @@ declare const EXPENSE_DEFAULT_CATEGORIES: readonly [{
|
|
|
2049
2180
|
}];
|
|
2050
2181
|
type ExpenseDefaultCategoryKey = (typeof EXPENSE_DEFAULT_CATEGORIES)[number]['key'];
|
|
2051
2182
|
|
|
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 };
|
|
2183
|
+
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, 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, 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, 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,
|
|
@@ -155,6 +158,7 @@ __export(index_exports, {
|
|
|
155
158
|
buildResolvedConfig: () => buildResolvedConfig,
|
|
156
159
|
calculatePercentage: () => calculatePercentage,
|
|
157
160
|
canTransition: () => canTransition,
|
|
161
|
+
cardFromProcessorData: () => cardFromProcessorData,
|
|
158
162
|
cheapestCompositeItem: () => cheapestCompositeItem,
|
|
159
163
|
cheapestCompositePrice: () => cheapestCompositePrice,
|
|
160
164
|
compositeItemCost: () => compositeItemCost,
|
|
@@ -229,6 +233,7 @@ __export(index_exports, {
|
|
|
229
233
|
normalizeMongoIdString: () => normalizeMongoIdString,
|
|
230
234
|
normalizePostCode: () => normalizePostCode,
|
|
231
235
|
normalizeProvince: () => normalizeProvince,
|
|
236
|
+
normalizeShopperEmail: () => normalizeShopperEmail,
|
|
232
237
|
occupancyIn: () => occupancyIn,
|
|
233
238
|
orderAssignments: () => orderAssignments,
|
|
234
239
|
parseAmountToMinorUnits: () => parseAmountToMinorUnits,
|
|
@@ -4486,6 +4491,46 @@ function registrationPlacesByKind(rates) {
|
|
|
4486
4491
|
return places;
|
|
4487
4492
|
}
|
|
4488
4493
|
|
|
4494
|
+
// shopper/types.ts
|
|
4495
|
+
var SHOPPER_CONSENT_SOURCES = ["checkout", "my-account", "store-account"];
|
|
4496
|
+
var SHOPPER_RETURN_METHODS = ["mail", "in-store"];
|
|
4497
|
+
var SHOPPER_ERROR_CODES = {
|
|
4498
|
+
ORDER_NOT_FOUND: "ORDER_NOT_FOUND",
|
|
4499
|
+
RETURN_ALREADY_REQUESTED: "RETURN_ALREADY_REQUESTED",
|
|
4500
|
+
RETURN_NOT_ALLOWED: "RETURN_NOT_ALLOWED",
|
|
4501
|
+
STORE_HAS_NO_SUPPORT_EMAIL: "STORE_HAS_NO_SUPPORT_EMAIL",
|
|
4502
|
+
TOO_MANY_ADDRESSES: "TOO_MANY_ADDRESSES",
|
|
4503
|
+
STORE_NOT_LINKED: "STORE_NOT_LINKED",
|
|
4504
|
+
STORED_METHOD_NOT_FOUND: "STORED_METHOD_NOT_FOUND"
|
|
4505
|
+
};
|
|
4506
|
+
|
|
4507
|
+
// shopper/email.ts
|
|
4508
|
+
function normalizeShopperEmail(email) {
|
|
4509
|
+
if (typeof email !== "string") return null;
|
|
4510
|
+
const value = email.trim().toLowerCase();
|
|
4511
|
+
return /^[^\s@]+@[^\s@]+$/.test(value) ? value : null;
|
|
4512
|
+
}
|
|
4513
|
+
|
|
4514
|
+
// shopper/card.ts
|
|
4515
|
+
function cardFromProcessorData(processorData) {
|
|
4516
|
+
if (typeof processorData !== "string" || !processorData) return {};
|
|
4517
|
+
let data;
|
|
4518
|
+
try {
|
|
4519
|
+
data = JSON.parse(processorData);
|
|
4520
|
+
} catch {
|
|
4521
|
+
return {};
|
|
4522
|
+
}
|
|
4523
|
+
if (!data || typeof data !== "object") return {};
|
|
4524
|
+
const fields = new Map(Object.entries(data));
|
|
4525
|
+
const text = (...keys) => keys.map((key) => fields.get(key)).find((value) => typeof value === "string" && !!value.trim());
|
|
4526
|
+
const brand = text("Brand", "brand")?.trim();
|
|
4527
|
+
const digits = text("Card Number", "card", "card_number")?.replace(/\D/g, "");
|
|
4528
|
+
return {
|
|
4529
|
+
...brand ? { cardBrand: brand.charAt(0).toUpperCase() + brand.slice(1) } : {},
|
|
4530
|
+
...digits && digits.length >= 4 ? { cardLastFour: digits.slice(-4) } : {}
|
|
4531
|
+
};
|
|
4532
|
+
}
|
|
4533
|
+
|
|
4489
4534
|
// constants/adyen.constants.ts
|
|
4490
4535
|
var ADYEN_ROLLOUT_COUNTRY_CODES = /* @__PURE__ */ new Set(["CA"]);
|
|
4491
4536
|
function isAdyenRolloutCountry(alpha2) {
|
|
@@ -4668,6 +4713,9 @@ var EXPENSE_DEFAULT_CATEGORIES = [
|
|
|
4668
4713
|
ResidualStatus,
|
|
4669
4714
|
ResourceAvailabilityState,
|
|
4670
4715
|
SHIPPING_COUNTRIES,
|
|
4716
|
+
SHOPPER_CONSENT_SOURCES,
|
|
4717
|
+
SHOPPER_ERROR_CODES,
|
|
4718
|
+
SHOPPER_RETURN_METHODS,
|
|
4671
4719
|
STANDARD_TAX_TYPE,
|
|
4672
4720
|
STATE_SCHEMA,
|
|
4673
4721
|
STRIPE_SUPPORTED_COUNTRIES,
|
|
@@ -4717,6 +4765,7 @@ var EXPENSE_DEFAULT_CATEGORIES = [
|
|
|
4717
4765
|
buildResolvedConfig,
|
|
4718
4766
|
calculatePercentage,
|
|
4719
4767
|
canTransition,
|
|
4768
|
+
cardFromProcessorData,
|
|
4720
4769
|
cheapestCompositeItem,
|
|
4721
4770
|
cheapestCompositePrice,
|
|
4722
4771
|
compositeItemCost,
|
|
@@ -4791,6 +4840,7 @@ var EXPENSE_DEFAULT_CATEGORIES = [
|
|
|
4791
4840
|
normalizeMongoIdString,
|
|
4792
4841
|
normalizePostCode,
|
|
4793
4842
|
normalizeProvince,
|
|
4843
|
+
normalizeShopperEmail,
|
|
4794
4844
|
occupancyIn,
|
|
4795
4845
|
orderAssignments,
|
|
4796
4846
|
parseAmountToMinorUnits,
|