@final-commerce/command-frame 0.1.31 → 0.1.32

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.
@@ -359,21 +359,33 @@ export interface CFOrder {
359
359
  }
360
360
  export interface CFActiveUserRole {
361
361
  id?: string;
362
+ _id?: string;
363
+ companyId?: string;
362
364
  name: string;
363
365
  permissions: {
364
366
  category: string;
365
- label: string;
367
+ label?: string;
366
368
  name: string;
367
369
  value: boolean;
370
+ permissionId?: string;
371
+ subCategory?: string;
368
372
  }[];
369
373
  }
370
374
  export interface CFActiveUser extends CFActiveEntity {
371
375
  firstName?: string;
372
376
  lastName?: string;
373
- role: CFActiveUserRole;
377
+ email?: string;
378
+ phone?: string;
379
+ pincode?: string;
380
+ role: CFActiveUserRole | {
381
+ _id: string;
382
+ name: string;
383
+ };
374
384
  id: string;
375
385
  _id?: string;
376
- outlets?: string[];
386
+ outlets?: string[] | {
387
+ _id: string;
388
+ }[];
377
389
  type?: CFUserTypes;
378
390
  companies?: any;
379
391
  }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Get roles action
3
+ * Calls the getRoles action on the parent window
4
+ */
5
+ import type { GetRoles } from "./types";
6
+ export declare const getRoles: GetRoles;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Get roles action
3
+ * Calls the getRoles action on the parent window
4
+ */
5
+ import { commandFrameClient } from "../../client";
6
+ export const getRoles = async (params) => {
7
+ return await commandFrameClient.call("getRoles", params);
8
+ };
@@ -0,0 +1,2 @@
1
+ import type { GetRoles } from "./types";
2
+ export declare const mockGetRoles: GetRoles;
@@ -0,0 +1,68 @@
1
+ export const mockGetRoles = async (params) => {
2
+ console.log("[Mock] getRoles called with params:", params);
3
+ return {
4
+ roles: [
5
+ {
6
+ id: "691df9c6c478bada1fb23d0b",
7
+ _id: "691df9c6c478bada1fb23d0b",
8
+ companyId: "691df9c4c478bada1fb23bff",
9
+ name: "Owner",
10
+ permissions: [
11
+ { category: "hub_access", name: "taxes", value: true, subCategory: "store_management", permissionId: "664759347eefffe8aba84476" },
12
+ { category: "hub_access", name: "general", value: true, subCategory: "store_management", permissionId: "6647591d7eefffe8aba84475" },
13
+ { category: "hub_access", name: "reports", value: true, subCategory: "store_management", permissionId: "6645f719ee8498efff5c49bb" },
14
+ { category: "hub_access", name: "products", value: true, subCategory: "store_management", permissionId: "6645f719f00dc43caaeffe2b" },
15
+ { category: "hub_access", name: "users", value: true, subCategory: "store_management", permissionId: "6647555b7eefffe8aba84473" },
16
+ { category: "hub_access", name: "outlets", value: true, subCategory: "store_management", permissionId: "664759047eefffe8aba84474" },
17
+ { category: "hub_access", name: "builder", value: true, subCategory: "builder_access", permissionId: "664779827eefffe8aba84477" },
18
+ { category: "hub_access", name: "global_blocks", value: true, subCategory: "builder_access", permissionId: "6645f719f00dc43caaeffe47" },
19
+ { category: "hub_access", name: "images", value: true, subCategory: "builder_access", permissionId: "6645f719ee8498efff5c49dc" },
20
+ { category: "hub_access", name: "transactions", value: true, subCategory: "payments_access", permissionId: "6645f719ee8498efff5c4a6b" },
21
+ { category: "hub_access", name: "payouts", value: true, subCategory: "payments_access", permissionId: "66477add7eefffe8aba84478" },
22
+ { category: "hub_access", name: "terminals", value: true, subCategory: "payments_access", permissionId: "6645f71998735e68b2c45740" },
23
+ { category: "hub_access", name: "billing", value: true, subCategory: "payments_access", permissionId: "66bbb00572999149fdd57866" },
24
+ { category: "station_access", name: "give_discounts", value: true, subCategory: "pos_actions", permissionId: "6723b146ae5f176f7539d8a6" },
25
+ { category: "station_access", name: "issue_refunds", value: true, subCategory: "pos_actions", permissionId: "6645f719ee8498efff5c4ae4" },
26
+ { category: "station_access", name: "delete_customers", value: true, subCategory: "pos_actions", permissionId: "6645f71998735e68b2c457df" },
27
+ { category: "station_access", name: "version_control", value: true, subCategory: "station_setting", permissionId: "66e050160d69015fbff9758a" },
28
+ { category: "station_access", name: "session_reports", value: true, subCategory: "station_home", permissionId: "6723b271ae5f176f7539d8a7" },
29
+ { category: "station_access", name: "cash_drawer", value: true, subCategory: "station_home", permissionId: "6723b2aeae5f176f7539d8a8" },
30
+ { category: "station_access", name: "station_setting", value: true, subCategory: "station_home", permissionId: "6723b2c5ae5f176f7539d8a9" },
31
+ { category: "station_access", name: "station_transactions", value: true, subCategory: "station_home", permissionId: "677eb109d2607a0169fdf7d5" },
32
+ ]
33
+ },
34
+ {
35
+ id: "691df9c6c478bada1fb23d0c",
36
+ _id: "691df9c6c478bada1fb23d0c",
37
+ companyId: "691df9c4c478bada1fb23bff",
38
+ name: "admin",
39
+ permissions: [
40
+ { category: "hub_access", name: "taxes", value: true, subCategory: "store_management", permissionId: "664759347eefffe8aba84476" },
41
+ { category: "hub_access", name: "general", value: true, subCategory: "store_management", permissionId: "6647591d7eefffe8aba84475" },
42
+ { category: "hub_access", name: "reports", value: true, subCategory: "store_management", permissionId: "6645f719ee8498efff5c49bb" },
43
+ { category: "hub_access", name: "products", value: true, subCategory: "store_management", permissionId: "6645f719f00dc43caaeffe2b" },
44
+ { category: "hub_access", name: "users", value: true, subCategory: "store_management", permissionId: "6647555b7eefffe8aba84473" },
45
+ { category: "hub_access", name: "transactions", value: true, subCategory: "payments_access", permissionId: "6645f719ee8498efff5c4a6b" },
46
+ { category: "station_access", name: "give_discounts", value: true, subCategory: "pos_actions", permissionId: "6723b146ae5f176f7539d8a6" },
47
+ { category: "station_access", name: "issue_refunds", value: true, subCategory: "pos_actions", permissionId: "6645f719ee8498efff5c4ae4" },
48
+ { category: "station_access", name: "delete_customers", value: true, subCategory: "pos_actions", permissionId: "6645f71998735e68b2c457df" },
49
+ ]
50
+ },
51
+ {
52
+ id: "691df9c6c478bada1fb23d0d",
53
+ _id: "691df9c6c478bada1fb23d0d",
54
+ companyId: "691df9c4c478bada1fb23bff",
55
+ name: "cashier",
56
+ permissions: [
57
+ { category: "station_access", name: "give_discounts", value: false, subCategory: "pos_actions", permissionId: "6723b146ae5f176f7539d8a6" },
58
+ { category: "station_access", name: "issue_refunds", value: false, subCategory: "pos_actions", permissionId: "6645f719ee8498efff5c4ae4" },
59
+ { category: "station_access", name: "delete_customers", value: false, subCategory: "pos_actions", permissionId: "6645f71998735e68b2c457df" },
60
+ { category: "station_access", name: "session_reports", value: true, subCategory: "station_home", permissionId: "6723b271ae5f176f7539d8a7" },
61
+ { category: "station_access", name: "cash_drawer", value: true, subCategory: "station_home", permissionId: "6723b2aeae5f176f7539d8a8" },
62
+ ]
63
+ }
64
+ ],
65
+ success: true,
66
+ timestamp: new Date().toISOString()
67
+ };
68
+ };
@@ -0,0 +1,9 @@
1
+ import { CFActiveUserRole } from "../../CommonTypes";
2
+ export interface GetRolesParams {
3
+ }
4
+ export interface GetRolesResponse {
5
+ roles: CFActiveUserRole[];
6
+ success: boolean;
7
+ timestamp: string;
8
+ }
9
+ export type GetRoles = (params?: GetRolesParams) => Promise<GetRolesResponse>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Get users action
3
+ * Calls the getUsers action on the parent window
4
+ */
5
+ import type { GetUsers } from "./types";
6
+ export declare const getUsers: GetUsers;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Get users action
3
+ * Calls the getUsers action on the parent window
4
+ */
5
+ import { commandFrameClient } from "../../client";
6
+ export const getUsers = async (params) => {
7
+ return await commandFrameClient.call("getUsers", params);
8
+ };
@@ -0,0 +1,2 @@
1
+ import type { GetUsers } from "./types";
2
+ export declare const mockGetUsers: GetUsers;
@@ -0,0 +1,80 @@
1
+ import { CFUserTypes } from "../../CommonTypes";
2
+ export const mockGetUsers = async (params) => {
3
+ console.log("[Mock] getUsers called with params:", params);
4
+ return {
5
+ users: [
6
+ {
7
+ id: "691df9c2047bfc55994d703f",
8
+ _id: "691df9c2047bfc55994d703f",
9
+ firstName: "Sarah",
10
+ lastName: "Mitchell",
11
+ email: "sarah.mitchell@company.com",
12
+ phone: "+1-555-0101",
13
+ type: CFUserTypes.ORG_OWNER,
14
+ role: {
15
+ id: "691df9c6c478bada1fb23d0b",
16
+ _id: "691df9c6c478bada1fb23d0b",
17
+ name: "Owner",
18
+ companyId: "691df9c4c478bada1fb23bff",
19
+ permissions: [
20
+ { category: "hub_access", name: "general", value: true, subCategory: "store_management" },
21
+ { category: "hub_access", name: "products", value: true, subCategory: "store_management" },
22
+ { category: "hub_access", name: "reports", value: true, subCategory: "store_management" },
23
+ { category: "hub_access", name: "users", value: true, subCategory: "store_management" },
24
+ { category: "hub_access", name: "builder", value: true, subCategory: "builder_access" },
25
+ { category: "hub_access", name: "billing", value: true, subCategory: "payments_access" },
26
+ { category: "station_access", name: "give_discounts", value: true, subCategory: "pos_actions" },
27
+ { category: "station_access", name: "issue_refunds", value: true, subCategory: "pos_actions" },
28
+ ]
29
+ },
30
+ outlets: []
31
+ },
32
+ {
33
+ id: "692a1b3c4d5e6f7890abcde1",
34
+ _id: "692a1b3c4d5e6f7890abcde1",
35
+ firstName: "James",
36
+ lastName: "Rodriguez",
37
+ email: "james.rodriguez@company.com",
38
+ phone: "+1-555-0202",
39
+ type: CFUserTypes.ADMIN,
40
+ role: {
41
+ id: "691df9c6c478bada1fb23d0c",
42
+ _id: "691df9c6c478bada1fb23d0c",
43
+ name: "admin",
44
+ companyId: "691df9c4c478bada1fb23bff",
45
+ permissions: [
46
+ { category: "hub_access", name: "general", value: true, subCategory: "store_management" },
47
+ { category: "hub_access", name: "products", value: true, subCategory: "store_management" },
48
+ { category: "hub_access", name: "reports", value: true, subCategory: "store_management" },
49
+ { category: "hub_access", name: "users", value: true, subCategory: "store_management" },
50
+ { category: "station_access", name: "give_discounts", value: true, subCategory: "pos_actions" },
51
+ ]
52
+ },
53
+ outlets: ["outlet-main", "outlet-downtown"]
54
+ },
55
+ {
56
+ id: "692a1b3c4d5e6f7890abcde2",
57
+ _id: "692a1b3c4d5e6f7890abcde2",
58
+ firstName: "Lisa",
59
+ lastName: "Chen",
60
+ email: "lisa.chen@company.com",
61
+ phone: "+1-555-0303",
62
+ type: CFUserTypes.CASHIER,
63
+ role: {
64
+ id: "691df9c6c478bada1fb23d0d",
65
+ _id: "691df9c6c478bada1fb23d0d",
66
+ name: "cashier",
67
+ companyId: "691df9c4c478bada1fb23bff",
68
+ permissions: [
69
+ { category: "station_access", name: "give_discounts", value: false, subCategory: "pos_actions" },
70
+ { category: "station_access", name: "issue_refunds", value: false, subCategory: "pos_actions" },
71
+ { category: "station_access", name: "session_reports", value: true, subCategory: "station_home" },
72
+ ]
73
+ },
74
+ outlets: ["outlet-main"]
75
+ }
76
+ ],
77
+ success: true,
78
+ timestamp: new Date().toISOString()
79
+ };
80
+ };
@@ -0,0 +1,11 @@
1
+ import { CFActiveUser } from "../../CommonTypes";
2
+ export interface GetUsersParams {
3
+ /** Optional array of outlet IDs to filter users by */
4
+ outlets?: string[];
5
+ }
6
+ export interface GetUsersResponse {
7
+ users: CFActiveUser[];
8
+ success: boolean;
9
+ timestamp: string;
10
+ }
11
+ export type GetUsers = (params?: GetUsersParams) => Promise<GetUsersResponse>;
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.d.ts CHANGED
@@ -58,6 +58,8 @@ export declare const command: {
58
58
  readonly getCustomExtensions: import("./actions/get-custom-extensions/types").GetCustomExtensions;
59
59
  readonly getCurrentCompanyCustomExtensions: import("./actions/get-current-company-custom-extensions/types").GetCurrentCompanyCustomExtensions;
60
60
  readonly getCustomExtensionCustomTables: import("./actions/get-custom-extension-custom-tables/types").GetCustomExtensionCustomTables;
61
+ readonly getUsers: import("./actions/get-users/types").GetUsers;
62
+ readonly getRoles: import("./actions/get-roles/types").GetRoles;
61
63
  readonly getSecretsKeys: import("./actions/get-secrets-keys/types").GetSecretsKeys;
62
64
  readonly getSecretVal: import("./actions/get-secret-val/types").GetSecretVal;
63
65
  readonly setSecretVal: import("./actions/set-secret-val/types").SetSecretVal;
@@ -151,3 +153,5 @@ export type { GetCurrentCompanyCustomExtensions, GetCurrentCompanyCustomExtensio
151
153
  export type { GetSecretsKeys, GetSecretsKeysParams, GetSecretsKeysResponse } from "./actions/get-secrets-keys/types";
152
154
  export type { GetSecretVal, GetSecretValParams, GetSecretValResponse } from "./actions/get-secret-val/types";
153
155
  export type { SetSecretVal, SetSecretValParams, SetSecretValResponse } from "./actions/set-secret-val/types";
156
+ export type { GetUsers, GetUsersParams, GetUsersResponse } from "./actions/get-users/types";
157
+ export type { GetRoles, GetRolesParams, GetRolesResponse } from "./actions/get-roles/types";
package/dist/index.js CHANGED
@@ -65,6 +65,9 @@ import { deleteCustomTableData } from "./actions/delete-custom-table-data/action
65
65
  import { getCustomExtensions } from "./actions/get-custom-extensions/action";
66
66
  import { getCurrentCompanyCustomExtensions } from "./actions/get-current-company-custom-extensions/action";
67
67
  import { getCustomExtensionCustomTables } from "./actions/get-custom-extension-custom-tables/action";
68
+ // Company Data Actions
69
+ import { getUsers } from "./actions/get-users/action";
70
+ import { getRoles } from "./actions/get-roles/action";
68
71
  import { getSecretsKeys } from "./actions/get-secrets-keys/action";
69
72
  import { getSecretVal } from "./actions/get-secret-val/action";
70
73
  import { setSecretVal } from "./actions/set-secret-val/action";
@@ -138,6 +141,9 @@ export const command = {
138
141
  getCustomExtensions,
139
142
  getCurrentCompanyCustomExtensions,
140
143
  getCustomExtensionCustomTables,
144
+ // Company Data Actions
145
+ getUsers,
146
+ getRoles,
141
147
  // Secret Storage Actions
142
148
  getSecretsKeys,
143
149
  getSecretVal,
@@ -12,6 +12,10 @@ import { mockDeleteCustomTableData } from "../../actions/delete-custom-table-dat
12
12
  import { mockGetCustomExtensions } from "../../actions/get-custom-extensions/mock";
13
13
  import { mockGetCurrentCompanyCustomExtensions } from "../../actions/get-current-company-custom-extensions/mock";
14
14
  import { mockGetCustomExtensionCustomTables } from "../../actions/get-custom-extension-custom-tables/mock";
15
+ // Company Data Mocks
16
+ import { mockGetUsers } from "../../actions/get-users/mock";
17
+ import { mockGetRoles } from "../../actions/get-roles/mock";
18
+ import { mockGetCustomers } from "../../actions/get-customers/mock";
15
19
  // Manage-specific mock for getFinalContext
16
20
  const mockGetFinalContextManage = async () => {
17
21
  console.log("[Mock] getFinalContext called (Manage)");
@@ -34,5 +38,9 @@ export const MANAGE_MOCKS = {
34
38
  // Custom Extensions Actions
35
39
  getCustomExtensions: mockGetCustomExtensions,
36
40
  getCurrentCompanyCustomExtensions: mockGetCurrentCompanyCustomExtensions,
37
- getCustomExtensionCustomTables: mockGetCustomExtensionCustomTables
41
+ getCustomExtensionCustomTables: mockGetCustomExtensionCustomTables,
42
+ // Company Data Actions
43
+ getUsers: mockGetUsers,
44
+ getRoles: mockGetRoles,
45
+ getCustomers: mockGetCustomers
38
46
  };
@@ -1,4 +1,6 @@
1
- import type { GetContext, GetFinalContext, GetSecretsKeys, GetSecretVal, SetSecretVal, GenerateAPIKey, GetCustomTables, GetCustomTableData, UpsertCustomTableData, DeleteCustomTableData, GetCustomExtensions, GetCurrentCompanyCustomExtensions, GetCustomExtensionCustomTables } from "../../index";
1
+ import type { GetContext, GetFinalContext, GetSecretsKeys, GetSecretVal, SetSecretVal, GenerateAPIKey, GetCustomTables, GetCustomTableData, UpsertCustomTableData, DeleteCustomTableData, GetCustomExtensions, GetCurrentCompanyCustomExtensions, GetCustomExtensionCustomTables, GetCustomers } from "../../index";
2
+ import type { GetUsers } from "../../actions/get-users/types";
3
+ import type { GetRoles } from "../../actions/get-roles/types";
2
4
  export interface ManageProviderActions {
3
5
  getContext: GetContext;
4
6
  getFinalContext: GetFinalContext;
@@ -13,4 +15,7 @@ export interface ManageProviderActions {
13
15
  getCustomExtensions: GetCustomExtensions;
14
16
  getCurrentCompanyCustomExtensions: GetCurrentCompanyCustomExtensions;
15
17
  getCustomExtensionCustomTables: GetCustomExtensionCustomTables;
18
+ getUsers: GetUsers;
19
+ getRoles: GetRoles;
20
+ getCustomers: GetCustomers;
16
21
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@final-commerce/command-frame",
3
- "version": "0.1.31",
3
+ "version": "0.1.32",
4
4
  "description": "Commands Frame library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",