@gamaro.io/widget 1.0.1 → 1.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/README.md +21 -20
- package/THIRD_PARTY_NOTICES.md +34 -0
- package/dist/loader.d.ts +6 -6
- package/dist/types.d.ts +5 -0
- package/dist/widget.es.js +166 -119
- package/dist/widget.umd.js +36 -11
- package/package.json +11 -10
package/README.md
CHANGED
|
@@ -256,23 +256,23 @@ widget.on("error", (data) => {
|
|
|
256
256
|
|
|
257
257
|
### Event Types
|
|
258
258
|
|
|
259
|
-
| Event | Payload | Description
|
|
260
|
-
| --------------------- | ---------------------------------------------------- |
|
|
261
|
-
| `ready` | - | Widget is loaded and ready
|
|
262
|
-
| `open` | - | Widget was opened
|
|
263
|
-
| `close` | - | Widget was closed
|
|
264
|
-
| `message` | `{ message: WidgetMessage }` | New chat message
|
|
265
|
-
| `profile-update` | - | Profile was updated (signal only — subscribe to webhooks for the data)
|
|
266
|
-
| `qualified` | - | Lead qualified (signal only — subscribe to the `lead.qualified` webhook for the data)
|
|
267
|
-
| `funnel-stage-change` | `{ stage: string, previousStage: string \| null }` | Conversion funnel stage transition
|
|
268
|
-
| `cta-shown` | `{ ctaType: string, objectiveId?: string }` | A call-to-action was
|
|
269
|
-
| `cta-clicked` | `{ ctaType: string, objectiveId?: string }` | A call-to-action was clicked
|
|
270
|
-
| `lead-captured` | `{ hasEmail: boolean, hasPhone: boolean }` |
|
|
271
|
-
| `error` | `{ code: string, message: string }` | An error occurred
|
|
272
|
-
| `quota-warning` | `{ remaining: number, limit: number }` | Lead quota running low
|
|
273
|
-
| `quota-exceeded` | - | Lead quota exceeded
|
|
274
|
-
| `identity-verified` | `{ email: string, userId?: string }` | Host identity verified (HMAC)
|
|
275
|
-
| `widget-unavailable` | `{ reason: "timeout" \| "error", attempts: number }` | SDK exhausted all load retries — the widget degrades to a static state
|
|
259
|
+
| Event | Payload | Description |
|
|
260
|
+
| --------------------- | ---------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
|
|
261
|
+
| `ready` | - | Widget is loaded and ready |
|
|
262
|
+
| `open` | - | Widget was opened |
|
|
263
|
+
| `close` | - | Widget was closed |
|
|
264
|
+
| `message` | `{ message: WidgetMessage }` | New chat message |
|
|
265
|
+
| `profile-update` | - | Profile was updated (signal only — subscribe to webhooks for the data) |
|
|
266
|
+
| `qualified` | - | Lead qualified (signal only — subscribe to the `lead.qualified` webhook for the data) |
|
|
267
|
+
| `funnel-stage-change` | `{ stage: string, previousStage: string \| null }` | Conversion funnel stage transition |
|
|
268
|
+
| `cta-shown` | `{ ctaType: string, objectiveId?: string }` | A call-to-action was rendered — once per objective per conversation (mount, not viewport visibility) |
|
|
269
|
+
| `cta-clicked` | `{ ctaType: string, objectiveId?: string }` | A call-to-action was clicked |
|
|
270
|
+
| `lead-captured` | `{ hasEmail: boolean, hasPhone: boolean }` | A contact was saved this turn (channels only, never the value); not emitted when the agent reply fails |
|
|
271
|
+
| `error` | `{ code: string, message: string }` | An error occurred |
|
|
272
|
+
| `quota-warning` | `{ remaining: number, limit: number }` | Lead quota running low |
|
|
273
|
+
| `quota-exceeded` | - | Lead quota exceeded |
|
|
274
|
+
| `identity-verified` | `{ email: string, userId?: string }` | Host identity verified (HMAC) |
|
|
275
|
+
| `widget-unavailable` | `{ reason: "timeout" \| "error", attempts: number }` | SDK exhausted all load retries — the widget degrades to a static state |
|
|
276
276
|
|
|
277
277
|
## TypeScript
|
|
278
278
|
|
|
@@ -413,9 +413,10 @@ export function ContactWidget() {
|
|
|
413
413
|
|
|
414
414
|
## Data Attributes (Script Tag)
|
|
415
415
|
|
|
416
|
-
|
|
417
|
-
the `<script>` tag
|
|
418
|
-
|
|
416
|
+
Most `WidgetConfig` options can be passed as kebab-cased `data-*` attributes on
|
|
417
|
+
the `<script>` tag — the parser reads a fixed attribute list, so
|
|
418
|
+
`initialMessage` and `responsive` are programmatic-only. The same scope split as
|
|
419
|
+
the JavaScript API applies — in practice only `data-api-key` is needed.
|
|
419
420
|
|
|
420
421
|
### Host-side (essential)
|
|
421
422
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
The published bundles (`dist/widget.umd.js`, `dist/widget.es.js`) include the
|
|
4
|
+
following third-party software. `@gamaro.io/core-types`, also inlined, is Gamaro
|
|
5
|
+
code under its own license.
|
|
6
|
+
|
|
7
|
+
## zod
|
|
8
|
+
|
|
9
|
+
- Source: <https://github.com/colinhacks/zod>
|
|
10
|
+
- License: MIT
|
|
11
|
+
|
|
12
|
+
```text
|
|
13
|
+
MIT License
|
|
14
|
+
|
|
15
|
+
Copyright (c) 2025 Colin McDonnell
|
|
16
|
+
|
|
17
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
18
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
19
|
+
in the Software without restriction, including without limitation the rights
|
|
20
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
21
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
22
|
+
furnished to do so, subject to the following conditions:
|
|
23
|
+
|
|
24
|
+
The above copyright notice and this permission notice shall be included in all
|
|
25
|
+
copies or substantial portions of the Software.
|
|
26
|
+
|
|
27
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
28
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
29
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
30
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
31
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
32
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
33
|
+
SOFTWARE.
|
|
34
|
+
```
|
package/dist/loader.d.ts
CHANGED
|
@@ -72,12 +72,12 @@ export declare class GamaroWidget implements GamaroAPI {
|
|
|
72
72
|
*/
|
|
73
73
|
private setSkeletonStateUnavailable;
|
|
74
74
|
/**
|
|
75
|
-
* Resolve the widget runtime config from the server (#726). Retries
|
|
76
|
-
*
|
|
77
|
-
* 4xx and parse errors are permanent config/setup
|
|
78
|
-
* retry cannot fix, so we surface them immediately. If
|
|
79
|
-
*
|
|
80
|
-
* visible degraded mode rather than a silently absent widget.
|
|
75
|
+
* Resolve the widget runtime config from the server (#726). Retries
|
|
76
|
+
* along CONFIG_FETCH_BACKOFF_MS on *transient* failures (network,
|
|
77
|
+
* timeout, 5xx) — 4xx and parse errors are permanent config/setup
|
|
78
|
+
* problems that a retry cannot fix, so we surface them immediately. If
|
|
79
|
+
* every attempt fails, the skeleton stays visible and the widget emits
|
|
80
|
+
* `error` — visible degraded mode rather than a silently absent widget.
|
|
81
81
|
*/
|
|
82
82
|
private resolveConfig;
|
|
83
83
|
private isTransientFetchError;
|
package/dist/types.d.ts
CHANGED
|
@@ -156,6 +156,11 @@ export interface GamaroAPI {
|
|
|
156
156
|
close(): void;
|
|
157
157
|
/** Reset the conversation */
|
|
158
158
|
reset(): void;
|
|
159
|
+
/**
|
|
160
|
+
* Tear the widget down: remove it from the DOM, detach its listeners and
|
|
161
|
+
* abort in-flight requests. Idempotent.
|
|
162
|
+
*/
|
|
163
|
+
destroy(): void;
|
|
159
164
|
/** Update theme dynamically */
|
|
160
165
|
setTheme(theme: ThemeConfig): void;
|
|
161
166
|
/**
|