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

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 (126) hide show
  1. package/README.md +24 -0
  2. package/dist/CommonTypes.d.ts +73 -622
  3. package/dist/CommonTypes.js +5 -65
  4. package/dist/actions/add-cart-discount/mock.js +6 -3
  5. package/dist/actions/add-cart-fee/mock.js +6 -6
  6. package/dist/actions/add-custom-sale/mock.js +7 -2
  7. package/dist/actions/add-order-note/mock.js +3 -1
  8. package/dist/actions/add-product/mock.js +1 -1
  9. package/dist/actions/add-product-discount/mock.js +5 -5
  10. package/dist/actions/add-product-fee/mock.js +6 -6
  11. package/dist/actions/apply-transition/action.d.ts +2 -0
  12. package/dist/actions/apply-transition/action.js +4 -0
  13. package/dist/actions/apply-transition/mock.d.ts +6 -0
  14. package/dist/actions/apply-transition/mock.js +33 -0
  15. package/dist/actions/apply-transition/types.d.ts +17 -0
  16. package/dist/actions/cash-payment/mock.js +12 -18
  17. package/dist/actions/delete-parked-order/mock.js +3 -1
  18. package/dist/actions/edit-product/mock.js +1 -1
  19. package/dist/actions/extension-payment/types.d.ts +4 -0
  20. package/dist/actions/get-context/mock.js +1 -1
  21. package/dist/actions/get-orders/mock.js +3 -3
  22. package/dist/actions/get-products/mock.js +9 -4
  23. package/dist/actions/get-products/types.d.ts +2 -0
  24. package/dist/actions/get-roles/mock.js +35 -41
  25. package/dist/actions/get-smart-grid-layout/action.d.ts +2 -0
  26. package/dist/actions/get-smart-grid-layout/action.js +4 -0
  27. package/dist/actions/get-smart-grid-layout/mock.d.ts +2 -0
  28. package/dist/actions/get-smart-grid-layout/mock.js +9 -0
  29. package/dist/actions/get-smart-grid-layout/types.d.ts +10 -0
  30. package/dist/actions/get-users/mock.js +16 -25
  31. package/dist/actions/integration-payment/action.d.ts +5 -0
  32. package/dist/actions/integration-payment/action.js +7 -0
  33. package/dist/actions/integration-payment/mock.d.ts +2 -0
  34. package/dist/actions/integration-payment/mock.js +4 -0
  35. package/dist/actions/integration-payment/types.d.ts +56 -0
  36. package/dist/actions/open-extension-overlay/action.d.ts +2 -0
  37. package/dist/actions/open-extension-overlay/action.js +4 -0
  38. package/dist/actions/open-extension-overlay/mock.d.ts +2 -0
  39. package/dist/actions/open-extension-overlay/mock.js +1 -0
  40. package/dist/actions/open-extension-overlay/types.d.ts +9 -0
  41. package/dist/actions/park-order/mock.js +4 -1
  42. package/dist/actions/partial-payment/mock.js +21 -3
  43. package/dist/actions/redeem-payment/types.d.ts +9 -5
  44. package/dist/actions/remove-custom-sale/mock.d.ts +2 -0
  45. package/dist/actions/remove-custom-sale/mock.js +29 -0
  46. package/dist/actions/remove-customer-from-cart/mock.js +3 -1
  47. package/dist/actions/remove-order-note/mock.d.ts +2 -0
  48. package/dist/actions/remove-order-note/mock.js +12 -0
  49. package/dist/actions/remove-product-discount/mock.d.ts +2 -0
  50. package/dist/actions/remove-product-discount/mock.js +17 -0
  51. package/dist/actions/remove-product-fee/mock.d.ts +2 -0
  52. package/dist/actions/remove-product-fee/mock.js +17 -0
  53. package/dist/actions/remove-product-from-cart/mock.js +5 -5
  54. package/dist/actions/resolve-extension-overlay/action.d.ts +2 -0
  55. package/dist/actions/resolve-extension-overlay/action.js +4 -0
  56. package/dist/actions/resolve-extension-overlay/mock.d.ts +2 -0
  57. package/dist/actions/resolve-extension-overlay/mock.js +1 -0
  58. package/dist/actions/resolve-extension-overlay/types.d.ts +9 -0
  59. package/dist/actions/resolve-extension-overlay/types.js +1 -0
  60. package/dist/actions/resume-parked-order/mock.js +5 -2
  61. package/dist/actions/save-smart-grid-layout/action.d.ts +2 -0
  62. package/dist/actions/save-smart-grid-layout/action.js +4 -0
  63. package/dist/actions/save-smart-grid-layout/mock.d.ts +2 -0
  64. package/dist/actions/save-smart-grid-layout/mock.js +10 -0
  65. package/dist/actions/save-smart-grid-layout/types.d.ts +10 -0
  66. package/dist/actions/save-smart-grid-layout/types.js +1 -0
  67. package/dist/actions/set-active-product-discount/mock.js +1 -1
  68. package/dist/actions/set-active-product-fee/mock.js +1 -1
  69. package/dist/actions/tap-to-pay-payment/mock.js +5 -3
  70. package/dist/actions/terminal-payment/mock.js +4 -5
  71. package/dist/actions/update-cart-item-quantity/mock.js +9 -9
  72. package/dist/demo/database.d.ts +33 -22
  73. package/dist/demo/database.js +191 -21
  74. package/dist/index.d.ts +116 -115
  75. package/dist/index.js +15 -13
  76. package/dist/interceptors/index.d.ts +21 -0
  77. package/dist/interceptors/index.js +53 -0
  78. package/dist/interceptors/types.d.ts +26 -0
  79. package/dist/interceptors/types.js +1 -0
  80. package/dist/projects/render/mocks.js +19 -15
  81. package/dist/projects/render/types.d.ts +8 -6
  82. package/dist/pubsub/topics/products/product-get-active/types.d.ts +6 -2
  83. package/dist/pubsub/topics/split-payments/index.d.ts +12 -0
  84. package/dist/pubsub/topics/split-payments/index.js +22 -0
  85. package/dist/pubsub/topics/split-payments/split-payment-updated/types.d.ts +16 -0
  86. package/dist/pubsub/topics/split-payments/split-payment-updated/types.js +1 -0
  87. package/dist/pubsub/topics/split-payments/types.d.ts +10 -0
  88. package/dist/pubsub/topics/split-payments/types.js +5 -0
  89. package/dist/pubsub/topics/types.d.ts +2 -0
  90. package/package.json +17 -14
  91. package/dist/actions/extension-refund/constants.d.ts +0 -2
  92. package/dist/actions/extension-refund/constants.js +0 -2
  93. package/dist/actions/extension-refund/extension-refund-listener.d.ts +0 -11
  94. package/dist/actions/extension-refund/extension-refund-listener.js +0 -60
  95. package/dist/actions/extension-refund/types.d.ts +0 -32
  96. package/dist/actions/extension-refund/types.js +0 -5
  97. package/dist/actions/set-active-outlet/action.d.ts +0 -2
  98. package/dist/actions/set-active-outlet/action.js +0 -4
  99. package/dist/actions/set-active-outlet/mock.d.ts +0 -2
  100. package/dist/actions/set-active-outlet/mock.js +0 -16
  101. package/dist/actions/set-active-outlet/types.d.ts +0 -10
  102. package/dist/actions/set-active-session/action.d.ts +0 -2
  103. package/dist/actions/set-active-session/action.js +0 -4
  104. package/dist/actions/set-active-session/mock.d.ts +0 -2
  105. package/dist/actions/set-active-session/mock.js +0 -15
  106. package/dist/actions/set-active-session/types.d.ts +0 -10
  107. package/dist/actions/set-active-station/action.d.ts +0 -2
  108. package/dist/actions/set-active-station/action.js +0 -4
  109. package/dist/actions/set-active-station/mock.d.ts +0 -2
  110. package/dist/actions/set-active-station/mock.js +0 -16
  111. package/dist/actions/set-active-station/types.d.ts +0 -10
  112. package/dist/actions/trigger-webhook/action.d.ts +0 -6
  113. package/dist/actions/trigger-webhook/action.js +0 -8
  114. package/dist/actions/trigger-webhook/mock.d.ts +0 -2
  115. package/dist/actions/trigger-webhook/mock.js +0 -8
  116. package/dist/actions/trigger-webhook/types.d.ts +0 -21
  117. package/dist/actions/trigger-webhook/types.js +0 -2
  118. package/dist/actions/trigger-zapier-webhook/action.d.ts +0 -6
  119. package/dist/actions/trigger-zapier-webhook/action.js +0 -8
  120. package/dist/actions/trigger-zapier-webhook/mock.d.ts +0 -2
  121. package/dist/actions/trigger-zapier-webhook/mock.js +0 -8
  122. package/dist/actions/trigger-zapier-webhook/types.d.ts +0 -9
  123. /package/dist/actions/{set-active-outlet → apply-transition}/types.js +0 -0
  124. /package/dist/actions/{set-active-session → get-smart-grid-layout}/types.js +0 -0
  125. /package/dist/actions/{set-active-station → integration-payment}/types.js +0 -0
  126. /package/dist/actions/{trigger-zapier-webhook → open-extension-overlay}/types.js +0 -0
@@ -2,13 +2,17 @@ import { mockAddCartDiscount } from "../../actions/add-cart-discount/mock";
2
2
  import { mockAddCartFee } from "../../actions/add-cart-fee/mock";
3
3
  import { mockRemoveCartFee } from "../../actions/remove-cart-fee/mock";
4
4
  import { mockAddCustomSale } from "../../actions/add-custom-sale/mock";
5
+ import { mockRemoveCustomSale } from "../../actions/remove-custom-sale/mock";
5
6
  import { mockAddCustomer } from "../../actions/add-customer/mock";
6
7
  import { mockAddCustomerNote } from "../../actions/add-customer-note/mock";
7
8
  import { mockRemoveCustomerNote } from "../../actions/remove-customer-note/mock";
8
9
  import { mockEditCustomer } from "../../actions/edit-customer/mock";
9
10
  import { mockAddOrderNote } from "../../actions/add-order-note/mock";
11
+ import { mockRemoveOrderNote } from "../../actions/remove-order-note/mock";
10
12
  import { mockAddProductDiscount } from "../../actions/add-product-discount/mock";
11
13
  import { mockAddProductFee } from "../../actions/add-product-fee/mock";
14
+ import { mockRemoveProductDiscount } from "../../actions/remove-product-discount/mock";
15
+ import { mockRemoveProductFee } from "../../actions/remove-product-fee/mock";
12
16
  import { mockSetActiveProductFee } from "../../actions/set-active-product-fee/mock";
13
17
  import { mockSetActiveProductDiscount } from "../../actions/set-active-product-discount/mock";
14
18
  import { mockGetActiveProduct } from "../../actions/get-active-product/mock";
@@ -37,6 +41,8 @@ import { mockGetTaxTables } from "../../actions/get-tax-tables/mock";
37
41
  import { mockGetRemainingRefundableQuantities } from "../../actions/get-remaining-refundable-quantities/mock";
38
42
  import { mockGoToStationHome } from "../../actions/go-to-station-home/mock";
39
43
  import { mockInitiateRefund } from "../../actions/initiate-refund/mock";
44
+ import { mockOpenExtensionOverlay } from "../../actions/open-extension-overlay/mock";
45
+ import { mockResolveExtensionOverlay } from "../../actions/resolve-extension-overlay/mock";
40
46
  import { mockOpenCashDrawer } from "../../actions/open-cash-drawer/mock";
41
47
  import { mockParkOrder } from "../../actions/park-order/mock";
42
48
  import { mockPartialPayment } from "../../actions/partial-payment/mock";
@@ -51,11 +57,10 @@ import { mockShowNotification } from "../../actions/show-notification/mock";
51
57
  import { mockSwitchUser } from "../../actions/switch-user/mock";
52
58
  import { mockTapToPayPayment } from "../../actions/tap-to-pay-payment/mock";
53
59
  import { mockTerminalPayment } from "../../actions/terminal-payment/mock";
54
- import { mockTriggerWebhook } from "../../actions/trigger-webhook/mock";
55
- import { mockTriggerZapierWebhook } from "../../actions/trigger-zapier-webhook/mock";
56
60
  import { mockVendaraPayment } from "../../actions/vendara-payment/mock";
57
61
  import { mockExtensionPayment } from "../../actions/extension-payment/mock";
58
62
  import { mockRedeemPayment } from "../../actions/redeem-payment/mock";
63
+ import { mockIntegrationPayment } from "../../actions/integration-payment/mock";
59
64
  import { mockAddNonRevenueItem } from "../../actions/add-non-revenue-item/mock";
60
65
  import { mockGetFinalContext } from "../../actions/get-final-context/mock";
61
66
  import { mockPrint } from "../../actions/print/mock";
@@ -77,16 +82,15 @@ import { mockGetActiveOrder } from "../../actions/get-active-order/mock";
77
82
  import { mockGetActiveCustomer } from "../../actions/get-active-customer/mock";
78
83
  import { mockSetActiveCustomer } from "../../actions/set-active-customer/mock";
79
84
  import { mockGetActiveOutlet } from "../../actions/get-active-outlet/mock";
80
- import { mockSetActiveOutlet } from "../../actions/set-active-outlet/mock";
81
85
  import { mockGetActiveStation } from "../../actions/get-active-station/mock";
82
- import { mockSetActiveStation } from "../../actions/set-active-station/mock";
83
86
  import { mockGetActiveSession } from "../../actions/get-active-session/mock";
84
- import { mockSetActiveSession } from "../../actions/set-active-session/mock";
85
87
  import { mockGetActiveUser } from "../../actions/get-active-user/mock";
86
88
  import { mockSetActiveUser } from "../../actions/set-active-user/mock";
87
89
  import { mockSetActiveRefund } from "../../actions/set-active-refund/mock";
88
90
  import { canTransitionMock } from "../../actions/can-transition/mock";
89
91
  import { getAvailableTransitionsMock } from "../../actions/get-available-transitions/mock";
92
+ import { mockGetSmartGridLayout } from "../../actions/get-smart-grid-layout/mock";
93
+ import { mockSaveSmartGridLayout } from "../../actions/save-smart-grid-layout/mock";
90
94
  export const RENDER_MOCKS = {
91
95
  addCartDiscount: mockAddCartDiscount,
92
96
  addCartFee: mockAddCartFee,
@@ -125,6 +129,8 @@ export const RENDER_MOCKS = {
125
129
  getRemainingRefundableQuantities: mockGetRemainingRefundableQuantities,
126
130
  goToStationHome: mockGoToStationHome,
127
131
  initiateRefund: mockInitiateRefund,
132
+ openExtensionOverlay: mockOpenExtensionOverlay,
133
+ resolveExtensionOverlay: mockResolveExtensionOverlay,
128
134
  openCashDrawer: mockOpenCashDrawer,
129
135
  parkOrder: mockParkOrder,
130
136
  partialPayment: mockPartialPayment,
@@ -140,11 +146,10 @@ export const RENDER_MOCKS = {
140
146
  switchUser: mockSwitchUser,
141
147
  tapToPayPayment: mockTapToPayPayment,
142
148
  terminalPayment: mockTerminalPayment,
143
- triggerWebhook: mockTriggerWebhook,
144
- triggerZapierWebhook: mockTriggerZapierWebhook,
145
149
  vendaraPayment: mockVendaraPayment,
146
150
  extensionPayment: mockExtensionPayment,
147
151
  redeemPayment: mockRedeemPayment,
152
+ integrationPayment: mockIntegrationPayment,
148
153
  addNonRevenueItem: mockAddNonRevenueItem,
149
154
  getFinalContext: mockGetFinalContext,
150
155
  print: mockPrint,
@@ -166,21 +171,20 @@ export const RENDER_MOCKS = {
166
171
  getActiveCustomer: mockGetActiveCustomer,
167
172
  setActiveCustomer: mockSetActiveCustomer,
168
173
  getActiveOutlet: mockGetActiveOutlet,
169
- setActiveOutlet: mockSetActiveOutlet,
170
174
  getActiveStation: mockGetActiveStation,
171
- setActiveStation: mockSetActiveStation,
172
175
  getActiveSession: mockGetActiveSession,
173
- setActiveSession: mockSetActiveSession,
174
176
  getActiveUser: mockGetActiveUser,
175
177
  setActiveUser: mockSetActiveUser,
176
178
  setActiveRefund: mockSetActiveRefund,
177
- removeProductDiscount: () => Promise.resolve({ success: true, timestamp: new Date().toISOString() }),
178
- removeProductFee: () => Promise.resolve({ success: true, timestamp: new Date().toISOString() }),
179
+ removeProductDiscount: mockRemoveProductDiscount,
180
+ removeProductFee: mockRemoveProductFee,
179
181
  removeProductNote: () => Promise.resolve({ success: true, timestamp: new Date().toISOString() }),
180
182
  removeCartFee: mockRemoveCartFee,
181
- removeOrderNote: () => Promise.resolve({ success: true, timestamp: new Date().toISOString() }),
182
- removeCustomSale: params => Promise.resolve({ success: true, id: params.id, timestamp: new Date().toISOString() }),
183
+ removeOrderNote: mockRemoveOrderNote,
184
+ removeCustomSale: mockRemoveCustomSale,
183
185
  removeNonRevenueItem: params => Promise.resolve({ success: true, externalId: params.externalId, timestamp: new Date().toISOString() }),
184
186
  canTransition: canTransitionMock,
185
- getAvailableTransitions: getAvailableTransitionsMock
187
+ getAvailableTransitions: getAvailableTransitionsMock,
188
+ getSmartGridLayout: mockGetSmartGridLayout,
189
+ saveSmartGridLayout: mockSaveSmartGridLayout
186
190
  };
@@ -1,4 +1,6 @@
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";
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, 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 } from "../../index";
2
+ import type { OpenExtensionOverlay } from "../../actions/open-extension-overlay/types";
3
+ import type { ResolveExtensionOverlay } from "../../actions/resolve-extension-overlay/types";
2
4
  export interface RenderProviderActions {
3
5
  exampleFunction: ExampleFunction;
4
6
  getProducts: GetProducts;
@@ -32,12 +34,15 @@ export interface RenderProviderActions {
32
34
  resumeParkedOrder: ResumeParkedOrder;
33
35
  deleteParkedOrder: DeleteParkedOrder;
34
36
  initiateRefund: InitiateRefund;
37
+ openExtensionOverlay: OpenExtensionOverlay;
38
+ resolveExtensionOverlay: ResolveExtensionOverlay;
35
39
  cashPayment: CashPayment;
36
40
  tapToPayPayment: TapToPayPayment;
37
41
  terminalPayment: TerminalPayment;
38
42
  vendaraPayment: VendaraPayment;
39
43
  extensionPayment: ExtensionPayment;
40
44
  redeemPayment: RedeemPayment;
45
+ integrationPayment: IntegrationPayment;
41
46
  addNonRevenueItem: AddNonRevenueItem;
42
47
  addCustomerNote: AddCustomerNote;
43
48
  removeCustomerNote: RemoveCustomerNote;
@@ -50,8 +55,6 @@ export interface RenderProviderActions {
50
55
  authenticateUser: AuthenticateUser;
51
56
  partialPayment: PartialPayment;
52
57
  switchUser: SwitchUser;
53
- triggerWebhook: TriggerWebhook;
54
- triggerZapierWebhook: TriggerZapierWebhook;
55
58
  setRefundStockAction: SetRefundStockAction;
56
59
  selectAllRefundItems: SelectAllRefundItems;
57
60
  resetRefundDetails: ResetRefundDetails;
@@ -78,11 +81,8 @@ export interface RenderProviderActions {
78
81
  getActiveCustomer: GetActiveCustomer;
79
82
  setActiveCustomer: SetActiveCustomer;
80
83
  getActiveOutlet: GetActiveOutlet;
81
- setActiveOutlet: SetActiveOutlet;
82
84
  getActiveStation: GetActiveStation;
83
- setActiveStation: SetActiveStation;
84
85
  getActiveSession: GetActiveSession;
85
- setActiveSession: SetActiveSession;
86
86
  getActiveUser: GetActiveUser;
87
87
  setActiveUser: SetActiveUser;
88
88
  setActiveRefund: SetActiveRefund;
@@ -95,4 +95,6 @@ export interface RenderProviderActions {
95
95
  removeNonRevenueItem: RemoveNonRevenueItem;
96
96
  canTransition: CanTransition;
97
97
  getAvailableTransitions: GetAvailableTransitions;
98
+ getSmartGridLayout: GetSmartGridLayout;
99
+ saveSmartGridLayout: SaveSmartGridLayout;
98
100
  }
@@ -1,10 +1,14 @@
1
1
  import type { CFActiveProduct } from "../../../../CommonTypes";
2
2
  import type { TopicEvent } from "../../../types";
3
3
  /**
4
- * Payload for product-get-active event
4
+ * Payload for product-get-active event.
5
+ *
6
+ * `product` is nullable: the host publishes this event unconditionally, including
7
+ * with `null` when there is no active selection (e.g. after the active product is
8
+ * cleared). Subscribers must handle the null case. [FI-6491]
5
9
  */
6
10
  export interface ProductGetActivePayload {
7
- product: CFActiveProduct;
11
+ product: CFActiveProduct | null;
8
12
  }
9
13
  /**
10
14
  * Typed event for product-get-active
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Split Payments Topic Definition
3
+ * Defines the split-payments topic and its available event types.
4
+ *
5
+ * This topic mirrors render's `activeEntities.splitPayment` Redux slice. The
6
+ * host (render) publishes the full current `CFSplitPayment` (or `null` when
7
+ * reset) on every mutation and on the command-frame handshake so consumers
8
+ * stay in sync without owning the underlying state.
9
+ */
10
+ import type { TopicDefinition } from "../../types";
11
+ export declare const splitPaymentsTopic: TopicDefinition;
12
+ export * from "./types";
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Split Payments Topic Definition
3
+ * Defines the split-payments topic and its available event types.
4
+ *
5
+ * This topic mirrors render's `activeEntities.splitPayment` Redux slice. The
6
+ * host (render) publishes the full current `CFSplitPayment` (or `null` when
7
+ * reset) on every mutation and on the command-frame handshake so consumers
8
+ * stay in sync without owning the underlying state.
9
+ */
10
+ export const splitPaymentsTopic = {
11
+ id: "split-payments",
12
+ name: "Split Payments",
13
+ description: "Topic for in-progress split-payment session updates",
14
+ eventTypes: [
15
+ {
16
+ id: "split-payment-updated",
17
+ name: "Split Payment Updated",
18
+ description: "Published whenever the host's split-payment slice mutates (partial added, reset, etc.); payload carries the full current slice or null."
19
+ }
20
+ ]
21
+ };
22
+ export * from "./types";
@@ -0,0 +1,16 @@
1
+ import type { CFSplitPayment } from "../../../../CommonTypes";
2
+ import type { TopicEvent } from "../../../types";
3
+ /**
4
+ * Payload for split-payment-updated event.
5
+ *
6
+ * Mirrors the host's full split-payment slice. When no split-payment session is
7
+ * active (initial state or after `resetSplitPayment`) the host publishes
8
+ * `{ splitPayment: null }` so subscribers can clear their mirror.
9
+ */
10
+ export interface SplitPaymentUpdatedPayload {
11
+ splitPayment: CFSplitPayment | null;
12
+ }
13
+ /**
14
+ * Typed event for split-payment-updated.
15
+ */
16
+ export type SplitPaymentUpdatedEvent = TopicEvent<SplitPaymentUpdatedPayload>;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Split Payments Topic Types
3
+ * Aggregated types for all split-payment-related events.
4
+ */
5
+ export * from "./split-payment-updated/types";
6
+ import type { SplitPaymentUpdatedPayload } from "./split-payment-updated/types";
7
+ /** Union type for all split-payments event payloads. */
8
+ export type SplitPaymentsEventPayload = SplitPaymentUpdatedPayload;
9
+ /** Literal types for split-payments event IDs. */
10
+ export type SplitPaymentsEventType = "split-payment-updated";
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Split Payments Topic Types
3
+ * Aggregated types for all split-payment-related events.
4
+ */
5
+ export * from "./split-payment-updated/types";
@@ -4,6 +4,7 @@ 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 { SplitPaymentsEventType, SplitPaymentsEventPayload } from "./split-payments/types";
7
8
  import { CustomTablesEventPayload, CustomTablesEventType } from "./custom-tables/types";
8
9
  import { PrintEventType, PrintEventPayload } from "./print/types";
9
10
  import { OutletEventType, OutletEventPayload } from "./outlet/types";
@@ -21,6 +22,7 @@ export interface TopicEventPayloadMap {
21
22
  products: Record<ProductsEventType, ProductsEventPayload>;
22
23
  cart: Record<CartEventType, CartEventPayload>;
23
24
  payments: Record<PaymentsEventType, PaymentsEventPayload>;
25
+ "split-payments": Record<SplitPaymentsEventType, SplitPaymentsEventPayload>;
24
26
  customTables: Record<CustomTablesEventType, CustomTablesEventPayload>;
25
27
  print: Record<PrintEventType, PrintEventPayload>;
26
28
  outlet: Record<OutletEventType, OutletEventPayload>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@final-commerce/command-frame",
3
- "version": "0.2.0-beta.6",
3
+ "version": "0.3.0-beta.5",
4
4
  "description": "Commands Frame library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -11,6 +11,7 @@
11
11
  "package.json"
12
12
  ],
13
13
  "scripts": {
14
+ "preinstall": "node -e \"if(process.cwd()===process.env.INIT_CWD&&!process.env.NPM_REGISTRY_TOKEN){try{require('child_process').execSync('npx google-artifactregistry-auth',{stdio:'inherit'})}catch(e){}}\"",
14
15
  "build": "tsc",
15
16
  "build:clean": "rm -rf dist && npm run build",
16
17
  "dev": "tsc --watch",
@@ -18,12 +19,12 @@
18
19
  "test:run": "vitest run",
19
20
  "prepublishOnly": "npm run build",
20
21
  "prepare": "husky && npm run build",
21
- "lint": "eslint . --ext ts,tsx --report-unused-disable-directives",
22
+ "lint": "eslint .",
22
23
  "format": "prettier --write .",
23
24
  "format:check": "prettier --check .",
24
25
  "publish:npm": "npm publish --registry=https://registry.npmjs.org",
25
- "publish:github": "npm publish --registry=https://npm.pkg.github.com",
26
- "publish:all": "npm run publish:npm && npm run publish:github"
26
+ "publish:ar": "npm publish --registry=https://us-npm.pkg.dev/final-preproduction/npm/",
27
+ "publish:all": "npm run publish:npm && npm run publish:ar"
27
28
  },
28
29
  "keywords": [
29
30
  "final commerce",
@@ -35,8 +36,7 @@
35
36
  "author": "Final Commerce",
36
37
  "license": "MIT",
37
38
  "publishConfig": {
38
- "access": "public",
39
- "registry": "https://registry.npmjs.org/"
39
+ "access": "public"
40
40
  },
41
41
  "repository": {
42
42
  "type": "git",
@@ -56,18 +56,21 @@
56
56
  "ignoredBranchesPattern": "^(main|master|develop|release-staging.*|pre-prod)$",
57
57
  "ignoreBranchesMissingTickets": true
58
58
  },
59
+ "dependencies": {
60
+ "@final-commerce/common": "^2.0.2"
61
+ },
59
62
  "devDependencies": {
60
- "@typescript-eslint/eslint-plugin": "^8.48.0",
61
- "@typescript-eslint/parser": "^8.48.0",
62
- "eslint": "^8.57.0",
63
- "eslint-plugin-react": "^7.37.5",
64
- "eslint-plugin-react-hooks": "^7.1.1",
65
- "eslint-plugin-react-refresh": "^0.4.26",
63
+ "@commitlint/cli": "^19.0.0",
64
+ "@commitlint/config-conventional": "^19.0.0",
65
+ "@eslint/js": "^9.0.0",
66
+ "eslint": "^9.0.0",
66
67
  "husky": "^9.1.7",
67
68
  "jira-prepare-commit-msg": "^1.7.2",
68
69
  "lint-staged": "^16.2.7",
69
70
  "prettier": "^3.7.1",
70
71
  "typescript": "^5.0.0",
71
- "vitest": "^3.0.5"
72
- }
72
+ "typescript-eslint": "^8.0.0",
73
+ "vitest": "^4.0.0"
74
+ },
75
+ "prettier": "@final-commerce/common/prettier"
73
76
  }
@@ -1,2 +0,0 @@
1
- /** postMessage `action` for host → iframe extension refund requests. */
2
- export declare const EXTENSION_REFUND_REQUEST_ACTION = "extensionRefundRequest";
@@ -1,2 +0,0 @@
1
- /** postMessage `action` for host → iframe extension refund requests. */
2
- export const EXTENSION_REFUND_REQUEST_ACTION = "extensionRefundRequest";
@@ -1,11 +0,0 @@
1
- import type { ExtensionRefundParams, ExtensionRefundResponse } from "./types";
2
- /**
3
- * Install a message listener in the **extension iframe** so the host can request refunds.
4
- * Validates `event.source === window.top` before handling.
5
- *
6
- * Replies with {@link PostMessageResponse}, using `event.origin` as the target origin when posting back to the host.
7
- *
8
- * @param handler - Perform the extension-side refund (API call, etc.)
9
- * @returns Unsubscribe function
10
- */
11
- export declare function installExtensionRefundListener(handler: (params: ExtensionRefundParams) => Promise<ExtensionRefundResponse>): () => void;
@@ -1,60 +0,0 @@
1
- import { EXTENSION_REFUND_REQUEST_ACTION } from "./constants";
2
- function isRecord(value) {
3
- return typeof value === "object" && value !== null;
4
- }
5
- /**
6
- * Install a message listener in the **extension iframe** so the host can request refunds.
7
- * Validates `event.source === window.top` before handling.
8
- *
9
- * Replies with {@link PostMessageResponse}, using `event.origin` as the target origin when posting back to the host.
10
- *
11
- * @param handler - Perform the extension-side refund (API call, etc.)
12
- * @returns Unsubscribe function
13
- */
14
- export function installExtensionRefundListener(handler) {
15
- const onMessage = async (event) => {
16
- const raw = event.data;
17
- if (!isRecord(raw) || raw.action !== EXTENSION_REFUND_REQUEST_ACTION) {
18
- return;
19
- }
20
- const requestId = raw.requestId;
21
- if (typeof requestId !== "string") {
22
- return;
23
- }
24
- if (event.source !== window.top || !event.source) {
25
- return;
26
- }
27
- const source = event.source;
28
- const replyOrigin = typeof event.origin === "string" ? event.origin : "*";
29
- const params = raw.params;
30
- try {
31
- if (!params || typeof params.paymentType !== "string" || typeof params.amount !== "number" || typeof params.saleId !== "string") {
32
- const errPayload = {
33
- requestId,
34
- success: false,
35
- error: "Invalid extension refund params"
36
- };
37
- source.postMessage(errPayload, replyOrigin);
38
- return;
39
- }
40
- const result = await handler(params);
41
- const payload = {
42
- requestId,
43
- success: true,
44
- data: result
45
- };
46
- source.postMessage(payload, replyOrigin);
47
- }
48
- catch (e) {
49
- const message = e instanceof Error ? e.message : String(e);
50
- const errPayload = {
51
- requestId,
52
- success: false,
53
- error: message
54
- };
55
- source.postMessage(errPayload, replyOrigin);
56
- }
57
- };
58
- window.addEventListener("message", onMessage);
59
- return () => window.removeEventListener("message", onMessage);
60
- }
@@ -1,32 +0,0 @@
1
- /**
2
- * Host-initiated refund request for extension-controlled payments (e.g. redeem / gift card).
3
- * The host (Render) postMessages the iframe; the extension performs the provider refund and replies.
4
- */
5
- /**
6
- * Parameters sent from host to extension for a refund.
7
- *
8
- * **`amount` uses major currency units** (e.g. dollars), consistent with the string amount
9
- * passed through `sendRefundPaymentRequest` in Render (parsed with `parseFloat` / `+amount`).
10
- */
11
- export interface ExtensionRefundParams {
12
- /** e.g. `"redeem"` — matches order paymentMethods[].paymentType */
13
- paymentType: string;
14
- processor?: string;
15
- /** Major currency units (same as refund flow amount string, not cents). */
16
- amount: number;
17
- /** Local sale transaction id (Mongo-style id from paymentMethods[].transactionId). */
18
- saleId: string;
19
- orderId?: string;
20
- referenceId?: string;
21
- metadata?: Record<string, unknown>;
22
- }
23
- /**
24
- * Business result from the extension after attempting the refund.
25
- * Transport success/failure uses {@link import("../../client").PostMessageResponse}.
26
- */
27
- export interface ExtensionRefundResponse {
28
- success: boolean;
29
- error?: string;
30
- /** Provider/extension reference for the refund transaction, stored in local DB paymentData when present. */
31
- extensionTransactionId?: string;
32
- }
@@ -1,5 +0,0 @@
1
- /**
2
- * Host-initiated refund request for extension-controlled payments (e.g. redeem / gift card).
3
- * The host (Render) postMessages the iframe; the extension performs the provider refund and replies.
4
- */
5
- export {};
@@ -1,2 +0,0 @@
1
- import type { SetActiveOutlet } from "./types";
2
- export declare const setActiveOutlet: SetActiveOutlet;
@@ -1,4 +0,0 @@
1
- import { commandFrameClient } from "../../client";
2
- export const setActiveOutlet = async (params) => {
3
- return await commandFrameClient.call("setActiveOutlet", params);
4
- };
@@ -1,2 +0,0 @@
1
- import { SetActiveOutlet } from "./types";
2
- export declare const mockSetActiveOutlet: SetActiveOutlet;
@@ -1,16 +0,0 @@
1
- import { MOCK_OUTLETS } from "../../demo/database";
2
- export const mockSetActiveOutlet = async (params) => {
3
- console.log("[Mock] setActiveOutlet called", params);
4
- if (!params?.outletId) {
5
- throw new Error("outletId is required");
6
- }
7
- const found = MOCK_OUTLETS.find(o => o.id === params.outletId || o._id === params.outletId);
8
- if (!found) {
9
- throw new Error(`Outlet with ID ${params.outletId} not found`);
10
- }
11
- return {
12
- success: true,
13
- outlet: found,
14
- timestamp: new Date().toISOString()
15
- };
16
- };
@@ -1,10 +0,0 @@
1
- import { CFActiveOutlet } from "../../CommonTypes";
2
- export interface SetActiveOutletParams {
3
- outletId: string;
4
- }
5
- export interface SetActiveOutletResponse {
6
- success: boolean;
7
- outlet: CFActiveOutlet;
8
- timestamp: string;
9
- }
10
- export type SetActiveOutlet = (params?: SetActiveOutletParams) => Promise<SetActiveOutletResponse>;
@@ -1,2 +0,0 @@
1
- import type { SetActiveSession } from "./types";
2
- export declare const setActiveSession: SetActiveSession;
@@ -1,4 +0,0 @@
1
- import { commandFrameClient } from "../../client";
2
- export const setActiveSession = async (params) => {
3
- return await commandFrameClient.call("setActiveSession", params);
4
- };
@@ -1,2 +0,0 @@
1
- import { SetActiveSession } from "./types";
2
- export declare const mockSetActiveSession: SetActiveSession;
@@ -1,15 +0,0 @@
1
- import { MOCK_SESSION } from "../../demo/database";
2
- export const mockSetActiveSession = async (params) => {
3
- console.log("[Mock] setActiveSession called", params);
4
- if (!params?.sessionId) {
5
- throw new Error("sessionId is required");
6
- }
7
- if (params.sessionId !== MOCK_SESSION.id) {
8
- throw new Error(`Session with ID ${params.sessionId} not found`);
9
- }
10
- return {
11
- success: true,
12
- session: MOCK_SESSION,
13
- timestamp: new Date().toISOString()
14
- };
15
- };
@@ -1,10 +0,0 @@
1
- import { CFSession } from "../../CommonTypes";
2
- export interface SetActiveSessionParams {
3
- sessionId: string;
4
- }
5
- export interface SetActiveSessionResponse {
6
- success: boolean;
7
- session: CFSession;
8
- timestamp: string;
9
- }
10
- export type SetActiveSession = (params?: SetActiveSessionParams) => Promise<SetActiveSessionResponse>;
@@ -1,2 +0,0 @@
1
- import type { SetActiveStation } from "./types";
2
- export declare const setActiveStation: SetActiveStation;
@@ -1,4 +0,0 @@
1
- import { commandFrameClient } from "../../client";
2
- export const setActiveStation = async (params) => {
3
- return await commandFrameClient.call("setActiveStation", params);
4
- };
@@ -1,2 +0,0 @@
1
- import { SetActiveStation } from "./types";
2
- export declare const mockSetActiveStation: SetActiveStation;
@@ -1,16 +0,0 @@
1
- import { MOCK_STATIONS } from "../../demo/database";
2
- export const mockSetActiveStation = async (params) => {
3
- console.log("[Mock] setActiveStation called", params);
4
- if (!params?.stationId) {
5
- throw new Error("stationId is required");
6
- }
7
- const found = MOCK_STATIONS.find(s => s._id === params.stationId);
8
- if (!found) {
9
- throw new Error(`Station with ID ${params.stationId} not found`);
10
- }
11
- return {
12
- success: true,
13
- station: found,
14
- timestamp: new Date().toISOString()
15
- };
16
- };
@@ -1,10 +0,0 @@
1
- import { CFActiveStation } from "../../CommonTypes";
2
- export interface SetActiveStationParams {
3
- stationId: string;
4
- }
5
- export interface SetActiveStationResponse {
6
- success: boolean;
7
- station: CFActiveStation;
8
- timestamp: string;
9
- }
10
- export type SetActiveStation = (params?: SetActiveStationParams) => Promise<SetActiveStationResponse>;
@@ -1,6 +0,0 @@
1
- /**
2
- * Trigger webhook action
3
- * Calls the triggerWebhook action on the parent window
4
- */
5
- import type { TriggerWebhook } from "./types";
6
- export declare const triggerWebhook: TriggerWebhook;
@@ -1,8 +0,0 @@
1
- /**
2
- * Trigger webhook action
3
- * Calls the triggerWebhook action on the parent window
4
- */
5
- import { commandFrameClient } from "../../client";
6
- export const triggerWebhook = async (params) => {
7
- return await commandFrameClient.call("triggerWebhook", params);
8
- };
@@ -1,2 +0,0 @@
1
- import { TriggerWebhook } from "./types";
2
- export declare const mockTriggerWebhook: TriggerWebhook;
@@ -1,8 +0,0 @@
1
- export const mockTriggerWebhook = async (params) => {
2
- console.log("[Mock] triggerWebhook called", params);
3
- return {
4
- success: true,
5
- webhookUrl: params?.webhookUrl || "",
6
- timestamp: new Date().toISOString()
7
- };
8
- };