@final-commerce/common 2.4.1-staging2.1 → 2.5.0-preprod.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.
@@ -431,7 +431,8 @@ declare enum InventorySpecificActionType {
431
431
  APPLIED_FROM_WOO = "APPLIED_FROM_WOO",
432
432
  PO_RECEIVED = "PO_RECEIVED",
433
433
  EXTERNAL_SALE = "EXTERNAL_SALE",
434
- EXTERNAL_RESTOCK = "EXTERNAL_RESTOCK"
434
+ EXTERNAL_RESTOCK = "EXTERNAL_RESTOCK",
435
+ CUSTOM = "CUSTOM"
435
436
  }
436
437
  declare enum UserTypes {
437
438
  COMPANY_OWNER = "owner",
@@ -458,7 +459,8 @@ declare enum NonRevenueItemType {
458
459
 
459
460
  declare enum ProductType {
460
461
  SIMPLE = "simple",
461
- VARIABLE = "variable"
462
+ VARIABLE = "variable",
463
+ BOOKING = "booking"
462
464
  }
463
465
  declare enum ProductStatus {
464
466
  ACTIVE = "active",
@@ -472,6 +474,34 @@ declare enum PaymentProcessor {
472
474
  EXTERNAL = "external"
473
475
  }
474
476
 
477
+ declare enum BookingType {
478
+ RENTAL = "rental",
479
+ APPOINTMENT = "appointment",
480
+ OVERNIGHT = "overnight",
481
+ GROUP = "group"
482
+ }
483
+ declare enum BookingRatePeriod {
484
+ SLOT = "slot",
485
+ DAY = "day",
486
+ NIGHT = "night",
487
+ WEEK = "week",
488
+ MONTH = "month"
489
+ }
490
+ declare enum BookingResourceKind {
491
+ ASSET = "asset",
492
+ ROOM = "room",
493
+ PROPERTY = "property",
494
+ SPACE = "space",
495
+ STAFF = "staff",
496
+ TABLE = "table"
497
+ }
498
+ declare enum ReservationStatus {
499
+ HELD = "held",
500
+ CONFIRMED = "confirmed",
501
+ CANCELLED = "cancelled",
502
+ EXPIRED = "expired"
503
+ }
504
+
475
505
  interface RefundLineItem {
476
506
  taxes?: OrderTax[];
477
507
  discount?: RefundDiscount;
@@ -510,6 +540,7 @@ interface RefundPayment {
510
540
  processor?: string;
511
541
  saleId?: string;
512
542
  tendered?: number;
543
+ tip?: OrderTip | null;
513
544
  }
514
545
 
515
546
  interface RefundTip {
@@ -578,6 +609,31 @@ interface TransactionPaymentData {
578
609
  chargeId?: string;
579
610
  }
580
611
 
612
+ interface OrderReservation {
613
+ internalId: string;
614
+ bookingId?: string;
615
+ productId: string;
616
+ variantId?: string | null;
617
+ resourceId: string;
618
+ name: string;
619
+ resourceName?: string;
620
+ price: number;
621
+ quantity?: number;
622
+ fulfilledQuantity?: number;
623
+ returnedQuantity?: number;
624
+ taxes?: OrderTax[];
625
+ discount?: OrderLineItemDiscount;
626
+ fee?: OrderLineItemFee;
627
+ totalTax?: number;
628
+ total: number;
629
+ taxTableId?: string;
630
+ startAt: string;
631
+ endAt: string;
632
+ bufferEndAt: string;
633
+ override?: boolean;
634
+ overriddenBy?: string | null;
635
+ }
636
+
581
637
  interface Attribute extends BaseEntity {
582
638
  optionName: string;
583
639
  sortingOrder: number;
@@ -793,6 +849,7 @@ interface Order extends BaseEntity {
793
849
  lineItems: Partial<OrderLineItem>[];
794
850
  customSales?: OrderCustomSale[];
795
851
  nonRevenueItems?: NonRevenueItem$1[];
852
+ reservations?: OrderReservation[];
796
853
  refund?: OrderRefund[];
797
854
  minorUnits?: number;
798
855
  }
@@ -841,6 +898,7 @@ interface Product extends BaseEntity {
841
898
  maxPrice?: number;
842
899
  supplier?: string;
843
900
  taxTable?: string | null;
901
+ defaultVariantId?: string;
844
902
  categories?: string[];
845
903
  outlets?: string[];
846
904
  currency?: CurrencyCode;
@@ -1129,6 +1187,22 @@ interface Variant extends BaseEntity {
1129
1187
  stockVariantId?: string;
1130
1188
  }
1131
1189
 
1190
+ interface Tax {
1191
+ id: string;
1192
+ name: string;
1193
+ percentage: number;
1194
+ amount: number;
1195
+ taxableAmount?: number;
1196
+ taxTableName: string;
1197
+ taxTableId: string;
1198
+ compounding?: boolean;
1199
+ priority?: number;
1200
+ }
1201
+ interface Tip {
1202
+ amount: number;
1203
+ percentage: number;
1204
+ }
1205
+
1132
1206
  interface Address {
1133
1207
  firstName: string;
1134
1208
  lastName: string;
@@ -1190,6 +1264,7 @@ interface ActiveOutlet {
1190
1264
  taxId: string;
1191
1265
  postCode?: string;
1192
1266
  name?: string;
1267
+ timeZone?: string;
1193
1268
  stripe?: {
1194
1269
  locationId: string;
1195
1270
  };
@@ -1320,22 +1395,6 @@ interface PosDataItem {
1320
1395
  };
1321
1396
  }
1322
1397
 
1323
- interface Tax {
1324
- id: string;
1325
- name: string;
1326
- percentage: number;
1327
- amount: number;
1328
- taxableAmount?: number;
1329
- taxTableName: string;
1330
- taxTableId: string;
1331
- compounding?: boolean;
1332
- priority?: number;
1333
- }
1334
- interface Tip {
1335
- amount: number;
1336
- percentage: number;
1337
- }
1338
-
1339
1398
  interface DiscountDetail {
1340
1399
  percentage: number;
1341
1400
  amount: number;
@@ -1486,6 +1545,7 @@ interface RefundedLineItem {
1486
1545
  interface RefundItem {
1487
1546
  lineItems: RefundedLineItem[];
1488
1547
  customSales: RefundedCustomSale[];
1548
+ reservations?: OrderReservation[];
1489
1549
  cartFees: CartFeeItem[];
1490
1550
  tips: RefundedTipPayment[];
1491
1551
  refundedBy: string;
@@ -1498,6 +1558,9 @@ interface RefundItem {
1498
1558
  minorUnits?: number;
1499
1559
  }
1500
1560
 
1561
+ type ActiveOrderReservation = Omit<OrderReservation, 'taxes'> & {
1562
+ taxes?: Tax[];
1563
+ };
1501
1564
  type ActiveOrder = Enrich<Order, {
1502
1565
  _id: string;
1503
1566
  id?: string;
@@ -1521,6 +1584,7 @@ type ActiveOrder = Enrich<Order, {
1521
1584
  shipping: Address | null;
1522
1585
  lineItems: LineItem[];
1523
1586
  customSales: CustomSale[];
1587
+ reservations?: ActiveOrderReservation[];
1524
1588
  nonRevenueItems?: NonRevenueItem[];
1525
1589
  refund?: RefundItem[];
1526
1590
  signature?: string | null;
@@ -1633,6 +1697,13 @@ interface ActiveProduct {
1633
1697
  productType?: ProductType;
1634
1698
  }
1635
1699
 
1700
+ interface CartReservation extends OrderReservation {
1701
+ bookingId: string;
1702
+ expiresAt?: string;
1703
+ discounts?: Discount[];
1704
+ fees?: CustomFee[];
1705
+ }
1706
+
1636
1707
  interface ActiveCustomSales {
1637
1708
  id: string;
1638
1709
  name: string;
@@ -1657,11 +1728,13 @@ interface ActiveCart {
1657
1728
  taxes?: Tax[];
1658
1729
  total: number;
1659
1730
  subtotal: number;
1731
+ itemCount?: number;
1660
1732
  discount?: Discount;
1661
1733
  customFee?: CustomFee[];
1662
1734
  products: ActiveProduct[];
1663
1735
  customSales?: ActiveCustomSales[];
1664
1736
  nonRevenueItems?: NonRevenueItem[];
1737
+ reservations?: CartReservation[];
1665
1738
  remainingBalance?: number;
1666
1739
  amountToBeCharged: number;
1667
1740
  customer?: Partial<ActiveCustomer | null> | null;
@@ -1743,7 +1816,9 @@ interface FullProduct {
1743
1816
  supplier?: string;
1744
1817
  sku?: string;
1745
1818
  productType: ProductType;
1819
+ bookingRulesId?: string;
1746
1820
  variants: ProductVariant[];
1821
+ defaultVariantId?: string;
1747
1822
  modifiers?: ResolvedModifier[];
1748
1823
  minPrice?: number;
1749
1824
  maxPrice?: number;
@@ -1757,6 +1832,65 @@ interface FullProduct {
1757
1832
  }
1758
1833
  type ActiveFullProduct = FullProduct;
1759
1834
 
1835
+ interface BookingSlotResource {
1836
+ resourceId: string;
1837
+ name: string;
1838
+ capacity: number;
1839
+ booked: number;
1840
+ free: number;
1841
+ }
1842
+ interface BookingSlot {
1843
+ startAt: string;
1844
+ endAt: string;
1845
+ bufferEndAt: string;
1846
+ canStart: boolean;
1847
+ capacity: number;
1848
+ booked: number;
1849
+ free: number;
1850
+ resources: BookingSlotResource[];
1851
+ dayKey?: string;
1852
+ }
1853
+ interface BookingAvailability {
1854
+ productId: string;
1855
+ bookingRulesId: string;
1856
+ bookingType: BookingType;
1857
+ ratePeriod: BookingRatePeriod;
1858
+ minimumToRun?: number;
1859
+ minStay?: number;
1860
+ maxStay?: number;
1861
+ bookableUntil?: string;
1862
+ beyondWindow?: boolean;
1863
+ slots: BookingSlot[];
1864
+ timeZone?: string | null;
1865
+ days?: string[];
1866
+ }
1867
+ interface BookingResource {
1868
+ id: string;
1869
+ name: string;
1870
+ kind: BookingResourceKind;
1871
+ tag?: string;
1872
+ image?: string;
1873
+ }
1874
+ interface Booking {
1875
+ id: string;
1876
+ productId: string;
1877
+ resourceId: string;
1878
+ variantId?: string;
1879
+ startAt: string;
1880
+ endAt: string;
1881
+ bufferEndAt: string;
1882
+ status: ReservationStatus;
1883
+ expiresAt?: string;
1884
+ orderId?: string;
1885
+ customerId?: string;
1886
+ productName?: string;
1887
+ resourceName?: string;
1888
+ customerName?: string;
1889
+ outletId?: string;
1890
+ outletName?: string;
1891
+ timeZone?: string;
1892
+ }
1893
+
1760
1894
  interface ActiveSession {
1761
1895
  id: string;
1762
1896
  stationId: string;
@@ -2174,7 +2308,11 @@ interface ReaderAvailability {
2174
2308
  bluetooth: boolean;
2175
2309
  unreferencedRefund?: boolean;
2176
2310
  }
2177
- type ServiceChannelMessageType = 'POSBRAIN_READY' | 'HOST_HELLO' | 'SERVICE_INIT' | 'BOOTSTRAP' | 'TOKEN_REFRESH' | 'SELECTION' | 'HOST_SHUTDOWN' | 'READER_CAPABILITIES' | 'RUNTIME_READY' | 'HOST_NAVIGATE' | 'SYNC_PROGRESS' | 'DEVICE_OP_REQUEST' | 'DEVICE_OP_RESPONSE' | 'PUBSUB_TOPICS_REQUEST' | 'PUBSUB_TOPICS_LIST' | 'PUBSUB_SUBSCRIBE' | 'PUBSUB_UNSUBSCRIBE' | 'PUBSUB_EVENT';
2311
+ type CashDrawerPolicy = 'everySale' | 'never';
2312
+ interface PrinterSettings {
2313
+ cashDrawer: CashDrawerPolicy;
2314
+ }
2315
+ type ServiceChannelMessageType = 'POSBRAIN_READY' | 'HOST_HELLO' | 'SERVICE_INIT' | 'BOOTSTRAP' | 'TOKEN_REFRESH' | 'SELECTION' | 'HOST_SHUTDOWN' | 'READER_CAPABILITIES' | 'PRINTER_SETTINGS' | 'RUNTIME_READY' | 'HOST_NAVIGATE' | 'SYNC_PROGRESS' | 'DEVICE_OP_REQUEST' | 'DEVICE_OP_RESPONSE' | 'PUBSUB_TOPICS_REQUEST' | 'PUBSUB_TOPICS_LIST' | 'PUBSUB_SUBSCRIBE' | 'PUBSUB_UNSUBSCRIBE' | 'PUBSUB_EVENT';
2178
2316
  interface PosBrainReadyMessage {
2179
2317
  type: 'POSBRAIN_READY';
2180
2318
  }
@@ -2195,6 +2333,7 @@ interface BootstrapMessage {
2195
2333
  apiUrl?: string;
2196
2334
  };
2197
2335
  paymentProvider?: PaymentProcessor;
2336
+ printerSettings?: PrinterSettings | null;
2198
2337
  }
2199
2338
  interface TokenRefreshMessage {
2200
2339
  type: 'TOKEN_REFRESH';
@@ -2211,6 +2350,10 @@ interface ReaderCapabilitiesMessage {
2211
2350
  type: 'READER_CAPABILITIES';
2212
2351
  readerCapabilities: ReaderCapabilities;
2213
2352
  }
2353
+ interface PrinterSettingsMessage {
2354
+ type: 'PRINTER_SETTINGS';
2355
+ printerSettings: PrinterSettings;
2356
+ }
2214
2357
  interface RuntimeReadyMessage {
2215
2358
  type: 'RUNTIME_READY';
2216
2359
  }
@@ -2273,6 +2416,6 @@ interface PubsubEventMessage {
2273
2416
  type: 'PUBSUB_EVENT';
2274
2417
  event: TopicEventWire;
2275
2418
  }
2276
- type ServiceChannelMessage = PosBrainReadyMessage | HostHelloMessage | ServiceInitMessage | BootstrapMessage | TokenRefreshMessage | SelectionMessage | HostShutdownMessage | ReaderCapabilitiesMessage | RuntimeReadyMessage | HostNavigateMessage | SyncProgressMessage | DeviceOpRequestMessage | DeviceOpResponseMessage | PubsubTopicsRequestMessage | PubsubTopicsListMessage | PubsubSubscribeMessage | PubsubEventMessage;
2419
+ type ServiceChannelMessage = PosBrainReadyMessage | HostHelloMessage | ServiceInitMessage | BootstrapMessage | TokenRefreshMessage | SelectionMessage | HostShutdownMessage | ReaderCapabilitiesMessage | PrinterSettingsMessage | RuntimeReadyMessage | HostNavigateMessage | SyncProgressMessage | DeviceOpRequestMessage | DeviceOpResponseMessage | PubsubTopicsRequestMessage | PubsubTopicsListMessage | PubsubSubscribeMessage | PubsubEventMessage;
2277
2420
 
2278
- export { type ActiveCart, type ActiveCartProduct, type ActiveCompany, type ActiveCustomSales, type ActiveCustomer, type ActiveEntityChanges, ActiveEntityType, type ActiveFullProduct, type ActiveOrder, type ActiveOutlet, type ActivePark, type ActiveProduct, type ActiveRefundOrder, type ActiveSession, type ActiveSplitPayment, type ActiveStation, type ActiveTaxDetails, type ActiveTimer, type ActiveUpdatedOrder, type ActiveUser, type ActiveUserRole, type Address, type Attribute, type AttributeEmbedded, type AttributeOption, type BaseDocument, type BaseEntity, type BaseTile, type BootstrapMessage, type CalculatedTaxDetails, type CartDiscountItem, type CartFeeItem, type CartFeeTaxEntry, type CartFeesDetails, type CartLineModifier, type CashPaymentSettings, type CashRoundingIncrement, type Category, type CompanyExtension, type CompanySettingsEavValue, type CompanySettingsEavValueType, type CustomExtension, type CustomFee, type CustomSale, type CustomSaleDetails, type CustomTable, type CustomTableField, type CustomTableMetadata, type CustomTableRow, type CustomTableValue, type Customer, type CustomerNote, type DeviceEnvAttribute, type DeviceEnvCategory, type DeviceEnvValue, type DeviceOpName, type DeviceOpRequestMessage, type DeviceOpResponseMessage, type Discount, type DiscountDetail, type DiscountLineItem, type Enrich, EnvironmentDataKeys, EnvironmentDataSubKeys, type FeeDetail, type FeeLineItem, type Flow, type FlowSettings, type FlowSettingsKey, type FlowWebApp, type FlowWebAppVersion, type FullProduct, type HostHelloMessage, type HostNavigateMessage, type HostNavigateTarget, type HostShutdownMessage, type Inventory, type LineItem, type Metadata, type MetadataItem, type ModifierChoiceSelection, type ModifierSelection, type ModifierSelectionType, type NonRevenueItem, type Note, type Order, type OrderCartDiscount, type OrderCartFee, type OrderCustomSale, type OrderCustomSaleDiscount, type OrderCustomSaleFee, type OrderLineItem, type OrderLineItemDiscount, type OrderLineItemFee, type OrderLineItemModifier, type OrderNote, type OrderPaymentMethod, type OrderPosData, type OrderRefund, type OrderRefundSummary, type OrderStateActor, type OrderStateActorType, type OrderStateConfig, type OrderStateEvent, type OrderStateEventTrigger, type OrderStateHistoryEntry, type OrderStateOperation, type OrderStatePair, type OrderSummary, type OrderSummaryPayments, type OrderTax, type OrderTip, type Outlet, type PaymentMethod, type PaymentResponse, type PaymentSetting, PaymentStatus, type PosBrainReadyMessage, type PosDataItem, type PriceModifierDetail, type PrinterDetails, ProcessorType, type ProdDiscountBreakdown, type ProdFeeBreakdown, type ProdModifierBreakdown, type Product, type ProductTaxDetails, type ProductVariant, type PubsubEventMessage, type PubsubSubscribeMessage, type PubsubTopicsListMessage, type PubsubTopicsRequestMessage, type Reader, type ReaderAvailability, type ReaderCapabilities, type ReaderCapabilitiesMessage, type Refund, type RefundCartDiscount, type RefundDiscount, type RefundItem, type RefundItemDiscount, type RefundLineItem, type RefundPayment, type RefundProcessingStatus, type RefundSummary, type RefundTip, type RefundedCustomSale, type RefundedLineItem, type RefundedTipPayment, type ResolvedModifier, type ResolvedModifierChoice, type Role, type RolePermission, type RuntimeReadyMessage, type SelectionContext, type SelectionFlowContext, type SelectionMessage, type SelectionRoleContext, type ServiceChannelMessage, type ServiceChannelMessageType, type ServiceInitMessage, type Session, type SessionClosingAmounts, type SmartGridSetting, type SmartGridSettings, type SmartGridSettingsData, type Station, type StripeAccount, type Summary, type SummaryPayments, type SyncProgressMessage, type Tax, type TaxRate, type TaxRateValue, type TaxTable, type TaxTableActive, type TaxTableRate, type TileGrid, type TimeClockEntry, type TimeClockEntryStatus, type Tip, type TipData, type TipPayment, type TipsDetails, type TokenRefreshMessage, type TopicDefinitionWire, type TopicEventWire, type Transaction, type TransactionPaymentData, type User, type UserType, type Variant, type VariantInventory };
2421
+ export { type ActiveCart, type ActiveCartProduct, type ActiveCompany, type ActiveCustomSales, type ActiveCustomer, type ActiveEntityChanges, ActiveEntityType, type ActiveFullProduct, type ActiveOrder, type ActiveOrderReservation, type ActiveOutlet, type ActivePark, type ActiveProduct, type ActiveRefundOrder, type ActiveSession, type ActiveSplitPayment, type ActiveStation, type ActiveTaxDetails, type ActiveTimer, type ActiveUpdatedOrder, type ActiveUser, type ActiveUserRole, type Address, type Attribute, type AttributeEmbedded, type AttributeOption, type BaseDocument, type BaseEntity, type BaseTile, type Booking, type BookingAvailability, type BookingResource, type BookingSlot, type BookingSlotResource, type BootstrapMessage, type CalculatedTaxDetails, type CartDiscountItem, type CartFeeItem, type CartFeeTaxEntry, type CartFeesDetails, type CartLineModifier, type CartReservation, type CashDrawerPolicy, type CashPaymentSettings, type CashRoundingIncrement, type Category, type CompanyExtension, type CompanySettingsEavValue, type CompanySettingsEavValueType, type CustomExtension, type CustomFee, type CustomSale, type CustomSaleDetails, type CustomTable, type CustomTableField, type CustomTableMetadata, type CustomTableRow, type CustomTableValue, type Customer, type CustomerNote, type DeviceEnvAttribute, type DeviceEnvCategory, type DeviceEnvValue, type DeviceOpName, type DeviceOpRequestMessage, type DeviceOpResponseMessage, type Discount, type DiscountDetail, type DiscountLineItem, type Enrich, EnvironmentDataKeys, EnvironmentDataSubKeys, type FeeDetail, type FeeLineItem, type Flow, type FlowSettings, type FlowSettingsKey, type FlowWebApp, type FlowWebAppVersion, type FullProduct, type HostHelloMessage, type HostNavigateMessage, type HostNavigateTarget, type HostShutdownMessage, type Inventory, type LineItem, type Metadata, type MetadataItem, type ModifierChoiceSelection, type ModifierSelection, type ModifierSelectionType, type NonRevenueItem, type Note, type Order, type OrderCartDiscount, type OrderCartFee, type OrderCustomSale, type OrderCustomSaleDiscount, type OrderCustomSaleFee, type OrderLineItem, type OrderLineItemDiscount, type OrderLineItemFee, type OrderLineItemModifier, type OrderNote, type OrderPaymentMethod, type OrderPosData, type OrderRefund, type OrderRefundSummary, type OrderReservation, type OrderStateActor, type OrderStateActorType, type OrderStateConfig, type OrderStateEvent, type OrderStateEventTrigger, type OrderStateHistoryEntry, type OrderStateOperation, type OrderStatePair, type OrderSummary, type OrderSummaryPayments, type OrderTax, type OrderTip, type Outlet, type PaymentMethod, type PaymentResponse, type PaymentSetting, PaymentStatus, type PosBrainReadyMessage, type PosDataItem, type PriceModifierDetail, type PrinterDetails, type PrinterSettings, type PrinterSettingsMessage, ProcessorType, type ProdDiscountBreakdown, type ProdFeeBreakdown, type ProdModifierBreakdown, type Product, type ProductTaxDetails, type ProductVariant, type PubsubEventMessage, type PubsubSubscribeMessage, type PubsubTopicsListMessage, type PubsubTopicsRequestMessage, type Reader, type ReaderAvailability, type ReaderCapabilities, type ReaderCapabilitiesMessage, type Refund, type RefundCartDiscount, type RefundDiscount, type RefundItem, type RefundItemDiscount, type RefundLineItem, type RefundPayment, type RefundProcessingStatus, type RefundSummary, type RefundTip, type RefundedCustomSale, type RefundedLineItem, type RefundedTipPayment, type ResolvedModifier, type ResolvedModifierChoice, type Role, type RolePermission, type RuntimeReadyMessage, type SelectionContext, type SelectionFlowContext, type SelectionMessage, type SelectionRoleContext, type ServiceChannelMessage, type ServiceChannelMessageType, type ServiceInitMessage, type Session, type SessionClosingAmounts, type SmartGridSetting, type SmartGridSettings, type SmartGridSettingsData, type Station, type StripeAccount, type Summary, type SummaryPayments, type SyncProgressMessage, type Tax, type TaxRate, type TaxRateValue, type TaxTable, type TaxTableActive, type TaxTableRate, type TileGrid, type TimeClockEntry, type TimeClockEntryStatus, type Tip, type TipData, type TipPayment, type TipsDetails, type TokenRefreshMessage, type TopicDefinitionWire, type TopicEventWire, type Transaction, type TransactionPaymentData, type User, type UserType, type Variant, type VariantInventory };
@@ -431,7 +431,8 @@ declare enum InventorySpecificActionType {
431
431
  APPLIED_FROM_WOO = "APPLIED_FROM_WOO",
432
432
  PO_RECEIVED = "PO_RECEIVED",
433
433
  EXTERNAL_SALE = "EXTERNAL_SALE",
434
- EXTERNAL_RESTOCK = "EXTERNAL_RESTOCK"
434
+ EXTERNAL_RESTOCK = "EXTERNAL_RESTOCK",
435
+ CUSTOM = "CUSTOM"
435
436
  }
436
437
  declare enum UserTypes {
437
438
  COMPANY_OWNER = "owner",
@@ -458,7 +459,8 @@ declare enum NonRevenueItemType {
458
459
 
459
460
  declare enum ProductType {
460
461
  SIMPLE = "simple",
461
- VARIABLE = "variable"
462
+ VARIABLE = "variable",
463
+ BOOKING = "booking"
462
464
  }
463
465
  declare enum ProductStatus {
464
466
  ACTIVE = "active",
@@ -472,6 +474,34 @@ declare enum PaymentProcessor {
472
474
  EXTERNAL = "external"
473
475
  }
474
476
 
477
+ declare enum BookingType {
478
+ RENTAL = "rental",
479
+ APPOINTMENT = "appointment",
480
+ OVERNIGHT = "overnight",
481
+ GROUP = "group"
482
+ }
483
+ declare enum BookingRatePeriod {
484
+ SLOT = "slot",
485
+ DAY = "day",
486
+ NIGHT = "night",
487
+ WEEK = "week",
488
+ MONTH = "month"
489
+ }
490
+ declare enum BookingResourceKind {
491
+ ASSET = "asset",
492
+ ROOM = "room",
493
+ PROPERTY = "property",
494
+ SPACE = "space",
495
+ STAFF = "staff",
496
+ TABLE = "table"
497
+ }
498
+ declare enum ReservationStatus {
499
+ HELD = "held",
500
+ CONFIRMED = "confirmed",
501
+ CANCELLED = "cancelled",
502
+ EXPIRED = "expired"
503
+ }
504
+
475
505
  interface RefundLineItem {
476
506
  taxes?: OrderTax[];
477
507
  discount?: RefundDiscount;
@@ -510,6 +540,7 @@ interface RefundPayment {
510
540
  processor?: string;
511
541
  saleId?: string;
512
542
  tendered?: number;
543
+ tip?: OrderTip | null;
513
544
  }
514
545
 
515
546
  interface RefundTip {
@@ -578,6 +609,31 @@ interface TransactionPaymentData {
578
609
  chargeId?: string;
579
610
  }
580
611
 
612
+ interface OrderReservation {
613
+ internalId: string;
614
+ bookingId?: string;
615
+ productId: string;
616
+ variantId?: string | null;
617
+ resourceId: string;
618
+ name: string;
619
+ resourceName?: string;
620
+ price: number;
621
+ quantity?: number;
622
+ fulfilledQuantity?: number;
623
+ returnedQuantity?: number;
624
+ taxes?: OrderTax[];
625
+ discount?: OrderLineItemDiscount;
626
+ fee?: OrderLineItemFee;
627
+ totalTax?: number;
628
+ total: number;
629
+ taxTableId?: string;
630
+ startAt: string;
631
+ endAt: string;
632
+ bufferEndAt: string;
633
+ override?: boolean;
634
+ overriddenBy?: string | null;
635
+ }
636
+
581
637
  interface Attribute extends BaseEntity {
582
638
  optionName: string;
583
639
  sortingOrder: number;
@@ -793,6 +849,7 @@ interface Order extends BaseEntity {
793
849
  lineItems: Partial<OrderLineItem>[];
794
850
  customSales?: OrderCustomSale[];
795
851
  nonRevenueItems?: NonRevenueItem$1[];
852
+ reservations?: OrderReservation[];
796
853
  refund?: OrderRefund[];
797
854
  minorUnits?: number;
798
855
  }
@@ -841,6 +898,7 @@ interface Product extends BaseEntity {
841
898
  maxPrice?: number;
842
899
  supplier?: string;
843
900
  taxTable?: string | null;
901
+ defaultVariantId?: string;
844
902
  categories?: string[];
845
903
  outlets?: string[];
846
904
  currency?: CurrencyCode;
@@ -1129,6 +1187,22 @@ interface Variant extends BaseEntity {
1129
1187
  stockVariantId?: string;
1130
1188
  }
1131
1189
 
1190
+ interface Tax {
1191
+ id: string;
1192
+ name: string;
1193
+ percentage: number;
1194
+ amount: number;
1195
+ taxableAmount?: number;
1196
+ taxTableName: string;
1197
+ taxTableId: string;
1198
+ compounding?: boolean;
1199
+ priority?: number;
1200
+ }
1201
+ interface Tip {
1202
+ amount: number;
1203
+ percentage: number;
1204
+ }
1205
+
1132
1206
  interface Address {
1133
1207
  firstName: string;
1134
1208
  lastName: string;
@@ -1190,6 +1264,7 @@ interface ActiveOutlet {
1190
1264
  taxId: string;
1191
1265
  postCode?: string;
1192
1266
  name?: string;
1267
+ timeZone?: string;
1193
1268
  stripe?: {
1194
1269
  locationId: string;
1195
1270
  };
@@ -1320,22 +1395,6 @@ interface PosDataItem {
1320
1395
  };
1321
1396
  }
1322
1397
 
1323
- interface Tax {
1324
- id: string;
1325
- name: string;
1326
- percentage: number;
1327
- amount: number;
1328
- taxableAmount?: number;
1329
- taxTableName: string;
1330
- taxTableId: string;
1331
- compounding?: boolean;
1332
- priority?: number;
1333
- }
1334
- interface Tip {
1335
- amount: number;
1336
- percentage: number;
1337
- }
1338
-
1339
1398
  interface DiscountDetail {
1340
1399
  percentage: number;
1341
1400
  amount: number;
@@ -1486,6 +1545,7 @@ interface RefundedLineItem {
1486
1545
  interface RefundItem {
1487
1546
  lineItems: RefundedLineItem[];
1488
1547
  customSales: RefundedCustomSale[];
1548
+ reservations?: OrderReservation[];
1489
1549
  cartFees: CartFeeItem[];
1490
1550
  tips: RefundedTipPayment[];
1491
1551
  refundedBy: string;
@@ -1498,6 +1558,9 @@ interface RefundItem {
1498
1558
  minorUnits?: number;
1499
1559
  }
1500
1560
 
1561
+ type ActiveOrderReservation = Omit<OrderReservation, 'taxes'> & {
1562
+ taxes?: Tax[];
1563
+ };
1501
1564
  type ActiveOrder = Enrich<Order, {
1502
1565
  _id: string;
1503
1566
  id?: string;
@@ -1521,6 +1584,7 @@ type ActiveOrder = Enrich<Order, {
1521
1584
  shipping: Address | null;
1522
1585
  lineItems: LineItem[];
1523
1586
  customSales: CustomSale[];
1587
+ reservations?: ActiveOrderReservation[];
1524
1588
  nonRevenueItems?: NonRevenueItem[];
1525
1589
  refund?: RefundItem[];
1526
1590
  signature?: string | null;
@@ -1633,6 +1697,13 @@ interface ActiveProduct {
1633
1697
  productType?: ProductType;
1634
1698
  }
1635
1699
 
1700
+ interface CartReservation extends OrderReservation {
1701
+ bookingId: string;
1702
+ expiresAt?: string;
1703
+ discounts?: Discount[];
1704
+ fees?: CustomFee[];
1705
+ }
1706
+
1636
1707
  interface ActiveCustomSales {
1637
1708
  id: string;
1638
1709
  name: string;
@@ -1657,11 +1728,13 @@ interface ActiveCart {
1657
1728
  taxes?: Tax[];
1658
1729
  total: number;
1659
1730
  subtotal: number;
1731
+ itemCount?: number;
1660
1732
  discount?: Discount;
1661
1733
  customFee?: CustomFee[];
1662
1734
  products: ActiveProduct[];
1663
1735
  customSales?: ActiveCustomSales[];
1664
1736
  nonRevenueItems?: NonRevenueItem[];
1737
+ reservations?: CartReservation[];
1665
1738
  remainingBalance?: number;
1666
1739
  amountToBeCharged: number;
1667
1740
  customer?: Partial<ActiveCustomer | null> | null;
@@ -1743,7 +1816,9 @@ interface FullProduct {
1743
1816
  supplier?: string;
1744
1817
  sku?: string;
1745
1818
  productType: ProductType;
1819
+ bookingRulesId?: string;
1746
1820
  variants: ProductVariant[];
1821
+ defaultVariantId?: string;
1747
1822
  modifiers?: ResolvedModifier[];
1748
1823
  minPrice?: number;
1749
1824
  maxPrice?: number;
@@ -1757,6 +1832,65 @@ interface FullProduct {
1757
1832
  }
1758
1833
  type ActiveFullProduct = FullProduct;
1759
1834
 
1835
+ interface BookingSlotResource {
1836
+ resourceId: string;
1837
+ name: string;
1838
+ capacity: number;
1839
+ booked: number;
1840
+ free: number;
1841
+ }
1842
+ interface BookingSlot {
1843
+ startAt: string;
1844
+ endAt: string;
1845
+ bufferEndAt: string;
1846
+ canStart: boolean;
1847
+ capacity: number;
1848
+ booked: number;
1849
+ free: number;
1850
+ resources: BookingSlotResource[];
1851
+ dayKey?: string;
1852
+ }
1853
+ interface BookingAvailability {
1854
+ productId: string;
1855
+ bookingRulesId: string;
1856
+ bookingType: BookingType;
1857
+ ratePeriod: BookingRatePeriod;
1858
+ minimumToRun?: number;
1859
+ minStay?: number;
1860
+ maxStay?: number;
1861
+ bookableUntil?: string;
1862
+ beyondWindow?: boolean;
1863
+ slots: BookingSlot[];
1864
+ timeZone?: string | null;
1865
+ days?: string[];
1866
+ }
1867
+ interface BookingResource {
1868
+ id: string;
1869
+ name: string;
1870
+ kind: BookingResourceKind;
1871
+ tag?: string;
1872
+ image?: string;
1873
+ }
1874
+ interface Booking {
1875
+ id: string;
1876
+ productId: string;
1877
+ resourceId: string;
1878
+ variantId?: string;
1879
+ startAt: string;
1880
+ endAt: string;
1881
+ bufferEndAt: string;
1882
+ status: ReservationStatus;
1883
+ expiresAt?: string;
1884
+ orderId?: string;
1885
+ customerId?: string;
1886
+ productName?: string;
1887
+ resourceName?: string;
1888
+ customerName?: string;
1889
+ outletId?: string;
1890
+ outletName?: string;
1891
+ timeZone?: string;
1892
+ }
1893
+
1760
1894
  interface ActiveSession {
1761
1895
  id: string;
1762
1896
  stationId: string;
@@ -2174,7 +2308,11 @@ interface ReaderAvailability {
2174
2308
  bluetooth: boolean;
2175
2309
  unreferencedRefund?: boolean;
2176
2310
  }
2177
- type ServiceChannelMessageType = 'POSBRAIN_READY' | 'HOST_HELLO' | 'SERVICE_INIT' | 'BOOTSTRAP' | 'TOKEN_REFRESH' | 'SELECTION' | 'HOST_SHUTDOWN' | 'READER_CAPABILITIES' | 'RUNTIME_READY' | 'HOST_NAVIGATE' | 'SYNC_PROGRESS' | 'DEVICE_OP_REQUEST' | 'DEVICE_OP_RESPONSE' | 'PUBSUB_TOPICS_REQUEST' | 'PUBSUB_TOPICS_LIST' | 'PUBSUB_SUBSCRIBE' | 'PUBSUB_UNSUBSCRIBE' | 'PUBSUB_EVENT';
2311
+ type CashDrawerPolicy = 'everySale' | 'never';
2312
+ interface PrinterSettings {
2313
+ cashDrawer: CashDrawerPolicy;
2314
+ }
2315
+ type ServiceChannelMessageType = 'POSBRAIN_READY' | 'HOST_HELLO' | 'SERVICE_INIT' | 'BOOTSTRAP' | 'TOKEN_REFRESH' | 'SELECTION' | 'HOST_SHUTDOWN' | 'READER_CAPABILITIES' | 'PRINTER_SETTINGS' | 'RUNTIME_READY' | 'HOST_NAVIGATE' | 'SYNC_PROGRESS' | 'DEVICE_OP_REQUEST' | 'DEVICE_OP_RESPONSE' | 'PUBSUB_TOPICS_REQUEST' | 'PUBSUB_TOPICS_LIST' | 'PUBSUB_SUBSCRIBE' | 'PUBSUB_UNSUBSCRIBE' | 'PUBSUB_EVENT';
2178
2316
  interface PosBrainReadyMessage {
2179
2317
  type: 'POSBRAIN_READY';
2180
2318
  }
@@ -2195,6 +2333,7 @@ interface BootstrapMessage {
2195
2333
  apiUrl?: string;
2196
2334
  };
2197
2335
  paymentProvider?: PaymentProcessor;
2336
+ printerSettings?: PrinterSettings | null;
2198
2337
  }
2199
2338
  interface TokenRefreshMessage {
2200
2339
  type: 'TOKEN_REFRESH';
@@ -2211,6 +2350,10 @@ interface ReaderCapabilitiesMessage {
2211
2350
  type: 'READER_CAPABILITIES';
2212
2351
  readerCapabilities: ReaderCapabilities;
2213
2352
  }
2353
+ interface PrinterSettingsMessage {
2354
+ type: 'PRINTER_SETTINGS';
2355
+ printerSettings: PrinterSettings;
2356
+ }
2214
2357
  interface RuntimeReadyMessage {
2215
2358
  type: 'RUNTIME_READY';
2216
2359
  }
@@ -2273,6 +2416,6 @@ interface PubsubEventMessage {
2273
2416
  type: 'PUBSUB_EVENT';
2274
2417
  event: TopicEventWire;
2275
2418
  }
2276
- type ServiceChannelMessage = PosBrainReadyMessage | HostHelloMessage | ServiceInitMessage | BootstrapMessage | TokenRefreshMessage | SelectionMessage | HostShutdownMessage | ReaderCapabilitiesMessage | RuntimeReadyMessage | HostNavigateMessage | SyncProgressMessage | DeviceOpRequestMessage | DeviceOpResponseMessage | PubsubTopicsRequestMessage | PubsubTopicsListMessage | PubsubSubscribeMessage | PubsubEventMessage;
2419
+ type ServiceChannelMessage = PosBrainReadyMessage | HostHelloMessage | ServiceInitMessage | BootstrapMessage | TokenRefreshMessage | SelectionMessage | HostShutdownMessage | ReaderCapabilitiesMessage | PrinterSettingsMessage | RuntimeReadyMessage | HostNavigateMessage | SyncProgressMessage | DeviceOpRequestMessage | DeviceOpResponseMessage | PubsubTopicsRequestMessage | PubsubTopicsListMessage | PubsubSubscribeMessage | PubsubEventMessage;
2277
2420
 
2278
- export { type ActiveCart, type ActiveCartProduct, type ActiveCompany, type ActiveCustomSales, type ActiveCustomer, type ActiveEntityChanges, ActiveEntityType, type ActiveFullProduct, type ActiveOrder, type ActiveOutlet, type ActivePark, type ActiveProduct, type ActiveRefundOrder, type ActiveSession, type ActiveSplitPayment, type ActiveStation, type ActiveTaxDetails, type ActiveTimer, type ActiveUpdatedOrder, type ActiveUser, type ActiveUserRole, type Address, type Attribute, type AttributeEmbedded, type AttributeOption, type BaseDocument, type BaseEntity, type BaseTile, type BootstrapMessage, type CalculatedTaxDetails, type CartDiscountItem, type CartFeeItem, type CartFeeTaxEntry, type CartFeesDetails, type CartLineModifier, type CashPaymentSettings, type CashRoundingIncrement, type Category, type CompanyExtension, type CompanySettingsEavValue, type CompanySettingsEavValueType, type CustomExtension, type CustomFee, type CustomSale, type CustomSaleDetails, type CustomTable, type CustomTableField, type CustomTableMetadata, type CustomTableRow, type CustomTableValue, type Customer, type CustomerNote, type DeviceEnvAttribute, type DeviceEnvCategory, type DeviceEnvValue, type DeviceOpName, type DeviceOpRequestMessage, type DeviceOpResponseMessage, type Discount, type DiscountDetail, type DiscountLineItem, type Enrich, EnvironmentDataKeys, EnvironmentDataSubKeys, type FeeDetail, type FeeLineItem, type Flow, type FlowSettings, type FlowSettingsKey, type FlowWebApp, type FlowWebAppVersion, type FullProduct, type HostHelloMessage, type HostNavigateMessage, type HostNavigateTarget, type HostShutdownMessage, type Inventory, type LineItem, type Metadata, type MetadataItem, type ModifierChoiceSelection, type ModifierSelection, type ModifierSelectionType, type NonRevenueItem, type Note, type Order, type OrderCartDiscount, type OrderCartFee, type OrderCustomSale, type OrderCustomSaleDiscount, type OrderCustomSaleFee, type OrderLineItem, type OrderLineItemDiscount, type OrderLineItemFee, type OrderLineItemModifier, type OrderNote, type OrderPaymentMethod, type OrderPosData, type OrderRefund, type OrderRefundSummary, type OrderStateActor, type OrderStateActorType, type OrderStateConfig, type OrderStateEvent, type OrderStateEventTrigger, type OrderStateHistoryEntry, type OrderStateOperation, type OrderStatePair, type OrderSummary, type OrderSummaryPayments, type OrderTax, type OrderTip, type Outlet, type PaymentMethod, type PaymentResponse, type PaymentSetting, PaymentStatus, type PosBrainReadyMessage, type PosDataItem, type PriceModifierDetail, type PrinterDetails, ProcessorType, type ProdDiscountBreakdown, type ProdFeeBreakdown, type ProdModifierBreakdown, type Product, type ProductTaxDetails, type ProductVariant, type PubsubEventMessage, type PubsubSubscribeMessage, type PubsubTopicsListMessage, type PubsubTopicsRequestMessage, type Reader, type ReaderAvailability, type ReaderCapabilities, type ReaderCapabilitiesMessage, type Refund, type RefundCartDiscount, type RefundDiscount, type RefundItem, type RefundItemDiscount, type RefundLineItem, type RefundPayment, type RefundProcessingStatus, type RefundSummary, type RefundTip, type RefundedCustomSale, type RefundedLineItem, type RefundedTipPayment, type ResolvedModifier, type ResolvedModifierChoice, type Role, type RolePermission, type RuntimeReadyMessage, type SelectionContext, type SelectionFlowContext, type SelectionMessage, type SelectionRoleContext, type ServiceChannelMessage, type ServiceChannelMessageType, type ServiceInitMessage, type Session, type SessionClosingAmounts, type SmartGridSetting, type SmartGridSettings, type SmartGridSettingsData, type Station, type StripeAccount, type Summary, type SummaryPayments, type SyncProgressMessage, type Tax, type TaxRate, type TaxRateValue, type TaxTable, type TaxTableActive, type TaxTableRate, type TileGrid, type TimeClockEntry, type TimeClockEntryStatus, type Tip, type TipData, type TipPayment, type TipsDetails, type TokenRefreshMessage, type TopicDefinitionWire, type TopicEventWire, type Transaction, type TransactionPaymentData, type User, type UserType, type Variant, type VariantInventory };
2421
+ export { type ActiveCart, type ActiveCartProduct, type ActiveCompany, type ActiveCustomSales, type ActiveCustomer, type ActiveEntityChanges, ActiveEntityType, type ActiveFullProduct, type ActiveOrder, type ActiveOrderReservation, type ActiveOutlet, type ActivePark, type ActiveProduct, type ActiveRefundOrder, type ActiveSession, type ActiveSplitPayment, type ActiveStation, type ActiveTaxDetails, type ActiveTimer, type ActiveUpdatedOrder, type ActiveUser, type ActiveUserRole, type Address, type Attribute, type AttributeEmbedded, type AttributeOption, type BaseDocument, type BaseEntity, type BaseTile, type Booking, type BookingAvailability, type BookingResource, type BookingSlot, type BookingSlotResource, type BootstrapMessage, type CalculatedTaxDetails, type CartDiscountItem, type CartFeeItem, type CartFeeTaxEntry, type CartFeesDetails, type CartLineModifier, type CartReservation, type CashDrawerPolicy, type CashPaymentSettings, type CashRoundingIncrement, type Category, type CompanyExtension, type CompanySettingsEavValue, type CompanySettingsEavValueType, type CustomExtension, type CustomFee, type CustomSale, type CustomSaleDetails, type CustomTable, type CustomTableField, type CustomTableMetadata, type CustomTableRow, type CustomTableValue, type Customer, type CustomerNote, type DeviceEnvAttribute, type DeviceEnvCategory, type DeviceEnvValue, type DeviceOpName, type DeviceOpRequestMessage, type DeviceOpResponseMessage, type Discount, type DiscountDetail, type DiscountLineItem, type Enrich, EnvironmentDataKeys, EnvironmentDataSubKeys, type FeeDetail, type FeeLineItem, type Flow, type FlowSettings, type FlowSettingsKey, type FlowWebApp, type FlowWebAppVersion, type FullProduct, type HostHelloMessage, type HostNavigateMessage, type HostNavigateTarget, type HostShutdownMessage, type Inventory, type LineItem, type Metadata, type MetadataItem, type ModifierChoiceSelection, type ModifierSelection, type ModifierSelectionType, type NonRevenueItem, type Note, type Order, type OrderCartDiscount, type OrderCartFee, type OrderCustomSale, type OrderCustomSaleDiscount, type OrderCustomSaleFee, type OrderLineItem, type OrderLineItemDiscount, type OrderLineItemFee, type OrderLineItemModifier, type OrderNote, type OrderPaymentMethod, type OrderPosData, type OrderRefund, type OrderRefundSummary, type OrderReservation, type OrderStateActor, type OrderStateActorType, type OrderStateConfig, type OrderStateEvent, type OrderStateEventTrigger, type OrderStateHistoryEntry, type OrderStateOperation, type OrderStatePair, type OrderSummary, type OrderSummaryPayments, type OrderTax, type OrderTip, type Outlet, type PaymentMethod, type PaymentResponse, type PaymentSetting, PaymentStatus, type PosBrainReadyMessage, type PosDataItem, type PriceModifierDetail, type PrinterDetails, type PrinterSettings, type PrinterSettingsMessage, ProcessorType, type ProdDiscountBreakdown, type ProdFeeBreakdown, type ProdModifierBreakdown, type Product, type ProductTaxDetails, type ProductVariant, type PubsubEventMessage, type PubsubSubscribeMessage, type PubsubTopicsListMessage, type PubsubTopicsRequestMessage, type Reader, type ReaderAvailability, type ReaderCapabilities, type ReaderCapabilitiesMessage, type Refund, type RefundCartDiscount, type RefundDiscount, type RefundItem, type RefundItemDiscount, type RefundLineItem, type RefundPayment, type RefundProcessingStatus, type RefundSummary, type RefundTip, type RefundedCustomSale, type RefundedLineItem, type RefundedTipPayment, type ResolvedModifier, type ResolvedModifierChoice, type Role, type RolePermission, type RuntimeReadyMessage, type SelectionContext, type SelectionFlowContext, type SelectionMessage, type SelectionRoleContext, type ServiceChannelMessage, type ServiceChannelMessageType, type ServiceInitMessage, type Session, type SessionClosingAmounts, type SmartGridSetting, type SmartGridSettings, type SmartGridSettingsData, type Station, type StripeAccount, type Summary, type SummaryPayments, type SyncProgressMessage, type Tax, type TaxRate, type TaxRateValue, type TaxTable, type TaxTableActive, type TaxTableRate, type TileGrid, type TimeClockEntry, type TimeClockEntryStatus, type Tip, type TipData, type TipPayment, type TipsDetails, type TokenRefreshMessage, type TopicDefinitionWire, type TopicEventWire, type Transaction, type TransactionPaymentData, type User, type UserType, type Variant, type VariantInventory };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@final-commerce/common",
3
- "version": "2.4.1-staging2.1",
3
+ "version": "2.5.0-preprod.1",
4
4
  "description": "Shared utilities, types, constants, and engineering governance configs for the Final Commerce platform.",
5
5
  "homepage": "https://github.com/Final-Commerce/common#readme",
6
6
  "bugs": {