@softistx/pulsarix-widget 0.7.3 → 0.8.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 +15 -8
- package/dist/chunks/abnfDiagram-XWFEHMT6.jcqkp43e.js +1 -0
- package/dist/chunks/architecture-WOLXFQ4H.6qa86taq.js +1 -0
- package/dist/chunks/architectureDiagram-CSQXQB3N.pk9dxdfb.js +36 -0
- package/dist/chunks/blockDiagram-BEDRHYPZ.ehefn7dt.js +140 -0
- package/dist/chunks/bpmnIcons-APHXDYXF.whh96nc8.js +1 -0
- package/dist/chunks/c4Diagram-M2UUVUY5.knj3as6x.js +38 -0
- package/dist/chunks/chat-markdown-DLDNLXM9.tvekh9sm.js +301 -0
- package/dist/chunks/classDiagram-v2-KXABOMEV.vtb7vjzn.js +217 -0
- package/dist/chunks/cose-bilkent-JH36ORCC.gb18dr42.js +1 -0
- package/dist/chunks/cynefin-EF2NZ3EQ.e86yfa9w.js +1 -0
- package/dist/chunks/cynefinDiagram-NJNITYFG.akmr90zk.js +62 -0
- package/dist/chunks/dagre-KIHZ2IZ3.7n7s7vq2.js +4 -0
- package/dist/chunks/diagram-7YQZDPLS.d3sdv0py.js +41 -0
- package/dist/chunks/diagram-QBROCOUO.2v08zs42.js +200 -0
- package/dist/chunks/diagram-RJJCUUZO.tpnwa621.js +30 -0
- package/dist/chunks/diagram-WERXNKYE.hz7tgbtr.js +24 -0
- package/dist/chunks/diagram-YHHI257C.9gge9ecb.js +3 -0
- package/dist/chunks/diagram-YR4HJLHV.bajpx75b.js +24 -0
- package/dist/chunks/ebnfDiagram-N527522P.hxbbq671.js +1 -0
- package/dist/chunks/editor-shortcuts-dialog-I77EAez1.0s00eh53.js +1 -0
- package/dist/chunks/editor.h5bxwyxn.js +4 -0
- package/dist/chunks/elk-O5DQBFGD.vy7cdqps.js +27 -0
- package/dist/chunks/emoji-picker-BofyuTmK.qf287fk6.js +4 -0
- package/dist/chunks/erDiagram-K3K3BIDK.kzs3v0ts.js +99 -0
- package/dist/chunks/eventmodeling-K75KTNOO.9yb5zf47.js +1 -0
- package/dist/chunks/flow-diagram-OPO1ep57.5006stqg.js +7 -0
- package/dist/chunks/flowDiagram-Z6JWZHQI.zf0kndsp.js +1 -0
- package/dist/chunks/ganttDiagram-3PRQTZWP.qkcp8pvg.js +292 -0
- package/dist/chunks/gitGraph-VSP46ZUC.txpj8e6d.js +1 -0
- package/dist/chunks/gitGraphDiagram-VXDFKS5L.ry9dejxm.js +106 -0
- package/dist/chunks/grid-E2QIVN74.q51enfx7.js +1 -0
- package/dist/chunks/illustration-BoOzuxNg.h0gnxa4s.js +1 -0
- package/dist/chunks/index.0hrfbrja.js +44 -0
- package/dist/chunks/index.153rcscj.js +2 -0
- package/dist/chunks/index.20dvswea.js +2 -0
- package/dist/chunks/index.23p1k2rx.js +2 -0
- package/dist/chunks/index.3k4gyba0.js +2 -0
- package/dist/chunks/index.51yk4ene.js +2 -0
- package/dist/chunks/index.9zhger75.js +142 -0
- package/dist/chunks/index.bfeafb22.js +1 -0
- package/dist/chunks/index.cf9nd6xy.js +2 -0
- package/dist/chunks/index.eec12m3n.js +16 -0
- package/dist/chunks/index.fab58nn0.js +2 -0
- package/dist/chunks/index.fgsp5qqn.js +303 -0
- package/dist/chunks/index.fv9af3wd.js +333 -0
- package/dist/chunks/index.fvh2m60c.js +2 -0
- package/dist/chunks/index.gqa9s37g.js +2 -0
- package/dist/chunks/index.h6120080.js +2 -0
- package/dist/chunks/index.q9dsw4bt.js +2 -0
- package/dist/chunks/index.vnhefjwh.js +2 -0
- package/dist/chunks/index.x163xe9c.js +89 -0
- package/dist/chunks/index.x1xqs5m5.js +214 -0
- package/dist/chunks/index.yf0h5qnv.js +2 -0
- package/dist/chunks/info-OHQRW6UA.xea9bh7d.js +1 -0
- package/dist/chunks/infoDiagram-EZ3ZOAHP.r2yygqw8.js +2 -0
- package/dist/chunks/ishikawaDiagram-S3EKX5GW.gwqtdvb2.js +70 -0
- package/dist/chunks/journeyDiagram-POQNLL5X.rp31qkq5.js +139 -0
- package/dist/chunks/kanban-definition-BH5XI6FM.ymsqx6en.js +89 -0
- package/dist/chunks/katex.n08hp8fc.js +257 -0
- package/dist/chunks/markup-color-chrome-ykGNUl8y.06cy435c.js +1 -0
- package/dist/chunks/markup-custom-color-C8Xc6JxB.an2wngns.js +1 -0
- package/dist/chunks/mention-list-Dhq70jL5.1k61f24q.js +1 -0
- package/dist/chunks/mermaid.core.x45crg0h.js +12 -0
- package/dist/chunks/mindmap-definition-WVAN44T4.5cbd4rg2.js +98 -0
- package/dist/chunks/packet-JDAUHWVQ.c7dmae11.js +1 -0
- package/dist/chunks/panel.rzp4q8s3.js +7 -0
- package/dist/chunks/pegDiagram-D4NLKWP3.fsryts4r.js +1 -0
- package/dist/chunks/pie-XZMESJXO.6rv4kzjx.js +1 -0
- package/dist/chunks/pieDiagram-36ENHN4W.k4k2gvg0.js +39 -0
- package/dist/chunks/plated-illustration-BzxADkoZ.wtc9psry.js +1 -0
- package/dist/chunks/quadrantDiagram-ZQUDMS73.j7nj12w0.js +7 -0
- package/dist/chunks/radar-ABXABTNO.58dfc8ba.js +1 -0
- package/dist/chunks/railroad-I3PHUGI6.00fqbahv.js +1 -0
- package/dist/chunks/railroad-abnf-LNEFI6M7.gt1x50q5.js +1 -0
- package/dist/chunks/railroad-ebnf-DWYD2UWJ.qr5qfkga.js +1 -0
- package/dist/chunks/railroad-peg-JR7BVNR7.m61rq7hj.js +1 -0
- package/dist/chunks/railroadDiagram-JIZHGYPL.a681wt3b.js +1 -0
- package/dist/chunks/render-VIF2ZAQL.rn9hpsbx.js +1 -0
- package/dist/chunks/requirementDiagram-AXW2TVFA.shapgy39.js +84 -0
- package/dist/chunks/sankeyDiagram-FBCJTAIF.2syz1e2b.js +40 -0
- package/dist/chunks/sequenceDiagram-3LA2ROMG.jq1w12a6.js +169 -0
- package/dist/chunks/sizeCapture-2Q2CQKSF.jtv53a6j.js +1 -0
- package/dist/chunks/stateDiagram-v2-ATKHQDJO.x0g2rngz.js +291 -0
- package/dist/chunks/swimlanes-YQL5WMAO.j7j7c6ex.js +1 -0
- package/dist/chunks/swimlanesDiagram-UCCPES4V.tzqcsrmd.js +8 -0
- package/dist/chunks/timeline-definition-7Z437IG3.s5bvn8dr.js +120 -0
- package/dist/chunks/treeView-D4JQ5SDB.0x1grm2t.js +1 -0
- package/dist/chunks/treemap-SAJKECNS.1te19jsm.js +1 -0
- package/dist/chunks/usecaseDiagram-RDK6N6HP.9k4r423e.js +370 -0
- package/dist/chunks/vennDiagram-SHRQU5PJ.82q5dzm6.js +34 -0
- package/dist/chunks/wardley-7MLQ67FV.zp6gykk3.js +1 -0
- package/dist/chunks/wardleyDiagram-F3OXNVQS.fm4tw2nc.js +78 -0
- package/dist/chunks/xychartDiagram-GDYJKCDI.57vqn2zd.js +7 -0
- package/dist/index.js +23 -4695
- package/docs/integration.md +146 -33
- package/package.json +7 -6
package/docs/integration.md
CHANGED
|
@@ -16,6 +16,11 @@ and "My requests" working. Reference for every option and event: the [README](..
|
|
|
16
16
|
10. [Changing theme, locale and metadata at run time](#10-changing-theme-locale-and-metadata-at-run-time)
|
|
17
17
|
11. [The launcher: look, position and visibility](#11-the-launcher-look-position-and-visibility)
|
|
18
18
|
- [Sticky bottom bars: `holdLauncher()`](#sticky-bottom-bars-holdlauncher)
|
|
19
|
+
12. [Language](#12-language)
|
|
20
|
+
13. [Host accent](#13-host-accent)
|
|
21
|
+
|
|
22
|
+
The shortest path: get a key (1), add the loader (2), sign identities on your server and call
|
|
23
|
+
`identify()` (3), allow the pulsarix host in your CSP (4). Everything else is optional.
|
|
19
24
|
|
|
20
25
|
## 1. Get a project and a widget key
|
|
21
26
|
|
|
@@ -48,7 +53,19 @@ origin is the host that served the loader; override it with `data-api-base`.
|
|
|
48
53
|
|
|
49
54
|
### npm `mount()`
|
|
50
55
|
|
|
51
|
-
For an app that installs the package
|
|
56
|
+
For an app that installs the package. The package is private on npmjs: point the `@softistx` scope at
|
|
57
|
+
npmjs with a read token kept in an environment variable (never committed), as the README's "Install"
|
|
58
|
+
shows (`.npmrc` form below), then:
|
|
59
|
+
|
|
60
|
+
```ini
|
|
61
|
+
@softistx:registry=https://registry.npmjs.org
|
|
62
|
+
//registry.npmjs.org/:_authToken=${NPM_SOFTISTX_READ_TOKEN}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
```sh
|
|
66
|
+
export NPM_SOFTISTX_READ_TOKEN=<your read token>
|
|
67
|
+
bun add @softistx/pulsarix-widget # or: npm install @softistx/pulsarix-widget
|
|
68
|
+
```
|
|
52
69
|
|
|
53
70
|
```ts
|
|
54
71
|
import { mount } from "@softistx/pulsarix-widget";
|
|
@@ -60,18 +77,33 @@ const widget = mount({
|
|
|
60
77
|
});
|
|
61
78
|
```
|
|
62
79
|
|
|
80
|
+
The package is split for your bundler: `dist/index.js` (about 1.2 MB un-gzipped, 300 KB gzipped) holds the
|
|
81
|
+
widget and imports the editor, the requests view and the markdown renderer (with its diagram engine) from
|
|
82
|
+
`dist/chunks/` on first use, so your build emits them as lazy chunks and a host that never opens them
|
|
83
|
+
never loads them. Nothing is fetched from the pulsarix host except the API calls and the icon sheet.
|
|
84
|
+
|
|
63
85
|
The module is browser-only: in an SSR framework import it on the client, inside an effect:
|
|
64
86
|
|
|
65
87
|
```tsx
|
|
66
88
|
useEffect(() => {
|
|
89
|
+
let cancelled = false;
|
|
67
90
|
let widget: { destroy(): void } | undefined;
|
|
68
91
|
import("@softistx/pulsarix-widget").then(({ mount }) => {
|
|
92
|
+
if (cancelled) return;
|
|
69
93
|
widget = mount({ projectKey, apiBase });
|
|
70
94
|
});
|
|
71
|
-
return () =>
|
|
95
|
+
return () => {
|
|
96
|
+
cancelled = true;
|
|
97
|
+
widget?.destroy();
|
|
98
|
+
};
|
|
72
99
|
}, [projectKey, apiBase]);
|
|
73
100
|
```
|
|
74
101
|
|
|
102
|
+
In the snippets of this guide, names such as `projectKey`, `apiBase`, `token`, `analytics`, `resolvedMode`, `orgId`, `plan`, `user`, `requireUser`, `getUser`,
|
|
103
|
+
`locale` and `Route.LoaderArgs` stand for your own values and types: the snippets are schematic. The
|
|
104
|
+
page gets the public key (it is not secret) from your own build-time or loader config, never from the
|
|
105
|
+
server-only `PULSARIX_*` variables.
|
|
106
|
+
|
|
75
107
|
One widget per page: use the script tag or `mount()`, not both.
|
|
76
108
|
|
|
77
109
|
## 3. Identify your signed-in users
|
|
@@ -105,15 +137,16 @@ export function pulsarixTokenFor(user: {
|
|
|
105
137
|
Import the signer only in server code (a loader, or a `*.server.ts` file), never in the browser. Then hand
|
|
106
138
|
the token to the widget, and clear it at sign-out. In a strict-TypeScript host the script tag's global is
|
|
107
139
|
not typed: declare it once with
|
|
108
|
-
`declare global { interface Window { PulsarixWidget?: { identify(token: string | null): void; holdLauncher(): () => void } } }
|
|
140
|
+
`declare global { interface Window { PulsarixWidget?: { identify(token: string | null): void; holdLauncher(): () => void; setLocale(locale: "en" | "fr"): void; setTheme(theme: "light" | "dark" | "auto"): void } } }`
|
|
141
|
+
(add the other methods you call),
|
|
109
142
|
or use the npm route's typed handle:
|
|
110
143
|
|
|
111
144
|
```ts
|
|
112
145
|
// browser, after sign-in or on each page load (script tag)
|
|
113
|
-
window.PulsarixWidget
|
|
146
|
+
window.PulsarixWidget?.identify(token);
|
|
114
147
|
|
|
115
148
|
// at sign-out
|
|
116
|
-
window.PulsarixWidget
|
|
149
|
+
window.PulsarixWidget?.identify(null);
|
|
117
150
|
|
|
118
151
|
// npm route: the handle mount() returned
|
|
119
152
|
widget.identify(token);
|
|
@@ -136,6 +169,12 @@ The token is `<payload>.<signature>`, both base64url without padding; the signat
|
|
|
136
169
|
HMAC-SHA256 of the payload text, keyed with the secret **as the raw string** (not base64url-decoded).
|
|
137
170
|
The API allows 5 minutes of clock skew between your server and itself.
|
|
138
171
|
|
|
172
|
+
**The script tag is `async`.** `window.PulsarixWidget` exists only once `loader.js` has run, so an
|
|
173
|
+
effect that runs earlier finds it `undefined` and `?.` silently does nothing. Either load the loader
|
|
174
|
+
without `async` (`defer`, with your effects after it), or pass the first values in the tag
|
|
175
|
+
(`data-identity`, `data-locale`) and use the calls for later changes. Once the global exists, calls
|
|
176
|
+
made before the bundle has loaded are queued.
|
|
177
|
+
|
|
139
178
|
**Re-sign before expiry.** A token is not renewed by the widget. Sign a new one on each request that
|
|
140
179
|
renders a page, or from a small endpoint your page calls every half life, and call `identify(newToken)`.
|
|
141
180
|
A tab that stays open longer than the token lives gets `pulsarix:error` with
|
|
@@ -236,7 +275,7 @@ Content-Security-Policy:
|
|
|
236
275
|
(uploading an image works without it).
|
|
237
276
|
- Lazy chunks come from the same pulsarix host, so no extra `script-src` entry: the screenshot editor
|
|
238
277
|
(fetched on the first capture) and the markdown renderer of the team's replies (`chat-markdown-*.js`,
|
|
239
|
-
about
|
|
278
|
+
about 750 KB, 223 KB gzipped, fetched when a thread opens; plain text shows until it arrives). Serve
|
|
240
279
|
every file of the widget's folder beside the entry, with the bundle's cache headers.
|
|
241
280
|
- The icons (the type and impact cards, the camera button) come from a small sheet at
|
|
242
281
|
`<apiBase>/widget/v1/icons/duotone.svg`, where `apiBase` is the loader's origin unless you set
|
|
@@ -257,22 +296,24 @@ Content-Security-Policy:
|
|
|
257
296
|
|
|
258
297
|
Script-tag attributes and `init` / `mount` options (all optional except the key):
|
|
259
298
|
|
|
260
|
-
| Attribute / option
|
|
261
|
-
|
|
|
262
|
-
| `data-project-key` / `projectKey`
|
|
263
|
-
| `data-api-base` / `apiBase`
|
|
264
|
-
| `data-locale` / `locale`
|
|
265
|
-
| `data-theme` / `theme`
|
|
266
|
-
| `data-launcher-side` / `launcher.side`
|
|
267
|
-
| `data-launcher-offset` / `launcher.offset`
|
|
268
|
-
| `data-accent-color` / `accentColor`
|
|
269
|
-
| `data-
|
|
270
|
-
| `
|
|
271
|
-
| `data-
|
|
272
|
-
| `data-
|
|
273
|
-
| `data-
|
|
274
|
-
| `data-
|
|
275
|
-
| `data-
|
|
299
|
+
| Attribute / option | Effect |
|
|
300
|
+
| ---------------------------------------------------- | ----------------------------------------------------------------- |
|
|
301
|
+
| `data-project-key` / `projectKey` | the public key (required) |
|
|
302
|
+
| `data-api-base` / `apiBase` | the pulsarix origin; required on the npm route |
|
|
303
|
+
| `data-locale` / `locale` | `en` (default) or `fr` |
|
|
304
|
+
| `data-theme` / `theme` | `light`, `dark` or `auto` (default) |
|
|
305
|
+
| `data-launcher-side` / `launcher.side` | `right` (default) or `left` (section 11) |
|
|
306
|
+
| `data-launcher-offset` / `launcher.offset` | a fraction from 0 (top) to 1 (bottom), `0.5` default (section 11) |
|
|
307
|
+
| `data-accent-color` / `accentColor` | a hex seed for the theme |
|
|
308
|
+
| `data-inherit-theme="false"` / `inheritTheme: false` | keep the widget's own look (section 9) |
|
|
309
|
+
| `target` (`mount()` only) | the element to append the widget to; `document.body` by default |
|
|
310
|
+
| `data-launcher` / `launcher` | `false` for none; any other value gives the edge tab (section 11) |
|
|
311
|
+
| `data-attachments="false"` | no screenshot and no file controls |
|
|
312
|
+
| `data-mask-text="true"` | "Mask the text on the page" starts on |
|
|
313
|
+
| `data-privacy-url` / `privacyUrl` | an http(s) link to your privacy page |
|
|
314
|
+
| `data-prefill-email`, `data-prefill-title` | starting values of the form |
|
|
315
|
+
| `data-identity` / `identity` | the signed token (section 3) |
|
|
316
|
+
| `data-metadata` / `metadata` | a JSON object of strings stored with each report |
|
|
276
317
|
|
|
277
318
|
`metadata` carries facts about the session that help triage: at most 20 entries, keys of 64 characters,
|
|
278
319
|
values of 512, 2 KB in all; the rest is dropped. The keys `capture-N-page` are reserved: the widget
|
|
@@ -286,7 +327,7 @@ and drops the host's last entries first when the whole would pass these limits.
|
|
|
286
327
|
data-metadata='{"plan":"pro","build":"2026.11.3"}'></script>
|
|
287
328
|
```
|
|
288
329
|
|
|
289
|
-
```
|
|
330
|
+
```js
|
|
290
331
|
PulsarixWidget.init({
|
|
291
332
|
projectKey: "pk_live_xxx",
|
|
292
333
|
metadata: { plan: "pro", build: "2026.11.3" },
|
|
@@ -311,7 +352,7 @@ Heard on the element and with `on(name, callback)`, which returns the function t
|
|
|
311
352
|
| `pulsarix:erase` | `{ requests }` | the reporter erased their data |
|
|
312
353
|
| `pulsarix:error` | `{ code }` | a failure; the API's `intake.errors.*`, `network`, `config` or `http-<status>` |
|
|
313
354
|
|
|
314
|
-
```
|
|
355
|
+
```js
|
|
315
356
|
const off = PulsarixWidget.on("pulsarix:submit", (e) =>
|
|
316
357
|
analytics.track("report", e.detail.reportId),
|
|
317
358
|
);
|
|
@@ -353,7 +394,7 @@ never sits on the production key.
|
|
|
353
394
|
| `intake.errors.attachments-disabled` (403) | the key's "Screenshots and files" switch is off | switch it on, or set `data-attachments="false"` |
|
|
354
395
|
| `config` | no project key, or no `apiBase` on the npm route | give both |
|
|
355
396
|
| `intake.errors.unavailable` (503) | the service cannot check its limits | retry shortly |
|
|
356
|
-
| `signPulsarixIdentity:
|
|
397
|
+
| `signPulsarixIdentity: the token is N characters ...`, `now must return milliseconds`, `... must be ...` | an option the API would refuse | fix the named option; the message says which |
|
|
357
398
|
| Blocked by CSP in the console | the pulsarix host is missing from `script-src` or `connect-src`, or a strict `style-src` has no nonce | section 4 |
|
|
358
399
|
| `identify()` seems ignored | the token is malformed (anything that is not `<payload>.<signature>` is dropped) | pass the string `signPulsarixIdentity` returned, unchanged |
|
|
359
400
|
|
|
@@ -367,7 +408,11 @@ when the user changes theme. Nothing to configure: `inheritTheme` is `true` by d
|
|
|
367
408
|
mount({ projectKey: "pk_live_xxx", apiBase: "https://pulsarix.example.com" });
|
|
368
409
|
// the host's theme picker, dark mode and primary now apply to the dialog
|
|
369
410
|
|
|
370
|
-
mount({
|
|
411
|
+
mount({
|
|
412
|
+
projectKey: "pk_live_xxx",
|
|
413
|
+
apiBase: "https://pulsarix.example.com",
|
|
414
|
+
inheritTheme: false,
|
|
415
|
+
}); // the widget's own look, as before
|
|
371
416
|
```
|
|
372
417
|
|
|
373
418
|
Script tag: `data-inherit-theme="false"`. Element attribute: `inherit-theme="false"`.
|
|
@@ -421,7 +466,12 @@ reporter may have a dialog open. Never remount the widget for that (a remount dr
|
|
|
421
466
|
use the setters on the mount handle or on the script-tag global.
|
|
422
467
|
|
|
423
468
|
```ts
|
|
424
|
-
const widget = mount({
|
|
469
|
+
const widget = mount({
|
|
470
|
+
projectKey: "pk_live_xxx",
|
|
471
|
+
apiBase: "https://pulsarix.example.com",
|
|
472
|
+
theme: "light",
|
|
473
|
+
locale: "en",
|
|
474
|
+
});
|
|
425
475
|
|
|
426
476
|
// the app's mode changed (resolve "Système" yourself, from the app's own state)
|
|
427
477
|
widget.setTheme(resolvedMode); // "light" | "dark" | "auto"
|
|
@@ -478,10 +528,9 @@ The edge tab that opens the dialog. Two options shape it; each has script-tag at
|
|
|
478
528
|
### Look: `launcher`
|
|
479
529
|
|
|
480
530
|
The launcher is an icon button, 44 x 44 px on wide screens, docked flush to the viewport edge and
|
|
481
|
-
rounded on the content side only. On phones (viewport 600 px or less) it is
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
44-48 px on wide screens.
|
|
531
|
+
rounded on the content side only. On phones (viewport 600 px or less) it is still 44 x 44 px, with no peek, and the hit area is
|
|
532
|
+
exactly the visible tab. To avoid any overlap, reserve `padding-inline-end` (`-start` for a left
|
|
533
|
+
tab) of 44-48 px at every width.
|
|
485
534
|
It wears the pulsarix mark and the unread badge. On wide screens it peeks 6 px less at rest; it slides
|
|
486
535
|
fully in on hover, focus and while dragged. Its label is a tooltip only
|
|
487
536
|
("Report a problem", with "Drag to move" on a second line): shown on hover or keyboard focus after a short
|
|
@@ -502,7 +551,11 @@ You choose where the tab starts: the edge (`"right"` default, or `"left"`) and a
|
|
|
502
551
|
default.
|
|
503
552
|
|
|
504
553
|
```ts
|
|
505
|
-
mount({
|
|
554
|
+
mount({
|
|
555
|
+
projectKey: "pk_live_xxx",
|
|
556
|
+
apiBase: "https://pulsarix.example.com",
|
|
557
|
+
launcher: { side: "left", offset: 0.3 },
|
|
558
|
+
});
|
|
506
559
|
```
|
|
507
560
|
|
|
508
561
|
```html
|
|
@@ -532,7 +585,10 @@ types are replaced by `LauncherSide` and `LauncherPlacement`.
|
|
|
532
585
|
Hides or shows the launcher only, for a screen where the button is in the way:
|
|
533
586
|
|
|
534
587
|
```ts
|
|
535
|
-
const widget = mount({
|
|
588
|
+
const widget = mount({
|
|
589
|
+
projectKey: "pk_live_xxx",
|
|
590
|
+
apiBase: "https://pulsarix.example.com",
|
|
591
|
+
});
|
|
536
592
|
widget.setLauncherVisible(false); // on the checkout step
|
|
537
593
|
widget.setLauncherVisible(true);
|
|
538
594
|
```
|
|
@@ -541,6 +597,8 @@ An open dialog is never hidden or closed by it, and `open()` still works while t
|
|
|
541
597
|
With the script tag: `window.PulsarixWidget.setLauncherVisible(false)`. `launcher: false` still
|
|
542
598
|
removes the launcher for good.
|
|
543
599
|
|
|
600
|
+
The launcher also hides by itself while the host page shows a modal (an element with `aria-modal="true"` or a modal `<dialog>` (`dialog:modal`)), and returns when it closes, so at 360 px it never covers a modal's edge. It does not see modals inside another shadow root. Nothing to call.
|
|
601
|
+
|
|
544
602
|
### Sticky bottom bars: `holdLauncher()`
|
|
545
603
|
|
|
546
604
|
A host's own sticky bottom bar (a checkout bar, a cookie banner, an editor toolbar) can sit under the
|
|
@@ -564,3 +622,58 @@ function StickyCheckoutBar() {
|
|
|
564
622
|
With the npm route, `const release = widget.holdLauncher()`. It combines with `setLauncherVisible`: the
|
|
565
623
|
launcher shows only when `setLauncherVisible` is not `false` and no hold is open. Like it, a hold never
|
|
566
624
|
closes or hides an open dialog, and `launcher: false` still removes the launcher for good.
|
|
625
|
+
|
|
626
|
+
## 12. Language
|
|
627
|
+
|
|
628
|
+
The widget speaks English (`en`, the default) and French (`fr`). It does not read the page's `lang`
|
|
629
|
+
attribute or the browser's language: pass the language your app uses, and keep it in step when
|
|
630
|
+
the user changes it.
|
|
631
|
+
|
|
632
|
+
```ts
|
|
633
|
+
const widget = mount({
|
|
634
|
+
projectKey: "pk_live_xxx",
|
|
635
|
+
apiBase: "https://pulsarix.example.com",
|
|
636
|
+
locale: "fr",
|
|
637
|
+
});
|
|
638
|
+
|
|
639
|
+
// your app's language switch
|
|
640
|
+
widget.setLocale("en");
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
With the script tag, `data-locale="fr"` (or `init({ locale })`), then `PulsarixWidget.setLocale("en")`.
|
|
644
|
+
Never remount to change language: `setLocale` keeps the open dialog and its draft (section 10 lists
|
|
645
|
+
what an idle form keeps). Any other value is ignored and the current language stays. The team's own
|
|
646
|
+
replies are shown as written, in whichever language the team used.
|
|
647
|
+
|
|
648
|
+
In a React Router host, drive it from the language your loader already returns:
|
|
649
|
+
|
|
650
|
+
```tsx
|
|
651
|
+
useEffect(() => {
|
|
652
|
+
window.PulsarixWidget?.setLocale(locale); // "en" | "fr"
|
|
653
|
+
}, [locale]);
|
|
654
|
+
```
|
|
655
|
+
|
|
656
|
+
Calls made before the bundle has loaded are queued, so the effect can run on first render.
|
|
657
|
+
|
|
658
|
+
## 13. Host accent
|
|
659
|
+
|
|
660
|
+
By default the widget wears the host's `@softistx/material` theme (section 9) and falls back to its own
|
|
661
|
+
`lavande` theme. When the host is not on material, or should show one brand colour, give a hex seed:
|
|
662
|
+
|
|
663
|
+
```ts
|
|
664
|
+
mount({
|
|
665
|
+
projectKey: "pk_live_xxx",
|
|
666
|
+
apiBase: "https://pulsarix.example.com",
|
|
667
|
+
accentColor: "#0b6bcb",
|
|
668
|
+
});
|
|
669
|
+
```
|
|
670
|
+
|
|
671
|
+
```html
|
|
672
|
+
<script ... data-accent-color="#0b6bcb"></script>
|
|
673
|
+
```
|
|
674
|
+
|
|
675
|
+
Only `#rgb` and `#rrggbb` are accepted; anything else is ignored and the default theme applies. The
|
|
676
|
+
widget builds its whole palette (light and dark) from the seed, and the seed wins over the host's
|
|
677
|
+
inherited primary (section 9). The handle has no accent setter; to change it at run time write the attribute on the element
|
|
678
|
+
(`widget.element.setAttribute("accent-color", "#7a2bd1")`), which re-renders without a remount. Passing `theme` does not turn host inheritance off; only
|
|
679
|
+
`inheritTheme: false` does (section 9).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@softistx/pulsarix-widget",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Embeddable client-issue intake widget for pulsarix, rendered in a Shadow DOM",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,19 +13,19 @@
|
|
|
13
13
|
"access": "restricted"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@biomejs/biome": "2.6.
|
|
16
|
+
"@biomejs/biome": "2.6.9",
|
|
17
17
|
"@graphql-codegen/cli": "^8.0.0",
|
|
18
18
|
"@graphql-codegen/typescript": "^7.0.1",
|
|
19
|
-
"@graphql-codegen/typescript-operations": "^7.0.
|
|
19
|
+
"@graphql-codegen/typescript-operations": "^7.0.3",
|
|
20
20
|
"@happy-dom/global-registrator": "^21.0.4",
|
|
21
|
-
"@softistx/material": "^3.
|
|
22
|
-
"@softistx/material-core": "^0.
|
|
21
|
+
"@softistx/material": "^3.329.1",
|
|
22
|
+
"@softistx/material-core": "^0.103.2",
|
|
23
23
|
"@tailwindcss/cli": "^4.3.3",
|
|
24
24
|
"@testing-library/dom": "^10.4.2",
|
|
25
25
|
"@testing-library/react": "^16.3.3",
|
|
26
26
|
"@testing-library/user-event": "^14.6.13",
|
|
27
27
|
"@types/bun": "^1.4.5",
|
|
28
|
-
"@types/react": "^19.3.
|
|
28
|
+
"@types/react": "^19.3.3",
|
|
29
29
|
"@types/react-dom": "^19.3.0",
|
|
30
30
|
"graphql": "^17.1.0",
|
|
31
31
|
"playwright-core": "^1.65.1",
|
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
},
|
|
74
74
|
"files": [
|
|
75
75
|
"dist/index.js",
|
|
76
|
+
"dist/chunks/*.js",
|
|
76
77
|
"dist/types/index.d.ts",
|
|
77
78
|
"dist/types/config.d.ts",
|
|
78
79
|
"dist/types/element.d.ts",
|