@final-commerce/command-frame 0.8.0-online.4 → 0.8.0-preprod.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CommonTypes.d.ts +26 -1
- package/dist/actions/add-booking-to-cart/action.d.ts +6 -0
- package/dist/actions/add-booking-to-cart/action.js +8 -0
- package/dist/actions/add-booking-to-cart/mock.d.ts +2 -0
- package/dist/actions/add-booking-to-cart/mock.js +66 -0
- package/dist/actions/add-booking-to-cart/types.d.ts +27 -0
- package/dist/actions/cancel-booking/action.d.ts +6 -0
- package/dist/actions/cancel-booking/action.js +8 -0
- package/dist/actions/cancel-booking/mock.d.ts +2 -0
- package/dist/actions/cancel-booking/mock.js +31 -0
- package/dist/actions/cancel-booking/types.d.ts +14 -0
- package/dist/actions/get-booking-availability/action.d.ts +6 -0
- package/dist/actions/get-booking-availability/action.js +8 -0
- package/dist/actions/get-booking-availability/mock.d.ts +2 -0
- package/dist/actions/get-booking-availability/mock.js +12 -0
- package/dist/actions/get-booking-availability/types.d.ts +37 -0
- package/dist/actions/get-booking-resources/action.d.ts +6 -0
- package/dist/actions/get-booking-resources/action.js +8 -0
- package/dist/actions/get-booking-resources/mock.d.ts +2 -0
- package/dist/actions/get-booking-resources/mock.js +7 -0
- package/dist/actions/get-booking-resources/types.d.ts +16 -0
- package/dist/actions/get-booking-resources/types.js +1 -0
- package/dist/actions/get-bookings/action.d.ts +6 -0
- package/dist/actions/get-bookings/action.js +8 -0
- package/dist/actions/get-bookings/mock.d.ts +2 -0
- package/dist/actions/get-bookings/mock.js +20 -0
- package/dist/actions/get-bookings/types.d.ts +22 -0
- package/dist/actions/get-bookings/types.js +1 -0
- package/dist/actions/get-context/mock.js +4 -0
- package/dist/actions/get-product-modifier-selections/action.d.ts +1 -1
- package/dist/actions/get-product-modifier-selections/action.js +2 -2
- package/dist/actions/get-product-modifier-selections/mock.d.ts +1 -1
- package/dist/actions/get-product-modifier-selections/mock.js +5 -5
- package/dist/actions/get-product-modifier-selections/types.d.ts +1 -1
- package/dist/actions/get-products/mock.js +6 -0
- package/dist/actions/get-products/types.d.ts +25 -3
- package/dist/actions/get-refund-plan/types.d.ts +5 -2
- package/dist/actions/get-remaining-refundable-quantities/mock.js +1 -0
- package/dist/actions/get-remaining-refundable-quantities/types.d.ts +8 -0
- package/dist/actions/hold-booking/action.d.ts +6 -0
- package/dist/actions/hold-booking/action.js +8 -0
- package/dist/actions/hold-booking/mock.d.ts +2 -0
- package/dist/actions/hold-booking/mock.js +37 -0
- package/dist/actions/hold-booking/types.d.ts +28 -0
- package/dist/actions/hold-booking/types.js +1 -0
- package/dist/actions/process-partial-refund/types.d.ts +2 -2
- package/dist/actions/remove-booking-from-cart/action.d.ts +6 -0
- package/dist/actions/remove-booking-from-cart/action.js +8 -0
- package/dist/actions/remove-booking-from-cart/mock.d.ts +2 -0
- package/dist/actions/remove-booking-from-cart/mock.js +40 -0
- package/dist/actions/remove-booking-from-cart/types.d.ts +16 -0
- package/dist/actions/remove-booking-from-cart/types.js +1 -0
- package/dist/actions/set-product-modifier-selections/action.d.ts +1 -1
- package/dist/actions/set-product-modifier-selections/action.js +2 -2
- package/dist/actions/set-product-modifier-selections/mock.d.ts +1 -1
- package/dist/actions/set-product-modifier-selections/mock.js +7 -7
- package/dist/actions/set-product-modifier-selections/types.d.ts +2 -2
- package/dist/demo/database.d.ts +18 -1
- package/dist/demo/database.js +183 -0
- package/dist/index.d.ts +16 -6
- package/dist/index.js +15 -5
- package/dist/projects/render/mocks.js +14 -4
- package/dist/projects/render/types.d.ts +8 -13
- package/dist/pubsub/topics/bookings/booking-created/types.d.ts +6 -0
- package/dist/pubsub/topics/bookings/booking-created/types.js +1 -0
- package/dist/pubsub/topics/bookings/booking-setup-changed/types.d.ts +15 -0
- package/dist/pubsub/topics/bookings/booking-setup-changed/types.js +1 -0
- package/dist/pubsub/topics/bookings/booking-updated/types.d.ts +6 -0
- package/dist/pubsub/topics/bookings/booking-updated/types.js +1 -0
- package/dist/pubsub/topics/bookings/index.d.ts +3 -0
- package/dist/pubsub/topics/bookings/index.js +27 -0
- package/dist/pubsub/topics/bookings/types.d.ts +8 -0
- package/dist/pubsub/topics/bookings/types.js +3 -0
- package/dist/pubsub/topics/cart/product-modifiers-updated/types.d.ts +2 -2
- package/dist/pubsub/topics/cart/types.d.ts +33 -33
- package/dist/pubsub/topics/cart/types.js +16 -16
- package/dist/pubsub/topics/index.d.ts +17 -17
- package/dist/pubsub/topics/index.js +17 -17
- package/dist/pubsub/topics/types.d.ts +2 -8
- package/package.json +5 -2
- package/dist/actions/resume-checkout/action.d.ts +0 -6
- package/dist/actions/resume-checkout/action.js +0 -8
- package/dist/actions/resume-checkout/mock.d.ts +0 -16
- package/dist/actions/resume-checkout/mock.js +0 -51
- package/dist/actions/resume-checkout/types.d.ts +0 -59
- package/dist/actions/resume-checkout/types.js +0 -13
- package/dist/actions/start-checkout/action.d.ts +0 -6
- package/dist/actions/start-checkout/action.js +0 -8
- package/dist/actions/start-checkout/mock.d.ts +0 -16
- package/dist/actions/start-checkout/mock.js +0 -80
- package/dist/actions/start-checkout/types.d.ts +0 -81
- package/dist/actions/start-checkout/types.js +0 -10
- package/dist/pubsub/topics/checkout/checkout-started/types.d.ts +0 -26
- package/dist/pubsub/topics/checkout/index.d.ts +0 -7
- package/dist/pubsub/topics/checkout/index.js +0 -28
- package/dist/pubsub/topics/checkout/payment-completed/types.d.ts +0 -31
- package/dist/pubsub/topics/checkout/payment-failed/types.d.ts +0 -20
- package/dist/pubsub/topics/checkout/types.d.ts +0 -12
- package/dist/pubsub/topics/checkout/types.js +0 -8
- /package/dist/{pubsub/topics/checkout/checkout-started → actions/add-booking-to-cart}/types.js +0 -0
- /package/dist/{pubsub/topics/checkout/payment-completed → actions/cancel-booking}/types.js +0 -0
- /package/dist/{pubsub/topics/checkout/payment-failed → actions/get-booking-availability}/types.js +0 -0
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,
|
|
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 @@
|
|
|
1
|
+
export {};
|
|
@@ -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 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { CFActiveProduct, CFModifierSelection } from
|
|
2
|
-
import type { TopicEvent } from
|
|
1
|
+
import type { CFActiveProduct, CFModifierSelection } from '../../../../CommonTypes';
|
|
2
|
+
import type { TopicEvent } from '../../../types';
|
|
3
3
|
/**
|
|
4
4
|
* Payload for product-modifiers-updated event (FT-0010) — fired when a cart
|
|
5
5
|
* line's modifier selections are replaced via setProductModifierSelections.
|
|
@@ -2,37 +2,37 @@
|
|
|
2
2
|
* Cart Topic Types
|
|
3
3
|
* Aggregated types for all cart-related events
|
|
4
4
|
*/
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
11
|
-
export * from
|
|
12
|
-
export * from
|
|
13
|
-
export * from
|
|
14
|
-
export * from
|
|
15
|
-
export * from
|
|
16
|
-
export * from
|
|
17
|
-
export * from
|
|
18
|
-
export * from
|
|
19
|
-
export * from
|
|
20
|
-
export * from
|
|
21
|
-
import type { CartCreatedPayload } from
|
|
22
|
-
import type { CartCustomerAssignedPayload } from
|
|
23
|
-
import type { ProductAddedPayload } from
|
|
24
|
-
import type { ProductDeletedPayload } from
|
|
25
|
-
import type { CartProductUpdatedPayload } from
|
|
26
|
-
import type { CartDiscountAddedPayload } from
|
|
27
|
-
import type { CartDiscountRemovedPayload } from
|
|
28
|
-
import type { CartFeeAddedPayload } from
|
|
29
|
-
import type { CartFeeRemovedPayload } from
|
|
30
|
-
import type { ProductDiscountAddedPayload } from
|
|
31
|
-
import type { ProductDiscountRemovedPayload } from
|
|
32
|
-
import type { ProductFeeAddedPayload } from
|
|
33
|
-
import type { ProductFeeRemovedPayload } from
|
|
34
|
-
import type { ProductNoteAddedPayload } from
|
|
35
|
-
import type { ProductNoteRemovedPayload } from
|
|
36
|
-
import type { ProductModifiersUpdatedPayload } from
|
|
5
|
+
export * from './cart-created/types';
|
|
6
|
+
export * from './customer-assigned/types';
|
|
7
|
+
export * from './product-added/types';
|
|
8
|
+
export * from './product-deleted/types';
|
|
9
|
+
export * from './product-updated/types';
|
|
10
|
+
export * from './cart-discount-added/types';
|
|
11
|
+
export * from './cart-discount-removed/types';
|
|
12
|
+
export * from './cart-fee-added/types';
|
|
13
|
+
export * from './cart-fee-removed/types';
|
|
14
|
+
export * from './product-discount-added/types';
|
|
15
|
+
export * from './product-discount-removed/types';
|
|
16
|
+
export * from './product-fee-added/types';
|
|
17
|
+
export * from './product-fee-removed/types';
|
|
18
|
+
export * from './product-note-added/types';
|
|
19
|
+
export * from './product-note-removed/types';
|
|
20
|
+
export * from './product-modifiers-updated/types';
|
|
21
|
+
import type { CartCreatedPayload } from './cart-created/types';
|
|
22
|
+
import type { CartCustomerAssignedPayload } from './customer-assigned/types';
|
|
23
|
+
import type { ProductAddedPayload } from './product-added/types';
|
|
24
|
+
import type { ProductDeletedPayload } from './product-deleted/types';
|
|
25
|
+
import type { CartProductUpdatedPayload } from './product-updated/types';
|
|
26
|
+
import type { CartDiscountAddedPayload } from './cart-discount-added/types';
|
|
27
|
+
import type { CartDiscountRemovedPayload } from './cart-discount-removed/types';
|
|
28
|
+
import type { CartFeeAddedPayload } from './cart-fee-added/types';
|
|
29
|
+
import type { CartFeeRemovedPayload } from './cart-fee-removed/types';
|
|
30
|
+
import type { ProductDiscountAddedPayload } from './product-discount-added/types';
|
|
31
|
+
import type { ProductDiscountRemovedPayload } from './product-discount-removed/types';
|
|
32
|
+
import type { ProductFeeAddedPayload } from './product-fee-added/types';
|
|
33
|
+
import type { ProductFeeRemovedPayload } from './product-fee-removed/types';
|
|
34
|
+
import type { ProductNoteAddedPayload } from './product-note-added/types';
|
|
35
|
+
import type { ProductNoteRemovedPayload } from './product-note-removed/types';
|
|
36
|
+
import type { ProductModifiersUpdatedPayload } from './product-modifiers-updated/types';
|
|
37
37
|
export type CartEventPayload = CartCreatedPayload | CartCustomerAssignedPayload | ProductAddedPayload | ProductDeletedPayload | CartProductUpdatedPayload | CartDiscountAddedPayload | CartDiscountRemovedPayload | CartFeeAddedPayload | CartFeeRemovedPayload | ProductDiscountAddedPayload | ProductDiscountRemovedPayload | ProductFeeAddedPayload | ProductFeeRemovedPayload | ProductNoteAddedPayload | ProductNoteRemovedPayload | ProductModifiersUpdatedPayload;
|
|
38
|
-
export type CartEventType =
|
|
38
|
+
export type CartEventType = 'cart-created' | 'customer-assigned' | 'customer-unassigned' | 'product-added' | 'product-deleted' | 'product-updated' | 'cart-discount-added' | 'cart-discount-removed' | 'cart-fee-added' | 'cart-fee-removed' | 'product-discount-added' | 'product-discount-removed' | 'product-fee-added' | 'product-fee-removed' | 'product-note-added' | 'product-note-removed' | 'product-modifiers-updated';
|
|
@@ -3,19 +3,19 @@
|
|
|
3
3
|
* Aggregated types for all cart-related events
|
|
4
4
|
*/
|
|
5
5
|
// Re-export all event types
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
11
|
-
export * from
|
|
12
|
-
export * from
|
|
13
|
-
export * from
|
|
14
|
-
export * from
|
|
15
|
-
export * from
|
|
16
|
-
export * from
|
|
17
|
-
export * from
|
|
18
|
-
export * from
|
|
19
|
-
export * from
|
|
20
|
-
export * from
|
|
21
|
-
export * from
|
|
6
|
+
export * from './cart-created/types';
|
|
7
|
+
export * from './customer-assigned/types';
|
|
8
|
+
export * from './product-added/types';
|
|
9
|
+
export * from './product-deleted/types';
|
|
10
|
+
export * from './product-updated/types';
|
|
11
|
+
export * from './cart-discount-added/types';
|
|
12
|
+
export * from './cart-discount-removed/types';
|
|
13
|
+
export * from './cart-fee-added/types';
|
|
14
|
+
export * from './cart-fee-removed/types';
|
|
15
|
+
export * from './product-discount-added/types';
|
|
16
|
+
export * from './product-discount-removed/types';
|
|
17
|
+
export * from './product-fee-added/types';
|
|
18
|
+
export * from './product-fee-removed/types';
|
|
19
|
+
export * from './product-note-added/types';
|
|
20
|
+
export * from './product-note-removed/types';
|
|
21
|
+
export * from './product-modifiers-updated/types';
|
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
* Pub/Sub Topics
|
|
3
3
|
* Export all available topics and their types
|
|
4
4
|
*/
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
11
|
-
export * from
|
|
12
|
-
export * from
|
|
13
|
-
export * from
|
|
14
|
-
export * from
|
|
15
|
-
export * from
|
|
16
|
-
export * from
|
|
17
|
-
export * from
|
|
18
|
-
export * from
|
|
19
|
-
export * from
|
|
20
|
-
export * from
|
|
21
|
-
export * from
|
|
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,20 +2,20 @@
|
|
|
2
2
|
* Pub/Sub Topics
|
|
3
3
|
* Export all available topics and their types
|
|
4
4
|
*/
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
11
|
-
export * from
|
|
12
|
-
export * from
|
|
13
|
-
export * from
|
|
14
|
-
export * from
|
|
15
|
-
export * from
|
|
16
|
-
export * from
|
|
17
|
-
export * from
|
|
18
|
-
export * from
|
|
19
|
-
export * from
|
|
20
|
-
export * from
|
|
21
|
-
export * from
|
|
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';
|
|
@@ -4,7 +4,6 @@ import { RefundsEventType, RefundsEventPayload } from "./refunds/types";
|
|
|
4
4
|
import { ProductsEventType, ProductsEventPayload } from "./products/types";
|
|
5
5
|
import { CartEventType, CartEventPayload } from "./cart/types";
|
|
6
6
|
import { PaymentsEventType, PaymentsEventPayload } from "./payments/types";
|
|
7
|
-
import { CheckoutEventType, CheckoutEventPayload } from "./checkout/types";
|
|
8
7
|
import { SplitPaymentsEventType, SplitPaymentsEventPayload } from "./split-payments/types";
|
|
9
8
|
import { CustomTablesEventPayload, CustomTablesEventType } from "./custom-tables/types";
|
|
10
9
|
import { PrintEventType, PrintEventPayload } from "./print/types";
|
|
@@ -16,6 +15,7 @@ import { VariantsEventType, VariantsEventPayload } from "./variants/types";
|
|
|
16
15
|
import { TransactionsEventType, TransactionsEventPayload } from "./transactions/types";
|
|
17
16
|
import { CategoriesEventType, CategoriesEventPayload } from "./categories/types";
|
|
18
17
|
import { AttributesEventType, AttributesEventPayload } from "./attributes/types";
|
|
18
|
+
import { BookingsEventType, BookingsEventPayload } from "./bookings/types";
|
|
19
19
|
export interface TopicEventPayloadMap {
|
|
20
20
|
customers: Record<CustomersEventType, CustomersEventPayload>;
|
|
21
21
|
orders: Record<OrdersEventType, OrdersEventPayload>;
|
|
@@ -23,13 +23,6 @@ export interface TopicEventPayloadMap {
|
|
|
23
23
|
products: Record<ProductsEventType, ProductsEventPayload>;
|
|
24
24
|
cart: Record<CartEventType, CartEventPayload>;
|
|
25
25
|
payments: Record<PaymentsEventType, PaymentsEventPayload>;
|
|
26
|
-
/**
|
|
27
|
-
* ONLINE checkout only (a published website), where the POS `payments`
|
|
28
|
-
* topic never fires: `payments` reports a till tender settling in front of
|
|
29
|
-
* a cashier, while a web shopper's outcome arrives asynchronously and can
|
|
30
|
-
* only ever be an authorisation until the provider's webhook lands.
|
|
31
|
-
*/
|
|
32
|
-
checkout: Record<CheckoutEventType, CheckoutEventPayload>;
|
|
33
26
|
"split-payments": Record<SplitPaymentsEventType, SplitPaymentsEventPayload>;
|
|
34
27
|
customTables: Record<CustomTablesEventType, CustomTablesEventPayload>;
|
|
35
28
|
print: Record<PrintEventType, PrintEventPayload>;
|
|
@@ -41,4 +34,5 @@ export interface TopicEventPayloadMap {
|
|
|
41
34
|
transactions: Record<TransactionsEventType, TransactionsEventPayload>;
|
|
42
35
|
categories: Record<CategoriesEventType, CategoriesEventPayload>;
|
|
43
36
|
attributes: Record<AttributesEventType, AttributesEventPayload>;
|
|
37
|
+
bookings: Record<BookingsEventType, BookingsEventPayload>;
|
|
44
38
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@final-commerce/command-frame",
|
|
3
|
-
"version": "0.8.0-
|
|
3
|
+
"version": "0.8.0-preprod.2",
|
|
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.
|
|
60
|
+
"@final-commerce/common": "2.4.0-preprod.3"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@commitlint/cli": "^19.0.0",
|
|
@@ -73,5 +73,8 @@
|
|
|
73
73
|
"typescript-eslint": "^8.0.0",
|
|
74
74
|
"vitest": "^4.0.0"
|
|
75
75
|
},
|
|
76
|
+
"overrides": {
|
|
77
|
+
"js-yaml": "^4.3.2"
|
|
78
|
+
},
|
|
76
79
|
"prettier": "@final-commerce/common/prettier"
|
|
77
80
|
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Resume Checkout action
|
|
3
|
-
* Calls the resumeCheckout action on the parent window
|
|
4
|
-
*/
|
|
5
|
-
import { commandFrameClient } from '../../client';
|
|
6
|
-
export const resumeCheckout = async (params) => {
|
|
7
|
-
return await commandFrameClient.call('resumeCheckout', params ?? {});
|
|
8
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { ResumeCheckout } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Standalone mock of the checkout return leg.
|
|
4
|
-
*
|
|
5
|
-
* It reads the SAME query parameters the real provider sends a shopper back
|
|
6
|
-
* with, so a builder can exercise the redirect path in preview by appending
|
|
7
|
-
* them by hand:
|
|
8
|
-
*
|
|
9
|
-
* ?sessionId=CS_MOCK&redirectResult=MOCK
|
|
10
|
-
*
|
|
11
|
-
* Without them it answers `{ resumed: false }` and does nothing, which is what
|
|
12
|
-
* the real command does on an ordinary page load. That is the branch a
|
|
13
|
-
* checkout screen hits on every normal visit, so it is the one worth getting
|
|
14
|
-
* right in a mock.
|
|
15
|
-
*/
|
|
16
|
-
export declare const mockResumeCheckout: ResumeCheckout;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { mockPublishEvent } from '../../demo/database';
|
|
2
|
-
/**
|
|
3
|
-
* Standalone mock of the checkout return leg.
|
|
4
|
-
*
|
|
5
|
-
* It reads the SAME query parameters the real provider sends a shopper back
|
|
6
|
-
* with, so a builder can exercise the redirect path in preview by appending
|
|
7
|
-
* them by hand:
|
|
8
|
-
*
|
|
9
|
-
* ?sessionId=CS_MOCK&redirectResult=MOCK
|
|
10
|
-
*
|
|
11
|
-
* Without them it answers `{ resumed: false }` and does nothing, which is what
|
|
12
|
-
* the real command does on an ordinary page load. That is the branch a
|
|
13
|
-
* checkout screen hits on every normal visit, so it is the one worth getting
|
|
14
|
-
* right in a mock.
|
|
15
|
-
*/
|
|
16
|
-
export const mockResumeCheckout = async (params) => {
|
|
17
|
-
console.log('[Mock] resumeCheckout called', params);
|
|
18
|
-
const href = params?.url ?? (typeof window === 'undefined' ? '' : window.location.href);
|
|
19
|
-
let redirectResult = null;
|
|
20
|
-
try {
|
|
21
|
-
redirectResult = new URL(href).searchParams.get('redirectResult');
|
|
22
|
-
}
|
|
23
|
-
catch {
|
|
24
|
-
redirectResult = null;
|
|
25
|
-
}
|
|
26
|
-
if (!redirectResult) {
|
|
27
|
-
return {
|
|
28
|
-
success: true,
|
|
29
|
-
timestamp: new Date().toISOString(),
|
|
30
|
-
checkout: { resumed: false },
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
const suffix = String(Date.now()).slice(-6);
|
|
34
|
-
const checkout = {
|
|
35
|
-
resumed: true,
|
|
36
|
-
orderId: `mock-order-${suffix}`,
|
|
37
|
-
receiptId: `ON-001-${suffix}`,
|
|
38
|
-
// `Authorised` is what the real provider reports for a completed redirect.
|
|
39
|
-
// It is NOT settlement — see the checkout topic docs.
|
|
40
|
-
resultCode: 'Authorised',
|
|
41
|
-
sessionResult: `mock-session-result-${suffix}`,
|
|
42
|
-
orderPassword: `mock-pw-${suffix}`,
|
|
43
|
-
};
|
|
44
|
-
mockPublishEvent('checkout', 'payment-completed', {
|
|
45
|
-
orderId: checkout.orderId,
|
|
46
|
-
receiptId: checkout.receiptId,
|
|
47
|
-
resultCode: checkout.resultCode,
|
|
48
|
-
sessionResult: checkout.sessionResult,
|
|
49
|
-
});
|
|
50
|
-
return { success: true, timestamp: new Date().toISOString(), checkout };
|
|
51
|
-
};
|