@betterbugs/web-sdk 0.0.44 → 0.0.46
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 +81 -2
- package/index.js +1 -1
- package/package.json +1 -1
- package/recorder.js +1 -1
- package/types/index.d.ts +45 -0
- package/types/loginData.d.ts +3 -0
- package/types/user.d.ts +19 -0
package/README.md
CHANGED
|
@@ -70,13 +70,14 @@ You can customize the SDK behavior with the following parameters:
|
|
|
70
70
|
| apiKey | string | Your workspace API key (required) |
|
|
71
71
|
| projectId | string | The project to report bugs to. Required with a workspace API key; omit it if you are using a legacy project-scoped key. |
|
|
72
72
|
| metaData | Record<string \| number, string \| number \| null> | Custom metadata to attach to reports (e.g., { userId: 123 }) |
|
|
73
|
-
| recordType | "recordVideo" \| "domRecord" | The "recordVideo" type (recommended for SPAs) is the traditional media recording method for video and audio. The "domRecord" type (recommended for Multi Page Apps) is the DOM recording method and may not be as accurate as the "recordVideo" type. |
|
|
73
|
+
| recordType | "recordVideo" \| "domRecord" | The "recordVideo" type (recommended for SPAs) is the traditional media recording method for video and audio. The "domRecord" type (recommended for Multi Page Apps) is the DOM recording method and may not be as accurate as the "recordVideo" type. **Leave it unset and the SDK picks the best mode the browser supports** — see [Recording modes](#recording-modes). |
|
|
74
74
|
| disableScreenshot | boolean | Disable screenshot capturing |
|
|
75
75
|
| disableRecording | boolean | Disable screen recording |
|
|
76
|
+
| mediaRequired | boolean | Require a screenshot or screen recording before the report can be submitted. Ignored when both `disableScreenshot` and `disableRecording` are enabled. Default: `false`. |
|
|
76
77
|
| enableAnnotation | boolean | Enable annotation tools for screenshots. |
|
|
77
78
|
| showActionButton | boolean | Display/Hide the floating action button. |
|
|
78
79
|
| position | { top? : string, left? : string, right? : string, bottom? : string } | Control the widget's screen position. |
|
|
79
|
-
| mode | "development" \| "production" | Set development or production mode.<br><br>The "development" mode can be set when the app is under development
|
|
80
|
+
| mode | "development" \| "production" | Set development or production mode (defaults to "production").<br><br>The "development" mode can be set when the app is under development: the report form drops the Email field and instead shows **Reporter** (required) and **Assignee** (optional) pickers, populated with your workspace's members. The "production" mode is for end-users, meaning the app's customers can report a bug in the live environment via the Email field. |
|
|
80
81
|
| email | string | The user's email address who is reporting the bug. Works only in "production" mode. |
|
|
81
82
|
| styles | { theme?: 'light' \| 'dark', primaryColor?: string, primaryTextColor?: string, secondaryColor?: string, secondaryTextColor?: string, textColor?: string, mutedTextColor?: string, inputBgColor?: string, fontFamily?: string, fontFamilyUrl?: string (optional) } | Set the styles of the widget |
|
|
82
83
|
| actionButtonComponent | React.ReactNode \| string | Component for the action button (React component or HTML string accepted). |
|
|
@@ -90,6 +91,84 @@ You can customize the SDK behavior with the following parameters:
|
|
|
90
91
|
| titleFieldPlaceholder | string | Set placeholder of title field |
|
|
91
92
|
| descriptionFieldLabel | string | Set label of description field |
|
|
92
93
|
| descriptionFieldPlaceholder | string | Set placeholder of description field |
|
|
94
|
+
| preferNativeCapture | boolean | Capture screenshots from the browser's rendered pixels instead of re-rendering the DOM. Defaults to `true`. See [Screenshot accuracy](#screenshot-accuracy) below. |
|
|
95
|
+
|
|
96
|
+
## Screenshot accuracy
|
|
97
|
+
|
|
98
|
+
Screenshots are captured with one of two engines, chosen automatically by what
|
|
99
|
+
the browser supports.
|
|
100
|
+
|
|
101
|
+
**Native capture (default, all desktop browsers).** The SDK asks the browser for
|
|
102
|
+
the actual rendered pixels via `getDisplayMedia`. The result matches what the
|
|
103
|
+
user saw, including cross-origin iframes, `<video>`, WebGL and canvas content,
|
|
104
|
+
and modern CSS such as `backdrop-filter` and blend modes. Region ("Crop")
|
|
105
|
+
captures are cropped from the same frame, so both modes look identical.
|
|
106
|
+
|
|
107
|
+
The cost is one browser permission prompt per capture. What the user sees in
|
|
108
|
+
that prompt depends on the engine:
|
|
109
|
+
|
|
110
|
+
| Browser | Prompt | Notes |
|
|
111
|
+
| --- | --- | --- |
|
|
112
|
+
| Chrome, Edge, Opera, Brave | This tab, pre-selected | One click to confirm |
|
|
113
|
+
| Safari (macOS), Firefox | Screen or window picker | WebKit and Gecko expose no "this tab" surface, so the user shares a screen or window and the SDK crops the page's viewport out of the frame |
|
|
114
|
+
| Mobile (iOS + Android) | — | No browser on mobile implements screen capture; DOM rendering is always used |
|
|
115
|
+
|
|
116
|
+
On Safari and Firefox the SDK falls back to DOM rendering automatically if it
|
|
117
|
+
cannot locate the viewport in the shared frame reliably, or if the frame comes
|
|
118
|
+
back at a lower resolution than a DOM render would produce — a sharp
|
|
119
|
+
approximation beats a blurry photograph of the real thing.
|
|
120
|
+
|
|
121
|
+
If the user dismisses the prompt entirely, no screenshot is taken. Declining is
|
|
122
|
+
treated as "don't capture me", not as a request for a lower-fidelity capture.
|
|
123
|
+
|
|
124
|
+
**DOM rendering (fallback).** Used on mobile browsers, when
|
|
125
|
+
`preferNativeCapture: false`, and whenever native capture is unavailable or
|
|
126
|
+
declined per the rules above. The page is re-rendered from the DOM by
|
|
127
|
+
`html2canvas-pro`, which reimplements CSS layout in JavaScript and therefore
|
|
128
|
+
**will be inaccurate on some sites**. Known limitations:
|
|
129
|
+
|
|
130
|
+
| Content | Result |
|
|
131
|
+
| --- | --- |
|
|
132
|
+
| Cross-origin `<iframe>` (payment forms, embedded maps, third-party widgets) | Renders blank — the browser gives no page any way to read those pixels |
|
|
133
|
+
| `<video>` | Blank or poster frame |
|
|
134
|
+
| WebGL / 3D canvas | Captured only for canvases created after the SDK loaded; otherwise blank |
|
|
135
|
+
| `backdrop-filter`, blend modes, masks, `color-mix()` | May render differently from the screen |
|
|
136
|
+
| Cross-origin images without CORS headers | Omitted |
|
|
137
|
+
|
|
138
|
+
When the SDK falls back to DOM rendering and detects any of the first three in
|
|
139
|
+
the captured area, it shows the reporter a warning at capture time so an
|
|
140
|
+
inaccurate screenshot is not submitted unnoticed.
|
|
141
|
+
|
|
142
|
+
Set `preferNativeCapture: false` to always use DOM rendering and never show a
|
|
143
|
+
permission prompt — appropriate if the prompt is disruptive in your product and
|
|
144
|
+
your pages do not contain the content listed above.
|
|
145
|
+
|
|
146
|
+
## Recording modes
|
|
147
|
+
|
|
148
|
+
`recordType` controls how screen recordings are captured.
|
|
149
|
+
|
|
150
|
+
- **`recordVideo`** — real video via the browser's `MediaRecorder`. Highest
|
|
151
|
+
fidelity: it records exactly what was on screen, with audio.
|
|
152
|
+
- **`domRecord`** — records DOM mutations and replays them. No video file, works
|
|
153
|
+
on every device including mobile, and stays accurate through page navigations.
|
|
154
|
+
|
|
155
|
+
### Leaving `recordType` unset (recommended)
|
|
156
|
+
|
|
157
|
+
The SDK detects what the visitor's browser can actually deliver and picks the
|
|
158
|
+
optimal mode for it — real video wherever the browser supports screen capture,
|
|
159
|
+
DOM recording everywhere else. Recording formats differ between browser engines;
|
|
160
|
+
the SDK handles that internally, so playback and upload work the same either way
|
|
161
|
+
and there is nothing for you to configure.
|
|
162
|
+
|
|
163
|
+
### Setting `recordType` explicitly
|
|
164
|
+
|
|
165
|
+
Your choice is honoured as given, with no capability substitution — useful when
|
|
166
|
+
you want one consistent recording format across all your users. If the browser
|
|
167
|
+
cannot support what you asked for, the SDK logs a console warning rather than
|
|
168
|
+
silently overriding you.
|
|
169
|
+
|
|
170
|
+
The one exception is **Electron**, which does not support DOM recording:
|
|
171
|
+
`domRecord` there is overridden to `recordVideo` with a warning.
|
|
93
172
|
|
|
94
173
|
## Programmatic Methods: Control SDK behavior
|
|
95
174
|
|