@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 +26 -6
- package/dist/README.md +26 -6
- package/dist/feedback-sdk.js +22 -16
- package/dist/feedback-sdk.js.map +1 -1
- package/dist/feedback-sdk.min.js +1 -1
- package/dist/feedback-sdk.min.js.map +1 -1
- package/package.json +1 -1
- package/src/docs/framework-integrations.md +10 -4
- package/src/styles/survey.js +10 -0
- package/src/widgets/SurveyWidget.js +12 -16
- package/types/index.d.ts +9 -0
package/package.json
CHANGED
|
@@ -639,10 +639,16 @@ const survey = sdk.createWidget('survey', {
|
|
|
639
639
|
surveyType: 'nps',
|
|
640
640
|
position: 'center',
|
|
641
641
|
theme: 'light',
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
642
|
+
description:
|
|
643
|
+
'To what extent do you agree or disagree that our tools support the work you do?',
|
|
644
|
+
ratingScale: 5,
|
|
645
|
+
showTitle: false,
|
|
646
|
+
showDescription: true,
|
|
647
|
+
showFeedbackInput: false,
|
|
648
|
+
showSubmitButton: false,
|
|
649
|
+
autoSubmitOnSelect: true,
|
|
650
|
+
lowLabel: 'Strongly Disagree',
|
|
651
|
+
highLabel: 'Strongly Agree',
|
|
646
652
|
onSubmit: (response) => {
|
|
647
653
|
console.log('Survey submitted:', response);
|
|
648
654
|
// Optional: send to analytics
|
package/src/styles/survey.js
CHANGED
|
@@ -266,6 +266,11 @@ export const surveyStyles = `
|
|
|
266
266
|
box-shadow: inset 0 0 0 2px var(--color-primary);
|
|
267
267
|
}
|
|
268
268
|
|
|
269
|
+
.feedback-survey-rating-scale-compact .feedback-survey-rating-scale-btn {
|
|
270
|
+
min-height: 50px;
|
|
271
|
+
font-size: clamp(12px, 2vw, 16px);
|
|
272
|
+
}
|
|
273
|
+
|
|
269
274
|
.feedback-survey-labels {
|
|
270
275
|
display: flex;
|
|
271
276
|
justify-content: space-between;
|
|
@@ -540,6 +545,11 @@ export const surveyStyles = `
|
|
|
540
545
|
font-size: clamp(14px, 6vw, 18px);
|
|
541
546
|
}
|
|
542
547
|
|
|
548
|
+
.feedback-survey-rating-scale-compact .feedback-survey-rating-scale-btn {
|
|
549
|
+
min-height: 44px;
|
|
550
|
+
font-size: clamp(11px, 3.7vw, 14px);
|
|
551
|
+
}
|
|
552
|
+
|
|
543
553
|
.feedback-survey-rating-scale + .feedback-survey-labels {
|
|
544
554
|
font-size: var(--font-size-xs);
|
|
545
555
|
}
|
|
@@ -151,13 +151,11 @@ export class SurveyWidget extends BaseWidget {
|
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
const npsScale = this._getNPSScale();
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
? 'feedback-survey-nps-btn feedback-survey-ces-btn feedback-survey-rating-scale-btn'
|
|
160
|
-
: 'feedback-survey-nps-btn';
|
|
154
|
+
const npsCompactClass =
|
|
155
|
+
npsScale.values.length > 7 ? ' feedback-survey-rating-scale-compact' : '';
|
|
156
|
+
const npsContainerClass = `feedback-survey-rating-scale${npsCompactClass}`;
|
|
157
|
+
const npsButtonClass =
|
|
158
|
+
'feedback-survey-nps-btn feedback-survey-rating-scale-btn';
|
|
161
159
|
const npsLowLabel =
|
|
162
160
|
this.surveyOptions.lowLabel ||
|
|
163
161
|
(npsScale.start === 0 ? 'Not likely' : 'Strongly Disagree');
|
|
@@ -417,13 +415,11 @@ export class SurveyWidget extends BaseWidget {
|
|
|
417
415
|
{ length: npsScale },
|
|
418
416
|
(_, index) => start + index
|
|
419
417
|
);
|
|
420
|
-
const
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
? 'feedback-survey-page-rating-btn feedback-survey-nps-btn feedback-survey-ces-btn feedback-survey-rating-scale-btn'
|
|
426
|
-
: 'feedback-survey-page-rating-btn feedback-survey-nps-btn';
|
|
418
|
+
const compactClass =
|
|
419
|
+
values.length > 7 ? ' feedback-survey-rating-scale-compact' : '';
|
|
420
|
+
const containerClass = `feedback-survey-rating-scale${compactClass}`;
|
|
421
|
+
const buttonClass =
|
|
422
|
+
'feedback-survey-page-rating-btn feedback-survey-nps-btn feedback-survey-rating-scale-btn';
|
|
427
423
|
return `
|
|
428
424
|
<div class="${containerClass}" data-page-id="${pageId}">
|
|
429
425
|
${values
|
|
@@ -460,12 +456,12 @@ export class SurveyWidget extends BaseWidget {
|
|
|
460
456
|
}
|
|
461
457
|
|
|
462
458
|
return `
|
|
463
|
-
<div class="feedback-survey-
|
|
459
|
+
<div class="feedback-survey-rating-scale" data-page-id="${pageId}">
|
|
464
460
|
${[...Array(scale).keys()]
|
|
465
461
|
.map((i) => {
|
|
466
462
|
const score = i + 1;
|
|
467
463
|
const selected = currentRating === score ? ' selected' : '';
|
|
468
|
-
return `<button class="feedback-survey-page-rating-btn feedback-survey-
|
|
464
|
+
return `<button class="feedback-survey-page-rating-btn feedback-survey-rating-scale-btn${selected}" data-page-id="${pageId}" data-score="${score}">${score}</button>`;
|
|
469
465
|
})
|
|
470
466
|
.join('')}
|
|
471
467
|
</div>
|
package/types/index.d.ts
CHANGED
|
@@ -114,6 +114,12 @@ declare module '@product7/feedback-sdk' {
|
|
|
114
114
|
description?: string | null;
|
|
115
115
|
lowLabel?: string | null;
|
|
116
116
|
highLabel?: string | null;
|
|
117
|
+
ratingScale?: number | null;
|
|
118
|
+
showFeedbackInput?: boolean | null;
|
|
119
|
+
showSubmitButton?: boolean | null;
|
|
120
|
+
autoSubmitOnSelect?: boolean | null;
|
|
121
|
+
showTitle?: boolean | null;
|
|
122
|
+
showDescription?: boolean | null;
|
|
117
123
|
customQuestions?: SurveyQuestion[];
|
|
118
124
|
pages?: SurveyPage[];
|
|
119
125
|
respondentId?: string | null;
|
|
@@ -132,6 +138,9 @@ declare module '@product7/feedback-sdk' {
|
|
|
132
138
|
score: number | null;
|
|
133
139
|
feedback: string;
|
|
134
140
|
customAnswers: Record<string, any>;
|
|
141
|
+
pageAnswers?: Record<string, any>;
|
|
142
|
+
currentPageIndex?: number;
|
|
143
|
+
isSubmitting?: boolean;
|
|
135
144
|
isVisible: boolean;
|
|
136
145
|
};
|
|
137
146
|
}
|