@intentai/react 2.2.0 → 2.3.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 +315 -160
- package/dist/index.d.mts +297 -192
- package/dist/index.d.ts +297 -192
- package/dist/index.js +2 -2129
- package/dist/index.mjs +2 -2106
- package/package.json +21 -18
- package/dist/styles.css +0 -1047
package/dist/index.d.ts
CHANGED
|
@@ -1,80 +1,189 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React$1 from 'react';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
categories?: Category[];
|
|
9
|
-
allowVoice?: boolean;
|
|
10
|
-
allowText?: boolean;
|
|
11
|
-
allowScreenshot?: boolean;
|
|
12
|
-
maxRecordingDuration?: number;
|
|
13
|
-
onSubmit?: (feedback: FeedbackData) => Promise<void>;
|
|
14
|
-
onOpen?: () => void;
|
|
15
|
-
onClose?: () => void;
|
|
16
|
-
}
|
|
17
|
-
interface Category {
|
|
4
|
+
/**
|
|
5
|
+
* User identity for feedback attribution
|
|
6
|
+
*/
|
|
7
|
+
interface UserIdentity {
|
|
8
|
+
/** Unique user identifier */
|
|
18
9
|
id: string;
|
|
19
|
-
|
|
20
|
-
|
|
10
|
+
/** User email address */
|
|
11
|
+
email?: string;
|
|
12
|
+
/** User display name */
|
|
13
|
+
name?: string;
|
|
14
|
+
/** User avatar URL */
|
|
15
|
+
avatar?: string;
|
|
16
|
+
/** Subscription plan */
|
|
17
|
+
plan?: string;
|
|
18
|
+
/** Company name */
|
|
19
|
+
company?: string;
|
|
20
|
+
/** Custom properties */
|
|
21
|
+
[key: string]: string | number | boolean | undefined;
|
|
21
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Widget position on screen
|
|
25
|
+
*/
|
|
26
|
+
type WidgetPosition = 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
|
|
27
|
+
/**
|
|
28
|
+
* Widget color theme
|
|
29
|
+
*/
|
|
30
|
+
type WidgetTheme = 'light' | 'dark' | 'auto';
|
|
31
|
+
/**
|
|
32
|
+
* Feedback type categories
|
|
33
|
+
*/
|
|
34
|
+
type FeedbackType = 'bug' | 'feature' | 'question' | 'praise' | 'other';
|
|
35
|
+
/**
|
|
36
|
+
* Sentiment analysis result
|
|
37
|
+
*/
|
|
38
|
+
type Sentiment = 'positive' | 'neutral' | 'negative';
|
|
39
|
+
/**
|
|
40
|
+
* Data returned when feedback is submitted
|
|
41
|
+
*/
|
|
22
42
|
interface FeedbackData {
|
|
23
|
-
|
|
43
|
+
/** Feedback ID */
|
|
44
|
+
id: string;
|
|
45
|
+
/** Type of feedback */
|
|
46
|
+
type: FeedbackType;
|
|
47
|
+
/** Text content */
|
|
24
48
|
content: string;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
49
|
+
/** Voice recording URL */
|
|
50
|
+
voiceUrl?: string;
|
|
51
|
+
/** Screenshot data URL */
|
|
28
52
|
screenshot?: string;
|
|
29
|
-
sentiment
|
|
53
|
+
/** AI-analyzed sentiment */
|
|
54
|
+
sentiment?: Sentiment;
|
|
55
|
+
/** Submission timestamp */
|
|
56
|
+
createdAt: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Options for opening the widget
|
|
60
|
+
*/
|
|
61
|
+
interface OpenOptions {
|
|
62
|
+
/** Pre-select feedback type */
|
|
63
|
+
type?: FeedbackType;
|
|
64
|
+
/** Prefill text content */
|
|
65
|
+
prefill?: {
|
|
66
|
+
text?: string;
|
|
67
|
+
};
|
|
68
|
+
/** Additional metadata for this feedback */
|
|
30
69
|
metadata?: Record<string, unknown>;
|
|
31
70
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
71
|
+
/**
|
|
72
|
+
* Configuration options for the Intent AI widget
|
|
73
|
+
*/
|
|
74
|
+
interface IntentAIConfig {
|
|
75
|
+
/**
|
|
76
|
+
* Your Intent AI public key (pk_live_* or pk_test_*)
|
|
77
|
+
* Can also be set via environment variables:
|
|
78
|
+
* - NEXT_PUBLIC_INTENT_AI_KEY
|
|
79
|
+
* - REACT_APP_INTENT_AI_KEY
|
|
80
|
+
* - VITE_INTENT_AI_KEY
|
|
81
|
+
*/
|
|
82
|
+
apiKey?: string;
|
|
83
|
+
/**
|
|
84
|
+
* Widget position on screen
|
|
85
|
+
* @default "bottom-right"
|
|
86
|
+
*/
|
|
87
|
+
position?: WidgetPosition;
|
|
88
|
+
/**
|
|
89
|
+
* Color theme
|
|
90
|
+
* @default "auto"
|
|
91
|
+
*/
|
|
92
|
+
theme?: WidgetTheme;
|
|
93
|
+
/**
|
|
94
|
+
* Primary brand color (hex)
|
|
95
|
+
* @default "#6366f1"
|
|
96
|
+
*/
|
|
97
|
+
primaryColor?: string;
|
|
98
|
+
/**
|
|
99
|
+
* Show widget button automatically
|
|
100
|
+
* @default true
|
|
101
|
+
*/
|
|
102
|
+
autoShow?: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Initial user identification
|
|
105
|
+
*/
|
|
106
|
+
user?: UserIdentity;
|
|
107
|
+
/**
|
|
108
|
+
* Custom metadata attached to all feedback
|
|
109
|
+
*/
|
|
42
110
|
metadata?: Record<string, unknown>;
|
|
111
|
+
/**
|
|
112
|
+
* Callback when widget is ready
|
|
113
|
+
*/
|
|
114
|
+
onReady?: () => void;
|
|
115
|
+
/**
|
|
116
|
+
* Callback when widget opens
|
|
117
|
+
*/
|
|
118
|
+
onOpen?: () => void;
|
|
119
|
+
/**
|
|
120
|
+
* Callback when widget closes
|
|
121
|
+
*/
|
|
122
|
+
onClose?: () => void;
|
|
123
|
+
/**
|
|
124
|
+
* Callback when feedback is submitted
|
|
125
|
+
*/
|
|
126
|
+
onSubmit?: (feedback: FeedbackData) => void;
|
|
127
|
+
/**
|
|
128
|
+
* Callback when an error occurs
|
|
129
|
+
*/
|
|
130
|
+
onError?: (error: Error) => void;
|
|
43
131
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
132
|
+
/**
|
|
133
|
+
* Props for IntentAIProvider component
|
|
134
|
+
*/
|
|
135
|
+
interface IntentAIProviderProps extends IntentAIConfig {
|
|
136
|
+
children: React.ReactNode;
|
|
49
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* Context value for IntentAI provider
|
|
140
|
+
*/
|
|
50
141
|
interface IntentAIContextValue {
|
|
51
|
-
/**
|
|
52
|
-
|
|
53
|
-
/**
|
|
142
|
+
/** Whether the widget is loaded and ready */
|
|
143
|
+
isReady: boolean;
|
|
144
|
+
/** Error if widget failed to load */
|
|
145
|
+
error: Error | null;
|
|
146
|
+
/** Open the feedback widget */
|
|
147
|
+
open: (options?: OpenOptions) => void;
|
|
148
|
+
/** Close the feedback widget */
|
|
149
|
+
close: () => void;
|
|
150
|
+
/** Identify a user */
|
|
151
|
+
identify: (user: UserIdentity) => void;
|
|
152
|
+
/** Track a custom event */
|
|
153
|
+
track: (event: string, properties?: Record<string, unknown>) => void;
|
|
154
|
+
/** Set custom metadata */
|
|
54
155
|
setMetadata: (metadata: Record<string, unknown>) => void;
|
|
55
|
-
/** Clear the current user */
|
|
56
|
-
clearUser: () => void;
|
|
57
|
-
/** Whether the provider is configured */
|
|
58
|
-
isConfigured: boolean;
|
|
59
156
|
}
|
|
60
157
|
/**
|
|
61
|
-
*
|
|
158
|
+
* Intent AI widget instance methods
|
|
62
159
|
*/
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
160
|
+
interface IntentAIInstance {
|
|
161
|
+
open: (options?: OpenOptions) => void;
|
|
162
|
+
close: () => void;
|
|
163
|
+
identify: (user: UserIdentity) => void;
|
|
164
|
+
track: (event: string, properties?: Record<string, unknown>) => void;
|
|
165
|
+
setMetadata: (metadata: Record<string, unknown>) => void;
|
|
166
|
+
destroy: () => void;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Window augmentation for Intent AI global
|
|
170
|
+
*/
|
|
171
|
+
declare global {
|
|
172
|
+
interface Window {
|
|
173
|
+
IntentAI?: IntentAIInstance;
|
|
174
|
+
IntentAIConfig?: IntentAIConfig;
|
|
175
|
+
}
|
|
176
|
+
interface WindowEventMap {
|
|
177
|
+
'intentai:ready': CustomEvent;
|
|
178
|
+
'intentai:open': CustomEvent;
|
|
179
|
+
'intentai:close': CustomEvent;
|
|
180
|
+
'intentai:submit': CustomEvent<FeedbackData>;
|
|
181
|
+
'intentai:error': CustomEvent<Error>;
|
|
182
|
+
}
|
|
75
183
|
}
|
|
184
|
+
|
|
76
185
|
/**
|
|
77
|
-
*
|
|
186
|
+
* Provider component for Intent AI widget
|
|
78
187
|
*
|
|
79
188
|
* @example
|
|
80
189
|
* ```tsx
|
|
@@ -82,193 +191,189 @@ interface IntentAIProviderProps extends IntentAIProviderConfig {
|
|
|
82
191
|
*
|
|
83
192
|
* function App() {
|
|
84
193
|
* return (
|
|
85
|
-
* <IntentAIProvider
|
|
86
|
-
* apiKey="your-api-key"
|
|
87
|
-
* user={{ id: 'user-123', email: 'user@example.com' }}
|
|
88
|
-
* >
|
|
194
|
+
* <IntentAIProvider apiKey="pk_live_xxxxx">
|
|
89
195
|
* <YourApp />
|
|
90
196
|
* </IntentAIProvider>
|
|
91
197
|
* );
|
|
92
198
|
* }
|
|
93
199
|
* ```
|
|
94
200
|
*/
|
|
95
|
-
declare function IntentAIProvider({
|
|
201
|
+
declare function IntentAIProvider({ children, apiKey, user, position, theme, primaryColor, autoShow, metadata, onReady, onOpen, onClose, onSubmit, onError, }: IntentAIProviderProps): react_jsx_runtime.JSX.Element;
|
|
96
202
|
/**
|
|
97
|
-
* Hook to
|
|
203
|
+
* Hook to access Intent AI widget controls
|
|
98
204
|
*
|
|
99
205
|
* @example
|
|
100
206
|
* ```tsx
|
|
101
|
-
*
|
|
102
|
-
* const identify = useIdentify();
|
|
207
|
+
* import { useIntentAI } from '@intentai/react';
|
|
103
208
|
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
* }, [user]);
|
|
209
|
+
* function FeedbackButton() {
|
|
210
|
+
* const { open, isReady } = useIntentAI();
|
|
107
211
|
*
|
|
108
|
-
* return
|
|
212
|
+
* return (
|
|
213
|
+
* <button onClick={() => open()} disabled={!isReady}>
|
|
214
|
+
* Give Feedback
|
|
215
|
+
* </button>
|
|
216
|
+
* );
|
|
109
217
|
* }
|
|
110
218
|
* ```
|
|
111
219
|
*/
|
|
112
|
-
declare function
|
|
220
|
+
declare function useIntentAI(): IntentAIContextValue;
|
|
113
221
|
/**
|
|
114
|
-
* Hook to
|
|
222
|
+
* Hook to automatically identify a user when they're available
|
|
115
223
|
*
|
|
116
224
|
* @example
|
|
117
225
|
* ```tsx
|
|
118
|
-
*
|
|
119
|
-
* const setMetadata = useSetMetadata();
|
|
120
|
-
*
|
|
121
|
-
* useEffect(() => {
|
|
122
|
-
* setMetadata({ plan, feature: 'dashboard' });
|
|
123
|
-
* }, [plan]);
|
|
226
|
+
* import { useIdentify } from '@intentai/react';
|
|
124
227
|
*
|
|
228
|
+
* function Profile({ user }) {
|
|
229
|
+
* useIdentify(user ? { id: user.id, email: user.email } : null);
|
|
125
230
|
* return <div>...</div>;
|
|
126
231
|
* }
|
|
127
232
|
* ```
|
|
128
233
|
*/
|
|
129
|
-
declare function
|
|
234
|
+
declare function useIdentify(user: UserIdentity | null | undefined): void;
|
|
130
235
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
icon?: React.ReactNode;
|
|
140
|
-
/** Button label */
|
|
141
|
-
label?: string;
|
|
142
|
-
/** Additional class name */
|
|
143
|
-
className?: string;
|
|
144
|
-
/** Custom styles */
|
|
145
|
-
style?: React.CSSProperties;
|
|
146
|
-
/** Primary color */
|
|
147
|
-
primaryColor?: string;
|
|
148
|
-
/** Click handler - if provided, will be called instead of opening widget */
|
|
149
|
-
onClick?: () => void;
|
|
150
|
-
/** Disabled state */
|
|
151
|
-
disabled?: boolean;
|
|
236
|
+
/**
|
|
237
|
+
* Props for FeedbackButton component
|
|
238
|
+
*/
|
|
239
|
+
interface FeedbackButtonProps extends React$1.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
240
|
+
/** Options to pass when opening the widget */
|
|
241
|
+
openOptions?: OpenOptions;
|
|
242
|
+
/** Custom children to render */
|
|
243
|
+
children?: React$1.ReactNode;
|
|
152
244
|
}
|
|
153
245
|
/**
|
|
154
|
-
*
|
|
246
|
+
* Pre-built button component to open the feedback widget
|
|
155
247
|
*
|
|
156
248
|
* @example
|
|
157
249
|
* ```tsx
|
|
158
|
-
*
|
|
159
|
-
* <FeedbackButton />
|
|
160
|
-
*
|
|
161
|
-
* // Custom label and style
|
|
162
|
-
* <FeedbackButton
|
|
163
|
-
* label="Give Feedback"
|
|
164
|
-
* variant="secondary"
|
|
165
|
-
* size="lg"
|
|
166
|
-
* />
|
|
250
|
+
* import { FeedbackButton } from '@intentai/react';
|
|
167
251
|
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
252
|
+
* function App() {
|
|
253
|
+
* return (
|
|
254
|
+
* <FeedbackButton className="my-custom-class">
|
|
255
|
+
* Send Feedback
|
|
256
|
+
* </FeedbackButton>
|
|
257
|
+
* );
|
|
258
|
+
* }
|
|
173
259
|
* ```
|
|
174
260
|
*/
|
|
175
|
-
declare
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
widgetUrl: string;
|
|
189
|
-
/** Widget position on screen */
|
|
190
|
-
position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
|
|
191
|
-
/** Widget theme */
|
|
192
|
-
theme?: 'light' | 'dark';
|
|
193
|
-
/** Primary color for the widget */
|
|
194
|
-
primaryColor?: string;
|
|
195
|
-
/** Enable/disable voice feedback */
|
|
196
|
-
allowVoice?: boolean;
|
|
197
|
-
/** Enable/disable text feedback */
|
|
198
|
-
allowText?: boolean;
|
|
199
|
-
/** Enable/disable screenshot capture */
|
|
200
|
-
allowScreenshot?: boolean;
|
|
201
|
-
/** Custom metadata to attach to feedback */
|
|
202
|
-
customMetadata?: Record<string, any>;
|
|
203
|
-
/** User information */
|
|
204
|
-
user?: IntentAIUser;
|
|
205
|
-
}
|
|
206
|
-
interface IntentAIProps extends IntentAIConfig {
|
|
207
|
-
/** Called when widget is opened */
|
|
208
|
-
onOpen?: () => void;
|
|
209
|
-
/** Called when widget is closed */
|
|
210
|
-
onClose?: () => void;
|
|
211
|
-
/** Called when feedback is submitted successfully */
|
|
212
|
-
onFeedbackSubmitted?: () => void;
|
|
213
|
-
/** Called when there's an error */
|
|
214
|
-
onError?: (error: Error) => void;
|
|
215
|
-
}
|
|
216
|
-
interface FeedbackIQInstance {
|
|
217
|
-
open: () => void;
|
|
218
|
-
close: () => void;
|
|
219
|
-
identify: (user: IntentAIUser) => void;
|
|
220
|
-
setMetadata: (metadata: Record<string, any>) => void;
|
|
221
|
-
destroy: () => void;
|
|
222
|
-
}
|
|
223
|
-
declare global {
|
|
224
|
-
interface Window {
|
|
225
|
-
FeedbackIQ: new (config: IntentAIConfig) => FeedbackIQInstance;
|
|
226
|
-
}
|
|
261
|
+
declare const FeedbackButton: React$1.ForwardRefExoticComponent<FeedbackButtonProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
262
|
+
/**
|
|
263
|
+
* Props for FeedbackTrigger component
|
|
264
|
+
*/
|
|
265
|
+
interface FeedbackTriggerProps {
|
|
266
|
+
/** Render function or element */
|
|
267
|
+
children: React$1.ReactElement | ((props: {
|
|
268
|
+
open: (options?: OpenOptions) => void;
|
|
269
|
+
isReady: boolean;
|
|
270
|
+
error: Error | null;
|
|
271
|
+
}) => React$1.ReactElement);
|
|
272
|
+
/** Options to pass when opening */
|
|
273
|
+
openOptions?: OpenOptions;
|
|
227
274
|
}
|
|
228
275
|
/**
|
|
229
|
-
*
|
|
276
|
+
* Headless component for custom feedback triggers
|
|
230
277
|
*
|
|
231
278
|
* @example
|
|
232
279
|
* ```tsx
|
|
233
|
-
* import {
|
|
280
|
+
* import { FeedbackTrigger } from '@intentai/react';
|
|
234
281
|
*
|
|
235
282
|
* function App() {
|
|
236
283
|
* return (
|
|
237
|
-
* <
|
|
238
|
-
*
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
-
*
|
|
284
|
+
* <FeedbackTrigger>
|
|
285
|
+
* {({ open, isReady }) => (
|
|
286
|
+
* <MyCustomButton onClick={() => open()} disabled={!isReady}>
|
|
287
|
+
* Feedback
|
|
288
|
+
* </MyCustomButton>
|
|
289
|
+
* )}
|
|
290
|
+
* </FeedbackTrigger>
|
|
291
|
+
* );
|
|
292
|
+
* }
|
|
293
|
+
* ```
|
|
294
|
+
*/
|
|
295
|
+
declare function FeedbackTrigger({ children, openOptions }: FeedbackTriggerProps): React$1.ReactElement<any, string | React$1.JSXElementConstructor<any>>;
|
|
296
|
+
/**
|
|
297
|
+
* Props for IdentifyUser component
|
|
298
|
+
*/
|
|
299
|
+
interface IdentifyUserProps {
|
|
300
|
+
/** User to identify */
|
|
301
|
+
user: UserIdentity | null | undefined;
|
|
302
|
+
/** Children to render */
|
|
303
|
+
children?: React$1.ReactNode;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Component to identify a user declaratively
|
|
307
|
+
*
|
|
308
|
+
* @example
|
|
309
|
+
* ```tsx
|
|
310
|
+
* import { IdentifyUser } from '@intentai/react';
|
|
311
|
+
*
|
|
312
|
+
* function App({ user }) {
|
|
313
|
+
* return (
|
|
314
|
+
* <IdentifyUser user={user ? { id: user.id, email: user.email } : null}>
|
|
315
|
+
* <YourApp />
|
|
316
|
+
* </IdentifyUser>
|
|
242
317
|
* );
|
|
243
318
|
* }
|
|
244
319
|
* ```
|
|
245
320
|
*/
|
|
246
|
-
declare function
|
|
321
|
+
declare function IdentifyUser({ user, children }: IdentifyUserProps): react_jsx_runtime.JSX.Element;
|
|
322
|
+
/**
|
|
323
|
+
* Props for SetMetadata component
|
|
324
|
+
*/
|
|
325
|
+
interface SetMetadataProps {
|
|
326
|
+
/** Metadata to set */
|
|
327
|
+
metadata: Record<string, unknown>;
|
|
328
|
+
/** Children to render */
|
|
329
|
+
children?: React$1.ReactNode;
|
|
330
|
+
}
|
|
247
331
|
/**
|
|
248
|
-
*
|
|
249
|
-
* @deprecated Use useIntentAI from IntentAIProvider instead for React apps
|
|
332
|
+
* Component to set metadata declaratively
|
|
250
333
|
*
|
|
251
334
|
* @example
|
|
252
335
|
* ```tsx
|
|
253
|
-
* import {
|
|
336
|
+
* import { SetMetadata } from '@intentai/react';
|
|
254
337
|
*
|
|
255
|
-
* function
|
|
256
|
-
*
|
|
338
|
+
* function PricingPage() {
|
|
339
|
+
* return (
|
|
340
|
+
* <SetMetadata metadata={{ page: 'pricing', plan: 'pro' }}>
|
|
341
|
+
* <PricingContent />
|
|
342
|
+
* </SetMetadata>
|
|
343
|
+
* );
|
|
344
|
+
* }
|
|
345
|
+
* ```
|
|
346
|
+
*/
|
|
347
|
+
declare function SetMetadata({ metadata, children }: SetMetadataProps): react_jsx_runtime.JSX.Element;
|
|
348
|
+
/**
|
|
349
|
+
* Props for TrackEvent component
|
|
350
|
+
*/
|
|
351
|
+
interface TrackEventProps {
|
|
352
|
+
/** Event name to track */
|
|
353
|
+
event: string;
|
|
354
|
+
/** Event properties */
|
|
355
|
+
properties?: Record<string, unknown>;
|
|
356
|
+
/** When to track: 'mount' (default) or 'render' */
|
|
357
|
+
trigger?: 'mount' | 'render';
|
|
358
|
+
/** Children to render */
|
|
359
|
+
children?: React$1.ReactNode;
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Component to track events declaratively
|
|
257
363
|
*
|
|
364
|
+
* @example
|
|
365
|
+
* ```tsx
|
|
366
|
+
* import { TrackEvent } from '@intentai/react';
|
|
367
|
+
*
|
|
368
|
+
* function CheckoutPage() {
|
|
258
369
|
* return (
|
|
259
|
-
*
|
|
260
|
-
* <
|
|
261
|
-
*
|
|
262
|
-
* </>
|
|
370
|
+
* <TrackEvent event="checkout_viewed" properties={{ items: 3 }}>
|
|
371
|
+
* <CheckoutContent />
|
|
372
|
+
* </TrackEvent>
|
|
263
373
|
* );
|
|
264
374
|
* }
|
|
265
375
|
* ```
|
|
266
376
|
*/
|
|
267
|
-
declare function
|
|
268
|
-
open: () => void;
|
|
269
|
-
close: () => void;
|
|
270
|
-
identify: (user: IntentAIUser) => void;
|
|
271
|
-
setMetadata: (metadata: Record<string, any>) => void;
|
|
272
|
-
};
|
|
377
|
+
declare function TrackEvent({ event, properties, trigger, children, }: TrackEventProps): react_jsx_runtime.JSX.Element;
|
|
273
378
|
|
|
274
|
-
export { FeedbackButton, type FeedbackButtonProps, type IntentAIConfig, type IntentAIContextValue, type
|
|
379
|
+
export { FeedbackButton, type FeedbackButtonProps, type FeedbackData, FeedbackTrigger, type FeedbackTriggerProps, type FeedbackType, IdentifyUser, type IdentifyUserProps, type IntentAIConfig, type IntentAIContextValue, type IntentAIInstance, IntentAIProvider, type IntentAIProviderProps, type OpenOptions, type Sentiment, SetMetadata, type SetMetadataProps, TrackEvent, type TrackEventProps, type UserIdentity, type WidgetPosition, type WidgetTheme, useIdentify, useIntentAI };
|