@callembed/elements 0.0.0-stage → 0.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/LICENSE +21 -0
- package/README.md +84 -2
- package/dist/callembed-elements.iife.js +125 -0
- package/dist/index.cjs +549 -0
- package/dist/index.d.cts +56 -0
- package/dist/index.d.ts +56 -0
- package/dist/index.js +528 -0
- package/package.json +81 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sealby
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,85 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@callembed/elements`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Framework-agnostic [Web Component](https://developer.mozilla.org/en-US/docs/Web/API/Web_components) for [CallEmbed](https://callembed.sealby.me) — a **thin wrapper** over [`@callembed/sdk`](../sdk).
|
|
4
|
+
|
|
5
|
+
**Product model:** customer-service queue only. An end user on a web page clicks “talk to a human” → rings a project queue → an agent answers. This package does **not** implement person-to-person calling.
|
|
6
|
+
|
|
7
|
+
## Install (ESM)
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @callembed/elements @callembed/sdk livekit-client
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
```html
|
|
14
|
+
<script type="module">
|
|
15
|
+
import "@callembed/elements";
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<callembed-button
|
|
19
|
+
publishable-key="pk_…"
|
|
20
|
+
api-base-url=""
|
|
21
|
+
locale="en"
|
|
22
|
+
queue="onboarding"
|
|
23
|
+
></callembed-button>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## CDN (IIFE)
|
|
27
|
+
|
|
28
|
+
Single file — no bundler. Registers `<callembed-button>` and exposes `window.CallEmbedElements`.
|
|
29
|
+
|
|
30
|
+
```html
|
|
31
|
+
<script src="https://unpkg.com/@callembed/elements/dist/callembed-elements.iife.js"></script>
|
|
32
|
+
|
|
33
|
+
<callembed-button
|
|
34
|
+
publishable-key="pk_…"
|
|
35
|
+
api-base-url="https://api.example.com"
|
|
36
|
+
locale="zh-TW"
|
|
37
|
+
queue="onboarding"
|
|
38
|
+
></callembed-button>
|
|
39
|
+
|
|
40
|
+
<script>
|
|
41
|
+
const el = document.querySelector("callembed-button");
|
|
42
|
+
el.addEventListener("callembed:state", (e) => console.log(e.detail));
|
|
43
|
+
el.addEventListener("callembed:error", (e) => console.error(e.detail));
|
|
44
|
+
</script>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
> Before the first npm publish, load the built file from `packages/elements/dist/callembed-elements.iife.js` after `npm run build -w @callembed/elements`.
|
|
48
|
+
|
|
49
|
+
## Attributes
|
|
50
|
+
|
|
51
|
+
| Attribute | Notes |
|
|
52
|
+
|-----------|--------|
|
|
53
|
+
| `publishable-key` | Required (`pk_…`) |
|
|
54
|
+
| `api-base-url` | Required (`""` for same-origin) |
|
|
55
|
+
| `locale` | `en` \| `zh-TW` |
|
|
56
|
+
| `queue` | Project queue to ring |
|
|
57
|
+
| `label` | Optional idle label override |
|
|
58
|
+
| `show-status` / `show-mute` | `"false"` to hide |
|
|
59
|
+
| `branding` | `"false"` to hide brand line in SDK panel (headless by default) |
|
|
60
|
+
| `debug` | `"true"` for SDK debug |
|
|
61
|
+
|
|
62
|
+
## Events
|
|
63
|
+
|
|
64
|
+
| Event | `detail` |
|
|
65
|
+
|-------|----------|
|
|
66
|
+
| `callembed:state` | `{ uiState, status, callId, muted, error }` |
|
|
67
|
+
| `callembed:error` | `{ code, message }` |
|
|
68
|
+
|
|
69
|
+
`uiState`: `idle` \| `ringing` \| `connected` \| `ended` \| `error`.
|
|
70
|
+
|
|
71
|
+
Programmatic API on the element: `start()`, `end()`, `setMuted(boolean)`.
|
|
72
|
+
|
|
73
|
+
Disconnect or changing `publishable-key` / `api-base-url` hangs up any active/ringing call.
|
|
74
|
+
|
|
75
|
+
## SSR
|
|
76
|
+
|
|
77
|
+
Importing the package is safe under Node / Nuxt: `customElements.define` is guarded when `customElements` is undefined.
|
|
78
|
+
|
|
79
|
+
## Builds
|
|
80
|
+
|
|
81
|
+
ESM + CJS + `.d.ts`, plus `dist/callembed-elements.iife.js` for CDN.
|
|
82
|
+
|
|
83
|
+
## Publishing
|
|
84
|
+
|
|
85
|
+
Published via the multi-package tag workflow (see [`docs/RELEASING.md`](../../docs/RELEASING.md)). The npm tarball includes `dist/callembed-elements.iife.js` (CDN). Local allowlist check: `npm run pack:verify -w @callembed/elements`.
|