@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.
Files changed (217) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +418 -0
  3. package/dist/actions/add-cart-discount/action.d.ts +6 -0
  4. package/dist/actions/add-cart-discount/action.js +8 -0
  5. package/dist/actions/add-cart-discount/types.d.ts +13 -0
  6. package/dist/actions/add-cart-discount/types.js +1 -0
  7. package/dist/actions/add-cart-fee/action.d.ts +6 -0
  8. package/dist/actions/add-cart-fee/action.js +8 -0
  9. package/dist/actions/add-cart-fee/types.d.ts +16 -0
  10. package/dist/actions/add-cart-fee/types.js +1 -0
  11. package/dist/actions/add-custom-sale/action.d.ts +6 -0
  12. package/dist/actions/add-custom-sale/action.js +8 -0
  13. package/dist/actions/add-custom-sale/types.d.ts +13 -0
  14. package/dist/actions/add-custom-sale/types.js +1 -0
  15. package/dist/actions/add-customer/action.d.ts +6 -0
  16. package/dist/actions/add-customer/action.js +8 -0
  17. package/dist/actions/add-customer/types.d.ts +9 -0
  18. package/dist/actions/add-customer/types.js +1 -0
  19. package/dist/actions/add-customer-note/action.d.ts +6 -0
  20. package/dist/actions/add-customer-note/action.js +8 -0
  21. package/dist/actions/add-customer-note/types.d.ts +11 -0
  22. package/dist/actions/add-customer-note/types.js +1 -0
  23. package/dist/actions/add-order-note/action.d.ts +6 -0
  24. package/dist/actions/add-order-note/action.js +8 -0
  25. package/dist/actions/add-order-note/types.d.ts +9 -0
  26. package/dist/actions/add-order-note/types.js +1 -0
  27. package/dist/actions/add-product-discount/action.d.ts +6 -0
  28. package/dist/actions/add-product-discount/action.js +8 -0
  29. package/dist/actions/add-product-discount/types.d.ts +13 -0
  30. package/dist/actions/add-product-discount/types.js +1 -0
  31. package/dist/actions/add-product-fee/action.d.ts +6 -0
  32. package/dist/actions/add-product-fee/action.js +8 -0
  33. package/dist/actions/add-product-fee/types.d.ts +16 -0
  34. package/dist/actions/add-product-fee/types.js +1 -0
  35. package/dist/actions/add-product-note/action.d.ts +6 -0
  36. package/dist/actions/add-product-note/action.js +8 -0
  37. package/dist/actions/add-product-note/types.d.ts +9 -0
  38. package/dist/actions/add-product-note/types.js +1 -0
  39. package/dist/actions/add-product-to-cart/action.d.ts +6 -0
  40. package/dist/actions/add-product-to-cart/action.js +8 -0
  41. package/dist/actions/add-product-to-cart/types.d.ts +12 -0
  42. package/dist/actions/add-product-to-cart/types.js +1 -0
  43. package/dist/actions/adjust-inventory/action.d.ts +6 -0
  44. package/dist/actions/adjust-inventory/action.js +8 -0
  45. package/dist/actions/adjust-inventory/types.d.ts +12 -0
  46. package/dist/actions/adjust-inventory/types.js +1 -0
  47. package/dist/actions/assign-customer/action.d.ts +6 -0
  48. package/dist/actions/assign-customer/action.js +8 -0
  49. package/dist/actions/assign-customer/types.d.ts +9 -0
  50. package/dist/actions/assign-customer/types.js +1 -0
  51. package/dist/actions/authenticate-user/action.d.ts +6 -0
  52. package/dist/actions/authenticate-user/action.js +8 -0
  53. package/dist/actions/authenticate-user/types.d.ts +9 -0
  54. package/dist/actions/authenticate-user/types.js +1 -0
  55. package/dist/actions/calculate-refund-total/action.d.ts +6 -0
  56. package/dist/actions/calculate-refund-total/action.js +8 -0
  57. package/dist/actions/calculate-refund-total/types.d.ts +12 -0
  58. package/dist/actions/calculate-refund-total/types.js +1 -0
  59. package/dist/actions/cash-payment/action.d.ts +6 -0
  60. package/dist/actions/cash-payment/action.js +8 -0
  61. package/dist/actions/cash-payment/types.d.ts +13 -0
  62. package/dist/actions/cash-payment/types.js +1 -0
  63. package/dist/actions/clear-cart/action.d.ts +6 -0
  64. package/dist/actions/clear-cart/action.js +8 -0
  65. package/dist/actions/clear-cart/types.d.ts +5 -0
  66. package/dist/actions/clear-cart/types.js +1 -0
  67. package/dist/actions/delete-parked-order/action.d.ts +6 -0
  68. package/dist/actions/delete-parked-order/action.js +8 -0
  69. package/dist/actions/delete-parked-order/types.d.ts +9 -0
  70. package/dist/actions/delete-parked-order/types.js +1 -0
  71. package/dist/actions/example-function/action.d.ts +6 -0
  72. package/dist/actions/example-function/action.js +8 -0
  73. package/dist/actions/example-function/types.d.ts +16 -0
  74. package/dist/actions/example-function/types.js +1 -0
  75. package/dist/actions/get-categories/action.d.ts +6 -0
  76. package/dist/actions/get-categories/action.js +8 -0
  77. package/dist/actions/get-categories/types.d.ts +16 -0
  78. package/dist/actions/get-categories/types.js +1 -0
  79. package/dist/actions/get-context/action.d.ts +6 -0
  80. package/dist/actions/get-context/action.js +8 -0
  81. package/dist/actions/get-context/types.d.ts +17 -0
  82. package/dist/actions/get-context/types.js +1 -0
  83. package/dist/actions/get-current-cart/action.d.ts +6 -0
  84. package/dist/actions/get-current-cart/action.js +8 -0
  85. package/dist/actions/get-current-cart/types.d.ts +6 -0
  86. package/dist/actions/get-current-cart/types.js +1 -0
  87. package/dist/actions/get-customers/action.d.ts +6 -0
  88. package/dist/actions/get-customers/action.js +8 -0
  89. package/dist/actions/get-customers/types.d.ts +31 -0
  90. package/dist/actions/get-customers/types.js +1 -0
  91. package/dist/actions/get-line-items-by-order/action.d.ts +6 -0
  92. package/dist/actions/get-line-items-by-order/action.js +8 -0
  93. package/dist/actions/get-line-items-by-order/types.d.ts +13 -0
  94. package/dist/actions/get-line-items-by-order/types.js +1 -0
  95. package/dist/actions/get-orders/action.d.ts +6 -0
  96. package/dist/actions/get-orders/action.js +8 -0
  97. package/dist/actions/get-orders/types.d.ts +17 -0
  98. package/dist/actions/get-orders/types.js +1 -0
  99. package/dist/actions/get-product-variants/action.d.ts +6 -0
  100. package/dist/actions/get-product-variants/action.js +8 -0
  101. package/dist/actions/get-product-variants/types.d.ts +9 -0
  102. package/dist/actions/get-product-variants/types.js +1 -0
  103. package/dist/actions/get-products/action.d.ts +6 -0
  104. package/dist/actions/get-products/action.js +8 -0
  105. package/dist/actions/get-products/types.d.ts +28 -0
  106. package/dist/actions/get-products/types.js +1 -0
  107. package/dist/actions/get-refunds/action.d.ts +6 -0
  108. package/dist/actions/get-refunds/action.js +8 -0
  109. package/dist/actions/get-refunds/types.d.ts +16 -0
  110. package/dist/actions/get-refunds/types.js +1 -0
  111. package/dist/actions/get-remaining-refundable-quantities/action.d.ts +6 -0
  112. package/dist/actions/get-remaining-refundable-quantities/action.js +8 -0
  113. package/dist/actions/get-remaining-refundable-quantities/types.d.ts +7 -0
  114. package/dist/actions/get-remaining-refundable-quantities/types.js +1 -0
  115. package/dist/actions/go-to-page/action.d.ts +6 -0
  116. package/dist/actions/go-to-page/action.js +8 -0
  117. package/dist/actions/go-to-page/types.d.ts +9 -0
  118. package/dist/actions/go-to-page/types.js +1 -0
  119. package/dist/actions/go-to-station-home/action.d.ts +6 -0
  120. package/dist/actions/go-to-station-home/action.js +8 -0
  121. package/dist/actions/go-to-station-home/types.d.ts +5 -0
  122. package/dist/actions/go-to-station-home/types.js +1 -0
  123. package/dist/actions/initiate-refund/action.d.ts +6 -0
  124. package/dist/actions/initiate-refund/action.js +8 -0
  125. package/dist/actions/initiate-refund/types.d.ts +9 -0
  126. package/dist/actions/initiate-refund/types.js +1 -0
  127. package/dist/actions/open-cash-drawer/action.d.ts +6 -0
  128. package/dist/actions/open-cash-drawer/action.js +8 -0
  129. package/dist/actions/open-cash-drawer/types.d.ts +5 -0
  130. package/dist/actions/open-cash-drawer/types.js +1 -0
  131. package/dist/actions/open-popup/action.d.ts +6 -0
  132. package/dist/actions/open-popup/action.js +8 -0
  133. package/dist/actions/open-popup/types.d.ts +9 -0
  134. package/dist/actions/open-popup/types.js +1 -0
  135. package/dist/actions/park-order/action.d.ts +6 -0
  136. package/dist/actions/park-order/action.js +8 -0
  137. package/dist/actions/park-order/types.d.ts +6 -0
  138. package/dist/actions/park-order/types.js +1 -0
  139. package/dist/actions/partial-payment/action.d.ts +6 -0
  140. package/dist/actions/partial-payment/action.js +8 -0
  141. package/dist/actions/partial-payment/types.d.ts +14 -0
  142. package/dist/actions/partial-payment/types.js +1 -0
  143. package/dist/actions/process-partial-refund/action.d.ts +6 -0
  144. package/dist/actions/process-partial-refund/action.js +8 -0
  145. package/dist/actions/process-partial-refund/types.d.ts +9 -0
  146. package/dist/actions/process-partial-refund/types.js +1 -0
  147. package/dist/actions/remove-customer-from-cart/action.d.ts +6 -0
  148. package/dist/actions/remove-customer-from-cart/action.js +8 -0
  149. package/dist/actions/remove-customer-from-cart/types.d.ts +5 -0
  150. package/dist/actions/remove-customer-from-cart/types.js +1 -0
  151. package/dist/actions/reset-refund-details/action.d.ts +6 -0
  152. package/dist/actions/reset-refund-details/action.js +8 -0
  153. package/dist/actions/reset-refund-details/types.d.ts +5 -0
  154. package/dist/actions/reset-refund-details/types.js +1 -0
  155. package/dist/actions/resume-parked-order/action.d.ts +6 -0
  156. package/dist/actions/resume-parked-order/action.js +8 -0
  157. package/dist/actions/resume-parked-order/types.d.ts +9 -0
  158. package/dist/actions/resume-parked-order/types.js +1 -0
  159. package/dist/actions/select-all-refund-items/action.d.ts +6 -0
  160. package/dist/actions/select-all-refund-items/action.js +8 -0
  161. package/dist/actions/select-all-refund-items/types.d.ts +6 -0
  162. package/dist/actions/select-all-refund-items/types.js +1 -0
  163. package/dist/actions/set-product-active/action.d.ts +6 -0
  164. package/dist/actions/set-product-active/action.js +8 -0
  165. package/dist/actions/set-product-active/types.d.ts +9 -0
  166. package/dist/actions/set-product-active/types.js +1 -0
  167. package/dist/actions/set-refund-stock-action/action.d.ts +6 -0
  168. package/dist/actions/set-refund-stock-action/action.js +8 -0
  169. package/dist/actions/set-refund-stock-action/types.d.ts +11 -0
  170. package/dist/actions/set-refund-stock-action/types.js +1 -0
  171. package/dist/actions/show-confirmation/action.d.ts +6 -0
  172. package/dist/actions/show-confirmation/action.js +8 -0
  173. package/dist/actions/show-confirmation/types.d.ts +9 -0
  174. package/dist/actions/show-confirmation/types.js +1 -0
  175. package/dist/actions/show-notification/action.d.ts +6 -0
  176. package/dist/actions/show-notification/action.js +8 -0
  177. package/dist/actions/show-notification/types.d.ts +9 -0
  178. package/dist/actions/show-notification/types.js +1 -0
  179. package/dist/actions/switch-user/action.d.ts +6 -0
  180. package/dist/actions/switch-user/action.js +8 -0
  181. package/dist/actions/switch-user/types.d.ts +13 -0
  182. package/dist/actions/switch-user/types.js +1 -0
  183. package/dist/actions/tap-to-pay-payment/action.d.ts +6 -0
  184. package/dist/actions/tap-to-pay-payment/action.js +8 -0
  185. package/dist/actions/tap-to-pay-payment/types.d.ts +11 -0
  186. package/dist/actions/tap-to-pay-payment/types.js +1 -0
  187. package/dist/actions/terminal-payment/action.d.ts +6 -0
  188. package/dist/actions/terminal-payment/action.js +8 -0
  189. package/dist/actions/terminal-payment/types.d.ts +11 -0
  190. package/dist/actions/terminal-payment/types.js +1 -0
  191. package/dist/actions/toggle-slide-out/action.d.ts +6 -0
  192. package/dist/actions/toggle-slide-out/action.js +8 -0
  193. package/dist/actions/toggle-slide-out/types.d.ts +9 -0
  194. package/dist/actions/toggle-slide-out/types.js +1 -0
  195. package/dist/actions/trigger-webhook/action.d.ts +6 -0
  196. package/dist/actions/trigger-webhook/action.js +8 -0
  197. package/dist/actions/trigger-webhook/types.d.ts +16 -0
  198. package/dist/actions/trigger-webhook/types.js +1 -0
  199. package/dist/actions/trigger-zapier-webhook/action.d.ts +6 -0
  200. package/dist/actions/trigger-zapier-webhook/action.js +8 -0
  201. package/dist/actions/trigger-zapier-webhook/types.d.ts +9 -0
  202. package/dist/actions/trigger-zapier-webhook/types.js +1 -0
  203. package/dist/actions/update-customer-facing-display/action.d.ts +6 -0
  204. package/dist/actions/update-customer-facing-display/action.js +8 -0
  205. package/dist/actions/update-customer-facing-display/types.d.ts +9 -0
  206. package/dist/actions/update-customer-facing-display/types.js +1 -0
  207. package/dist/actions/vendara-payment/action.d.ts +6 -0
  208. package/dist/actions/vendara-payment/action.js +8 -0
  209. package/dist/actions/vendara-payment/types.d.ts +11 -0
  210. package/dist/actions/vendara-payment/types.js +1 -0
  211. package/dist/client.d.ts +33 -0
  212. package/dist/client.js +145 -0
  213. package/dist/index.d.ts +108 -0
  214. package/dist/index.js +121 -0
  215. package/dist/types.d.ts +64 -0
  216. package/dist/types.js +1 -0
  217. 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,6 @@
1
+ /**
2
+ * Show notification action
3
+ * Calls the showNotification action on the parent window
4
+ */
5
+ import type { ShowNotification } from "./types";
6
+ export declare const showNotification: ShowNotification;
@@ -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,6 @@
1
+ /**
2
+ * Switch user action
3
+ * Calls the switchUser action on the parent window
4
+ */
5
+ import type { SwitchUser } from "./types";
6
+ export declare const switchUser: SwitchUser;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Switch user action
3
+ * Calls the switchUser action on the parent window
4
+ */
5
+ import { commandFrameClient } from "../../client";
6
+ export const switchUser = async (params) => {
7
+ return await commandFrameClient.call("switchUser", params);
8
+ };
@@ -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,6 @@
1
+ /**
2
+ * Tap to pay payment action
3
+ * Calls the tapToPayPayment action on the parent window
4
+ */
5
+ import type { TapToPayPayment } from "./types";
6
+ export declare const tapToPayPayment: TapToPayPayment;
@@ -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,6 @@
1
+ /**
2
+ * Terminal payment action
3
+ * Calls the terminalPayment action on the parent window
4
+ */
5
+ import type { TerminalPayment } from "./types";
6
+ export declare const terminalPayment: TerminalPayment;
@@ -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,6 @@
1
+ /**
2
+ * Toggle slide out action
3
+ * Calls the toggleSlideOut action on the parent window
4
+ */
5
+ import type { ToggleSlideOut } from "./types";
6
+ export declare const toggleSlideOut: ToggleSlideOut;
@@ -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,6 @@
1
+ /**
2
+ * Trigger webhook action
3
+ * Calls the triggerWebhook action on the parent window
4
+ */
5
+ import type { TriggerWebhook } from "./types";
6
+ export declare const triggerWebhook: TriggerWebhook;
@@ -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,6 @@
1
+ /**
2
+ * Trigger Zapier webhook action
3
+ * Calls the triggerZapierWebhook action on the parent window
4
+ */
5
+ import type { TriggerZapierWebhook } from "./types";
6
+ export declare const triggerZapierWebhook: TriggerZapierWebhook;
@@ -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,6 @@
1
+ /**
2
+ * Update customer facing display action
3
+ * Calls the updateCustomerFacingDisplay action on the parent window
4
+ */
5
+ import type { UpdateCustomerFacingDisplay } from "./types";
6
+ export declare const updateCustomerFacingDisplay: UpdateCustomerFacingDisplay;
@@ -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,6 @@
1
+ /**
2
+ * Vendara payment action
3
+ * Calls the vendaraPayment action on the parent window
4
+ */
5
+ import type { VendaraPayment } from "./types";
6
+ export declare const vendaraPayment: VendaraPayment;
@@ -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 {};
@@ -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
+ });
@@ -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";