@final-commerce/command-frame 0.8.0-online.3 → 0.8.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.
Files changed (102) hide show
  1. package/dist/CommonTypes.d.ts +26 -1
  2. package/dist/actions/add-booking-to-cart/action.d.ts +6 -0
  3. package/dist/actions/add-booking-to-cart/action.js +8 -0
  4. package/dist/actions/add-booking-to-cart/mock.d.ts +2 -0
  5. package/dist/actions/add-booking-to-cart/mock.js +42 -0
  6. package/dist/actions/add-booking-to-cart/types.d.ts +23 -0
  7. package/dist/actions/cancel-booking/action.d.ts +6 -0
  8. package/dist/actions/cancel-booking/action.js +8 -0
  9. package/dist/actions/cancel-booking/mock.d.ts +2 -0
  10. package/dist/actions/cancel-booking/mock.js +10 -0
  11. package/dist/actions/cancel-booking/types.d.ts +10 -0
  12. package/dist/actions/get-booking-availability/action.d.ts +6 -0
  13. package/dist/actions/get-booking-availability/action.js +8 -0
  14. package/dist/actions/get-booking-availability/mock.d.ts +2 -0
  15. package/dist/actions/get-booking-availability/mock.js +6 -0
  16. package/dist/actions/get-booking-availability/types.d.ts +18 -0
  17. package/dist/actions/get-booking-resources/action.d.ts +6 -0
  18. package/dist/actions/get-booking-resources/action.js +8 -0
  19. package/dist/actions/get-booking-resources/mock.d.ts +2 -0
  20. package/dist/actions/get-booking-resources/mock.js +7 -0
  21. package/dist/actions/get-booking-resources/types.d.ts +12 -0
  22. package/dist/actions/get-booking-resources/types.js +1 -0
  23. package/dist/actions/get-bookings/action.d.ts +6 -0
  24. package/dist/actions/get-bookings/action.js +8 -0
  25. package/dist/actions/get-bookings/mock.d.ts +2 -0
  26. package/dist/actions/get-bookings/mock.js +20 -0
  27. package/dist/actions/get-bookings/types.d.ts +18 -0
  28. package/dist/actions/get-bookings/types.js +1 -0
  29. package/dist/actions/get-context/mock.js +4 -0
  30. package/dist/actions/get-product-modifier-selections/action.d.ts +1 -1
  31. package/dist/actions/get-product-modifier-selections/action.js +2 -2
  32. package/dist/actions/get-product-modifier-selections/mock.d.ts +1 -1
  33. package/dist/actions/get-product-modifier-selections/mock.js +5 -5
  34. package/dist/actions/get-product-modifier-selections/types.d.ts +1 -1
  35. package/dist/actions/get-products/mock.js +6 -0
  36. package/dist/actions/get-products/types.d.ts +25 -3
  37. package/dist/actions/get-refund-plan/types.d.ts +5 -2
  38. package/dist/actions/get-remaining-refundable-quantities/mock.js +1 -0
  39. package/dist/actions/get-remaining-refundable-quantities/types.d.ts +8 -0
  40. package/dist/actions/hold-booking/action.d.ts +6 -0
  41. package/dist/actions/hold-booking/action.js +8 -0
  42. package/dist/actions/hold-booking/mock.d.ts +2 -0
  43. package/dist/actions/hold-booking/mock.js +33 -0
  44. package/dist/actions/hold-booking/types.d.ts +24 -0
  45. package/dist/actions/hold-booking/types.js +1 -0
  46. package/dist/actions/process-partial-refund/types.d.ts +2 -2
  47. package/dist/actions/remove-booking-from-cart/action.d.ts +6 -0
  48. package/dist/actions/remove-booking-from-cart/action.js +8 -0
  49. package/dist/actions/remove-booking-from-cart/mock.d.ts +2 -0
  50. package/dist/actions/remove-booking-from-cart/mock.js +26 -0
  51. package/dist/actions/remove-booking-from-cart/types.d.ts +12 -0
  52. package/dist/actions/remove-booking-from-cart/types.js +1 -0
  53. package/dist/actions/set-product-modifier-selections/action.d.ts +1 -1
  54. package/dist/actions/set-product-modifier-selections/action.js +2 -2
  55. package/dist/actions/set-product-modifier-selections/mock.d.ts +1 -1
  56. package/dist/actions/set-product-modifier-selections/mock.js +7 -7
  57. package/dist/actions/set-product-modifier-selections/types.d.ts +2 -2
  58. package/dist/demo/database.d.ts +12 -1
  59. package/dist/demo/database.js +127 -0
  60. package/dist/index.d.ts +16 -6
  61. package/dist/index.js +15 -5
  62. package/dist/projects/render/mocks.js +14 -4
  63. package/dist/projects/render/types.d.ts +8 -13
  64. package/dist/pubsub/topics/bookings/booking-created/types.d.ts +6 -0
  65. package/dist/pubsub/topics/bookings/booking-created/types.js +1 -0
  66. package/dist/pubsub/topics/bookings/booking-setup-changed/types.d.ts +15 -0
  67. package/dist/pubsub/topics/bookings/booking-setup-changed/types.js +1 -0
  68. package/dist/pubsub/topics/bookings/booking-updated/types.d.ts +6 -0
  69. package/dist/pubsub/topics/bookings/booking-updated/types.js +1 -0
  70. package/dist/pubsub/topics/bookings/index.d.ts +3 -0
  71. package/dist/pubsub/topics/bookings/index.js +27 -0
  72. package/dist/pubsub/topics/bookings/types.d.ts +8 -0
  73. package/dist/pubsub/topics/bookings/types.js +3 -0
  74. package/dist/pubsub/topics/cart/product-modifiers-updated/types.d.ts +2 -2
  75. package/dist/pubsub/topics/cart/types.d.ts +33 -33
  76. package/dist/pubsub/topics/cart/types.js +16 -16
  77. package/dist/pubsub/topics/index.d.ts +17 -17
  78. package/dist/pubsub/topics/index.js +17 -17
  79. package/dist/pubsub/topics/types.d.ts +2 -8
  80. package/package.json +2 -2
  81. package/dist/actions/resume-checkout/action.d.ts +0 -6
  82. package/dist/actions/resume-checkout/action.js +0 -8
  83. package/dist/actions/resume-checkout/mock.d.ts +0 -16
  84. package/dist/actions/resume-checkout/mock.js +0 -51
  85. package/dist/actions/resume-checkout/types.d.ts +0 -59
  86. package/dist/actions/resume-checkout/types.js +0 -13
  87. package/dist/actions/start-checkout/action.d.ts +0 -6
  88. package/dist/actions/start-checkout/action.js +0 -8
  89. package/dist/actions/start-checkout/mock.d.ts +0 -16
  90. package/dist/actions/start-checkout/mock.js +0 -80
  91. package/dist/actions/start-checkout/types.d.ts +0 -81
  92. package/dist/actions/start-checkout/types.js +0 -10
  93. package/dist/pubsub/topics/checkout/checkout-started/types.d.ts +0 -26
  94. package/dist/pubsub/topics/checkout/index.d.ts +0 -7
  95. package/dist/pubsub/topics/checkout/index.js +0 -28
  96. package/dist/pubsub/topics/checkout/payment-completed/types.d.ts +0 -31
  97. package/dist/pubsub/topics/checkout/payment-failed/types.d.ts +0 -20
  98. package/dist/pubsub/topics/checkout/types.d.ts +0 -12
  99. package/dist/pubsub/topics/checkout/types.js +0 -8
  100. /package/dist/{pubsub/topics/checkout/checkout-started → actions/add-booking-to-cart}/types.js +0 -0
  101. /package/dist/{pubsub/topics/checkout/payment-completed → actions/cancel-booking}/types.js +0 -0
  102. /package/dist/{pubsub/topics/checkout/payment-failed → actions/get-booking-availability}/types.js +0 -0
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Remove booking from cart action
3
+ * Calls the removeBookingFromCart action on the parent window
4
+ */
5
+ import { commandFrameClient } from '../../client';
6
+ export const removeBookingFromCart = async (params) => {
7
+ return await commandFrameClient.call('removeBookingFromCart', params);
8
+ };
@@ -0,0 +1,2 @@
1
+ import { RemoveBookingFromCart } from './types';
2
+ export declare const mockRemoveBookingFromCart: RemoveBookingFromCart;
@@ -0,0 +1,26 @@
1
+ import { MOCK_BOOKINGS, MOCK_CART, mockPublishEvent } from '../../demo/database';
2
+ export const mockRemoveBookingFromCart = async (params) => {
3
+ console.log('[Mock] removeBookingFromCart called', params);
4
+ const reservations = MOCK_CART.reservations ?? [];
5
+ const cartIndex = reservations.findIndex(({ internalId }) => internalId === params.reservationInternalId);
6
+ const [removed] = cartIndex >= 0 ? reservations.splice(cartIndex, 1) : [];
7
+ if (removed) {
8
+ const line = removed.total || removed.price * (removed.quantity ?? 1);
9
+ MOCK_CART.subtotal -= line;
10
+ MOCK_CART.total -= line;
11
+ MOCK_CART.amountToBeCharged = MOCK_CART.total;
12
+ MOCK_CART.remainingBalance = MOCK_CART.total;
13
+ mockPublishEvent('cart', 'reservation-removed', { reservation: removed });
14
+ }
15
+ // The hold has to go back, or the mock is a trap: `addBookingToCart` pushes into the very list
16
+ // availability reads, so add → remove → add the same slot used to refuse forever with "that
17
+ // window has just been taken". The reservation id is `res_<booking.id>`, the link back to the row.
18
+ const bookingId = removed?.bookingId ?? params.reservationInternalId.replace(/^res_/, '');
19
+ const index = MOCK_BOOKINGS.findIndex(({ id }) => id === bookingId);
20
+ const [released] = index >= 0 ? MOCK_BOOKINGS.splice(index, 1) : [];
21
+ return {
22
+ reservationInternalId: params.reservationInternalId,
23
+ booking: released,
24
+ timestamp: new Date().toISOString(),
25
+ };
26
+ };
@@ -0,0 +1,12 @@
1
+ import { CFBooking } from '../../CommonTypes';
2
+ export interface RemoveBookingFromCartParams {
3
+ /** The reservation's own id, as `addBookingToCart` returned it. */
4
+ reservationInternalId: string;
5
+ }
6
+ export interface RemoveBookingFromCartResponse {
7
+ reservationInternalId: string;
8
+ /** The released hold, so the caller can see it is no longer held. */
9
+ booking?: CFBooking;
10
+ timestamp: string;
11
+ }
12
+ export type RemoveBookingFromCart = (params: RemoveBookingFromCartParams) => Promise<RemoveBookingFromCartResponse>;
@@ -0,0 +1 @@
1
+ export {};
@@ -2,5 +2,5 @@
2
2
  * Set product modifier selections action
3
3
  * Calls the setProductModifierSelections action on the parent window
4
4
  */
5
- import type { SetProductModifierSelections } from "./types";
5
+ import type { SetProductModifierSelections } from './types';
6
6
  export declare const setProductModifierSelections: SetProductModifierSelections;
@@ -2,7 +2,7 @@
2
2
  * Set product modifier selections action
3
3
  * Calls the setProductModifierSelections action on the parent window
4
4
  */
5
- import { commandFrameClient } from "../../client";
5
+ import { commandFrameClient } from '../../client';
6
6
  export const setProductModifierSelections = async (params) => {
7
- return await commandFrameClient.call("setProductModifierSelections", params);
7
+ return await commandFrameClient.call('setProductModifierSelections', params);
8
8
  };
@@ -1,2 +1,2 @@
1
- import { SetProductModifierSelections } from "./types";
1
+ import { SetProductModifierSelections } from './types';
2
2
  export declare const mockSetProductModifierSelections: SetProductModifierSelections;
@@ -1,15 +1,15 @@
1
- import { MOCK_CART, MOCK_PRODUCTS, buildCartLineModifiers, buildModifierRows } from "../../demo/database";
1
+ import { MOCK_CART, MOCK_PRODUCTS, buildCartLineModifiers, buildModifierRows } from '../../demo/database';
2
2
  export const mockSetProductModifierSelections = async (params) => {
3
- console.log("[Mock] setProductModifierSelections called", params);
3
+ console.log('[Mock] setProductModifierSelections called', params);
4
4
  if (!params?.selections) {
5
5
  return {
6
6
  success: false,
7
- reason: "selections is required (pass [] to clear)",
7
+ reason: 'selections is required (pass [] to clear)',
8
8
  internalId: params?.internalId,
9
9
  selections: [],
10
10
  rows: [],
11
11
  modifiersTotal: 0,
12
- timestamp: new Date().toISOString()
12
+ timestamp: new Date().toISOString(),
13
13
  };
14
14
  }
15
15
  // Write the selections onto the mock cart line (last line when no internalId).
@@ -22,12 +22,12 @@ export const mockSetProductModifierSelections = async (params) => {
22
22
  if (!line) {
23
23
  return {
24
24
  success: false,
25
- reason: "No matching cart line",
25
+ reason: 'No matching cart line',
26
26
  internalId: params.internalId,
27
27
  selections: [],
28
28
  rows: [],
29
29
  modifiersTotal: 0,
30
- timestamp: new Date().toISOString()
30
+ timestamp: new Date().toISOString(),
31
31
  };
32
32
  }
33
33
  // Full replacement — passing [] clears the rows. The line drops the product's resolved
@@ -44,6 +44,6 @@ export const mockSetProductModifierSelections = async (params) => {
44
44
  selections: params.selections,
45
45
  rows,
46
46
  modifiersTotal,
47
- timestamp: new Date().toISOString()
47
+ timestamp: new Date().toISOString(),
48
48
  };
49
49
  };
@@ -1,5 +1,5 @@
1
- import type { ModifierSelection } from "../get-product-modifier-selections/types";
2
- import type { CFProdModifierBreakdown } from "../../CommonTypes";
1
+ import type { ModifierSelection } from '../get-product-modifier-selections/types';
2
+ import type { CFProdModifierBreakdown } from '../../CommonTypes';
3
3
  export interface SetProductModifierSelectionsParams {
4
4
  /** The cart line to edit. Defaults to the active product's line. */
5
5
  internalId?: string;
@@ -2,7 +2,7 @@
2
2
  * Mock Database for Standalone/Demo Mode
3
3
  * Stores mock data that mimics the Render environment
4
4
  */
5
- import { CFActiveCompany, CFActiveUser, CFActiveStation, CFActiveOutlet, CFActiveOrder, CFCustomer, CFProduct, CFActiveCart, CFCategory, CFActiveProduct, CFSession, CFActiveRefundDetails, CFSmartGridLayout, CFCartLineModifier, CFProdModifierBreakdown, CFModifierSelection, CFResolvedModifier } from '../CommonTypes';
5
+ import { CFActiveCompany, CFActiveUser, CFActiveStation, CFActiveOutlet, CFActiveOrder, CFCustomer, CFProduct, CFActiveCart, CFCategory, CFActiveProduct, CFSession, CFActiveRefundDetails, CFSmartGridLayout, CFBooking, CFBookingAvailability, CFBookingResource, CFCartLineModifier, CFProdModifierBreakdown, CFModifierSelection, CFResolvedModifier } from '../CommonTypes';
6
6
  export * from './mocks';
7
7
  /** Replace mock catalog / context data in place (same array references mock handlers use). */
8
8
  export interface MockDatabaseConfig {
@@ -15,6 +15,10 @@ export interface MockDatabaseConfig {
15
15
  products?: CFProduct[];
16
16
  orders?: CFActiveOrder[];
17
17
  parkedOrders?: CFActiveOrder[];
18
+ /** Who is scarce: the staff, rooms or machines the dataset's services are booked against. */
19
+ bookingResources?: CFBookingResource[];
20
+ /** Windows already taken when the dataset loads, so a calendar does not open empty. */
21
+ bookings?: CFBooking[];
18
22
  }
19
23
  export declare const MOCK_COMPANY: CFActiveCompany;
20
24
  export declare const MOCK_OUTLET_MAIN: CFActiveOutlet;
@@ -59,6 +63,7 @@ export declare const MOCK_STATIONS: import("@final-commerce/common/pos-types").A
59
63
  export declare const MOCK_OUTLETS: import("@final-commerce/common/pos-types").ActiveOutlet[];
60
64
  export declare const MOCK_CUSTOMERS: import("@final-commerce/common/pos-types").ActiveCustomer[];
61
65
  export declare const MOCK_CATEGORIES: import("@final-commerce/common/pos-types").Category[];
66
+ export declare const MOCK_PRODUCT_HAIRCUT: CFProduct;
62
67
  export declare const MOCK_PRODUCTS: import("@final-commerce/common/pos-types").FullProduct[];
63
68
  export declare const MOCK_ORDERS: import("@final-commerce/common/pos-types").ActiveOrder[];
64
69
  export declare const MOCK_PARKED_ORDERS: CFActiveOrder[];
@@ -87,6 +92,12 @@ export declare const createOrderFromCart: (paymentType: string, amount: number,
87
92
  * open with `amountToBeCharged` reset to what's left, and returns null.
88
93
  */
89
94
  export declare const applyMockPayment: (amount: number, paymentType: string, processor?: string) => CFActiveOrder | null;
95
+ export declare const MOCK_BOOKING_RULES_ID = "rule_salon_30";
96
+ export declare const MOCK_BOOKING_RESOURCES: CFBookingResource[];
97
+ export declare const MOCK_BOOKINGS: CFBooking[];
98
+ /** Live = confirmed, or held and not yet expired. An expired hold occupies nothing. */
99
+ export declare const mockLiveBookings: () => CFBooking[];
100
+ export declare const mockBookingAvailability: (productId: string, from: Date, to: Date, resourceId?: string) => CFBookingAvailability;
90
101
  /**
91
102
  * Price the cashier's raw modifier answers into the rows a CART line carries (FT-0010).
92
103
  *
@@ -4,6 +4,7 @@
4
4
  */
5
5
  import { CFProductType, CFUserTypes, CurrencyCode, } from '../CommonTypes';
6
6
  import { extendPrice, resolveUnit, toBase } from '@final-commerce/common';
7
+ import { BookingRatePeriod, BookingResourceKind, BookingType, ReservationStatus } from '@final-commerce/common';
7
8
  export * from './mocks';
8
9
  // Asset Imports - Using Remote URLs to avoid build complexity with asset copying
9
10
  const ASSETS_BASE_URL = 'https://raw.githubusercontent.com/Final-Commerce/command-frame/refs/heads/main/src/demo/assets';
@@ -649,6 +650,14 @@ export const MOCK_CATEGORIES = [
649
650
  MOCK_CATEGORY_VEGAN,
650
651
  MOCK_CATEGORY_SPICY,
651
652
  ];
653
+ // A service, not a thing on a shelf: no stock, sold as a slot of somebody's time.
654
+ // `bookingRulesId` is what tells a catalogue screen to ask for slots instead of stock.
655
+ export const MOCK_PRODUCT_HAIRCUT = {
656
+ ...createSimpleProduct('prod_haircut', 'Haircut', 4500, '', [MOCK_CATEGORY_SPECIALTY], 'Cut and finish, 30 minutes.'),
657
+ images: [],
658
+ productType: CFProductType.BOOKING,
659
+ bookingRulesId: 'rule_salon_30',
660
+ };
652
661
  export const MOCK_PRODUCTS = [
653
662
  MOCK_PRODUCT_BASIL_ALMOND,
654
663
  MOCK_PRODUCT_BEER,
@@ -664,6 +673,7 @@ export const MOCK_PRODUCTS = [
664
673
  MOCK_PRODUCT_CHILI_GARLIC,
665
674
  MOCK_PRODUCT_HABANERO,
666
675
  MOCK_PRODUCT_BLACK_GARLIC,
676
+ MOCK_PRODUCT_HAIRCUT,
667
677
  ];
668
678
  export const MOCK_ORDERS = [MOCK_ORDER_1, MOCK_ORDER_2, MOCK_ORDER_3, MOCK_ORDER_4];
669
679
  export const MOCK_PARKED_ORDERS = [MOCK_PARKED_ORDER_1, MOCK_PARKED_ORDER_2];
@@ -678,6 +688,7 @@ export let MOCK_CART = {
678
688
  remainingBalance: 0,
679
689
  products: [],
680
690
  customSales: [],
691
+ reservations: [],
681
692
  nonRevenueItems: [],
682
693
  customer: null,
683
694
  };
@@ -698,6 +709,7 @@ export const resetMockCart = () => {
698
709
  remainingBalance: 0,
699
710
  products: [],
700
711
  customSales: [],
712
+ reservations: [],
701
713
  nonRevenueItems: [],
702
714
  customer: null,
703
715
  };
@@ -742,6 +754,12 @@ export function setMockDatabase(config) {
742
754
  if (config.parkedOrders !== undefined) {
743
755
  MOCK_PARKED_ORDERS.splice(0, MOCK_PARKED_ORDERS.length, ...config.parkedOrders);
744
756
  }
757
+ if (config.bookingResources !== undefined) {
758
+ MOCK_BOOKING_RESOURCES.splice(0, MOCK_BOOKING_RESOURCES.length, ...config.bookingResources);
759
+ }
760
+ if (config.bookings !== undefined) {
761
+ MOCK_BOOKINGS.splice(0, MOCK_BOOKINGS.length, ...config.bookings);
762
+ }
745
763
  if (MOCK_OUTLETS.length > 0) {
746
764
  Object.assign(MOCK_OUTLET_MAIN, MOCK_OUTLETS[0]);
747
765
  if (MOCK_OUTLET_MAIN.id === undefined && MOCK_OUTLET_MAIN._id !== undefined) {
@@ -878,6 +896,30 @@ export const createOrderFromCart = (paymentType, amount, processor = 'cash') =>
878
896
  billing: MOCK_CART.customer?.billing || null,
879
897
  shipping: MOCK_CART.customer?.shipping || null,
880
898
  lineItems,
899
+ // A paid booking is a sale: it belongs on the order (and thus the receipt),
900
+ // in its own array rather than among the line items, and CONFIRMED — payment
901
+ // is what turns a held window into a kept appointment.
902
+ reservations: (MOCK_CART.reservations ?? []).map((reservation) => ({
903
+ internalId: reservation.internalId,
904
+ bookingId: reservation.bookingId,
905
+ productId: reservation.productId,
906
+ variantId: reservation.variantId,
907
+ resourceId: reservation.resourceId,
908
+ name: reservation.name,
909
+ resourceName: reservation.resourceName,
910
+ price: reservation.price,
911
+ quantity: reservation.quantity,
912
+ total: reservation.total,
913
+ taxTableId: reservation.taxTableId,
914
+ startAt: reservation.startAt,
915
+ endAt: reservation.endAt,
916
+ bufferEndAt: reservation.bufferEndAt,
917
+ // The mock computes no tax anywhere — line items ship `taxes: []` too.
918
+ taxes: [],
919
+ // Neither `expiresAt` nor a status comes along: a booking's state lives on its own
920
+ // row — which is what `getBookings` reads — and a copy frozen on the order would be
921
+ // wrong from the next moment on.
922
+ })),
881
923
  customSales: [],
882
924
  balance: 0,
883
925
  user: employeeUser,
@@ -914,6 +956,91 @@ export const applyMockPayment = (amount, paymentType, processor = 'cash') => {
914
956
  mockPublishEvent('payments', 'payment-done', { order });
915
957
  return order;
916
958
  };
959
+ // ── Booking (FT-0064) ────────────────────────────────────────────────────────────
960
+ // A salon: one service, two people who can perform it, a 30-minute slot with a
961
+ // 5-minute turnaround, open 9–18. Enough to click through a booking screen with no
962
+ // server. Availability here is COMPUTED, exactly as the host computes it — a mock
963
+ // that returned a fixed list of slots would hide the one behaviour that matters:
964
+ // a slot disappears once somebody takes it.
965
+ export const MOCK_BOOKING_RULES_ID = 'rule_salon_30';
966
+ const SLOT_MINUTES = 30;
967
+ const BUFFER_MINUTES = 5;
968
+ const OPEN_HOUR = 9;
969
+ const CLOSE_HOUR = 18;
970
+ // Rooms, not people: a resource is whatever is scarce, and a room is the case that
971
+ // reads the same in every vertical a dataset might describe.
972
+ export const MOCK_BOOKING_RESOURCES = [
973
+ { id: 'res_room_1', name: 'Room 1', kind: BookingResourceKind.ROOM },
974
+ { id: 'res_room_2', name: 'Room 2', kind: BookingResourceKind.ROOM },
975
+ ];
976
+ const at = (dayOffset, hour, minute = 0) => {
977
+ const date = new Date();
978
+ date.setDate(date.getDate() + dayOffset);
979
+ date.setHours(hour, minute, 0, 0);
980
+ return date;
981
+ };
982
+ const booking = (id, resourceId, start, status, customerName) => ({
983
+ id,
984
+ productId: MOCK_PRODUCT_HAIRCUT._id,
985
+ resourceId,
986
+ startAt: start.toISOString(),
987
+ endAt: new Date(start.getTime() + SLOT_MINUTES * 60000).toISOString(),
988
+ bufferEndAt: new Date(start.getTime() + (SLOT_MINUTES + BUFFER_MINUTES) * 60000).toISOString(),
989
+ status,
990
+ productName: MOCK_PRODUCT_HAIRCUT.name,
991
+ resourceName: MOCK_BOOKING_RESOURCES.find((resource) => resource.id === resourceId)?.name,
992
+ customerName,
993
+ });
994
+ export const MOCK_BOOKINGS = [
995
+ booking('bk_1', 'res_room_1', at(0, 10), ReservationStatus.CONFIRMED, 'Alex Green'),
996
+ booking('bk_2', 'res_room_2', at(0, 11, 30), ReservationStatus.CONFIRMED, 'Dana White'),
997
+ booking('bk_3', 'res_room_1', at(1, 9, 30), ReservationStatus.CONFIRMED, 'Sam Blue'),
998
+ ];
999
+ /** Live = confirmed, or held and not yet expired. An expired hold occupies nothing. */
1000
+ export const mockLiveBookings = () => MOCK_BOOKINGS.filter(({ status, expiresAt }) => status === ReservationStatus.CONFIRMED ||
1001
+ (status === ReservationStatus.HELD && (!expiresAt || new Date(expiresAt) > new Date())));
1002
+ const takenBy = (resourceId, startAt, bufferEndAt) => mockLiveBookings().some((entry) => entry.resourceId === resourceId && new Date(entry.startAt) < bufferEndAt && new Date(entry.bufferEndAt) > startAt);
1003
+ export const mockBookingAvailability = (productId, from, to, resourceId) => {
1004
+ const serving = resourceId
1005
+ ? MOCK_BOOKING_RESOURCES.filter((resource) => resource.id === resourceId)
1006
+ : MOCK_BOOKING_RESOURCES;
1007
+ const slots = [];
1008
+ const step = (SLOT_MINUTES + BUFFER_MINUTES) * 60000;
1009
+ for (let day = 0; day < 14; day += 1) {
1010
+ const open = at(day, OPEN_HOUR);
1011
+ if (open < from || open > to)
1012
+ continue;
1013
+ const close = at(day, CLOSE_HOUR);
1014
+ for (let start = open.getTime(); start + SLOT_MINUTES * 60000 <= close.getTime(); start += step) {
1015
+ const startAt = new Date(start);
1016
+ const endAt = new Date(start + SLOT_MINUTES * 60000);
1017
+ const bufferEndAt = new Date(start + (SLOT_MINUTES + BUFFER_MINUTES) * 60000);
1018
+ if (bufferEndAt < new Date())
1019
+ continue;
1020
+ const resources = serving.map((resource) => {
1021
+ const free = takenBy(resource.id, startAt, bufferEndAt) ? 0 : 1;
1022
+ return { resourceId: resource.id, name: resource.name, capacity: 1, booked: 1 - free, free };
1023
+ });
1024
+ slots.push({
1025
+ startAt: startAt.toISOString(),
1026
+ endAt: endAt.toISOString(),
1027
+ bufferEndAt: bufferEndAt.toISOString(),
1028
+ canStart: true,
1029
+ capacity: resources.length,
1030
+ booked: resources.reduce((sum, entry) => sum + entry.booked, 0),
1031
+ free: resources.reduce((sum, entry) => sum + entry.free, 0),
1032
+ resources,
1033
+ });
1034
+ }
1035
+ }
1036
+ return {
1037
+ productId,
1038
+ bookingRulesId: MOCK_BOOKING_RULES_ID,
1039
+ bookingType: BookingType.APPOINTMENT,
1040
+ ratePeriod: BookingRatePeriod.SLOT,
1041
+ slots,
1042
+ };
1043
+ };
917
1044
  /**
918
1045
  * Price the cashier's raw modifier answers into the rows a CART line carries (FT-0010).
919
1046
  *
package/dist/index.d.ts CHANGED
@@ -2,6 +2,13 @@ export declare const command: {
2
2
  readonly exampleFunction: import(".").ExampleFunction;
3
3
  readonly generateAPIKey: import(".").GenerateAPIKey;
4
4
  readonly getProducts: import(".").GetProducts;
5
+ readonly getBookingResources: import(".").GetBookingResources;
6
+ readonly getBookingAvailability: import(".").GetBookingAvailability;
7
+ readonly getBookings: import(".").GetBookings;
8
+ readonly holdBooking: import(".").HoldBooking;
9
+ readonly addBookingToCart: import(".").AddBookingToCart;
10
+ readonly removeBookingFromCart: import(".").RemoveBookingFromCart;
11
+ readonly cancelBooking: import(".").CancelBooking;
5
12
  readonly addCustomSale: import(".").AddCustomSale;
6
13
  readonly editCustomSale: import(".").EditCustomSale;
7
14
  readonly addNonRevenueItem: import(".").AddNonRevenueItem;
@@ -45,8 +52,6 @@ export declare const command: {
45
52
  readonly integrationPayment: import(".").IntegrationPayment;
46
53
  readonly createPaymentLink: import(".").CreatePaymentLink;
47
54
  readonly chargeMoto: import(".").ChargeMoto;
48
- readonly startCheckout: import(".").StartCheckout;
49
- readonly resumeCheckout: import(".").ResumeCheckout;
50
55
  readonly addCustomerNote: import(".").AddCustomerNote;
51
56
  readonly removeCustomerNote: import(".").RemoveCustomerNote;
52
57
  readonly removeCustomerFromCart: import(".").RemoveCustomerFromCart;
@@ -123,6 +128,13 @@ export declare const command: {
123
128
  export type { ExampleFunction, ExampleFunctionParams, ExampleFunctionResponse } from './actions/example-function/types';
124
129
  export type { GenerateAPIKey, GenerateAPIKeyParams, GenerateAPIKeyResponse } from './actions/generate-api-key/types';
125
130
  export type { GetProducts, GetProductsParams, GetProductsResponse } from './actions/get-products/types';
131
+ export type { GetBookingResources, GetBookingResourcesParams, GetBookingResourcesResponse, } from './actions/get-booking-resources/types';
132
+ export type { GetBookingAvailability, GetBookingAvailabilityParams, GetBookingAvailabilityResponse, } from './actions/get-booking-availability/types';
133
+ export type { GetBookings, GetBookingsParams, GetBookingsResponse } from './actions/get-bookings/types';
134
+ export type { HoldBooking, HoldBookingParams, HoldBookingResponse } from './actions/hold-booking/types';
135
+ export type { AddBookingToCart, AddBookingToCartParams, AddBookingToCartResponse, } from './actions/add-booking-to-cart/types';
136
+ export type { RemoveBookingFromCart, RemoveBookingFromCartParams, RemoveBookingFromCartResponse, } from './actions/remove-booking-from-cart/types';
137
+ export type { CancelBooking, CancelBookingParams, CancelBookingResponse } from './actions/cancel-booking/types';
126
138
  export type { AddCustomSale, AddCustomSaleParams, AddCustomSaleResponse } from './actions/add-custom-sale/types';
127
139
  export type { EditCustomSale, EditCustomSaleParams, EditCustomSaleResponse } from './actions/edit-custom-sale/types';
128
140
  export type { AddNonRevenueItem, AddNonRevenueItemParams, AddNonRevenueItemResponse, } from './actions/add-non-revenue-item/types';
@@ -184,8 +196,6 @@ export type { RedeemPayment, RedeemPaymentParams, RedeemPaymentResponse } from '
184
196
  export type { IntegrationPayment, IntegrationPaymentParams, IntegrationPaymentResponse, IntegrationEmvData, } from './actions/integration-payment/types';
185
197
  export type { CreatePaymentLink, CreatePaymentLinkParams, CreatePaymentLinkResponse, } from './actions/create-payment-link/types';
186
198
  export type { ChargeMoto, ChargeMotoParams, ChargeMotoResponse, ChargeMotoCardFields, } from './actions/charge-moto/types';
187
- export type { StartCheckout, StartCheckoutParams, StartCheckoutResponse, StartCheckoutContact, StartCheckoutOrder, } from './actions/start-checkout/types';
188
- export type { ResumeCheckout, ResumeCheckoutParams, ResumeCheckoutResponse, ResumeCheckoutResult, } from './actions/resume-checkout/types';
189
199
  export type { AddCustomerNote, AddCustomerNoteParams, AddCustomerNoteResponse, } from './actions/add-customer-note/types';
190
200
  export type { RemoveCustomerNote, RemoveCustomerNoteParams, RemoveCustomerNoteResponse, } from './actions/remove-customer-note/types';
191
201
  export type { RemoveCustomerFromCart, RemoveCustomerFromCartResponse } from './actions/remove-customer-from-cart/types';
@@ -242,7 +252,6 @@ export { refundsTopic } from './pubsub/topics/refunds';
242
252
  export { productsTopic } from './pubsub/topics/products';
243
253
  export { cartTopic } from './pubsub/topics/cart';
244
254
  export { paymentsTopic } from './pubsub/topics/payments';
245
- export { checkoutTopic } from './pubsub/topics/checkout';
246
255
  export { splitPaymentsTopic } from './pubsub/topics/split-payments';
247
256
  export { customTablesTopic } from './pubsub/topics/custom-tables';
248
257
  export { printTopic } from './pubsub/topics/print';
@@ -254,6 +263,7 @@ export { variantsTopic } from './pubsub/topics/variants';
254
263
  export { transactionsTopic } from './pubsub/topics/transactions';
255
264
  export { categoriesTopic } from './pubsub/topics/categories';
256
265
  export { attributesTopic } from './pubsub/topics/attributes';
266
+ export { bookingsTopic } from './pubsub/topics/bookings';
257
267
  export type { CustomerCreatedPayload, CustomerUpdatedPayload, CustomerNoteAddedPayload, CustomerNoteDeletedPayload, CustomerAssignedPayload, CustomerUnassignedPayload, CustomerActiveSetPayload, CustomerActiveGetPayload, CustomerCreatedEvent, CustomerUpdatedEvent, CustomerNoteAddedEvent, CustomerNoteDeletedEvent, CustomerAssignedEvent, CustomerUnassignedEvent, CustomerActiveSetEvent, CustomerActiveGetEvent, CustomersEventType, CustomersEventPayload, } from './pubsub/topics/customers/types';
258
268
  export type { OrderCreatedPayload, OrderUpdatedPayload, OrderVoidedPayload, OrderActiveSetPayload, OrderActiveGetPayload, OrderCreatedEvent, OrderUpdatedEvent, OrderVoidedEvent, OrderActiveSetEvent, OrderActiveGetEvent, OrderStateTransitionCompletedPayload, OrderStateTransitionBlockedPayload, OrderStateTransitionCompletedEvent, OrderStateTransitionBlockedEvent, OrdersEventType, OrdersEventPayload, } from './pubsub/topics/orders/types';
259
269
  export type { RefundCreatedPayload, RefundUpdatedPayload, RefundActiveSetPayload, RefundActiveGetPayload, RefundCreatedEvent, RefundUpdatedEvent, RefundActiveSetEvent, RefundActiveGetEvent, RefundsEventType, RefundsEventPayload, } from './pubsub/topics/refunds/types';
@@ -264,11 +274,11 @@ export type { SessionActiveSetPayload, SessionActiveGetPayload, SessionActiveSet
264
274
  export type { UserActiveSetPayload, UserActiveGetPayload, UserActiveSetEvent, UserActiveGetEvent, UserCreatedPayload, UserCreatedEvent, UserUpdatedPayload, UserUpdatedEvent, UsersEventType, UsersEventPayload, } from './pubsub/topics/users/types';
265
275
  export type { VariantCreatedPayload, VariantCreatedEvent, VariantUpdatedPayload, VariantUpdatedEvent, VariantsEventType, VariantsEventPayload, } from './pubsub/topics/variants/types';
266
276
  export type { TransactionCreatedPayload, TransactionCreatedEvent, TransactionUpdatedPayload, TransactionUpdatedEvent, TransactionsEventType, TransactionsEventPayload, } from './pubsub/topics/transactions/types';
277
+ export type { BookingCreatedPayload, BookingCreatedEvent, BookingUpdatedPayload, BookingUpdatedEvent, BookingSetupChangedPayload, BookingSetupChangedEvent, BookingsEventType, BookingsEventPayload, } from './pubsub/topics/bookings/types';
267
278
  export type { CategoryCreatedPayload, CategoryCreatedEvent, CategoryUpdatedPayload, CategoryUpdatedEvent, CategoriesEventType, CategoriesEventPayload, } from './pubsub/topics/categories/types';
268
279
  export type { AttributeCreatedPayload, AttributeCreatedEvent, AttributeUpdatedPayload, AttributeUpdatedEvent, AttributesEventType, AttributesEventPayload, } from './pubsub/topics/attributes/types';
269
280
  export type { CartCreatedPayload, CartCustomerAssignedPayload, ProductAddedPayload, ProductDeletedPayload, CartDiscountAddedPayload, CartDiscountRemovedPayload, CartFeeAddedPayload, CartFeeRemovedPayload, ProductDiscountAddedPayload, ProductDiscountRemovedPayload, ProductFeeAddedPayload, ProductFeeRemovedPayload, ProductNoteAddedPayload, ProductNoteRemovedPayload, CartCreatedEvent, CartCustomerAssignedEvent, ProductAddedEvent, ProductDeletedEvent, CartDiscountAddedEvent, CartDiscountRemovedEvent, CartFeeAddedEvent, CartFeeRemovedEvent, ProductDiscountAddedEvent, ProductDiscountRemovedEvent, ProductFeeAddedEvent, ProductFeeRemovedEvent, ProductNoteAddedEvent, ProductNoteRemovedEvent, CartEventType, CartEventPayload, } from './pubsub/topics/cart/types';
270
281
  export type { PaymentDonePayload, PaymentErrPayload, PaymentDoneEvent, PaymentErrEvent, PaymentsEventType, PaymentsEventPayload, } from './pubsub/topics/payments/types';
271
- export type { CheckoutStartedPayload, PaymentCompletedPayload, PaymentFailedPayload, CheckoutStartedEvent, PaymentCompletedEvent, PaymentFailedEvent, CheckoutEventType, CheckoutEventPayload, } from './pubsub/topics/checkout/types';
272
282
  export type { SplitPaymentUpdatedPayload, SplitPaymentUpdatedEvent, SplitPaymentsEventType, SplitPaymentsEventPayload, } from './pubsub/topics/split-payments/types';
273
283
  export type { RowCreatedPayload, RowUpdatedPayload, RowDeletedPayload, RowCreatedEvent, RowUpdatedEvent, RowDeletedEvent, CustomTablesEventType, CustomTablesEventPayload, } from './pubsub/topics/custom-tables/types';
274
284
  export type { PrintStartedPayload, PrintCompletedPayload, PrintErrorPayload, PrintStartedEvent, PrintCompletedEvent, PrintErrorEvent, PrintEventType, PrintEventPayload, } from './pubsub/topics/print/types';
package/dist/index.js CHANGED
@@ -1,6 +1,13 @@
1
1
  // Import actions from new folder structure
2
2
  import { exampleFunction } from './actions/example-function/action';
3
3
  import { getProducts } from './actions/get-products/action';
4
+ import { getBookingResources } from './actions/get-booking-resources/action';
5
+ import { getBookingAvailability } from './actions/get-booking-availability/action';
6
+ import { getBookings } from './actions/get-bookings/action';
7
+ import { holdBooking } from './actions/hold-booking/action';
8
+ import { addBookingToCart } from './actions/add-booking-to-cart/action';
9
+ import { removeBookingFromCart } from './actions/remove-booking-from-cart/action';
10
+ import { cancelBooking } from './actions/cancel-booking/action';
4
11
  import { addCustomSale } from './actions/add-custom-sale/action';
5
12
  import { editCustomSale } from './actions/edit-custom-sale/action';
6
13
  import { addNonRevenueItem } from './actions/add-non-revenue-item/action';
@@ -45,8 +52,6 @@ import { redeemPayment } from './actions/redeem-payment/action';
45
52
  import { integrationPayment } from './actions/integration-payment/action';
46
53
  import { createPaymentLink } from './actions/create-payment-link/action';
47
54
  import { chargeMoto } from './actions/charge-moto/action';
48
- import { startCheckout } from './actions/start-checkout/action';
49
- import { resumeCheckout } from './actions/resume-checkout/action';
50
55
  // Customer Actions
51
56
  import { addCustomerNote } from './actions/add-customer-note/action';
52
57
  import { removeCustomerNote } from './actions/remove-customer-note/action';
@@ -141,6 +146,13 @@ export const command = {
141
146
  exampleFunction,
142
147
  generateAPIKey,
143
148
  getProducts,
149
+ getBookingResources,
150
+ getBookingAvailability,
151
+ getBookings,
152
+ holdBooking,
153
+ addBookingToCart,
154
+ removeBookingFromCart,
155
+ cancelBooking,
144
156
  addCustomSale,
145
157
  editCustomSale,
146
158
  addNonRevenueItem,
@@ -186,8 +198,6 @@ export const command = {
186
198
  integrationPayment,
187
199
  createPaymentLink,
188
200
  chargeMoto,
189
- startCheckout,
190
- resumeCheckout,
191
201
  // Customer Actions
192
202
  addCustomerNote,
193
203
  removeCustomerNote,
@@ -298,7 +308,6 @@ export { refundsTopic } from './pubsub/topics/refunds';
298
308
  export { productsTopic } from './pubsub/topics/products';
299
309
  export { cartTopic } from './pubsub/topics/cart';
300
310
  export { paymentsTopic } from './pubsub/topics/payments';
301
- export { checkoutTopic } from './pubsub/topics/checkout';
302
311
  export { splitPaymentsTopic } from './pubsub/topics/split-payments';
303
312
  export { customTablesTopic } from './pubsub/topics/custom-tables';
304
313
  export { printTopic } from './pubsub/topics/print';
@@ -310,6 +319,7 @@ export { variantsTopic } from './pubsub/topics/variants';
310
319
  export { transactionsTopic } from './pubsub/topics/transactions';
311
320
  export { categoriesTopic } from './pubsub/topics/categories';
312
321
  export { attributesTopic } from './pubsub/topics/attributes';
322
+ export { bookingsTopic } from './pubsub/topics/bookings';
313
323
  // Export Custom Tables Types
314
324
  export { AttributeType } from './common-types/attribute-type';
315
325
  // State Machine Fragments
@@ -33,8 +33,6 @@ import { mockCashPayment } from '../../actions/cash-payment/mock';
33
33
  import { mockGetCashRoundingAmount } from '../../actions/get-cash-rounding-amount/mock';
34
34
  import { mockCreatePaymentLink } from '../../actions/create-payment-link/mock';
35
35
  import { mockChargeMoto } from '../../actions/charge-moto/mock';
36
- import { mockStartCheckout } from '../../actions/start-checkout/mock';
37
- import { mockResumeCheckout } from '../../actions/resume-checkout/mock';
38
36
  import { mockGetTimeClockStatus } from '../../actions/get-time-clock-status/mock';
39
37
  import { mockClearCart } from '../../actions/clear-cart/mock';
40
38
  import { mockDeleteParkedOrder } from '../../actions/delete-parked-order/mock';
@@ -46,6 +44,13 @@ import { mockGetCurrentCart } from '../../actions/get-current-cart/mock';
46
44
  import { mockGetCustomers } from '../../actions/get-customers/mock';
47
45
  import { mockGetOrders } from '../../actions/get-orders/mock';
48
46
  import { mockGetProducts } from '../../actions/get-products/mock';
47
+ import { mockGetBookingResources } from '../../actions/get-booking-resources/mock';
48
+ import { mockGetBookingAvailability } from '../../actions/get-booking-availability/mock';
49
+ import { mockGetBookings } from '../../actions/get-bookings/mock';
50
+ import { mockHoldBooking } from '../../actions/hold-booking/mock';
51
+ import { mockAddBookingToCart } from '../../actions/add-booking-to-cart/mock';
52
+ import { mockRemoveBookingFromCart } from '../../actions/remove-booking-from-cart/mock';
53
+ import { mockCancelBooking } from '../../actions/cancel-booking/mock';
49
54
  import { mockGetRefunds } from '../../actions/get-refunds/mock';
50
55
  import { mockGetTaxTables } from '../../actions/get-tax-tables/mock';
51
56
  import { mockGetRemainingRefundableQuantities } from '../../actions/get-remaining-refundable-quantities/mock';
@@ -134,8 +139,6 @@ export const RENDER_MOCKS = {
134
139
  getCashRoundingAmount: mockGetCashRoundingAmount,
135
140
  createPaymentLink: mockCreatePaymentLink,
136
141
  chargeMoto: mockChargeMoto,
137
- startCheckout: mockStartCheckout,
138
- resumeCheckout: mockResumeCheckout,
139
142
  clearCart: mockClearCart,
140
143
  deleteParkedOrder: mockDeleteParkedOrder,
141
144
  voidOrder: mockVoidOrder,
@@ -146,6 +149,13 @@ export const RENDER_MOCKS = {
146
149
  getCustomers: mockGetCustomers,
147
150
  getOrders: mockGetOrders,
148
151
  getProducts: mockGetProducts,
152
+ getBookingResources: mockGetBookingResources,
153
+ getBookingAvailability: mockGetBookingAvailability,
154
+ getBookings: mockGetBookings,
155
+ holdBooking: mockHoldBooking,
156
+ addBookingToCart: mockAddBookingToCart,
157
+ removeBookingFromCart: mockRemoveBookingFromCart,
158
+ cancelBooking: mockCancelBooking,
149
159
  getRefunds: mockGetRefunds,
150
160
  getTaxTables: mockGetTaxTables,
151
161
  getRemainingRefundableQuantities: mockGetRemainingRefundableQuantities,
@@ -1,7 +1,14 @@
1
- import type { ExampleFunction, GetProducts, AddCustomSale, EditCustomSale, GetCustomers, AssignCustomer, AddCustomer, EditCustomer, GetCategories, GetOrders, GetRefunds, GetTaxTables, AddProductDiscount, AddProductToCart, RemoveProductFromCart, UpdateCartItemQuantity, AddCartDiscount, GetContext, GetFinalContext, AddProductNote, AddProductFee, GetProductModifierSelections, SetProductModifierSelections, SetActiveProductFee, SetActiveProductDiscount, GetActiveProduct, SetActiveProduct, AdjustInventory, AddOrderNote, AddCartFee, ClearCart, ParkOrder, ResumeParkedOrder, DeleteParkedOrder, VoidOrder, InitiateRefund, CashPayment, GetCashRoundingAmount, TapToPayPayment, TerminalPayment, ExtensionPayment, RedeemPayment, AddNonRevenueItem, AddCustomerNote, RemoveCustomerNote, RemoveCustomerFromCart, GoToStationHome, OpenCashDrawer, ShowNotification, ShowConfirmation, AuthenticateUser, PartialPayment, SwitchUser, SetRefundStockAction, SelectAllRefundItems, ResetRefundDetails, CalculateRefundTotal, GetRemainingRefundableQuantities, ProcessPartialRefund, RedeemRefund, GetRefundPlan, CheckPermission, GetCurrentCart, Print, SetActiveOrder, GetCustomTables, GetCustomTableData, UpsertCustomTableData, DeleteCustomTableData, GetCustomExtensions, GetCurrentCompanyCustomExtensions, GetCustomExtensionCustomTables, GetCustomTableFields, GetSecretsKeys, GetSecretVal, SetSecretVal, GetUsers, GetRoles, RemoveCartDiscount, GetActiveOrder, GetActiveCustomer, SetActiveCustomer, GetActiveOutlet, GetActiveStation, GetActiveSession, GetActiveUser, SetActiveUser, SetActiveRefund, RemoveProductDiscount, RemoveProductFee, RemoveProductNote, RemoveCartFee, RemoveOrderNote, RemoveCustomSale, RemoveNonRevenueItem, CanTransition, GetAvailableTransitions, ApplyTransition, IntegrationPayment, GetSmartGridLayout, SaveSmartGridLayout, SendEmail, SendSms, CreatePaymentLink, ChargeMoto, StartCheckout, ResumeCheckout, GetTimeClockStatus } from '../../index';
1
+ import type { ExampleFunction, GetProducts, AddCustomSale, EditCustomSale, GetCustomers, AssignCustomer, AddCustomer, EditCustomer, GetCategories, GetOrders, GetRefunds, GetTaxTables, AddProductDiscount, AddProductToCart, RemoveProductFromCart, UpdateCartItemQuantity, AddCartDiscount, GetContext, GetFinalContext, AddProductNote, AddProductFee, GetProductModifierSelections, SetProductModifierSelections, SetActiveProductFee, SetActiveProductDiscount, GetActiveProduct, SetActiveProduct, AdjustInventory, AddOrderNote, AddCartFee, ClearCart, ParkOrder, ResumeParkedOrder, DeleteParkedOrder, VoidOrder, InitiateRefund, CashPayment, GetCashRoundingAmount, TapToPayPayment, TerminalPayment, ExtensionPayment, RedeemPayment, AddNonRevenueItem, AddCustomerNote, RemoveCustomerNote, RemoveCustomerFromCart, GoToStationHome, OpenCashDrawer, ShowNotification, ShowConfirmation, AuthenticateUser, PartialPayment, SwitchUser, SetRefundStockAction, SelectAllRefundItems, ResetRefundDetails, CalculateRefundTotal, GetRemainingRefundableQuantities, ProcessPartialRefund, RedeemRefund, GetRefundPlan, CheckPermission, GetCurrentCart, Print, SetActiveOrder, GetCustomTables, GetCustomTableData, UpsertCustomTableData, DeleteCustomTableData, GetCustomExtensions, GetCurrentCompanyCustomExtensions, GetCustomExtensionCustomTables, GetCustomTableFields, GetSecretsKeys, GetSecretVal, SetSecretVal, GetUsers, GetRoles, RemoveCartDiscount, GetActiveOrder, GetActiveCustomer, SetActiveCustomer, GetActiveOutlet, GetActiveStation, GetActiveSession, GetActiveUser, SetActiveUser, SetActiveRefund, RemoveProductDiscount, RemoveProductFee, RemoveProductNote, RemoveCartFee, RemoveOrderNote, RemoveCustomSale, RemoveNonRevenueItem, CanTransition, GetAvailableTransitions, ApplyTransition, IntegrationPayment, GetSmartGridLayout, SaveSmartGridLayout, SendEmail, SendSms, GetBookingResources, GetBookingAvailability, GetBookings, HoldBooking, AddBookingToCart, RemoveBookingFromCart, CancelBooking, CreatePaymentLink, ChargeMoto, GetTimeClockStatus } from '../../index';
2
2
  export interface RenderProviderActions {
3
3
  exampleFunction: ExampleFunction;
4
4
  getProducts: GetProducts;
5
+ getBookingResources: GetBookingResources;
6
+ getBookingAvailability: GetBookingAvailability;
7
+ getBookings: GetBookings;
8
+ holdBooking: HoldBooking;
9
+ addBookingToCart: AddBookingToCart;
10
+ removeBookingFromCart: RemoveBookingFromCart;
11
+ cancelBooking: CancelBooking;
5
12
  addCustomSale: AddCustomSale;
6
13
  editCustomSale: EditCustomSale;
7
14
  getCustomers: GetCustomers;
@@ -45,18 +52,6 @@ export interface RenderProviderActions {
45
52
  integrationPayment: IntegrationPayment;
46
53
  createPaymentLink: CreatePaymentLink;
47
54
  chargeMoto: ChargeMoto;
48
- /**
49
- * ONLINE checkout — served only by the storefront runtime (a published
50
- * website). The till tenders above are refused there, and this is refused on
51
- * a register, because the two declare different things to the card networks.
52
- */
53
- startCheckout: StartCheckout;
54
- /**
55
- * The RETURN LEG of an online checkout, after a redirect payment method or
56
- * 3-D Secure sent the shopper away and back. Storefront-only, like
57
- * `startCheckout`, and safe to call on every page load.
58
- */
59
- resumeCheckout: ResumeCheckout;
60
55
  addNonRevenueItem: AddNonRevenueItem;
61
56
  addCustomerNote: AddCustomerNote;
62
57
  removeCustomerNote: RemoveCustomerNote;
@@ -0,0 +1,6 @@
1
+ import type { CFBooking } from '../../../../CommonTypes';
2
+ import type { TopicEvent } from '../../../types';
3
+ export interface BookingCreatedPayload {
4
+ booking: CFBooking;
5
+ }
6
+ export type BookingCreatedEvent = TopicEvent<BookingCreatedPayload>;
@@ -0,0 +1,15 @@
1
+ import type { TopicEvent } from '../../../types';
2
+ /**
3
+ * What a booking can be MADE of changed — a rule set, a resource, who serves a product, or where
4
+ * a resource works. Occupancy is untouched.
5
+ *
6
+ * Deliberately carries no row: the change can span several collections at once (a rule set edited
7
+ * AND a product↔resource link removed), and a subscriber cannot act on a partial picture anyway.
8
+ * The only correct reaction is to re-ask `getBookingResources` and `getBookingAvailability`,
9
+ * because both previous answers were computed from the old setup.
10
+ */
11
+ export interface BookingSetupChangedPayload {
12
+ /** Which collection moved, when the host knows: `booking-rules`, `booking-resources`, … */
13
+ collection?: string;
14
+ }
15
+ export type BookingSetupChangedEvent = TopicEvent<BookingSetupChangedPayload>;
@@ -0,0 +1,6 @@
1
+ import type { CFBooking } from '../../../../CommonTypes';
2
+ import type { TopicEvent } from '../../../types';
3
+ export interface BookingUpdatedPayload {
4
+ booking: CFBooking;
5
+ }
6
+ export type BookingUpdatedEvent = TopicEvent<BookingUpdatedPayload>;
@@ -0,0 +1,3 @@
1
+ import type { TopicDefinition } from '../../types';
2
+ export declare const bookingsTopic: TopicDefinition;
3
+ export * from './types';