@final-commerce/command-frame 0.6.1 → 0.7.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 (80) hide show
  1. package/dist/CommonTypes.d.ts +11 -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 +8 -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/cancel-booking/types.js +1 -0
  13. package/dist/actions/get-booking-availability/action.d.ts +6 -0
  14. package/dist/actions/get-booking-availability/action.js +8 -0
  15. package/dist/actions/get-booking-availability/mock.d.ts +2 -0
  16. package/dist/actions/get-booking-availability/mock.js +6 -0
  17. package/dist/actions/get-booking-availability/types.d.ts +18 -0
  18. package/dist/actions/get-booking-availability/types.js +1 -0
  19. package/dist/actions/get-booking-resources/action.d.ts +6 -0
  20. package/dist/actions/get-booking-resources/action.js +8 -0
  21. package/dist/actions/get-booking-resources/mock.d.ts +2 -0
  22. package/dist/actions/get-booking-resources/mock.js +7 -0
  23. package/dist/actions/get-booking-resources/types.d.ts +12 -0
  24. package/dist/actions/get-booking-resources/types.js +1 -0
  25. package/dist/actions/get-bookings/action.d.ts +6 -0
  26. package/dist/actions/get-bookings/action.js +8 -0
  27. package/dist/actions/get-bookings/mock.d.ts +2 -0
  28. package/dist/actions/get-bookings/mock.js +20 -0
  29. package/dist/actions/get-bookings/types.d.ts +18 -0
  30. package/dist/actions/get-bookings/types.js +1 -0
  31. package/dist/actions/hold-booking/action.d.ts +6 -0
  32. package/dist/actions/hold-booking/action.js +8 -0
  33. package/dist/actions/hold-booking/mock.d.ts +2 -0
  34. package/dist/actions/hold-booking/mock.js +33 -0
  35. package/dist/actions/hold-booking/types.d.ts +24 -0
  36. package/dist/actions/hold-booking/types.js +1 -0
  37. package/dist/actions/remove-booking-from-cart/action.d.ts +6 -0
  38. package/dist/actions/remove-booking-from-cart/action.js +8 -0
  39. package/dist/actions/remove-booking-from-cart/mock.d.ts +2 -0
  40. package/dist/actions/remove-booking-from-cart/mock.js +16 -0
  41. package/dist/actions/remove-booking-from-cart/types.d.ts +12 -0
  42. package/dist/actions/remove-booking-from-cart/types.js +1 -0
  43. package/dist/demo/database.d.ts +8 -1
  44. package/dist/demo/database.js +93 -0
  45. package/dist/index.d.ts +16 -6
  46. package/dist/index.js +15 -8
  47. package/dist/projects/render/mocks.js +14 -6
  48. package/dist/projects/render/types.d.ts +8 -4
  49. package/dist/pubsub/topics/bookings/booking-created/types.d.ts +6 -0
  50. package/dist/pubsub/topics/bookings/booking-created/types.js +1 -0
  51. package/dist/pubsub/topics/bookings/booking-setup-changed/types.d.ts +15 -0
  52. package/dist/pubsub/topics/bookings/booking-setup-changed/types.js +1 -0
  53. package/dist/pubsub/topics/bookings/booking-updated/types.d.ts +6 -0
  54. package/dist/pubsub/topics/bookings/booking-updated/types.js +1 -0
  55. package/dist/pubsub/topics/bookings/index.d.ts +3 -0
  56. package/dist/pubsub/topics/bookings/index.js +27 -0
  57. package/dist/pubsub/topics/bookings/types.d.ts +8 -0
  58. package/dist/pubsub/topics/bookings/types.js +3 -0
  59. package/dist/pubsub/topics/index.d.ts +17 -16
  60. package/dist/pubsub/topics/index.js +17 -16
  61. package/dist/pubsub/topics/types.d.ts +2 -0
  62. package/package.json +2 -2
  63. package/dist/actions/charge-moto/action.d.ts +0 -6
  64. package/dist/actions/charge-moto/action.js +0 -8
  65. package/dist/actions/charge-moto/mock.d.ts +0 -2
  66. package/dist/actions/charge-moto/mock.js +0 -47
  67. package/dist/actions/charge-moto/types.d.ts +0 -53
  68. package/dist/actions/create-payment-link/action.d.ts +0 -6
  69. package/dist/actions/create-payment-link/action.js +0 -8
  70. package/dist/actions/create-payment-link/mock.d.ts +0 -2
  71. package/dist/actions/create-payment-link/mock.js +0 -35
  72. package/dist/actions/create-payment-link/types.d.ts +0 -27
  73. package/dist/actions/create-payment-link/types.js +0 -12
  74. package/dist/actions/get-time-clock-status/action.d.ts +0 -6
  75. package/dist/actions/get-time-clock-status/action.js +0 -8
  76. package/dist/actions/get-time-clock-status/mock.d.ts +0 -2
  77. package/dist/actions/get-time-clock-status/mock.js +0 -17
  78. package/dist/actions/get-time-clock-status/types.d.ts +0 -18
  79. package/dist/actions/get-time-clock-status/types.js +0 -7
  80. /package/dist/actions/{charge-moto → add-booking-to-cart}/types.js +0 -0
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;
@@ -41,8 +48,6 @@ export declare const command: {
41
48
  readonly extensionPayment: import(".").ExtensionPayment;
42
49
  readonly redeemPayment: import(".").RedeemPayment;
43
50
  readonly integrationPayment: import(".").IntegrationPayment;
44
- readonly createPaymentLink: import(".").CreatePaymentLink;
45
- readonly chargeMoto: import(".").ChargeMoto;
46
51
  readonly addCustomerNote: import(".").AddCustomerNote;
47
52
  readonly removeCustomerNote: import(".").RemoveCustomerNote;
48
53
  readonly removeCustomerFromCart: import(".").RemoveCustomerFromCart;
@@ -111,7 +116,6 @@ export declare const command: {
111
116
  readonly uploadMedia: import(".").UploadMedia;
112
117
  readonly getTaxTables: import(".").GetTaxTables;
113
118
  readonly getBranding: import(".").GetBranding;
114
- readonly getTimeClockStatus: import(".").GetTimeClockStatus;
115
119
  readonly canTransition: import(".").CanTransition;
116
120
  readonly getAvailableTransitions: import(".").GetAvailableTransitions;
117
121
  readonly applyTransition: import(".").ApplyTransition;
@@ -119,6 +123,13 @@ export declare const command: {
119
123
  export type { ExampleFunction, ExampleFunctionParams, ExampleFunctionResponse } from './actions/example-function/types';
120
124
  export type { GenerateAPIKey, GenerateAPIKeyParams, GenerateAPIKeyResponse } from './actions/generate-api-key/types';
121
125
  export type { GetProducts, GetProductsParams, GetProductsResponse } from './actions/get-products/types';
126
+ export type { GetBookingResources, GetBookingResourcesParams, GetBookingResourcesResponse, } from './actions/get-booking-resources/types';
127
+ export type { GetBookingAvailability, GetBookingAvailabilityParams, GetBookingAvailabilityResponse, } from './actions/get-booking-availability/types';
128
+ export type { GetBookings, GetBookingsParams, GetBookingsResponse } from './actions/get-bookings/types';
129
+ export type { HoldBooking, HoldBookingParams, HoldBookingResponse } from './actions/hold-booking/types';
130
+ export type { AddBookingToCart, AddBookingToCartParams, AddBookingToCartResponse, } from './actions/add-booking-to-cart/types';
131
+ export type { RemoveBookingFromCart, RemoveBookingFromCartParams, RemoveBookingFromCartResponse, } from './actions/remove-booking-from-cart/types';
132
+ export type { CancelBooking, CancelBookingParams, CancelBookingResponse } from './actions/cancel-booking/types';
122
133
  export type { AddCustomSale, AddCustomSaleParams, AddCustomSaleResponse } from './actions/add-custom-sale/types';
123
134
  export type { EditCustomSale, EditCustomSaleParams, EditCustomSaleResponse } from './actions/edit-custom-sale/types';
124
135
  export type { AddNonRevenueItem, AddNonRevenueItemParams, AddNonRevenueItemResponse, } from './actions/add-non-revenue-item/types';
@@ -176,8 +187,6 @@ export type { TerminalPayment, TerminalPaymentParams, TerminalPaymentResponse }
176
187
  export type { ExtensionPayment, ExtensionPaymentParams, ExtensionPaymentResponse, } from './actions/extension-payment/types';
177
188
  export type { RedeemPayment, RedeemPaymentParams, RedeemPaymentResponse } from './actions/redeem-payment/types';
178
189
  export type { IntegrationPayment, IntegrationPaymentParams, IntegrationPaymentResponse, IntegrationEmvData, } from './actions/integration-payment/types';
179
- export type { CreatePaymentLink, CreatePaymentLinkParams, CreatePaymentLinkResponse, } from './actions/create-payment-link/types';
180
- export type { ChargeMoto, ChargeMotoParams, ChargeMotoResponse, ChargeMotoCardFields, } from './actions/charge-moto/types';
181
190
  export type { AddCustomerNote, AddCustomerNoteParams, AddCustomerNoteResponse, } from './actions/add-customer-note/types';
182
191
  export type { RemoveCustomerNote, RemoveCustomerNoteParams, RemoveCustomerNoteResponse, } from './actions/remove-customer-note/types';
183
192
  export type { RemoveCustomerFromCart, RemoveCustomerFromCartResponse } from './actions/remove-customer-from-cart/types';
@@ -191,7 +200,6 @@ export type { GetMedia, GetMediaParams, GetMediaResponse, MediaItemPayload } fro
191
200
  export type { UploadMedia, UploadMediaParams, UploadMediaResponse } from './actions/upload-media/types';
192
201
  export type { GetTaxTables, GetTaxTablesResponse, TaxRatePayload, TaxTablePayload, } from './actions/get-tax-tables/types';
193
202
  export type { BorderRadiusPreset, GetBranding, GetBrandingResponse } from './actions/get-branding/types';
194
- export type { GetTimeClockStatus, GetTimeClockStatusResponse, TimeClockEntry, } from './actions/get-time-clock-status/types';
195
203
  export type { ShowConfirmation, ShowConfirmationParams, ShowConfirmationResponse, } from './actions/show-confirmation/types';
196
204
  export type { AuthenticateUser, AuthenticateUserParams, AuthenticateUserResponse, } from './actions/authenticate-user/types';
197
205
  export type { PartialPayment, PartialPaymentParams, PartialPaymentResponse } from './actions/partial-payment/types';
@@ -245,6 +253,7 @@ export { variantsTopic } from './pubsub/topics/variants';
245
253
  export { transactionsTopic } from './pubsub/topics/transactions';
246
254
  export { categoriesTopic } from './pubsub/topics/categories';
247
255
  export { attributesTopic } from './pubsub/topics/attributes';
256
+ export { bookingsTopic } from './pubsub/topics/bookings';
248
257
  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';
249
258
  export type { OrderCreatedPayload, OrderUpdatedPayload, OrderVoidedPayload, OrderActiveSetPayload, OrderActiveGetPayload, OrderCreatedEvent, OrderUpdatedEvent, OrderVoidedEvent, OrderActiveSetEvent, OrderActiveGetEvent, OrderStateTransitionCompletedPayload, OrderStateTransitionBlockedPayload, OrderStateTransitionCompletedEvent, OrderStateTransitionBlockedEvent, OrdersEventType, OrdersEventPayload, } from './pubsub/topics/orders/types';
250
259
  export type { RefundCreatedPayload, RefundUpdatedPayload, RefundActiveSetPayload, RefundActiveGetPayload, RefundCreatedEvent, RefundUpdatedEvent, RefundActiveSetEvent, RefundActiveGetEvent, RefundsEventType, RefundsEventPayload, } from './pubsub/topics/refunds/types';
@@ -255,6 +264,7 @@ export type { SessionActiveSetPayload, SessionActiveGetPayload, SessionActiveSet
255
264
  export type { UserActiveSetPayload, UserActiveGetPayload, UserActiveSetEvent, UserActiveGetEvent, UserCreatedPayload, UserCreatedEvent, UserUpdatedPayload, UserUpdatedEvent, UsersEventType, UsersEventPayload, } from './pubsub/topics/users/types';
256
265
  export type { VariantCreatedPayload, VariantCreatedEvent, VariantUpdatedPayload, VariantUpdatedEvent, VariantsEventType, VariantsEventPayload, } from './pubsub/topics/variants/types';
257
266
  export type { TransactionCreatedPayload, TransactionCreatedEvent, TransactionUpdatedPayload, TransactionUpdatedEvent, TransactionsEventType, TransactionsEventPayload, } from './pubsub/topics/transactions/types';
267
+ export type { BookingCreatedPayload, BookingCreatedEvent, BookingUpdatedPayload, BookingUpdatedEvent, BookingSetupChangedPayload, BookingSetupChangedEvent, BookingsEventType, BookingsEventPayload, } from './pubsub/topics/bookings/types';
258
268
  export type { CategoryCreatedPayload, CategoryCreatedEvent, CategoryUpdatedPayload, CategoryUpdatedEvent, CategoriesEventType, CategoriesEventPayload, } from './pubsub/topics/categories/types';
259
269
  export type { AttributeCreatedPayload, AttributeCreatedEvent, AttributeUpdatedPayload, AttributeUpdatedEvent, AttributesEventType, AttributesEventPayload, } from './pubsub/topics/attributes/types';
260
270
  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';
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';
@@ -41,8 +48,6 @@ import { terminalPayment } from './actions/terminal-payment/action';
41
48
  import { extensionPayment } from './actions/extension-payment/action';
42
49
  import { redeemPayment } from './actions/redeem-payment/action';
43
50
  import { integrationPayment } from './actions/integration-payment/action';
44
- import { createPaymentLink } from './actions/create-payment-link/action';
45
- import { chargeMoto } from './actions/charge-moto/action';
46
51
  // Customer Actions
47
52
  import { addCustomerNote } from './actions/add-customer-note/action';
48
53
  import { removeCustomerNote } from './actions/remove-customer-note/action';
@@ -130,13 +135,18 @@ import { getMedia } from './actions/get-media/action';
130
135
  import { uploadMedia } from './actions/upload-media/action';
131
136
  import { getTaxTables } from './actions/get-tax-tables/action';
132
137
  import { getBranding } from './actions/get-branding/action';
133
- // Time Clock Actions
134
- import { getTimeClockStatus } from './actions/get-time-clock-status/action';
135
138
  // Export actions as command object
136
139
  export const command = {
137
140
  exampleFunction,
138
141
  generateAPIKey,
139
142
  getProducts,
143
+ getBookingResources,
144
+ getBookingAvailability,
145
+ getBookings,
146
+ holdBooking,
147
+ addBookingToCart,
148
+ removeBookingFromCart,
149
+ cancelBooking,
140
150
  addCustomSale,
141
151
  editCustomSale,
142
152
  addNonRevenueItem,
@@ -178,8 +188,6 @@ export const command = {
178
188
  extensionPayment,
179
189
  redeemPayment,
180
190
  integrationPayment,
181
- createPaymentLink,
182
- chargeMoto,
183
191
  // Customer Actions
184
192
  addCustomerNote,
185
193
  removeCustomerNote,
@@ -262,8 +270,6 @@ export const command = {
262
270
  uploadMedia,
263
271
  getTaxTables,
264
272
  getBranding,
265
- // Time Clock Actions
266
- getTimeClockStatus,
267
273
  // State Machine Queries
268
274
  canTransition,
269
275
  getAvailableTransitions,
@@ -301,6 +307,7 @@ export { variantsTopic } from './pubsub/topics/variants';
301
307
  export { transactionsTopic } from './pubsub/topics/transactions';
302
308
  export { categoriesTopic } from './pubsub/topics/categories';
303
309
  export { attributesTopic } from './pubsub/topics/attributes';
310
+ export { bookingsTopic } from './pubsub/topics/bookings';
304
311
  // Export Custom Tables Types
305
312
  export { AttributeType } from './common-types/attribute-type';
306
313
  // State Machine Fragments
@@ -29,9 +29,6 @@ import { mockAuthenticateUser } from '../../actions/authenticate-user/mock';
29
29
  import { mockCalculateRefundTotal } from '../../actions/calculate-refund-total/mock';
30
30
  import { mockCashPayment } from '../../actions/cash-payment/mock';
31
31
  import { mockGetCashRoundingAmount } from '../../actions/get-cash-rounding-amount/mock';
32
- import { mockCreatePaymentLink } from '../../actions/create-payment-link/mock';
33
- import { mockChargeMoto } from '../../actions/charge-moto/mock';
34
- import { mockGetTimeClockStatus } from '../../actions/get-time-clock-status/mock';
35
32
  import { mockClearCart } from '../../actions/clear-cart/mock';
36
33
  import { mockDeleteParkedOrder } from '../../actions/delete-parked-order/mock';
37
34
  import { mockVoidOrder } from '../../actions/void-order/mock';
@@ -42,6 +39,13 @@ import { mockGetCurrentCart } from '../../actions/get-current-cart/mock';
42
39
  import { mockGetCustomers } from '../../actions/get-customers/mock';
43
40
  import { mockGetOrders } from '../../actions/get-orders/mock';
44
41
  import { mockGetProducts } from '../../actions/get-products/mock';
42
+ import { mockGetBookingResources } from '../../actions/get-booking-resources/mock';
43
+ import { mockGetBookingAvailability } from '../../actions/get-booking-availability/mock';
44
+ import { mockGetBookings } from '../../actions/get-bookings/mock';
45
+ import { mockHoldBooking } from '../../actions/hold-booking/mock';
46
+ import { mockAddBookingToCart } from '../../actions/add-booking-to-cart/mock';
47
+ import { mockRemoveBookingFromCart } from '../../actions/remove-booking-from-cart/mock';
48
+ import { mockCancelBooking } from '../../actions/cancel-booking/mock';
45
49
  import { mockGetRefunds } from '../../actions/get-refunds/mock';
46
50
  import { mockGetTaxTables } from '../../actions/get-tax-tables/mock';
47
51
  import { mockGetRemainingRefundableQuantities } from '../../actions/get-remaining-refundable-quantities/mock';
@@ -126,8 +130,6 @@ export const RENDER_MOCKS = {
126
130
  calculateRefundTotal: mockCalculateRefundTotal,
127
131
  cashPayment: mockCashPayment,
128
132
  getCashRoundingAmount: mockGetCashRoundingAmount,
129
- createPaymentLink: mockCreatePaymentLink,
130
- chargeMoto: mockChargeMoto,
131
133
  clearCart: mockClearCart,
132
134
  deleteParkedOrder: mockDeleteParkedOrder,
133
135
  voidOrder: mockVoidOrder,
@@ -138,6 +140,13 @@ export const RENDER_MOCKS = {
138
140
  getCustomers: mockGetCustomers,
139
141
  getOrders: mockGetOrders,
140
142
  getProducts: mockGetProducts,
143
+ getBookingResources: mockGetBookingResources,
144
+ getBookingAvailability: mockGetBookingAvailability,
145
+ getBookings: mockGetBookings,
146
+ holdBooking: mockHoldBooking,
147
+ addBookingToCart: mockAddBookingToCart,
148
+ removeBookingFromCart: mockRemoveBookingFromCart,
149
+ cancelBooking: mockCancelBooking,
141
150
  getRefunds: mockGetRefunds,
142
151
  getTaxTables: mockGetTaxTables,
143
152
  getRemainingRefundableQuantities: mockGetRemainingRefundableQuantities,
@@ -204,5 +213,4 @@ export const RENDER_MOCKS = {
204
213
  saveSmartGridLayout: mockSaveSmartGridLayout,
205
214
  sendEmail: mockSendEmail,
206
215
  sendSms: mockSendSms,
207
- getTimeClockStatus: mockGetTimeClockStatus,
208
216
  };
@@ -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, 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, 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, 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 } 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;
@@ -41,8 +48,6 @@ export interface RenderProviderActions {
41
48
  extensionPayment: ExtensionPayment;
42
49
  redeemPayment: RedeemPayment;
43
50
  integrationPayment: IntegrationPayment;
44
- createPaymentLink: CreatePaymentLink;
45
- chargeMoto: ChargeMoto;
46
51
  addNonRevenueItem: AddNonRevenueItem;
47
52
  addCustomerNote: AddCustomerNote;
48
53
  removeCustomerNote: RemoveCustomerNote;
@@ -103,5 +108,4 @@ export interface RenderProviderActions {
103
108
  saveSmartGridLayout: SaveSmartGridLayout;
104
109
  sendEmail: SendEmail;
105
110
  sendSms: SendSms;
106
- getTimeClockStatus: GetTimeClockStatus;
107
111
  }
@@ -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';
@@ -0,0 +1,27 @@
1
+ export const bookingsTopic = {
2
+ id: 'bookings',
3
+ name: 'Bookings',
4
+ description: 'Topic for bookings synced from the database. A booking IS the occupancy, so this is the ' +
5
+ 'signal that somebody else took (or freed) a window: re-ask getBookingAvailability when it ' +
6
+ 'fires instead of polling the server on a timer.',
7
+ eventTypes: [
8
+ {
9
+ id: 'booking-created',
10
+ name: 'Booking Created',
11
+ description: 'Published when a booking made elsewhere — another till, the back office — is synced in',
12
+ },
13
+ {
14
+ id: 'booking-updated',
15
+ name: 'Booking Updated',
16
+ description: 'Published when a synced booking changes: confirmed after payment, cancelled, or expired',
17
+ },
18
+ {
19
+ id: 'booking-setup-changed',
20
+ name: 'Booking Setup Changed',
21
+ description: 'Published when what a booking can be MADE of changes: a rule set, a resource, who serves ' +
22
+ 'a product, or where a resource works. Occupancy is untouched — re-ask getBookingResources ' +
23
+ 'and getBookingAvailability, because both answers were computed from the old setup.',
24
+ },
25
+ ],
26
+ };
27
+ export * from './types';
@@ -0,0 +1,8 @@
1
+ export * from './booking-created/types';
2
+ export * from './booking-updated/types';
3
+ export * from './booking-setup-changed/types';
4
+ import type { BookingCreatedPayload } from './booking-created/types';
5
+ import type { BookingUpdatedPayload } from './booking-updated/types';
6
+ import type { BookingSetupChangedPayload } from './booking-setup-changed/types';
7
+ export type BookingsEventPayload = BookingCreatedPayload | BookingUpdatedPayload | BookingSetupChangedPayload;
8
+ export type BookingsEventType = 'booking-created' | 'booking-updated' | 'booking-setup-changed';
@@ -0,0 +1,3 @@
1
+ export * from './booking-created/types';
2
+ export * from './booking-updated/types';
3
+ export * from './booking-setup-changed/types';
@@ -2,19 +2,20 @@
2
2
  * Pub/Sub Topics
3
3
  * Export all available topics and their types
4
4
  */
5
- export * from "./customers";
6
- export * from "./orders";
7
- export * from "./refunds";
8
- export * from "./products";
9
- export * from "./cart";
10
- export * from "./payments";
11
- export * from "./custom-tables";
12
- export * from "./print";
13
- export * from "./outlet";
14
- export * from "./station";
15
- export * from "./session";
16
- export * from "./users";
17
- export * from "./variants";
18
- export * from "./transactions";
19
- export * from "./categories";
20
- export * from "./attributes";
5
+ export * from './customers';
6
+ export * from './orders';
7
+ export * from './bookings';
8
+ export * from './refunds';
9
+ export * from './products';
10
+ export * from './cart';
11
+ export * from './payments';
12
+ export * from './custom-tables';
13
+ export * from './print';
14
+ export * from './outlet';
15
+ export * from './station';
16
+ export * from './session';
17
+ export * from './users';
18
+ export * from './variants';
19
+ export * from './transactions';
20
+ export * from './categories';
21
+ export * from './attributes';
@@ -2,19 +2,20 @@
2
2
  * Pub/Sub Topics
3
3
  * Export all available topics and their types
4
4
  */
5
- export * from "./customers";
6
- export * from "./orders";
7
- export * from "./refunds";
8
- export * from "./products";
9
- export * from "./cart";
10
- export * from "./payments";
11
- export * from "./custom-tables";
12
- export * from "./print";
13
- export * from "./outlet";
14
- export * from "./station";
15
- export * from "./session";
16
- export * from "./users";
17
- export * from "./variants";
18
- export * from "./transactions";
19
- export * from "./categories";
20
- export * from "./attributes";
5
+ export * from './customers';
6
+ export * from './orders';
7
+ export * from './bookings';
8
+ export * from './refunds';
9
+ export * from './products';
10
+ export * from './cart';
11
+ export * from './payments';
12
+ export * from './custom-tables';
13
+ export * from './print';
14
+ export * from './outlet';
15
+ export * from './station';
16
+ export * from './session';
17
+ export * from './users';
18
+ export * from './variants';
19
+ export * from './transactions';
20
+ export * from './categories';
21
+ export * from './attributes';
@@ -15,6 +15,7 @@ import { VariantsEventType, VariantsEventPayload } from "./variants/types";
15
15
  import { TransactionsEventType, TransactionsEventPayload } from "./transactions/types";
16
16
  import { CategoriesEventType, CategoriesEventPayload } from "./categories/types";
17
17
  import { AttributesEventType, AttributesEventPayload } from "./attributes/types";
18
+ import { BookingsEventType, BookingsEventPayload } from "./bookings/types";
18
19
  export interface TopicEventPayloadMap {
19
20
  customers: Record<CustomersEventType, CustomersEventPayload>;
20
21
  orders: Record<OrdersEventType, OrdersEventPayload>;
@@ -33,4 +34,5 @@ export interface TopicEventPayloadMap {
33
34
  transactions: Record<TransactionsEventType, TransactionsEventPayload>;
34
35
  categories: Record<CategoriesEventType, CategoriesEventPayload>;
35
36
  attributes: Record<AttributesEventType, AttributesEventPayload>;
37
+ bookings: Record<BookingsEventType, BookingsEventPayload>;
36
38
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@final-commerce/command-frame",
3
- "version": "0.6.1",
3
+ "version": "0.7.0-staging.1",
4
4
  "description": "Commands Frame library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -57,7 +57,7 @@
57
57
  "ignoreBranchesMissingTickets": true
58
58
  },
59
59
  "dependencies": {
60
- "@final-commerce/common": "2.2.2"
60
+ "@final-commerce/common": "2.3.0-staging.1"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@commitlint/cli": "^19.0.0",
@@ -1,6 +0,0 @@
1
- /**
2
- * Charge MOTO action
3
- * Calls the chargeMoto action on the parent window
4
- */
5
- import type { ChargeMoto } from './types';
6
- export declare const chargeMoto: ChargeMoto;
@@ -1,8 +0,0 @@
1
- /**
2
- * Charge MOTO action
3
- * Calls the chargeMoto action on the parent window
4
- */
5
- import { commandFrameClient } from '../../client';
6
- export const chargeMoto = async (params) => {
7
- return await commandFrameClient.call('chargeMoto', params);
8
- };
@@ -1,2 +0,0 @@
1
- import { ChargeMoto } from './types';
2
- export declare const mockChargeMoto: ChargeMoto;
@@ -1,47 +0,0 @@
1
- import { applyMockPayment, MOCK_CART } from '../../demo/database';
2
- /** Mirrors kaching's `MOTO_MIN_AMOUNT_MINOR` — the processors' floor. */
3
- const MOTO_MIN_AMOUNT_MINOR = 50;
4
- /** The card fields that must be present and non-empty on every keyed charge. */
5
- const REQUIRED_CARD_FIELDS = [
6
- 'encryptedCardNumber',
7
- 'encryptedExpiryMonth',
8
- 'encryptedExpiryYear',
9
- 'encryptedSecurityCode',
10
- ];
11
- export const mockChargeMoto = async (params) => {
12
- console.log('[Mock] chargeMoto called', params);
13
- if (!params)
14
- throw new Error('Params required');
15
- if (!Number.isInteger(params.amount)) {
16
- throw new Error('amount must be an integer number of minor units');
17
- }
18
- if (params.amount < MOTO_MIN_AMOUNT_MINOR) {
19
- throw new Error(`amount must be at least ${MOTO_MIN_AMOUNT_MINOR} minor units`);
20
- }
21
- for (const field of REQUIRED_CARD_FIELDS) {
22
- const value = params.card?.[field];
23
- if (!value || !value.trim()) {
24
- throw new Error(`card.${field} is required`);
25
- }
26
- }
27
- if (!params.idempotencyKey || !params.idempotencyKey.trim()) {
28
- throw new Error('idempotencyKey is required so a retry replays instead of recharging');
29
- }
30
- const balanceDue = MOCK_CART.amountToBeCharged ?? MOCK_CART.total;
31
- if (params.amount > balanceDue) {
32
- throw new Error(`amount ${params.amount} exceeds balance due ${balanceDue}`);
33
- }
34
- // The mock always completes the sale in one leg — it does not model
35
- // kaching's real partial-leg (`saleFinalized: false`) path.
36
- const order = applyMockPayment(balanceDue, 'card', 'adyen');
37
- if (!order) {
38
- throw new Error('MOCK_CHARGE_MOTO_PARTIAL_UNSUPPORTED: the mock only supports charging the full balance due');
39
- }
40
- return {
41
- success: true,
42
- timestamp: new Date().toISOString(),
43
- order,
44
- saleFinalized: true,
45
- remainingBalance: 0,
46
- };
47
- };
@@ -1,53 +0,0 @@
1
- import { CFOrder } from '../../CommonTypes';
2
- /**
3
- * Provider-encrypted card fields, opaque to this library — mirrors kaching's
4
- * `MotoCardFields` field for field. Never a raw PAN: these are the CSE blobs
5
- * the provider's own client-side encrypter produces.
6
- */
7
- export interface ChargeMotoCardFields {
8
- encryptedCardNumber: string;
9
- encryptedExpiryMonth: string;
10
- encryptedExpiryYear: string;
11
- encryptedSecurityCode: string;
12
- /** Optional AVS postal code the operator entered. */
13
- postalCode?: string;
14
- /** Provider-side `reference` for this payment. Defaults to the idempotency key server-side. */
15
- reference?: string;
16
- }
17
- export interface ChargeMotoParams {
18
- /**
19
- * Total to charge, base + tip, in integer MINOR currency units. Minimum 50
20
- * minor units (the processors' floor). This is the leg amount: a value
21
- * below the cart's balance due records a partial payment.
22
- */
23
- amount: number;
24
- /** Tip portion of `amount`, already collected by the caller's own UI. Defaults to 0. */
25
- tipAmount?: number;
26
- /**
27
- * ISO 4217 code. Optional — the active company's currency is authoritative.
28
- * When supplied it must match, or the charge is rejected before anything is sent.
29
- */
30
- currency?: string;
31
- card: ChargeMotoCardFields;
32
- /**
33
- * Idempotency key for this charge, HELD BY THE CALLER across retries. A
34
- * retried charge must carry the SAME key so the charge is replayed instead
35
- * of doubled; use a NEW key after changing the amount.
36
- */
37
- idempotencyKey: string;
38
- /** Optional tender label recorded on the payment method. */
39
- paymentName?: string;
40
- /** Fulfillment state to land on after full payment (default: auto-fulfill). */
41
- targetFulfillmentState?: string;
42
- }
43
- export interface ChargeMotoResponse {
44
- success: boolean;
45
- timestamp: string;
46
- /** The persisted order the charge landed on. */
47
- order: CFOrder;
48
- /** True only when this charge completed the sale (`paymentState === 'paid'`). */
49
- saleFinalized: boolean;
50
- /** Balance still due after this charge, in integer minor units. 0 when finalized. */
51
- remainingBalance: number;
52
- }
53
- export type ChargeMoto = (params: ChargeMotoParams) => Promise<ChargeMotoResponse>;
@@ -1,6 +0,0 @@
1
- /**
2
- * Create payment link action
3
- * Calls the createPaymentLink action on the parent window
4
- */
5
- import type { CreatePaymentLink } from './types';
6
- export declare const createPaymentLink: CreatePaymentLink;
@@ -1,8 +0,0 @@
1
- /**
2
- * Create payment link action
3
- * Calls the createPaymentLink action on the parent window
4
- */
5
- import { commandFrameClient } from '../../client';
6
- export const createPaymentLink = async (params) => {
7
- return await commandFrameClient.call('createPaymentLink', params);
8
- };
@@ -1,2 +0,0 @@
1
- import { CreatePaymentLink } from './types';
2
- export declare const mockCreatePaymentLink: CreatePaymentLink;
@@ -1,35 +0,0 @@
1
- import { MOCK_CART, mockPublishEvent, resetMockCart } from '../../demo/database';
2
- export const mockCreatePaymentLink = async (params) => {
3
- console.log('[Mock] createPaymentLink called', params);
4
- if (!params)
5
- throw new Error('Params required');
6
- const email = params.email?.trim() ? params.email : undefined;
7
- const phone = params.phone?.trim() ? params.phone : undefined;
8
- if (email && phone) {
9
- throw new Error('exactly one of email or phone delivers a payment link, not both');
10
- }
11
- if (!email && !phone) {
12
- throw new Error('exactly one of email or phone is required to deliver the payment link');
13
- }
14
- const hasCart = MOCK_CART.products.length > 0 ||
15
- (MOCK_CART.customSales?.length ?? 0) > 0 ||
16
- (MOCK_CART.nonRevenueItems?.length ?? 0) > 0;
17
- if (!hasCart || MOCK_CART.total <= 0) {
18
- throw new Error('ring the sale up before creating a payment link: the cart is empty');
19
- }
20
- const mockOrderId = 'order_' + Date.now();
21
- const mockLinkId = 'link_' + Math.random().toString(36).substr(2, 9);
22
- // Marks the cart consumed, same as a successful send in kaching — the order
23
- // now owns the line.
24
- resetMockCart();
25
- mockPublishEvent('cart', 'cart-created', {});
26
- return {
27
- success: true,
28
- timestamp: new Date().toISOString(),
29
- orderId: mockOrderId,
30
- url: `https://mock.finalpos.dev/pay/${mockLinkId}`,
31
- id: mockLinkId,
32
- expiresAt: new Date(Date.now() + 24 * 60 * 60 * 1000).toISOString(),
33
- delivery: email ? { email: 'sent' } : { sms: 'sent' },
34
- };
35
- };