@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.js CHANGED
@@ -4144,18 +4144,20 @@ var DeepdotsPopups = class {
4144
4144
  emitEvent(type, surveyId, data) {
4145
4145
  const event = { type, surveyId, timestamp: Date.now(), data };
4146
4146
  this.log("Event emitted", event);
4147
- if (type === "popup_clicked" && data?.action === "partial") {
4147
+ const isPartialClick = type === "popup_clicked" && data?.action === "partial";
4148
+ if (isPartialClick) {
4148
4149
  this.markSurveyProgress(surveyId, "PARTIAL");
4149
4150
  }
4150
4151
  if (type === "survey_completed") {
4151
4152
  this.markSurveyAnswered(surveyId);
4152
4153
  }
4153
- if (type === "popup_shown" || type === "survey_completed") {
4154
+ if (type === "popup_shown" || type === "survey_completed" || isPartialClick) {
4154
4155
  const popupIdFromData = data?.popupId;
4155
4156
  const popupId = popupIdFromData || this.surveyToPopupId.get(surveyId);
4156
4157
  if (popupId) {
4157
4158
  const userIdFromData = data?.userId;
4158
- void this.postPopupEvent(type === "popup_shown" ? "SHOWED" /* SHOWED */ : "COMPLETED" /* COMPLETED */, popupId, userIdFromData || this.config?.userId);
4159
+ const status = type === "popup_shown" ? "SHOWED" /* SHOWED */ : type === "survey_completed" ? "COMPLETED" /* COMPLETED */ : "PARTIAL" /* PARTIAL */;
4160
+ void this.postPopupEvent(status, popupId, userIdFromData || this.config?.userId);
4159
4161
  } else {
4160
4162
  this.debug("No popupId available to post event", { type, surveyId });
4161
4163
  }