@final-commerce/command-frame 0.1.19 → 0.1.21
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.
- package/dist/CommonTypes.d.ts +1 -0
- package/dist/CommonTypes.js +1 -0
- package/dist/actions/delete-custom-table-data/action.d.ts +6 -0
- package/dist/actions/delete-custom-table-data/action.js +8 -0
- package/dist/actions/delete-custom-table-data/types.d.ts +9 -0
- package/dist/actions/delete-custom-table-data/types.js +1 -0
- package/dist/actions/get-custom-table-data/action.d.ts +6 -0
- package/dist/actions/get-custom-table-data/action.js +8 -0
- package/dist/actions/get-custom-table-data/types.d.ts +12 -0
- package/dist/actions/get-custom-table-data/types.js +1 -0
- package/dist/actions/get-custom-table-fields/action.d.ts +6 -0
- package/dist/actions/get-custom-table-fields/action.js +8 -0
- package/dist/actions/get-custom-table-fields/types.d.ts +10 -0
- package/dist/actions/get-custom-table-fields/types.js +1 -0
- package/dist/actions/get-custom-tables/action.d.ts +6 -0
- package/dist/actions/get-custom-tables/action.js +8 -0
- package/dist/actions/get-custom-tables/types.d.ts +7 -0
- package/dist/actions/get-custom-tables/types.js +1 -0
- package/dist/actions/print/action.d.ts +6 -0
- package/dist/actions/print/action.js +8 -0
- package/dist/actions/print/mock.d.ts +2 -0
- package/dist/actions/print/mock.js +26 -0
- package/dist/actions/print/types.d.ts +44 -0
- package/dist/actions/print/types.js +1 -0
- package/dist/actions/set-active-order/action.d.ts +6 -0
- package/dist/actions/set-active-order/action.js +8 -0
- package/dist/actions/set-active-order/mock.d.ts +2 -0
- package/dist/actions/set-active-order/mock.js +19 -0
- package/dist/actions/set-active-order/types.d.ts +10 -0
- package/dist/actions/set-active-order/types.js +1 -0
- package/dist/actions/upsert-custom-table-data/action.d.ts +6 -0
- package/dist/actions/upsert-custom-table-data/action.js +8 -0
- package/dist/actions/upsert-custom-table-data/types.d.ts +10 -0
- package/dist/actions/upsert-custom-table-data/types.js +1 -0
- package/dist/common-types/custom-tables.d.ts +26 -0
- package/dist/common-types/custom-tables.js +8 -0
- package/dist/common-types/index.d.ts +1 -0
- package/dist/common-types/index.js +1 -0
- package/dist/demo/database.d.ts +1 -1
- package/dist/demo/database.js +1 -0
- package/dist/demo/mocks/custom-tables.d.ts +3 -0
- package/dist/demo/mocks/custom-tables.js +46 -0
- package/dist/demo/mocks/index.d.ts +1 -0
- package/dist/demo/mocks/index.js +1 -0
- package/dist/index.d.ts +14 -1
- package/dist/index.js +12 -1
- package/dist/projects/render/mocks.js +4 -0
- package/dist/projects/render/types.d.ts +3 -1
- package/dist/pubsub/topics/custom-tables/index.d.ts +7 -0
- package/dist/pubsub/topics/custom-tables/index.js +28 -0
- package/dist/pubsub/topics/custom-tables/row-created/types.d.ts +12 -0
- package/dist/pubsub/topics/custom-tables/row-created/types.js +1 -0
- package/dist/pubsub/topics/custom-tables/row-deleted/types.d.ts +12 -0
- package/dist/pubsub/topics/custom-tables/row-deleted/types.js +1 -0
- package/dist/pubsub/topics/custom-tables/row-updated/types.d.ts +12 -0
- package/dist/pubsub/topics/custom-tables/row-updated/types.js +1 -0
- package/dist/pubsub/topics/custom-tables/types.d.ts +12 -0
- package/dist/pubsub/topics/custom-tables/types.js +8 -0
- package/dist/pubsub/topics/index.d.ts +1 -0
- package/dist/pubsub/topics/index.js +1 -0
- package/dist/pubsub/topics/types.d.ts +2 -0
- package/package.json +1 -1
- package/dist/pubsub/topic.d.ts +0 -36
- package/dist/pubsub/topic.js +0 -52
package/dist/CommonTypes.d.ts
CHANGED
package/dist/CommonTypes.js
CHANGED
|
@@ -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,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,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 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const mockPrint = async (params) => {
|
|
2
|
+
console.log("[Mock] print called", params);
|
|
3
|
+
if (!params) {
|
|
4
|
+
throw new Error("Print parameters are required");
|
|
5
|
+
}
|
|
6
|
+
// Mock implementation - just log what would be printed
|
|
7
|
+
switch (params.type) {
|
|
8
|
+
case "image":
|
|
9
|
+
console.log("[Mock] Would print image:", params.data.image?.substring(0, 50) + "...");
|
|
10
|
+
break;
|
|
11
|
+
case "html":
|
|
12
|
+
console.log("[Mock] Would print HTML:", params.data.html?.substring(0, 100) + "...");
|
|
13
|
+
break;
|
|
14
|
+
case "selector":
|
|
15
|
+
console.log("[Mock] Would print element with selector:", params.data.selector);
|
|
16
|
+
break;
|
|
17
|
+
case "receipt":
|
|
18
|
+
console.log("[Mock] Would print receipt for order:", params.data.order);
|
|
19
|
+
break;
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
success: true,
|
|
23
|
+
timestamp: new Date().toISOString(),
|
|
24
|
+
type: params.type
|
|
25
|
+
};
|
|
26
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { CFActiveOrder } from "../../CommonTypes";
|
|
2
|
+
export type PrintType = "image" | "html" | "selector" | "receipt";
|
|
3
|
+
export type PrintParams = {
|
|
4
|
+
type: "image";
|
|
5
|
+
data: {
|
|
6
|
+
image: string;
|
|
7
|
+
};
|
|
8
|
+
options?: PrintOptions;
|
|
9
|
+
} | {
|
|
10
|
+
type: "html";
|
|
11
|
+
data: {
|
|
12
|
+
html: string;
|
|
13
|
+
};
|
|
14
|
+
options?: PrintOptions;
|
|
15
|
+
} | {
|
|
16
|
+
type: "selector";
|
|
17
|
+
data: {
|
|
18
|
+
selector: string;
|
|
19
|
+
};
|
|
20
|
+
options?: PrintOptions;
|
|
21
|
+
} | {
|
|
22
|
+
type: "receipt";
|
|
23
|
+
data: {
|
|
24
|
+
order?: Omit<CFActiveOrder, "_id">;
|
|
25
|
+
globalBlockId?: string;
|
|
26
|
+
};
|
|
27
|
+
options?: PrintOptions;
|
|
28
|
+
};
|
|
29
|
+
export interface PrintOptions {
|
|
30
|
+
margins?: {
|
|
31
|
+
top?: number;
|
|
32
|
+
right?: number;
|
|
33
|
+
bottom?: number;
|
|
34
|
+
left?: number;
|
|
35
|
+
};
|
|
36
|
+
paperSize?: string;
|
|
37
|
+
width?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface PrintResponse {
|
|
40
|
+
success: boolean;
|
|
41
|
+
timestamp: string;
|
|
42
|
+
type: PrintType;
|
|
43
|
+
}
|
|
44
|
+
export type Print = (params?: PrintParams) => Promise<PrintResponse>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Set active order action
|
|
3
|
+
* Calls the setActiveOrder action on the parent window
|
|
4
|
+
*/
|
|
5
|
+
import { commandFrameClient } from "../../client";
|
|
6
|
+
export const setActiveOrder = async (params) => {
|
|
7
|
+
return await commandFrameClient.call("setActiveOrder", params);
|
|
8
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export const mockSetActiveOrder = async (params) => {
|
|
2
|
+
console.log("[Mock] setActiveOrder called", params);
|
|
3
|
+
if (!params?.orderId) {
|
|
4
|
+
throw new Error("Order ID is required");
|
|
5
|
+
}
|
|
6
|
+
// Mock order response
|
|
7
|
+
return {
|
|
8
|
+
success: true,
|
|
9
|
+
order: {
|
|
10
|
+
_id: params.orderId,
|
|
11
|
+
id: params.orderId,
|
|
12
|
+
status: "completed",
|
|
13
|
+
companyId: "mock-company",
|
|
14
|
+
createdAt: new Date().toISOString(),
|
|
15
|
+
updatedAt: new Date().toISOString()
|
|
16
|
+
},
|
|
17
|
+
timestamp: new Date().toISOString()
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CFOrder } from "../../CommonTypes";
|
|
2
|
+
export interface SetActiveOrderParams {
|
|
3
|
+
orderId: string;
|
|
4
|
+
}
|
|
5
|
+
export interface SetActiveOrderResponse {
|
|
6
|
+
success: boolean;
|
|
7
|
+
order: CFOrder;
|
|
8
|
+
timestamp: string;
|
|
9
|
+
}
|
|
10
|
+
export type SetActiveOrder = (params?: SetActiveOrderParams) => Promise<SetActiveOrderResponse>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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";
|
package/dist/demo/database.d.ts
CHANGED
|
@@ -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 {};
|
package/dist/demo/database.js
CHANGED
|
@@ -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,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
|
@@ -38,6 +38,8 @@ export declare const command: {
|
|
|
38
38
|
readonly authenticateUser: import("./actions/authenticate-user/types").AuthenticateUser;
|
|
39
39
|
readonly partialPayment: import("./actions/partial-payment/types").PartialPayment;
|
|
40
40
|
readonly switchUser: import("./actions/switch-user/types").SwitchUser;
|
|
41
|
+
readonly print: import("./actions/print/types").Print;
|
|
42
|
+
readonly setActiveOrder: import("./actions/set-active-order/types").SetActiveOrder;
|
|
41
43
|
readonly triggerWebhook: import("./actions/trigger-webhook/types").TriggerWebhook;
|
|
42
44
|
readonly triggerZapierWebhook: import("./actions/trigger-zapier-webhook/types").TriggerZapierWebhook;
|
|
43
45
|
readonly initiateRefund: import("./actions/initiate-refund/types").InitiateRefund;
|
|
@@ -47,6 +49,8 @@ export declare const command: {
|
|
|
47
49
|
readonly calculateRefundTotal: import("./actions/calculate-refund-total/types").CalculateRefundTotal;
|
|
48
50
|
readonly getRemainingRefundableQuantities: import("./actions/get-remaining-refundable-quantities/types").GetRemainingRefundableQuantities;
|
|
49
51
|
readonly processPartialRefund: import("./actions/process-partial-refund/types").ProcessPartialRefund;
|
|
52
|
+
readonly getCustomTables: import("./actions/get-custom-tables/types").GetCustomTables;
|
|
53
|
+
readonly getCustomTableFields: import("./actions/get-custom-table-fields/types").GetCustomTableFields;
|
|
50
54
|
};
|
|
51
55
|
export type { ExampleFunction, ExampleFunctionParams, ExampleFunctionResponse } from "./actions/example-function/types";
|
|
52
56
|
export type { GetProducts, GetProductsParams, GetProductsResponse } from "./actions/get-products/types";
|
|
@@ -94,6 +98,8 @@ export type { ShowConfirmation, ShowConfirmationParams, ShowConfirmationResponse
|
|
|
94
98
|
export type { AuthenticateUser, AuthenticateUserParams, AuthenticateUserResponse } from "./actions/authenticate-user/types";
|
|
95
99
|
export type { PartialPayment, PartialPaymentParams, PartialPaymentResponse } from "./actions/partial-payment/types";
|
|
96
100
|
export type { SwitchUser, SwitchUserParams, SwitchUserResponse } from "./actions/switch-user/types";
|
|
101
|
+
export type { Print, PrintParams, PrintResponse } from "./actions/print/types";
|
|
102
|
+
export type { SetActiveOrder, SetActiveOrderParams, SetActiveOrderResponse } from "./actions/set-active-order/types";
|
|
97
103
|
export type { TriggerWebhook, TriggerWebhookPresetType, TriggerWebhookParams, TriggerWebhookResponse } from "./actions/trigger-webhook/types";
|
|
98
104
|
export type { TriggerZapierWebhook, TriggerZapierWebhookParams, TriggerZapierWebhookResponse } from "./actions/trigger-zapier-webhook/types";
|
|
99
105
|
export * from "./CommonTypes";
|
|
@@ -103,7 +109,7 @@ export * from "./projects/render";
|
|
|
103
109
|
export * from "./projects/manage";
|
|
104
110
|
export { commandFrameClient, CommandFrameClient } from "./client";
|
|
105
111
|
export type { PostMessageRequest, PostMessageResponse } from "./client";
|
|
106
|
-
export { topics } from "./pubsub/
|
|
112
|
+
export { topics } from "./pubsub/topics";
|
|
107
113
|
export type { TopicDefinition, TopicEvent, TopicEventType, TopicSubscriptionCallback, TopicSubscription } from "./pubsub/types";
|
|
108
114
|
export { customersTopic } from "./pubsub/topics/customers";
|
|
109
115
|
export { ordersTopic } from "./pubsub/topics/orders";
|
|
@@ -111,9 +117,16 @@ export { refundsTopic } from "./pubsub/topics/refunds";
|
|
|
111
117
|
export { productsTopic } from "./pubsub/topics/products";
|
|
112
118
|
export { cartTopic } from "./pubsub/topics/cart";
|
|
113
119
|
export { paymentsTopic } from "./pubsub/topics/payments";
|
|
120
|
+
export { customTablesTopic } from "./pubsub/topics/custom-tables";
|
|
114
121
|
export type { CustomerCreatedPayload, CustomerUpdatedPayload, CustomerNoteAddedPayload, CustomerNoteDeletedPayload, CustomerAssignedPayload, CustomerUnassignedPayload, CustomerCreatedEvent, CustomerUpdatedEvent, CustomerNoteAddedEvent, CustomerNoteDeletedEvent, CustomerAssignedEvent, CustomerUnassignedEvent, CustomersEventType, CustomersEventPayload } from "./pubsub/topics/customers/types";
|
|
115
122
|
export type { OrderCreatedPayload, OrderUpdatedPayload, OrderCreatedEvent, OrderUpdatedEvent, OrdersEventType, OrdersEventPayload } from "./pubsub/topics/orders/types";
|
|
116
123
|
export type { RefundCreatedPayload, RefundUpdatedPayload, RefundCreatedEvent, RefundUpdatedEvent, RefundsEventType, RefundsEventPayload } from "./pubsub/topics/refunds/types";
|
|
117
124
|
export type { ProductCreatedPayload, ProductUpdatedPayload, ProductCreatedEvent, ProductUpdatedEvent, ProductsEventType, ProductsEventPayload } from "./pubsub/topics/products/types";
|
|
118
125
|
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
126
|
export type { PaymentDonePayload, PaymentErrPayload, PaymentDoneEvent, PaymentErrEvent, PaymentsEventType, PaymentsEventPayload } from "./pubsub/topics/payments/types";
|
|
127
|
+
export type { RowCreatedPayload, RowUpdatedPayload, RowDeletedPayload, RowCreatedEvent, RowUpdatedEvent, RowDeletedEvent, CustomTablesEventType, CustomTablesEventPayload } from "./pubsub/topics/custom-tables/types";
|
|
128
|
+
export type { GetCustomTables, GetCustomTablesResponse } from "./actions/get-custom-tables/types";
|
|
129
|
+
export type { GetCustomTableFields, GetCustomTableFieldsParams, GetCustomTableFieldsResponse } from "./actions/get-custom-table-fields/types";
|
|
130
|
+
export type { GetCustomTableData, GetCustomTableDataParams, GetCustomTableDataResponse } from "./actions/get-custom-table-data/types";
|
|
131
|
+
export type { UpsertCustomTableData, UpsertCustomTableDataParams, UpsertCustomTableDataResponse } from "./actions/upsert-custom-table-data/types";
|
|
132
|
+
export type { DeleteCustomTableData, DeleteCustomTableDataParams, DeleteCustomTableDataResponse } from "./actions/delete-custom-table-data/types";
|
package/dist/index.js
CHANGED
|
@@ -41,6 +41,8 @@ import { showConfirmation } from "./actions/show-confirmation/action";
|
|
|
41
41
|
import { authenticateUser } from "./actions/authenticate-user/action";
|
|
42
42
|
import { partialPayment } from "./actions/partial-payment/action";
|
|
43
43
|
import { switchUser } from "./actions/switch-user/action";
|
|
44
|
+
import { print } from "./actions/print/action";
|
|
45
|
+
import { setActiveOrder } from "./actions/set-active-order/action";
|
|
44
46
|
// Integration Actions
|
|
45
47
|
import { triggerWebhook } from "./actions/trigger-webhook/action";
|
|
46
48
|
import { triggerZapierWebhook } from "./actions/trigger-zapier-webhook/action";
|
|
@@ -53,6 +55,9 @@ import { resetRefundDetails } from "./actions/reset-refund-details/action";
|
|
|
53
55
|
import { calculateRefundTotal } from "./actions/calculate-refund-total/action";
|
|
54
56
|
import { getRemainingRefundableQuantities } from "./actions/get-remaining-refundable-quantities/action";
|
|
55
57
|
import { processPartialRefund } from "./actions/process-partial-refund/action";
|
|
58
|
+
// Custom Tables Actions
|
|
59
|
+
import { getCustomTables } from "./actions/get-custom-tables/action";
|
|
60
|
+
import { getCustomTableFields } from "./actions/get-custom-table-fields/action";
|
|
56
61
|
// Export actions as command object
|
|
57
62
|
export const command = {
|
|
58
63
|
exampleFunction,
|
|
@@ -98,6 +103,8 @@ export const command = {
|
|
|
98
103
|
authenticateUser,
|
|
99
104
|
partialPayment,
|
|
100
105
|
switchUser,
|
|
106
|
+
print,
|
|
107
|
+
setActiveOrder,
|
|
101
108
|
// Integration Actions
|
|
102
109
|
triggerWebhook,
|
|
103
110
|
triggerZapierWebhook,
|
|
@@ -109,6 +116,9 @@ export const command = {
|
|
|
109
116
|
calculateRefundTotal,
|
|
110
117
|
getRemainingRefundableQuantities,
|
|
111
118
|
processPartialRefund,
|
|
119
|
+
// Custom Tables Actions
|
|
120
|
+
getCustomTables,
|
|
121
|
+
getCustomTableFields
|
|
112
122
|
};
|
|
113
123
|
// Export Common Types
|
|
114
124
|
export * from "./CommonTypes";
|
|
@@ -121,7 +131,7 @@ export * from "./projects/manage";
|
|
|
121
131
|
// Export client
|
|
122
132
|
export { commandFrameClient, CommandFrameClient } from "./client";
|
|
123
133
|
// Export Pub/Sub
|
|
124
|
-
export { topics } from "./pubsub/
|
|
134
|
+
export { topics } from "./pubsub/topics";
|
|
125
135
|
// Export Pub/Sub Topics
|
|
126
136
|
export { customersTopic } from "./pubsub/topics/customers";
|
|
127
137
|
export { ordersTopic } from "./pubsub/topics/orders";
|
|
@@ -129,3 +139,4 @@ export { refundsTopic } from "./pubsub/topics/refunds";
|
|
|
129
139
|
export { productsTopic } from "./pubsub/topics/products";
|
|
130
140
|
export { cartTopic } from "./pubsub/topics/cart";
|
|
131
141
|
export { paymentsTopic } from "./pubsub/topics/payments";
|
|
142
|
+
export { customTablesTopic } from "./pubsub/topics/custom-tables";
|
|
@@ -46,6 +46,8 @@ import { mockTriggerWebhook } from "../../actions/trigger-webhook/mock";
|
|
|
46
46
|
import { mockTriggerZapierWebhook } from "../../actions/trigger-zapier-webhook/mock";
|
|
47
47
|
import { mockVendaraPayment } from "../../actions/vendara-payment/mock";
|
|
48
48
|
import { mockGetFinalContext } from "../../actions/get-final-context/mock";
|
|
49
|
+
import { mockPrint } from "../../actions/print/mock";
|
|
50
|
+
import { mockSetActiveOrder } from "../../actions/set-active-order/mock";
|
|
49
51
|
export const RENDER_MOCKS = {
|
|
50
52
|
addCartDiscount: mockAddCartDiscount,
|
|
51
53
|
addCartFee: mockAddCartFee,
|
|
@@ -95,4 +97,6 @@ export const RENDER_MOCKS = {
|
|
|
95
97
|
triggerZapierWebhook: mockTriggerZapierWebhook,
|
|
96
98
|
vendaraPayment: mockVendaraPayment,
|
|
97
99
|
getFinalContext: mockGetFinalContext,
|
|
100
|
+
print: mockPrint,
|
|
101
|
+
setActiveOrder: mockSetActiveOrder
|
|
98
102
|
};
|
|
@@ -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 } 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 } from "../../index";
|
|
2
2
|
export interface RenderProviderActions {
|
|
3
3
|
exampleFunction: ExampleFunction;
|
|
4
4
|
getProducts: GetProducts;
|
|
@@ -48,4 +48,6 @@ export interface RenderProviderActions {
|
|
|
48
48
|
getRemainingRefundableQuantities: GetRemainingRefundableQuantities;
|
|
49
49
|
processPartialRefund: ProcessPartialRefund;
|
|
50
50
|
getCurrentCart: GetCurrentCart;
|
|
51
|
+
print: Print;
|
|
52
|
+
setActiveOrder: SetActiveOrder;
|
|
51
53
|
}
|
|
@@ -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 @@
|
|
|
1
|
+
export {};
|
|
@@ -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 @@
|
|
|
1
|
+
export {};
|
|
@@ -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 @@
|
|
|
1
|
+
export {};
|
|
@@ -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";
|
|
@@ -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
package/dist/pubsub/topic.d.ts
DELETED
|
@@ -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 };
|
package/dist/pubsub/topic.js
DELETED
|
@@ -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 };
|