@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.
@@ -13345,11 +13345,11 @@
13345
13345
  await this.apiService.submitSurveyResponse(surveyId, responseData);
13346
13346
 
13347
13347
  this.sdk.eventBus.emit('survey:submitted', { widget: this, response });
13348
- this._showThankYouScreen();
13349
-
13350
- if (this.surveyOptions.onSubmit) {
13351
- this.surveyOptions.onSubmit(response);
13352
- }
13348
+ this._showThankYouScreen(() => {
13349
+ if (this.surveyOptions.onSubmit) {
13350
+ this.surveyOptions.onSubmit(response);
13351
+ }
13352
+ });
13353
13353
  } catch (error) {
13354
13354
  console.error('[SurveyWidget] Failed to submit survey:', error);
13355
13355
  this._showError('Something went wrong. Please try again.');
@@ -13599,7 +13599,7 @@
13599
13599
  setTimeout(() => error.remove(), 3000);
13600
13600
  }
13601
13601
 
13602
- _showThankYouScreen() {
13602
+ _showThankYouScreen(onAfterClose) {
13603
13603
  if (!this.surveyElement) return;
13604
13604
 
13605
13605
  const config = this.surveyOptions.thankYouConfig || {};
@@ -13635,6 +13635,7 @@
13635
13635
  setTimeout(
13636
13636
  () => {
13637
13637
  if (this.surveyElement) this._closeSurvey();
13638
+ if (onAfterClose) onAfterClose();
13638
13639
  },
13639
13640
  buttonText ? 6000 : 3500
13640
13641
  );