@product7/feedback-sdk 1.7.5 → 1.7.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/dist/feedback-sdk.js +108 -29
- 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 +88 -9
- package/src/widgets/SurveyWidget.js +20 -20
package/dist/feedback-sdk.js
CHANGED
|
@@ -7161,7 +7161,7 @@
|
|
|
7161
7161
|
|
|
7162
7162
|
document
|
|
7163
7163
|
.querySelectorAll(
|
|
7164
|
-
'.feedback-survey, .feedback-survey-backdrop, .feedback-survey-success'
|
|
7164
|
+
'.feedback-survey, .feedback-survey-backdrop, .feedback-survey-success, .feedback-sdk-notification'
|
|
7165
7165
|
)
|
|
7166
7166
|
.forEach((el) => {
|
|
7167
7167
|
if (el && el.parentNode) {
|
|
@@ -7517,8 +7517,18 @@
|
|
|
7517
7517
|
const pageId = page.id || `page_${this.surveyState.currentPageIndex}`;
|
|
7518
7518
|
const config = page.ratingConfig || page.rating_config || {};
|
|
7519
7519
|
const scale = Number(config.scale) || 5;
|
|
7520
|
-
const
|
|
7521
|
-
|
|
7520
|
+
const topSurveyType = this.surveyOptions.surveyType;
|
|
7521
|
+
const configType = config.survey_type;
|
|
7522
|
+
let ratingType;
|
|
7523
|
+
if (topSurveyType === 'ces') {
|
|
7524
|
+
ratingType = 'ces';
|
|
7525
|
+
} else if (topSurveyType === 'nps') {
|
|
7526
|
+
ratingType = 'nps';
|
|
7527
|
+
} else if (topSurveyType === 'csat' && !configType) {
|
|
7528
|
+
ratingType = 'emoji';
|
|
7529
|
+
} else {
|
|
7530
|
+
ratingType = configType || topSurveyType || 'csat';
|
|
7531
|
+
}
|
|
7522
7532
|
const pageAnswer = this.surveyState.pageAnswers[pageId] || {};
|
|
7523
7533
|
const currentRating = pageAnswer.rating;
|
|
7524
7534
|
const defaultLowLabel =
|
|
@@ -7569,12 +7579,12 @@
|
|
|
7569
7579
|
if (ratingType === 'ces') {
|
|
7570
7580
|
const cesLabels = ['Very Difficult', 'Difficult', 'Neutral', 'Easy', 'Very Easy'];
|
|
7571
7581
|
return `
|
|
7572
|
-
<div class="feedback-survey-ces" data-page-id="${pageId}">
|
|
7582
|
+
<div class="feedback-survey-ces-list" data-page-id="${pageId}">
|
|
7573
7583
|
${cesLabels
|
|
7574
7584
|
.map((label, i) => {
|
|
7575
7585
|
const score = i + 1;
|
|
7576
7586
|
const selected = currentRating === score ? ' selected' : '';
|
|
7577
|
-
return `<button class="feedback-survey-page-rating-btn feedback-survey-ces-btn${selected}" data-page-id="${pageId}" data-score="${score}">${label}</button>`;
|
|
7587
|
+
return `<button class="feedback-survey-page-rating-btn feedback-survey-ces-list-btn${selected}" data-page-id="${pageId}" data-score="${score}">${label}</button>`;
|
|
7578
7588
|
})
|
|
7579
7589
|
.join('')}
|
|
7580
7590
|
</div>
|
|
@@ -8285,30 +8295,20 @@
|
|
|
8285
8295
|
|
|
8286
8296
|
const error = document.createElement('div');
|
|
8287
8297
|
error.className = 'feedback-survey-error';
|
|
8288
|
-
error.
|
|
8298
|
+
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>`;
|
|
8289
8299
|
|
|
8290
|
-
|
|
8291
|
-
'.feedback-survey-submit'
|
|
8292
|
-
);
|
|
8293
|
-
const actions = this.surveyElement.querySelector(
|
|
8294
|
-
'.feedback-survey-actions'
|
|
8295
|
-
);
|
|
8296
|
-
const anchor = submitBtn || actions;
|
|
8297
|
-
if (anchor && anchor.parentNode) {
|
|
8298
|
-
anchor.parentNode.insertBefore(error, anchor);
|
|
8299
|
-
} else {
|
|
8300
|
-
this.surveyElement.appendChild(error);
|
|
8301
|
-
}
|
|
8300
|
+
this.surveyElement.prepend(error);
|
|
8302
8301
|
|
|
8303
8302
|
setTimeout(() => error.remove(), 3000);
|
|
8304
8303
|
}
|
|
8305
8304
|
|
|
8306
8305
|
_showSuccessNotification() {
|
|
8307
8306
|
const notification = document.createElement('div');
|
|
8308
|
-
notification.className =
|
|
8307
|
+
notification.className =
|
|
8308
|
+
'feedback-sdk-notification feedback-sdk-notification-success';
|
|
8309
8309
|
notification.innerHTML = `
|
|
8310
8310
|
<div>
|
|
8311
|
-
<
|
|
8311
|
+
<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>
|
|
8312
8312
|
<span>Thank you for your feedback!</span>
|
|
8313
8313
|
</div>
|
|
8314
8314
|
`;
|
|
@@ -12616,6 +12616,7 @@
|
|
|
12616
12616
|
min-width: 320px;
|
|
12617
12617
|
max-width: 400px;
|
|
12618
12618
|
font-family: inherit;
|
|
12619
|
+
overflow: hidden;
|
|
12619
12620
|
}
|
|
12620
12621
|
|
|
12621
12622
|
.feedback-survey-theme-dark {
|
|
@@ -12833,11 +12834,16 @@
|
|
|
12833
12834
|
}
|
|
12834
12835
|
|
|
12835
12836
|
.feedback-survey-csat-btn:hover {
|
|
12836
|
-
transform: scale(1.
|
|
12837
|
+
transform: scale(1.15);
|
|
12837
12838
|
}
|
|
12838
12839
|
|
|
12839
12840
|
.feedback-survey-csat-btn.selected {
|
|
12840
|
-
transform: scale(1.
|
|
12841
|
+
transform: scale(1.5);
|
|
12842
|
+
}
|
|
12843
|
+
|
|
12844
|
+
.feedback-survey-csat:has(.selected) .feedback-survey-csat-btn:not(.selected) {
|
|
12845
|
+
transform: scale(0.8);
|
|
12846
|
+
opacity: 0.35;
|
|
12841
12847
|
}
|
|
12842
12848
|
|
|
12843
12849
|
/* ========================================
|
|
@@ -12876,6 +12882,38 @@
|
|
|
12876
12882
|
color: var(--color-white);
|
|
12877
12883
|
}
|
|
12878
12884
|
|
|
12885
|
+
.feedback-survey-ces-list {
|
|
12886
|
+
display: flex;
|
|
12887
|
+
flex-direction: column;
|
|
12888
|
+
gap: var(--spacing-2);
|
|
12889
|
+
}
|
|
12890
|
+
|
|
12891
|
+
.feedback-survey-ces-list-btn {
|
|
12892
|
+
width: 100%;
|
|
12893
|
+
padding: var(--spacing-3) var(--spacing-4);
|
|
12894
|
+
border: 1px solid var(--color-border);
|
|
12895
|
+
border-radius: var(--radius-md);
|
|
12896
|
+
background: var(--color-surface);
|
|
12897
|
+
cursor: pointer;
|
|
12898
|
+
font-size: var(--font-size-base);
|
|
12899
|
+
font-weight: var(--font-weight-medium);
|
|
12900
|
+
color: var(--color-text-primary);
|
|
12901
|
+
transition: all var(--transition-fast);
|
|
12902
|
+
font-family: inherit;
|
|
12903
|
+
text-align: left;
|
|
12904
|
+
}
|
|
12905
|
+
|
|
12906
|
+
.feedback-survey-ces-list-btn:hover {
|
|
12907
|
+
background: var(--color-neutral-100);
|
|
12908
|
+
border-color: var(--color-border);
|
|
12909
|
+
}
|
|
12910
|
+
|
|
12911
|
+
.feedback-survey-ces-list-btn.selected {
|
|
12912
|
+
background: var(--color-primary);
|
|
12913
|
+
border-color: var(--color-primary);
|
|
12914
|
+
color: var(--color-white);
|
|
12915
|
+
}
|
|
12916
|
+
|
|
12879
12917
|
.feedback-survey-rating-scale {
|
|
12880
12918
|
display: flex;
|
|
12881
12919
|
gap: 0;
|
|
@@ -13143,18 +13181,35 @@
|
|
|
13143
13181
|
}
|
|
13144
13182
|
|
|
13145
13183
|
.feedback-survey-error {
|
|
13146
|
-
|
|
13184
|
+
position: absolute;
|
|
13185
|
+
top: 0;
|
|
13186
|
+
left: 0;
|
|
13187
|
+
right: 0;
|
|
13188
|
+
background: #FF9900;
|
|
13189
|
+
color: #000;
|
|
13147
13190
|
font-size: var(--font-size-sm);
|
|
13148
|
-
|
|
13149
|
-
|
|
13191
|
+
font-weight: var(--font-weight-medium);
|
|
13192
|
+
padding: 10px 14px;
|
|
13193
|
+
display: flex;
|
|
13194
|
+
align-items: center;
|
|
13195
|
+
gap: 8px;
|
|
13196
|
+
z-index: 2;
|
|
13197
|
+
}
|
|
13198
|
+
|
|
13199
|
+
.feedback-survey-error svg {
|
|
13200
|
+
width: 16px;
|
|
13201
|
+
height: 16px;
|
|
13202
|
+
flex-shrink: 0;
|
|
13150
13203
|
}
|
|
13151
13204
|
|
|
13152
|
-
|
|
13205
|
+
/* ========================================
|
|
13206
|
+
NOTIFICATION TOASTS
|
|
13207
|
+
======================================== */
|
|
13208
|
+
|
|
13209
|
+
.feedback-sdk-notification {
|
|
13153
13210
|
position: fixed;
|
|
13154
13211
|
top: var(--spacing-6);
|
|
13155
13212
|
right: var(--spacing-6);
|
|
13156
|
-
background: var(--color-success);
|
|
13157
|
-
color: var(--color-white);
|
|
13158
13213
|
padding: var(--spacing-3) var(--spacing-5);
|
|
13159
13214
|
border-radius: var(--radius-xl);
|
|
13160
13215
|
font-size: var(--font-size-sm);
|
|
@@ -13162,14 +13217,38 @@
|
|
|
13162
13217
|
z-index: var(--z-notification);
|
|
13163
13218
|
box-shadow: var(--shadow-lg);
|
|
13164
13219
|
font-family: inherit;
|
|
13220
|
+
color: #fff;
|
|
13165
13221
|
}
|
|
13166
13222
|
|
|
13167
|
-
.feedback-
|
|
13223
|
+
.feedback-sdk-notification > div {
|
|
13168
13224
|
display: flex;
|
|
13169
13225
|
align-items: center;
|
|
13170
13226
|
gap: var(--spacing-2);
|
|
13171
13227
|
}
|
|
13172
13228
|
|
|
13229
|
+
.feedback-sdk-notification svg {
|
|
13230
|
+
width: 18px;
|
|
13231
|
+
height: 18px;
|
|
13232
|
+
flex-shrink: 0;
|
|
13233
|
+
}
|
|
13234
|
+
|
|
13235
|
+
.feedback-sdk-notification-success {
|
|
13236
|
+
background: #037F0C;
|
|
13237
|
+
}
|
|
13238
|
+
|
|
13239
|
+
.feedback-sdk-notification-error {
|
|
13240
|
+
background: #D13212;
|
|
13241
|
+
}
|
|
13242
|
+
|
|
13243
|
+
.feedback-sdk-notification-warning {
|
|
13244
|
+
background: #FF9900;
|
|
13245
|
+
color: #000;
|
|
13246
|
+
}
|
|
13247
|
+
|
|
13248
|
+
.feedback-sdk-notification-info {
|
|
13249
|
+
background: #0972D3;
|
|
13250
|
+
}
|
|
13251
|
+
|
|
13173
13252
|
/* ========================================
|
|
13174
13253
|
RESPONSIVE
|
|
13175
13254
|
======================================== */
|