@accurix/centrinfo-widget 1.0.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/LICENSE.md ADDED
@@ -0,0 +1,8 @@
1
+ Proprietary License
2
+
3
+ Copyright (c) Accurix. All rights reserved.
4
+
5
+ This package is provided for installing and embedding the Centrinfo public chat
6
+ widget on authorized organization websites. You may not copy, modify,
7
+ redistribute, sublicense, or publish this package except as permitted by a
8
+ separate written agreement with Accurix.
package/README.md ADDED
@@ -0,0 +1,114 @@
1
+ # @accurix/centrinfo-widget
2
+
3
+ The embeddable **Centrinfo public chat widget** — a style-isolated chat client
4
+ that drops onto any website. The current standalone CDN bundle is about 35 KB
5
+ gzipped and can dock bottom-right or bottom-left.
6
+
7
+ Built with Preact inside a **Shadow DOM** web component, so it can't break the
8
+ host site's CSS and the host's CSS can't break it. It talks to the Centrinfo
9
+ public chat API (see [`.claude/PUBLIC_CHAT.md`](../../../../.claude/PUBLIC_CHAT.md)
10
+ for the backend, and [`.claude/PUBLIC_WIDGET_LIBRARY.md`](../../../../.claude/PUBLIC_WIDGET_LIBRARY.md)
11
+ for the design).
12
+
13
+ ## Install
14
+
15
+ ### Script tag (any site — WordPress / Webflow / plain HTML)
16
+
17
+ Zero-JS, via `data-*` on the script:
18
+
19
+ ```html
20
+ <script
21
+ src="https://cdn.accurix.com/centrinfo/js/sdk-centrinfo-widget-v1.0.0/centrinfo-widget.js"
22
+ data-token="pub_8f3k…"
23
+ defer
24
+ ></script>
25
+ ```
26
+
27
+ Or call `init` yourself:
28
+
29
+ ```html
30
+ <script
31
+ src="https://cdn.accurix.com/centrinfo/js/sdk-centrinfo-widget-v1.0.0/centrinfo-widget.js"
32
+ defer
33
+ ></script>
34
+ <script>
35
+ window.addEventListener('load', () => Centrinfo.init({ token: 'pub_8f3k…' }));
36
+ </script>
37
+ ```
38
+
39
+ ### npm (React / Next / any bundler)
40
+
41
+ ```bash
42
+ pnpm add @accurix/centrinfo-widget
43
+ ```
44
+
45
+ ```ts
46
+ import { init } from '@accurix/centrinfo-widget';
47
+ const widget = init({ token: 'pub_8f3k…' });
48
+ // widget.open() / .close() / .toggle() / .destroy()
49
+ ```
50
+
51
+ ## Config
52
+
53
+ | Option | Type | Default | Notes |
54
+ | ------------------------------------------------------------- | ----------------------------- | ----------- | ----------------------------------------------------------------------------------------------------------------------------------- |
55
+ | `token` **(required)** | string | — | The org's `pub_*` token. It _is_ the org identity. |
56
+ | `apiBaseUrl` | string | prod API | Override for staging / self-host. |
57
+ | `accentColor` | string | brand green | Any CSS color — drives the launcher, header, user bubbles & send button (a darker shade for the gradient is derived automatically). |
58
+ | `launcherIcon` | string | chat glyph | Image URL (e.g. the org's logo) shown in the launcher bubble. |
59
+ | `theme` | `'light' \| 'dark' \| 'auto'` | `'auto'` | `auto` follows the host's `prefers-color-scheme`; `light`/`dark` force it. |
60
+ | `openByDefault` | boolean | `false` | Open the panel on load. |
61
+ | `zIndex` | number | very high | Stacking against the host page. |
62
+ | `demo` | boolean | `false` | Use the built-in mock transport — **no backend/token needed**. |
63
+ | `onOpen` / `onClose` / `onMessage` / `onAction` / `onHandoff` | function | — | Event hooks. |
64
+
65
+ Persona (agent name/avatar/greeting), the voice toggle, and which lead-gen
66
+ actions appear all come from the token via `GET /public-chat/bootstrap` — not
67
+ from the snippet.
68
+
69
+ `data-*` attributes for the script install: `data-token`, `data-api-base`,
70
+ `data-accent`, `data-theme`, `data-open`, `data-demo`.
71
+
72
+ ## Environment
73
+
74
+ The default API origin is baked from `VITE_API_BASE_URL` (see `.env.example`).
75
+ Copy `.env.example` → `.env` (gitignored) to override locally; unset falls back
76
+ to production (`https://api.accurixtech.com`). Local default is the local API
77
+ (`http://api.accurixtech.com/`). A per-`init` `apiBaseUrl` always wins at runtime.
78
+ Restart the dev server after editing `.env`.
79
+
80
+ ## Develop
81
+
82
+ ```bash
83
+ pnpm --filter @accurix/centrinfo-widget dev # playground host site @ :3005 (demo mode)
84
+ pnpm --filter @accurix/centrinfo-widget build # → dist/index.{mjs,cjs,d.ts} + dist/cdn/*
85
+ pnpm --filter @accurix/centrinfo-widget check-types
86
+ pnpm --filter @accurix/centrinfo-widget test-unit
87
+ pnpm --filter @accurix/centrinfo-widget verify:release
88
+ ```
89
+
90
+ ## Release Artifacts
91
+
92
+ `build:npm` uses tsdown to emit the npm package entrypoints:
93
+
94
+ - `dist/index.mjs`
95
+ - `dist/index.cjs`
96
+ - `dist/index.d.ts`
97
+
98
+ `build:cdn` uses Vite to emit the browser script and then writes a manifest:
99
+
100
+ - `dist/cdn/centrinfo-widget.js`
101
+ - `dist/cdn/manifest.json`
102
+
103
+ Canonical v1 CDN URL:
104
+
105
+ ```text
106
+ https://cdn.accurix.com/centrinfo/js/sdk-centrinfo-widget-v1.0.0/centrinfo-widget.js
107
+ ```
108
+
109
+ ## Status
110
+
111
+ v1 in progress — chat, streaming (SSE), citations, suggested-reply chips,
112
+ session memory, handoff CTA, lead-gen actions, voice input, theming.
113
+ Backend `GET /public-chat/bootstrap` is pending (the only backend work);
114
+ the client falls back to sensible defaults until it lands.