altio-chat 1.0.15 → 1.0.16

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 (3) hide show
  1. package/README.md +58 -58
  2. package/index.d.ts +41 -41
  3. package/package.json +65 -65
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.
package/index.d.ts CHANGED
@@ -1,41 +1,41 @@
1
- /**
2
- * Type declarations for the `altio-chat` widget bundle.
3
- *
4
- * The runtime is a single IIFE (dist/widget.js) that registers `window.AltioWidget`
5
- * as a side effect on import. Consumers typically do:
6
- * await import("altio-chat"); // runs the IIFE → window.AltioWidget is set
7
- * window.AltioWidget.mount(el, cfg);
8
- */
9
-
10
- export type TokenProvider = () =>
11
- | string
12
- | null
13
- | undefined
14
- | Promise<string | null | undefined>;
15
-
16
- export interface AltioWidgetConfig {
17
- /** Main backend base URL (POST /threads). */
18
- apiUrl?: string;
19
- /** Agent/widget backend base URL (connect/ask). Falls back to apiUrl. */
20
- agentApiUrl?: string;
21
- /** External-DB slot selector sent as `env`. */
22
- dbEnv?: string;
23
- /** Host user id — namespaces the persisted conversation per signed-in user. */
24
- uid?: string;
25
- /** Returns the host user's current access token (may be async). */
26
- getToken?: TokenProvider;
27
- }
28
-
29
- export interface AltioWidgetApi {
30
- /** Render the chat into `el` (fills it). Returns a handle with destroy(). */
31
- mount(el: HTMLElement, cfg?: AltioWidgetConfig): { destroy(): void };
32
- /** Update runtime config later (e.g. after the host user signs in). */
33
- setConfig(cfg: AltioWidgetConfig): void;
34
- }
35
-
36
- // NOTE: the bundle also assigns `window.AltioWidget` at import time. We intentionally
37
- // do NOT augment the global `Window` here so consumers can keep their own declaration
38
- // without a duplicate-property conflict.
39
-
40
- declare const AltioWidget: AltioWidgetApi;
41
- export default AltioWidget;
1
+ /**
2
+ * Type declarations for the `altio-chat` widget bundle.
3
+ *
4
+ * The runtime is a single IIFE (dist/widget.js) that registers `window.AltioWidget`
5
+ * as a side effect on import. Consumers typically do:
6
+ * await import("altio-chat"); // runs the IIFE → window.AltioWidget is set
7
+ * window.AltioWidget.mount(el, cfg);
8
+ */
9
+
10
+ export type TokenProvider = () =>
11
+ | string
12
+ | null
13
+ | undefined
14
+ | Promise<string | null | undefined>;
15
+
16
+ export interface AltioWidgetConfig {
17
+ /** Main backend base URL (POST /threads). */
18
+ apiUrl?: string;
19
+ /** Agent/widget backend base URL (connect/ask). Falls back to apiUrl. */
20
+ agentApiUrl?: string;
21
+ /** External-DB slot selector sent as `env`. */
22
+ dbEnv?: string;
23
+ /** Host user id — namespaces the persisted conversation per signed-in user. */
24
+ uid?: string;
25
+ /** Returns the host user's current access token (may be async). */
26
+ getToken?: TokenProvider;
27
+ }
28
+
29
+ export interface AltioWidgetApi {
30
+ /** Render the chat into `el` (fills it). Returns a handle with destroy(). */
31
+ mount(el: HTMLElement, cfg?: AltioWidgetConfig): { destroy(): void };
32
+ /** Update runtime config later (e.g. after the host user signs in). */
33
+ setConfig(cfg: AltioWidgetConfig): void;
34
+ }
35
+
36
+ // NOTE: the bundle also assigns `window.AltioWidget` at import time. We intentionally
37
+ // do NOT augment the global `Window` here so consumers can keep their own declaration
38
+ // without a duplicate-property conflict.
39
+
40
+ declare const AltioWidget: AltioWidgetApi;
41
+ export default AltioWidget;
package/package.json CHANGED
@@ -1,65 +1,65 @@
1
- {
2
- "name": "altio-chat",
3
- "version": "1.0.15",
4
- "description": "Altio embeddable chat widget — single-file, Shadow-DOM isolated, loaded via <script> from a CDN.",
5
- "type": "module",
6
- "files": [
7
- "dist/widget.js",
8
- "index.d.ts"
9
- ],
10
- "main": "dist/widget.js",
11
- "types": "./index.d.ts",
12
- "unpkg": "dist/widget.js",
13
- "jsdelivr": "dist/widget.js",
14
- "exports": {
15
- ".": {
16
- "types": "./index.d.ts",
17
- "default": "./dist/widget.js"
18
- }
19
- },
20
- "publishConfig": {
21
- "access": "public"
22
- },
23
- "scripts": {
24
- "dev": "vite",
25
- "build": "tsc --noEmit && vite build",
26
- "build:only": "vite build",
27
- "typecheck": "tsc --noEmit",
28
- "preview": "vite preview",
29
- "prepublishOnly": "pnpm build"
30
- },
31
- "dependencies": {
32
- "@phosphor-icons/react": "^2.1.10",
33
- "@tanstack/react-query": "^5.90.2",
34
- "axios": "^1.12.2",
35
- "clsx": "^2.1.1",
36
- "katex": "^0.16.25",
37
- "react": "19.1.2",
38
- "react-cookie": "^8.0.1",
39
- "react-dom": "19.1.2",
40
- "react-markdown": "^10.1.0",
41
- "react-syntax-highlighter": "^16.1.0",
42
- "rehype-katex": "^7.0.1",
43
- "rehype-raw": "^7.0.0",
44
- "remark-gfm": "^4.0.1",
45
- "remark-math": "^6.0.0",
46
- "tailwind-merge": "^3.3.1",
47
- "zustand": "^5.0.8"
48
- },
49
- "devDependencies": {
50
- "@tailwindcss/postcss": "^4",
51
- "@types/react": "^19",
52
- "@types/react-dom": "^19",
53
- "@types/react-syntax-highlighter": "^15.5.13",
54
- "@vitejs/plugin-react": "^4.3.4",
55
- "postcss": "^8.5.6",
56
- "tailwindcss": "^4",
57
- "typescript": "^5",
58
- "vite": "^6.0.0"
59
- },
60
- "pnpm": {
61
- "onlyBuiltDependencies": [
62
- "esbuild"
63
- ]
64
- }
65
- }
1
+ {
2
+ "name": "altio-chat",
3
+ "version": "1.0.16",
4
+ "description": "Altio embeddable chat widget — single-file, Shadow-DOM isolated, loaded via <script> from a CDN.",
5
+ "type": "module",
6
+ "files": [
7
+ "dist/widget.js",
8
+ "index.d.ts"
9
+ ],
10
+ "main": "dist/widget.js",
11
+ "types": "./index.d.ts",
12
+ "unpkg": "dist/widget.js",
13
+ "jsdelivr": "dist/widget.js",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./index.d.ts",
17
+ "default": "./dist/widget.js"
18
+ }
19
+ },
20
+ "publishConfig": {
21
+ "access": "public"
22
+ },
23
+ "scripts": {
24
+ "dev": "vite",
25
+ "build": "tsc --noEmit && vite build",
26
+ "build:only": "vite build",
27
+ "typecheck": "tsc --noEmit",
28
+ "preview": "vite preview",
29
+ "prepublishOnly": "pnpm build"
30
+ },
31
+ "dependencies": {
32
+ "@phosphor-icons/react": "^2.1.10",
33
+ "@tanstack/react-query": "^5.90.2",
34
+ "axios": "^1.12.2",
35
+ "clsx": "^2.1.1",
36
+ "katex": "^0.16.25",
37
+ "react": "19.1.2",
38
+ "react-cookie": "^8.0.1",
39
+ "react-dom": "19.1.2",
40
+ "react-markdown": "^10.1.0",
41
+ "react-syntax-highlighter": "^16.1.0",
42
+ "rehype-katex": "^7.0.1",
43
+ "rehype-raw": "^7.0.0",
44
+ "remark-gfm": "^4.0.1",
45
+ "remark-math": "^6.0.0",
46
+ "tailwind-merge": "^3.3.1",
47
+ "zustand": "^5.0.8"
48
+ },
49
+ "devDependencies": {
50
+ "@tailwindcss/postcss": "^4",
51
+ "@types/react": "^19",
52
+ "@types/react-dom": "^19",
53
+ "@types/react-syntax-highlighter": "^15.5.13",
54
+ "@vitejs/plugin-react": "^4.3.4",
55
+ "postcss": "^8.5.6",
56
+ "tailwindcss": "^4",
57
+ "typescript": "^5",
58
+ "vite": "^6.0.0"
59
+ },
60
+ "pnpm": {
61
+ "onlyBuiltDependencies": [
62
+ "esbuild"
63
+ ]
64
+ }
65
+ }