@product7/product7-js 0.5.0 → 0.5.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@product7/product7-js",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "JavaScript SDK for integrating Product7 feedback widgets into any website",
5
5
  "main": "dist/product7-js.js",
6
6
  "module": "src/index.js",
@@ -456,6 +456,7 @@ export class Product7 {
456
456
  page.multipleChoiceConfig || page.multiple_choice_config || null,
457
457
  linkConfig: page.linkConfig || page.link_config || null,
458
458
  afterThisPage: page.afterThisPage || page.after_this_page || null,
459
+ thankYouConfig: page.thankYouConfig || page.thank_you_config || null,
459
460
  }))
460
461
  .sort((a, b) => a.position - b.position);
461
462
  }
@@ -487,6 +487,9 @@ export const surveyStyles = `
487
487
  border-radius: 50%;
488
488
  border: 1.5px solid #D1D5DB;
489
489
  flex-shrink: 0;
490
+ display: flex;
491
+ align-items: center;
492
+ justify-content: center;
490
493
  background: transparent;
491
494
  transition: all var(--transition-fast);
492
495
  }
@@ -508,6 +511,10 @@ export const surveyStyles = `
508
511
  }
509
512
 
510
513
  .feedback-survey-page-choice-btn.selected::after {
514
+ content: '✓';
515
+ color: #ffffff;
516
+ font-size: 11px;
517
+ font-weight: 700;
511
518
  border-color: var(--color-primary);
512
519
  background-color: var(--color-primary);
513
520
  }
@@ -1221,10 +1221,25 @@ export class SurveyWidget extends BaseWidget {
1221
1221
  _showThankYouScreen(onAfterClose) {
1222
1222
  if (!this.surveyElement) return;
1223
1223
 
1224
- const config = this.surveyOptions.thankYouConfig || {};
1224
+ const pages = this.surveyOptions.pages || [];
1225
+ const currentPage =
1226
+ pages[this.surveyState.currentPageIndex] ||
1227
+ pages[pages.length - 1] ||
1228
+ null;
1229
+ const pageConfig = currentPage?.thankYouConfig || null;
1230
+ const surveyConfig = this.surveyOptions.thankYouConfig || null;
1231
+ const config =
1232
+ (pageConfig?.title ? pageConfig : null) ||
1233
+ (surveyConfig?.title ? surveyConfig : null) ||
1234
+ {};
1225
1235
  const title = config.title || 'Thanks for your feedback!';
1226
1236
  const buttonText = config.button_text || null;
1227
- const buttonUrl = config.button_url || '#';
1237
+ const rawUrl = config.button_url || '';
1238
+ const buttonUrl = rawUrl
1239
+ ? /^https?:\/\//i.test(rawUrl)
1240
+ ? rawUrl
1241
+ : `https://${rawUrl}`
1242
+ : '#';
1228
1243
 
1229
1244
  if (this._escapeHandler) {
1230
1245
  document.removeEventListener('keydown', this._escapeHandler);