@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.js CHANGED
@@ -3657,20 +3657,17 @@ async function renderPopup(container, surveyId, productId, actions, emit, onClos
3657
3657
  setLoading(true);
3658
3658
  emit("popup_clicked", surveyId, { action: "before_submit" });
3659
3659
  };
3660
- generateOptions.afterSubmitEvent = ({ error }) => {
3660
+ generateOptions.afterSubmitEvent = ({ error, completed }) => {
3661
3661
  setLoading(false);
3662
3662
  if (error) {
3663
3663
  emit("popup_clicked", surveyId, { action: "submit_error", error });
3664
3664
  return;
3665
3665
  }
3666
- };
3667
- generateOptions.onFinishEvent = () => {
3668
- console.log("finish");
3669
- if (!surveyCompletedEmitted) {
3666
+ if (completed) {
3670
3667
  emit("survey_completed", surveyId, { action: "completed" });
3671
3668
  surveyCompletedEmitted = true;
3669
+ onClose();
3672
3670
  }
3673
- onClose();
3674
3671
  };
3675
3672
  generateOptions.onBackEvent = () => {
3676
3673
  emit("popup_clicked", surveyId, { action: "back" });