@elqnt/admin 2.0.5 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -192
- package/dist/admin-Dlsd5IZ0.d.cts +767 -0
- package/dist/admin-Dlsd5IZ0.d.ts +767 -0
- package/dist/api/index.cjs +213 -27
- package/dist/api/index.cjs.map +1 -1
- package/dist/api/index.d.cts +121 -3
- package/dist/api/index.d.ts +121 -3
- package/dist/api/index.js +192 -27
- package/dist/api/index.js.map +1 -1
- package/dist/hooks/index.cjs +765 -0
- package/dist/hooks/index.cjs.map +1 -0
- package/dist/hooks/index.d.cts +119 -0
- package/dist/hooks/index.d.ts +119 -0
- package/dist/hooks/index.js +735 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/index.cjs +695 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +532 -27
- package/dist/index.js.map +1 -1
- package/dist/models/index.cjs +491 -0
- package/dist/models/index.cjs.map +1 -1
- package/dist/models/index.d.cts +1095 -29
- package/dist/models/index.d.ts +1095 -29
- package/dist/models/index.js +341 -0
- package/dist/models/index.js.map +1 -1
- package/package.json +9 -3
package/README.md
CHANGED
|
@@ -1,242 +1,97 @@
|
|
|
1
1
|
# @elqnt/admin
|
|
2
2
|
|
|
3
|
-
Admin APIs for Eloquent platform - onboarding, organization settings, and
|
|
3
|
+
Admin APIs and types for the Eloquent platform - onboarding, organization settings, billing, and user management.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
|
|
8
|
+
npm install @elqnt/admin
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Quick Start
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
createOrganizationApi,
|
|
17
|
-
getOrgSettingsApi,
|
|
18
|
-
getBillingPlansApi,
|
|
19
|
-
} from "@elqnt/admin/api";
|
|
14
|
+
import { getOnboardingStatusApi, getBillingPlansApi } from "@elqnt/admin/api";
|
|
15
|
+
import type { User, Org, Plan } from "@elqnt/admin/models";
|
|
20
16
|
|
|
21
17
|
// Check onboarding status
|
|
22
18
|
const status = await getOnboardingStatusApi({
|
|
23
|
-
baseUrl: "https://api.
|
|
19
|
+
baseUrl: "https://api.example.com",
|
|
24
20
|
});
|
|
25
21
|
|
|
26
|
-
//
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
// Get org settings (requires orgId)
|
|
33
|
-
const settings = await getOrgSettingsApi({
|
|
34
|
-
baseUrl: "https://api.elqnt.ai",
|
|
35
|
-
orgId: "org-uuid",
|
|
22
|
+
// Get billing plans
|
|
23
|
+
const plans = await getBillingPlansApi({
|
|
24
|
+
baseUrl: "https://api.example.com",
|
|
25
|
+
orgId: "org_123",
|
|
36
26
|
});
|
|
37
27
|
```
|
|
38
28
|
|
|
39
|
-
##
|
|
29
|
+
## Entry Points
|
|
40
30
|
|
|
41
|
-
| Import
|
|
42
|
-
|
|
31
|
+
| Import | Description |
|
|
32
|
+
|--------|-------------|
|
|
43
33
|
| `@elqnt/admin` | All exports |
|
|
44
34
|
| `@elqnt/admin/api` | Browser API functions |
|
|
45
35
|
| `@elqnt/admin/models` | TypeScript types |
|
|
36
|
+
| `@elqnt/admin/hooks` | React hooks (`useOrgAdmin`, `useUsersAdmin`, `useInvitesAdmin`, `useOrgSettings`) |
|
|
46
37
|
|
|
47
|
-
##
|
|
48
|
-
|
|
49
|
-
### Onboarding API
|
|
38
|
+
## APIs
|
|
50
39
|
|
|
51
|
-
|
|
40
|
+
### Onboarding
|
|
41
|
+
- `getOnboardingStatusApi()` - Get current state
|
|
42
|
+
- `createOrganizationApi()` - Create org
|
|
43
|
+
- `completeOnboardingApi()` - Finish onboarding
|
|
52
44
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
| `startOnboardingApi(options)` | Initialize onboarding process |
|
|
57
|
-
| `createPaymentSessionApi(params, options)` | Create Stripe checkout session |
|
|
58
|
-
| `createOrganizationApi(org, options)` | Create new organization |
|
|
59
|
-
| `sendOnboardingInvitesApi(invites, options)` | Send team invitations |
|
|
60
|
-
| `createOnboardingKnowledgeApi(knowledge, options)` | Set up knowledge base |
|
|
61
|
-
| `createOnboardingAgentApi(agent, options)` | Create initial AI agent |
|
|
62
|
-
| `createAgentWithSkillsApi(payload, options)` | Create agent with skills |
|
|
63
|
-
| `completeOnboardingApi(options)` | Mark onboarding complete |
|
|
64
|
-
| `skipOnboardingStepApi(step, options)` | Skip optional step |
|
|
65
|
-
|
|
66
|
-
```typescript
|
|
67
|
-
import {
|
|
68
|
-
getOnboardingStatusApi,
|
|
69
|
-
createOrganizationApi,
|
|
70
|
-
completeOnboardingApi,
|
|
71
|
-
} from "@elqnt/admin/api";
|
|
72
|
-
|
|
73
|
-
// Onboarding options - orgId is optional
|
|
74
|
-
interface OnboardingApiOptions {
|
|
75
|
-
baseUrl: string;
|
|
76
|
-
orgId?: string; // May not exist yet
|
|
77
|
-
userId?: string;
|
|
78
|
-
userEmail?: string;
|
|
79
|
-
}
|
|
80
|
-
```
|
|
45
|
+
### Organization Settings
|
|
46
|
+
- `getOrgSettingsApi()` - Get settings
|
|
47
|
+
- `updateOrgSettingsApi()` - Update settings
|
|
81
48
|
|
|
82
|
-
###
|
|
49
|
+
### Billing
|
|
50
|
+
- `getBillingPlansApi()` - List plans
|
|
51
|
+
- `getSubscriptionApi()` - Current subscription
|
|
52
|
+
- `createCheckoutSessionApi()` - Stripe checkout
|
|
53
|
+
- `createPortalSessionApi()` - Billing portal
|
|
83
54
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
| Function | Description |
|
|
87
|
-
|----------|-------------|
|
|
88
|
-
| `getOrgSettingsApi(options)` | Get organization settings |
|
|
89
|
-
| `createOrgSettingsApi(settings, options)` | Create settings (first time) |
|
|
90
|
-
| `updateOrgSettingsApi(settings, options)` | Update settings |
|
|
91
|
-
| `updateOrgAgentsApi(agentIds, options)` | Update enabled agents |
|
|
92
|
-
| `updateEntityDefinitionsApi(entityNames, options)` | Update enabled entities |
|
|
93
|
-
| `updateWorkflowDefinitionsApi(workflowIds, options)` | Update enabled workflows |
|
|
55
|
+
## Hooks
|
|
94
56
|
|
|
95
57
|
```typescript
|
|
96
|
-
import {
|
|
97
|
-
|
|
98
|
-
const settings = await getOrgSettingsApi({
|
|
99
|
-
baseUrl: "https://api.elqnt.ai",
|
|
100
|
-
orgId: "org-uuid",
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
if (settings.data) {
|
|
104
|
-
await updateOrgSettingsApi(
|
|
105
|
-
{ ...settings.data.settings, timezone: "America/New_York" },
|
|
106
|
-
{ baseUrl: "https://api.elqnt.ai", orgId: "org-uuid" }
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
```
|
|
58
|
+
import { useOrgAdmin, useUsersAdmin, useInvitesAdmin, useOrgSettings } from "@elqnt/admin/hooks";
|
|
110
59
|
|
|
111
|
-
|
|
60
|
+
// Organization management
|
|
61
|
+
const { listOrgs, getOrg, createOrg, updateOrg, deleteOrg, loading, error } = useOrgAdmin(options);
|
|
112
62
|
|
|
113
|
-
|
|
63
|
+
// User management
|
|
64
|
+
const { listUsers, getUser, createUser, updateUser, deleteUser, getUserSettings, updateUserSettings, loading, error } = useUsersAdmin(options);
|
|
114
65
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
| `getBillingPlansApi(options)` | List available plans |
|
|
118
|
-
| `getSubscriptionApi(options)` | Get current subscription |
|
|
119
|
-
| `getCreditsApi(options)` | Get credit balance |
|
|
120
|
-
| `createCheckoutSessionApi(params, options)` | Create Stripe checkout |
|
|
121
|
-
| `createPortalSessionApi(params, options)` | Create billing portal session |
|
|
122
|
-
| `cancelSubscriptionApi(options)` | Cancel subscription |
|
|
123
|
-
| `purchaseCreditsApi(params, options)` | Purchase additional credits |
|
|
66
|
+
// Invite management
|
|
67
|
+
const { listInvites, sendInvite, sendInvites, getInvite, acceptInvite, revokeInvite, resendInvite, loading, error } = useInvitesAdmin(options);
|
|
124
68
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
getBillingPlansApi,
|
|
128
|
-
getSubscriptionApi,
|
|
129
|
-
createPortalSessionApi,
|
|
130
|
-
} from "@elqnt/admin/api";
|
|
131
|
-
|
|
132
|
-
// Get available plans
|
|
133
|
-
const plans = await getBillingPlansApi({
|
|
134
|
-
baseUrl: "https://api.elqnt.ai",
|
|
135
|
-
orgId: "org-uuid",
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
// Get current subscription
|
|
139
|
-
const subscription = await getSubscriptionApi({
|
|
140
|
-
baseUrl: "https://api.elqnt.ai",
|
|
141
|
-
orgId: "org-uuid",
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
// Open billing portal
|
|
145
|
-
const portal = await createPortalSessionApi(
|
|
146
|
-
{ returnUrl: window.location.href },
|
|
147
|
-
{ baseUrl: "https://api.elqnt.ai", orgId: "org-uuid" }
|
|
148
|
-
);
|
|
149
|
-
|
|
150
|
-
if (portal.data?.url) {
|
|
151
|
-
window.location.href = portal.data.url;
|
|
152
|
-
}
|
|
69
|
+
// Organization settings
|
|
70
|
+
const { getSettings, createSettings, updateSettings, loading, error } = useOrgSettings(options);
|
|
153
71
|
```
|
|
154
72
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
```typescript
|
|
158
|
-
import { clearGatewayTokenCache } from "@elqnt/admin/api";
|
|
159
|
-
|
|
160
|
-
// Clear cached token after org creation or user switch
|
|
161
|
-
clearGatewayTokenCache();
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
## Types (`@elqnt/admin/models`)
|
|
73
|
+
## Models
|
|
165
74
|
|
|
166
75
|
```typescript
|
|
167
76
|
import type {
|
|
168
|
-
//
|
|
169
|
-
|
|
170
|
-
OnboardingResponse,
|
|
171
|
-
CreateOrgResponse,
|
|
172
|
-
SendInvitesResponse,
|
|
173
|
-
CompleteOnboardingResponse,
|
|
174
|
-
|
|
175
|
-
// Organization
|
|
176
|
-
OrgSettings,
|
|
177
|
-
OrgSettingsResponse,
|
|
77
|
+
// User & Org
|
|
78
|
+
User, Org, OrgRole, Permission, Invite,
|
|
178
79
|
|
|
179
80
|
// Billing
|
|
180
|
-
Plan,
|
|
181
|
-
OrganizationBilling,
|
|
182
|
-
UsageSummary,
|
|
183
|
-
CreditBalance,
|
|
184
|
-
PlansResponse,
|
|
185
|
-
SubscriptionResponse,
|
|
186
|
-
CreditsResponse,
|
|
187
|
-
|
|
188
|
-
// Provisioning
|
|
189
|
-
ProvisionAgentsResponse,
|
|
190
|
-
ProvisionEntitiesResponse,
|
|
191
|
-
ProvisionWorkflowsResponse,
|
|
192
|
-
} from "@elqnt/admin/models";
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
### OnboardingState
|
|
196
|
-
|
|
197
|
-
```typescript
|
|
198
|
-
interface OnboardingState {
|
|
199
|
-
currentStep: string;
|
|
200
|
-
completedSteps: string[];
|
|
201
|
-
orgId?: string;
|
|
202
|
-
stripeSessionId?: string;
|
|
203
|
-
// ... step-specific data
|
|
204
|
-
}
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
### OrgSettings
|
|
81
|
+
Plan, OrganizationBilling, CreditBalance, UsageSummary,
|
|
208
82
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
orgId: string;
|
|
213
|
-
timezone?: string;
|
|
214
|
-
locale?: string;
|
|
215
|
-
features?: Record<string, boolean>;
|
|
216
|
-
agents?: string[];
|
|
217
|
-
entities?: string[];
|
|
218
|
-
workflows?: string[];
|
|
219
|
-
}
|
|
83
|
+
// Onboarding
|
|
84
|
+
OnboardingState, OnboardingStep,
|
|
85
|
+
} from "@elqnt/admin/models";
|
|
220
86
|
```
|
|
221
87
|
|
|
222
|
-
##
|
|
88
|
+
## Documentation
|
|
223
89
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
```typescript
|
|
227
|
-
// DEPRECATED - use @elqnt/agents/api instead
|
|
228
|
-
provisionDefaultAgentsApi(definitions, options)
|
|
229
|
-
|
|
230
|
-
// DEPRECATED - use @elqnt/entity/api instead
|
|
231
|
-
provisionEntitiesApi(definitions, options)
|
|
232
|
-
|
|
233
|
-
// DEPRECATED - use @elqnt/workflow/api instead
|
|
234
|
-
provisionWorkflowsApi(definitions, options)
|
|
235
|
-
```
|
|
90
|
+
Full API reference: https://docs.eloquent.ai/packages/admin
|
|
236
91
|
|
|
237
|
-
##
|
|
92
|
+
## Changelog
|
|
238
93
|
|
|
239
|
-
|
|
94
|
+
See [CHANGELOG.md](./CHANGELOG.md)
|
|
240
95
|
|
|
241
96
|
## License
|
|
242
97
|
|