@diegotsi/flint-react 0.2.0 → 0.2.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.
package/dist/index.d.ts CHANGED
@@ -1,507 +1,10 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
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. Pass a function for lazy evaluation. */
39
- sessionReplay?: string | (() => 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
- slackMessageUrl?: string | null;
82
- isDuplicate: boolean;
83
- duplicateOfId?: string | null;
84
- }
2
+ import { FlintWidgetProps, FlintUser, Theme, EnvironmentInfo, ConsoleEntry, NetworkEntry } from '@flint/types';
3
+ export { FlintUser, FlintWidgetProps, Locale, ReportPayload, ReportResult, Severity, Theme, ThemeOverride } from '@flint/types';
4
+ import { eventWithTime } from '@rrweb/types';
85
5
 
86
6
  declare function FlintWidget(props: FlintWidgetProps): react_jsx_runtime.JSX.Element;
87
7
 
88
- declare type addedNodeMutation = {
89
- parentId: number;
90
- previousId?: number | null;
91
- nextId: number | null;
92
- node: serializedNodeWithId;
93
- };
94
-
95
- declare type adoptedStyleSheetData = {
96
- source: IncrementalSource.AdoptedStyleSheet;
97
- } & adoptedStyleSheetParam;
98
-
99
- declare type adoptedStyleSheetParam = {
100
- id: number;
101
- styles?: {
102
- styleId: number;
103
- rules: styleSheetAddRule[];
104
- }[];
105
- styleIds: number[];
106
- };
107
-
108
- declare type attributeMutation = {
109
- id: number;
110
- attributes: {
111
- [key: string]: string | styleOMValue | null;
112
- };
113
- };
114
-
115
- declare type attributes = cssTextKeyAttr & {
116
- [key: string]: string | number | true | null;
117
- };
118
-
119
- declare enum CanvasContext {
120
- '2D' = 0,
121
- WebGL = 1,
122
- WebGL2 = 2
123
- }
124
-
125
- declare type canvasMutationCommand = {
126
- property: string;
127
- args: Array<unknown>;
128
- setter?: true;
129
- };
130
-
131
- declare type canvasMutationData = {
132
- source: IncrementalSource.CanvasMutation;
133
- } & canvasMutationParam;
134
-
135
- declare type canvasMutationParam = {
136
- id: number;
137
- type: CanvasContext;
138
- commands: canvasMutationCommand[];
139
- } | ({
140
- id: number;
141
- type: CanvasContext;
142
- } & canvasMutationCommand);
143
-
144
- declare type cdataNode = {
145
- type: NodeType.CDATA;
146
- textContent: '';
147
- };
148
-
149
- declare type commentNode = {
150
- type: NodeType.Comment;
151
- textContent: string;
152
- };
153
-
154
- declare type cssTextKeyAttr = {
155
- _cssText?: string;
156
- };
157
-
158
- declare type customElementData = {
159
- source: IncrementalSource.CustomElement;
160
- } & customElementParam;
161
-
162
- declare type customElementParam = {
163
- define?: {
164
- name: string;
165
- };
166
- };
167
-
168
- declare type customEvent<T = unknown> = {
169
- type: EventType.Custom;
170
- data: {
171
- tag: string;
172
- payload: T;
173
- };
174
- };
175
-
176
- declare type documentNode = {
177
- type: NodeType.Document;
178
- childNodes: serializedNodeWithId[];
179
- compatMode?: string;
180
- };
181
-
182
- declare type documentTypeNode = {
183
- type: NodeType.DocumentType;
184
- name: string;
185
- publicId: string;
186
- systemId: string;
187
- };
188
-
189
- declare type domContentLoadedEvent = {
190
- type: EventType.DomContentLoaded;
191
- data: unknown;
192
- };
193
-
194
- declare type elementNode = {
195
- type: NodeType.Element;
196
- tagName: string;
197
- attributes: attributes;
198
- childNodes: serializedNodeWithId[];
199
- isSVG?: true;
200
- needBlock?: boolean;
201
- isCustom?: true;
202
- };
203
-
204
- declare enum EventType {
205
- DomContentLoaded = 0,
206
- Load = 1,
207
- FullSnapshot = 2,
208
- IncrementalSnapshot = 3,
209
- Meta = 4,
210
- Custom = 5,
211
- Plugin = 6
212
- }
213
-
214
- declare type eventWithoutTime = domContentLoadedEvent | loadedEvent | fullSnapshotEvent | incrementalSnapshotEvent | metaEvent | customEvent | pluginEvent;
215
-
216
- declare type eventWithTime = eventWithoutTime & {
217
- timestamp: number;
218
- delay?: number;
219
- };
220
-
221
- declare type fontData = {
222
- source: IncrementalSource.Font;
223
- } & fontParam;
224
-
225
- declare type fontParam = {
226
- family: string;
227
- fontSource: string;
228
- buffer: boolean;
229
- descriptors?: FontFaceDescriptors;
230
- };
231
-
232
- declare type fullSnapshotEvent = {
233
- type: EventType.FullSnapshot;
234
- data: {
235
- node: serializedNodeWithId;
236
- initialOffset: {
237
- top: number;
238
- left: number;
239
- };
240
- };
241
- };
242
-
243
- declare type incrementalData = mutationData | mousemoveData | mouseInteractionData | scrollData | viewportResizeData | inputData | mediaInteractionData | styleSheetRuleData | canvasMutationData | fontData | selectionData | styleDeclarationData | adoptedStyleSheetData | customElementData;
244
-
245
- declare type incrementalSnapshotEvent = {
246
- type: EventType.IncrementalSnapshot;
247
- data: incrementalData;
248
- };
249
-
250
- declare enum IncrementalSource {
251
- Mutation = 0,
252
- MouseMove = 1,
253
- MouseInteraction = 2,
254
- Scroll = 3,
255
- ViewportResize = 4,
256
- Input = 5,
257
- TouchMove = 6,
258
- MediaInteraction = 7,
259
- StyleSheetRule = 8,
260
- CanvasMutation = 9,
261
- Font = 10,
262
- Log = 11,
263
- Drag = 12,
264
- StyleDeclaration = 13,
265
- Selection = 14,
266
- AdoptedStyleSheet = 15,
267
- CustomElement = 16
268
- }
269
-
270
- declare type inputData = {
271
- source: IncrementalSource.Input;
272
- id: number;
273
- } & inputValue;
274
-
275
- declare type inputValue = {
276
- text: string;
277
- isChecked: boolean;
278
- userTriggered?: boolean;
279
- };
280
-
281
- declare type loadedEvent = {
282
- type: EventType.Load;
283
- data: unknown;
284
- };
285
-
286
- declare type mediaInteractionData = {
287
- source: IncrementalSource.MediaInteraction;
288
- } & mediaInteractionParam;
289
-
290
- declare type mediaInteractionParam = {
291
- type: MediaInteractions;
292
- id: number;
293
- currentTime?: number;
294
- volume?: number;
295
- muted?: boolean;
296
- loop?: boolean;
297
- playbackRate?: number;
298
- };
299
-
300
- declare enum MediaInteractions {
301
- Play = 0,
302
- Pause = 1,
303
- Seeked = 2,
304
- VolumeChange = 3,
305
- RateChange = 4
306
- }
307
-
308
- declare type metaEvent = {
309
- type: EventType.Meta;
310
- data: {
311
- href: string;
312
- width: number;
313
- height: number;
314
- };
315
- };
316
-
317
- declare type mouseInteractionData = {
318
- source: IncrementalSource.MouseInteraction;
319
- } & mouseInteractionParam;
320
-
321
- declare type mouseInteractionParam = {
322
- type: MouseInteractions;
323
- id: number;
324
- x?: number;
325
- y?: number;
326
- pointerType?: PointerTypes;
327
- };
328
-
329
- declare enum MouseInteractions {
330
- MouseUp = 0,
331
- MouseDown = 1,
332
- Click = 2,
333
- ContextMenu = 3,
334
- DblClick = 4,
335
- Focus = 5,
336
- Blur = 6,
337
- TouchStart = 7,
338
- TouchMove_Departed = 8,
339
- TouchEnd = 9,
340
- TouchCancel = 10
341
- }
342
-
343
- declare type mousemoveData = {
344
- source: IncrementalSource.MouseMove | IncrementalSource.TouchMove | IncrementalSource.Drag;
345
- positions: mousePosition[];
346
- };
347
-
348
- declare type mousePosition = {
349
- x: number;
350
- y: number;
351
- id: number;
352
- timeOffset: number;
353
- };
354
-
355
- declare type mutationCallbackParam = {
356
- texts: textMutation[];
357
- attributes: attributeMutation[];
358
- removes: removedNodeMutation[];
359
- adds: addedNodeMutation[];
360
- isAttachIframe?: true;
361
- };
362
-
363
- declare type mutationData = {
364
- source: IncrementalSource.Mutation;
365
- } & mutationCallbackParam;
366
-
367
- declare enum NodeType {
368
- Document = 0,
369
- DocumentType = 1,
370
- Element = 2,
371
- Text = 3,
372
- CDATA = 4,
373
- Comment = 5
374
- }
375
-
376
- declare type pluginEvent<T = unknown> = {
377
- type: EventType.Plugin;
378
- data: {
379
- plugin: string;
380
- payload: T;
381
- };
382
- };
383
-
384
- declare enum PointerTypes {
385
- Mouse = 0,
386
- Pen = 1,
387
- Touch = 2
388
- }
389
-
390
- declare type removedNodeMutation = {
391
- parentId: number;
392
- id: number;
393
- isShadow?: boolean;
394
- };
395
-
396
- declare type scrollData = {
397
- source: IncrementalSource.Scroll;
398
- } & scrollPosition;
399
-
400
- declare type scrollPosition = {
401
- id: number;
402
- x: number;
403
- y: number;
404
- };
405
-
406
- declare type selectionData = {
407
- source: IncrementalSource.Selection;
408
- } & selectionParam;
409
-
410
- declare type selectionParam = {
411
- ranges: Array<SelectionRange>;
412
- };
413
-
414
- declare type SelectionRange = {
415
- start: number;
416
- startOffset: number;
417
- end: number;
418
- endOffset: number;
419
- };
420
-
421
- declare type serializedNode = (documentNode | documentTypeNode | elementNode | textNode | cdataNode | commentNode) & {
422
- rootId?: number;
423
- isShadowHost?: boolean;
424
- isShadow?: boolean;
425
- };
426
-
427
- declare type serializedNodeWithId = serializedNode & {
428
- id: number;
429
- };
430
-
431
- declare type styleDeclarationData = {
432
- source: IncrementalSource.StyleDeclaration;
433
- } & styleDeclarationParam;
434
-
435
- declare type styleDeclarationParam = {
436
- id?: number;
437
- styleId?: number;
438
- index: number[];
439
- set?: {
440
- property: string;
441
- value: string | null;
442
- priority: string | undefined;
443
- };
444
- remove?: {
445
- property: string;
446
- };
447
- };
448
-
449
- declare type styleOMValue = {
450
- [key: string]: styleValueWithPriority | string | false;
451
- };
452
-
453
- declare type styleSheetAddRule = {
454
- rule: string;
455
- index?: number | number[];
456
- };
457
-
458
- declare type styleSheetDeleteRule = {
459
- index: number | number[];
460
- };
461
-
462
- declare type styleSheetRuleData = {
463
- source: IncrementalSource.StyleSheetRule;
464
- } & styleSheetRuleParam;
465
-
466
- declare type styleSheetRuleParam = {
467
- id?: number;
468
- styleId?: number;
469
- removes?: styleSheetDeleteRule[];
470
- adds?: styleSheetAddRule[];
471
- replace?: string;
472
- replaceSync?: string;
473
- };
474
-
475
- declare type styleValueWithPriority = [string, string];
476
-
477
- declare type textMutation = {
478
- id: number;
479
- value: string | null;
480
- };
481
-
482
- declare type textNode = {
483
- type: NodeType.Text;
484
- textContent: string;
485
- isStyle?: true;
486
- };
487
-
488
- declare type viewportResizeData = {
489
- source: IncrementalSource.ViewportResize;
490
- } & viewportResizeDimension;
491
-
492
- declare type viewportResizeDimension = {
493
- width: number;
494
- height: number;
495
- };
496
-
497
-
498
-
499
- declare global {
500
- interface Window {
501
- FontFace: typeof FontFace;
502
- }
503
- }
504
-
505
8
  interface Props {
506
9
  projectKey: string;
507
10
  serverUrl: string;
@@ -523,4 +26,4 @@ declare const flint: {
523
26
  setSessionReplay(url: string | (() => string)): void;
524
27
  };
525
28
 
526
- export { FlintModal, type FlintUser, FlintWidget, type FlintWidgetProps, type Locale, type ReportPayload, type ReportResult, type Severity, type Theme, type ThemeOverride, flint };
29
+ export { FlintModal, FlintWidget, flint };
package/dist/index.js CHANGED
@@ -384,46 +384,30 @@ function FlintModal({
384
384
  transition: "opacity 0.35s ease 0.35s, transform 0.35s ease 0.35s",
385
385
  pointerEvents: isSuccess ? "auto" : "none"
386
386
  }, children: [
387
- /* @__PURE__ */ jsx("p", { style: { fontSize: 15, color: colors.textMuted, margin: 0 }, children: result?.isDuplicate ? t("successDuplicate") : result ? `ID: ${result.id}` : "" }),
388
- result?.slackMessageUrl && /* @__PURE__ */ jsxs(
389
- "a",
390
- {
391
- href: result.slackMessageUrl,
392
- target: "_blank",
393
- rel: "noreferrer",
394
- style: {
395
- display: "inline-flex",
396
- alignItems: "center",
397
- gap: 6,
398
- padding: "9px 18px",
399
- borderRadius: "10px",
400
- background: `linear-gradient(135deg, ${colors.accent}, ${colors.accentHover})`,
401
- color: colors.buttonText,
402
- textDecoration: "none",
403
- fontSize: "15px",
404
- fontWeight: 600,
405
- boxShadow: accentGlow
406
- },
407
- children: [
408
- t("successSlack"),
409
- " \u2197"
410
- ]
411
- }
412
- ),
387
+ /* @__PURE__ */ jsx("p", { style: { fontSize: 15, color: colors.textMuted, margin: 0 }, children: result ? `ID: ${result.id}` : "" }),
413
388
  /* @__PURE__ */ jsx(
414
389
  "button",
415
390
  {
416
391
  onClick: onClose,
417
392
  style: {
418
- background: "none",
393
+ width: "100%",
394
+ padding: "13px 20px",
395
+ borderRadius: 12,
419
396
  border: "none",
397
+ background: `linear-gradient(135deg, ${colors.accent}, ${colors.accentHover})`,
398
+ color: colors.buttonText,
399
+ fontSize: 17,
400
+ fontWeight: 700,
420
401
  cursor: "pointer",
421
- fontSize: 15,
422
- color: colors.textMuted,
423
- padding: "4px 8px",
424
- fontFamily: "inherit"
402
+ letterSpacing: "-0.01em",
403
+ boxShadow: accentGlow,
404
+ fontFamily: "inherit",
405
+ display: "flex",
406
+ alignItems: "center",
407
+ justifyContent: "center",
408
+ gap: 8
425
409
  },
426
- children: t("cancel")
410
+ children: t("close")
427
411
  }
428
412
  )
429
413
  ] })
@@ -751,6 +735,7 @@ var en_default = {
751
735
  screenshotLabel: "Screenshot (optional)",
752
736
  screenshotPlaceholder: "Click to attach...",
753
737
  submitLabel: "Submit",
738
+ close: "Close",
754
739
  successTitle: "Bug reported!",
755
740
  successDuplicate: "Looks like a duplicate of an existing bug.",
756
741
  successGitHub: "View GitHub issue",