@diegotsi/flint-react 1.0.2 → 1.2.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/dist/index.cjs +77 -464
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -130
- package/dist/index.d.ts +6 -130
- package/dist/index.js +67 -455
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,122 +1,7 @@
|
|
|
1
|
+
import { FlintUser, Theme, EnvironmentInfo, ConsoleEntry, NetworkEntry, FormErrorEntry, ReportPayload, ReportResult, FlintWidgetProps } from '@diegotsi/flint-core';
|
|
2
|
+
export { Flint, FlintConfig, FlintUser, FlintWidgetProps, Locale, ReportPayload, ReportResult, Severity, Theme, ThemeOverride, flint } from '@diegotsi/flint-core';
|
|
1
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
4
|
|
|
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$1 {
|
|
34
|
-
id: string;
|
|
35
|
-
name: string;
|
|
36
|
-
email?: string;
|
|
37
|
-
}
|
|
38
|
-
interface FlintExtraFields {
|
|
39
|
-
/** Session replay URL from Datadog RUM, FullStory, LogRocket, etc. Pass a function for lazy evaluation. */
|
|
40
|
-
sessionReplay?: string | (() => string);
|
|
41
|
-
[key: string]: unknown;
|
|
42
|
-
}
|
|
43
|
-
interface FlintWidgetProps {
|
|
44
|
-
/** Project API key — get this from the flint-server admin API */
|
|
45
|
-
projectKey: string;
|
|
46
|
-
/** Full URL of the flint-server, e.g. "https://bugs.example.com" */
|
|
47
|
-
serverUrl: string;
|
|
48
|
-
/** Authenticated user info (optional) */
|
|
49
|
-
user?: FlintUser$1;
|
|
50
|
-
/** Arbitrary metadata to attach to every report */
|
|
51
|
-
meta?: Record<string, unknown>;
|
|
52
|
-
/** Extra fields for developer use (e.g. external session replay URL) */
|
|
53
|
-
extraFields?: FlintExtraFields;
|
|
54
|
-
/** Label shown on the trigger button. Default: "Reportar bug" */
|
|
55
|
-
buttonLabel?: string;
|
|
56
|
-
/** Locale for UI strings. Default: "pt-BR" */
|
|
57
|
-
locale?: Locale;
|
|
58
|
-
/** Visual theme. Default: "light" */
|
|
59
|
-
theme?: Theme;
|
|
60
|
-
/** Custom z-index for the widget. Default: 9999 */
|
|
61
|
-
zIndex?: number;
|
|
62
|
-
/** URL of the admin/status page for reporters to track their bugs */
|
|
63
|
-
statusPageUrl?: string;
|
|
64
|
-
/**
|
|
65
|
-
* Datadog site hostname for auto-generating RUM Session Replay deep links.
|
|
66
|
-
* When set, the widget auto-detects `window.DD_RUM` and generates a direct
|
|
67
|
-
* link to the session replay at the exact moment the bug was reported.
|
|
68
|
-
* Examples: "app.datadoghq.com", "app.datadoghq.eu", "app.us5.datadoghq.com"
|
|
69
|
-
*/
|
|
70
|
-
datadogSite?: string;
|
|
71
|
-
/** Enable session replay recording. Default: true */
|
|
72
|
-
enableReplay?: boolean;
|
|
73
|
-
/** Enable screenshot capture. Default: true */
|
|
74
|
-
enableScreenshot?: boolean;
|
|
75
|
-
/** Enable console log collection. Default: true */
|
|
76
|
-
enableConsole?: boolean;
|
|
77
|
-
/** Enable network error collection. Default: true */
|
|
78
|
-
enableNetwork?: boolean;
|
|
79
|
-
/** Enable frustration detection (rage clicks, dead clicks, error loops). Default: false */
|
|
80
|
-
enableFrustration?: boolean;
|
|
81
|
-
/** Auto-submit bug report on frustration detection. Default: false */
|
|
82
|
-
autoReportFrustration?: boolean;
|
|
83
|
-
/** Called before report submission. Return false to cancel. */
|
|
84
|
-
onBeforeSubmit?: (payload: ReportPayload) => boolean | Promise<boolean>;
|
|
85
|
-
/** Called after successful submission */
|
|
86
|
-
onSuccess?: (result: ReportResult) => void;
|
|
87
|
-
/** Called when submission fails */
|
|
88
|
-
onError?: (error: Error) => void;
|
|
89
|
-
/** Called when the modal opens */
|
|
90
|
-
onOpen?: () => void;
|
|
91
|
-
/** Called when the modal closes */
|
|
92
|
-
onClose?: () => void;
|
|
93
|
-
}
|
|
94
|
-
interface ReportPayload {
|
|
95
|
-
reporterId: string;
|
|
96
|
-
reporterName: string;
|
|
97
|
-
reporterEmail?: string;
|
|
98
|
-
description: string;
|
|
99
|
-
expectedBehavior?: string;
|
|
100
|
-
stepsToReproduce?: {
|
|
101
|
-
action: string;
|
|
102
|
-
result: string;
|
|
103
|
-
}[];
|
|
104
|
-
externalReplayUrl?: string;
|
|
105
|
-
additionalContext?: string;
|
|
106
|
-
severity: Severity;
|
|
107
|
-
url?: string;
|
|
108
|
-
meta?: Record<string, unknown>;
|
|
109
|
-
label?: string;
|
|
110
|
-
}
|
|
111
|
-
interface ReportResult {
|
|
112
|
-
id: string;
|
|
113
|
-
status: string;
|
|
114
|
-
githubIssueUrl?: string | null;
|
|
115
|
-
slackMessageUrl?: string | null;
|
|
116
|
-
isDuplicate: boolean;
|
|
117
|
-
duplicateOfId?: string | null;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
5
|
declare type addedNodeMutation = {
|
|
121
6
|
parentId: number;
|
|
122
7
|
previousId?: number | null;
|
|
@@ -537,7 +422,7 @@ declare global {
|
|
|
537
422
|
interface Props {
|
|
538
423
|
projectKey: string;
|
|
539
424
|
serverUrl: string;
|
|
540
|
-
user?: FlintUser
|
|
425
|
+
user?: FlintUser;
|
|
541
426
|
meta?: Record<string, unknown>;
|
|
542
427
|
theme: Theme;
|
|
543
428
|
zIndex: number;
|
|
@@ -545,6 +430,7 @@ interface Props {
|
|
|
545
430
|
getEnvironment: () => EnvironmentInfo;
|
|
546
431
|
getConsoleLogs: () => ConsoleEntry[];
|
|
547
432
|
getNetworkErrors: () => NetworkEntry[];
|
|
433
|
+
getFormErrors: () => FormErrorEntry[];
|
|
548
434
|
getReplayEvents: () => eventWithTime[];
|
|
549
435
|
getExternalReplayUrl: () => string | undefined;
|
|
550
436
|
initialSelection?: string;
|
|
@@ -554,18 +440,8 @@ interface Props {
|
|
|
554
440
|
onSuccess?: (result: ReportResult) => void;
|
|
555
441
|
onError?: (error: Error) => void;
|
|
556
442
|
}
|
|
557
|
-
declare function FlintModal({ projectKey, serverUrl, user, meta, theme, zIndex, onClose, getEnvironment, getConsoleLogs, getNetworkErrors, getReplayEvents, getExternalReplayUrl, initialSelection, enableScreenshot, statusPageUrl, onBeforeSubmit, onSuccess, onError, }: Props): react_jsx_runtime.JSX.Element;
|
|
443
|
+
declare function FlintModal({ projectKey, serverUrl, user, meta, theme, zIndex, onClose, getEnvironment, getConsoleLogs, getNetworkErrors, getFormErrors, getReplayEvents, getExternalReplayUrl, initialSelection, enableScreenshot, statusPageUrl, onBeforeSubmit, onSuccess, onError, }: Props): react_jsx_runtime.JSX.Element;
|
|
558
444
|
|
|
559
445
|
declare function FlintWidget(props: FlintWidgetProps): react_jsx_runtime.JSX.Element;
|
|
560
446
|
|
|
561
|
-
|
|
562
|
-
id: string;
|
|
563
|
-
name: string;
|
|
564
|
-
email?: string;
|
|
565
|
-
}
|
|
566
|
-
declare const flint: {
|
|
567
|
-
setUser(user: FlintUser | null): void;
|
|
568
|
-
setSessionReplay(url: string | (() => string) | null): void;
|
|
569
|
-
};
|
|
570
|
-
|
|
571
|
-
export { FlintModal, type FlintUser$1 as FlintUser, FlintWidget, type FlintWidgetProps, type Locale, type ReportPayload, type ReportResult, type Severity, type Theme, type ThemeOverride, flint };
|
|
447
|
+
export { FlintModal, FlintWidget };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,122 +1,7 @@
|
|
|
1
|
+
import { FlintUser, Theme, EnvironmentInfo, ConsoleEntry, NetworkEntry, FormErrorEntry, ReportPayload, ReportResult, FlintWidgetProps } from '@diegotsi/flint-core';
|
|
2
|
+
export { Flint, FlintConfig, FlintUser, FlintWidgetProps, Locale, ReportPayload, ReportResult, Severity, Theme, ThemeOverride, flint } from '@diegotsi/flint-core';
|
|
1
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
4
|
|
|
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$1 {
|
|
34
|
-
id: string;
|
|
35
|
-
name: string;
|
|
36
|
-
email?: string;
|
|
37
|
-
}
|
|
38
|
-
interface FlintExtraFields {
|
|
39
|
-
/** Session replay URL from Datadog RUM, FullStory, LogRocket, etc. Pass a function for lazy evaluation. */
|
|
40
|
-
sessionReplay?: string | (() => string);
|
|
41
|
-
[key: string]: unknown;
|
|
42
|
-
}
|
|
43
|
-
interface FlintWidgetProps {
|
|
44
|
-
/** Project API key — get this from the flint-server admin API */
|
|
45
|
-
projectKey: string;
|
|
46
|
-
/** Full URL of the flint-server, e.g. "https://bugs.example.com" */
|
|
47
|
-
serverUrl: string;
|
|
48
|
-
/** Authenticated user info (optional) */
|
|
49
|
-
user?: FlintUser$1;
|
|
50
|
-
/** Arbitrary metadata to attach to every report */
|
|
51
|
-
meta?: Record<string, unknown>;
|
|
52
|
-
/** Extra fields for developer use (e.g. external session replay URL) */
|
|
53
|
-
extraFields?: FlintExtraFields;
|
|
54
|
-
/** Label shown on the trigger button. Default: "Reportar bug" */
|
|
55
|
-
buttonLabel?: string;
|
|
56
|
-
/** Locale for UI strings. Default: "pt-BR" */
|
|
57
|
-
locale?: Locale;
|
|
58
|
-
/** Visual theme. Default: "light" */
|
|
59
|
-
theme?: Theme;
|
|
60
|
-
/** Custom z-index for the widget. Default: 9999 */
|
|
61
|
-
zIndex?: number;
|
|
62
|
-
/** URL of the admin/status page for reporters to track their bugs */
|
|
63
|
-
statusPageUrl?: string;
|
|
64
|
-
/**
|
|
65
|
-
* Datadog site hostname for auto-generating RUM Session Replay deep links.
|
|
66
|
-
* When set, the widget auto-detects `window.DD_RUM` and generates a direct
|
|
67
|
-
* link to the session replay at the exact moment the bug was reported.
|
|
68
|
-
* Examples: "app.datadoghq.com", "app.datadoghq.eu", "app.us5.datadoghq.com"
|
|
69
|
-
*/
|
|
70
|
-
datadogSite?: string;
|
|
71
|
-
/** Enable session replay recording. Default: true */
|
|
72
|
-
enableReplay?: boolean;
|
|
73
|
-
/** Enable screenshot capture. Default: true */
|
|
74
|
-
enableScreenshot?: boolean;
|
|
75
|
-
/** Enable console log collection. Default: true */
|
|
76
|
-
enableConsole?: boolean;
|
|
77
|
-
/** Enable network error collection. Default: true */
|
|
78
|
-
enableNetwork?: boolean;
|
|
79
|
-
/** Enable frustration detection (rage clicks, dead clicks, error loops). Default: false */
|
|
80
|
-
enableFrustration?: boolean;
|
|
81
|
-
/** Auto-submit bug report on frustration detection. Default: false */
|
|
82
|
-
autoReportFrustration?: boolean;
|
|
83
|
-
/** Called before report submission. Return false to cancel. */
|
|
84
|
-
onBeforeSubmit?: (payload: ReportPayload) => boolean | Promise<boolean>;
|
|
85
|
-
/** Called after successful submission */
|
|
86
|
-
onSuccess?: (result: ReportResult) => void;
|
|
87
|
-
/** Called when submission fails */
|
|
88
|
-
onError?: (error: Error) => void;
|
|
89
|
-
/** Called when the modal opens */
|
|
90
|
-
onOpen?: () => void;
|
|
91
|
-
/** Called when the modal closes */
|
|
92
|
-
onClose?: () => void;
|
|
93
|
-
}
|
|
94
|
-
interface ReportPayload {
|
|
95
|
-
reporterId: string;
|
|
96
|
-
reporterName: string;
|
|
97
|
-
reporterEmail?: string;
|
|
98
|
-
description: string;
|
|
99
|
-
expectedBehavior?: string;
|
|
100
|
-
stepsToReproduce?: {
|
|
101
|
-
action: string;
|
|
102
|
-
result: string;
|
|
103
|
-
}[];
|
|
104
|
-
externalReplayUrl?: string;
|
|
105
|
-
additionalContext?: string;
|
|
106
|
-
severity: Severity;
|
|
107
|
-
url?: string;
|
|
108
|
-
meta?: Record<string, unknown>;
|
|
109
|
-
label?: string;
|
|
110
|
-
}
|
|
111
|
-
interface ReportResult {
|
|
112
|
-
id: string;
|
|
113
|
-
status: string;
|
|
114
|
-
githubIssueUrl?: string | null;
|
|
115
|
-
slackMessageUrl?: string | null;
|
|
116
|
-
isDuplicate: boolean;
|
|
117
|
-
duplicateOfId?: string | null;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
5
|
declare type addedNodeMutation = {
|
|
121
6
|
parentId: number;
|
|
122
7
|
previousId?: number | null;
|
|
@@ -537,7 +422,7 @@ declare global {
|
|
|
537
422
|
interface Props {
|
|
538
423
|
projectKey: string;
|
|
539
424
|
serverUrl: string;
|
|
540
|
-
user?: FlintUser
|
|
425
|
+
user?: FlintUser;
|
|
541
426
|
meta?: Record<string, unknown>;
|
|
542
427
|
theme: Theme;
|
|
543
428
|
zIndex: number;
|
|
@@ -545,6 +430,7 @@ interface Props {
|
|
|
545
430
|
getEnvironment: () => EnvironmentInfo;
|
|
546
431
|
getConsoleLogs: () => ConsoleEntry[];
|
|
547
432
|
getNetworkErrors: () => NetworkEntry[];
|
|
433
|
+
getFormErrors: () => FormErrorEntry[];
|
|
548
434
|
getReplayEvents: () => eventWithTime[];
|
|
549
435
|
getExternalReplayUrl: () => string | undefined;
|
|
550
436
|
initialSelection?: string;
|
|
@@ -554,18 +440,8 @@ interface Props {
|
|
|
554
440
|
onSuccess?: (result: ReportResult) => void;
|
|
555
441
|
onError?: (error: Error) => void;
|
|
556
442
|
}
|
|
557
|
-
declare function FlintModal({ projectKey, serverUrl, user, meta, theme, zIndex, onClose, getEnvironment, getConsoleLogs, getNetworkErrors, getReplayEvents, getExternalReplayUrl, initialSelection, enableScreenshot, statusPageUrl, onBeforeSubmit, onSuccess, onError, }: Props): react_jsx_runtime.JSX.Element;
|
|
443
|
+
declare function FlintModal({ projectKey, serverUrl, user, meta, theme, zIndex, onClose, getEnvironment, getConsoleLogs, getNetworkErrors, getFormErrors, getReplayEvents, getExternalReplayUrl, initialSelection, enableScreenshot, statusPageUrl, onBeforeSubmit, onSuccess, onError, }: Props): react_jsx_runtime.JSX.Element;
|
|
558
444
|
|
|
559
445
|
declare function FlintWidget(props: FlintWidgetProps): react_jsx_runtime.JSX.Element;
|
|
560
446
|
|
|
561
|
-
|
|
562
|
-
id: string;
|
|
563
|
-
name: string;
|
|
564
|
-
email?: string;
|
|
565
|
-
}
|
|
566
|
-
declare const flint: {
|
|
567
|
-
setUser(user: FlintUser | null): void;
|
|
568
|
-
setSessionReplay(url: string | (() => string) | null): void;
|
|
569
|
-
};
|
|
570
|
-
|
|
571
|
-
export { FlintModal, type FlintUser$1 as FlintUser, FlintWidget, type FlintWidgetProps, type Locale, type ReportPayload, type ReportResult, type Severity, type Theme, type ThemeOverride, flint };
|
|
447
|
+
export { FlintModal, FlintWidget };
|