@final-commerce/command-frame 0.3.2-beta.1 → 0.4.0-preprod.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -30
- package/dist/actions/apply-transition/mock.d.ts +1 -1
- package/dist/actions/apply-transition/mock.js +8 -18
- package/dist/actions/apply-transition/types.d.ts +6 -4
- package/dist/actions/extension-payment/types.d.ts +2 -2
- package/dist/actions/get-available-transitions/mock.d.ts +5 -3
- package/dist/actions/get-available-transitions/mock.js +24 -12
- package/dist/actions/integration-payment/types.d.ts +2 -0
- package/dist/actions/partial-payment/types.d.ts +2 -2
- package/dist/actions/redeem-payment/types.d.ts +2 -0
- package/dist/actions/terminal-payment/types.d.ts +3 -3
- package/dist/actions/void-order/action.d.ts +6 -0
- package/dist/actions/void-order/action.js +8 -0
- package/dist/actions/void-order/mock.d.ts +2 -0
- package/dist/actions/void-order/mock.js +23 -0
- package/dist/actions/void-order/types.d.ts +27 -0
- package/dist/actions/void-order/types.js +1 -0
- package/dist/demo/database.d.ts +3 -2
- package/dist/demo/database.js +310 -250
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -0
- package/dist/projects/render/mocks.js +4 -0
- package/dist/projects/render/types.d.ts +3 -1
- package/dist/pubsub/topics/orders/index.d.ts +2 -2
- package/dist/pubsub/topics/orders/index.js +29 -24
- package/dist/pubsub/topics/orders/order-voided/types.d.ts +14 -0
- package/dist/pubsub/topics/orders/order-voided/types.js +1 -0
- package/dist/pubsub/topics/orders/types.d.ts +16 -14
- package/dist/pubsub/topics/orders/types.js +7 -6
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ export declare const command: {
|
|
|
33
33
|
readonly parkOrder: import(".").ParkOrder;
|
|
34
34
|
readonly resumeParkedOrder: import(".").ResumeParkedOrder;
|
|
35
35
|
readonly deleteParkedOrder: import(".").DeleteParkedOrder;
|
|
36
|
+
readonly voidOrder: import(".").VoidOrder;
|
|
36
37
|
readonly cashPayment: import(".").CashPayment;
|
|
37
38
|
readonly getCashRoundingAmount: import(".").GetCashRoundingAmount;
|
|
38
39
|
readonly tapToPayPayment: import(".").TapToPayPayment;
|
|
@@ -161,6 +162,7 @@ export type { ClearCart, ClearCartResponse } from './actions/clear-cart/types';
|
|
|
161
162
|
export type { ParkOrder, ParkOrderResponse } from './actions/park-order/types';
|
|
162
163
|
export type { ResumeParkedOrder, ResumeParkedOrderParams, ResumeParkedOrderResponse, } from './actions/resume-parked-order/types';
|
|
163
164
|
export type { DeleteParkedOrder, DeleteParkedOrderParams, DeleteParkedOrderResponse, } from './actions/delete-parked-order/types';
|
|
165
|
+
export type { VoidOrder, VoidOrderParams, VoidOrderResponse, VoidOrderOutcome } from './actions/void-order/types';
|
|
164
166
|
export type { CashPayment, CashPaymentParams, CashPaymentResponse } from './actions/cash-payment/types';
|
|
165
167
|
export type { GetCashRoundingAmount, GetCashRoundingAmountParams, GetCashRoundingAmountResponse, } from './actions/get-cash-rounding-amount/types';
|
|
166
168
|
export type { TapToPayPayment, TapToPayPaymentParams, TapToPayPaymentResponse, } from './actions/tap-to-pay-payment/types';
|
|
@@ -240,7 +242,7 @@ export { transactionsTopic } from './pubsub/topics/transactions';
|
|
|
240
242
|
export { categoriesTopic } from './pubsub/topics/categories';
|
|
241
243
|
export { attributesTopic } from './pubsub/topics/attributes';
|
|
242
244
|
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';
|
|
243
|
-
export type { OrderCreatedPayload, OrderUpdatedPayload, OrderActiveSetPayload, OrderActiveGetPayload, OrderCreatedEvent, OrderUpdatedEvent, OrderActiveSetEvent, OrderActiveGetEvent, OrderStateTransitionCompletedPayload, OrderStateTransitionBlockedPayload, OrderStateTransitionCompletedEvent, OrderStateTransitionBlockedEvent, OrdersEventType, OrdersEventPayload, } from './pubsub/topics/orders/types';
|
|
245
|
+
export type { OrderCreatedPayload, OrderUpdatedPayload, OrderVoidedPayload, OrderActiveSetPayload, OrderActiveGetPayload, OrderCreatedEvent, OrderUpdatedEvent, OrderVoidedEvent, OrderActiveSetEvent, OrderActiveGetEvent, OrderStateTransitionCompletedPayload, OrderStateTransitionBlockedPayload, OrderStateTransitionCompletedEvent, OrderStateTransitionBlockedEvent, OrdersEventType, OrdersEventPayload, } from './pubsub/topics/orders/types';
|
|
244
246
|
export type { RefundCreatedPayload, RefundUpdatedPayload, RefundActiveSetPayload, RefundActiveGetPayload, RefundCreatedEvent, RefundUpdatedEvent, RefundActiveSetEvent, RefundActiveGetEvent, RefundsEventType, RefundsEventPayload, } from './pubsub/topics/refunds/types';
|
|
245
247
|
export type { ProductCreatedPayload, ProductUpdatedPayload, ProductSetActivePayload, ProductGetActivePayload, ProductCreatedEvent, ProductUpdatedEvent, ProductSetActiveEvent, ProductGetActiveEvent, ProductsEventType, ProductsEventPayload, } from './pubsub/topics/products/types';
|
|
246
248
|
export type { OutletActiveSetPayload, OutletActiveGetPayload, OutletActiveSetEvent, OutletActiveGetEvent, OutletEventType, OutletEventPayload, } from './pubsub/topics/outlet/types';
|
package/dist/index.js
CHANGED
|
@@ -33,6 +33,7 @@ import { clearCart } from './actions/clear-cart/action';
|
|
|
33
33
|
import { parkOrder } from './actions/park-order/action';
|
|
34
34
|
import { resumeParkedOrder } from './actions/resume-parked-order/action';
|
|
35
35
|
import { deleteParkedOrder } from './actions/delete-parked-order/action';
|
|
36
|
+
import { voidOrder } from './actions/void-order/action';
|
|
36
37
|
import { cashPayment } from './actions/cash-payment/action';
|
|
37
38
|
import { getCashRoundingAmount } from './actions/get-cash-rounding-amount/action';
|
|
38
39
|
import { tapToPayPayment } from './actions/tap-to-pay-payment/action';
|
|
@@ -163,6 +164,7 @@ export const command = {
|
|
|
163
164
|
parkOrder,
|
|
164
165
|
resumeParkedOrder,
|
|
165
166
|
deleteParkedOrder,
|
|
167
|
+
voidOrder,
|
|
166
168
|
cashPayment,
|
|
167
169
|
getCashRoundingAmount,
|
|
168
170
|
tapToPayPayment,
|
|
@@ -31,6 +31,7 @@ import { mockCashPayment } from '../../actions/cash-payment/mock';
|
|
|
31
31
|
import { mockGetCashRoundingAmount } from '../../actions/get-cash-rounding-amount/mock';
|
|
32
32
|
import { mockClearCart } from '../../actions/clear-cart/mock';
|
|
33
33
|
import { mockDeleteParkedOrder } from '../../actions/delete-parked-order/mock';
|
|
34
|
+
import { mockVoidOrder } from '../../actions/void-order/mock';
|
|
34
35
|
import { mockExampleFunction } from '../../actions/example-function/mock';
|
|
35
36
|
import { mockGetCategories } from '../../actions/get-categories/mock';
|
|
36
37
|
import { mockGetContext } from '../../actions/get-context/mock';
|
|
@@ -91,6 +92,7 @@ import { mockSetActiveUser } from '../../actions/set-active-user/mock';
|
|
|
91
92
|
import { mockSetActiveRefund } from '../../actions/set-active-refund/mock';
|
|
92
93
|
import { canTransitionMock } from '../../actions/can-transition/mock';
|
|
93
94
|
import { getAvailableTransitionsMock } from '../../actions/get-available-transitions/mock';
|
|
95
|
+
import { applyTransitionMock } from '../../actions/apply-transition/mock';
|
|
94
96
|
import { mockGetSmartGridLayout } from '../../actions/get-smart-grid-layout/mock';
|
|
95
97
|
import { mockSaveSmartGridLayout } from '../../actions/save-smart-grid-layout/mock';
|
|
96
98
|
import { mockSendEmail } from '../../actions/send-email/mock';
|
|
@@ -123,6 +125,7 @@ export const RENDER_MOCKS = {
|
|
|
123
125
|
getCashRoundingAmount: mockGetCashRoundingAmount,
|
|
124
126
|
clearCart: mockClearCart,
|
|
125
127
|
deleteParkedOrder: mockDeleteParkedOrder,
|
|
128
|
+
voidOrder: mockVoidOrder,
|
|
126
129
|
exampleFunction: mockExampleFunction,
|
|
127
130
|
getCategories: mockGetCategories,
|
|
128
131
|
getContext: mockGetContext,
|
|
@@ -191,6 +194,7 @@ export const RENDER_MOCKS = {
|
|
|
191
194
|
removeNonRevenueItem: (params) => Promise.resolve({ success: true, externalId: params.externalId, timestamp: new Date().toISOString() }),
|
|
192
195
|
canTransition: canTransitionMock,
|
|
193
196
|
getAvailableTransitions: getAvailableTransitionsMock,
|
|
197
|
+
applyTransition: applyTransitionMock,
|
|
194
198
|
getSmartGridLayout: mockGetSmartGridLayout,
|
|
195
199
|
saveSmartGridLayout: mockSaveSmartGridLayout,
|
|
196
200
|
sendEmail: mockSendEmail,
|
|
@@ -1,4 +1,4 @@
|
|
|
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, InitiateRefund, CashPayment, GetCashRoundingAmount, TapToPayPayment, TerminalPayment, VendaraPayment, ExtensionPayment, RedeemPayment, AddNonRevenueItem, AddCustomerNote, RemoveCustomerNote, RemoveCustomerFromCart, GoToStationHome, OpenCashDrawer, ShowNotification, ShowConfirmation, AuthenticateUser, PartialPayment, SwitchUser, SetRefundStockAction, SelectAllRefundItems, ResetRefundDetails, CalculateRefundTotal, GetRemainingRefundableQuantities, ProcessPartialRefund, 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, IntegrationPayment, GetSmartGridLayout, SaveSmartGridLayout, SendEmail, SendSms } 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, VendaraPayment, ExtensionPayment, RedeemPayment, AddNonRevenueItem, AddCustomerNote, RemoveCustomerNote, RemoveCustomerFromCart, GoToStationHome, OpenCashDrawer, ShowNotification, ShowConfirmation, AuthenticateUser, PartialPayment, SwitchUser, SetRefundStockAction, SelectAllRefundItems, ResetRefundDetails, CalculateRefundTotal, GetRemainingRefundableQuantities, ProcessPartialRefund, 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 } from '../../index';
|
|
2
2
|
import type { OpenExtensionOverlay } from '../../actions/open-extension-overlay/types';
|
|
3
3
|
import type { ResolveExtensionOverlay } from '../../actions/resolve-extension-overlay/types';
|
|
4
4
|
export interface RenderProviderActions {
|
|
@@ -34,6 +34,7 @@ export interface RenderProviderActions {
|
|
|
34
34
|
parkOrder: ParkOrder;
|
|
35
35
|
resumeParkedOrder: ResumeParkedOrder;
|
|
36
36
|
deleteParkedOrder: DeleteParkedOrder;
|
|
37
|
+
voidOrder: VoidOrder;
|
|
37
38
|
initiateRefund: InitiateRefund;
|
|
38
39
|
openExtensionOverlay: OpenExtensionOverlay;
|
|
39
40
|
resolveExtensionOverlay: ResolveExtensionOverlay;
|
|
@@ -97,6 +98,7 @@ export interface RenderProviderActions {
|
|
|
97
98
|
removeNonRevenueItem: RemoveNonRevenueItem;
|
|
98
99
|
canTransition: CanTransition;
|
|
99
100
|
getAvailableTransitions: GetAvailableTransitions;
|
|
101
|
+
applyTransition: ApplyTransition;
|
|
100
102
|
getSmartGridLayout: GetSmartGridLayout;
|
|
101
103
|
saveSmartGridLayout: SaveSmartGridLayout;
|
|
102
104
|
sendEmail: SendEmail;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* Orders Topic Definition
|
|
3
3
|
* Defines the orders topic and its available event types
|
|
4
4
|
*/
|
|
5
|
-
import type { TopicDefinition } from
|
|
5
|
+
import type { TopicDefinition } from '../../types';
|
|
6
6
|
export declare const ordersTopic: TopicDefinition;
|
|
7
|
-
export * from
|
|
7
|
+
export * from './types';
|
|
@@ -3,41 +3,46 @@
|
|
|
3
3
|
* Defines the orders topic and its available event types
|
|
4
4
|
*/
|
|
5
5
|
export const ordersTopic = {
|
|
6
|
-
id:
|
|
7
|
-
name:
|
|
8
|
-
description:
|
|
6
|
+
id: 'orders',
|
|
7
|
+
name: 'Orders',
|
|
8
|
+
description: 'Topic for order-related events',
|
|
9
9
|
eventTypes: [
|
|
10
10
|
{
|
|
11
|
-
id:
|
|
12
|
-
name:
|
|
13
|
-
description:
|
|
11
|
+
id: 'order-created',
|
|
12
|
+
name: 'Order Created',
|
|
13
|
+
description: 'Published when a new order is created',
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
|
-
id:
|
|
17
|
-
name:
|
|
18
|
-
description:
|
|
16
|
+
id: 'order-updated',
|
|
17
|
+
name: 'Order Updated',
|
|
18
|
+
description: 'Published when an order is updated',
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
|
-
id:
|
|
22
|
-
name:
|
|
23
|
-
description:
|
|
21
|
+
id: 'set-active-order',
|
|
22
|
+
name: 'Set Active Order',
|
|
23
|
+
description: 'Published when the active order is set in POS state',
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
|
-
id:
|
|
27
|
-
name:
|
|
28
|
-
description:
|
|
26
|
+
id: 'get-active-order',
|
|
27
|
+
name: 'Get Active Order',
|
|
28
|
+
description: 'Published when the active order is retrieved for listeners',
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
|
-
id:
|
|
32
|
-
name:
|
|
33
|
-
description:
|
|
31
|
+
id: 'state-transition-completed',
|
|
32
|
+
name: 'State Transition Completed',
|
|
33
|
+
description: 'Published when an order state transition completes successfully',
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
|
-
id:
|
|
37
|
-
name:
|
|
38
|
-
description:
|
|
39
|
-
}
|
|
40
|
-
|
|
36
|
+
id: 'state-transition-blocked',
|
|
37
|
+
name: 'State Transition Blocked',
|
|
38
|
+
description: 'Published when an order state transition is blocked by the state machine',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: 'order-voided',
|
|
42
|
+
name: 'Order Voided',
|
|
43
|
+
description: 'Published when an open order is voided (pure void, or captured legs refunded)',
|
|
44
|
+
},
|
|
45
|
+
],
|
|
41
46
|
};
|
|
42
47
|
// Re-export types
|
|
43
|
-
export * from
|
|
48
|
+
export * from './types';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { TopicEvent } from '../../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Order Voided Event Types
|
|
4
|
+
*/
|
|
5
|
+
export interface OrderVoidedPayload {
|
|
6
|
+
orderId: string;
|
|
7
|
+
/** 'voided' = nothing captured; 'refunded' = captured legs were refunded. */
|
|
8
|
+
outcome: 'voided' | 'refunded';
|
|
9
|
+
reason?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Typed event for order-voided
|
|
13
|
+
*/
|
|
14
|
+
export type OrderVoidedEvent = TopicEvent<OrderVoidedPayload>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -2,17 +2,19 @@
|
|
|
2
2
|
* Orders Topic Types
|
|
3
3
|
* Aggregated types for all order-related events
|
|
4
4
|
*/
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
11
|
-
|
|
12
|
-
import type {
|
|
13
|
-
import type {
|
|
14
|
-
import type {
|
|
15
|
-
import type {
|
|
16
|
-
import type {
|
|
17
|
-
|
|
18
|
-
|
|
5
|
+
export * from './order-created/types';
|
|
6
|
+
export * from './order-updated/types';
|
|
7
|
+
export * from './order-voided/types';
|
|
8
|
+
export * from './set-active-order/types';
|
|
9
|
+
export * from './get-active-order/types';
|
|
10
|
+
export * from './state-transition-completed/types';
|
|
11
|
+
export * from './state-transition-blocked/types';
|
|
12
|
+
import type { OrderCreatedPayload } from './order-created/types';
|
|
13
|
+
import type { OrderUpdatedPayload } from './order-updated/types';
|
|
14
|
+
import type { OrderVoidedPayload } from './order-voided/types';
|
|
15
|
+
import type { OrderActiveSetPayload } from './set-active-order/types';
|
|
16
|
+
import type { OrderActiveGetPayload } from './get-active-order/types';
|
|
17
|
+
import type { OrderStateTransitionCompletedPayload } from './state-transition-completed/types';
|
|
18
|
+
import type { OrderStateTransitionBlockedPayload } from './state-transition-blocked/types';
|
|
19
|
+
export type OrdersEventPayload = OrderCreatedPayload | OrderUpdatedPayload | OrderVoidedPayload | OrderActiveSetPayload | OrderActiveGetPayload | OrderStateTransitionCompletedPayload | OrderStateTransitionBlockedPayload;
|
|
20
|
+
export type OrdersEventType = 'order-created' | 'order-updated' | 'order-voided' | 'set-active-order' | 'get-active-order' | 'state-transition-completed' | 'state-transition-blocked';
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
* Aggregated types for all order-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
|
|
6
|
+
export * from './order-created/types';
|
|
7
|
+
export * from './order-updated/types';
|
|
8
|
+
export * from './order-voided/types';
|
|
9
|
+
export * from './set-active-order/types';
|
|
10
|
+
export * from './get-active-order/types';
|
|
11
|
+
export * from './state-transition-completed/types';
|
|
12
|
+
export * from './state-transition-blocked/types';
|