@final-commerce/common 2.5.0 → 2.5.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 +200 -4
- package/dist/index.d.ts +200 -4
- package/dist/index.js +468 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +438 -2
- package/dist/index.mjs.map +1 -1
- package/dist/pos-types/index.d.mts +10 -1
- package/dist/pos-types/index.d.ts +10 -1
- package/dist/pos-types/index.js +1 -0
- package/dist/pos-types/index.js.map +1 -1
- package/dist/pos-types/index.mjs +1 -0
- package/dist/pos-types/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -190,7 +190,8 @@ declare enum Platform {
|
|
|
190
190
|
declare enum OrderPlatform {
|
|
191
191
|
POS = "in-store",
|
|
192
192
|
WOO_COMMERCE = "woo-commerce",
|
|
193
|
-
PUBLIC_API = "public-api"
|
|
193
|
+
PUBLIC_API = "public-api",
|
|
194
|
+
ONLINE_STORE = "online-store"
|
|
194
195
|
}
|
|
195
196
|
declare enum CustomerPlatform {
|
|
196
197
|
POS = "in-store",
|
|
@@ -442,6 +443,43 @@ declare enum ResourceAvailabilityState {
|
|
|
442
443
|
NO_HOURS_IN_RANGE = "noHoursInRange"
|
|
443
444
|
}
|
|
444
445
|
|
|
446
|
+
declare enum ShippingZoneKind {
|
|
447
|
+
COUNTRY = "country",
|
|
448
|
+
PROVINCE = "province",
|
|
449
|
+
CITY = "city",
|
|
450
|
+
EVERYWHERE = "everywhere"
|
|
451
|
+
}
|
|
452
|
+
declare enum ShippingOptionType {
|
|
453
|
+
SHIP = "ship",
|
|
454
|
+
PICKUP = "pickup"
|
|
455
|
+
}
|
|
456
|
+
declare enum ShippingRateType {
|
|
457
|
+
FLAT = "flat"
|
|
458
|
+
}
|
|
459
|
+
declare enum ShippingChannel {
|
|
460
|
+
WEB = "web",
|
|
461
|
+
POS = "pos"
|
|
462
|
+
}
|
|
463
|
+
declare enum ShippingNoOptionReason {
|
|
464
|
+
INCOMPLETE = "INCOMPLETE",
|
|
465
|
+
ADDRESS_MISMATCH = "ADDRESS_MISMATCH",
|
|
466
|
+
NO_COVERAGE = "NO_COVERAGE",
|
|
467
|
+
BLOCKED = "BLOCKED",
|
|
468
|
+
NO_OPTION = "NO_OPTION"
|
|
469
|
+
}
|
|
470
|
+
declare enum ShippingZoneError {
|
|
471
|
+
NO_PLACES = "NO_PLACES",
|
|
472
|
+
INVALID_PLACE = "INVALID_PLACE",
|
|
473
|
+
DUPLICATE_PLACE = "DUPLICATE_PLACE",
|
|
474
|
+
NO_WEBSITE_OPTION = "NO_WEBSITE_OPTION",
|
|
475
|
+
INVALID_PRICE = "INVALID_PRICE",
|
|
476
|
+
INVALID_DAYS = "INVALID_DAYS",
|
|
477
|
+
INVALID_TIERS = "INVALID_TIERS",
|
|
478
|
+
NO_CHANNEL = "NO_CHANNEL",
|
|
479
|
+
PICKUP_WITHOUT_STORE = "PICKUP_WITHOUT_STORE",
|
|
480
|
+
MISSING_NAME = "MISSING_NAME"
|
|
481
|
+
}
|
|
482
|
+
|
|
445
483
|
interface CurrencyConfig {
|
|
446
484
|
minorUnits: number;
|
|
447
485
|
symbol: string;
|
|
@@ -663,6 +701,43 @@ interface EndOfSessionReport {
|
|
|
663
701
|
minorUnits?: number;
|
|
664
702
|
}
|
|
665
703
|
|
|
704
|
+
declare const ADYEN_ROLLOUT_COUNTRY_CODES: Set<string>;
|
|
705
|
+
declare function isAdyenRolloutCountry(alpha2: string): boolean;
|
|
706
|
+
declare const AFFIRM_PRICE_PLANS: readonly ["core", "standard", "signature"];
|
|
707
|
+
type AffirmPricePlan = (typeof AFFIRM_PRICE_PLANS)[number];
|
|
708
|
+
declare function isAffirmPricePlan(value: unknown): value is AffirmPricePlan;
|
|
709
|
+
declare const AFFIRM_COUNTRY_CODES: Set<string>;
|
|
710
|
+
declare function isAffirmCountry(alpha2: string | undefined): boolean;
|
|
711
|
+
declare const BNPL_METHOD_STATUS: {
|
|
712
|
+
readonly ACTIVE: "active";
|
|
713
|
+
readonly PENDING: "pending";
|
|
714
|
+
readonly UNAVAILABLE: "unavailable";
|
|
715
|
+
readonly UNKNOWN: "unknown";
|
|
716
|
+
};
|
|
717
|
+
type BnplMethodStatus = (typeof BNPL_METHOD_STATUS)[keyof typeof BNPL_METHOD_STATUS];
|
|
718
|
+
declare const BNPL_SKIP_REASON: {
|
|
719
|
+
readonly PENDING: "pending";
|
|
720
|
+
readonly NO_SUPPORT_EMAIL: "no_support_email";
|
|
721
|
+
readonly NO_CURRENCY: "no_currency";
|
|
722
|
+
readonly NO_BUSINESS_LINE: "no_business_line";
|
|
723
|
+
};
|
|
724
|
+
type BnplSkipReason = (typeof BNPL_SKIP_REASON)[keyof typeof BNPL_SKIP_REASON];
|
|
725
|
+
|
|
726
|
+
interface AdyenBnplSettings {
|
|
727
|
+
affirmPricePlan?: AffirmPricePlan;
|
|
728
|
+
affirm: BnplMethodStatus;
|
|
729
|
+
available: boolean;
|
|
730
|
+
}
|
|
731
|
+
interface AdyenBnplSkippedStore {
|
|
732
|
+
storeId: string;
|
|
733
|
+
reason: BnplSkipReason;
|
|
734
|
+
}
|
|
735
|
+
interface AdyenBnplUpdateResult {
|
|
736
|
+
updated: string[];
|
|
737
|
+
requested: string[];
|
|
738
|
+
skipped: AdyenBnplSkippedStore[];
|
|
739
|
+
}
|
|
740
|
+
|
|
666
741
|
declare const CURRENCY_CONFIG: Record<CurrencyCode | string, CurrencyConfig>;
|
|
667
742
|
declare function getCurrencyConfig(currency: CurrencyCode): CurrencyConfig;
|
|
668
743
|
declare function getMinorUnitMultiplier(currency: CurrencyCode): number;
|
|
@@ -1400,8 +1475,111 @@ declare function planWindow({ rule, timeZone, presence, startAt, endAt, now, bus
|
|
|
1400
1475
|
};
|
|
1401
1476
|
declare const holdExpiresAt: (rule: BookingRulesInput, now: Date) => Date;
|
|
1402
1477
|
|
|
1403
|
-
|
|
1404
|
-
|
|
1478
|
+
interface ShippingPlace {
|
|
1479
|
+
country: string;
|
|
1480
|
+
province?: string | null;
|
|
1481
|
+
city?: string | null;
|
|
1482
|
+
}
|
|
1483
|
+
interface ShippingPriceTier {
|
|
1484
|
+
from: number;
|
|
1485
|
+
price: number;
|
|
1486
|
+
}
|
|
1487
|
+
interface ShippingOptionRule {
|
|
1488
|
+
id: string;
|
|
1489
|
+
type: ShippingOptionType | `${ShippingOptionType}`;
|
|
1490
|
+
rate?: ShippingRateType | `${ShippingRateType}`;
|
|
1491
|
+
name?: string | null;
|
|
1492
|
+
price: number;
|
|
1493
|
+
priceByTotal?: ShippingPriceTier[] | null;
|
|
1494
|
+
freeOver?: number | null;
|
|
1495
|
+
minDays?: number | null;
|
|
1496
|
+
maxDays?: number | null;
|
|
1497
|
+
channels: (ShippingChannel | `${ShippingChannel}`)[];
|
|
1498
|
+
outletId?: string | null;
|
|
1499
|
+
}
|
|
1500
|
+
interface ShippingZoneRule {
|
|
1501
|
+
id: string;
|
|
1502
|
+
kind: ShippingZoneKind | `${ShippingZoneKind}`;
|
|
1503
|
+
places: ShippingPlace[];
|
|
1504
|
+
ships: boolean;
|
|
1505
|
+
message?: string | null;
|
|
1506
|
+
options: ShippingOptionRule[];
|
|
1507
|
+
}
|
|
1508
|
+
interface AddressLike {
|
|
1509
|
+
country?: string | null;
|
|
1510
|
+
state?: string | null;
|
|
1511
|
+
province?: string | null;
|
|
1512
|
+
city?: string | null;
|
|
1513
|
+
postCode?: string | null;
|
|
1514
|
+
postalCode?: string | null;
|
|
1515
|
+
zip?: string | null;
|
|
1516
|
+
}
|
|
1517
|
+
interface NormalizedAddress {
|
|
1518
|
+
country?: string;
|
|
1519
|
+
province?: string;
|
|
1520
|
+
cityKey?: string;
|
|
1521
|
+
postCode?: string;
|
|
1522
|
+
}
|
|
1523
|
+
interface ShippingQuoteOption {
|
|
1524
|
+
optionId: string;
|
|
1525
|
+
zoneId: string;
|
|
1526
|
+
type: ShippingOptionType | `${ShippingOptionType}`;
|
|
1527
|
+
name: string | null;
|
|
1528
|
+
amount: number;
|
|
1529
|
+
amountToFree: number | null;
|
|
1530
|
+
minDays: number | null;
|
|
1531
|
+
maxDays: number | null;
|
|
1532
|
+
outletId: string | null;
|
|
1533
|
+
}
|
|
1534
|
+
interface ShippingResolution {
|
|
1535
|
+
zoneId: string | null;
|
|
1536
|
+
options: ShippingQuoteOption[];
|
|
1537
|
+
reason: ShippingNoOptionReason | null;
|
|
1538
|
+
message: string | null;
|
|
1539
|
+
shipsToCountries: string[];
|
|
1540
|
+
}
|
|
1541
|
+
interface ResolveShippingInput {
|
|
1542
|
+
zones: ShippingZoneRule[];
|
|
1543
|
+
address: AddressLike | null | undefined;
|
|
1544
|
+
itemsTotal: number;
|
|
1545
|
+
channel: ShippingChannel | `${ShippingChannel}`;
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
declare function normalizeCountry(value: string | null | undefined): string | undefined;
|
|
1549
|
+
interface CountryOption {
|
|
1550
|
+
code: string;
|
|
1551
|
+
name: string;
|
|
1552
|
+
}
|
|
1553
|
+
declare function listCountries(locale?: string): CountryOption[];
|
|
1554
|
+
|
|
1555
|
+
interface Province {
|
|
1556
|
+
code: string;
|
|
1557
|
+
name: string;
|
|
1558
|
+
nameFr: string;
|
|
1559
|
+
postalLetters: string[];
|
|
1560
|
+
aliases?: string[];
|
|
1561
|
+
}
|
|
1562
|
+
declare const CANADA_PROVINCES: readonly Province[];
|
|
1563
|
+
declare function normalizeProvince(country: string | undefined, value: string | null | undefined): string | undefined;
|
|
1564
|
+
declare function listProvinces(country: string): readonly Province[];
|
|
1565
|
+
declare function provincesForPostCode(country: string | undefined, postCode: string | undefined): string[];
|
|
1566
|
+
|
|
1567
|
+
declare const EVERYWHERE_KEY = "*";
|
|
1568
|
+
declare function normalizeCityKey(value: string | null | undefined): string | undefined;
|
|
1569
|
+
declare function normalizePostCode(value: string | null | undefined): string | undefined;
|
|
1570
|
+
declare function normalizeAddress(address: AddressLike | null | undefined): NormalizedAddress;
|
|
1571
|
+
declare function postCodeMatchesProvince(address: NormalizedAddress): boolean;
|
|
1572
|
+
declare function placeKey(place: ShippingPlace): string | undefined;
|
|
1573
|
+
declare function addressPlaceKeys(address: NormalizedAddress): string[];
|
|
1574
|
+
|
|
1575
|
+
declare function resolveShipping({ zones, address, itemsTotal, channel }: ResolveShippingInput): ShippingResolution;
|
|
1576
|
+
declare function priceForTotal(option: ShippingOptionRule, itemsTotal: number): number;
|
|
1577
|
+
|
|
1578
|
+
interface ShippingZoneProblem {
|
|
1579
|
+
code: ShippingZoneError;
|
|
1580
|
+
optionId?: string;
|
|
1581
|
+
}
|
|
1582
|
+
declare function validateShippingZone(zone: ShippingZoneRule): ShippingZoneProblem[];
|
|
1405
1583
|
|
|
1406
1584
|
interface CurrencyRate {
|
|
1407
1585
|
rate: number;
|
|
@@ -1414,4 +1592,22 @@ declare const EUFixedRates: Record<string, CurrencyRate>;
|
|
|
1414
1592
|
declare const OtherFixedRates: Record<string, CurrencyRate>;
|
|
1415
1593
|
declare const COUNTRY_CURRENCIES: Record<string, string>;
|
|
1416
1594
|
|
|
1417
|
-
|
|
1595
|
+
declare enum ProcessorType {
|
|
1596
|
+
FINAL_PAY = "Terminal",
|
|
1597
|
+
TAP_TO_PAY = "TapToPay",
|
|
1598
|
+
MOTO = "Moto",
|
|
1599
|
+
CLOUD = "Cloud",
|
|
1600
|
+
BLUETOOTH = "Bluetooth",
|
|
1601
|
+
CASH = "Cash",
|
|
1602
|
+
CUSTOM_PAY = "CustomPay",
|
|
1603
|
+
VENDARA = "Vendara",
|
|
1604
|
+
REDEEM = "Redeem",
|
|
1605
|
+
INTEGRATION = "Integration",
|
|
1606
|
+
PAYMENT_LINK = "PaymentLink",
|
|
1607
|
+
ONLINE_PAYMENT = "OnlinePayment"
|
|
1608
|
+
}
|
|
1609
|
+
|
|
1610
|
+
declare const PAYMENT_CHANNELS: readonly ["inPerson", "online"];
|
|
1611
|
+
type PaymentChannel = (typeof PAYMENT_CHANNELS)[number];
|
|
1612
|
+
|
|
1613
|
+
export { ADYEN_ROLLOUT_COUNTRY_CODES, AFFIRM_COUNTRY_CODES, AFFIRM_PRICE_PLANS, type AddressLike, type AdyenBnplSettings, type AdyenBnplSkippedStore, type AdyenBnplUpdateResult, type AffirmPricePlan, type Amount, AttributeType, type AvailabilityInput, type AvailabilitySlot, type AvailableTransition, BNPL_METHOD_STATUS, BNPL_SKIP_REASON, type BnplMethodStatus, type BnplSkipReason, type BookingOccupancy, BookingRatePeriod, type BookingResourceInput, BookingResourceKind, BookingResourceStatus, BookingRulesError, type BookingRulesInput, BookingType, type BusyWindow, CANADA_PROVINCES, CONDITION_OPERATORS, COUNTRY_CURRENCIES, CURRENCY_CONFIG, type CartDiscountBucket, type CartFeeBucket, type CashDrawer, type CashRoundingTuple, CompanyType, 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, type EndOfSessionReport, ExtensionCategory, FINANCIAL_INVARIANTS, FULFILLMENT_STATES, type FailedCondition, type FeesBreakdown, FeesCustomBillingStatus, type FeesTuple, type FinancialInvariant, type FragmentParam, type FragmentValidationResult, type FulfillmentState, type FulfillmentStateDefinition, type FulfillmentTransitionPath, type GetAvailableTransitionsParams, type GetAvailableTransitionsResponse, type GetOrderDisplayStateParams, type GetOrderDisplayStateResponse, type GetOrderStateConfigParams, type GetOrderStateConfigResponse, type GetStateConfigFragmentParams, type GetStateConfigFragmentResponse, type GridSlot, InventoryBaseActionEnum, type InventoryBaseActionType, InventorySpecificActionType, InvoiceStatus, LegacyWriteStrategy, LibraryItemType, MAX_PRECISION, type Measurable, type MeasurementBase, type MeasurementUnit, type MeasurementUnitFamily, MenuProject, type ModifiersBreakdown, type ModifiersTuple, NAFixedRates, NORTH_AMERICA, NonRevenueItemType, type NormalizedAddress, ORDER_STATE_ACTIONS, ORDER_STATE_EVENTS, ORDER_STATE_TOPIC, type OrderContext, type OrderLikeForContext, type OrderLikeForLegacyInference, type OrderLineItem, type OrderMutationData, type OrderPaymentMethod, OrderPlatform, type OrderRefund, type OrderReservationForContext, type OrderStateEventPayload, type OrderStateWritable, type OrderWriteStrategy, OtherFixedRates, OwnerType, PATH_MODES, PAYMENT_CHANNELS, PAYMENT_STATES, POS_VALID_INITIAL_STATES, type PathMode, type PaymentChannel, PaymentMethod, PaymentProcessor, type PaymentState, type PaymentStateDefinition, type PaymentTransitionPath, type PlanWindowInput, Platform, PreviewImageMode, PricingLevel, PricingPlanEnum, PricingRegionEnum, ProcessorType, type ProductDiscountBucket, type ProductFeeBucket, ProductStatus, ProductType, type Province, PublicationAvailability, type PublicationConfig, PublicationStatus, REGION_MAPPING, REPORT_NEGATE_PATHS, ReceiptSendChannel, ReceiptType, type RefundsBreakdown, ReservationStatus, ResidualPaymentMethod, ResidualStatus, type ResolveShippingInput, type ResolveTemplateResult, type ResourceAvailability, ResourceAvailabilityState, type ResourceInWindow, type ResourcePresenceRow, STATE_SCHEMA, STRIPE_SUPPORTED_COUNTRIES, SYSTEM_FAMILIES, SYSTEM_FAMILY_IDS, SYSTEM_UNITS, SYSTEM_UNIT_IDS, type SalesSummary, type SaveStateConfigFragmentParams, type SaveStateConfigFragmentResponse, type SettlementBreakdown, type SettlementBuckets, type SettlementCardSection, type SettlementCashSection, type SettlementCustomEntry, ShippingChannel, ShippingNoOptionReason, type ShippingOptionRule, ShippingOptionType, type ShippingPlace, type ShippingPriceTier, type ShippingQuoteOption, ShippingRateType, type ShippingResolution, ShippingZoneError, ShippingZoneKind, type ShippingZoneProblem, type ShippingZoneRule, type SplitPayment, type SplitPaymentPayment, type StaffSales, type StaffSalesEntry, type StateConfig, type StateConfigFragment, type StateDefinition, type StatePair, type StateSchema, type StateTransitionBlockedPayload, type StateTransitionCompletedPayload, StationStatus, type StoredStateConfig, StripeCurrencyCode, StripeStatus, type TaxBreakdown, type TaxBreakdownRateEntry, type TaxBreakdownSection, type TaxBreakdownSubtotal, type TaxesTuple, TimePeriod, type TipEntry, type TipsBreakdown, type TipsTuple, TopMetericsSort, type TransitionBlockedBy, type TransitionConditionSet, type TransitionOrderStateParams, type TransitionOrderStateResponse, type TransitionPath, type TransitionRequest, type TransitionResult, UserTypes, type WeeklyHours, addAmounts, addressPlaceKeys, amountToString, assertUnitSane, availableIn, baseFor, baseFulfillmentDefinitions, baseOf, basePaymentDefinitions, buildAvailability, buildGrid, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, canTransition, conditionSummary, convertFixedFeeToLocalCurrency, createAmount, crossAxisRuleApplies, deriveDisplayState, deriveFamilyCode, deriveUnitId, displayRuleMatchesPair, divideAmount, evaluateCondition, evaluateConditionSet, extendPrice, extendPriceFor, formatCurrency, formatInUnit, formatMinorUnitsToString, formatQuantity, fromBase, fromMinorUnits, generateMongoID, getAvailableTransitions, getCashAmountDue, getCountriesByRegion, getCurrencyConfig, getCurrentISODate, getFinancialInvariantViolations, getGoodsPortion, getLineSubtotal, getMinorUnitMultiplier, getMinorUnits, getPaymentLegTotal, getPricingRegionFromCountry, getSettlementTotal, getTotalCollected, holdExpiresAt, inferStatesFromLegacyStatus, isAdyenRolloutCountry, isAffirmCountry, isAffirmPricePlan, isConditionOperator, isFulfillmentState, isPaymentState, isSupportedCurrency, isSystemFamilyCode, isValidQuantity, isWhole, listCountries, listProvinces, mapToLegacyStatus, maxPrecisionFor, mergeFragment, multiplyAmount, normalizeAddress, normalizeCityKey, normalizeCountry, normalizeMongoIdString, normalizePostCode, normalizeProvince, occupancyIn, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, placeKey, planWindow, postCodeMatchesProvince, presentAt, priceForTotal, provincesForPostCode, removeFragment, resolveFamily, resolveShipping, resolveTemplate, resolveUnit, roundToPrecision, sameFamily, setOrderState, shopDayKey, shopDayRange, signReportForDisplay, slotsForWindow, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, validateShippingZone, violatesFinancialInvariant, windowEndsAt, withinPresence };
|
package/dist/index.d.ts
CHANGED
|
@@ -190,7 +190,8 @@ declare enum Platform {
|
|
|
190
190
|
declare enum OrderPlatform {
|
|
191
191
|
POS = "in-store",
|
|
192
192
|
WOO_COMMERCE = "woo-commerce",
|
|
193
|
-
PUBLIC_API = "public-api"
|
|
193
|
+
PUBLIC_API = "public-api",
|
|
194
|
+
ONLINE_STORE = "online-store"
|
|
194
195
|
}
|
|
195
196
|
declare enum CustomerPlatform {
|
|
196
197
|
POS = "in-store",
|
|
@@ -442,6 +443,43 @@ declare enum ResourceAvailabilityState {
|
|
|
442
443
|
NO_HOURS_IN_RANGE = "noHoursInRange"
|
|
443
444
|
}
|
|
444
445
|
|
|
446
|
+
declare enum ShippingZoneKind {
|
|
447
|
+
COUNTRY = "country",
|
|
448
|
+
PROVINCE = "province",
|
|
449
|
+
CITY = "city",
|
|
450
|
+
EVERYWHERE = "everywhere"
|
|
451
|
+
}
|
|
452
|
+
declare enum ShippingOptionType {
|
|
453
|
+
SHIP = "ship",
|
|
454
|
+
PICKUP = "pickup"
|
|
455
|
+
}
|
|
456
|
+
declare enum ShippingRateType {
|
|
457
|
+
FLAT = "flat"
|
|
458
|
+
}
|
|
459
|
+
declare enum ShippingChannel {
|
|
460
|
+
WEB = "web",
|
|
461
|
+
POS = "pos"
|
|
462
|
+
}
|
|
463
|
+
declare enum ShippingNoOptionReason {
|
|
464
|
+
INCOMPLETE = "INCOMPLETE",
|
|
465
|
+
ADDRESS_MISMATCH = "ADDRESS_MISMATCH",
|
|
466
|
+
NO_COVERAGE = "NO_COVERAGE",
|
|
467
|
+
BLOCKED = "BLOCKED",
|
|
468
|
+
NO_OPTION = "NO_OPTION"
|
|
469
|
+
}
|
|
470
|
+
declare enum ShippingZoneError {
|
|
471
|
+
NO_PLACES = "NO_PLACES",
|
|
472
|
+
INVALID_PLACE = "INVALID_PLACE",
|
|
473
|
+
DUPLICATE_PLACE = "DUPLICATE_PLACE",
|
|
474
|
+
NO_WEBSITE_OPTION = "NO_WEBSITE_OPTION",
|
|
475
|
+
INVALID_PRICE = "INVALID_PRICE",
|
|
476
|
+
INVALID_DAYS = "INVALID_DAYS",
|
|
477
|
+
INVALID_TIERS = "INVALID_TIERS",
|
|
478
|
+
NO_CHANNEL = "NO_CHANNEL",
|
|
479
|
+
PICKUP_WITHOUT_STORE = "PICKUP_WITHOUT_STORE",
|
|
480
|
+
MISSING_NAME = "MISSING_NAME"
|
|
481
|
+
}
|
|
482
|
+
|
|
445
483
|
interface CurrencyConfig {
|
|
446
484
|
minorUnits: number;
|
|
447
485
|
symbol: string;
|
|
@@ -663,6 +701,43 @@ interface EndOfSessionReport {
|
|
|
663
701
|
minorUnits?: number;
|
|
664
702
|
}
|
|
665
703
|
|
|
704
|
+
declare const ADYEN_ROLLOUT_COUNTRY_CODES: Set<string>;
|
|
705
|
+
declare function isAdyenRolloutCountry(alpha2: string): boolean;
|
|
706
|
+
declare const AFFIRM_PRICE_PLANS: readonly ["core", "standard", "signature"];
|
|
707
|
+
type AffirmPricePlan = (typeof AFFIRM_PRICE_PLANS)[number];
|
|
708
|
+
declare function isAffirmPricePlan(value: unknown): value is AffirmPricePlan;
|
|
709
|
+
declare const AFFIRM_COUNTRY_CODES: Set<string>;
|
|
710
|
+
declare function isAffirmCountry(alpha2: string | undefined): boolean;
|
|
711
|
+
declare const BNPL_METHOD_STATUS: {
|
|
712
|
+
readonly ACTIVE: "active";
|
|
713
|
+
readonly PENDING: "pending";
|
|
714
|
+
readonly UNAVAILABLE: "unavailable";
|
|
715
|
+
readonly UNKNOWN: "unknown";
|
|
716
|
+
};
|
|
717
|
+
type BnplMethodStatus = (typeof BNPL_METHOD_STATUS)[keyof typeof BNPL_METHOD_STATUS];
|
|
718
|
+
declare const BNPL_SKIP_REASON: {
|
|
719
|
+
readonly PENDING: "pending";
|
|
720
|
+
readonly NO_SUPPORT_EMAIL: "no_support_email";
|
|
721
|
+
readonly NO_CURRENCY: "no_currency";
|
|
722
|
+
readonly NO_BUSINESS_LINE: "no_business_line";
|
|
723
|
+
};
|
|
724
|
+
type BnplSkipReason = (typeof BNPL_SKIP_REASON)[keyof typeof BNPL_SKIP_REASON];
|
|
725
|
+
|
|
726
|
+
interface AdyenBnplSettings {
|
|
727
|
+
affirmPricePlan?: AffirmPricePlan;
|
|
728
|
+
affirm: BnplMethodStatus;
|
|
729
|
+
available: boolean;
|
|
730
|
+
}
|
|
731
|
+
interface AdyenBnplSkippedStore {
|
|
732
|
+
storeId: string;
|
|
733
|
+
reason: BnplSkipReason;
|
|
734
|
+
}
|
|
735
|
+
interface AdyenBnplUpdateResult {
|
|
736
|
+
updated: string[];
|
|
737
|
+
requested: string[];
|
|
738
|
+
skipped: AdyenBnplSkippedStore[];
|
|
739
|
+
}
|
|
740
|
+
|
|
666
741
|
declare const CURRENCY_CONFIG: Record<CurrencyCode | string, CurrencyConfig>;
|
|
667
742
|
declare function getCurrencyConfig(currency: CurrencyCode): CurrencyConfig;
|
|
668
743
|
declare function getMinorUnitMultiplier(currency: CurrencyCode): number;
|
|
@@ -1400,8 +1475,111 @@ declare function planWindow({ rule, timeZone, presence, startAt, endAt, now, bus
|
|
|
1400
1475
|
};
|
|
1401
1476
|
declare const holdExpiresAt: (rule: BookingRulesInput, now: Date) => Date;
|
|
1402
1477
|
|
|
1403
|
-
|
|
1404
|
-
|
|
1478
|
+
interface ShippingPlace {
|
|
1479
|
+
country: string;
|
|
1480
|
+
province?: string | null;
|
|
1481
|
+
city?: string | null;
|
|
1482
|
+
}
|
|
1483
|
+
interface ShippingPriceTier {
|
|
1484
|
+
from: number;
|
|
1485
|
+
price: number;
|
|
1486
|
+
}
|
|
1487
|
+
interface ShippingOptionRule {
|
|
1488
|
+
id: string;
|
|
1489
|
+
type: ShippingOptionType | `${ShippingOptionType}`;
|
|
1490
|
+
rate?: ShippingRateType | `${ShippingRateType}`;
|
|
1491
|
+
name?: string | null;
|
|
1492
|
+
price: number;
|
|
1493
|
+
priceByTotal?: ShippingPriceTier[] | null;
|
|
1494
|
+
freeOver?: number | null;
|
|
1495
|
+
minDays?: number | null;
|
|
1496
|
+
maxDays?: number | null;
|
|
1497
|
+
channels: (ShippingChannel | `${ShippingChannel}`)[];
|
|
1498
|
+
outletId?: string | null;
|
|
1499
|
+
}
|
|
1500
|
+
interface ShippingZoneRule {
|
|
1501
|
+
id: string;
|
|
1502
|
+
kind: ShippingZoneKind | `${ShippingZoneKind}`;
|
|
1503
|
+
places: ShippingPlace[];
|
|
1504
|
+
ships: boolean;
|
|
1505
|
+
message?: string | null;
|
|
1506
|
+
options: ShippingOptionRule[];
|
|
1507
|
+
}
|
|
1508
|
+
interface AddressLike {
|
|
1509
|
+
country?: string | null;
|
|
1510
|
+
state?: string | null;
|
|
1511
|
+
province?: string | null;
|
|
1512
|
+
city?: string | null;
|
|
1513
|
+
postCode?: string | null;
|
|
1514
|
+
postalCode?: string | null;
|
|
1515
|
+
zip?: string | null;
|
|
1516
|
+
}
|
|
1517
|
+
interface NormalizedAddress {
|
|
1518
|
+
country?: string;
|
|
1519
|
+
province?: string;
|
|
1520
|
+
cityKey?: string;
|
|
1521
|
+
postCode?: string;
|
|
1522
|
+
}
|
|
1523
|
+
interface ShippingQuoteOption {
|
|
1524
|
+
optionId: string;
|
|
1525
|
+
zoneId: string;
|
|
1526
|
+
type: ShippingOptionType | `${ShippingOptionType}`;
|
|
1527
|
+
name: string | null;
|
|
1528
|
+
amount: number;
|
|
1529
|
+
amountToFree: number | null;
|
|
1530
|
+
minDays: number | null;
|
|
1531
|
+
maxDays: number | null;
|
|
1532
|
+
outletId: string | null;
|
|
1533
|
+
}
|
|
1534
|
+
interface ShippingResolution {
|
|
1535
|
+
zoneId: string | null;
|
|
1536
|
+
options: ShippingQuoteOption[];
|
|
1537
|
+
reason: ShippingNoOptionReason | null;
|
|
1538
|
+
message: string | null;
|
|
1539
|
+
shipsToCountries: string[];
|
|
1540
|
+
}
|
|
1541
|
+
interface ResolveShippingInput {
|
|
1542
|
+
zones: ShippingZoneRule[];
|
|
1543
|
+
address: AddressLike | null | undefined;
|
|
1544
|
+
itemsTotal: number;
|
|
1545
|
+
channel: ShippingChannel | `${ShippingChannel}`;
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
declare function normalizeCountry(value: string | null | undefined): string | undefined;
|
|
1549
|
+
interface CountryOption {
|
|
1550
|
+
code: string;
|
|
1551
|
+
name: string;
|
|
1552
|
+
}
|
|
1553
|
+
declare function listCountries(locale?: string): CountryOption[];
|
|
1554
|
+
|
|
1555
|
+
interface Province {
|
|
1556
|
+
code: string;
|
|
1557
|
+
name: string;
|
|
1558
|
+
nameFr: string;
|
|
1559
|
+
postalLetters: string[];
|
|
1560
|
+
aliases?: string[];
|
|
1561
|
+
}
|
|
1562
|
+
declare const CANADA_PROVINCES: readonly Province[];
|
|
1563
|
+
declare function normalizeProvince(country: string | undefined, value: string | null | undefined): string | undefined;
|
|
1564
|
+
declare function listProvinces(country: string): readonly Province[];
|
|
1565
|
+
declare function provincesForPostCode(country: string | undefined, postCode: string | undefined): string[];
|
|
1566
|
+
|
|
1567
|
+
declare const EVERYWHERE_KEY = "*";
|
|
1568
|
+
declare function normalizeCityKey(value: string | null | undefined): string | undefined;
|
|
1569
|
+
declare function normalizePostCode(value: string | null | undefined): string | undefined;
|
|
1570
|
+
declare function normalizeAddress(address: AddressLike | null | undefined): NormalizedAddress;
|
|
1571
|
+
declare function postCodeMatchesProvince(address: NormalizedAddress): boolean;
|
|
1572
|
+
declare function placeKey(place: ShippingPlace): string | undefined;
|
|
1573
|
+
declare function addressPlaceKeys(address: NormalizedAddress): string[];
|
|
1574
|
+
|
|
1575
|
+
declare function resolveShipping({ zones, address, itemsTotal, channel }: ResolveShippingInput): ShippingResolution;
|
|
1576
|
+
declare function priceForTotal(option: ShippingOptionRule, itemsTotal: number): number;
|
|
1577
|
+
|
|
1578
|
+
interface ShippingZoneProblem {
|
|
1579
|
+
code: ShippingZoneError;
|
|
1580
|
+
optionId?: string;
|
|
1581
|
+
}
|
|
1582
|
+
declare function validateShippingZone(zone: ShippingZoneRule): ShippingZoneProblem[];
|
|
1405
1583
|
|
|
1406
1584
|
interface CurrencyRate {
|
|
1407
1585
|
rate: number;
|
|
@@ -1414,4 +1592,22 @@ declare const EUFixedRates: Record<string, CurrencyRate>;
|
|
|
1414
1592
|
declare const OtherFixedRates: Record<string, CurrencyRate>;
|
|
1415
1593
|
declare const COUNTRY_CURRENCIES: Record<string, string>;
|
|
1416
1594
|
|
|
1417
|
-
|
|
1595
|
+
declare enum ProcessorType {
|
|
1596
|
+
FINAL_PAY = "Terminal",
|
|
1597
|
+
TAP_TO_PAY = "TapToPay",
|
|
1598
|
+
MOTO = "Moto",
|
|
1599
|
+
CLOUD = "Cloud",
|
|
1600
|
+
BLUETOOTH = "Bluetooth",
|
|
1601
|
+
CASH = "Cash",
|
|
1602
|
+
CUSTOM_PAY = "CustomPay",
|
|
1603
|
+
VENDARA = "Vendara",
|
|
1604
|
+
REDEEM = "Redeem",
|
|
1605
|
+
INTEGRATION = "Integration",
|
|
1606
|
+
PAYMENT_LINK = "PaymentLink",
|
|
1607
|
+
ONLINE_PAYMENT = "OnlinePayment"
|
|
1608
|
+
}
|
|
1609
|
+
|
|
1610
|
+
declare const PAYMENT_CHANNELS: readonly ["inPerson", "online"];
|
|
1611
|
+
type PaymentChannel = (typeof PAYMENT_CHANNELS)[number];
|
|
1612
|
+
|
|
1613
|
+
export { ADYEN_ROLLOUT_COUNTRY_CODES, AFFIRM_COUNTRY_CODES, AFFIRM_PRICE_PLANS, type AddressLike, type AdyenBnplSettings, type AdyenBnplSkippedStore, type AdyenBnplUpdateResult, type AffirmPricePlan, type Amount, AttributeType, type AvailabilityInput, type AvailabilitySlot, type AvailableTransition, BNPL_METHOD_STATUS, BNPL_SKIP_REASON, type BnplMethodStatus, type BnplSkipReason, type BookingOccupancy, BookingRatePeriod, type BookingResourceInput, BookingResourceKind, BookingResourceStatus, BookingRulesError, type BookingRulesInput, BookingType, type BusyWindow, CANADA_PROVINCES, CONDITION_OPERATORS, COUNTRY_CURRENCIES, CURRENCY_CONFIG, type CartDiscountBucket, type CartFeeBucket, type CashDrawer, type CashRoundingTuple, CompanyType, 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, type EndOfSessionReport, ExtensionCategory, FINANCIAL_INVARIANTS, FULFILLMENT_STATES, type FailedCondition, type FeesBreakdown, FeesCustomBillingStatus, type FeesTuple, type FinancialInvariant, type FragmentParam, type FragmentValidationResult, type FulfillmentState, type FulfillmentStateDefinition, type FulfillmentTransitionPath, type GetAvailableTransitionsParams, type GetAvailableTransitionsResponse, type GetOrderDisplayStateParams, type GetOrderDisplayStateResponse, type GetOrderStateConfigParams, type GetOrderStateConfigResponse, type GetStateConfigFragmentParams, type GetStateConfigFragmentResponse, type GridSlot, InventoryBaseActionEnum, type InventoryBaseActionType, InventorySpecificActionType, InvoiceStatus, LegacyWriteStrategy, LibraryItemType, MAX_PRECISION, type Measurable, type MeasurementBase, type MeasurementUnit, type MeasurementUnitFamily, MenuProject, type ModifiersBreakdown, type ModifiersTuple, NAFixedRates, NORTH_AMERICA, NonRevenueItemType, type NormalizedAddress, ORDER_STATE_ACTIONS, ORDER_STATE_EVENTS, ORDER_STATE_TOPIC, type OrderContext, type OrderLikeForContext, type OrderLikeForLegacyInference, type OrderLineItem, type OrderMutationData, type OrderPaymentMethod, OrderPlatform, type OrderRefund, type OrderReservationForContext, type OrderStateEventPayload, type OrderStateWritable, type OrderWriteStrategy, OtherFixedRates, OwnerType, PATH_MODES, PAYMENT_CHANNELS, PAYMENT_STATES, POS_VALID_INITIAL_STATES, type PathMode, type PaymentChannel, PaymentMethod, PaymentProcessor, type PaymentState, type PaymentStateDefinition, type PaymentTransitionPath, type PlanWindowInput, Platform, PreviewImageMode, PricingLevel, PricingPlanEnum, PricingRegionEnum, ProcessorType, type ProductDiscountBucket, type ProductFeeBucket, ProductStatus, ProductType, type Province, PublicationAvailability, type PublicationConfig, PublicationStatus, REGION_MAPPING, REPORT_NEGATE_PATHS, ReceiptSendChannel, ReceiptType, type RefundsBreakdown, ReservationStatus, ResidualPaymentMethod, ResidualStatus, type ResolveShippingInput, type ResolveTemplateResult, type ResourceAvailability, ResourceAvailabilityState, type ResourceInWindow, type ResourcePresenceRow, STATE_SCHEMA, STRIPE_SUPPORTED_COUNTRIES, SYSTEM_FAMILIES, SYSTEM_FAMILY_IDS, SYSTEM_UNITS, SYSTEM_UNIT_IDS, type SalesSummary, type SaveStateConfigFragmentParams, type SaveStateConfigFragmentResponse, type SettlementBreakdown, type SettlementBuckets, type SettlementCardSection, type SettlementCashSection, type SettlementCustomEntry, ShippingChannel, ShippingNoOptionReason, type ShippingOptionRule, ShippingOptionType, type ShippingPlace, type ShippingPriceTier, type ShippingQuoteOption, ShippingRateType, type ShippingResolution, ShippingZoneError, ShippingZoneKind, type ShippingZoneProblem, type ShippingZoneRule, type SplitPayment, type SplitPaymentPayment, type StaffSales, type StaffSalesEntry, type StateConfig, type StateConfigFragment, type StateDefinition, type StatePair, type StateSchema, type StateTransitionBlockedPayload, type StateTransitionCompletedPayload, StationStatus, type StoredStateConfig, StripeCurrencyCode, StripeStatus, type TaxBreakdown, type TaxBreakdownRateEntry, type TaxBreakdownSection, type TaxBreakdownSubtotal, type TaxesTuple, TimePeriod, type TipEntry, type TipsBreakdown, type TipsTuple, TopMetericsSort, type TransitionBlockedBy, type TransitionConditionSet, type TransitionOrderStateParams, type TransitionOrderStateResponse, type TransitionPath, type TransitionRequest, type TransitionResult, UserTypes, type WeeklyHours, addAmounts, addressPlaceKeys, amountToString, assertUnitSane, availableIn, baseFor, baseFulfillmentDefinitions, baseOf, basePaymentDefinitions, buildAvailability, buildGrid, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, canTransition, conditionSummary, convertFixedFeeToLocalCurrency, createAmount, crossAxisRuleApplies, deriveDisplayState, deriveFamilyCode, deriveUnitId, displayRuleMatchesPair, divideAmount, evaluateCondition, evaluateConditionSet, extendPrice, extendPriceFor, formatCurrency, formatInUnit, formatMinorUnitsToString, formatQuantity, fromBase, fromMinorUnits, generateMongoID, getAvailableTransitions, getCashAmountDue, getCountriesByRegion, getCurrencyConfig, getCurrentISODate, getFinancialInvariantViolations, getGoodsPortion, getLineSubtotal, getMinorUnitMultiplier, getMinorUnits, getPaymentLegTotal, getPricingRegionFromCountry, getSettlementTotal, getTotalCollected, holdExpiresAt, inferStatesFromLegacyStatus, isAdyenRolloutCountry, isAffirmCountry, isAffirmPricePlan, isConditionOperator, isFulfillmentState, isPaymentState, isSupportedCurrency, isSystemFamilyCode, isValidQuantity, isWhole, listCountries, listProvinces, mapToLegacyStatus, maxPrecisionFor, mergeFragment, multiplyAmount, normalizeAddress, normalizeCityKey, normalizeCountry, normalizeMongoIdString, normalizePostCode, normalizeProvince, occupancyIn, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, placeKey, planWindow, postCodeMatchesProvince, presentAt, priceForTotal, provincesForPostCode, removeFragment, resolveFamily, resolveShipping, resolveTemplate, resolveUnit, roundToPrecision, sameFamily, setOrderState, shopDayKey, shopDayRange, signReportForDisplay, slotsForWindow, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, validateShippingZone, violatesFinancialInvariant, windowEndsAt, withinPresence };
|