@final-commerce/command-frame 0.1.21 → 0.1.22

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 (37) hide show
  1. package/dist/actions/delete-custom-table-data/action.d.ts +2 -2
  2. package/dist/actions/delete-custom-table-data/action.js +2 -2
  3. package/dist/actions/delete-custom-table-data/mock.d.ts +2 -0
  4. package/dist/actions/delete-custom-table-data/mock.js +7 -0
  5. package/dist/actions/get-custom-extension-custom-tables/action.d.ts +6 -0
  6. package/dist/actions/get-custom-extension-custom-tables/action.js +8 -0
  7. package/dist/actions/get-custom-extension-custom-tables/mock.d.ts +2 -0
  8. package/dist/actions/get-custom-extension-custom-tables/mock.js +8 -0
  9. package/dist/actions/get-custom-extension-custom-tables/types.d.ts +10 -0
  10. package/dist/actions/get-custom-extension-custom-tables/types.js +1 -0
  11. package/dist/actions/get-custom-extensions/action.d.ts +6 -0
  12. package/dist/actions/get-custom-extensions/action.js +8 -0
  13. package/dist/actions/get-custom-extensions/mock.d.ts +2 -0
  14. package/dist/actions/get-custom-extensions/mock.js +8 -0
  15. package/dist/actions/get-custom-extensions/types.d.ts +7 -0
  16. package/dist/actions/get-custom-extensions/types.js +1 -0
  17. package/dist/actions/get-custom-table-data/action.d.ts +2 -2
  18. package/dist/actions/get-custom-table-data/action.js +2 -2
  19. package/dist/actions/get-custom-table-data/mock.d.ts +2 -0
  20. package/dist/actions/get-custom-table-data/mock.js +8 -0
  21. package/dist/actions/get-custom-tables/mock.d.ts +2 -0
  22. package/dist/actions/get-custom-tables/mock.js +8 -0
  23. package/dist/actions/upsert-custom-table-data/mock.d.ts +2 -0
  24. package/dist/actions/upsert-custom-table-data/mock.js +8 -0
  25. package/dist/common-types/base-entity.d.ts +5 -0
  26. package/dist/common-types/base-entity.js +1 -0
  27. package/dist/common-types/custom-extensions.d.ts +18 -0
  28. package/dist/common-types/custom-extensions.js +1 -0
  29. package/dist/common-types/custom-tables.d.ts +3 -4
  30. package/dist/common-types/index.d.ts +1 -0
  31. package/dist/common-types/index.js +1 -0
  32. package/dist/demo/mocks/custom-tables.js +15 -5
  33. package/dist/index.d.ts +7 -0
  34. package/dist/index.js +13 -1
  35. package/dist/projects/render/mocks.js +13 -1
  36. package/dist/projects/render/types.d.ts +7 -1
  37. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Get custom tables action
3
- * Calls the getCustomTables action on the parent window
2
+ * Delete custom table data action
3
+ * Calls the deleteCustomTableData action on the parent window
4
4
  */
5
5
  import type { DeleteCustomTableData } from "./types";
6
6
  export declare const deleteCustomTableData: DeleteCustomTableData;
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Get custom tables action
3
- * Calls the getCustomTables action on the parent window
2
+ * Delete custom table data action
3
+ * Calls the deleteCustomTableData action on the parent window
4
4
  */
5
5
  import { commandFrameClient } from "../../client";
6
6
  export const deleteCustomTableData = async (params) => {
@@ -0,0 +1,2 @@
1
+ import { DeleteCustomTableData } from "./types";
2
+ export declare const mockDeleteCustomTableData: DeleteCustomTableData;
@@ -0,0 +1,7 @@
1
+ export const mockDeleteCustomTableData = async (params) => {
2
+ console.log("[Mock] deleteCustomTableData called", params);
3
+ return {
4
+ success: true,
5
+ timestamp: new Date().toISOString()
6
+ };
7
+ };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Get custom extensions action
3
+ * Calls the getCustomExtensions action on the parent window
4
+ */
5
+ import type { GetCustomExtensionCustomTables } from "./types";
6
+ export declare const getCustomExtensionCustomTables: GetCustomExtensionCustomTables;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Get custom extensions action
3
+ * Calls the getCustomExtensions action on the parent window
4
+ */
5
+ import { commandFrameClient } from "../../client";
6
+ export const getCustomExtensionCustomTables = async (params) => {
7
+ return await commandFrameClient.call("getCustomExtensionCustomTables", params);
8
+ };
@@ -0,0 +1,2 @@
1
+ import { GetCustomExtensionCustomTables } from "./types";
2
+ export declare const mockGetCustomExtensionCustomTables: GetCustomExtensionCustomTables;
@@ -0,0 +1,8 @@
1
+ export const mockGetCustomExtensionCustomTables = async (params) => {
2
+ console.log("[Mock] getCustomExtensionCustomTables called", params);
3
+ return {
4
+ success: true,
5
+ customTables: [],
6
+ timestamp: new Date().toISOString()
7
+ };
8
+ };
@@ -0,0 +1,10 @@
1
+ import { CFCustomTable } from "../../common-types/custom-tables";
2
+ export interface GetCustomExtensionCustomTablesParams {
3
+ extensionId: string;
4
+ }
5
+ export interface GetCustomExtensionCustomTablesResponse {
6
+ success: boolean;
7
+ customTables: CFCustomTable[];
8
+ timestamp: string;
9
+ }
10
+ export type GetCustomExtensionCustomTables = (params: GetCustomExtensionCustomTablesParams) => Promise<GetCustomExtensionCustomTablesResponse>;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Get custom extensions action
3
+ * Calls the getCustomExtensions action on the parent window
4
+ */
5
+ import type { GetCustomExtensions } from "./types";
6
+ export declare const getCustomExtensions: GetCustomExtensions;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Get custom extensions action
3
+ * Calls the getCustomExtensions action on the parent window
4
+ */
5
+ import { commandFrameClient } from "../../client";
6
+ export const getCustomExtensions = async () => {
7
+ return await commandFrameClient.call("getCustomExtensions");
8
+ };
@@ -0,0 +1,2 @@
1
+ import { GetCustomExtensions } from "./types";
2
+ export declare const mockGetCustomExtensions: GetCustomExtensions;
@@ -0,0 +1,8 @@
1
+ export const mockGetCustomExtensions = async () => {
2
+ console.log("[Mock] getCustomExtensions called");
3
+ return {
4
+ success: true,
5
+ customExtensions: [],
6
+ timestamp: new Date().toISOString()
7
+ };
8
+ };
@@ -0,0 +1,7 @@
1
+ import { CustomExtension } from "../../common-types/custom-extensions";
2
+ export interface GetCustomExtensionsResponse {
3
+ success: boolean;
4
+ customExtensions: CustomExtension[];
5
+ timestamp: string;
6
+ }
7
+ export type GetCustomExtensions = () => Promise<GetCustomExtensionsResponse>;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Get custom tables action
3
- * Calls the getCustomTables action on the parent window
2
+ * Get custom table data action
3
+ * Calls the getCustomTableData action on the parent window
4
4
  */
5
5
  import type { GetCustomTableData } from "./types";
6
6
  export declare const getCustomTableData: GetCustomTableData;
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Get custom tables action
3
- * Calls the getCustomTables action on the parent window
2
+ * Get custom table data action
3
+ * Calls the getCustomTableData action on the parent window
4
4
  */
5
5
  import { commandFrameClient } from "../../client";
6
6
  export const getCustomTableData = async (params) => {
@@ -0,0 +1,2 @@
1
+ import { GetCustomTableData } from "./types";
2
+ export declare const mockGetCustomTableData: GetCustomTableData;
@@ -0,0 +1,8 @@
1
+ export const mockGetCustomTableData = async (params) => {
2
+ console.log("[Mock] getCustomTableData called", params);
3
+ return {
4
+ success: true,
5
+ data: [],
6
+ timestamp: new Date().toISOString()
7
+ };
8
+ };
@@ -0,0 +1,2 @@
1
+ import { GetCustomTables } from "./types";
2
+ export declare const mockGetCustomTables: GetCustomTables;
@@ -0,0 +1,8 @@
1
+ export const mockGetCustomTables = async () => {
2
+ console.log("[Mock] getCustomTables called");
3
+ return {
4
+ success: true,
5
+ customTables: [],
6
+ timestamp: new Date().toISOString()
7
+ };
8
+ };
@@ -0,0 +1,2 @@
1
+ import { UpsertCustomTableData } from "./types";
2
+ export declare const mockUpsertCustomTableData: UpsertCustomTableData;
@@ -0,0 +1,8 @@
1
+ export const mockUpsertCustomTableData = async (params) => {
2
+ console.log("[Mock] upsertCustomTableData called", params);
3
+ return {
4
+ success: true,
5
+ data: params?.data,
6
+ timestamp: new Date().toISOString()
7
+ };
8
+ };
@@ -0,0 +1,5 @@
1
+ export type BaseEntity = {
2
+ _id: string;
3
+ createdAt: string;
4
+ updatedAt: string;
5
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,18 @@
1
+ import { BaseEntity } from "./base-entity";
2
+ export type CustomExtension = BaseEntity & {
3
+ _id: string;
4
+ label: string;
5
+ description?: string;
6
+ backgroundUrl?: string;
7
+ gallery?: string[];
8
+ category: string;
9
+ short_description?: string;
10
+ long_description?: string;
11
+ main_image?: string;
12
+ price: string;
13
+ isDeleted: boolean;
14
+ createdAt: string;
15
+ updatedAt: string;
16
+ __v: number;
17
+ website?: string;
18
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,5 @@
1
- export type CFCustomTable = {
2
- _id: string;
1
+ import { BaseEntity } from "./base-entity";
2
+ export type CFCustomTable = BaseEntity & {
3
3
  name: string;
4
4
  description?: string;
5
5
  metadata?: Array<{
@@ -14,8 +14,7 @@ export declare enum AttributeType {
14
14
  DATE = "date",
15
15
  JSON_STRING = "json-string"
16
16
  }
17
- export type CFCustomTableField = {
18
- _id: string;
17
+ export type CFCustomTableField = BaseEntity & {
19
18
  tableId: string;
20
19
  name: string;
21
20
  type: AttributeType;
@@ -1 +1,2 @@
1
1
  export * from "./custom-tables";
2
+ export * from "./custom-extensions";
@@ -1 +1,2 @@
1
1
  export * from "./custom-tables";
2
+ export * from "./custom-extensions";
@@ -9,7 +9,9 @@ export const MOCK_CUSTOM_TABLES = [
9
9
  key: "value",
10
10
  value: "value"
11
11
  }
12
- ]
12
+ ],
13
+ createdAt: new Date().toISOString(),
14
+ updatedAt: new Date().toISOString()
13
15
  }
14
16
  ];
15
17
  export const MOCK_CUSTOM_TABLE_FIELDS = [
@@ -18,7 +20,9 @@ export const MOCK_CUSTOM_TABLE_FIELDS = [
18
20
  tableId: "custom_table_1",
19
21
  name: "customerId",
20
22
  type: AttributeType.STRING,
21
- required: true
23
+ required: true,
24
+ createdAt: new Date().toISOString(),
25
+ updatedAt: new Date().toISOString()
22
26
  },
23
27
  {
24
28
  _id: "field_2",
@@ -26,7 +30,9 @@ export const MOCK_CUSTOM_TABLE_FIELDS = [
26
30
  name: "points",
27
31
  type: AttributeType.NUMBER,
28
32
  required: true,
29
- defaultValue: 0
33
+ defaultValue: 0,
34
+ createdAt: new Date().toISOString(),
35
+ updatedAt: new Date().toISOString()
30
36
  },
31
37
  {
32
38
  _id: "field_3",
@@ -34,13 +40,17 @@ export const MOCK_CUSTOM_TABLE_FIELDS = [
34
40
  name: "isActive",
35
41
  type: AttributeType.BOOLEAN,
36
42
  required: false,
37
- defaultValue: true
43
+ defaultValue: true,
44
+ createdAt: new Date().toISOString(),
45
+ updatedAt: new Date().toISOString()
38
46
  },
39
47
  {
40
48
  _id: "field_4",
41
49
  tableId: "custom_table_1",
42
50
  name: "lastUpdated",
43
51
  type: AttributeType.DATE,
44
- required: false
52
+ required: false,
53
+ createdAt: new Date().toISOString(),
54
+ updatedAt: new Date().toISOString()
45
55
  }
46
56
  ];
package/dist/index.d.ts CHANGED
@@ -51,6 +51,11 @@ export declare const command: {
51
51
  readonly processPartialRefund: import("./actions/process-partial-refund/types").ProcessPartialRefund;
52
52
  readonly getCustomTables: import("./actions/get-custom-tables/types").GetCustomTables;
53
53
  readonly getCustomTableFields: import("./actions/get-custom-table-fields/types").GetCustomTableFields;
54
+ readonly getCustomTableData: import("./actions/get-custom-table-data/types").GetCustomTableData;
55
+ readonly upsertCustomTableData: import("./actions/upsert-custom-table-data/types").UpsertCustomTableData;
56
+ readonly deleteCustomTableData: import("./actions/delete-custom-table-data/types").DeleteCustomTableData;
57
+ readonly getCustomExtensions: import("./actions/get-custom-extensions/types").GetCustomExtensions;
58
+ readonly getCustomExtensionCustomTables: import("./actions/get-custom-extension-custom-tables/types").GetCustomExtensionCustomTables;
54
59
  };
55
60
  export type { ExampleFunction, ExampleFunctionParams, ExampleFunctionResponse } from "./actions/example-function/types";
56
61
  export type { GetProducts, GetProductsParams, GetProductsResponse } from "./actions/get-products/types";
@@ -130,3 +135,5 @@ export type { GetCustomTableFields, GetCustomTableFieldsParams, GetCustomTableFi
130
135
  export type { GetCustomTableData, GetCustomTableDataParams, GetCustomTableDataResponse } from "./actions/get-custom-table-data/types";
131
136
  export type { UpsertCustomTableData, UpsertCustomTableDataParams, UpsertCustomTableDataResponse } from "./actions/upsert-custom-table-data/types";
132
137
  export type { DeleteCustomTableData, DeleteCustomTableDataParams, DeleteCustomTableDataResponse } from "./actions/delete-custom-table-data/types";
138
+ export type { GetCustomExtensions, GetCustomExtensionsResponse } from "./actions/get-custom-extensions/types";
139
+ export type { GetCustomExtensionCustomTables, GetCustomExtensionCustomTablesParams, GetCustomExtensionCustomTablesResponse } from "./actions/get-custom-extension-custom-tables/types";
package/dist/index.js CHANGED
@@ -58,6 +58,12 @@ import { processPartialRefund } from "./actions/process-partial-refund/action";
58
58
  // Custom Tables Actions
59
59
  import { getCustomTables } from "./actions/get-custom-tables/action";
60
60
  import { getCustomTableFields } from "./actions/get-custom-table-fields/action";
61
+ import { getCustomTableData } from "./actions/get-custom-table-data/action";
62
+ import { upsertCustomTableData } from "./actions/upsert-custom-table-data/action";
63
+ import { deleteCustomTableData } from "./actions/delete-custom-table-data/action";
64
+ // Custom Extensions Actions
65
+ import { getCustomExtensions } from "./actions/get-custom-extensions/action";
66
+ import { getCustomExtensionCustomTables } from "./actions/get-custom-extension-custom-tables/action";
61
67
  // Export actions as command object
62
68
  export const command = {
63
69
  exampleFunction,
@@ -118,7 +124,13 @@ export const command = {
118
124
  processPartialRefund,
119
125
  // Custom Tables Actions
120
126
  getCustomTables,
121
- getCustomTableFields
127
+ getCustomTableFields,
128
+ getCustomTableData,
129
+ upsertCustomTableData,
130
+ deleteCustomTableData,
131
+ // Custom Extensions Actions
132
+ getCustomExtensions,
133
+ getCustomExtensionCustomTables,
122
134
  };
123
135
  // Export Common Types
124
136
  export * from "./CommonTypes";
@@ -48,6 +48,12 @@ import { mockVendaraPayment } from "../../actions/vendara-payment/mock";
48
48
  import { mockGetFinalContext } from "../../actions/get-final-context/mock";
49
49
  import { mockPrint } from "../../actions/print/mock";
50
50
  import { mockSetActiveOrder } from "../../actions/set-active-order/mock";
51
+ import { mockGetCustomTables } from "../../actions/get-custom-tables/mock";
52
+ import { mockGetCustomTableData } from "../../actions/get-custom-table-data/mock";
53
+ import { mockUpsertCustomTableData } from "../../actions/upsert-custom-table-data/mock";
54
+ import { mockDeleteCustomTableData } from "../../actions/delete-custom-table-data/mock";
55
+ import { mockGetCustomExtensions } from "../../actions/get-custom-extensions/mock";
56
+ import { mockGetCustomExtensionCustomTables } from "../../actions/get-custom-extension-custom-tables/mock";
51
57
  export const RENDER_MOCKS = {
52
58
  addCartDiscount: mockAddCartDiscount,
53
59
  addCartFee: mockAddCartFee,
@@ -98,5 +104,11 @@ export const RENDER_MOCKS = {
98
104
  vendaraPayment: mockVendaraPayment,
99
105
  getFinalContext: mockGetFinalContext,
100
106
  print: mockPrint,
101
- setActiveOrder: mockSetActiveOrder
107
+ setActiveOrder: mockSetActiveOrder,
108
+ getCustomTables: mockGetCustomTables,
109
+ getCustomTableData: mockGetCustomTableData,
110
+ upsertCustomTableData: mockUpsertCustomTableData,
111
+ deleteCustomTableData: mockDeleteCustomTableData,
112
+ getCustomExtensions: mockGetCustomExtensions,
113
+ getCustomExtensionCustomTables: mockGetCustomExtensionCustomTables,
102
114
  };
@@ -1,4 +1,4 @@
1
- import type { ExampleFunction, GetProducts, AddCustomSale, GetCustomers, AssignCustomer, AddCustomer, GetCategories, GetOrders, GetRefunds, AddProductDiscount, AddProductToCart, RemoveProductFromCart, UpdateCartItemQuantity, AddCartDiscount, GetContext, GetFinalContext, AddProductNote, AddProductFee, AdjustInventory, AddOrderNote, AddCartFee, ClearCart, ParkOrder, ResumeParkedOrder, DeleteParkedOrder, InitiateRefund, CashPayment, TapToPayPayment, TerminalPayment, VendaraPayment, AddCustomerNote, RemoveCustomerFromCart, GoToStationHome, OpenCashDrawer, ShowNotification, ShowConfirmation, AuthenticateUser, PartialPayment, SwitchUser, TriggerWebhook, TriggerZapierWebhook, SetRefundStockAction, SelectAllRefundItems, ResetRefundDetails, CalculateRefundTotal, GetRemainingRefundableQuantities, ProcessPartialRefund, GetCurrentCart, Print, SetActiveOrder } from "../../index";
1
+ import type { ExampleFunction, GetProducts, AddCustomSale, GetCustomers, AssignCustomer, AddCustomer, GetCategories, GetOrders, GetRefunds, AddProductDiscount, AddProductToCart, RemoveProductFromCart, UpdateCartItemQuantity, AddCartDiscount, GetContext, GetFinalContext, AddProductNote, AddProductFee, AdjustInventory, AddOrderNote, AddCartFee, ClearCart, ParkOrder, ResumeParkedOrder, DeleteParkedOrder, InitiateRefund, CashPayment, TapToPayPayment, TerminalPayment, VendaraPayment, AddCustomerNote, RemoveCustomerFromCart, GoToStationHome, OpenCashDrawer, ShowNotification, ShowConfirmation, AuthenticateUser, PartialPayment, SwitchUser, TriggerWebhook, TriggerZapierWebhook, SetRefundStockAction, SelectAllRefundItems, ResetRefundDetails, CalculateRefundTotal, GetRemainingRefundableQuantities, ProcessPartialRefund, GetCurrentCart, Print, SetActiveOrder, GetCustomTables, GetCustomTableData, UpsertCustomTableData, DeleteCustomTableData, GetCustomExtensions, GetCustomExtensionCustomTables } from "../../index";
2
2
  export interface RenderProviderActions {
3
3
  exampleFunction: ExampleFunction;
4
4
  getProducts: GetProducts;
@@ -50,4 +50,10 @@ export interface RenderProviderActions {
50
50
  getCurrentCart: GetCurrentCart;
51
51
  print: Print;
52
52
  setActiveOrder: SetActiveOrder;
53
+ getCustomTables: GetCustomTables;
54
+ getCustomTableData: GetCustomTableData;
55
+ upsertCustomTableData: UpsertCustomTableData;
56
+ deleteCustomTableData: DeleteCustomTableData;
57
+ getCustomExtensions: GetCustomExtensions;
58
+ getCustomExtensionCustomTables: GetCustomExtensionCustomTables;
53
59
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@final-commerce/command-frame",
3
- "version": "0.1.21",
3
+ "version": "0.1.22",
4
4
  "description": "Commands Frame library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",