@product7/feedback-sdk 1.5.8 → 1.6.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.
package/README.md CHANGED
@@ -542,7 +542,7 @@ The SDK includes a powerful survey widget for collecting structured user feedbac
542
542
 
543
543
  | Type | Description | Scale |
544
544
  | ---------- | --------------------- | ------------------------ |
545
- | **NPS** | Net Promoter Score | 0-10 numeric scale |
545
+ | **NPS** | Net Promoter Score | 1-5 numeric scale (default; configurable to 0-10) |
546
546
  | **CSAT** | Customer Satisfaction | 5-point emoji scale |
547
547
  | **CES** | Customer Effort Score | 5-level difficulty scale |
548
548
  | **Custom** | Multi-question forms | Flexible input types |
@@ -560,7 +560,14 @@ await feedback.init();
560
560
  // Show NPS survey
561
561
  feedback.showSurvey({
562
562
  surveyType: 'nps',
563
- title: 'How likely are you to recommend us?',
563
+ description:
564
+ 'To what extent do you agree or disagree that our tools support the work you do?',
565
+ ratingScale: 5,
566
+ showTitle: false,
567
+ showDescription: true,
568
+ showFeedbackInput: false,
569
+ showSubmitButton: false,
570
+ autoSubmitOnSelect: true,
564
571
  onSubmit: (response) => {
565
572
  console.log('Survey submitted:', response);
566
573
  },
@@ -577,6 +584,12 @@ feedback.showSurvey({
577
584
  theme: 'light', // 'light' | 'dark'
578
585
  title: 'Your survey title',
579
586
  description: 'Optional description',
587
+ ratingScale: 5, // NPS scale (default 5, set 11 for 0-10)
588
+ showTitle: false, // default false for single-step rating surveys
589
+ showDescription: true, // default true for single-step rating surveys
590
+ showFeedbackInput: false, // default false for single-step rating surveys
591
+ showSubmitButton: false, // default false for single-step rating surveys
592
+ autoSubmitOnSelect: true, // default true for single-step rating surveys
580
593
  lowLabel: 'Not likely', // Low end label (NPS/CES)
581
594
  highLabel: 'Very likely', // High end label (NPS/CES)
582
595
  customQuestions: [], // For custom surveys
@@ -639,12 +652,19 @@ const surveys = await feedback.getActiveSurveys({
639
652
  ```javascript
640
653
  feedback.showSurvey({
641
654
  surveyType: 'nps',
642
- title: 'How likely are you to recommend us to a friend?',
643
- lowLabel: 'Not at all likely',
644
- highLabel: 'Extremely likely',
655
+ description:
656
+ 'To what extent do you agree or disagree that our tools support the work you do?',
657
+ ratingScale: 5,
658
+ showTitle: false,
659
+ showDescription: true,
660
+ showFeedbackInput: false,
661
+ showSubmitButton: false,
662
+ autoSubmitOnSelect: true,
663
+ lowLabel: 'Strongly Disagree',
664
+ highLabel: 'Strongly Agree',
645
665
  position: 'bottom-right',
646
666
  onSubmit: (response) => {
647
- console.log('Score:', response.score); // 0-10
667
+ console.log('Score:', response.score); // 1-5 by default
648
668
  console.log('Feedback:', response.feedback);
649
669
  },
650
670
  });
package/dist/README.md CHANGED
@@ -542,7 +542,7 @@ The SDK includes a powerful survey widget for collecting structured user feedbac
542
542
 
543
543
  | Type | Description | Scale |
544
544
  | ---------- | --------------------- | ------------------------ |
545
- | **NPS** | Net Promoter Score | 0-10 numeric scale |
545
+ | **NPS** | Net Promoter Score | 1-5 numeric scale (default; configurable to 0-10) |
546
546
  | **CSAT** | Customer Satisfaction | 5-point emoji scale |
547
547
  | **CES** | Customer Effort Score | 5-level difficulty scale |
548
548
  | **Custom** | Multi-question forms | Flexible input types |
@@ -560,7 +560,14 @@ await feedback.init();
560
560
  // Show NPS survey
561
561
  feedback.showSurvey({
562
562
  surveyType: 'nps',
563
- title: 'How likely are you to recommend us?',
563
+ description:
564
+ 'To what extent do you agree or disagree that our tools support the work you do?',
565
+ ratingScale: 5,
566
+ showTitle: false,
567
+ showDescription: true,
568
+ showFeedbackInput: false,
569
+ showSubmitButton: false,
570
+ autoSubmitOnSelect: true,
564
571
  onSubmit: (response) => {
565
572
  console.log('Survey submitted:', response);
566
573
  },
@@ -577,6 +584,12 @@ feedback.showSurvey({
577
584
  theme: 'light', // 'light' | 'dark'
578
585
  title: 'Your survey title',
579
586
  description: 'Optional description',
587
+ ratingScale: 5, // NPS scale (default 5, set 11 for 0-10)
588
+ showTitle: false, // default false for single-step rating surveys
589
+ showDescription: true, // default true for single-step rating surveys
590
+ showFeedbackInput: false, // default false for single-step rating surveys
591
+ showSubmitButton: false, // default false for single-step rating surveys
592
+ autoSubmitOnSelect: true, // default true for single-step rating surveys
580
593
  lowLabel: 'Not likely', // Low end label (NPS/CES)
581
594
  highLabel: 'Very likely', // High end label (NPS/CES)
582
595
  customQuestions: [], // For custom surveys
@@ -639,12 +652,19 @@ const surveys = await feedback.getActiveSurveys({
639
652
  ```javascript
640
653
  feedback.showSurvey({
641
654
  surveyType: 'nps',
642
- title: 'How likely are you to recommend us to a friend?',
643
- lowLabel: 'Not at all likely',
644
- highLabel: 'Extremely likely',
655
+ description:
656
+ 'To what extent do you agree or disagree that our tools support the work you do?',
657
+ ratingScale: 5,
658
+ showTitle: false,
659
+ showDescription: true,
660
+ showFeedbackInput: false,
661
+ showSubmitButton: false,
662
+ autoSubmitOnSelect: true,
663
+ lowLabel: 'Strongly Disagree',
664
+ highLabel: 'Strongly Agree',
645
665
  position: 'bottom-right',
646
666
  onSubmit: (response) => {
647
- console.log('Score:', response.score); // 0-10
667
+ console.log('Score:', response.score); // 1-5 by default
648
668
  console.log('Feedback:', response.feedback);
649
669
  },
650
670
  });
@@ -6877,13 +6877,11 @@
6877
6877
  }
6878
6878
 
6879
6879
  const npsScale = this._getNPSScale();
6880
- const npsUsesSegmentedScale = npsScale.values.length <= 7;
6881
- const npsContainerClass = npsUsesSegmentedScale
6882
- ? 'feedback-survey-ces feedback-survey-rating-scale'
6883
- : 'feedback-survey-nps';
6884
- const npsButtonClass = npsUsesSegmentedScale
6885
- ? 'feedback-survey-nps-btn feedback-survey-ces-btn feedback-survey-rating-scale-btn'
6886
- : 'feedback-survey-nps-btn';
6880
+ const npsCompactClass =
6881
+ npsScale.values.length > 7 ? ' feedback-survey-rating-scale-compact' : '';
6882
+ const npsContainerClass = `feedback-survey-rating-scale${npsCompactClass}`;
6883
+ const npsButtonClass =
6884
+ 'feedback-survey-nps-btn feedback-survey-rating-scale-btn';
6887
6885
  const npsLowLabel =
6888
6886
  this.surveyOptions.lowLabel ||
6889
6887
  (npsScale.start === 0 ? 'Not likely' : 'Strongly Disagree');
@@ -7143,13 +7141,11 @@
7143
7141
  { length: npsScale },
7144
7142
  (_, index) => start + index
7145
7143
  );
7146
- const usesSegmentedScale = values.length <= 7;
7147
- const containerClass = usesSegmentedScale
7148
- ? 'feedback-survey-ces feedback-survey-rating-scale'
7149
- : 'feedback-survey-nps';
7150
- const buttonClass = usesSegmentedScale
7151
- ? 'feedback-survey-page-rating-btn feedback-survey-nps-btn feedback-survey-ces-btn feedback-survey-rating-scale-btn'
7152
- : 'feedback-survey-page-rating-btn feedback-survey-nps-btn';
7144
+ const compactClass =
7145
+ values.length > 7 ? ' feedback-survey-rating-scale-compact' : '';
7146
+ const containerClass = `feedback-survey-rating-scale${compactClass}`;
7147
+ const buttonClass =
7148
+ 'feedback-survey-page-rating-btn feedback-survey-nps-btn feedback-survey-rating-scale-btn';
7153
7149
  return `
7154
7150
  <div class="${containerClass}" data-page-id="${pageId}">
7155
7151
  ${values
@@ -7186,12 +7182,12 @@
7186
7182
  }
7187
7183
 
7188
7184
  return `
7189
- <div class="feedback-survey-ces feedback-survey-rating-scale" data-page-id="${pageId}">
7185
+ <div class="feedback-survey-rating-scale" data-page-id="${pageId}">
7190
7186
  ${[...Array(scale).keys()]
7191
7187
  .map((i) => {
7192
7188
  const score = i + 1;
7193
7189
  const selected = currentRating === score ? ' selected' : '';
7194
- return `<button class="feedback-survey-page-rating-btn feedback-survey-ces-btn feedback-survey-rating-scale-btn${selected}" data-page-id="${pageId}" data-score="${score}">${score}</button>`;
7190
+ return `<button class="feedback-survey-page-rating-btn feedback-survey-rating-scale-btn${selected}" data-page-id="${pageId}" data-score="${score}">${score}</button>`;
7195
7191
  })
7196
7192
  .join('')}
7197
7193
  </div>
@@ -11988,6 +11984,11 @@
11988
11984
  box-shadow: inset 0 0 0 2px var(--color-primary);
11989
11985
  }
11990
11986
 
11987
+ .feedback-survey-rating-scale-compact .feedback-survey-rating-scale-btn {
11988
+ min-height: 50px;
11989
+ font-size: clamp(12px, 2vw, 16px);
11990
+ }
11991
+
11991
11992
  .feedback-survey-labels {
11992
11993
  display: flex;
11993
11994
  justify-content: space-between;
@@ -12262,6 +12263,11 @@
12262
12263
  font-size: clamp(14px, 6vw, 18px);
12263
12264
  }
12264
12265
 
12266
+ .feedback-survey-rating-scale-compact .feedback-survey-rating-scale-btn {
12267
+ min-height: 44px;
12268
+ font-size: clamp(11px, 3.7vw, 14px);
12269
+ }
12270
+
12265
12271
  .feedback-survey-rating-scale + .feedback-survey-labels {
12266
12272
  font-size: var(--font-size-xs);
12267
12273
  }