@elementor/editor-variables 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 +48 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +48 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/components/variables-manager/variables-manager-panel.tsx +30 -13
- package/src/utils/tracking.ts +29 -0
package/dist/index.js
CHANGED
|
@@ -538,6 +538,26 @@ var trackVariablesManagerEvent = ({ action, varType, controlPath }) => {
|
|
|
538
538
|
}
|
|
539
539
|
dispatchEvent?.(name, eventData);
|
|
540
540
|
};
|
|
541
|
+
var trackVariableSyncToV3 = ({ variableLabel, action }) => {
|
|
542
|
+
try {
|
|
543
|
+
const { dispatchEvent, config } = (0, import_events.getMixpanel)();
|
|
544
|
+
if (!config?.names?.variables?.variableSyncToV3) {
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
547
|
+
const name = config.names.variables.variableSyncToV3;
|
|
548
|
+
const isSync = action === "sync";
|
|
549
|
+
dispatchEvent?.(name, {
|
|
550
|
+
interaction_type: "click",
|
|
551
|
+
target_type: variableLabel,
|
|
552
|
+
target_name: isSync ? "sync_to_v3" : "unsync_to_v3",
|
|
553
|
+
interaction_result: isSync ? "var_is_synced_to_V3" : "var_is_unsynced_from_V3",
|
|
554
|
+
target_location: "widget_panel",
|
|
555
|
+
location_l1: "var_manager",
|
|
556
|
+
interaction_description: isSync ? `user_synced_${variableLabel}_to_v3` : `user_unsync_${variableLabel}_from_v3`
|
|
557
|
+
});
|
|
558
|
+
} catch {
|
|
559
|
+
}
|
|
560
|
+
};
|
|
541
561
|
|
|
542
562
|
// src/utils/validations.ts
|
|
543
563
|
var import_icons = require("@elementor/icons");
|
|
@@ -1932,8 +1952,8 @@ function VariablesManagerPanel() {
|
|
|
1932
1952
|
handleOnChange,
|
|
1933
1953
|
createVariable: createVariable2,
|
|
1934
1954
|
handleDeleteVariable,
|
|
1935
|
-
handleStartSync,
|
|
1936
|
-
handleStopSync,
|
|
1955
|
+
handleStartSync: startSyncFromState,
|
|
1956
|
+
handleStopSync: stopSyncFromState,
|
|
1937
1957
|
handleSave,
|
|
1938
1958
|
isSaving,
|
|
1939
1959
|
handleSearch,
|
|
@@ -1994,22 +2014,35 @@ function VariablesManagerPanel() {
|
|
|
1994
2014
|
},
|
|
1995
2015
|
[handleDeleteVariable]
|
|
1996
2016
|
);
|
|
1997
|
-
const
|
|
2017
|
+
const commitStopSync = (0, import_react14.useCallback)(
|
|
1998
2018
|
(itemId) => {
|
|
1999
|
-
|
|
2000
|
-
|
|
2019
|
+
stopSyncFromState(itemId);
|
|
2020
|
+
const variable = variables[itemId];
|
|
2021
|
+
if (variable) {
|
|
2022
|
+
trackVariableSyncToV3({ variableLabel: variable.label, action: "unsync" });
|
|
2023
|
+
}
|
|
2024
|
+
},
|
|
2025
|
+
[stopSyncFromState, variables]
|
|
2026
|
+
);
|
|
2027
|
+
const handleStartSync = (0, import_react14.useCallback)(
|
|
2028
|
+
(itemId) => {
|
|
2029
|
+
startSyncFromState(itemId);
|
|
2030
|
+
const variable = variables[itemId];
|
|
2031
|
+
if (variable) {
|
|
2032
|
+
trackVariableSyncToV3({ variableLabel: variable.label, action: "sync" });
|
|
2033
|
+
}
|
|
2001
2034
|
},
|
|
2002
|
-
[
|
|
2035
|
+
[startSyncFromState, variables]
|
|
2003
2036
|
);
|
|
2004
|
-
const
|
|
2037
|
+
const handleStopSync = (0, import_react14.useCallback)(
|
|
2005
2038
|
(itemId) => {
|
|
2006
2039
|
if (!isStopSyncSuppressed) {
|
|
2007
2040
|
setStopSyncConfirmation(itemId);
|
|
2008
2041
|
} else {
|
|
2009
|
-
|
|
2042
|
+
commitStopSync(itemId);
|
|
2010
2043
|
}
|
|
2011
2044
|
},
|
|
2012
|
-
[isStopSyncSuppressed,
|
|
2045
|
+
[isStopSyncSuppressed, commitStopSync]
|
|
2013
2046
|
);
|
|
2014
2047
|
const buildMenuActions = (0, import_react14.useCallback)(
|
|
2015
2048
|
(variableId) => {
|
|
@@ -2022,7 +2055,7 @@ function VariablesManagerPanel() {
|
|
|
2022
2055
|
variableId,
|
|
2023
2056
|
handlers: {
|
|
2024
2057
|
onStartSync: handleStartSync,
|
|
2025
|
-
onStopSync:
|
|
2058
|
+
onStopSync: handleStopSync
|
|
2026
2059
|
}
|
|
2027
2060
|
});
|
|
2028
2061
|
const deleteAction = {
|
|
@@ -2040,7 +2073,7 @@ function VariablesManagerPanel() {
|
|
|
2040
2073
|
};
|
|
2041
2074
|
return [...typeActions, deleteAction];
|
|
2042
2075
|
},
|
|
2043
|
-
[variables, handleStartSync,
|
|
2076
|
+
[variables, handleStartSync, handleStopSync]
|
|
2044
2077
|
);
|
|
2045
2078
|
const hasVariables = Object.keys(variables).length > 0;
|
|
2046
2079
|
return /* @__PURE__ */ React14.createElement(import_editor_ui5.ThemeProvider, null, /* @__PURE__ */ React14.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React14.createElement(
|
|
@@ -2175,7 +2208,10 @@ function VariablesManagerPanel() {
|
|
|
2175
2208
|
{
|
|
2176
2209
|
open: true,
|
|
2177
2210
|
onClose: () => setStopSyncConfirmation(null),
|
|
2178
|
-
onConfirm: () =>
|
|
2211
|
+
onConfirm: () => {
|
|
2212
|
+
commitStopSync(stopSyncConfirmation);
|
|
2213
|
+
setStopSyncConfirmation(null);
|
|
2214
|
+
}
|
|
2179
2215
|
}
|
|
2180
2216
|
), isSaveChangesDialogOpen && /* @__PURE__ */ React14.createElement(import_editor_ui5.SaveChangesDialog, null, /* @__PURE__ */ React14.createElement(import_editor_ui5.SaveChangesDialog.Title, { onClose: closeSaveChangesDialog }, (0, import_i18n10.__)("You have unsaved changes", "elementor")), /* @__PURE__ */ React14.createElement(import_editor_ui5.SaveChangesDialog.Content, null, /* @__PURE__ */ React14.createElement(import_editor_ui5.SaveChangesDialog.ContentText, null, (0, import_i18n10.__)("To avoid losing your updates, save your changes before leaving.", "elementor"))), /* @__PURE__ */ React14.createElement(
|
|
2181
2217
|
import_editor_ui5.SaveChangesDialog.Actions,
|