altio-chat 1.0.21 → 1.0.23

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.
Files changed (4) hide show
  1. package/README.md +58 -58
  2. package/dist/widget.js +229 -229
  3. package/index.d.ts +41 -41
  4. package/package.json +65 -66
package/README.md CHANGED
@@ -1,58 +1,58 @@
1
- # altio-chat
2
-
3
- Embeddable Altio chat widget — a single, self-contained JavaScript bundle that renders
4
- the Altio chat UI inside a **Shadow DOM** (fully isolated from the host page's CSS/JS).
5
-
6
- Loaded with one `<script>` from a CDN. Updating the widget = publish a new version;
7
- **embedding apps are never rebuilt**.
8
-
9
- ## Embed (auto-mount)
10
-
11
- ```html
12
- <div id="altio-chat" style="width:100%;height:600px"></div>
13
- <script
14
- src="https://cdn.jsdelivr.net/npm/altio-chat@1/dist/widget.js"
15
- data-auto-init
16
- data-target="#altio-chat"
17
- data-api-url="https://api.altio.co.kr/v1"
18
- data-agent-api-url="https://v2.api.altio.co.kr/v1"
19
- ></script>
20
- ```
21
-
22
- Omit `data-target` to fill the whole viewport (like a full-page chat).
23
-
24
- ## Embed (manual mount)
25
-
26
- ```html
27
- <div id="altio-chat" style="width:100%;height:600px"></div>
28
- <script src="https://cdn.jsdelivr.net/npm/altio-chat@1/dist/widget.js"></script>
29
- <script>
30
- const handle = AltioWidget.mount(document.getElementById("altio-chat"), {
31
- apiUrl: "https://api.altio.co.kr/v1",
32
- agentApiUrl: "https://v2.api.altio.co.kr/v1",
33
- dbEnv: "…", // external-DB slot selector (optional)
34
- uid: "user-123", // namespaces the saved conversation per user (optional)
35
- getToken: () => host.getAccessToken(), // signed-in user's token; may be async (optional)
36
- });
37
- // handle.destroy() to unmount
38
- </script>
39
- ```
40
-
41
- ## Runtime config
42
-
43
- | Key | Purpose |
44
- |---|---|
45
- | `apiUrl` | Main backend base (POST /threads). |
46
- | `agentApiUrl` | Agent backend base (connect/ask); falls back to `apiUrl`. |
47
- | `dbEnv` | External-DB slot selector sent as `env`. |
48
- | `uid` | Host user id — keys the persisted conversation per user. |
49
- | `getToken` | Returns the host user's access token (sync or async) so the backend scopes DB reads to that user. Omit for anonymous/guest. |
50
-
51
- `AltioWidget.setConfig({...})` updates config later (e.g. after the user signs in).
52
-
53
- ## Versioning
54
-
55
- - `@1` → latest 1.x (recommended). `@0.1.2` → exact pin.
56
- - Force a fresh CDN copy: `https://purge.jsdelivr.net/npm/altio-chat@1/dist/widget.js`
57
-
58
- See [PUBLISHING.md](./PUBLISHING.md) for release steps.
1
+ # altio-chat
2
+
3
+ Embeddable Altio chat widget — a single, self-contained JavaScript bundle that renders
4
+ the Altio chat UI inside a **Shadow DOM** (fully isolated from the host page's CSS/JS).
5
+
6
+ Loaded with one `<script>` from a CDN. Updating the widget = publish a new version;
7
+ **embedding apps are never rebuilt**.
8
+
9
+ ## Embed (auto-mount)
10
+
11
+ ```html
12
+ <div id="altio-chat" style="width:100%;height:600px"></div>
13
+ <script
14
+ src="https://cdn.jsdelivr.net/npm/altio-chat@1/dist/widget.js"
15
+ data-auto-init
16
+ data-target="#altio-chat"
17
+ data-api-url="https://api.altio.co.kr/v1"
18
+ data-agent-api-url="https://v2.api.altio.co.kr/v1"
19
+ ></script>
20
+ ```
21
+
22
+ Omit `data-target` to fill the whole viewport (like a full-page chat).
23
+
24
+ ## Embed (manual mount)
25
+
26
+ ```html
27
+ <div id="altio-chat" style="width:100%;height:600px"></div>
28
+ <script src="https://cdn.jsdelivr.net/npm/altio-chat@1/dist/widget.js"></script>
29
+ <script>
30
+ const handle = AltioWidget.mount(document.getElementById("altio-chat"), {
31
+ apiUrl: "https://api.altio.co.kr/v1",
32
+ agentApiUrl: "https://v2.api.altio.co.kr/v1",
33
+ dbEnv: "…", // external-DB slot selector (optional)
34
+ uid: "user-123", // namespaces the saved conversation per user (optional)
35
+ getToken: () => host.getAccessToken(), // signed-in user's token; may be async (optional)
36
+ });
37
+ // handle.destroy() to unmount
38
+ </script>
39
+ ```
40
+
41
+ ## Runtime config
42
+
43
+ | Key | Purpose |
44
+ |---|---|
45
+ | `apiUrl` | Main backend base (POST /threads). |
46
+ | `agentApiUrl` | Agent backend base (connect/ask); falls back to `apiUrl`. |
47
+ | `dbEnv` | External-DB slot selector sent as `env`. |
48
+ | `uid` | Host user id — keys the persisted conversation per user. |
49
+ | `getToken` | Returns the host user's access token (sync or async) so the backend scopes DB reads to that user. Omit for anonymous/guest. |
50
+
51
+ `AltioWidget.setConfig({...})` updates config later (e.g. after the user signs in).
52
+
53
+ ## Versioning
54
+
55
+ - `@1` → latest 1.x (recommended). `@0.1.2` → exact pin.
56
+ - Force a fresh CDN copy: `https://purge.jsdelivr.net/npm/altio-chat@1/dist/widget.js`
57
+
58
+ See [PUBLISHING.md](./PUBLISHING.md) for release steps.