@diegotsi/flint-react 0.1.2 → 0.1.3
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/dist/index.d.cts +500 -4
- package/dist/index.d.ts +500 -4
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,10 +1,506 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
|
|
3
|
+
type Severity = "P1" | "P2" | "P3" | "P4";
|
|
4
|
+
interface EnvironmentInfo {
|
|
5
|
+
browser: string;
|
|
6
|
+
os: string;
|
|
7
|
+
viewport: string;
|
|
8
|
+
screen: string;
|
|
9
|
+
language: string;
|
|
10
|
+
timezone: string;
|
|
11
|
+
online: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface ConsoleEntry {
|
|
14
|
+
level: "log" | "warn" | "error";
|
|
15
|
+
args: string;
|
|
16
|
+
timestamp: number;
|
|
17
|
+
}
|
|
18
|
+
interface NetworkEntry {
|
|
19
|
+
method: string;
|
|
20
|
+
url: string;
|
|
21
|
+
status: number;
|
|
22
|
+
duration: number;
|
|
23
|
+
timestamp: number;
|
|
24
|
+
}
|
|
25
|
+
type Locale = "pt-BR" | "en-US";
|
|
26
|
+
type Theme = "light" | "dark" | ThemeOverride;
|
|
27
|
+
interface ThemeOverride {
|
|
28
|
+
background?: string;
|
|
29
|
+
accent?: string;
|
|
30
|
+
text?: string;
|
|
31
|
+
border?: string;
|
|
32
|
+
}
|
|
33
|
+
interface FlintUser {
|
|
34
|
+
id: string;
|
|
35
|
+
name: string;
|
|
36
|
+
}
|
|
37
|
+
interface FlintExtraFields {
|
|
38
|
+
/** Session replay URL from Datadog RUM, FullStory, LogRocket, etc. */
|
|
39
|
+
sessionReplay?: string;
|
|
40
|
+
[key: string]: unknown;
|
|
41
|
+
}
|
|
42
|
+
interface FlintWidgetProps {
|
|
43
|
+
/** Project API key — get this from the flint-server admin API */
|
|
44
|
+
projectKey: string;
|
|
45
|
+
/** Full URL of the flint-server, e.g. "https://bugs.example.com" */
|
|
46
|
+
serverUrl: string;
|
|
47
|
+
/** Authenticated user info (optional) */
|
|
48
|
+
user?: FlintUser;
|
|
49
|
+
/** Arbitrary metadata to attach to every report */
|
|
50
|
+
meta?: Record<string, unknown>;
|
|
51
|
+
/** Extra fields for developer use (e.g. external session replay URL) */
|
|
52
|
+
extraFields?: FlintExtraFields;
|
|
53
|
+
/** Label shown on the trigger button. Default: "Reportar bug" */
|
|
54
|
+
buttonLabel?: string;
|
|
55
|
+
/** Locale for UI strings. Default: "pt-BR" */
|
|
56
|
+
locale?: Locale;
|
|
57
|
+
/** Visual theme. Default: "light" */
|
|
58
|
+
theme?: Theme;
|
|
59
|
+
/** Custom z-index for the widget. Default: 9999 */
|
|
60
|
+
zIndex?: number;
|
|
61
|
+
}
|
|
62
|
+
interface ReportPayload {
|
|
63
|
+
reporterId: string;
|
|
64
|
+
reporterName: string;
|
|
65
|
+
description: string;
|
|
66
|
+
expectedBehavior?: string;
|
|
67
|
+
stepsToReproduce?: {
|
|
68
|
+
action: string;
|
|
69
|
+
result: string;
|
|
70
|
+
}[];
|
|
71
|
+
externalReplayUrl?: string;
|
|
72
|
+
additionalContext?: string;
|
|
73
|
+
severity: Severity;
|
|
74
|
+
url?: string;
|
|
75
|
+
meta?: Record<string, unknown>;
|
|
76
|
+
}
|
|
77
|
+
interface ReportResult {
|
|
78
|
+
id: string;
|
|
79
|
+
status: string;
|
|
80
|
+
githubIssueUrl?: string | null;
|
|
81
|
+
isDuplicate: boolean;
|
|
82
|
+
duplicateOfId?: string | null;
|
|
83
|
+
}
|
|
5
84
|
|
|
6
85
|
declare function FlintWidget(props: FlintWidgetProps): react_jsx_runtime.JSX.Element;
|
|
7
86
|
|
|
87
|
+
declare type addedNodeMutation = {
|
|
88
|
+
parentId: number;
|
|
89
|
+
previousId?: number | null;
|
|
90
|
+
nextId: number | null;
|
|
91
|
+
node: serializedNodeWithId;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
declare type adoptedStyleSheetData = {
|
|
95
|
+
source: IncrementalSource.AdoptedStyleSheet;
|
|
96
|
+
} & adoptedStyleSheetParam;
|
|
97
|
+
|
|
98
|
+
declare type adoptedStyleSheetParam = {
|
|
99
|
+
id: number;
|
|
100
|
+
styles?: {
|
|
101
|
+
styleId: number;
|
|
102
|
+
rules: styleSheetAddRule[];
|
|
103
|
+
}[];
|
|
104
|
+
styleIds: number[];
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
declare type attributeMutation = {
|
|
108
|
+
id: number;
|
|
109
|
+
attributes: {
|
|
110
|
+
[key: string]: string | styleOMValue | null;
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
declare type attributes = cssTextKeyAttr & {
|
|
115
|
+
[key: string]: string | number | true | null;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
declare enum CanvasContext {
|
|
119
|
+
'2D' = 0,
|
|
120
|
+
WebGL = 1,
|
|
121
|
+
WebGL2 = 2
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
declare type canvasMutationCommand = {
|
|
125
|
+
property: string;
|
|
126
|
+
args: Array<unknown>;
|
|
127
|
+
setter?: true;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
declare type canvasMutationData = {
|
|
131
|
+
source: IncrementalSource.CanvasMutation;
|
|
132
|
+
} & canvasMutationParam;
|
|
133
|
+
|
|
134
|
+
declare type canvasMutationParam = {
|
|
135
|
+
id: number;
|
|
136
|
+
type: CanvasContext;
|
|
137
|
+
commands: canvasMutationCommand[];
|
|
138
|
+
} | ({
|
|
139
|
+
id: number;
|
|
140
|
+
type: CanvasContext;
|
|
141
|
+
} & canvasMutationCommand);
|
|
142
|
+
|
|
143
|
+
declare type cdataNode = {
|
|
144
|
+
type: NodeType.CDATA;
|
|
145
|
+
textContent: '';
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
declare type commentNode = {
|
|
149
|
+
type: NodeType.Comment;
|
|
150
|
+
textContent: string;
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
declare type cssTextKeyAttr = {
|
|
154
|
+
_cssText?: string;
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
declare type customElementData = {
|
|
158
|
+
source: IncrementalSource.CustomElement;
|
|
159
|
+
} & customElementParam;
|
|
160
|
+
|
|
161
|
+
declare type customElementParam = {
|
|
162
|
+
define?: {
|
|
163
|
+
name: string;
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
declare type customEvent<T = unknown> = {
|
|
168
|
+
type: EventType.Custom;
|
|
169
|
+
data: {
|
|
170
|
+
tag: string;
|
|
171
|
+
payload: T;
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
declare type documentNode = {
|
|
176
|
+
type: NodeType.Document;
|
|
177
|
+
childNodes: serializedNodeWithId[];
|
|
178
|
+
compatMode?: string;
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
declare type documentTypeNode = {
|
|
182
|
+
type: NodeType.DocumentType;
|
|
183
|
+
name: string;
|
|
184
|
+
publicId: string;
|
|
185
|
+
systemId: string;
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
declare type domContentLoadedEvent = {
|
|
189
|
+
type: EventType.DomContentLoaded;
|
|
190
|
+
data: unknown;
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
declare type elementNode = {
|
|
194
|
+
type: NodeType.Element;
|
|
195
|
+
tagName: string;
|
|
196
|
+
attributes: attributes;
|
|
197
|
+
childNodes: serializedNodeWithId[];
|
|
198
|
+
isSVG?: true;
|
|
199
|
+
needBlock?: boolean;
|
|
200
|
+
isCustom?: true;
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
declare enum EventType {
|
|
204
|
+
DomContentLoaded = 0,
|
|
205
|
+
Load = 1,
|
|
206
|
+
FullSnapshot = 2,
|
|
207
|
+
IncrementalSnapshot = 3,
|
|
208
|
+
Meta = 4,
|
|
209
|
+
Custom = 5,
|
|
210
|
+
Plugin = 6
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
declare type eventWithoutTime = domContentLoadedEvent | loadedEvent | fullSnapshotEvent | incrementalSnapshotEvent | metaEvent | customEvent | pluginEvent;
|
|
214
|
+
|
|
215
|
+
declare type eventWithTime = eventWithoutTime & {
|
|
216
|
+
timestamp: number;
|
|
217
|
+
delay?: number;
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
declare type fontData = {
|
|
221
|
+
source: IncrementalSource.Font;
|
|
222
|
+
} & fontParam;
|
|
223
|
+
|
|
224
|
+
declare type fontParam = {
|
|
225
|
+
family: string;
|
|
226
|
+
fontSource: string;
|
|
227
|
+
buffer: boolean;
|
|
228
|
+
descriptors?: FontFaceDescriptors;
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
declare type fullSnapshotEvent = {
|
|
232
|
+
type: EventType.FullSnapshot;
|
|
233
|
+
data: {
|
|
234
|
+
node: serializedNodeWithId;
|
|
235
|
+
initialOffset: {
|
|
236
|
+
top: number;
|
|
237
|
+
left: number;
|
|
238
|
+
};
|
|
239
|
+
};
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
declare type incrementalData = mutationData | mousemoveData | mouseInteractionData | scrollData | viewportResizeData | inputData | mediaInteractionData | styleSheetRuleData | canvasMutationData | fontData | selectionData | styleDeclarationData | adoptedStyleSheetData | customElementData;
|
|
243
|
+
|
|
244
|
+
declare type incrementalSnapshotEvent = {
|
|
245
|
+
type: EventType.IncrementalSnapshot;
|
|
246
|
+
data: incrementalData;
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
declare enum IncrementalSource {
|
|
250
|
+
Mutation = 0,
|
|
251
|
+
MouseMove = 1,
|
|
252
|
+
MouseInteraction = 2,
|
|
253
|
+
Scroll = 3,
|
|
254
|
+
ViewportResize = 4,
|
|
255
|
+
Input = 5,
|
|
256
|
+
TouchMove = 6,
|
|
257
|
+
MediaInteraction = 7,
|
|
258
|
+
StyleSheetRule = 8,
|
|
259
|
+
CanvasMutation = 9,
|
|
260
|
+
Font = 10,
|
|
261
|
+
Log = 11,
|
|
262
|
+
Drag = 12,
|
|
263
|
+
StyleDeclaration = 13,
|
|
264
|
+
Selection = 14,
|
|
265
|
+
AdoptedStyleSheet = 15,
|
|
266
|
+
CustomElement = 16
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
declare type inputData = {
|
|
270
|
+
source: IncrementalSource.Input;
|
|
271
|
+
id: number;
|
|
272
|
+
} & inputValue;
|
|
273
|
+
|
|
274
|
+
declare type inputValue = {
|
|
275
|
+
text: string;
|
|
276
|
+
isChecked: boolean;
|
|
277
|
+
userTriggered?: boolean;
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
declare type loadedEvent = {
|
|
281
|
+
type: EventType.Load;
|
|
282
|
+
data: unknown;
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
declare type mediaInteractionData = {
|
|
286
|
+
source: IncrementalSource.MediaInteraction;
|
|
287
|
+
} & mediaInteractionParam;
|
|
288
|
+
|
|
289
|
+
declare type mediaInteractionParam = {
|
|
290
|
+
type: MediaInteractions;
|
|
291
|
+
id: number;
|
|
292
|
+
currentTime?: number;
|
|
293
|
+
volume?: number;
|
|
294
|
+
muted?: boolean;
|
|
295
|
+
loop?: boolean;
|
|
296
|
+
playbackRate?: number;
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
declare enum MediaInteractions {
|
|
300
|
+
Play = 0,
|
|
301
|
+
Pause = 1,
|
|
302
|
+
Seeked = 2,
|
|
303
|
+
VolumeChange = 3,
|
|
304
|
+
RateChange = 4
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
declare type metaEvent = {
|
|
308
|
+
type: EventType.Meta;
|
|
309
|
+
data: {
|
|
310
|
+
href: string;
|
|
311
|
+
width: number;
|
|
312
|
+
height: number;
|
|
313
|
+
};
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
declare type mouseInteractionData = {
|
|
317
|
+
source: IncrementalSource.MouseInteraction;
|
|
318
|
+
} & mouseInteractionParam;
|
|
319
|
+
|
|
320
|
+
declare type mouseInteractionParam = {
|
|
321
|
+
type: MouseInteractions;
|
|
322
|
+
id: number;
|
|
323
|
+
x?: number;
|
|
324
|
+
y?: number;
|
|
325
|
+
pointerType?: PointerTypes;
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
declare enum MouseInteractions {
|
|
329
|
+
MouseUp = 0,
|
|
330
|
+
MouseDown = 1,
|
|
331
|
+
Click = 2,
|
|
332
|
+
ContextMenu = 3,
|
|
333
|
+
DblClick = 4,
|
|
334
|
+
Focus = 5,
|
|
335
|
+
Blur = 6,
|
|
336
|
+
TouchStart = 7,
|
|
337
|
+
TouchMove_Departed = 8,
|
|
338
|
+
TouchEnd = 9,
|
|
339
|
+
TouchCancel = 10
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
declare type mousemoveData = {
|
|
343
|
+
source: IncrementalSource.MouseMove | IncrementalSource.TouchMove | IncrementalSource.Drag;
|
|
344
|
+
positions: mousePosition[];
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
declare type mousePosition = {
|
|
348
|
+
x: number;
|
|
349
|
+
y: number;
|
|
350
|
+
id: number;
|
|
351
|
+
timeOffset: number;
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
declare type mutationCallbackParam = {
|
|
355
|
+
texts: textMutation[];
|
|
356
|
+
attributes: attributeMutation[];
|
|
357
|
+
removes: removedNodeMutation[];
|
|
358
|
+
adds: addedNodeMutation[];
|
|
359
|
+
isAttachIframe?: true;
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
declare type mutationData = {
|
|
363
|
+
source: IncrementalSource.Mutation;
|
|
364
|
+
} & mutationCallbackParam;
|
|
365
|
+
|
|
366
|
+
declare enum NodeType {
|
|
367
|
+
Document = 0,
|
|
368
|
+
DocumentType = 1,
|
|
369
|
+
Element = 2,
|
|
370
|
+
Text = 3,
|
|
371
|
+
CDATA = 4,
|
|
372
|
+
Comment = 5
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
declare type pluginEvent<T = unknown> = {
|
|
376
|
+
type: EventType.Plugin;
|
|
377
|
+
data: {
|
|
378
|
+
plugin: string;
|
|
379
|
+
payload: T;
|
|
380
|
+
};
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
declare enum PointerTypes {
|
|
384
|
+
Mouse = 0,
|
|
385
|
+
Pen = 1,
|
|
386
|
+
Touch = 2
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
declare type removedNodeMutation = {
|
|
390
|
+
parentId: number;
|
|
391
|
+
id: number;
|
|
392
|
+
isShadow?: boolean;
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
declare type scrollData = {
|
|
396
|
+
source: IncrementalSource.Scroll;
|
|
397
|
+
} & scrollPosition;
|
|
398
|
+
|
|
399
|
+
declare type scrollPosition = {
|
|
400
|
+
id: number;
|
|
401
|
+
x: number;
|
|
402
|
+
y: number;
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
declare type selectionData = {
|
|
406
|
+
source: IncrementalSource.Selection;
|
|
407
|
+
} & selectionParam;
|
|
408
|
+
|
|
409
|
+
declare type selectionParam = {
|
|
410
|
+
ranges: Array<SelectionRange>;
|
|
411
|
+
};
|
|
412
|
+
|
|
413
|
+
declare type SelectionRange = {
|
|
414
|
+
start: number;
|
|
415
|
+
startOffset: number;
|
|
416
|
+
end: number;
|
|
417
|
+
endOffset: number;
|
|
418
|
+
};
|
|
419
|
+
|
|
420
|
+
declare type serializedNode = (documentNode | documentTypeNode | elementNode | textNode | cdataNode | commentNode) & {
|
|
421
|
+
rootId?: number;
|
|
422
|
+
isShadowHost?: boolean;
|
|
423
|
+
isShadow?: boolean;
|
|
424
|
+
};
|
|
425
|
+
|
|
426
|
+
declare type serializedNodeWithId = serializedNode & {
|
|
427
|
+
id: number;
|
|
428
|
+
};
|
|
429
|
+
|
|
430
|
+
declare type styleDeclarationData = {
|
|
431
|
+
source: IncrementalSource.StyleDeclaration;
|
|
432
|
+
} & styleDeclarationParam;
|
|
433
|
+
|
|
434
|
+
declare type styleDeclarationParam = {
|
|
435
|
+
id?: number;
|
|
436
|
+
styleId?: number;
|
|
437
|
+
index: number[];
|
|
438
|
+
set?: {
|
|
439
|
+
property: string;
|
|
440
|
+
value: string | null;
|
|
441
|
+
priority: string | undefined;
|
|
442
|
+
};
|
|
443
|
+
remove?: {
|
|
444
|
+
property: string;
|
|
445
|
+
};
|
|
446
|
+
};
|
|
447
|
+
|
|
448
|
+
declare type styleOMValue = {
|
|
449
|
+
[key: string]: styleValueWithPriority | string | false;
|
|
450
|
+
};
|
|
451
|
+
|
|
452
|
+
declare type styleSheetAddRule = {
|
|
453
|
+
rule: string;
|
|
454
|
+
index?: number | number[];
|
|
455
|
+
};
|
|
456
|
+
|
|
457
|
+
declare type styleSheetDeleteRule = {
|
|
458
|
+
index: number | number[];
|
|
459
|
+
};
|
|
460
|
+
|
|
461
|
+
declare type styleSheetRuleData = {
|
|
462
|
+
source: IncrementalSource.StyleSheetRule;
|
|
463
|
+
} & styleSheetRuleParam;
|
|
464
|
+
|
|
465
|
+
declare type styleSheetRuleParam = {
|
|
466
|
+
id?: number;
|
|
467
|
+
styleId?: number;
|
|
468
|
+
removes?: styleSheetDeleteRule[];
|
|
469
|
+
adds?: styleSheetAddRule[];
|
|
470
|
+
replace?: string;
|
|
471
|
+
replaceSync?: string;
|
|
472
|
+
};
|
|
473
|
+
|
|
474
|
+
declare type styleValueWithPriority = [string, string];
|
|
475
|
+
|
|
476
|
+
declare type textMutation = {
|
|
477
|
+
id: number;
|
|
478
|
+
value: string | null;
|
|
479
|
+
};
|
|
480
|
+
|
|
481
|
+
declare type textNode = {
|
|
482
|
+
type: NodeType.Text;
|
|
483
|
+
textContent: string;
|
|
484
|
+
isStyle?: true;
|
|
485
|
+
};
|
|
486
|
+
|
|
487
|
+
declare type viewportResizeData = {
|
|
488
|
+
source: IncrementalSource.ViewportResize;
|
|
489
|
+
} & viewportResizeDimension;
|
|
490
|
+
|
|
491
|
+
declare type viewportResizeDimension = {
|
|
492
|
+
width: number;
|
|
493
|
+
height: number;
|
|
494
|
+
};
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
|
|
498
|
+
declare global {
|
|
499
|
+
interface Window {
|
|
500
|
+
FontFace: typeof FontFace;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
|
|
8
504
|
interface Props {
|
|
9
505
|
projectKey: string;
|
|
10
506
|
serverUrl: string;
|
|
@@ -21,4 +517,4 @@ interface Props {
|
|
|
21
517
|
}
|
|
22
518
|
declare function FlintModal({ projectKey, serverUrl, user, meta, theme, zIndex, onClose, getEnvironment, getConsoleLogs, getNetworkErrors, getReplayEvents, externalReplayUrl, }: Props): react_jsx_runtime.JSX.Element;
|
|
23
519
|
|
|
24
|
-
export { FlintModal, FlintWidget };
|
|
520
|
+
export { FlintModal, type FlintUser, FlintWidget, type FlintWidgetProps, type Locale, type ReportPayload, type ReportResult, type Severity, type Theme, type ThemeOverride };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,506 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
|
|
3
|
+
type Severity = "P1" | "P2" | "P3" | "P4";
|
|
4
|
+
interface EnvironmentInfo {
|
|
5
|
+
browser: string;
|
|
6
|
+
os: string;
|
|
7
|
+
viewport: string;
|
|
8
|
+
screen: string;
|
|
9
|
+
language: string;
|
|
10
|
+
timezone: string;
|
|
11
|
+
online: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface ConsoleEntry {
|
|
14
|
+
level: "log" | "warn" | "error";
|
|
15
|
+
args: string;
|
|
16
|
+
timestamp: number;
|
|
17
|
+
}
|
|
18
|
+
interface NetworkEntry {
|
|
19
|
+
method: string;
|
|
20
|
+
url: string;
|
|
21
|
+
status: number;
|
|
22
|
+
duration: number;
|
|
23
|
+
timestamp: number;
|
|
24
|
+
}
|
|
25
|
+
type Locale = "pt-BR" | "en-US";
|
|
26
|
+
type Theme = "light" | "dark" | ThemeOverride;
|
|
27
|
+
interface ThemeOverride {
|
|
28
|
+
background?: string;
|
|
29
|
+
accent?: string;
|
|
30
|
+
text?: string;
|
|
31
|
+
border?: string;
|
|
32
|
+
}
|
|
33
|
+
interface FlintUser {
|
|
34
|
+
id: string;
|
|
35
|
+
name: string;
|
|
36
|
+
}
|
|
37
|
+
interface FlintExtraFields {
|
|
38
|
+
/** Session replay URL from Datadog RUM, FullStory, LogRocket, etc. */
|
|
39
|
+
sessionReplay?: string;
|
|
40
|
+
[key: string]: unknown;
|
|
41
|
+
}
|
|
42
|
+
interface FlintWidgetProps {
|
|
43
|
+
/** Project API key — get this from the flint-server admin API */
|
|
44
|
+
projectKey: string;
|
|
45
|
+
/** Full URL of the flint-server, e.g. "https://bugs.example.com" */
|
|
46
|
+
serverUrl: string;
|
|
47
|
+
/** Authenticated user info (optional) */
|
|
48
|
+
user?: FlintUser;
|
|
49
|
+
/** Arbitrary metadata to attach to every report */
|
|
50
|
+
meta?: Record<string, unknown>;
|
|
51
|
+
/** Extra fields for developer use (e.g. external session replay URL) */
|
|
52
|
+
extraFields?: FlintExtraFields;
|
|
53
|
+
/** Label shown on the trigger button. Default: "Reportar bug" */
|
|
54
|
+
buttonLabel?: string;
|
|
55
|
+
/** Locale for UI strings. Default: "pt-BR" */
|
|
56
|
+
locale?: Locale;
|
|
57
|
+
/** Visual theme. Default: "light" */
|
|
58
|
+
theme?: Theme;
|
|
59
|
+
/** Custom z-index for the widget. Default: 9999 */
|
|
60
|
+
zIndex?: number;
|
|
61
|
+
}
|
|
62
|
+
interface ReportPayload {
|
|
63
|
+
reporterId: string;
|
|
64
|
+
reporterName: string;
|
|
65
|
+
description: string;
|
|
66
|
+
expectedBehavior?: string;
|
|
67
|
+
stepsToReproduce?: {
|
|
68
|
+
action: string;
|
|
69
|
+
result: string;
|
|
70
|
+
}[];
|
|
71
|
+
externalReplayUrl?: string;
|
|
72
|
+
additionalContext?: string;
|
|
73
|
+
severity: Severity;
|
|
74
|
+
url?: string;
|
|
75
|
+
meta?: Record<string, unknown>;
|
|
76
|
+
}
|
|
77
|
+
interface ReportResult {
|
|
78
|
+
id: string;
|
|
79
|
+
status: string;
|
|
80
|
+
githubIssueUrl?: string | null;
|
|
81
|
+
isDuplicate: boolean;
|
|
82
|
+
duplicateOfId?: string | null;
|
|
83
|
+
}
|
|
5
84
|
|
|
6
85
|
declare function FlintWidget(props: FlintWidgetProps): react_jsx_runtime.JSX.Element;
|
|
7
86
|
|
|
87
|
+
declare type addedNodeMutation = {
|
|
88
|
+
parentId: number;
|
|
89
|
+
previousId?: number | null;
|
|
90
|
+
nextId: number | null;
|
|
91
|
+
node: serializedNodeWithId;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
declare type adoptedStyleSheetData = {
|
|
95
|
+
source: IncrementalSource.AdoptedStyleSheet;
|
|
96
|
+
} & adoptedStyleSheetParam;
|
|
97
|
+
|
|
98
|
+
declare type adoptedStyleSheetParam = {
|
|
99
|
+
id: number;
|
|
100
|
+
styles?: {
|
|
101
|
+
styleId: number;
|
|
102
|
+
rules: styleSheetAddRule[];
|
|
103
|
+
}[];
|
|
104
|
+
styleIds: number[];
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
declare type attributeMutation = {
|
|
108
|
+
id: number;
|
|
109
|
+
attributes: {
|
|
110
|
+
[key: string]: string | styleOMValue | null;
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
declare type attributes = cssTextKeyAttr & {
|
|
115
|
+
[key: string]: string | number | true | null;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
declare enum CanvasContext {
|
|
119
|
+
'2D' = 0,
|
|
120
|
+
WebGL = 1,
|
|
121
|
+
WebGL2 = 2
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
declare type canvasMutationCommand = {
|
|
125
|
+
property: string;
|
|
126
|
+
args: Array<unknown>;
|
|
127
|
+
setter?: true;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
declare type canvasMutationData = {
|
|
131
|
+
source: IncrementalSource.CanvasMutation;
|
|
132
|
+
} & canvasMutationParam;
|
|
133
|
+
|
|
134
|
+
declare type canvasMutationParam = {
|
|
135
|
+
id: number;
|
|
136
|
+
type: CanvasContext;
|
|
137
|
+
commands: canvasMutationCommand[];
|
|
138
|
+
} | ({
|
|
139
|
+
id: number;
|
|
140
|
+
type: CanvasContext;
|
|
141
|
+
} & canvasMutationCommand);
|
|
142
|
+
|
|
143
|
+
declare type cdataNode = {
|
|
144
|
+
type: NodeType.CDATA;
|
|
145
|
+
textContent: '';
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
declare type commentNode = {
|
|
149
|
+
type: NodeType.Comment;
|
|
150
|
+
textContent: string;
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
declare type cssTextKeyAttr = {
|
|
154
|
+
_cssText?: string;
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
declare type customElementData = {
|
|
158
|
+
source: IncrementalSource.CustomElement;
|
|
159
|
+
} & customElementParam;
|
|
160
|
+
|
|
161
|
+
declare type customElementParam = {
|
|
162
|
+
define?: {
|
|
163
|
+
name: string;
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
declare type customEvent<T = unknown> = {
|
|
168
|
+
type: EventType.Custom;
|
|
169
|
+
data: {
|
|
170
|
+
tag: string;
|
|
171
|
+
payload: T;
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
declare type documentNode = {
|
|
176
|
+
type: NodeType.Document;
|
|
177
|
+
childNodes: serializedNodeWithId[];
|
|
178
|
+
compatMode?: string;
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
declare type documentTypeNode = {
|
|
182
|
+
type: NodeType.DocumentType;
|
|
183
|
+
name: string;
|
|
184
|
+
publicId: string;
|
|
185
|
+
systemId: string;
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
declare type domContentLoadedEvent = {
|
|
189
|
+
type: EventType.DomContentLoaded;
|
|
190
|
+
data: unknown;
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
declare type elementNode = {
|
|
194
|
+
type: NodeType.Element;
|
|
195
|
+
tagName: string;
|
|
196
|
+
attributes: attributes;
|
|
197
|
+
childNodes: serializedNodeWithId[];
|
|
198
|
+
isSVG?: true;
|
|
199
|
+
needBlock?: boolean;
|
|
200
|
+
isCustom?: true;
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
declare enum EventType {
|
|
204
|
+
DomContentLoaded = 0,
|
|
205
|
+
Load = 1,
|
|
206
|
+
FullSnapshot = 2,
|
|
207
|
+
IncrementalSnapshot = 3,
|
|
208
|
+
Meta = 4,
|
|
209
|
+
Custom = 5,
|
|
210
|
+
Plugin = 6
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
declare type eventWithoutTime = domContentLoadedEvent | loadedEvent | fullSnapshotEvent | incrementalSnapshotEvent | metaEvent | customEvent | pluginEvent;
|
|
214
|
+
|
|
215
|
+
declare type eventWithTime = eventWithoutTime & {
|
|
216
|
+
timestamp: number;
|
|
217
|
+
delay?: number;
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
declare type fontData = {
|
|
221
|
+
source: IncrementalSource.Font;
|
|
222
|
+
} & fontParam;
|
|
223
|
+
|
|
224
|
+
declare type fontParam = {
|
|
225
|
+
family: string;
|
|
226
|
+
fontSource: string;
|
|
227
|
+
buffer: boolean;
|
|
228
|
+
descriptors?: FontFaceDescriptors;
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
declare type fullSnapshotEvent = {
|
|
232
|
+
type: EventType.FullSnapshot;
|
|
233
|
+
data: {
|
|
234
|
+
node: serializedNodeWithId;
|
|
235
|
+
initialOffset: {
|
|
236
|
+
top: number;
|
|
237
|
+
left: number;
|
|
238
|
+
};
|
|
239
|
+
};
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
declare type incrementalData = mutationData | mousemoveData | mouseInteractionData | scrollData | viewportResizeData | inputData | mediaInteractionData | styleSheetRuleData | canvasMutationData | fontData | selectionData | styleDeclarationData | adoptedStyleSheetData | customElementData;
|
|
243
|
+
|
|
244
|
+
declare type incrementalSnapshotEvent = {
|
|
245
|
+
type: EventType.IncrementalSnapshot;
|
|
246
|
+
data: incrementalData;
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
declare enum IncrementalSource {
|
|
250
|
+
Mutation = 0,
|
|
251
|
+
MouseMove = 1,
|
|
252
|
+
MouseInteraction = 2,
|
|
253
|
+
Scroll = 3,
|
|
254
|
+
ViewportResize = 4,
|
|
255
|
+
Input = 5,
|
|
256
|
+
TouchMove = 6,
|
|
257
|
+
MediaInteraction = 7,
|
|
258
|
+
StyleSheetRule = 8,
|
|
259
|
+
CanvasMutation = 9,
|
|
260
|
+
Font = 10,
|
|
261
|
+
Log = 11,
|
|
262
|
+
Drag = 12,
|
|
263
|
+
StyleDeclaration = 13,
|
|
264
|
+
Selection = 14,
|
|
265
|
+
AdoptedStyleSheet = 15,
|
|
266
|
+
CustomElement = 16
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
declare type inputData = {
|
|
270
|
+
source: IncrementalSource.Input;
|
|
271
|
+
id: number;
|
|
272
|
+
} & inputValue;
|
|
273
|
+
|
|
274
|
+
declare type inputValue = {
|
|
275
|
+
text: string;
|
|
276
|
+
isChecked: boolean;
|
|
277
|
+
userTriggered?: boolean;
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
declare type loadedEvent = {
|
|
281
|
+
type: EventType.Load;
|
|
282
|
+
data: unknown;
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
declare type mediaInteractionData = {
|
|
286
|
+
source: IncrementalSource.MediaInteraction;
|
|
287
|
+
} & mediaInteractionParam;
|
|
288
|
+
|
|
289
|
+
declare type mediaInteractionParam = {
|
|
290
|
+
type: MediaInteractions;
|
|
291
|
+
id: number;
|
|
292
|
+
currentTime?: number;
|
|
293
|
+
volume?: number;
|
|
294
|
+
muted?: boolean;
|
|
295
|
+
loop?: boolean;
|
|
296
|
+
playbackRate?: number;
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
declare enum MediaInteractions {
|
|
300
|
+
Play = 0,
|
|
301
|
+
Pause = 1,
|
|
302
|
+
Seeked = 2,
|
|
303
|
+
VolumeChange = 3,
|
|
304
|
+
RateChange = 4
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
declare type metaEvent = {
|
|
308
|
+
type: EventType.Meta;
|
|
309
|
+
data: {
|
|
310
|
+
href: string;
|
|
311
|
+
width: number;
|
|
312
|
+
height: number;
|
|
313
|
+
};
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
declare type mouseInteractionData = {
|
|
317
|
+
source: IncrementalSource.MouseInteraction;
|
|
318
|
+
} & mouseInteractionParam;
|
|
319
|
+
|
|
320
|
+
declare type mouseInteractionParam = {
|
|
321
|
+
type: MouseInteractions;
|
|
322
|
+
id: number;
|
|
323
|
+
x?: number;
|
|
324
|
+
y?: number;
|
|
325
|
+
pointerType?: PointerTypes;
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
declare enum MouseInteractions {
|
|
329
|
+
MouseUp = 0,
|
|
330
|
+
MouseDown = 1,
|
|
331
|
+
Click = 2,
|
|
332
|
+
ContextMenu = 3,
|
|
333
|
+
DblClick = 4,
|
|
334
|
+
Focus = 5,
|
|
335
|
+
Blur = 6,
|
|
336
|
+
TouchStart = 7,
|
|
337
|
+
TouchMove_Departed = 8,
|
|
338
|
+
TouchEnd = 9,
|
|
339
|
+
TouchCancel = 10
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
declare type mousemoveData = {
|
|
343
|
+
source: IncrementalSource.MouseMove | IncrementalSource.TouchMove | IncrementalSource.Drag;
|
|
344
|
+
positions: mousePosition[];
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
declare type mousePosition = {
|
|
348
|
+
x: number;
|
|
349
|
+
y: number;
|
|
350
|
+
id: number;
|
|
351
|
+
timeOffset: number;
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
declare type mutationCallbackParam = {
|
|
355
|
+
texts: textMutation[];
|
|
356
|
+
attributes: attributeMutation[];
|
|
357
|
+
removes: removedNodeMutation[];
|
|
358
|
+
adds: addedNodeMutation[];
|
|
359
|
+
isAttachIframe?: true;
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
declare type mutationData = {
|
|
363
|
+
source: IncrementalSource.Mutation;
|
|
364
|
+
} & mutationCallbackParam;
|
|
365
|
+
|
|
366
|
+
declare enum NodeType {
|
|
367
|
+
Document = 0,
|
|
368
|
+
DocumentType = 1,
|
|
369
|
+
Element = 2,
|
|
370
|
+
Text = 3,
|
|
371
|
+
CDATA = 4,
|
|
372
|
+
Comment = 5
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
declare type pluginEvent<T = unknown> = {
|
|
376
|
+
type: EventType.Plugin;
|
|
377
|
+
data: {
|
|
378
|
+
plugin: string;
|
|
379
|
+
payload: T;
|
|
380
|
+
};
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
declare enum PointerTypes {
|
|
384
|
+
Mouse = 0,
|
|
385
|
+
Pen = 1,
|
|
386
|
+
Touch = 2
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
declare type removedNodeMutation = {
|
|
390
|
+
parentId: number;
|
|
391
|
+
id: number;
|
|
392
|
+
isShadow?: boolean;
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
declare type scrollData = {
|
|
396
|
+
source: IncrementalSource.Scroll;
|
|
397
|
+
} & scrollPosition;
|
|
398
|
+
|
|
399
|
+
declare type scrollPosition = {
|
|
400
|
+
id: number;
|
|
401
|
+
x: number;
|
|
402
|
+
y: number;
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
declare type selectionData = {
|
|
406
|
+
source: IncrementalSource.Selection;
|
|
407
|
+
} & selectionParam;
|
|
408
|
+
|
|
409
|
+
declare type selectionParam = {
|
|
410
|
+
ranges: Array<SelectionRange>;
|
|
411
|
+
};
|
|
412
|
+
|
|
413
|
+
declare type SelectionRange = {
|
|
414
|
+
start: number;
|
|
415
|
+
startOffset: number;
|
|
416
|
+
end: number;
|
|
417
|
+
endOffset: number;
|
|
418
|
+
};
|
|
419
|
+
|
|
420
|
+
declare type serializedNode = (documentNode | documentTypeNode | elementNode | textNode | cdataNode | commentNode) & {
|
|
421
|
+
rootId?: number;
|
|
422
|
+
isShadowHost?: boolean;
|
|
423
|
+
isShadow?: boolean;
|
|
424
|
+
};
|
|
425
|
+
|
|
426
|
+
declare type serializedNodeWithId = serializedNode & {
|
|
427
|
+
id: number;
|
|
428
|
+
};
|
|
429
|
+
|
|
430
|
+
declare type styleDeclarationData = {
|
|
431
|
+
source: IncrementalSource.StyleDeclaration;
|
|
432
|
+
} & styleDeclarationParam;
|
|
433
|
+
|
|
434
|
+
declare type styleDeclarationParam = {
|
|
435
|
+
id?: number;
|
|
436
|
+
styleId?: number;
|
|
437
|
+
index: number[];
|
|
438
|
+
set?: {
|
|
439
|
+
property: string;
|
|
440
|
+
value: string | null;
|
|
441
|
+
priority: string | undefined;
|
|
442
|
+
};
|
|
443
|
+
remove?: {
|
|
444
|
+
property: string;
|
|
445
|
+
};
|
|
446
|
+
};
|
|
447
|
+
|
|
448
|
+
declare type styleOMValue = {
|
|
449
|
+
[key: string]: styleValueWithPriority | string | false;
|
|
450
|
+
};
|
|
451
|
+
|
|
452
|
+
declare type styleSheetAddRule = {
|
|
453
|
+
rule: string;
|
|
454
|
+
index?: number | number[];
|
|
455
|
+
};
|
|
456
|
+
|
|
457
|
+
declare type styleSheetDeleteRule = {
|
|
458
|
+
index: number | number[];
|
|
459
|
+
};
|
|
460
|
+
|
|
461
|
+
declare type styleSheetRuleData = {
|
|
462
|
+
source: IncrementalSource.StyleSheetRule;
|
|
463
|
+
} & styleSheetRuleParam;
|
|
464
|
+
|
|
465
|
+
declare type styleSheetRuleParam = {
|
|
466
|
+
id?: number;
|
|
467
|
+
styleId?: number;
|
|
468
|
+
removes?: styleSheetDeleteRule[];
|
|
469
|
+
adds?: styleSheetAddRule[];
|
|
470
|
+
replace?: string;
|
|
471
|
+
replaceSync?: string;
|
|
472
|
+
};
|
|
473
|
+
|
|
474
|
+
declare type styleValueWithPriority = [string, string];
|
|
475
|
+
|
|
476
|
+
declare type textMutation = {
|
|
477
|
+
id: number;
|
|
478
|
+
value: string | null;
|
|
479
|
+
};
|
|
480
|
+
|
|
481
|
+
declare type textNode = {
|
|
482
|
+
type: NodeType.Text;
|
|
483
|
+
textContent: string;
|
|
484
|
+
isStyle?: true;
|
|
485
|
+
};
|
|
486
|
+
|
|
487
|
+
declare type viewportResizeData = {
|
|
488
|
+
source: IncrementalSource.ViewportResize;
|
|
489
|
+
} & viewportResizeDimension;
|
|
490
|
+
|
|
491
|
+
declare type viewportResizeDimension = {
|
|
492
|
+
width: number;
|
|
493
|
+
height: number;
|
|
494
|
+
};
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
|
|
498
|
+
declare global {
|
|
499
|
+
interface Window {
|
|
500
|
+
FontFace: typeof FontFace;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
|
|
8
504
|
interface Props {
|
|
9
505
|
projectKey: string;
|
|
10
506
|
serverUrl: string;
|
|
@@ -21,4 +517,4 @@ interface Props {
|
|
|
21
517
|
}
|
|
22
518
|
declare function FlintModal({ projectKey, serverUrl, user, meta, theme, zIndex, onClose, getEnvironment, getConsoleLogs, getNetworkErrors, getReplayEvents, externalReplayUrl, }: Props): react_jsx_runtime.JSX.Element;
|
|
23
519
|
|
|
24
|
-
export { FlintModal, FlintWidget };
|
|
520
|
+
export { FlintModal, type FlintUser, FlintWidget, type FlintWidgetProps, type Locale, type ReportPayload, type ReportResult, type Severity, type Theme, type ThemeOverride };
|