@product7/feedback-sdk 1.7.5 → 1.7.6
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 +74 -27
- 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 +56 -9
- package/src/widgets/SurveyWidget.js +18 -18
package/package.json
CHANGED
package/src/styles/survey.js
CHANGED
|
@@ -33,6 +33,7 @@ export const surveyStyles = `
|
|
|
33
33
|
min-width: 320px;
|
|
34
34
|
max-width: 400px;
|
|
35
35
|
font-family: inherit;
|
|
36
|
+
overflow: hidden;
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
.feedback-survey-theme-dark {
|
|
@@ -250,11 +251,16 @@ export const surveyStyles = `
|
|
|
250
251
|
}
|
|
251
252
|
|
|
252
253
|
.feedback-survey-csat-btn:hover {
|
|
253
|
-
transform: scale(1.
|
|
254
|
+
transform: scale(1.15);
|
|
254
255
|
}
|
|
255
256
|
|
|
256
257
|
.feedback-survey-csat-btn.selected {
|
|
257
|
-
transform: scale(1.
|
|
258
|
+
transform: scale(1.5);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.feedback-survey-csat:has(.selected) .feedback-survey-csat-btn:not(.selected) {
|
|
262
|
+
transform: scale(0.8);
|
|
263
|
+
opacity: 0.35;
|
|
258
264
|
}
|
|
259
265
|
|
|
260
266
|
/* ========================================
|
|
@@ -560,18 +566,35 @@ export const surveyStyles = `
|
|
|
560
566
|
}
|
|
561
567
|
|
|
562
568
|
.feedback-survey-error {
|
|
563
|
-
|
|
569
|
+
position: absolute;
|
|
570
|
+
top: 0;
|
|
571
|
+
left: 0;
|
|
572
|
+
right: 0;
|
|
573
|
+
background: #FF9900;
|
|
574
|
+
color: #000;
|
|
564
575
|
font-size: var(--font-size-sm);
|
|
565
|
-
|
|
566
|
-
|
|
576
|
+
font-weight: var(--font-weight-medium);
|
|
577
|
+
padding: 10px 14px;
|
|
578
|
+
display: flex;
|
|
579
|
+
align-items: center;
|
|
580
|
+
gap: 8px;
|
|
581
|
+
z-index: 2;
|
|
567
582
|
}
|
|
568
583
|
|
|
569
|
-
.feedback-survey-
|
|
584
|
+
.feedback-survey-error svg {
|
|
585
|
+
width: 16px;
|
|
586
|
+
height: 16px;
|
|
587
|
+
flex-shrink: 0;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
/* ========================================
|
|
591
|
+
NOTIFICATION TOASTS
|
|
592
|
+
======================================== */
|
|
593
|
+
|
|
594
|
+
.feedback-sdk-notification {
|
|
570
595
|
position: fixed;
|
|
571
596
|
top: var(--spacing-6);
|
|
572
597
|
right: var(--spacing-6);
|
|
573
|
-
background: var(--color-success);
|
|
574
|
-
color: var(--color-white);
|
|
575
598
|
padding: var(--spacing-3) var(--spacing-5);
|
|
576
599
|
border-radius: var(--radius-xl);
|
|
577
600
|
font-size: var(--font-size-sm);
|
|
@@ -579,14 +602,38 @@ export const surveyStyles = `
|
|
|
579
602
|
z-index: var(--z-notification);
|
|
580
603
|
box-shadow: var(--shadow-lg);
|
|
581
604
|
font-family: inherit;
|
|
605
|
+
color: #fff;
|
|
582
606
|
}
|
|
583
607
|
|
|
584
|
-
.feedback-
|
|
608
|
+
.feedback-sdk-notification > div {
|
|
585
609
|
display: flex;
|
|
586
610
|
align-items: center;
|
|
587
611
|
gap: var(--spacing-2);
|
|
588
612
|
}
|
|
589
613
|
|
|
614
|
+
.feedback-sdk-notification svg {
|
|
615
|
+
width: 18px;
|
|
616
|
+
height: 18px;
|
|
617
|
+
flex-shrink: 0;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
.feedback-sdk-notification-success {
|
|
621
|
+
background: #037F0C;
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
.feedback-sdk-notification-error {
|
|
625
|
+
background: #D13212;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
.feedback-sdk-notification-warning {
|
|
629
|
+
background: #FF9900;
|
|
630
|
+
color: #000;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
.feedback-sdk-notification-info {
|
|
634
|
+
background: #0972D3;
|
|
635
|
+
}
|
|
636
|
+
|
|
590
637
|
/* ========================================
|
|
591
638
|
RESPONSIVE
|
|
592
639
|
======================================== */
|
|
@@ -58,7 +58,7 @@ export class SurveyWidget extends BaseWidget {
|
|
|
58
58
|
|
|
59
59
|
document
|
|
60
60
|
.querySelectorAll(
|
|
61
|
-
'.feedback-survey, .feedback-survey-backdrop, .feedback-survey-success'
|
|
61
|
+
'.feedback-survey, .feedback-survey-backdrop, .feedback-survey-success, .feedback-sdk-notification'
|
|
62
62
|
)
|
|
63
63
|
.forEach((el) => {
|
|
64
64
|
if (el && el.parentNode) {
|
|
@@ -414,8 +414,18 @@ export class SurveyWidget extends BaseWidget {
|
|
|
414
414
|
const pageId = page.id || `page_${this.surveyState.currentPageIndex}`;
|
|
415
415
|
const config = page.ratingConfig || page.rating_config || {};
|
|
416
416
|
const scale = Number(config.scale) || 5;
|
|
417
|
-
const
|
|
418
|
-
|
|
417
|
+
const topSurveyType = this.surveyOptions.surveyType;
|
|
418
|
+
const configType = config.survey_type;
|
|
419
|
+
let ratingType;
|
|
420
|
+
if (topSurveyType === 'ces') {
|
|
421
|
+
ratingType = 'ces';
|
|
422
|
+
} else if (topSurveyType === 'nps') {
|
|
423
|
+
ratingType = 'nps';
|
|
424
|
+
} else if (topSurveyType === 'csat' && !configType) {
|
|
425
|
+
ratingType = 'emoji';
|
|
426
|
+
} else {
|
|
427
|
+
ratingType = configType || topSurveyType || 'csat';
|
|
428
|
+
}
|
|
419
429
|
const pageAnswer = this.surveyState.pageAnswers[pageId] || {};
|
|
420
430
|
const currentRating = pageAnswer.rating;
|
|
421
431
|
const defaultLowLabel =
|
|
@@ -1182,30 +1192,20 @@ export class SurveyWidget extends BaseWidget {
|
|
|
1182
1192
|
|
|
1183
1193
|
const error = document.createElement('div');
|
|
1184
1194
|
error.className = 'feedback-survey-error';
|
|
1185
|
-
error.
|
|
1195
|
+
error.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><path d="M236.8,188.09,149.35,36a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM120,104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm8,88a12,12,0,1,1,12-12A12,12,0,0,1,128,192Z" fill="currentColor"/></svg><span>${message}</span>`;
|
|
1186
1196
|
|
|
1187
|
-
|
|
1188
|
-
'.feedback-survey-submit'
|
|
1189
|
-
);
|
|
1190
|
-
const actions = this.surveyElement.querySelector(
|
|
1191
|
-
'.feedback-survey-actions'
|
|
1192
|
-
);
|
|
1193
|
-
const anchor = submitBtn || actions;
|
|
1194
|
-
if (anchor && anchor.parentNode) {
|
|
1195
|
-
anchor.parentNode.insertBefore(error, anchor);
|
|
1196
|
-
} else {
|
|
1197
|
-
this.surveyElement.appendChild(error);
|
|
1198
|
-
}
|
|
1197
|
+
this.surveyElement.prepend(error);
|
|
1199
1198
|
|
|
1200
1199
|
setTimeout(() => error.remove(), 3000);
|
|
1201
1200
|
}
|
|
1202
1201
|
|
|
1203
1202
|
_showSuccessNotification() {
|
|
1204
1203
|
const notification = document.createElement('div');
|
|
1205
|
-
notification.className =
|
|
1204
|
+
notification.className =
|
|
1205
|
+
'feedback-sdk-notification feedback-sdk-notification-success';
|
|
1206
1206
|
notification.innerHTML = `
|
|
1207
1207
|
<div>
|
|
1208
|
-
<
|
|
1208
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><path d="M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z" fill="currentColor"/></svg>
|
|
1209
1209
|
<span>Thank you for your feedback!</span>
|
|
1210
1210
|
</div>
|
|
1211
1211
|
`;
|