@opencx/widget 5.0.0-beta.9 → 5.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 CHANGED
@@ -15,16 +15,26 @@ For all the available options, check [the documentation](https://docs.open.cx/wi
15
15
 
16
16
  ## Self-hosting
17
17
 
18
- Since v5 the embed is two files: `script.js` is a tiny classic loader that
19
- injects `widget.js` as an ES module from the same directory, and `widget.js`
20
- lazy-loads a few hashed chunks (the chart renderer, for one) from that
21
- directory too. If you copy the build onto your own CDN:
22
-
23
- - publish the WHOLE `dist-embed/` directory, not `script.js` alone;
24
- - serve it with `Access-Control-Allow-Origin` (module scripts are fetched in
25
- CORS mode);
26
- - keep the previous chunks around when you redeploy, or give `widget.js` a
27
- short cache TTL, so a cached `widget.js` never points at a chunk that no
28
- longer exists;
29
- - under a nonce-based CSP, the loader copies the nonce from its own `<script>`
30
- tag onto the injected module tag.
18
+ `dist-embed/script.js` is a self-contained classic script. Copy that single file
19
+ to your own server, as with v4. No sibling module or lazy chunks are required.
20
+ Apply your site's existing script CSP policy to the script tag.
21
+
22
+ Repeated script loads reuse the first loaded widget runtime and its React root.
23
+ Calling `initOpenScript` again updates its options. To switch widget versions,
24
+ reload the page.
25
+
26
+ ## Opt into v5 runtime features
27
+
28
+ An unchanged configuration keeps classic send/poll delivery. To enable streaming
29
+ and personal service connections, declare both explicitly:
30
+
31
+ ```js
32
+ initOpenScript({
33
+ token: 'YOUR_WIDGET_TOKEN',
34
+ streaming: true,
35
+ capabilities: { connections: true },
36
+ });
37
+ ```
38
+
39
+ Streaming also requires backend support. Companion layout is selected separately
40
+ with `displayMode: 'companion'`; changing layout alone does not change delivery.