@magicfeedback/popup-sdk 1.0.15 → 1.1.0

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
@@ -4130,18 +4130,20 @@ var DeepdotsPopups = class {
4130
4130
  emitEvent(type, surveyId, data) {
4131
4131
  const event = { type, surveyId, timestamp: Date.now(), data };
4132
4132
  this.log("Event emitted", event);
4133
- if (type === "popup_clicked" && data?.action === "partial") {
4133
+ const isPartialClick = type === "popup_clicked" && data?.action === "partial";
4134
+ if (isPartialClick) {
4134
4135
  this.markSurveyProgress(surveyId, "PARTIAL");
4135
4136
  }
4136
4137
  if (type === "survey_completed") {
4137
4138
  this.markSurveyAnswered(surveyId);
4138
4139
  }
4139
- if (type === "popup_shown" || type === "survey_completed") {
4140
+ if (type === "popup_shown" || type === "survey_completed" || isPartialClick) {
4140
4141
  const popupIdFromData = data?.popupId;
4141
4142
  const popupId = popupIdFromData || this.surveyToPopupId.get(surveyId);
4142
4143
  if (popupId) {
4143
4144
  const userIdFromData = data?.userId;
4144
- void this.postPopupEvent(type === "popup_shown" ? "SHOWED" /* SHOWED */ : "COMPLETED" /* COMPLETED */, popupId, userIdFromData || this.config?.userId);
4145
+ const status = type === "popup_shown" ? "SHOWED" /* SHOWED */ : type === "survey_completed" ? "COMPLETED" /* COMPLETED */ : "PARTIAL" /* PARTIAL */;
4146
+ void this.postPopupEvent(status, popupId, userIdFromData || this.config?.userId);
4145
4147
  } else {
4146
4148
  this.debug("No popupId available to post event", { type, surveyId });
4147
4149
  }