gentiq 0.7.32 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,6 +11,17 @@ export interface Admin {
11
11
  name: string;
12
12
  permissions: string[];
13
13
  }
14
+ export type RechargeIntervalUnit = 'minute' | 'hour' | 'day' | 'week' | 'month';
15
+ export interface RechargePolicyInput {
16
+ enabled: boolean;
17
+ interval_value?: number;
18
+ interval_unit?: RechargeIntervalUnit;
19
+ anchor_at?: string;
20
+ }
21
+ export interface RechargePolicy extends RechargePolicyInput {
22
+ next_recharge_at?: string | null;
23
+ last_recharged_at?: string | null;
24
+ }
14
25
  export interface User {
15
26
  id: string;
16
27
  phone: string;
@@ -24,6 +35,17 @@ export interface User {
24
35
  token_limit: number;
25
36
  request_limit: number;
26
37
  };
38
+ recharge_policy?: RechargePolicy | null;
39
+ }
40
+ export interface UserUsageSummary {
41
+ input_tokens: number;
42
+ output_tokens: number;
43
+ total_tokens: number;
44
+ requests: number;
45
+ total_cost_microunits: number;
46
+ unpriced_requests: number;
47
+ renewal_count: number;
48
+ currency: string;
27
49
  }
28
50
  export interface AdminRegisterResponse {
29
51
  admin_id: string;
@@ -107,20 +129,25 @@ export declare class AdminAPI {
107
129
  share_id: string;
108
130
  url: string;
109
131
  }>;
110
- listUsers(skip?: number, limit?: number, query?: string): Promise<{
132
+ listUsers(skip?: number, limit?: number, query?: string, sortBy?: 'phone' | 'name' | 'surname', sortOrder?: 'asc' | 'desc'): Promise<{
111
133
  users: User[];
112
134
  count: number;
113
135
  }>;
114
- createUser(phone: string, name: string, surname: string, tokens?: number, requests?: number, token_limit?: number, request_limit?: number, metadata?: Record<string, any>): Promise<any>;
136
+ createUser(phone: string, name: string, surname: string, tokens?: number, requests?: number, token_limit?: number, request_limit?: number, metadata?: Record<string, any>, recharge_policy?: RechargePolicyInput): Promise<any>;
115
137
  updateUser(userId: string, data: {
116
138
  phone?: string;
117
139
  name?: string;
118
140
  surname?: string;
119
141
  metadata?: Record<string, any>;
120
- }): Promise<any>;
142
+ recharge_policy?: RechargePolicyInput;
143
+ }): Promise<{
144
+ status: string;
145
+ user: User;
146
+ }>;
121
147
  deleteUser(userId: string): Promise<any>;
122
148
  updateUserBalance(userId: string, tokens: number, requests: number, token_limit?: number, request_limit?: number): Promise<any>;
123
149
  refreshUserToken(userId: string): Promise<any>;
150
+ getUserUsageSummary(userId: string): Promise<UserUsageSummary>;
124
151
  getAnalytics(days?: number): Promise<any>;
125
152
  listJobs(limit?: number, type?: string): Promise<{
126
153
  jobs: Job[];
@@ -0,0 +1,2 @@
1
+ export declare function formatMicrounits(microunits: number, currency: string, locale: string): string;
2
+ export declare function formatMicrounitsCompact(microunits: number, currency: string, locale: string): string;
@@ -10,7 +10,10 @@ export declare function useAdminUsersMutations(): {
10
10
  tokens?: number;
11
11
  requests?: number;
12
12
  }, unknown>;
13
- updateUser: import('@tanstack/react-query').UseMutationResult<any, Error, {
13
+ updateUser: import('@tanstack/react-query').UseMutationResult<{
14
+ status: string;
15
+ user: import('../admin/lib/api').User;
16
+ }, Error, {
14
17
  userId: string;
15
18
  data: {
16
19
  phone?: string;
@@ -197,9 +197,14 @@ declare const _default: {
197
197
  "total_threads": "Total Threads",
198
198
  "total_messages": "Total Messages",
199
199
  "total_token_usage": "Total Token Usage",
200
+ "usage_cost": "Usage & Cost",
201
+ "input": "Input",
202
+ "output": "Output",
203
+ "cost": "Cost",
200
204
  "threads_chart": "Threads",
201
205
  "messages_chart": "Messages",
202
206
  "token_usage_chart": "Token Usage",
207
+ "cost_chart": "Cost Per Day",
203
208
  "active_users": "Active Users",
204
209
  "conversations": "conversations",
205
210
  "threads": "threads",
@@ -229,6 +234,8 @@ declare const _default: {
229
234
  "input_tokens": "Input: {{value}}",
230
235
  "output_tokens": "Output: {{value}}",
231
236
  "total_tokens": "Total: {{value}}",
237
+ "cost": "Cost: {{value}}",
238
+ "unpriced": "Unpriced",
232
239
  "all_feedbacks": "All Conversations",
233
240
  "liked_feedbacks": "Liked 👍",
234
241
  "disliked_feedbacks": "Disliked 👎",
@@ -268,6 +275,8 @@ declare const _default: {
268
275
  "request_count": "Request Count",
269
276
  "updating": "Updating...",
270
277
  "no_users": "No users found.",
278
+ "sort_ascending": "Sort ascending",
279
+ "sort_descending": "Sort descending",
271
280
  "confirm_delete_user": "Are you sure you want to delete this user?",
272
281
  "tokens_exceed_limit": "Tokens cannot exceed the specified limit",
273
282
  "requests_exceed_limit": "Requests cannot exceed the specified limit",
@@ -277,6 +286,30 @@ declare const _default: {
277
286
  "metadata_raw": "Metadata (Raw JSON)",
278
287
  "advanced_usage": "Advanced usage",
279
288
  "invalid_json": "Invalid JSON format"
289
+ ,"auto_recharge": "Automatic Balance Renewal"
290
+ ,"auto_recharge_help": "Restore this user's balance to its limits on a recurring schedule."
291
+ ,"enabled": "Enabled"
292
+ ,"recharge_interval": "Every"
293
+ ,"recharge_unit": "Interval Unit"
294
+ ,"recharge_unit_minute": "Minute(s)"
295
+ ,"recharge_unit_hour": "Hour(s)"
296
+ ,"recharge_unit_day": "Day(s)"
297
+ ,"recharge_unit_week": "Week(s)"
298
+ ,"recharge_unit_month": "Month(s)"
299
+ ,"recharge_schedule_help": "New schedules begin when saved. Existing schedules keep their current cycle anchor."
300
+ ,"next_recharge": "Next renewal"
301
+ ,"last_recharge": "Last automatic renewal"
302
+ ,"not_available": "Not available"
303
+ ,"recharge_interval_invalid": "The renewal interval must be a positive whole number"
304
+ ,"recharge_policy_not_saved": "The backend did not save the renewal policy. Restart or update the backend to the version that supports automatic renewal."
305
+ ,"usage_summary": "Usage Summary"
306
+ ,"input_tokens": "Input Tokens"
307
+ ,"output_tokens": "Output Tokens"
308
+ ,"total_tokens": "Total Tokens"
309
+ ,"requests_made": "Requests Made"
310
+ ,"total_cost": "Total Cost"
311
+ ,"renewals": "Balance Renewals"
312
+ ,"unpriced_requests": "Unpriced Requests"
280
313
  },
281
314
  "admins": {
282
315
  "title": "Admin Management",
@@ -196,9 +196,14 @@ declare const _default: {
196
196
  "total_threads": "تعداد گفتگوها",
197
197
  "total_messages": "تعداد پیام‌ها",
198
198
  "total_token_usage": "مصرف کل توکن",
199
+ "usage_cost": "مصرف و هزینه",
200
+ "input": "ورودی",
201
+ "output": "خروجی",
202
+ "cost": "هزینه",
199
203
  "threads_chart": "گفتگوها",
200
204
  "messages_chart": "پیام‌ها",
201
205
  "token_usage_chart": "مصرف توکن",
206
+ "cost_chart": "هزینه روزانه",
202
207
  "active_users": "کاربران فعال",
203
208
  "conversations": "گفتگو",
204
209
  "threads": "گفتگو",
@@ -228,6 +233,8 @@ declare const _default: {
228
233
  "input_tokens": "ورودی: {{value}}",
229
234
  "output_tokens": "خروجی: {{value}}",
230
235
  "total_tokens": "کل: {{value}}",
236
+ "cost": "هزینه: {{value}}",
237
+ "unpriced": "بدون هزینه",
231
238
  "all_feedbacks": "همه گفتگوها",
232
239
  "liked_feedbacks": "پسندیده شده 👍",
233
240
  "disliked_feedbacks": "نپسندیده شده 👎",
@@ -267,6 +274,8 @@ declare const _default: {
267
274
  "request_count": "تعداد درخواست",
268
275
  "updating": "در حال بروزرسانی...",
269
276
  "no_users": "هیچ کاربری یافت نشد.",
277
+ "sort_ascending": "مرتب‌سازی صعودی",
278
+ "sort_descending": "مرتب‌سازی نزولی",
270
279
  "confirm_delete_user": "آیا از حذف این کاربر اطمینان دارید؟",
271
280
  "tokens_exceed_limit": "تعداد توکن نمی‌تواند بیشتر از سقف مجاز باشد",
272
281
  "requests_exceed_limit": "تعداد درخواست نمی‌تواند بیشتر از سقف مجاز باشد",
@@ -276,6 +285,30 @@ declare const _default: {
276
285
  "metadata_raw": "متادیتا (JSON خام)",
277
286
  "advanced_usage": "استفاده پیشرفته",
278
287
  "invalid_json": "فرمت JSON نامعتبر است"
288
+ ,"auto_recharge": "تمدید خودکار موجودی"
289
+ ,"auto_recharge_help": "موجودی این کاربر را طبق یک برنامه تکرارشونده تا سقف تعیین‌شده بازنشانی می‌کند."
290
+ ,"enabled": "فعال"
291
+ ,"recharge_interval": "هر"
292
+ ,"recharge_unit": "واحد بازه"
293
+ ,"recharge_unit_minute": "دقیقه"
294
+ ,"recharge_unit_hour": "ساعت"
295
+ ,"recharge_unit_day": "روز"
296
+ ,"recharge_unit_week": "هفته"
297
+ ,"recharge_unit_month": "ماه"
298
+ ,"recharge_schedule_help": "برنامه جدید از زمان ذخیره آغاز می‌شود. برنامه موجود مبدأ دوره فعلی خود را حفظ می‌کند."
299
+ ,"next_recharge": "تمدید بعدی"
300
+ ,"last_recharge": "آخرین تمدید خودکار"
301
+ ,"not_available": "در دسترس نیست"
302
+ ,"recharge_interval_invalid": "بازه تمدید باید یک عدد صحیح مثبت باشد"
303
+ ,"recharge_policy_not_saved": "سرور تنظیمات تمدید خودکار را ذخیره نکرد. سرور را راه‌اندازی مجدد یا به نسخه پشتیبان‌کننده از تمدید خودکار بروزرسانی کنید."
304
+ ,"usage_summary": "خلاصه مصرف"
305
+ ,"input_tokens": "توکن‌های ورودی"
306
+ ,"output_tokens": "توکن‌های خروجی"
307
+ ,"total_tokens": "کل توکن‌ها"
308
+ ,"requests_made": "تعداد درخواست‌ها"
309
+ ,"total_cost": "هزینه کل"
310
+ ,"renewals": "دفعات شارژ موجودی"
311
+ ,"unpriced_requests": "درخواست‌های بدون هزینه‌ی ثبت شده"
279
312
  },
280
313
  "admins": {
281
314
  "title": "مدیریت ادمین‌ها",
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "provenance": true
11
11
  },
12
12
  "description": "React UI library for the Gentiq AI framework.",
13
- "version": "0.7.32",
13
+ "version": "0.8.1",
14
14
  "type": "module",
15
15
  "files": [
16
16
  "dist"