@elqnt/types 2.0.12 → 2.0.13

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.
@@ -254,1835 +254,4 @@ interface ChartSettings {
254
254
  compareFilterFieldValue: string;
255
255
  }
256
256
 
257
- interface Address {
258
- line1: string;
259
- line2: string;
260
- city: string;
261
- state: string;
262
- country: string;
263
- zip: string;
264
- }
265
- interface Org {
266
- id?: string;
267
- title: string;
268
- logoUrl: string;
269
- mainDomain: string;
270
- address: Address;
271
- apps: SystemAppTS[];
272
- /**
273
- * Status & Control
274
- */
275
- status: OrgStatusTS;
276
- enabled: boolean;
277
- /**
278
- * Classification
279
- */
280
- type: OrgTypeTS;
281
- size?: OrgSizeTS;
282
- industry?: string;
283
- tags?: string[];
284
- /**
285
- * Subscription (Stripe)
286
- */
287
- subscription?: OrgSubscription;
288
- userCount: number;
289
- /**
290
- * Onboarding & Provisioning
291
- */
292
- onboarding?: OrgOnboarding;
293
- provisioning?: OrgProvisioning;
294
- /**
295
- * Template & Roles
296
- */
297
- template?: OrgTemplate;
298
- roles: string[];
299
- /**
300
- * Flexible metadata
301
- */
302
- metadata?: {
303
- [key: string]: any;
304
- };
305
- /**
306
- * Audit fields
307
- */
308
- createdAt?: number;
309
- updatedAt?: number;
310
- createdBy?: string;
311
- updatedBy?: string;
312
- }
313
- type OrgStatus = string;
314
- declare const OrgStatusActive: OrgStatus;
315
- declare const OrgStatusSuspended: OrgStatus;
316
- declare const OrgStatuses: {
317
- readonly active: {
318
- readonly value: "active";
319
- readonly label: "Active";
320
- };
321
- readonly suspended: {
322
- readonly value: "suspended";
323
- readonly label: "Suspended";
324
- };
325
- };
326
- type OrgStatusTS = keyof typeof OrgStatuses;
327
- type OrgStatusOptionTS = typeof OrgStatuses[OrgStatusTS];
328
- /**
329
- * OrgType represents whether the org is self-serve or enterprise
330
- */
331
- type OrgType = string;
332
- declare const OrgTypeSelfServe: OrgType;
333
- declare const OrgTypeEnterprise: OrgType;
334
- declare const OrgTypes: {
335
- readonly "self-serve": {
336
- readonly value: "self-serve";
337
- readonly label: "Self-Serve";
338
- };
339
- readonly enterprise: {
340
- readonly value: "enterprise";
341
- readonly label: "Enterprise";
342
- };
343
- };
344
- type OrgTypeTS = keyof typeof OrgTypes;
345
- type OrgTypeOptionTS = typeof OrgTypes[OrgTypeTS];
346
- /**
347
- * OrgSize represents the size of the organization
348
- */
349
- type OrgSize = string;
350
- declare const OrgSizeSolo: OrgSize;
351
- declare const OrgSizeSmall: OrgSize;
352
- declare const OrgSizeMedium: OrgSize;
353
- declare const OrgSizeLarge: OrgSize;
354
- declare const OrgSizeEnterprise: OrgSize;
355
- declare const OrgSizes: {
356
- readonly solo: {
357
- readonly value: "solo";
358
- readonly label: "Just me";
359
- };
360
- readonly small: {
361
- readonly value: "small";
362
- readonly label: "2-10";
363
- };
364
- readonly medium: {
365
- readonly value: "medium";
366
- readonly label: "11-50";
367
- };
368
- readonly large: {
369
- readonly value: "large";
370
- readonly label: "51-200";
371
- };
372
- readonly enterprise: {
373
- readonly value: "enterprise";
374
- readonly label: "200+";
375
- };
376
- };
377
- type OrgSizeTS = keyof typeof OrgSizes;
378
- type OrgSizeOptionTS = typeof OrgSizes[OrgSizeTS];
379
- /**
380
- * OnboardingStatus represents the status of an onboarding flow
381
- */
382
- type OnboardingStatus = string;
383
- declare const OnboardingStatusPending: OnboardingStatus;
384
- declare const OnboardingStatusInProgress: OnboardingStatus;
385
- declare const OnboardingStatusCompleted: OnboardingStatus;
386
- declare const OnboardingStatusSkipped: OnboardingStatus;
387
- declare const OnboardingStatusLegacy: OnboardingStatus;
388
- declare const OnboardingStatuses: {
389
- readonly pending: {
390
- readonly value: "pending";
391
- readonly label: "Pending";
392
- };
393
- readonly in_progress: {
394
- readonly value: "in_progress";
395
- readonly label: "In Progress";
396
- };
397
- readonly completed: {
398
- readonly value: "completed";
399
- readonly label: "Completed";
400
- };
401
- readonly skipped: {
402
- readonly value: "skipped";
403
- readonly label: "Skipped";
404
- };
405
- readonly legacy: {
406
- readonly value: "legacy";
407
- readonly label: "Legacy";
408
- };
409
- };
410
- type OnboardingStatusTS = keyof typeof OnboardingStatuses;
411
- type OnboardingStatusOptionTS = typeof OnboardingStatuses[OnboardingStatusTS];
412
- /**
413
- * ProvisioningStatus represents the status of resource provisioning
414
- */
415
- type ProvisioningStatus = string;
416
- declare const ProvisioningStatusPending: ProvisioningStatus;
417
- declare const ProvisioningStatusRunning: ProvisioningStatus;
418
- declare const ProvisioningStatusCompleted: ProvisioningStatus;
419
- declare const ProvisioningStatusFailed: ProvisioningStatus;
420
- declare const ProvisioningStatuses: {
421
- readonly pending: {
422
- readonly value: "pending";
423
- readonly label: "Pending";
424
- };
425
- readonly running: {
426
- readonly value: "running";
427
- readonly label: "Running";
428
- };
429
- readonly completed: {
430
- readonly value: "completed";
431
- readonly label: "Completed";
432
- };
433
- readonly failed: {
434
- readonly value: "failed";
435
- readonly label: "Failed";
436
- };
437
- };
438
- type ProvisioningStatusTS = keyof typeof ProvisioningStatuses;
439
- type ProvisioningStatusOptionTS = typeof ProvisioningStatuses[ProvisioningStatusTS];
440
- /**
441
- * OrgOnboarding tracks the onboarding progress for an organization
442
- */
443
- interface OrgOnboarding {
444
- status: OnboardingStatus;
445
- currentStep: number;
446
- completedAt?: number;
447
- skippedSteps?: number[];
448
- }
449
- /**
450
- * OrgProvisioning tracks the provisioning status of default resources
451
- */
452
- interface OrgProvisioning {
453
- status: ProvisioningStatus;
454
- defaultAgentId?: string;
455
- defaultKnowledgeGraphId?: string;
456
- completedAt?: number;
457
- error?: string;
458
- }
459
- interface OrgSubscription {
460
- plan: string;
461
- platform: SubscriptionPlatform;
462
- status: OrgSubscriptionStatus;
463
- trialEndsAt?: number;
464
- currentPeriodEnd?: number;
465
- seats?: number;
466
- stripeCustomerId?: string;
467
- stripeSubscriptionId?: string;
468
- cancelledAt?: number;
469
- cancelReason?: string;
470
- gracePeriodEndsAt?: number;
471
- }
472
- type OrgSubscriptionStatus = string;
473
- declare const OrgSubscriptionStatusTrialing: OrgSubscriptionStatus;
474
- declare const OrgSubscriptionStatusActive: OrgSubscriptionStatus;
475
- declare const OrgSubscriptionStatusPastDue: OrgSubscriptionStatus;
476
- declare const OrgSubscriptionStatusCancelled: OrgSubscriptionStatus;
477
- declare const OrgSubscriptionStatusUnpaid: OrgSubscriptionStatus;
478
- declare const OrgSubscriptionStatuses: {
479
- readonly trialing: {
480
- readonly value: "trialing";
481
- readonly label: "Trialing";
482
- };
483
- readonly active: {
484
- readonly value: "active";
485
- readonly label: "Active";
486
- };
487
- readonly past_due: {
488
- readonly value: "past_due";
489
- readonly label: "Past Due";
490
- };
491
- readonly cancelled: {
492
- readonly value: "cancelled";
493
- readonly label: "Cancelled";
494
- };
495
- readonly unpaid: {
496
- readonly value: "unpaid";
497
- readonly label: "Unpaid";
498
- };
499
- };
500
- type OrgSubscriptionStatusTS = keyof typeof OrgSubscriptionStatuses;
501
- type OrgSubscriptionStatusOptionTS = typeof OrgSubscriptionStatuses[OrgSubscriptionStatusTS];
502
- interface OrgResponse {
503
- org: Org;
504
- metadata: ResponseMetadata;
505
- }
506
- interface OrgInfoResponse {
507
- orgInfo: OrgInfo;
508
- metadata: ResponseMetadata;
509
- }
510
- interface OrgRoleResponse {
511
- role: OrgRole;
512
- metadata: ResponseMetadata;
513
- }
514
- interface ListOrgsResponse {
515
- orgs: Org[];
516
- metadata: ResponseMetadata;
517
- }
518
- interface ListOrgRolesResponse {
519
- roles: OrgRole[];
520
- metadata: ResponseMetadata;
521
- }
522
- interface OrgInfo {
523
- id?: string;
524
- title: string;
525
- logoUrl: string;
526
- mainDomain?: string;
527
- apps: SystemAppTS[];
528
- }
529
- interface AzureSettings {
530
- appClientId?: string;
531
- appClientSecret?: string;
532
- azureTenantId?: string;
533
- }
534
- interface OrgTemplate {
535
- id: string;
536
- slug: string;
537
- title: string;
538
- }
539
- interface UserOrgAccess {
540
- orgId?: string;
541
- orgTitle?: string;
542
- roles: string[];
543
- isSingleAccount: boolean;
544
- entityRecordFilter?: {
545
- entityName: string;
546
- recordId: string;
547
- displayValue?: string;
548
- };
549
- }
550
- /**
551
- * UserSettings represents user preferences (elastic JSON structure)
552
- */
553
- interface UserSettings {
554
- theme?: string;
555
- language?: string;
556
- timezone?: string;
557
- occupation?: string;
558
- company?: string;
559
- }
560
- declare const ThemeOptions: {
561
- readonly system: {
562
- readonly value: "system";
563
- readonly label: "System";
564
- };
565
- readonly light: {
566
- readonly value: "light";
567
- readonly label: "Light";
568
- };
569
- readonly dark: {
570
- readonly value: "dark";
571
- readonly label: "Dark";
572
- };
573
- };
574
- type ThemeOptionTS = keyof typeof ThemeOptions;
575
- /**
576
- * NotificationPreferences represents user notification settings
577
- */
578
- interface NotificationPreferences {
579
- pushEnabled: boolean;
580
- newChatAssignment: boolean;
581
- newMessages: boolean;
582
- escalations: boolean;
583
- urgentOnly: boolean;
584
- soundEnabled: boolean;
585
- doNotDisturb: boolean;
586
- dndStart?: string;
587
- dndEnd?: string;
588
- }
589
- /**
590
- * UserSource represents how a user was created
591
- */
592
- type UserSource = string;
593
- declare const UserSourceSignup: UserSource;
594
- declare const UserSourceInvite: UserSource;
595
- declare const UserSourceSSO: UserSource;
596
- declare const UserSourceAPI: UserSource;
597
- declare const UserSources: {
598
- readonly signup: {
599
- readonly value: "signup";
600
- readonly label: "Signup";
601
- };
602
- readonly invite: {
603
- readonly value: "invite";
604
- readonly label: "Invite";
605
- };
606
- readonly sso: {
607
- readonly value: "sso";
608
- readonly label: "SSO";
609
- };
610
- readonly api: {
611
- readonly value: "api";
612
- readonly label: "API";
613
- };
614
- };
615
- type UserSourceTS = keyof typeof UserSources;
616
- type UserSourceOptionTS = typeof UserSources[UserSourceTS];
617
- /**
618
- * InviteStatus represents the status of an invitation
619
- */
620
- type InviteStatus = string;
621
- declare const InviteStatusPending: InviteStatus;
622
- declare const InviteStatusAccepted: InviteStatus;
623
- declare const InviteStatusExpired: InviteStatus;
624
- declare const InviteStatusRevoked: InviteStatus;
625
- declare const InviteStatuses: {
626
- readonly pending: {
627
- readonly value: "pending";
628
- readonly label: "Pending";
629
- };
630
- readonly accepted: {
631
- readonly value: "accepted";
632
- readonly label: "Accepted";
633
- };
634
- readonly expired: {
635
- readonly value: "expired";
636
- readonly label: "Expired";
637
- };
638
- readonly revoked: {
639
- readonly value: "revoked";
640
- readonly label: "Revoked";
641
- };
642
- };
643
- type InviteStatusTS = keyof typeof InviteStatuses;
644
- type InviteStatusOptionTS = typeof InviteStatuses[InviteStatusTS];
645
- /**
646
- * Invite represents a team/org invitation
647
- */
648
- interface Invite {
649
- id?: string;
650
- orgId: string;
651
- email: string;
652
- role: string;
653
- invitedBy: string;
654
- status: InviteStatusTS;
655
- acceptedBy?: string;
656
- acceptedAt?: number;
657
- expiresAt?: number;
658
- createdAt?: number;
659
- updatedAt?: number;
660
- }
661
- interface InviteResponse {
662
- invite: Invite;
663
- metadata: ResponseMetadata;
664
- }
665
- interface ListInvitesResponse {
666
- invites: Invite[];
667
- metadata: ResponseMetadata;
668
- }
669
- /**
670
- * UserOnboarding tracks the onboarding progress for a user
671
- */
672
- interface UserOnboarding {
673
- status: OnboardingStatus;
674
- completedAt?: number;
675
- }
676
- /**
677
- * User represents a user in the system
678
- */
679
- interface User {
680
- id?: string;
681
- email: string;
682
- firstName: string;
683
- lastName: string;
684
- authProviderName: string;
685
- orgAccess?: UserOrgAccess[];
686
- /**
687
- * Status & Control
688
- */
689
- enabled?: boolean;
690
- /**
691
- * Source tracking
692
- */
693
- source?: UserSourceTS;
694
- invitedBy?: string;
695
- inviteStatus?: InviteStatusTS;
696
- /**
697
- * Team membership - LEGACY, DO NOT USE
698
- * These fields are deprecated and will be removed.
699
- * Use Org and OrgAccess patterns instead.
700
- */
701
- isTeamAdmin?: boolean;
702
- teamId?: string;
703
- teamName?: string;
704
- /**
705
- * System admin flag
706
- */
707
- isSysAdmin?: boolean;
708
- /**
709
- * Preferences
710
- */
711
- settings?: UserSettings;
712
- notificationPreferences?: NotificationPreferences;
713
- /**
714
- * Onboarding tracking
715
- */
716
- onboarding?: UserOnboarding;
717
- /**
718
- * Flexible metadata
719
- */
720
- metadata?: {
721
- [key: string]: any;
722
- };
723
- /**
724
- * Audit fields
725
- */
726
- createdAt?: number;
727
- updatedAt?: number;
728
- createdBy?: string;
729
- updatedBy?: string;
730
- }
731
- interface UserResponse {
732
- user: User;
733
- metadata: ResponseMetadata;
734
- }
735
- interface ListUsersResponse {
736
- users: User[];
737
- metadata: ResponseMetadata;
738
- }
739
- interface Team {
740
- id?: string;
741
- name: string;
742
- isSubscribed: boolean;
743
- subscribedAt?: number;
744
- plan: string;
745
- ownerName?: string;
746
- ownerEmail?: string;
747
- subscriptionPlatform?: SubscriptionPlatform;
748
- subscriptionId?: string;
749
- onboardingDone?: boolean;
750
- onboardingData?: string;
751
- }
752
- type SubscriptionPlatform = string;
753
- declare const SubscriptionPlatformStripe: SubscriptionPlatform;
754
- declare const SubscriptionPlatformCustom: SubscriptionPlatform;
755
- interface OrgRole {
756
- id?: string;
757
- orgId?: string;
758
- title: string;
759
- permissions: Permission[];
760
- isSystem: boolean;
761
- createdAt?: number;
762
- updatedAt?: number;
763
- createdBy?: string;
764
- updatedBy?: string;
765
- }
766
- /**
767
- * org db - copied from sys db
768
- */
769
- interface Permission {
770
- /**
771
- * ID *primitive.ObjectID `bson:"_id,omitempty" json:"id"`
772
- */
773
- name: string;
774
- title: string;
775
- isSystem: boolean;
776
- }
777
- type SystemApp = string;
778
- declare const SystemAppAdmin: SystemApp;
779
- declare const SystemAppCRM: SystemApp;
780
- declare const SystemAppHelpdesk: SystemApp;
781
- declare const SystemAppMarketing: SystemApp;
782
- declare const SystemAppWorkflow: SystemApp;
783
- declare const SystemAppAnalytics: SystemApp;
784
- declare const SystemAppKnowledgeGraph: SystemApp;
785
- declare const SystemAppDocumentProcessor: SystemApp;
786
- declare const SystemApps: {
787
- readonly admin: {
788
- readonly value: "admin";
789
- readonly label: "Admin";
790
- };
791
- readonly crm: {
792
- readonly value: "crm";
793
- readonly label: "CRM";
794
- };
795
- readonly helpdesk: {
796
- readonly value: "helpdesk";
797
- readonly label: "Helpdesk";
798
- };
799
- readonly marketing: {
800
- readonly value: "marketing";
801
- readonly label: "Marketing";
802
- };
803
- readonly workflow: {
804
- readonly value: "workflow";
805
- readonly label: "Workflow";
806
- };
807
- readonly analytics: {
808
- readonly value: "analytics";
809
- readonly label: "Analytics";
810
- };
811
- readonly "knowledge-graph": {
812
- readonly value: "knowledge-graph";
813
- readonly label: "Knowledge Graph";
814
- };
815
- readonly "document-processor": {
816
- readonly value: "document-processor";
817
- readonly label: "Document Processor";
818
- };
819
- };
820
- type SystemAppTS = keyof typeof SystemApps;
821
- type SystemAppOptionTS = typeof SystemApps[SystemAppTS];
822
- /**
823
- * UpdateUserSettingsRequest is the request payload for updating user settings
824
- */
825
- interface UpdateUserSettingsRequest {
826
- id: string;
827
- settings?: UserSettings;
828
- notificationPreferences?: NotificationPreferences;
829
- }
830
- /**
831
- * UserSettingsResponse is the response for settings operations
832
- */
833
- interface UserSettingsResponse {
834
- settings?: UserSettings;
835
- notificationPreferences?: NotificationPreferences;
836
- metadata: ResponseMetadata;
837
- }
838
- /**
839
- * OnboardingStep represents a step in the onboarding flow
840
- */
841
- interface OnboardingStep {
842
- step: number;
843
- name: string;
844
- status: string;
845
- required: boolean;
846
- }
847
- /**
848
- * OnboardingState represents the current state of a user's onboarding
849
- */
850
- interface OnboardingState {
851
- status: string;
852
- currentStep: number;
853
- steps: OnboardingStep[];
854
- user?: User;
855
- org?: Org;
856
- }
857
- /**
858
- * OnboardingStateResponse is the response for onboarding status
859
- */
860
- interface OnboardingStateResponse {
861
- state: OnboardingState;
862
- metadata: ResponseMetadata;
863
- }
864
- /**
865
- * OrgInput contains the input for creating an organization
866
- */
867
- interface OrgInput {
868
- name: string;
869
- industry?: string;
870
- size: string;
871
- stripeSessionId?: string;
872
- }
873
- /**
874
- * OrgResult contains the result of organization creation
875
- */
876
- interface OrgResult {
877
- org?: Org;
878
- nextStep: string;
879
- metadata: ResponseMetadata;
880
- }
881
- /**
882
- * WorkspaceInput is an alias for OrgInput (deprecated)
883
- */
884
- type WorkspaceInput = OrgInput;
885
- /**
886
- * WorkspaceResult is an alias for OrgResult (deprecated)
887
- */
888
- type WorkspaceResult = OrgResult;
889
- /**
890
- * InviteInput contains the input for sending invites
891
- */
892
- interface InviteInput {
893
- email: string;
894
- role: string;
895
- }
896
- /**
897
- * InvitesResult contains the result of sending invites
898
- */
899
- interface InvitesResult {
900
- sent: InviteSentStatus[];
901
- failed: string[];
902
- nextStep: string;
903
- metadata: ResponseMetadata;
904
- }
905
- /**
906
- * InviteSentStatus represents status of a sent invite
907
- */
908
- interface InviteSentStatus {
909
- email: string;
910
- status: string;
911
- }
912
- /**
913
- * KnowledgeInput contains the input for creating knowledge graph
914
- */
915
- interface KnowledgeInput {
916
- name?: string;
917
- skipUpload: boolean;
918
- }
919
- /**
920
- * KnowledgeGraphInfo contains info about a knowledge graph
921
- */
922
- interface KnowledgeGraphInfo {
923
- id: string;
924
- name: string;
925
- status: string;
926
- documentCount: number;
927
- }
928
- /**
929
- * KnowledgeResult contains the result of knowledge graph creation
930
- */
931
- interface KnowledgeResult {
932
- knowledgeGraph: KnowledgeGraphInfo;
933
- nextStep: string;
934
- metadata: ResponseMetadata;
935
- }
936
- /**
937
- * AgentInput contains the input for creating an agent
938
- */
939
- interface AgentInput {
940
- name: string;
941
- goal: string;
942
- personality: string;
943
- skills?: string[];
944
- }
945
- /**
946
- * AgentInfo contains info about an agent
947
- */
948
- interface AgentInfo {
949
- id: string;
950
- name: string;
951
- goal: string;
952
- personality: string;
953
- status: string;
954
- knowledgeGraphId?: string;
955
- }
956
- /**
957
- * AgentResult contains the result of agent creation
958
- */
959
- interface AgentResult {
960
- agent: AgentInfo;
961
- nextStep: string;
962
- metadata: ResponseMetadata;
963
- }
964
- /**
965
- * OnboardingCompleteResult contains the result of completing onboarding
966
- */
967
- interface OnboardingCompleteResult {
968
- status: string;
969
- completedAt: number;
970
- org?: Org;
971
- redirectUrl: string;
972
- metadata: ResponseMetadata;
973
- }
974
- /**
975
- * PaymentSessionInput contains input for creating a payment session
976
- */
977
- interface PaymentSessionInput {
978
- plan: string;
979
- billingCycle: string;
980
- seats: number;
981
- successUrl: string;
982
- cancelUrl: string;
983
- affiliateCode?: string;
984
- }
985
- /**
986
- * PaymentSessionResult contains the result of creating a payment session
987
- */
988
- interface PaymentSessionResult {
989
- url: string;
990
- sessionId: string;
991
- customerId: string;
992
- metadata: ResponseMetadata;
993
- }
994
- declare const AdminOrgCreate = "admin.orgs.create";
995
- declare const AdminOrgList = "admin.orgs.list";
996
- declare const AdminOrgListByMetadata = "admin.orgs.listByMetadata";
997
- declare const AdminOrgGet = "admin.orgs.get";
998
- declare const AdminOrgGetInfo = "admin.orgs.getInfo";
999
- declare const AdminOrgGetByDomain = "admin.orgs.getByDomain";
1000
- declare const AdminOrgUpdate = "admin.orgs.update";
1001
- declare const AdminOrgDelete = "admin.orgs.delete";
1002
- declare const AdminOrgCreated = "system.admin.org.created";
1003
- declare const AdminOrgRolesGet = "admin.orgRoles.get";
1004
- declare const AdminOrgRolesCreate = "admin.orgRoles.create";
1005
- declare const AdminOrgRolesUpdate = "admin.orgRoles.update";
1006
- declare const AdminOrgRolesDelete = "admin.orgRoles.delete";
1007
- declare const AdminUsersGet = "admin.users.get";
1008
- declare const AdminUsersGetForOrg = "admin.users.getUsersForOrg";
1009
- declare const AdminUsersGetOne = "admin.users.getOne";
1010
- declare const AdminUsersGetOneByEmail = "admin.users.getOneByEmail";
1011
- declare const AdminUsersCreate = "admin.users.create";
1012
- declare const AdminUsersUpdate = "admin.users.update";
1013
- declare const AdminUsersDelete = "admin.users.delete";
1014
- declare const AdminUsersUpdateSettings = "admin.users.updateSettings";
1015
- declare const AdminUsersGetSettings = "admin.users.getSettings";
1016
- declare const AdminTeamsCreate = "admin.teams.create";
1017
- declare const AdminTeamsGetOne = "admin.teams.getOne";
1018
- declare const AdminTeamsGetForOrg = "admin.teams.getTeamsForOrg";
1019
- declare const AdminTeamsUpdateOnboarding = "admin.teams.updateOnboardingData";
1020
-
1021
- /**
1022
- * Billing event handlers
1023
- */
1024
- declare const BillingRecordEvent = "billing.events.record";
1025
- /**
1026
- * NATS Subject constants
1027
- */
1028
- declare const BillingGetUsageReport = "billing.usage.report";
1029
- /**
1030
- * NATS Subject constants
1031
- */
1032
- declare const BillingGetInvoice = "billing.invoice.get";
1033
- /**
1034
- * NATS Subject constants
1035
- */
1036
- declare const BillingProcessBillingPeriod = "billing.period.process";
1037
- /**
1038
- * Usage handlers
1039
- */
1040
- declare const UsageGetCurrentUsage = "billing.usage.current";
1041
- /**
1042
- * NATS Subject constants
1043
- */
1044
- declare const UsageGetUsageHistory = "billing.usage.history";
1045
- /**
1046
- * NATS Subject constants
1047
- */
1048
- declare const UsageGetCostBreakdown = "billing.usage.breakdown";
1049
- /**
1050
- * NATS Subject constants
1051
- */
1052
- declare const UsageGetTopCostCenters = "billing.usage.top_centers";
1053
- /**
1054
- * Rules handlers
1055
- */
1056
- declare const RulesGetBillingRules = "billing.rules.get";
1057
- /**
1058
- * NATS Subject constants
1059
- */
1060
- declare const RulesCreateBillingRule = "billing.rules.create";
1061
- /**
1062
- * NATS Subject constants
1063
- */
1064
- declare const RulesUpdateBillingRule = "billing.rules.update";
1065
- /**
1066
- * NATS Subject constants
1067
- */
1068
- declare const RulesDeleteBillingRule = "billing.rules.delete";
1069
- interface BillingEvent {
1070
- /**
1071
- * Core identifiers
1072
- */
1073
- org_id: string;
1074
- event_id: string;
1075
- user_id: string;
1076
- customer_id: string;
1077
- /**
1078
- * Event details
1079
- */
1080
- event_type: string;
1081
- event_subtype: string;
1082
- timestamp: string;
1083
- /**
1084
- * Billing metrics
1085
- */
1086
- billable_units: number;
1087
- unit_type: string;
1088
- cost_per_unit: number;
1089
- total_cost: number;
1090
- /**
1091
- * Context
1092
- */
1093
- service_name: string;
1094
- session_id: string;
1095
- parent_event_id: string;
1096
- /**
1097
- * Resource consumption
1098
- */
1099
- input_tokens: number;
1100
- output_tokens: number;
1101
- processing_time_ms: number;
1102
- /**
1103
- * Product context
1104
- */
1105
- product_tier: string;
1106
- feature_name: string;
1107
- plan_id: string;
1108
- /**
1109
- * Metadata
1110
- */
1111
- metadata: {
1112
- [key: string]: any;
1113
- };
1114
- created_by: string;
1115
- }
1116
- interface UsageReport {
1117
- org_id: string;
1118
- period_start: string;
1119
- period_end: string;
1120
- total_cost: number;
1121
- currency: string;
1122
- service_breakdowns: ServiceUsage[];
1123
- generated_at: string;
1124
- }
1125
- interface ServiceUsage {
1126
- service_name: string;
1127
- event_type: string;
1128
- unit_type: string;
1129
- total_units: number;
1130
- total_cost: number;
1131
- total_events: number;
1132
- unique_users: number;
1133
- unique_sessions: number;
1134
- total_input_tokens: number;
1135
- total_output_tokens: number;
1136
- total_processing_time: number;
1137
- }
1138
- interface BillingRule {
1139
- rule_id: string;
1140
- org_id: string;
1141
- service_name: string;
1142
- event_type: string;
1143
- unit_type: string;
1144
- /**
1145
- * Tiered pricing
1146
- */
1147
- base_cost: number;
1148
- tier_1_threshold: number;
1149
- tier_1_cost: number;
1150
- tier_2_threshold: number;
1151
- tier_2_cost: number;
1152
- tier_3_threshold: number;
1153
- tier_3_cost: number;
1154
- /**
1155
- * Validity
1156
- */
1157
- effective_from: string;
1158
- effective_to: string;
1159
- is_active: boolean;
1160
- created_at: string;
1161
- updated_at: string;
1162
- }
1163
- interface BillingPeriod {
1164
- period_id: string;
1165
- org_id: string;
1166
- period_start: string;
1167
- period_end: string;
1168
- status: string;
1169
- billing_cycle: string;
1170
- created_at: string;
1171
- }
1172
- interface Invoice {
1173
- invoice_id: string;
1174
- org_id: string;
1175
- period_id: string;
1176
- period_start: string;
1177
- period_end: string;
1178
- line_items: InvoiceLineItem[];
1179
- subtotal_amount: number;
1180
- tax_amount: number;
1181
- total_amount: number;
1182
- currency: string;
1183
- status: string;
1184
- generated_at: string;
1185
- due_date: string;
1186
- payment_method_id: string;
1187
- }
1188
- interface InvoiceLineItem {
1189
- line_item_id: string;
1190
- service_name: string;
1191
- event_type: string;
1192
- unit_type: string;
1193
- description: string;
1194
- quantity: number;
1195
- unit_price: number;
1196
- total_price: number;
1197
- }
1198
- interface BillingEventRequest {
1199
- BillingEvent: BillingEvent;
1200
- }
1201
- interface BillingEventResponse {
1202
- success: boolean;
1203
- error?: string;
1204
- }
1205
- interface UsageReportRequest {
1206
- org_id: string;
1207
- period_start: string;
1208
- period_end: string;
1209
- }
1210
- interface UsageReportResponse {
1211
- success: boolean;
1212
- data?: UsageReport;
1213
- error?: string;
1214
- }
1215
- interface CurrentUsageRequest {
1216
- org_id: string;
1217
- service_name: string;
1218
- event_type: string;
1219
- }
1220
- interface CurrentUsageResponse {
1221
- success: boolean;
1222
- data?: {
1223
- [key: string]: any;
1224
- };
1225
- error?: string;
1226
- }
1227
- interface CostBreakdownRequest {
1228
- org_id: string;
1229
- period_start: string;
1230
- period_end: string;
1231
- group_by: string;
1232
- }
1233
- interface CostBreakdownResponse {
1234
- success: boolean;
1235
- data?: CostBreakdown[];
1236
- error?: string;
1237
- }
1238
- interface CostBreakdown {
1239
- group_value: string;
1240
- total_cost: number;
1241
- total_units: number;
1242
- event_count: number;
1243
- }
1244
- interface BillingRuleRequest {
1245
- BillingRule: BillingRule;
1246
- }
1247
- interface BillingRuleResponse {
1248
- success: boolean;
1249
- data?: BillingRule;
1250
- error?: string;
1251
- }
1252
- interface BillingRulesRequest {
1253
- org_id: string;
1254
- service_name: string;
1255
- event_type: string;
1256
- }
1257
- interface BillingRulesResponse {
1258
- success: boolean;
1259
- data?: (BillingRule | undefined)[];
1260
- error?: string;
1261
- }
1262
- interface InvoiceRequest {
1263
- org_id: string;
1264
- period_id: string;
1265
- invoice_id: string;
1266
- }
1267
- interface InvoiceResponse {
1268
- success: boolean;
1269
- data?: Invoice;
1270
- error?: string;
1271
- }
1272
- interface BillingPeriodProcessRequest {
1273
- org_id: string;
1274
- period_id: string;
1275
- }
1276
- interface BillingPeriodProcessResponse {
1277
- success: boolean;
1278
- invoice_id?: string;
1279
- error?: string;
1280
- }
1281
- interface UsageAggregation {
1282
- org_id: string;
1283
- period_id: string;
1284
- date: string;
1285
- hour: number;
1286
- service_name: string;
1287
- event_type: string;
1288
- unit_type: string;
1289
- total_units: number;
1290
- total_events: number;
1291
- total_cost: number;
1292
- unique_users: number;
1293
- unique_sessions: number;
1294
- total_input_tokens: number;
1295
- total_output_tokens: number;
1296
- total_processing_time: number;
1297
- created_at: string;
1298
- }
1299
- interface TopCostCenter {
1300
- service_name: string;
1301
- event_type: string;
1302
- total_cost: number;
1303
- total_units: number;
1304
- event_count: number;
1305
- percentage: number;
1306
- }
1307
- interface UsageHistory {
1308
- date: string;
1309
- total_cost: number;
1310
- total_units: number;
1311
- event_count: number;
1312
- unique_users: number;
1313
- }
1314
- interface UserUsage {
1315
- user_id: string;
1316
- total_cost: number;
1317
- total_units: number;
1318
- event_count: number;
1319
- last_activity: string;
1320
- }
1321
- /**
1322
- * Usage trends and analytics models
1323
- */
1324
- interface UsageTrends {
1325
- org_id: string;
1326
- days: number;
1327
- trend: string;
1328
- direction: string;
1329
- change_percent: number;
1330
- recent_week_cost: number;
1331
- previous_week_cost: number;
1332
- }
1333
- interface UsageAlert {
1334
- type: string;
1335
- severity: string;
1336
- message: string;
1337
- current_value: number;
1338
- threshold_value: number;
1339
- created_at: string;
1340
- }
1341
- /**
1342
- * Cost preview models
1343
- */
1344
- interface CostPreview {
1345
- units: number;
1346
- total_cost: number;
1347
- cost_per_unit: number;
1348
- tier_breakdown: TierCost[];
1349
- rule?: BillingRule;
1350
- }
1351
- interface TierCost {
1352
- tier: string;
1353
- units: number;
1354
- rate: number;
1355
- cost: number;
1356
- }
1357
- /**
1358
- * Rule coverage models
1359
- */
1360
- interface RuleCoverage {
1361
- org_id: string;
1362
- total_services: number;
1363
- covered_services: {
1364
- [key: string]: boolean;
1365
- };
1366
- missing_rules: string[];
1367
- rule_count: number;
1368
- coverage_percentage: number;
1369
- }
1370
- /**
1371
- * Generic Response
1372
- */
1373
- interface BillingResponse {
1374
- success: boolean;
1375
- data?: any;
1376
- error?: string;
1377
- }
1378
- /**
1379
- * Subscription management
1380
- */
1381
- declare const SubscriptionCreate = "billing.subscription.create";
1382
- /**
1383
- * NATS Subjects for Stripe/Subscription operations
1384
- */
1385
- declare const SubscriptionGet = "billing.subscription.get";
1386
- /**
1387
- * NATS Subjects for Stripe/Subscription operations
1388
- */
1389
- declare const SubscriptionUpdate = "billing.subscription.update";
1390
- /**
1391
- * NATS Subjects for Stripe/Subscription operations
1392
- */
1393
- declare const SubscriptionCancel = "billing.subscription.cancel";
1394
- /**
1395
- * NATS Subjects for Stripe/Subscription operations
1396
- */
1397
- declare const SubscriptionList = "billing.subscription.list";
1398
- /**
1399
- * NATS Subjects for Stripe/Subscription operations
1400
- */
1401
- declare const SubscriptionCheckout = "billing.subscription.checkout";
1402
- /**
1403
- * Payment links
1404
- */
1405
- declare const PaymentLinkCreate = "billing.payment-link.create";
1406
- /**
1407
- * NATS Subjects for Stripe/Subscription operations
1408
- */
1409
- declare const PaymentLinkList = "billing.payment-link.list";
1410
- /**
1411
- * Customer portal
1412
- */
1413
- declare const PortalSessionCreate = "billing.portal.create";
1414
- /**
1415
- * Customer management
1416
- */
1417
- declare const CustomerCreate = "billing.customer.create";
1418
- /**
1419
- * NATS Subjects for Stripe/Subscription operations
1420
- */
1421
- declare const CustomerGet = "billing.customer.get";
1422
- /**
1423
- * NATS Subjects for Stripe/Subscription operations
1424
- */
1425
- declare const CustomerUpdate = "billing.customer.update";
1426
- /**
1427
- * Credits
1428
- */
1429
- declare const CreditsBalance = "billing.credits.balance";
1430
- /**
1431
- * NATS Subjects for Stripe/Subscription operations
1432
- */
1433
- declare const CreditsPurchase = "billing.credits.purchase";
1434
- /**
1435
- * NATS Subjects for Stripe/Subscription operations
1436
- */
1437
- declare const CreditsConsume = "billing.credits.consume";
1438
- /**
1439
- * Plans
1440
- */
1441
- declare const PlansGet = "billing.plans.get";
1442
- /**
1443
- * NATS Subjects for Stripe/Subscription operations
1444
- */
1445
- declare const PlansGetAll = "billing.plans.list";
1446
- /**
1447
- * Usage alerts
1448
- */
1449
- declare const UsageAlertThreshold = "billing.usage.alert";
1450
- /**
1451
- * Webhooks (internal events)
1452
- */
1453
- declare const WebhookSubscriptionCreated = "billing.webhook.subscription.created";
1454
- /**
1455
- * NATS Subjects for Stripe/Subscription operations
1456
- */
1457
- declare const WebhookSubscriptionUpdated = "billing.webhook.subscription.updated";
1458
- /**
1459
- * NATS Subjects for Stripe/Subscription operations
1460
- */
1461
- declare const WebhookSubscriptionCanceled = "billing.webhook.subscription.canceled";
1462
- /**
1463
- * NATS Subjects for Stripe/Subscription operations
1464
- */
1465
- declare const WebhookInvoicePaid = "billing.webhook.invoice.paid";
1466
- /**
1467
- * NATS Subjects for Stripe/Subscription operations
1468
- */
1469
- declare const WebhookInvoiceFailed = "billing.webhook.invoice.failed";
1470
- /**
1471
- * NATS Subjects for Stripe/Subscription operations
1472
- */
1473
- declare const WebhookPaymentSucceeded = "billing.webhook.payment.succeeded";
1474
- /**
1475
- * Affiliates
1476
- */
1477
- declare const AffiliateCreate = "billing.affiliate.create";
1478
- /**
1479
- * NATS Subjects for Stripe/Subscription operations
1480
- */
1481
- declare const AffiliateGet = "billing.affiliate.get";
1482
- /**
1483
- * NATS Subjects for Stripe/Subscription operations
1484
- */
1485
- declare const AffiliateList = "billing.affiliate.list";
1486
- /**
1487
- * NATS Subjects for Stripe/Subscription operations
1488
- */
1489
- declare const AffiliateUpdate = "billing.affiliate.update";
1490
- /**
1491
- * NATS Subjects for Stripe/Subscription operations
1492
- */
1493
- declare const AffiliateOnboard = "billing.affiliate.onboard";
1494
- /**
1495
- * NATS Subjects for Stripe/Subscription operations
1496
- */
1497
- declare const AffiliateCommissions = "billing.affiliate.commissions";
1498
- /**
1499
- * Analytics
1500
- */
1501
- declare const AnalyticsRevenue = "billing.analytics.revenue";
1502
- /**
1503
- * NATS Subjects for Stripe/Subscription operations
1504
- */
1505
- declare const AnalyticsUsage = "billing.analytics.usage";
1506
- /**
1507
- * NATS Subjects for Stripe/Subscription operations
1508
- */
1509
- declare const AnalyticsChurn = "billing.analytics.churn";
1510
- /**
1511
- * Plan represents a subscription plan
1512
- */
1513
- interface Plan {
1514
- id: string;
1515
- stripeProductId?: string;
1516
- stripePriceId?: string;
1517
- name: string;
1518
- tier: string;
1519
- priceCents: number;
1520
- currency: string;
1521
- billingInterval: string;
1522
- chatSessionsLimit: number;
1523
- tokenAllowance: number;
1524
- agentsLimit: number;
1525
- usersLimit: number;
1526
- knowledgeGraphMb: number;
1527
- tokenOverageRateCents: number;
1528
- sessionOverageRateCents: number;
1529
- features: {
1530
- [key: string]: any;
1531
- };
1532
- isActive: boolean;
1533
- createdAt: string;
1534
- updatedAt: string;
1535
- }
1536
- /**
1537
- * OrganizationBilling represents an organization's billing info
1538
- */
1539
- interface OrganizationBilling {
1540
- orgId: string;
1541
- stripeCustomerId?: string;
1542
- stripeSubscriptionId?: string;
1543
- planId?: string;
1544
- plan?: Plan;
1545
- status: string;
1546
- currentPeriodStart?: string;
1547
- currentPeriodEnd?: string;
1548
- trialStart?: string;
1549
- trialEnd?: string;
1550
- billingEmail?: string;
1551
- billingName?: string;
1552
- affiliateCode?: string;
1553
- createdAt: string;
1554
- updatedAt: string;
1555
- }
1556
- /**
1557
- * CreditBalance represents a credit balance entry
1558
- */
1559
- interface CreditBalance {
1560
- id: string;
1561
- orgId: string;
1562
- creditType: string;
1563
- amount: number;
1564
- remaining: number;
1565
- description?: string;
1566
- expiresAt?: string;
1567
- stripePaymentId?: string;
1568
- createdAt: string;
1569
- }
1570
- /**
1571
- * CreditPackage represents a purchasable credit package
1572
- */
1573
- interface CreditPackage {
1574
- id: string;
1575
- stripeProductId?: string;
1576
- stripePriceId?: string;
1577
- name: string;
1578
- tokens: number;
1579
- priceCents: number;
1580
- currency: string;
1581
- bonusTokens: number;
1582
- isActive: boolean;
1583
- createdAt: string;
1584
- }
1585
- /**
1586
- * UsagePeriod represents usage within a billing period
1587
- */
1588
- interface UsagePeriod {
1589
- id: string;
1590
- orgId: string;
1591
- periodStart: string;
1592
- periodEnd: string;
1593
- tokensUsed: number;
1594
- sessionsUsed: number;
1595
- tokensAllowance: number;
1596
- sessionsAllowance: number;
1597
- tokensOverage: number;
1598
- sessionsOverage: number;
1599
- overageChargedCents: number;
1600
- status: string;
1601
- stripeUsageRecordId?: string;
1602
- createdAt: string;
1603
- updatedAt: string;
1604
- }
1605
- /**
1606
- * UsageSummary provides a summary of current usage
1607
- */
1608
- interface UsageSummary {
1609
- orgId: string;
1610
- planTier: string;
1611
- billingPeriodStart: string;
1612
- billingPeriodEnd: string;
1613
- daysRemaining: number;
1614
- /**
1615
- * Token usage
1616
- */
1617
- tokensUsed: number;
1618
- tokensAllowance: number;
1619
- tokensPercentage: number;
1620
- tokensRemaining: number;
1621
- /**
1622
- * Session usage
1623
- */
1624
- sessionsUsed: number;
1625
- sessionsAllowance: number;
1626
- sessionsPercentage: number;
1627
- sessionsRemaining: number;
1628
- /**
1629
- * Credits
1630
- */
1631
- creditsRemaining: number;
1632
- /**
1633
- * Projected overage
1634
- */
1635
- projectedTokenOverage: number;
1636
- projectedSessionOverage: number;
1637
- projectedOverageCents: number;
1638
- }
1639
- /**
1640
- * Affiliate represents an affiliate partner
1641
- */
1642
- interface Affiliate {
1643
- id: string;
1644
- name: string;
1645
- email: string;
1646
- stripeAccountId?: string;
1647
- status: string;
1648
- commissionRate: number;
1649
- commissionType: string;
1650
- referralCode: string;
1651
- referralLink: string;
1652
- totalEarningsCents: number;
1653
- pendingPayoutCents: number;
1654
- onboardingCompleted: boolean;
1655
- onboardingCompletedAt?: string;
1656
- country?: string;
1657
- phone?: string;
1658
- createdAt: string;
1659
- updatedAt: string;
1660
- }
1661
- /**
1662
- * AffiliateReferral represents a customer referred by an affiliate
1663
- */
1664
- interface AffiliateReferral {
1665
- id: string;
1666
- affiliateId: string;
1667
- customerOrgId: string;
1668
- stripeCustomerId?: string;
1669
- status: string;
1670
- firstPurchaseAt?: string;
1671
- totalRevenueCents: number;
1672
- totalCommissionCents: number;
1673
- createdAt: string;
1674
- updatedAt: string;
1675
- }
1676
- /**
1677
- * AffiliateCommission represents a commission payment to an affiliate
1678
- */
1679
- interface AffiliateCommission {
1680
- id: string;
1681
- affiliateId: string;
1682
- referralId: string;
1683
- stripePaymentId?: string;
1684
- stripeTransferId?: string;
1685
- stripeInvoiceId?: string;
1686
- grossAmountCents: number;
1687
- commissionAmountCents: number;
1688
- commissionRate: number;
1689
- currency: string;
1690
- status: string;
1691
- createdAt: string;
1692
- paidAt?: string;
1693
- }
1694
- /**
1695
- * Payment represents a payment record
1696
- */
1697
- interface Payment {
1698
- id: string;
1699
- orgId: string;
1700
- stripePaymentIntentId?: string;
1701
- stripeInvoiceId?: string;
1702
- stripeSubscriptionId?: string;
1703
- amountCents: number;
1704
- currency: string;
1705
- status: string;
1706
- paymentType: string;
1707
- customerEmail?: string;
1708
- paymentMethod?: string;
1709
- description?: string;
1710
- metadata?: {
1711
- [key: string]: any;
1712
- };
1713
- createdAt: string;
1714
- updatedAt: string;
1715
- }
1716
- /**
1717
- * CreatePaymentLinkRequest is the request to create a payment link
1718
- */
1719
- interface CreatePaymentLinkRequest {
1720
- orgId: string;
1721
- priceId: string;
1722
- successUrl: string;
1723
- cancelUrl: string;
1724
- customerEmail?: string;
1725
- affiliateCode?: string;
1726
- quantity?: number;
1727
- metadata?: {
1728
- [key: string]: string;
1729
- };
1730
- }
1731
- /**
1732
- * CreatePaymentLinkResponse is the response from creating a payment link
1733
- */
1734
- interface CreatePaymentLinkResponse {
1735
- success: boolean;
1736
- url?: string;
1737
- paymentLinkId?: string;
1738
- error?: string;
1739
- }
1740
- /**
1741
- * CreatePortalSessionRequest is the request to create a billing portal session
1742
- */
1743
- interface CreatePortalSessionRequest {
1744
- orgId: string;
1745
- returnUrl: string;
1746
- }
1747
- /**
1748
- * CreatePortalSessionResponse is the response from creating a portal session
1749
- */
1750
- interface CreatePortalSessionResponse {
1751
- success: boolean;
1752
- url?: string;
1753
- error?: string;
1754
- }
1755
- /**
1756
- * CreateCheckoutSessionRequest is the request to create a checkout session
1757
- */
1758
- interface CreateCheckoutSessionRequest {
1759
- orgId: string;
1760
- priceId: string;
1761
- successUrl: string;
1762
- cancelUrl: string;
1763
- customerEmail?: string;
1764
- affiliateCode?: string;
1765
- trialDays?: number;
1766
- metadata?: {
1767
- [key: string]: string;
1768
- };
1769
- }
1770
- /**
1771
- * CreateCheckoutSessionResponse is the response from creating a checkout session
1772
- */
1773
- interface CreateCheckoutSessionResponse {
1774
- success: boolean;
1775
- sessionId?: string;
1776
- url?: string;
1777
- error?: string;
1778
- }
1779
- /**
1780
- * GetSubscriptionRequest is the request to get subscription info
1781
- */
1782
- interface GetSubscriptionRequest {
1783
- orgId: string;
1784
- }
1785
- /**
1786
- * GetSubscriptionResponse is the response with subscription info
1787
- */
1788
- interface GetSubscriptionResponse {
1789
- success: boolean;
1790
- subscription?: OrganizationBilling;
1791
- usage?: UsageSummary;
1792
- error?: string;
1793
- }
1794
- /**
1795
- * CancelSubscriptionRequest is the request to cancel a subscription
1796
- */
1797
- interface CancelSubscriptionRequest {
1798
- orgId: string;
1799
- cancelAtEnd: boolean;
1800
- reason?: string;
1801
- }
1802
- /**
1803
- * CancelSubscriptionResponse is the response from canceling a subscription
1804
- */
1805
- interface CancelSubscriptionResponse {
1806
- success: boolean;
1807
- cancelAt?: string;
1808
- error?: string;
1809
- }
1810
- /**
1811
- * GetCreditsRequest is the request to get credit balance
1812
- */
1813
- interface GetCreditsRequest {
1814
- orgId: string;
1815
- }
1816
- /**
1817
- * GetCreditsResponse is the response with credit balance
1818
- */
1819
- interface GetCreditsResponse {
1820
- success: boolean;
1821
- totalRemaining: number;
1822
- balances?: (CreditBalance | undefined)[];
1823
- error?: string;
1824
- }
1825
- /**
1826
- * PurchaseCreditsRequest is the request to purchase credits
1827
- */
1828
- interface PurchaseCreditsRequest {
1829
- orgId: string;
1830
- packageId: string;
1831
- successUrl: string;
1832
- cancelUrl: string;
1833
- }
1834
- /**
1835
- * PurchaseCreditsResponse is the response from purchasing credits
1836
- */
1837
- interface PurchaseCreditsResponse {
1838
- success: boolean;
1839
- sessionId?: string;
1840
- url?: string;
1841
- error?: string;
1842
- }
1843
- /**
1844
- * ConsumeCreditsRequest is the request to consume credits
1845
- */
1846
- interface ConsumeCreditsRequest {
1847
- orgId: string;
1848
- amount: number;
1849
- reason?: string;
1850
- }
1851
- /**
1852
- * ConsumeCreditsResponse is the response from consuming credits
1853
- */
1854
- interface ConsumeCreditsResponse {
1855
- success: boolean;
1856
- consumed: number;
1857
- remaining: number;
1858
- error?: string;
1859
- }
1860
- /**
1861
- * GetPlansRequest is the request to get available plans
1862
- */
1863
- interface GetPlansRequest {
1864
- activeOnly: boolean;
1865
- }
1866
- /**
1867
- * GetPlansResponse is the response with available plans
1868
- */
1869
- interface GetPlansResponse {
1870
- success: boolean;
1871
- plans?: (Plan | undefined)[];
1872
- error?: string;
1873
- }
1874
- /**
1875
- * CreateAffiliateRequest is the request to create an affiliate
1876
- */
1877
- interface CreateAffiliateRequest {
1878
- name: string;
1879
- email: string;
1880
- country: string;
1881
- commissionRate?: number;
1882
- phone?: string;
1883
- }
1884
- /**
1885
- * CreateAffiliateResponse is the response from creating an affiliate
1886
- */
1887
- interface CreateAffiliateResponse {
1888
- success: boolean;
1889
- affiliate?: Affiliate;
1890
- error?: string;
1891
- }
1892
- /**
1893
- * GetAffiliateRequest is the request to get an affiliate
1894
- */
1895
- interface GetAffiliateRequest {
1896
- affiliateId?: string;
1897
- referralCode?: string;
1898
- }
1899
- /**
1900
- * GetAffiliateResponse is the response with affiliate info
1901
- */
1902
- interface GetAffiliateResponse {
1903
- success: boolean;
1904
- affiliate?: Affiliate;
1905
- error?: string;
1906
- }
1907
- /**
1908
- * ListAffiliatesRequest is the request to list affiliates
1909
- */
1910
- interface ListAffiliatesRequest {
1911
- status?: string;
1912
- page?: number;
1913
- pageSize?: number;
1914
- }
1915
- /**
1916
- * ListAffiliatesResponse is the response with affiliate list
1917
- */
1918
- interface ListAffiliatesResponse {
1919
- success: boolean;
1920
- affiliates?: (Affiliate | undefined)[];
1921
- total: number;
1922
- page: number;
1923
- pageSize: number;
1924
- error?: string;
1925
- }
1926
- /**
1927
- * CreateAffiliateOnboardingLinkRequest is the request to create an onboarding link
1928
- */
1929
- interface CreateAffiliateOnboardingLinkRequest {
1930
- affiliateId: string;
1931
- refreshUrl: string;
1932
- returnUrl: string;
1933
- }
1934
- /**
1935
- * CreateAffiliateOnboardingLinkResponse is the response with onboarding link
1936
- */
1937
- interface CreateAffiliateOnboardingLinkResponse {
1938
- success: boolean;
1939
- url?: string;
1940
- error?: string;
1941
- }
1942
- /**
1943
- * GetAffiliateCommissionsRequest is the request to get affiliate commissions
1944
- */
1945
- interface GetAffiliateCommissionsRequest {
1946
- affiliateId: string;
1947
- startDate?: string;
1948
- endDate?: string;
1949
- status?: string;
1950
- page?: number;
1951
- pageSize?: number;
1952
- }
1953
- /**
1954
- * GetAffiliateCommissionsResponse is the response with affiliate commissions
1955
- */
1956
- interface GetAffiliateCommissionsResponse {
1957
- success: boolean;
1958
- commissions?: (AffiliateCommission | undefined)[];
1959
- total: number;
1960
- totalAmount: number;
1961
- page: number;
1962
- pageSize: number;
1963
- error?: string;
1964
- }
1965
- /**
1966
- * GetAffiliateAnalyticsRequest is the request to get affiliate analytics
1967
- */
1968
- interface GetAffiliateAnalyticsRequest {
1969
- affiliateId: string;
1970
- period?: string;
1971
- startDate?: string;
1972
- endDate?: string;
1973
- }
1974
- /**
1975
- * NATS Subjects for Stripe/Subscription operations
1976
- */
1977
- declare const AffiliateAnalytics = "billing.affiliate.analytics";
1978
- /**
1979
- * AffiliateAnalytics represents affiliate analytics data
1980
- */
1981
- interface AffiliateAnalytics {
1982
- affiliateId: string;
1983
- period: string;
1984
- totalReferrals: number;
1985
- activeReferrals: number;
1986
- churnedReferrals: number;
1987
- totalRevenueCents: number;
1988
- totalCommissionsCents: number;
1989
- conversionRate: number;
1990
- avgCustomerLtvCents: number;
1991
- }
1992
- /**
1993
- * GetAffiliateAnalyticsResponse is the response with affiliate analytics
1994
- */
1995
- interface GetAffiliateAnalyticsResponse {
1996
- success: boolean;
1997
- analytics?: AffiliateAnalytics;
1998
- error?: string;
1999
- }
2000
- /**
2001
- * RevenueAnalyticsRequest is the request to get revenue analytics
2002
- */
2003
- interface RevenueAnalyticsRequest {
2004
- period?: string;
2005
- startDate?: string;
2006
- endDate?: string;
2007
- }
2008
- /**
2009
- * RevenueAnalytics represents revenue analytics data
2010
- */
2011
- interface RevenueAnalytics {
2012
- period: string;
2013
- mrrCents: number;
2014
- arrCents: number;
2015
- newMrrCents: number;
2016
- churnedMrrCents: number;
2017
- expansionMrrCents: number;
2018
- contractionMrrCents: number;
2019
- netMrrCents: number;
2020
- totalCustomers: number;
2021
- newCustomers: number;
2022
- churnedCustomers: number;
2023
- churnRate: number;
2024
- }
2025
- /**
2026
- * RevenueAnalyticsResponse is the response with revenue analytics
2027
- */
2028
- interface RevenueAnalyticsResponse {
2029
- success: boolean;
2030
- analytics?: RevenueAnalytics;
2031
- error?: string;
2032
- }
2033
- /**
2034
- * Webhook event types
2035
- */
2036
- interface StripeWebhookEvent {
2037
- type: string;
2038
- data: {
2039
- [key: string]: any;
2040
- };
2041
- eventId: string;
2042
- createdAt: string;
2043
- }
2044
- /**
2045
- * Base subject prefix
2046
- */
2047
- declare const BillingSubjectPrefix = "billing";
2048
- /**
2049
- * Event recording subjects
2050
- */
2051
- declare const BillingEventsRecord = "billing.events.record";
2052
- /**
2053
- * Usage reporting subjects
2054
- */
2055
- declare const BillingUsageReport = "billing.usage.report";
2056
- declare const BillingUsageCurrent = "billing.usage.current";
2057
- declare const BillingUsageHistory = "billing.usage.history";
2058
- declare const BillingUsageCostBreakdown = "billing.usage.breakdown";
2059
- declare const BillingUsageTopCenters = "billing.usage.top_centers";
2060
- /**
2061
- * Invoice subjects
2062
- */
2063
- declare const BillingInvoiceGet = "billing.invoice.get";
2064
- declare const BillingInvoiceCreate = "billing.invoice.create";
2065
- declare const BillingInvoiceProcess = "billing.invoice.process";
2066
- /**
2067
- * Billing period subjects
2068
- */
2069
- declare const BillingPeriodCreate = "billing.period.create";
2070
- declare const BillingPeriodClose = "billing.period.close";
2071
- declare const BillingPeriodProcess = "billing.period.process";
2072
- /**
2073
- * Billing rules subjects
2074
- */
2075
- declare const BillingRulesGet = "billing.rules.get";
2076
- declare const BillingRulesCreate = "billing.rules.create";
2077
- declare const BillingRulesUpdate = "billing.rules.update";
2078
- declare const BillingRulesDelete = "billing.rules.delete";
2079
- /**
2080
- * Organization provisioning
2081
- */
2082
- declare const BillingOrgProvision = "billing.org.provision";
2083
- /**
2084
- * Health check
2085
- */
2086
- declare const BillingHealthCheck = "billing.health.check";
2087
-
2088
- export { type APIError, type APIResponse, type Address, AdminOrgCreate, AdminOrgCreated, AdminOrgDelete, AdminOrgGet, AdminOrgGetByDomain, AdminOrgGetInfo, AdminOrgList, AdminOrgListByMetadata, AdminOrgRolesCreate, AdminOrgRolesDelete, AdminOrgRolesGet, AdminOrgRolesUpdate, AdminOrgUpdate, AdminTeamsCreate, AdminTeamsGetForOrg, AdminTeamsGetOne, AdminTeamsUpdateOnboarding, AdminUsersCreate, AdminUsersDelete, AdminUsersGet, AdminUsersGetForOrg, AdminUsersGetOne, AdminUsersGetOneByEmail, AdminUsersGetSettings, AdminUsersUpdate, AdminUsersUpdateSettings, type Affiliate, AffiliateAnalytics, type AffiliateCommission, AffiliateCommissions, AffiliateCreate, AffiliateGet, AffiliateList, AffiliateOnboard, type AffiliateReferral, AffiliateUpdate, type AgentInfo, type AgentInput, type AgentResult, type AggregateType, AggregateTypeAverage, AggregateTypeCount, AggregateTypeDistinct, AggregateTypeMax, AggregateTypeMin, AggregateTypeSum, AnalyticsChurn, AnalyticsRevenue, AnalyticsUsage, type AzureSettings, type BillingEvent, type BillingEventRequest, type BillingEventResponse, BillingEventsRecord, BillingGetInvoice, BillingGetUsageReport, BillingHealthCheck, BillingInvoiceCreate, BillingInvoiceGet, BillingInvoiceProcess, BillingOrgProvision, type BillingPeriod, BillingPeriodClose, BillingPeriodCreate, BillingPeriodProcess, type BillingPeriodProcessRequest, type BillingPeriodProcessResponse, BillingProcessBillingPeriod, BillingRecordEvent, type BillingResponse, type BillingRule, type BillingRuleRequest, type BillingRuleResponse, BillingRulesCreate, BillingRulesDelete, BillingRulesGet, type BillingRulesRequest, type BillingRulesResponse, BillingRulesUpdate, BillingSubjectPrefix, BillingUsageCostBreakdown, BillingUsageCurrent, BillingUsageHistory, BillingUsageReport, BillingUsageTopCenters, type CancelSubscriptionRequest, type CancelSubscriptionResponse, type ChartSettings, type ChartType, ChartTypeBar, ChartTypeDoughnut, ChartTypeLine, ChartTypeMetic, ChartTypePie, type ConsumeCreditsRequest, type ConsumeCreditsResponse, type CostBreakdown, type CostBreakdownRequest, type CostBreakdownResponse, type CostPreview, type CreateAffiliateOnboardingLinkRequest, type CreateAffiliateOnboardingLinkResponse, type CreateAffiliateRequest, type CreateAffiliateResponse, type CreateCheckoutSessionRequest, type CreateCheckoutSessionResponse, type CreatePaymentLinkRequest, type CreatePaymentLinkResponse, type CreatePortalSessionRequest, type CreatePortalSessionResponse, type CreditBalance, type CreditPackage, CreditsBalance, CreditsConsume, CreditsPurchase, type CurrentUsageRequest, type CurrentUsageResponse, CustomerCreate, CustomerGet, CustomerUpdate, type DataType, DataTypeArray, DataTypeBoolean, DataTypeDate, DataTypeFile, DataTypeFloat, DataTypeInputFields, DataTypeInt, DataTypeJSON, DataTypeObjectList, DataTypeString, type DateValue, type GetAffiliateAnalyticsRequest, type GetAffiliateAnalyticsResponse, type GetAffiliateCommissionsRequest, type GetAffiliateCommissionsResponse, type GetAffiliateRequest, type GetAffiliateResponse, type GetCreditsRequest, type GetCreditsResponse, type GetPlansRequest, type GetPlansResponse, type GetSubscriptionRequest, type GetSubscriptionResponse, type Invite, type InviteInput, type InviteResponse, type InviteSentStatus, type InviteStatus, InviteStatusAccepted, InviteStatusExpired, type InviteStatusOptionTS, InviteStatusPending, InviteStatusRevoked, type InviteStatusTS, InviteStatuses, type InvitesResult, type Invoice, type InvoiceLineItem, type InvoiceRequest, type InvoiceResponse, type JSONSchema, type KnowledgeGraphInfo, type KnowledgeInput, type KnowledgeResult, type ListAffiliatesRequest, type ListAffiliatesResponse, type ListInvitesResponse, type ListOrgRolesResponse, type ListOrgsResponse, type ListUsersResponse, type MetricResult, type NotificationPreferences, type OnboardingCompleteResult, type OnboardingState, type OnboardingStateResponse, type OnboardingStatus, OnboardingStatusCompleted, OnboardingStatusInProgress, OnboardingStatusLegacy, type OnboardingStatusOptionTS, OnboardingStatusPending, OnboardingStatusSkipped, type OnboardingStatusTS, OnboardingStatuses, type OnboardingStep, type Org, type OrgInfo, type OrgInfoResponse, type OrgInput, type OrgOnboarding, type OrgProvisioning, type OrgResponse, type OrgResult, type OrgRole, type OrgRoleResponse, type OrgSize, OrgSizeEnterprise, OrgSizeLarge, OrgSizeMedium, type OrgSizeOptionTS, OrgSizeSmall, OrgSizeSolo, type OrgSizeTS, OrgSizes, type OrgStatus, OrgStatusActive, type OrgStatusOptionTS, OrgStatusSuspended, type OrgStatusTS, OrgStatuses, type OrgSubscription, type OrgSubscriptionStatus, OrgSubscriptionStatusActive, OrgSubscriptionStatusCancelled, type OrgSubscriptionStatusOptionTS, OrgSubscriptionStatusPastDue, type OrgSubscriptionStatusTS, OrgSubscriptionStatusTrialing, OrgSubscriptionStatusUnpaid, OrgSubscriptionStatuses, type OrgTemplate, type OrgType, OrgTypeEnterprise, type OrgTypeOptionTS, OrgTypeSelfServe, type OrgTypeTS, OrgTypes, type OrganizationBilling, type Payment, PaymentLinkCreate, PaymentLinkList, type PaymentSessionInput, type PaymentSessionResult, type Permission, type Plan, PlansGet, PlansGetAll, PortalSessionCreate, type ProductName, ProductNameDocBrain, ProductNameDoneProjects, ProductNameFinance, ProductNameHub, ProductNameLegal, type ProductNameOptionTS, ProductNamePublicSector, ProductNameQuickMind, ProductNameRealEstate, ProductNameShopAssist, type ProductNameTS, ProductNames, type ProvisioningStatus, ProvisioningStatusCompleted, ProvisioningStatusFailed, type ProvisioningStatusOptionTS, ProvisioningStatusPending, ProvisioningStatusRunning, type ProvisioningStatusTS, ProvisioningStatuses, type PurchaseCreditsRequest, type PurchaseCreditsResponse, type ResponseMetadata, type RevenueAnalytics, type RevenueAnalyticsRequest, type RevenueAnalyticsResponse, type RuleCoverage, RulesCreateBillingRule, RulesDeleteBillingRule, RulesGetBillingRules, RulesUpdateBillingRule, type ServiceEvent, type ServiceEventMetadata, type ServiceUsage, type StripeWebhookEvent, SubscriptionCancel, SubscriptionCheckout, SubscriptionCreate, SubscriptionGet, SubscriptionList, type SubscriptionPlatform, SubscriptionPlatformCustom, SubscriptionPlatformStripe, SubscriptionUpdate, type SystemApp, SystemAppAdmin, SystemAppAnalytics, SystemAppCRM, SystemAppDocumentProcessor, SystemAppHelpdesk, SystemAppKnowledgeGraph, SystemAppMarketing, type SystemAppOptionTS, type SystemAppTS, SystemAppWorkflow, SystemApps, type Team, type ThemeOptionTS, ThemeOptions, type TierCost, type TopCostCenter, type UpdateUserSettingsRequest, type UpdateUserStatusRequest, type UpdateUserStatusResponse, UpdateUserStatusSubject, type UsageAggregation, type UsageAlert, UsageAlertThreshold, UsageGetCostBreakdown, UsageGetCurrentUsage, UsageGetTopCostCenters, UsageGetUsageHistory, type UsageHistory, type UsagePeriod, type UsageReport, type UsageReportRequest, type UsageReportResponse, type UsageSummary, type UsageTrends, type User, type UserOnboarding, type UserOrgAccess, type UserResponse, type UserSettings, type UserSettingsResponse, type UserSource, UserSourceAPI, UserSourceInvite, type UserSourceOptionTS, UserSourceSSO, UserSourceSignup, type UserSourceTS, UserSources, type UserStatusTS, type UserUsage, type Variable, type VariableReference, type VariableScope, VariableScopeEdge, VariableScopeGlobal, VariableScopeNode, type VariableValidation, WebhookInvoiceFailed, WebhookInvoicePaid, WebhookPaymentSucceeded, WebhookSubscriptionCanceled, WebhookSubscriptionCreated, WebhookSubscriptionUpdated, type Widget, type WidgetType, WidgetTypeAccounts, WidgetTypeActivities, WidgetTypeCalendar, WidgetTypeChart, WidgetTypeContacts, WidgetTypeEmail, WidgetTypeFiles, WidgetTypeLeads, WidgetTypeNotes, WidgetTypeOpportunities, WidgetTypeOrders, WidgetTypeTasks, type WorkspaceInput, type WorkspaceResult };
257
+ export { type APIError, type APIResponse, type AggregateType, AggregateTypeAverage, AggregateTypeCount, AggregateTypeDistinct, AggregateTypeMax, AggregateTypeMin, AggregateTypeSum, type ChartSettings, type ChartType, ChartTypeBar, ChartTypeDoughnut, ChartTypeLine, ChartTypeMetic, ChartTypePie, type DataType, DataTypeArray, DataTypeBoolean, DataTypeDate, DataTypeFile, DataTypeFloat, DataTypeInputFields, DataTypeInt, DataTypeJSON, DataTypeObjectList, DataTypeString, type DateValue, type JSONSchema, type MetricResult, type ProductName, ProductNameDocBrain, ProductNameDoneProjects, ProductNameFinance, ProductNameHub, ProductNameLegal, type ProductNameOptionTS, ProductNamePublicSector, ProductNameQuickMind, ProductNameRealEstate, ProductNameShopAssist, type ProductNameTS, ProductNames, type ResponseMetadata, type ServiceEvent, type ServiceEventMetadata, type UpdateUserStatusRequest, type UpdateUserStatusResponse, UpdateUserStatusSubject, type UserStatusTS, type Variable, type VariableReference, type VariableScope, VariableScopeEdge, VariableScopeGlobal, VariableScopeNode, type VariableValidation, type Widget, type WidgetType, WidgetTypeAccounts, WidgetTypeActivities, WidgetTypeCalendar, WidgetTypeChart, WidgetTypeContacts, WidgetTypeEmail, WidgetTypeFiles, WidgetTypeLeads, WidgetTypeNotes, WidgetTypeOpportunities, WidgetTypeOrders, WidgetTypeTasks };