@elqnt/admin 2.0.5 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -192
- package/dist/admin-Dlsd5IZ0.d.cts +767 -0
- package/dist/admin-Dlsd5IZ0.d.ts +767 -0
- package/dist/api/index.cjs +213 -27
- package/dist/api/index.cjs.map +1 -1
- package/dist/api/index.d.cts +121 -3
- package/dist/api/index.d.ts +121 -3
- package/dist/api/index.js +192 -27
- package/dist/api/index.js.map +1 -1
- package/dist/hooks/index.cjs +765 -0
- package/dist/hooks/index.cjs.map +1 -0
- package/dist/hooks/index.d.cts +119 -0
- package/dist/hooks/index.d.ts +119 -0
- package/dist/hooks/index.js +735 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/index.cjs +695 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +532 -27
- package/dist/index.js.map +1 -1
- package/dist/models/index.cjs +491 -0
- package/dist/models/index.cjs.map +1 -1
- package/dist/models/index.d.cts +1095 -29
- package/dist/models/index.d.ts +1095 -29
- package/dist/models/index.js +341 -0
- package/dist/models/index.js.map +1 -1
- package/package.json +9 -3
package/dist/models/index.d.cts
CHANGED
|
@@ -1,15 +1,1082 @@
|
|
|
1
|
-
import { ResponseMetadata
|
|
2
|
-
export {
|
|
1
|
+
import { ResponseMetadata } from '@elqnt/types';
|
|
2
|
+
export { A as Address, a as AdminOrgCreate, b as AdminOrgCreated, c as AdminOrgDelete, d as AdminOrgGet, e as AdminOrgGetByDomain, f as AdminOrgGetInfo, g as AdminOrgList, h as AdminOrgListByMetadata, i as AdminOrgRolesCreate, j as AdminOrgRolesDelete, k as AdminOrgRolesGet, l as AdminOrgRolesUpdate, m as AdminOrgUpdate, n as AdminTeamsCreate, o as AdminTeamsGetForOrg, p as AdminTeamsGetOne, q as AdminTeamsUpdateOnboarding, r as AdminUsersCreate, s as AdminUsersDelete, t as AdminUsersGet, u as AdminUsersGetForOrg, v as AdminUsersGetOne, w as AdminUsersGetOneByEmail, x as AdminUsersGetSettings, y as AdminUsersUpdate, z as AdminUsersUpdateSettings, B as AgentInfo, C as AgentInput, D as AgentResult, E as AzureSettings, I as Invite, F as InviteInput, G as InviteResponse, H as InviteSentStatus, J as InviteStatus, K as InviteStatusAccepted, L as InviteStatusExpired, M as InviteStatusOptionTS, N as InviteStatusPending, O as InviteStatusRevoked, P as InviteStatusTS, Q as InviteStatuses, R as InvitesResult, S as KnowledgeGraphInfo, T as KnowledgeInput, U as KnowledgeResult, V as ListInvitesResponse, W as ListOrgRolesResponse, X as ListOrgsResponse, Y as ListUsersResponse, Z as NotificationPreferences, _ as OnboardingCompleteResult, $ as OnboardingState, a0 as OnboardingStateResponse, a1 as OnboardingStatus, a2 as OnboardingStatusCompleted, a3 as OnboardingStatusInProgress, a4 as OnboardingStatusLegacy, a5 as OnboardingStatusOptionTS, a6 as OnboardingStatusPending, a7 as OnboardingStatusSkipped, a8 as OnboardingStatusTS, a9 as OnboardingStatuses, aa as OnboardingStep, ab as Org, ac as OrgInfo, ad as OrgInfoResponse, ae as OrgInput, af as OrgOnboarding, ag as OrgProvisioning, ah as OrgResponse, ai as OrgResult, aj as OrgRole, ak as OrgRoleResponse, al as OrgSize, am as OrgSizeEnterprise, an as OrgSizeLarge, ao as OrgSizeMedium, ap as OrgSizeOptionTS, aq as OrgSizeSmall, ar as OrgSizeSolo, as as OrgSizeTS, at as OrgSizes, au as OrgStatus, av as OrgStatusActive, aw as OrgStatusOptionTS, ax as OrgStatusSuspended, ay as OrgStatusTS, az as OrgStatuses, aA as OrgSubscription, aB as OrgSubscriptionStatus, aC as OrgSubscriptionStatusActive, aD as OrgSubscriptionStatusCancelled, aE as OrgSubscriptionStatusOptionTS, aF as OrgSubscriptionStatusPastDue, aG as OrgSubscriptionStatusTS, aH as OrgSubscriptionStatusTrialing, aI as OrgSubscriptionStatusUnpaid, aJ as OrgSubscriptionStatuses, aK as OrgTemplate, aL as OrgType, aM as OrgTypeEnterprise, aN as OrgTypeOptionTS, aO as OrgTypeSelfServe, aP as OrgTypeTS, aQ as OrgTypes, aR as PaymentSessionInput, aS as PaymentSessionResult, aT as Permission, aU as ProvisioningStatus, aV as ProvisioningStatusCompleted, aW as ProvisioningStatusFailed, aX as ProvisioningStatusOptionTS, aY as ProvisioningStatusPending, aZ as ProvisioningStatusRunning, a_ as ProvisioningStatusTS, a$ as ProvisioningStatuses, b0 as SubscriptionPlatform, b1 as SubscriptionPlatformCustom, b2 as SubscriptionPlatformStripe, b3 as SystemApp, b4 as SystemAppAdmin, b5 as SystemAppAnalytics, b6 as SystemAppCRM, b7 as SystemAppDocumentProcessor, b8 as SystemAppHelpdesk, b9 as SystemAppKnowledgeGraph, ba as SystemAppMarketing, bb as SystemAppOptionTS, bc as SystemAppTS, bd as SystemAppWorkflow, be as SystemApps, bf as Team, bg as ThemeOptionTS, bh as ThemeOptions, bi as UpdateUserSettingsRequest, bj as User, bk as UserOnboarding, bl as UserOrgAccess, bm as UserResponse, bn as UserSettings, bo as UserSettingsResponse, bp as UserSource, bq as UserSourceAPI, br as UserSourceInvite, bs as UserSourceOptionTS, bt as UserSourceSSO, bu as UserSourceSignup, bv as UserSourceTS, bw as UserSources, bx as WorkspaceInput, by as WorkspaceResult } from '../admin-Dlsd5IZ0.cjs';
|
|
3
3
|
export { OrgSettings, OrgSettingsRequest, OrgSettingsResponse } from '@elqnt/agents/models';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Billing event handlers
|
|
7
|
+
*/
|
|
8
|
+
declare const BillingRecordEvent = "billing.events.record";
|
|
9
|
+
/**
|
|
10
|
+
* NATS Subject constants
|
|
11
|
+
*/
|
|
12
|
+
declare const BillingGetUsageReport = "billing.usage.report";
|
|
13
|
+
/**
|
|
14
|
+
* NATS Subject constants
|
|
15
|
+
*/
|
|
16
|
+
declare const BillingGetInvoice = "billing.invoice.get";
|
|
17
|
+
/**
|
|
18
|
+
* NATS Subject constants
|
|
19
|
+
*/
|
|
20
|
+
declare const BillingProcessBillingPeriod = "billing.period.process";
|
|
21
|
+
/**
|
|
22
|
+
* Usage handlers
|
|
23
|
+
*/
|
|
24
|
+
declare const UsageGetCurrentUsage = "billing.usage.current";
|
|
25
|
+
/**
|
|
26
|
+
* NATS Subject constants
|
|
27
|
+
*/
|
|
28
|
+
declare const UsageGetUsageHistory = "billing.usage.history";
|
|
29
|
+
/**
|
|
30
|
+
* NATS Subject constants
|
|
31
|
+
*/
|
|
32
|
+
declare const UsageGetCostBreakdown = "billing.usage.breakdown";
|
|
33
|
+
/**
|
|
34
|
+
* NATS Subject constants
|
|
35
|
+
*/
|
|
36
|
+
declare const UsageGetTopCostCenters = "billing.usage.top_centers";
|
|
37
|
+
/**
|
|
38
|
+
* Rules handlers
|
|
39
|
+
*/
|
|
40
|
+
declare const RulesGetBillingRules = "billing.rules.get";
|
|
41
|
+
/**
|
|
42
|
+
* NATS Subject constants
|
|
43
|
+
*/
|
|
44
|
+
declare const RulesCreateBillingRule = "billing.rules.create";
|
|
45
|
+
/**
|
|
46
|
+
* NATS Subject constants
|
|
47
|
+
*/
|
|
48
|
+
declare const RulesUpdateBillingRule = "billing.rules.update";
|
|
49
|
+
/**
|
|
50
|
+
* NATS Subject constants
|
|
51
|
+
*/
|
|
52
|
+
declare const RulesDeleteBillingRule = "billing.rules.delete";
|
|
53
|
+
interface BillingEvent {
|
|
54
|
+
/**
|
|
55
|
+
* Core identifiers
|
|
56
|
+
*/
|
|
57
|
+
org_id: string;
|
|
58
|
+
event_id: string;
|
|
59
|
+
user_id: string;
|
|
60
|
+
customer_id: string;
|
|
61
|
+
/**
|
|
62
|
+
* Event details
|
|
63
|
+
*/
|
|
64
|
+
event_type: string;
|
|
65
|
+
event_subtype: string;
|
|
66
|
+
timestamp: string;
|
|
67
|
+
/**
|
|
68
|
+
* Billing metrics
|
|
69
|
+
*/
|
|
70
|
+
billable_units: number;
|
|
71
|
+
unit_type: string;
|
|
72
|
+
cost_per_unit: number;
|
|
73
|
+
total_cost: number;
|
|
74
|
+
/**
|
|
75
|
+
* Context
|
|
76
|
+
*/
|
|
77
|
+
service_name: string;
|
|
78
|
+
session_id: string;
|
|
79
|
+
parent_event_id: string;
|
|
80
|
+
/**
|
|
81
|
+
* Resource consumption
|
|
82
|
+
*/
|
|
83
|
+
input_tokens: number;
|
|
84
|
+
output_tokens: number;
|
|
85
|
+
processing_time_ms: number;
|
|
86
|
+
/**
|
|
87
|
+
* Product context
|
|
88
|
+
*/
|
|
89
|
+
product_tier: string;
|
|
90
|
+
feature_name: string;
|
|
91
|
+
plan_id: string;
|
|
92
|
+
/**
|
|
93
|
+
* Metadata
|
|
94
|
+
*/
|
|
95
|
+
metadata: {
|
|
96
|
+
[key: string]: any;
|
|
97
|
+
};
|
|
98
|
+
created_by: string;
|
|
99
|
+
}
|
|
100
|
+
interface UsageReport {
|
|
101
|
+
org_id: string;
|
|
102
|
+
period_start: string;
|
|
103
|
+
period_end: string;
|
|
104
|
+
total_cost: number;
|
|
105
|
+
currency: string;
|
|
106
|
+
service_breakdowns: ServiceUsage[];
|
|
107
|
+
generated_at: string;
|
|
108
|
+
}
|
|
109
|
+
interface ServiceUsage {
|
|
110
|
+
service_name: string;
|
|
111
|
+
event_type: string;
|
|
112
|
+
unit_type: string;
|
|
113
|
+
total_units: number;
|
|
114
|
+
total_cost: number;
|
|
115
|
+
total_events: number;
|
|
116
|
+
unique_users: number;
|
|
117
|
+
unique_sessions: number;
|
|
118
|
+
total_input_tokens: number;
|
|
119
|
+
total_output_tokens: number;
|
|
120
|
+
total_processing_time: number;
|
|
121
|
+
}
|
|
122
|
+
interface BillingRule {
|
|
123
|
+
rule_id: string;
|
|
124
|
+
org_id: string;
|
|
125
|
+
service_name: string;
|
|
126
|
+
event_type: string;
|
|
127
|
+
unit_type: string;
|
|
128
|
+
/**
|
|
129
|
+
* Tiered pricing
|
|
130
|
+
*/
|
|
131
|
+
base_cost: number;
|
|
132
|
+
tier_1_threshold: number;
|
|
133
|
+
tier_1_cost: number;
|
|
134
|
+
tier_2_threshold: number;
|
|
135
|
+
tier_2_cost: number;
|
|
136
|
+
tier_3_threshold: number;
|
|
137
|
+
tier_3_cost: number;
|
|
138
|
+
/**
|
|
139
|
+
* Validity
|
|
140
|
+
*/
|
|
141
|
+
effective_from: string;
|
|
142
|
+
effective_to: string;
|
|
143
|
+
is_active: boolean;
|
|
144
|
+
created_at: string;
|
|
145
|
+
updated_at: string;
|
|
146
|
+
}
|
|
147
|
+
interface BillingPeriod {
|
|
148
|
+
period_id: string;
|
|
149
|
+
org_id: string;
|
|
150
|
+
period_start: string;
|
|
151
|
+
period_end: string;
|
|
152
|
+
status: string;
|
|
153
|
+
billing_cycle: string;
|
|
154
|
+
created_at: string;
|
|
155
|
+
}
|
|
156
|
+
interface Invoice {
|
|
157
|
+
invoice_id: string;
|
|
158
|
+
org_id: string;
|
|
159
|
+
period_id: string;
|
|
160
|
+
period_start: string;
|
|
161
|
+
period_end: string;
|
|
162
|
+
line_items: InvoiceLineItem[];
|
|
163
|
+
subtotal_amount: number;
|
|
164
|
+
tax_amount: number;
|
|
165
|
+
total_amount: number;
|
|
166
|
+
currency: string;
|
|
167
|
+
status: string;
|
|
168
|
+
generated_at: string;
|
|
169
|
+
due_date: string;
|
|
170
|
+
payment_method_id: string;
|
|
171
|
+
}
|
|
172
|
+
interface InvoiceLineItem {
|
|
173
|
+
line_item_id: string;
|
|
174
|
+
service_name: string;
|
|
175
|
+
event_type: string;
|
|
176
|
+
unit_type: string;
|
|
177
|
+
description: string;
|
|
178
|
+
quantity: number;
|
|
179
|
+
unit_price: number;
|
|
180
|
+
total_price: number;
|
|
181
|
+
}
|
|
182
|
+
interface BillingEventRequest {
|
|
183
|
+
BillingEvent: BillingEvent;
|
|
184
|
+
}
|
|
185
|
+
interface BillingEventResponse {
|
|
186
|
+
success: boolean;
|
|
187
|
+
error?: string;
|
|
188
|
+
}
|
|
189
|
+
interface UsageReportRequest {
|
|
190
|
+
org_id: string;
|
|
191
|
+
period_start: string;
|
|
192
|
+
period_end: string;
|
|
193
|
+
}
|
|
194
|
+
interface UsageReportResponse {
|
|
195
|
+
success: boolean;
|
|
196
|
+
data?: UsageReport;
|
|
197
|
+
error?: string;
|
|
198
|
+
}
|
|
199
|
+
interface CurrentUsageRequest {
|
|
200
|
+
org_id: string;
|
|
201
|
+
service_name: string;
|
|
202
|
+
event_type: string;
|
|
203
|
+
}
|
|
204
|
+
interface CurrentUsageResponse {
|
|
205
|
+
success: boolean;
|
|
206
|
+
data?: {
|
|
207
|
+
[key: string]: any;
|
|
208
|
+
};
|
|
209
|
+
error?: string;
|
|
210
|
+
}
|
|
211
|
+
interface CostBreakdownRequest {
|
|
212
|
+
org_id: string;
|
|
213
|
+
period_start: string;
|
|
214
|
+
period_end: string;
|
|
215
|
+
group_by: string;
|
|
216
|
+
}
|
|
217
|
+
interface CostBreakdownResponse {
|
|
218
|
+
success: boolean;
|
|
219
|
+
data?: CostBreakdown[];
|
|
220
|
+
error?: string;
|
|
221
|
+
}
|
|
222
|
+
interface CostBreakdown {
|
|
223
|
+
group_value: string;
|
|
224
|
+
total_cost: number;
|
|
225
|
+
total_units: number;
|
|
226
|
+
event_count: number;
|
|
227
|
+
}
|
|
228
|
+
interface BillingRuleRequest {
|
|
229
|
+
BillingRule: BillingRule;
|
|
230
|
+
}
|
|
231
|
+
interface BillingRuleResponse {
|
|
232
|
+
success: boolean;
|
|
233
|
+
data?: BillingRule;
|
|
234
|
+
error?: string;
|
|
235
|
+
}
|
|
236
|
+
interface BillingRulesRequest {
|
|
237
|
+
org_id: string;
|
|
238
|
+
service_name: string;
|
|
239
|
+
event_type: string;
|
|
240
|
+
}
|
|
241
|
+
interface BillingRulesResponse {
|
|
242
|
+
success: boolean;
|
|
243
|
+
data?: (BillingRule | undefined)[];
|
|
244
|
+
error?: string;
|
|
245
|
+
}
|
|
246
|
+
interface InvoiceRequest {
|
|
247
|
+
org_id: string;
|
|
248
|
+
period_id: string;
|
|
249
|
+
invoice_id: string;
|
|
250
|
+
}
|
|
251
|
+
interface InvoiceResponse {
|
|
252
|
+
success: boolean;
|
|
253
|
+
data?: Invoice;
|
|
254
|
+
error?: string;
|
|
255
|
+
}
|
|
256
|
+
interface BillingPeriodProcessRequest {
|
|
257
|
+
org_id: string;
|
|
258
|
+
period_id: string;
|
|
259
|
+
}
|
|
260
|
+
interface BillingPeriodProcessResponse {
|
|
261
|
+
success: boolean;
|
|
262
|
+
invoice_id?: string;
|
|
263
|
+
error?: string;
|
|
264
|
+
}
|
|
265
|
+
interface UsageAggregation {
|
|
266
|
+
org_id: string;
|
|
267
|
+
period_id: string;
|
|
268
|
+
date: string;
|
|
269
|
+
hour: number;
|
|
270
|
+
service_name: string;
|
|
271
|
+
event_type: string;
|
|
272
|
+
unit_type: string;
|
|
273
|
+
total_units: number;
|
|
274
|
+
total_events: number;
|
|
275
|
+
total_cost: number;
|
|
276
|
+
unique_users: number;
|
|
277
|
+
unique_sessions: number;
|
|
278
|
+
total_input_tokens: number;
|
|
279
|
+
total_output_tokens: number;
|
|
280
|
+
total_processing_time: number;
|
|
281
|
+
created_at: string;
|
|
282
|
+
}
|
|
283
|
+
interface TopCostCenter {
|
|
284
|
+
service_name: string;
|
|
285
|
+
event_type: string;
|
|
286
|
+
total_cost: number;
|
|
287
|
+
total_units: number;
|
|
288
|
+
event_count: number;
|
|
289
|
+
percentage: number;
|
|
290
|
+
}
|
|
291
|
+
interface UsageHistory {
|
|
292
|
+
date: string;
|
|
293
|
+
total_cost: number;
|
|
294
|
+
total_units: number;
|
|
295
|
+
event_count: number;
|
|
296
|
+
unique_users: number;
|
|
297
|
+
}
|
|
298
|
+
interface UserUsage {
|
|
299
|
+
user_id: string;
|
|
300
|
+
total_cost: number;
|
|
301
|
+
total_units: number;
|
|
302
|
+
event_count: number;
|
|
303
|
+
last_activity: string;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Usage trends and analytics models
|
|
307
|
+
*/
|
|
308
|
+
interface UsageTrends {
|
|
309
|
+
org_id: string;
|
|
310
|
+
days: number;
|
|
311
|
+
trend: string;
|
|
312
|
+
direction: string;
|
|
313
|
+
change_percent: number;
|
|
314
|
+
recent_week_cost: number;
|
|
315
|
+
previous_week_cost: number;
|
|
316
|
+
}
|
|
317
|
+
interface UsageAlert {
|
|
318
|
+
type: string;
|
|
319
|
+
severity: string;
|
|
320
|
+
message: string;
|
|
321
|
+
current_value: number;
|
|
322
|
+
threshold_value: number;
|
|
323
|
+
created_at: string;
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Cost preview models
|
|
327
|
+
*/
|
|
328
|
+
interface CostPreview {
|
|
329
|
+
units: number;
|
|
330
|
+
total_cost: number;
|
|
331
|
+
cost_per_unit: number;
|
|
332
|
+
tier_breakdown: TierCost[];
|
|
333
|
+
rule?: BillingRule;
|
|
334
|
+
}
|
|
335
|
+
interface TierCost {
|
|
336
|
+
tier: string;
|
|
337
|
+
units: number;
|
|
338
|
+
rate: number;
|
|
339
|
+
cost: number;
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Rule coverage models
|
|
343
|
+
*/
|
|
344
|
+
interface RuleCoverage {
|
|
345
|
+
org_id: string;
|
|
346
|
+
total_services: number;
|
|
347
|
+
covered_services: {
|
|
348
|
+
[key: string]: boolean;
|
|
349
|
+
};
|
|
350
|
+
missing_rules: string[];
|
|
351
|
+
rule_count: number;
|
|
352
|
+
coverage_percentage: number;
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Generic Response
|
|
356
|
+
*/
|
|
357
|
+
interface BillingResponse {
|
|
358
|
+
success: boolean;
|
|
359
|
+
data?: any;
|
|
360
|
+
error?: string;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Subscription management
|
|
364
|
+
*/
|
|
365
|
+
declare const SubscriptionCreate = "billing.subscription.create";
|
|
366
|
+
/**
|
|
367
|
+
* NATS Subjects for Stripe/Subscription operations
|
|
368
|
+
*/
|
|
369
|
+
declare const SubscriptionGet = "billing.subscription.get";
|
|
370
|
+
/**
|
|
371
|
+
* NATS Subjects for Stripe/Subscription operations
|
|
372
|
+
*/
|
|
373
|
+
declare const SubscriptionUpdate = "billing.subscription.update";
|
|
374
|
+
/**
|
|
375
|
+
* NATS Subjects for Stripe/Subscription operations
|
|
376
|
+
*/
|
|
377
|
+
declare const SubscriptionCancel = "billing.subscription.cancel";
|
|
378
|
+
/**
|
|
379
|
+
* NATS Subjects for Stripe/Subscription operations
|
|
380
|
+
*/
|
|
381
|
+
declare const SubscriptionList = "billing.subscription.list";
|
|
382
|
+
/**
|
|
383
|
+
* NATS Subjects for Stripe/Subscription operations
|
|
384
|
+
*/
|
|
385
|
+
declare const SubscriptionCheckout = "billing.subscription.checkout";
|
|
386
|
+
/**
|
|
387
|
+
* Payment links
|
|
388
|
+
*/
|
|
389
|
+
declare const PaymentLinkCreate = "billing.payment-link.create";
|
|
390
|
+
/**
|
|
391
|
+
* NATS Subjects for Stripe/Subscription operations
|
|
392
|
+
*/
|
|
393
|
+
declare const PaymentLinkList = "billing.payment-link.list";
|
|
394
|
+
/**
|
|
395
|
+
* Customer portal
|
|
396
|
+
*/
|
|
397
|
+
declare const PortalSessionCreate = "billing.portal.create";
|
|
398
|
+
/**
|
|
399
|
+
* Customer management
|
|
400
|
+
*/
|
|
401
|
+
declare const CustomerCreate = "billing.customer.create";
|
|
402
|
+
/**
|
|
403
|
+
* NATS Subjects for Stripe/Subscription operations
|
|
404
|
+
*/
|
|
405
|
+
declare const CustomerGet = "billing.customer.get";
|
|
406
|
+
/**
|
|
407
|
+
* NATS Subjects for Stripe/Subscription operations
|
|
408
|
+
*/
|
|
409
|
+
declare const CustomerUpdate = "billing.customer.update";
|
|
410
|
+
/**
|
|
411
|
+
* Credits
|
|
412
|
+
*/
|
|
413
|
+
declare const CreditsBalance = "billing.credits.balance";
|
|
414
|
+
/**
|
|
415
|
+
* NATS Subjects for Stripe/Subscription operations
|
|
416
|
+
*/
|
|
417
|
+
declare const CreditsPurchase = "billing.credits.purchase";
|
|
418
|
+
/**
|
|
419
|
+
* NATS Subjects for Stripe/Subscription operations
|
|
420
|
+
*/
|
|
421
|
+
declare const CreditsConsume = "billing.credits.consume";
|
|
422
|
+
/**
|
|
423
|
+
* Plans
|
|
424
|
+
*/
|
|
425
|
+
declare const PlansGet = "billing.plans.get";
|
|
426
|
+
/**
|
|
427
|
+
* NATS Subjects for Stripe/Subscription operations
|
|
428
|
+
*/
|
|
429
|
+
declare const PlansGetAll = "billing.plans.list";
|
|
430
|
+
/**
|
|
431
|
+
* Usage alerts
|
|
432
|
+
*/
|
|
433
|
+
declare const UsageAlertThreshold = "billing.usage.alert";
|
|
434
|
+
/**
|
|
435
|
+
* Webhooks (internal events)
|
|
436
|
+
*/
|
|
437
|
+
declare const WebhookSubscriptionCreated = "billing.webhook.subscription.created";
|
|
438
|
+
/**
|
|
439
|
+
* NATS Subjects for Stripe/Subscription operations
|
|
440
|
+
*/
|
|
441
|
+
declare const WebhookSubscriptionUpdated = "billing.webhook.subscription.updated";
|
|
442
|
+
/**
|
|
443
|
+
* NATS Subjects for Stripe/Subscription operations
|
|
444
|
+
*/
|
|
445
|
+
declare const WebhookSubscriptionCanceled = "billing.webhook.subscription.canceled";
|
|
446
|
+
/**
|
|
447
|
+
* NATS Subjects for Stripe/Subscription operations
|
|
448
|
+
*/
|
|
449
|
+
declare const WebhookInvoicePaid = "billing.webhook.invoice.paid";
|
|
450
|
+
/**
|
|
451
|
+
* NATS Subjects for Stripe/Subscription operations
|
|
452
|
+
*/
|
|
453
|
+
declare const WebhookInvoiceFailed = "billing.webhook.invoice.failed";
|
|
454
|
+
/**
|
|
455
|
+
* NATS Subjects for Stripe/Subscription operations
|
|
456
|
+
*/
|
|
457
|
+
declare const WebhookPaymentSucceeded = "billing.webhook.payment.succeeded";
|
|
458
|
+
/**
|
|
459
|
+
* Affiliates
|
|
460
|
+
*/
|
|
461
|
+
declare const AffiliateCreate = "billing.affiliate.create";
|
|
462
|
+
/**
|
|
463
|
+
* NATS Subjects for Stripe/Subscription operations
|
|
464
|
+
*/
|
|
465
|
+
declare const AffiliateGet = "billing.affiliate.get";
|
|
466
|
+
/**
|
|
467
|
+
* NATS Subjects for Stripe/Subscription operations
|
|
468
|
+
*/
|
|
469
|
+
declare const AffiliateList = "billing.affiliate.list";
|
|
470
|
+
/**
|
|
471
|
+
* NATS Subjects for Stripe/Subscription operations
|
|
472
|
+
*/
|
|
473
|
+
declare const AffiliateUpdate = "billing.affiliate.update";
|
|
474
|
+
/**
|
|
475
|
+
* NATS Subjects for Stripe/Subscription operations
|
|
476
|
+
*/
|
|
477
|
+
declare const AffiliateOnboard = "billing.affiliate.onboard";
|
|
478
|
+
/**
|
|
479
|
+
* NATS Subjects for Stripe/Subscription operations
|
|
480
|
+
*/
|
|
481
|
+
declare const AffiliateCommissions = "billing.affiliate.commissions";
|
|
482
|
+
/**
|
|
483
|
+
* Analytics
|
|
484
|
+
*/
|
|
485
|
+
declare const AnalyticsRevenue = "billing.analytics.revenue";
|
|
486
|
+
/**
|
|
487
|
+
* NATS Subjects for Stripe/Subscription operations
|
|
488
|
+
*/
|
|
489
|
+
declare const AnalyticsUsage = "billing.analytics.usage";
|
|
490
|
+
/**
|
|
491
|
+
* NATS Subjects for Stripe/Subscription operations
|
|
492
|
+
*/
|
|
493
|
+
declare const AnalyticsChurn = "billing.analytics.churn";
|
|
494
|
+
/**
|
|
495
|
+
* Plan represents a subscription plan
|
|
496
|
+
*/
|
|
497
|
+
interface Plan {
|
|
498
|
+
id: string;
|
|
499
|
+
stripeProductId?: string;
|
|
500
|
+
stripePriceId?: string;
|
|
501
|
+
name: string;
|
|
502
|
+
tier: string;
|
|
503
|
+
priceCents: number;
|
|
504
|
+
currency: string;
|
|
505
|
+
billingInterval: string;
|
|
506
|
+
chatSessionsLimit: number;
|
|
507
|
+
tokenAllowance: number;
|
|
508
|
+
agentsLimit: number;
|
|
509
|
+
usersLimit: number;
|
|
510
|
+
knowledgeGraphMb: number;
|
|
511
|
+
tokenOverageRateCents: number;
|
|
512
|
+
sessionOverageRateCents: number;
|
|
513
|
+
features: {
|
|
514
|
+
[key: string]: any;
|
|
515
|
+
};
|
|
516
|
+
isActive: boolean;
|
|
517
|
+
createdAt: string;
|
|
518
|
+
updatedAt: string;
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* OrganizationBilling represents an organization's billing info
|
|
522
|
+
*/
|
|
523
|
+
interface OrganizationBilling {
|
|
524
|
+
orgId: string;
|
|
525
|
+
stripeCustomerId?: string;
|
|
526
|
+
stripeSubscriptionId?: string;
|
|
527
|
+
planId?: string;
|
|
528
|
+
plan?: Plan;
|
|
529
|
+
status: string;
|
|
530
|
+
currentPeriodStart?: string;
|
|
531
|
+
currentPeriodEnd?: string;
|
|
532
|
+
trialStart?: string;
|
|
533
|
+
trialEnd?: string;
|
|
534
|
+
billingEmail?: string;
|
|
535
|
+
billingName?: string;
|
|
536
|
+
affiliateCode?: string;
|
|
537
|
+
createdAt: string;
|
|
538
|
+
updatedAt: string;
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* CreditBalance represents a credit balance entry
|
|
542
|
+
*/
|
|
543
|
+
interface CreditBalance {
|
|
544
|
+
id: string;
|
|
545
|
+
orgId: string;
|
|
546
|
+
creditType: string;
|
|
547
|
+
amount: number;
|
|
548
|
+
remaining: number;
|
|
549
|
+
description?: string;
|
|
550
|
+
expiresAt?: string;
|
|
551
|
+
stripePaymentId?: string;
|
|
552
|
+
createdAt: string;
|
|
553
|
+
}
|
|
554
|
+
/**
|
|
555
|
+
* CreditPackage represents a purchasable credit package
|
|
556
|
+
*/
|
|
557
|
+
interface CreditPackage {
|
|
558
|
+
id: string;
|
|
559
|
+
stripeProductId?: string;
|
|
560
|
+
stripePriceId?: string;
|
|
561
|
+
name: string;
|
|
562
|
+
tokens: number;
|
|
563
|
+
priceCents: number;
|
|
564
|
+
currency: string;
|
|
565
|
+
bonusTokens: number;
|
|
566
|
+
isActive: boolean;
|
|
567
|
+
createdAt: string;
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* UsagePeriod represents usage within a billing period
|
|
571
|
+
*/
|
|
572
|
+
interface UsagePeriod {
|
|
573
|
+
id: string;
|
|
574
|
+
orgId: string;
|
|
575
|
+
periodStart: string;
|
|
576
|
+
periodEnd: string;
|
|
577
|
+
tokensUsed: number;
|
|
578
|
+
sessionsUsed: number;
|
|
579
|
+
tokensAllowance: number;
|
|
580
|
+
sessionsAllowance: number;
|
|
581
|
+
tokensOverage: number;
|
|
582
|
+
sessionsOverage: number;
|
|
583
|
+
overageChargedCents: number;
|
|
584
|
+
status: string;
|
|
585
|
+
stripeUsageRecordId?: string;
|
|
586
|
+
createdAt: string;
|
|
587
|
+
updatedAt: string;
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* UsageSummary provides a summary of current usage
|
|
591
|
+
*/
|
|
592
|
+
interface UsageSummary {
|
|
593
|
+
orgId: string;
|
|
594
|
+
planTier: string;
|
|
595
|
+
billingPeriodStart: string;
|
|
596
|
+
billingPeriodEnd: string;
|
|
597
|
+
daysRemaining: number;
|
|
598
|
+
/**
|
|
599
|
+
* Token usage
|
|
600
|
+
*/
|
|
601
|
+
tokensUsed: number;
|
|
602
|
+
tokensAllowance: number;
|
|
603
|
+
tokensPercentage: number;
|
|
604
|
+
tokensRemaining: number;
|
|
605
|
+
/**
|
|
606
|
+
* Session usage
|
|
607
|
+
*/
|
|
608
|
+
sessionsUsed: number;
|
|
609
|
+
sessionsAllowance: number;
|
|
610
|
+
sessionsPercentage: number;
|
|
611
|
+
sessionsRemaining: number;
|
|
612
|
+
/**
|
|
613
|
+
* Credits
|
|
614
|
+
*/
|
|
615
|
+
creditsRemaining: number;
|
|
616
|
+
/**
|
|
617
|
+
* Projected overage
|
|
618
|
+
*/
|
|
619
|
+
projectedTokenOverage: number;
|
|
620
|
+
projectedSessionOverage: number;
|
|
621
|
+
projectedOverageCents: number;
|
|
622
|
+
}
|
|
623
|
+
/**
|
|
624
|
+
* Affiliate represents an affiliate partner
|
|
625
|
+
*/
|
|
626
|
+
interface Affiliate {
|
|
627
|
+
id: string;
|
|
628
|
+
name: string;
|
|
629
|
+
email: string;
|
|
630
|
+
stripeAccountId?: string;
|
|
631
|
+
status: string;
|
|
632
|
+
commissionRate: number;
|
|
633
|
+
commissionType: string;
|
|
634
|
+
referralCode: string;
|
|
635
|
+
referralLink: string;
|
|
636
|
+
totalEarningsCents: number;
|
|
637
|
+
pendingPayoutCents: number;
|
|
638
|
+
onboardingCompleted: boolean;
|
|
639
|
+
onboardingCompletedAt?: string;
|
|
640
|
+
country?: string;
|
|
641
|
+
phone?: string;
|
|
642
|
+
createdAt: string;
|
|
643
|
+
updatedAt: string;
|
|
644
|
+
}
|
|
645
|
+
/**
|
|
646
|
+
* AffiliateReferral represents a customer referred by an affiliate
|
|
647
|
+
*/
|
|
648
|
+
interface AffiliateReferral {
|
|
649
|
+
id: string;
|
|
650
|
+
affiliateId: string;
|
|
651
|
+
customerOrgId: string;
|
|
652
|
+
stripeCustomerId?: string;
|
|
653
|
+
status: string;
|
|
654
|
+
firstPurchaseAt?: string;
|
|
655
|
+
totalRevenueCents: number;
|
|
656
|
+
totalCommissionCents: number;
|
|
657
|
+
createdAt: string;
|
|
658
|
+
updatedAt: string;
|
|
659
|
+
}
|
|
660
|
+
/**
|
|
661
|
+
* AffiliateCommission represents a commission payment to an affiliate
|
|
662
|
+
*/
|
|
663
|
+
interface AffiliateCommission {
|
|
664
|
+
id: string;
|
|
665
|
+
affiliateId: string;
|
|
666
|
+
referralId: string;
|
|
667
|
+
stripePaymentId?: string;
|
|
668
|
+
stripeTransferId?: string;
|
|
669
|
+
stripeInvoiceId?: string;
|
|
670
|
+
grossAmountCents: number;
|
|
671
|
+
commissionAmountCents: number;
|
|
672
|
+
commissionRate: number;
|
|
673
|
+
currency: string;
|
|
674
|
+
status: string;
|
|
675
|
+
createdAt: string;
|
|
676
|
+
paidAt?: string;
|
|
677
|
+
}
|
|
678
|
+
/**
|
|
679
|
+
* Payment represents a payment record
|
|
680
|
+
*/
|
|
681
|
+
interface Payment {
|
|
682
|
+
id: string;
|
|
683
|
+
orgId: string;
|
|
684
|
+
stripePaymentIntentId?: string;
|
|
685
|
+
stripeInvoiceId?: string;
|
|
686
|
+
stripeSubscriptionId?: string;
|
|
687
|
+
amountCents: number;
|
|
688
|
+
currency: string;
|
|
689
|
+
status: string;
|
|
690
|
+
paymentType: string;
|
|
691
|
+
customerEmail?: string;
|
|
692
|
+
paymentMethod?: string;
|
|
693
|
+
description?: string;
|
|
694
|
+
metadata?: {
|
|
695
|
+
[key: string]: any;
|
|
696
|
+
};
|
|
697
|
+
createdAt: string;
|
|
698
|
+
updatedAt: string;
|
|
699
|
+
}
|
|
700
|
+
/**
|
|
701
|
+
* CreatePaymentLinkRequest is the request to create a payment link
|
|
702
|
+
*/
|
|
703
|
+
interface CreatePaymentLinkRequest {
|
|
704
|
+
orgId: string;
|
|
705
|
+
priceId: string;
|
|
706
|
+
successUrl: string;
|
|
707
|
+
cancelUrl: string;
|
|
708
|
+
customerEmail?: string;
|
|
709
|
+
affiliateCode?: string;
|
|
710
|
+
quantity?: number;
|
|
711
|
+
metadata?: {
|
|
712
|
+
[key: string]: string;
|
|
713
|
+
};
|
|
714
|
+
}
|
|
715
|
+
/**
|
|
716
|
+
* CreatePaymentLinkResponse is the response from creating a payment link
|
|
717
|
+
*/
|
|
718
|
+
interface CreatePaymentLinkResponse {
|
|
719
|
+
success: boolean;
|
|
720
|
+
url?: string;
|
|
721
|
+
paymentLinkId?: string;
|
|
722
|
+
error?: string;
|
|
723
|
+
}
|
|
724
|
+
/**
|
|
725
|
+
* CreatePortalSessionRequest is the request to create a billing portal session
|
|
726
|
+
*/
|
|
727
|
+
interface CreatePortalSessionRequest {
|
|
728
|
+
orgId: string;
|
|
729
|
+
returnUrl: string;
|
|
730
|
+
}
|
|
731
|
+
/**
|
|
732
|
+
* CreatePortalSessionResponse is the response from creating a portal session
|
|
733
|
+
*/
|
|
734
|
+
interface CreatePortalSessionResponse {
|
|
735
|
+
success: boolean;
|
|
736
|
+
url?: string;
|
|
737
|
+
error?: string;
|
|
738
|
+
}
|
|
739
|
+
/**
|
|
740
|
+
* CreateCheckoutSessionRequest is the request to create a checkout session
|
|
741
|
+
*/
|
|
742
|
+
interface CreateCheckoutSessionRequest {
|
|
743
|
+
orgId: string;
|
|
744
|
+
priceId: string;
|
|
745
|
+
successUrl: string;
|
|
746
|
+
cancelUrl: string;
|
|
747
|
+
customerEmail?: string;
|
|
748
|
+
affiliateCode?: string;
|
|
749
|
+
trialDays?: number;
|
|
750
|
+
metadata?: {
|
|
751
|
+
[key: string]: string;
|
|
752
|
+
};
|
|
753
|
+
}
|
|
754
|
+
/**
|
|
755
|
+
* CreateCheckoutSessionResponse is the response from creating a checkout session
|
|
756
|
+
*/
|
|
757
|
+
interface CreateCheckoutSessionResponse {
|
|
758
|
+
success: boolean;
|
|
759
|
+
sessionId?: string;
|
|
760
|
+
url?: string;
|
|
761
|
+
error?: string;
|
|
762
|
+
}
|
|
763
|
+
/**
|
|
764
|
+
* GetSubscriptionRequest is the request to get subscription info
|
|
765
|
+
*/
|
|
766
|
+
interface GetSubscriptionRequest {
|
|
767
|
+
orgId: string;
|
|
768
|
+
}
|
|
769
|
+
/**
|
|
770
|
+
* GetSubscriptionResponse is the response with subscription info
|
|
771
|
+
*/
|
|
772
|
+
interface GetSubscriptionResponse {
|
|
773
|
+
success: boolean;
|
|
774
|
+
subscription?: OrganizationBilling;
|
|
775
|
+
usage?: UsageSummary;
|
|
776
|
+
error?: string;
|
|
777
|
+
}
|
|
778
|
+
/**
|
|
779
|
+
* CancelSubscriptionRequest is the request to cancel a subscription
|
|
780
|
+
*/
|
|
781
|
+
interface CancelSubscriptionRequest {
|
|
782
|
+
orgId: string;
|
|
783
|
+
cancelAtEnd: boolean;
|
|
784
|
+
reason?: string;
|
|
785
|
+
}
|
|
786
|
+
/**
|
|
787
|
+
* CancelSubscriptionResponse is the response from canceling a subscription
|
|
788
|
+
*/
|
|
789
|
+
interface CancelSubscriptionResponse {
|
|
790
|
+
success: boolean;
|
|
791
|
+
cancelAt?: string;
|
|
792
|
+
error?: string;
|
|
793
|
+
}
|
|
794
|
+
/**
|
|
795
|
+
* GetCreditsRequest is the request to get credit balance
|
|
796
|
+
*/
|
|
797
|
+
interface GetCreditsRequest {
|
|
798
|
+
orgId: string;
|
|
799
|
+
}
|
|
800
|
+
/**
|
|
801
|
+
* GetCreditsResponse is the response with credit balance
|
|
802
|
+
*/
|
|
803
|
+
interface GetCreditsResponse {
|
|
804
|
+
success: boolean;
|
|
805
|
+
totalRemaining: number;
|
|
806
|
+
balances?: (CreditBalance | undefined)[];
|
|
807
|
+
error?: string;
|
|
808
|
+
}
|
|
809
|
+
/**
|
|
810
|
+
* PurchaseCreditsRequest is the request to purchase credits
|
|
811
|
+
*/
|
|
812
|
+
interface PurchaseCreditsRequest {
|
|
813
|
+
orgId: string;
|
|
814
|
+
packageId: string;
|
|
815
|
+
successUrl: string;
|
|
816
|
+
cancelUrl: string;
|
|
817
|
+
}
|
|
818
|
+
/**
|
|
819
|
+
* PurchaseCreditsResponse is the response from purchasing credits
|
|
820
|
+
*/
|
|
821
|
+
interface PurchaseCreditsResponse {
|
|
822
|
+
success: boolean;
|
|
823
|
+
sessionId?: string;
|
|
824
|
+
url?: string;
|
|
825
|
+
error?: string;
|
|
826
|
+
}
|
|
827
|
+
/**
|
|
828
|
+
* ConsumeCreditsRequest is the request to consume credits
|
|
829
|
+
*/
|
|
830
|
+
interface ConsumeCreditsRequest {
|
|
831
|
+
orgId: string;
|
|
832
|
+
amount: number;
|
|
833
|
+
reason?: string;
|
|
834
|
+
}
|
|
835
|
+
/**
|
|
836
|
+
* ConsumeCreditsResponse is the response from consuming credits
|
|
837
|
+
*/
|
|
838
|
+
interface ConsumeCreditsResponse {
|
|
839
|
+
success: boolean;
|
|
840
|
+
consumed: number;
|
|
841
|
+
remaining: number;
|
|
842
|
+
error?: string;
|
|
843
|
+
}
|
|
844
|
+
/**
|
|
845
|
+
* GetPlansRequest is the request to get available plans
|
|
846
|
+
*/
|
|
847
|
+
interface GetPlansRequest {
|
|
848
|
+
activeOnly: boolean;
|
|
849
|
+
}
|
|
850
|
+
/**
|
|
851
|
+
* GetPlansResponse is the response with available plans
|
|
852
|
+
*/
|
|
853
|
+
interface GetPlansResponse {
|
|
854
|
+
success: boolean;
|
|
855
|
+
plans?: (Plan | undefined)[];
|
|
856
|
+
error?: string;
|
|
857
|
+
}
|
|
858
|
+
/**
|
|
859
|
+
* CreateAffiliateRequest is the request to create an affiliate
|
|
860
|
+
*/
|
|
861
|
+
interface CreateAffiliateRequest {
|
|
862
|
+
name: string;
|
|
863
|
+
email: string;
|
|
864
|
+
country: string;
|
|
865
|
+
commissionRate?: number;
|
|
866
|
+
phone?: string;
|
|
867
|
+
}
|
|
868
|
+
/**
|
|
869
|
+
* CreateAffiliateResponse is the response from creating an affiliate
|
|
870
|
+
*/
|
|
871
|
+
interface CreateAffiliateResponse {
|
|
872
|
+
success: boolean;
|
|
873
|
+
affiliate?: Affiliate;
|
|
874
|
+
error?: string;
|
|
875
|
+
}
|
|
876
|
+
/**
|
|
877
|
+
* GetAffiliateRequest is the request to get an affiliate
|
|
878
|
+
*/
|
|
879
|
+
interface GetAffiliateRequest {
|
|
880
|
+
affiliateId?: string;
|
|
881
|
+
referralCode?: string;
|
|
882
|
+
}
|
|
883
|
+
/**
|
|
884
|
+
* GetAffiliateResponse is the response with affiliate info
|
|
885
|
+
*/
|
|
886
|
+
interface GetAffiliateResponse {
|
|
887
|
+
success: boolean;
|
|
888
|
+
affiliate?: Affiliate;
|
|
889
|
+
error?: string;
|
|
890
|
+
}
|
|
891
|
+
/**
|
|
892
|
+
* ListAffiliatesRequest is the request to list affiliates
|
|
893
|
+
*/
|
|
894
|
+
interface ListAffiliatesRequest {
|
|
895
|
+
status?: string;
|
|
896
|
+
page?: number;
|
|
897
|
+
pageSize?: number;
|
|
898
|
+
}
|
|
899
|
+
/**
|
|
900
|
+
* ListAffiliatesResponse is the response with affiliate list
|
|
901
|
+
*/
|
|
902
|
+
interface ListAffiliatesResponse {
|
|
903
|
+
success: boolean;
|
|
904
|
+
affiliates?: (Affiliate | undefined)[];
|
|
905
|
+
total: number;
|
|
906
|
+
page: number;
|
|
907
|
+
pageSize: number;
|
|
908
|
+
error?: string;
|
|
909
|
+
}
|
|
910
|
+
/**
|
|
911
|
+
* CreateAffiliateOnboardingLinkRequest is the request to create an onboarding link
|
|
912
|
+
*/
|
|
913
|
+
interface CreateAffiliateOnboardingLinkRequest {
|
|
914
|
+
affiliateId: string;
|
|
915
|
+
refreshUrl: string;
|
|
916
|
+
returnUrl: string;
|
|
917
|
+
}
|
|
918
|
+
/**
|
|
919
|
+
* CreateAffiliateOnboardingLinkResponse is the response with onboarding link
|
|
920
|
+
*/
|
|
921
|
+
interface CreateAffiliateOnboardingLinkResponse {
|
|
922
|
+
success: boolean;
|
|
923
|
+
url?: string;
|
|
924
|
+
error?: string;
|
|
925
|
+
}
|
|
926
|
+
/**
|
|
927
|
+
* GetAffiliateCommissionsRequest is the request to get affiliate commissions
|
|
928
|
+
*/
|
|
929
|
+
interface GetAffiliateCommissionsRequest {
|
|
930
|
+
affiliateId: string;
|
|
931
|
+
startDate?: string;
|
|
932
|
+
endDate?: string;
|
|
933
|
+
status?: string;
|
|
934
|
+
page?: number;
|
|
935
|
+
pageSize?: number;
|
|
936
|
+
}
|
|
937
|
+
/**
|
|
938
|
+
* GetAffiliateCommissionsResponse is the response with affiliate commissions
|
|
939
|
+
*/
|
|
940
|
+
interface GetAffiliateCommissionsResponse {
|
|
941
|
+
success: boolean;
|
|
942
|
+
commissions?: (AffiliateCommission | undefined)[];
|
|
943
|
+
total: number;
|
|
944
|
+
totalAmount: number;
|
|
945
|
+
page: number;
|
|
946
|
+
pageSize: number;
|
|
947
|
+
error?: string;
|
|
948
|
+
}
|
|
949
|
+
/**
|
|
950
|
+
* GetAffiliateAnalyticsRequest is the request to get affiliate analytics
|
|
951
|
+
*/
|
|
952
|
+
interface GetAffiliateAnalyticsRequest {
|
|
953
|
+
affiliateId: string;
|
|
954
|
+
period?: string;
|
|
955
|
+
startDate?: string;
|
|
956
|
+
endDate?: string;
|
|
957
|
+
}
|
|
958
|
+
/**
|
|
959
|
+
* NATS Subjects for Stripe/Subscription operations
|
|
960
|
+
*/
|
|
961
|
+
declare const AffiliateAnalytics = "billing.affiliate.analytics";
|
|
962
|
+
/**
|
|
963
|
+
* AffiliateAnalytics represents affiliate analytics data
|
|
964
|
+
*/
|
|
965
|
+
interface AffiliateAnalytics {
|
|
966
|
+
affiliateId: string;
|
|
967
|
+
period: string;
|
|
968
|
+
totalReferrals: number;
|
|
969
|
+
activeReferrals: number;
|
|
970
|
+
churnedReferrals: number;
|
|
971
|
+
totalRevenueCents: number;
|
|
972
|
+
totalCommissionsCents: number;
|
|
973
|
+
conversionRate: number;
|
|
974
|
+
avgCustomerLtvCents: number;
|
|
975
|
+
}
|
|
976
|
+
/**
|
|
977
|
+
* GetAffiliateAnalyticsResponse is the response with affiliate analytics
|
|
978
|
+
*/
|
|
979
|
+
interface GetAffiliateAnalyticsResponse {
|
|
980
|
+
success: boolean;
|
|
981
|
+
analytics?: AffiliateAnalytics;
|
|
982
|
+
error?: string;
|
|
983
|
+
}
|
|
984
|
+
/**
|
|
985
|
+
* RevenueAnalyticsRequest is the request to get revenue analytics
|
|
986
|
+
*/
|
|
987
|
+
interface RevenueAnalyticsRequest {
|
|
988
|
+
period?: string;
|
|
989
|
+
startDate?: string;
|
|
990
|
+
endDate?: string;
|
|
991
|
+
}
|
|
992
|
+
/**
|
|
993
|
+
* RevenueAnalytics represents revenue analytics data
|
|
994
|
+
*/
|
|
995
|
+
interface RevenueAnalytics {
|
|
996
|
+
period: string;
|
|
997
|
+
mrrCents: number;
|
|
998
|
+
arrCents: number;
|
|
999
|
+
newMrrCents: number;
|
|
1000
|
+
churnedMrrCents: number;
|
|
1001
|
+
expansionMrrCents: number;
|
|
1002
|
+
contractionMrrCents: number;
|
|
1003
|
+
netMrrCents: number;
|
|
1004
|
+
totalCustomers: number;
|
|
1005
|
+
newCustomers: number;
|
|
1006
|
+
churnedCustomers: number;
|
|
1007
|
+
churnRate: number;
|
|
1008
|
+
}
|
|
1009
|
+
/**
|
|
1010
|
+
* RevenueAnalyticsResponse is the response with revenue analytics
|
|
1011
|
+
*/
|
|
1012
|
+
interface RevenueAnalyticsResponse {
|
|
1013
|
+
success: boolean;
|
|
1014
|
+
analytics?: RevenueAnalytics;
|
|
1015
|
+
error?: string;
|
|
1016
|
+
}
|
|
1017
|
+
/**
|
|
1018
|
+
* Webhook event types
|
|
1019
|
+
*/
|
|
1020
|
+
interface StripeWebhookEvent {
|
|
1021
|
+
type: string;
|
|
1022
|
+
data: {
|
|
1023
|
+
[key: string]: any;
|
|
1024
|
+
};
|
|
1025
|
+
eventId: string;
|
|
1026
|
+
createdAt: string;
|
|
1027
|
+
}
|
|
1028
|
+
/**
|
|
1029
|
+
* Base subject prefix
|
|
1030
|
+
*/
|
|
1031
|
+
declare const BillingSubjectPrefix = "billing";
|
|
1032
|
+
/**
|
|
1033
|
+
* Event recording subjects
|
|
1034
|
+
*/
|
|
1035
|
+
declare const BillingEventsRecord = "billing.events.record";
|
|
1036
|
+
/**
|
|
1037
|
+
* Usage reporting subjects
|
|
1038
|
+
*/
|
|
1039
|
+
declare const BillingUsageReport = "billing.usage.report";
|
|
1040
|
+
declare const BillingUsageCurrent = "billing.usage.current";
|
|
1041
|
+
declare const BillingUsageHistory = "billing.usage.history";
|
|
1042
|
+
declare const BillingUsageCostBreakdown = "billing.usage.breakdown";
|
|
1043
|
+
declare const BillingUsageTopCenters = "billing.usage.top_centers";
|
|
1044
|
+
/**
|
|
1045
|
+
* Invoice subjects
|
|
1046
|
+
*/
|
|
1047
|
+
declare const BillingInvoiceGet = "billing.invoice.get";
|
|
1048
|
+
declare const BillingInvoiceCreate = "billing.invoice.create";
|
|
1049
|
+
declare const BillingInvoiceProcess = "billing.invoice.process";
|
|
1050
|
+
/**
|
|
1051
|
+
* Billing period subjects
|
|
1052
|
+
*/
|
|
1053
|
+
declare const BillingPeriodCreate = "billing.period.create";
|
|
1054
|
+
declare const BillingPeriodClose = "billing.period.close";
|
|
1055
|
+
declare const BillingPeriodProcess = "billing.period.process";
|
|
1056
|
+
/**
|
|
1057
|
+
* Billing rules subjects
|
|
1058
|
+
*/
|
|
1059
|
+
declare const BillingRulesGet = "billing.rules.get";
|
|
1060
|
+
declare const BillingRulesCreate = "billing.rules.create";
|
|
1061
|
+
declare const BillingRulesUpdate = "billing.rules.update";
|
|
1062
|
+
declare const BillingRulesDelete = "billing.rules.delete";
|
|
1063
|
+
/**
|
|
1064
|
+
* Organization provisioning
|
|
1065
|
+
*/
|
|
1066
|
+
declare const BillingOrgProvision = "billing.org.provision";
|
|
1067
|
+
/**
|
|
1068
|
+
* Health check
|
|
1069
|
+
*/
|
|
1070
|
+
declare const BillingHealthCheck = "billing.health.check";
|
|
1071
|
+
|
|
5
1072
|
/**
|
|
6
1073
|
* Admin Models
|
|
7
1074
|
*
|
|
8
1075
|
* Types for admin-related operations (onboarding, org-settings, billing)
|
|
9
|
-
*
|
|
1076
|
+
* Primary source for admin and billing types.
|
|
10
1077
|
*/
|
|
11
1078
|
|
|
12
|
-
interface
|
|
1079
|
+
interface OnboardingStateSimple {
|
|
13
1080
|
currentStep: string;
|
|
14
1081
|
completedSteps: string[];
|
|
15
1082
|
skippedSteps: string[];
|
|
@@ -18,7 +1085,7 @@ interface OnboardingState {
|
|
|
18
1085
|
[key: string]: unknown;
|
|
19
1086
|
}
|
|
20
1087
|
interface OnboardingResponse {
|
|
21
|
-
state:
|
|
1088
|
+
state: OnboardingStateSimple;
|
|
22
1089
|
metadata: ResponseMetadata;
|
|
23
1090
|
}
|
|
24
1091
|
interface CreateOrgResponse {
|
|
@@ -52,29 +1119,6 @@ interface PaymentSessionResponse {
|
|
|
52
1119
|
url: string;
|
|
53
1120
|
metadata: ResponseMetadata;
|
|
54
1121
|
}
|
|
55
|
-
|
|
56
|
-
interface ProvisionAgentsResponse {
|
|
57
|
-
agentsCreated: number;
|
|
58
|
-
subAgentsCreated: number;
|
|
59
|
-
toolsCreated: number;
|
|
60
|
-
skillsCreated: number;
|
|
61
|
-
success: boolean;
|
|
62
|
-
metadata: ResponseMetadata;
|
|
63
|
-
}
|
|
64
|
-
interface ProvisionEntitiesResponse {
|
|
65
|
-
successCount: number;
|
|
66
|
-
errorCount: number;
|
|
67
|
-
errors: string[];
|
|
68
|
-
success: boolean;
|
|
69
|
-
metadata: ResponseMetadata;
|
|
70
|
-
}
|
|
71
|
-
interface ProvisionWorkflowsResponse {
|
|
72
|
-
successCount: number;
|
|
73
|
-
errorCount: number;
|
|
74
|
-
errors: string[];
|
|
75
|
-
success: boolean;
|
|
76
|
-
metadata: ResponseMetadata;
|
|
77
|
-
}
|
|
78
1122
|
interface PlansResponse {
|
|
79
1123
|
plans: Plan[];
|
|
80
1124
|
metadata: ResponseMetadata;
|
|
@@ -98,5 +1142,27 @@ interface PortalSessionResponse {
|
|
|
98
1142
|
url: string;
|
|
99
1143
|
metadata: ResponseMetadata;
|
|
100
1144
|
}
|
|
1145
|
+
interface ProvisionAgentsResponse {
|
|
1146
|
+
agentsCreated: number;
|
|
1147
|
+
subAgentsCreated: number;
|
|
1148
|
+
toolsCreated: number;
|
|
1149
|
+
skillsCreated: number;
|
|
1150
|
+
success: boolean;
|
|
1151
|
+
metadata: ResponseMetadata;
|
|
1152
|
+
}
|
|
1153
|
+
interface ProvisionEntitiesResponse {
|
|
1154
|
+
successCount: number;
|
|
1155
|
+
errorCount: number;
|
|
1156
|
+
errors: string[];
|
|
1157
|
+
success: boolean;
|
|
1158
|
+
metadata: ResponseMetadata;
|
|
1159
|
+
}
|
|
1160
|
+
interface ProvisionWorkflowsResponse {
|
|
1161
|
+
successCount: number;
|
|
1162
|
+
errorCount: number;
|
|
1163
|
+
errors: string[];
|
|
1164
|
+
success: boolean;
|
|
1165
|
+
metadata: ResponseMetadata;
|
|
1166
|
+
}
|
|
101
1167
|
|
|
102
|
-
export type
|
|
1168
|
+
export { type Affiliate, AffiliateAnalytics, type AffiliateCommission, AffiliateCommissions, AffiliateCreate, AffiliateGet, AffiliateList, AffiliateOnboard, type AffiliateReferral, AffiliateUpdate, AnalyticsChurn, AnalyticsRevenue, AnalyticsUsage, 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 CompleteOnboardingResponse, type ConsumeCreditsRequest, type ConsumeCreditsResponse, type CostBreakdown, type CostBreakdownRequest, type CostBreakdownResponse, type CostPreview, type CreateAffiliateOnboardingLinkRequest, type CreateAffiliateOnboardingLinkResponse, type CreateAffiliateRequest, type CreateAffiliateResponse, type CreateAgentResponse, type CreateCheckoutResponse, type CreateCheckoutSessionRequest, type CreateCheckoutSessionResponse, type CreateKnowledgeResponse, type CreateOrgResponse, type CreatePaymentLinkRequest, type CreatePaymentLinkResponse, type CreatePortalSessionRequest, type CreatePortalSessionResponse, type CreditBalance, type CreditPackage, CreditsBalance, CreditsConsume, CreditsPurchase, type CreditsResponse, type CurrentUsageRequest, type CurrentUsageResponse, CustomerCreate, CustomerGet, CustomerUpdate, 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 Invoice, type InvoiceLineItem, type InvoiceRequest, type InvoiceResponse, type ListAffiliatesRequest, type ListAffiliatesResponse, type OnboardingResponse, type OnboardingStateSimple, type OrganizationBilling, type Payment, PaymentLinkCreate, PaymentLinkList, type PaymentSessionResponse, type Plan, PlansGet, PlansGetAll, type PlansResponse, PortalSessionCreate, type PortalSessionResponse, type ProvisionAgentsResponse, type ProvisionEntitiesResponse, type ProvisionWorkflowsResponse, type PurchaseCreditsRequest, type PurchaseCreditsResponse, type RevenueAnalytics, type RevenueAnalyticsRequest, type RevenueAnalyticsResponse, type RuleCoverage, RulesCreateBillingRule, RulesDeleteBillingRule, RulesGetBillingRules, RulesUpdateBillingRule, type SendInvitesResponse, type ServiceUsage, type StripeWebhookEvent, SubscriptionCancel, SubscriptionCheckout, SubscriptionCreate, SubscriptionGet, SubscriptionList, type SubscriptionResponse, SubscriptionUpdate, type TierCost, type TopCostCenter, type UsageAggregation, type UsageAlert, UsageAlertThreshold, UsageGetCostBreakdown, UsageGetCurrentUsage, UsageGetTopCostCenters, UsageGetUsageHistory, type UsageHistory, type UsagePeriod, type UsageReport, type UsageReportRequest, type UsageReportResponse, type UsageSummary, type UsageTrends, type UserUsage, WebhookInvoiceFailed, WebhookInvoicePaid, WebhookPaymentSucceeded, WebhookSubscriptionCanceled, WebhookSubscriptionCreated, WebhookSubscriptionUpdated };
|