@final-commerce/command-frame 0.0.2 → 0.0.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 (151) hide show
  1. package/README.md +56 -7
  2. package/dist/CommonTypes.d.ts +469 -0
  3. package/dist/CommonTypes.js +21 -0
  4. package/dist/actions/add-cart-discount/mock.d.ts +2 -0
  5. package/dist/actions/add-cart-discount/mock.js +27 -0
  6. package/dist/actions/add-cart-fee/mock.d.ts +2 -0
  7. package/dist/actions/add-cart-fee/mock.js +31 -0
  8. package/dist/actions/add-custom-sale/mock.d.ts +2 -0
  9. package/dist/actions/add-custom-sale/mock.js +12 -0
  10. package/dist/actions/add-customer/mock.d.ts +2 -0
  11. package/dist/actions/add-customer/mock.js +23 -0
  12. package/dist/actions/add-customer/types.d.ts +3 -2
  13. package/dist/actions/add-customer-note/mock.d.ts +2 -0
  14. package/dist/actions/add-customer-note/mock.js +9 -0
  15. package/dist/actions/add-order-note/mock.d.ts +2 -0
  16. package/dist/actions/add-order-note/mock.js +8 -0
  17. package/dist/actions/add-product-discount/mock.d.ts +2 -0
  18. package/dist/actions/add-product-discount/mock.js +10 -0
  19. package/dist/actions/add-product-fee/mock.d.ts +2 -0
  20. package/dist/actions/add-product-fee/mock.js +11 -0
  21. package/dist/actions/add-product-note/mock.d.ts +2 -0
  22. package/dist/actions/add-product-note/mock.js +8 -0
  23. package/dist/actions/add-product-to-cart/mock.d.ts +2 -0
  24. package/dist/actions/add-product-to-cart/mock.js +56 -0
  25. package/dist/actions/add-product-to-cart/types.d.ts +2 -0
  26. package/dist/actions/adjust-inventory/mock.d.ts +2 -0
  27. package/dist/actions/adjust-inventory/mock.js +18 -0
  28. package/dist/actions/assign-customer/mock.d.ts +2 -0
  29. package/dist/actions/assign-customer/mock.js +14 -0
  30. package/dist/actions/assign-customer/types.d.ts +2 -1
  31. package/dist/actions/authenticate-user/mock.d.ts +2 -0
  32. package/dist/actions/authenticate-user/mock.js +8 -0
  33. package/dist/actions/calculate-refund-total/mock.d.ts +2 -0
  34. package/dist/actions/calculate-refund-total/mock.js +14 -0
  35. package/dist/actions/calculate-refund-total/types.d.ts +3 -2
  36. package/dist/actions/cash-payment/mock.d.ts +2 -0
  37. package/dist/actions/cash-payment/mock.js +14 -0
  38. package/dist/actions/cash-payment/types.d.ts +2 -1
  39. package/dist/actions/clear-cart/mock.d.ts +2 -0
  40. package/dist/actions/clear-cart/mock.js +9 -0
  41. package/dist/actions/delete-parked-order/mock.d.ts +2 -0
  42. package/dist/actions/delete-parked-order/mock.js +8 -0
  43. package/dist/actions/example-function/mock.d.ts +2 -0
  44. package/dist/actions/example-function/mock.js +13 -0
  45. package/dist/actions/get-categories/mock.d.ts +2 -0
  46. package/dist/actions/get-categories/mock.js +20 -0
  47. package/dist/actions/get-categories/types.d.ts +2 -1
  48. package/dist/actions/get-context/mock.d.ts +2 -0
  49. package/dist/actions/get-context/mock.js +24 -0
  50. package/dist/actions/get-context/types.d.ts +2 -20
  51. package/dist/actions/get-current-cart/mock.d.ts +2 -0
  52. package/dist/actions/get-current-cart/mock.js +9 -0
  53. package/dist/actions/get-current-cart/types.d.ts +2 -1
  54. package/dist/actions/get-customers/mock.d.ts +2 -0
  55. package/dist/actions/get-customers/mock.js +17 -0
  56. package/dist/actions/get-customers/types.d.ts +2 -1
  57. package/dist/actions/get-final-context/action.d.ts +6 -0
  58. package/dist/actions/get-final-context/action.js +8 -0
  59. package/dist/actions/get-final-context/types.d.ts +4 -0
  60. package/dist/actions/get-final-context/types.js +1 -0
  61. package/dist/actions/get-line-items-by-order/mock.d.ts +2 -0
  62. package/dist/actions/get-line-items-by-order/mock.js +12 -0
  63. package/dist/actions/get-line-items-by-order/types.d.ts +3 -2
  64. package/dist/actions/get-orders/mock.d.ts +2 -0
  65. package/dist/actions/get-orders/mock.js +104 -0
  66. package/dist/actions/get-orders/types.d.ts +2 -1
  67. package/dist/actions/get-product-variants/mock.d.ts +2 -0
  68. package/dist/actions/get-product-variants/mock.js +14 -0
  69. package/dist/actions/get-product-variants/types.d.ts +2 -1
  70. package/dist/actions/get-products/mock.d.ts +2 -0
  71. package/dist/actions/get-products/mock.js +31 -0
  72. package/dist/actions/get-products/types.d.ts +2 -1
  73. package/dist/actions/get-refunds/mock.d.ts +2 -0
  74. package/dist/actions/get-refunds/mock.js +9 -0
  75. package/dist/actions/get-refunds/types.d.ts +2 -1
  76. package/dist/actions/get-remaining-refundable-quantities/mock.d.ts +2 -0
  77. package/dist/actions/get-remaining-refundable-quantities/mock.js +9 -0
  78. package/dist/actions/go-to-page/mock.d.ts +2 -0
  79. package/dist/actions/go-to-page/mock.js +8 -0
  80. package/dist/actions/go-to-station-home/mock.d.ts +2 -0
  81. package/dist/actions/go-to-station-home/mock.js +7 -0
  82. package/dist/actions/initiate-refund/mock.d.ts +2 -0
  83. package/dist/actions/initiate-refund/mock.js +8 -0
  84. package/dist/actions/open-cash-drawer/mock.d.ts +2 -0
  85. package/dist/actions/open-cash-drawer/mock.js +7 -0
  86. package/dist/actions/open-popup/mock.d.ts +2 -0
  87. package/dist/actions/open-popup/mock.js +8 -0
  88. package/dist/actions/park-order/mock.d.ts +2 -0
  89. package/dist/actions/park-order/mock.js +9 -0
  90. package/dist/actions/park-order/types.d.ts +2 -1
  91. package/dist/actions/partial-payment/mock.d.ts +2 -0
  92. package/dist/actions/partial-payment/mock.js +12 -0
  93. package/dist/actions/partial-payment/types.d.ts +2 -1
  94. package/dist/actions/process-partial-refund/mock.d.ts +2 -0
  95. package/dist/actions/process-partial-refund/mock.js +8 -0
  96. package/dist/actions/remove-customer-from-cart/mock.d.ts +2 -0
  97. package/dist/actions/remove-customer-from-cart/mock.js +9 -0
  98. package/dist/actions/reset-refund-details/mock.d.ts +2 -0
  99. package/dist/actions/reset-refund-details/mock.js +7 -0
  100. package/dist/actions/resume-parked-order/mock.d.ts +2 -0
  101. package/dist/actions/resume-parked-order/mock.js +9 -0
  102. package/dist/actions/resume-parked-order/types.d.ts +2 -1
  103. package/dist/actions/select-all-refund-items/mock.d.ts +2 -0
  104. package/dist/actions/select-all-refund-items/mock.js +8 -0
  105. package/dist/actions/set-product-active/mock.d.ts +2 -0
  106. package/dist/actions/set-product-active/mock.js +8 -0
  107. package/dist/actions/set-refund-stock-action/mock.d.ts +2 -0
  108. package/dist/actions/set-refund-stock-action/mock.js +9 -0
  109. package/dist/actions/show-confirmation/mock.d.ts +2 -0
  110. package/dist/actions/show-confirmation/mock.js +9 -0
  111. package/dist/actions/show-notification/mock.d.ts +2 -0
  112. package/dist/actions/show-notification/mock.js +8 -0
  113. package/dist/actions/switch-user/mock.d.ts +2 -0
  114. package/dist/actions/switch-user/mock.js +10 -0
  115. package/dist/actions/tap-to-pay-payment/mock.d.ts +2 -0
  116. package/dist/actions/tap-to-pay-payment/mock.js +11 -0
  117. package/dist/actions/tap-to-pay-payment/types.d.ts +2 -1
  118. package/dist/actions/terminal-payment/mock.d.ts +2 -0
  119. package/dist/actions/terminal-payment/mock.js +14 -0
  120. package/dist/actions/terminal-payment/types.d.ts +2 -1
  121. package/dist/actions/toggle-slide-out/mock.d.ts +2 -0
  122. package/dist/actions/toggle-slide-out/mock.js +8 -0
  123. package/dist/actions/trigger-webhook/mock.d.ts +2 -0
  124. package/dist/actions/trigger-webhook/mock.js +8 -0
  125. package/dist/actions/trigger-zapier-webhook/mock.d.ts +2 -0
  126. package/dist/actions/trigger-zapier-webhook/mock.js +8 -0
  127. package/dist/actions/update-customer-facing-display/mock.d.ts +2 -0
  128. package/dist/actions/update-customer-facing-display/mock.js +8 -0
  129. package/dist/actions/vendara-payment/mock.d.ts +2 -0
  130. package/dist/actions/vendara-payment/mock.js +11 -0
  131. package/dist/actions/vendara-payment/types.d.ts +2 -1
  132. package/dist/client.d.ts +3 -0
  133. package/dist/client.js +62 -1
  134. package/dist/demo/assets/assets/basil-almond-paste.png +0 -0
  135. package/dist/demo/assets/assets/beer-paste.png +0 -0
  136. package/dist/demo/assets/assets/beet-paste.png +0 -0
  137. package/dist/demo/assets/assets/caramelized-paste.png +0 -0
  138. package/dist/demo/assets/assets/garlic-onion-paste.png +0 -0
  139. package/dist/demo/assets/assets/garlic-paste.png +0 -0
  140. package/dist/demo/assets/assets/ginger-lime-paste.png +0 -0
  141. package/dist/demo/assets/assets/lemon-paste.png +0 -0
  142. package/dist/demo/assets/assets/logo.png +0 -0
  143. package/dist/demo/assets/assets/red-pepper-paste.png +0 -0
  144. package/dist/demo/assets/assets/roasted-tomato-paste.png +0 -0
  145. package/dist/demo/database.d.ts +45 -0
  146. package/dist/demo/database.js +515 -0
  147. package/dist/demo/registry.d.ts +5 -0
  148. package/dist/demo/registry.js +106 -0
  149. package/dist/index.d.ts +1 -0
  150. package/dist/types.d.ts +6 -5
  151. package/package.json +2 -2
@@ -0,0 +1,12 @@
1
+ export const mockAddCustomSale = async (params) => {
2
+ console.log("[Mock] addCustomSale called", params);
3
+ if (!params)
4
+ throw new Error("Params required");
5
+ return {
6
+ success: true,
7
+ label: params.label,
8
+ price: Number(params.price),
9
+ applyTaxes: params.applyTaxes ?? false,
10
+ timestamp: new Date().toISOString()
11
+ };
12
+ };
@@ -0,0 +1,2 @@
1
+ import { AddCustomer } from "./types";
2
+ export declare const mockAddCustomer: AddCustomer;
@@ -0,0 +1,23 @@
1
+ import { MOCK_CUSTOMERS } from "../../demo/database";
2
+ export const mockAddCustomer = async (params) => {
3
+ console.log("[Mock] addCustomer called", params);
4
+ if (!params?.customer)
5
+ throw new Error("Customer data required");
6
+ const newCustomer = {
7
+ _id: "new_mock_cust_" + Date.now(),
8
+ companyId: "mock_company_id",
9
+ email: params.customer.email || "",
10
+ firstName: params.customer.firstName || "",
11
+ lastName: params.customer.lastName || "",
12
+ phone: params.customer.phone,
13
+ billing: null,
14
+ shipping: null,
15
+ ...params.customer
16
+ };
17
+ MOCK_CUSTOMERS.push(newCustomer);
18
+ return {
19
+ success: true,
20
+ customer: newCustomer,
21
+ timestamp: new Date().toISOString()
22
+ };
23
+ };
@@ -1,9 +1,10 @@
1
+ import { CFCustomer } from "../../CommonTypes";
1
2
  export interface AddCustomerParams {
2
- customer: Record<string, any>;
3
+ customer: Partial<CFCustomer>;
3
4
  }
4
5
  export interface AddCustomerResponse {
5
6
  success: boolean;
6
- customer: any;
7
+ customer: CFCustomer;
7
8
  timestamp: string;
8
9
  }
9
10
  export type AddCustomer = (params: AddCustomerParams) => Promise<AddCustomerResponse>;
@@ -0,0 +1,2 @@
1
+ import { AddCustomerNote } from "./types";
2
+ export declare const mockAddCustomerNote: AddCustomerNote;
@@ -0,0 +1,9 @@
1
+ export const mockAddCustomerNote = async (params) => {
2
+ console.log("[Mock] addCustomerNote called", params);
3
+ return {
4
+ success: true,
5
+ customerId: params?.customerId || "",
6
+ note: params?.note || "",
7
+ timestamp: new Date().toISOString()
8
+ };
9
+ };
@@ -0,0 +1,2 @@
1
+ import { AddOrderNote } from "./types";
2
+ export declare const mockAddOrderNote: AddOrderNote;
@@ -0,0 +1,8 @@
1
+ export const mockAddOrderNote = async (params) => {
2
+ console.log("[Mock] addOrderNote called", params);
3
+ return {
4
+ success: true,
5
+ note: params?.note || "",
6
+ timestamp: new Date().toISOString()
7
+ };
8
+ };
@@ -0,0 +1,2 @@
1
+ import { AddProductDiscount } from "./types";
2
+ export declare const mockAddProductDiscount: AddProductDiscount;
@@ -0,0 +1,10 @@
1
+ export const mockAddProductDiscount = async (params) => {
2
+ console.log("[Mock] addProductDiscount called", params);
3
+ return {
4
+ success: true,
5
+ amount: params?.amount || 0,
6
+ isPercent: params?.isPercent || false,
7
+ label: params?.label || "",
8
+ timestamp: new Date().toISOString()
9
+ };
10
+ };
@@ -0,0 +1,2 @@
1
+ import { AddProductFee } from "./types";
2
+ export declare const mockAddProductFee: AddProductFee;
@@ -0,0 +1,11 @@
1
+ export const mockAddProductFee = async (params) => {
2
+ console.log("[Mock] addProductFee called", params);
3
+ return {
4
+ success: true,
5
+ amount: params?.amount || 0,
6
+ isPercent: params?.isPercent || false,
7
+ label: params?.label || "",
8
+ applyTaxes: params?.applyTaxes || false,
9
+ timestamp: new Date().toISOString()
10
+ };
11
+ };
@@ -0,0 +1,2 @@
1
+ import { AddProductNote } from "./types";
2
+ export declare const mockAddProductNote: AddProductNote;
@@ -0,0 +1,8 @@
1
+ export const mockAddProductNote = async (params) => {
2
+ console.log("[Mock] addProductNote called", params);
3
+ return {
4
+ success: true,
5
+ note: params?.note || "",
6
+ timestamp: new Date().toISOString()
7
+ };
8
+ };
@@ -0,0 +1,2 @@
1
+ import { AddProductToCart } from "./types";
2
+ export declare const mockAddProductToCart: AddProductToCart;
@@ -0,0 +1,56 @@
1
+ import { MOCK_CART, MOCK_PRODUCTS } from "../../demo/database";
2
+ export const mockAddProductToCart = async (params) => {
3
+ console.log("[Mock] addProductToCart called", params);
4
+ const productId = params?.productId;
5
+ const variantId = params?.variantId;
6
+ const quantity = params?.quantity || 1;
7
+ let product = MOCK_PRODUCTS[0]; // Default fallback
8
+ if (productId) {
9
+ const found = MOCK_PRODUCTS.find(p => p._id === productId);
10
+ if (found) {
11
+ product = found;
12
+ }
13
+ else {
14
+ console.warn(`[Mock] Product with ID ${productId} not found, using default.`);
15
+ }
16
+ }
17
+ // Determine variant
18
+ let variant = product.variants[0];
19
+ if (variantId) {
20
+ const foundVariant = product.variants.find(v => v._id === variantId);
21
+ if (foundVariant) {
22
+ variant = foundVariant;
23
+ }
24
+ }
25
+ // Add to MOCK_CART
26
+ const activeProduct = {
27
+ ...product,
28
+ id: product._id,
29
+ internalId: product._id + "_" + Date.now(), // unique ID for cart item
30
+ variantId: variant._id,
31
+ quantity: quantity,
32
+ price: Number(variant.price),
33
+ taxTableId: product.taxTable,
34
+ stock: variant.inventory?.[0]?.stock || 0,
35
+ images: product.images || [],
36
+ localQuantity: quantity,
37
+ sku: variant.sku,
38
+ attributes: variant.attributes.map(a => `${a.name}: ${a.value}`).join(", ")
39
+ };
40
+ MOCK_CART.products.push(activeProduct);
41
+ // Recalculate totals
42
+ const lineTotal = activeProduct.price * quantity;
43
+ MOCK_CART.subtotal += lineTotal;
44
+ // Simple total calculation (ignoring taxes/fees for mock simplicity unless needed)
45
+ MOCK_CART.total += lineTotal;
46
+ MOCK_CART.amountToBeCharged = MOCK_CART.total;
47
+ MOCK_CART.remainingBalance = MOCK_CART.total;
48
+ return {
49
+ success: true,
50
+ productId: activeProduct.id,
51
+ variantId: activeProduct.variantId,
52
+ name: activeProduct.name,
53
+ quantity: quantity,
54
+ timestamp: new Date().toISOString()
55
+ };
56
+ };
@@ -1,4 +1,6 @@
1
1
  export interface AddProductToCartParams {
2
+ productId?: string;
3
+ variantId?: string;
2
4
  quantity?: number;
3
5
  }
4
6
  export interface AddProductToCartResponse {
@@ -0,0 +1,2 @@
1
+ import { AdjustInventory } from "./types";
2
+ export declare const mockAdjustInventory: AdjustInventory;
@@ -0,0 +1,18 @@
1
+ export const mockAdjustInventory = async (params) => {
2
+ console.log("[Mock] adjustInventory called", params);
3
+ // Simulate updating inventory
4
+ let newStock = 100;
5
+ if (params?.stockType === 'add')
6
+ newStock += Number(params.amount);
7
+ if (params?.stockType === 'subtract')
8
+ newStock -= Number(params.amount);
9
+ if (params?.stockType === 'set')
10
+ newStock = Number(params.amount);
11
+ return {
12
+ success: true,
13
+ amount: params?.amount || "0",
14
+ stockType: params?.stockType || "set",
15
+ newStock,
16
+ timestamp: new Date().toISOString()
17
+ };
18
+ };
@@ -0,0 +1,2 @@
1
+ import { AssignCustomer } from "./types";
2
+ export declare const mockAssignCustomer: AssignCustomer;
@@ -0,0 +1,14 @@
1
+ import { MOCK_CUSTOMERS, MOCK_CART } from "../../demo/database";
2
+ export const mockAssignCustomer = async (params) => {
3
+ console.log("[Mock] assignCustomer called", params);
4
+ const customer = MOCK_CUSTOMERS.find(c => c._id === params.customerId);
5
+ if (!customer) {
6
+ throw new Error("Customer not found in mock DB");
7
+ }
8
+ MOCK_CART.customer = customer;
9
+ return {
10
+ success: true,
11
+ customer,
12
+ timestamp: new Date().toISOString()
13
+ };
14
+ };
@@ -1,9 +1,10 @@
1
+ import { CFCustomer } from "../../CommonTypes";
1
2
  export interface AssignCustomerParams {
2
3
  customerId: string;
3
4
  }
4
5
  export interface AssignCustomerResponse {
5
6
  success: boolean;
6
- customer: any;
7
+ customer: CFCustomer;
7
8
  timestamp: string;
8
9
  }
9
10
  export type AssignCustomer = (params: AssignCustomerParams) => Promise<AssignCustomerResponse>;
@@ -0,0 +1,2 @@
1
+ import { AuthenticateUser } from "./types";
2
+ export declare const mockAuthenticateUser: AuthenticateUser;
@@ -0,0 +1,8 @@
1
+ export const mockAuthenticateUser = async (params) => {
2
+ console.log("[Mock] authenticateUser called", params);
3
+ return {
4
+ success: true,
5
+ roleIds: params?.roleIds || [],
6
+ timestamp: new Date().toISOString()
7
+ };
8
+ };
@@ -0,0 +1,2 @@
1
+ import { CalculateRefundTotal } from "./types";
2
+ export declare const mockCalculateRefundTotal: CalculateRefundTotal;
@@ -0,0 +1,14 @@
1
+ export const mockCalculateRefundTotal = async () => {
2
+ console.log("[Mock] calculateRefundTotal called");
3
+ return {
4
+ success: true,
5
+ summary: {
6
+ subtotal: "0.00",
7
+ tax: "0.00",
8
+ total: "0.00"
9
+ },
10
+ refundedLineItems: [],
11
+ refundedCustomSales: [],
12
+ timestamp: new Date().toISOString()
13
+ };
14
+ };
@@ -1,3 +1,4 @@
1
+ import { CFRefundedLineItem, CFRefundedCustomSale } from "../../CommonTypes";
1
2
  export interface CalculateRefundTotalResponse {
2
3
  success: boolean;
3
4
  summary: {
@@ -5,8 +6,8 @@ export interface CalculateRefundTotalResponse {
5
6
  tax: string;
6
7
  total: string;
7
8
  };
8
- refundedLineItems: any[];
9
- refundedCustomSales: any[];
9
+ refundedLineItems: CFRefundedLineItem[];
10
+ refundedCustomSales: CFRefundedCustomSale[];
10
11
  timestamp: string;
11
12
  }
12
13
  export type CalculateRefundTotal = () => Promise<CalculateRefundTotalResponse>;
@@ -0,0 +1,2 @@
1
+ import { CashPayment } from "./types";
2
+ export declare const mockCashPayment: CashPayment;
@@ -0,0 +1,14 @@
1
+ import { createOrderFromCart } from "../../demo/database";
2
+ export const mockCashPayment = async (params) => {
3
+ console.log("[Mock] cashPayment called", params);
4
+ const amount = params?.amount || 0;
5
+ const order = createOrderFromCart("cash", amount, "cash");
6
+ return {
7
+ success: true,
8
+ amount,
9
+ openChangeCalculator: params?.openChangeCalculator || false,
10
+ paymentType: "cash",
11
+ order,
12
+ timestamp: new Date().toISOString()
13
+ };
14
+ };
@@ -1,3 +1,4 @@
1
+ import { CFOrder } from "../../CommonTypes";
1
2
  export interface CashPaymentParams {
2
3
  amount?: number;
3
4
  openChangeCalculator?: boolean;
@@ -7,7 +8,7 @@ export interface CashPaymentResponse {
7
8
  amount: number;
8
9
  openChangeCalculator: boolean;
9
10
  paymentType: string;
10
- order: any | null;
11
+ order: CFOrder | null;
11
12
  timestamp: string;
12
13
  }
13
14
  export type CashPayment = (params?: CashPaymentParams) => Promise<CashPaymentResponse>;
@@ -0,0 +1,2 @@
1
+ import { ClearCart } from "./types";
2
+ export declare const mockClearCart: ClearCart;
@@ -0,0 +1,9 @@
1
+ import { resetMockCart } from "../../demo/database";
2
+ export const mockClearCart = async () => {
3
+ console.log("[Mock] clearCart called");
4
+ resetMockCart();
5
+ return {
6
+ success: true,
7
+ timestamp: new Date().toISOString()
8
+ };
9
+ };
@@ -0,0 +1,2 @@
1
+ import { DeleteParkedOrder } from "./types";
2
+ export declare const mockDeleteParkedOrder: DeleteParkedOrder;
@@ -0,0 +1,8 @@
1
+ export const mockDeleteParkedOrder = async (params) => {
2
+ console.log("[Mock] deleteParkedOrder called", params);
3
+ return {
4
+ success: true,
5
+ orderId: params?.orderId || "",
6
+ timestamp: new Date().toISOString()
7
+ };
8
+ };
@@ -0,0 +1,2 @@
1
+ import { ExampleFunction } from "./types";
2
+ export declare const mockExampleFunction: ExampleFunction;
@@ -0,0 +1,13 @@
1
+ export const mockExampleFunction = async (params) => {
2
+ console.log("[Mock] exampleFunction called", params);
3
+ return {
4
+ receivedParams: params || {},
5
+ responsePayload: {
6
+ field1: "mock1",
7
+ field2: "mock2",
8
+ field3: "mock3"
9
+ },
10
+ timestamp: new Date().toISOString(),
11
+ processed: true
12
+ };
13
+ };
@@ -0,0 +1,2 @@
1
+ import { GetCategories } from "./types";
2
+ export declare const mockGetCategories: GetCategories;
@@ -0,0 +1,20 @@
1
+ import { MOCK_CATEGORIES, safeSerialize } from "../../demo/database";
2
+ export const mockGetCategories = async (params) => {
3
+ console.log("[Mock] getCategories called", params);
4
+ // Simple filter simulation
5
+ let categories = MOCK_CATEGORIES;
6
+ const query = params?.query || {};
7
+ if (query.name) {
8
+ const nameFilter = typeof query.name === 'string' ? query.name : '';
9
+ if (nameFilter) {
10
+ categories = categories.filter(c => c.name.toLowerCase().includes(nameFilter.toLowerCase()));
11
+ }
12
+ }
13
+ if (query.parentId !== undefined) {
14
+ categories = categories.filter(c => c.parentId === query.parentId);
15
+ }
16
+ return {
17
+ categories: safeSerialize(categories),
18
+ timestamp: new Date().toISOString()
19
+ };
20
+ };
@@ -1,3 +1,4 @@
1
+ import { CFCategory } from "../../CommonTypes";
1
2
  export interface GetCategoriesParams {
2
3
  query?: {
3
4
  name?: string | {
@@ -10,7 +11,7 @@ export interface GetCategoriesParams {
10
11
  };
11
12
  }
12
13
  export interface GetCategoriesResponse {
13
- categories: any[];
14
+ categories: CFCategory[];
14
15
  timestamp: string;
15
16
  }
16
17
  export type GetCategories = (params?: GetCategoriesParams) => Promise<GetCategoriesResponse>;
@@ -0,0 +1,2 @@
1
+ import { GetContext } from "./types";
2
+ export declare const mockGetContext: GetContext;
@@ -0,0 +1,24 @@
1
+ import { MOCK_COMPANY, MOCK_OUTLET, MOCK_STATION, MOCK_USER } from "../../demo/database";
2
+ export const mockGetContext = async () => {
3
+ console.log("[Mock] getContext called");
4
+ return {
5
+ userId: MOCK_USER.id,
6
+ companyId: MOCK_COMPANY.id || null,
7
+ companyName: MOCK_COMPANY.name || null,
8
+ deviceId: "mock_device_id",
9
+ stationId: MOCK_STATION._id,
10
+ stationName: MOCK_STATION.name,
11
+ outletId: MOCK_OUTLET.id,
12
+ outletName: MOCK_OUTLET.name || null,
13
+ buildId: "mock_build_id",
14
+ buildName: "Mock Build",
15
+ buildVersion: "1.0.0-mock",
16
+ buildSourceId: "mock_source_id",
17
+ buildIsPremium: true,
18
+ user: null,
19
+ company: null,
20
+ station: null,
21
+ outlet: null,
22
+ timestamp: new Date().toISOString()
23
+ };
24
+ };
@@ -1,21 +1,3 @@
1
- export interface GetContextResponse {
2
- userId: string | null;
3
- companyId: string | null;
4
- companyName: string | null;
5
- deviceId: string | null;
6
- stationId: string | null;
7
- stationName: string | null;
8
- outletId: string | null;
9
- outletName: string | null;
10
- buildId: string | null;
11
- buildName: string | null;
12
- buildVersion: string | null;
13
- buildSourceId: string | null;
14
- buildIsPremium: boolean;
15
- timestamp: string;
16
- user: Record<string, any> | null;
17
- company: Omit<Record<string, any>, 'settings'> | null;
18
- station: Record<string, any> | null;
19
- outlet: Record<string, any> | null;
20
- }
1
+ import { CFContext } from "../../CommonTypes";
2
+ export type GetContextResponse = CFContext;
21
3
  export type GetContext = () => Promise<GetContextResponse>;
@@ -0,0 +1,2 @@
1
+ import { GetCurrentCart } from "./types";
2
+ export declare const mockGetCurrentCart: GetCurrentCart;
@@ -0,0 +1,9 @@
1
+ import { MOCK_CART, safeSerialize } from "../../demo/database";
2
+ export const mockGetCurrentCart = async () => {
3
+ console.log("[Mock] getCurrentCart called");
4
+ return {
5
+ success: true,
6
+ cart: safeSerialize(MOCK_CART),
7
+ timestamp: new Date().toISOString()
8
+ };
9
+ };
@@ -1,6 +1,7 @@
1
+ import { CFActiveCart } from "../../CommonTypes";
1
2
  export interface GetCurrentCartResponse {
2
3
  success: boolean;
3
- cart: any;
4
+ cart: CFActiveCart;
4
5
  timestamp: string;
5
6
  }
6
7
  export type GetCurrentCart = () => Promise<GetCurrentCartResponse>;
@@ -0,0 +1,2 @@
1
+ import { GetCustomers } from "./types";
2
+ export declare const mockGetCustomers: GetCustomers;
@@ -0,0 +1,17 @@
1
+ import { MOCK_CUSTOMERS, safeSerialize } from "../../demo/database";
2
+ export const mockGetCustomers = async (params) => {
3
+ console.log("[Mock] getCustomers called", params);
4
+ let customers = MOCK_CUSTOMERS;
5
+ const query = params?.query || {};
6
+ if (query.searchValue) {
7
+ const search = String(query.searchValue).toLowerCase();
8
+ customers = customers.filter(c => c.firstName.toLowerCase().includes(search) ||
9
+ c.lastName.toLowerCase().includes(search) ||
10
+ c.email.toLowerCase().includes(search));
11
+ }
12
+ return {
13
+ customers: safeSerialize(customers),
14
+ total: customers.length,
15
+ timestamp: new Date().toISOString()
16
+ };
17
+ };
@@ -1,3 +1,4 @@
1
+ import { CFCustomer } from "../../CommonTypes";
1
2
  export interface GetCustomersParams {
2
3
  query?: {
3
4
  email?: string | {
@@ -24,7 +25,7 @@ export interface GetCustomersParams {
24
25
  };
25
26
  }
26
27
  export interface GetCustomersResponse {
27
- customers: any[];
28
+ customers: CFCustomer[];
28
29
  total?: number;
29
30
  timestamp: string;
30
31
  }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Get final context action
3
+ * Calls the getFinalContext action on the parent window
4
+ */
5
+ import type { GetFinalContext } from "./types";
6
+ export declare const getFinalContext: GetFinalContext;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Get final context action
3
+ * Calls the getFinalContext action on the parent window
4
+ */
5
+ import { commandFrameClient } from "../../client";
6
+ export const getFinalContext = async () => {
7
+ return await commandFrameClient.call("getFinalContext", undefined);
8
+ };
@@ -0,0 +1,4 @@
1
+ export interface GetFinalContextResponse {
2
+ projectName: string;
3
+ }
4
+ export type GetFinalContext = () => Promise<GetFinalContextResponse | null>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import { GetLineItemsByOrder } from "./types";
2
+ export declare const mockGetLineItemsByOrder: GetLineItemsByOrder;
@@ -0,0 +1,12 @@
1
+ export const mockGetLineItemsByOrder = async (params) => {
2
+ console.log("[Mock] getLineItemsByOrder called", params);
3
+ return {
4
+ success: true,
5
+ orderId: params?.orderId || "mock_order_id",
6
+ lineItems: [],
7
+ customSales: [],
8
+ remainingQuantities: {},
9
+ remainingCustomSalesQuantities: {},
10
+ timestamp: new Date().toISOString()
11
+ };
12
+ };
@@ -1,11 +1,12 @@
1
+ import { CFLineItem, CFCustomSale } from "../../CommonTypes";
1
2
  export interface GetLineItemsByOrderParams {
2
3
  orderId?: string;
3
4
  }
4
5
  export interface GetLineItemsByOrderResponse {
5
6
  success: boolean;
6
7
  orderId: string;
7
- lineItems: any[];
8
- customSales: any[];
8
+ lineItems: CFLineItem[];
9
+ customSales: CFCustomSale[];
9
10
  remainingQuantities: Record<string, number>;
10
11
  remainingCustomSalesQuantities: Record<string, number>;
11
12
  timestamp: string;
@@ -0,0 +1,2 @@
1
+ import { GetOrders } from "./types";
2
+ export declare const mockGetOrders: GetOrders;