@final-commerce/common 2.5.0 → 2.5.1-online.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +58 -5
- package/dist/index.d.ts +58 -5
- package/dist/index.js +68 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +60 -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",
|
|
@@ -663,6 +664,43 @@ interface EndOfSessionReport {
|
|
|
663
664
|
minorUnits?: number;
|
|
664
665
|
}
|
|
665
666
|
|
|
667
|
+
declare const ADYEN_ROLLOUT_COUNTRY_CODES: Set<string>;
|
|
668
|
+
declare function isAdyenRolloutCountry(alpha2: string): boolean;
|
|
669
|
+
declare const AFFIRM_PRICE_PLANS: readonly ["core", "standard", "signature"];
|
|
670
|
+
type AffirmPricePlan = (typeof AFFIRM_PRICE_PLANS)[number];
|
|
671
|
+
declare function isAffirmPricePlan(value: unknown): value is AffirmPricePlan;
|
|
672
|
+
declare const AFFIRM_COUNTRY_CODES: Set<string>;
|
|
673
|
+
declare function isAffirmCountry(alpha2: string | undefined): boolean;
|
|
674
|
+
declare const BNPL_METHOD_STATUS: {
|
|
675
|
+
readonly ACTIVE: "active";
|
|
676
|
+
readonly PENDING: "pending";
|
|
677
|
+
readonly UNAVAILABLE: "unavailable";
|
|
678
|
+
readonly UNKNOWN: "unknown";
|
|
679
|
+
};
|
|
680
|
+
type BnplMethodStatus = (typeof BNPL_METHOD_STATUS)[keyof typeof BNPL_METHOD_STATUS];
|
|
681
|
+
declare const BNPL_SKIP_REASON: {
|
|
682
|
+
readonly PENDING: "pending";
|
|
683
|
+
readonly NO_SUPPORT_EMAIL: "no_support_email";
|
|
684
|
+
readonly NO_CURRENCY: "no_currency";
|
|
685
|
+
readonly NO_BUSINESS_LINE: "no_business_line";
|
|
686
|
+
};
|
|
687
|
+
type BnplSkipReason = (typeof BNPL_SKIP_REASON)[keyof typeof BNPL_SKIP_REASON];
|
|
688
|
+
|
|
689
|
+
interface AdyenBnplSettings {
|
|
690
|
+
affirmPricePlan?: AffirmPricePlan;
|
|
691
|
+
affirm: BnplMethodStatus;
|
|
692
|
+
available: boolean;
|
|
693
|
+
}
|
|
694
|
+
interface AdyenBnplSkippedStore {
|
|
695
|
+
storeId: string;
|
|
696
|
+
reason: BnplSkipReason;
|
|
697
|
+
}
|
|
698
|
+
interface AdyenBnplUpdateResult {
|
|
699
|
+
updated: string[];
|
|
700
|
+
requested: string[];
|
|
701
|
+
skipped: AdyenBnplSkippedStore[];
|
|
702
|
+
}
|
|
703
|
+
|
|
666
704
|
declare const CURRENCY_CONFIG: Record<CurrencyCode | string, CurrencyConfig>;
|
|
667
705
|
declare function getCurrencyConfig(currency: CurrencyCode): CurrencyConfig;
|
|
668
706
|
declare function getMinorUnitMultiplier(currency: CurrencyCode): number;
|
|
@@ -1400,9 +1438,6 @@ declare function planWindow({ rule, timeZone, presence, startAt, endAt, now, bus
|
|
|
1400
1438
|
};
|
|
1401
1439
|
declare const holdExpiresAt: (rule: BookingRulesInput, now: Date) => Date;
|
|
1402
1440
|
|
|
1403
|
-
declare const ADYEN_ROLLOUT_COUNTRY_CODES: Set<string>;
|
|
1404
|
-
declare function isAdyenRolloutCountry(alpha2: string): boolean;
|
|
1405
|
-
|
|
1406
1441
|
interface CurrencyRate {
|
|
1407
1442
|
rate: number;
|
|
1408
1443
|
country: string;
|
|
@@ -1414,4 +1449,22 @@ declare const EUFixedRates: Record<string, CurrencyRate>;
|
|
|
1414
1449
|
declare const OtherFixedRates: Record<string, CurrencyRate>;
|
|
1415
1450
|
declare const COUNTRY_CURRENCIES: Record<string, string>;
|
|
1416
1451
|
|
|
1417
|
-
|
|
1452
|
+
declare enum ProcessorType {
|
|
1453
|
+
FINAL_PAY = "Terminal",
|
|
1454
|
+
TAP_TO_PAY = "TapToPay",
|
|
1455
|
+
MOTO = "Moto",
|
|
1456
|
+
CLOUD = "Cloud",
|
|
1457
|
+
BLUETOOTH = "Bluetooth",
|
|
1458
|
+
CASH = "Cash",
|
|
1459
|
+
CUSTOM_PAY = "CustomPay",
|
|
1460
|
+
VENDARA = "Vendara",
|
|
1461
|
+
REDEEM = "Redeem",
|
|
1462
|
+
INTEGRATION = "Integration",
|
|
1463
|
+
PAYMENT_LINK = "PaymentLink",
|
|
1464
|
+
ONLINE_PAYMENT = "OnlinePayment"
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1467
|
+
declare const PAYMENT_CHANNELS: readonly ["inPerson", "online"];
|
|
1468
|
+
type PaymentChannel = (typeof PAYMENT_CHANNELS)[number];
|
|
1469
|
+
|
|
1470
|
+
export { ADYEN_ROLLOUT_COUNTRY_CODES, AFFIRM_COUNTRY_CODES, AFFIRM_PRICE_PLANS, type AdyenBnplSettings, type AdyenBnplSkippedStore, type AdyenBnplUpdateResult, type AffirmPricePlan, type Amount, AttributeType, type AvailabilityInput, type AvailabilitySlot, type AvailableTransition, BNPL_METHOD_STATUS, BNPL_SKIP_REASON, type BnplMethodStatus, type BnplSkipReason, type BookingOccupancy, BookingRatePeriod, type BookingResourceInput, BookingResourceKind, BookingResourceStatus, BookingRulesError, type BookingRulesInput, BookingType, type BusyWindow, CONDITION_OPERATORS, COUNTRY_CURRENCIES, CURRENCY_CONFIG, type CartDiscountBucket, type CartFeeBucket, type CashDrawer, type CashRoundingTuple, CompanyType, type Condition, type ConditionGroup, type ConditionOperator, type ConfigUpdatedPayload, type ConfigValidationError, type ConfigValidationResult, type ConfigValidationWarning, type CrossAxisRequires, type CrossAxisRule, type CrossAxisTrigger, CurrencyCode, type CurrencyConfig, type CurrencyRate, CustomTableAvailability, CustomerPlatform, DEFAULT_CONFIG, DEFAULT_CROSS_AXIS_RULES, DEFAULT_DISPLAY_STATE_MAP, DEFAULT_HOLD_MINUTES, DEFAULT_RESOLVED_CONFIG, DEFAULT_UNIT_ID, type DeleteStateConfigFragmentParams, type DeleteStateConfigFragmentResponse, type DiscountsBreakdown, type DiscountsTuple, type DisplayStateResult, type DisplayStateRule, DualWriteStrategy, EUFixedRates, EUROPE, type EndOfSessionReport, ExtensionCategory, FINANCIAL_INVARIANTS, FULFILLMENT_STATES, type FailedCondition, type FeesBreakdown, FeesCustomBillingStatus, type FeesTuple, type FinancialInvariant, type FragmentParam, type FragmentValidationResult, type FulfillmentState, type FulfillmentStateDefinition, type FulfillmentTransitionPath, type GetAvailableTransitionsParams, type GetAvailableTransitionsResponse, type GetOrderDisplayStateParams, type GetOrderDisplayStateResponse, type GetOrderStateConfigParams, type GetOrderStateConfigResponse, type GetStateConfigFragmentParams, type GetStateConfigFragmentResponse, type GridSlot, InventoryBaseActionEnum, type InventoryBaseActionType, InventorySpecificActionType, InvoiceStatus, LegacyWriteStrategy, LibraryItemType, MAX_PRECISION, type Measurable, type MeasurementBase, type MeasurementUnit, type MeasurementUnitFamily, MenuProject, type ModifiersBreakdown, type ModifiersTuple, NAFixedRates, NORTH_AMERICA, NonRevenueItemType, ORDER_STATE_ACTIONS, ORDER_STATE_EVENTS, ORDER_STATE_TOPIC, type OrderContext, type OrderLikeForContext, type OrderLikeForLegacyInference, type OrderLineItem, type OrderMutationData, type OrderPaymentMethod, OrderPlatform, type OrderRefund, type OrderReservationForContext, type OrderStateEventPayload, type OrderStateWritable, type OrderWriteStrategy, OtherFixedRates, OwnerType, PATH_MODES, PAYMENT_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, PublicationAvailability, type PublicationConfig, PublicationStatus, REGION_MAPPING, REPORT_NEGATE_PATHS, ReceiptSendChannel, ReceiptType, type RefundsBreakdown, ReservationStatus, ResidualPaymentMethod, ResidualStatus, type ResolveTemplateResult, type ResourceAvailability, ResourceAvailabilityState, type ResourceInWindow, type ResourcePresenceRow, STATE_SCHEMA, STRIPE_SUPPORTED_COUNTRIES, SYSTEM_FAMILIES, SYSTEM_FAMILY_IDS, SYSTEM_UNITS, SYSTEM_UNIT_IDS, type SalesSummary, type SaveStateConfigFragmentParams, type SaveStateConfigFragmentResponse, type SettlementBreakdown, type SettlementBuckets, type SettlementCardSection, type SettlementCashSection, type SettlementCustomEntry, type SplitPayment, type SplitPaymentPayment, type StaffSales, type StaffSalesEntry, type StateConfig, type StateConfigFragment, type StateDefinition, type StatePair, type StateSchema, type StateTransitionBlockedPayload, type StateTransitionCompletedPayload, StationStatus, type StoredStateConfig, StripeCurrencyCode, StripeStatus, type TaxBreakdown, type TaxBreakdownRateEntry, type TaxBreakdownSection, type TaxBreakdownSubtotal, type TaxesTuple, TimePeriod, type TipEntry, type TipsBreakdown, type TipsTuple, TopMetericsSort, type TransitionBlockedBy, type TransitionConditionSet, type TransitionOrderStateParams, type TransitionOrderStateResponse, type TransitionPath, type TransitionRequest, type TransitionResult, UserTypes, type WeeklyHours, addAmounts, amountToString, assertUnitSane, availableIn, baseFor, baseFulfillmentDefinitions, baseOf, basePaymentDefinitions, buildAvailability, buildGrid, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, canTransition, conditionSummary, convertFixedFeeToLocalCurrency, createAmount, crossAxisRuleApplies, deriveDisplayState, deriveFamilyCode, deriveUnitId, displayRuleMatchesPair, divideAmount, evaluateCondition, evaluateConditionSet, extendPrice, extendPriceFor, formatCurrency, formatInUnit, formatMinorUnitsToString, formatQuantity, fromBase, fromMinorUnits, generateMongoID, getAvailableTransitions, getCashAmountDue, getCountriesByRegion, getCurrencyConfig, getCurrentISODate, getFinancialInvariantViolations, getGoodsPortion, getLineSubtotal, getMinorUnitMultiplier, getMinorUnits, getPaymentLegTotal, getPricingRegionFromCountry, getSettlementTotal, getTotalCollected, holdExpiresAt, inferStatesFromLegacyStatus, isAdyenRolloutCountry, isAffirmCountry, isAffirmPricePlan, isConditionOperator, isFulfillmentState, isPaymentState, isSupportedCurrency, isSystemFamilyCode, isValidQuantity, isWhole, mapToLegacyStatus, maxPrecisionFor, mergeFragment, multiplyAmount, normalizeMongoIdString, occupancyIn, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, planWindow, presentAt, removeFragment, resolveFamily, resolveTemplate, resolveUnit, roundToPrecision, sameFamily, setOrderState, shopDayKey, shopDayRange, signReportForDisplay, slotsForWindow, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, violatesFinancialInvariant, windowEndsAt, withinPresence };
|
package/dist/index.d.ts
CHANGED
|
@@ -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",
|
|
@@ -663,6 +664,43 @@ interface EndOfSessionReport {
|
|
|
663
664
|
minorUnits?: number;
|
|
664
665
|
}
|
|
665
666
|
|
|
667
|
+
declare const ADYEN_ROLLOUT_COUNTRY_CODES: Set<string>;
|
|
668
|
+
declare function isAdyenRolloutCountry(alpha2: string): boolean;
|
|
669
|
+
declare const AFFIRM_PRICE_PLANS: readonly ["core", "standard", "signature"];
|
|
670
|
+
type AffirmPricePlan = (typeof AFFIRM_PRICE_PLANS)[number];
|
|
671
|
+
declare function isAffirmPricePlan(value: unknown): value is AffirmPricePlan;
|
|
672
|
+
declare const AFFIRM_COUNTRY_CODES: Set<string>;
|
|
673
|
+
declare function isAffirmCountry(alpha2: string | undefined): boolean;
|
|
674
|
+
declare const BNPL_METHOD_STATUS: {
|
|
675
|
+
readonly ACTIVE: "active";
|
|
676
|
+
readonly PENDING: "pending";
|
|
677
|
+
readonly UNAVAILABLE: "unavailable";
|
|
678
|
+
readonly UNKNOWN: "unknown";
|
|
679
|
+
};
|
|
680
|
+
type BnplMethodStatus = (typeof BNPL_METHOD_STATUS)[keyof typeof BNPL_METHOD_STATUS];
|
|
681
|
+
declare const BNPL_SKIP_REASON: {
|
|
682
|
+
readonly PENDING: "pending";
|
|
683
|
+
readonly NO_SUPPORT_EMAIL: "no_support_email";
|
|
684
|
+
readonly NO_CURRENCY: "no_currency";
|
|
685
|
+
readonly NO_BUSINESS_LINE: "no_business_line";
|
|
686
|
+
};
|
|
687
|
+
type BnplSkipReason = (typeof BNPL_SKIP_REASON)[keyof typeof BNPL_SKIP_REASON];
|
|
688
|
+
|
|
689
|
+
interface AdyenBnplSettings {
|
|
690
|
+
affirmPricePlan?: AffirmPricePlan;
|
|
691
|
+
affirm: BnplMethodStatus;
|
|
692
|
+
available: boolean;
|
|
693
|
+
}
|
|
694
|
+
interface AdyenBnplSkippedStore {
|
|
695
|
+
storeId: string;
|
|
696
|
+
reason: BnplSkipReason;
|
|
697
|
+
}
|
|
698
|
+
interface AdyenBnplUpdateResult {
|
|
699
|
+
updated: string[];
|
|
700
|
+
requested: string[];
|
|
701
|
+
skipped: AdyenBnplSkippedStore[];
|
|
702
|
+
}
|
|
703
|
+
|
|
666
704
|
declare const CURRENCY_CONFIG: Record<CurrencyCode | string, CurrencyConfig>;
|
|
667
705
|
declare function getCurrencyConfig(currency: CurrencyCode): CurrencyConfig;
|
|
668
706
|
declare function getMinorUnitMultiplier(currency: CurrencyCode): number;
|
|
@@ -1400,9 +1438,6 @@ declare function planWindow({ rule, timeZone, presence, startAt, endAt, now, bus
|
|
|
1400
1438
|
};
|
|
1401
1439
|
declare const holdExpiresAt: (rule: BookingRulesInput, now: Date) => Date;
|
|
1402
1440
|
|
|
1403
|
-
declare const ADYEN_ROLLOUT_COUNTRY_CODES: Set<string>;
|
|
1404
|
-
declare function isAdyenRolloutCountry(alpha2: string): boolean;
|
|
1405
|
-
|
|
1406
1441
|
interface CurrencyRate {
|
|
1407
1442
|
rate: number;
|
|
1408
1443
|
country: string;
|
|
@@ -1414,4 +1449,22 @@ declare const EUFixedRates: Record<string, CurrencyRate>;
|
|
|
1414
1449
|
declare const OtherFixedRates: Record<string, CurrencyRate>;
|
|
1415
1450
|
declare const COUNTRY_CURRENCIES: Record<string, string>;
|
|
1416
1451
|
|
|
1417
|
-
|
|
1452
|
+
declare enum ProcessorType {
|
|
1453
|
+
FINAL_PAY = "Terminal",
|
|
1454
|
+
TAP_TO_PAY = "TapToPay",
|
|
1455
|
+
MOTO = "Moto",
|
|
1456
|
+
CLOUD = "Cloud",
|
|
1457
|
+
BLUETOOTH = "Bluetooth",
|
|
1458
|
+
CASH = "Cash",
|
|
1459
|
+
CUSTOM_PAY = "CustomPay",
|
|
1460
|
+
VENDARA = "Vendara",
|
|
1461
|
+
REDEEM = "Redeem",
|
|
1462
|
+
INTEGRATION = "Integration",
|
|
1463
|
+
PAYMENT_LINK = "PaymentLink",
|
|
1464
|
+
ONLINE_PAYMENT = "OnlinePayment"
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1467
|
+
declare const PAYMENT_CHANNELS: readonly ["inPerson", "online"];
|
|
1468
|
+
type PaymentChannel = (typeof PAYMENT_CHANNELS)[number];
|
|
1469
|
+
|
|
1470
|
+
export { ADYEN_ROLLOUT_COUNTRY_CODES, AFFIRM_COUNTRY_CODES, AFFIRM_PRICE_PLANS, type AdyenBnplSettings, type AdyenBnplSkippedStore, type AdyenBnplUpdateResult, type AffirmPricePlan, type Amount, AttributeType, type AvailabilityInput, type AvailabilitySlot, type AvailableTransition, BNPL_METHOD_STATUS, BNPL_SKIP_REASON, type BnplMethodStatus, type BnplSkipReason, type BookingOccupancy, BookingRatePeriod, type BookingResourceInput, BookingResourceKind, BookingResourceStatus, BookingRulesError, type BookingRulesInput, BookingType, type BusyWindow, CONDITION_OPERATORS, COUNTRY_CURRENCIES, CURRENCY_CONFIG, type CartDiscountBucket, type CartFeeBucket, type CashDrawer, type CashRoundingTuple, CompanyType, type Condition, type ConditionGroup, type ConditionOperator, type ConfigUpdatedPayload, type ConfigValidationError, type ConfigValidationResult, type ConfigValidationWarning, type CrossAxisRequires, type CrossAxisRule, type CrossAxisTrigger, CurrencyCode, type CurrencyConfig, type CurrencyRate, CustomTableAvailability, CustomerPlatform, DEFAULT_CONFIG, DEFAULT_CROSS_AXIS_RULES, DEFAULT_DISPLAY_STATE_MAP, DEFAULT_HOLD_MINUTES, DEFAULT_RESOLVED_CONFIG, DEFAULT_UNIT_ID, type DeleteStateConfigFragmentParams, type DeleteStateConfigFragmentResponse, type DiscountsBreakdown, type DiscountsTuple, type DisplayStateResult, type DisplayStateRule, DualWriteStrategy, EUFixedRates, EUROPE, type EndOfSessionReport, ExtensionCategory, FINANCIAL_INVARIANTS, FULFILLMENT_STATES, type FailedCondition, type FeesBreakdown, FeesCustomBillingStatus, type FeesTuple, type FinancialInvariant, type FragmentParam, type FragmentValidationResult, type FulfillmentState, type FulfillmentStateDefinition, type FulfillmentTransitionPath, type GetAvailableTransitionsParams, type GetAvailableTransitionsResponse, type GetOrderDisplayStateParams, type GetOrderDisplayStateResponse, type GetOrderStateConfigParams, type GetOrderStateConfigResponse, type GetStateConfigFragmentParams, type GetStateConfigFragmentResponse, type GridSlot, InventoryBaseActionEnum, type InventoryBaseActionType, InventorySpecificActionType, InvoiceStatus, LegacyWriteStrategy, LibraryItemType, MAX_PRECISION, type Measurable, type MeasurementBase, type MeasurementUnit, type MeasurementUnitFamily, MenuProject, type ModifiersBreakdown, type ModifiersTuple, NAFixedRates, NORTH_AMERICA, NonRevenueItemType, ORDER_STATE_ACTIONS, ORDER_STATE_EVENTS, ORDER_STATE_TOPIC, type OrderContext, type OrderLikeForContext, type OrderLikeForLegacyInference, type OrderLineItem, type OrderMutationData, type OrderPaymentMethod, OrderPlatform, type OrderRefund, type OrderReservationForContext, type OrderStateEventPayload, type OrderStateWritable, type OrderWriteStrategy, OtherFixedRates, OwnerType, PATH_MODES, PAYMENT_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, PublicationAvailability, type PublicationConfig, PublicationStatus, REGION_MAPPING, REPORT_NEGATE_PATHS, ReceiptSendChannel, ReceiptType, type RefundsBreakdown, ReservationStatus, ResidualPaymentMethod, ResidualStatus, type ResolveTemplateResult, type ResourceAvailability, ResourceAvailabilityState, type ResourceInWindow, type ResourcePresenceRow, STATE_SCHEMA, STRIPE_SUPPORTED_COUNTRIES, SYSTEM_FAMILIES, SYSTEM_FAMILY_IDS, SYSTEM_UNITS, SYSTEM_UNIT_IDS, type SalesSummary, type SaveStateConfigFragmentParams, type SaveStateConfigFragmentResponse, type SettlementBreakdown, type SettlementBuckets, type SettlementCardSection, type SettlementCashSection, type SettlementCustomEntry, type SplitPayment, type SplitPaymentPayment, type StaffSales, type StaffSalesEntry, type StateConfig, type StateConfigFragment, type StateDefinition, type StatePair, type StateSchema, type StateTransitionBlockedPayload, type StateTransitionCompletedPayload, StationStatus, type StoredStateConfig, StripeCurrencyCode, StripeStatus, type TaxBreakdown, type TaxBreakdownRateEntry, type TaxBreakdownSection, type TaxBreakdownSubtotal, type TaxesTuple, TimePeriod, type TipEntry, type TipsBreakdown, type TipsTuple, TopMetericsSort, type TransitionBlockedBy, type TransitionConditionSet, type TransitionOrderStateParams, type TransitionOrderStateResponse, type TransitionPath, type TransitionRequest, type TransitionResult, UserTypes, type WeeklyHours, addAmounts, amountToString, assertUnitSane, availableIn, baseFor, baseFulfillmentDefinitions, baseOf, basePaymentDefinitions, buildAvailability, buildGrid, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, canTransition, conditionSummary, convertFixedFeeToLocalCurrency, createAmount, crossAxisRuleApplies, deriveDisplayState, deriveFamilyCode, deriveUnitId, displayRuleMatchesPair, divideAmount, evaluateCondition, evaluateConditionSet, extendPrice, extendPriceFor, formatCurrency, formatInUnit, formatMinorUnitsToString, formatQuantity, fromBase, fromMinorUnits, generateMongoID, getAvailableTransitions, getCashAmountDue, getCountriesByRegion, getCurrencyConfig, getCurrentISODate, getFinancialInvariantViolations, getGoodsPortion, getLineSubtotal, getMinorUnitMultiplier, getMinorUnits, getPaymentLegTotal, getPricingRegionFromCountry, getSettlementTotal, getTotalCollected, holdExpiresAt, inferStatesFromLegacyStatus, isAdyenRolloutCountry, isAffirmCountry, isAffirmPricePlan, isConditionOperator, isFulfillmentState, isPaymentState, isSupportedCurrency, isSystemFamilyCode, isValidQuantity, isWhole, mapToLegacyStatus, maxPrecisionFor, mergeFragment, multiplyAmount, normalizeMongoIdString, occupancyIn, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, planWindow, presentAt, removeFragment, resolveFamily, resolveTemplate, resolveUnit, roundToPrecision, sameFamily, setOrderState, shopDayKey, shopDayRange, signReportForDisplay, slotsForWindow, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, violatesFinancialInvariant, windowEndsAt, withinPresence };
|
package/dist/index.js
CHANGED
|
@@ -20,7 +20,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
var index_exports = {};
|
|
21
21
|
__export(index_exports, {
|
|
22
22
|
ADYEN_ROLLOUT_COUNTRY_CODES: () => ADYEN_ROLLOUT_COUNTRY_CODES,
|
|
23
|
+
AFFIRM_COUNTRY_CODES: () => AFFIRM_COUNTRY_CODES,
|
|
24
|
+
AFFIRM_PRICE_PLANS: () => AFFIRM_PRICE_PLANS,
|
|
23
25
|
AttributeType: () => AttributeType,
|
|
26
|
+
BNPL_METHOD_STATUS: () => BNPL_METHOD_STATUS,
|
|
27
|
+
BNPL_SKIP_REASON: () => BNPL_SKIP_REASON,
|
|
24
28
|
BookingRatePeriod: () => BookingRatePeriod,
|
|
25
29
|
BookingResourceKind: () => BookingResourceKind,
|
|
26
30
|
BookingResourceStatus: () => BookingResourceStatus,
|
|
@@ -63,6 +67,7 @@ __export(index_exports, {
|
|
|
63
67
|
OtherFixedRates: () => OtherFixedRates,
|
|
64
68
|
OwnerType: () => OwnerType,
|
|
65
69
|
PATH_MODES: () => PATH_MODES,
|
|
70
|
+
PAYMENT_CHANNELS: () => PAYMENT_CHANNELS,
|
|
66
71
|
PAYMENT_STATES: () => PAYMENT_STATES,
|
|
67
72
|
POS_VALID_INITIAL_STATES: () => POS_VALID_INITIAL_STATES,
|
|
68
73
|
PaymentMethod: () => PaymentMethod,
|
|
@@ -72,6 +77,7 @@ __export(index_exports, {
|
|
|
72
77
|
PricingLevel: () => PricingLevel,
|
|
73
78
|
PricingPlanEnum: () => PricingPlanEnum,
|
|
74
79
|
PricingRegionEnum: () => PricingRegionEnum,
|
|
80
|
+
ProcessorType: () => ProcessorType,
|
|
75
81
|
ProductStatus: () => ProductStatus,
|
|
76
82
|
ProductType: () => ProductType,
|
|
77
83
|
PublicationAvailability: () => PublicationAvailability,
|
|
@@ -148,6 +154,8 @@ __export(index_exports, {
|
|
|
148
154
|
holdExpiresAt: () => holdExpiresAt,
|
|
149
155
|
inferStatesFromLegacyStatus: () => inferStatesFromLegacyStatus,
|
|
150
156
|
isAdyenRolloutCountry: () => isAdyenRolloutCountry,
|
|
157
|
+
isAffirmCountry: () => isAffirmCountry,
|
|
158
|
+
isAffirmPricePlan: () => isAffirmPricePlan,
|
|
151
159
|
isConditionOperator: () => isConditionOperator,
|
|
152
160
|
isFulfillmentState: () => isFulfillmentState,
|
|
153
161
|
isPaymentState: () => isPaymentState,
|
|
@@ -391,6 +399,7 @@ var OrderPlatform = /* @__PURE__ */ ((OrderPlatform2) => {
|
|
|
391
399
|
OrderPlatform2["POS"] = "in-store";
|
|
392
400
|
OrderPlatform2["WOO_COMMERCE"] = "woo-commerce";
|
|
393
401
|
OrderPlatform2["PUBLIC_API"] = "public-api";
|
|
402
|
+
OrderPlatform2["ONLINE_STORE"] = "online-store";
|
|
394
403
|
return OrderPlatform2;
|
|
395
404
|
})(OrderPlatform || {});
|
|
396
405
|
var CustomerPlatform = /* @__PURE__ */ ((CustomerPlatform2) => {
|
|
@@ -3194,7 +3203,9 @@ function buildGrid(rule, timeZone, from, to, now, busy = []) {
|
|
|
3194
3203
|
const start = startAt.getTime();
|
|
3195
3204
|
if (start < askedFrom || start >= askedTo) return false;
|
|
3196
3205
|
if (start < notBefore || start > notAfter) return false;
|
|
3197
|
-
return !blocked.some(
|
|
3206
|
+
return !blocked.some(
|
|
3207
|
+
({ from: blockFrom, to: blockTo }) => start < blockTo && bufferEndAt.getTime() > blockFrom
|
|
3208
|
+
);
|
|
3198
3209
|
}).sort((first, second) => +first.startAt - +second.startAt);
|
|
3199
3210
|
}
|
|
3200
3211
|
function slotsForWindow(grid, startAt, endAt) {
|
|
@@ -3313,7 +3324,14 @@ function buildAvailability({
|
|
|
3313
3324
|
for (const slot of slots2) {
|
|
3314
3325
|
const { taken, foreignProductId } = occupancyIn(mine, productId, slot.startAt, slot.bufferEndAt, shared);
|
|
3315
3326
|
const free = foreignProductId ? 0 : Math.max(capacity - taken, 0);
|
|
3316
|
-
const entry = byInstant.get(+slot.startAt) ?? {
|
|
3327
|
+
const entry = byInstant.get(+slot.startAt) ?? {
|
|
3328
|
+
...slot,
|
|
3329
|
+
capacity: 0,
|
|
3330
|
+
booked: 0,
|
|
3331
|
+
free: 0,
|
|
3332
|
+
resources: [],
|
|
3333
|
+
dayKey: shopDayKey(slot.startAt, resource.timeZone)
|
|
3334
|
+
};
|
|
3317
3335
|
entry.capacity += capacity;
|
|
3318
3336
|
entry.booked += foreignProductId ? capacity : taken;
|
|
3319
3337
|
entry.free += free;
|
|
@@ -3391,10 +3409,54 @@ var ADYEN_ROLLOUT_COUNTRY_CODES = /* @__PURE__ */ new Set(["CA"]);
|
|
|
3391
3409
|
function isAdyenRolloutCountry(alpha2) {
|
|
3392
3410
|
return ADYEN_ROLLOUT_COUNTRY_CODES.has(alpha2);
|
|
3393
3411
|
}
|
|
3412
|
+
var AFFIRM_PRICE_PLANS = ["core", "standard", "signature"];
|
|
3413
|
+
function isAffirmPricePlan(value) {
|
|
3414
|
+
return typeof value === "string" && AFFIRM_PRICE_PLANS.includes(value);
|
|
3415
|
+
}
|
|
3416
|
+
var AFFIRM_COUNTRY_CODES = /* @__PURE__ */ new Set(["CA"]);
|
|
3417
|
+
function isAffirmCountry(alpha2) {
|
|
3418
|
+
return !!alpha2 && AFFIRM_COUNTRY_CODES.has(alpha2.toUpperCase());
|
|
3419
|
+
}
|
|
3420
|
+
var BNPL_METHOD_STATUS = {
|
|
3421
|
+
ACTIVE: "active",
|
|
3422
|
+
PENDING: "pending",
|
|
3423
|
+
UNAVAILABLE: "unavailable",
|
|
3424
|
+
UNKNOWN: "unknown"
|
|
3425
|
+
};
|
|
3426
|
+
var BNPL_SKIP_REASON = {
|
|
3427
|
+
PENDING: "pending",
|
|
3428
|
+
NO_SUPPORT_EMAIL: "no_support_email",
|
|
3429
|
+
NO_CURRENCY: "no_currency",
|
|
3430
|
+
NO_BUSINESS_LINE: "no_business_line"
|
|
3431
|
+
};
|
|
3432
|
+
|
|
3433
|
+
// pos-types/active/ProcessorType.ts
|
|
3434
|
+
var ProcessorType = /* @__PURE__ */ ((ProcessorType2) => {
|
|
3435
|
+
ProcessorType2["FINAL_PAY"] = "Terminal";
|
|
3436
|
+
ProcessorType2["TAP_TO_PAY"] = "TapToPay";
|
|
3437
|
+
ProcessorType2["MOTO"] = "Moto";
|
|
3438
|
+
ProcessorType2["CLOUD"] = "Cloud";
|
|
3439
|
+
ProcessorType2["BLUETOOTH"] = "Bluetooth";
|
|
3440
|
+
ProcessorType2["CASH"] = "Cash";
|
|
3441
|
+
ProcessorType2["CUSTOM_PAY"] = "CustomPay";
|
|
3442
|
+
ProcessorType2["VENDARA"] = "Vendara";
|
|
3443
|
+
ProcessorType2["REDEEM"] = "Redeem";
|
|
3444
|
+
ProcessorType2["INTEGRATION"] = "Integration";
|
|
3445
|
+
ProcessorType2["PAYMENT_LINK"] = "PaymentLink";
|
|
3446
|
+
ProcessorType2["ONLINE_PAYMENT"] = "OnlinePayment";
|
|
3447
|
+
return ProcessorType2;
|
|
3448
|
+
})(ProcessorType || {});
|
|
3449
|
+
|
|
3450
|
+
// constants/payment-channel.constants.ts
|
|
3451
|
+
var PAYMENT_CHANNELS = ["inPerson", "online"];
|
|
3394
3452
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3395
3453
|
0 && (module.exports = {
|
|
3396
3454
|
ADYEN_ROLLOUT_COUNTRY_CODES,
|
|
3455
|
+
AFFIRM_COUNTRY_CODES,
|
|
3456
|
+
AFFIRM_PRICE_PLANS,
|
|
3397
3457
|
AttributeType,
|
|
3458
|
+
BNPL_METHOD_STATUS,
|
|
3459
|
+
BNPL_SKIP_REASON,
|
|
3398
3460
|
BookingRatePeriod,
|
|
3399
3461
|
BookingResourceKind,
|
|
3400
3462
|
BookingResourceStatus,
|
|
@@ -3437,6 +3499,7 @@ function isAdyenRolloutCountry(alpha2) {
|
|
|
3437
3499
|
OtherFixedRates,
|
|
3438
3500
|
OwnerType,
|
|
3439
3501
|
PATH_MODES,
|
|
3502
|
+
PAYMENT_CHANNELS,
|
|
3440
3503
|
PAYMENT_STATES,
|
|
3441
3504
|
POS_VALID_INITIAL_STATES,
|
|
3442
3505
|
PaymentMethod,
|
|
@@ -3446,6 +3509,7 @@ function isAdyenRolloutCountry(alpha2) {
|
|
|
3446
3509
|
PricingLevel,
|
|
3447
3510
|
PricingPlanEnum,
|
|
3448
3511
|
PricingRegionEnum,
|
|
3512
|
+
ProcessorType,
|
|
3449
3513
|
ProductStatus,
|
|
3450
3514
|
ProductType,
|
|
3451
3515
|
PublicationAvailability,
|
|
@@ -3522,6 +3586,8 @@ function isAdyenRolloutCountry(alpha2) {
|
|
|
3522
3586
|
holdExpiresAt,
|
|
3523
3587
|
inferStatesFromLegacyStatus,
|
|
3524
3588
|
isAdyenRolloutCountry,
|
|
3589
|
+
isAffirmCountry,
|
|
3590
|
+
isAffirmPricePlan,
|
|
3525
3591
|
isConditionOperator,
|
|
3526
3592
|
isFulfillmentState,
|
|
3527
3593
|
isPaymentState,
|