@product7/feedback-sdk 1.3.8 → 1.3.9

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 +2824 -2371
  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 +33 -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} +55 -20
  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 +15 -9
  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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@product7/feedback-sdk",
3
- "version": "1.3.8",
3
+ "version": "1.3.9",
4
4
  "description": "JavaScript SDK for integrating Product7 feedback widgets into any website",
5
5
  "main": "dist/feedback-sdk.js",
6
6
  "module": "src/index.js",
@@ -14,7 +14,7 @@ export class MessengerService {
14
14
  status: true,
15
15
  data: {
16
16
  enabled: true,
17
- greeting_message: 'Hi there! How can we help you today?',
17
+ greeting_message: 'Hi there! How can we help?',
18
18
  team_name: 'Support Team',
19
19
  response_time: 'Usually replies within a few minutes',
20
20
  },
@@ -125,7 +125,7 @@ export class MessengerService {
125
125
  body: JSON.stringify({
126
126
  message: data.message,
127
127
  subject: data.subject || '',
128
- attachments: data.attachments || []
128
+ attachments: data.attachments || [],
129
129
  }),
130
130
  });
131
131
  }
@@ -157,9 +157,9 @@ export class MessengerService {
157
157
  'Content-Type': 'application/json',
158
158
  Authorization: `Bearer ${this.api.sessionToken}`,
159
159
  },
160
- body: JSON.stringify({
160
+ body: JSON.stringify({
161
161
  content: data.content,
162
- attachments: data.attachments || []
162
+ attachments: data.attachments || [],
163
163
  }),
164
164
  }
165
165
  );
@@ -276,4 +276,4 @@ export class MessengerService {
276
276
  }
277
277
  );
278
278
  }
279
- }
279
+ }
@@ -76,22 +76,37 @@ export class APIService extends BaseAPIService {
76
76
 
77
77
  async startConversation(data) {
78
78
  if (!this.isSessionValid()) {
79
- console.log('[APIService] startConversation: session invalid, calling init...');
79
+ console.log(
80
+ '[APIService] startConversation: session invalid, calling init...'
81
+ );
80
82
  try {
81
83
  await this.init();
82
- console.log('[APIService] startConversation: init result, token:', this.sessionToken ? 'set' : 'null');
84
+ console.log(
85
+ '[APIService] startConversation: init result, token:',
86
+ this.sessionToken ? 'set' : 'null'
87
+ );
83
88
  } catch (initError) {
84
- console.error('[APIService] startConversation: init failed:', initError.message);
89
+ console.error(
90
+ '[APIService] startConversation: init failed:',
91
+ initError.message
92
+ );
85
93
  throw initError;
86
94
  }
87
95
  }
88
96
 
89
97
  if (!this.sessionToken) {
90
- console.error('[APIService] startConversation: no session token after init');
98
+ console.error(
99
+ '[APIService] startConversation: no session token after init'
100
+ );
91
101
  throw new APIError(401, 'No valid session token available');
92
102
  }
93
103
 
94
- console.log('[APIService] startConversation: sending to', `${this.baseURL}/widget/messenger/conversations`, 'mock:', this.mock);
104
+ console.log(
105
+ '[APIService] startConversation: sending to',
106
+ `${this.baseURL}/widget/messenger/conversations`,
107
+ 'mock:',
108
+ this.mock
109
+ );
95
110
 
96
111
  if (this.mock) {
97
112
  await new Promise((resolve) => setTimeout(resolve, 300));
@@ -154,14 +169,17 @@ export class APIService extends BaseAPIService {
154
169
  payload.attachments = data.attachments;
155
170
  }
156
171
 
157
- return this._makeRequest(`/widget/messenger/conversations/${conversationId}/messages`, {
158
- method: 'POST',
159
- headers: {
160
- 'Content-Type': 'application/json',
161
- Authorization: `Bearer ${this.sessionToken}`,
162
- },
163
- body: JSON.stringify(payload),
164
- });
172
+ return this._makeRequest(
173
+ `/widget/messenger/conversations/${conversationId}/messages`,
174
+ {
175
+ method: 'POST',
176
+ headers: {
177
+ 'Content-Type': 'application/json',
178
+ Authorization: `Bearer ${this.sessionToken}`,
179
+ },
180
+ body: JSON.stringify(payload),
181
+ }
182
+ );
165
183
  }
166
184
 
167
185
  /**
@@ -228,7 +246,8 @@ export class APIService extends BaseAPIService {
228
246
  const sessionData = JSON.parse(stored);
229
247
 
230
248
  // Invalidate mock tokens when not in mock mode (and vice versa)
231
- const isMockToken = sessionData.token && sessionData.token.startsWith('mock_');
249
+ const isMockToken =
250
+ sessionData.token && sessionData.token.startsWith('mock_');
232
251
  if (isMockToken !== this.mock) {
233
252
  localStorage.removeItem('feedbackSDK_session');
234
253
  return false;
package/src/index.js CHANGED
@@ -194,4 +194,4 @@ export {
194
194
  ValidationError,
195
195
  WidgetError,
196
196
  WidgetFactory,
197
- };
197
+ };
@@ -47,4 +47,4 @@ export const baseStyles = `
47
47
  display: none !important;
48
48
  }
49
49
  }
50
- `;
50
+ `;
@@ -75,6 +75,10 @@ export const changelogStyles = `
75
75
  border: 2px solid var(--color-white);
76
76
  }
77
77
 
78
+ /* ========================================
79
+ CONFETTI
80
+ ======================================== */
81
+
78
82
  .changelog-confetti-container {
79
83
  position: fixed;
80
84
  top: 0;
@@ -107,6 +111,10 @@ export const changelogStyles = `
107
111
  }
108
112
  }
109
113
 
114
+ /* ========================================
115
+ POPUP MODAL
116
+ ======================================== */
117
+
110
118
  .changelog-modal {
111
119
  position: fixed;
112
120
  top: 0;
@@ -134,7 +142,7 @@ export const changelogStyles = `
134
142
  background: #DBEAFE;
135
143
  border-radius: var(--radius-4xl);
136
144
  overflow: hidden;
137
- box-shadow: var(--shadow-2xl);
145
+ box-shadow: rgba(50, 50, 93, 0.25) 0px 2px 5px -1px, rgba(0, 0, 0, 0.3) 0px 1px 3px -1px;
138
146
  transform: scale(0.95) translateY(20px);
139
147
  opacity: 0;
140
148
  transition: all var(--transition-slow);
@@ -205,6 +213,10 @@ export const changelogStyles = `
205
213
  font-size: var(--font-size-md);
206
214
  }
207
215
 
216
+ /* ========================================
217
+ POPUP ITEM
218
+ ======================================== */
219
+
208
220
  .changelog-popup-item {
209
221
  display: flex;
210
222
  flex-direction: column;
@@ -231,16 +243,16 @@ export const changelogStyles = `
231
243
  }
232
244
 
233
245
  .changelog-popup-title {
234
- margin: 0 0 var(--spacing-4);
246
+ margin: 0 0 var(--spacing-3);
235
247
  font-size: var(--font-size-xl);
236
- font-weight: var(--font-weight-semibold);
248
+ font-weight: var(--font-weight-bold);
237
249
  line-height: var(--line-height-snug);
238
250
  color: var(--color-neutral-900);
239
251
  }
240
252
 
241
253
  .changelog-popup-description {
242
254
  margin: 0 0 var(--spacing-6);
243
- font-size: 17px;
255
+ font-size: var(--font-size-md);
244
256
  line-height: var(--line-height-loose);
245
257
  color: var(--color-neutral-600);
246
258
  }
@@ -249,15 +261,16 @@ export const changelogStyles = `
249
261
  display: inline-flex;
250
262
  align-items: center;
251
263
  justify-content: center;
252
- padding: 14px var(--spacing-8);
253
- font-size: var(--font-size-lg);
264
+ padding: var(--spacing-3) var(--spacing-8);
265
+ font-size: var(--font-size-base);
254
266
  font-weight: var(--font-weight-semibold);
255
267
  color: var(--color-white);
256
268
  background: var(--color-primary);
257
- border: none;
258
- border-radius: var(--radius-lg);
269
+ border: 1px solid var(--color-primary);
270
+ border-radius: var(--radius-md);
259
271
  cursor: pointer;
260
272
  transition: all var(--transition-base);
273
+ font-family: inherit;
261
274
  }
262
275
 
263
276
  .changelog-popup-btn:hover {
@@ -271,6 +284,10 @@ export const changelogStyles = `
271
284
  outline-offset: 2px;
272
285
  }
273
286
 
287
+ /* ========================================
288
+ POPUP FOOTER / DOTS
289
+ ======================================== */
290
+
274
291
  .changelog-popup-footer {
275
292
  padding: 0 var(--spacing-8) var(--spacing-6);
276
293
  display: flex;
@@ -285,8 +302,8 @@ export const changelogStyles = `
285
302
  }
286
303
 
287
304
  .changelog-dot {
288
- width: 10px;
289
- height: 10px;
305
+ width: 8px;
306
+ height: 8px;
290
307
  border-radius: var(--radius-full);
291
308
  background: var(--color-primary-border);
292
309
  cursor: pointer;
@@ -313,8 +330,9 @@ export const changelogStyles = `
313
330
  font-weight: var(--font-weight-medium);
314
331
  cursor: pointer;
315
332
  padding: var(--spacing-2) var(--spacing-3);
316
- border-radius: var(--radius-sm);
333
+ border-radius: var(--radius-md);
317
334
  transition: all var(--transition-base);
335
+ font-family: inherit;
318
336
  }
319
337
 
320
338
  .changelog-view-all-btn:hover {
@@ -329,6 +347,10 @@ export const changelogStyles = `
329
347
  transform: translateX(3px);
330
348
  }
331
349
 
350
+ /* ========================================
351
+ LIST MODAL
352
+ ======================================== */
353
+
332
354
  .changelog-list-modal {
333
355
  position: fixed;
334
356
  top: 0;
@@ -354,9 +376,9 @@ export const changelogStyles = `
354
376
  max-width: 460px;
355
377
  max-height: 85vh;
356
378
  background: var(--color-white);
357
- border-radius: var(--radius-3xl);
379
+ border-radius: var(--radius-2xl);
358
380
  overflow: hidden;
359
- box-shadow: var(--shadow-2xl);
381
+ box-shadow: rgba(50, 50, 93, 0.25) 0px 2px 5px -1px, rgba(0, 0, 0, 0.3) 0px 1px 3px -1px;
360
382
  transform: scale(0.95) translateY(20px);
361
383
  opacity: 0;
362
384
  transition: all var(--transition-slow);
@@ -373,7 +395,7 @@ export const changelogStyles = `
373
395
  display: flex;
374
396
  align-items: center;
375
397
  justify-content: space-between;
376
- padding: 14px var(--spacing-5);
398
+ padding: var(--spacing-4) var(--spacing-5);
377
399
  border-bottom: 1px solid var(--color-border);
378
400
  flex-shrink: 0;
379
401
  background: var(--color-white);
@@ -389,7 +411,6 @@ export const changelogStyles = `
389
411
  .changelog-list-modal-close {
390
412
  background: none;
391
413
  border: none;
392
- font-size: 22px;
393
414
  cursor: pointer;
394
415
  color: var(--color-neutral-500);
395
416
  padding: var(--spacing-1);
@@ -398,9 +419,8 @@ export const changelogStyles = `
398
419
  display: flex;
399
420
  align-items: center;
400
421
  justify-content: center;
401
- border-radius: var(--radius-sm);
422
+ border-radius: var(--radius-md);
402
423
  transition: all var(--transition-base);
403
- line-height: 1;
404
424
  }
405
425
 
406
426
  .changelog-list-modal-close:hover {
@@ -413,6 +433,10 @@ export const changelogStyles = `
413
433
  overflow-y: auto;
414
434
  }
415
435
 
436
+ /* ========================================
437
+ LIST ITEMS
438
+ ======================================== */
439
+
416
440
  .changelog-list {
417
441
  display: flex;
418
442
  flex-direction: column;
@@ -420,13 +444,11 @@ export const changelogStyles = `
420
444
 
421
445
  .changelog-list-item {
422
446
  display: flex;
423
- flex-direction: row;
424
447
  align-items: center;
425
- padding: var(--spacing-3) var(--spacing-4);
448
+ padding: var(--spacing-3) var(--spacing-5);
426
449
  border-bottom: 1px solid var(--color-border);
427
450
  cursor: pointer;
428
- transition: background-color var(--transition-base);
429
- position: relative;
451
+ transition: background var(--transition-base);
430
452
  }
431
453
 
432
454
  .changelog-list-item:hover {
@@ -440,7 +462,7 @@ export const changelogStyles = `
440
462
  .changelog-list-item-image {
441
463
  width: 100%;
442
464
  margin-bottom: var(--spacing-2);
443
- border-radius: var(--radius-sm);
465
+ border-radius: var(--radius-md);
444
466
  overflow: hidden;
445
467
  border: 1px solid var(--color-border);
446
468
  }
@@ -465,7 +487,7 @@ export const changelogStyles = `
465
487
 
466
488
  .changelog-list-item-date {
467
489
  font-size: var(--font-size-xs);
468
- color: var(--color-neutral-500);
490
+ color: var(--color-text-tertiary);
469
491
  font-weight: var(--font-weight-medium);
470
492
  }
471
493
 
@@ -488,7 +510,7 @@ export const changelogStyles = `
488
510
  margin: 0;
489
511
  font-size: var(--font-size-sm);
490
512
  line-height: var(--line-height-normal);
491
- color: var(--color-neutral-500);
513
+ color: var(--color-text-secondary);
492
514
  display: -webkit-box;
493
515
  -webkit-line-clamp: 2;
494
516
  -webkit-box-orient: vertical;
@@ -507,6 +529,10 @@ export const changelogStyles = `
507
529
  transform: translateX(3px);
508
530
  }
509
531
 
532
+ /* ========================================
533
+ RESPONSIVE
534
+ ======================================== */
535
+
510
536
  @media (max-width: 768px) {
511
537
  .changelog-widget {
512
538
  bottom: var(--spacing-4);
@@ -523,7 +549,7 @@ export const changelogStyles = `
523
549
 
524
550
  .changelog-modal-container {
525
551
  max-width: 100%;
526
- border-radius: var(--spacing-5);
552
+ border-radius: var(--radius-3xl);
527
553
  }
528
554
 
529
555
  .changelog-popup-image {
@@ -535,16 +561,16 @@ export const changelogStyles = `
535
561
  }
536
562
 
537
563
  .changelog-popup-title {
538
- font-size: 22px;
564
+ font-size: var(--font-size-xl);
539
565
  }
540
566
 
541
567
  .changelog-popup-description {
542
- font-size: var(--font-size-md);
568
+ font-size: var(--font-size-base);
543
569
  }
544
570
 
545
571
  .changelog-popup-btn {
546
- padding: var(--spacing-3) 28px;
547
- font-size: var(--font-size-md);
572
+ padding: var(--spacing-3) var(--spacing-7);
573
+ font-size: var(--font-size-base);
548
574
  width: 100%;
549
575
  }
550
576
 
@@ -559,23 +585,15 @@ export const changelogStyles = `
559
585
  .changelog-list-modal-container {
560
586
  max-width: 100%;
561
587
  max-height: 90vh;
562
- border-radius: var(--spacing-4);
588
+ border-radius: var(--radius-2xl);
563
589
  }
564
590
 
565
591
  .changelog-list-item {
566
- padding: 10px 14px;
592
+ padding: var(--spacing-3) var(--spacing-4);
567
593
  }
568
594
 
569
595
  .changelog-list-item-image img {
570
596
  height: 80px;
571
597
  }
572
-
573
- .changelog-list-item-title {
574
- font-size: var(--font-size-sm);
575
- }
576
-
577
- .changelog-list-item-description {
578
- font-size: var(--font-size-xs);
579
- }
580
598
  }
581
- `;
599
+ `;
@@ -27,6 +27,10 @@ export const componentsStyles = `
27
27
  .sdk-btn-primary {
28
28
  background: var(--color-primary);
29
29
  color: var(--color-white);
30
+ border: 1px solid var(--color-primary);
31
+ border-radius: var(--radius-md);
32
+ font-size: var(--font-size-base);
33
+ font-weight: var(--font-weight-medium);
30
34
  height: 44px;
31
35
  padding: 10px 18px;
32
36
  }
@@ -84,10 +88,23 @@ export const componentsStyles = `
84
88
  }
85
89
 
86
90
  .sdk-btn-icon {
91
+ display: flex;
92
+ align-items: center;
93
+ justify-content: center;
87
94
  width: 36px;
88
95
  height: 36px;
89
- padding: 0;
96
+ border: none;
97
+ background: none;
90
98
  border-radius: var(--radius-md);
99
+ cursor: pointer;
100
+ color: var(--color-text-secondary);
101
+ transition: all var(--transition-base);
102
+ padding: 0;
103
+ }
104
+
105
+ .sdk-btn-icon:hover {
106
+ background: var(--color-neutral-100);
107
+ color: var(--color-text-primary);
91
108
  }
92
109
 
93
110
  .sdk-input {
@@ -486,4 +503,4 @@ export const componentsStyles = `
486
503
  min-width: auto;
487
504
  }
488
505
  }
489
- `;
506
+ `;
@@ -38,8 +38,8 @@ export const designTokens = `
38
38
  --color-surface: #F9FAFB;
39
39
  --color-border: #E5E7EB;
40
40
  --color-text-primary: #111827;
41
- --color-text-secondary: #6B7280;
42
- --color-text-tertiary: #9CA3AF;
41
+ --color-text-secondary: #4B5563;
42
+ --color-text-tertiary: #6B7280;
43
43
 
44
44
  --spacing-1: 4px;
45
45
  --spacing-2: 8px;
@@ -61,7 +61,7 @@ export const designTokens = `
61
61
  --font-size-2xl: 20px;
62
62
  --font-size-3xl: 24px;
63
63
 
64
- --font-weight-normal: 400;
64
+ --font-weight-normal: 450;
65
65
  --font-weight-medium: 500;
66
66
  --font-weight-semibold: 600;
67
67
  --font-weight-bold: 700;
@@ -101,4 +101,4 @@ export const designTokens = `
101
101
  --z-tooltip: 1000001;
102
102
  --z-notification: 1000002;
103
103
  }
104
- `;
104
+ `;
@@ -136,15 +136,14 @@ export const feedbackStyles = `
136
136
  display: flex;
137
137
  flex-direction: column;
138
138
  border-radius: var(--radius-2xl);
139
- box-shadow: var(--shadow-xl);
140
- border: 1px solid var(--color-border);
139
+ box-shadow: rgba(50, 50, 93, 0.25) 0px 2px 5px -1px, rgba(0, 0, 0, 0.3) 0px 1px 3px -1px;
141
140
  }
142
141
 
143
142
  .feedback-panel-header {
144
143
  display: flex;
145
144
  align-items: center;
146
145
  justify-content: space-between;
147
- padding: var(--spacing-6);
146
+ padding: var(--spacing-4) var(--spacing-6);
148
147
  border-bottom: 1px solid var(--color-border);
149
148
  flex-shrink: 0;
150
149
  }
@@ -232,10 +231,6 @@ export const feedbackStyles = `
232
231
  transform: translateY(0);
233
232
  }
234
233
 
235
- .feedback-panel-content {
236
- border-radius: var(--radius-3xl) var(--radius-3xl) 0 0;
237
- }
238
-
239
234
  .feedback-panel-header {
240
235
  padding: var(--spacing-5);
241
236
  position: relative;
@@ -261,4 +256,4 @@ export const feedbackStyles = `
261
256
  min-height: 150px;
262
257
  }
263
258
  }
264
- `;
259
+ `;