@final-commerce/common 2.0.3 → 2.0.5
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 +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +2 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -16
- package/dist/index.mjs.map +1 -1
- package/dist/pos-types/index.d.mts +9 -3
- package/dist/pos-types/index.d.ts +9 -3
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -899,7 +899,6 @@ declare const DEFAULT_CONFIG: StoredStateConfig;
|
|
|
899
899
|
declare function buildResolvedConfig(config: StoredStateConfig): StateConfig;
|
|
900
900
|
declare const DEFAULT_RESOLVED_CONFIG: StateConfig;
|
|
901
901
|
|
|
902
|
-
declare const POS_CROSS_AXIS_RULES: readonly CrossAxisRule[];
|
|
903
902
|
declare const POS_VALID_INITIAL_STATES: readonly StatePair[];
|
|
904
903
|
declare function buildPosPresetConfig(companyId?: string): StoredStateConfig;
|
|
905
904
|
|
|
@@ -1059,4 +1058,4 @@ declare const EUFixedRates: Record<string, CurrencyRate>;
|
|
|
1059
1058
|
declare const OtherFixedRates: Record<string, CurrencyRate>;
|
|
1060
1059
|
declare const COUNTRY_CURRENCIES: Record<string, string>;
|
|
1061
1060
|
|
|
1062
|
-
export { type Amount, AttributeType, type AvailableTransition, 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_RESOLVED_CONFIG, type DeleteStateConfigFragmentParams, type DeleteStateConfigFragmentResponse, type DiscountsBreakdown, type DiscountsTuple, type DisplayStateResult, type DisplayStateRule, 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, InventoryBaseActionEnum, type InventoryBaseActionType, InventorySpecificActionType, InvoiceStatus, LibraryItemType, MenuProject, NAFixedRates, NORTH_AMERICA, NonRevenueItemType, ORDER_STATE_ACTIONS, ORDER_STATE_EVENTS, ORDER_STATE_TOPIC, type OrderContext, type OrderLikeForContext, type OrderLikeForLegacyInference, type OrderLineItem, type OrderPaymentMethod, OrderPlatform, type OrderRefund, type OrderStateEventPayload, type OrderStateWritable, OtherFixedRates, OwnerType, PATH_MODES, PAYMENT_STATES,
|
|
1061
|
+
export { type Amount, AttributeType, type AvailableTransition, 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_RESOLVED_CONFIG, type DeleteStateConfigFragmentParams, type DeleteStateConfigFragmentResponse, type DiscountsBreakdown, type DiscountsTuple, type DisplayStateResult, type DisplayStateRule, 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, InventoryBaseActionEnum, type InventoryBaseActionType, InventorySpecificActionType, InvoiceStatus, LibraryItemType, MenuProject, NAFixedRates, NORTH_AMERICA, NonRevenueItemType, ORDER_STATE_ACTIONS, ORDER_STATE_EVENTS, ORDER_STATE_TOPIC, type OrderContext, type OrderLikeForContext, type OrderLikeForLegacyInference, type OrderLineItem, type OrderPaymentMethod, OrderPlatform, type OrderRefund, type OrderStateEventPayload, type OrderStateWritable, OtherFixedRates, OwnerType, PATH_MODES, PAYMENT_STATES, POS_VALID_INITIAL_STATES, type PathMode, PaymentMethod, type PaymentState, type PaymentStateDefinition, type PaymentTransitionPath, Platform, PreviewImageMode, PricingLevel, PricingPlanEnum, PricingRegionEnum, type ProductDiscountBucket, type ProductFeeBucket, ProductStatus, ProductType, PublicationAvailability, type PublicationConfig, PublicationStatus, REGION_MAPPING, REPORT_NEGATE_PATHS, ReceiptSendChannel, ReceiptType, type RefundsBreakdown, ResidualPaymentMethod, ResidualStatus, type ResolveTemplateResult, STATE_SCHEMA, STRIPE_SUPPORTED_COUNTRIES, type SalesSummary, type SaveStateConfigFragmentParams, type SaveStateConfigFragmentResponse, type SettlementBreakdown, 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, addAmounts, amountToString, baseFulfillmentDefinitions, basePaymentDefinitions, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, canTransition, conditionSummary, convertFixedFeeToLocalCurrency, createAmount, crossAxisRuleApplies, deriveDisplayState, displayRuleMatchesPair, divideAmount, evaluateCondition, evaluateConditionSet, formatCurrency, formatMinorUnitsToString, fromMinorUnits, generateMongoID, getAvailableTransitions, getCountriesByRegion, getCurrencyConfig, getCurrentISODate, getFinancialInvariantViolations, getMinorUnitMultiplier, getMinorUnits, getPricingRegionFromCountry, inferStatesFromLegacyStatus, isConditionOperator, isFulfillmentState, isPaymentState, isSupportedCurrency, mapToLegacyStatus, mergeFragment, multiplyAmount, normalizeMongoIdString, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, removeFragment, resolveTemplate, setOrderState, signReportForDisplay, stringifyMinorUnits, subtractAmounts, toMinorUnits, validateConfig, validateFragmentCompatibility, violatesFinancialInvariant };
|
package/dist/index.d.ts
CHANGED
|
@@ -899,7 +899,6 @@ declare const DEFAULT_CONFIG: StoredStateConfig;
|
|
|
899
899
|
declare function buildResolvedConfig(config: StoredStateConfig): StateConfig;
|
|
900
900
|
declare const DEFAULT_RESOLVED_CONFIG: StateConfig;
|
|
901
901
|
|
|
902
|
-
declare const POS_CROSS_AXIS_RULES: readonly CrossAxisRule[];
|
|
903
902
|
declare const POS_VALID_INITIAL_STATES: readonly StatePair[];
|
|
904
903
|
declare function buildPosPresetConfig(companyId?: string): StoredStateConfig;
|
|
905
904
|
|
|
@@ -1059,4 +1058,4 @@ declare const EUFixedRates: Record<string, CurrencyRate>;
|
|
|
1059
1058
|
declare const OtherFixedRates: Record<string, CurrencyRate>;
|
|
1060
1059
|
declare const COUNTRY_CURRENCIES: Record<string, string>;
|
|
1061
1060
|
|
|
1062
|
-
export { type Amount, AttributeType, type AvailableTransition, 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_RESOLVED_CONFIG, type DeleteStateConfigFragmentParams, type DeleteStateConfigFragmentResponse, type DiscountsBreakdown, type DiscountsTuple, type DisplayStateResult, type DisplayStateRule, 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, InventoryBaseActionEnum, type InventoryBaseActionType, InventorySpecificActionType, InvoiceStatus, LibraryItemType, MenuProject, NAFixedRates, NORTH_AMERICA, NonRevenueItemType, ORDER_STATE_ACTIONS, ORDER_STATE_EVENTS, ORDER_STATE_TOPIC, type OrderContext, type OrderLikeForContext, type OrderLikeForLegacyInference, type OrderLineItem, type OrderPaymentMethod, OrderPlatform, type OrderRefund, type OrderStateEventPayload, type OrderStateWritable, OtherFixedRates, OwnerType, PATH_MODES, PAYMENT_STATES,
|
|
1061
|
+
export { type Amount, AttributeType, type AvailableTransition, 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_RESOLVED_CONFIG, type DeleteStateConfigFragmentParams, type DeleteStateConfigFragmentResponse, type DiscountsBreakdown, type DiscountsTuple, type DisplayStateResult, type DisplayStateRule, 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, InventoryBaseActionEnum, type InventoryBaseActionType, InventorySpecificActionType, InvoiceStatus, LibraryItemType, MenuProject, NAFixedRates, NORTH_AMERICA, NonRevenueItemType, ORDER_STATE_ACTIONS, ORDER_STATE_EVENTS, ORDER_STATE_TOPIC, type OrderContext, type OrderLikeForContext, type OrderLikeForLegacyInference, type OrderLineItem, type OrderPaymentMethod, OrderPlatform, type OrderRefund, type OrderStateEventPayload, type OrderStateWritable, OtherFixedRates, OwnerType, PATH_MODES, PAYMENT_STATES, POS_VALID_INITIAL_STATES, type PathMode, PaymentMethod, type PaymentState, type PaymentStateDefinition, type PaymentTransitionPath, Platform, PreviewImageMode, PricingLevel, PricingPlanEnum, PricingRegionEnum, type ProductDiscountBucket, type ProductFeeBucket, ProductStatus, ProductType, PublicationAvailability, type PublicationConfig, PublicationStatus, REGION_MAPPING, REPORT_NEGATE_PATHS, ReceiptSendChannel, ReceiptType, type RefundsBreakdown, ResidualPaymentMethod, ResidualStatus, type ResolveTemplateResult, STATE_SCHEMA, STRIPE_SUPPORTED_COUNTRIES, type SalesSummary, type SaveStateConfigFragmentParams, type SaveStateConfigFragmentResponse, type SettlementBreakdown, 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, addAmounts, amountToString, baseFulfillmentDefinitions, basePaymentDefinitions, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, canTransition, conditionSummary, convertFixedFeeToLocalCurrency, createAmount, crossAxisRuleApplies, deriveDisplayState, displayRuleMatchesPair, divideAmount, evaluateCondition, evaluateConditionSet, formatCurrency, formatMinorUnitsToString, fromMinorUnits, generateMongoID, getAvailableTransitions, getCountriesByRegion, getCurrencyConfig, getCurrentISODate, getFinancialInvariantViolations, getMinorUnitMultiplier, getMinorUnits, getPricingRegionFromCountry, inferStatesFromLegacyStatus, isConditionOperator, isFulfillmentState, isPaymentState, isSupportedCurrency, mapToLegacyStatus, mergeFragment, multiplyAmount, normalizeMongoIdString, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, removeFragment, resolveTemplate, setOrderState, signReportForDisplay, stringifyMinorUnits, subtractAmounts, toMinorUnits, validateConfig, validateFragmentCompatibility, violatesFinancialInvariant };
|
package/dist/index.js
CHANGED
|
@@ -53,7 +53,6 @@ __export(index_exports, {
|
|
|
53
53
|
OwnerType: () => OwnerType,
|
|
54
54
|
PATH_MODES: () => PATH_MODES,
|
|
55
55
|
PAYMENT_STATES: () => PAYMENT_STATES,
|
|
56
|
-
POS_CROSS_AXIS_RULES: () => POS_CROSS_AXIS_RULES,
|
|
57
56
|
POS_VALID_INITIAL_STATES: () => POS_VALID_INITIAL_STATES,
|
|
58
57
|
PaymentMethod: () => PaymentMethod,
|
|
59
58
|
Platform: () => Platform,
|
|
@@ -1402,7 +1401,7 @@ var DEFAULT_CONFIG = {
|
|
|
1402
1401
|
fulfillmentPaths: [],
|
|
1403
1402
|
paymentPathMode: "permissive",
|
|
1404
1403
|
fulfillmentPathMode: "permissive",
|
|
1405
|
-
crossAxisRules: [
|
|
1404
|
+
crossAxisRules: [],
|
|
1406
1405
|
transitionConditions: [],
|
|
1407
1406
|
validInitialStates: [{ payment: "unpaid", fulfillment: "draft" }],
|
|
1408
1407
|
displayStateMap: [...DEFAULT_DISPLAY_STATE_MAP],
|
|
@@ -1419,19 +1418,6 @@ function buildResolvedConfig(config) {
|
|
|
1419
1418
|
var DEFAULT_RESOLVED_CONFIG = buildResolvedConfig(DEFAULT_CONFIG);
|
|
1420
1419
|
|
|
1421
1420
|
// order-state-machine/pos-preset.ts
|
|
1422
|
-
var POS_CROSS_AXIS_RULES = [
|
|
1423
|
-
{
|
|
1424
|
-
id: "pos-pay-requires-open-fulfillment",
|
|
1425
|
-
label: "Payments only on open fulfillment states",
|
|
1426
|
-
description: "POS payments are only valid on orders whose fulfillment is open (draft / pending / on_hold) or auto-fulfilled in lock-step (fulfilled). Returned / cancelled / in-progress fulfillment must use refund flows instead.",
|
|
1427
|
-
enabled: true,
|
|
1428
|
-
trigger: { axis: "payment", to: ["payment_pending", "paid", "partially_paid"] },
|
|
1429
|
-
requires: {
|
|
1430
|
-
axis: "fulfillment",
|
|
1431
|
-
states: ["draft", "pending", "on_hold", "fulfilled"]
|
|
1432
|
-
}
|
|
1433
|
-
}
|
|
1434
|
-
];
|
|
1435
1421
|
var POS_VALID_INITIAL_STATES = [
|
|
1436
1422
|
{ payment: "unpaid", fulfillment: "draft" },
|
|
1437
1423
|
{ payment: "unpaid", fulfillment: "on_hold" },
|
|
@@ -1446,7 +1432,7 @@ function buildPosPresetConfig(companyId) {
|
|
|
1446
1432
|
_id: "pos-preset",
|
|
1447
1433
|
companyId: companyId ?? DEFAULT_CONFIG.companyId,
|
|
1448
1434
|
name: "POS Preset",
|
|
1449
|
-
crossAxisRules: [
|
|
1435
|
+
crossAxisRules: [],
|
|
1450
1436
|
validInitialStates: [...POS_VALID_INITIAL_STATES],
|
|
1451
1437
|
displayStateMap: [...DEFAULT_DISPLAY_STATE_MAP]
|
|
1452
1438
|
};
|
|
@@ -2620,7 +2606,6 @@ var ORDER_STATE_EVENTS = {
|
|
|
2620
2606
|
OwnerType,
|
|
2621
2607
|
PATH_MODES,
|
|
2622
2608
|
PAYMENT_STATES,
|
|
2623
|
-
POS_CROSS_AXIS_RULES,
|
|
2624
2609
|
POS_VALID_INITIAL_STATES,
|
|
2625
2610
|
PaymentMethod,
|
|
2626
2611
|
Platform,
|