@final-commerce/command-frame 0.1.63 → 0.2.0-beta.6

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 (101) hide show
  1. package/README.md +26 -28
  2. package/dist/CommonTypes.d.ts +118 -19
  3. package/dist/actions/add-customer-note/mock.js +27 -18
  4. package/dist/actions/add-customer-note/types.d.ts +3 -2
  5. package/dist/actions/add-product/mock.js +11 -5
  6. package/dist/actions/can-transition/action.d.ts +2 -0
  7. package/dist/actions/can-transition/action.js +4 -0
  8. package/dist/actions/can-transition/mock.d.ts +6 -0
  9. package/dist/actions/can-transition/mock.js +28 -0
  10. package/dist/actions/can-transition/types.d.ts +11 -0
  11. package/dist/actions/can-transition/types.js +1 -0
  12. package/dist/actions/cash-payment/types.d.ts +5 -0
  13. package/dist/actions/delete-parked-order/types.d.ts +3 -0
  14. package/dist/actions/edit-product/mock.js +4 -2
  15. package/dist/actions/extension-payment/types.d.ts +5 -0
  16. package/dist/actions/get-available-transitions/action.d.ts +2 -0
  17. package/dist/actions/get-available-transitions/action.js +4 -0
  18. package/dist/actions/get-available-transitions/mock.d.ts +6 -0
  19. package/dist/actions/get-available-transitions/mock.js +26 -0
  20. package/dist/actions/get-available-transitions/types.d.ts +9 -0
  21. package/dist/actions/get-available-transitions/types.js +1 -0
  22. package/dist/actions/get-context/mock.js +12 -6
  23. package/dist/actions/initiate-refund/types.d.ts +3 -0
  24. package/dist/actions/park-order/types.d.ts +3 -0
  25. package/dist/actions/partial-payment/types.d.ts +5 -0
  26. package/dist/actions/print/mock.js +3 -6
  27. package/dist/actions/print/types.d.ts +1 -7
  28. package/dist/actions/process-partial-refund/types.d.ts +3 -0
  29. package/dist/actions/remove-customer-note/mock.js +16 -7
  30. package/dist/actions/resume-parked-order/types.d.ts +3 -0
  31. package/dist/actions/tap-to-pay-payment/types.d.ts +5 -0
  32. package/dist/actions/terminal-payment/types.d.ts +5 -0
  33. package/dist/actions/vendara-payment/types.d.ts +5 -0
  34. package/dist/common-types/index.d.ts +1 -0
  35. package/dist/common-types/index.js +1 -0
  36. package/dist/common-types/order-state.d.ts +32 -0
  37. package/dist/common-types/order-state.js +6 -0
  38. package/dist/common-types/state-fragment.d.ts +77 -0
  39. package/dist/common-types/state-fragment.js +10 -0
  40. package/dist/demo/database.js +18 -24
  41. package/dist/fragments/index.d.ts +1 -0
  42. package/dist/fragments/index.js +1 -0
  43. package/dist/fragments/preorder-no-deposit.d.ts +26 -0
  44. package/dist/fragments/preorder-no-deposit.js +166 -0
  45. package/dist/index.d.ts +17 -2
  46. package/dist/index.js +12 -0
  47. package/dist/projects/render/mocks.js +5 -1
  48. package/dist/projects/render/types.d.ts +3 -1
  49. package/dist/pubsub/topics/attributes/attribute-created/types.d.ts +6 -0
  50. package/dist/pubsub/topics/attributes/attribute-created/types.js +1 -0
  51. package/dist/pubsub/topics/attributes/attribute-updated/types.d.ts +6 -0
  52. package/dist/pubsub/topics/attributes/attribute-updated/types.js +1 -0
  53. package/dist/pubsub/topics/attributes/index.d.ts +3 -0
  54. package/dist/pubsub/topics/attributes/index.js +18 -0
  55. package/dist/pubsub/topics/attributes/types.d.ts +6 -0
  56. package/dist/pubsub/topics/attributes/types.js +2 -0
  57. package/dist/pubsub/topics/categories/category-created/types.d.ts +6 -0
  58. package/dist/pubsub/topics/categories/category-created/types.js +1 -0
  59. package/dist/pubsub/topics/categories/category-updated/types.d.ts +6 -0
  60. package/dist/pubsub/topics/categories/category-updated/types.js +1 -0
  61. package/dist/pubsub/topics/categories/index.d.ts +3 -0
  62. package/dist/pubsub/topics/categories/index.js +18 -0
  63. package/dist/pubsub/topics/categories/types.d.ts +6 -0
  64. package/dist/pubsub/topics/categories/types.js +2 -0
  65. package/dist/pubsub/topics/index.d.ts +4 -0
  66. package/dist/pubsub/topics/index.js +4 -0
  67. package/dist/pubsub/topics/orders/index.js +10 -0
  68. package/dist/pubsub/topics/orders/state-transition-blocked/types.d.ts +16 -0
  69. package/dist/pubsub/topics/orders/state-transition-blocked/types.js +1 -0
  70. package/dist/pubsub/topics/orders/state-transition-completed/types.d.ts +15 -0
  71. package/dist/pubsub/topics/orders/state-transition-completed/types.js +1 -0
  72. package/dist/pubsub/topics/orders/types.d.ts +6 -2
  73. package/dist/pubsub/topics/orders/types.js +2 -0
  74. package/dist/pubsub/topics/print/print-completed/types.d.ts +1 -1
  75. package/dist/pubsub/topics/print/print-error/types.d.ts +1 -1
  76. package/dist/pubsub/topics/print/print-started/types.d.ts +1 -1
  77. package/dist/pubsub/topics/transactions/index.d.ts +3 -0
  78. package/dist/pubsub/topics/transactions/index.js +18 -0
  79. package/dist/pubsub/topics/transactions/transaction-created/types.d.ts +6 -0
  80. package/dist/pubsub/topics/transactions/transaction-created/types.js +1 -0
  81. package/dist/pubsub/topics/transactions/transaction-updated/types.d.ts +6 -0
  82. package/dist/pubsub/topics/transactions/transaction-updated/types.js +1 -0
  83. package/dist/pubsub/topics/transactions/types.d.ts +6 -0
  84. package/dist/pubsub/topics/transactions/types.js +2 -0
  85. package/dist/pubsub/topics/types.d.ts +8 -0
  86. package/dist/pubsub/topics/users/index.js +10 -0
  87. package/dist/pubsub/topics/users/types.d.ts +6 -2
  88. package/dist/pubsub/topics/users/types.js +2 -0
  89. package/dist/pubsub/topics/users/user-created/types.d.ts +6 -0
  90. package/dist/pubsub/topics/users/user-created/types.js +1 -0
  91. package/dist/pubsub/topics/users/user-updated/types.d.ts +6 -0
  92. package/dist/pubsub/topics/users/user-updated/types.js +1 -0
  93. package/dist/pubsub/topics/variants/index.d.ts +3 -0
  94. package/dist/pubsub/topics/variants/index.js +18 -0
  95. package/dist/pubsub/topics/variants/types.d.ts +6 -0
  96. package/dist/pubsub/topics/variants/types.js +2 -0
  97. package/dist/pubsub/topics/variants/variant-created/types.d.ts +6 -0
  98. package/dist/pubsub/topics/variants/variant-created/types.js +1 -0
  99. package/dist/pubsub/topics/variants/variant-updated/types.d.ts +6 -0
  100. package/dist/pubsub/topics/variants/variant-updated/types.js +1 -0
  101. package/package.json +1 -1
@@ -0,0 +1,166 @@
1
+ /**
2
+ * Pre-order fragment — no deposit required.
3
+ *
4
+ * Mirrors preorder-with-deposit but removes the cross-axis rule that gates
5
+ * `on_hold` on payment state. An order can be placed on hold while still
6
+ * `unpaid` — payment is collected later (pay-at-pickup, BOPIS, COD, etc.).
7
+ *
8
+ * State flow:
9
+ *
10
+ * unpaid|on_hold → (cashier collects payment) → paid|on_hold
11
+ * ↓
12
+ * (progress fulfillment)
13
+ * ↓
14
+ * paid|in_progress
15
+ *
16
+ * Key difference from preorder-with-deposit:
17
+ * - No cross-axis rule blocking `on_hold` when unpaid. The cashier can
18
+ * confirm the pre-order without collecting a deposit first.
19
+ * - `unpaid|on_hold` is whitelisted as a valid first-save state pair.
20
+ * - `in_progress` still requires at least a partial payment (you must pay
21
+ * before the merchant starts fulfilling).
22
+ *
23
+ * Prefix all IDs with your extension id before merging to avoid collisions.
24
+ */
25
+ export const preorderNoDepositFragment = {
26
+ paymentPaths: [
27
+ {
28
+ from: "unpaid",
29
+ to: "partially_paid",
30
+ conditionSetId: "require-payment-recorded"
31
+ },
32
+ {
33
+ from: "unpaid",
34
+ to: "paid",
35
+ conditionSetId: "require-full-payment"
36
+ },
37
+ {
38
+ from: "partially_paid",
39
+ to: "paid",
40
+ conditionSetId: "require-full-payment"
41
+ }
42
+ ],
43
+ fulfillmentPaths: [
44
+ {
45
+ from: "draft",
46
+ to: "on_hold",
47
+ conditionSetId: "preorder-no-deposit-require-items"
48
+ },
49
+ {
50
+ from: "on_hold",
51
+ to: "cancelled",
52
+ conditionSetId: "preorder-no-deposit-cancel-before-progress"
53
+ }
54
+ ],
55
+ transitionConditions: [
56
+ {
57
+ id: "preorder-no-deposit-require-items",
58
+ label: "Require at least one item to place pre-order",
59
+ groups: [
60
+ {
61
+ conditions: [
62
+ {
63
+ field: "computed.itemCount",
64
+ operator: "gte",
65
+ value: 1
66
+ }
67
+ ]
68
+ }
69
+ ]
70
+ },
71
+ {
72
+ id: "preorder-no-deposit-cancel-before-progress",
73
+ label: "Can only cancel pre-order before fulfillment begins",
74
+ groups: [
75
+ {
76
+ conditions: [
77
+ {
78
+ field: "computed.fulfilledItemCount",
79
+ operator: "eq",
80
+ value: 0
81
+ }
82
+ ]
83
+ }
84
+ ]
85
+ },
86
+ {
87
+ id: "require-payment-recorded",
88
+ label: "Require at least one payment before marking partially paid",
89
+ groups: [
90
+ {
91
+ conditions: [
92
+ {
93
+ field: "computed.totalPaid",
94
+ operator: "gt",
95
+ value: 0
96
+ }
97
+ ]
98
+ }
99
+ ]
100
+ },
101
+ {
102
+ id: "require-full-payment",
103
+ label: "Require full payment before marking as paid",
104
+ groups: [
105
+ {
106
+ conditions: [
107
+ {
108
+ field: "computed.totalPaid",
109
+ operator: "gte",
110
+ value: 1
111
+ },
112
+ {
113
+ field: "computed.balance",
114
+ operator: "lte",
115
+ value: 0
116
+ }
117
+ ]
118
+ }
119
+ ]
120
+ }
121
+ ],
122
+ crossAxisRules: [
123
+ {
124
+ id: "preorder-no-deposit-require-payment-before-confirm",
125
+ label: "Require payment before starting fulfillment",
126
+ description: "Fulfillment cannot move to in_progress unless at least a partial payment has been made",
127
+ enabled: true,
128
+ trigger: {
129
+ axis: "fulfillment",
130
+ to: ["in_progress"]
131
+ },
132
+ requires: {
133
+ axis: "payment",
134
+ states: ["partially_paid", "paid"]
135
+ }
136
+ }
137
+ ],
138
+ validInitialStates: [
139
+ { payment: "unpaid", fulfillment: "on_hold" },
140
+ { payment: "partially_paid", fulfillment: "on_hold" },
141
+ { payment: "paid", fulfillment: "on_hold" }
142
+ ],
143
+ displayStateMap: [
144
+ {
145
+ paymentState: ["unpaid"],
146
+ fulfillmentState: ["on_hold"],
147
+ label: "Pre-Order",
148
+ color: "#6366f1",
149
+ icon: "clock"
150
+ },
151
+ {
152
+ paymentState: ["partially_paid"],
153
+ fulfillmentState: ["on_hold"],
154
+ label: "Pre-Order (Deposit Received)",
155
+ color: "#f59e0b",
156
+ icon: "clock"
157
+ },
158
+ {
159
+ paymentState: ["paid"],
160
+ fulfillmentState: ["on_hold"],
161
+ label: "Pre-Order (Fully Paid)",
162
+ color: "#22c55e",
163
+ icon: "check-circle"
164
+ }
165
+ ]
166
+ };
package/dist/index.d.ts CHANGED
@@ -104,6 +104,8 @@ export declare const command: {
104
104
  readonly uploadMedia: import("./actions/upload-media/types").UploadMedia;
105
105
  readonly getTaxTables: import("./actions/get-tax-tables/types").GetTaxTables;
106
106
  readonly getBranding: import("./actions/get-branding/types").GetBranding;
107
+ readonly canTransition: import("./actions/can-transition/types").CanTransition;
108
+ readonly getAvailableTransitions: import("./actions/get-available-transitions/types").GetAvailableTransitions;
107
109
  };
108
110
  export type { ExampleFunction, ExampleFunctionParams, ExampleFunctionResponse } from "./actions/example-function/types";
109
111
  export type { GenerateAPIKey, GenerateAPIKeyParams, GenerateAPIKeyResponse } from "./actions/generate-api-key/types";
@@ -226,14 +228,22 @@ export { outletTopic } from "./pubsub/topics/outlet";
226
228
  export { stationTopic } from "./pubsub/topics/station";
227
229
  export { sessionTopic } from "./pubsub/topics/session";
228
230
  export { usersTopic } from "./pubsub/topics/users";
231
+ export { variantsTopic } from "./pubsub/topics/variants";
232
+ export { transactionsTopic } from "./pubsub/topics/transactions";
233
+ export { categoriesTopic } from "./pubsub/topics/categories";
234
+ export { attributesTopic } from "./pubsub/topics/attributes";
229
235
  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";
230
- export type { OrderCreatedPayload, OrderUpdatedPayload, OrderActiveSetPayload, OrderActiveGetPayload, OrderCreatedEvent, OrderUpdatedEvent, OrderActiveSetEvent, OrderActiveGetEvent, OrdersEventType, OrdersEventPayload } from "./pubsub/topics/orders/types";
236
+ export type { OrderCreatedPayload, OrderUpdatedPayload, OrderActiveSetPayload, OrderActiveGetPayload, OrderCreatedEvent, OrderUpdatedEvent, OrderActiveSetEvent, OrderActiveGetEvent, OrderStateTransitionCompletedPayload, OrderStateTransitionBlockedPayload, OrderStateTransitionCompletedEvent, OrderStateTransitionBlockedEvent, OrdersEventType, OrdersEventPayload } from "./pubsub/topics/orders/types";
231
237
  export type { RefundCreatedPayload, RefundUpdatedPayload, RefundActiveSetPayload, RefundActiveGetPayload, RefundCreatedEvent, RefundUpdatedEvent, RefundActiveSetEvent, RefundActiveGetEvent, RefundsEventType, RefundsEventPayload } from "./pubsub/topics/refunds/types";
232
238
  export type { ProductCreatedPayload, ProductUpdatedPayload, ProductSetActivePayload, ProductGetActivePayload, ProductCreatedEvent, ProductUpdatedEvent, ProductSetActiveEvent, ProductGetActiveEvent, ProductsEventType, ProductsEventPayload } from "./pubsub/topics/products/types";
233
239
  export type { OutletActiveSetPayload, OutletActiveGetPayload, OutletActiveSetEvent, OutletActiveGetEvent, OutletEventType, OutletEventPayload } from "./pubsub/topics/outlet/types";
234
240
  export type { StationActiveSetPayload, StationActiveGetPayload, StationActiveSetEvent, StationActiveGetEvent, StationEventType, StationEventPayload } from "./pubsub/topics/station/types";
235
241
  export type { SessionActiveSetPayload, SessionActiveGetPayload, SessionActiveSetEvent, SessionActiveGetEvent, SessionEventType, SessionEventPayload } from "./pubsub/topics/session/types";
236
- export type { UserActiveSetPayload, UserActiveGetPayload, UserActiveSetEvent, UserActiveGetEvent, UsersEventType, UsersEventPayload } from "./pubsub/topics/users/types";
242
+ export type { UserActiveSetPayload, UserActiveGetPayload, UserActiveSetEvent, UserActiveGetEvent, UserCreatedPayload, UserCreatedEvent, UserUpdatedPayload, UserUpdatedEvent, UsersEventType, UsersEventPayload } from "./pubsub/topics/users/types";
243
+ export type { VariantCreatedPayload, VariantCreatedEvent, VariantUpdatedPayload, VariantUpdatedEvent, VariantsEventType, VariantsEventPayload } from "./pubsub/topics/variants/types";
244
+ export type { TransactionCreatedPayload, TransactionCreatedEvent, TransactionUpdatedPayload, TransactionUpdatedEvent, TransactionsEventType, TransactionsEventPayload } from "./pubsub/topics/transactions/types";
245
+ export type { CategoryCreatedPayload, CategoryCreatedEvent, CategoryUpdatedPayload, CategoryUpdatedEvent, CategoriesEventType, CategoriesEventPayload } from "./pubsub/topics/categories/types";
246
+ export type { AttributeCreatedPayload, AttributeCreatedEvent, AttributeUpdatedPayload, AttributeUpdatedEvent, AttributesEventType, AttributesEventPayload } from "./pubsub/topics/attributes/types";
237
247
  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";
238
248
  export type { PaymentDonePayload, PaymentErrPayload, PaymentDoneEvent, PaymentErrEvent, PaymentsEventType, PaymentsEventPayload } from "./pubsub/topics/payments/types";
239
249
  export type { RowCreatedPayload, RowUpdatedPayload, RowDeletedPayload, RowCreatedEvent, RowUpdatedEvent, RowDeletedEvent, CustomTablesEventType, CustomTablesEventPayload } from "./pubsub/topics/custom-tables/types";
@@ -253,3 +263,8 @@ export type { GetSecretVal, GetSecretValParams, GetSecretValResponse } from "./a
253
263
  export type { SetSecretVal, SetSecretValParams, SetSecretValResponse } from "./actions/set-secret-val/types";
254
264
  export type { GetUsers, GetUsersParams, GetUsersResponse } from "./actions/get-users/types";
255
265
  export type { GetRoles, GetRolesParams, GetRolesResponse } from "./actions/get-roles/types";
266
+ export type { CFBlockedBy, CFStatePair, CFTransitionResult, CFFailedCondition, CFConditionStatus, CFAvailableTransition } from "./common-types/order-state";
267
+ export type { CFConditionOperator, CFCondition, CFConditionGroup, CFTransitionConditionSet, CFPaymentTransitionPath, CFFulfillmentTransitionPath, CFCrossAxisRule, CFDisplayStateRule, CFStateConfigFragment } from "./common-types/state-fragment";
268
+ export type { CanTransition, CanTransitionParams, CanTransitionResponse } from "./actions/can-transition/types";
269
+ export type { GetAvailableTransitions, GetAvailableTransitionsParams, GetAvailableTransitionsResponse } from "./actions/get-available-transitions/types";
270
+ export { preorderNoDepositFragment } from "./fragments";
package/dist/index.js CHANGED
@@ -102,6 +102,9 @@ import { getSecretsKeys } from "./actions/get-secrets-keys/action";
102
102
  import { getSecretVal } from "./actions/get-secret-val/action";
103
103
  import { setSecretVal } from "./actions/set-secret-val/action";
104
104
  import { generateAPIKey } from "./actions/generate-api-key/action";
105
+ // State Machine Query Actions
106
+ import { canTransition } from "./actions/can-transition/action";
107
+ import { getAvailableTransitions } from "./actions/get-available-transitions/action";
105
108
  // Product CRUD Actions
106
109
  import { addProduct } from "./actions/add-product/action";
107
110
  import { editProduct } from "./actions/edit-product/action";
@@ -238,6 +241,9 @@ export const command = {
238
241
  uploadMedia,
239
242
  getTaxTables,
240
243
  getBranding,
244
+ // State Machine Queries
245
+ canTransition,
246
+ getAvailableTransitions
241
247
  };
242
248
  export { EXTENSION_REFUND_REQUEST_ACTION } from "./actions/extension-refund/constants";
243
249
  export { installExtensionRefundListener } from "./actions/extension-refund/extension-refund-listener";
@@ -270,5 +276,11 @@ export { outletTopic } from "./pubsub/topics/outlet";
270
276
  export { stationTopic } from "./pubsub/topics/station";
271
277
  export { sessionTopic } from "./pubsub/topics/session";
272
278
  export { usersTopic } from "./pubsub/topics/users";
279
+ export { variantsTopic } from "./pubsub/topics/variants";
280
+ export { transactionsTopic } from "./pubsub/topics/transactions";
281
+ export { categoriesTopic } from "./pubsub/topics/categories";
282
+ export { attributesTopic } from "./pubsub/topics/attributes";
273
283
  // Export Custom Tables Types
274
284
  export { AttributeType } from "./common-types/attribute-type";
285
+ // State Machine Fragments
286
+ export { preorderNoDepositFragment } from "./fragments";
@@ -85,6 +85,8 @@ import { mockSetActiveSession } from "../../actions/set-active-session/mock";
85
85
  import { mockGetActiveUser } from "../../actions/get-active-user/mock";
86
86
  import { mockSetActiveUser } from "../../actions/set-active-user/mock";
87
87
  import { mockSetActiveRefund } from "../../actions/set-active-refund/mock";
88
+ import { canTransitionMock } from "../../actions/can-transition/mock";
89
+ import { getAvailableTransitionsMock } from "../../actions/get-available-transitions/mock";
88
90
  export const RENDER_MOCKS = {
89
91
  addCartDiscount: mockAddCartDiscount,
90
92
  addCartFee: mockAddCartFee,
@@ -178,5 +180,7 @@ export const RENDER_MOCKS = {
178
180
  removeCartFee: mockRemoveCartFee,
179
181
  removeOrderNote: () => Promise.resolve({ success: true, timestamp: new Date().toISOString() }),
180
182
  removeCustomSale: params => Promise.resolve({ success: true, id: params.id, timestamp: new Date().toISOString() }),
181
- removeNonRevenueItem: params => Promise.resolve({ success: true, externalId: params.externalId, timestamp: new Date().toISOString() })
183
+ removeNonRevenueItem: params => Promise.resolve({ success: true, externalId: params.externalId, timestamp: new Date().toISOString() }),
184
+ canTransition: canTransitionMock,
185
+ getAvailableTransitions: getAvailableTransitionsMock
182
186
  };
@@ -1,4 +1,4 @@
1
- import type { ExampleFunction, GetProducts, AddCustomSale, 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, TapToPayPayment, TerminalPayment, VendaraPayment, ExtensionPayment, RedeemPayment, AddNonRevenueItem, AddCustomerNote, RemoveCustomerNote, RemoveCustomerFromCart, GoToStationHome, OpenCashDrawer, ShowNotification, ShowConfirmation, AuthenticateUser, PartialPayment, SwitchUser, TriggerWebhook, TriggerZapierWebhook, 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, SetActiveOutlet, GetActiveStation, SetActiveStation, GetActiveSession, SetActiveSession, GetActiveUser, SetActiveUser, SetActiveRefund, RemoveProductDiscount, RemoveProductFee, RemoveProductNote, RemoveCartFee, RemoveOrderNote, RemoveCustomSale, RemoveNonRevenueItem } from "../../index";
1
+ import type { ExampleFunction, GetProducts, AddCustomSale, 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, TapToPayPayment, TerminalPayment, VendaraPayment, ExtensionPayment, RedeemPayment, AddNonRevenueItem, AddCustomerNote, RemoveCustomerNote, RemoveCustomerFromCart, GoToStationHome, OpenCashDrawer, ShowNotification, ShowConfirmation, AuthenticateUser, PartialPayment, SwitchUser, TriggerWebhook, TriggerZapierWebhook, 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, SetActiveOutlet, GetActiveStation, SetActiveStation, GetActiveSession, SetActiveSession, GetActiveUser, SetActiveUser, SetActiveRefund, RemoveProductDiscount, RemoveProductFee, RemoveProductNote, RemoveCartFee, RemoveOrderNote, RemoveCustomSale, RemoveNonRevenueItem, CanTransition, GetAvailableTransitions } from "../../index";
2
2
  export interface RenderProviderActions {
3
3
  exampleFunction: ExampleFunction;
4
4
  getProducts: GetProducts;
@@ -93,4 +93,6 @@ export interface RenderProviderActions {
93
93
  removeOrderNote: RemoveOrderNote;
94
94
  removeCustomSale: RemoveCustomSale;
95
95
  removeNonRevenueItem: RemoveNonRevenueItem;
96
+ canTransition: CanTransition;
97
+ getAvailableTransitions: GetAvailableTransitions;
96
98
  }
@@ -0,0 +1,6 @@
1
+ import type { CFAttribute } from "../../../../CommonTypes";
2
+ import type { TopicEvent } from "../../../types";
3
+ export interface AttributeCreatedPayload {
4
+ attribute: CFAttribute;
5
+ }
6
+ export type AttributeCreatedEvent = TopicEvent<AttributeCreatedPayload>;
@@ -0,0 +1,6 @@
1
+ import type { CFAttribute } from "../../../../CommonTypes";
2
+ import type { TopicEvent } from "../../../types";
3
+ export interface AttributeUpdatedPayload {
4
+ attribute: CFAttribute;
5
+ }
6
+ export type AttributeUpdatedEvent = TopicEvent<AttributeUpdatedPayload>;
@@ -0,0 +1,3 @@
1
+ import type { TopicDefinition } from "../../types";
2
+ export declare const attributesTopic: TopicDefinition;
3
+ export * from "./types";
@@ -0,0 +1,18 @@
1
+ export const attributesTopic = {
2
+ id: "attributes",
3
+ name: "Attributes",
4
+ description: "Topic for product attribute definition changes synced from the database",
5
+ eventTypes: [
6
+ {
7
+ id: "attribute-created",
8
+ name: "Attribute Created",
9
+ description: "Published when a new attribute definition is synced/created"
10
+ },
11
+ {
12
+ id: "attribute-updated",
13
+ name: "Attribute Updated",
14
+ description: "Published when an attribute definition is synced/updated"
15
+ }
16
+ ]
17
+ };
18
+ export * from "./types";
@@ -0,0 +1,6 @@
1
+ export * from "./attribute-created/types";
2
+ export * from "./attribute-updated/types";
3
+ import type { AttributeCreatedPayload } from "./attribute-created/types";
4
+ import type { AttributeUpdatedPayload } from "./attribute-updated/types";
5
+ export type AttributesEventPayload = AttributeCreatedPayload | AttributeUpdatedPayload;
6
+ export type AttributesEventType = "attribute-created" | "attribute-updated";
@@ -0,0 +1,2 @@
1
+ export * from "./attribute-created/types";
2
+ export * from "./attribute-updated/types";
@@ -0,0 +1,6 @@
1
+ import type { CFCategory } from "../../../../CommonTypes";
2
+ import type { TopicEvent } from "../../../types";
3
+ export interface CategoryCreatedPayload {
4
+ category: CFCategory;
5
+ }
6
+ export type CategoryCreatedEvent = TopicEvent<CategoryCreatedPayload>;
@@ -0,0 +1,6 @@
1
+ import type { CFCategory } from "../../../../CommonTypes";
2
+ import type { TopicEvent } from "../../../types";
3
+ export interface CategoryUpdatedPayload {
4
+ category: CFCategory;
5
+ }
6
+ export type CategoryUpdatedEvent = TopicEvent<CategoryUpdatedPayload>;
@@ -0,0 +1,3 @@
1
+ import type { TopicDefinition } from "../../types";
2
+ export declare const categoriesTopic: TopicDefinition;
3
+ export * from "./types";
@@ -0,0 +1,18 @@
1
+ export const categoriesTopic = {
2
+ id: "categories",
3
+ name: "Categories",
4
+ description: "Topic for product category changes synced from the database",
5
+ eventTypes: [
6
+ {
7
+ id: "category-created",
8
+ name: "Category Created",
9
+ description: "Published when a new category is synced/created"
10
+ },
11
+ {
12
+ id: "category-updated",
13
+ name: "Category Updated",
14
+ description: "Published when a category is synced/updated"
15
+ }
16
+ ]
17
+ };
18
+ export * from "./types";
@@ -0,0 +1,6 @@
1
+ export * from "./category-created/types";
2
+ export * from "./category-updated/types";
3
+ import type { CategoryCreatedPayload } from "./category-created/types";
4
+ import type { CategoryUpdatedPayload } from "./category-updated/types";
5
+ export type CategoriesEventPayload = CategoryCreatedPayload | CategoryUpdatedPayload;
6
+ export type CategoriesEventType = "category-created" | "category-updated";
@@ -0,0 +1,2 @@
1
+ export * from "./category-created/types";
2
+ export * from "./category-updated/types";
@@ -14,3 +14,7 @@ export * from "./outlet";
14
14
  export * from "./station";
15
15
  export * from "./session";
16
16
  export * from "./users";
17
+ export * from "./variants";
18
+ export * from "./transactions";
19
+ export * from "./categories";
20
+ export * from "./attributes";
@@ -14,3 +14,7 @@ export * from "./outlet";
14
14
  export * from "./station";
15
15
  export * from "./session";
16
16
  export * from "./users";
17
+ export * from "./variants";
18
+ export * from "./transactions";
19
+ export * from "./categories";
20
+ export * from "./attributes";
@@ -26,6 +26,16 @@ export const ordersTopic = {
26
26
  id: "get-active-order",
27
27
  name: "Get Active Order",
28
28
  description: "Published when the active order is retrieved for listeners"
29
+ },
30
+ {
31
+ id: "state-transition-completed",
32
+ name: "State Transition Completed",
33
+ description: "Published when an order state transition completes successfully"
34
+ },
35
+ {
36
+ id: "state-transition-blocked",
37
+ name: "State Transition Blocked",
38
+ description: "Published when an order state transition is blocked by the state machine"
29
39
  }
30
40
  ]
31
41
  };
@@ -0,0 +1,16 @@
1
+ import type { TopicEvent } from "../../../types";
2
+ import type { CFBlockedBy } from "../../../../common-types/order-state";
3
+ export interface OrderStateTransitionBlockedPayload {
4
+ orderId: string;
5
+ from: {
6
+ payment: string;
7
+ fulfillment: string;
8
+ };
9
+ to: {
10
+ payment: string;
11
+ fulfillment: string;
12
+ };
13
+ blockedBy: CFBlockedBy;
14
+ reason?: string;
15
+ }
16
+ export type OrderStateTransitionBlockedEvent = TopicEvent<OrderStateTransitionBlockedPayload>;
@@ -0,0 +1,15 @@
1
+ import type { TopicEvent } from "../../../types";
2
+ export interface OrderStateTransitionCompletedPayload {
3
+ orderId: string;
4
+ from: {
5
+ payment: string;
6
+ fulfillment: string;
7
+ };
8
+ to: {
9
+ payment: string;
10
+ fulfillment: string;
11
+ };
12
+ displayState: string;
13
+ forced?: boolean;
14
+ }
15
+ export type OrderStateTransitionCompletedEvent = TopicEvent<OrderStateTransitionCompletedPayload>;
@@ -6,9 +6,13 @@ export * from "./order-created/types";
6
6
  export * from "./order-updated/types";
7
7
  export * from "./set-active-order/types";
8
8
  export * from "./get-active-order/types";
9
+ export * from "./state-transition-completed/types";
10
+ export * from "./state-transition-blocked/types";
9
11
  import type { OrderCreatedPayload } from "./order-created/types";
10
12
  import type { OrderUpdatedPayload } from "./order-updated/types";
11
13
  import type { OrderActiveSetPayload } from "./set-active-order/types";
12
14
  import type { OrderActiveGetPayload } from "./get-active-order/types";
13
- export type OrdersEventPayload = OrderCreatedPayload | OrderUpdatedPayload | OrderActiveSetPayload | OrderActiveGetPayload;
14
- export type OrdersEventType = "order-created" | "order-updated" | "set-active-order" | "get-active-order";
15
+ import type { OrderStateTransitionCompletedPayload } from "./state-transition-completed/types";
16
+ import type { OrderStateTransitionBlockedPayload } from "./state-transition-blocked/types";
17
+ export type OrdersEventPayload = OrderCreatedPayload | OrderUpdatedPayload | OrderActiveSetPayload | OrderActiveGetPayload | OrderStateTransitionCompletedPayload | OrderStateTransitionBlockedPayload;
18
+ export type OrdersEventType = "order-created" | "order-updated" | "set-active-order" | "get-active-order" | "state-transition-completed" | "state-transition-blocked";
@@ -7,3 +7,5 @@ export * from "./order-created/types";
7
7
  export * from "./order-updated/types";
8
8
  export * from "./set-active-order/types";
9
9
  export * from "./get-active-order/types";
10
+ export * from "./state-transition-completed/types";
11
+ export * from "./state-transition-blocked/types";
@@ -3,7 +3,7 @@ import type { TopicEvent } from "../../../types";
3
3
  * Payload for print-completed event
4
4
  */
5
5
  export interface PrintCompletedPayload {
6
- type: "image" | "html" | "selector" | "receipt";
6
+ type: "image" | "html" | "receipt";
7
7
  orderId?: string;
8
8
  globalBlockId?: string;
9
9
  }
@@ -3,7 +3,7 @@ import type { TopicEvent } from "../../../types";
3
3
  * Payload for print-error event
4
4
  */
5
5
  export interface PrintErrorPayload {
6
- type: "image" | "html" | "selector" | "receipt";
6
+ type: "image" | "html" | "receipt";
7
7
  error: string;
8
8
  orderId?: string;
9
9
  globalBlockId?: string;
@@ -3,7 +3,7 @@ import type { TopicEvent } from "../../../types";
3
3
  * Payload for print-started event
4
4
  */
5
5
  export interface PrintStartedPayload {
6
- type: "image" | "html" | "selector" | "receipt";
6
+ type: "image" | "html" | "receipt";
7
7
  options?: {
8
8
  margins?: {
9
9
  top?: number;
@@ -0,0 +1,3 @@
1
+ import type { TopicDefinition } from "../../types";
2
+ export declare const transactionsTopic: TopicDefinition;
3
+ export * from "./types";
@@ -0,0 +1,18 @@
1
+ export const transactionsTopic = {
2
+ id: "transactions",
3
+ name: "Transactions",
4
+ description: "Topic for payment transaction events",
5
+ eventTypes: [
6
+ {
7
+ id: "transaction-created",
8
+ name: "Transaction Created",
9
+ description: "Published when a new transaction is created"
10
+ },
11
+ {
12
+ id: "transaction-updated",
13
+ name: "Transaction Updated",
14
+ description: "Published when a transaction is updated"
15
+ }
16
+ ]
17
+ };
18
+ export * from "./types";
@@ -0,0 +1,6 @@
1
+ import type { CFTransaction } from "../../../../CommonTypes";
2
+ import type { TopicEvent } from "../../../types";
3
+ export interface TransactionCreatedPayload {
4
+ transaction: CFTransaction;
5
+ }
6
+ export type TransactionCreatedEvent = TopicEvent<TransactionCreatedPayload>;
@@ -0,0 +1,6 @@
1
+ import type { CFTransaction } from "../../../../CommonTypes";
2
+ import type { TopicEvent } from "../../../types";
3
+ export interface TransactionUpdatedPayload {
4
+ transaction: CFTransaction;
5
+ }
6
+ export type TransactionUpdatedEvent = TopicEvent<TransactionUpdatedPayload>;
@@ -0,0 +1,6 @@
1
+ export * from "./transaction-created/types";
2
+ export * from "./transaction-updated/types";
3
+ import type { TransactionCreatedPayload } from "./transaction-created/types";
4
+ import type { TransactionUpdatedPayload } from "./transaction-updated/types";
5
+ export type TransactionsEventPayload = TransactionCreatedPayload | TransactionUpdatedPayload;
6
+ export type TransactionsEventType = "transaction-created" | "transaction-updated";
@@ -0,0 +1,2 @@
1
+ export * from "./transaction-created/types";
2
+ export * from "./transaction-updated/types";
@@ -10,6 +10,10 @@ import { OutletEventType, OutletEventPayload } from "./outlet/types";
10
10
  import { StationEventType, StationEventPayload } from "./station/types";
11
11
  import { SessionEventType, SessionEventPayload } from "./session/types";
12
12
  import { UsersEventType, UsersEventPayload } from "./users/types";
13
+ import { VariantsEventType, VariantsEventPayload } from "./variants/types";
14
+ import { TransactionsEventType, TransactionsEventPayload } from "./transactions/types";
15
+ import { CategoriesEventType, CategoriesEventPayload } from "./categories/types";
16
+ import { AttributesEventType, AttributesEventPayload } from "./attributes/types";
13
17
  export interface TopicEventPayloadMap {
14
18
  customers: Record<CustomersEventType, CustomersEventPayload>;
15
19
  orders: Record<OrdersEventType, OrdersEventPayload>;
@@ -23,4 +27,8 @@ export interface TopicEventPayloadMap {
23
27
  station: Record<StationEventType, StationEventPayload>;
24
28
  session: Record<SessionEventType, SessionEventPayload>;
25
29
  users: Record<UsersEventType, UsersEventPayload>;
30
+ variants: Record<VariantsEventType, VariantsEventPayload>;
31
+ transactions: Record<TransactionsEventType, TransactionsEventPayload>;
32
+ categories: Record<CategoriesEventType, CategoriesEventPayload>;
33
+ attributes: Record<AttributesEventType, AttributesEventPayload>;
26
34
  }