@streamoji/aitwin 0.5.3 → 0.5.4

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
@@ -16,6 +16,8 @@ npm install react react-dom
16
16
 
17
17
  ## Usage
18
18
 
19
+ ### React — face only (`AiTwin`)
20
+
19
21
  ```tsx
20
22
  import { useRef } from "react";
21
23
  import { AiTwin, type AiTwinHandle } from "@streamoji/aitwin";
@@ -44,6 +46,45 @@ function Demo() {
44
46
  }
45
47
  ```
46
48
 
49
+ ### React — widget chrome (`AiTwinWidget`)
50
+
51
+ Same Talk / Text / mute / float UI as the HTML script tag:
52
+
53
+ ```tsx
54
+ import { useRef } from "react";
55
+ import { AiTwinWidget, type AiTwinWidgetHandle } from "@streamoji/aitwin";
56
+
57
+ function WidgetDemo() {
58
+ const ref = useRef<AiTwinWidgetHandle>(null);
59
+
60
+ return (
61
+ <AiTwinWidget
62
+ ref={ref}
63
+ id="zoe"
64
+ authToken={optionalBearerToken}
65
+ showControls
66
+ float
67
+ onReady={() => console.log("ready")}
68
+ />
69
+ );
70
+ }
71
+ ```
72
+
73
+ ### HTML — script tag
74
+
75
+ ```html
76
+ <div id="aitwin"></div>
77
+ <script src="https://…/aitwin-widget.umd.js"></script>
78
+ <script>
79
+ AiTwinWidget.init("#aitwin", {
80
+ id: "zoe",
81
+ authToken: "client_…",
82
+ showControls: true,
83
+ float: true,
84
+ });
85
+ </script>
86
+ ```
87
+
47
88
  ### Props
48
89
 
49
90
  Provide **`id`** (cloud twin), **`avatarId`/`faceId`** (R2 custom face), or **`assets`** (fixed URLs). One is required.