@product7/product7-js 0.4.7 → 0.4.8

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.7",
3
+ "version": "0.4.8",
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",
@@ -938,16 +938,16 @@ export class SurveyWidget extends BaseWidget {
938
938
  };
939
939
 
940
940
  try {
941
- if (this.surveyOptions.onSubmit) {
942
- this.surveyOptions.onSubmit(response);
943
- }
944
-
945
941
  const surveyId =
946
942
  this.surveyOptions.surveyId || `local_${type}_${Date.now()}`;
947
943
  await this.apiService.submitSurveyResponse(surveyId, responseData);
948
944
 
949
945
  this.sdk.eventBus.emit('survey:submitted', { widget: this, response });
950
946
  this._showThankYouScreen();
947
+
948
+ if (this.surveyOptions.onSubmit) {
949
+ this.surveyOptions.onSubmit(response);
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.');