@final-commerce/command-frame 0.0.1
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/LICENSE +22 -0
- package/README.md +418 -0
- package/dist/actions/add-cart-discount/action.d.ts +6 -0
- package/dist/actions/add-cart-discount/action.js +8 -0
- package/dist/actions/add-cart-discount/types.d.ts +13 -0
- package/dist/actions/add-cart-discount/types.js +1 -0
- package/dist/actions/add-cart-fee/action.d.ts +6 -0
- package/dist/actions/add-cart-fee/action.js +8 -0
- package/dist/actions/add-cart-fee/types.d.ts +16 -0
- package/dist/actions/add-cart-fee/types.js +1 -0
- package/dist/actions/add-custom-sale/action.d.ts +6 -0
- package/dist/actions/add-custom-sale/action.js +8 -0
- package/dist/actions/add-custom-sale/types.d.ts +13 -0
- package/dist/actions/add-custom-sale/types.js +1 -0
- package/dist/actions/add-customer/action.d.ts +6 -0
- package/dist/actions/add-customer/action.js +8 -0
- package/dist/actions/add-customer/types.d.ts +9 -0
- package/dist/actions/add-customer/types.js +1 -0
- package/dist/actions/add-customer-note/action.d.ts +6 -0
- package/dist/actions/add-customer-note/action.js +8 -0
- package/dist/actions/add-customer-note/types.d.ts +11 -0
- package/dist/actions/add-customer-note/types.js +1 -0
- package/dist/actions/add-order-note/action.d.ts +6 -0
- package/dist/actions/add-order-note/action.js +8 -0
- package/dist/actions/add-order-note/types.d.ts +9 -0
- package/dist/actions/add-order-note/types.js +1 -0
- package/dist/actions/add-product-discount/action.d.ts +6 -0
- package/dist/actions/add-product-discount/action.js +8 -0
- package/dist/actions/add-product-discount/types.d.ts +13 -0
- package/dist/actions/add-product-discount/types.js +1 -0
- package/dist/actions/add-product-fee/action.d.ts +6 -0
- package/dist/actions/add-product-fee/action.js +8 -0
- package/dist/actions/add-product-fee/types.d.ts +16 -0
- package/dist/actions/add-product-fee/types.js +1 -0
- package/dist/actions/add-product-note/action.d.ts +6 -0
- package/dist/actions/add-product-note/action.js +8 -0
- package/dist/actions/add-product-note/types.d.ts +9 -0
- package/dist/actions/add-product-note/types.js +1 -0
- package/dist/actions/add-product-to-cart/action.d.ts +6 -0
- package/dist/actions/add-product-to-cart/action.js +8 -0
- package/dist/actions/add-product-to-cart/types.d.ts +12 -0
- package/dist/actions/add-product-to-cart/types.js +1 -0
- package/dist/actions/adjust-inventory/action.d.ts +6 -0
- package/dist/actions/adjust-inventory/action.js +8 -0
- package/dist/actions/adjust-inventory/types.d.ts +12 -0
- package/dist/actions/adjust-inventory/types.js +1 -0
- package/dist/actions/assign-customer/action.d.ts +6 -0
- package/dist/actions/assign-customer/action.js +8 -0
- package/dist/actions/assign-customer/types.d.ts +9 -0
- package/dist/actions/assign-customer/types.js +1 -0
- package/dist/actions/authenticate-user/action.d.ts +6 -0
- package/dist/actions/authenticate-user/action.js +8 -0
- package/dist/actions/authenticate-user/types.d.ts +9 -0
- package/dist/actions/authenticate-user/types.js +1 -0
- package/dist/actions/calculate-refund-total/action.d.ts +6 -0
- package/dist/actions/calculate-refund-total/action.js +8 -0
- package/dist/actions/calculate-refund-total/types.d.ts +12 -0
- package/dist/actions/calculate-refund-total/types.js +1 -0
- package/dist/actions/cash-payment/action.d.ts +6 -0
- package/dist/actions/cash-payment/action.js +8 -0
- package/dist/actions/cash-payment/types.d.ts +13 -0
- package/dist/actions/cash-payment/types.js +1 -0
- package/dist/actions/clear-cart/action.d.ts +6 -0
- package/dist/actions/clear-cart/action.js +8 -0
- package/dist/actions/clear-cart/types.d.ts +5 -0
- package/dist/actions/clear-cart/types.js +1 -0
- package/dist/actions/delete-parked-order/action.d.ts +6 -0
- package/dist/actions/delete-parked-order/action.js +8 -0
- package/dist/actions/delete-parked-order/types.d.ts +9 -0
- package/dist/actions/delete-parked-order/types.js +1 -0
- package/dist/actions/example-function/action.d.ts +6 -0
- package/dist/actions/example-function/action.js +8 -0
- package/dist/actions/example-function/types.d.ts +16 -0
- package/dist/actions/example-function/types.js +1 -0
- package/dist/actions/get-categories/action.d.ts +6 -0
- package/dist/actions/get-categories/action.js +8 -0
- package/dist/actions/get-categories/types.d.ts +16 -0
- package/dist/actions/get-categories/types.js +1 -0
- package/dist/actions/get-context/action.d.ts +6 -0
- package/dist/actions/get-context/action.js +8 -0
- package/dist/actions/get-context/types.d.ts +17 -0
- package/dist/actions/get-context/types.js +1 -0
- package/dist/actions/get-current-cart/action.d.ts +6 -0
- package/dist/actions/get-current-cart/action.js +8 -0
- package/dist/actions/get-current-cart/types.d.ts +6 -0
- package/dist/actions/get-current-cart/types.js +1 -0
- package/dist/actions/get-customers/action.d.ts +6 -0
- package/dist/actions/get-customers/action.js +8 -0
- package/dist/actions/get-customers/types.d.ts +31 -0
- package/dist/actions/get-customers/types.js +1 -0
- package/dist/actions/get-line-items-by-order/action.d.ts +6 -0
- package/dist/actions/get-line-items-by-order/action.js +8 -0
- package/dist/actions/get-line-items-by-order/types.d.ts +13 -0
- package/dist/actions/get-line-items-by-order/types.js +1 -0
- package/dist/actions/get-orders/action.d.ts +6 -0
- package/dist/actions/get-orders/action.js +8 -0
- package/dist/actions/get-orders/types.d.ts +17 -0
- package/dist/actions/get-orders/types.js +1 -0
- package/dist/actions/get-product-variants/action.d.ts +6 -0
- package/dist/actions/get-product-variants/action.js +8 -0
- package/dist/actions/get-product-variants/types.d.ts +9 -0
- package/dist/actions/get-product-variants/types.js +1 -0
- package/dist/actions/get-products/action.d.ts +6 -0
- package/dist/actions/get-products/action.js +8 -0
- package/dist/actions/get-products/types.d.ts +28 -0
- package/dist/actions/get-products/types.js +1 -0
- package/dist/actions/get-refunds/action.d.ts +6 -0
- package/dist/actions/get-refunds/action.js +8 -0
- package/dist/actions/get-refunds/types.d.ts +16 -0
- package/dist/actions/get-refunds/types.js +1 -0
- package/dist/actions/get-remaining-refundable-quantities/action.d.ts +6 -0
- package/dist/actions/get-remaining-refundable-quantities/action.js +8 -0
- package/dist/actions/get-remaining-refundable-quantities/types.d.ts +7 -0
- package/dist/actions/get-remaining-refundable-quantities/types.js +1 -0
- package/dist/actions/go-to-page/action.d.ts +6 -0
- package/dist/actions/go-to-page/action.js +8 -0
- package/dist/actions/go-to-page/types.d.ts +9 -0
- package/dist/actions/go-to-page/types.js +1 -0
- package/dist/actions/go-to-station-home/action.d.ts +6 -0
- package/dist/actions/go-to-station-home/action.js +8 -0
- package/dist/actions/go-to-station-home/types.d.ts +5 -0
- package/dist/actions/go-to-station-home/types.js +1 -0
- package/dist/actions/initiate-refund/action.d.ts +6 -0
- package/dist/actions/initiate-refund/action.js +8 -0
- package/dist/actions/initiate-refund/types.d.ts +9 -0
- package/dist/actions/initiate-refund/types.js +1 -0
- package/dist/actions/open-cash-drawer/action.d.ts +6 -0
- package/dist/actions/open-cash-drawer/action.js +8 -0
- package/dist/actions/open-cash-drawer/types.d.ts +5 -0
- package/dist/actions/open-cash-drawer/types.js +1 -0
- package/dist/actions/open-popup/action.d.ts +6 -0
- package/dist/actions/open-popup/action.js +8 -0
- package/dist/actions/open-popup/types.d.ts +9 -0
- package/dist/actions/open-popup/types.js +1 -0
- package/dist/actions/park-order/action.d.ts +6 -0
- package/dist/actions/park-order/action.js +8 -0
- package/dist/actions/park-order/types.d.ts +6 -0
- package/dist/actions/park-order/types.js +1 -0
- package/dist/actions/partial-payment/action.d.ts +6 -0
- package/dist/actions/partial-payment/action.js +8 -0
- package/dist/actions/partial-payment/types.d.ts +14 -0
- package/dist/actions/partial-payment/types.js +1 -0
- package/dist/actions/process-partial-refund/action.d.ts +6 -0
- package/dist/actions/process-partial-refund/action.js +8 -0
- package/dist/actions/process-partial-refund/types.d.ts +9 -0
- package/dist/actions/process-partial-refund/types.js +1 -0
- package/dist/actions/remove-customer-from-cart/action.d.ts +6 -0
- package/dist/actions/remove-customer-from-cart/action.js +8 -0
- package/dist/actions/remove-customer-from-cart/types.d.ts +5 -0
- package/dist/actions/remove-customer-from-cart/types.js +1 -0
- package/dist/actions/reset-refund-details/action.d.ts +6 -0
- package/dist/actions/reset-refund-details/action.js +8 -0
- package/dist/actions/reset-refund-details/types.d.ts +5 -0
- package/dist/actions/reset-refund-details/types.js +1 -0
- package/dist/actions/resume-parked-order/action.d.ts +6 -0
- package/dist/actions/resume-parked-order/action.js +8 -0
- package/dist/actions/resume-parked-order/types.d.ts +9 -0
- package/dist/actions/resume-parked-order/types.js +1 -0
- package/dist/actions/select-all-refund-items/action.d.ts +6 -0
- package/dist/actions/select-all-refund-items/action.js +8 -0
- package/dist/actions/select-all-refund-items/types.d.ts +6 -0
- package/dist/actions/select-all-refund-items/types.js +1 -0
- package/dist/actions/set-product-active/action.d.ts +6 -0
- package/dist/actions/set-product-active/action.js +8 -0
- package/dist/actions/set-product-active/types.d.ts +9 -0
- package/dist/actions/set-product-active/types.js +1 -0
- package/dist/actions/set-refund-stock-action/action.d.ts +6 -0
- package/dist/actions/set-refund-stock-action/action.js +8 -0
- package/dist/actions/set-refund-stock-action/types.d.ts +11 -0
- package/dist/actions/set-refund-stock-action/types.js +1 -0
- package/dist/actions/show-confirmation/action.d.ts +6 -0
- package/dist/actions/show-confirmation/action.js +8 -0
- package/dist/actions/show-confirmation/types.d.ts +9 -0
- package/dist/actions/show-confirmation/types.js +1 -0
- package/dist/actions/show-notification/action.d.ts +6 -0
- package/dist/actions/show-notification/action.js +8 -0
- package/dist/actions/show-notification/types.d.ts +9 -0
- package/dist/actions/show-notification/types.js +1 -0
- package/dist/actions/switch-user/action.d.ts +6 -0
- package/dist/actions/switch-user/action.js +8 -0
- package/dist/actions/switch-user/types.d.ts +13 -0
- package/dist/actions/switch-user/types.js +1 -0
- package/dist/actions/tap-to-pay-payment/action.d.ts +6 -0
- package/dist/actions/tap-to-pay-payment/action.js +8 -0
- package/dist/actions/tap-to-pay-payment/types.d.ts +11 -0
- package/dist/actions/tap-to-pay-payment/types.js +1 -0
- package/dist/actions/terminal-payment/action.d.ts +6 -0
- package/dist/actions/terminal-payment/action.js +8 -0
- package/dist/actions/terminal-payment/types.d.ts +11 -0
- package/dist/actions/terminal-payment/types.js +1 -0
- package/dist/actions/toggle-slide-out/action.d.ts +6 -0
- package/dist/actions/toggle-slide-out/action.js +8 -0
- package/dist/actions/toggle-slide-out/types.d.ts +9 -0
- package/dist/actions/toggle-slide-out/types.js +1 -0
- package/dist/actions/trigger-webhook/action.d.ts +6 -0
- package/dist/actions/trigger-webhook/action.js +8 -0
- package/dist/actions/trigger-webhook/types.d.ts +16 -0
- package/dist/actions/trigger-webhook/types.js +1 -0
- package/dist/actions/trigger-zapier-webhook/action.d.ts +6 -0
- package/dist/actions/trigger-zapier-webhook/action.js +8 -0
- package/dist/actions/trigger-zapier-webhook/types.d.ts +9 -0
- package/dist/actions/trigger-zapier-webhook/types.js +1 -0
- package/dist/actions/update-customer-facing-display/action.d.ts +6 -0
- package/dist/actions/update-customer-facing-display/action.js +8 -0
- package/dist/actions/update-customer-facing-display/types.d.ts +9 -0
- package/dist/actions/update-customer-facing-display/types.js +1 -0
- package/dist/actions/vendara-payment/action.d.ts +6 -0
- package/dist/actions/vendara-payment/action.js +8 -0
- package/dist/actions/vendara-payment/types.d.ts +11 -0
- package/dist/actions/vendara-payment/types.js +1 -0
- package/dist/client.d.ts +33 -0
- package/dist/client.js +145 -0
- package/dist/index.d.ts +108 -0
- package/dist/index.js +121 -0
- package/dist/types.d.ts +64 -0
- package/dist/types.js +1 -0
- package/package.json +48 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface ShowConfirmationParams {
|
|
2
|
+
message: string;
|
|
3
|
+
}
|
|
4
|
+
export interface ShowConfirmationResponse {
|
|
5
|
+
success: boolean;
|
|
6
|
+
message: string;
|
|
7
|
+
timestamp: string;
|
|
8
|
+
}
|
|
9
|
+
export type ShowConfirmation = (params?: ShowConfirmationParams) => Promise<ShowConfirmationResponse>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Show notification action
|
|
3
|
+
* Calls the showNotification action on the parent window
|
|
4
|
+
*/
|
|
5
|
+
import { commandFrameClient } from "../../client";
|
|
6
|
+
export const showNotification = async (params) => {
|
|
7
|
+
return await commandFrameClient.call("showNotification", params);
|
|
8
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface ShowNotificationParams {
|
|
2
|
+
message: string;
|
|
3
|
+
}
|
|
4
|
+
export interface ShowNotificationResponse {
|
|
5
|
+
success: boolean;
|
|
6
|
+
message: string;
|
|
7
|
+
timestamp: string;
|
|
8
|
+
}
|
|
9
|
+
export type ShowNotification = (params?: ShowNotificationParams) => Promise<ShowNotificationResponse>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface SwitchUserParams {
|
|
2
|
+
mode: 'dialog' | 'role' | 'specific';
|
|
3
|
+
roleIds?: string[];
|
|
4
|
+
userId?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface SwitchUserResponse {
|
|
7
|
+
success: boolean;
|
|
8
|
+
mode: 'dialog' | 'role' | 'specific';
|
|
9
|
+
roleIds?: string[];
|
|
10
|
+
userId?: string;
|
|
11
|
+
timestamp: string;
|
|
12
|
+
}
|
|
13
|
+
export type SwitchUser = (params?: SwitchUserParams) => Promise<SwitchUserResponse>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tap to pay payment action
|
|
3
|
+
* Calls the tapToPayPayment action on the parent window
|
|
4
|
+
*/
|
|
5
|
+
import { commandFrameClient } from "../../client";
|
|
6
|
+
export const tapToPayPayment = async (params) => {
|
|
7
|
+
return await commandFrameClient.call("tapToPayPayment", params);
|
|
8
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface TapToPayPaymentParams {
|
|
2
|
+
amount?: number;
|
|
3
|
+
}
|
|
4
|
+
export interface TapToPayPaymentResponse {
|
|
5
|
+
success: boolean;
|
|
6
|
+
amount: number | null;
|
|
7
|
+
paymentType: string;
|
|
8
|
+
order: any | null;
|
|
9
|
+
timestamp: string;
|
|
10
|
+
}
|
|
11
|
+
export type TapToPayPayment = (params?: TapToPayPaymentParams) => Promise<TapToPayPaymentResponse>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Terminal payment action
|
|
3
|
+
* Calls the terminalPayment action on the parent window
|
|
4
|
+
*/
|
|
5
|
+
import { commandFrameClient } from "../../client";
|
|
6
|
+
export const terminalPayment = async (params) => {
|
|
7
|
+
return await commandFrameClient.call("terminalPayment", params);
|
|
8
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface TerminalPaymentParams {
|
|
2
|
+
amount?: number;
|
|
3
|
+
}
|
|
4
|
+
export interface TerminalPaymentResponse {
|
|
5
|
+
success: boolean;
|
|
6
|
+
amount: number | null;
|
|
7
|
+
paymentType: string;
|
|
8
|
+
order: any | null;
|
|
9
|
+
timestamp: string;
|
|
10
|
+
}
|
|
11
|
+
export type TerminalPayment = (params?: TerminalPaymentParams) => Promise<TerminalPaymentResponse>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Toggle slide out action
|
|
3
|
+
* Calls the toggleSlideOut action on the parent window
|
|
4
|
+
*/
|
|
5
|
+
import { commandFrameClient } from "../../client";
|
|
6
|
+
export const toggleSlideOut = async (params) => {
|
|
7
|
+
return await commandFrameClient.call("toggleSlideOut", params);
|
|
8
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface ToggleSlideOutParams {
|
|
2
|
+
slideOutId: string;
|
|
3
|
+
}
|
|
4
|
+
export interface ToggleSlideOutResponse {
|
|
5
|
+
success: boolean;
|
|
6
|
+
slideOutId: string;
|
|
7
|
+
timestamp: string;
|
|
8
|
+
}
|
|
9
|
+
export type ToggleSlideOut = (params?: ToggleSlideOutParams) => Promise<ToggleSlideOutResponse>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trigger webhook action
|
|
3
|
+
* Calls the triggerWebhook action on the parent window
|
|
4
|
+
*/
|
|
5
|
+
import { commandFrameClient } from "../../client";
|
|
6
|
+
export const triggerWebhook = async (params) => {
|
|
7
|
+
return await commandFrameClient.call("triggerWebhook", params);
|
|
8
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface TriggerWebhookParams {
|
|
2
|
+
webhookUrl: string;
|
|
3
|
+
publicKey?: string;
|
|
4
|
+
presetData?: boolean;
|
|
5
|
+
presetType?: string;
|
|
6
|
+
isCustomHook?: boolean;
|
|
7
|
+
customHookData?: string;
|
|
8
|
+
payloadType?: string;
|
|
9
|
+
dynamicDataFields?: any[];
|
|
10
|
+
}
|
|
11
|
+
export interface TriggerWebhookResponse {
|
|
12
|
+
success: boolean;
|
|
13
|
+
webhookUrl: string;
|
|
14
|
+
timestamp: string;
|
|
15
|
+
}
|
|
16
|
+
export type TriggerWebhook = (params?: TriggerWebhookParams) => Promise<TriggerWebhookResponse>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trigger Zapier webhook action
|
|
3
|
+
* Calls the triggerZapierWebhook action on the parent window
|
|
4
|
+
*/
|
|
5
|
+
import { commandFrameClient } from "../../client";
|
|
6
|
+
export const triggerZapierWebhook = async (params) => {
|
|
7
|
+
return await commandFrameClient.call("triggerZapierWebhook", params);
|
|
8
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface TriggerZapierWebhookParams {
|
|
2
|
+
triggerUrl: string;
|
|
3
|
+
}
|
|
4
|
+
export interface TriggerZapierWebhookResponse {
|
|
5
|
+
success: boolean;
|
|
6
|
+
triggerUrl: string;
|
|
7
|
+
timestamp: string;
|
|
8
|
+
}
|
|
9
|
+
export type TriggerZapierWebhook = (params?: TriggerZapierWebhookParams) => Promise<TriggerZapierWebhookResponse>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Update customer facing display action
|
|
3
|
+
* Calls the updateCustomerFacingDisplay action on the parent window
|
|
4
|
+
*/
|
|
5
|
+
import { commandFrameClient } from "../../client";
|
|
6
|
+
export const updateCustomerFacingDisplay = async (params) => {
|
|
7
|
+
return await commandFrameClient.call("updateCustomerFacingDisplay", params);
|
|
8
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface UpdateCustomerFacingDisplayParams {
|
|
2
|
+
pageId: string;
|
|
3
|
+
}
|
|
4
|
+
export interface UpdateCustomerFacingDisplayResponse {
|
|
5
|
+
success: boolean;
|
|
6
|
+
pageId: string;
|
|
7
|
+
timestamp: string;
|
|
8
|
+
}
|
|
9
|
+
export type UpdateCustomerFacingDisplay = (params?: UpdateCustomerFacingDisplayParams) => Promise<UpdateCustomerFacingDisplayResponse>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vendara payment action
|
|
3
|
+
* Calls the vendaraPayment action on the parent window
|
|
4
|
+
*/
|
|
5
|
+
import { commandFrameClient } from "../../client";
|
|
6
|
+
export const vendaraPayment = async (params) => {
|
|
7
|
+
return await commandFrameClient.call("vendaraPayment", params);
|
|
8
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface VendaraPaymentParams {
|
|
2
|
+
amount?: number;
|
|
3
|
+
}
|
|
4
|
+
export interface VendaraPaymentResponse {
|
|
5
|
+
success: boolean;
|
|
6
|
+
amount: number | null;
|
|
7
|
+
paymentType: string;
|
|
8
|
+
order: any | null;
|
|
9
|
+
timestamp: string;
|
|
10
|
+
}
|
|
11
|
+
export type VendaraPayment = (params?: VendaraPaymentParams) => Promise<VendaraPaymentResponse>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Commands Frame Client for iframe communication
|
|
3
|
+
* Allows the iframe to call functions on the parent window via postMessage
|
|
4
|
+
*/
|
|
5
|
+
export interface PostMessageRequest<T = any> {
|
|
6
|
+
action: string;
|
|
7
|
+
params?: T;
|
|
8
|
+
requestId: string;
|
|
9
|
+
}
|
|
10
|
+
export interface PostMessageResponse<T = any> {
|
|
11
|
+
requestId: string;
|
|
12
|
+
success: boolean;
|
|
13
|
+
data?: T;
|
|
14
|
+
error?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare class CommandFrameClient {
|
|
17
|
+
private pendingRequests;
|
|
18
|
+
private defaultTimeout;
|
|
19
|
+
private origin;
|
|
20
|
+
private debug;
|
|
21
|
+
private useGlobalDebug;
|
|
22
|
+
constructor(options?: {
|
|
23
|
+
timeout?: number;
|
|
24
|
+
origin?: string;
|
|
25
|
+
debug?: boolean;
|
|
26
|
+
});
|
|
27
|
+
private isDebugEnabled;
|
|
28
|
+
call<TParams = any, TResponse = any>(action: string, params?: TParams, timeout?: number): Promise<TResponse>;
|
|
29
|
+
private handleMessage;
|
|
30
|
+
private generateRequestId;
|
|
31
|
+
destroy(): void;
|
|
32
|
+
}
|
|
33
|
+
export declare const commandFrameClient: CommandFrameClient;
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Commands Frame Client for iframe communication
|
|
3
|
+
* Allows the iframe to call functions on the parent window via postMessage
|
|
4
|
+
*/
|
|
5
|
+
export class CommandFrameClient {
|
|
6
|
+
constructor(options = {}) {
|
|
7
|
+
this.pendingRequests = new Map();
|
|
8
|
+
this.defaultTimeout = options.timeout || 60000;
|
|
9
|
+
this.origin = options.origin || "*";
|
|
10
|
+
this.debug = options.debug ?? false;
|
|
11
|
+
this.useGlobalDebug = options.debug === undefined;
|
|
12
|
+
if (typeof window !== 'undefined') {
|
|
13
|
+
window.addEventListener("message", this.handleMessage.bind(this));
|
|
14
|
+
}
|
|
15
|
+
if (this.isDebugEnabled()) {
|
|
16
|
+
console.log("[ActionsClient] Initialized", {
|
|
17
|
+
origin: this.origin,
|
|
18
|
+
debug: this.isDebugEnabled()
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
isDebugEnabled() {
|
|
23
|
+
if (!this.useGlobalDebug) {
|
|
24
|
+
return this.debug;
|
|
25
|
+
}
|
|
26
|
+
return typeof window !== "undefined" && window.__POSTMESSAGE_DEBUG__ === true;
|
|
27
|
+
}
|
|
28
|
+
async call(action, params, timeout) {
|
|
29
|
+
return new Promise((resolve, reject) => {
|
|
30
|
+
const requestId = this.generateRequestId();
|
|
31
|
+
const timeoutMs = timeout || this.defaultTimeout;
|
|
32
|
+
const timeoutHandle = setTimeout(() => {
|
|
33
|
+
this.pendingRequests.delete(requestId);
|
|
34
|
+
const error = new Error(`PostMessage request timeout: ${action} (${timeoutMs}ms)`);
|
|
35
|
+
if (this.isDebugEnabled()) {
|
|
36
|
+
console.error("[ActionsClient] Request timeout", {
|
|
37
|
+
requestId,
|
|
38
|
+
action,
|
|
39
|
+
timeout: timeoutMs
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
reject(error);
|
|
43
|
+
}, timeoutMs);
|
|
44
|
+
this.pendingRequests.set(requestId, {
|
|
45
|
+
resolve,
|
|
46
|
+
reject,
|
|
47
|
+
timeout: timeoutHandle
|
|
48
|
+
});
|
|
49
|
+
const message = {
|
|
50
|
+
action,
|
|
51
|
+
params,
|
|
52
|
+
requestId
|
|
53
|
+
};
|
|
54
|
+
if (this.isDebugEnabled()) {
|
|
55
|
+
console.log("[ActionsClient] Sending request", {
|
|
56
|
+
requestId,
|
|
57
|
+
action,
|
|
58
|
+
params,
|
|
59
|
+
origin: this.origin,
|
|
60
|
+
timestamp: new Date().toISOString()
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
if (typeof window !== 'undefined' && window.parent) {
|
|
64
|
+
window.parent.postMessage(message, this.origin);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
clearTimeout(timeoutHandle);
|
|
68
|
+
this.pendingRequests.delete(requestId);
|
|
69
|
+
const error = new Error("No parent window found. This app must run in an iframe.");
|
|
70
|
+
if (this.isDebugEnabled()) {
|
|
71
|
+
console.error("[ActionsClient] No parent window", error);
|
|
72
|
+
}
|
|
73
|
+
reject(error);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
handleMessage(event) {
|
|
78
|
+
if (this.isDebugEnabled()) {
|
|
79
|
+
console.log("[ActionsClient] Received message", {
|
|
80
|
+
origin: event.origin,
|
|
81
|
+
data: event.data,
|
|
82
|
+
timestamp: new Date().toISOString()
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
if (this.origin !== "*" && event.origin !== this.origin) {
|
|
86
|
+
if (this.isDebugEnabled()) {
|
|
87
|
+
console.warn("[ActionsClient] Origin mismatch", {
|
|
88
|
+
expected: this.origin,
|
|
89
|
+
received: event.origin
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const response = event.data;
|
|
95
|
+
if (response && response.requestId && this.pendingRequests.has(response.requestId)) {
|
|
96
|
+
const { resolve, reject, timeout } = this.pendingRequests.get(response.requestId);
|
|
97
|
+
clearTimeout(timeout);
|
|
98
|
+
this.pendingRequests.delete(response.requestId);
|
|
99
|
+
if (this.isDebugEnabled()) {
|
|
100
|
+
console.log("[ActionsClient] Response received", {
|
|
101
|
+
requestId: response.requestId,
|
|
102
|
+
success: response.success,
|
|
103
|
+
data: response.data,
|
|
104
|
+
error: response.error
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
if (response.success) {
|
|
108
|
+
resolve(response.data);
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
const error = new Error(response.error || "Unknown error occurred");
|
|
112
|
+
if (this.isDebugEnabled()) {
|
|
113
|
+
console.error("[ActionsClient] Request failed", {
|
|
114
|
+
requestId: response.requestId,
|
|
115
|
+
error: error.message
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
reject(error);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
else if (this.isDebugEnabled() && response && response.requestId) {
|
|
122
|
+
console.warn("[ActionsClient] Unmatched response", {
|
|
123
|
+
requestId: response.requestId,
|
|
124
|
+
pendingRequests: Array.from(this.pendingRequests.keys())
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
generateRequestId() {
|
|
129
|
+
return `req_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
130
|
+
}
|
|
131
|
+
destroy() {
|
|
132
|
+
this.pendingRequests.forEach(({ reject, timeout }) => {
|
|
133
|
+
clearTimeout(timeout);
|
|
134
|
+
reject(new Error("CommandFrameClient destroyed"));
|
|
135
|
+
});
|
|
136
|
+
this.pendingRequests.clear();
|
|
137
|
+
if (typeof window !== 'undefined') {
|
|
138
|
+
window.removeEventListener("message", this.handleMessage.bind(this));
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
// Singleton instance
|
|
143
|
+
export const commandFrameClient = new CommandFrameClient({
|
|
144
|
+
debug: typeof window !== "undefined" && window.__POSTMESSAGE_DEBUG__ === true
|
|
145
|
+
});
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
export declare const command: {
|
|
2
|
+
readonly exampleFunction: import("./actions/example-function/types").ExampleFunction;
|
|
3
|
+
readonly getProducts: import("./actions/get-products/types").GetProducts;
|
|
4
|
+
readonly addCustomSale: import("./actions/add-custom-sale/types").AddCustomSale;
|
|
5
|
+
readonly getCustomers: import("./actions/get-customers/types").GetCustomers;
|
|
6
|
+
readonly assignCustomer: import("./actions/assign-customer/types").AssignCustomer;
|
|
7
|
+
readonly addCustomer: import("./actions/add-customer/types").AddCustomer;
|
|
8
|
+
readonly getCategories: import("./actions/get-categories/types").GetCategories;
|
|
9
|
+
readonly getProductVariants: import("./actions/get-product-variants/types").GetProductVariants;
|
|
10
|
+
readonly getOrders: import("./actions/get-orders/types").GetOrders;
|
|
11
|
+
readonly getRefunds: import("./actions/get-refunds/types").GetRefunds;
|
|
12
|
+
readonly setProductActive: import("./actions/set-product-active/types").SetProductActive;
|
|
13
|
+
readonly addProductDiscount: import("./actions/add-product-discount/types").AddProductDiscount;
|
|
14
|
+
readonly addProductToCart: import("./actions/add-product-to-cart/types").AddProductToCart;
|
|
15
|
+
readonly addCartDiscount: import("./actions/add-cart-discount/types").AddCartDiscount;
|
|
16
|
+
readonly getContext: import("./actions/get-context/types").GetContext;
|
|
17
|
+
readonly addProductNote: import("./actions/add-product-note/types").AddProductNote;
|
|
18
|
+
readonly addProductFee: import("./actions/add-product-fee/types").AddProductFee;
|
|
19
|
+
readonly adjustInventory: import("./actions/adjust-inventory/types").AdjustInventory;
|
|
20
|
+
readonly addOrderNote: import("./actions/add-order-note/types").AddOrderNote;
|
|
21
|
+
readonly addCartFee: import("./actions/add-cart-fee/types").AddCartFee;
|
|
22
|
+
readonly clearCart: import("./actions/clear-cart/types").ClearCart;
|
|
23
|
+
readonly parkOrder: import("./actions/park-order/types").ParkOrder;
|
|
24
|
+
readonly resumeParkedOrder: import("./actions/resume-parked-order/types").ResumeParkedOrder;
|
|
25
|
+
readonly deleteParkedOrder: import("./actions/delete-parked-order/types").DeleteParkedOrder;
|
|
26
|
+
readonly initiateRefund: import("./actions/initiate-refund/types").InitiateRefund;
|
|
27
|
+
readonly cashPayment: import("./actions/cash-payment/types").CashPayment;
|
|
28
|
+
readonly tapToPayPayment: import("./actions/tap-to-pay-payment/types").TapToPayPayment;
|
|
29
|
+
readonly terminalPayment: import("./actions/terminal-payment/types").TerminalPayment;
|
|
30
|
+
readonly vendaraPayment: import("./actions/vendara-payment/types").VendaraPayment;
|
|
31
|
+
readonly addCustomerNote: import("./actions/add-customer-note/types").AddCustomerNote;
|
|
32
|
+
readonly removeCustomerFromCart: import("./actions/remove-customer-from-cart/types").RemoveCustomerFromCart;
|
|
33
|
+
readonly goToStationHome: import("./actions/go-to-station-home/types").GoToStationHome;
|
|
34
|
+
readonly goToPage: import("./actions/go-to-page/types").GoToPage;
|
|
35
|
+
readonly openCashDrawer: import("./actions/open-cash-drawer/types").OpenCashDrawer;
|
|
36
|
+
readonly openPopup: import("./actions/open-popup/types").OpenPopup;
|
|
37
|
+
readonly showNotification: import("./actions/show-notification/types").ShowNotification;
|
|
38
|
+
readonly toggleSlideOut: import("./actions/toggle-slide-out/types").ToggleSlideOut;
|
|
39
|
+
readonly showConfirmation: import("./actions/show-confirmation/types").ShowConfirmation;
|
|
40
|
+
readonly authenticateUser: import("./actions/authenticate-user/types").AuthenticateUser;
|
|
41
|
+
readonly updateCustomerFacingDisplay: import("./actions/update-customer-facing-display/types").UpdateCustomerFacingDisplay;
|
|
42
|
+
readonly partialPayment: import("./actions/partial-payment/types").PartialPayment;
|
|
43
|
+
readonly switchUser: import("./actions/switch-user/types").SwitchUser;
|
|
44
|
+
readonly triggerWebhook: import("./actions/trigger-webhook/types").TriggerWebhook;
|
|
45
|
+
readonly triggerZapierWebhook: import("./actions/trigger-zapier-webhook/types").TriggerZapierWebhook;
|
|
46
|
+
readonly getLineItemsByOrder: import("./actions/get-line-items-by-order/types").GetLineItemsByOrder;
|
|
47
|
+
readonly setRefundStockAction: import("./actions/set-refund-stock-action/types").SetRefundStockAction;
|
|
48
|
+
readonly selectAllRefundItems: import("./actions/select-all-refund-items/types").SelectAllRefundItems;
|
|
49
|
+
readonly resetRefundDetails: import("./actions/reset-refund-details/types").ResetRefundDetails;
|
|
50
|
+
readonly calculateRefundTotal: import("./actions/calculate-refund-total/types").CalculateRefundTotal;
|
|
51
|
+
readonly getRemainingRefundableQuantities: import("./actions/get-remaining-refundable-quantities/types").GetRemainingRefundableQuantities;
|
|
52
|
+
readonly processPartialRefund: import("./actions/process-partial-refund/types").ProcessPartialRefund;
|
|
53
|
+
readonly getCurrentCart: import("./actions/get-current-cart/types").GetCurrentCart;
|
|
54
|
+
};
|
|
55
|
+
export type { ExampleFunction, ExampleFunctionParams, ExampleFunctionResponse } from "./actions/example-function/types";
|
|
56
|
+
export type { GetProducts, GetProductsParams, GetProductsResponse } from "./actions/get-products/types";
|
|
57
|
+
export type { AddCustomSale, AddCustomSaleParams, AddCustomSaleResponse } from "./actions/add-custom-sale/types";
|
|
58
|
+
export type { GetCustomers, GetCustomersParams, GetCustomersResponse } from "./actions/get-customers/types";
|
|
59
|
+
export type { AssignCustomer, AssignCustomerParams, AssignCustomerResponse } from "./actions/assign-customer/types";
|
|
60
|
+
export type { AddCustomer, AddCustomerParams, AddCustomerResponse } from "./actions/add-customer/types";
|
|
61
|
+
export type { GetCategories, GetCategoriesParams, GetCategoriesResponse } from "./actions/get-categories/types";
|
|
62
|
+
export type { GetProductVariants, GetProductVariantsParams, GetProductVariantsResponse } from "./actions/get-product-variants/types";
|
|
63
|
+
export type { GetOrders, GetOrdersParams, GetOrdersResponse } from "./actions/get-orders/types";
|
|
64
|
+
export type { GetRefunds, GetRefundsParams, GetRefundsResponse } from "./actions/get-refunds/types";
|
|
65
|
+
export type { GetLineItemsByOrder, GetLineItemsByOrderParams, GetLineItemsByOrderResponse } from "./actions/get-line-items-by-order/types";
|
|
66
|
+
export type { SetRefundStockAction, SetRefundStockActionParams, SetRefundStockActionResponse } from "./actions/set-refund-stock-action/types";
|
|
67
|
+
export type { SelectAllRefundItems, SelectAllRefundItemsResponse } from "./actions/select-all-refund-items/types";
|
|
68
|
+
export type { ResetRefundDetails, ResetRefundDetailsResponse } from "./actions/reset-refund-details/types";
|
|
69
|
+
export type { CalculateRefundTotal, CalculateRefundTotalResponse } from "./actions/calculate-refund-total/types";
|
|
70
|
+
export type { GetRemainingRefundableQuantities, GetRemainingRefundableQuantitiesResponse } from "./actions/get-remaining-refundable-quantities/types";
|
|
71
|
+
export type { ProcessPartialRefund, ProcessPartialRefundParams, ProcessPartialRefundResponse } from "./actions/process-partial-refund/types";
|
|
72
|
+
export type { GetCurrentCart, GetCurrentCartResponse } from "./actions/get-current-cart/types";
|
|
73
|
+
export type { SetProductActive, SetProductActiveParams, SetProductActiveResponse } from "./actions/set-product-active/types";
|
|
74
|
+
export type { AddProductDiscount, AddProductDiscountParams, AddProductDiscountResponse } from "./actions/add-product-discount/types";
|
|
75
|
+
export type { AddProductToCart, AddProductToCartParams, AddProductToCartResponse } from "./actions/add-product-to-cart/types";
|
|
76
|
+
export type { AddCartDiscount, AddCartDiscountParams, AddCartDiscountResponse } from "./actions/add-cart-discount/types";
|
|
77
|
+
export type { GetContext, GetContextResponse } from "./actions/get-context/types";
|
|
78
|
+
export type { AddProductNote, AddProductNoteParams, AddProductNoteResponse } from "./actions/add-product-note/types";
|
|
79
|
+
export type { AddProductFee, AddProductFeeParams, AddProductFeeResponse } from "./actions/add-product-fee/types";
|
|
80
|
+
export type { AdjustInventory, AdjustInventoryParams, AdjustInventoryResponse } from "./actions/adjust-inventory/types";
|
|
81
|
+
export type { AddOrderNote, AddOrderNoteParams, AddOrderNoteResponse } from "./actions/add-order-note/types";
|
|
82
|
+
export type { AddCartFee, AddCartFeeParams, AddCartFeeResponse } from "./actions/add-cart-fee/types";
|
|
83
|
+
export type { ClearCart, ClearCartResponse } from "./actions/clear-cart/types";
|
|
84
|
+
export type { ParkOrder, ParkOrderResponse } from "./actions/park-order/types";
|
|
85
|
+
export type { ResumeParkedOrder, ResumeParkedOrderParams, ResumeParkedOrderResponse } from "./actions/resume-parked-order/types";
|
|
86
|
+
export type { DeleteParkedOrder, DeleteParkedOrderParams, DeleteParkedOrderResponse } from "./actions/delete-parked-order/types";
|
|
87
|
+
export type { InitiateRefund, InitiateRefundParams, InitiateRefundResponse } from "./actions/initiate-refund/types";
|
|
88
|
+
export type { CashPayment, CashPaymentParams, CashPaymentResponse } from "./actions/cash-payment/types";
|
|
89
|
+
export type { TapToPayPayment, TapToPayPaymentParams, TapToPayPaymentResponse } from "./actions/tap-to-pay-payment/types";
|
|
90
|
+
export type { TerminalPayment, TerminalPaymentParams, TerminalPaymentResponse } from "./actions/terminal-payment/types";
|
|
91
|
+
export type { VendaraPayment, VendaraPaymentParams, VendaraPaymentResponse } from "./actions/vendara-payment/types";
|
|
92
|
+
export type { AddCustomerNote, AddCustomerNoteParams, AddCustomerNoteResponse } from "./actions/add-customer-note/types";
|
|
93
|
+
export type { RemoveCustomerFromCart, RemoveCustomerFromCartResponse } from "./actions/remove-customer-from-cart/types";
|
|
94
|
+
export type { GoToStationHome, GoToStationHomeResponse } from "./actions/go-to-station-home/types";
|
|
95
|
+
export type { GoToPage, GoToPageParams, GoToPageResponse } from "./actions/go-to-page/types";
|
|
96
|
+
export type { OpenCashDrawer, OpenCashDrawerResponse } from "./actions/open-cash-drawer/types";
|
|
97
|
+
export type { OpenPopup, OpenPopupParams, OpenPopupResponse } from "./actions/open-popup/types";
|
|
98
|
+
export type { ShowNotification, ShowNotificationParams, ShowNotificationResponse } from "./actions/show-notification/types";
|
|
99
|
+
export type { ToggleSlideOut, ToggleSlideOutParams, ToggleSlideOutResponse } from "./actions/toggle-slide-out/types";
|
|
100
|
+
export type { ShowConfirmation, ShowConfirmationParams, ShowConfirmationResponse } from "./actions/show-confirmation/types";
|
|
101
|
+
export type { AuthenticateUser, AuthenticateUserParams, AuthenticateUserResponse } from "./actions/authenticate-user/types";
|
|
102
|
+
export type { UpdateCustomerFacingDisplay, UpdateCustomerFacingDisplayParams, UpdateCustomerFacingDisplayResponse } from "./actions/update-customer-facing-display/types";
|
|
103
|
+
export type { PartialPayment, PartialPaymentParams, PartialPaymentResponse } from "./actions/partial-payment/types";
|
|
104
|
+
export type { SwitchUser, SwitchUserParams, SwitchUserResponse } from "./actions/switch-user/types";
|
|
105
|
+
export type { TriggerWebhook, TriggerWebhookParams, TriggerWebhookResponse } from "./actions/trigger-webhook/types";
|
|
106
|
+
export type { TriggerZapierWebhook, TriggerZapierWebhookParams, TriggerZapierWebhookResponse } from "./actions/trigger-zapier-webhook/types";
|
|
107
|
+
export { commandFrameClient, CommandFrameClient } from "./client";
|
|
108
|
+
export type { PostMessageRequest, PostMessageResponse } from "./client";
|