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

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
@@ -35,9 +35,6 @@ __export(index_exports, {
35
35
  });
36
36
  module.exports = __toCommonJS(index_exports);
37
37
 
38
- // src/mcp-integration/classes-resource.ts
39
- var import_editor_mcp = require("@elementor/editor-mcp");
40
-
41
38
  // src/global-classes-styles-provider.ts
42
39
  var import_editor_styles2 = require("@elementor/editor-styles");
43
40
  var import_editor_styles_repository = require("@elementor/editor-styles-repository");
@@ -387,6 +384,41 @@ var getSanitizedData = async (payload) => {
387
384
  return { ...payload, classTitle: getCssClass(payload.classId).label };
388
385
  }
389
386
  break;
387
+ case "classSyncToV3PopupShown":
388
+ return {
389
+ ...payload,
390
+ interaction_type: "popup_shown",
391
+ target_type: "popup",
392
+ target_name: "sync_to_v3_popup",
393
+ interaction_result: "popup_viewed",
394
+ target_location: "widget_panel",
395
+ location_l1: "class_manager"
396
+ };
397
+ case "classSyncToV3": {
398
+ const classLabel = getCssClass(payload.classId).label;
399
+ const isSync = payload.action === "sync";
400
+ return {
401
+ ...payload,
402
+ interaction_type: "click",
403
+ target_type: classLabel,
404
+ target_name: isSync ? "sync_to_v3" : "unsync_to_v3",
405
+ interaction_result: isSync ? "class_is_synced_to_V3" : "class_is_unsynced_from_V3",
406
+ target_location: "widget_panel",
407
+ location_l1: "class_manager",
408
+ interaction_description: isSync ? `user_synced_${classLabel}_to_v3` : `user_unsync_${classLabel}_from_v3`
409
+ };
410
+ }
411
+ case "classSyncToV3PopupClick": {
412
+ const isSyncAction = payload.action === "sync";
413
+ return {
414
+ ...payload,
415
+ interaction_type: "click",
416
+ target_type: "button",
417
+ target_name: isSyncAction ? "sync_to_v3" : "cancel",
418
+ interaction_result: isSyncAction ? "class_is_synced" : "cancel",
419
+ target_location: "sync_to_v3_popup"
420
+ };
421
+ }
390
422
  default:
391
423
  return payload;
392
424
  }
@@ -532,9 +564,7 @@ var updateLocalStorageCache = () => {
532
564
  const classes = globalClassesStylesProvider.actions.all();
533
565
  localStorage.setItem(STORAGE_KEY, JSON.stringify(classes));
534
566
  };
535
- var initClassesResource = () => {
536
- const canvasMcpEntry = (0, import_editor_mcp.getMCPByDomain)("canvas");
537
- const classesMcpEntry = (0, import_editor_mcp.getMCPByDomain)("classes");
567
+ var initClassesResource = (classesMcpEntry, canvasMcpEntry) => {
538
568
  [canvasMcpEntry, classesMcpEntry].forEach((entry) => {
539
569
  const { mcpServer, resource, waitForReady } = entry;
540
570
  resource(
@@ -562,6 +592,7 @@ var initClassesResource = () => {
562
592
  // src/init.ts
563
593
  var import_editor = require("@elementor/editor");
564
594
  var import_editor_editing_panel2 = require("@elementor/editor-editing-panel");
595
+ var import_editor_mcp = require("@elementor/editor-mcp");
565
596
  var import_editor_panels2 = require("@elementor/editor-panels");
566
597
  var import_editor_styles_repository5 = require("@elementor/editor-styles-repository");
567
598
  var import_store28 = require("@elementor/store");
@@ -2064,12 +2095,33 @@ var import_react8 = require("react");
2064
2095
  var import_ui15 = require("@elementor/ui");
2065
2096
  var import_i18n14 = require("@wordpress/i18n");
2066
2097
  var IMAGE_URL = "https://assets.elementor.com/packages/v1/images/class-manager-sync-modal.png";
2067
- var StartSyncToV3Modal = ({ externalOpen, onExternalClose, onConfirm } = {}) => {
2098
+ var StartSyncToV3Modal = ({
2099
+ externalOpen,
2100
+ classId,
2101
+ onExternalClose,
2102
+ onConfirm
2103
+ } = {}) => {
2068
2104
  const [shouldShowAgain, setShouldShowAgain] = (0, import_react8.useState)(true);
2105
+ const hasTrackedExposure = (0, import_react8.useRef)(false);
2106
+ (0, import_react8.useEffect)(() => {
2107
+ if (externalOpen && classId && !hasTrackedExposure.current) {
2108
+ hasTrackedExposure.current = true;
2109
+ trackGlobalClasses({ event: "classSyncToV3PopupShown", classId });
2110
+ }
2111
+ if (!externalOpen) {
2112
+ hasTrackedExposure.current = false;
2113
+ }
2114
+ }, [externalOpen, classId]);
2069
2115
  const handleClose = () => {
2116
+ if (classId) {
2117
+ trackGlobalClasses({ event: "classSyncToV3PopupClick", classId, action: "cancel" });
2118
+ }
2070
2119
  onExternalClose?.();
2071
2120
  };
2072
2121
  const handleConfirm = () => {
2122
+ if (classId) {
2123
+ trackGlobalClasses({ event: "classSyncToV3PopupClick", classId, action: "sync" });
2124
+ }
2073
2125
  onConfirm?.();
2074
2126
  onExternalClose?.();
2075
2127
  };
@@ -2140,6 +2192,7 @@ function ClassManagerPanel() {
2140
2192
  }
2141
2193
  })
2142
2194
  );
2195
+ trackGlobalClasses({ event: "classSyncToV3", classId, action: "unsync" });
2143
2196
  setStopSyncConfirmation(null);
2144
2197
  }, []);
2145
2198
  const handleStartSync = (0, import_react9.useCallback)((classId) => {
@@ -2151,6 +2204,7 @@ function ClassManagerPanel() {
2151
2204
  }
2152
2205
  })
2153
2206
  );
2207
+ trackGlobalClasses({ event: "classSyncToV3", classId, action: "sync" });
2154
2208
  setStartSyncConfirmation(null);
2155
2209
  }, []);
2156
2210
  const handleStopSyncRequest = (0, import_react9.useCallback)(
@@ -2222,6 +2276,7 @@ function ClassManagerPanel() {
2222
2276
  StartSyncToV3Modal,
2223
2277
  {
2224
2278
  externalOpen: true,
2279
+ classId: startSyncConfirmation,
2225
2280
  onExternalClose: () => setStartSyncConfirmation(null),
2226
2281
  onConfirm: () => handleStartSync(startSyncConfirmation)
2227
2282
  }
@@ -2526,9 +2581,6 @@ function PopulateStore() {
2526
2581
  return null;
2527
2582
  }
2528
2583
 
2529
- // src/mcp-integration/index.ts
2530
- var import_editor_mcp2 = require("@elementor/editor-mcp");
2531
-
2532
2584
  // src/mcp-integration/mcp-apply-unapply-global-classes.ts
2533
2585
  var import_editor_editing_panel = require("@elementor/editor-editing-panel");
2534
2586
  var import_schema = require("@elementor/schema");
@@ -2957,14 +3009,21 @@ async function attemptDelete(opts) {
2957
3009
  }
2958
3010
 
2959
3011
  // src/mcp-integration/index.ts
2960
- var initMcpIntegration = () => {
2961
- const reg = (0, import_editor_mcp2.getMCPByDomain)("classes", {
2962
- instructions: "MCP server for management of Elementor global classes"
2963
- });
3012
+ var initMcpIntegration = (reg, canvasMcpEntry) => {
3013
+ const { setMCPDescription } = reg;
3014
+ setMCPDescription(
3015
+ `Everything related to V4 ( Atomic ) global classes.
3016
+ # Global classes
3017
+ - Create/update/delete global classes
3018
+ - Get list of global classes
3019
+ - Get details of a global class
3020
+ - Get details of a global class
3021
+ `
3022
+ );
2964
3023
  initMcpApplyUnapplyGlobalClasses(reg);
2965
3024
  initMcpApplyGetGlobalClassUsages(reg);
2966
3025
  initManageGlobalClasses(reg);
2967
- initClassesResource();
3026
+ initClassesResource(reg, canvasMcpEntry);
2968
3027
  };
2969
3028
 
2970
3029
  // src/sync-with-document.tsx
@@ -3078,7 +3137,10 @@ function init() {
3078
3137
  name: "global",
3079
3138
  getThemeColor: (theme) => theme.palette.global.dark
3080
3139
  });
3081
- initMcpIntegration();
3140
+ initMcpIntegration(
3141
+ (0, import_editor_mcp.getMCPByDomain)("classes", { instructions: "MCP server for management of Elementor global classes" }),
3142
+ (0, import_editor_mcp.getMCPByDomain)("canvas")
3143
+ );
3082
3144
  }
3083
3145
  // Annotate the CommonJS export names for ESM import in node:
3084
3146
  0 && (module.exports = {