@product7/feedback-sdk 1.5.9 → 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/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/styles/survey.js +10 -0
- package/src/widgets/SurveyWidget.js +12 -16
package/package.json
CHANGED
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>
|