@final-commerce/common 2.5.1-preprod.3 → 2.6.0-staging.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 +182 -33
- package/dist/index.d.ts +182 -33
- package/dist/index.js +352 -62
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +335 -57
- package/dist/index.mjs.map +1 -1
- package/dist/pos-types/index.d.mts +175 -121
- package/dist/pos-types/index.d.ts +175 -121
- package/dist/pos-types/index.js +0 -1
- package/dist/pos-types/index.js.map +1 -1
- package/dist/pos-types/index.mjs +0 -1
- package/dist/pos-types/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -224,8 +224,7 @@ declare enum InventorySpecificActionType {
|
|
|
224
224
|
APPLIED_FROM_WOO = "APPLIED_FROM_WOO",
|
|
225
225
|
PO_RECEIVED = "PO_RECEIVED",
|
|
226
226
|
EXTERNAL_SALE = "EXTERNAL_SALE",
|
|
227
|
-
EXTERNAL_RESTOCK = "EXTERNAL_RESTOCK"
|
|
228
|
-
CUSTOM = "CUSTOM"
|
|
227
|
+
EXTERNAL_RESTOCK = "EXTERNAL_RESTOCK"
|
|
229
228
|
}
|
|
230
229
|
declare enum ExtensionCategory {
|
|
231
230
|
SYNC = "sync",
|
|
@@ -391,7 +390,8 @@ declare enum StripeCurrencyCode {
|
|
|
391
390
|
declare enum ProductType {
|
|
392
391
|
SIMPLE = "simple",
|
|
393
392
|
VARIABLE = "variable",
|
|
394
|
-
BOOKING = "booking"
|
|
393
|
+
BOOKING = "booking",
|
|
394
|
+
COMPOSITE = "composite"
|
|
395
395
|
}
|
|
396
396
|
declare enum ProductStatus {
|
|
397
397
|
ACTIVE = "active",
|
|
@@ -713,6 +713,85 @@ declare function generateMongoID(): string;
|
|
|
713
713
|
declare function getCurrentISODate(): string;
|
|
714
714
|
declare function normalizeMongoIdString(value: unknown): string | null;
|
|
715
715
|
|
|
716
|
+
interface CompositePriceItem {
|
|
717
|
+
extraCharge: number;
|
|
718
|
+
quantity: number;
|
|
719
|
+
available: boolean;
|
|
720
|
+
}
|
|
721
|
+
interface CompositePricePart {
|
|
722
|
+
min: number;
|
|
723
|
+
items: CompositePriceItem[];
|
|
724
|
+
}
|
|
725
|
+
declare const compositeItemCost: (item: CompositePriceItem) => number;
|
|
726
|
+
declare function cheapestCompositeItem(items: CompositePriceItem[]): number | undefined;
|
|
727
|
+
declare function cheapestCompositePrice(parts: CompositePricePart[]): number | undefined;
|
|
728
|
+
|
|
729
|
+
type ModifierSelectionType = 'single' | 'multiple' | 'quantity';
|
|
730
|
+
interface ResolvedModifierChoice {
|
|
731
|
+
_id: string;
|
|
732
|
+
name: string;
|
|
733
|
+
price: number;
|
|
734
|
+
isDefault?: boolean;
|
|
735
|
+
defaultQuantity?: number;
|
|
736
|
+
unavailableOutletIds?: string[];
|
|
737
|
+
sortOrder: number;
|
|
738
|
+
}
|
|
739
|
+
interface ResolvedModifier {
|
|
740
|
+
_id: string;
|
|
741
|
+
name: string;
|
|
742
|
+
selectionType: ModifierSelectionType;
|
|
743
|
+
allowQuantity?: boolean;
|
|
744
|
+
required: boolean;
|
|
745
|
+
min?: number | null;
|
|
746
|
+
max?: number | null;
|
|
747
|
+
sortOrder: number;
|
|
748
|
+
choices: ResolvedModifierChoice[];
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
interface ModifierChoiceRow {
|
|
752
|
+
_id: string;
|
|
753
|
+
name: string;
|
|
754
|
+
price?: number;
|
|
755
|
+
sortOrder?: number;
|
|
756
|
+
isDefault?: boolean;
|
|
757
|
+
defaultQuantity?: number;
|
|
758
|
+
unavailableOutletIds?: string[];
|
|
759
|
+
}
|
|
760
|
+
interface ModifierRow {
|
|
761
|
+
_id: string;
|
|
762
|
+
name: string;
|
|
763
|
+
selectionType: ModifierSelectionType;
|
|
764
|
+
allowQuantity?: boolean;
|
|
765
|
+
choices?: ModifierChoiceRow[];
|
|
766
|
+
isDeleted?: boolean;
|
|
767
|
+
}
|
|
768
|
+
interface CategoryModifierRow {
|
|
769
|
+
_id: string;
|
|
770
|
+
modifierId: string;
|
|
771
|
+
categoryId: string;
|
|
772
|
+
required?: boolean;
|
|
773
|
+
min?: number | null;
|
|
774
|
+
max?: number | null;
|
|
775
|
+
sortOrder?: number;
|
|
776
|
+
isDeleted?: boolean;
|
|
777
|
+
}
|
|
778
|
+
interface CategoryRow {
|
|
779
|
+
_id: string;
|
|
780
|
+
parentId?: string | null;
|
|
781
|
+
isDeleted?: boolean;
|
|
782
|
+
}
|
|
783
|
+
declare function ancestorChain(categoryId: string, categoriesById: Map<string, CategoryRow>): string[];
|
|
784
|
+
interface ResolveInputs {
|
|
785
|
+
categoryIds: string[];
|
|
786
|
+
modifiers: ModifierRow[];
|
|
787
|
+
categoryModifiers: CategoryModifierRow[];
|
|
788
|
+
categories: CategoryRow[];
|
|
789
|
+
}
|
|
790
|
+
declare function resolveModifiersForProduct(inputs: ResolveInputs): ResolvedModifier[];
|
|
791
|
+
declare function isChoiceAvailableAtOutlet(choice: ResolvedModifierChoice, outletId: string): boolean;
|
|
792
|
+
declare function hasSellableChoice(modifier: ResolvedModifier, outletId: string): boolean;
|
|
793
|
+
declare const modifiersSellable: (modifiers: ResolvedModifier[], outletId: string) => boolean;
|
|
794
|
+
|
|
716
795
|
interface Measurable {
|
|
717
796
|
name: string;
|
|
718
797
|
abbreviation: string;
|
|
@@ -743,6 +822,105 @@ interface MeasurementUnit {
|
|
|
743
822
|
sellable?: false;
|
|
744
823
|
}
|
|
745
824
|
|
|
825
|
+
type CompositeItemUnavailable = 'deleted' | 'inactive' | 'hidden' | 'empty' | 'out_of_stock' | 'by_date' | 'fully_booked' | 'marked_sold_out';
|
|
826
|
+
|
|
827
|
+
interface CompositeShelf {
|
|
828
|
+
pool: string;
|
|
829
|
+
unit?: Measurable;
|
|
830
|
+
backorder: boolean;
|
|
831
|
+
unresolved?: boolean;
|
|
832
|
+
}
|
|
833
|
+
interface CompositeAvailabilityRows {
|
|
834
|
+
variantProducts: ReadonlyMap<string, string>;
|
|
835
|
+
productStatuses: ReadonlyMap<string, string | undefined>;
|
|
836
|
+
categoryVariants: ReadonlyMap<string, readonly string[]>;
|
|
837
|
+
bookableProductIds: ReadonlySet<string>;
|
|
838
|
+
outlet?: {
|
|
839
|
+
hiddenProductIds: ReadonlySet<string>;
|
|
840
|
+
unsellableProductIds: ReadonlySet<string>;
|
|
841
|
+
shelves: ReadonlyMap<string, CompositeShelf>;
|
|
842
|
+
poolStock: ReadonlyMap<string, number | null>;
|
|
843
|
+
bookableSeats?: ReadonlyMap<string, number>;
|
|
844
|
+
markedVariantIds: ReadonlySet<string>;
|
|
845
|
+
};
|
|
846
|
+
}
|
|
847
|
+
declare function poolStockAt(rows: readonly {
|
|
848
|
+
outletId: unknown;
|
|
849
|
+
manageStock?: boolean;
|
|
850
|
+
quantity?: number;
|
|
851
|
+
}[], outletId: string): number | null;
|
|
852
|
+
declare function compositeVariantInStock(variantId: string, quantity: number, outlet: NonNullable<CompositeAvailabilityRows['outlet']>): boolean;
|
|
853
|
+
declare function compositeItemUnavailable(item: {
|
|
854
|
+
variantId?: unknown;
|
|
855
|
+
categoryId?: unknown;
|
|
856
|
+
quantity: number;
|
|
857
|
+
}, rows: CompositeAvailabilityRows): CompositeItemUnavailable | null;
|
|
858
|
+
interface CompositeStockPart {
|
|
859
|
+
min: number;
|
|
860
|
+
items: readonly {
|
|
861
|
+
id: string;
|
|
862
|
+
variantId?: unknown;
|
|
863
|
+
categoryId?: unknown;
|
|
864
|
+
quantity: number;
|
|
865
|
+
}[];
|
|
866
|
+
}
|
|
867
|
+
interface CompositeMakeableRow {
|
|
868
|
+
itemIds: string[];
|
|
869
|
+
partIndex?: number;
|
|
870
|
+
uses: number;
|
|
871
|
+
has: number | null;
|
|
872
|
+
makes: number | null;
|
|
873
|
+
}
|
|
874
|
+
type CompositeMakeable = {
|
|
875
|
+
byDate: true;
|
|
876
|
+
} | {
|
|
877
|
+
count: number | null;
|
|
878
|
+
rows: CompositeMakeableRow[];
|
|
879
|
+
limitedBy?: number;
|
|
880
|
+
};
|
|
881
|
+
declare function compositeMakeable(parts: readonly CompositeStockPart[], rows: CompositeAvailabilityRows): CompositeMakeable;
|
|
882
|
+
interface PoolDrawing {
|
|
883
|
+
variantId: string;
|
|
884
|
+
stockVariantId?: string;
|
|
885
|
+
quantity: number;
|
|
886
|
+
unit?: Measurable;
|
|
887
|
+
}
|
|
888
|
+
declare const poolOf: (line: PoolDrawing) => string;
|
|
889
|
+
declare function poolDemand(lines: readonly (PoolDrawing & {
|
|
890
|
+
components?: readonly PoolDrawing[];
|
|
891
|
+
})[]): Map<string, number>;
|
|
892
|
+
declare function poolShortfall(demand: ReadonlyMap<string, number>, poolStock: ReadonlyMap<string, number | null>, backordered?: ReadonlySet<string>): {
|
|
893
|
+
poolId: string;
|
|
894
|
+
available: number;
|
|
895
|
+
wanted: number;
|
|
896
|
+
} | null;
|
|
897
|
+
|
|
898
|
+
interface CompositeReservationOrder {
|
|
899
|
+
lineItems?: readonly {
|
|
900
|
+
internalId?: string;
|
|
901
|
+
components?: readonly {
|
|
902
|
+
productId: unknown;
|
|
903
|
+
}[];
|
|
904
|
+
}[];
|
|
905
|
+
reservations?: readonly {
|
|
906
|
+
bookingId?: unknown;
|
|
907
|
+
productId: unknown;
|
|
908
|
+
lineItemInternalId?: string;
|
|
909
|
+
componentIndex?: number;
|
|
910
|
+
price?: number;
|
|
911
|
+
total?: number;
|
|
912
|
+
}[];
|
|
913
|
+
}
|
|
914
|
+
declare function compositeModifierMismatches(lineItems: readonly {
|
|
915
|
+
internalId?: string;
|
|
916
|
+
components?: readonly unknown[];
|
|
917
|
+
modifiers?: readonly {
|
|
918
|
+
modifierName?: string;
|
|
919
|
+
componentIndex?: number;
|
|
920
|
+
}[];
|
|
921
|
+
}[]): string[];
|
|
922
|
+
declare function compositeReservationMismatches(order: CompositeReservationOrder): string[];
|
|
923
|
+
|
|
746
924
|
declare const SYSTEM_FAMILY_IDS: {
|
|
747
925
|
readonly COUNT: "count";
|
|
748
926
|
readonly WEIGHT: "weight-metric";
|
|
@@ -805,21 +983,6 @@ declare function isConditionOperator(value: string): value is ConditionOperator;
|
|
|
805
983
|
type PathMode = 'strict' | 'permissive';
|
|
806
984
|
declare const PATH_MODES: readonly PathMode[];
|
|
807
985
|
|
|
808
|
-
interface OrderStatusDefinition {
|
|
809
|
-
id: string;
|
|
810
|
-
label: string;
|
|
811
|
-
color?: string;
|
|
812
|
-
icon?: string;
|
|
813
|
-
fulfillmentState?: FulfillmentState;
|
|
814
|
-
requiresPaymentState?: PaymentState[];
|
|
815
|
-
}
|
|
816
|
-
interface OrderStatusValidationError {
|
|
817
|
-
index: number;
|
|
818
|
-
field: string;
|
|
819
|
-
message: string;
|
|
820
|
-
}
|
|
821
|
-
declare function validateOrderStatuses(statuses: unknown): OrderStatusValidationError[];
|
|
822
|
-
|
|
823
986
|
interface OrderPaymentMethod {
|
|
824
987
|
id?: string;
|
|
825
988
|
amount?: number;
|
|
@@ -993,7 +1156,6 @@ interface StoredStateConfig {
|
|
|
993
1156
|
validInitialStates: StatePair[];
|
|
994
1157
|
enforceValidInitialStates?: boolean;
|
|
995
1158
|
displayStateMap: DisplayStateRule[];
|
|
996
|
-
orderStatuses?: OrderStatusDefinition[];
|
|
997
1159
|
createdAt: Date;
|
|
998
1160
|
updatedAt: Date;
|
|
999
1161
|
}
|
|
@@ -1115,16 +1277,6 @@ declare function setOrderState(order: OrderStateWritable, paymentState: PaymentS
|
|
|
1115
1277
|
|
|
1116
1278
|
declare function inferStatesFromLegacyStatus(order: OrderLikeForLegacyInference): StatePair;
|
|
1117
1279
|
|
|
1118
|
-
interface OrderLikeForInCart {
|
|
1119
|
-
inCart?: {
|
|
1120
|
-
active: boolean;
|
|
1121
|
-
} | null;
|
|
1122
|
-
status?: string;
|
|
1123
|
-
fulfillmentState?: string;
|
|
1124
|
-
}
|
|
1125
|
-
declare function hasInCartFlag(order: OrderLikeForInCart): boolean;
|
|
1126
|
-
declare function isInCart(order: OrderLikeForInCart): boolean;
|
|
1127
|
-
|
|
1128
1280
|
interface OrderMutationData extends OrderStateWritable {
|
|
1129
1281
|
total?: number;
|
|
1130
1282
|
balance?: number;
|
|
@@ -1428,9 +1580,6 @@ declare const holdExpiresAt: (rule: BookingRulesInput, now: Date) => Date;
|
|
|
1428
1580
|
|
|
1429
1581
|
declare const ADYEN_ROLLOUT_COUNTRY_CODES: Set<string>;
|
|
1430
1582
|
declare function isAdyenRolloutCountry(alpha2: string): boolean;
|
|
1431
|
-
declare const AFFIRM_PRICE_PLANS: readonly ["core", "standard", "signature"];
|
|
1432
|
-
type AffirmPricePlan = (typeof AFFIRM_PRICE_PLANS)[number];
|
|
1433
|
-
declare function isAffirmPricePlan(value: unknown): value is AffirmPricePlan;
|
|
1434
1583
|
|
|
1435
1584
|
interface CurrencyRate {
|
|
1436
1585
|
rate: number;
|
|
@@ -1443,4 +1592,4 @@ declare const EUFixedRates: Record<string, CurrencyRate>;
|
|
|
1443
1592
|
declare const OtherFixedRates: Record<string, CurrencyRate>;
|
|
1444
1593
|
declare const COUNTRY_CURRENCIES: Record<string, string>;
|
|
1445
1594
|
|
|
1446
|
-
export { ADYEN_ROLLOUT_COUNTRY_CODES,
|
|
1595
|
+
export { ADYEN_ROLLOUT_COUNTRY_CODES, type Amount, AttributeType, type AvailabilityInput, type AvailabilitySlot, type AvailableTransition, 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, type CategoryModifierRow, type CategoryRow, CompanyType, type CompositeAvailabilityRows, type CompositeMakeable, type CompositeMakeableRow, type CompositePriceItem, type CompositePricePart, type CompositeReservationOrder, type CompositeShelf, type CompositeStockPart, type Condition, type ConditionGroup, type ConditionOperator, type ConfigUpdatedPayload, type ConfigValidationError, type ConfigValidationResult, type ConfigValidationWarning, type 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 ModifierChoiceRow, type ModifierRow, 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_STATES, POS_VALID_INITIAL_STATES, type PathMode, PaymentMethod, PaymentProcessor, type PaymentState, type PaymentStateDefinition, type PaymentTransitionPath, type PlanWindowInput, Platform, type PoolDrawing, PreviewImageMode, PricingLevel, PricingPlanEnum, PricingRegionEnum, type ProductDiscountBucket, type ProductFeeBucket, ProductStatus, ProductType, PublicationAvailability, type PublicationConfig, PublicationStatus, REGION_MAPPING, REPORT_NEGATE_PATHS, ReceiptSendChannel, ReceiptType, type RefundsBreakdown, ReservationStatus, ResidualPaymentMethod, ResidualStatus, type ResolveInputs, 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, ancestorChain, assertUnitSane, availableIn, baseFor, baseFulfillmentDefinitions, baseOf, basePaymentDefinitions, buildAvailability, buildGrid, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, canTransition, cheapestCompositeItem, cheapestCompositePrice, compositeItemCost, compositeItemUnavailable, compositeMakeable, compositeModifierMismatches, compositeReservationMismatches, compositeVariantInStock, 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, hasSellableChoice, holdExpiresAt, inferStatesFromLegacyStatus, isAdyenRolloutCountry, isChoiceAvailableAtOutlet, isConditionOperator, isFulfillmentState, isPaymentState, isSupportedCurrency, isSystemFamilyCode, isValidQuantity, isWhole, mapToLegacyStatus, maxPrecisionFor, mergeFragment, modifiersSellable, multiplyAmount, normalizeMongoIdString, occupancyIn, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, planWindow, poolDemand, poolOf, poolShortfall, poolStockAt, presentAt, removeFragment, resolveFamily, resolveModifiersForProduct, resolveTemplate, resolveUnit, roundToPrecision, sameFamily, setOrderState, shopDayKey, shopDayRange, signReportForDisplay, slotsForWindow, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, violatesFinancialInvariant, windowEndsAt, withinPresence };
|
package/dist/index.d.ts
CHANGED
|
@@ -224,8 +224,7 @@ declare enum InventorySpecificActionType {
|
|
|
224
224
|
APPLIED_FROM_WOO = "APPLIED_FROM_WOO",
|
|
225
225
|
PO_RECEIVED = "PO_RECEIVED",
|
|
226
226
|
EXTERNAL_SALE = "EXTERNAL_SALE",
|
|
227
|
-
EXTERNAL_RESTOCK = "EXTERNAL_RESTOCK"
|
|
228
|
-
CUSTOM = "CUSTOM"
|
|
227
|
+
EXTERNAL_RESTOCK = "EXTERNAL_RESTOCK"
|
|
229
228
|
}
|
|
230
229
|
declare enum ExtensionCategory {
|
|
231
230
|
SYNC = "sync",
|
|
@@ -391,7 +390,8 @@ declare enum StripeCurrencyCode {
|
|
|
391
390
|
declare enum ProductType {
|
|
392
391
|
SIMPLE = "simple",
|
|
393
392
|
VARIABLE = "variable",
|
|
394
|
-
BOOKING = "booking"
|
|
393
|
+
BOOKING = "booking",
|
|
394
|
+
COMPOSITE = "composite"
|
|
395
395
|
}
|
|
396
396
|
declare enum ProductStatus {
|
|
397
397
|
ACTIVE = "active",
|
|
@@ -713,6 +713,85 @@ declare function generateMongoID(): string;
|
|
|
713
713
|
declare function getCurrentISODate(): string;
|
|
714
714
|
declare function normalizeMongoIdString(value: unknown): string | null;
|
|
715
715
|
|
|
716
|
+
interface CompositePriceItem {
|
|
717
|
+
extraCharge: number;
|
|
718
|
+
quantity: number;
|
|
719
|
+
available: boolean;
|
|
720
|
+
}
|
|
721
|
+
interface CompositePricePart {
|
|
722
|
+
min: number;
|
|
723
|
+
items: CompositePriceItem[];
|
|
724
|
+
}
|
|
725
|
+
declare const compositeItemCost: (item: CompositePriceItem) => number;
|
|
726
|
+
declare function cheapestCompositeItem(items: CompositePriceItem[]): number | undefined;
|
|
727
|
+
declare function cheapestCompositePrice(parts: CompositePricePart[]): number | undefined;
|
|
728
|
+
|
|
729
|
+
type ModifierSelectionType = 'single' | 'multiple' | 'quantity';
|
|
730
|
+
interface ResolvedModifierChoice {
|
|
731
|
+
_id: string;
|
|
732
|
+
name: string;
|
|
733
|
+
price: number;
|
|
734
|
+
isDefault?: boolean;
|
|
735
|
+
defaultQuantity?: number;
|
|
736
|
+
unavailableOutletIds?: string[];
|
|
737
|
+
sortOrder: number;
|
|
738
|
+
}
|
|
739
|
+
interface ResolvedModifier {
|
|
740
|
+
_id: string;
|
|
741
|
+
name: string;
|
|
742
|
+
selectionType: ModifierSelectionType;
|
|
743
|
+
allowQuantity?: boolean;
|
|
744
|
+
required: boolean;
|
|
745
|
+
min?: number | null;
|
|
746
|
+
max?: number | null;
|
|
747
|
+
sortOrder: number;
|
|
748
|
+
choices: ResolvedModifierChoice[];
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
interface ModifierChoiceRow {
|
|
752
|
+
_id: string;
|
|
753
|
+
name: string;
|
|
754
|
+
price?: number;
|
|
755
|
+
sortOrder?: number;
|
|
756
|
+
isDefault?: boolean;
|
|
757
|
+
defaultQuantity?: number;
|
|
758
|
+
unavailableOutletIds?: string[];
|
|
759
|
+
}
|
|
760
|
+
interface ModifierRow {
|
|
761
|
+
_id: string;
|
|
762
|
+
name: string;
|
|
763
|
+
selectionType: ModifierSelectionType;
|
|
764
|
+
allowQuantity?: boolean;
|
|
765
|
+
choices?: ModifierChoiceRow[];
|
|
766
|
+
isDeleted?: boolean;
|
|
767
|
+
}
|
|
768
|
+
interface CategoryModifierRow {
|
|
769
|
+
_id: string;
|
|
770
|
+
modifierId: string;
|
|
771
|
+
categoryId: string;
|
|
772
|
+
required?: boolean;
|
|
773
|
+
min?: number | null;
|
|
774
|
+
max?: number | null;
|
|
775
|
+
sortOrder?: number;
|
|
776
|
+
isDeleted?: boolean;
|
|
777
|
+
}
|
|
778
|
+
interface CategoryRow {
|
|
779
|
+
_id: string;
|
|
780
|
+
parentId?: string | null;
|
|
781
|
+
isDeleted?: boolean;
|
|
782
|
+
}
|
|
783
|
+
declare function ancestorChain(categoryId: string, categoriesById: Map<string, CategoryRow>): string[];
|
|
784
|
+
interface ResolveInputs {
|
|
785
|
+
categoryIds: string[];
|
|
786
|
+
modifiers: ModifierRow[];
|
|
787
|
+
categoryModifiers: CategoryModifierRow[];
|
|
788
|
+
categories: CategoryRow[];
|
|
789
|
+
}
|
|
790
|
+
declare function resolveModifiersForProduct(inputs: ResolveInputs): ResolvedModifier[];
|
|
791
|
+
declare function isChoiceAvailableAtOutlet(choice: ResolvedModifierChoice, outletId: string): boolean;
|
|
792
|
+
declare function hasSellableChoice(modifier: ResolvedModifier, outletId: string): boolean;
|
|
793
|
+
declare const modifiersSellable: (modifiers: ResolvedModifier[], outletId: string) => boolean;
|
|
794
|
+
|
|
716
795
|
interface Measurable {
|
|
717
796
|
name: string;
|
|
718
797
|
abbreviation: string;
|
|
@@ -743,6 +822,105 @@ interface MeasurementUnit {
|
|
|
743
822
|
sellable?: false;
|
|
744
823
|
}
|
|
745
824
|
|
|
825
|
+
type CompositeItemUnavailable = 'deleted' | 'inactive' | 'hidden' | 'empty' | 'out_of_stock' | 'by_date' | 'fully_booked' | 'marked_sold_out';
|
|
826
|
+
|
|
827
|
+
interface CompositeShelf {
|
|
828
|
+
pool: string;
|
|
829
|
+
unit?: Measurable;
|
|
830
|
+
backorder: boolean;
|
|
831
|
+
unresolved?: boolean;
|
|
832
|
+
}
|
|
833
|
+
interface CompositeAvailabilityRows {
|
|
834
|
+
variantProducts: ReadonlyMap<string, string>;
|
|
835
|
+
productStatuses: ReadonlyMap<string, string | undefined>;
|
|
836
|
+
categoryVariants: ReadonlyMap<string, readonly string[]>;
|
|
837
|
+
bookableProductIds: ReadonlySet<string>;
|
|
838
|
+
outlet?: {
|
|
839
|
+
hiddenProductIds: ReadonlySet<string>;
|
|
840
|
+
unsellableProductIds: ReadonlySet<string>;
|
|
841
|
+
shelves: ReadonlyMap<string, CompositeShelf>;
|
|
842
|
+
poolStock: ReadonlyMap<string, number | null>;
|
|
843
|
+
bookableSeats?: ReadonlyMap<string, number>;
|
|
844
|
+
markedVariantIds: ReadonlySet<string>;
|
|
845
|
+
};
|
|
846
|
+
}
|
|
847
|
+
declare function poolStockAt(rows: readonly {
|
|
848
|
+
outletId: unknown;
|
|
849
|
+
manageStock?: boolean;
|
|
850
|
+
quantity?: number;
|
|
851
|
+
}[], outletId: string): number | null;
|
|
852
|
+
declare function compositeVariantInStock(variantId: string, quantity: number, outlet: NonNullable<CompositeAvailabilityRows['outlet']>): boolean;
|
|
853
|
+
declare function compositeItemUnavailable(item: {
|
|
854
|
+
variantId?: unknown;
|
|
855
|
+
categoryId?: unknown;
|
|
856
|
+
quantity: number;
|
|
857
|
+
}, rows: CompositeAvailabilityRows): CompositeItemUnavailable | null;
|
|
858
|
+
interface CompositeStockPart {
|
|
859
|
+
min: number;
|
|
860
|
+
items: readonly {
|
|
861
|
+
id: string;
|
|
862
|
+
variantId?: unknown;
|
|
863
|
+
categoryId?: unknown;
|
|
864
|
+
quantity: number;
|
|
865
|
+
}[];
|
|
866
|
+
}
|
|
867
|
+
interface CompositeMakeableRow {
|
|
868
|
+
itemIds: string[];
|
|
869
|
+
partIndex?: number;
|
|
870
|
+
uses: number;
|
|
871
|
+
has: number | null;
|
|
872
|
+
makes: number | null;
|
|
873
|
+
}
|
|
874
|
+
type CompositeMakeable = {
|
|
875
|
+
byDate: true;
|
|
876
|
+
} | {
|
|
877
|
+
count: number | null;
|
|
878
|
+
rows: CompositeMakeableRow[];
|
|
879
|
+
limitedBy?: number;
|
|
880
|
+
};
|
|
881
|
+
declare function compositeMakeable(parts: readonly CompositeStockPart[], rows: CompositeAvailabilityRows): CompositeMakeable;
|
|
882
|
+
interface PoolDrawing {
|
|
883
|
+
variantId: string;
|
|
884
|
+
stockVariantId?: string;
|
|
885
|
+
quantity: number;
|
|
886
|
+
unit?: Measurable;
|
|
887
|
+
}
|
|
888
|
+
declare const poolOf: (line: PoolDrawing) => string;
|
|
889
|
+
declare function poolDemand(lines: readonly (PoolDrawing & {
|
|
890
|
+
components?: readonly PoolDrawing[];
|
|
891
|
+
})[]): Map<string, number>;
|
|
892
|
+
declare function poolShortfall(demand: ReadonlyMap<string, number>, poolStock: ReadonlyMap<string, number | null>, backordered?: ReadonlySet<string>): {
|
|
893
|
+
poolId: string;
|
|
894
|
+
available: number;
|
|
895
|
+
wanted: number;
|
|
896
|
+
} | null;
|
|
897
|
+
|
|
898
|
+
interface CompositeReservationOrder {
|
|
899
|
+
lineItems?: readonly {
|
|
900
|
+
internalId?: string;
|
|
901
|
+
components?: readonly {
|
|
902
|
+
productId: unknown;
|
|
903
|
+
}[];
|
|
904
|
+
}[];
|
|
905
|
+
reservations?: readonly {
|
|
906
|
+
bookingId?: unknown;
|
|
907
|
+
productId: unknown;
|
|
908
|
+
lineItemInternalId?: string;
|
|
909
|
+
componentIndex?: number;
|
|
910
|
+
price?: number;
|
|
911
|
+
total?: number;
|
|
912
|
+
}[];
|
|
913
|
+
}
|
|
914
|
+
declare function compositeModifierMismatches(lineItems: readonly {
|
|
915
|
+
internalId?: string;
|
|
916
|
+
components?: readonly unknown[];
|
|
917
|
+
modifiers?: readonly {
|
|
918
|
+
modifierName?: string;
|
|
919
|
+
componentIndex?: number;
|
|
920
|
+
}[];
|
|
921
|
+
}[]): string[];
|
|
922
|
+
declare function compositeReservationMismatches(order: CompositeReservationOrder): string[];
|
|
923
|
+
|
|
746
924
|
declare const SYSTEM_FAMILY_IDS: {
|
|
747
925
|
readonly COUNT: "count";
|
|
748
926
|
readonly WEIGHT: "weight-metric";
|
|
@@ -805,21 +983,6 @@ declare function isConditionOperator(value: string): value is ConditionOperator;
|
|
|
805
983
|
type PathMode = 'strict' | 'permissive';
|
|
806
984
|
declare const PATH_MODES: readonly PathMode[];
|
|
807
985
|
|
|
808
|
-
interface OrderStatusDefinition {
|
|
809
|
-
id: string;
|
|
810
|
-
label: string;
|
|
811
|
-
color?: string;
|
|
812
|
-
icon?: string;
|
|
813
|
-
fulfillmentState?: FulfillmentState;
|
|
814
|
-
requiresPaymentState?: PaymentState[];
|
|
815
|
-
}
|
|
816
|
-
interface OrderStatusValidationError {
|
|
817
|
-
index: number;
|
|
818
|
-
field: string;
|
|
819
|
-
message: string;
|
|
820
|
-
}
|
|
821
|
-
declare function validateOrderStatuses(statuses: unknown): OrderStatusValidationError[];
|
|
822
|
-
|
|
823
986
|
interface OrderPaymentMethod {
|
|
824
987
|
id?: string;
|
|
825
988
|
amount?: number;
|
|
@@ -993,7 +1156,6 @@ interface StoredStateConfig {
|
|
|
993
1156
|
validInitialStates: StatePair[];
|
|
994
1157
|
enforceValidInitialStates?: boolean;
|
|
995
1158
|
displayStateMap: DisplayStateRule[];
|
|
996
|
-
orderStatuses?: OrderStatusDefinition[];
|
|
997
1159
|
createdAt: Date;
|
|
998
1160
|
updatedAt: Date;
|
|
999
1161
|
}
|
|
@@ -1115,16 +1277,6 @@ declare function setOrderState(order: OrderStateWritable, paymentState: PaymentS
|
|
|
1115
1277
|
|
|
1116
1278
|
declare function inferStatesFromLegacyStatus(order: OrderLikeForLegacyInference): StatePair;
|
|
1117
1279
|
|
|
1118
|
-
interface OrderLikeForInCart {
|
|
1119
|
-
inCart?: {
|
|
1120
|
-
active: boolean;
|
|
1121
|
-
} | null;
|
|
1122
|
-
status?: string;
|
|
1123
|
-
fulfillmentState?: string;
|
|
1124
|
-
}
|
|
1125
|
-
declare function hasInCartFlag(order: OrderLikeForInCart): boolean;
|
|
1126
|
-
declare function isInCart(order: OrderLikeForInCart): boolean;
|
|
1127
|
-
|
|
1128
1280
|
interface OrderMutationData extends OrderStateWritable {
|
|
1129
1281
|
total?: number;
|
|
1130
1282
|
balance?: number;
|
|
@@ -1428,9 +1580,6 @@ declare const holdExpiresAt: (rule: BookingRulesInput, now: Date) => Date;
|
|
|
1428
1580
|
|
|
1429
1581
|
declare const ADYEN_ROLLOUT_COUNTRY_CODES: Set<string>;
|
|
1430
1582
|
declare function isAdyenRolloutCountry(alpha2: string): boolean;
|
|
1431
|
-
declare const AFFIRM_PRICE_PLANS: readonly ["core", "standard", "signature"];
|
|
1432
|
-
type AffirmPricePlan = (typeof AFFIRM_PRICE_PLANS)[number];
|
|
1433
|
-
declare function isAffirmPricePlan(value: unknown): value is AffirmPricePlan;
|
|
1434
1583
|
|
|
1435
1584
|
interface CurrencyRate {
|
|
1436
1585
|
rate: number;
|
|
@@ -1443,4 +1592,4 @@ declare const EUFixedRates: Record<string, CurrencyRate>;
|
|
|
1443
1592
|
declare const OtherFixedRates: Record<string, CurrencyRate>;
|
|
1444
1593
|
declare const COUNTRY_CURRENCIES: Record<string, string>;
|
|
1445
1594
|
|
|
1446
|
-
export { ADYEN_ROLLOUT_COUNTRY_CODES,
|
|
1595
|
+
export { ADYEN_ROLLOUT_COUNTRY_CODES, type Amount, AttributeType, type AvailabilityInput, type AvailabilitySlot, type AvailableTransition, 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, type CategoryModifierRow, type CategoryRow, CompanyType, type CompositeAvailabilityRows, type CompositeMakeable, type CompositeMakeableRow, type CompositePriceItem, type CompositePricePart, type CompositeReservationOrder, type CompositeShelf, type CompositeStockPart, type Condition, type ConditionGroup, type ConditionOperator, type ConfigUpdatedPayload, type ConfigValidationError, type ConfigValidationResult, type ConfigValidationWarning, type 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 ModifierChoiceRow, type ModifierRow, 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_STATES, POS_VALID_INITIAL_STATES, type PathMode, PaymentMethod, PaymentProcessor, type PaymentState, type PaymentStateDefinition, type PaymentTransitionPath, type PlanWindowInput, Platform, type PoolDrawing, PreviewImageMode, PricingLevel, PricingPlanEnum, PricingRegionEnum, type ProductDiscountBucket, type ProductFeeBucket, ProductStatus, ProductType, PublicationAvailability, type PublicationConfig, PublicationStatus, REGION_MAPPING, REPORT_NEGATE_PATHS, ReceiptSendChannel, ReceiptType, type RefundsBreakdown, ReservationStatus, ResidualPaymentMethod, ResidualStatus, type ResolveInputs, 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, ancestorChain, assertUnitSane, availableIn, baseFor, baseFulfillmentDefinitions, baseOf, basePaymentDefinitions, buildAvailability, buildGrid, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, canTransition, cheapestCompositeItem, cheapestCompositePrice, compositeItemCost, compositeItemUnavailable, compositeMakeable, compositeModifierMismatches, compositeReservationMismatches, compositeVariantInStock, 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, hasSellableChoice, holdExpiresAt, inferStatesFromLegacyStatus, isAdyenRolloutCountry, isChoiceAvailableAtOutlet, isConditionOperator, isFulfillmentState, isPaymentState, isSupportedCurrency, isSystemFamilyCode, isValidQuantity, isWhole, mapToLegacyStatus, maxPrecisionFor, mergeFragment, modifiersSellable, multiplyAmount, normalizeMongoIdString, occupancyIn, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, planWindow, poolDemand, poolOf, poolShortfall, poolStockAt, presentAt, removeFragment, resolveFamily, resolveModifiersForProduct, resolveTemplate, resolveUnit, roundToPrecision, sameFamily, setOrderState, shopDayKey, shopDayRange, signReportForDisplay, slotsForWindow, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, violatesFinancialInvariant, windowEndsAt, withinPresence };
|