@callembed/sdk 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 +66 -2
- package/dist/callembed.iife.js +129 -0
- package/dist/core/agent.d.ts +10 -0
- package/dist/core/agent.js +19 -0
- package/dist/core/api.d.ts +44 -0
- package/dist/core/api.js +169 -0
- package/dist/core/audio.d.ts +20 -0
- package/dist/core/audio.js +68 -0
- package/dist/core/call.d.ts +45 -0
- package/dist/core/call.js +252 -0
- package/dist/core/client.d.ts +53 -0
- package/dist/core/client.js +157 -0
- package/dist/core/errors.d.ts +22 -0
- package/dist/core/errors.js +41 -0
- package/dist/core/events.d.ts +20 -0
- package/dist/core/events.js +43 -0
- package/dist/core/metadata.d.ts +13 -0
- package/dist/core/metadata.js +38 -0
- package/dist/core/ring-watch.d.ts +20 -0
- package/dist/core/ring-watch.js +46 -0
- package/dist/core/room-events.d.ts +13 -0
- package/dist/core/room-events.js +29 -0
- package/dist/core/state-machine.d.ts +11 -0
- package/dist/core/state-machine.js +44 -0
- package/dist/core/teardown.d.ts +49 -0
- package/dist/core/teardown.js +107 -0
- package/dist/core/types.d.ts +175 -0
- package/dist/core/types.js +5 -0
- package/dist/iife.d.ts +23 -0
- package/dist/iife.js +27 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +10 -0
- package/dist/ui/bind.d.ts +14 -0
- package/dist/ui/bind.js +82 -0
- package/dist/ui/button.d.ts +28 -0
- package/dist/ui/button.js +57 -0
- package/dist/ui/copy-en.d.ts +3 -0
- package/dist/ui/copy-en.js +25 -0
- package/dist/ui/copy-zh-tw.d.ts +28 -0
- package/dist/ui/copy-zh-tw.js +25 -0
- package/dist/ui/copy.d.ts +18 -0
- package/dist/ui/copy.js +45 -0
- package/dist/ui/index.d.ts +12 -0
- package/dist/ui/index.js +12 -0
- package/dist/ui/panel.d.ts +26 -0
- package/dist/ui/panel.js +62 -0
- package/dist/ui/theme.d.ts +13 -0
- package/dist/ui/theme.js +124 -0
- package/package.json +68 -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,67 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@callembed/sdk`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Embeddable web SDK for [CallEmbed](https://callembed.sealby.me) — headless voice calls plus an optional themable UI.
|
|
4
|
+
|
|
5
|
+
**Requires Node.js ≥ 20.** Published as ESM (`import` / bundlers). No dual CJS build. From CommonJS, use dynamic `import()`, or `require()` on **Node ≥ 20.19 / ≥ 22.12** (synchronous ESM require). CDN: jsDelivr / unpkg → `dist/callembed.iife.js`.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @callembed/sdk
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick start
|
|
14
|
+
|
|
15
|
+
Matches the [site quickstart](https://callembed.sealby.me/#quickstart) (init + default button):
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { CallEmbed } from "@callembed/sdk";
|
|
19
|
+
import { mountButton } from "@callembed/sdk/ui";
|
|
20
|
+
|
|
21
|
+
CallEmbed.init({
|
|
22
|
+
publishableKey: "pk_…",
|
|
23
|
+
// Placeholder — replace with your CallEmbed API origin (see dashboard / deploy docs).
|
|
24
|
+
// Not a real hostname. Same-origin / reverse-proxy setups may use "".
|
|
25
|
+
apiBaseUrl: "https://<your-api-host>",
|
|
26
|
+
});
|
|
27
|
+
mountButton("#talk", { queue: "onboarding" });
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Use a **publishable** key (`pk_…`) only. Set `apiBaseUrl` to your CallEmbed API origin (or `""` when the page is same-origin / proxied to the API).
|
|
31
|
+
|
|
32
|
+
### Headless (your own UI)
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import { CallEmbed } from "@callembed/sdk";
|
|
36
|
+
|
|
37
|
+
CallEmbed.init({
|
|
38
|
+
publishableKey: "pk_…",
|
|
39
|
+
apiBaseUrl: "https://<your-api-host>", // placeholder — your API origin
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const call = await CallEmbed.startCall({
|
|
43
|
+
queue: "onboarding",
|
|
44
|
+
hidePanel: true,
|
|
45
|
+
on: {
|
|
46
|
+
answered: ({ agentIdentity }) => console.log("agent", agentIdentity),
|
|
47
|
+
ended: () => {},
|
|
48
|
+
error: ({ code, message }) => console.error(code, message),
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
await call.setMuted(true);
|
|
53
|
+
await call.hangUp();
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Locale
|
|
57
|
+
|
|
58
|
+
When `CallEmbed.init({ locale })` omits `locale`:
|
|
59
|
+
|
|
60
|
+
- `navigator.language` starting with `zh` → `zh-TW`
|
|
61
|
+
- otherwise → `en`
|
|
62
|
+
|
|
63
|
+
Pass `locale: "en"` or `locale: "zh-TW"` to override.
|
|
64
|
+
|
|
65
|
+
## License
|
|
66
|
+
|
|
67
|
+
MIT
|