@softistx/pulsarix-widget 0.6.0 → 0.7.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 CHANGED
@@ -46,11 +46,11 @@ and isolated in the widget's shadow root, so it never clashes with the page's ow
46
46
  ```
47
47
 
48
48
  Attributes (all optional but the key): `data-locale` (`en` default, `fr`), `data-theme`
49
- (`light`, `dark`, `auto` default), `data-position` (`bottom-right` default, `bottom-left`),
49
+ (`light`, `dark`, `auto` default), `data-launcher-side` (`right` default, `left`) and `data-launcher-offset` (a fraction from 0, top, to 1, bottom; `0.5` default),
50
50
  `data-accent-color` (a hex seed for the theme; without it the widget wears the host's `@softistx/material` theme, else material's built-in `lavande`), `data-inherit-theme="false"` (never inherit the host's theme; see "Theme"), `data-api-base` (the
51
51
  pulsarix origin; defaults to the host that served the loader), `data-launcher="false"` (no
52
52
  floating button; open it with `window.PulsarixWidget.open()`) or `data-launcher="auto|pill|icon"`
53
- (any value other than `false` gives the round FAB), `data-offset-bottom` and `data-offset-side` (see "The launcher"), `data-mask-text="true"` (the
53
+ (any value other than `false` gives the edge tab; see "The launcher"), `data-mask-text="true"` (the
54
54
  "Mask the text on the page" screenshot option starts on; see "Screenshots"), `data-attachments="false"`
55
55
  (no screenshot and no file controls; see "Attached files"), `data-privacy-url` (an http(s) link to your
56
56
  own privacy page, shown after the privacy line), `data-prefill-email` and `data-prefill-title` (starting
@@ -121,22 +121,20 @@ Server helper: `@softistx/pulsarix-widget/server` exports `signPulsarixIdentity`
121
121
 
122
122
  `mount`, `defineWidget` (registers the element; `mount` calls it), `PulsarixWidgetElement`,
123
123
  `TAG_NAME` (`"pulsarix-widget"`), and the types `MountOptions`,
124
- `WidgetHandle`, `WidgetEvent`, `WidgetConfig`, `Locale`, `Position`, `ThemeMode`, `LauncherMode`,
125
- `LauncherOffset`.
126
-
127
- | `MountOptions` | Type | Default |
128
- | -------------- | --------------------------------------------------- | ---------------------------------------------------- |
129
- | `projectKey` | `string` | required; missing reports `pulsarix:error` `config` |
130
- | `apiBase` | `string` | none; required on the npm route |
131
- | `locale` | `"en" \| "fr"` | `"en"` |
132
- | `theme` | `"light" \| "dark" \| "auto"` | `"auto"` |
133
- | `position` | `"bottom-right" \| "bottom-left"` | `"bottom-right"` |
134
- | `accentColor` | hex string | none: the built-in `lavande` theme |
135
- | `inheritTheme` | `boolean` | `true`: wear the host's `@softistx/material` theme |
136
- | `launcher` | `boolean \| "auto" \| "pill" \| "icon"` | `"auto"` (`false` removes the floating button) |
137
- | `offset` | `{ bottom?, side? }` (number = px, or a CSS length) | 16 px each, plus the bottom safe area |
138
- | `identity` | `string \| null` | none: today's form only (see "Identified reporters") |
139
- | `target` | `Element` | `document.body` |
124
+ `WidgetHandle`, `WidgetEvent`, `WidgetConfig`, `Locale`, `ThemeMode`, `LauncherMode`,
125
+ `LauncherPlacement`, `LauncherSide`.
126
+
127
+ | `MountOptions` | Type | Default |
128
+ | -------------- | ------------------------------------------------------------- | ---------------------------------------------------------- |
129
+ | `projectKey` | `string` | required; missing reports `pulsarix:error` `config` |
130
+ | `apiBase` | `string` | none; required on the npm route |
131
+ | `locale` | `"en" \| "fr"` | `"en"` |
132
+ | `theme` | `"light" \| "dark" \| "auto"` | `"auto"` |
133
+ | `accentColor` | hex string | none: the built-in `lavande` theme |
134
+ | `inheritTheme` | `boolean` | `true`: wear the host's `@softistx/material` theme |
135
+ | `launcher` | `boolean \| "auto" \| "pill" \| "icon" \| { side?, offset? }` | `{ side: "right", offset: 0.5 }` (`false` removes the tab) |
136
+ | `identity` | `string \| null` | none: today's form only (see "Identified reporters") |
137
+ | `target` | `Element` | `document.body` |
140
138
 
141
139
  `WidgetHandle`: `open()`, `close()`, `setLauncherVisible(visible)`, `holdLauncher()` (returns a release function), `destroy()`, `identify(token \| null)`, `setTheme(theme)`, `setLocale(locale)`,
142
140
  `setMetadata(metadata \| null)` (see "Changing theme, locale and metadata at run time"), `on(name, callback)` (returns the function that
@@ -181,14 +179,41 @@ works, and its limits: [docs/integration.md](docs/integration.md#9-inheriting-th
181
179
 
182
180
  ## The launcher
183
181
 
184
- The launcher is one round FAB with the pulsarix mark at every width; with an identity token it opens a
185
- menu with "Report a problem" and "My requests" (unread badge), and its accessible name carries the unread
186
- count. `"auto"`, `"pill"` and `"icon"` all give the FAB, `false` removes it (the `pill` and `icon` values are kept for compatibility and are no-ops; the text pill is gone). With the launcher removed or held hidden, an identified reporter has no way to the requests list: keep it visible for them. To clear a sticky bar,
187
- `offset: { bottom: 88 }` (or `--pulsarix-launcher-bottom` / `--pulsarix-launcher-side` in your own CSS), and
182
+ The launcher is an **edge tab**: a 44 x 44 px icon button docked flush to the viewport edge, rounded on the
183
+ content side only, with the pulsarix mark and the unread badge. At rest it peeks 6 px less; it slides fully
184
+ in on hover, focus and while it is dragged. Its label is a tooltip only (hover or keyboard focus, hidden
185
+ while dragging and on touch screens), and its accessible name carries the unread count ("Report a
186
+ problem, 2 unread requests"). Without an identity token a click opens the report form; with one it opens a
187
+ menu with "Report a problem" and "My requests" (unread badge).
188
+
189
+ You choose where it starts, `launcher: { side: "right" | "left", offset: 0..1 }` (`offset` is a fraction of
190
+ the free height, `0.5` by default; script tag: `data-launcher-side`, `data-launcher-offset`). The reporter can move it
191
+ along the edge: by dragging it, or with Alt+ArrowUp / Alt+ArrowDown (each move is announced). Their
192
+ position is saved in `localStorage` for your origin and wins over your starting point; it stays inside the
193
+ viewport, also when the window is resized. A drag never opens the dialog.
194
+
195
+ `false` removes the tab (`"auto"`, `"pill"` and `"icon"` are still read and give the default tab). With the
196
+ launcher removed or held hidden, an identified reporter has no way to the requests list: keep it visible for them.
188
197
  `setLauncherVisible(false)` hides only the launcher, never an open dialog, and `holdLauncher()` hides it the same way while a host's own sticky bar is up (ref-counted, call the returned function to release); with the script tag it is
189
- `window.PulsarixWidget.setLauncherVisible(false)`. A negative or malformed offset is ignored. Details and examples:
198
+ `window.PulsarixWidget.setLauncherVisible(false)`. Details and examples:
190
199
  [docs/integration.md](docs/integration.md).
191
200
 
201
+ ### Migrating from 0.6 (breaking)
202
+
203
+ The floating round button, its `position` and its offsets are gone:
204
+
205
+ | 0.6 | Now |
206
+ | -------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
207
+ | `position: "bottom-left"` / `data-position` | `launcher: { side: "left" }` / `data-launcher-side="left"` |
208
+ | `offset: { bottom: 88 }` / `data-offset-bottom` | `launcher: { offset: 0.4 }` / `data-launcher-offset="0.4"` (a fraction of the height, not pixels) |
209
+ | `offset.side` / `data-offset-side` | removed: the tab is flush to the edge |
210
+ | `--pulsarix-launcher-bottom`, `--pulsarix-launcher-side` | removed: no longer read |
211
+ | `LauncherOffset`, `Position` types | `LauncherPlacement`, `LauncherSide` |
212
+
213
+ A host that reserved space for the round button (a right padding, say) no longer needs it: the tab is 44 px
214
+ wide, sits on the edge and the reporter can move it out of the way. To clear a sticky bar, use
215
+ `holdLauncher()`.
216
+
192
217
  ## The report form
193
218
 
194
219
  The launcher opens a dialog with a title, a description and an optional e-mail. With an e-mail,
@@ -222,10 +247,10 @@ is kept in the widget's memory and is not written to the page; a token in `data-
222
247
  attribute of the element, so it is visible in the DOM (prefer `identify()` when that matters).
223
248
 
224
249
  - Without a token the dialog is the one report form, and the e-mail field is asked.
225
- - With one, the FAB opens a menu with "Report a problem" and "My requests" (no e-mail field). My requests is its own view, with its own title, and one list with
250
+ - With one, the tab opens a menu with "Report a problem" and "My requests" (no e-mail field). My requests is its own view, with its own title, and one list with
226
251
  filter chips and their counts (Open by default, Resolved, Declined, All); requests with
227
252
  unread replies come first, and the list is read again each time the dialog opens.
228
- - The FAB (in its name) and the My requests menu item show the unread count.
253
+ - The tab (in its name) and the My requests menu item show the unread count.
229
254
  - Opening a request shows its thread: the original message, then the replies of the team (plain
230
255
  text, with their file names). The reporter can reply, with up to three files sent the same way as
231
256
  a report's (the ticket upload below), resolve the request, and reopen a resolved one for 30 days.
@@ -339,13 +364,13 @@ With the npm route, call `widget.identify(token)` on the handle `mount()` return
339
364
  ## Screenshots
340
365
 
341
366
  A report can carry one optional screenshot, never taken without a click (and a per-report
342
- choice). The one "Attachments" control of the form offers:
367
+ choice). The form has a "Screenshot" section and a separate "Attachments" section:
343
368
 
344
- - **Capture this page** (under the one "Add" control): the browser's screen capture (`getDisplayMedia`). The widget hides itself
369
+ - **Capture this page** (Screenshot section): the browser's screen capture (`getDisplayMedia`). The widget hides itself
345
370
  (`visibility`, not unmount, so the form keeps its text) while the frame is grabbed, then shows
346
371
  itself again. Not offered on a phone, without the API, or under a Permissions-Policy that blocks
347
372
  `display-capture`.
348
- - **Upload a file** (under "Add"): always offered, and the only choice where capture is unavailable or was
373
+ - **Upload a file** (Attachments section, a drop zone with a Browse button): always offered, and the only choice where capture is unavailable or was
349
374
  refused. PNG, JPEG, WebP or PDF. An uploaded image opens in the same editor as a capture (a PDF is
350
375
  a plain attachment).
351
376
  - **Mask the text on the page** (off by default; `data-mask-text="true"`, or `maskText: true` in `init` / `mount`, turns it on when the dialog opens): covers the
@@ -385,7 +410,7 @@ widget.on("pulsarix:error", (event) => console.warn(event.detail.code));
385
410
  ## Attached files
386
411
 
387
412
  Besides the screenshot, a reporter can attach up to 3 files (PNG, JPEG, WebP or PDF, 5 MB each,
388
- 12 MB for the report, screenshot included) by dropping them on the dialog or with "Add" then "Upload a file". The
413
+ 12 MB for the report, screenshot included) by dropping them on the Attachments zone or with "Upload a file". The
389
414
  checks mirror the API's, so a refused file is shown with its reason and never sent; the list shows
390
415
  each file's type icon, name, size, a thumbnail for images, a Remove button, and its progress while
391
416
  the report goes out.