hanc-webrtc-widgets 2.8.5 → 2.8.6

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/README.md CHANGED
@@ -8,10 +8,12 @@ You can use it in **plain HTML**, or integrate it with **React**, **Next.js**, *
8
8
 
9
9
  ## ✨ Features
10
10
 
11
- - 🎨 **Four Widget Types**: Inline, Floating, Pill, and Pill Floating layouts
11
+ - 🎨 **Five Widget Types**: Inline, Floating, Pill, Pill Floating, and Callback (call-me-back)
12
12
  - 🌈 **Audio-Reactive 3D Orb**: WebGL-powered visualization responding to voice
13
13
  - 🎭 **Color Presets**: Dark and light theme color palettes
14
+ - 🌍 **14 UI Languages**: Callback widget UI localised across en/de/fr/es/it/pt/pl/cs/hu/tr/kk/zh/ru/uk
14
15
  - 🔧 **Highly Customizable**: Full control over colors, glow, animations, and behavior
16
+ - 🛡 **Terms & Privacy**: Optional consent modal before the call starts
15
17
  - 🚀 **Zero Dependencies**: Works standalone or with any framework
16
18
  - 📦 **Tiny Bundle**: Optimized for performance
17
19
  - ♿ **Accessible**: Built with Web Components standards
@@ -59,6 +61,12 @@ You can use it in **plain HTML**, or integrate it with **React**, **Next.js**, *
59
61
  position="bottom-right"
60
62
  button-start-text="Talk to AI"
61
63
  ></hanc-ai-pill-floating-call>
64
+
65
+ <!-- Callback Widget (visitor leaves number → AI calls them back) -->
66
+ <hanc-ai-callback
67
+ agent-id="YOUR_AGENT_ID"
68
+ theme="emerald"
69
+ ></hanc-ai-callback>
62
70
  </body>
63
71
  </html>
64
72
  ```
@@ -332,6 +340,16 @@ const handleCallEnd = () => {
332
340
 
333
341
  ## Components
334
342
 
343
+ The library ships five custom elements:
344
+
345
+ - [`<hanc-ai-inline-call>`](#hanc-ai-inline-call) — large inline widget with the audio-reactive orb
346
+ - [`<hanc-ai-floating-call>`](#hanc-ai-floating-call) — same widget, fixed-positioned in a viewport corner
347
+ - [`<hanc-ai-pill-call>`](#hanc-ai-pill-call) — horizontal pill button with a small orb
348
+ - [`<hanc-ai-pill-floating-call>`](#hanc-ai-pill-floating-call) — pill button fixed in a corner
349
+ - [`<hanc-ai-callback>`](#hanc-ai-callback) — call-me-back form (no WebRTC; visitor leaves a number, agent calls them)
350
+
351
+ The first four open a WebRTC call session in the visitor's browser. The fifth is a one-way "leave your number" form — the platform's outbound dispatcher calls the visitor from the agent's phone number.
352
+
335
353
  ### `<hanc-ai-inline-call>`
336
354
 
337
355
  An inline widget that embeds directly in your page content. Features a large, prominent orb visualization with button overlay.
@@ -354,7 +372,9 @@ The essentials to get started:
354
372
  | Attribute | Type | Default | Description |
355
373
  |-----------|------|---------|-------------|
356
374
  | `agent-id` **(required)** | string | - | Hanc AI agent ID |
357
- | `voice-service-url` | string | - | Optional custom voice service URL |
375
+ | `api-base-url` | string | auto-detect | Override the manifest API host (auto: `api.hanc.me` for `*.hanc.me`/localhost, `api.hanc.ai` otherwise) |
376
+ | `voice-service-url` | string | - | Optional custom LiveKit voice service URL |
377
+ | `skip-fetch` | boolean | `false` | Skip the manifest fetch and rely on the `manifestOverride` JS property — used by the dashboard preview |
358
378
  | `button-start-text` | string | `"Start Call"` | Button text in idle state |
359
379
  | `button-connecting-text` | string | `"Connecting..."` | Button text when connecting |
360
380
  | `size` | number | `370` | Container size in pixels (responsive on small screens) |
@@ -373,6 +393,21 @@ The essentials to get started:
373
393
  | `audio-smoothing` | number | `0.9` | Audio smoothing (0.1 = slow, 1.0 = instant) |
374
394
  | `idle-morph-multiplier` | number | `0.25` | Morph strength in idle state |
375
395
  | `color-contrast` | number | `1.5` | Color pattern sharpness |
396
+ | `terms-enabled` | boolean | `false` | Show terms & privacy consent modal before the call starts |
397
+ | `terms-content` | string | - | Markdown content shown in the terms modal (when enabled) |
398
+ | `terms-url` | string | - | Link to full terms; rendered inside the modal |
399
+ | `privacy-url` | string | - | Link to the privacy policy; rendered inside the modal |
400
+ | `sound-enabled` | boolean | `false` | Play call-start / call-end sound effects |
401
+ | `sound-volume` | number | `0.5` | Sound effect volume (0-1) |
402
+ | `sound-preset` | string | `"default"` | Sound preset name |
403
+
404
+ #### JS-only Properties
405
+
406
+ Properties that can only be set from JavaScript (no HTML attribute equivalent):
407
+
408
+ | Property | Type | Description |
409
+ |----------|------|-------------|
410
+ | `manifestOverride` | object | Provides a synthetic manifest in place of the network fetch. Pair with `skip-fetch="true"`. Used by the dashboard preview iframe; not typically needed in production embeds |
376
411
 
377
412
  #### Events
378
413
 
@@ -576,6 +611,50 @@ Same attributes as `<hanc-ai-pill-call>`, plus:
576
611
 
577
612
  ---
578
613
 
614
+ ### `<hanc-ai-callback>`
615
+
616
+ A "call-me-back" widget. Visitors leave a phone number; the platform queues the request and the AI agent calls them within a few minutes. Unlike the other widgets, this one doesn't open a WebRTC session in the browser — it's a one-way ticket from the visitor's number to the agent's outbound line.
617
+
618
+ #### Quick Start Attributes
619
+
620
+ | Attribute | Type | Default | Description |
621
+ |-----------|------|---------|-------------|
622
+ | `agent-id` **(required)** | string | - | Your Hanc AI agent ID |
623
+ | `theme` | string | `"default"` | Color theme — same palette as the call widgets |
624
+ | `locale` | string | (from manifest) | UI language: `en`, `de`, `fr`, `es`, `it`, `pt`, `pl`, `cs`, `hu`, `tr`, `kk`, `zh`, `ru`, `uk` |
625
+
626
+ #### All Attributes
627
+
628
+ | Attribute | Type | Default | Description |
629
+ |-----------|------|---------|-------------|
630
+ | `agent-id` **(required)** | string | - | Hanc AI agent ID |
631
+ | `api-base-url` | string | auto-detect | Override the API host (auto: `api.hanc.me` for `*.hanc.me`/localhost, `api.hanc.ai` otherwise) |
632
+ | `theme` | string | `"default"` | Theme name — see Themes section |
633
+ | `locale` | string | (manifest's `widget_locale`) | Per-instance UI language override. When set, wins over the agent's dashboard setting — useful for multi-language host sites that control language per page. Falls back to English if the value isn't one of the 14 bundled locales |
634
+ | `skip-fetch` | boolean | `false` | Skip the manifest fetch and use the `manifestOverride` property instead (dashboard preview use case) |
635
+
636
+ #### Language behaviour
637
+
638
+ The widget UI (button labels, status screens, error messages) is localised across 14 languages. Resolution order:
639
+
640
+ 1. The `locale` attribute on the element (per-page override)
641
+ 2. The agent's `widget_settings.locale` saved in the dashboard, served on the manifest as `widget_locale`
642
+ 3. English fallback
643
+
644
+ The widget bundles all 14 dictionaries inline (~11 kB gzipped extra) so language switches are instant — no extra network roundtrip.
645
+
646
+ #### Example
647
+
648
+ ```html
649
+ <!-- Default: language follows agent.widget_settings.locale from the dashboard -->
650
+ <hanc-ai-callback agent-id="YOUR_AGENT_ID" theme="emerald"></hanc-ai-callback>
651
+
652
+ <!-- Per-page override: force German regardless of dashboard setting -->
653
+ <hanc-ai-callback agent-id="YOUR_AGENT_ID" locale="de"></hanc-ai-callback>
654
+ ```
655
+
656
+ ---
657
+
579
658
  ## Color Presets
580
659
 
581
660
  The library includes professional color presets optimized for dark and light backgrounds.