@softistx/pulsarix-widget 0.5.0 → 0.6.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 +24 -16
- package/dist/index.js +4689 -53
- package/dist/types/config.d.ts +2 -2
- package/dist/types/mount.d.ts +3 -3
- package/docs/integration.md +18 -13
- package/package.json +3 -3
package/dist/types/config.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export type Locale = "en" | "fr";
|
|
3
3
|
export type ThemeMode = "light" | "dark" | "auto";
|
|
4
4
|
export type Position = "bottom-right" | "bottom-left";
|
|
5
|
-
/**
|
|
5
|
+
/** Every value gives the round FAB; the values are read so existing embeds keep working. */
|
|
6
6
|
export type LauncherMode = "auto" | "pill" | "icon";
|
|
7
7
|
/** A launcher offset: a number is pixels, a string is any CSS length (`"2rem"`, `"env(...)"`). */
|
|
8
8
|
export interface LauncherOffset {
|
|
@@ -14,7 +14,7 @@ export interface WidgetConfig {
|
|
|
14
14
|
locale: Locale;
|
|
15
15
|
theme: ThemeMode;
|
|
16
16
|
position: Position;
|
|
17
|
-
/**
|
|
17
|
+
/** Read for compatibility (`launcher="pill"`, `"icon"`): the launcher is always the round FAB; `launcher="false"` is read by the element. */
|
|
18
18
|
launcherMode: LauncherMode;
|
|
19
19
|
/** The launcher's offsets (`offset-bottom`, `offset-side`), as CSS lengths, or null. */
|
|
20
20
|
offset: {
|
package/dist/types/mount.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export interface MountOptions {
|
|
|
14
14
|
inheritTheme?: boolean;
|
|
15
15
|
/** Origin of the pulsarix host (`https://pulsarix.example.com`); the loader fills it in. */
|
|
16
16
|
apiBase?: string;
|
|
17
|
-
/** The floating button: `"auto"`
|
|
17
|
+
/** The floating button: `"auto"`, `"pill"` and `"icon"` all give the round FAB (kept for compatibility), or `false` for none. */
|
|
18
18
|
launcher?: boolean | LauncherMode;
|
|
19
19
|
/** Launcher distance from the bottom and its side (16 px default): pixels, or a CSS length. */
|
|
20
20
|
offset?: LauncherOffset;
|
|
@@ -57,8 +57,8 @@ export interface WidgetHandle {
|
|
|
57
57
|
setTheme(theme: ThemeMode): void;
|
|
58
58
|
/**
|
|
59
59
|
* Switches the language. The widget's strings change at once; `@softistx/material`'s built-in labels
|
|
60
|
-
* follow when the form is idle (typed fields, type
|
|
61
|
-
* during a send, on the confirmation or on the requests
|
|
60
|
+
* follow when the form is idle (typed fields, type and impact kept, attachments dropped), never
|
|
61
|
+
* during a send, on the confirmation or on the requests view.
|
|
62
62
|
*/
|
|
63
63
|
setLocale(locale: Locale): void;
|
|
64
64
|
/** Replaces the metadata sent with the next report (`null` clears it). */
|
package/docs/integration.md
CHANGED
|
@@ -77,7 +77,7 @@ One widget per page: use the script tag or `mount()`, not both.
|
|
|
77
77
|
## 3. Identify your signed-in users
|
|
78
78
|
|
|
79
79
|
Without an identity the widget is the anonymous report form. With one, reports are filed under the
|
|
80
|
-
reporter, who also gets a "My requests"
|
|
80
|
+
reporter, who also gets a "My requests" view (threads, replies, unread counts, "Delete my data").
|
|
81
81
|
|
|
82
82
|
Your server signs a short-lived token for the signed-in user with the key's identity secret; the browser
|
|
83
83
|
only carries the token. The helper does the signing:
|
|
@@ -234,6 +234,10 @@ Content-Security-Policy:
|
|
|
234
234
|
- Nothing else is needed for images or capture: thumbnails and the screenshot editor draw on canvases,
|
|
235
235
|
so there is no `img-src blob:`. Screen capture needs `display-capture` in your `Permissions-Policy`
|
|
236
236
|
(uploading an image works without it).
|
|
237
|
+
- Lazy chunks come from the same pulsarix host, so no extra `script-src` entry: the screenshot editor
|
|
238
|
+
(fetched on the first capture) and the markdown renderer of the team's replies (`chat-markdown-*.js`,
|
|
239
|
+
about 740 KB, 221 KB gzipped, fetched when a thread opens; plain text shows until it arrives). Serve
|
|
240
|
+
every file of the widget's folder beside the entry, with the bundle's cache headers.
|
|
237
241
|
- The widget's styles are adopted into its shadow root: no `style-src 'unsafe-inline'`. The requests
|
|
238
242
|
thread injects one `<style>` element; under a strict `style-src` give your page a nonce, which the
|
|
239
243
|
widget reads from a `nonce` attribute on a `style` or `script` element or from this tag:
|
|
@@ -254,7 +258,7 @@ Script-tag attributes and `init` / `mount` options (all optional except the key)
|
|
|
254
258
|
| `data-theme` / `theme` | `light`, `dark` or `auto` (default) |
|
|
255
259
|
| `data-position` / `position` | `bottom-right` (default) or `bottom-left` |
|
|
256
260
|
| `data-accent-color` / `accentColor` | a hex seed for the theme |
|
|
257
|
-
| `data-launcher` / `launcher` | `
|
|
261
|
+
| `data-launcher` / `launcher` | `false` for none; any other value gives the round FAB (section 11) |
|
|
258
262
|
| `data-offset-bottom`, `data-offset-side` / `offset` | launcher distance from the bottom and its side (section 11) |
|
|
259
263
|
| `data-attachments="false"` | no screenshot and no file controls |
|
|
260
264
|
| `data-mask-text="true"` | "Mask the text on the page" starts on |
|
|
@@ -264,7 +268,9 @@ Script-tag attributes and `init` / `mount` options (all optional except the key)
|
|
|
264
268
|
| `data-metadata` / `metadata` | a JSON object of strings stored with each report |
|
|
265
269
|
|
|
266
270
|
`metadata` carries facts about the session that help triage: at most 20 entries, keys of 64 characters,
|
|
267
|
-
values of 512, 2 KB in all; the rest is dropped.
|
|
271
|
+
values of 512, 2 KB in all; the rest is dropped. The keys `capture-N-page` are reserved: the widget
|
|
272
|
+
writes one per screenshot (the page it was taken on, origin and path), drops a host entry of that shape,
|
|
273
|
+
and drops the host's last entries first when the whole would pass these limits.
|
|
268
274
|
|
|
269
275
|
```html
|
|
270
276
|
<script src="https://<pulsarix-host>/widget/v1/loader.js" async
|
|
@@ -448,9 +454,9 @@ Rules:
|
|
|
448
454
|
64 characters, values of 512, 2 KB in all). A report already sent is not changed.
|
|
449
455
|
- `setLocale` changes the widget's own strings at once. The built-in labels of `@softistx/material` (the close
|
|
450
456
|
button, the file list, ...) are read once by its i18n context, so they change when the form is next idle:
|
|
451
|
-
- On an idle form, the typed fields, the chosen type and impact
|
|
457
|
+
- On an idle form, the typed fields, the chosen type and impact are kept; files and a
|
|
452
458
|
screenshot already attached are dropped.
|
|
453
|
-
- While a report is being sent, on the confirmation screen, or
|
|
459
|
+
- While a report is being sent, on the confirmation screen, or in the "My requests" view, nothing is rebuilt:
|
|
454
460
|
those built-in labels switch when the reporter returns to the form (or the dialog closes), and no
|
|
455
461
|
attachment is lost.
|
|
456
462
|
- `setTheme` and `setMetadata` drop nothing.
|
|
@@ -465,15 +471,14 @@ attribute and a `mount()` option.
|
|
|
465
471
|
|
|
466
472
|
### Look: `launcher`
|
|
467
473
|
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
| `"pill"` | Always the text pill (the 0.3 look). |
|
|
472
|
-
| `"icon"` | Always a 48 px round button with a speech-bubble icon. |
|
|
473
|
-
| `false` | No launcher; open the dialog with `open()`. |
|
|
474
|
+
The launcher is one round floating action button (FAB) with the pulsarix mark, at every width. The
|
|
475
|
+
`launcher` option no longer changes its look: `"auto"`, `"pill"` and `"icon"` all give the FAB (they
|
|
476
|
+
are still read so existing embeds keep working), and `false` removes it (open the dialog with `open()`).
|
|
474
477
|
|
|
475
|
-
|
|
476
|
-
|
|
478
|
+
Without a token the FAB opens the report form directly. With a token it opens a small menu anchored
|
|
479
|
+
to it with two items, "Report a problem" and "My requests" (with its unread badge); each opens one
|
|
480
|
+
view, never tabs. The FAB keeps the localized label as its accessible name and carries the unread
|
|
481
|
+
count in it ("Report a problem, 3"), with a visible focus ring.
|
|
477
482
|
|
|
478
483
|
```html
|
|
479
484
|
<script src="https://<pulsarix-host>/widget/v1/loader.js" async
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@softistx/pulsarix-widget",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Embeddable client-issue intake widget for pulsarix, rendered in a Shadow DOM",
|
|
6
6
|
"license": "MIT",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"@graphql-codegen/typescript": "^7.0.1",
|
|
19
19
|
"@graphql-codegen/typescript-operations": "^7.0.1",
|
|
20
20
|
"@happy-dom/global-registrator": "^21.0.4",
|
|
21
|
-
"@softistx/material": "^3.
|
|
21
|
+
"@softistx/material": "^3.279.0",
|
|
22
22
|
"@softistx/material-core": "^0.96.1",
|
|
23
23
|
"@tailwindcss/cli": "^4.3.3",
|
|
24
24
|
"@testing-library/dom": "^10.4.2",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"generate:check": "bun scripts/generate.ts --check",
|
|
48
48
|
"schema:sync": "bun scripts/schema-sync.ts",
|
|
49
49
|
"schema:check": "bun scripts/schema-sync.ts --check",
|
|
50
|
-
"test:browser": "bun scripts/leak-test.ts && bun scripts/screenshot-test.ts && bun scripts/files-test.ts && bun scripts/thread-test.ts && bun scripts/privacy-test.ts",
|
|
50
|
+
"test:browser": "bun scripts/leak-test.ts && bun scripts/screenshot-test.ts && bun scripts/files-test.ts && bun scripts/thread-test.ts && bun scripts/privacy-test.ts && bun scripts/contrast-test.ts",
|
|
51
51
|
"fixture": "bun scripts/serve-fixture.ts",
|
|
52
52
|
"verify": "bun run lint && bun run schema:check && bun run generate:check && bun run build && bun run typecheck && bun run test && bun run check:deps && bun run size",
|
|
53
53
|
"release": "bun scripts/publish.ts",
|