@ozvi/widget 1.0.0 → 1.1.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 +33 -1
- package/dist/types.d.ts +2 -0
- package/package.json +1 -1
- package/dist/capture.d.ts +0 -94
package/README.md
CHANGED
|
@@ -5,7 +5,9 @@ Ozvi inside your app, MIT:
|
|
|
5
5
|
- `<ozvi-widget>`: the floating feedback widget (bug reports with masked context, ideas with voting), Preact in shadow DOM;
|
|
6
6
|
- `window.Ozvi`: a JavaScript API to open it from your own buttons, prefill it, identify the person and listen to events;
|
|
7
7
|
- `<ozvi-roadmap>` and `<ozvi-changelog>`: inline embeds (with a "What's new" badge);
|
|
8
|
-
- `@ozvi/widget`, `@ozvi/widget/react`, `@ozvi/widget/vue`: typed ESM wrappers.
|
|
8
|
+
- `@ozvi/widget`, `@ozvi/widget/react`, `@ozvi/widget/vue`: typed ESM wrappers (`npm i @ozvi/widget`).
|
|
9
|
+
|
|
10
|
+
Docs: [ozvi.io/docs/widget](https://ozvi.io/docs/widget). Signing people in from your backend: [`@ozvi/sdk`](https://www.npmjs.com/package/@ozvi/sdk).
|
|
9
11
|
|
|
10
12
|
```html
|
|
11
13
|
<script src="https://feedback.example.com/widget.js" defer></script>
|
|
@@ -239,6 +241,36 @@ window.OzviConfig = { mask: "all" };
|
|
|
239
241
|
If the copy can't be masked (an unexpected error), the report goes **without** a screenshot, never with
|
|
240
242
|
an unmasked one. The reporter still sees the screenshot before sending and can remove it.
|
|
241
243
|
|
|
244
|
+
## Placement and styling
|
|
245
|
+
|
|
246
|
+
The floating button sits bottom right, 20 px from the edges. `position="bottom-left"` moves it to the left corner and
|
|
247
|
+
the panel opens towards the page. Your page's CSS on the `ozvi-widget` element wins over the widget's own, so offsets
|
|
248
|
+
and layering need no option:
|
|
249
|
+
|
|
250
|
+
```css
|
|
251
|
+
/* above a cookie bar or a chat bubble, below your own modals */
|
|
252
|
+
ozvi-widget { bottom: 88px; right: 24px; z-index: 50; }
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
The inside lives in shadow DOM; these parts are a public, stable styling hook (`::part()`), everything else may change:
|
|
256
|
+
|
|
257
|
+
| Part | What it is |
|
|
258
|
+
|---|---|
|
|
259
|
+
| `launcher` | the floating button (the theme gives it the accent colour, radius and font) |
|
|
260
|
+
| `launcher-label` | the text in the button; the button keeps its accessible name if you hide it |
|
|
261
|
+
| `panel` | the opened panel |
|
|
262
|
+
|
|
263
|
+
```css
|
|
264
|
+
/* an icon-only round button */
|
|
265
|
+
ozvi-widget::part(launcher) { width: 48px; height: 48px; padding: 0; justify-content: center; }
|
|
266
|
+
ozvi-widget::part(launcher-label) { display: none; }
|
|
267
|
+
ozvi-widget::part(panel) { box-shadow: none; }
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
Colours, fonts and radius come from the board's theme (admin → Appearance), so the widget, the board and the e-mails
|
|
271
|
+
stay alike; prefer that over overriding colours here. No button at all: `launcher="none"` and `Ozvi.open()` from your
|
|
272
|
+
own menu.
|
|
273
|
+
|
|
242
274
|
## Configuration
|
|
243
275
|
|
|
244
276
|
Simple switches as attributes:
|
package/dist/types.d.ts
CHANGED
|
@@ -86,6 +86,8 @@ export interface OzviOptions {
|
|
|
86
86
|
appVersion?: string;
|
|
87
87
|
/** "none" hides the floating button; open it with Ozvi.open(). */
|
|
88
88
|
launcher?: "none" | "button";
|
|
89
|
+
/** Corner of the floating button; the panel opens on the same side. Offsets and z-index: CSS on ozvi-widget. */
|
|
90
|
+
position?: "bottom-right" | "bottom-left";
|
|
89
91
|
lang?: OzviLang;
|
|
90
92
|
label?: string;
|
|
91
93
|
network?: "off" | "bodies";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ozvi/widget",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Ozvi feedback widget for your app: bug reports with masked screenshots, ideas and voting, roadmap and changelog embeds. Plain ESM, React and Vue. MIT.",
|
|
6
6
|
"type": "module",
|
package/dist/capture.d.ts
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* What the widget remembers so the team can reproduce a bug: the last requests (network log), the last
|
|
3
|
-
* user actions (route changes, clicks by accessible name, form submits) and console errors.
|
|
4
|
-
* Everything is masked BEFORE it is kept, lives only in memory, and leaves the page only with a bug report.
|
|
5
|
-
*
|
|
6
|
-
* Host app configuration (set before widget.js loads, or later via Ozvi.configure):
|
|
7
|
-
* window.OzviConfig = {
|
|
8
|
-
* network: false, // no network log
|
|
9
|
-
* networkBodies: true, // also keep bodies of FAILED requests (masked, max 2 000 chars)
|
|
10
|
-
* actions: false, // no action timeline
|
|
11
|
-
* maskRequest: (e) => e, // last word on every request: change it, or return null to drop it
|
|
12
|
-
* links: { sentry: () => url, posthog: url, logrocket: url },
|
|
13
|
-
* detectLinks: true, // read session links from Sentry/PostHog/LogRocket globals
|
|
14
|
-
* sentryOrg: "acme", // needed to build the Sentry replay URL
|
|
15
|
-
* }
|
|
16
|
-
* Attributes on <ozvi-widget> do the same for the simple cases: network="off|bodies", actions="off", links="auto".
|
|
17
|
-
*/
|
|
18
|
-
export interface NetEntry {
|
|
19
|
-
at: number;
|
|
20
|
-
method: string;
|
|
21
|
-
url: string;
|
|
22
|
-
status: number;
|
|
23
|
-
ms: number;
|
|
24
|
-
failed: boolean;
|
|
25
|
-
size?: number;
|
|
26
|
-
type?: string;
|
|
27
|
-
error?: string;
|
|
28
|
-
req?: string;
|
|
29
|
-
res?: string;
|
|
30
|
-
}
|
|
31
|
-
export interface Action {
|
|
32
|
-
at: number;
|
|
33
|
-
kind: "nav" | "click" | "submit";
|
|
34
|
-
label: string;
|
|
35
|
-
role?: string;
|
|
36
|
-
}
|
|
37
|
-
export interface LogLine {
|
|
38
|
-
at: number;
|
|
39
|
-
text: string;
|
|
40
|
-
}
|
|
41
|
-
export type LinkKind = "sentry" | "posthog" | "logrocket";
|
|
42
|
-
export interface OzviConfig {
|
|
43
|
-
network?: boolean;
|
|
44
|
-
networkBodies?: boolean;
|
|
45
|
-
actions?: boolean;
|
|
46
|
-
maskRequest?: (e: NetEntry) => NetEntry | null | false | undefined | void;
|
|
47
|
-
links?: Partial<Record<LinkKind, string | (() => string | null | undefined)>>;
|
|
48
|
-
detectLinks?: boolean;
|
|
49
|
-
sentryOrg?: string;
|
|
50
|
-
}
|
|
51
|
-
export declare const MAX_NET = 30;
|
|
52
|
-
export declare const MAX_ACTIONS = 30;
|
|
53
|
-
export declare const MAX_ERRORS = 20;
|
|
54
|
-
export declare const BODY_LIMIT = 2000;
|
|
55
|
-
/** Fixed-size buffer: the oldest entry falls out. */
|
|
56
|
-
export declare function ring<T>(max: number): {
|
|
57
|
-
push(x: T): void;
|
|
58
|
-
list: () => T[];
|
|
59
|
-
clear(): void;
|
|
60
|
-
};
|
|
61
|
-
export declare const net: {
|
|
62
|
-
push(x: NetEntry): void;
|
|
63
|
-
list: () => NetEntry[];
|
|
64
|
-
clear(): void;
|
|
65
|
-
};
|
|
66
|
-
export declare const actions: {
|
|
67
|
-
push(x: Action): void;
|
|
68
|
-
list: () => Action[];
|
|
69
|
-
clear(): void;
|
|
70
|
-
};
|
|
71
|
-
export declare const errors: {
|
|
72
|
-
push(x: LogLine): void;
|
|
73
|
-
list: () => LogLine[];
|
|
74
|
-
clear(): void;
|
|
75
|
-
};
|
|
76
|
-
/** URL prefixes never logged: the Ozvi host and the host app's token endpoint (its response IS a token). */
|
|
77
|
-
export declare const ignored: string[];
|
|
78
|
-
/** Built-in masking, then the host's maskRequest hook, then masking again (the hook may add data). */
|
|
79
|
-
export declare function finish(e: NetEntry): void;
|
|
80
|
-
export declare function installNetwork(): void;
|
|
81
|
-
/** The accessible name of a clicked control, never an input's value (except button-like inputs, whose value IS the label). */
|
|
82
|
-
export declare function nameOf(el: Element): string;
|
|
83
|
-
export declare function installActions(): void;
|
|
84
|
-
export declare function installErrors(): void;
|
|
85
|
-
/** Session links the host set, plus (only when allowed) the ones its Sentry / PostHog / LogRocket expose. */
|
|
86
|
-
export declare function sessionLinks(): Partial<Record<LinkKind, string>>;
|
|
87
|
-
/** What goes into a bug report's context; respects the opt-outs at the moment of sending too. */
|
|
88
|
-
export declare function snapshot(): {
|
|
89
|
-
network: NetEntry[];
|
|
90
|
-
actions: Action[];
|
|
91
|
-
errors: LogLine[];
|
|
92
|
-
links: Partial<Record<LinkKind, string>>;
|
|
93
|
-
};
|
|
94
|
-
export declare function install(): void;
|