@product7/feedback-sdk 1.3.8 → 1.4.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.
Files changed (39) hide show
  1. package/dist/feedback-sdk.js +3008 -2568
  2. package/dist/feedback-sdk.js.map +1 -1
  3. package/dist/feedback-sdk.min.js +1 -1
  4. package/dist/feedback-sdk.min.js.map +1 -1
  5. package/package.json +1 -1
  6. package/src/api/services/MessengerService.js +5 -5
  7. package/src/core/APIService.js +37 -14
  8. package/src/index.js +1 -1
  9. package/src/styles/base.js +1 -1
  10. package/src/styles/changelog.js +58 -40
  11. package/src/styles/components.js +19 -2
  12. package/src/styles/design-tokens.js +4 -4
  13. package/src/styles/feedback.js +3 -8
  14. package/src/styles/messenger-components.js +473 -0
  15. package/src/styles/messenger-core.js +37 -268
  16. package/src/styles/messenger-features.js +89 -267
  17. package/src/styles/messenger-views.js +391 -325
  18. package/src/styles/messenger.js +17 -558
  19. package/src/styles/styles.js +21 -24
  20. package/src/styles/{surveys.js → survey.js} +56 -21
  21. package/src/widgets/BaseWidget.js +1 -1
  22. package/src/widgets/ButtonWidget.js +1 -1
  23. package/src/widgets/ChangelogWidget.js +1 -1
  24. package/src/widgets/InlineWidget.js +1 -1
  25. package/src/widgets/MessengerWidget.js +111 -122
  26. package/src/widgets/SurveyWidget.js +1 -1
  27. package/src/widgets/TabWidget.js +1 -1
  28. package/src/widgets/messenger/MessengerState.js +5 -2
  29. package/src/widgets/messenger/components/MessengerLauncher.js +22 -18
  30. package/src/widgets/messenger/components/MessengerPanel.js +1 -1
  31. package/src/widgets/messenger/components/NavigationTabs.js +36 -15
  32. package/src/widgets/messenger/views/ChangelogView.js +8 -32
  33. package/src/widgets/messenger/views/ChatView.js +96 -60
  34. package/src/widgets/messenger/views/ConversationsView.js +67 -45
  35. package/src/widgets/messenger/views/HelpView.js +22 -32
  36. package/src/widgets/messenger/views/HomeView.js +58 -40
  37. package/src/widgets/messenger/views/PreChatFormView.js +12 -5
  38. package/src/styles/messenger-help.js +0 -298
  39. package/src/styles/messenger-themes.js +0 -500
@@ -14,12 +14,16 @@ export const surveyStyles = `
14
14
  animation: fadeIn var(--transition-slow);
15
15
  }
16
16
 
17
+ /* ========================================
18
+ SURVEY CARD
19
+ ======================================== */
20
+
17
21
  .feedback-survey {
18
22
  position: fixed;
19
23
  z-index: var(--z-modal);
20
24
  background: var(--color-white);
21
25
  border-radius: var(--radius-2xl);
22
- box-shadow: var(--shadow-2xl);
26
+ box-shadow: rgba(50, 50, 93, 0.25) 0px 2px 5px -1px, rgba(0, 0, 0, 0.3) 0px 1px 3px -1px;
23
27
  padding: var(--spacing-6);
24
28
  min-width: 320px;
25
29
  max-width: 400px;
@@ -56,16 +60,15 @@ export const surveyStyles = `
56
60
  right: var(--spacing-3);
57
61
  background: none;
58
62
  border: none;
59
- font-size: 20px;
60
63
  cursor: pointer;
61
64
  color: var(--color-neutral-500);
62
- line-height: 1;
65
+ padding: 0;
63
66
  width: 28px;
64
67
  height: 28px;
65
68
  display: flex;
66
69
  align-items: center;
67
70
  justify-content: center;
68
- border-radius: var(--radius-sm);
71
+ border-radius: var(--radius-md);
69
72
  transition: all var(--transition-base);
70
73
  }
71
74
 
@@ -77,7 +80,7 @@ export const surveyStyles = `
77
80
  .feedback-survey-title {
78
81
  margin: 0 0 var(--spacing-2) 0;
79
82
  font-size: var(--font-size-xl);
80
- font-weight: var(--font-weight-semibold);
83
+ font-weight: var(--font-weight-bold);
81
84
  padding-right: var(--spacing-6);
82
85
  color: var(--color-text-primary);
83
86
  }
@@ -93,6 +96,10 @@ export const surveyStyles = `
93
96
  margin-bottom: var(--spacing-4);
94
97
  }
95
98
 
99
+ /* ========================================
100
+ NPS
101
+ ======================================== */
102
+
96
103
  .feedback-survey-nps {
97
104
  display: flex;
98
105
  justify-content: space-between;
@@ -103,10 +110,11 @@ export const surveyStyles = `
103
110
  width: 28px;
104
111
  height: 36px;
105
112
  border: 1px solid var(--color-border);
106
- border-radius: var(--radius-sm);
113
+ border-radius: var(--radius-md);
107
114
  background: var(--color-surface);
108
115
  cursor: pointer;
109
116
  font-size: var(--font-size-sm);
117
+ font-weight: var(--font-weight-medium);
110
118
  color: var(--color-text-primary);
111
119
  transition: all var(--transition-fast);
112
120
  font-family: inherit;
@@ -123,6 +131,10 @@ export const surveyStyles = `
123
131
  color: var(--color-white);
124
132
  }
125
133
 
134
+ /* ========================================
135
+ CSAT
136
+ ======================================== */
137
+
126
138
  .feedback-survey-csat {
127
139
  display: flex;
128
140
  justify-content: center;
@@ -146,6 +158,10 @@ export const surveyStyles = `
146
158
  transform: scale(1.2);
147
159
  }
148
160
 
161
+ /* ========================================
162
+ CES
163
+ ======================================== */
164
+
149
165
  .feedback-survey-ces {
150
166
  display: flex;
151
167
  justify-content: space-between;
@@ -160,6 +176,7 @@ export const surveyStyles = `
160
176
  background: var(--color-surface);
161
177
  cursor: pointer;
162
178
  font-size: var(--font-size-xs);
179
+ font-weight: var(--font-weight-medium);
163
180
  color: var(--color-text-primary);
164
181
  transition: all var(--transition-fast);
165
182
  font-family: inherit;
@@ -182,9 +199,13 @@ export const surveyStyles = `
182
199
  justify-content: space-between;
183
200
  margin-top: var(--spacing-2);
184
201
  font-size: var(--font-size-xs);
185
- color: var(--color-text-secondary);
202
+ color: var(--color-text-tertiary);
186
203
  }
187
204
 
205
+ /* ========================================
206
+ FREQUENCY
207
+ ======================================== */
208
+
188
209
  .feedback-survey-frequency {
189
210
  display: flex;
190
211
  gap: var(--spacing-2);
@@ -192,12 +213,13 @@ export const surveyStyles = `
192
213
 
193
214
  .feedback-survey-freq-btn {
194
215
  flex: 1;
195
- padding: 10px;
216
+ padding: var(--spacing-3);
196
217
  border: 1px solid var(--color-border);
197
218
  border-radius: var(--radius-md);
198
219
  background: var(--color-surface);
199
220
  cursor: pointer;
200
221
  font-size: var(--font-size-sm);
222
+ font-weight: var(--font-weight-medium);
201
223
  color: var(--color-text-primary);
202
224
  transition: all var(--transition-fast);
203
225
  font-family: inherit;
@@ -214,13 +236,17 @@ export const surveyStyles = `
214
236
  color: var(--color-white);
215
237
  }
216
238
 
239
+ /* ========================================
240
+ FORM INPUTS
241
+ ======================================== */
242
+
217
243
  .feedback-survey-feedback {
218
244
  margin-top: var(--spacing-4);
219
245
  }
220
246
 
221
247
  .feedback-survey-textarea {
222
248
  width: 100%;
223
- padding: var(--spacing-3) 14px;
249
+ padding: var(--spacing-3);
224
250
  border: 1px solid var(--color-border);
225
251
  border-radius: var(--radius-md);
226
252
  font-size: var(--font-size-base);
@@ -230,7 +256,7 @@ export const surveyStyles = `
230
256
  color: var(--color-text-primary);
231
257
  font-family: inherit;
232
258
  box-sizing: border-box;
233
- transition: all var(--transition-base);
259
+ transition: border-color var(--transition-base);
234
260
  outline: none;
235
261
  }
236
262
 
@@ -245,7 +271,7 @@ export const surveyStyles = `
245
271
 
246
272
  .feedback-survey-select {
247
273
  width: 100%;
248
- padding: 10px 14px;
274
+ padding: var(--spacing-3);
249
275
  border: 1px solid var(--color-border);
250
276
  border-radius: var(--radius-md);
251
277
  font-size: var(--font-size-base);
@@ -253,7 +279,7 @@ export const surveyStyles = `
253
279
  color: var(--color-text-primary);
254
280
  font-family: inherit;
255
281
  cursor: pointer;
256
- transition: all var(--transition-base);
282
+ transition: border-color var(--transition-base);
257
283
  outline: none;
258
284
  }
259
285
 
@@ -264,7 +290,7 @@ export const surveyStyles = `
264
290
 
265
291
  .feedback-survey-input {
266
292
  width: 100%;
267
- padding: 10px 14px;
293
+ padding: var(--spacing-3);
268
294
  border: 1px solid var(--color-border);
269
295
  border-radius: var(--radius-md);
270
296
  font-size: var(--font-size-base);
@@ -272,7 +298,7 @@ export const surveyStyles = `
272
298
  color: var(--color-text-primary);
273
299
  font-family: inherit;
274
300
  box-sizing: border-box;
275
- transition: all var(--transition-base);
301
+ transition: border-color var(--transition-base);
276
302
  outline: none;
277
303
  }
278
304
 
@@ -285,16 +311,20 @@ export const surveyStyles = `
285
311
  box-shadow: 0 0 0 3px var(--color-primary-light);
286
312
  }
287
313
 
314
+ /* ========================================
315
+ SUBMIT & FEEDBACK
316
+ ======================================== */
317
+
288
318
  .feedback-survey-submit {
289
319
  width: 100%;
290
320
  margin-top: var(--spacing-3);
291
321
  padding: var(--spacing-3);
292
322
  background: var(--color-primary);
293
323
  color: var(--color-white);
294
- border: none;
324
+ border: 1px solid var(--color-primary);
295
325
  border-radius: var(--radius-md);
296
326
  font-size: var(--font-size-base);
297
- font-weight: var(--font-weight-medium);
327
+ font-weight: var(--font-weight-semibold);
298
328
  cursor: pointer;
299
329
  font-family: inherit;
300
330
  transition: all var(--transition-base);
@@ -302,6 +332,7 @@ export const surveyStyles = `
302
332
 
303
333
  .feedback-survey-submit:hover {
304
334
  background: var(--color-primary-hover);
335
+ border-color: var(--color-primary-hover);
305
336
  }
306
337
 
307
338
  .feedback-survey-error {
@@ -317,7 +348,7 @@ export const surveyStyles = `
317
348
  right: var(--spacing-6);
318
349
  background: var(--color-success);
319
350
  color: var(--color-white);
320
- padding: var(--spacing-4) var(--spacing-6);
351
+ padding: var(--spacing-3) var(--spacing-5);
321
352
  border-radius: var(--radius-xl);
322
353
  font-size: var(--font-size-base);
323
354
  font-weight: var(--font-weight-medium);
@@ -332,23 +363,27 @@ export const surveyStyles = `
332
363
  gap: var(--spacing-2);
333
364
  }
334
365
 
366
+ /* ========================================
367
+ RESPONSIVE
368
+ ======================================== */
369
+
335
370
  @media (max-width: 768px) {
336
371
  .feedback-survey {
337
372
  min-width: 300px;
338
373
  }
339
-
374
+
340
375
  .feedback-survey-bottom {
341
376
  padding: var(--spacing-5);
342
377
  }
343
-
378
+
344
379
  .feedback-survey-nps-btn {
345
380
  width: 24px;
346
381
  height: 32px;
347
382
  font-size: var(--font-size-xs);
348
383
  }
349
-
384
+
350
385
  .feedback-survey-csat-btn {
351
386
  font-size: 32px;
352
387
  }
353
388
  }
354
- `;
389
+ `;
@@ -510,4 +510,4 @@ export class BaseWidget {
510
510
  closeModal() {
511
511
  this.closePanel();
512
512
  }
513
- }
513
+ }
@@ -98,4 +98,4 @@ export class ButtonWidget extends BaseWidget {
98
98
  );
99
99
  }
100
100
  }
101
- }
101
+ }
@@ -570,4 +570,4 @@ export class ChangelogWidget extends BaseWidget {
570
570
  this.closeSidebar();
571
571
  super.destroy();
572
572
  }
573
- }
573
+ }
@@ -145,4 +145,4 @@ export class InlineWidget extends BaseWidget {
145
145
  input.placeholder = placeholder;
146
146
  }
147
147
  }
148
- }
148
+ }
@@ -1,3 +1,4 @@
1
+ import { WebSocketService } from '../core/WebSocketService.js';
1
2
  import { BaseWidget } from './BaseWidget.js';
2
3
  import { MessengerState } from './messenger/MessengerState.js';
3
4
  import { MessengerLauncher } from './messenger/components/MessengerLauncher.js';
@@ -8,7 +9,6 @@ import { ConversationsView } from './messenger/views/ConversationsView.js';
8
9
  import { HelpView } from './messenger/views/HelpView.js';
9
10
  import { HomeView } from './messenger/views/HomeView.js';
10
11
  import { PreChatFormView } from './messenger/views/PreChatFormView.js';
11
- import { WebSocketService } from '../core/WebSocketService.js';
12
12
 
13
13
  export class MessengerWidget extends BaseWidget {
14
14
  constructor(options) {
@@ -198,7 +198,10 @@ export class MessengerWidget extends BaseWidget {
198
198
  });
199
199
 
200
200
  if (response.status) {
201
- console.log('[MessengerWidget] Contact identified:', response.data.contact_id);
201
+ console.log(
202
+ '[MessengerWidget] Contact identified:',
203
+ response.data.contact_id
204
+ );
202
205
  this.messengerState.setIdentified(true, {
203
206
  name: contactData.name,
204
207
  email: contactData.email,
@@ -350,7 +353,9 @@ export class MessengerWidget extends BaseWidget {
350
353
  data?.conversation_id || data?.id || data?.conversation?.id;
351
354
  if (!conversationId) return;
352
355
 
353
- this.messengerState.updateConversation(conversationId, { status: 'closed' });
356
+ this.messengerState.updateConversation(conversationId, {
357
+ status: 'closed',
358
+ });
354
359
  }
355
360
 
356
361
  async _updateUnreadCount() {
@@ -521,26 +526,25 @@ export class MessengerWidget extends BaseWidget {
521
526
  }
522
527
  }
523
528
 
524
- async _fetchHelpArticles() {
525
- try {
526
- const response = await this.apiService.getHelpCollections();
527
- if (response.status && response.data) {
528
- return response.data.map((collection) => ({
529
- id: collection.id,
530
- title: collection.title || collection.name,
531
- description: collection.description || '',
532
- articleCount:
533
- collection.article_count || collection.articleCount || 0,
534
- icon: collection.icon || 'ph-book-open',
535
- url: collection.url || `#/help/${collection.slug || collection.id}`,
536
- }));
537
- }
538
- return [];
539
- } catch (error) {
540
- console.error('[MessengerWidget] Failed to fetch help articles:', error);
541
- return [];
542
- }
543
- }
529
+ async _fetchHelpArticles() {
530
+ try {
531
+ const response = await this.apiService.getHelpCollections();
532
+ if (response.success && response.data) {
533
+ const collections = response.data.collections || response.data;
534
+ return collections.map((collection) => ({
535
+ id: collection.id,
536
+ title: collection.title,
537
+ description: collection.description || '',
538
+ articleCount: collection.article_count || 0,
539
+ url: collection.url_slug ? `/help/${collection.url_slug}` : null,
540
+ }));
541
+ }
542
+ return [];
543
+ } catch (error) {
544
+ console.error('[MessengerWidget] Failed to fetch help articles:', error);
545
+ return [];
546
+ }
547
+ }
544
548
 
545
549
  async fetchMessages(conversationId) {
546
550
  try {
@@ -665,104 +669,89 @@ export class MessengerWidget extends BaseWidget {
665
669
  }
666
670
  }
667
671
 
668
- async _fetchChangelog() {
669
- if (this.apiService?.mock) {
670
- return {
671
- homeItems: [
672
- {
673
- id: 'changelog_5',
674
- title: 'New integrations available',
675
- description:
676
- 'Connect with more tools you love and streamline your workflow.',
677
- tags: ['Integration'],
678
- coverImage: 'https://feedback-sdk.product7.io/700x400__5_.png',
679
- coverText: null,
680
- publishedAt: new Date(
681
- Date.now() - 14 * 24 * 60 * 60 * 1000
682
- ).toISOString(),
683
- url: '#',
684
- },
685
- {
686
- id: 'changelog_2',
687
- title: 'A new era of Insights has arrived',
688
- description:
689
- 'We announced Fin Insights, a groundbreaking, AI-powered product that gives you complete visibility into every customer conversation.',
690
- tags: ['New feature', 'AI'],
691
- coverImage:
692
- 'https://feedback-sdk.product7.io/Intercom_Messenger__1_.jpg',
693
- coverText: 'Watch our major product launch on-demand',
694
- publishedAt: new Date(
695
- Date.now() - 5 * 24 * 60 * 60 * 1000
696
- ).toISOString(),
697
- url: '#',
698
- },
699
- {
700
- id: 'changelog_1',
701
- title: 'The 2025 Customer Service Transformation Report',
702
- description:
703
- 'Learn how AI has transformed customer service from the ground up—rewriting its economics and reshaping expectations.',
704
- tags: ['Report'],
705
- coverImage:
706
- 'https://feedback-sdk.product7.io/Main_Report_Email_Header.png',
707
- coverText: 'Customer service trends as we know them are dead.',
708
- publishedAt: new Date(
709
- Date.now() - 2 * 24 * 60 * 60 * 1000
710
- ).toISOString(),
711
- url: '#',
712
- },
713
- ],
714
- changelogItems: [
715
- {
716
- id: 'changelog_4',
717
- title: 'Enhanced conversation analytics',
718
- description:
719
- 'Get deeper insights into your customer conversations with our new analytics dashboard.',
720
- tags: ['Analytics'],
721
- coverImage:
722
- 'https://feedback-sdk.product7.io/cgangelog-Frame%202087334450.jpg',
723
- coverText: null,
724
- publishedAt: new Date(
725
- Date.now() - 10 * 24 * 60 * 60 * 1000
726
- ).toISOString(),
727
- url: '#',
728
- },
729
- {
730
- id: 'changelog_3',
731
- title: 'Escalation guidance for complex issues',
732
- description:
733
- 'New AI-powered escalation guidance helps your team handle complex customer issues more effectively.',
734
- tags: ['New feature', 'AI'],
735
- coverImage:
736
- 'https://feedback-sdk.product7.io/cgangelog-image-escalation-guidance-event@2x.png',
737
- coverText: null,
738
- publishedAt: new Date(
739
- Date.now() - 7 * 24 * 60 * 60 * 1000
740
- ).toISOString(),
741
- url: '#',
742
- },
743
- ],
744
- };
745
- }
746
-
747
- const response = await this.apiService.getChangelogs({ limit: 20 });
748
- const changelogs = response.data || [];
749
-
750
- const mappedItems = changelogs.map((item) => ({
751
- id: item.id,
752
- title: item.title,
753
- description: item.excerpt || item.description || '',
754
- tags: item.labels ? item.labels.map((label) => label.name) : [],
755
- coverImage: item.cover_image || null,
756
- coverText: null,
757
- publishedAt: item.published_at,
758
- url: item.slug ? `/changelog/${item.slug}` : '#',
759
- }));
760
-
761
- return {
762
- homeItems: mappedItems.slice(0, 3),
763
- changelogItems: mappedItems,
764
- };
765
- }
672
+ async _fetchChangelog() {
673
+ if (this.apiService?.mock) {
674
+ return {
675
+ homeItems: [
676
+ {
677
+ id: 'changelog_5',
678
+ title: 'New integrations available',
679
+ description: 'Connect with more tools you love and streamline your workflow.',
680
+ tags: ['Integration'],
681
+ coverImage: 'https://images.unsplash.com/photo-1674027444485-cec3da58eef4?w=500&auto=format&fit=crop&q=60',
682
+ publishedAt: new Date(Date.now() - 14 * 24 * 60 * 60 * 1000).toISOString(),
683
+ url: '#',
684
+ },
685
+ {
686
+ id: 'changelog_2',
687
+ title: 'A new era of Insights has arrived',
688
+ description: 'We announced Fin Insights, a groundbreaking, AI-powered product that gives you complete visibility into every customer conversation.',
689
+ tags: ['New feature', 'AI'],
690
+ coverImage: 'https://images.unsplash.com/photo-1666875753105-c63a6f3bdc86?w=500&auto=format&fit=crop&q=60',
691
+ publishedAt: new Date(Date.now() - 5 * 24 * 60 * 60 * 1000).toISOString(),
692
+ url: '#',
693
+ },
694
+ {
695
+ id: 'changelog_1',
696
+ title: 'The 2025 Customer Service Transformation Report',
697
+ description: 'Learn how AI has transformed customer service from the ground up—rewriting its economics and reshaping expectations.',
698
+ tags: ['Report'],
699
+ coverImage: 'https://images.unsplash.com/photo-1762330467475-a565d04e1808?w=500&auto=format&fit=crop&q=60',
700
+ publishedAt: new Date(Date.now() - 2 * 24 * 60 * 60 * 1000).toISOString(),
701
+ url: '#',
702
+ },
703
+ ],
704
+ changelogItems: [
705
+ {
706
+ id: 'changelog_4',
707
+ title: 'Enhanced conversation analytics',
708
+ description: 'Get deeper insights into your customer conversations with our new analytics dashboard.',
709
+ tags: ['Analytics'],
710
+ coverImage: 'https://images.unsplash.com/photo-1523961131990-5ea7c61b2107?w=500&auto=format&fit=crop&q=60',
711
+ publishedAt: new Date(Date.now() - 10 * 24 * 60 * 60 * 1000).toISOString(),
712
+ url: '#',
713
+ },
714
+ {
715
+ id: 'changelog_3',
716
+ title: 'Escalation guidance for complex issues',
717
+ description: 'New AI-powered escalation guidance helps your team handle complex customer issues more effectively.',
718
+ tags: ['New feature', 'AI'],
719
+ coverImage: 'https://images.unsplash.com/photo-1764773516703-b246ac2ad5ef?w=500&auto=format&fit=crop&q=60',
720
+ publishedAt: new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toISOString(),
721
+ url: '#',
722
+ },
723
+ ],
724
+ };
725
+ }
726
+
727
+ try {
728
+ const response = await this.apiService.getChangelogs({ limit: 20 });
729
+
730
+ if (response.success && response.data) {
731
+ const changelogs = Array.isArray(response.data) ? response.data : [];
732
+
733
+ const mappedItems = changelogs.map((item) => ({
734
+ id: item.id,
735
+ title: item.title,
736
+ description: item.excerpt || item.description || '',
737
+ tags: item.labels ? item.labels.map((label) => label.name) : [],
738
+ coverImage: item.cover_image || null,
739
+ publishedAt: item.published_at,
740
+ url: item.slug ? `/changelog/${item.slug}` : null,
741
+ }));
742
+
743
+ return {
744
+ homeItems: mappedItems.slice(0, 3),
745
+ changelogItems: mappedItems,
746
+ };
747
+ }
748
+
749
+ return { homeItems: [], changelogItems: [] };
750
+ } catch (error) {
751
+ console.error('[MessengerWidget] Failed to fetch changelog:', error);
752
+ return { homeItems: [], changelogItems: [] };
753
+ }
754
+ }
766
755
 
767
756
  async onMount() {
768
757
  this.loadInitialData();
@@ -805,4 +794,4 @@ export class MessengerWidget extends BaseWidget {
805
794
  this.onDestroy();
806
795
  super.destroy();
807
796
  }
808
- }
797
+ }
@@ -508,4 +508,4 @@ export class SurveyWidget extends BaseWidget {
508
508
  this._closeSurvey();
509
509
  super.destroy();
510
510
  }
511
- }
511
+ }
@@ -42,4 +42,4 @@ export class TabWidget extends BaseWidget {
42
42
  );
43
43
  }
44
44
  }
45
- }
45
+ }
@@ -60,7 +60,10 @@ export class MessengerState {
60
60
  setActiveConversation(conversationId) {
61
61
  const previousConversationId = this.activeConversationId;
62
62
  this.activeConversationId = conversationId;
63
- this._notify('conversationChange', { conversationId, previousConversationId });
63
+ this._notify('conversationChange', {
64
+ conversationId,
65
+ previousConversationId,
66
+ });
64
67
  }
65
68
 
66
69
  setIdentified(isIdentified, userContext = null) {
@@ -192,4 +195,4 @@ export class MessengerState {
192
195
  this.helpSearchQuery = '';
193
196
  this._notify('reset', {});
194
197
  }
195
- }
198
+ }
@@ -36,24 +36,28 @@ export class MessengerLauncher {
36
36
  : '';
37
37
 
38
38
  this.element.innerHTML = `
39
- <button class="messenger-launcher-btn" aria-label="Open messenger">
40
- <span class="messenger-launcher-icon messenger-launcher-icon-chat">
41
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 256 256">
42
- <path d="M144,140a12,12,0,1,1-12-12A12,12,0,0,1,144,140Zm44-12a12,12,0,1,0,12,12A12,12,0,0,0,188,128Zm51.34,83.47a16,16,0,0,1-19.87,19.87l-24.71-7.27A80,80,0,0,1,86.43,183.42a79,79,0,0,1-25.19-7.35l-24.71,7.27a16,16,0,0,1-19.87-19.87l7.27-24.71A80,80,0,1,1,169.58,72.59a80,80,0,0,1,62.49,114.17ZM81.3,166.3a79.94,79.94,0,0,1,70.38-93.87A64,64,0,0,0,39.55,134.19a8,8,0,0,1,.63,6L32,168l27.76-8.17a8,8,0,0,1,6,.63A63.45,63.45,0,0,0,81.3,166.3Zm135.15,15.89a64,64,0,1,0-26.26,26.26,8,8,0,0,1,6-.63L224,216l-8.17-27.76A8,8,0,0,1,216.45,182.19Z"></path>
43
- </svg>
44
- </span>
45
- <span class="messenger-launcher-icon messenger-launcher-icon-close" style="display: none;">
46
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 256 256">
47
- <path d="M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"></path>
48
- </svg>
49
- </span>
50
- ${badgeHtml}
51
- </button>
52
- `;
39
+ <button class="messenger-launcher-btn" aria-label="Open messenger">
40
+ <span class="messenger-launcher-icon messenger-launcher-icon-chat">
41
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 256 256">
42
+ <path d="M144,140a12,12,0,1,1-12-12A12,12,0,0,1,144,140Zm44-12a12,12,0,1,0,12,12A12,12,0,0,0,188,128Zm51.34,83.47a16,16,0,0,1-19.87,19.87l-24.71-7.27A80,80,0,0,1,86.43,183.42a79,79,0,0,1-25.19-7.35l-24.71,7.27a16,16,0,0,1-19.87-19.87l7.27-24.71A80,80,0,1,1,169.58,72.59a80,80,0,0,1,62.49,114.17ZM81.3,166.3a79.94,79.94,0,0,1,70.38-93.87A64,64,0,0,0,39.55,134.19a8,8,0,0,1,.63,6L32,168l27.76-8.17a8,8,0,0,1,6,.63A63.45,63.45,0,0,0,81.3,166.3Zm135.15,15.89a64,64,0,1,0-26.26,26.26,8,8,0,0,1,6-.63L224,216l-8.17-27.76A8,8,0,0,1,216.45,182.19Z"></path>
43
+ </svg>
44
+ </span>
45
+ <span class="messenger-launcher-icon messenger-launcher-icon-close" style="display: none;">
46
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 256 256">
47
+ <path d="M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"></path>
48
+ </svg>
49
+ </span>
50
+ ${badgeHtml}
51
+ </button>
52
+ `;
53
53
 
54
- // Set custom primary color if provided
55
- if (this.options.primaryColor) {
56
- this.element.querySelector('.messenger-launcher-btn').style.setProperty('background', this.options.primaryColor);
54
+ const btn = this.element.querySelector('.messenger-launcher-btn');
55
+ if (btn && this.options.primaryColor) {
56
+ btn.style.setProperty(
57
+ 'background',
58
+ this.options.primaryColor,
59
+ 'important'
60
+ );
57
61
  }
58
62
  }
59
63
 
@@ -121,4 +125,4 @@ export class MessengerLauncher {
121
125
  this.element.parentNode.removeChild(this.element);
122
126
  }
123
127
  }
124
- }
128
+ }
@@ -105,4 +105,4 @@ export class MessengerPanel {
105
105
  this.element.parentNode.removeChild(this.element);
106
106
  }
107
107
  }
108
- }
108
+ }