@elementor/editor-global-classes 4.1.0-719 → 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 +60 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +72 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +20 -20
- package/src/components/class-manager/class-manager-panel.tsx +4 -0
- package/src/components/class-manager/start-sync-to-v3-modal.tsx +28 -2
- package/src/utils/tracking.ts +48 -0
package/dist/index.mjs
CHANGED
|
@@ -359,6 +359,41 @@ var getSanitizedData = async (payload) => {
|
|
|
359
359
|
return { ...payload, classTitle: getCssClass(payload.classId).label };
|
|
360
360
|
}
|
|
361
361
|
break;
|
|
362
|
+
case "classSyncToV3PopupShown":
|
|
363
|
+
return {
|
|
364
|
+
...payload,
|
|
365
|
+
interaction_type: "popup_shown",
|
|
366
|
+
target_type: "popup",
|
|
367
|
+
target_name: "sync_to_v3_popup",
|
|
368
|
+
interaction_result: "popup_viewed",
|
|
369
|
+
target_location: "widget_panel",
|
|
370
|
+
location_l1: "class_manager"
|
|
371
|
+
};
|
|
372
|
+
case "classSyncToV3": {
|
|
373
|
+
const classLabel = getCssClass(payload.classId).label;
|
|
374
|
+
const isSync = payload.action === "sync";
|
|
375
|
+
return {
|
|
376
|
+
...payload,
|
|
377
|
+
interaction_type: "click",
|
|
378
|
+
target_type: classLabel,
|
|
379
|
+
target_name: isSync ? "sync_to_v3" : "unsync_to_v3",
|
|
380
|
+
interaction_result: isSync ? "class_is_synced_to_V3" : "class_is_unsynced_from_V3",
|
|
381
|
+
target_location: "widget_panel",
|
|
382
|
+
location_l1: "class_manager",
|
|
383
|
+
interaction_description: isSync ? `user_synced_${classLabel}_to_v3` : `user_unsync_${classLabel}_from_v3`
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
case "classSyncToV3PopupClick": {
|
|
387
|
+
const isSyncAction = payload.action === "sync";
|
|
388
|
+
return {
|
|
389
|
+
...payload,
|
|
390
|
+
interaction_type: "click",
|
|
391
|
+
target_type: "button",
|
|
392
|
+
target_name: isSyncAction ? "sync_to_v3" : "cancel",
|
|
393
|
+
interaction_result: isSyncAction ? "class_is_synced" : "cancel",
|
|
394
|
+
target_location: "sync_to_v3_popup"
|
|
395
|
+
};
|
|
396
|
+
}
|
|
362
397
|
default:
|
|
363
398
|
return payload;
|
|
364
399
|
}
|
|
@@ -576,7 +611,7 @@ var PrefetchCssClassUsage = () => {
|
|
|
576
611
|
|
|
577
612
|
// src/components/class-manager/class-manager-panel.tsx
|
|
578
613
|
import * as React19 from "react";
|
|
579
|
-
import { useCallback, useEffect as
|
|
614
|
+
import { useCallback, useEffect as useEffect4, useState as useState7 } from "react";
|
|
580
615
|
import { useSuppressedMessage as useSuppressedMessage2 } from "@elementor/editor-current-user";
|
|
581
616
|
import { getCurrentDocument, getV1DocumentsManager, setDocumentModifiedStatus } from "@elementor/editor-documents";
|
|
582
617
|
import {
|
|
@@ -2107,7 +2142,7 @@ function unblockPanelInteractions() {
|
|
|
2107
2142
|
|
|
2108
2143
|
// src/components/class-manager/start-sync-to-v3-modal.tsx
|
|
2109
2144
|
import * as React18 from "react";
|
|
2110
|
-
import { useState as useState6 } from "react";
|
|
2145
|
+
import { useEffect as useEffect3, useRef as useRef2, useState as useState6 } from "react";
|
|
2111
2146
|
import {
|
|
2112
2147
|
Box as Box10,
|
|
2113
2148
|
Button as Button2,
|
|
@@ -2120,12 +2155,33 @@ import {
|
|
|
2120
2155
|
} from "@elementor/ui";
|
|
2121
2156
|
import { __ as __14 } from "@wordpress/i18n";
|
|
2122
2157
|
var IMAGE_URL = "https://assets.elementor.com/packages/v1/images/class-manager-sync-modal.png";
|
|
2123
|
-
var StartSyncToV3Modal = ({
|
|
2158
|
+
var StartSyncToV3Modal = ({
|
|
2159
|
+
externalOpen,
|
|
2160
|
+
classId,
|
|
2161
|
+
onExternalClose,
|
|
2162
|
+
onConfirm
|
|
2163
|
+
} = {}) => {
|
|
2124
2164
|
const [shouldShowAgain, setShouldShowAgain] = useState6(true);
|
|
2165
|
+
const hasTrackedExposure = useRef2(false);
|
|
2166
|
+
useEffect3(() => {
|
|
2167
|
+
if (externalOpen && classId && !hasTrackedExposure.current) {
|
|
2168
|
+
hasTrackedExposure.current = true;
|
|
2169
|
+
trackGlobalClasses({ event: "classSyncToV3PopupShown", classId });
|
|
2170
|
+
}
|
|
2171
|
+
if (!externalOpen) {
|
|
2172
|
+
hasTrackedExposure.current = false;
|
|
2173
|
+
}
|
|
2174
|
+
}, [externalOpen, classId]);
|
|
2125
2175
|
const handleClose = () => {
|
|
2176
|
+
if (classId) {
|
|
2177
|
+
trackGlobalClasses({ event: "classSyncToV3PopupClick", classId, action: "cancel" });
|
|
2178
|
+
}
|
|
2126
2179
|
onExternalClose?.();
|
|
2127
2180
|
};
|
|
2128
2181
|
const handleConfirm = () => {
|
|
2182
|
+
if (classId) {
|
|
2183
|
+
trackGlobalClasses({ event: "classSyncToV3PopupClick", classId, action: "sync" });
|
|
2184
|
+
}
|
|
2129
2185
|
onConfirm?.();
|
|
2130
2186
|
onExternalClose?.();
|
|
2131
2187
|
};
|
|
@@ -2196,6 +2252,7 @@ function ClassManagerPanel() {
|
|
|
2196
2252
|
}
|
|
2197
2253
|
})
|
|
2198
2254
|
);
|
|
2255
|
+
trackGlobalClasses({ event: "classSyncToV3", classId, action: "unsync" });
|
|
2199
2256
|
setStopSyncConfirmation(null);
|
|
2200
2257
|
}, []);
|
|
2201
2258
|
const handleStartSync = useCallback((classId) => {
|
|
@@ -2207,6 +2264,7 @@ function ClassManagerPanel() {
|
|
|
2207
2264
|
}
|
|
2208
2265
|
})
|
|
2209
2266
|
);
|
|
2267
|
+
trackGlobalClasses({ event: "classSyncToV3", classId, action: "sync" });
|
|
2210
2268
|
setStartSyncConfirmation(null);
|
|
2211
2269
|
}, []);
|
|
2212
2270
|
const handleStopSyncRequest = useCallback(
|
|
@@ -2278,6 +2336,7 @@ function ClassManagerPanel() {
|
|
|
2278
2336
|
StartSyncToV3Modal,
|
|
2279
2337
|
{
|
|
2280
2338
|
externalOpen: true,
|
|
2339
|
+
classId: startSyncConfirmation,
|
|
2281
2340
|
onExternalClose: () => setStartSyncConfirmation(null),
|
|
2282
2341
|
onConfirm: () => handleStartSync(startSyncConfirmation)
|
|
2283
2342
|
}
|
|
@@ -2314,7 +2373,7 @@ var CloseButton = ({ onClose, ...props }) => /* @__PURE__ */ React19.createEleme
|
|
|
2314
2373
|
var ErrorBoundaryFallback = () => /* @__PURE__ */ React19.createElement(Box11, { role: "alert", sx: { minHeight: "100%", p: 2 } }, /* @__PURE__ */ React19.createElement(Alert2, { severity: "error", sx: { mb: 2, maxWidth: 400, textAlign: "center" } }, /* @__PURE__ */ React19.createElement("strong", null, __15("Something went wrong", "elementor"))));
|
|
2315
2374
|
var usePreventUnload = () => {
|
|
2316
2375
|
const isDirty2 = useDirtyState();
|
|
2317
|
-
|
|
2376
|
+
useEffect4(() => {
|
|
2318
2377
|
const handleBeforeUnload = (event) => {
|
|
2319
2378
|
if (isDirty2) {
|
|
2320
2379
|
event.preventDefault();
|
|
@@ -2475,11 +2534,11 @@ function createClassName(prefix) {
|
|
|
2475
2534
|
}
|
|
2476
2535
|
|
|
2477
2536
|
// src/components/global-styles-import-listener.tsx
|
|
2478
|
-
import { useEffect as
|
|
2537
|
+
import { useEffect as useEffect5 } from "react";
|
|
2479
2538
|
import { __useDispatch as useDispatch2 } from "@elementor/store";
|
|
2480
2539
|
function GlobalStylesImportListener() {
|
|
2481
2540
|
const dispatch5 = useDispatch2();
|
|
2482
|
-
|
|
2541
|
+
useEffect5(() => {
|
|
2483
2542
|
const handleGlobalStylesImported = (event) => {
|
|
2484
2543
|
const importedClasses = event.detail?.global_classes;
|
|
2485
2544
|
if (importedClasses?.items && importedClasses?.order) {
|
|
@@ -2526,15 +2585,15 @@ function GlobalStylesImportListener() {
|
|
|
2526
2585
|
}
|
|
2527
2586
|
|
|
2528
2587
|
// src/components/open-panel-from-url.tsx
|
|
2529
|
-
import { useEffect as
|
|
2588
|
+
import { useEffect as useEffect6, useRef as useRef3 } from "react";
|
|
2530
2589
|
import { __privateListenTo as listenTo, routeOpenEvent } from "@elementor/editor-v1-adapters";
|
|
2531
2590
|
var ACTIVE_PANEL_PARAM = "active-panel";
|
|
2532
2591
|
var PANEL_ID = "global-classes-manager";
|
|
2533
2592
|
var DEFAULT_PANEL_ROUTE = "panel/elements";
|
|
2534
2593
|
function OpenPanelFromUrl() {
|
|
2535
2594
|
const { open } = usePanelActions();
|
|
2536
|
-
const hasOpened =
|
|
2537
|
-
|
|
2595
|
+
const hasOpened = useRef3(false);
|
|
2596
|
+
useEffect6(() => {
|
|
2538
2597
|
const urlParams = new URLSearchParams(window.location.search);
|
|
2539
2598
|
const activePanel = urlParams.get(ACTIVE_PANEL_PARAM);
|
|
2540
2599
|
if (activePanel !== PANEL_ID) {
|
|
@@ -2555,11 +2614,11 @@ function OpenPanelFromUrl() {
|
|
|
2555
2614
|
}
|
|
2556
2615
|
|
|
2557
2616
|
// src/components/populate-store.tsx
|
|
2558
|
-
import { useEffect as
|
|
2617
|
+
import { useEffect as useEffect7 } from "react";
|
|
2559
2618
|
import { __useDispatch as useDispatch3 } from "@elementor/store";
|
|
2560
2619
|
function PopulateStore() {
|
|
2561
2620
|
const dispatch5 = useDispatch3();
|
|
2562
|
-
|
|
2621
|
+
useEffect7(() => {
|
|
2563
2622
|
Promise.all([apiClient.all("preview"), apiClient.all("frontend")]).then(
|
|
2564
2623
|
([previewRes, frontendRes]) => {
|
|
2565
2624
|
const { data: previewData } = previewRes;
|
|
@@ -3024,7 +3083,7 @@ var initMcpIntegration = () => {
|
|
|
3024
3083
|
};
|
|
3025
3084
|
|
|
3026
3085
|
// src/sync-with-document.tsx
|
|
3027
|
-
import { useEffect as
|
|
3086
|
+
import { useEffect as useEffect8 } from "react";
|
|
3028
3087
|
import { __privateListenTo as listenTo2, v1ReadyEvent } from "@elementor/editor-v1-adapters";
|
|
3029
3088
|
|
|
3030
3089
|
// src/sync-with-document-save.ts
|
|
@@ -3089,7 +3148,7 @@ function isDirty() {
|
|
|
3089
3148
|
// src/sync-with-document.tsx
|
|
3090
3149
|
function SyncWithDocumentSave() {
|
|
3091
3150
|
const panelActions = usePanelActions();
|
|
3092
|
-
|
|
3151
|
+
useEffect8(() => {
|
|
3093
3152
|
listenTo2(v1ReadyEvent(), () => {
|
|
3094
3153
|
syncWithDocumentSave(panelActions);
|
|
3095
3154
|
});
|