@final-commerce/command-frame 0.1.11 → 0.1.13

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 (72) hide show
  1. package/README.md +7 -48
  2. package/dist/actions/add-custom-sale/mock.js +21 -1
  3. package/dist/actions/add-custom-sale/types.d.ts +1 -0
  4. package/dist/actions/add-customer/mock.js +1 -0
  5. package/dist/actions/add-customer-note/mock.js +13 -0
  6. package/dist/actions/add-order-note/mock.js +10 -0
  7. package/dist/actions/add-product-discount/mock.js +20 -1
  8. package/dist/actions/add-product-discount/types.d.ts +3 -2
  9. package/dist/actions/add-product-fee/mock.js +19 -1
  10. package/dist/actions/add-product-fee/types.d.ts +3 -2
  11. package/dist/actions/add-product-note/mock.js +12 -1
  12. package/dist/actions/add-product-note/types.d.ts +3 -3
  13. package/dist/actions/add-product-to-cart/types.d.ts +1 -0
  14. package/dist/actions/adjust-inventory/mock.js +26 -8
  15. package/dist/actions/adjust-inventory/types.d.ts +1 -0
  16. package/dist/actions/assign-customer/mock.js +1 -0
  17. package/dist/actions/cash-payment/action.js +5 -1
  18. package/dist/actions/cash-payment/mock.js +35 -3
  19. package/dist/actions/delete-parked-order/mock.js +7 -0
  20. package/dist/actions/initiate-refund/mock.js +1 -0
  21. package/dist/actions/open-cash-drawer/mock.js +1 -0
  22. package/dist/actions/park-order/mock.js +14 -2
  23. package/dist/actions/partial-payment/action.js +5 -1
  24. package/dist/actions/partial-payment/mock.js +7 -2
  25. package/dist/actions/remove-customer-from-cart/mock.js +1 -0
  26. package/dist/actions/resume-parked-order/mock.js +46 -2
  27. package/dist/actions/show-confirmation/mock.js +4 -1
  28. package/dist/actions/show-notification/mock.js +1 -0
  29. package/dist/actions/tap-to-pay-payment/mock.js +2 -0
  30. package/dist/actions/terminal-payment/mock.js +4 -2
  31. package/dist/demo/database.d.ts +1 -0
  32. package/dist/demo/database.js +1 -0
  33. package/dist/demo/registry.js +0 -12
  34. package/dist/index.d.ts +0 -12
  35. package/dist/index.js +0 -12
  36. package/package.json +1 -1
  37. package/dist/actions/get-line-items-by-order/action.d.ts +0 -6
  38. package/dist/actions/get-line-items-by-order/action.js +0 -8
  39. package/dist/actions/get-line-items-by-order/mock.d.ts +0 -2
  40. package/dist/actions/get-line-items-by-order/mock.js +0 -12
  41. package/dist/actions/get-line-items-by-order/types.d.ts +0 -15
  42. package/dist/actions/get-line-items-by-order/types.js +0 -1
  43. package/dist/actions/get-product-variants/action.d.ts +0 -6
  44. package/dist/actions/get-product-variants/action.js +0 -8
  45. package/dist/actions/get-product-variants/mock.d.ts +0 -2
  46. package/dist/actions/get-product-variants/mock.js +0 -14
  47. package/dist/actions/get-product-variants/types.d.ts +0 -10
  48. package/dist/actions/get-product-variants/types.js +0 -1
  49. package/dist/actions/go-to-page/action.d.ts +0 -6
  50. package/dist/actions/go-to-page/action.js +0 -8
  51. package/dist/actions/go-to-page/mock.d.ts +0 -2
  52. package/dist/actions/go-to-page/mock.js +0 -8
  53. package/dist/actions/go-to-page/types.d.ts +0 -9
  54. package/dist/actions/go-to-page/types.js +0 -1
  55. package/dist/actions/open-popup/action.d.ts +0 -6
  56. package/dist/actions/open-popup/action.js +0 -8
  57. package/dist/actions/open-popup/mock.d.ts +0 -2
  58. package/dist/actions/open-popup/mock.js +0 -8
  59. package/dist/actions/open-popup/types.d.ts +0 -9
  60. package/dist/actions/open-popup/types.js +0 -1
  61. package/dist/actions/toggle-slide-out/action.d.ts +0 -6
  62. package/dist/actions/toggle-slide-out/action.js +0 -8
  63. package/dist/actions/toggle-slide-out/mock.d.ts +0 -2
  64. package/dist/actions/toggle-slide-out/mock.js +0 -8
  65. package/dist/actions/toggle-slide-out/types.d.ts +0 -9
  66. package/dist/actions/toggle-slide-out/types.js +0 -1
  67. package/dist/actions/update-customer-facing-display/action.d.ts +0 -6
  68. package/dist/actions/update-customer-facing-display/action.js +0 -8
  69. package/dist/actions/update-customer-facing-display/mock.d.ts +0 -2
  70. package/dist/actions/update-customer-facing-display/mock.js +0 -8
  71. package/dist/actions/update-customer-facing-display/types.d.ts +0 -9
  72. package/dist/actions/update-customer-facing-display/types.js +0 -1
@@ -1,9 +1,53 @@
1
- import { MOCK_ORDERS } from "../../demo/database";
1
+ import { MOCK_PARKED_ORDERS, MOCK_CART, resetMockCart } from "../../demo/database";
2
2
  export const mockResumeParkedOrder = async (params) => {
3
3
  console.log("[Mock] resumeParkedOrder called", params);
4
+ const orderId = params?.orderId;
5
+ let orderToResume = null;
6
+ let index = -1;
7
+ if (orderId) {
8
+ index = MOCK_PARKED_ORDERS.findIndex(o => o._id === orderId);
9
+ if (index !== -1)
10
+ orderToResume = MOCK_PARKED_ORDERS[index];
11
+ }
12
+ else {
13
+ // Resume last if no ID
14
+ if (MOCK_PARKED_ORDERS.length > 0) {
15
+ index = MOCK_PARKED_ORDERS.length - 1;
16
+ orderToResume = MOCK_PARKED_ORDERS[index];
17
+ }
18
+ }
19
+ if (!orderToResume) {
20
+ throw new Error("Parked order not found");
21
+ }
22
+ // Restore to MOCK_CART
23
+ // Logic to convert Order back to Cart (simplified)
24
+ resetMockCart();
25
+ // Copy properties back
26
+ MOCK_CART.customer = orderToResume.customer; // Cast if needed
27
+ // MOCK_CART.products = orderToResume.lineItems... (Mapping needed)
28
+ // For Mock demo, we'll do a best effort mapping
29
+ MOCK_CART.products = orderToResume.lineItems.map(li => ({
30
+ id: li.productId,
31
+ name: li.name,
32
+ quantity: li.quantity,
33
+ price: parseFloat(li.price),
34
+ internalId: li.internalId || li.productId,
35
+ variantId: li.variantId,
36
+ sku: li.sku,
37
+ images: [li.image],
38
+ stock: 100,
39
+ taxTableId: "",
40
+ attributes: li.attributes
41
+ }));
42
+ MOCK_CART.subtotal = parseFloat(orderToResume.summary.subTotal);
43
+ MOCK_CART.total = parseFloat(orderToResume.summary.total);
44
+ MOCK_CART.amountToBeCharged = MOCK_CART.total;
45
+ MOCK_CART.remainingBalance = MOCK_CART.total;
46
+ // Remove from parked
47
+ MOCK_PARKED_ORDERS.splice(index, 1);
4
48
  return {
5
49
  success: true,
6
- order: MOCK_ORDERS[0],
50
+ order: orderToResume,
7
51
  timestamp: new Date().toISOString()
8
52
  };
9
53
  };
@@ -1,6 +1,9 @@
1
1
  export const mockShowConfirmation = async (params) => {
2
2
  console.log("[Mock] showConfirmation called", params);
3
- // Simulate user confirming
3
+ const confirmed = window.confirm(`Confirmation Required:\n${params?.message || "Are you sure?"}`);
4
+ if (!confirmed) {
5
+ throw new Error("User cancelled confirmation");
6
+ }
4
7
  return {
5
8
  success: true,
6
9
  message: params?.message || "",
@@ -1,5 +1,6 @@
1
1
  export const mockShowNotification = async (params) => {
2
2
  console.log("[Mock] showNotification called", params);
3
+ window.alert(`Notification: ${params?.message || "No message"}`);
3
4
  return {
4
5
  success: true,
5
6
  message: params?.message || "",
@@ -1,6 +1,8 @@
1
1
  import { MOCK_ORDERS } from "../../demo/database";
2
2
  export const mockTapToPayPayment = async (params) => {
3
3
  console.log("[Mock] tapToPayPayment called", params);
4
+ // Simulate Tap to Pay interaction
5
+ window.alert("Demo: Processing Tap to Pay...\n(Please tap card or device on screen)");
4
6
  return {
5
7
  success: true,
6
8
  amount: params?.amount || null,
@@ -1,7 +1,9 @@
1
- import { createOrderFromCart } from "../../demo/database";
1
+ import { createOrderFromCart, MOCK_CART } from "../../demo/database";
2
2
  export const mockTerminalPayment = async (params) => {
3
3
  console.log("[Mock] terminalPayment called", params);
4
- const amount = params?.amount || 0;
4
+ // Simulate terminal interaction
5
+ window.alert("Demo: Processing Terminal Payment...\n(Please tap, insert, or swipe card on terminal)");
6
+ const amount = params?.amount || MOCK_CART.total;
5
7
  // Mocking terminal payment success immediately
6
8
  const order = createOrderFromCart("card", amount, "stripe_terminal");
7
9
  return {
@@ -36,6 +36,7 @@ export declare const MOCK_CUSTOMERS: CFCustomer[];
36
36
  export declare const MOCK_CATEGORIES: CFCategory[];
37
37
  export declare const MOCK_PRODUCTS: CFProduct[];
38
38
  export declare const MOCK_ORDERS: CFActiveOrder[];
39
+ export declare const MOCK_PARKED_ORDERS: CFActiveOrder[];
39
40
  export declare const MOCK_USER: CFActiveUser;
40
41
  export declare const MOCK_STATION: CFActiveStation;
41
42
  export declare const MOCK_OUTLET: CFActiveOutlet;
@@ -403,6 +403,7 @@ export const MOCK_PRODUCTS = [
403
403
  MOCK_PRODUCT_ROASTED_TOMATO
404
404
  ];
405
405
  export const MOCK_ORDERS = [MOCK_ORDER_1, MOCK_ORDER_2];
406
+ export const MOCK_PARKED_ORDERS = [];
406
407
  // Compatibility Exports
407
408
  export const MOCK_USER = MOCK_USERS[0];
408
409
  export const MOCK_STATION = MOCK_STATIONS[0];
@@ -20,17 +20,13 @@ import { mockGetCategories } from "../actions/get-categories/mock";
20
20
  import { mockGetContext } from "../actions/get-context/mock";
21
21
  import { mockGetCurrentCart } from "../actions/get-current-cart/mock";
22
22
  import { mockGetCustomers } from "../actions/get-customers/mock";
23
- import { mockGetLineItemsByOrder } from "../actions/get-line-items-by-order/mock";
24
23
  import { mockGetOrders } from "../actions/get-orders/mock";
25
- import { mockGetProductVariants } from "../actions/get-product-variants/mock";
26
24
  import { mockGetProducts } from "../actions/get-products/mock";
27
25
  import { mockGetRefunds } from "../actions/get-refunds/mock";
28
26
  import { mockGetRemainingRefundableQuantities } from "../actions/get-remaining-refundable-quantities/mock";
29
- import { mockGoToPage } from "../actions/go-to-page/mock";
30
27
  import { mockGoToStationHome } from "../actions/go-to-station-home/mock";
31
28
  import { mockInitiateRefund } from "../actions/initiate-refund/mock";
32
29
  import { mockOpenCashDrawer } from "../actions/open-cash-drawer/mock";
33
- import { mockOpenPopup } from "../actions/open-popup/mock";
34
30
  import { mockParkOrder } from "../actions/park-order/mock";
35
31
  import { mockPartialPayment } from "../actions/partial-payment/mock";
36
32
  import { mockProcessPartialRefund } from "../actions/process-partial-refund/mock";
@@ -44,10 +40,8 @@ import { mockShowNotification } from "../actions/show-notification/mock";
44
40
  import { mockSwitchUser } from "../actions/switch-user/mock";
45
41
  import { mockTapToPayPayment } from "../actions/tap-to-pay-payment/mock";
46
42
  import { mockTerminalPayment } from "../actions/terminal-payment/mock";
47
- import { mockToggleSlideOut } from "../actions/toggle-slide-out/mock";
48
43
  import { mockTriggerWebhook } from "../actions/trigger-webhook/mock";
49
44
  import { mockTriggerZapierWebhook } from "../actions/trigger-zapier-webhook/mock";
50
- import { mockUpdateCustomerFacingDisplay } from "../actions/update-customer-facing-display/mock";
51
45
  import { mockVendaraPayment } from "../actions/vendara-payment/mock";
52
46
  import { mockGetFinalContext } from "../actions/get-final-context/mock";
53
47
  export const MOCK_REGISTRY = {
@@ -73,17 +67,13 @@ export const MOCK_REGISTRY = {
73
67
  "getContext": mockGetContext,
74
68
  "getCurrentCart": mockGetCurrentCart,
75
69
  "getCustomers": mockGetCustomers,
76
- "getLineItemsByOrder": mockGetLineItemsByOrder,
77
70
  "getOrders": mockGetOrders,
78
- "getProductVariants": mockGetProductVariants,
79
71
  "getProducts": mockGetProducts,
80
72
  "getRefunds": mockGetRefunds,
81
73
  "getRemainingRefundableQuantities": mockGetRemainingRefundableQuantities,
82
- "goToPage": mockGoToPage,
83
74
  "goToStationHome": mockGoToStationHome,
84
75
  "initiateRefund": mockInitiateRefund,
85
76
  "openCashDrawer": mockOpenCashDrawer,
86
- "openPopup": mockOpenPopup,
87
77
  "parkOrder": mockParkOrder,
88
78
  "partialPayment": mockPartialPayment,
89
79
  "processPartialRefund": mockProcessPartialRefund,
@@ -97,10 +87,8 @@ export const MOCK_REGISTRY = {
97
87
  "switchUser": mockSwitchUser,
98
88
  "tapToPayPayment": mockTapToPayPayment,
99
89
  "terminalPayment": mockTerminalPayment,
100
- "toggleSlideOut": mockToggleSlideOut,
101
90
  "triggerWebhook": mockTriggerWebhook,
102
91
  "triggerZapierWebhook": mockTriggerZapierWebhook,
103
- "updateCustomerFacingDisplay": mockUpdateCustomerFacingDisplay,
104
92
  "vendaraPayment": mockVendaraPayment,
105
93
  "getFinalContext": mockGetFinalContext,
106
94
  };
package/dist/index.d.ts CHANGED
@@ -6,7 +6,6 @@ export declare const command: {
6
6
  readonly assignCustomer: import("./actions/assign-customer/types").AssignCustomer;
7
7
  readonly addCustomer: import("./actions/add-customer/types").AddCustomer;
8
8
  readonly getCategories: import("./actions/get-categories/types").GetCategories;
9
- readonly getProductVariants: import("./actions/get-product-variants/types").GetProductVariants;
10
9
  readonly getOrders: import("./actions/get-orders/types").GetOrders;
11
10
  readonly getRefunds: import("./actions/get-refunds/types").GetRefunds;
12
11
  readonly addProductDiscount: import("./actions/add-product-discount/types").AddProductDiscount;
@@ -31,19 +30,14 @@ export declare const command: {
31
30
  readonly addCustomerNote: import("./actions/add-customer-note/types").AddCustomerNote;
32
31
  readonly removeCustomerFromCart: import("./actions/remove-customer-from-cart/types").RemoveCustomerFromCart;
33
32
  readonly goToStationHome: import("./actions/go-to-station-home/types").GoToStationHome;
34
- readonly goToPage: import("./actions/go-to-page/types").GoToPage;
35
33
  readonly openCashDrawer: import("./actions/open-cash-drawer/types").OpenCashDrawer;
36
- readonly openPopup: import("./actions/open-popup/types").OpenPopup;
37
34
  readonly showNotification: import("./actions/show-notification/types").ShowNotification;
38
- readonly toggleSlideOut: import("./actions/toggle-slide-out/types").ToggleSlideOut;
39
35
  readonly showConfirmation: import("./actions/show-confirmation/types").ShowConfirmation;
40
36
  readonly authenticateUser: import("./actions/authenticate-user/types").AuthenticateUser;
41
- readonly updateCustomerFacingDisplay: import("./actions/update-customer-facing-display/types").UpdateCustomerFacingDisplay;
42
37
  readonly partialPayment: import("./actions/partial-payment/types").PartialPayment;
43
38
  readonly switchUser: import("./actions/switch-user/types").SwitchUser;
44
39
  readonly triggerWebhook: import("./actions/trigger-webhook/types").TriggerWebhook;
45
40
  readonly triggerZapierWebhook: import("./actions/trigger-zapier-webhook/types").TriggerZapierWebhook;
46
- readonly getLineItemsByOrder: import("./actions/get-line-items-by-order/types").GetLineItemsByOrder;
47
41
  readonly setRefundStockAction: import("./actions/set-refund-stock-action/types").SetRefundStockAction;
48
42
  readonly selectAllRefundItems: import("./actions/select-all-refund-items/types").SelectAllRefundItems;
49
43
  readonly resetRefundDetails: import("./actions/reset-refund-details/types").ResetRefundDetails;
@@ -59,10 +53,8 @@ export type { GetCustomers, GetCustomersParams, GetCustomersResponse } from "./a
59
53
  export type { AssignCustomer, AssignCustomerParams, AssignCustomerResponse } from "./actions/assign-customer/types";
60
54
  export type { AddCustomer, AddCustomerParams, AddCustomerResponse } from "./actions/add-customer/types";
61
55
  export type { GetCategories, GetCategoriesParams, GetCategoriesResponse } from "./actions/get-categories/types";
62
- export type { GetProductVariants, GetProductVariantsParams, GetProductVariantsResponse } from "./actions/get-product-variants/types";
63
56
  export type { GetOrders, GetOrdersParams, GetOrdersResponse } from "./actions/get-orders/types";
64
57
  export type { GetRefunds, GetRefundsParams, GetRefundsResponse } from "./actions/get-refunds/types";
65
- export type { GetLineItemsByOrder, GetLineItemsByOrderParams, GetLineItemsByOrderResponse } from "./actions/get-line-items-by-order/types";
66
58
  export type { SetRefundStockAction, SetRefundStockActionParams, SetRefundStockActionResponse } from "./actions/set-refund-stock-action/types";
67
59
  export type { SelectAllRefundItems, SelectAllRefundItemsParams, SelectAllRefundItemsResponse } from "./actions/select-all-refund-items/types";
68
60
  export type { ResetRefundDetails, ResetRefundDetailsResponse } from "./actions/reset-refund-details/types";
@@ -92,14 +84,10 @@ export type { VendaraPayment, VendaraPaymentParams, VendaraPaymentResponse } fro
92
84
  export type { AddCustomerNote, AddCustomerNoteParams, AddCustomerNoteResponse } from "./actions/add-customer-note/types";
93
85
  export type { RemoveCustomerFromCart, RemoveCustomerFromCartResponse } from "./actions/remove-customer-from-cart/types";
94
86
  export type { GoToStationHome, GoToStationHomeResponse } from "./actions/go-to-station-home/types";
95
- export type { GoToPage, GoToPageParams, GoToPageResponse } from "./actions/go-to-page/types";
96
87
  export type { OpenCashDrawer, OpenCashDrawerResponse } from "./actions/open-cash-drawer/types";
97
- export type { OpenPopup, OpenPopupParams, OpenPopupResponse } from "./actions/open-popup/types";
98
88
  export type { ShowNotification, ShowNotificationParams, ShowNotificationResponse } from "./actions/show-notification/types";
99
- export type { ToggleSlideOut, ToggleSlideOutParams, ToggleSlideOutResponse } from "./actions/toggle-slide-out/types";
100
89
  export type { ShowConfirmation, ShowConfirmationParams, ShowConfirmationResponse } from "./actions/show-confirmation/types";
101
90
  export type { AuthenticateUser, AuthenticateUserParams, AuthenticateUserResponse } from "./actions/authenticate-user/types";
102
- export type { UpdateCustomerFacingDisplay, UpdateCustomerFacingDisplayParams, UpdateCustomerFacingDisplayResponse } from "./actions/update-customer-facing-display/types";
103
91
  export type { PartialPayment, PartialPaymentParams, PartialPaymentResponse } from "./actions/partial-payment/types";
104
92
  export type { SwitchUser, SwitchUserParams, SwitchUserResponse } from "./actions/switch-user/types";
105
93
  export type { TriggerWebhook, TriggerWebhookPresetType, TriggerWebhookParams, TriggerWebhookResponse } from "./actions/trigger-webhook/types";
package/dist/index.js CHANGED
@@ -6,7 +6,6 @@ import { getCustomers } from "./actions/get-customers/action";
6
6
  import { assignCustomer } from "./actions/assign-customer/action";
7
7
  import { addCustomer } from "./actions/add-customer/action";
8
8
  import { getCategories } from "./actions/get-categories/action";
9
- import { getProductVariants } from "./actions/get-product-variants/action";
10
9
  import { getOrders } from "./actions/get-orders/action";
11
10
  import { getRefunds } from "./actions/get-refunds/action";
12
11
  import { addCartDiscount } from "./actions/add-cart-discount/action";
@@ -35,20 +34,15 @@ import { addCustomerNote } from "./actions/add-customer-note/action";
35
34
  import { removeCustomerFromCart } from "./actions/remove-customer-from-cart/action";
36
35
  // System Actions
37
36
  import { goToStationHome } from "./actions/go-to-station-home/action";
38
- import { goToPage } from "./actions/go-to-page/action";
39
37
  import { openCashDrawer } from "./actions/open-cash-drawer/action";
40
- import { openPopup } from "./actions/open-popup/action";
41
38
  import { showNotification } from "./actions/show-notification/action";
42
- import { toggleSlideOut } from "./actions/toggle-slide-out/action";
43
39
  import { showConfirmation } from "./actions/show-confirmation/action";
44
40
  import { authenticateUser } from "./actions/authenticate-user/action";
45
- import { updateCustomerFacingDisplay } from "./actions/update-customer-facing-display/action";
46
41
  import { partialPayment } from "./actions/partial-payment/action";
47
42
  import { switchUser } from "./actions/switch-user/action";
48
43
  // Integration Actions
49
44
  import { triggerWebhook } from "./actions/trigger-webhook/action";
50
45
  import { triggerZapierWebhook } from "./actions/trigger-zapier-webhook/action";
51
- import { getLineItemsByOrder } from "./actions/get-line-items-by-order/action";
52
46
  import { setRefundStockAction } from "./actions/set-refund-stock-action/action";
53
47
  import { selectAllRefundItems } from "./actions/select-all-refund-items/action";
54
48
  import { resetRefundDetails } from "./actions/reset-refund-details/action";
@@ -65,7 +59,6 @@ export const command = {
65
59
  assignCustomer,
66
60
  addCustomer,
67
61
  getCategories,
68
- getProductVariants,
69
62
  getOrders,
70
63
  getRefunds,
71
64
  addProductDiscount,
@@ -94,21 +87,16 @@ export const command = {
94
87
  removeCustomerFromCart,
95
88
  // System Actions
96
89
  goToStationHome,
97
- goToPage,
98
90
  openCashDrawer,
99
- openPopup,
100
91
  showNotification,
101
- toggleSlideOut,
102
92
  showConfirmation,
103
93
  authenticateUser,
104
- updateCustomerFacingDisplay,
105
94
  partialPayment,
106
95
  switchUser,
107
96
  // Integration Actions
108
97
  triggerWebhook,
109
98
  triggerZapierWebhook,
110
99
  // Refund Actions
111
- getLineItemsByOrder,
112
100
  setRefundStockAction,
113
101
  selectAllRefundItems,
114
102
  resetRefundDetails,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@final-commerce/command-frame",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "Commands Frame library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,6 +0,0 @@
1
- /**
2
- * Get line items by order action
3
- * Calls the getLineItemsByOrder action on the parent window
4
- */
5
- import type { GetLineItemsByOrder } from "./types";
6
- export declare const getLineItemsByOrder: GetLineItemsByOrder;
@@ -1,8 +0,0 @@
1
- /**
2
- * Get line items by order action
3
- * Calls the getLineItemsByOrder action on the parent window
4
- */
5
- import { commandFrameClient } from "../../client";
6
- export const getLineItemsByOrder = async (params) => {
7
- return await commandFrameClient.call("getLineItemsByOrder", params);
8
- };
@@ -1,2 +0,0 @@
1
- import { GetLineItemsByOrder } from "./types";
2
- export declare const mockGetLineItemsByOrder: GetLineItemsByOrder;
@@ -1,12 +0,0 @@
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,15 +0,0 @@
1
- import { CFLineItem, CFCustomSale } from "../../CommonTypes";
2
- export interface GetLineItemsByOrderParams {
3
- /** If not provided, uses the currently active order. */
4
- orderId?: string;
5
- }
6
- export interface GetLineItemsByOrderResponse {
7
- success: boolean;
8
- orderId: string;
9
- lineItems: CFLineItem[];
10
- customSales: CFCustomSale[];
11
- remainingQuantities: Record<string, number>;
12
- remainingCustomSalesQuantities: Record<string, number>;
13
- timestamp: string;
14
- }
15
- export type GetLineItemsByOrder = (params?: GetLineItemsByOrderParams) => Promise<GetLineItemsByOrderResponse>;
@@ -1 +0,0 @@
1
- export {};
@@ -1,6 +0,0 @@
1
- /**
2
- * Get product variants action
3
- * Calls the getProductVariants action on the parent window
4
- */
5
- import type { GetProductVariants } from "./types";
6
- export declare const getProductVariants: GetProductVariants;
@@ -1,8 +0,0 @@
1
- /**
2
- * Get product variants action
3
- * Calls the getProductVariants action on the parent window
4
- */
5
- import { commandFrameClient } from "../../client";
6
- export const getProductVariants = async (params) => {
7
- return await commandFrameClient.call("getProductVariants", params);
8
- };
@@ -1,2 +0,0 @@
1
- import { GetProductVariants } from "./types";
2
- export declare const mockGetProductVariants: GetProductVariants;
@@ -1,14 +0,0 @@
1
- import { MOCK_PRODUCTS, safeSerialize } from "../../demo/database";
2
- export const mockGetProductVariants = async (params) => {
3
- console.log("[Mock] getProductVariants called", params);
4
- if (!params?.productId) {
5
- throw new Error("productId is required");
6
- }
7
- const product = MOCK_PRODUCTS.find(p => p._id === params.productId);
8
- const variants = product ? product.variants : [];
9
- return {
10
- variants: safeSerialize(variants),
11
- productId: params.productId,
12
- timestamp: new Date().toISOString()
13
- };
14
- };
@@ -1,10 +0,0 @@
1
- import { CFProductVariant } from "../../CommonTypes";
2
- export interface GetProductVariantsParams {
3
- productId: string;
4
- }
5
- export interface GetProductVariantsResponse {
6
- variants: CFProductVariant[];
7
- productId: string;
8
- timestamp: string;
9
- }
10
- export type GetProductVariants = (params?: GetProductVariantsParams) => Promise<GetProductVariantsResponse>;
@@ -1 +0,0 @@
1
- export {};
@@ -1,6 +0,0 @@
1
- /**
2
- * Go to page action
3
- * Calls the goToPage action on the parent window
4
- */
5
- import type { GoToPage } from "./types";
6
- export declare const goToPage: GoToPage;
@@ -1,8 +0,0 @@
1
- /**
2
- * Go to page action
3
- * Calls the goToPage action on the parent window
4
- */
5
- import { commandFrameClient } from "../../client";
6
- export const goToPage = async (params) => {
7
- return await commandFrameClient.call("goToPage", params);
8
- };
@@ -1,2 +0,0 @@
1
- import { GoToPage } from "./types";
2
- export declare const mockGoToPage: GoToPage;
@@ -1,8 +0,0 @@
1
- export const mockGoToPage = async (params) => {
2
- console.log("[Mock] goToPage called", params);
3
- return {
4
- success: true,
5
- pageId: params?.pageId || "home",
6
- timestamp: new Date().toISOString()
7
- };
8
- };
@@ -1,9 +0,0 @@
1
- export interface GoToPageParams {
2
- pageId: string;
3
- }
4
- export interface GoToPageResponse {
5
- success: boolean;
6
- pageId: string;
7
- timestamp: string;
8
- }
9
- export type GoToPage = (params?: GoToPageParams) => Promise<GoToPageResponse>;
@@ -1 +0,0 @@
1
- export {};
@@ -1,6 +0,0 @@
1
- /**
2
- * Open popup action
3
- * Calls the openPopup action on the parent window
4
- */
5
- import type { OpenPopup } from "./types";
6
- export declare const openPopup: OpenPopup;
@@ -1,8 +0,0 @@
1
- /**
2
- * Open popup action
3
- * Calls the openPopup action on the parent window
4
- */
5
- import { commandFrameClient } from "../../client";
6
- export const openPopup = async (params) => {
7
- return await commandFrameClient.call("openPopup", params);
8
- };
@@ -1,2 +0,0 @@
1
- import { OpenPopup } from "./types";
2
- export declare const mockOpenPopup: OpenPopup;
@@ -1,8 +0,0 @@
1
- export const mockOpenPopup = async (params) => {
2
- console.log("[Mock] openPopup called", params);
3
- return {
4
- success: true,
5
- popupId: params?.popupId || "",
6
- timestamp: new Date().toISOString()
7
- };
8
- };
@@ -1,9 +0,0 @@
1
- export interface OpenPopupParams {
2
- popupId: string;
3
- }
4
- export interface OpenPopupResponse {
5
- success: boolean;
6
- popupId: string;
7
- timestamp: string;
8
- }
9
- export type OpenPopup = (params?: OpenPopupParams) => Promise<OpenPopupResponse>;
@@ -1 +0,0 @@
1
- export {};
@@ -1,6 +0,0 @@
1
- /**
2
- * Toggle slide out action
3
- * Calls the toggleSlideOut action on the parent window
4
- */
5
- import type { ToggleSlideOut } from "./types";
6
- export declare const toggleSlideOut: ToggleSlideOut;
@@ -1,8 +0,0 @@
1
- /**
2
- * Toggle slide out action
3
- * Calls the toggleSlideOut action on the parent window
4
- */
5
- import { commandFrameClient } from "../../client";
6
- export const toggleSlideOut = async (params) => {
7
- return await commandFrameClient.call("toggleSlideOut", params);
8
- };
@@ -1,2 +0,0 @@
1
- import { ToggleSlideOut } from "./types";
2
- export declare const mockToggleSlideOut: ToggleSlideOut;
@@ -1,8 +0,0 @@
1
- export const mockToggleSlideOut = async (params) => {
2
- console.log("[Mock] toggleSlideOut called", params);
3
- return {
4
- success: true,
5
- slideOutId: params?.slideOutId || "",
6
- timestamp: new Date().toISOString()
7
- };
8
- };
@@ -1,9 +0,0 @@
1
- export interface ToggleSlideOutParams {
2
- slideOutId: string;
3
- }
4
- export interface ToggleSlideOutResponse {
5
- success: boolean;
6
- slideOutId: string;
7
- timestamp: string;
8
- }
9
- export type ToggleSlideOut = (params?: ToggleSlideOutParams) => Promise<ToggleSlideOutResponse>;
@@ -1 +0,0 @@
1
- export {};
@@ -1,6 +0,0 @@
1
- /**
2
- * Update customer facing display action
3
- * Calls the updateCustomerFacingDisplay action on the parent window
4
- */
5
- import type { UpdateCustomerFacingDisplay } from "./types";
6
- export declare const updateCustomerFacingDisplay: UpdateCustomerFacingDisplay;
@@ -1,8 +0,0 @@
1
- /**
2
- * Update customer facing display action
3
- * Calls the updateCustomerFacingDisplay action on the parent window
4
- */
5
- import { commandFrameClient } from "../../client";
6
- export const updateCustomerFacingDisplay = async (params) => {
7
- return await commandFrameClient.call("updateCustomerFacingDisplay", params);
8
- };
@@ -1,2 +0,0 @@
1
- import { UpdateCustomerFacingDisplay } from "./types";
2
- export declare const mockUpdateCustomerFacingDisplay: UpdateCustomerFacingDisplay;
@@ -1,8 +0,0 @@
1
- export const mockUpdateCustomerFacingDisplay = async (params) => {
2
- console.log("[Mock] updateCustomerFacingDisplay called", params);
3
- return {
4
- success: true,
5
- pageId: params?.pageId || "",
6
- timestamp: new Date().toISOString()
7
- };
8
- };
@@ -1,9 +0,0 @@
1
- export interface UpdateCustomerFacingDisplayParams {
2
- pageId: string;
3
- }
4
- export interface UpdateCustomerFacingDisplayResponse {
5
- success: boolean;
6
- pageId: string;
7
- timestamp: string;
8
- }
9
- export type UpdateCustomerFacingDisplay = (params?: UpdateCustomerFacingDisplayParams) => Promise<UpdateCustomerFacingDisplayResponse>;
@@ -1 +0,0 @@
1
- export {};