@final-commerce/command-frame 0.1.19 → 0.1.20

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 (50) hide show
  1. package/dist/CommonTypes.d.ts +1 -0
  2. package/dist/CommonTypes.js +1 -0
  3. package/dist/actions/delete-custom-table-data/action.d.ts +6 -0
  4. package/dist/actions/delete-custom-table-data/action.js +8 -0
  5. package/dist/actions/delete-custom-table-data/types.d.ts +9 -0
  6. package/dist/actions/delete-custom-table-data/types.js +1 -0
  7. package/dist/actions/get-custom-table-data/action.d.ts +6 -0
  8. package/dist/actions/get-custom-table-data/action.js +8 -0
  9. package/dist/actions/get-custom-table-data/types.d.ts +12 -0
  10. package/dist/actions/get-custom-table-data/types.js +1 -0
  11. package/dist/actions/get-custom-table-fields/action.d.ts +6 -0
  12. package/dist/actions/get-custom-table-fields/action.js +8 -0
  13. package/dist/actions/get-custom-table-fields/types.d.ts +10 -0
  14. package/dist/actions/get-custom-table-fields/types.js +1 -0
  15. package/dist/actions/get-custom-tables/action.d.ts +6 -0
  16. package/dist/actions/get-custom-tables/action.js +8 -0
  17. package/dist/actions/get-custom-tables/types.d.ts +7 -0
  18. package/dist/actions/get-custom-tables/types.js +1 -0
  19. package/dist/actions/upsert-custom-table-data/action.d.ts +6 -0
  20. package/dist/actions/upsert-custom-table-data/action.js +8 -0
  21. package/dist/actions/upsert-custom-table-data/types.d.ts +10 -0
  22. package/dist/actions/upsert-custom-table-data/types.js +1 -0
  23. package/dist/common-types/custom-tables.d.ts +26 -0
  24. package/dist/common-types/custom-tables.js +8 -0
  25. package/dist/common-types/index.d.ts +1 -0
  26. package/dist/common-types/index.js +1 -0
  27. package/dist/demo/database.d.ts +1 -1
  28. package/dist/demo/database.js +1 -0
  29. package/dist/demo/mocks/custom-tables.d.ts +3 -0
  30. package/dist/demo/mocks/custom-tables.js +46 -0
  31. package/dist/demo/mocks/index.d.ts +1 -0
  32. package/dist/demo/mocks/index.js +1 -0
  33. package/dist/index.d.ts +10 -1
  34. package/dist/index.js +8 -1
  35. package/dist/pubsub/topics/custom-tables/index.d.ts +7 -0
  36. package/dist/pubsub/topics/custom-tables/index.js +28 -0
  37. package/dist/pubsub/topics/custom-tables/row-created/types.d.ts +12 -0
  38. package/dist/pubsub/topics/custom-tables/row-created/types.js +1 -0
  39. package/dist/pubsub/topics/custom-tables/row-deleted/types.d.ts +12 -0
  40. package/dist/pubsub/topics/custom-tables/row-deleted/types.js +1 -0
  41. package/dist/pubsub/topics/custom-tables/row-updated/types.d.ts +12 -0
  42. package/dist/pubsub/topics/custom-tables/row-updated/types.js +1 -0
  43. package/dist/pubsub/topics/custom-tables/types.d.ts +12 -0
  44. package/dist/pubsub/topics/custom-tables/types.js +8 -0
  45. package/dist/pubsub/topics/index.d.ts +1 -0
  46. package/dist/pubsub/topics/index.js +1 -0
  47. package/dist/pubsub/topics/types.d.ts +2 -0
  48. package/package.json +1 -1
  49. package/dist/pubsub/topic.d.ts +0 -36
  50. package/dist/pubsub/topic.js +0 -52
@@ -1,3 +1,4 @@
1
+ export * from "./common-types";
1
2
  export declare enum CFProductType {
2
3
  SIMPLE = "simple",
3
4
  VARIABLE = "variable"
@@ -1,3 +1,4 @@
1
+ export * from "./common-types";
1
2
  // Enums
2
3
  export var CFProductType;
3
4
  (function (CFProductType) {
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Get custom tables action
3
+ * Calls the getCustomTables action on the parent window
4
+ */
5
+ import type { DeleteCustomTableData } from "./types";
6
+ export declare const deleteCustomTableData: DeleteCustomTableData;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Get custom tables action
3
+ * Calls the getCustomTables action on the parent window
4
+ */
5
+ import { commandFrameClient } from "../../client";
6
+ export const deleteCustomTableData = async (params) => {
7
+ return await commandFrameClient.call("deleteCustomTableData", params);
8
+ };
@@ -0,0 +1,9 @@
1
+ export interface DeleteCustomTableDataResponse {
2
+ success: boolean;
3
+ timestamp: string;
4
+ }
5
+ export interface DeleteCustomTableDataParams {
6
+ tableName: string;
7
+ rowId: string;
8
+ }
9
+ export type DeleteCustomTableData = (params?: DeleteCustomTableDataParams) => Promise<DeleteCustomTableDataResponse>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Get custom tables action
3
+ * Calls the getCustomTables action on the parent window
4
+ */
5
+ import type { GetCustomTableData } from "./types";
6
+ export declare const getCustomTableData: GetCustomTableData;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Get custom tables action
3
+ * Calls the getCustomTables action on the parent window
4
+ */
5
+ import { commandFrameClient } from "../../client";
6
+ export const getCustomTableData = async (params) => {
7
+ return await commandFrameClient.call("getCustomTableData", params);
8
+ };
@@ -0,0 +1,12 @@
1
+ export interface GetCustomTableDataResponse<T = any> {
2
+ success: boolean;
3
+ data: T[];
4
+ timestamp: string;
5
+ }
6
+ export interface GetCustomTableDataParams {
7
+ tableName: string;
8
+ query?: any;
9
+ offset?: number;
10
+ limit?: number;
11
+ }
12
+ export type GetCustomTableData = <T = any>(params?: GetCustomTableDataParams) => Promise<GetCustomTableDataResponse<T>>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Get custom table fields action
3
+ * Calls the getCustomTableFields action on the parent window
4
+ */
5
+ import type { GetCustomTableFields } from "./types";
6
+ export declare const getCustomTableFields: GetCustomTableFields;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Get custom table fields action
3
+ * Calls the getCustomTableFields action on the parent window
4
+ */
5
+ import { commandFrameClient } from "../../client";
6
+ export const getCustomTableFields = async (params) => {
7
+ return await commandFrameClient.call("getCustomTableFields", params);
8
+ };
@@ -0,0 +1,10 @@
1
+ import { CFCustomTableField } from "../../CommonTypes";
2
+ export interface GetCustomTableFieldsParams {
3
+ tableId: string;
4
+ }
5
+ export interface GetCustomTableFieldsResponse {
6
+ success: boolean;
7
+ fields: CFCustomTableField[];
8
+ timestamp: string;
9
+ }
10
+ export type GetCustomTableFields = (params: GetCustomTableFieldsParams) => Promise<GetCustomTableFieldsResponse>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Get custom tables action
3
+ * Calls the getCustomTables action on the parent window
4
+ */
5
+ import type { GetCustomTables } from "./types";
6
+ export declare const getCustomTables: GetCustomTables;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Get custom tables action
3
+ * Calls the getCustomTables action on the parent window
4
+ */
5
+ import { commandFrameClient } from "../../client";
6
+ export const getCustomTables = async () => {
7
+ return await commandFrameClient.call("getCustomTables");
8
+ };
@@ -0,0 +1,7 @@
1
+ import { CFCustomTable } from "../../CommonTypes";
2
+ export interface GetCustomTablesResponse {
3
+ success: boolean;
4
+ customTables: CFCustomTable[];
5
+ timestamp: string;
6
+ }
7
+ export type GetCustomTables = () => Promise<GetCustomTablesResponse>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Get custom tables action
3
+ * Calls the getCustomTables action on the parent window
4
+ */
5
+ import type { UpsertCustomTableData } from "./types";
6
+ export declare const upsertCustomTableData: UpsertCustomTableData;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Get custom tables action
3
+ * Calls the getCustomTables action on the parent window
4
+ */
5
+ import { commandFrameClient } from "../../client";
6
+ export const upsertCustomTableData = async (params) => {
7
+ return await commandFrameClient.call("upsertCustomTableData", params);
8
+ };
@@ -0,0 +1,10 @@
1
+ export interface UpsertCustomTableDataResponse<T = any> {
2
+ success: boolean;
3
+ data: T;
4
+ timestamp: string;
5
+ }
6
+ export interface UpsertCustomTableDataParams<T = any> {
7
+ tableName: string;
8
+ data: T;
9
+ }
10
+ export type UpsertCustomTableData = <T = any>(params?: UpsertCustomTableDataParams<T>) => Promise<UpsertCustomTableDataResponse<T>>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,26 @@
1
+ export type CFCustomTable = {
2
+ _id: string;
3
+ name: string;
4
+ description?: string;
5
+ metadata?: Array<{
6
+ key: string;
7
+ value: any;
8
+ }>;
9
+ };
10
+ export declare enum AttributeType {
11
+ STRING = "string",
12
+ NUMBER = "number",
13
+ BOOLEAN = "boolean",
14
+ DATE = "date",
15
+ JSON_STRING = "json-string"
16
+ }
17
+ export type CFCustomTableField = {
18
+ _id: string;
19
+ tableId: string;
20
+ name: string;
21
+ type: AttributeType;
22
+ required?: boolean;
23
+ defaultValue?: any;
24
+ referenceLinkedCollection?: string;
25
+ referenceLinkedField?: string;
26
+ };
@@ -0,0 +1,8 @@
1
+ export var AttributeType;
2
+ (function (AttributeType) {
3
+ AttributeType["STRING"] = "string";
4
+ AttributeType["NUMBER"] = "number";
5
+ AttributeType["BOOLEAN"] = "boolean";
6
+ AttributeType["DATE"] = "date";
7
+ AttributeType["JSON_STRING"] = "json-string";
8
+ })(AttributeType || (AttributeType = {}));
@@ -0,0 +1 @@
1
+ export * from "./custom-tables";
@@ -0,0 +1 @@
1
+ export * from "./custom-tables";
@@ -3,6 +3,7 @@
3
3
  * Stores mock data that mimics the Render environment
4
4
  */
5
5
  import { CFActiveCompany, CFActiveUser, CFActiveStation, CFActiveOutlet, CFActiveOrder, CFCustomer, CFProduct, CFActiveCart, CFCategory } from "../CommonTypes";
6
+ export * from './mocks';
6
7
  export declare const MOCK_COMPANY: CFActiveCompany;
7
8
  export declare const MOCK_OUTLET_MAIN: CFActiveOutlet;
8
9
  export declare const MOCK_STATION_1: CFActiveStation;
@@ -53,4 +54,3 @@ type MockEventCallback = (event: any) => void;
53
54
  export declare const mockPublishEvent: (topic: string, eventType: string, data: any) => void;
54
55
  export declare const mockSubscribeToTopic: (topic: string, callback: MockEventCallback) => void;
55
56
  export declare const createOrderFromCart: (paymentType: string, amount: number | string, processor?: string) => CFActiveOrder;
56
- export {};
@@ -3,6 +3,7 @@
3
3
  * Stores mock data that mimics the Render environment
4
4
  */
5
5
  import { CFProductType, CFUserTypes, } from "../CommonTypes";
6
+ export * from './mocks';
6
7
  // Asset Imports - Using Remote URLs to avoid build complexity with asset copying
7
8
  const ASSETS_BASE_URL = "https://raw.githubusercontent.com/Final-Commerce/command-frame/refs/heads/main/src/demo/assets";
8
9
  const logo = `${ASSETS_BASE_URL}/logo.png`;
@@ -0,0 +1,3 @@
1
+ import { CFCustomTable, CFCustomTableField } from "../../CommonTypes";
2
+ export declare const MOCK_CUSTOM_TABLES: CFCustomTable[];
3
+ export declare const MOCK_CUSTOM_TABLE_FIELDS: CFCustomTableField[];
@@ -0,0 +1,46 @@
1
+ import { AttributeType } from "../../CommonTypes";
2
+ export const MOCK_CUSTOM_TABLES = [
3
+ {
4
+ _id: "custom_table_1",
5
+ name: "Custom Table 1",
6
+ description: "Custom Table 1 Description",
7
+ metadata: [
8
+ {
9
+ key: "value",
10
+ value: "value"
11
+ }
12
+ ]
13
+ }
14
+ ];
15
+ export const MOCK_CUSTOM_TABLE_FIELDS = [
16
+ {
17
+ _id: "field_1",
18
+ tableId: "custom_table_1",
19
+ name: "customerId",
20
+ type: AttributeType.STRING,
21
+ required: true
22
+ },
23
+ {
24
+ _id: "field_2",
25
+ tableId: "custom_table_1",
26
+ name: "points",
27
+ type: AttributeType.NUMBER,
28
+ required: true,
29
+ defaultValue: 0
30
+ },
31
+ {
32
+ _id: "field_3",
33
+ tableId: "custom_table_1",
34
+ name: "isActive",
35
+ type: AttributeType.BOOLEAN,
36
+ required: false,
37
+ defaultValue: true
38
+ },
39
+ {
40
+ _id: "field_4",
41
+ tableId: "custom_table_1",
42
+ name: "lastUpdated",
43
+ type: AttributeType.DATE,
44
+ required: false
45
+ }
46
+ ];
@@ -0,0 +1 @@
1
+ export * from "./custom-tables";
@@ -0,0 +1 @@
1
+ export * from "./custom-tables";
package/dist/index.d.ts CHANGED
@@ -47,6 +47,8 @@ export declare const command: {
47
47
  readonly calculateRefundTotal: import("./actions/calculate-refund-total/types").CalculateRefundTotal;
48
48
  readonly getRemainingRefundableQuantities: import("./actions/get-remaining-refundable-quantities/types").GetRemainingRefundableQuantities;
49
49
  readonly processPartialRefund: import("./actions/process-partial-refund/types").ProcessPartialRefund;
50
+ readonly getCustomTables: import("./actions/get-custom-tables/types").GetCustomTables;
51
+ readonly getCustomTableFields: import("./actions/get-custom-table-fields/types").GetCustomTableFields;
50
52
  };
51
53
  export type { ExampleFunction, ExampleFunctionParams, ExampleFunctionResponse } from "./actions/example-function/types";
52
54
  export type { GetProducts, GetProductsParams, GetProductsResponse } from "./actions/get-products/types";
@@ -103,7 +105,7 @@ export * from "./projects/render";
103
105
  export * from "./projects/manage";
104
106
  export { commandFrameClient, CommandFrameClient } from "./client";
105
107
  export type { PostMessageRequest, PostMessageResponse } from "./client";
106
- export { topics } from "./pubsub/topic";
108
+ export { topics } from "./pubsub/topics";
107
109
  export type { TopicDefinition, TopicEvent, TopicEventType, TopicSubscriptionCallback, TopicSubscription } from "./pubsub/types";
108
110
  export { customersTopic } from "./pubsub/topics/customers";
109
111
  export { ordersTopic } from "./pubsub/topics/orders";
@@ -111,9 +113,16 @@ export { refundsTopic } from "./pubsub/topics/refunds";
111
113
  export { productsTopic } from "./pubsub/topics/products";
112
114
  export { cartTopic } from "./pubsub/topics/cart";
113
115
  export { paymentsTopic } from "./pubsub/topics/payments";
116
+ export { customTablesTopic } from "./pubsub/topics/custom-tables";
114
117
  export type { CustomerCreatedPayload, CustomerUpdatedPayload, CustomerNoteAddedPayload, CustomerNoteDeletedPayload, CustomerAssignedPayload, CustomerUnassignedPayload, CustomerCreatedEvent, CustomerUpdatedEvent, CustomerNoteAddedEvent, CustomerNoteDeletedEvent, CustomerAssignedEvent, CustomerUnassignedEvent, CustomersEventType, CustomersEventPayload } from "./pubsub/topics/customers/types";
115
118
  export type { OrderCreatedPayload, OrderUpdatedPayload, OrderCreatedEvent, OrderUpdatedEvent, OrdersEventType, OrdersEventPayload } from "./pubsub/topics/orders/types";
116
119
  export type { RefundCreatedPayload, RefundUpdatedPayload, RefundCreatedEvent, RefundUpdatedEvent, RefundsEventType, RefundsEventPayload } from "./pubsub/topics/refunds/types";
117
120
  export type { ProductCreatedPayload, ProductUpdatedPayload, ProductCreatedEvent, ProductUpdatedEvent, ProductsEventType, ProductsEventPayload } from "./pubsub/topics/products/types";
118
121
  export type { CartCreatedPayload, CartCustomerAssignedPayload, ProductAddedPayload, ProductDeletedPayload, CartDiscountAddedPayload, CartDiscountRemovedPayload, CartFeeAddedPayload, CartFeeRemovedPayload, CartCreatedEvent, CartCustomerAssignedEvent, ProductAddedEvent, ProductDeletedEvent, CartDiscountAddedEvent, CartDiscountRemovedEvent, CartFeeAddedEvent, CartFeeRemovedEvent, CartEventType, CartEventPayload } from "./pubsub/topics/cart/types";
119
122
  export type { PaymentDonePayload, PaymentErrPayload, PaymentDoneEvent, PaymentErrEvent, PaymentsEventType, PaymentsEventPayload } from "./pubsub/topics/payments/types";
123
+ export type { RowCreatedPayload, RowUpdatedPayload, RowDeletedPayload, RowCreatedEvent, RowUpdatedEvent, RowDeletedEvent, CustomTablesEventType, CustomTablesEventPayload } from "./pubsub/topics/custom-tables/types";
124
+ export type { GetCustomTables, GetCustomTablesResponse } from "./actions/get-custom-tables/types";
125
+ export type { GetCustomTableFields, GetCustomTableFieldsParams, GetCustomTableFieldsResponse } from "./actions/get-custom-table-fields/types";
126
+ export type { GetCustomTableData, GetCustomTableDataParams, GetCustomTableDataResponse } from "./actions/get-custom-table-data/types";
127
+ export type { UpsertCustomTableData, UpsertCustomTableDataParams, UpsertCustomTableDataResponse } from "./actions/upsert-custom-table-data/types";
128
+ export type { DeleteCustomTableData, DeleteCustomTableDataParams, DeleteCustomTableDataResponse } from "./actions/delete-custom-table-data/types";
package/dist/index.js CHANGED
@@ -53,6 +53,9 @@ import { resetRefundDetails } from "./actions/reset-refund-details/action";
53
53
  import { calculateRefundTotal } from "./actions/calculate-refund-total/action";
54
54
  import { getRemainingRefundableQuantities } from "./actions/get-remaining-refundable-quantities/action";
55
55
  import { processPartialRefund } from "./actions/process-partial-refund/action";
56
+ // Custom Tables Actions
57
+ import { getCustomTables } from "./actions/get-custom-tables/action";
58
+ import { getCustomTableFields } from "./actions/get-custom-table-fields/action";
56
59
  // Export actions as command object
57
60
  export const command = {
58
61
  exampleFunction,
@@ -109,6 +112,9 @@ export const command = {
109
112
  calculateRefundTotal,
110
113
  getRemainingRefundableQuantities,
111
114
  processPartialRefund,
115
+ // Custom Tables Actions
116
+ getCustomTables,
117
+ getCustomTableFields,
112
118
  };
113
119
  // Export Common Types
114
120
  export * from "./CommonTypes";
@@ -121,7 +127,7 @@ export * from "./projects/manage";
121
127
  // Export client
122
128
  export { commandFrameClient, CommandFrameClient } from "./client";
123
129
  // Export Pub/Sub
124
- export { topics } from "./pubsub/topic";
130
+ export { topics } from "./pubsub/topics";
125
131
  // Export Pub/Sub Topics
126
132
  export { customersTopic } from "./pubsub/topics/customers";
127
133
  export { ordersTopic } from "./pubsub/topics/orders";
@@ -129,3 +135,4 @@ export { refundsTopic } from "./pubsub/topics/refunds";
129
135
  export { productsTopic } from "./pubsub/topics/products";
130
136
  export { cartTopic } from "./pubsub/topics/cart";
131
137
  export { paymentsTopic } from "./pubsub/topics/payments";
138
+ export { customTablesTopic } from "./pubsub/topics/custom-tables";
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Custom Tables Topic Definition
3
+ * Defines the custom tables topic and its available event types
4
+ */
5
+ import type { TopicDefinition } from "../../types";
6
+ export declare const customTablesTopic: TopicDefinition;
7
+ export * from "./types";
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Custom Tables Topic Definition
3
+ * Defines the custom tables topic and its available event types
4
+ */
5
+ export const customTablesTopic = {
6
+ id: "custom-tables",
7
+ name: "Custom Tables",
8
+ description: "Topic for custom table-related events",
9
+ eventTypes: [
10
+ {
11
+ id: "row-created",
12
+ name: "Row Created",
13
+ description: "Fired when a new row is created in a custom table"
14
+ },
15
+ {
16
+ id: "row-updated",
17
+ name: "Row Updated",
18
+ description: "Fired when a row is updated in a custom table"
19
+ },
20
+ {
21
+ id: "row-deleted",
22
+ name: "Row Deleted",
23
+ description: "Fired when a row is deleted from a custom table"
24
+ }
25
+ ]
26
+ };
27
+ // Re-export types
28
+ export * from "./types";
@@ -0,0 +1,12 @@
1
+ import type { TopicEvent } from "../../../types";
2
+ /**
3
+ * Payload for customer-created event
4
+ */
5
+ export interface RowCreatedPayload {
6
+ tableName: string;
7
+ [key: string]: any;
8
+ }
9
+ /**
10
+ * Typed event for customer-created
11
+ */
12
+ export type RowCreatedEvent = TopicEvent<RowCreatedPayload>;
@@ -0,0 +1,12 @@
1
+ import type { TopicEvent } from "../../../types";
2
+ /**
3
+ * Payload for row-deleted event
4
+ */
5
+ export interface RowDeletedPayload {
6
+ tableName: string;
7
+ rowId: string;
8
+ }
9
+ /**
10
+ * Typed event for customer-created
11
+ */
12
+ export type RowDeletedEvent = TopicEvent<RowDeletedPayload>;
@@ -0,0 +1,12 @@
1
+ import type { TopicEvent } from "../../../types";
2
+ /**
3
+ * Payload for row-updated event
4
+ */
5
+ export interface RowUpdatedPayload {
6
+ tableName: string;
7
+ [key: string]: any;
8
+ }
9
+ /**
10
+ * Typed event for customer-created
11
+ */
12
+ export type RowUpdatedEvent = TopicEvent<RowUpdatedPayload>;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Custom Tables Topic Types
3
+ * Aggregated types for all custom table-related events
4
+ */
5
+ export * from "./row-created/types";
6
+ export * from "./row-updated/types";
7
+ export * from "./row-deleted/types";
8
+ import type { RowCreatedPayload } from "./row-created/types";
9
+ import type { RowUpdatedPayload } from "./row-updated/types";
10
+ import type { RowDeletedPayload } from "./row-deleted/types";
11
+ export type CustomTablesEventPayload = RowCreatedPayload | RowUpdatedPayload | RowDeletedPayload;
12
+ export type CustomTablesEventType = "row-created" | "row-updated" | "row-deleted";
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Custom Tables Topic Types
3
+ * Aggregated types for all custom table-related events
4
+ */
5
+ // Re-export all event types
6
+ export * from "./row-created/types";
7
+ export * from "./row-updated/types";
8
+ export * from "./row-deleted/types";
@@ -8,3 +8,4 @@ export * from "./refunds";
8
8
  export * from "./products";
9
9
  export * from "./cart";
10
10
  export * from "./payments";
11
+ export * from "./custom-tables";
@@ -8,3 +8,4 @@ export * from "./refunds";
8
8
  export * from "./products";
9
9
  export * from "./cart";
10
10
  export * from "./payments";
11
+ export * from "./custom-tables";
@@ -4,6 +4,7 @@ import { RefundsEventType, RefundsEventPayload } from "./refunds/types";
4
4
  import { ProductsEventType, ProductsEventPayload } from "./products/types";
5
5
  import { CartEventType, CartEventPayload } from "./cart/types";
6
6
  import { PaymentsEventType, PaymentsEventPayload } from "./payments/types";
7
+ import { CustomTablesEventPayload, CustomTablesEventType } from "./custom-tables/types";
7
8
  export interface TopicEventPayloadMap {
8
9
  customers: Record<CustomersEventType, CustomersEventPayload>;
9
10
  orders: Record<OrdersEventType, OrdersEventPayload>;
@@ -11,4 +12,5 @@ export interface TopicEventPayloadMap {
11
12
  products: Record<ProductsEventType, ProductsEventPayload>;
12
13
  cart: Record<CartEventType, CartEventPayload>;
13
14
  payments: Record<PaymentsEventType, PaymentsEventPayload>;
15
+ customTables: Record<CustomTablesEventType, CustomTablesEventPayload>;
14
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@final-commerce/command-frame",
3
- "version": "0.1.19",
3
+ "version": "0.1.20",
4
4
  "description": "Commands Frame library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,36 +0,0 @@
1
- /**
2
- * Pub/Sub module for Command Frame
3
- * Provides topic subscription functionality for iframe apps
4
- */
5
- export * from "./types";
6
- export { TopicSubscriber } from "./subscriber";
7
- import { TopicSubscriber } from "./subscriber";
8
- /**
9
- * Get or create the singleton TopicSubscriber instance
10
- */
11
- export declare function getTopicSubscriber(options?: {
12
- origin?: string;
13
- debug?: boolean;
14
- }): TopicSubscriber;
15
- /**
16
- * Topics API for iframe apps
17
- */
18
- declare const topicsApi: {
19
- /**
20
- * Subscribe to a topic
21
- */
22
- subscribe: <T = any>(topic: string, callback: (event: import("./types").TopicEvent<T>) => void) => string;
23
- /**
24
- * Unsubscribe from a topic
25
- */
26
- unsubscribe: (topic: string, subscriptionId: string) => boolean;
27
- /**
28
- * Unsubscribe all callbacks for a topic
29
- */
30
- unsubscribeAll: (topic: string) => number;
31
- /**
32
- * Get available topics
33
- */
34
- getTopics: () => Promise<import("./types").TopicDefinition[]>;
35
- };
36
- export { topicsApi as topics };
@@ -1,52 +0,0 @@
1
- /**
2
- * Pub/Sub module for Command Frame
3
- * Provides topic subscription functionality for iframe apps
4
- */
5
- export * from "./types";
6
- export { TopicSubscriber } from "./subscriber";
7
- // Singleton instance
8
- import { TopicSubscriber } from "./subscriber";
9
- let subscriberInstance = null;
10
- /**
11
- * Get or create the singleton TopicSubscriber instance
12
- */
13
- export function getTopicSubscriber(options) {
14
- if (!subscriberInstance) {
15
- subscriberInstance = new TopicSubscriber(options);
16
- }
17
- return subscriberInstance;
18
- }
19
- /**
20
- * Topics API for iframe apps
21
- */
22
- const topicsApi = {
23
- /**
24
- * Subscribe to a topic
25
- */
26
- subscribe: (topic, callback) => {
27
- const subscriber = getTopicSubscriber();
28
- return subscriber.subscribe(topic, callback);
29
- },
30
- /**
31
- * Unsubscribe from a topic
32
- */
33
- unsubscribe: (topic, subscriptionId) => {
34
- const subscriber = getTopicSubscriber();
35
- return subscriber.unsubscribe(topic, subscriptionId);
36
- },
37
- /**
38
- * Unsubscribe all callbacks for a topic
39
- */
40
- unsubscribeAll: (topic) => {
41
- const subscriber = getTopicSubscriber();
42
- return subscriber.unsubscribeAll(topic);
43
- },
44
- /**
45
- * Get available topics
46
- */
47
- getTopics: async () => {
48
- const subscriber = getTopicSubscriber();
49
- return await subscriber.getTopics();
50
- }
51
- };
52
- export { topicsApi as topics };