gentiq 0.8.3 → 0.9.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.
Files changed (44) hide show
  1. package/dist/{checkbox-hWwU3a5K.js → checkbox-DyzncQpE.js} +1680 -1712
  2. package/dist/gentiq-admin.es.js +4089 -3259
  3. package/dist/gentiq-index.es.js +1973 -1380
  4. package/dist/gentiq.css +1 -1
  5. package/dist/src/App.d.ts +1 -1
  6. package/dist/src/ComponentsContext.d.ts +1 -1
  7. package/dist/src/Part.d.ts +2 -1
  8. package/dist/src/admin/components/ErrorBanner.d.ts +7 -0
  9. package/dist/src/admin/components/I18nPreview.d.ts +6 -0
  10. package/dist/src/admin/components/ModalCloseButton.d.ts +7 -0
  11. package/dist/src/admin/components/SectionHeader.d.ts +8 -0
  12. package/dist/src/admin/lib/api.d.ts +109 -16
  13. package/dist/src/admin/pages/settings/ChatSection.d.ts +12 -0
  14. package/dist/src/admin/pages/settings/FieldModeGrid.d.ts +14 -0
  15. package/dist/src/admin/pages/settings/GeneralSection.d.ts +11 -0
  16. package/dist/src/admin/pages/settings/SettingsToggleCard.d.ts +10 -0
  17. package/dist/src/admin/pages/settings/TranslationEditor.d.ts +9 -0
  18. package/dist/src/admin/pages/settings/types.d.ts +12 -0
  19. package/dist/src/admin/pages/users/UserBulkBalanceModal.d.ts +11 -0
  20. package/dist/src/admin/pages/users/UserFormModal.d.ts +13 -0
  21. package/dist/src/admin/pages/users/UserRechargeModal.d.ts +10 -0
  22. package/dist/src/admin/pages/users/UserUsageDialog.d.ts +9 -0
  23. package/dist/src/admin/pages/users/UsersTable.d.ts +21 -0
  24. package/dist/src/components/PromptInputArea.d.ts +1 -1
  25. package/dist/src/components/ai-elements/Conversation.d.ts +10 -0
  26. package/dist/src/hooks/useGentiqAdmin.d.ts +9 -9
  27. package/dist/src/hooks/useGentiqChat.d.ts +3 -2
  28. package/dist/src/index.d.ts +4 -3
  29. package/dist/src/lib/GentiqApiContext.d.ts +12 -0
  30. package/dist/src/lib/api.d.ts +37 -17
  31. package/dist/src/lib/errors.d.ts +6 -5
  32. package/dist/src/lib/messageParts.d.ts +40 -0
  33. package/dist/src/locales/en.json.d.ts +456 -456
  34. package/dist/src/locales/fa.json.d.ts +455 -455
  35. package/dist/src/parts/FilePart.d.ts +1 -1
  36. package/dist/src/parts/ToolPart.d.ts +1 -1
  37. package/dist/src/types.d.ts +188 -14
  38. package/package.json +5 -5
  39. package/dist/src/components/ai-elements/Branch.d.ts +0 -20
  40. package/dist/src/components/ai-elements/Image.d.ts +0 -6
  41. package/dist/src/components/ai-elements/InlineCitation.d.ts +0 -38
  42. package/dist/src/components/ai-elements/Task.d.ts +0 -14
  43. package/dist/src/components/ai-elements/WebPreview.d.ts +0 -34
  44. package/dist/src/components/ui/carousel.d.ts +0 -19
@@ -1,3 +1,4 @@
1
+ import { TFunction } from 'i18next';
1
2
  /**
2
3
  * Standardized error codes for the Gentiq framework.
3
4
  * These should match the ErrorCode Enum in the backend.
@@ -29,25 +30,25 @@ export declare const GentiqErrorCode: {
29
30
  readonly VALIDATION_ERROR: "validation_error";
30
31
  readonly NOT_FOUND: "not_found";
31
32
  };
32
- export type GentiqErrorCode = typeof GentiqErrorCode[keyof typeof GentiqErrorCode];
33
+ export type GentiqErrorCode = (typeof GentiqErrorCode)[keyof typeof GentiqErrorCode];
33
34
  export interface GentiqErrorResponse {
34
35
  error: {
35
36
  code: GentiqErrorCode | string;
36
37
  message: string;
37
- details?: any;
38
+ details?: unknown;
38
39
  };
39
40
  }
40
41
  export declare class GentiqError extends Error {
41
42
  code: GentiqErrorCode | string;
42
43
  status?: number;
43
- details?: any;
44
+ details?: unknown;
44
45
  constructor(response: GentiqErrorResponse, status?: number);
45
46
  }
46
47
  /**
47
48
  * Checks if an error is a GentiqError.
48
49
  */
49
- export declare function isGentiqError(error: any): error is GentiqError;
50
+ export declare function isGentiqError(error: unknown): error is GentiqError;
50
51
  /**
51
52
  * Returns a localized error message for a given error or code.
52
53
  */
53
- export declare function getLocalizedErrorMessage(error: Error | GentiqErrorCode | string, t: (key: string, options?: any) => string): string;
54
+ export declare function getLocalizedErrorMessage(error: unknown, t: TFunction): string;
@@ -0,0 +1,40 @@
1
+ import { UIDataTypes, UIMessagePart, UITools } from 'ai';
2
+ /**
3
+ * A message part from the AI SDK union — covers `text`, `reasoning`, `tool-*`,
4
+ * `file`, and `data-*` parts. Use this instead of `any` for typed `parts` arrays.
5
+ */
6
+ export type MessagePart = UIMessagePart<UIDataTypes, UITools>;
7
+ /**
8
+ * A loose, structural view of a message part.
9
+ *
10
+ * The AI SDK's part union (and the backend's persisted thread items) expose
11
+ * per-variant fields — `text`, tool `input`/`output`, file metadata, `data-*`
12
+ * payloads — that are not surfaced uniformly on {@link MessagePart}. Renderers
13
+ * read those fields through this shape so the narrowing casts live in one place
14
+ * instead of being scattered as `as any` across the codebase.
15
+ *
16
+ * `data` is intentionally `any`: `data-*` parts carry arbitrary payloads that
17
+ * are sometimes arrays (`data[0].title`) and sometimes objects (`data.id`).
18
+ */
19
+ export interface LooseMessagePart {
20
+ type: string;
21
+ text?: string;
22
+ data?: any;
23
+ url?: string;
24
+ filename?: string;
25
+ mediaType?: string;
26
+ media_type?: string;
27
+ mime_type?: string;
28
+ toolName?: string;
29
+ tool_name?: string;
30
+ toolCallId?: string;
31
+ tool_call_id?: string;
32
+ state?: string;
33
+ input?: unknown;
34
+ output?: unknown;
35
+ error_text?: string;
36
+ errorText?: string;
37
+ object_name?: string;
38
+ }
39
+ /** Narrow an AI SDK / backend message part to its {@link LooseMessagePart} view. */
40
+ export declare const asLoosePart: (part: unknown) => LooseMessagePart;