@elqnt/admin 2.2.1 → 2.3.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.
@@ -0,0 +1,978 @@
1
+ import { ResponseMetadata } from '@elqnt/types';
2
+
3
+ interface Address {
4
+ line1: string;
5
+ line2: string;
6
+ city: string;
7
+ state: string;
8
+ country: string;
9
+ zip: string;
10
+ }
11
+ /**
12
+ * Org is one organization. With per-product DB + row-level tenancy,
13
+ * the DB the org lives in (admin_eloquent / admin_pumba / …) implies
14
+ * the product — there is no longer a product column on the row. With
15
+ * the system_*\/org_* artifact split, there's also no per-org artifact
16
+ * provisioning state to track. See docs/_db_v2/03_system_org_split.md.
17
+ */
18
+ interface Org {
19
+ id?: string;
20
+ title: string;
21
+ description?: string;
22
+ logoUrl: string;
23
+ mainDomain: string;
24
+ address: Address;
25
+ /**
26
+ * Localization & runtime preferences
27
+ */
28
+ defaultLang?: string;
29
+ timezone?: string;
30
+ settings?: {
31
+ [key: string]: any;
32
+ };
33
+ /**
34
+ * Status & Control
35
+ */
36
+ status: OrgStatusTS;
37
+ enabled: boolean;
38
+ /**
39
+ * Classification
40
+ */
41
+ type: OrgTypeTS;
42
+ size?: OrgSizeTS;
43
+ industry?: string;
44
+ /**
45
+ * Country is the org's jurisdiction code (e.g. "UAE", "KSA", "QA"). It
46
+ * scopes which system compliance libraries the org sees in the library
47
+ * section. Empty = unset (all system libraries visible). Validated against
48
+ * SupportedCountries; see common/admin/countries.go and
49
+ * docs/_db_v2/08_country_scoped_libraries.md.
50
+ */
51
+ country?: string;
52
+ tags?: string[];
53
+ /**
54
+ * Subscription (Stripe)
55
+ */
56
+ subscription?: OrgSubscription;
57
+ userCount: number;
58
+ /**
59
+ * Onboarding wizard state (per-user UX flow, not artifact provisioning)
60
+ */
61
+ onboarding?: OrgOnboarding;
62
+ /**
63
+ * Template & Roles
64
+ */
65
+ template?: OrgTemplate;
66
+ roles: string[];
67
+ /**
68
+ * Flexible metadata
69
+ */
70
+ metadata?: {
71
+ [key: string]: any;
72
+ };
73
+ /**
74
+ * Audit fields
75
+ */
76
+ createdAt?: number;
77
+ updatedAt?: number;
78
+ createdBy?: string;
79
+ updatedBy?: string;
80
+ }
81
+ type OrgStatus = string;
82
+ declare const OrgStatusActive: OrgStatus;
83
+ declare const OrgStatusSuspended: OrgStatus;
84
+ declare const OrgStatuses: {
85
+ readonly active: {
86
+ readonly value: "active";
87
+ readonly label: "Active";
88
+ };
89
+ readonly suspended: {
90
+ readonly value: "suspended";
91
+ readonly label: "Suspended";
92
+ };
93
+ };
94
+ type OrgStatusTS = keyof typeof OrgStatuses;
95
+ type OrgStatusOptionTS = typeof OrgStatuses[OrgStatusTS];
96
+ /**
97
+ * OrgType represents whether the org is self-serve or enterprise
98
+ */
99
+ type OrgType = string;
100
+ declare const OrgTypeSelfServe: OrgType;
101
+ declare const OrgTypeEnterprise: OrgType;
102
+ declare const OrgTypes: {
103
+ readonly "self-serve": {
104
+ readonly value: "self-serve";
105
+ readonly label: "Self-Serve";
106
+ };
107
+ readonly enterprise: {
108
+ readonly value: "enterprise";
109
+ readonly label: "Enterprise";
110
+ };
111
+ };
112
+ type OrgTypeTS = keyof typeof OrgTypes;
113
+ type OrgTypeOptionTS = typeof OrgTypes[OrgTypeTS];
114
+ /**
115
+ * OrgSize represents the size of the organization
116
+ */
117
+ type OrgSize = string;
118
+ declare const OrgSizeSolo: OrgSize;
119
+ declare const OrgSizeSmall: OrgSize;
120
+ declare const OrgSizeMedium: OrgSize;
121
+ declare const OrgSizeLarge: OrgSize;
122
+ declare const OrgSizeEnterprise: OrgSize;
123
+ declare const OrgSizes: {
124
+ readonly solo: {
125
+ readonly value: "solo";
126
+ readonly label: "Just me";
127
+ };
128
+ readonly small: {
129
+ readonly value: "small";
130
+ readonly label: "2-10";
131
+ };
132
+ readonly medium: {
133
+ readonly value: "medium";
134
+ readonly label: "11-50";
135
+ };
136
+ readonly large: {
137
+ readonly value: "large";
138
+ readonly label: "51-200";
139
+ };
140
+ readonly enterprise: {
141
+ readonly value: "enterprise";
142
+ readonly label: "200+";
143
+ };
144
+ };
145
+ type OrgSizeTS = keyof typeof OrgSizes;
146
+ type OrgSizeOptionTS = typeof OrgSizes[OrgSizeTS];
147
+ /**
148
+ * OnboardingStatus represents the status of an onboarding flow
149
+ */
150
+ type OnboardingStatus = string;
151
+ declare const OnboardingStatusPending: OnboardingStatus;
152
+ declare const OnboardingStatusInProgress: OnboardingStatus;
153
+ declare const OnboardingStatusCompleted: OnboardingStatus;
154
+ declare const OnboardingStatusSkipped: OnboardingStatus;
155
+ declare const OnboardingStatusLegacy: OnboardingStatus;
156
+ declare const OnboardingStatuses: {
157
+ readonly pending: {
158
+ readonly value: "pending";
159
+ readonly label: "Pending";
160
+ };
161
+ readonly in_progress: {
162
+ readonly value: "in_progress";
163
+ readonly label: "In Progress";
164
+ };
165
+ readonly completed: {
166
+ readonly value: "completed";
167
+ readonly label: "Completed";
168
+ };
169
+ readonly skipped: {
170
+ readonly value: "skipped";
171
+ readonly label: "Skipped";
172
+ };
173
+ readonly legacy: {
174
+ readonly value: "legacy";
175
+ readonly label: "Legacy";
176
+ };
177
+ };
178
+ type OnboardingStatusTS = keyof typeof OnboardingStatuses;
179
+ type OnboardingStatusOptionTS = typeof OnboardingStatuses[OnboardingStatusTS];
180
+ /**
181
+ * OrgOnboarding tracks the onboarding progress for an organization
182
+ */
183
+ interface OrgOnboarding {
184
+ status: OnboardingStatus;
185
+ currentStep: number;
186
+ completedAt?: number;
187
+ skippedSteps?: number[];
188
+ }
189
+ interface OrgSubscription {
190
+ plan: string;
191
+ platform: SubscriptionPlatform;
192
+ status: OrgSubscriptionStatus;
193
+ trialEndsAt?: number;
194
+ currentPeriodEnd?: number;
195
+ seats?: number;
196
+ stripeCustomerId?: string;
197
+ stripeSubscriptionId?: string;
198
+ cancelledAt?: number;
199
+ cancelReason?: string;
200
+ gracePeriodEndsAt?: number;
201
+ }
202
+ type OrgSubscriptionStatus = string;
203
+ declare const OrgSubscriptionStatusTrialing: OrgSubscriptionStatus;
204
+ declare const OrgSubscriptionStatusActive: OrgSubscriptionStatus;
205
+ declare const OrgSubscriptionStatusPastDue: OrgSubscriptionStatus;
206
+ declare const OrgSubscriptionStatusCancelled: OrgSubscriptionStatus;
207
+ declare const OrgSubscriptionStatusUnpaid: OrgSubscriptionStatus;
208
+ declare const OrgSubscriptionStatuses: {
209
+ readonly trialing: {
210
+ readonly value: "trialing";
211
+ readonly label: "Trialing";
212
+ };
213
+ readonly active: {
214
+ readonly value: "active";
215
+ readonly label: "Active";
216
+ };
217
+ readonly past_due: {
218
+ readonly value: "past_due";
219
+ readonly label: "Past Due";
220
+ };
221
+ readonly cancelled: {
222
+ readonly value: "cancelled";
223
+ readonly label: "Cancelled";
224
+ };
225
+ readonly unpaid: {
226
+ readonly value: "unpaid";
227
+ readonly label: "Unpaid";
228
+ };
229
+ };
230
+ type OrgSubscriptionStatusTS = keyof typeof OrgSubscriptionStatuses;
231
+ type OrgSubscriptionStatusOptionTS = typeof OrgSubscriptionStatuses[OrgSubscriptionStatusTS];
232
+ interface OrgResponse {
233
+ org: Org;
234
+ metadata: ResponseMetadata;
235
+ }
236
+ interface OrgInfoResponse {
237
+ orgInfo: OrgInfo;
238
+ metadata: ResponseMetadata;
239
+ }
240
+ interface OrgRoleResponse {
241
+ role: OrgRole;
242
+ metadata: ResponseMetadata;
243
+ }
244
+ interface ListOrgsResponse {
245
+ orgs: Org[];
246
+ metadata: ResponseMetadata;
247
+ }
248
+ interface ListOrgRolesResponse {
249
+ roles: OrgRole[];
250
+ metadata: ResponseMetadata;
251
+ }
252
+ interface OrgInfo {
253
+ id?: string;
254
+ title: string;
255
+ logoUrl: string;
256
+ mainDomain?: string;
257
+ }
258
+ interface AzureSettings {
259
+ appClientId?: string;
260
+ appClientSecret?: string;
261
+ azureTenantId?: string;
262
+ }
263
+ interface OrgTemplate {
264
+ id: string;
265
+ slug: string;
266
+ title: string;
267
+ }
268
+ interface UserOrgAccess {
269
+ orgId?: string;
270
+ orgTitle?: string;
271
+ roles: string[];
272
+ isSingleAccount: boolean;
273
+ entityRecordFilter?: {
274
+ entityName: string;
275
+ recordId: string;
276
+ displayValue?: string;
277
+ };
278
+ }
279
+ /**
280
+ * UserSettings represents user preferences (elastic JSON structure)
281
+ */
282
+ interface UserSettings {
283
+ theme?: string;
284
+ language?: string;
285
+ timezone?: string;
286
+ occupation?: string;
287
+ company?: string;
288
+ }
289
+ declare const ThemeOptions: {
290
+ readonly system: {
291
+ readonly value: "system";
292
+ readonly label: "System";
293
+ };
294
+ readonly light: {
295
+ readonly value: "light";
296
+ readonly label: "Light";
297
+ };
298
+ readonly dark: {
299
+ readonly value: "dark";
300
+ readonly label: "Dark";
301
+ };
302
+ };
303
+ type ThemeOptionTS = keyof typeof ThemeOptions;
304
+ /**
305
+ * NotificationPreferences represents user notification settings
306
+ */
307
+ interface NotificationPreferences {
308
+ pushEnabled: boolean;
309
+ newChatAssignment: boolean;
310
+ newMessages: boolean;
311
+ escalations: boolean;
312
+ urgentOnly: boolean;
313
+ soundEnabled: boolean;
314
+ doNotDisturb: boolean;
315
+ dndStart?: string;
316
+ dndEnd?: string;
317
+ }
318
+ /**
319
+ * UserSource represents how a user was created
320
+ */
321
+ type UserSource = string;
322
+ declare const UserSourceSignup: UserSource;
323
+ declare const UserSourceInvite: UserSource;
324
+ declare const UserSourceSSO: UserSource;
325
+ declare const UserSourceAPI: UserSource;
326
+ declare const UserSources: {
327
+ readonly signup: {
328
+ readonly value: "signup";
329
+ readonly label: "Signup";
330
+ };
331
+ readonly invite: {
332
+ readonly value: "invite";
333
+ readonly label: "Invite";
334
+ };
335
+ readonly sso: {
336
+ readonly value: "sso";
337
+ readonly label: "SSO";
338
+ };
339
+ readonly api: {
340
+ readonly value: "api";
341
+ readonly label: "API";
342
+ };
343
+ };
344
+ type UserSourceTS = keyof typeof UserSources;
345
+ type UserSourceOptionTS = typeof UserSources[UserSourceTS];
346
+ /**
347
+ * InviteStatus represents the status of an invitation
348
+ */
349
+ type InviteStatus = string;
350
+ declare const InviteStatusPending: InviteStatus;
351
+ declare const InviteStatusAccepted: InviteStatus;
352
+ declare const InviteStatusExpired: InviteStatus;
353
+ declare const InviteStatusRevoked: InviteStatus;
354
+ declare const InviteStatuses: {
355
+ readonly pending: {
356
+ readonly value: "pending";
357
+ readonly label: "Pending";
358
+ };
359
+ readonly accepted: {
360
+ readonly value: "accepted";
361
+ readonly label: "Accepted";
362
+ };
363
+ readonly expired: {
364
+ readonly value: "expired";
365
+ readonly label: "Expired";
366
+ };
367
+ readonly revoked: {
368
+ readonly value: "revoked";
369
+ readonly label: "Revoked";
370
+ };
371
+ };
372
+ type InviteStatusTS = keyof typeof InviteStatuses;
373
+ type InviteStatusOptionTS = typeof InviteStatuses[InviteStatusTS];
374
+ /**
375
+ * Invite represents a team/org invitation
376
+ */
377
+ interface Invite {
378
+ id?: string;
379
+ orgId: string;
380
+ email: string;
381
+ role: string;
382
+ invitedBy: string;
383
+ status: InviteStatusTS;
384
+ acceptedBy?: string;
385
+ acceptedAt?: number;
386
+ expiresAt?: number;
387
+ createdAt?: number;
388
+ updatedAt?: number;
389
+ }
390
+ interface InviteResponse {
391
+ invite: Invite;
392
+ metadata: ResponseMetadata;
393
+ }
394
+ interface ListInvitesResponse {
395
+ invites: Invite[];
396
+ metadata: ResponseMetadata;
397
+ }
398
+ /**
399
+ * UserOnboarding tracks the onboarding progress for a user
400
+ */
401
+ interface UserOnboarding {
402
+ status: OnboardingStatus;
403
+ completedAt?: number;
404
+ }
405
+ /**
406
+ * User represents a user in the system
407
+ */
408
+ interface User {
409
+ id?: string;
410
+ email: string;
411
+ firstName: string;
412
+ lastName: string;
413
+ authProviderName: string;
414
+ orgAccess?: UserOrgAccess[];
415
+ /**
416
+ * Status & Control
417
+ */
418
+ enabled?: boolean;
419
+ /**
420
+ * Source tracking
421
+ */
422
+ source?: UserSourceTS;
423
+ invitedBy?: string;
424
+ inviteStatus?: InviteStatusTS;
425
+ /**
426
+ * Team membership - LEGACY, DO NOT USE
427
+ * These fields are deprecated and will be removed.
428
+ * Use Org and OrgAccess patterns instead.
429
+ */
430
+ isTeamAdmin?: boolean;
431
+ teamId?: string;
432
+ teamName?: string;
433
+ /**
434
+ * System admin flag
435
+ */
436
+ isSysAdmin?: boolean;
437
+ /**
438
+ * Preferences
439
+ */
440
+ settings?: UserSettings;
441
+ notificationPreferences?: NotificationPreferences;
442
+ /**
443
+ * Onboarding tracking
444
+ */
445
+ onboarding?: UserOnboarding;
446
+ /**
447
+ * Flexible metadata
448
+ */
449
+ metadata?: {
450
+ [key: string]: any;
451
+ };
452
+ /**
453
+ * Activity tracking (Unix ms). FirstActiveAt is the activation moment —
454
+ * the first agent message sent after signup (web chat, or WhatsApp routed
455
+ * to a real org rather than the onboarding funnel). LastActiveAt is
456
+ * refreshed on every later message, throttled at the sender. Written ONLY
457
+ * via the dedicated TouchActivity UPDATE, never by full-row user updates,
458
+ * so concurrent profile edits can't clobber them.
459
+ */
460
+ firstActiveAt?: number;
461
+ lastActiveAt?: number;
462
+ /**
463
+ * Audit fields
464
+ */
465
+ createdAt?: number;
466
+ updatedAt?: number;
467
+ createdBy?: string;
468
+ updatedBy?: string;
469
+ }
470
+ interface UserResponse {
471
+ user: User;
472
+ metadata: ResponseMetadata;
473
+ }
474
+ interface ListUsersResponse {
475
+ users: User[];
476
+ metadata: ResponseMetadata;
477
+ }
478
+ interface Team {
479
+ id?: string;
480
+ name: string;
481
+ isSubscribed: boolean;
482
+ subscribedAt?: number;
483
+ plan: string;
484
+ ownerName?: string;
485
+ ownerEmail?: string;
486
+ subscriptionPlatform?: SubscriptionPlatform;
487
+ subscriptionId?: string;
488
+ onboardingDone?: boolean;
489
+ onboardingData?: string;
490
+ }
491
+ type SubscriptionPlatform = string;
492
+ declare const SubscriptionPlatformStripe: SubscriptionPlatform;
493
+ declare const SubscriptionPlatformCustom: SubscriptionPlatform;
494
+ interface OrgRole {
495
+ id?: string;
496
+ orgId?: string;
497
+ title: string;
498
+ permissions: Permission[];
499
+ isSystem: boolean;
500
+ createdAt?: number;
501
+ updatedAt?: number;
502
+ createdBy?: string;
503
+ updatedBy?: string;
504
+ }
505
+ /**
506
+ * org db - copied from sys db
507
+ */
508
+ interface Permission {
509
+ /**
510
+ * ID *primitive.ObjectID `bson:"_id,omitempty" json:"id"`
511
+ */
512
+ name: string;
513
+ title: string;
514
+ isSystem: boolean;
515
+ }
516
+ /**
517
+ * UpdateUserSettingsRequest is the request payload for updating user settings
518
+ */
519
+ interface UpdateUserSettingsRequest {
520
+ id: string;
521
+ settings?: UserSettings;
522
+ notificationPreferences?: NotificationPreferences;
523
+ }
524
+ /**
525
+ * UserSettingsResponse is the response for settings operations
526
+ */
527
+ interface UserSettingsResponse {
528
+ settings?: UserSettings;
529
+ notificationPreferences?: NotificationPreferences;
530
+ metadata: ResponseMetadata;
531
+ }
532
+ /**
533
+ * OnboardingStep represents a step in the onboarding flow
534
+ */
535
+ interface OnboardingStep {
536
+ step: number;
537
+ name: string;
538
+ status: string;
539
+ required: boolean;
540
+ }
541
+ /**
542
+ * OnboardingState represents the current state of a user's onboarding
543
+ */
544
+ interface OnboardingState {
545
+ status: string;
546
+ currentStep: number;
547
+ steps: OnboardingStep[];
548
+ user?: User;
549
+ org?: Org;
550
+ }
551
+ /**
552
+ * OnboardingStateResponse is the response for onboarding status
553
+ */
554
+ interface OnboardingStateResponse {
555
+ state: OnboardingState;
556
+ metadata: ResponseMetadata;
557
+ }
558
+ /**
559
+ * OrgInput contains the input for creating an organization
560
+ */
561
+ interface OrgInput {
562
+ name: string;
563
+ country?: string;
564
+ affiliateCode?: string;
565
+ mainDomain?: string;
566
+ industry?: string;
567
+ size?: string;
568
+ stripeSessionId?: string;
569
+ }
570
+ /**
571
+ * OrgResult contains the result of organization creation
572
+ */
573
+ interface OrgResult {
574
+ org?: Org;
575
+ nextStep: string;
576
+ metadata: ResponseMetadata;
577
+ }
578
+ /**
579
+ * WorkspaceInput is an alias for OrgInput (deprecated)
580
+ */
581
+ type WorkspaceInput = OrgInput;
582
+ /**
583
+ * WorkspaceResult is an alias for OrgResult (deprecated)
584
+ */
585
+ type WorkspaceResult = OrgResult;
586
+ /**
587
+ * InviteInput contains the input for sending invites
588
+ */
589
+ interface InviteInput {
590
+ email: string;
591
+ role: string;
592
+ }
593
+ /**
594
+ * InvitesResult contains the result of sending invites
595
+ */
596
+ interface InvitesResult {
597
+ sent: InviteSentStatus[];
598
+ failed: string[];
599
+ nextStep: string;
600
+ metadata: ResponseMetadata;
601
+ }
602
+ /**
603
+ * InviteSentStatus represents status of a sent invite
604
+ */
605
+ interface InviteSentStatus {
606
+ email: string;
607
+ status: string;
608
+ }
609
+ /**
610
+ * KnowledgeInput contains the input for creating knowledge graph
611
+ */
612
+ interface KnowledgeInput {
613
+ name?: string;
614
+ skipUpload: boolean;
615
+ }
616
+ /**
617
+ * KnowledgeGraphInfo contains info about a knowledge graph
618
+ */
619
+ interface KnowledgeGraphInfo {
620
+ id: string;
621
+ name: string;
622
+ status: string;
623
+ documentCount: number;
624
+ }
625
+ /**
626
+ * KnowledgeResult contains the result of knowledge graph creation
627
+ */
628
+ interface KnowledgeResult {
629
+ knowledgeGraph: KnowledgeGraphInfo;
630
+ nextStep: string;
631
+ metadata: ResponseMetadata;
632
+ }
633
+ /**
634
+ * AgentInput contains the input for creating an agent
635
+ */
636
+ interface AgentInput {
637
+ name: string;
638
+ goal: string;
639
+ personality: string;
640
+ skills?: string[];
641
+ }
642
+ /**
643
+ * AgentInfo contains info about an agent
644
+ */
645
+ interface AgentInfo {
646
+ id: string;
647
+ name: string;
648
+ goal: string;
649
+ personality: string;
650
+ status: string;
651
+ knowledgeGraphId?: string;
652
+ }
653
+ /**
654
+ * AgentResult contains the result of agent creation
655
+ */
656
+ interface AgentResult {
657
+ agent: AgentInfo;
658
+ nextStep: string;
659
+ metadata: ResponseMetadata;
660
+ }
661
+ /**
662
+ * OnboardingCompleteResult contains the result of completing onboarding
663
+ */
664
+ interface OnboardingCompleteResult {
665
+ status: string;
666
+ completedAt: number;
667
+ org?: Org;
668
+ redirectUrl: string;
669
+ metadata: ResponseMetadata;
670
+ }
671
+ /**
672
+ * PaymentSessionInput contains input for creating a payment session
673
+ */
674
+ interface PaymentSessionInput {
675
+ plan: string;
676
+ billingCycle: string;
677
+ seats: number;
678
+ successUrl: string;
679
+ cancelUrl: string;
680
+ affiliateCode?: string;
681
+ }
682
+ /**
683
+ * PaymentSessionResult contains the result of creating a payment session
684
+ */
685
+ interface PaymentSessionResult {
686
+ url: string;
687
+ sessionId: string;
688
+ customerId: string;
689
+ metadata: ResponseMetadata;
690
+ }
691
+ /**
692
+ * OnboardingPlanInput contains subscription plan selection for provisioning
693
+ */
694
+ interface OnboardingPlanInput {
695
+ plan: string;
696
+ billingCycle: string;
697
+ seats: number;
698
+ stripeSessionId?: string;
699
+ }
700
+ /**
701
+ * OnboardingOrgInput contains organization data for the onboarding wizard.
702
+ * The product is implicit in the admin DB the request lands in
703
+ * (admin_eloquent / admin_pumba / …) — no need to pass it on the body.
704
+ */
705
+ interface OnboardingOrgInput {
706
+ title: string;
707
+ mainDomain: string;
708
+ industry?: string;
709
+ size?: string;
710
+ }
711
+ /**
712
+ * OnboardingDocumentInput contains a document to be ingested during onboarding
713
+ */
714
+ interface OnboardingDocumentInput {
715
+ title: string;
716
+ fileUrl: string;
717
+ }
718
+ /**
719
+ * OnboardingKnowledgeInput contains knowledge base configuration with optional documents
720
+ */
721
+ interface OnboardingKnowledgeInput {
722
+ name: string;
723
+ documents?: OnboardingDocumentInput[];
724
+ }
725
+ /**
726
+ * OnboardingProvisionRequest contains all data collected during onboarding
727
+ * to create org and provision all resources in one request
728
+ */
729
+ interface OnboardingProvisionRequest {
730
+ plan: OnboardingPlanInput;
731
+ org: OnboardingOrgInput;
732
+ invites?: InviteInput[];
733
+ knowledge: OnboardingKnowledgeInput;
734
+ agent: AgentInput;
735
+ }
736
+ /**
737
+ * OnboardingProvisionResponse is returned after starting provisioning
738
+ */
739
+ interface OnboardingProvisionResponse {
740
+ orgId: string;
741
+ userId: string;
742
+ status: string;
743
+ metadata: ResponseMetadata;
744
+ }
745
+ /**
746
+ * CreateOrgRequest is the request payload for creating an organization.
747
+ * Under per-product DB + row-level tenancy this is a pure row INSERT —
748
+ * no per-org schema provisioning, no artifact install. The product is
749
+ * implicit in the admin DB the request lands in.
750
+ */
751
+ interface CreateOrgRequest {
752
+ title: string;
753
+ mainDomain: string;
754
+ type?: OrgTypeTS;
755
+ size?: OrgSizeTS;
756
+ industry?: string;
757
+ logoUrl?: string;
758
+ address?: Address;
759
+ subscription?: OrgSubscription;
760
+ metadata?: {
761
+ [key: string]: any;
762
+ };
763
+ }
764
+ declare const AdminOrgCreate = "admin.orgs.create";
765
+ declare const AdminOrgList = "admin.orgs.list";
766
+ declare const AdminOrgListByMetadata = "admin.orgs.listByMetadata";
767
+ declare const AdminOrgGet = "admin.orgs.get";
768
+ declare const AdminOrgGetInfo = "admin.orgs.getInfo";
769
+ declare const AdminOrgGetByDomain = "admin.orgs.getByDomain";
770
+ declare const AdminOrgUpdate = "admin.orgs.update";
771
+ declare const AdminOrgDelete = "admin.orgs.delete";
772
+ declare const AdminOrgCreated = "system.admin.org.created";
773
+ declare const AdminOrgRolesGet = "admin.orgRoles.get";
774
+ declare const AdminOrgRolesCreate = "admin.orgRoles.create";
775
+ declare const AdminOrgRolesUpdate = "admin.orgRoles.update";
776
+ declare const AdminOrgRolesDelete = "admin.orgRoles.delete";
777
+ declare const AdminUsersGet = "admin.users.get";
778
+ declare const AdminUsersGetForOrg = "admin.users.getUsersForOrg";
779
+ declare const AdminUsersGetOne = "admin.users.getOne";
780
+ declare const AdminUsersGetOneByEmail = "admin.users.getOneByEmail";
781
+ declare const AdminUsersGetOneByPhone = "admin.users.getOneByPhone";
782
+ declare const AdminUsersCreate = "admin.users.create";
783
+ declare const AdminUsersUpdate = "admin.users.update";
784
+ declare const AdminUsersDelete = "admin.users.delete";
785
+ declare const AdminUsersUpdateSettings = "admin.users.updateSettings";
786
+ declare const AdminUsersGetSettings = "admin.users.getSettings";
787
+ declare const AdminUsersTouchActivity = "admin.users.touchActivity";
788
+ declare const AdminTeamsCreate = "admin.teams.create";
789
+ declare const AdminTeamsGetOne = "admin.teams.getOne";
790
+ declare const AdminTeamsGetForOrg = "admin.teams.getTeamsForOrg";
791
+ declare const AdminTeamsUpdateOnboarding = "admin.teams.updateOnboardingData";
792
+ /**
793
+ * Country is a supported jurisdiction for org-level scoping of system
794
+ * document libraries. The Code is the canonical, machine value stored on
795
+ * Org.Country and matched against system_doc_libraries.metadata->>'country'
796
+ * (see backend/services/admin/artifacts/eloquent/system_libraries.go and
797
+ * docs/_db_v2/08_country_scoped_libraries.md).
798
+ * To onboard a new jurisdiction: append a row here, then add the matching
799
+ * <code>_<dept>_library entries in the artifact registry. No enum, no
800
+ * migration — Org.Country is a plain varchar.
801
+ */
802
+ interface Country {
803
+ code: string;
804
+ name: string;
805
+ }
806
+ /**
807
+ * DefaultTrialDays is the self-serve trial length. Override with TRIAL_DAYS.
808
+ */
809
+ declare const DefaultTrialDays = 7;
810
+
811
+ /**
812
+ * Product Analytics Models
813
+ *
814
+ * Types for product analytics (chats, agents, usage, events).
815
+ */
816
+
817
+ interface DateFilter {
818
+ from?: string;
819
+ to?: string;
820
+ }
821
+ interface AnalyticsSummary {
822
+ total_chats: number;
823
+ total_messages: number;
824
+ total_tokens: number;
825
+ total_cost: number;
826
+ unique_users: number;
827
+ avg_session_duration: number;
828
+ }
829
+ interface SummaryResponse {
830
+ success: boolean;
831
+ data: AnalyticsSummary;
832
+ metadata?: ResponseMetadata;
833
+ }
834
+ interface ChatAnalytics {
835
+ chat_id: string;
836
+ agent_id: string;
837
+ user_id: string;
838
+ message_count: number;
839
+ total_tokens: number;
840
+ duration_secs: number;
841
+ csat_score?: number;
842
+ created_at: string;
843
+ }
844
+ interface ChatsResponse {
845
+ success: boolean;
846
+ data: ChatAnalytics[];
847
+ total: number;
848
+ metadata?: ResponseMetadata;
849
+ }
850
+ interface AgentAnalytics {
851
+ agent_id: string;
852
+ agent_name?: string;
853
+ total_chats: number;
854
+ total_messages: number;
855
+ total_tokens: number;
856
+ avg_duration_secs: number;
857
+ unique_users: number;
858
+ avg_csat?: number;
859
+ }
860
+ interface AgentsAnalyticsResponse {
861
+ success: boolean;
862
+ data: AgentAnalytics[];
863
+ metadata?: ResponseMetadata;
864
+ }
865
+ interface UsageAnalytics {
866
+ service: string;
867
+ model: string;
868
+ input_tokens: number;
869
+ output_tokens: number;
870
+ total_tokens: number;
871
+ cost: number;
872
+ request_count: number;
873
+ }
874
+ interface UsageResponse {
875
+ success: boolean;
876
+ data: UsageAnalytics[];
877
+ metadata?: ResponseMetadata;
878
+ }
879
+ interface DailyAnalytics {
880
+ date: string;
881
+ total_chats: number;
882
+ total_messages: number;
883
+ total_tokens: number;
884
+ unique_users: number;
885
+ }
886
+ interface DailyResponse {
887
+ success: boolean;
888
+ data: DailyAnalytics[];
889
+ metadata?: ResponseMetadata;
890
+ }
891
+ interface AnalyticsEvent {
892
+ eventId?: string;
893
+ orgId?: string;
894
+ sessionId: string;
895
+ userId: string;
896
+ eventType: string;
897
+ eventCategory: string;
898
+ pagePath?: string;
899
+ properties?: Record<string, unknown>;
900
+ timestamp?: string;
901
+ }
902
+ interface EventsResponse {
903
+ success: boolean;
904
+ data: AnalyticsEvent[];
905
+ metadata?: ResponseMetadata;
906
+ }
907
+ interface GlobalAnalyticsSummary {
908
+ total_orgs: number;
909
+ total_chats: number;
910
+ total_messages: number;
911
+ total_tokens: number;
912
+ total_cost: number;
913
+ total_users: number;
914
+ }
915
+ interface GlobalSummaryResponse {
916
+ success: boolean;
917
+ data: GlobalAnalyticsSummary;
918
+ metadata?: ResponseMetadata;
919
+ }
920
+ interface OrgAnalytics {
921
+ org_id: string;
922
+ org_name: string;
923
+ total_chats: number;
924
+ total_messages: number;
925
+ total_tokens: number;
926
+ total_cost: number;
927
+ unique_users: number;
928
+ }
929
+ interface OrgAnalyticsResponse {
930
+ success: boolean;
931
+ data: OrgAnalytics[];
932
+ total: number;
933
+ metadata?: ResponseMetadata;
934
+ }
935
+ interface GlobalChannelSummary {
936
+ channel: string;
937
+ total_orgs: number;
938
+ total_chats: number;
939
+ total_messages: number;
940
+ inbound_messages: number;
941
+ total_users: number;
942
+ total_tokens: number;
943
+ total_cost: number;
944
+ avg_messages_per_chat: number;
945
+ }
946
+ interface ChannelSummaryResponse {
947
+ success: boolean;
948
+ data: GlobalChannelSummary;
949
+ metadata?: ResponseMetadata;
950
+ }
951
+ interface ChannelDaily {
952
+ date: string;
953
+ total_chats: number;
954
+ total_messages: number;
955
+ unique_users: number;
956
+ }
957
+ interface ChannelDailyResponse {
958
+ success: boolean;
959
+ data: ChannelDaily[];
960
+ metadata?: ResponseMetadata;
961
+ }
962
+ interface OrgChannelAnalytics {
963
+ org_id: string;
964
+ org_name: string;
965
+ total_chats: number;
966
+ total_messages: number;
967
+ unique_users: number;
968
+ total_tokens: number;
969
+ total_cost: number;
970
+ }
971
+ interface ChannelOrgsResponse {
972
+ success: boolean;
973
+ data: OrgChannelAnalytics[];
974
+ total: number;
975
+ metadata?: ResponseMetadata;
976
+ }
977
+
978
+ export { type DailyResponse as $, type Address as A, AdminUsersGetOne as B, AdminUsersGetOneByEmail as C, AdminUsersGetOneByPhone as D, AdminUsersGetSettings as E, AdminUsersTouchActivity as F, AdminUsersUpdate as G, AdminUsersUpdateSettings as H, type AgentAnalytics as I, type AgentInfo as J, type AgentInput as K, type ListOrgsResponse as L, type AgentResult as M, type AgentsAnalyticsResponse as N, type OrgStatusTS as O, type AnalyticsEvent as P, type AnalyticsSummary as Q, type AzureSettings as R, type ChannelDaily as S, type ChannelDailyResponse as T, type ChannelOrgsResponse as U, type ChannelSummaryResponse as V, type ChatAnalytics as W, type ChatsResponse as X, type Country as Y, type CreateOrgRequest as Z, type DailyAnalytics as _, type OrgTypeTS as a, OrgStatusActive as a$, type DateFilter as a0, DefaultTrialDays as a1, type EventsResponse as a2, type GlobalAnalyticsSummary as a3, type GlobalChannelSummary as a4, type GlobalSummaryResponse as a5, type Invite as a6, type InviteInput as a7, type InviteResponse as a8, type InviteSentStatus as a9, OnboardingStatusInProgress as aA, OnboardingStatusLegacy as aB, type OnboardingStatusOptionTS as aC, OnboardingStatusPending as aD, OnboardingStatusSkipped as aE, type OnboardingStatusTS as aF, OnboardingStatuses as aG, type OnboardingStep as aH, type OrgAnalytics as aI, type OrgAnalyticsResponse as aJ, type OrgChannelAnalytics as aK, type OrgInfo as aL, type OrgInput as aM, type OrgOnboarding as aN, type OrgResult as aO, type OrgRole as aP, type OrgRoleResponse as aQ, type OrgSize as aR, OrgSizeEnterprise as aS, OrgSizeLarge as aT, OrgSizeMedium as aU, type OrgSizeOptionTS as aV, OrgSizeSmall as aW, OrgSizeSolo as aX, type OrgSizeTS as aY, OrgSizes as aZ, type OrgStatus as a_, type InviteStatus as aa, InviteStatusAccepted as ab, InviteStatusExpired as ac, type InviteStatusOptionTS as ad, InviteStatusPending as ae, InviteStatusRevoked as af, type InviteStatusTS as ag, InviteStatuses as ah, type InvitesResult as ai, type KnowledgeGraphInfo as aj, type KnowledgeInput as ak, type KnowledgeResult as al, type ListInvitesResponse as am, type ListOrgRolesResponse as an, type ListUsersResponse as ao, type NotificationPreferences as ap, type OnboardingCompleteResult as aq, type OnboardingDocumentInput as ar, type OnboardingKnowledgeInput as as, type OnboardingOrgInput as at, type OnboardingPlanInput as au, type OnboardingProvisionRequest as av, type OnboardingProvisionResponse as aw, type OnboardingStateResponse as ax, type OnboardingStatus as ay, OnboardingStatusCompleted as az, type Org as b, type OrgStatusOptionTS as b0, OrgStatusSuspended as b1, OrgStatuses as b2, type OrgSubscription as b3, type OrgSubscriptionStatus as b4, OrgSubscriptionStatusActive as b5, OrgSubscriptionStatusCancelled as b6, type OrgSubscriptionStatusOptionTS as b7, OrgSubscriptionStatusPastDue as b8, type OrgSubscriptionStatusTS as b9, type UserSettings as bA, type UserSettingsResponse as bB, type UserSource as bC, UserSourceAPI as bD, UserSourceInvite as bE, type UserSourceOptionTS as bF, UserSourceSSO as bG, UserSourceSignup as bH, type UserSourceTS as bI, UserSources as bJ, type WorkspaceInput as bK, type WorkspaceResult as bL, OrgSubscriptionStatusTrialing as ba, OrgSubscriptionStatusUnpaid as bb, OrgSubscriptionStatuses as bc, type OrgTemplate as bd, type OrgType as be, OrgTypeEnterprise as bf, type OrgTypeOptionTS as bg, OrgTypeSelfServe as bh, OrgTypes as bi, type PaymentSessionInput as bj, type PaymentSessionResult as bk, type Permission as bl, type SubscriptionPlatform as bm, SubscriptionPlatformCustom as bn, SubscriptionPlatformStripe as bo, type SummaryResponse as bp, type Team as bq, type ThemeOptionTS as br, ThemeOptions as bs, type UpdateUserSettingsRequest as bt, type UsageAnalytics as bu, type UsageResponse as bv, type User as bw, type UserOnboarding as bx, type UserOrgAccess as by, type UserResponse as bz, type OrgResponse as c, type OrgInfoResponse as d, type OnboardingState as e, AdminOrgCreate as f, AdminOrgCreated as g, AdminOrgDelete as h, AdminOrgGet as i, AdminOrgGetByDomain as j, AdminOrgGetInfo as k, AdminOrgList as l, AdminOrgListByMetadata as m, AdminOrgRolesCreate as n, AdminOrgRolesDelete as o, AdminOrgRolesGet as p, AdminOrgRolesUpdate as q, AdminOrgUpdate as r, AdminTeamsCreate as s, AdminTeamsGetForOrg as t, AdminTeamsGetOne as u, AdminTeamsUpdateOnboarding as v, AdminUsersCreate as w, AdminUsersDelete as x, AdminUsersGet as y, AdminUsersGetForOrg as z };