@product7/feedback-sdk 1.7.1 → 1.7.4

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/feedback-sdk",
3
- "version": "1.7.1",
3
+ "version": "1.7.4",
4
4
  "description": "JavaScript SDK for integrating Product7 feedback widgets into any website",
5
5
  "main": "dist/feedback-sdk.js",
6
6
  "module": "src/index.js",
@@ -106,6 +106,7 @@ export class SurveyWidget extends BaseWidget {
106
106
  this._closeSurvey(false);
107
107
 
108
108
  const config = this._getSurveyConfig();
109
+ if (!config) return;
109
110
  const isMultiPage = this._isMultiPageSurvey();
110
111
  const isLastPage = this._isLastPage();
111
112
  const showFeedbackInput = this._shouldShowFeedbackInput();
@@ -141,7 +142,7 @@ export class SurveyWidget extends BaseWidget {
141
142
  <button class="feedback-survey-close"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><rect width="256" height="256" fill="none"/><line x1="200" y1="56" x2="56" y2="200" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/><line x1="200" y1="200" x2="56" y2="56" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/></svg></button>
142
143
  ${showTitle ? `<h3 class="feedback-survey-title">${config.title}</h3>` : ''}
143
144
  ${showDescription ? `<p class="feedback-survey-description">${config.description}</p>` : ''}
144
- ${isMultiPage ? `<div class="feedback-survey-progress">${pageProgress}</div>` : ''}
145
+ ${isMultiPage && this.surveyOptions.pages.length > 1 ? `<div class="feedback-survey-progress">${pageProgress}</div>` : ''}
145
146
  <div class="feedback-survey-content">${config.html}</div>
146
147
  ${
147
148
  showFeedbackInput
@@ -270,7 +271,7 @@ export class SurveyWidget extends BaseWidget {
270
271
  },
271
272
  };
272
273
 
273
- return configs[this.surveyOptions.surveyType] || configs.nps;
274
+ return configs[this.surveyOptions.surveyType] || null;
274
275
  }
275
276
 
276
277
  _getNPSScale() {
@@ -350,6 +351,10 @@ export class SurveyWidget extends BaseWidget {
350
351
 
351
352
  _shouldShowActions() {
352
353
  if (this._isMultiPageSurvey()) {
354
+ const page = this._getCurrentPage();
355
+ if (page && page.type === 'link') {
356
+ return false;
357
+ }
353
358
  return true;
354
359
  }
355
360
  if (typeof this.surveyOptions.showSubmitButton === 'boolean') {
@@ -380,24 +385,16 @@ export class SurveyWidget extends BaseWidget {
380
385
  _getCurrentPageConfig() {
381
386
  const page = this._getCurrentPage();
382
387
  if (!page) {
383
- return this._getFallbackSurveyConfig();
388
+ return null;
384
389
  }
385
390
 
386
391
  return {
387
- title: page.title || this.surveyOptions.title || 'Quick Feedback',
388
- description: page.description || this.surveyOptions.description || '',
392
+ title: page.title || '',
393
+ description: page.description || '',
389
394
  html: this._renderSurveyPage(page),
390
395
  };
391
396
  }
392
397
 
393
- _getFallbackSurveyConfig() {
394
- return {
395
- title: this.surveyOptions.title || 'Quick Feedback',
396
- description: this.surveyOptions.description || '',
397
- html: this._renderCustomQuestions(),
398
- };
399
- }
400
-
401
398
  _renderSurveyPage(page) {
402
399
  switch (page.type) {
403
400
  case 'rating':
@@ -409,7 +406,7 @@ export class SurveyWidget extends BaseWidget {
409
406
  case 'link':
410
407
  return this._renderLinkPage(page);
411
408
  default:
412
- return this._renderTextPage(page);
409
+ return '';
413
410
  }
414
411
  }
415
412