@elqnt/admin 2.2.1 → 2.3.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.
@@ -1,249 +1,130 @@
1
1
  import { ApiClientOptions } from '@elqnt/api-client';
2
- import { Org, OrgInfo, OrgSchemaTypeTS, CreateOrgWithSchemasResponse, User, UserSettingsResponse, UserSettings, NotificationPreferences, Invite, InviteInput, InvitesResult, AnalyticsSummary, ChatAnalytics, AgentAnalytics, UsageAnalytics, DailyAnalytics, AnalyticsEvent, DateFilter, GlobalAnalyticsSummary, OrgAnalytics, CreateOrgRequest, OrgArtifactTypeTS } from '../models/index.cjs';
3
- import { L as ListOrgsFilter, P as ProvisioningProgress, V as ValidationResult } from '../provisioning-Cfl6wbmV.cjs';
2
+ import { b as Org, as as OrgInfo, ba as User, bf as UserSettingsResponse, be as UserSettings, a9 as NotificationPreferences, S as Invite, T as InviteInput, a2 as InvitesResult } from '../admin-C1iVQe2d.cjs';
4
3
  import { OrgSettings } from '@elqnt/agents/models';
4
+ import { L as ListOrgsFilter } from '../orgs-Buu2Re0N.cjs';
5
5
  import '@elqnt/types';
6
6
 
7
7
  type UseOrgAdminOptions = ApiClientOptions;
8
8
  /**
9
- * Hook for organization CRUD operations
10
- *
11
- * @example
12
- * ```tsx
13
- * const { loading, error, listOrgs, createOrg, updateOrg } = useOrgAdmin({
14
- * baseUrl: apiGatewayUrl,
15
- * orgId: selectedOrgId,
16
- * userId: user?.id,
17
- * userEmail: user?.email,
18
- * });
9
+ * The exact, stable return surface of `useOrgAdmin`.
19
10
  *
20
- * const orgs = await listOrgs();
21
- * const newOrg = await createOrg({ name: "Acme Corp" });
22
- * ```
11
+ * This is the agent/consumer **contract**: the only members that exist on the
12
+ * org-admin hook (org CRUD + the settings methods folded in from the former
13
+ * `useOrgSettings`). Every method is imperative and DOES NOT throw — on failure
14
+ * it resolves to the documented default (`[]`, `null`, `false`) and sets
15
+ * `error`. See `SKILL.md`.
23
16
  */
24
- declare function useOrgAdmin(options: UseOrgAdminOptions): {
17
+ interface UseOrgAdminReturn {
18
+ /** True while any in-flight call runs. */
25
19
  loading: boolean;
20
+ /** Last error message, else null. */
26
21
  error: string | null;
22
+ /** GET /api/v1/admin/orgs (optional ?status&type&product) — default []. */
27
23
  listOrgs: (filter?: ListOrgsFilter) => Promise<Org[]>;
24
+ /** GET /api/v1/admin/orgs/{orgId} — default null. */
28
25
  getOrg: (orgId: string) => Promise<Org | null>;
26
+ /** GET /api/v1/admin/orgs/{orgId}/info (lightweight) — default null. */
29
27
  getOrgInfo: (orgId: string) => Promise<OrgInfo | null>;
30
- createOrg: (org: Partial<Org>) => Promise<Org | null>;
31
- createOrgWithSchemas: (org: Partial<Org>, schemas: OrgSchemaTypeTS[]) => Promise<CreateOrgWithSchemasResponse | null>;
28
+ /** POST /api/v1/admin/orgs — created org, or null on error. `product` is transient routing metadata. */
29
+ createOrg: (org: Partial<Org> & {
30
+ product?: string;
31
+ }) => Promise<Org | null>;
32
+ /** PUT /api/v1/admin/orgs/{orgId} — updated org, or null on error. */
32
33
  updateOrg: (orgId: string, updates: Partial<Org>) => Promise<Org | null>;
34
+ /** DELETE /api/v1/admin/orgs/{orgId} — true on success. */
33
35
  deleteOrg: (orgId: string) => Promise<boolean>;
34
- };
35
-
36
- type UseUsersAdminOptions = ApiClientOptions;
36
+ /** GET /api/v1/admin/orgs/{orgId} → OrgSettings — default null. */
37
+ getSettings: () => Promise<OrgSettings | null>;
38
+ /** Alias for updateSettings (settings rows always exist). PUT /api/v1/admin/orgs/{orgId}. */
39
+ createSettings: (settings: Partial<OrgSettings>) => Promise<OrgSettings | null>;
40
+ /** PUT /api/v1/admin/orgs/{orgId} then re-GET — updated OrgSettings, or null on error. */
41
+ updateSettings: (settings: Partial<OrgSettings>) => Promise<OrgSettings | null>;
42
+ }
37
43
  /**
38
- * Hook for user CRUD operations
44
+ * Hook for organization CRUD operations
39
45
  *
40
46
  * @example
41
47
  * ```tsx
42
- * const { loading, error, listUsers, createUser, updateUser } = useUsersAdmin({
48
+ * const { loading, error, listOrgs, createOrg, updateOrg } = useOrgAdmin({
43
49
  * baseUrl: apiGatewayUrl,
44
50
  * orgId: selectedOrgId,
45
51
  * userId: user?.id,
46
52
  * userEmail: user?.email,
47
53
  * });
48
54
  *
49
- * const users = await listUsers();
50
- * const user = await getUserByEmail("user@example.com");
55
+ * const orgs = await listOrgs();
56
+ * const newOrg = await createOrg({ name: "Acme Corp" });
51
57
  * ```
52
58
  */
53
- declare function useUsersAdmin(options: UseUsersAdminOptions): {
59
+ declare function useOrgAdmin(options: UseOrgAdminOptions): UseOrgAdminReturn;
60
+
61
+ type UseUsersAdminOptions = ApiClientOptions;
62
+ /**
63
+ * The exact, stable return surface of `useUsersAdmin`.
64
+ *
65
+ * Agent/consumer **contract**: the only members on the users-admin hook (user
66
+ * CRUD + the invitation methods folded in from the former `useInvitesAdmin`).
67
+ * Every method is imperative and DOES NOT throw — on failure it resolves to its
68
+ * default (`[]`, `null`, `false`) and sets `error`. See `SKILL.md`.
69
+ */
70
+ interface UseUsersAdminReturn {
71
+ /** True while any in-flight call runs. */
54
72
  loading: boolean;
73
+ /** Last error message, else null. */
55
74
  error: string | null;
75
+ /** GET /api/v1/admin/users — default []. */
56
76
  listUsers: () => Promise<User[]>;
77
+ /** GET /api/v1/admin/users/{userId} — default null. */
57
78
  getUser: (userId: string) => Promise<User | null>;
79
+ /** GET /api/v1/admin/users/by-email?email= — default null. */
58
80
  getUserByEmail: (email: string) => Promise<User | null>;
81
+ /** GET /api/v1/admin/users/by-phone?phone= — default null. */
59
82
  getUserByPhone: (phone: string) => Promise<User | null>;
83
+ /** POST /api/v1/admin/users — created user, or null on error. */
60
84
  createUser: (user: Partial<User>) => Promise<User | null>;
85
+ /** PUT /api/v1/admin/users/{userId} — updated user, or null on error. */
61
86
  updateUser: (userId: string, updates: Partial<User>) => Promise<User | null>;
87
+ /** DELETE /api/v1/admin/users/{userId} — true on success. */
62
88
  deleteUser: (userId: string) => Promise<boolean>;
89
+ /** GET /api/v1/admin/users/{userId}/settings — default null. */
63
90
  getUserSettings: (userId: string) => Promise<UserSettingsResponse | null>;
91
+ /** PUT /api/v1/admin/users/{userId}/settings — updated settings, or null on error. */
64
92
  updateUserSettings: (userId: string, settings: {
65
93
  settings?: UserSettings;
66
94
  notificationPreferences?: NotificationPreferences;
67
95
  }) => Promise<UserSettingsResponse | null>;
68
- };
69
-
70
- type UseInvitesAdminOptions = ApiClientOptions;
71
- /**
72
- * Hook for invitation CRUD operations
73
- *
74
- * @example
75
- * ```tsx
76
- * const { loading, error, listInvites, sendInvite, revokeInvite } = useInvitesAdmin({
77
- * baseUrl: apiGatewayUrl,
78
- * orgId: selectedOrgId,
79
- * userId: user?.id,
80
- * userEmail: user?.email,
81
- * });
82
- *
83
- * const invites = await listInvites();
84
- * await sendInvite({ email: "user@example.com", role: "member" });
85
- * ```
86
- */
87
- declare function useInvitesAdmin(options: UseInvitesAdminOptions): {
88
- loading: boolean;
89
- error: string | null;
96
+ /** GET /api/v1/admin/invites — default []. */
90
97
  listInvites: () => Promise<Invite[]>;
98
+ /** GET /api/v1/admin/invites/{inviteId} — default null. */
91
99
  getInvite: (inviteId: string) => Promise<Invite | null>;
100
+ /** POST /api/v1/admin/invites/single — created invite, or null on error. */
92
101
  sendInvite: (invite: InviteInput) => Promise<Invite | null>;
102
+ /** POST /api/v1/admin/invites, body { invites } — batch result, or null on error. */
93
103
  sendInvites: (invites: InviteInput[]) => Promise<InvitesResult | null>;
104
+ /** POST /api/v1/admin/invites/{inviteId}/resend — invite, or null on error. */
94
105
  resendInvite: (inviteId: string) => Promise<Invite | null>;
106
+ /** DELETE /api/v1/admin/invites/{inviteId} — true on success. */
95
107
  revokeInvite: (inviteId: string) => Promise<boolean>;
108
+ /** POST /api/v1/admin/invites/{inviteId}/accept — invite, or null on error. */
96
109
  acceptInvite: (inviteId: string) => Promise<Invite | null>;
97
- };
98
-
99
- type UseOrgSettingsOptions = ApiClientOptions;
100
- /**
101
- * Hook for organization settings CRUD operations
102
- *
103
- * @example
104
- * ```tsx
105
- * const { loading, error, getSettings, createSettings, updateSettings } = useOrgSettings({
106
- * baseUrl: apiGatewayUrl,
107
- * orgId: selectedOrgId,
108
- * });
109
- *
110
- * const settings = await getSettings();
111
- * await updateSettings({ timezone: "America/New_York" });
112
- * ```
113
- */
114
- declare function useOrgSettings(options: UseOrgSettingsOptions): {
115
- loading: boolean;
116
- error: string | null;
117
- getSettings: () => Promise<OrgSettings | null>;
118
- createSettings: (settings: Partial<OrgSettings>) => Promise<OrgSettings | null>;
119
- updateSettings: (settings: Partial<OrgSettings>) => Promise<OrgSettings | null>;
120
- };
121
-
122
- type UseProductAnalyticsOptions = ApiClientOptions;
123
- interface ProductAnalyticsState {
124
- summary: AnalyticsSummary | null;
125
- chats: ChatAnalytics[];
126
- agents: AgentAnalytics[];
127
- usage: UsageAnalytics[];
128
- daily: DailyAnalytics[];
129
- events: AnalyticsEvent[];
130
- loading: boolean;
131
- error: string | null;
132
110
  }
133
111
  /**
134
- * Hook for product analytics queries and event tracking
112
+ * Hook for user + invitation CRUD operations
135
113
  *
136
114
  * @example
137
115
  * ```tsx
138
- * const {
139
- * loading,
140
- * error,
141
- * summary,
142
- * getSummary,
143
- * trackEvent,
144
- * } = useProductAnalytics({
116
+ * const { loading, error, listUsers, createUser, updateUser, listInvites, sendInvite } = useUsersAdmin({
145
117
  * baseUrl: apiGatewayUrl,
146
- * orgId: user?.orgId,
118
+ * orgId: selectedOrgId,
147
119
  * userId: user?.id,
148
120
  * userEmail: user?.email,
149
121
  * });
150
122
  *
151
- * // Fetch analytics
152
- * await getSummary({ from: "2024-01-01", to: "2024-12-31" });
153
- *
154
- * // Track events
155
- * trackEvent("button_click", "ui", { buttonId: "submit" });
156
- * ```
157
- */
158
- declare function useProductAnalytics(options: UseProductAnalyticsOptions): {
159
- getSummary: (filter?: DateFilter) => Promise<AnalyticsSummary | null>;
160
- getChats: (filter?: DateFilter, agentId?: string) => Promise<ChatAnalytics[]>;
161
- getAgents: (filter?: DateFilter) => Promise<AgentAnalytics[]>;
162
- getUsage: (filter?: DateFilter) => Promise<UsageAnalytics[]>;
163
- getDaily: (filter?: DateFilter) => Promise<DailyAnalytics[]>;
164
- getEvents: (filter?: DateFilter) => Promise<AnalyticsEvent[]>;
165
- trackEvent: (eventType: string, eventCategory: string, properties?: Record<string, unknown>) => Promise<void>;
166
- trackPageView: (pageName?: string) => Promise<void>;
167
- getGlobalSummary: (filter?: DateFilter) => Promise<GlobalAnalyticsSummary | null>;
168
- getGlobalOrgs: (filter?: DateFilter) => Promise<OrgAnalytics[]>;
169
- summary: AnalyticsSummary | null;
170
- chats: ChatAnalytics[];
171
- agents: AgentAnalytics[];
172
- usage: UsageAnalytics[];
173
- daily: DailyAnalytics[];
174
- events: AnalyticsEvent[];
175
- loading: boolean;
176
- error: string | null;
177
- };
178
- /**
179
- * Hook to use analytics context (for event tracking throughout the app)
180
- *
181
- * This is an alias for useProductAnalytics that makes the intent clearer
182
- * when used primarily for event tracking.
183
- *
184
- * @example
185
- * ```tsx
186
- * const { trackEvent } = useAnalyticsContext(options);
187
- * trackEvent("form_submit", "ui", { formId: "contact" });
188
- * ```
189
- */
190
- declare const useAnalyticsContext: typeof useProductAnalytics;
191
-
192
- type UseOrgProvisioningOptions = ApiClientOptions;
193
- interface ProvisioningState {
194
- status: "idle" | "creating" | "provisioning" | "completed" | "failed" | "partial";
195
- progress: ProvisioningProgress | null;
196
- org: Org | null;
197
- error: string | null;
198
- percentage: number;
199
- }
200
- /**
201
- * Hook for organization provisioning with real-time progress
202
- *
203
- * @example
204
- * ```tsx
205
- * const {
206
- * state,
207
- * createOrgWithProvisioning,
208
- * retryProvisioning,
209
- * cancelProvisioning,
210
- * } = useOrgProvisioning({
211
- * baseUrl: apiGatewayUrl,
212
- * orgId: selectedOrgId,
213
- * });
214
- *
215
- * // Create org and track progress
216
- * await createOrgWithProvisioning({
217
- * title: "Acme Corp",
218
- * product: "eloquent",
219
- * });
220
- *
221
- * // state.progress will update in real-time
222
- * console.log(state.percentage); // 0-100
123
+ * const users = await listUsers();
124
+ * const user = await getUserByEmail("user@example.com");
125
+ * await sendInvite({ email: "user@example.com", role: "member" });
223
126
  * ```
224
127
  */
225
- declare function useOrgProvisioning(options: UseOrgProvisioningOptions): {
226
- state: ProvisioningState;
227
- createOrgWithProvisioning: (request: CreateOrgRequest) => Promise<Org | null>;
228
- getProvisioningStatus: (orgId: string) => Promise<ProvisioningProgress | null>;
229
- retryProvisioning: (orgId: string, artifacts?: OrgArtifactTypeTS[]) => Promise<boolean>;
230
- validateProvisioning: (orgId: string) => Promise<ValidationResult | null>;
231
- cancelProvisioning: (orgId: string) => Promise<boolean>;
232
- cleanupOrg: (orgId: string) => Promise<boolean>;
233
- reset: () => void;
234
- isComplete: boolean;
235
- isFailed: boolean;
236
- isPartial: boolean;
237
- isProvisioning: boolean;
238
- failedArtifacts: {
239
- type: OrgArtifactTypeTS;
240
- status: string;
241
- critical: boolean;
242
- error?: string;
243
- duration?: number;
244
- estimatedDuration?: number;
245
- }[];
246
- hasCriticalFailures: boolean;
247
- };
128
+ declare function useUsersAdmin(options: UseUsersAdminOptions): UseUsersAdminReturn;
248
129
 
249
- export { type ProductAnalyticsState, type ProvisioningState, type UseInvitesAdminOptions, type UseOrgAdminOptions, type UseOrgProvisioningOptions, type UseOrgSettingsOptions, type UseProductAnalyticsOptions, type UseUsersAdminOptions, useAnalyticsContext, useInvitesAdmin, useOrgAdmin, useOrgProvisioning, useOrgSettings, useProductAnalytics, useUsersAdmin };
130
+ export { type UseOrgAdminOptions, type UseOrgAdminReturn, type UseUsersAdminOptions, type UseUsersAdminReturn, useOrgAdmin, useUsersAdmin };
@@ -1,249 +1,130 @@
1
1
  import { ApiClientOptions } from '@elqnt/api-client';
2
- import { Org, OrgInfo, OrgSchemaTypeTS, CreateOrgWithSchemasResponse, User, UserSettingsResponse, UserSettings, NotificationPreferences, Invite, InviteInput, InvitesResult, AnalyticsSummary, ChatAnalytics, AgentAnalytics, UsageAnalytics, DailyAnalytics, AnalyticsEvent, DateFilter, GlobalAnalyticsSummary, OrgAnalytics, CreateOrgRequest, OrgArtifactTypeTS } from '../models/index.js';
3
- import { L as ListOrgsFilter, P as ProvisioningProgress, V as ValidationResult } from '../provisioning-Il9t2jnH.js';
2
+ import { b as Org, as as OrgInfo, ba as User, bf as UserSettingsResponse, be as UserSettings, a9 as NotificationPreferences, S as Invite, T as InviteInput, a2 as InvitesResult } from '../admin-C1iVQe2d.js';
4
3
  import { OrgSettings } from '@elqnt/agents/models';
4
+ import { L as ListOrgsFilter } from '../orgs-BSHeYVe-.js';
5
5
  import '@elqnt/types';
6
6
 
7
7
  type UseOrgAdminOptions = ApiClientOptions;
8
8
  /**
9
- * Hook for organization CRUD operations
10
- *
11
- * @example
12
- * ```tsx
13
- * const { loading, error, listOrgs, createOrg, updateOrg } = useOrgAdmin({
14
- * baseUrl: apiGatewayUrl,
15
- * orgId: selectedOrgId,
16
- * userId: user?.id,
17
- * userEmail: user?.email,
18
- * });
9
+ * The exact, stable return surface of `useOrgAdmin`.
19
10
  *
20
- * const orgs = await listOrgs();
21
- * const newOrg = await createOrg({ name: "Acme Corp" });
22
- * ```
11
+ * This is the agent/consumer **contract**: the only members that exist on the
12
+ * org-admin hook (org CRUD + the settings methods folded in from the former
13
+ * `useOrgSettings`). Every method is imperative and DOES NOT throw — on failure
14
+ * it resolves to the documented default (`[]`, `null`, `false`) and sets
15
+ * `error`. See `SKILL.md`.
23
16
  */
24
- declare function useOrgAdmin(options: UseOrgAdminOptions): {
17
+ interface UseOrgAdminReturn {
18
+ /** True while any in-flight call runs. */
25
19
  loading: boolean;
20
+ /** Last error message, else null. */
26
21
  error: string | null;
22
+ /** GET /api/v1/admin/orgs (optional ?status&type&product) — default []. */
27
23
  listOrgs: (filter?: ListOrgsFilter) => Promise<Org[]>;
24
+ /** GET /api/v1/admin/orgs/{orgId} — default null. */
28
25
  getOrg: (orgId: string) => Promise<Org | null>;
26
+ /** GET /api/v1/admin/orgs/{orgId}/info (lightweight) — default null. */
29
27
  getOrgInfo: (orgId: string) => Promise<OrgInfo | null>;
30
- createOrg: (org: Partial<Org>) => Promise<Org | null>;
31
- createOrgWithSchemas: (org: Partial<Org>, schemas: OrgSchemaTypeTS[]) => Promise<CreateOrgWithSchemasResponse | null>;
28
+ /** POST /api/v1/admin/orgs — created org, or null on error. `product` is transient routing metadata. */
29
+ createOrg: (org: Partial<Org> & {
30
+ product?: string;
31
+ }) => Promise<Org | null>;
32
+ /** PUT /api/v1/admin/orgs/{orgId} — updated org, or null on error. */
32
33
  updateOrg: (orgId: string, updates: Partial<Org>) => Promise<Org | null>;
34
+ /** DELETE /api/v1/admin/orgs/{orgId} — true on success. */
33
35
  deleteOrg: (orgId: string) => Promise<boolean>;
34
- };
35
-
36
- type UseUsersAdminOptions = ApiClientOptions;
36
+ /** GET /api/v1/admin/orgs/{orgId} → OrgSettings — default null. */
37
+ getSettings: () => Promise<OrgSettings | null>;
38
+ /** Alias for updateSettings (settings rows always exist). PUT /api/v1/admin/orgs/{orgId}. */
39
+ createSettings: (settings: Partial<OrgSettings>) => Promise<OrgSettings | null>;
40
+ /** PUT /api/v1/admin/orgs/{orgId} then re-GET — updated OrgSettings, or null on error. */
41
+ updateSettings: (settings: Partial<OrgSettings>) => Promise<OrgSettings | null>;
42
+ }
37
43
  /**
38
- * Hook for user CRUD operations
44
+ * Hook for organization CRUD operations
39
45
  *
40
46
  * @example
41
47
  * ```tsx
42
- * const { loading, error, listUsers, createUser, updateUser } = useUsersAdmin({
48
+ * const { loading, error, listOrgs, createOrg, updateOrg } = useOrgAdmin({
43
49
  * baseUrl: apiGatewayUrl,
44
50
  * orgId: selectedOrgId,
45
51
  * userId: user?.id,
46
52
  * userEmail: user?.email,
47
53
  * });
48
54
  *
49
- * const users = await listUsers();
50
- * const user = await getUserByEmail("user@example.com");
55
+ * const orgs = await listOrgs();
56
+ * const newOrg = await createOrg({ name: "Acme Corp" });
51
57
  * ```
52
58
  */
53
- declare function useUsersAdmin(options: UseUsersAdminOptions): {
59
+ declare function useOrgAdmin(options: UseOrgAdminOptions): UseOrgAdminReturn;
60
+
61
+ type UseUsersAdminOptions = ApiClientOptions;
62
+ /**
63
+ * The exact, stable return surface of `useUsersAdmin`.
64
+ *
65
+ * Agent/consumer **contract**: the only members on the users-admin hook (user
66
+ * CRUD + the invitation methods folded in from the former `useInvitesAdmin`).
67
+ * Every method is imperative and DOES NOT throw — on failure it resolves to its
68
+ * default (`[]`, `null`, `false`) and sets `error`. See `SKILL.md`.
69
+ */
70
+ interface UseUsersAdminReturn {
71
+ /** True while any in-flight call runs. */
54
72
  loading: boolean;
73
+ /** Last error message, else null. */
55
74
  error: string | null;
75
+ /** GET /api/v1/admin/users — default []. */
56
76
  listUsers: () => Promise<User[]>;
77
+ /** GET /api/v1/admin/users/{userId} — default null. */
57
78
  getUser: (userId: string) => Promise<User | null>;
79
+ /** GET /api/v1/admin/users/by-email?email= — default null. */
58
80
  getUserByEmail: (email: string) => Promise<User | null>;
81
+ /** GET /api/v1/admin/users/by-phone?phone= — default null. */
59
82
  getUserByPhone: (phone: string) => Promise<User | null>;
83
+ /** POST /api/v1/admin/users — created user, or null on error. */
60
84
  createUser: (user: Partial<User>) => Promise<User | null>;
85
+ /** PUT /api/v1/admin/users/{userId} — updated user, or null on error. */
61
86
  updateUser: (userId: string, updates: Partial<User>) => Promise<User | null>;
87
+ /** DELETE /api/v1/admin/users/{userId} — true on success. */
62
88
  deleteUser: (userId: string) => Promise<boolean>;
89
+ /** GET /api/v1/admin/users/{userId}/settings — default null. */
63
90
  getUserSettings: (userId: string) => Promise<UserSettingsResponse | null>;
91
+ /** PUT /api/v1/admin/users/{userId}/settings — updated settings, or null on error. */
64
92
  updateUserSettings: (userId: string, settings: {
65
93
  settings?: UserSettings;
66
94
  notificationPreferences?: NotificationPreferences;
67
95
  }) => Promise<UserSettingsResponse | null>;
68
- };
69
-
70
- type UseInvitesAdminOptions = ApiClientOptions;
71
- /**
72
- * Hook for invitation CRUD operations
73
- *
74
- * @example
75
- * ```tsx
76
- * const { loading, error, listInvites, sendInvite, revokeInvite } = useInvitesAdmin({
77
- * baseUrl: apiGatewayUrl,
78
- * orgId: selectedOrgId,
79
- * userId: user?.id,
80
- * userEmail: user?.email,
81
- * });
82
- *
83
- * const invites = await listInvites();
84
- * await sendInvite({ email: "user@example.com", role: "member" });
85
- * ```
86
- */
87
- declare function useInvitesAdmin(options: UseInvitesAdminOptions): {
88
- loading: boolean;
89
- error: string | null;
96
+ /** GET /api/v1/admin/invites — default []. */
90
97
  listInvites: () => Promise<Invite[]>;
98
+ /** GET /api/v1/admin/invites/{inviteId} — default null. */
91
99
  getInvite: (inviteId: string) => Promise<Invite | null>;
100
+ /** POST /api/v1/admin/invites/single — created invite, or null on error. */
92
101
  sendInvite: (invite: InviteInput) => Promise<Invite | null>;
102
+ /** POST /api/v1/admin/invites, body { invites } — batch result, or null on error. */
93
103
  sendInvites: (invites: InviteInput[]) => Promise<InvitesResult | null>;
104
+ /** POST /api/v1/admin/invites/{inviteId}/resend — invite, or null on error. */
94
105
  resendInvite: (inviteId: string) => Promise<Invite | null>;
106
+ /** DELETE /api/v1/admin/invites/{inviteId} — true on success. */
95
107
  revokeInvite: (inviteId: string) => Promise<boolean>;
108
+ /** POST /api/v1/admin/invites/{inviteId}/accept — invite, or null on error. */
96
109
  acceptInvite: (inviteId: string) => Promise<Invite | null>;
97
- };
98
-
99
- type UseOrgSettingsOptions = ApiClientOptions;
100
- /**
101
- * Hook for organization settings CRUD operations
102
- *
103
- * @example
104
- * ```tsx
105
- * const { loading, error, getSettings, createSettings, updateSettings } = useOrgSettings({
106
- * baseUrl: apiGatewayUrl,
107
- * orgId: selectedOrgId,
108
- * });
109
- *
110
- * const settings = await getSettings();
111
- * await updateSettings({ timezone: "America/New_York" });
112
- * ```
113
- */
114
- declare function useOrgSettings(options: UseOrgSettingsOptions): {
115
- loading: boolean;
116
- error: string | null;
117
- getSettings: () => Promise<OrgSettings | null>;
118
- createSettings: (settings: Partial<OrgSettings>) => Promise<OrgSettings | null>;
119
- updateSettings: (settings: Partial<OrgSettings>) => Promise<OrgSettings | null>;
120
- };
121
-
122
- type UseProductAnalyticsOptions = ApiClientOptions;
123
- interface ProductAnalyticsState {
124
- summary: AnalyticsSummary | null;
125
- chats: ChatAnalytics[];
126
- agents: AgentAnalytics[];
127
- usage: UsageAnalytics[];
128
- daily: DailyAnalytics[];
129
- events: AnalyticsEvent[];
130
- loading: boolean;
131
- error: string | null;
132
110
  }
133
111
  /**
134
- * Hook for product analytics queries and event tracking
112
+ * Hook for user + invitation CRUD operations
135
113
  *
136
114
  * @example
137
115
  * ```tsx
138
- * const {
139
- * loading,
140
- * error,
141
- * summary,
142
- * getSummary,
143
- * trackEvent,
144
- * } = useProductAnalytics({
116
+ * const { loading, error, listUsers, createUser, updateUser, listInvites, sendInvite } = useUsersAdmin({
145
117
  * baseUrl: apiGatewayUrl,
146
- * orgId: user?.orgId,
118
+ * orgId: selectedOrgId,
147
119
  * userId: user?.id,
148
120
  * userEmail: user?.email,
149
121
  * });
150
122
  *
151
- * // Fetch analytics
152
- * await getSummary({ from: "2024-01-01", to: "2024-12-31" });
153
- *
154
- * // Track events
155
- * trackEvent("button_click", "ui", { buttonId: "submit" });
156
- * ```
157
- */
158
- declare function useProductAnalytics(options: UseProductAnalyticsOptions): {
159
- getSummary: (filter?: DateFilter) => Promise<AnalyticsSummary | null>;
160
- getChats: (filter?: DateFilter, agentId?: string) => Promise<ChatAnalytics[]>;
161
- getAgents: (filter?: DateFilter) => Promise<AgentAnalytics[]>;
162
- getUsage: (filter?: DateFilter) => Promise<UsageAnalytics[]>;
163
- getDaily: (filter?: DateFilter) => Promise<DailyAnalytics[]>;
164
- getEvents: (filter?: DateFilter) => Promise<AnalyticsEvent[]>;
165
- trackEvent: (eventType: string, eventCategory: string, properties?: Record<string, unknown>) => Promise<void>;
166
- trackPageView: (pageName?: string) => Promise<void>;
167
- getGlobalSummary: (filter?: DateFilter) => Promise<GlobalAnalyticsSummary | null>;
168
- getGlobalOrgs: (filter?: DateFilter) => Promise<OrgAnalytics[]>;
169
- summary: AnalyticsSummary | null;
170
- chats: ChatAnalytics[];
171
- agents: AgentAnalytics[];
172
- usage: UsageAnalytics[];
173
- daily: DailyAnalytics[];
174
- events: AnalyticsEvent[];
175
- loading: boolean;
176
- error: string | null;
177
- };
178
- /**
179
- * Hook to use analytics context (for event tracking throughout the app)
180
- *
181
- * This is an alias for useProductAnalytics that makes the intent clearer
182
- * when used primarily for event tracking.
183
- *
184
- * @example
185
- * ```tsx
186
- * const { trackEvent } = useAnalyticsContext(options);
187
- * trackEvent("form_submit", "ui", { formId: "contact" });
188
- * ```
189
- */
190
- declare const useAnalyticsContext: typeof useProductAnalytics;
191
-
192
- type UseOrgProvisioningOptions = ApiClientOptions;
193
- interface ProvisioningState {
194
- status: "idle" | "creating" | "provisioning" | "completed" | "failed" | "partial";
195
- progress: ProvisioningProgress | null;
196
- org: Org | null;
197
- error: string | null;
198
- percentage: number;
199
- }
200
- /**
201
- * Hook for organization provisioning with real-time progress
202
- *
203
- * @example
204
- * ```tsx
205
- * const {
206
- * state,
207
- * createOrgWithProvisioning,
208
- * retryProvisioning,
209
- * cancelProvisioning,
210
- * } = useOrgProvisioning({
211
- * baseUrl: apiGatewayUrl,
212
- * orgId: selectedOrgId,
213
- * });
214
- *
215
- * // Create org and track progress
216
- * await createOrgWithProvisioning({
217
- * title: "Acme Corp",
218
- * product: "eloquent",
219
- * });
220
- *
221
- * // state.progress will update in real-time
222
- * console.log(state.percentage); // 0-100
123
+ * const users = await listUsers();
124
+ * const user = await getUserByEmail("user@example.com");
125
+ * await sendInvite({ email: "user@example.com", role: "member" });
223
126
  * ```
224
127
  */
225
- declare function useOrgProvisioning(options: UseOrgProvisioningOptions): {
226
- state: ProvisioningState;
227
- createOrgWithProvisioning: (request: CreateOrgRequest) => Promise<Org | null>;
228
- getProvisioningStatus: (orgId: string) => Promise<ProvisioningProgress | null>;
229
- retryProvisioning: (orgId: string, artifacts?: OrgArtifactTypeTS[]) => Promise<boolean>;
230
- validateProvisioning: (orgId: string) => Promise<ValidationResult | null>;
231
- cancelProvisioning: (orgId: string) => Promise<boolean>;
232
- cleanupOrg: (orgId: string) => Promise<boolean>;
233
- reset: () => void;
234
- isComplete: boolean;
235
- isFailed: boolean;
236
- isPartial: boolean;
237
- isProvisioning: boolean;
238
- failedArtifacts: {
239
- type: OrgArtifactTypeTS;
240
- status: string;
241
- critical: boolean;
242
- error?: string;
243
- duration?: number;
244
- estimatedDuration?: number;
245
- }[];
246
- hasCriticalFailures: boolean;
247
- };
128
+ declare function useUsersAdmin(options: UseUsersAdminOptions): UseUsersAdminReturn;
248
129
 
249
- export { type ProductAnalyticsState, type ProvisioningState, type UseInvitesAdminOptions, type UseOrgAdminOptions, type UseOrgProvisioningOptions, type UseOrgSettingsOptions, type UseProductAnalyticsOptions, type UseUsersAdminOptions, useAnalyticsContext, useInvitesAdmin, useOrgAdmin, useOrgProvisioning, useOrgSettings, useProductAnalytics, useUsersAdmin };
130
+ export { type UseOrgAdminOptions, type UseOrgAdminReturn, type UseUsersAdminOptions, type UseUsersAdminReturn, useOrgAdmin, useUsersAdmin };