@product7/feedback-sdk 1.5.4 → 1.5.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@product7/feedback-sdk",
3
- "version": "1.5.4",
3
+ "version": "1.5.7",
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",
@@ -147,6 +147,16 @@ export class FeedbackSDK {
147
147
  description: surveyConfig.description,
148
148
  lowLabel: surveyConfig.lowLabel || surveyConfig.low_label,
149
149
  highLabel: surveyConfig.highLabel || surveyConfig.high_label,
150
+ ratingScale: surveyConfig.ratingScale ?? surveyConfig.rating_scale,
151
+ showFeedbackInput:
152
+ surveyConfig.showFeedbackInput ?? surveyConfig.show_feedback_input,
153
+ showSubmitButton:
154
+ surveyConfig.showSubmitButton ?? surveyConfig.show_submit_button,
155
+ autoSubmitOnSelect:
156
+ surveyConfig.autoSubmitOnSelect ?? surveyConfig.auto_submit_on_select,
157
+ showTitle: surveyConfig.showTitle ?? surveyConfig.show_title,
158
+ showDescription:
159
+ surveyConfig.showDescription ?? surveyConfig.show_description,
150
160
  customQuestions: surveyConfig.customQuestions || surveyConfig.questions,
151
161
  pages: surveyConfig.pages,
152
162
  ...displayOptions,
@@ -173,13 +183,20 @@ export class FeedbackSDK {
173
183
 
174
184
  const surveyWidget = this.createWidget('survey', {
175
185
  surveyId: normalizedOptions.surveyId,
176
- surveyType: normalizedOptions.surveyType || normalizedOptions.type || 'nps',
186
+ surveyType:
187
+ normalizedOptions.surveyType || normalizedOptions.type || 'nps',
177
188
  position: normalizedOptions.position || 'bottom-right',
178
189
  theme: normalizedOptions.theme || this.config.theme || 'light',
179
190
  title: normalizedOptions.title,
180
191
  description: normalizedOptions.description,
181
192
  lowLabel: normalizedOptions.lowLabel,
182
193
  highLabel: normalizedOptions.highLabel,
194
+ ratingScale: normalizedOptions.ratingScale ?? normalizedOptions.scale,
195
+ showFeedbackInput: normalizedOptions.showFeedbackInput,
196
+ showSubmitButton: normalizedOptions.showSubmitButton,
197
+ autoSubmitOnSelect: normalizedOptions.autoSubmitOnSelect,
198
+ showTitle: normalizedOptions.showTitle,
199
+ showDescription: normalizedOptions.showDescription,
183
200
  customQuestions: normalizedOptions.customQuestions,
184
201
  pages: normalizedOptions.pages,
185
202
  respondentId: normalizedOptions.respondentId,
@@ -195,7 +212,10 @@ export class FeedbackSDK {
195
212
  }
196
213
 
197
214
  _isSurveyEligible(survey = {}) {
198
- const shouldShow = this._getSurveyField(survey, ['shouldShow', 'should_show']);
215
+ const shouldShow = this._getSurveyField(survey, [
216
+ 'shouldShow',
217
+ 'should_show',
218
+ ]);
199
219
  if (typeof shouldShow === 'boolean') {
200
220
  return shouldShow;
201
221
  }
@@ -217,7 +237,10 @@ export class FeedbackSDK {
217
237
  return eligible;
218
238
  }
219
239
 
220
- const isAnswered = this._getSurveyField(survey, ['isAnswered', 'is_answered']);
240
+ const isAnswered = this._getSurveyField(survey, [
241
+ 'isAnswered',
242
+ 'is_answered',
243
+ ]);
221
244
  if (typeof isAnswered === 'boolean') {
222
245
  return !isAnswered;
223
246
  }
@@ -252,7 +275,10 @@ export class FeedbackSDK {
252
275
  return eligibilityReason;
253
276
  }
254
277
 
255
- const isAnswered = this._getSurveyField(survey, ['isAnswered', 'is_answered']);
278
+ const isAnswered = this._getSurveyField(survey, [
279
+ 'isAnswered',
280
+ 'is_answered',
281
+ ]);
256
282
  if (isAnswered === true) {
257
283
  return 'already_answered';
258
284
  }
@@ -261,17 +287,16 @@ export class FeedbackSDK {
261
287
  }
262
288
 
263
289
  _normalizeSurveyConfig(survey = {}) {
264
- const firstPage = Array.isArray(survey.pages) && survey.pages.length > 0
265
- ? survey.pages[0]
266
- : null;
290
+ const firstPage =
291
+ Array.isArray(survey.pages) && survey.pages.length > 0
292
+ ? survey.pages[0]
293
+ : null;
267
294
  const ratingConfig = firstPage
268
295
  ? firstPage.rating_config || firstPage.ratingConfig || {}
269
296
  : {};
270
297
 
271
298
  const inferredType =
272
- survey.type ||
273
- this._inferSurveyTypeFromPage(firstPage) ||
274
- 'nps';
299
+ survey.type || this._inferSurveyTypeFromPage(firstPage) || 'nps';
275
300
 
276
301
  return {
277
302
  ...survey,
@@ -285,22 +310,27 @@ export class FeedbackSDK {
285
310
  survey.reason ||
286
311
  (survey.eligibility ? survey.eligibility.reason : undefined),
287
312
  title:
288
- survey.title ||
289
- survey.name ||
290
- (firstPage ? firstPage.title : null),
313
+ survey.title || survey.name || (firstPage ? firstPage.title : null),
291
314
  description:
292
- survey.description ||
293
- (firstPage ? firstPage.description : null),
315
+ survey.description || (firstPage ? firstPage.description : null),
294
316
  lowLabel:
295
- survey.lowLabel ||
296
- survey.low_label ||
297
- ratingConfig.low_label ||
298
- null,
317
+ survey.lowLabel || survey.low_label || ratingConfig.low_label || null,
299
318
  highLabel:
300
319
  survey.highLabel ||
301
320
  survey.high_label ||
302
321
  ratingConfig.high_label ||
303
322
  null,
323
+ ratingScale:
324
+ survey.ratingScale ?? survey.rating_scale ?? ratingConfig.scale ?? null,
325
+ showFeedbackInput:
326
+ survey.showFeedbackInput ?? survey.show_feedback_input ?? null,
327
+ showSubmitButton:
328
+ survey.showSubmitButton ?? survey.show_submit_button ?? null,
329
+ autoSubmitOnSelect:
330
+ survey.autoSubmitOnSelect ?? survey.auto_submit_on_select ?? null,
331
+ showTitle: survey.showTitle ?? survey.show_title ?? null,
332
+ showDescription:
333
+ survey.showDescription ?? survey.show_description ?? null,
304
334
  customQuestions: survey.customQuestions || survey.questions || [],
305
335
  pages: this._normalizeSurveyPages(survey.pages || []),
306
336
  };
@@ -313,17 +343,17 @@ export class FeedbackSDK {
313
343
 
314
344
  return pages
315
345
  .map((page, index) => ({
316
- id: page.id || `page_${index}`,
317
- type: page.type || 'rating',
318
- title: page.title || '',
319
- description: page.description || '',
320
- required: page.required !== false,
321
- position: page.position ?? index,
322
- ratingConfig: page.ratingConfig || page.rating_config || null,
323
- multipleChoiceConfig:
324
- page.multipleChoiceConfig || page.multiple_choice_config || null,
325
- linkConfig: page.linkConfig || page.link_config || null,
326
- afterThisPage: page.afterThisPage || page.after_this_page || null,
346
+ id: page.id || `page_${index}`,
347
+ type: page.type || 'rating',
348
+ title: page.title || '',
349
+ description: page.description || '',
350
+ required: page.required !== false,
351
+ position: page.position ?? index,
352
+ ratingConfig: page.ratingConfig || page.rating_config || null,
353
+ multipleChoiceConfig:
354
+ page.multipleChoiceConfig || page.multiple_choice_config || null,
355
+ linkConfig: page.linkConfig || page.link_config || null,
356
+ afterThisPage: page.afterThisPage || page.after_this_page || null,
327
357
  }))
328
358
  .sort((a, b) => a.position - b.position);
329
359
  }
@@ -139,8 +139,8 @@ export const changelogStyles = `
139
139
  width: 100%;
140
140
  max-width: 580px;
141
141
  max-height: 90vh;
142
- background: #DBEAFE;
143
- border-radius: var(--radius-4xl);
142
+ background: var(--color-primary-light);
143
+ border-radius: 10px;
144
144
  overflow: hidden;
145
145
  box-shadow: rgba(50, 50, 93, 0.25) 0px 2px 5px -1px, rgba(0, 0, 0, 0.3) 0px 1px 3px -1px;
146
146
  transform: scale(0.95) translateY(20px);
@@ -157,28 +157,30 @@ export const changelogStyles = `
157
157
  position: absolute;
158
158
  top: var(--spacing-4);
159
159
  right: var(--spacing-4);
160
- background: rgba(255, 255, 255, 0.9);
160
+ background: none;
161
161
  border: none;
162
- font-size: 24px;
163
162
  cursor: pointer;
164
163
  color: var(--color-neutral-500);
165
164
  padding: 0;
166
- width: 36px;
167
- height: 36px;
165
+ width: 20px;
166
+ height: 20px;
168
167
  display: flex;
169
168
  align-items: center;
170
169
  justify-content: center;
171
- border-radius: var(--radius-full);
170
+ border-radius: 8px;
172
171
  transition: all var(--transition-base);
173
172
  line-height: 1;
174
173
  z-index: 10;
175
- box-shadow: var(--shadow-md);
176
174
  }
177
175
 
178
176
  .changelog-modal-close:hover {
179
- background: var(--color-white);
177
+ background: var(--color-neutral-100);
180
178
  color: var(--color-neutral-900);
181
- transform: scale(1.05);
179
+ }
180
+
181
+ .changelog-modal-close svg {
182
+ width: 18px;
183
+ height: 18px;
182
184
  }
183
185
 
184
186
  .changelog-modal-content {
@@ -232,7 +234,7 @@ export const changelogStyles = `
232
234
  height: auto;
233
235
  display: block;
234
236
  object-fit: cover;
235
- border-radius: var(--radius-xl);
237
+ border-radius: 8px;
236
238
  border: 2px solid var(--color-primary);
237
239
  box-shadow: 0 4px 20px rgba(21, 94, 239, 0.2);
238
240
  }
@@ -245,7 +247,7 @@ export const changelogStyles = `
245
247
  .changelog-popup-title {
246
248
  margin: 0 0 var(--spacing-3);
247
249
  font-size: var(--font-size-xl);
248
- font-weight: var(--font-weight-bold);
250
+ font-weight: var(--font-weight-semibold);
249
251
  line-height: var(--line-height-snug);
250
252
  color: var(--color-neutral-900);
251
253
  }
@@ -263,11 +265,11 @@ export const changelogStyles = `
263
265
  justify-content: center;
264
266
  padding: var(--spacing-3) var(--spacing-8);
265
267
  font-size: var(--font-size-base);
266
- font-weight: var(--font-weight-semibold);
268
+ font-weight: var(--font-weight-medium);
267
269
  color: var(--color-white);
268
270
  background: var(--color-primary);
269
271
  border: 1px solid var(--color-primary);
270
- border-radius: var(--radius-md);
272
+ border-radius: 8px;
271
273
  cursor: pointer;
272
274
  transition: all var(--transition-base);
273
275
  font-family: inherit;
@@ -330,7 +332,7 @@ export const changelogStyles = `
330
332
  font-weight: var(--font-weight-medium);
331
333
  cursor: pointer;
332
334
  padding: var(--spacing-2) var(--spacing-3);
333
- border-radius: var(--radius-md);
335
+ border-radius: 8px;
334
336
  transition: all var(--transition-base);
335
337
  font-family: inherit;
336
338
  }
@@ -376,7 +378,7 @@ export const changelogStyles = `
376
378
  max-width: 460px;
377
379
  max-height: 85vh;
378
380
  background: var(--color-white);
379
- border-radius: var(--radius-2xl);
381
+ border-radius: 10px;
380
382
  overflow: hidden;
381
383
  box-shadow: rgba(50, 50, 93, 0.25) 0px 2px 5px -1px, rgba(0, 0, 0, 0.3) 0px 1px 3px -1px;
382
384
  transform: scale(0.95) translateY(20px);
@@ -403,7 +405,7 @@ export const changelogStyles = `
403
405
 
404
406
  .changelog-list-modal-header h2 {
405
407
  margin: 0;
406
- font-size: var(--font-size-lg);
408
+ font-size: var(--font-size-md);
407
409
  font-weight: var(--font-weight-semibold);
408
410
  color: var(--color-text-primary);
409
411
  }
@@ -413,16 +415,21 @@ export const changelogStyles = `
413
415
  border: none;
414
416
  cursor: pointer;
415
417
  color: var(--color-neutral-500);
416
- padding: var(--spacing-1);
417
- width: 28px;
418
- height: 28px;
418
+ padding: 0;
419
+ width: 20px;
420
+ height: 20px;
419
421
  display: flex;
420
422
  align-items: center;
421
423
  justify-content: center;
422
- border-radius: var(--radius-md);
424
+ border-radius: 8px;
423
425
  transition: all var(--transition-base);
424
426
  }
425
427
 
428
+ .changelog-list-modal-close svg {
429
+ width: 18px;
430
+ height: 18px;
431
+ }
432
+
426
433
  .changelog-list-modal-close:hover {
427
434
  background: var(--color-neutral-100);
428
435
  color: var(--color-neutral-900);
@@ -462,7 +469,7 @@ export const changelogStyles = `
462
469
  .changelog-list-item-image {
463
470
  width: 100%;
464
471
  margin-bottom: var(--spacing-2);
465
- border-radius: var(--radius-md);
472
+ border-radius: 8px;
466
473
  overflow: hidden;
467
474
  border: 1px solid var(--color-border);
468
475
  }
@@ -549,7 +556,7 @@ export const changelogStyles = `
549
556
 
550
557
  .changelog-modal-container {
551
558
  max-width: 100%;
552
- border-radius: var(--radius-3xl);
559
+ border-radius: 10px;
553
560
  }
554
561
 
555
562
  .changelog-popup-image {
@@ -561,7 +568,7 @@ export const changelogStyles = `
561
568
  }
562
569
 
563
570
  .changelog-popup-title {
564
- font-size: var(--font-size-xl);
571
+ font-size: var(--font-size-lg);
565
572
  }
566
573
 
567
574
  .changelog-popup-description {
@@ -585,7 +592,7 @@ export const changelogStyles = `
585
592
  .changelog-list-modal-container {
586
593
  max-width: 100%;
587
594
  max-height: 90vh;
588
- border-radius: var(--radius-2xl);
595
+ border-radius: 10px;
589
596
  }
590
597
 
591
598
  .changelog-list-item {
@@ -4,7 +4,7 @@ export const componentsStyles = `
4
4
  align-items: center;
5
5
  justify-content: center;
6
6
  gap: var(--spacing-2);
7
- border-radius: var(--radius-md);
7
+ border-radius: 8px;
8
8
  border: none;
9
9
  font-size: var(--font-size-md);
10
10
  font-weight: var(--font-weight-medium);
@@ -28,7 +28,7 @@ export const componentsStyles = `
28
28
  background: var(--color-primary);
29
29
  color: var(--color-white);
30
30
  border: 1px solid var(--color-primary);
31
- border-radius: var(--radius-md);
31
+ border-radius: 8px;
32
32
  font-size: var(--font-size-base);
33
33
  font-weight: var(--font-weight-medium);
34
34
  height: 44px;
@@ -95,7 +95,7 @@ export const componentsStyles = `
95
95
  height: 36px;
96
96
  border: none;
97
97
  background: none;
98
- border-radius: var(--radius-md);
98
+ border-radius: 8px;
99
99
  cursor: pointer;
100
100
  color: var(--color-text-secondary);
101
101
  transition: all var(--transition-base);
@@ -110,7 +110,7 @@ export const componentsStyles = `
110
110
  .sdk-input {
111
111
  width: 100%;
112
112
  height: 44px;
113
- border-radius: var(--radius-md);
113
+ border-radius: 8px;
114
114
  border: 1px solid var(--color-border);
115
115
  padding: 10px 14px;
116
116
  font-size: var(--font-size-md);
@@ -141,7 +141,7 @@ export const componentsStyles = `
141
141
  width: 100%;
142
142
  min-height: 120px;
143
143
  resize: vertical;
144
- border-radius: var(--radius-md);
144
+ border-radius: 8px;
145
145
  border: 1px solid var(--color-border);
146
146
  padding: 10px 14px;
147
147
  font-size: var(--font-size-md);
@@ -166,7 +166,7 @@ export const componentsStyles = `
166
166
  .sdk-select {
167
167
  width: 100%;
168
168
  height: 44px;
169
- border-radius: var(--radius-md);
169
+ border-radius: 8px;
170
170
  border: 1px solid var(--color-border);
171
171
  padding: 10px 14px;
172
172
  font-size: var(--font-size-md);
@@ -204,7 +204,7 @@ export const componentsStyles = `
204
204
 
205
205
  .sdk-card {
206
206
  background: var(--color-white);
207
- border-radius: var(--radius-xl);
207
+ border-radius: 10px;
208
208
  box-shadow: var(--shadow-base);
209
209
  overflow: hidden;
210
210
  }
@@ -265,7 +265,7 @@ export const componentsStyles = `
265
265
  max-width: 580px;
266
266
  max-height: 90vh;
267
267
  background: var(--color-white);
268
- border-radius: var(--radius-4xl);
268
+ border-radius: 10px;
269
269
  overflow: hidden;
270
270
  box-shadow: var(--shadow-2xl);
271
271
  transform: scale(0.95) translateY(20px);
@@ -301,15 +301,18 @@ export const componentsStyles = `
301
301
  .sdk-close-btn {
302
302
  background: none;
303
303
  border: none;
304
- padding: var(--spacing-2);
304
+ padding: 0;
305
305
  cursor: pointer;
306
306
  color: var(--color-neutral-500);
307
307
  display: flex;
308
308
  align-items: center;
309
309
  justify-content: center;
310
- border-radius: var(--radius-md);
310
+ width: 20px;
311
+ height: 20px;
312
+ border-radius: 8px;
311
313
  transition: all var(--transition-base);
312
314
  line-height: 1;
315
+ flex-shrink: 0;
313
316
  }
314
317
 
315
318
  .sdk-close-btn:hover {
@@ -317,6 +320,11 @@ export const componentsStyles = `
317
320
  color: var(--color-neutral-900);
318
321
  }
319
322
 
323
+ .sdk-close-btn svg {
324
+ width: 18px;
325
+ height: 18px;
326
+ }
327
+
320
328
  .sdk-avatar {
321
329
  display: flex;
322
330
  align-items: center;
@@ -403,7 +411,7 @@ export const componentsStyles = `
403
411
  right: var(--spacing-6);
404
412
  z-index: var(--z-notification);
405
413
  background: var(--color-white);
406
- border-radius: var(--radius-xl);
414
+ border-radius: 10px;
407
415
  box-shadow: var(--shadow-lg);
408
416
  min-width: 320px;
409
417
  animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
@@ -493,7 +501,7 @@ export const componentsStyles = `
493
501
 
494
502
  .sdk-modal-container {
495
503
  max-width: 100%;
496
- border-radius: var(--spacing-5);
504
+ border-radius: 10px;
497
505
  }
498
506
 
499
507
  .sdk-notification {
@@ -141,7 +141,7 @@ export const feedbackStyles = `
141
141
  height: 100%;
142
142
  display: flex;
143
143
  flex-direction: column;
144
- border-radius: var(--radius-2xl);
144
+ border-radius: 10px;
145
145
  }
146
146
 
147
147
  .feedback-panel-header {
@@ -259,6 +259,17 @@ export const messengerComponentsStyles = `
259
259
  display: none;
260
260
  }
261
261
 
262
+ .messenger-compose-attach {
263
+ width: 28px;
264
+ height: 28px;
265
+ flex-shrink: 0;
266
+ }
267
+
268
+ .messenger-compose-attach svg {
269
+ width: 20px;
270
+ height: 20px;
271
+ }
272
+
262
273
  /* ========================================
263
274
  TYPING INDICATOR
264
275
  ======================================== */
@@ -288,17 +299,9 @@ export const messengerComponentsStyles = `
288
299
  animation: messenger-typing-bounce 1.4s infinite ease-in-out;
289
300
  }
290
301
 
291
- .messenger-typing-dots span:nth-child(1) {
292
- animation-delay: -0.32s;
293
- }
294
-
295
- .messenger-typing-dots span:nth-child(2) {
296
- animation-delay: -0.16s;
297
- }
298
-
299
- .messenger-typing-dots span:nth-child(3) {
300
- animation-delay: 0s;
301
- }
302
+ .messenger-typing-dots span:nth-child(1) { animation-delay: -0.32s; }
303
+ .messenger-typing-dots span:nth-child(2) { animation-delay: -0.16s; }
304
+ .messenger-typing-dots span:nth-child(3) { animation-delay: 0s; }
302
305
 
303
306
  .messenger-typing-text {
304
307
  font-size: var(--font-size-xs);
@@ -316,12 +319,12 @@ export const messengerComponentsStyles = `
316
319
 
317
320
  .messenger-nav-tabs {
318
321
  display: flex;
319
- padding: var(--spacing-1) var(--spacing-2);
322
+ padding: var(--spacing-1) var(--spacing-2) 0;
320
323
  gap: var(--spacing-1);
321
324
  }
322
325
 
323
326
  .messenger-nav-footer {
324
- padding: var(--spacing-1) var(--spacing-2);
327
+ padding: 2px var(--spacing-2) var(--spacing-2);
325
328
  text-align: center;
326
329
  }
327
330
 
@@ -353,12 +356,12 @@ export const messengerComponentsStyles = `
353
356
  display: flex;
354
357
  flex-direction: column;
355
358
  align-items: center;
356
- gap: 4px;
357
- padding: var(--spacing-2) var(--spacing-1);
359
+ gap: 2px;
360
+ padding: var(--spacing-1) var(--spacing-1);
358
361
  background: none;
359
362
  border: none;
360
363
  cursor: pointer;
361
- border-radius: var(--radius-md);
364
+ border-radius: 8px;
362
365
  transition: all var(--transition-base);
363
366
  position: relative;
364
367
  }
@@ -370,10 +373,21 @@ export const messengerComponentsStyles = `
370
373
  .messenger-nav-icon {
371
374
  color: var(--color-text-secondary);
372
375
  transition: color var(--transition-base);
376
+ display: flex;
377
+ align-items: center;
378
+ justify-content: center;
379
+ width: 20px;
380
+ height: 20px;
381
+ }
382
+
383
+ .messenger-nav-icon svg {
384
+ width: 20px;
385
+ height: 20px;
386
+ display: block;
373
387
  }
374
388
 
375
389
  .messenger-nav-label {
376
- font-size: var(--font-size-base);
390
+ font-size: var(--font-size-xs);
377
391
  font-weight: var(--font-weight-medium);
378
392
  color: var(--color-text-secondary);
379
393
  transition: color var(--transition-base);
@@ -425,7 +439,7 @@ export const messengerComponentsStyles = `
425
439
 
426
440
  .messenger-prechat-card {
427
441
  background: var(--color-white);
428
- border-radius: var(--radius-2xl);
442
+ border-radius: 10px;
429
443
  padding: var(--spacing-6);
430
444
  width: 100%;
431
445
  max-width: 360px;