@product7/product7-js 0.4.8 → 0.4.9

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.4.8",
3
+ "version": "0.4.9",
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",
@@ -943,11 +943,11 @@ export class SurveyWidget extends BaseWidget {
943
943
  await this.apiService.submitSurveyResponse(surveyId, responseData);
944
944
 
945
945
  this.sdk.eventBus.emit('survey:submitted', { widget: this, response });
946
- this._showThankYouScreen();
947
-
948
- if (this.surveyOptions.onSubmit) {
949
- this.surveyOptions.onSubmit(response);
950
- }
946
+ this._showThankYouScreen(() => {
947
+ if (this.surveyOptions.onSubmit) {
948
+ this.surveyOptions.onSubmit(response);
949
+ }
950
+ });
951
951
  } catch (error) {
952
952
  console.error('[SurveyWidget] Failed to submit survey:', error);
953
953
  this._showError('Something went wrong. Please try again.');
@@ -1197,7 +1197,7 @@ export class SurveyWidget extends BaseWidget {
1197
1197
  setTimeout(() => error.remove(), 3000);
1198
1198
  }
1199
1199
 
1200
- _showThankYouScreen() {
1200
+ _showThankYouScreen(onAfterClose) {
1201
1201
  if (!this.surveyElement) return;
1202
1202
 
1203
1203
  const config = this.surveyOptions.thankYouConfig || {};
@@ -1233,6 +1233,7 @@ export class SurveyWidget extends BaseWidget {
1233
1233
  setTimeout(
1234
1234
  () => {
1235
1235
  if (this.surveyElement) this._closeSurvey();
1236
+ if (onAfterClose) onAfterClose();
1236
1237
  },
1237
1238
  buttonText ? 6000 : 3500
1238
1239
  );