@final-commerce/command-frame 0.1.55 → 0.1.57

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 (148) hide show
  1. package/README.md +1 -5
  2. package/dist/CommonTypes.d.ts +33 -0
  3. package/dist/actions/get-active-customer/action.d.ts +2 -0
  4. package/dist/actions/get-active-customer/action.js +4 -0
  5. package/dist/actions/get-active-customer/mock.d.ts +2 -0
  6. package/dist/actions/get-active-customer/mock.js +10 -0
  7. package/dist/actions/get-active-customer/types.d.ts +7 -0
  8. package/dist/actions/get-active-order/action.d.ts +6 -0
  9. package/dist/actions/get-active-order/action.js +8 -0
  10. package/dist/actions/get-active-order/mock.d.ts +2 -0
  11. package/dist/actions/get-active-order/mock.js +11 -0
  12. package/dist/actions/get-active-order/types.d.ts +7 -0
  13. package/dist/actions/get-active-order/types.js +1 -0
  14. package/dist/actions/get-active-outlet/action.d.ts +2 -0
  15. package/dist/actions/get-active-outlet/action.js +4 -0
  16. package/dist/actions/get-active-outlet/mock.d.ts +2 -0
  17. package/dist/actions/get-active-outlet/mock.js +9 -0
  18. package/dist/actions/get-active-outlet/types.d.ts +7 -0
  19. package/dist/actions/get-active-outlet/types.js +1 -0
  20. package/dist/actions/get-active-refund/action.d.ts +2 -0
  21. package/dist/actions/get-active-refund/action.js +4 -0
  22. package/dist/actions/get-active-refund/mock.d.ts +2 -0
  23. package/dist/actions/get-active-refund/mock.js +9 -0
  24. package/dist/actions/get-active-refund/types.d.ts +7 -0
  25. package/dist/actions/get-active-refund/types.js +1 -0
  26. package/dist/actions/get-active-session/action.d.ts +2 -0
  27. package/dist/actions/get-active-session/action.js +4 -0
  28. package/dist/actions/get-active-session/mock.d.ts +2 -0
  29. package/dist/actions/get-active-session/mock.js +9 -0
  30. package/dist/actions/get-active-session/types.d.ts +7 -0
  31. package/dist/actions/get-active-session/types.js +1 -0
  32. package/dist/actions/get-active-station/action.d.ts +2 -0
  33. package/dist/actions/get-active-station/action.js +4 -0
  34. package/dist/actions/get-active-station/mock.d.ts +2 -0
  35. package/dist/actions/get-active-station/mock.js +9 -0
  36. package/dist/actions/get-active-station/types.d.ts +7 -0
  37. package/dist/actions/get-active-station/types.js +1 -0
  38. package/dist/actions/get-active-user/action.d.ts +2 -0
  39. package/dist/actions/get-active-user/action.js +4 -0
  40. package/dist/actions/get-active-user/mock.d.ts +2 -0
  41. package/dist/actions/get-active-user/mock.js +9 -0
  42. package/dist/actions/get-active-user/types.d.ts +7 -0
  43. package/dist/actions/get-active-user/types.js +1 -0
  44. package/dist/actions/set-active-customer/action.d.ts +2 -0
  45. package/dist/actions/set-active-customer/action.js +4 -0
  46. package/dist/actions/set-active-customer/mock.d.ts +2 -0
  47. package/dist/actions/set-active-customer/mock.js +16 -0
  48. package/dist/actions/set-active-customer/types.d.ts +10 -0
  49. package/dist/actions/set-active-customer/types.js +1 -0
  50. package/dist/actions/set-active-outlet/action.d.ts +2 -0
  51. package/dist/actions/set-active-outlet/action.js +4 -0
  52. package/dist/actions/set-active-outlet/mock.d.ts +2 -0
  53. package/dist/actions/set-active-outlet/mock.js +16 -0
  54. package/dist/actions/set-active-outlet/types.d.ts +10 -0
  55. package/dist/actions/set-active-outlet/types.js +1 -0
  56. package/dist/actions/set-active-refund/action.d.ts +2 -0
  57. package/dist/actions/set-active-refund/action.js +4 -0
  58. package/dist/actions/set-active-refund/mock.d.ts +2 -0
  59. package/dist/actions/set-active-refund/mock.js +12 -0
  60. package/dist/actions/set-active-refund/types.d.ts +10 -0
  61. package/dist/actions/set-active-refund/types.js +1 -0
  62. package/dist/actions/set-active-session/action.d.ts +2 -0
  63. package/dist/actions/set-active-session/action.js +4 -0
  64. package/dist/actions/set-active-session/mock.d.ts +2 -0
  65. package/dist/actions/set-active-session/mock.js +15 -0
  66. package/dist/actions/set-active-session/types.d.ts +10 -0
  67. package/dist/actions/set-active-session/types.js +1 -0
  68. package/dist/actions/set-active-station/action.d.ts +2 -0
  69. package/dist/actions/set-active-station/action.js +4 -0
  70. package/dist/actions/set-active-station/mock.d.ts +2 -0
  71. package/dist/actions/set-active-station/mock.js +16 -0
  72. package/dist/actions/set-active-station/types.d.ts +10 -0
  73. package/dist/actions/set-active-station/types.js +1 -0
  74. package/dist/actions/set-active-user/action.d.ts +2 -0
  75. package/dist/actions/set-active-user/action.js +4 -0
  76. package/dist/actions/set-active-user/mock.d.ts +2 -0
  77. package/dist/actions/set-active-user/mock.js +16 -0
  78. package/dist/actions/set-active-user/types.d.ts +10 -0
  79. package/dist/actions/set-active-user/types.js +1 -0
  80. package/dist/demo/database.d.ts +3 -1
  81. package/dist/demo/database.js +19 -1
  82. package/dist/index.d.ts +39 -4
  83. package/dist/index.js +30 -0
  84. package/dist/projects/render/mocks.js +26 -0
  85. package/dist/projects/render/provider.d.ts +2 -2
  86. package/dist/projects/render/types.d.ts +14 -1
  87. package/dist/pubsub/topics/customers/get-active-customer/types.d.ts +6 -0
  88. package/dist/pubsub/topics/customers/get-active-customer/types.js +1 -0
  89. package/dist/pubsub/topics/customers/index.js +10 -0
  90. package/dist/pubsub/topics/customers/set-active-customer/types.d.ts +6 -0
  91. package/dist/pubsub/topics/customers/set-active-customer/types.js +1 -0
  92. package/dist/pubsub/topics/customers/types.d.ts +6 -2
  93. package/dist/pubsub/topics/customers/types.js +2 -0
  94. package/dist/pubsub/topics/index.d.ts +4 -0
  95. package/dist/pubsub/topics/index.js +4 -0
  96. package/dist/pubsub/topics/orders/get-active-order/types.d.ts +6 -0
  97. package/dist/pubsub/topics/orders/get-active-order/types.js +1 -0
  98. package/dist/pubsub/topics/orders/index.js +10 -0
  99. package/dist/pubsub/topics/orders/set-active-order/types.d.ts +6 -0
  100. package/dist/pubsub/topics/orders/set-active-order/types.js +1 -0
  101. package/dist/pubsub/topics/orders/types.d.ts +6 -2
  102. package/dist/pubsub/topics/orders/types.js +2 -0
  103. package/dist/pubsub/topics/outlet/get-active-outlet/types.d.ts +6 -0
  104. package/dist/pubsub/topics/outlet/get-active-outlet/types.js +1 -0
  105. package/dist/pubsub/topics/outlet/index.d.ts +3 -0
  106. package/dist/pubsub/topics/outlet/index.js +18 -0
  107. package/dist/pubsub/topics/outlet/set-active-outlet/types.d.ts +6 -0
  108. package/dist/pubsub/topics/outlet/set-active-outlet/types.js +1 -0
  109. package/dist/pubsub/topics/outlet/types.d.ts +6 -0
  110. package/dist/pubsub/topics/outlet/types.js +2 -0
  111. package/dist/pubsub/topics/products/product-get-active/types.js +1 -0
  112. package/dist/pubsub/topics/products/types.d.ts +6 -2
  113. package/dist/pubsub/topics/products/types.js +2 -0
  114. package/dist/pubsub/topics/refunds/get-active-refund/types.d.ts +6 -0
  115. package/dist/pubsub/topics/refunds/get-active-refund/types.js +1 -0
  116. package/dist/pubsub/topics/refunds/index.js +10 -0
  117. package/dist/pubsub/topics/refunds/set-active-refund/types.d.ts +6 -0
  118. package/dist/pubsub/topics/refunds/set-active-refund/types.js +1 -0
  119. package/dist/pubsub/topics/refunds/types.d.ts +6 -2
  120. package/dist/pubsub/topics/refunds/types.js +2 -0
  121. package/dist/pubsub/topics/session/get-active-session/types.d.ts +6 -0
  122. package/dist/pubsub/topics/session/get-active-session/types.js +1 -0
  123. package/dist/pubsub/topics/session/index.d.ts +3 -0
  124. package/dist/pubsub/topics/session/index.js +18 -0
  125. package/dist/pubsub/topics/session/set-active-session/types.d.ts +6 -0
  126. package/dist/pubsub/topics/session/set-active-session/types.js +1 -0
  127. package/dist/pubsub/topics/session/types.d.ts +6 -0
  128. package/dist/pubsub/topics/session/types.js +2 -0
  129. package/dist/pubsub/topics/station/get-active-station/types.d.ts +6 -0
  130. package/dist/pubsub/topics/station/get-active-station/types.js +1 -0
  131. package/dist/pubsub/topics/station/index.d.ts +3 -0
  132. package/dist/pubsub/topics/station/index.js +18 -0
  133. package/dist/pubsub/topics/station/set-active-station/types.d.ts +6 -0
  134. package/dist/pubsub/topics/station/set-active-station/types.js +1 -0
  135. package/dist/pubsub/topics/station/types.d.ts +6 -0
  136. package/dist/pubsub/topics/station/types.js +2 -0
  137. package/dist/pubsub/topics/types.d.ts +8 -0
  138. package/dist/pubsub/topics/users/get-active-user/types.d.ts +6 -0
  139. package/dist/pubsub/topics/users/get-active-user/types.js +1 -0
  140. package/dist/pubsub/topics/users/index.d.ts +3 -0
  141. package/dist/pubsub/topics/users/index.js +18 -0
  142. package/dist/pubsub/topics/users/set-active-user/types.d.ts +6 -0
  143. package/dist/pubsub/topics/users/set-active-user/types.js +1 -0
  144. package/dist/pubsub/topics/users/types.d.ts +6 -0
  145. package/dist/pubsub/topics/users/types.js +2 -0
  146. package/package.json +1 -1
  147. /package/dist/{pubsub/topics/products/product-get-active/types..js → actions/get-active-customer/types.js} +0 -0
  148. /package/dist/pubsub/topics/products/product-get-active/{types..d.ts → types.d.ts} +0 -0
package/README.md CHANGED
@@ -75,7 +75,7 @@ const context = await client.getContext();
75
75
  The pub/sub system allows iframe extensions to subscribe to topics and receive real-time events published by the host (Render). Subscriptions are **page-scoped** -- they fire only while the iframe is mounted on the current page.
76
76
 
77
77
  - **[Pub/Sub Documentation](./src/pubsub/README.md)**
78
- - **Topics:** Cart (8 events), Customers (6), Orders (2), Payments (2), Products (2), Refunds (2), Print (3).
78
+ - **Topics:** Cart (8), Customers (8), Orders (4), Payments (2), Products (4), Refunds (4), Print (3), Custom Tables (3), Outlet (2), Station (2), Session (2), Users (2).
79
79
 
80
80
  ```typescript
81
81
  import { topics } from '@final-commerce/command-frame';
@@ -170,7 +170,3 @@ Alternatively, set the global flag before initialization:
170
170
  ```typescript
171
171
  (window as any).__POSTMESSAGE_DEBUG__ = true;
172
172
  ```
173
-
174
- ## License
175
-
176
- MIT
@@ -465,6 +465,39 @@ export interface CFActiveStation {
465
465
  updatedAt?: string;
466
466
  stripeTerminalId?: string;
467
467
  }
468
+ /** Cash register session (station session), aligned with Render `Session`. */
469
+ export interface CFSession {
470
+ id: string;
471
+ stationId: string;
472
+ openingAmount?: number;
473
+ closingAmount?: number;
474
+ openedBy?: string;
475
+ closedBy?: string;
476
+ notes?: string[];
477
+ currency?: CurrencyCode;
478
+ minorUnits?: number;
479
+ }
480
+ /** Refund UI / selection state in POS, aligned with Render `ActiveRefundOrder`. */
481
+ export interface CFRefundProcessingStatus {
482
+ status: string;
483
+ isCardPresent?: boolean;
484
+ message?: string;
485
+ }
486
+ export interface CFActiveRefundDetails {
487
+ quantities?: Record<string, number>;
488
+ options?: Record<string, string>;
489
+ refundAmounts?: Record<string, number>;
490
+ refundPayments?: CFPaymentMethod[] | null;
491
+ currentRefundTotal?: number;
492
+ amountRemaining?: number | null;
493
+ buttonsDisabled?: Record<string, boolean>;
494
+ isRefund?: boolean;
495
+ customSalesQuantities?: Record<string, number>;
496
+ cartFeesRefunds?: Record<string, number>;
497
+ tipsRefunds?: Record<string, number>;
498
+ refundProcessingStatus?: CFRefundProcessingStatus | null;
499
+ sessionRefundedTotal?: number;
500
+ }
468
501
  export interface CFActiveOrder extends CFOrder {
469
502
  id?: string;
470
503
  internalId?: string;
@@ -0,0 +1,2 @@
1
+ import type { GetActiveCustomer } from "./types";
2
+ export declare const getActiveCustomer: GetActiveCustomer;
@@ -0,0 +1,4 @@
1
+ import { commandFrameClient } from "../../client";
2
+ export const getActiveCustomer = async () => {
3
+ return await commandFrameClient.call("getActiveCustomer");
4
+ };
@@ -0,0 +1,2 @@
1
+ import { GetActiveCustomer } from "./types";
2
+ export declare const mockGetActiveCustomer: GetActiveCustomer;
@@ -0,0 +1,10 @@
1
+ import { MOCK_CUSTOMER_1 } from "../../demo/database";
2
+ export const mockGetActiveCustomer = async () => {
3
+ console.log("[Mock] getActiveCustomer called");
4
+ const customer = { ...MOCK_CUSTOMER_1, id: MOCK_CUSTOMER_1._id };
5
+ return {
6
+ success: true,
7
+ customer,
8
+ timestamp: new Date().toISOString()
9
+ };
10
+ };
@@ -0,0 +1,7 @@
1
+ import { CFActiveCustomer } from "../../CommonTypes";
2
+ export interface GetActiveCustomerResponse {
3
+ success: boolean;
4
+ customer: CFActiveCustomer | null;
5
+ timestamp: string;
6
+ }
7
+ export type GetActiveCustomer = () => Promise<GetActiveCustomerResponse>;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Get active order action
3
+ * Calls the getActiveOrder action on the parent window
4
+ */
5
+ import type { GetActiveOrder } from "./types";
6
+ export declare const getActiveOrder: GetActiveOrder;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Get active order action
3
+ * Calls the getActiveOrder action on the parent window
4
+ */
5
+ import { commandFrameClient } from "../../client";
6
+ export const getActiveOrder = async () => {
7
+ return await commandFrameClient.call("getActiveOrder");
8
+ };
@@ -0,0 +1,2 @@
1
+ import { GetActiveOrder } from "./types";
2
+ export declare const mockGetActiveOrder: GetActiveOrder;
@@ -0,0 +1,11 @@
1
+ import { MOCK_ORDERS, safeSerialize } from "../../demo/database";
2
+ export const mockGetActiveOrder = async () => {
3
+ console.log("[Mock] getActiveOrder called");
4
+ const orders = safeSerialize(MOCK_ORDERS);
5
+ const order = orders.length > 0 ? orders[0] : null;
6
+ return {
7
+ success: true,
8
+ order,
9
+ timestamp: new Date().toISOString()
10
+ };
11
+ };
@@ -0,0 +1,7 @@
1
+ import { CFActiveOrder } from "../../CommonTypes";
2
+ export interface GetActiveOrderResponse {
3
+ success: boolean;
4
+ order: CFActiveOrder | null;
5
+ timestamp: string;
6
+ }
7
+ export type GetActiveOrder = () => Promise<GetActiveOrderResponse>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { GetActiveOutlet } from "./types";
2
+ export declare const getActiveOutlet: GetActiveOutlet;
@@ -0,0 +1,4 @@
1
+ import { commandFrameClient } from "../../client";
2
+ export const getActiveOutlet = async () => {
3
+ return await commandFrameClient.call("getActiveOutlet");
4
+ };
@@ -0,0 +1,2 @@
1
+ import { GetActiveOutlet } from "./types";
2
+ export declare const mockGetActiveOutlet: GetActiveOutlet;
@@ -0,0 +1,9 @@
1
+ import { MOCK_OUTLET_MAIN } from "../../demo/database";
2
+ export const mockGetActiveOutlet = async () => {
3
+ console.log("[Mock] getActiveOutlet called");
4
+ return {
5
+ success: true,
6
+ outlet: MOCK_OUTLET_MAIN,
7
+ timestamp: new Date().toISOString()
8
+ };
9
+ };
@@ -0,0 +1,7 @@
1
+ import { CFActiveOutlet } from "../../CommonTypes";
2
+ export interface GetActiveOutletResponse {
3
+ success: boolean;
4
+ outlet: CFActiveOutlet | null;
5
+ timestamp: string;
6
+ }
7
+ export type GetActiveOutlet = () => Promise<GetActiveOutletResponse>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { GetActiveRefund } from "./types";
2
+ export declare const getActiveRefund: GetActiveRefund;
@@ -0,0 +1,4 @@
1
+ import { commandFrameClient } from "../../client";
2
+ export const getActiveRefund = async () => {
3
+ return await commandFrameClient.call("getActiveRefund");
4
+ };
@@ -0,0 +1,2 @@
1
+ import { GetActiveRefund } from "./types";
2
+ export declare const mockGetActiveRefund: GetActiveRefund;
@@ -0,0 +1,9 @@
1
+ import { MOCK_ACTIVE_REFUND_DETAILS } from "../../demo/database";
2
+ export const mockGetActiveRefund = async () => {
3
+ console.log("[Mock] getActiveRefund called");
4
+ return {
5
+ success: true,
6
+ refund: MOCK_ACTIVE_REFUND_DETAILS,
7
+ timestamp: new Date().toISOString()
8
+ };
9
+ };
@@ -0,0 +1,7 @@
1
+ import { CFActiveRefundDetails } from "../../CommonTypes";
2
+ export interface GetActiveRefundResponse {
3
+ success: boolean;
4
+ refund: CFActiveRefundDetails | null;
5
+ timestamp: string;
6
+ }
7
+ export type GetActiveRefund = () => Promise<GetActiveRefundResponse>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { GetActiveSession } from "./types";
2
+ export declare const getActiveSession: GetActiveSession;
@@ -0,0 +1,4 @@
1
+ import { commandFrameClient } from "../../client";
2
+ export const getActiveSession = async () => {
3
+ return await commandFrameClient.call("getActiveSession");
4
+ };
@@ -0,0 +1,2 @@
1
+ import { GetActiveSession } from "./types";
2
+ export declare const mockGetActiveSession: GetActiveSession;
@@ -0,0 +1,9 @@
1
+ import { MOCK_SESSION } from "../../demo/database";
2
+ export const mockGetActiveSession = async () => {
3
+ console.log("[Mock] getActiveSession called");
4
+ return {
5
+ success: true,
6
+ session: MOCK_SESSION,
7
+ timestamp: new Date().toISOString()
8
+ };
9
+ };
@@ -0,0 +1,7 @@
1
+ import { CFSession } from "../../CommonTypes";
2
+ export interface GetActiveSessionResponse {
3
+ success: boolean;
4
+ session: CFSession | null;
5
+ timestamp: string;
6
+ }
7
+ export type GetActiveSession = () => Promise<GetActiveSessionResponse>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { GetActiveStation } from "./types";
2
+ export declare const getActiveStation: GetActiveStation;
@@ -0,0 +1,4 @@
1
+ import { commandFrameClient } from "../../client";
2
+ export const getActiveStation = async () => {
3
+ return await commandFrameClient.call("getActiveStation");
4
+ };
@@ -0,0 +1,2 @@
1
+ import { GetActiveStation } from "./types";
2
+ export declare const mockGetActiveStation: GetActiveStation;
@@ -0,0 +1,9 @@
1
+ import { MOCK_STATION_1 } from "../../demo/database";
2
+ export const mockGetActiveStation = async () => {
3
+ console.log("[Mock] getActiveStation called");
4
+ return {
5
+ success: true,
6
+ station: MOCK_STATION_1,
7
+ timestamp: new Date().toISOString()
8
+ };
9
+ };
@@ -0,0 +1,7 @@
1
+ import { CFActiveStation } from "../../CommonTypes";
2
+ export interface GetActiveStationResponse {
3
+ success: boolean;
4
+ station: CFActiveStation | null;
5
+ timestamp: string;
6
+ }
7
+ export type GetActiveStation = () => Promise<GetActiveStationResponse>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { GetActiveUser } from "./types";
2
+ export declare const getActiveUser: GetActiveUser;
@@ -0,0 +1,4 @@
1
+ import { commandFrameClient } from "../../client";
2
+ export const getActiveUser = async () => {
3
+ return await commandFrameClient.call("getActiveUser");
4
+ };
@@ -0,0 +1,2 @@
1
+ import { GetActiveUser } from "./types";
2
+ export declare const mockGetActiveUser: GetActiveUser;
@@ -0,0 +1,9 @@
1
+ import { MOCK_USER_MARIO } from "../../demo/database";
2
+ export const mockGetActiveUser = async () => {
3
+ console.log("[Mock] getActiveUser called");
4
+ return {
5
+ success: true,
6
+ user: MOCK_USER_MARIO,
7
+ timestamp: new Date().toISOString()
8
+ };
9
+ };
@@ -0,0 +1,7 @@
1
+ import { CFActiveUser } from "../../CommonTypes";
2
+ export interface GetActiveUserResponse {
3
+ success: boolean;
4
+ user: CFActiveUser | null;
5
+ timestamp: string;
6
+ }
7
+ export type GetActiveUser = () => Promise<GetActiveUserResponse>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { SetActiveCustomer } from "./types";
2
+ export declare const setActiveCustomer: SetActiveCustomer;
@@ -0,0 +1,4 @@
1
+ import { commandFrameClient } from "../../client";
2
+ export const setActiveCustomer = async (params) => {
3
+ return await commandFrameClient.call("setActiveCustomer", params);
4
+ };
@@ -0,0 +1,2 @@
1
+ import { SetActiveCustomer } from "./types";
2
+ export declare const mockSetActiveCustomer: SetActiveCustomer;
@@ -0,0 +1,16 @@
1
+ import { MOCK_CUSTOMERS } from "../../demo/database";
2
+ export const mockSetActiveCustomer = async (params) => {
3
+ console.log("[Mock] setActiveCustomer called", params);
4
+ if (!params?.customerId) {
5
+ throw new Error("customerId is required");
6
+ }
7
+ const found = MOCK_CUSTOMERS.find(c => c._id === params.customerId);
8
+ if (!found) {
9
+ throw new Error(`Customer with ID ${params.customerId} not found`);
10
+ }
11
+ return {
12
+ success: true,
13
+ customer: { ...found, id: found._id },
14
+ timestamp: new Date().toISOString()
15
+ };
16
+ };
@@ -0,0 +1,10 @@
1
+ import { CFActiveCustomer } from "../../CommonTypes";
2
+ export interface SetActiveCustomerParams {
3
+ customerId: string;
4
+ }
5
+ export interface SetActiveCustomerResponse {
6
+ success: boolean;
7
+ customer: CFActiveCustomer;
8
+ timestamp: string;
9
+ }
10
+ export type SetActiveCustomer = (params?: SetActiveCustomerParams) => Promise<SetActiveCustomerResponse>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { SetActiveOutlet } from "./types";
2
+ export declare const setActiveOutlet: SetActiveOutlet;
@@ -0,0 +1,4 @@
1
+ import { commandFrameClient } from "../../client";
2
+ export const setActiveOutlet = async (params) => {
3
+ return await commandFrameClient.call("setActiveOutlet", params);
4
+ };
@@ -0,0 +1,2 @@
1
+ import { SetActiveOutlet } from "./types";
2
+ export declare const mockSetActiveOutlet: SetActiveOutlet;
@@ -0,0 +1,16 @@
1
+ import { MOCK_OUTLETS } from "../../demo/database";
2
+ export const mockSetActiveOutlet = async (params) => {
3
+ console.log("[Mock] setActiveOutlet called", params);
4
+ if (!params?.outletId) {
5
+ throw new Error("outletId is required");
6
+ }
7
+ const found = MOCK_OUTLETS.find(o => o.id === params.outletId || o._id === params.outletId);
8
+ if (!found) {
9
+ throw new Error(`Outlet with ID ${params.outletId} not found`);
10
+ }
11
+ return {
12
+ success: true,
13
+ outlet: found,
14
+ timestamp: new Date().toISOString()
15
+ };
16
+ };
@@ -0,0 +1,10 @@
1
+ import { CFActiveOutlet } from "../../CommonTypes";
2
+ export interface SetActiveOutletParams {
3
+ outletId: string;
4
+ }
5
+ export interface SetActiveOutletResponse {
6
+ success: boolean;
7
+ outlet: CFActiveOutlet;
8
+ timestamp: string;
9
+ }
10
+ export type SetActiveOutlet = (params?: SetActiveOutletParams) => Promise<SetActiveOutletResponse>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { SetActiveRefund } from "./types";
2
+ export declare const setActiveRefund: SetActiveRefund;
@@ -0,0 +1,4 @@
1
+ import { commandFrameClient } from "../../client";
2
+ export const setActiveRefund = async (params) => {
3
+ return await commandFrameClient.call("setActiveRefund", params);
4
+ };
@@ -0,0 +1,2 @@
1
+ import { SetActiveRefund } from "./types";
2
+ export declare const mockSetActiveRefund: SetActiveRefund;
@@ -0,0 +1,12 @@
1
+ import { MOCK_ACTIVE_REFUND_DETAILS } from "../../demo/database";
2
+ export const mockSetActiveRefund = async (params) => {
3
+ console.log("[Mock] setActiveRefund called", params);
4
+ if (!params?.orderId) {
5
+ throw new Error("orderId is required");
6
+ }
7
+ return {
8
+ success: true,
9
+ refund: { ...MOCK_ACTIVE_REFUND_DETAILS, isRefund: true },
10
+ timestamp: new Date().toISOString()
11
+ };
12
+ };
@@ -0,0 +1,10 @@
1
+ import { CFActiveRefundDetails } from "../../CommonTypes";
2
+ export interface SetActiveRefundParams {
3
+ orderId: string;
4
+ }
5
+ export interface SetActiveRefundResponse {
6
+ success: boolean;
7
+ refund: CFActiveRefundDetails;
8
+ timestamp: string;
9
+ }
10
+ export type SetActiveRefund = (params?: SetActiveRefundParams) => Promise<SetActiveRefundResponse>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { SetActiveSession } from "./types";
2
+ export declare const setActiveSession: SetActiveSession;
@@ -0,0 +1,4 @@
1
+ import { commandFrameClient } from "../../client";
2
+ export const setActiveSession = async (params) => {
3
+ return await commandFrameClient.call("setActiveSession", params);
4
+ };
@@ -0,0 +1,2 @@
1
+ import { SetActiveSession } from "./types";
2
+ export declare const mockSetActiveSession: SetActiveSession;
@@ -0,0 +1,15 @@
1
+ import { MOCK_SESSION } from "../../demo/database";
2
+ export const mockSetActiveSession = async (params) => {
3
+ console.log("[Mock] setActiveSession called", params);
4
+ if (!params?.sessionId) {
5
+ throw new Error("sessionId is required");
6
+ }
7
+ if (params.sessionId !== MOCK_SESSION.id) {
8
+ throw new Error(`Session with ID ${params.sessionId} not found`);
9
+ }
10
+ return {
11
+ success: true,
12
+ session: MOCK_SESSION,
13
+ timestamp: new Date().toISOString()
14
+ };
15
+ };
@@ -0,0 +1,10 @@
1
+ import { CFSession } from "../../CommonTypes";
2
+ export interface SetActiveSessionParams {
3
+ sessionId: string;
4
+ }
5
+ export interface SetActiveSessionResponse {
6
+ success: boolean;
7
+ session: CFSession;
8
+ timestamp: string;
9
+ }
10
+ export type SetActiveSession = (params?: SetActiveSessionParams) => Promise<SetActiveSessionResponse>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { SetActiveStation } from "./types";
2
+ export declare const setActiveStation: SetActiveStation;
@@ -0,0 +1,4 @@
1
+ import { commandFrameClient } from "../../client";
2
+ export const setActiveStation = async (params) => {
3
+ return await commandFrameClient.call("setActiveStation", params);
4
+ };
@@ -0,0 +1,2 @@
1
+ import { SetActiveStation } from "./types";
2
+ export declare const mockSetActiveStation: SetActiveStation;
@@ -0,0 +1,16 @@
1
+ import { MOCK_STATIONS } from "../../demo/database";
2
+ export const mockSetActiveStation = async (params) => {
3
+ console.log("[Mock] setActiveStation called", params);
4
+ if (!params?.stationId) {
5
+ throw new Error("stationId is required");
6
+ }
7
+ const found = MOCK_STATIONS.find(s => s._id === params.stationId);
8
+ if (!found) {
9
+ throw new Error(`Station with ID ${params.stationId} not found`);
10
+ }
11
+ return {
12
+ success: true,
13
+ station: found,
14
+ timestamp: new Date().toISOString()
15
+ };
16
+ };
@@ -0,0 +1,10 @@
1
+ import { CFActiveStation } from "../../CommonTypes";
2
+ export interface SetActiveStationParams {
3
+ stationId: string;
4
+ }
5
+ export interface SetActiveStationResponse {
6
+ success: boolean;
7
+ station: CFActiveStation;
8
+ timestamp: string;
9
+ }
10
+ export type SetActiveStation = (params?: SetActiveStationParams) => Promise<SetActiveStationResponse>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { SetActiveUser } from "./types";
2
+ export declare const setActiveUser: SetActiveUser;
@@ -0,0 +1,4 @@
1
+ import { commandFrameClient } from "../../client";
2
+ export const setActiveUser = async (params) => {
3
+ return await commandFrameClient.call("setActiveUser", params);
4
+ };
@@ -0,0 +1,2 @@
1
+ import { SetActiveUser } from "./types";
2
+ export declare const mockSetActiveUser: SetActiveUser;
@@ -0,0 +1,16 @@
1
+ import { MOCK_USERS } from "../../demo/database";
2
+ export const mockSetActiveUser = async (params) => {
3
+ console.log("[Mock] setActiveUser called", params);
4
+ if (!params?.userId) {
5
+ throw new Error("userId is required");
6
+ }
7
+ const found = MOCK_USERS.find(u => u.id === params.userId);
8
+ if (!found) {
9
+ throw new Error(`User with ID ${params.userId} not found`);
10
+ }
11
+ return {
12
+ success: true,
13
+ user: found,
14
+ timestamp: new Date().toISOString()
15
+ };
16
+ };
@@ -0,0 +1,10 @@
1
+ import { CFActiveUser } from "../../CommonTypes";
2
+ export interface SetActiveUserParams {
3
+ userId: string;
4
+ }
5
+ export interface SetActiveUserResponse {
6
+ success: boolean;
7
+ user: CFActiveUser;
8
+ timestamp: string;
9
+ }
10
+ export type SetActiveUser = (params?: SetActiveUserParams) => Promise<SetActiveUserResponse>;
@@ -0,0 +1 @@
1
+ export {};