ttp-agent-sdk 2.2.10 → 2.2.12

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.
@@ -21,14 +21,21 @@ Integrating the TTP Agent SDK into WordPress or Wix is straightforward! The SDK
21
21
 
22
22
  ```html
23
23
  <!-- Load TTP Agent SDK -->
24
- <script src="https://unpkg.com/ttp-agent-sdk@2.2.2/dist/agent-widget.js"></script>
24
+ <script src="https://cdn.talktopc.com/agent-widget.js"></script>
25
+ <!-- Alternative CDN: https://unpkg.com/ttp-agent-sdk@latest/dist/agent-widget.js -->
25
26
 
26
27
  <script>
27
28
  // Initialize the widget when page loads
28
29
  window.addEventListener('DOMContentLoaded', function() {
29
- new TTPAgentSDK.AgentWidget({
30
- agentId: 'your_agent_id',
31
- appId: 'your_app_id',
30
+ // For unified text + voice chat (recommended)
31
+ const widget = new TTPAgentSDK.TTPChatWidget({
32
+ agentId: 'agent_f676e962a',
33
+ appId: 'app_bQHDFqydfNPl75MZNijXc4dUyHGqnHeX9e5l',
34
+
35
+ // Widget mode: 'unified' (text + voice), 'text-only', or 'voice-only'
36
+ behavior: {
37
+ mode: 'unified'
38
+ },
32
39
 
33
40
  // Optional: Customize appearance
34
41
  primaryColor: '#10B981',
@@ -45,6 +52,11 @@ Integrating the TTP Agent SDK into WordPress or Wix is straightforward! The SDK
45
52
  header: {
46
53
  title: 'Support Assistant',
47
54
  backgroundColor: '#10B981'
55
+ },
56
+
57
+ // Optional: Pass page context
58
+ variables: {
59
+ page: window.location.pathname
48
60
  }
49
61
  });
50
62
  });
@@ -57,11 +69,12 @@ Integrating the TTP Agent SDK into WordPress or Wix is straightforward! The SDK
57
69
  2. **Add the code before `</body>` tag:**
58
70
 
59
71
  ```html
60
- <script src="https://unpkg.com/ttp-agent-sdk@2.2.2/dist/agent-widget.js"></script>
72
+ <script src="https://cdn.talktopc.com/agent-widget.js"></script>
61
73
  <script>
62
- new TTPAgentSDK.AgentWidget({
63
- agentId: 'your_agent_id',
64
- appId: 'your_app_id',
74
+ new TTPAgentSDK.TTPChatWidget({
75
+ agentId: 'agent_f676e962a',
76
+ appId: 'app_bQHDFqydfNPl75MZNijXc4dUyHGqnHeX9e5l',
77
+ behavior: { mode: 'unified' },
65
78
  header: { title: 'Get Help' }
66
79
  });
67
80
  </script>
@@ -83,11 +96,12 @@ Create a simple plugin to add the SDK site-wide:
83
96
 
84
97
  function ttp_voice_agent_script() {
85
98
  ?>
86
- <script src="https://unpkg.com/ttp-agent-sdk@2.2.2/dist/agent-widget.js"></script>
99
+ <script src="https://cdn.talktopc.com/agent-widget.js"></script>
87
100
  <script>
88
- new TTPAgentSDK.AgentWidget({
101
+ new TTPAgentSDK.TTPChatWidget({
89
102
  agentId: '<?php echo esc_js(get_option('ttp_agent_id', '')); ?>',
90
103
  appId: '<?php echo esc_js(get_option('ttp_app_id', '')); ?>',
104
+ behavior: { mode: 'unified' },
91
105
  header: { title: '<?php echo esc_js(get_option('ttp_header_title', 'Voice Assistant')); ?>' }
92
106
  });
93
107
  </script>
@@ -108,11 +122,12 @@ add_action('wp_footer', 'ttp_voice_agent_script');
108
122
  4. **Paste this code:**
109
123
 
110
124
  ```html
111
- <script src="https://unpkg.com/ttp-agent-sdk@2.2.2/dist/agent-widget.js"></script>
125
+ <script src="https://cdn.talktopc.com/agent-widget.js"></script>
112
126
  <script>
113
- new TTPAgentSDK.AgentWidget({
114
- agentId: 'your_agent_id',
115
- appId: 'your_app_id',
127
+ new TTPAgentSDK.TTPChatWidget({
128
+ agentId: 'agent_f676e962a',
129
+ appId: 'app_bQHDFqydfNPl75MZNijXc4dUyHGqnHeX9e5l',
130
+ behavior: { mode: 'unified' },
116
131
  position: 'bottom-right',
117
132
  header: { title: 'Support Chat' }
118
133
  });
@@ -126,12 +141,13 @@ add_action('wp_footer', 'ttp_voice_agent_script');
126
141
  3. **Paste the script tags:**
127
142
 
128
143
  ```html
129
- <script src="https://unpkg.com/ttp-agent-sdk@2.2.2/dist/agent-widget.js"></script>
144
+ <script src="https://cdn.talktopc.com/agent-widget.js"></script>
130
145
  <script>
131
146
  window.addEventListener('DOMContentLoaded', function() {
132
- new TTPAgentSDK.AgentWidget({
133
- agentId: 'your_agent_id',
134
- appId: 'your_app_id'
147
+ new TTPAgentSDK.TTPChatWidget({
148
+ agentId: 'agent_f676e962a',
149
+ appId: 'app_bQHDFqydfNPl75MZNijXc4dUyHGqnHeX9e5l',
150
+ behavior: { mode: 'unified' }
135
151
  });
136
152
  });
137
153
  </script>
@@ -150,11 +166,12 @@ For production, use **signed links** instead of exposing agent IDs. Here's how:
150
166
  ### WordPress / Wix with Signed Links
151
167
 
152
168
  ```html
153
- <script src="https://unpkg.com/ttp-agent-sdk@2.2.2/dist/agent-widget.js"></script>
169
+ <script src="https://cdn.talktopc.com/agent-widget.js"></script>
154
170
  <script>
155
- new TTPAgentSDK.AgentWidget({
156
- agentId: 'your_agent_id',
157
- appId: 'your_app_id',
171
+ new TTPAgentSDK.TTPChatWidget({
172
+ agentId: 'agent_f676e962a',
173
+ appId: 'app_bQHDFqydfNPl75MZNijXc4dUyHGqnHeX9e5l',
174
+ behavior: { mode: 'unified' },
158
175
 
159
176
  // Use your backend to generate signed URLs
160
177
  getSessionUrl: async ({ agentId, appId, variables }) => {
@@ -179,11 +196,12 @@ For production, use **signed links** instead of exposing agent IDs. Here's how:
179
196
  Here's a complete example with all customization options:
180
197
 
181
198
  ```html
182
- <script src="https://unpkg.com/ttp-agent-sdk@2.2.2/dist/agent-widget.js"></script>
199
+ <script src="https://cdn.talktopc.com/agent-widget.js"></script>
183
200
  <script>
184
- new TTPAgentSDK.AgentWidget({
185
- agentId: 'your_agent_id',
186
- appId: 'your_app_id',
201
+ new TTPAgentSDK.TTPChatWidget({
202
+ agentId: 'agent_f676e962a',
203
+ appId: 'app_bQHDFqydfNPl75MZNijXc4dUyHGqnHeX9e5l',
204
+ behavior: { mode: 'unified' },
187
205
 
188
206
  // Colors
189
207
  primaryColor: '#10B981',
@@ -248,6 +266,30 @@ Here's a complete example with all customization options:
248
266
  3. **Check agent/app IDs**: Make sure they're correct
249
267
  4. **Z-index issues**: The widget uses `z-index: 10000` - if your theme has higher z-index, you may need to adjust
250
268
 
269
+ ### "Unable to load a worklet's module" Error?
270
+
271
+ This error occurs when the AudioWorklet processor file can't be loaded. **The widget now auto-detects the correct path**, but if you still encounter this issue:
272
+
273
+ 1. **Make sure `audio-processor.js` is available** on the CDN:
274
+ - Check: `https://cdn.talktopc.com/audio-processor.js`
275
+ - If it doesn't load, contact support to ensure it's deployed
276
+
277
+ 2. **Explicitly set the audio processor path** in your config:
278
+ ```javascript
279
+ const widget = new TTPAgentSDK.TTPChatWidget({
280
+ agentId: 'agent_f676e962a',
281
+ appId: 'app_bQHDFqydfNPl75MZNijXc4dUyHGqnHeX9e5l',
282
+ behavior: { mode: 'unified' },
283
+
284
+ // Explicitly set audio processor path if needed
285
+ voice: {
286
+ audioProcessorPath: 'https://cdn.talktopc.com/audio-processor.js'
287
+ }
288
+ });
289
+ ```
290
+
291
+ 3. **For self-hosted installations**, ensure `audio-processor.js` is in the same directory as `agent-widget.js`
292
+
251
293
  ### Mobile issues?
252
294
 
253
295
  - The widget is mobile-responsive by default
@@ -257,7 +299,7 @@ Here's a complete example with all customization options:
257
299
  ### WordPress Security Plugins?
258
300
 
259
301
  Some security plugins may block external scripts. You may need to:
260
- - Whitelist `unpkg.com` in your security plugin
302
+ - Whitelist `cdn.talktopc.com` in your security plugin
261
303
  - Or download the SDK file and host it on your own server
262
304
 
263
305
  ---
@@ -266,7 +308,7 @@ Some security plugins may block external scripts. You may need to:
266
308
 
267
309
  If you prefer to host the SDK file yourself:
268
310
 
269
- 1. Download: `https://unpkg.com/ttp-agent-sdk@2.2.2/dist/agent-widget.js`
311
+ 1. Download: `https://cdn.talktopc.com/agent-widget.js` or `https://unpkg.com/ttp-agent-sdk@latest/dist/agent-widget.js`
270
312
  2. Upload to your WordPress media library or Wix assets
271
313
  3. Update the script `src` to point to your hosted file
272
314