@product7/feedback-sdk 1.7.4 → 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.
@@ -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 ratingType =
7521
- config.survey_type || this.surveyOptions.surveyType || 'csat';
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 =
@@ -8285,30 +8295,20 @@
8285
8295
 
8286
8296
  const error = document.createElement('div');
8287
8297
  error.className = 'feedback-survey-error';
8288
- error.textContent = message;
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
- const submitBtn = this.surveyElement.querySelector(
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 = 'feedback-survey-success';
8307
+ notification.className =
8308
+ 'feedback-sdk-notification feedback-sdk-notification-success';
8309
8309
  notification.innerHTML = `
8310
8310
  <div>
8311
- <span style="font-size: 18px;">✓</span>
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.1);
12837
+ transform: scale(1.15);
12837
12838
  }
12838
12839
 
12839
12840
  .feedback-survey-csat-btn.selected {
12840
- transform: scale(1.2);
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
  /* ========================================
@@ -13116,7 +13122,9 @@
13116
13122
  SUBMIT & FEEDBACK
13117
13123
  ======================================== */
13118
13124
 
13119
- .feedback-survey-submit {
13125
+ .feedback-survey-submit,
13126
+ .feedback-survey-link-btn {
13127
+ display: block;
13120
13128
  width: 100%;
13121
13129
  padding: var(--spacing-3);
13122
13130
  background: var(--color-primary);
@@ -13127,27 +13135,49 @@
13127
13135
  font-weight: var(--font-weight-medium);
13128
13136
  cursor: pointer;
13129
13137
  font-family: inherit;
13138
+ text-align: center;
13139
+ text-decoration: none;
13130
13140
  transition: all var(--transition-base);
13131
13141
  }
13132
13142
 
13133
- .feedback-survey-submit:hover {
13143
+ .feedback-survey-submit:hover,
13144
+ .feedback-survey-link-btn:hover {
13134
13145
  background: var(--color-primary-hover);
13135
13146
  border-color: var(--color-primary-hover);
13147
+ color: var(--color-white);
13148
+ text-decoration: none;
13136
13149
  }
13137
13150
 
13138
13151
  .feedback-survey-error {
13139
- color: var(--color-error);
13152
+ position: absolute;
13153
+ top: 0;
13154
+ left: 0;
13155
+ right: 0;
13156
+ background: #FF9900;
13157
+ color: #000;
13140
13158
  font-size: var(--font-size-sm);
13141
- margin-top: var(--spacing-2);
13142
- text-align: center;
13159
+ font-weight: var(--font-weight-medium);
13160
+ padding: 10px 14px;
13161
+ display: flex;
13162
+ align-items: center;
13163
+ gap: 8px;
13164
+ z-index: 2;
13143
13165
  }
13144
13166
 
13145
- .feedback-survey-success {
13167
+ .feedback-survey-error svg {
13168
+ width: 16px;
13169
+ height: 16px;
13170
+ flex-shrink: 0;
13171
+ }
13172
+
13173
+ /* ========================================
13174
+ NOTIFICATION TOASTS
13175
+ ======================================== */
13176
+
13177
+ .feedback-sdk-notification {
13146
13178
  position: fixed;
13147
13179
  top: var(--spacing-6);
13148
13180
  right: var(--spacing-6);
13149
- background: var(--color-success);
13150
- color: var(--color-white);
13151
13181
  padding: var(--spacing-3) var(--spacing-5);
13152
13182
  border-radius: var(--radius-xl);
13153
13183
  font-size: var(--font-size-sm);
@@ -13155,14 +13185,38 @@
13155
13185
  z-index: var(--z-notification);
13156
13186
  box-shadow: var(--shadow-lg);
13157
13187
  font-family: inherit;
13188
+ color: #fff;
13158
13189
  }
13159
13190
 
13160
- .feedback-survey-success > div {
13191
+ .feedback-sdk-notification > div {
13161
13192
  display: flex;
13162
13193
  align-items: center;
13163
13194
  gap: var(--spacing-2);
13164
13195
  }
13165
13196
 
13197
+ .feedback-sdk-notification svg {
13198
+ width: 18px;
13199
+ height: 18px;
13200
+ flex-shrink: 0;
13201
+ }
13202
+
13203
+ .feedback-sdk-notification-success {
13204
+ background: #037F0C;
13205
+ }
13206
+
13207
+ .feedback-sdk-notification-error {
13208
+ background: #D13212;
13209
+ }
13210
+
13211
+ .feedback-sdk-notification-warning {
13212
+ background: #FF9900;
13213
+ color: #000;
13214
+ }
13215
+
13216
+ .feedback-sdk-notification-info {
13217
+ background: #0972D3;
13218
+ }
13219
+
13166
13220
  /* ========================================
13167
13221
  RESPONSIVE
13168
13222
  ======================================== */