cevro-messenger-sdk 0.1.11 → 0.1.13

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
@@ -35,7 +35,6 @@ All options are passed inside `window.cevroSettings` in the snippet above:
35
35
  | `workspaceId` | `string` | Yes | Your Cevro workspace ID |
36
36
  | `brandId` | `string` | Yes | Brand ID for the workspace |
37
37
  | `player` | `object` | No | Authenticated user information (see below) |
38
- | `agentId` | `string` | No | Route conversations to a specific agent |
39
38
  | `alignment` | `'left' \| 'right'` | No | Horizontal position of the widget |
40
39
  | `verticalPadding` | `number` | No | Padding from bottom (px) |
41
40
  | `horizontalPadding` | `number` | No | Padding from edge (px) |
@@ -113,9 +112,35 @@ window.cevroSettings = {
113
112
  };
114
113
  ```
115
114
 
115
+ All properties are optional. Set just `primaryColor` to derive all accent colors automatically, or override individual properties via `theme` for full control. Theme can also be managed from the admin dashboard (**Settings → Cevro → Appearance**).
116
+
117
+ | Property | Type | Description |
118
+ |----------|------|-------------|
119
+ | `backgroundColor` | `string` | Main background color |
120
+ | `backgroundSecondaryColor` | `string` | Secondary/alternate background |
121
+ | `textColor` | `string` | Primary text color |
122
+ | `textSecondaryColor` | `string` | Secondary/muted text color |
123
+ | `borderColor` | `string` | Border color |
124
+ | `userMessageBackgroundColor` | `string` | User message bubble background |
125
+ | `userMessageTextColor` | `string` | User message text color |
126
+ | `agentMessageBackgroundColor` | `string` | Agent/AI message bubble background |
127
+ | `agentMessageTextColor` | `string` | Agent/AI message text color |
128
+ | `headerBackgroundColor` | `string` | Header background color |
129
+ | `headerTextColor` | `string` | Header text color |
130
+ | `inputBackgroundColor` | `string` | Input field background color |
131
+ | `launcherBackgroundColor` | `string` | Launcher button background |
132
+ | `launcherIconColor` | `string` | Launcher button icon color |
133
+ | `launcherHoverShadowColor` | `string` | Launcher hover shadow color |
134
+ | `sendButtonBackgroundColor` | `string` | Send button background |
135
+ | `sendButtonIconColor` | `string` | Send button icon color |
136
+ | `fileButtonBackgroundColor` | `string` | File button background |
137
+ | `fileButtonIconColor` | `string` | File button icon color |
138
+ | `borderRadius` | `number` | Border radius in pixels |
139
+ | `shadowColor` | `string` | Shadow color (e.g. `'rgba(0,0,0,0.2)'`) |
140
+
116
141
  ### Locale
117
142
 
118
- Override default UI texts via `locale`:
143
+ The widget language is detected automatically from the player's browser. To override specific UI texts, use `locale`:
119
144
 
120
145
  ```javascript
121
146
  window.cevroSettings = {
@@ -151,45 +176,24 @@ Cevro('shutdown', { clearVisitorData: true }); // Remove and clear visitor data
151
176
  Cevro('getUnreadCount'); // Get unread message count
152
177
  Cevro('getVisitorId'); // Get current visitor ID
153
178
 
154
- // Update player data (e.g., after login)
155
- Cevro('update', {
179
+ // Identify a player after login (soft re-init, no flicker)
180
+ Cevro('identify', {
156
181
  playerId: 'user-123',
157
182
  email: 'user@example.com',
158
183
  firstName: 'John',
184
+ playerHash: 'hmac-hash-for-verification',
185
+ customAttributes: { vipLevel: 'gold' },
159
186
  });
160
187
 
161
- // Subscribe to events
162
- Cevro('on', 'message:received', function(data) {
163
- console.log('New message:', data.message.body);
188
+ // Update SDK config
189
+ Cevro('update', {
190
+ player: {
191
+ playerId: 'user-123',
192
+ email: 'user@example.com',
193
+ },
164
194
  });
165
195
  ```
166
196
 
167
- Commands can be queued before the SDK finishes loading — they will be replayed automatically.
168
-
169
- ## Events
170
-
171
- | Event | Payload | Description |
172
- |-------|---------|-------------|
173
- | `boot` | - | Widget initialized |
174
- | `ready` | - | WebSocket connected and ready |
175
- | `show` | - | Chat window opened |
176
- | `hide` | - | Chat window closed |
177
- | `shutdown` | - | Widget removed |
178
- | `session:initialized` | `{ sessionId, contactId, ticketId, isNewSession, isNewTicket }` | Session created/restored |
179
- | `message:received` | `{ ticketId, message }` | New message from agent/AI |
180
- | `message:sent` | `{ message }` | Message sent |
181
- | `unread_count_change` | `{ count }` | Unread count changed |
182
- | `conversation:started` | `{ ticketId }` | New conversation started |
183
- | `conversation:updated` | `{ ticketId, status }` | Conversation status changed |
184
- | `chat:new_started` | - | New chat started after previous closed |
185
- | `typing:start` | `{ ticketId, actor }` | Agent/AI started typing |
186
- | `typing:stop` | `{ ticketId, actor }` | Agent/AI stopped typing |
187
- | `error` | `{ type, error, message? }` | An error occurred |
188
- | `connection:open` | - | WebSocket connected |
189
- | `connection:close` | - | WebSocket disconnected |
190
- | `connection:error` | `{ error }` | WebSocket error |
191
- | `appearance:updated` | `WidgetAppearance` | Widget appearance config updated |
192
-
193
197
  ## License
194
198
 
195
199
  MIT