@chatsystem/client 1.2.3 → 1.2.5
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 +41 -3
- package/dist/index.cjs +199 -79
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +56 -0
- package/dist/index.mjs +5289 -4997
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -69,6 +69,18 @@ The value is scoped to that widget instance. Credentials, query strings,
|
|
|
69
69
|
fragments, and non-local plain HTTP origins are rejected. Localhost HTTP remains
|
|
70
70
|
available for development.
|
|
71
71
|
|
|
72
|
+
### First-party server-boundary adapter
|
|
73
|
+
|
|
74
|
+
`runtimeAdapter` is an advanced integration boundary for ChatSystem-owned
|
|
75
|
+
embedded surfaces such as the shareable acquisition demo. It may replace only
|
|
76
|
+
settings loading and text-prompt transport when that surface has its own
|
|
77
|
+
admission or quota endpoint. The `App` remains the authority for settings
|
|
78
|
+
hydration, messages, streaming, Markdown, suggestions, loading and scroll.
|
|
79
|
+
|
|
80
|
+
Normal customer installations must omit this property and continue through the
|
|
81
|
+
standard public installation endpoints. New presentation behavior belongs in
|
|
82
|
+
the client itself; it must never be reimplemented in a host-specific adapter.
|
|
83
|
+
|
|
72
84
|
## Bundled JavaScript
|
|
73
85
|
|
|
74
86
|
```html
|
|
@@ -82,6 +94,32 @@ available for development.
|
|
|
82
94
|
`data-displayMode` is optional and defaults to `launcher`. Set
|
|
83
95
|
`data-displayMode="chatbox"` when embedding the chat directly in the page.
|
|
84
96
|
|
|
85
|
-
The
|
|
86
|
-
|
|
87
|
-
|
|
97
|
+
The declarative form remains the simplest anonymous integration. For Identity
|
|
98
|
+
Delegation, load the same bundle without `data-appToken`, then use its
|
|
99
|
+
programmatic browser API so the provider functions remain JavaScript values:
|
|
100
|
+
|
|
101
|
+
```html
|
|
102
|
+
<script src="https://chatsystem.s3.eu-west-3.amazonaws.com/index.js"></script>
|
|
103
|
+
<script>
|
|
104
|
+
window.ChatSystem.mount({
|
|
105
|
+
appToken: "YOUR_TOKEN_ID",
|
|
106
|
+
displayMode: "launcher",
|
|
107
|
+
identityProvider: {
|
|
108
|
+
async getToken(request) {
|
|
109
|
+
const response = await fetch("/api/chatsystem/identity", {
|
|
110
|
+
credentials: "include",
|
|
111
|
+
cache: "no-store",
|
|
112
|
+
});
|
|
113
|
+
if (!response.ok) return null;
|
|
114
|
+
return (await response.json()).token ?? null;
|
|
115
|
+
},
|
|
116
|
+
subscribe(onIdentityChanged) {
|
|
117
|
+
return customerAuth.onAuthStateChanged(onIdentityChanged);
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
});
|
|
121
|
+
</script>
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
This passes the provider to the same internal `App` and identity session used
|
|
125
|
+
by the npm package. Do not place callbacks or secrets in `data-*` attributes.
|