@final-commerce/command-frame 0.2.0-beta.1 → 0.3.0-beta.3

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 (151) hide show
  1. package/README.md +28 -26
  2. package/dist/CommonTypes.d.ts +79 -534
  3. package/dist/CommonTypes.js +5 -65
  4. package/dist/actions/add-customer-note/mock.js +24 -15
  5. package/dist/actions/add-customer-note/types.d.ts +3 -2
  6. package/dist/actions/add-product/mock.js +12 -6
  7. package/dist/actions/add-product-discount/mock.js +5 -5
  8. package/dist/actions/add-product-fee/mock.js +6 -6
  9. package/dist/actions/cash-payment/types.d.ts +0 -5
  10. package/dist/actions/delete-parked-order/types.d.ts +0 -3
  11. package/dist/actions/edit-product/mock.js +5 -3
  12. package/dist/actions/extension-payment/types.d.ts +4 -5
  13. package/dist/actions/get-context/mock.js +12 -6
  14. package/dist/actions/get-products/mock.js +3 -3
  15. package/dist/actions/get-roles/mock.js +35 -41
  16. package/dist/actions/get-smart-grid-layout/action.d.ts +2 -0
  17. package/dist/actions/get-smart-grid-layout/action.js +4 -0
  18. package/dist/actions/get-smart-grid-layout/mock.d.ts +2 -0
  19. package/dist/actions/get-smart-grid-layout/mock.js +7 -0
  20. package/dist/actions/get-smart-grid-layout/types.d.ts +12 -0
  21. package/dist/actions/get-users/mock.js +16 -25
  22. package/dist/actions/initiate-refund/types.d.ts +0 -3
  23. package/dist/actions/integration-payment/action.d.ts +5 -0
  24. package/dist/actions/integration-payment/action.js +7 -0
  25. package/dist/actions/integration-payment/mock.d.ts +2 -0
  26. package/dist/actions/integration-payment/mock.js +4 -0
  27. package/dist/actions/integration-payment/types.d.ts +16 -0
  28. package/dist/actions/open-extension-overlay/action.d.ts +2 -0
  29. package/dist/actions/open-extension-overlay/action.js +4 -0
  30. package/dist/actions/open-extension-overlay/mock.d.ts +2 -0
  31. package/dist/actions/open-extension-overlay/mock.js +1 -0
  32. package/dist/actions/open-extension-overlay/types.d.ts +9 -0
  33. package/dist/actions/park-order/types.d.ts +0 -3
  34. package/dist/actions/partial-payment/types.d.ts +0 -5
  35. package/dist/actions/print/mock.js +3 -6
  36. package/dist/actions/print/types.d.ts +1 -7
  37. package/dist/actions/process-partial-refund/types.d.ts +0 -3
  38. package/dist/actions/remove-customer-note/mock.js +14 -5
  39. package/dist/actions/resolve-extension-overlay/action.d.ts +2 -0
  40. package/dist/actions/resolve-extension-overlay/action.js +4 -0
  41. package/dist/actions/resolve-extension-overlay/mock.d.ts +2 -0
  42. package/dist/actions/resolve-extension-overlay/mock.js +1 -0
  43. package/dist/actions/resolve-extension-overlay/types.d.ts +9 -0
  44. package/dist/actions/resume-parked-order/mock.js +1 -1
  45. package/dist/actions/resume-parked-order/types.d.ts +0 -3
  46. package/dist/actions/save-smart-grid-layout/action.d.ts +2 -0
  47. package/dist/actions/save-smart-grid-layout/action.js +4 -0
  48. package/dist/actions/save-smart-grid-layout/mock.d.ts +2 -0
  49. package/dist/actions/save-smart-grid-layout/mock.js +7 -0
  50. package/dist/actions/save-smart-grid-layout/types.d.ts +12 -0
  51. package/dist/actions/set-active-product-discount/mock.js +1 -1
  52. package/dist/actions/set-active-product-fee/mock.js +1 -1
  53. package/dist/actions/tap-to-pay-payment/types.d.ts +0 -5
  54. package/dist/actions/terminal-payment/types.d.ts +0 -5
  55. package/dist/actions/vendara-payment/types.d.ts +0 -5
  56. package/dist/common-types/index.d.ts +0 -1
  57. package/dist/common-types/index.js +0 -1
  58. package/dist/demo/database.d.ts +21 -21
  59. package/dist/demo/database.js +36 -51
  60. package/dist/index.d.ts +124 -116
  61. package/dist/index.js +19 -15
  62. package/dist/interceptors/types.d.ts +34 -0
  63. package/dist/interceptors/types.js +1 -0
  64. package/dist/projects/render/mocks.js +10 -8
  65. package/dist/projects/render/types.d.ts +6 -5
  66. package/dist/pubsub/topics/attributes/attribute-created/types.d.ts +6 -0
  67. package/dist/pubsub/topics/attributes/attribute-created/types.js +1 -0
  68. package/dist/pubsub/topics/attributes/attribute-updated/types.d.ts +6 -0
  69. package/dist/pubsub/topics/attributes/attribute-updated/types.js +1 -0
  70. package/dist/pubsub/topics/attributes/index.d.ts +3 -0
  71. package/dist/pubsub/topics/attributes/index.js +18 -0
  72. package/dist/pubsub/topics/attributes/types.d.ts +6 -0
  73. package/dist/pubsub/topics/attributes/types.js +2 -0
  74. package/dist/pubsub/topics/categories/category-created/types.d.ts +6 -0
  75. package/dist/pubsub/topics/categories/category-created/types.js +1 -0
  76. package/dist/pubsub/topics/categories/category-updated/types.d.ts +6 -0
  77. package/dist/pubsub/topics/categories/category-updated/types.js +1 -0
  78. package/dist/pubsub/topics/categories/index.d.ts +3 -0
  79. package/dist/pubsub/topics/categories/index.js +18 -0
  80. package/dist/pubsub/topics/categories/types.d.ts +6 -0
  81. package/dist/pubsub/topics/categories/types.js +2 -0
  82. package/dist/pubsub/topics/index.d.ts +4 -0
  83. package/dist/pubsub/topics/index.js +4 -0
  84. package/dist/pubsub/topics/orders/index.js +0 -10
  85. package/dist/pubsub/topics/orders/types.d.ts +2 -6
  86. package/dist/pubsub/topics/orders/types.js +0 -2
  87. package/dist/pubsub/topics/print/print-completed/types.d.ts +1 -1
  88. package/dist/pubsub/topics/print/print-error/types.d.ts +1 -1
  89. package/dist/pubsub/topics/print/print-started/types.d.ts +1 -1
  90. package/dist/pubsub/topics/products/product-get-active/types.d.ts +6 -2
  91. package/dist/pubsub/topics/transactions/index.d.ts +3 -0
  92. package/dist/pubsub/topics/transactions/index.js +18 -0
  93. package/dist/pubsub/topics/transactions/transaction-created/types.d.ts +6 -0
  94. package/dist/pubsub/topics/transactions/transaction-created/types.js +1 -0
  95. package/dist/pubsub/topics/transactions/transaction-updated/types.d.ts +6 -0
  96. package/dist/pubsub/topics/transactions/transaction-updated/types.js +1 -0
  97. package/dist/pubsub/topics/transactions/types.d.ts +6 -0
  98. package/dist/pubsub/topics/transactions/types.js +2 -0
  99. package/dist/pubsub/topics/types.d.ts +8 -0
  100. package/dist/pubsub/topics/users/index.js +10 -0
  101. package/dist/pubsub/topics/users/types.d.ts +6 -2
  102. package/dist/pubsub/topics/users/types.js +2 -0
  103. package/dist/pubsub/topics/users/user-created/types.d.ts +6 -0
  104. package/dist/pubsub/topics/users/user-created/types.js +1 -0
  105. package/dist/pubsub/topics/users/user-updated/types.d.ts +6 -0
  106. package/dist/pubsub/topics/users/user-updated/types.js +1 -0
  107. package/dist/pubsub/topics/variants/index.d.ts +3 -0
  108. package/dist/pubsub/topics/variants/index.js +18 -0
  109. package/dist/pubsub/topics/variants/types.d.ts +6 -0
  110. package/dist/pubsub/topics/variants/types.js +2 -0
  111. package/dist/pubsub/topics/variants/variant-created/types.d.ts +6 -0
  112. package/dist/pubsub/topics/variants/variant-created/types.js +1 -0
  113. package/dist/pubsub/topics/variants/variant-updated/types.d.ts +6 -0
  114. package/dist/pubsub/topics/variants/variant-updated/types.js +1 -0
  115. package/package.json +15 -12
  116. package/dist/actions/can-transition/action.d.ts +0 -2
  117. package/dist/actions/can-transition/action.js +0 -4
  118. package/dist/actions/can-transition/mock.d.ts +0 -6
  119. package/dist/actions/can-transition/mock.js +0 -28
  120. package/dist/actions/can-transition/types.d.ts +0 -11
  121. package/dist/actions/get-available-transitions/action.d.ts +0 -2
  122. package/dist/actions/get-available-transitions/action.js +0 -4
  123. package/dist/actions/get-available-transitions/mock.d.ts +0 -6
  124. package/dist/actions/get-available-transitions/mock.js +0 -26
  125. package/dist/actions/get-available-transitions/types.d.ts +0 -9
  126. package/dist/actions/trigger-webhook/action.d.ts +0 -6
  127. package/dist/actions/trigger-webhook/action.js +0 -8
  128. package/dist/actions/trigger-webhook/mock.d.ts +0 -2
  129. package/dist/actions/trigger-webhook/mock.js +0 -8
  130. package/dist/actions/trigger-webhook/types.d.ts +0 -21
  131. package/dist/actions/trigger-webhook/types.js +0 -2
  132. package/dist/actions/trigger-zapier-webhook/action.d.ts +0 -6
  133. package/dist/actions/trigger-zapier-webhook/action.js +0 -8
  134. package/dist/actions/trigger-zapier-webhook/mock.d.ts +0 -2
  135. package/dist/actions/trigger-zapier-webhook/mock.js +0 -8
  136. package/dist/actions/trigger-zapier-webhook/types.d.ts +0 -9
  137. package/dist/common-types/order-state.d.ts +0 -32
  138. package/dist/common-types/order-state.js +0 -6
  139. package/dist/common-types/state-fragment.d.ts +0 -77
  140. package/dist/common-types/state-fragment.js +0 -10
  141. package/dist/fragments/index.d.ts +0 -1
  142. package/dist/fragments/index.js +0 -1
  143. package/dist/fragments/preorder-no-deposit.d.ts +0 -26
  144. package/dist/fragments/preorder-no-deposit.js +0 -166
  145. package/dist/pubsub/topics/orders/state-transition-blocked/types.d.ts +0 -16
  146. package/dist/pubsub/topics/orders/state-transition-completed/types.d.ts +0 -15
  147. /package/dist/actions/{can-transition → get-smart-grid-layout}/types.js +0 -0
  148. /package/dist/actions/{get-available-transitions → integration-payment}/types.js +0 -0
  149. /package/dist/actions/{trigger-zapier-webhook → open-extension-overlay}/types.js +0 -0
  150. /package/dist/{pubsub/topics/orders/state-transition-blocked → actions/resolve-extension-overlay}/types.js +0 -0
  151. /package/dist/{pubsub/topics/orders/state-transition-completed → actions/save-smart-grid-layout}/types.js +0 -0
@@ -0,0 +1,9 @@
1
+ import type { InterceptorPoint, InterceptorReturn } from "../../interceptors/types";
2
+ export interface OpenExtensionOverlayParams {
3
+ point: InterceptorPoint;
4
+ payload?: unknown;
5
+ /** Owning extension id. Injected by the host for interceptor-originated calls; optional for direct calls. */
6
+ extensionId?: string;
7
+ }
8
+ export type OpenExtensionOverlayResponse = InterceptorReturn;
9
+ export type OpenExtensionOverlay = (params: OpenExtensionOverlayParams) => Promise<OpenExtensionOverlayResponse>;
@@ -1,10 +1,7 @@
1
1
  import { CFOrder } from "../../CommonTypes";
2
- import type { CFTransitionResult } from "../../common-types/order-state";
3
2
  export interface ParkOrderResponse {
4
3
  success: boolean;
5
4
  order: CFOrder;
6
5
  timestamp: string;
7
- /** Present when the state machine blocked or forced the transition. */
8
- transitionResult?: CFTransitionResult;
9
6
  }
10
7
  export type ParkOrder = () => Promise<ParkOrderResponse>;
@@ -1,5 +1,4 @@
1
1
  import { CFOrder } from "../../CommonTypes";
2
- import type { CFTransitionResult } from "../../common-types/order-state";
3
2
  export interface PartialPaymentParams {
4
3
  /** The payment amount (required if openUI is false). */
5
4
  amount?: number;
@@ -7,8 +6,6 @@ export interface PartialPaymentParams {
7
6
  isPercent?: boolean;
8
7
  /** If true, opens the split payment UI. */
9
8
  openUI?: boolean;
10
- /** Override the fulfillment state after full payment. Render resolves the cascade. */
11
- checkoutFulfillmentTarget?: string;
12
9
  }
13
10
  export interface PartialPaymentResponse {
14
11
  success: boolean;
@@ -17,7 +14,5 @@ export interface PartialPaymentResponse {
17
14
  openUI: boolean;
18
15
  order: CFOrder | null;
19
16
  timestamp: string;
20
- /** Present when the state machine blocked or forced the transition. */
21
- transitionResult?: CFTransitionResult;
22
17
  }
23
18
  export type PartialPayment = (params?: PartialPaymentParams) => Promise<PartialPaymentResponse>;
@@ -1,4 +1,4 @@
1
- export const mockPrint = async (params) => {
1
+ export const mockPrint = (params) => {
2
2
  console.log("[Mock] print called", params);
3
3
  if (!params) {
4
4
  throw new Error("Print parameters are required");
@@ -11,16 +11,13 @@ export const mockPrint = async (params) => {
11
11
  case "html":
12
12
  console.log("[Mock] Would print HTML:", params.data.html?.substring(0, 100) + "...");
13
13
  break;
14
- case "selector":
15
- console.log("[Mock] Would print element with selector:", params.data.selector);
16
- break;
17
14
  case "receipt":
18
15
  console.log("[Mock] Would print receipt for order:", params.data.order);
19
16
  break;
20
17
  }
21
- return {
18
+ return Promise.resolve({
22
19
  success: true,
23
20
  timestamp: new Date().toISOString(),
24
21
  type: params.type
25
- };
22
+ });
26
23
  };
@@ -1,5 +1,5 @@
1
1
  import type { CFActiveOrder } from "../../CommonTypes";
2
- export type PrintType = "image" | "html" | "selector" | "receipt";
2
+ export type PrintType = "image" | "html" | "receipt";
3
3
  export type PrintParams = {
4
4
  type: "image";
5
5
  data: {
@@ -12,12 +12,6 @@ export type PrintParams = {
12
12
  html: string;
13
13
  };
14
14
  options?: PrintOptions;
15
- } | {
16
- type: "selector";
17
- data: {
18
- selector: string;
19
- };
20
- options?: PrintOptions;
21
15
  } | {
22
16
  type: "receipt";
23
17
  data: {
@@ -1,4 +1,3 @@
1
- import type { CFTransitionResult } from "../../common-types/order-state";
2
1
  export interface ProcessPartialRefundParams {
3
2
  /** Optional refund reason. */
4
3
  reason?: string;
@@ -16,7 +15,5 @@ export interface ProcessPartialRefundResponse {
16
15
  success: boolean;
17
16
  refundId: string;
18
17
  timestamp: string;
19
- /** Present when the state machine blocked or forced the transition. */
20
- transitionResult?: CFTransitionResult;
21
18
  }
22
19
  export type ProcessPartialRefund = (params?: ProcessPartialRefundParams) => Promise<ProcessPartialRefundResponse>;
@@ -1,3 +1,4 @@
1
+ import { MOCK_CUSTOMERS, mockPublishEvent } from "../../demo/database";
1
2
  export const mockRemoveCustomerNote = (params) => {
2
3
  console.log("[Mock] removeCustomerNote called", params);
3
4
  const noteId = params?.noteId ?? "";
@@ -5,9 +6,17 @@ export const mockRemoveCustomerNote = (params) => {
5
6
  if (!noteId) {
6
7
  return Promise.resolve({ success: false, noteId, timestamp });
7
8
  }
8
- return Promise.resolve({
9
- success: true,
10
- noteId,
11
- timestamp
12
- });
9
+ for (const customer of MOCK_CUSTOMERS) {
10
+ const before = customer.notes?.length ?? 0;
11
+ const removed = (customer.notes || []).find(n => n._id === noteId);
12
+ customer.notes = (customer.notes || []).filter(n => n._id !== noteId);
13
+ if ((customer.notes?.length ?? 0) !== before) {
14
+ mockPublishEvent("customers", "customer-note-deleted", {
15
+ customer,
16
+ note: removed
17
+ });
18
+ return Promise.resolve({ success: true, noteId, timestamp });
19
+ }
20
+ }
21
+ return Promise.resolve({ success: false, noteId, timestamp });
13
22
  };
@@ -0,0 +1,2 @@
1
+ import type { ResolveExtensionOverlay } from "./types";
2
+ export declare const resolveExtensionOverlay: ResolveExtensionOverlay;
@@ -0,0 +1,4 @@
1
+ import { commandFrameClient } from "../../client";
2
+ export const resolveExtensionOverlay = async (params) => {
3
+ return await commandFrameClient.call("resolveExtensionOverlay", params);
4
+ };
@@ -0,0 +1,2 @@
1
+ import type { ResolveExtensionOverlay } from "./types";
2
+ export declare const mockResolveExtensionOverlay: ResolveExtensionOverlay;
@@ -0,0 +1 @@
1
+ export const mockResolveExtensionOverlay = () => Promise.resolve({ success: true });
@@ -0,0 +1,9 @@
1
+ import type { InterceptorReturn } from "../../interceptors/types";
2
+ export interface ResolveExtensionOverlayParams {
3
+ overlayId: string;
4
+ result: InterceptorReturn;
5
+ }
6
+ export interface ResolveExtensionOverlayResponse {
7
+ success: boolean;
8
+ }
9
+ export type ResolveExtensionOverlay = (params: ResolveExtensionOverlayParams) => Promise<ResolveExtensionOverlayResponse>;
@@ -39,7 +39,7 @@ export const mockResumeParkedOrder = async (params) => {
39
39
  taxTableId: "",
40
40
  attributes: li.attributes
41
41
  }));
42
- MOCK_CART.subtotal = orderToResume.summary.subTotal;
42
+ MOCK_CART.subtotal = orderToResume.summary.subtotalAfterFees;
43
43
  MOCK_CART.total = orderToResume.summary.total;
44
44
  MOCK_CART.amountToBeCharged = MOCK_CART.total;
45
45
  MOCK_CART.remainingBalance = MOCK_CART.total;
@@ -1,5 +1,4 @@
1
1
  import { CFOrder } from "../../CommonTypes";
2
- import type { CFTransitionResult } from "../../common-types/order-state";
3
2
  export interface ResumeParkedOrderParams {
4
3
  orderId: string;
5
4
  }
@@ -7,7 +6,5 @@ export interface ResumeParkedOrderResponse {
7
6
  success: boolean;
8
7
  order: CFOrder;
9
8
  timestamp: string;
10
- /** Present when the state machine blocked or forced the transition. */
11
- transitionResult?: CFTransitionResult;
12
9
  }
13
10
  export type ResumeParkedOrder = (params?: ResumeParkedOrderParams) => Promise<ResumeParkedOrderResponse>;
@@ -0,0 +1,2 @@
1
+ import type { SaveSmartGridLayout } from "./types";
2
+ export declare const saveSmartGridLayout: SaveSmartGridLayout;
@@ -0,0 +1,4 @@
1
+ import { commandFrameClient } from "../../client";
2
+ export const saveSmartGridLayout = async (params) => {
3
+ return await commandFrameClient.call("saveSmartGridLayout", params);
4
+ };
@@ -0,0 +1,2 @@
1
+ import type { SaveSmartGridLayout } from "./types";
2
+ export declare const mockSaveSmartGridLayout: SaveSmartGridLayout;
@@ -0,0 +1,7 @@
1
+ export const mockSaveSmartGridLayout = (params) => {
2
+ return Promise.resolve({
3
+ success: true,
4
+ gridId: params.layout.gridId,
5
+ timestamp: new Date().toISOString()
6
+ });
7
+ };
@@ -0,0 +1,12 @@
1
+ import type { CFSmartGridLayout } from "../../CommonTypes";
2
+ /** Persist a builder SmartGrid layout. The `layout.gridId` identifies the grid. */
3
+ export interface SaveSmartGridLayoutParams {
4
+ layout: CFSmartGridLayout;
5
+ }
6
+ export interface SaveSmartGridLayoutResponse {
7
+ success: boolean;
8
+ /** The gridId that was saved. */
9
+ gridId: string;
10
+ timestamp: string;
11
+ }
12
+ export type SaveSmartGridLayout = (params: SaveSmartGridLayoutParams) => Promise<SaveSmartGridLayoutResponse>;
@@ -9,7 +9,7 @@ export const mockSetActiveProductDiscount = async (params) => {
9
9
  isPercent: params.isPercent || false,
10
10
  label: params.label || "Discount"
11
11
  };
12
- setMockActiveProduct({ ...MOCK_ACTIVE_PRODUCT, discount });
12
+ setMockActiveProduct({ ...MOCK_ACTIVE_PRODUCT, discounts: [discount] });
13
13
  return {
14
14
  success: true,
15
15
  amount: params.amount,
@@ -10,7 +10,7 @@ export const mockSetActiveProductFee = async (params) => {
10
10
  isPercent: params.isPercent || false,
11
11
  applyTaxes: params.applyTaxes || false
12
12
  };
13
- setMockActiveProduct({ ...MOCK_ACTIVE_PRODUCT, fee });
13
+ setMockActiveProduct({ ...MOCK_ACTIVE_PRODUCT, fees: [fee] });
14
14
  return {
15
15
  success: true,
16
16
  amount: params.amount,
@@ -1,10 +1,7 @@
1
1
  import { CFOrder } from "../../CommonTypes";
2
- import type { CFTransitionResult } from "../../common-types/order-state";
3
2
  export interface TapToPayPaymentParams {
4
3
  /** If not provided, uses the cart total. */
5
4
  amount?: number;
6
- /** Override the fulfillment state after full payment. Render resolves the cascade. */
7
- checkoutFulfillmentTarget?: string;
8
5
  }
9
6
  export interface TapToPayPaymentResponse {
10
7
  success: boolean;
@@ -12,7 +9,5 @@ export interface TapToPayPaymentResponse {
12
9
  paymentType: string;
13
10
  order: CFOrder | null;
14
11
  timestamp: string;
15
- /** Present when the state machine blocked or forced the transition. */
16
- transitionResult?: CFTransitionResult;
17
12
  }
18
13
  export type TapToPayPayment = (params?: TapToPayPaymentParams) => Promise<TapToPayPaymentResponse>;
@@ -1,12 +1,9 @@
1
1
  import { CFOrder } from "../../CommonTypes";
2
- import type { CFTransitionResult } from "../../common-types/order-state";
3
2
  export interface TerminalPaymentParams {
4
3
  /** If not provided, uses the cart total. */
5
4
  amount?: number;
6
5
  /** "Bluetooth" or "Cloud". Defaults to "Cloud". */
7
6
  paymentType?: 'Bluetooth' | 'Cloud';
8
- /** Override the fulfillment state after full payment. Render resolves the cascade. */
9
- checkoutFulfillmentTarget?: string;
10
7
  }
11
8
  export interface TerminalPaymentResponse {
12
9
  success: boolean;
@@ -14,7 +11,5 @@ export interface TerminalPaymentResponse {
14
11
  paymentType: string;
15
12
  order: CFOrder | null;
16
13
  timestamp: string;
17
- /** Present when the state machine blocked or forced the transition. */
18
- transitionResult?: CFTransitionResult;
19
14
  }
20
15
  export type TerminalPayment = (params?: TerminalPaymentParams) => Promise<TerminalPaymentResponse>;
@@ -1,10 +1,7 @@
1
1
  import { CFOrder } from "../../CommonTypes";
2
- import type { CFTransitionResult } from "../../common-types/order-state";
3
2
  export interface VendaraPaymentParams {
4
3
  /** If not provided, uses the cart total. */
5
4
  amount?: number;
6
- /** Override the fulfillment state after full payment. Render resolves the cascade. */
7
- checkoutFulfillmentTarget?: string;
8
5
  }
9
6
  export interface VendaraPaymentResponse {
10
7
  success: boolean;
@@ -12,7 +9,5 @@ export interface VendaraPaymentResponse {
12
9
  paymentType: string;
13
10
  order: CFOrder | null;
14
11
  timestamp: string;
15
- /** Present when the state machine blocked or forced the transition. */
16
- transitionResult?: CFTransitionResult;
17
12
  }
18
13
  export type VendaraPayment = (params?: VendaraPaymentParams) => Promise<VendaraPaymentResponse>;
@@ -1,3 +1,2 @@
1
1
  export * from "./custom-tables";
2
2
  export * from "./custom-extensions";
3
- export * from "./order-state";
@@ -1,3 +1,2 @@
1
1
  export * from "./custom-tables";
2
2
  export * from "./custom-extensions";
3
- export * from "./order-state";
@@ -34,29 +34,29 @@ export declare const MOCK_CATEGORY_SPECIALTY: CFCategory;
34
34
  export declare const MOCK_CATEGORY_BASIC: CFCategory;
35
35
  export declare const MOCK_CATEGORY_VEGAN: CFCategory;
36
36
  export declare const MOCK_CATEGORY_SPICY: CFCategory;
37
- export declare const MOCK_PRODUCT_BASIL_ALMOND: CFProduct;
38
- export declare const MOCK_PRODUCT_BEER: CFProduct;
39
- export declare const MOCK_PRODUCT_BEET: CFProduct;
40
- export declare const MOCK_PRODUCT_CARAMELIZED: CFProduct;
41
- export declare const MOCK_PRODUCT_GARLIC_ONION: CFProduct;
42
- export declare const MOCK_PRODUCT_GARLIC: CFProduct;
43
- export declare const MOCK_PRODUCT_GINGER_LIME: CFProduct;
44
- export declare const MOCK_PRODUCT_LEMON: CFProduct;
45
- export declare const MOCK_PRODUCT_RED_PEPPER: CFProduct;
46
- export declare const MOCK_PRODUCT_ROASTED_TOMATO: CFProduct;
47
- export declare const MOCK_PRODUCT_MINT_LEMON: CFProduct;
48
- export declare const MOCK_PRODUCT_CHILI_GARLIC: CFProduct;
49
- export declare const MOCK_PRODUCT_HABANERO: CFProduct;
50
- export declare const MOCK_PRODUCT_BLACK_GARLIC: CFProduct;
37
+ export declare const MOCK_PRODUCT_BASIL_ALMOND: import("@final-commerce/common/pos-types").FullProduct;
38
+ export declare const MOCK_PRODUCT_BEER: import("@final-commerce/common/pos-types").FullProduct;
39
+ export declare const MOCK_PRODUCT_BEET: import("@final-commerce/common/pos-types").FullProduct;
40
+ export declare const MOCK_PRODUCT_CARAMELIZED: import("@final-commerce/common/pos-types").FullProduct;
41
+ export declare const MOCK_PRODUCT_GARLIC_ONION: import("@final-commerce/common/pos-types").FullProduct;
42
+ export declare const MOCK_PRODUCT_GARLIC: import("@final-commerce/common/pos-types").FullProduct;
43
+ export declare const MOCK_PRODUCT_GINGER_LIME: import("@final-commerce/common/pos-types").FullProduct;
44
+ export declare const MOCK_PRODUCT_LEMON: import("@final-commerce/common/pos-types").FullProduct;
45
+ export declare const MOCK_PRODUCT_RED_PEPPER: import("@final-commerce/common/pos-types").FullProduct;
46
+ export declare const MOCK_PRODUCT_ROASTED_TOMATO: import("@final-commerce/common/pos-types").FullProduct;
47
+ export declare const MOCK_PRODUCT_MINT_LEMON: import("@final-commerce/common/pos-types").FullProduct;
48
+ export declare const MOCK_PRODUCT_CHILI_GARLIC: import("@final-commerce/common/pos-types").FullProduct;
49
+ export declare const MOCK_PRODUCT_HABANERO: import("@final-commerce/common/pos-types").FullProduct;
50
+ export declare const MOCK_PRODUCT_BLACK_GARLIC: import("@final-commerce/common/pos-types").FullProduct;
51
51
  export declare const MOCK_ORDER_1: CFActiveOrder;
52
52
  export declare const MOCK_ORDER_2: CFActiveOrder;
53
- export declare const MOCK_USERS: CFActiveUser[];
54
- export declare const MOCK_STATIONS: CFActiveStation[];
55
- export declare const MOCK_OUTLETS: CFActiveOutlet[];
56
- export declare const MOCK_CUSTOMERS: CFCustomer[];
57
- export declare const MOCK_CATEGORIES: CFCategory[];
58
- export declare const MOCK_PRODUCTS: CFProduct[];
59
- export declare const MOCK_ORDERS: CFActiveOrder[];
53
+ export declare const MOCK_USERS: import("@final-commerce/common/pos-types").ActiveUser[];
54
+ export declare const MOCK_STATIONS: import("@final-commerce/common/pos-types").ActiveStation[];
55
+ export declare const MOCK_OUTLETS: import("@final-commerce/common/pos-types").ActiveOutlet[];
56
+ export declare const MOCK_CUSTOMERS: import("@final-commerce/common/pos-types").ActiveCustomer[];
57
+ export declare const MOCK_CATEGORIES: import("@final-commerce/common/pos-types").Category[];
58
+ export declare const MOCK_PRODUCTS: import("@final-commerce/common/pos-types").FullProduct[];
59
+ export declare const MOCK_ORDERS: import("@final-commerce/common/pos-types").ActiveOrder[];
60
60
  export declare const MOCK_PARKED_ORDERS: CFActiveOrder[];
61
61
  export declare let MOCK_USER: CFActiveUser;
62
62
  export declare let MOCK_STATION: CFActiveStation;
@@ -167,42 +167,49 @@ export const MOCK_CUSTOMER_5 = {
167
167
  };
168
168
  // --- CATEGORIES ---
169
169
  export const MOCK_CATEGORY_PASTES = {
170
- _id: "cat_pastes",
170
+ id: "cat_pastes",
171
+ createdAt: "2024-01-01T00:00:00.000Z",
172
+ updatedAt: "2024-01-01T00:00:00.000Z",
171
173
  name: "Pastes",
172
174
  externalId: "ext_cat_pastes",
173
175
  companyId: MOCK_COMPANY.id,
174
- parentId: null
175
176
  };
176
177
  export const MOCK_CATEGORY_SPECIALTY = {
177
- _id: "cat_specialty",
178
+ id: "cat_specialty",
179
+ createdAt: "2024-01-01T00:00:00.000Z",
180
+ updatedAt: "2024-01-01T00:00:00.000Z",
178
181
  name: "Specialty",
179
182
  externalId: "ext_cat_specialty",
180
183
  companyId: MOCK_COMPANY.id,
181
184
  parentId: "cat_pastes"
182
185
  };
183
186
  export const MOCK_CATEGORY_BASIC = {
184
- _id: "cat_basic",
187
+ id: "cat_basic",
188
+ createdAt: "2024-01-01T00:00:00.000Z",
189
+ updatedAt: "2024-01-01T00:00:00.000Z",
185
190
  name: "Basic",
186
191
  externalId: "ext_cat_basic",
187
192
  companyId: MOCK_COMPANY.id,
188
193
  parentId: "cat_pastes"
189
194
  };
190
195
  export const MOCK_CATEGORY_VEGAN = {
191
- _id: "cat_vegan",
196
+ id: "cat_vegan",
197
+ createdAt: "2024-01-01T00:00:00.000Z",
198
+ updatedAt: "2024-01-01T00:00:00.000Z",
192
199
  name: "Vegan",
193
200
  externalId: "ext_cat_vegan",
194
201
  companyId: MOCK_COMPANY.id,
195
- parentId: null
196
202
  };
197
203
  export const MOCK_CATEGORY_SPICY = {
198
- _id: "cat_spicy",
204
+ id: "cat_spicy",
205
+ createdAt: "2024-01-01T00:00:00.000Z",
206
+ updatedAt: "2024-01-01T00:00:00.000Z",
199
207
  name: "Spicy",
200
208
  externalId: "ext_cat_spicy",
201
209
  companyId: MOCK_COMPANY.id,
202
- parentId: null
203
210
  };
204
211
  // --- PRODUCTS ---
205
- const createInventory = (stock) => [{ outletId: MOCK_OUTLET_MAIN.id, stock }];
212
+ const createInventory = (stock) => [{ warehouse: "main", outletId: MOCK_OUTLET_MAIN.id, stock }];
206
213
  // Helper for Simple Product
207
214
  const createSimpleProduct = (id, name, price, image, categories, description) => {
208
215
  const sku = `SKU-${id.toUpperCase()}`;
@@ -221,7 +228,7 @@ const createSimpleProduct = (id, name, price, image, categories, description) =>
221
228
  taxTable: "tax_standard",
222
229
  description,
223
230
  images: [image],
224
- categories: categories.map(c => c._id),
231
+ categories: categories.map(c => ({ name: c.name, externalId: c.externalId ?? c.id })),
225
232
  attributes: [],
226
233
  variants: [
227
234
  {
@@ -256,7 +263,7 @@ const createVariableProduct = (id, name, basePrice, largePrice, image, categorie
256
263
  taxTable: "tax_standard",
257
264
  description,
258
265
  images: [image],
259
- categories: categories.map(c => c._id),
266
+ categories: categories.map(c => ({ name: c.name, externalId: c.externalId ?? c.id })),
260
267
  attributes: [{ name: "Size", values: ["Small", "Large"] }],
261
268
  variants: [
262
269
  {
@@ -314,12 +321,13 @@ const createLineItem = (product, variantIndex = 0, quantity = 1) => {
314
321
  price: variant.price,
315
322
  taxes: [],
316
323
  discount: {
317
- itemDiscount: { percentage: 0, amount: 0 },
324
+ itemDiscounts: [],
318
325
  cartDiscount: { percentage: 0, amount: 0 }
319
326
  },
320
- fee: { itemFee: { percentage: 0, amount: 0, tax: 0, taxTableId: "" } },
327
+ fee: { itemFees: [] },
321
328
  totalTax: 0,
322
329
  total: variant.price * quantity,
330
+ lineNetWithFees: variant.price * quantity,
323
331
  metadata: [],
324
332
  image: product.images?.[0] || "",
325
333
  sku: variant.sku,
@@ -335,13 +343,10 @@ export const MOCK_ORDER_1 = {
335
343
  companyId: MOCK_COMPANY.id,
336
344
  externalId: null,
337
345
  status: "completed",
338
- paymentState: "paid",
339
- fulfillmentState: "fulfilled",
340
- displayState: "Completed",
341
346
  customer: MOCK_CUSTOMER_1,
342
347
  summary: {
343
348
  total: 2100,
344
- subTotal: 2100,
349
+ subtotalAfterFees: 2100,
345
350
  discountTotal: 0,
346
351
  shippingTotal: 0,
347
352
  totalTaxes: 0,
@@ -369,10 +374,7 @@ export const MOCK_ORDER_1 = {
369
374
  metadata: [],
370
375
  billing: MOCK_CUSTOMER_1.billing || null,
371
376
  shipping: null,
372
- lineItems: [
373
- createLineItem(MOCK_PRODUCT_GARLIC, 0, 1),
374
- createLineItem(MOCK_PRODUCT_BASIL_ALMOND, 0, 1)
375
- ],
377
+ lineItems: [createLineItem(MOCK_PRODUCT_GARLIC, 0, 1), createLineItem(MOCK_PRODUCT_BASIL_ALMOND, 0, 1)],
376
378
  customSales: [],
377
379
  balance: 0,
378
380
  user: MOCK_USER_LUIGI,
@@ -388,13 +390,10 @@ export const MOCK_ORDER_2 = {
388
390
  companyId: MOCK_COMPANY.id,
389
391
  externalId: null,
390
392
  status: "completed",
391
- paymentState: "paid",
392
- fulfillmentState: "fulfilled",
393
- displayState: "Completed",
394
393
  customer: MOCK_CUSTOMER_2,
395
394
  summary: {
396
395
  total: 3000,
397
- subTotal: 3000,
396
+ subtotalAfterFees: 3000,
398
397
  discountTotal: 0,
399
398
  shippingTotal: 0,
400
399
  totalTaxes: 0,
@@ -422,9 +421,7 @@ export const MOCK_ORDER_2 = {
422
421
  metadata: [],
423
422
  billing: null,
424
423
  shipping: null,
425
- lineItems: [
426
- createLineItem(MOCK_PRODUCT_BEER, 0, 2)
427
- ],
424
+ lineItems: [createLineItem(MOCK_PRODUCT_BEER, 0, 2)],
428
425
  customSales: [],
429
426
  balance: 0,
430
427
  user: MOCK_USER_MARIO,
@@ -436,20 +433,8 @@ export const MOCK_ORDER_2 = {
436
433
  export const MOCK_USERS = [MOCK_USER_MARIO, MOCK_USER_LUIGI];
437
434
  export const MOCK_STATIONS = [MOCK_STATION_1, MOCK_STATION_2];
438
435
  export const MOCK_OUTLETS = [MOCK_OUTLET_MAIN];
439
- export const MOCK_CUSTOMERS = [
440
- MOCK_CUSTOMER_1,
441
- MOCK_CUSTOMER_2,
442
- MOCK_CUSTOMER_3,
443
- MOCK_CUSTOMER_4,
444
- MOCK_CUSTOMER_5
445
- ];
446
- export const MOCK_CATEGORIES = [
447
- MOCK_CATEGORY_PASTES,
448
- MOCK_CATEGORY_SPECIALTY,
449
- MOCK_CATEGORY_BASIC,
450
- MOCK_CATEGORY_VEGAN,
451
- MOCK_CATEGORY_SPICY
452
- ];
436
+ export const MOCK_CUSTOMERS = [MOCK_CUSTOMER_1, MOCK_CUSTOMER_2, MOCK_CUSTOMER_3, MOCK_CUSTOMER_4, MOCK_CUSTOMER_5];
437
+ export const MOCK_CATEGORIES = [MOCK_CATEGORY_PASTES, MOCK_CATEGORY_SPECIALTY, MOCK_CATEGORY_BASIC, MOCK_CATEGORY_VEGAN, MOCK_CATEGORY_SPICY];
453
438
  export const MOCK_PRODUCTS = [
454
439
  MOCK_PRODUCT_BASIL_ALMOND,
455
440
  MOCK_PRODUCT_BEER,
@@ -500,7 +485,8 @@ export const resetMockCart = () => {
500
485
  };
501
486
  };
502
487
  function resolveMockOrderCurrency() {
503
- const raw = MOCK_COMPANY.settings?.currency;
488
+ const settings = MOCK_COMPANY.settings;
489
+ const raw = settings?.currency;
504
490
  if (typeof raw === "string" && Object.values(CurrencyCode).includes(raw)) {
505
491
  return raw;
506
492
  }
@@ -560,6 +546,7 @@ export const safeSerialize = (data) => {
560
546
  return JSON.parse(JSON.stringify(data));
561
547
  };
562
548
  const mockTopicSubscribers = {};
549
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
563
550
  export const mockPublishEvent = (topic, eventType, data) => {
564
551
  const subscribers = mockTopicSubscribers[topic] || [];
565
552
  const event = {
@@ -602,12 +589,13 @@ export const createOrderFromCart = (paymentType, amount, processor = "cash") =>
602
589
  price: p.price,
603
590
  taxes: [],
604
591
  discount: {
605
- itemDiscount: { percentage: 0, amount: 0, const: "0" },
606
- cartDiscount: { percentage: 0, amount: 0, const: "0" }
592
+ itemDiscounts: [],
593
+ cartDiscount: { percentage: 0, amount: 0 }
607
594
  },
608
- fee: { itemFee: { percentage: 0, amount: 0, tax: 0, taxTableId: "" } },
595
+ fee: { itemFees: [] },
609
596
  totalTax: 0,
610
597
  total: p.price * p.quantity,
598
+ lineNetWithFees: p.price * p.quantity,
611
599
  metadata: [],
612
600
  image: p.images?.[0] || "",
613
601
  sku: p.sku || "",
@@ -624,13 +612,10 @@ export const createOrderFromCart = (paymentType, amount, processor = "cash") =>
624
612
  companyId: MOCK_COMPANY.id,
625
613
  externalId: null,
626
614
  status: "completed",
627
- paymentState: "paid",
628
- fulfillmentState: "fulfilled",
629
- displayState: "Completed",
630
615
  customer: MOCK_CART.customer ? MOCK_CART.customer : null,
631
616
  summary: {
632
617
  total: totalNum,
633
- subTotal: totalNum,
618
+ subtotalAfterFees: totalNum,
634
619
  discountTotal: 0,
635
620
  shippingTotal: 0,
636
621
  totalTaxes: 0,
@@ -669,6 +654,6 @@ export const createOrderFromCart = (paymentType, amount, processor = "cash") =>
669
654
  MOCK_ORDERS.push(newOrder);
670
655
  resetMockCart();
671
656
  // Publish cart-created event after cart is reset (simulates new empty cart)
672
- mockPublishEvent('cart', 'cart-created', {});
657
+ mockPublishEvent("cart", "cart-created", {});
673
658
  return newOrder;
674
659
  };