@elementor/editor-global-classes 4.1.0-720 → 4.1.0-721

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
@@ -387,6 +387,41 @@ var getSanitizedData = async (payload) => {
387
387
  return { ...payload, classTitle: getCssClass(payload.classId).label };
388
388
  }
389
389
  break;
390
+ case "classSyncToV3PopupShown":
391
+ return {
392
+ ...payload,
393
+ interaction_type: "popup_shown",
394
+ target_type: "popup",
395
+ target_name: "sync_to_v3_popup",
396
+ interaction_result: "popup_viewed",
397
+ target_location: "widget_panel",
398
+ location_l1: "class_manager"
399
+ };
400
+ case "classSyncToV3": {
401
+ const classLabel = getCssClass(payload.classId).label;
402
+ const isSync = payload.action === "sync";
403
+ return {
404
+ ...payload,
405
+ interaction_type: "click",
406
+ target_type: classLabel,
407
+ target_name: isSync ? "sync_to_v3" : "unsync_to_v3",
408
+ interaction_result: isSync ? "class_is_synced_to_V3" : "class_is_unsynced_from_V3",
409
+ target_location: "widget_panel",
410
+ location_l1: "class_manager",
411
+ interaction_description: isSync ? `user_synced_${classLabel}_to_v3` : `user_unsync_${classLabel}_from_v3`
412
+ };
413
+ }
414
+ case "classSyncToV3PopupClick": {
415
+ const isSyncAction = payload.action === "sync";
416
+ return {
417
+ ...payload,
418
+ interaction_type: "click",
419
+ target_type: "button",
420
+ target_name: isSyncAction ? "sync_to_v3" : "cancel",
421
+ interaction_result: isSyncAction ? "class_is_synced" : "cancel",
422
+ target_location: "sync_to_v3_popup"
423
+ };
424
+ }
390
425
  default:
391
426
  return payload;
392
427
  }
@@ -2064,12 +2099,33 @@ var import_react8 = require("react");
2064
2099
  var import_ui15 = require("@elementor/ui");
2065
2100
  var import_i18n14 = require("@wordpress/i18n");
2066
2101
  var IMAGE_URL = "https://assets.elementor.com/packages/v1/images/class-manager-sync-modal.png";
2067
- var StartSyncToV3Modal = ({ externalOpen, onExternalClose, onConfirm } = {}) => {
2102
+ var StartSyncToV3Modal = ({
2103
+ externalOpen,
2104
+ classId,
2105
+ onExternalClose,
2106
+ onConfirm
2107
+ } = {}) => {
2068
2108
  const [shouldShowAgain, setShouldShowAgain] = (0, import_react8.useState)(true);
2109
+ const hasTrackedExposure = (0, import_react8.useRef)(false);
2110
+ (0, import_react8.useEffect)(() => {
2111
+ if (externalOpen && classId && !hasTrackedExposure.current) {
2112
+ hasTrackedExposure.current = true;
2113
+ trackGlobalClasses({ event: "classSyncToV3PopupShown", classId });
2114
+ }
2115
+ if (!externalOpen) {
2116
+ hasTrackedExposure.current = false;
2117
+ }
2118
+ }, [externalOpen, classId]);
2069
2119
  const handleClose = () => {
2120
+ if (classId) {
2121
+ trackGlobalClasses({ event: "classSyncToV3PopupClick", classId, action: "cancel" });
2122
+ }
2070
2123
  onExternalClose?.();
2071
2124
  };
2072
2125
  const handleConfirm = () => {
2126
+ if (classId) {
2127
+ trackGlobalClasses({ event: "classSyncToV3PopupClick", classId, action: "sync" });
2128
+ }
2073
2129
  onConfirm?.();
2074
2130
  onExternalClose?.();
2075
2131
  };
@@ -2140,6 +2196,7 @@ function ClassManagerPanel() {
2140
2196
  }
2141
2197
  })
2142
2198
  );
2199
+ trackGlobalClasses({ event: "classSyncToV3", classId, action: "unsync" });
2143
2200
  setStopSyncConfirmation(null);
2144
2201
  }, []);
2145
2202
  const handleStartSync = (0, import_react9.useCallback)((classId) => {
@@ -2151,6 +2208,7 @@ function ClassManagerPanel() {
2151
2208
  }
2152
2209
  })
2153
2210
  );
2211
+ trackGlobalClasses({ event: "classSyncToV3", classId, action: "sync" });
2154
2212
  setStartSyncConfirmation(null);
2155
2213
  }, []);
2156
2214
  const handleStopSyncRequest = (0, import_react9.useCallback)(
@@ -2222,6 +2280,7 @@ function ClassManagerPanel() {
2222
2280
  StartSyncToV3Modal,
2223
2281
  {
2224
2282
  externalOpen: true,
2283
+ classId: startSyncConfirmation,
2225
2284
  onExternalClose: () => setStartSyncConfirmation(null),
2226
2285
  onConfirm: () => handleStartSync(startSyncConfirmation)
2227
2286
  }