@glydeunity/voice-sdk 1.6.19 → 1.6.22

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 ADDED
@@ -0,0 +1,166 @@
1
+ # @glydeunity/voice-sdk
2
+
3
+ Customer and web developer guide for the packaged GLYDE Voice SDK.
4
+
5
+ Version: `1.6.19`
6
+
7
+ ## What You Get
8
+
9
+ - Drop-in CDN widget via `window.GlydeChat`
10
+ - Headless clients: `GlydeVoice`, `GlydeText`
11
+ - React components/hooks for custom app UIs
12
+
13
+ ## CDN Widget (recommended)
14
+
15
+ ### Auto-init script tag
16
+
17
+ ```html
18
+ <script
19
+ src="https://unpkg.com/@glydeunity/voice-sdk@latest/dist/glyde-chat.umd.js"
20
+ data-publishable-key="YOUR_PUBLISHABLE_KEY"
21
+ data-context-type="discovery"
22
+ data-context-id="YOUR_CLIENT_UUID"
23
+ ></script>
24
+ ```
25
+
26
+ ### Manual init
27
+
28
+ ```html
29
+ <script src="https://unpkg.com/@glydeunity/voice-sdk@latest/dist/glyde-chat.umd.js"></script>
30
+ <script>
31
+ GlydeChat.init({
32
+ publishableKey: 'YOUR_PUBLISHABLE_KEY',
33
+ contextType: 'screening',
34
+ contextId: 'APPLICATION_UUID',
35
+ unityBaseUrl: 'https://api.glydeunity.com',
36
+ displayMode: 'floating',
37
+ defaultMode: 'voice',
38
+ allowModeSwitch: true,
39
+ });
40
+ </script>
41
+ ```
42
+
43
+ ## Scenario Configurations (from current CDN test patterns)
44
+
45
+ ### 1) Known Applicant
46
+
47
+ ```js
48
+ {
49
+ contextType: 'screening',
50
+ contextId: 'APPLICATION_UUID',
51
+ }
52
+ ```
53
+
54
+ ### 2) Known Candidate (Discovery)
55
+
56
+ ```js
57
+ {
58
+ contextType: 'candidate_discover',
59
+ contextId: 'CANDIDATE_UUID',
60
+ }
61
+ ```
62
+
63
+ ### 3) Job Page Visitor
64
+
65
+ ```js
66
+ {
67
+ contextType: 'job_apply',
68
+ contextId: 'JOB_UUID',
69
+ }
70
+ ```
71
+
72
+ ### 4) Unknown Visitor
73
+
74
+ ```js
75
+ {
76
+ contextType: 'discovery',
77
+ contextId: 'CLIENT_UUID',
78
+ }
79
+ ```
80
+
81
+ ## Continuity Controls
82
+
83
+ Use these to tune chat history sent to the backend:
84
+
85
+ - `skipContinuityLimit: true` -> send full history
86
+ - `limitToLast: 5` -> current CDN test behavior
87
+ - `limitToLast: 50` -> long-running candidate/discovery flows
88
+
89
+ Example:
90
+
91
+ ```js
92
+ GlydeChat.init({
93
+ publishableKey: 'YOUR_PUBLISHABLE_KEY',
94
+ contextType: 'screening',
95
+ contextId: 'APPLICATION_UUID',
96
+ skipContinuityLimit: false,
97
+ limitToLast: 5,
98
+ });
99
+ ```
100
+
101
+ ## Display Modes
102
+
103
+ - `floating` - launcher bubble + chat panel
104
+ - `modal` - overlay panel
105
+ - `inline` - embed directly into a container
106
+ - `mobile` - full viewport mobile layout
107
+
108
+ Examples:
109
+
110
+ ```js
111
+ GlydeChat.init({ ...config, displayMode: 'modal', dimensions: { width: 500, height: 600 } });
112
+ GlydeChat.render('#chat-container', { ...config, displayMode: 'inline', dimensions: { width: '100%', height: 650 } });
113
+ GlydeChat.init({ ...config, displayMode: 'mobile' });
114
+ ```
115
+
116
+ ## `GlydeChat` Global API
117
+
118
+ - `GlydeChat.init(config)`
119
+ - `GlydeChat.render(container, config)`
120
+ - `GlydeChat.destroy()`
121
+ - `GlydeChat.version`
122
+
123
+ ## Script Data Attributes
124
+
125
+ Supported attributes for auto-init:
126
+
127
+ - `data-publishable-key`, `data-api-key`, `data-auth-token`
128
+ - `data-context-type`, `data-context-id`
129
+ - `data-unity-url`
130
+ - `data-auto-init`
131
+ - `data-default-mode`, `data-position`, `data-theme`
132
+ - `data-display-mode`, `data-container-id`
133
+ - `data-width`, `data-height`, `data-max-width`, `data-max-height`
134
+ - `data-dimensions`
135
+ - `data-show-header`, `data-allow-close`, `data-allow-mode-switch`
136
+
137
+ ## NPM Usage
138
+
139
+ ```bash
140
+ npm install @glydeunity/voice-sdk
141
+ ```
142
+
143
+ ```ts
144
+ import { GlydeVoice, GlydeText, ChatWidget, useVoiceAgent, useTextChat } from '@glydeunity/voice-sdk';
145
+ ```
146
+
147
+ ## Context Rules
148
+
149
+ | Context Type | Required `contextId` |
150
+ |---|---|
151
+ | `screening` | `application_uuid` |
152
+ | `job_apply` | `job_uuid` |
153
+ | `candidate_discover` | `candidate_uuid` |
154
+ | `candidate_apply` | `candidate_uuid:job_uuid` |
155
+ | `discovery` | optional (`client_uuid` recommended) |
156
+ | `recruiter`, `custom`, `phone` | optional |
157
+
158
+ Text mode and voice mode both use the same `contextType` semantics. If you are using a non-screening flow (for example `discovery` with a `client_uuid`), always pass `contextType` explicitly to avoid screening-only initialization paths.
159
+
160
+ ## Troubleshooting
161
+
162
+ - If widget does not appear, verify auth key and `data-auto-init` settings.
163
+ - If voice fails, ensure HTTPS and microphone permissions.
164
+ - If context errors occur, validate `contextType` + `contextId` format.
165
+ - If text mode calls `/api/unity/screening/summary/*` unexpectedly, ensure the text component receives the same `contextType` used by voice mode.
166
+