@final-commerce/common 2.1.1 → 2.2.0-beta.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/bin/gate-save.mjs +20 -1
- package/dist/index.d.mts +78 -1
- package/dist/index.d.ts +78 -1
- package/dist/index.js +325 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +299 -1
- package/dist/index.mjs.map +1 -1
- package/dist/pos-types/index.d.mts +35 -0
- package/dist/pos-types/index.d.ts +35 -0
- package/package.json +1 -1
package/bin/gate-save.mjs
CHANGED
|
@@ -81,7 +81,26 @@ if (existsSync(pkgJsonPath)) {
|
|
|
81
81
|
/* ignore */
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
// Only when this commit actually moves a translatable string.
|
|
85
|
+
//
|
|
86
|
+
// The sync diffs every key found in src/ against en.json — not the keys this commit
|
|
87
|
+
// introduces. So one --no-verify anywhere leaves en.json behind, and from then on every
|
|
88
|
+
// commit by everyone re-pulls the whole bundle and rewrites all the locale files. That
|
|
89
|
+
// churn is what makes unrelated branches conflict in src/locales/.
|
|
90
|
+
//
|
|
91
|
+
// Gating on the staged diff leaves a string-free commit alone. `npm run i18n:sync` still
|
|
92
|
+
// pulls other people's translations on purpose, and SKIP_I18N_SYNC=1 still bypasses.
|
|
93
|
+
//
|
|
94
|
+
// The pattern reads only real diff lines (`^[+-][^+-]` drops the +++/--- headers), and
|
|
95
|
+
// `\bt\(` is word-bounded so `format(` does not match while `t('…')` and `.t(` do. It
|
|
96
|
+
// catches removals too, which is how an orphaned key gets noticed.
|
|
97
|
+
const touchesStrings = capture(
|
|
98
|
+
String.raw`git diff --cached -U0 -- '*.ts' '*.tsx' '*.mts' '*.cts' '*.js' '*.jsx' '*.mjs' '*.cjs'`,
|
|
99
|
+
);
|
|
100
|
+
const hasStringChange =
|
|
101
|
+
touchesStrings.status === 0 && /^[+-][^+-].*(\bt\(|<Trans\b|i18nKey)/m.test(touchesStrings.stdout);
|
|
102
|
+
|
|
103
|
+
if (rootPkg?.['fc-i18n']?.slug && hasStringChange) {
|
|
85
104
|
info('Running i18n sync…');
|
|
86
105
|
const syncResult = run('npx gate-i18n-sync');
|
|
87
106
|
if (syncResult.status !== 0) {
|
package/dist/index.d.mts
CHANGED
|
@@ -216,6 +216,7 @@ declare enum InventorySpecificActionType {
|
|
|
216
216
|
REFUND_RESTOCK_RETURN = "REFUND_RESTOCK_RETURN",
|
|
217
217
|
REFUND_DAMAGE = "REFUND_DAMAGE",
|
|
218
218
|
SALE = "SALE",
|
|
219
|
+
COMPOSED_FOR_SALE = "COMPOSED_FOR_SALE",
|
|
219
220
|
TRANSFER = "TRANSFER",
|
|
220
221
|
BULK_RECOUNT = "BULK_RECOUNT",
|
|
221
222
|
APPLIED_FROM_WOO = "APPLIED_FROM_WOO",
|
|
@@ -652,6 +653,82 @@ declare function generateMongoID(): string;
|
|
|
652
653
|
declare function getCurrentISODate(): string;
|
|
653
654
|
declare function normalizeMongoIdString(value: unknown): string | null;
|
|
654
655
|
|
|
656
|
+
interface Measurable {
|
|
657
|
+
name: string;
|
|
658
|
+
abbreviation: string;
|
|
659
|
+
ratioToBase: number;
|
|
660
|
+
precision: number;
|
|
661
|
+
}
|
|
662
|
+
interface MeasurementBase {
|
|
663
|
+
name: string;
|
|
664
|
+
abbreviation: string;
|
|
665
|
+
readonly ratioToBase: 1;
|
|
666
|
+
readonly precision: 0;
|
|
667
|
+
}
|
|
668
|
+
interface MeasurementUnitFamily {
|
|
669
|
+
familyId: string;
|
|
670
|
+
companyId: string | null;
|
|
671
|
+
name: string;
|
|
672
|
+
base: MeasurementBase;
|
|
673
|
+
}
|
|
674
|
+
interface MeasurementUnit {
|
|
675
|
+
unitId: string;
|
|
676
|
+
companyId: string | null;
|
|
677
|
+
familyId: string;
|
|
678
|
+
name: string;
|
|
679
|
+
abbreviation: string;
|
|
680
|
+
ratioToBase: number;
|
|
681
|
+
precision: number;
|
|
682
|
+
systemKey?: string;
|
|
683
|
+
sellable?: false;
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
declare const SYSTEM_FAMILY_IDS: {
|
|
687
|
+
readonly COUNT: "count";
|
|
688
|
+
readonly WEIGHT: "weight-metric";
|
|
689
|
+
readonly WEIGHT_IMPERIAL: "weight-imperial";
|
|
690
|
+
readonly VOLUME: "volume-metric";
|
|
691
|
+
readonly VOLUME_IMPERIAL: "volume-imperial";
|
|
692
|
+
readonly LENGTH: "length-metric";
|
|
693
|
+
readonly LENGTH_IMPERIAL: "length-imperial";
|
|
694
|
+
readonly AREA: "area-metric";
|
|
695
|
+
readonly AREA_IMPERIAL: "area-imperial";
|
|
696
|
+
};
|
|
697
|
+
declare const SYSTEM_UNIT_IDS: {
|
|
698
|
+
readonly EACH: "EA";
|
|
699
|
+
readonly GRAM: "GRM";
|
|
700
|
+
readonly KILOGRAM: "KGM";
|
|
701
|
+
readonly HECTOGRAM: "HGM";
|
|
702
|
+
readonly MILLILITRE: "MLT";
|
|
703
|
+
readonly LITRE: "LTR";
|
|
704
|
+
};
|
|
705
|
+
declare const SYSTEM_FAMILIES: readonly MeasurementUnitFamily[];
|
|
706
|
+
declare const SYSTEM_UNITS: readonly MeasurementUnit[];
|
|
707
|
+
declare const DEFAULT_UNIT_ID: "EA";
|
|
708
|
+
|
|
709
|
+
declare function isWhole(value: number): boolean;
|
|
710
|
+
declare const MAX_PRECISION = 5;
|
|
711
|
+
declare function resolveUnit(unitId: string, companyUnits?: readonly MeasurementUnit[]): MeasurementUnit;
|
|
712
|
+
declare function resolveFamily(familyId: string, companyFamilies?: readonly MeasurementUnitFamily[]): MeasurementUnitFamily;
|
|
713
|
+
declare function baseOf(familyId: string, companyFamilies?: readonly MeasurementUnitFamily[]): MeasurementBase;
|
|
714
|
+
declare function baseFor(unit: MeasurementUnit, companyFamilies?: readonly MeasurementUnitFamily[]): MeasurementBase;
|
|
715
|
+
declare function sameFamily(a: MeasurementUnit, b: MeasurementUnit): boolean;
|
|
716
|
+
declare function assertUnitSane(unit: Measurable): void;
|
|
717
|
+
declare function maxPrecisionFor(ratioToBase: number): number;
|
|
718
|
+
declare function isValidQuantity(quantity: number, unit: Measurable): boolean;
|
|
719
|
+
declare function toBase(quantity: number, unit: Measurable): number;
|
|
720
|
+
declare function fromBase(baseQuantity: number, unit: Measurable): number;
|
|
721
|
+
declare function availableIn(baseQuantity: number, unit: Measurable): number;
|
|
722
|
+
declare function formatQuantity(baseQuantity: number, unit: Measurable): string;
|
|
723
|
+
declare function formatInUnit(quantity: number, unit: Measurable): string;
|
|
724
|
+
declare function roundToPrecision(quantity: number, precision: number): number;
|
|
725
|
+
declare function extendPrice(priceMinor: number, quantity: number): number;
|
|
726
|
+
declare function extendPriceFor(priceMinor: number, quantity: number, unit: Measurable): number;
|
|
727
|
+
|
|
728
|
+
declare function deriveFamilyCode(name: string, companyId: string, takenCodes?: Iterable<string>): string;
|
|
729
|
+
declare function isSystemFamilyCode(code: string): boolean;
|
|
730
|
+
declare function deriveUnitId(abbreviation: string, documentId: string): string;
|
|
731
|
+
|
|
655
732
|
type PaymentState = 'unpaid' | 'payment_pending' | 'partially_paid' | 'paid' | 'partially_refunded' | 'refunded' | 'voided';
|
|
656
733
|
type FulfillmentState = 'draft' | 'pending' | 'on_hold' | 'in_progress' | 'fulfilled' | 'partially_fulfilled' | 'returned' | 'partially_returned' | 'cancelled';
|
|
657
734
|
declare const PAYMENT_STATES: readonly PaymentState[];
|
|
@@ -1113,4 +1190,4 @@ declare const EUFixedRates: Record<string, CurrencyRate>;
|
|
|
1113
1190
|
declare const OtherFixedRates: Record<string, CurrencyRate>;
|
|
1114
1191
|
declare const COUNTRY_CURRENCIES: Record<string, string>;
|
|
1115
1192
|
|
|
1116
|
-
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, 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, InventoryBaseActionEnum, type InventoryBaseActionType, InventorySpecificActionType, InvoiceStatus, LegacyWriteStrategy, LibraryItemType, MenuProject, 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 OrderStateEventPayload, type OrderStateWritable, type OrderWriteStrategy, OtherFixedRates, OwnerType, PATH_MODES, PAYMENT_STATES, POS_VALID_INITIAL_STATES, type PathMode, PaymentMethod, PaymentProcessor, 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 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, addAmounts, amountToString, baseFulfillmentDefinitions, basePaymentDefinitions, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, canTransition, conditionSummary, convertFixedFeeToLocalCurrency, createAmount, crossAxisRuleApplies, deriveDisplayState, displayRuleMatchesPair, divideAmount, evaluateCondition, evaluateConditionSet, formatCurrency, formatMinorUnitsToString, fromMinorUnits, generateMongoID, getAvailableTransitions, getCashAmountDue, getCountriesByRegion, getCurrencyConfig, getCurrentISODate, getFinancialInvariantViolations, getGoodsPortion, getLineSubtotal, getMinorUnitMultiplier, getMinorUnits, getPaymentLegTotal, getPricingRegionFromCountry, getSettlementTotal, getTotalCollected, inferStatesFromLegacyStatus, isConditionOperator, isFulfillmentState, isPaymentState, isSupportedCurrency, mapToLegacyStatus, mergeFragment, multiplyAmount, normalizeMongoIdString, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, removeFragment, resolveTemplate, setOrderState, signReportForDisplay, stringifyMinorUnits, subtractAmounts, toMinorUnits, validateConfig, validateFragmentCompatibility, violatesFinancialInvariant };
|
|
1193
|
+
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, 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, InventoryBaseActionEnum, type InventoryBaseActionType, InventorySpecificActionType, InvoiceStatus, LegacyWriteStrategy, LibraryItemType, MAX_PRECISION, type Measurable, type MeasurementBase, type MeasurementUnit, type MeasurementUnitFamily, MenuProject, 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 OrderStateEventPayload, type OrderStateWritable, type OrderWriteStrategy, OtherFixedRates, OwnerType, PATH_MODES, PAYMENT_STATES, POS_VALID_INITIAL_STATES, type PathMode, PaymentMethod, PaymentProcessor, 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, 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, addAmounts, amountToString, assertUnitSane, availableIn, baseFor, baseFulfillmentDefinitions, baseOf, basePaymentDefinitions, 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, inferStatesFromLegacyStatus, isConditionOperator, isFulfillmentState, isPaymentState, isSupportedCurrency, isSystemFamilyCode, isValidQuantity, isWhole, mapToLegacyStatus, maxPrecisionFor, mergeFragment, multiplyAmount, normalizeMongoIdString, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, removeFragment, resolveFamily, resolveTemplate, resolveUnit, roundToPrecision, sameFamily, setOrderState, signReportForDisplay, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, violatesFinancialInvariant };
|
package/dist/index.d.ts
CHANGED
|
@@ -216,6 +216,7 @@ declare enum InventorySpecificActionType {
|
|
|
216
216
|
REFUND_RESTOCK_RETURN = "REFUND_RESTOCK_RETURN",
|
|
217
217
|
REFUND_DAMAGE = "REFUND_DAMAGE",
|
|
218
218
|
SALE = "SALE",
|
|
219
|
+
COMPOSED_FOR_SALE = "COMPOSED_FOR_SALE",
|
|
219
220
|
TRANSFER = "TRANSFER",
|
|
220
221
|
BULK_RECOUNT = "BULK_RECOUNT",
|
|
221
222
|
APPLIED_FROM_WOO = "APPLIED_FROM_WOO",
|
|
@@ -652,6 +653,82 @@ declare function generateMongoID(): string;
|
|
|
652
653
|
declare function getCurrentISODate(): string;
|
|
653
654
|
declare function normalizeMongoIdString(value: unknown): string | null;
|
|
654
655
|
|
|
656
|
+
interface Measurable {
|
|
657
|
+
name: string;
|
|
658
|
+
abbreviation: string;
|
|
659
|
+
ratioToBase: number;
|
|
660
|
+
precision: number;
|
|
661
|
+
}
|
|
662
|
+
interface MeasurementBase {
|
|
663
|
+
name: string;
|
|
664
|
+
abbreviation: string;
|
|
665
|
+
readonly ratioToBase: 1;
|
|
666
|
+
readonly precision: 0;
|
|
667
|
+
}
|
|
668
|
+
interface MeasurementUnitFamily {
|
|
669
|
+
familyId: string;
|
|
670
|
+
companyId: string | null;
|
|
671
|
+
name: string;
|
|
672
|
+
base: MeasurementBase;
|
|
673
|
+
}
|
|
674
|
+
interface MeasurementUnit {
|
|
675
|
+
unitId: string;
|
|
676
|
+
companyId: string | null;
|
|
677
|
+
familyId: string;
|
|
678
|
+
name: string;
|
|
679
|
+
abbreviation: string;
|
|
680
|
+
ratioToBase: number;
|
|
681
|
+
precision: number;
|
|
682
|
+
systemKey?: string;
|
|
683
|
+
sellable?: false;
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
declare const SYSTEM_FAMILY_IDS: {
|
|
687
|
+
readonly COUNT: "count";
|
|
688
|
+
readonly WEIGHT: "weight-metric";
|
|
689
|
+
readonly WEIGHT_IMPERIAL: "weight-imperial";
|
|
690
|
+
readonly VOLUME: "volume-metric";
|
|
691
|
+
readonly VOLUME_IMPERIAL: "volume-imperial";
|
|
692
|
+
readonly LENGTH: "length-metric";
|
|
693
|
+
readonly LENGTH_IMPERIAL: "length-imperial";
|
|
694
|
+
readonly AREA: "area-metric";
|
|
695
|
+
readonly AREA_IMPERIAL: "area-imperial";
|
|
696
|
+
};
|
|
697
|
+
declare const SYSTEM_UNIT_IDS: {
|
|
698
|
+
readonly EACH: "EA";
|
|
699
|
+
readonly GRAM: "GRM";
|
|
700
|
+
readonly KILOGRAM: "KGM";
|
|
701
|
+
readonly HECTOGRAM: "HGM";
|
|
702
|
+
readonly MILLILITRE: "MLT";
|
|
703
|
+
readonly LITRE: "LTR";
|
|
704
|
+
};
|
|
705
|
+
declare const SYSTEM_FAMILIES: readonly MeasurementUnitFamily[];
|
|
706
|
+
declare const SYSTEM_UNITS: readonly MeasurementUnit[];
|
|
707
|
+
declare const DEFAULT_UNIT_ID: "EA";
|
|
708
|
+
|
|
709
|
+
declare function isWhole(value: number): boolean;
|
|
710
|
+
declare const MAX_PRECISION = 5;
|
|
711
|
+
declare function resolveUnit(unitId: string, companyUnits?: readonly MeasurementUnit[]): MeasurementUnit;
|
|
712
|
+
declare function resolveFamily(familyId: string, companyFamilies?: readonly MeasurementUnitFamily[]): MeasurementUnitFamily;
|
|
713
|
+
declare function baseOf(familyId: string, companyFamilies?: readonly MeasurementUnitFamily[]): MeasurementBase;
|
|
714
|
+
declare function baseFor(unit: MeasurementUnit, companyFamilies?: readonly MeasurementUnitFamily[]): MeasurementBase;
|
|
715
|
+
declare function sameFamily(a: MeasurementUnit, b: MeasurementUnit): boolean;
|
|
716
|
+
declare function assertUnitSane(unit: Measurable): void;
|
|
717
|
+
declare function maxPrecisionFor(ratioToBase: number): number;
|
|
718
|
+
declare function isValidQuantity(quantity: number, unit: Measurable): boolean;
|
|
719
|
+
declare function toBase(quantity: number, unit: Measurable): number;
|
|
720
|
+
declare function fromBase(baseQuantity: number, unit: Measurable): number;
|
|
721
|
+
declare function availableIn(baseQuantity: number, unit: Measurable): number;
|
|
722
|
+
declare function formatQuantity(baseQuantity: number, unit: Measurable): string;
|
|
723
|
+
declare function formatInUnit(quantity: number, unit: Measurable): string;
|
|
724
|
+
declare function roundToPrecision(quantity: number, precision: number): number;
|
|
725
|
+
declare function extendPrice(priceMinor: number, quantity: number): number;
|
|
726
|
+
declare function extendPriceFor(priceMinor: number, quantity: number, unit: Measurable): number;
|
|
727
|
+
|
|
728
|
+
declare function deriveFamilyCode(name: string, companyId: string, takenCodes?: Iterable<string>): string;
|
|
729
|
+
declare function isSystemFamilyCode(code: string): boolean;
|
|
730
|
+
declare function deriveUnitId(abbreviation: string, documentId: string): string;
|
|
731
|
+
|
|
655
732
|
type PaymentState = 'unpaid' | 'payment_pending' | 'partially_paid' | 'paid' | 'partially_refunded' | 'refunded' | 'voided';
|
|
656
733
|
type FulfillmentState = 'draft' | 'pending' | 'on_hold' | 'in_progress' | 'fulfilled' | 'partially_fulfilled' | 'returned' | 'partially_returned' | 'cancelled';
|
|
657
734
|
declare const PAYMENT_STATES: readonly PaymentState[];
|
|
@@ -1113,4 +1190,4 @@ declare const EUFixedRates: Record<string, CurrencyRate>;
|
|
|
1113
1190
|
declare const OtherFixedRates: Record<string, CurrencyRate>;
|
|
1114
1191
|
declare const COUNTRY_CURRENCIES: Record<string, string>;
|
|
1115
1192
|
|
|
1116
|
-
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, 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, InventoryBaseActionEnum, type InventoryBaseActionType, InventorySpecificActionType, InvoiceStatus, LegacyWriteStrategy, LibraryItemType, MenuProject, 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 OrderStateEventPayload, type OrderStateWritable, type OrderWriteStrategy, OtherFixedRates, OwnerType, PATH_MODES, PAYMENT_STATES, POS_VALID_INITIAL_STATES, type PathMode, PaymentMethod, PaymentProcessor, 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 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, addAmounts, amountToString, baseFulfillmentDefinitions, basePaymentDefinitions, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, canTransition, conditionSummary, convertFixedFeeToLocalCurrency, createAmount, crossAxisRuleApplies, deriveDisplayState, displayRuleMatchesPair, divideAmount, evaluateCondition, evaluateConditionSet, formatCurrency, formatMinorUnitsToString, fromMinorUnits, generateMongoID, getAvailableTransitions, getCashAmountDue, getCountriesByRegion, getCurrencyConfig, getCurrentISODate, getFinancialInvariantViolations, getGoodsPortion, getLineSubtotal, getMinorUnitMultiplier, getMinorUnits, getPaymentLegTotal, getPricingRegionFromCountry, getSettlementTotal, getTotalCollected, inferStatesFromLegacyStatus, isConditionOperator, isFulfillmentState, isPaymentState, isSupportedCurrency, mapToLegacyStatus, mergeFragment, multiplyAmount, normalizeMongoIdString, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, removeFragment, resolveTemplate, setOrderState, signReportForDisplay, stringifyMinorUnits, subtractAmounts, toMinorUnits, validateConfig, validateFragmentCompatibility, violatesFinancialInvariant };
|
|
1193
|
+
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, 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, InventoryBaseActionEnum, type InventoryBaseActionType, InventorySpecificActionType, InvoiceStatus, LegacyWriteStrategy, LibraryItemType, MAX_PRECISION, type Measurable, type MeasurementBase, type MeasurementUnit, type MeasurementUnitFamily, MenuProject, 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 OrderStateEventPayload, type OrderStateWritable, type OrderWriteStrategy, OtherFixedRates, OwnerType, PATH_MODES, PAYMENT_STATES, POS_VALID_INITIAL_STATES, type PathMode, PaymentMethod, PaymentProcessor, 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, 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, addAmounts, amountToString, assertUnitSane, availableIn, baseFor, baseFulfillmentDefinitions, baseOf, basePaymentDefinitions, 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, inferStatesFromLegacyStatus, isConditionOperator, isFulfillmentState, isPaymentState, isSupportedCurrency, isSystemFamilyCode, isValidQuantity, isWhole, mapToLegacyStatus, maxPrecisionFor, mergeFragment, multiplyAmount, normalizeMongoIdString, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, removeFragment, resolveFamily, resolveTemplate, resolveUnit, roundToPrecision, sameFamily, setOrderState, signReportForDisplay, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, violatesFinancialInvariant };
|