@final-commerce/command-frame 0.1.72 → 0.1.73

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.
@@ -715,3 +715,22 @@ export interface CFContextManage {
715
715
  timestamp: string;
716
716
  }
717
717
  export type CFContext = CFContextRender;
718
+ export type CFTileType = "empty" | "product" | "action" | "category" | "folder" | "back";
719
+ export interface CFTileCell {
720
+ index: number;
721
+ type: CFTileType;
722
+ entityId?: string;
723
+ entityData?: Record<string, unknown>;
724
+ }
725
+ export interface CFSmartGridLayout {
726
+ gridId: string;
727
+ cells: CFTileCell[];
728
+ /** Operator-editable display name for this grid. When absent, consumers
729
+ * should fall back to a placeholder (e.g. "Smart Grid"). */
730
+ name?: string;
731
+ /** Cells inside operator-created folders, keyed by the folder tile's
732
+ * entityId. Each folder owns its own dense cell array (indices 0..N-1)
733
+ * and may contain further folder tiles for arbitrary nesting. Absent or
734
+ * empty when no folders exist. */
735
+ folders?: Record<string, CFTileCell[]>;
736
+ }
@@ -0,0 +1,2 @@
1
+ import type { GetSmartGridLayout } from "./types";
2
+ export declare const getSmartGridLayout: GetSmartGridLayout;
@@ -0,0 +1,4 @@
1
+ import { commandFrameClient } from "../../client";
2
+ export const getSmartGridLayout = async (params) => {
3
+ return await commandFrameClient.call("getSmartGridLayout", params);
4
+ };
@@ -0,0 +1,2 @@
1
+ import { GetSmartGridLayout } from "./types";
2
+ export declare const mockGetSmartGridLayout: GetSmartGridLayout;
@@ -0,0 +1,9 @@
1
+ import { MOCK_SMART_GRID_LAYOUTS } from "../../demo/database";
2
+ export const mockGetSmartGridLayout = (params) => {
3
+ console.log("[Mock] getSmartGridLayout called", params);
4
+ return Promise.resolve({
5
+ success: true,
6
+ layout: MOCK_SMART_GRID_LAYOUTS[params.gridId] ?? null,
7
+ timestamp: new Date().toISOString()
8
+ });
9
+ };
@@ -0,0 +1,10 @@
1
+ import { CFSmartGridLayout } from "../../CommonTypes";
2
+ export interface GetSmartGridLayoutParams {
3
+ gridId: string;
4
+ }
5
+ export interface GetSmartGridLayoutResponse {
6
+ success: boolean;
7
+ layout: CFSmartGridLayout | null;
8
+ timestamp: string;
9
+ }
10
+ export type GetSmartGridLayout = (params: GetSmartGridLayoutParams) => Promise<GetSmartGridLayoutResponse>;
@@ -0,0 +1 @@
1
+ export {};
@@ -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 { SaveSmartGridLayout } from "./types";
2
+ export declare const mockSaveSmartGridLayout: SaveSmartGridLayout;
@@ -0,0 +1,10 @@
1
+ import { MOCK_SMART_GRID_LAYOUTS } from "../../demo/database";
2
+ export const mockSaveSmartGridLayout = (params) => {
3
+ console.log("[Mock] saveSmartGridLayout called", params);
4
+ MOCK_SMART_GRID_LAYOUTS[params.layout.gridId] = params.layout;
5
+ return Promise.resolve({
6
+ success: true,
7
+ gridId: params.layout.gridId,
8
+ timestamp: new Date().toISOString()
9
+ });
10
+ };
@@ -0,0 +1,10 @@
1
+ import { CFSmartGridLayout } from "../../CommonTypes";
2
+ export interface SaveSmartGridLayoutParams {
3
+ layout: CFSmartGridLayout;
4
+ }
5
+ export interface SaveSmartGridLayoutResponse {
6
+ success: boolean;
7
+ gridId: string;
8
+ timestamp: string;
9
+ }
10
+ export type SaveSmartGridLayout = (params: SaveSmartGridLayoutParams) => Promise<SaveSmartGridLayoutResponse>;
@@ -0,0 +1 @@
1
+ export {};
@@ -2,7 +2,7 @@
2
2
  * Mock Database for Standalone/Demo Mode
3
3
  * Stores mock data that mimics the Render environment
4
4
  */
5
- import { CFActiveCompany, CFActiveUser, CFActiveStation, CFActiveOutlet, CFActiveOrder, CFCustomer, CFProduct, CFActiveCart, CFCategory, CFActiveProduct, CFSession, CFActiveRefundDetails } from "../CommonTypes";
5
+ import { CFActiveCompany, CFActiveUser, CFActiveStation, CFActiveOutlet, CFActiveOrder, CFCustomer, CFProduct, CFActiveCart, CFCategory, CFActiveProduct, CFSession, CFActiveRefundDetails, CFSmartGridLayout } from "../CommonTypes";
6
6
  export * from "./mocks";
7
7
  /** Replace mock catalog / context data in place (same array references mock handlers use). */
8
8
  export interface MockDatabaseConfig {
@@ -64,6 +64,7 @@ export declare let MOCK_OUTLET: CFActiveOutlet;
64
64
  export declare let MOCK_CART: CFActiveCart;
65
65
  export declare let MOCK_ACTIVE_PRODUCT: CFActiveProduct;
66
66
  export declare const setMockActiveProduct: (activeProduct: CFActiveProduct) => void;
67
+ export declare const MOCK_SMART_GRID_LAYOUTS: Record<string, CFSmartGridLayout>;
67
68
  export declare const resetMockCart: () => void;
68
69
  /**
69
70
  * Replace in-memory mock data used by default mock handlers. Arrays are mutated in place
@@ -463,6 +463,10 @@ export let MOCK_ACTIVE_PRODUCT;
463
463
  export const setMockActiveProduct = (activeProduct) => {
464
464
  MOCK_ACTIVE_PRODUCT = activeProduct;
465
465
  };
466
+ // In-memory smart-grid layouts keyed by gridId. Used by mockGetSmartGridLayout /
467
+ // mockSaveSmartGridLayout so the standalone builder (no command-frame host) can
468
+ // round-trip layouts within a session.
469
+ export const MOCK_SMART_GRID_LAYOUTS = {};
466
470
  // Helper to reset cart
467
471
  export const resetMockCart = () => {
468
472
  MOCK_CART = {
package/dist/index.d.ts CHANGED
@@ -86,6 +86,8 @@ export declare const command: {
86
86
  readonly deleteProduct: import("./actions/delete-product/types").DeleteProduct;
87
87
  readonly getOutlets: import("./actions/get-outlets/types").GetOutlets;
88
88
  readonly getStations: import("./actions/get-stations/types").GetStations;
89
+ readonly getSmartGridLayout: import("./actions/get-smart-grid-layout/types").GetSmartGridLayout;
90
+ readonly saveSmartGridLayout: import("./actions/save-smart-grid-layout/types").SaveSmartGridLayout;
89
91
  readonly getCustomTables: import("./actions/get-custom-tables/types").GetCustomTables;
90
92
  readonly getCustomTableFields: import("./actions/get-custom-table-fields/types").GetCustomTableFields;
91
93
  readonly getCustomTableData: import("./actions/get-custom-table-data/types").GetCustomTableData;
@@ -122,6 +124,8 @@ export type { EditProductVariants, EditProductVariantsParams, EditProductVariant
122
124
  export type { DeleteProduct, DeleteProductParams, DeleteProductResponse } from "./actions/delete-product/types";
123
125
  export type { GetOutlets, GetOutletsResponse } from "./actions/get-outlets/types";
124
126
  export type { GetStations, GetStationsParams, GetStationsResponse } from "./actions/get-stations/types";
127
+ export type { GetSmartGridLayout, GetSmartGridLayoutParams, GetSmartGridLayoutResponse } from "./actions/get-smart-grid-layout/types";
128
+ export type { SaveSmartGridLayout, SaveSmartGridLayoutParams, SaveSmartGridLayoutResponse } from "./actions/save-smart-grid-layout/types";
125
129
  export type { GetOrders, GetOrdersParams, GetOrdersResponse } from "./actions/get-orders/types";
126
130
  export type { GetRefunds, GetRefundsParams, GetRefundsResponse } from "./actions/get-refunds/types";
127
131
  export type { SetRefundStockAction, SetRefundStockActionParams, SetRefundStockActionResponse } from "./actions/set-refund-stock-action/types";
package/dist/index.js CHANGED
@@ -111,6 +111,9 @@ import { deleteProduct } from "./actions/delete-product/action";
111
111
  // Entity Actions
112
112
  import { getOutlets } from "./actions/get-outlets/action";
113
113
  import { getStations } from "./actions/get-stations/action";
114
+ // SmartGrid Actions
115
+ import { getSmartGridLayout } from "./actions/get-smart-grid-layout/action";
116
+ import { saveSmartGridLayout } from "./actions/save-smart-grid-layout/action";
114
117
  // Manage extension actions (optional hosts: Deerlake, etc.)
115
118
  import { navigateTo } from "./actions/navigate-to/action";
116
119
  import { refreshResource } from "./actions/refresh-resource/action";
@@ -216,6 +219,9 @@ export const command = {
216
219
  // Entity Actions
217
220
  getOutlets,
218
221
  getStations,
222
+ // SmartGrid Actions
223
+ getSmartGridLayout,
224
+ saveSmartGridLayout,
219
225
  // Custom Tables Actions
220
226
  getCustomTables,
221
227
  getCustomTableFields,
@@ -86,6 +86,8 @@ import { mockSetActiveSession } from "../../actions/set-active-session/mock";
86
86
  import { mockGetActiveUser } from "../../actions/get-active-user/mock";
87
87
  import { mockSetActiveUser } from "../../actions/set-active-user/mock";
88
88
  import { mockSetActiveRefund } from "../../actions/set-active-refund/mock";
89
+ import { mockGetSmartGridLayout } from "../../actions/get-smart-grid-layout/mock";
90
+ import { mockSaveSmartGridLayout } from "../../actions/save-smart-grid-layout/mock";
89
91
  export const RENDER_MOCKS = {
90
92
  addCartDiscount: mockAddCartDiscount,
91
93
  addCartFee: mockAddCartFee,
@@ -180,5 +182,7 @@ export const RENDER_MOCKS = {
180
182
  removeCartFee: mockRemoveCartFee,
181
183
  removeOrderNote: () => Promise.resolve({ success: true, timestamp: new Date().toISOString() }),
182
184
  removeCustomSale: params => Promise.resolve({ success: true, id: params.id, timestamp: new Date().toISOString() }),
183
- removeNonRevenueItem: params => Promise.resolve({ success: true, externalId: params.externalId, timestamp: new Date().toISOString() })
185
+ removeNonRevenueItem: params => Promise.resolve({ success: true, externalId: params.externalId, timestamp: new Date().toISOString() }),
186
+ getSmartGridLayout: mockGetSmartGridLayout,
187
+ saveSmartGridLayout: mockSaveSmartGridLayout
184
188
  };
@@ -1,4 +1,4 @@
1
- import type { ExampleFunction, GetProducts, AddCustomSale, GetCustomers, AssignCustomer, AddCustomer, EditCustomer, GetCategories, GetOrders, GetRefunds, GetTaxTables, AddProductDiscount, AddProductToCart, RemoveProductFromCart, UpdateCartItemQuantity, AddCartDiscount, GetContext, GetFinalContext, AddProductNote, AddProductFee, SetActiveProductFee, SetActiveProductDiscount, GetActiveProduct, SetActiveProduct, AdjustInventory, AddOrderNote, AddCartFee, ClearCart, ParkOrder, ResumeParkedOrder, DeleteParkedOrder, InitiateRefund, CashPayment, TapToPayPayment, TerminalPayment, VendaraPayment, ExtensionPayment, RedeemPayment, AddNonRevenueItem, AddCustomerNote, RemoveCustomerNote, RemoveCustomerFromCart, GoToStationHome, OpenCashDrawer, ShowNotification, ShowConfirmation, AuthenticateUser, PartialPayment, SwitchUser, TriggerWebhook, TriggerZapierWebhook, SetRefundStockAction, SelectAllRefundItems, ResetRefundDetails, CalculateRefundTotal, GetRemainingRefundableQuantities, ProcessPartialRefund, GetCurrentCart, Print, SetActiveOrder, GetCustomTables, GetCustomTableData, UpsertCustomTableData, DeleteCustomTableData, GetCustomExtensions, GetCurrentCompanyCustomExtensions, GetCustomExtensionCustomTables, GetCustomTableFields, GetSecretsKeys, GetSecretVal, SetSecretVal, GetUsers, GetRoles, RemoveCartDiscount, GetActiveOrder, GetActiveCustomer, SetActiveCustomer, GetActiveOutlet, SetActiveOutlet, GetActiveStation, SetActiveStation, GetActiveSession, SetActiveSession, GetActiveUser, SetActiveUser, SetActiveRefund, RemoveProductDiscount, RemoveProductFee, RemoveProductNote, RemoveCartFee, RemoveOrderNote, RemoveCustomSale, RemoveNonRevenueItem, IntegrationPayment } from "../../index";
1
+ import type { ExampleFunction, GetProducts, AddCustomSale, GetCustomers, AssignCustomer, AddCustomer, EditCustomer, GetCategories, GetOrders, GetRefunds, GetTaxTables, AddProductDiscount, AddProductToCart, RemoveProductFromCart, UpdateCartItemQuantity, AddCartDiscount, GetContext, GetFinalContext, AddProductNote, AddProductFee, SetActiveProductFee, SetActiveProductDiscount, GetActiveProduct, SetActiveProduct, AdjustInventory, AddOrderNote, AddCartFee, ClearCart, ParkOrder, ResumeParkedOrder, DeleteParkedOrder, InitiateRefund, CashPayment, TapToPayPayment, TerminalPayment, VendaraPayment, ExtensionPayment, RedeemPayment, AddNonRevenueItem, AddCustomerNote, RemoveCustomerNote, RemoveCustomerFromCart, GoToStationHome, OpenCashDrawer, ShowNotification, ShowConfirmation, AuthenticateUser, PartialPayment, SwitchUser, TriggerWebhook, TriggerZapierWebhook, SetRefundStockAction, SelectAllRefundItems, ResetRefundDetails, CalculateRefundTotal, GetRemainingRefundableQuantities, ProcessPartialRefund, GetCurrentCart, Print, SetActiveOrder, GetCustomTables, GetCustomTableData, UpsertCustomTableData, DeleteCustomTableData, GetCustomExtensions, GetCurrentCompanyCustomExtensions, GetCustomExtensionCustomTables, GetCustomTableFields, GetSecretsKeys, GetSecretVal, SetSecretVal, GetUsers, GetRoles, RemoveCartDiscount, GetActiveOrder, GetActiveCustomer, SetActiveCustomer, GetActiveOutlet, SetActiveOutlet, GetActiveStation, SetActiveStation, GetActiveSession, SetActiveSession, GetActiveUser, SetActiveUser, SetActiveRefund, RemoveProductDiscount, RemoveProductFee, RemoveProductNote, RemoveCartFee, RemoveOrderNote, RemoveCustomSale, RemoveNonRevenueItem, IntegrationPayment, GetSmartGridLayout, SaveSmartGridLayout } from "../../index";
2
2
  export interface RenderProviderActions {
3
3
  exampleFunction: ExampleFunction;
4
4
  getProducts: GetProducts;
@@ -94,4 +94,6 @@ export interface RenderProviderActions {
94
94
  removeOrderNote: RemoveOrderNote;
95
95
  removeCustomSale: RemoveCustomSale;
96
96
  removeNonRevenueItem: RemoveNonRevenueItem;
97
+ getSmartGridLayout: GetSmartGridLayout;
98
+ saveSmartGridLayout: SaveSmartGridLayout;
97
99
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@final-commerce/command-frame",
3
- "version": "0.1.72",
3
+ "version": "0.1.73",
4
4
  "description": "Commands Frame library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",