@magicfeedback/popup-sdk 1.0.2 → 1.0.3

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/dist/index.mjs CHANGED
@@ -3644,20 +3644,17 @@ async function renderPopup(container, surveyId, productId, actions, emit, onClos
3644
3644
  setLoading(true);
3645
3645
  emit("popup_clicked", surveyId, { action: "before_submit" });
3646
3646
  };
3647
- generateOptions.afterSubmitEvent = ({ error }) => {
3647
+ generateOptions.afterSubmitEvent = ({ error, completed }) => {
3648
3648
  setLoading(false);
3649
3649
  if (error) {
3650
3650
  emit("popup_clicked", surveyId, { action: "submit_error", error });
3651
3651
  return;
3652
3652
  }
3653
- };
3654
- generateOptions.onFinishEvent = () => {
3655
- console.log("finish");
3656
- if (!surveyCompletedEmitted) {
3653
+ if (completed) {
3657
3654
  emit("survey_completed", surveyId, { action: "completed" });
3658
3655
  surveyCompletedEmitted = true;
3656
+ onClose();
3659
3657
  }
3660
- onClose();
3661
3658
  };
3662
3659
  generateOptions.onBackEvent = () => {
3663
3660
  emit("popup_clicked", surveyId, { action: "back" });