gentiq 0.7.30 → 0.7.32
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 +51 -0
- package/dist/{checkbox-DllHCh8Z.js → checkbox-CdPG-d34.js} +939 -920
- package/dist/gentiq-admin.es.js +1386 -1322
- package/dist/gentiq-index.es.js +848 -834
- package/dist/src/components/ThemeProvider.d.ts +1 -1
- package/dist/src/hooks/useGentiqUser.d.ts +184 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/lib/api.d.ts +3 -3
- package/dist/src/locales/en.json.d.ts +8 -1
- package/dist/src/locales/fa.json.d.ts +8 -1
- package/dist/src/types.d.ts +37 -2
- package/package.json +1 -1
|
@@ -14,6 +14,6 @@ interface ThemeProviderState {
|
|
|
14
14
|
radius: string | undefined;
|
|
15
15
|
setRadius: (radius: string | undefined) => void;
|
|
16
16
|
}
|
|
17
|
-
export declare function ThemeProvider({ children, defaultTheme, storageKey, ...props }: ThemeProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare function ThemeProvider({ children, defaultTheme, storageKey, config, ...props }: ThemeProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
18
18
|
export declare const useTheme: () => ThemeProviderState;
|
|
19
19
|
export {};
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { GentiqUser } from '../types';
|
|
2
|
+
export declare const currentUserQueryKey: (cacheNamespace: string) => readonly [string, "currentUser"];
|
|
3
|
+
export interface UseGentiqUserOptions {
|
|
4
|
+
/** Set to false to defer loading the authenticated user profile. */
|
|
5
|
+
enabled?: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Loads the authenticated Gentiq user and exposes common display values.
|
|
9
|
+
*/
|
|
10
|
+
export declare function useGentiqUser(options?: UseGentiqUserOptions): {
|
|
11
|
+
user: GentiqUser | null;
|
|
12
|
+
firstName: string | null;
|
|
13
|
+
data: GentiqUser;
|
|
14
|
+
error: Error;
|
|
15
|
+
isError: true;
|
|
16
|
+
isPending: false;
|
|
17
|
+
isLoading: false;
|
|
18
|
+
isLoadingError: false;
|
|
19
|
+
isRefetchError: true;
|
|
20
|
+
isSuccess: false;
|
|
21
|
+
isPlaceholderData: false;
|
|
22
|
+
status: "error";
|
|
23
|
+
dataUpdatedAt: number;
|
|
24
|
+
errorUpdatedAt: number;
|
|
25
|
+
failureCount: number;
|
|
26
|
+
failureReason: Error | null;
|
|
27
|
+
errorUpdateCount: number;
|
|
28
|
+
isFetched: boolean;
|
|
29
|
+
isFetchedAfterMount: boolean;
|
|
30
|
+
isFetching: boolean;
|
|
31
|
+
isInitialLoading: boolean;
|
|
32
|
+
isPaused: boolean;
|
|
33
|
+
isRefetching: boolean;
|
|
34
|
+
isStale: boolean;
|
|
35
|
+
isEnabled: boolean;
|
|
36
|
+
refetch: (options?: import('@tanstack/react-query').RefetchOptions) => Promise<import('@tanstack/react-query').QueryObserverResult<GentiqUser, Error>>;
|
|
37
|
+
fetchStatus: import('@tanstack/react-query').FetchStatus;
|
|
38
|
+
promise: Promise<GentiqUser>;
|
|
39
|
+
} | {
|
|
40
|
+
user: GentiqUser | null;
|
|
41
|
+
firstName: string | null;
|
|
42
|
+
data: GentiqUser;
|
|
43
|
+
error: null;
|
|
44
|
+
isError: false;
|
|
45
|
+
isPending: false;
|
|
46
|
+
isLoading: false;
|
|
47
|
+
isLoadingError: false;
|
|
48
|
+
isRefetchError: false;
|
|
49
|
+
isSuccess: true;
|
|
50
|
+
isPlaceholderData: false;
|
|
51
|
+
status: "success";
|
|
52
|
+
dataUpdatedAt: number;
|
|
53
|
+
errorUpdatedAt: number;
|
|
54
|
+
failureCount: number;
|
|
55
|
+
failureReason: Error | null;
|
|
56
|
+
errorUpdateCount: number;
|
|
57
|
+
isFetched: boolean;
|
|
58
|
+
isFetchedAfterMount: boolean;
|
|
59
|
+
isFetching: boolean;
|
|
60
|
+
isInitialLoading: boolean;
|
|
61
|
+
isPaused: boolean;
|
|
62
|
+
isRefetching: boolean;
|
|
63
|
+
isStale: boolean;
|
|
64
|
+
isEnabled: boolean;
|
|
65
|
+
refetch: (options?: import('@tanstack/react-query').RefetchOptions) => Promise<import('@tanstack/react-query').QueryObserverResult<GentiqUser, Error>>;
|
|
66
|
+
fetchStatus: import('@tanstack/react-query').FetchStatus;
|
|
67
|
+
promise: Promise<GentiqUser>;
|
|
68
|
+
} | {
|
|
69
|
+
user: GentiqUser | null;
|
|
70
|
+
firstName: string | null;
|
|
71
|
+
data: undefined;
|
|
72
|
+
error: Error;
|
|
73
|
+
isError: true;
|
|
74
|
+
isPending: false;
|
|
75
|
+
isLoading: false;
|
|
76
|
+
isLoadingError: true;
|
|
77
|
+
isRefetchError: false;
|
|
78
|
+
isSuccess: false;
|
|
79
|
+
isPlaceholderData: false;
|
|
80
|
+
status: "error";
|
|
81
|
+
dataUpdatedAt: number;
|
|
82
|
+
errorUpdatedAt: number;
|
|
83
|
+
failureCount: number;
|
|
84
|
+
failureReason: Error | null;
|
|
85
|
+
errorUpdateCount: number;
|
|
86
|
+
isFetched: boolean;
|
|
87
|
+
isFetchedAfterMount: boolean;
|
|
88
|
+
isFetching: boolean;
|
|
89
|
+
isInitialLoading: boolean;
|
|
90
|
+
isPaused: boolean;
|
|
91
|
+
isRefetching: boolean;
|
|
92
|
+
isStale: boolean;
|
|
93
|
+
isEnabled: boolean;
|
|
94
|
+
refetch: (options?: import('@tanstack/react-query').RefetchOptions) => Promise<import('@tanstack/react-query').QueryObserverResult<GentiqUser, Error>>;
|
|
95
|
+
fetchStatus: import('@tanstack/react-query').FetchStatus;
|
|
96
|
+
promise: Promise<GentiqUser>;
|
|
97
|
+
} | {
|
|
98
|
+
user: GentiqUser | null;
|
|
99
|
+
firstName: string | null;
|
|
100
|
+
data: undefined;
|
|
101
|
+
error: null;
|
|
102
|
+
isError: false;
|
|
103
|
+
isPending: true;
|
|
104
|
+
isLoading: true;
|
|
105
|
+
isLoadingError: false;
|
|
106
|
+
isRefetchError: false;
|
|
107
|
+
isSuccess: false;
|
|
108
|
+
isPlaceholderData: false;
|
|
109
|
+
status: "pending";
|
|
110
|
+
dataUpdatedAt: number;
|
|
111
|
+
errorUpdatedAt: number;
|
|
112
|
+
failureCount: number;
|
|
113
|
+
failureReason: Error | null;
|
|
114
|
+
errorUpdateCount: number;
|
|
115
|
+
isFetched: boolean;
|
|
116
|
+
isFetchedAfterMount: boolean;
|
|
117
|
+
isFetching: boolean;
|
|
118
|
+
isInitialLoading: boolean;
|
|
119
|
+
isPaused: boolean;
|
|
120
|
+
isRefetching: boolean;
|
|
121
|
+
isStale: boolean;
|
|
122
|
+
isEnabled: boolean;
|
|
123
|
+
refetch: (options?: import('@tanstack/react-query').RefetchOptions) => Promise<import('@tanstack/react-query').QueryObserverResult<GentiqUser, Error>>;
|
|
124
|
+
fetchStatus: import('@tanstack/react-query').FetchStatus;
|
|
125
|
+
promise: Promise<GentiqUser>;
|
|
126
|
+
} | {
|
|
127
|
+
user: GentiqUser | null;
|
|
128
|
+
firstName: string | null;
|
|
129
|
+
data: undefined;
|
|
130
|
+
error: null;
|
|
131
|
+
isError: false;
|
|
132
|
+
isPending: true;
|
|
133
|
+
isLoadingError: false;
|
|
134
|
+
isRefetchError: false;
|
|
135
|
+
isSuccess: false;
|
|
136
|
+
isPlaceholderData: false;
|
|
137
|
+
status: "pending";
|
|
138
|
+
dataUpdatedAt: number;
|
|
139
|
+
errorUpdatedAt: number;
|
|
140
|
+
failureCount: number;
|
|
141
|
+
failureReason: Error | null;
|
|
142
|
+
errorUpdateCount: number;
|
|
143
|
+
isFetched: boolean;
|
|
144
|
+
isFetchedAfterMount: boolean;
|
|
145
|
+
isFetching: boolean;
|
|
146
|
+
isLoading: boolean;
|
|
147
|
+
isInitialLoading: boolean;
|
|
148
|
+
isPaused: boolean;
|
|
149
|
+
isRefetching: boolean;
|
|
150
|
+
isStale: boolean;
|
|
151
|
+
isEnabled: boolean;
|
|
152
|
+
refetch: (options?: import('@tanstack/react-query').RefetchOptions) => Promise<import('@tanstack/react-query').QueryObserverResult<GentiqUser, Error>>;
|
|
153
|
+
fetchStatus: import('@tanstack/react-query').FetchStatus;
|
|
154
|
+
promise: Promise<GentiqUser>;
|
|
155
|
+
} | {
|
|
156
|
+
user: GentiqUser | null;
|
|
157
|
+
firstName: string | null;
|
|
158
|
+
data: GentiqUser;
|
|
159
|
+
isError: false;
|
|
160
|
+
error: null;
|
|
161
|
+
isPending: false;
|
|
162
|
+
isLoading: false;
|
|
163
|
+
isLoadingError: false;
|
|
164
|
+
isRefetchError: false;
|
|
165
|
+
isSuccess: true;
|
|
166
|
+
isPlaceholderData: true;
|
|
167
|
+
status: "success";
|
|
168
|
+
dataUpdatedAt: number;
|
|
169
|
+
errorUpdatedAt: number;
|
|
170
|
+
failureCount: number;
|
|
171
|
+
failureReason: Error | null;
|
|
172
|
+
errorUpdateCount: number;
|
|
173
|
+
isFetched: boolean;
|
|
174
|
+
isFetchedAfterMount: boolean;
|
|
175
|
+
isFetching: boolean;
|
|
176
|
+
isInitialLoading: boolean;
|
|
177
|
+
isPaused: boolean;
|
|
178
|
+
isRefetching: boolean;
|
|
179
|
+
isStale: boolean;
|
|
180
|
+
isEnabled: boolean;
|
|
181
|
+
refetch: (options?: import('@tanstack/react-query').RefetchOptions) => Promise<import('@tanstack/react-query').QueryObserverResult<GentiqUser, Error>>;
|
|
182
|
+
fetchStatus: import('@tanstack/react-query').FetchStatus;
|
|
183
|
+
promise: Promise<GentiqUser>;
|
|
184
|
+
};
|
package/dist/src/index.d.ts
CHANGED
|
@@ -19,5 +19,6 @@ export { default as RequireAuth } from './components/RequireAuth';
|
|
|
19
19
|
export { default as UserLoginPage } from './pages/UserLoginPage';
|
|
20
20
|
export { default as SharedChatView } from './pages/SharedChatView';
|
|
21
21
|
export { useGentiqChat } from './hooks/useGentiqChat';
|
|
22
|
+
export { useGentiqUser, type UseGentiqUserOptions, } from './hooks/useGentiqUser';
|
|
22
23
|
export { useComponents } from './ComponentsContext';
|
|
23
24
|
export { useTranslation, withTranslation, Translation, Trans } from 'react-i18next';
|
package/dist/src/lib/api.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GentiqConfig, GentiqEndpoints } from '../types';
|
|
1
|
+
import { GentiqConfig, GentiqEndpoints, GentiqUser } from '../types';
|
|
2
2
|
export declare const userAPI: {
|
|
3
3
|
init: (config: GentiqConfig) => void;
|
|
4
4
|
getConfig: () => GentiqConfig;
|
|
@@ -27,14 +27,14 @@ export declare const userAPI: {
|
|
|
27
27
|
*/
|
|
28
28
|
getPublicAttachmentBlobUrl(object_name: string): Promise<string>;
|
|
29
29
|
saveFeedback: (threadId: string, messageId: string, sentiment: "like" | "dislike" | null) => Promise<any>;
|
|
30
|
-
getMe: () => Promise<
|
|
30
|
+
getMe: () => Promise<GentiqUser>;
|
|
31
31
|
updateMe: (data: {
|
|
32
32
|
name?: string;
|
|
33
33
|
surname?: string;
|
|
34
34
|
phone?: string;
|
|
35
35
|
password?: string;
|
|
36
36
|
metadata?: Record<string, any>;
|
|
37
|
-
}) => Promise<
|
|
37
|
+
}) => Promise<GentiqUser>;
|
|
38
38
|
pinThread: (threadId: string, pinned: boolean) => Promise<any>;
|
|
39
39
|
shareThread: (threadId: string) => Promise<any>;
|
|
40
40
|
getSharedThread: (shareId: string) => Promise<any>;
|
|
@@ -127,7 +127,14 @@ declare const _default: {
|
|
|
127
127
|
"app_name": "App Name",
|
|
128
128
|
"admin_title": "Admin Panel Title",
|
|
129
129
|
"language": "Default Language",
|
|
130
|
-
"language_help": "The language users see on their first visit (if not auto-detected)."
|
|
130
|
+
"language_help": "The language users see on their first visit (if not auto-detected).",
|
|
131
|
+
"appearance": "Default Appearance",
|
|
132
|
+
"appearance_help": "These values apply when a user has not saved their own appearance preferences.",
|
|
133
|
+
"default_theme": "Default Theme",
|
|
134
|
+
"default_accent": "Default Accent Color",
|
|
135
|
+
"default_accent_help": "Enter any browser-supported CSS color, such as #3b82f6, rgb(59 130 246), or oklch(0.623 0.214 259.815).",
|
|
136
|
+
"default_accent_invalid": "Enter a valid browser-supported CSS color.",
|
|
137
|
+
"default_accent_preview": "Accent color preview"
|
|
131
138
|
},
|
|
132
139
|
"chat": {
|
|
133
140
|
"welcome_greeting": "Welcome Greeting",
|
|
@@ -126,7 +126,14 @@ declare const _default: {
|
|
|
126
126
|
"app_name": "نام سامانه",
|
|
127
127
|
"admin_title": "عنوان پنل ادمین",
|
|
128
128
|
"language": "زبان پیشفرض",
|
|
129
|
-
"language_help": "زبانی که کاربر در اولین ورود مشاهده میکند (در صورت عدم تشخیص خودکار)."
|
|
129
|
+
"language_help": "زبانی که کاربر در اولین ورود مشاهده میکند (در صورت عدم تشخیص خودکار).",
|
|
130
|
+
"appearance": "ظاهر پیشفرض",
|
|
131
|
+
"appearance_help": "این مقادیر زمانی اعمال میشوند که کاربر تنظیمات ظاهری خود را ذخیره نکرده باشد.",
|
|
132
|
+
"default_theme": "پوسته پیشفرض",
|
|
133
|
+
"default_accent": "رنگ اصلی پیشفرض",
|
|
134
|
+
"default_accent_help": "هر رنگ CSS پشتیبانیشده توسط مرورگر را وارد کنید؛ مانند #3b82f6 یا rgb(59 130 246).",
|
|
135
|
+
"default_accent_invalid": "یک رنگ CSS معتبر و پشتیبانیشده توسط مرورگر وارد کنید.",
|
|
136
|
+
"default_accent_preview": "پیشنمایش رنگ اصلی"
|
|
130
137
|
},
|
|
131
138
|
"chat": {
|
|
132
139
|
"welcome_greeting": "پیام خوشآمدگویی",
|
package/dist/src/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ComponentType } from 'react';
|
|
2
2
|
import { UIMessage, UIMessagePart } from 'ai';
|
|
3
|
+
import { TFunction } from 'i18next';
|
|
3
4
|
/**
|
|
4
5
|
* Represents a single conversation thread in the history.
|
|
5
6
|
*/
|
|
@@ -13,6 +14,35 @@ export interface ConversationEntry {
|
|
|
13
14
|
/** Whether the thread is pinned to the top of the list. */
|
|
14
15
|
pinned?: boolean;
|
|
15
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* The authenticated user's profile returned by Gentiq.
|
|
19
|
+
*/
|
|
20
|
+
export interface GentiqUser {
|
|
21
|
+
id: string;
|
|
22
|
+
phone: string;
|
|
23
|
+
/** The user's first name. */
|
|
24
|
+
name: string;
|
|
25
|
+
surname: string;
|
|
26
|
+
metadata: Record<string, any>;
|
|
27
|
+
balance?: {
|
|
28
|
+
tokens: number;
|
|
29
|
+
requests: number;
|
|
30
|
+
token_limit: number;
|
|
31
|
+
request_limit: number;
|
|
32
|
+
updated_at?: string | null;
|
|
33
|
+
} | null;
|
|
34
|
+
created_at?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* User data available when building a personalized welcome greeting.
|
|
38
|
+
*/
|
|
39
|
+
export interface WelcomeGreetingContext {
|
|
40
|
+
user: GentiqUser | null;
|
|
41
|
+
firstName: string | null;
|
|
42
|
+
isLoading: boolean;
|
|
43
|
+
/** Translate the greeting using Gentiq's active language and resources. */
|
|
44
|
+
t: TFunction;
|
|
45
|
+
}
|
|
16
46
|
/**
|
|
17
47
|
* Adapter for managing authentication tokens and headers.
|
|
18
48
|
*/
|
|
@@ -132,8 +162,11 @@ export interface WelcomeSuggestion {
|
|
|
132
162
|
* Configuration for the welcome/empty-state screen.
|
|
133
163
|
*/
|
|
134
164
|
export interface WelcomeScreenConfig {
|
|
135
|
-
/**
|
|
136
|
-
|
|
165
|
+
/**
|
|
166
|
+
* Optional override for the welcome message title. A function can be used
|
|
167
|
+
* to personalize the greeting with the authenticated user's first name.
|
|
168
|
+
*/
|
|
169
|
+
greeting?: string | ((context: WelcomeGreetingContext) => string);
|
|
137
170
|
/** Optional override for the welcome message subtitle. */
|
|
138
171
|
subtitle?: string;
|
|
139
172
|
/** Optional override for the starter prompt suggestions. */
|
|
@@ -170,6 +203,8 @@ export interface ComposerConfig {
|
|
|
170
203
|
* Configuration for the UI theme and styling.
|
|
171
204
|
*/
|
|
172
205
|
export interface ThemeConfig {
|
|
206
|
+
/** Theme used when the user has not saved a preference. */
|
|
207
|
+
defaultTheme?: 'system' | 'light' | 'dark';
|
|
173
208
|
/** Typography settings. */
|
|
174
209
|
typography?: {
|
|
175
210
|
/** Custom font family. */
|