@elementor/editor-variables 3.33.0-257 → 3.33.0-259

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.mjs CHANGED
@@ -31,6 +31,43 @@ import {
31
31
  } from "@elementor/ui";
32
32
  import { __ as __9 } from "@wordpress/i18n";
33
33
 
34
+ // src/utils/tracking.ts
35
+ import { getMixpanel } from "@elementor/mixpanel";
36
+ var trackVariableEvent = ({ varType, controlPath, action }) => {
37
+ const { dispatchEvent, config } = getMixpanel();
38
+ if (!config?.names?.variables?.[action]) {
39
+ return;
40
+ }
41
+ const name = config.names.variables[action];
42
+ dispatchEvent?.(name, {
43
+ location: config?.locations?.variables || "",
44
+ secondaryLocation: config?.secondaryLocations?.variablesPopover || "",
45
+ trigger: config?.triggers?.click || "",
46
+ var_type: varType,
47
+ control_path: controlPath,
48
+ action_type: name
49
+ });
50
+ };
51
+ var trackVariablesManagerEvent = ({ action, varType, controlPath }) => {
52
+ const { dispatchEvent, config } = getMixpanel();
53
+ if (!config?.names?.variables?.[action]) {
54
+ return;
55
+ }
56
+ const name = config.names.variables[action];
57
+ const eventData = {
58
+ location: config?.locations?.variablesManager || "",
59
+ trigger: config?.triggers?.click || "",
60
+ action_type: name
61
+ };
62
+ if (varType) {
63
+ eventData.var_type = varType;
64
+ }
65
+ if (controlPath) {
66
+ eventData.style_control_path = controlPath;
67
+ }
68
+ dispatchEvent?.(name, eventData);
69
+ };
70
+
34
71
  // src/utils/validations.ts
35
72
  import { AlertTriangleFilledIcon, InfoCircleFilledIcon } from "@elementor/icons";
36
73
  import { __, sprintf } from "@wordpress/i18n";
@@ -127,154 +164,70 @@ var validateValue = (value) => {
127
164
  return "";
128
165
  };
129
166
 
130
- // src/components/ui/delete-confirmation-dialog.tsx
131
- import * as React from "react";
132
- import { AlertOctagonFilledIcon } from "@elementor/icons";
133
- import {
134
- Button,
135
- Dialog,
136
- DialogActions,
137
- DialogContent,
138
- DialogContentText,
139
- DialogTitle,
140
- Typography
141
- } from "@elementor/ui";
142
- import { __ as __2 } from "@wordpress/i18n";
143
- var TITLE_ID = "delete-variable-dialog";
144
- var DeleteConfirmationDialog = ({
145
- open,
146
- label,
147
- closeDialog,
148
- onConfirm
149
- }) => {
150
- return /* @__PURE__ */ React.createElement(Dialog, { open, onClose: closeDialog, "aria-labelledby": TITLE_ID, maxWidth: "xs" }, /* @__PURE__ */ React.createElement(DialogTitle, { id: TITLE_ID, display: "flex", alignItems: "center", gap: 1, sx: { lineHeight: 1 } }, /* @__PURE__ */ React.createElement(AlertOctagonFilledIcon, { color: "error" }), __2("Delete this variable?", "elementor")), /* @__PURE__ */ React.createElement(DialogContent, null, /* @__PURE__ */ React.createElement(DialogContentText, { variant: "body2", color: "textPrimary" }, __2("All elements using", "elementor"), "\xA0", /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle2", component: "span", sx: { lineBreak: "anywhere" } }, label), "\xA0", __2("will keep their current values, but the variable itself will be removed.", "elementor"))), /* @__PURE__ */ React.createElement(DialogActions, null, /* @__PURE__ */ React.createElement(Button, { color: "secondary", onClick: closeDialog }, __2("Not now", "elementor")), /* @__PURE__ */ React.createElement(Button, { variant: "contained", color: "error", onClick: onConfirm }, __2("Delete", "elementor"))));
151
- };
167
+ // src/variables-registry/create-variable-type-registry.ts
168
+ import { styleTransformersRegistry } from "@elementor/editor-canvas";
169
+ import { stylesInheritanceTransformersRegistry } from "@elementor/editor-editing-panel";
152
170
 
153
- // src/components/ui/empty-state.tsx
154
- import * as React2 from "react";
155
- import { Button as Button2, Stack, Typography as Typography2 } from "@elementor/ui";
171
+ // src/transformers/inheritance-transformer.tsx
172
+ import * as React from "react";
173
+ import { createTransformer } from "@elementor/editor-canvas";
174
+ import { Stack, Typography } from "@elementor/ui";
156
175
  import { __ as __3 } from "@wordpress/i18n";
157
176
 
158
- // src/hooks/use-permissions.ts
159
- import { useCurrentUserCapabilities } from "@elementor/editor-current-user";
160
- var usePermissions = () => {
161
- const { canUser } = useCurrentUserCapabilities();
162
- return {
163
- canAssign: () => canUser("edit_posts"),
164
- canUnlink: () => canUser("edit_posts"),
165
- canAdd: () => canUser("manage_options"),
166
- canDelete: () => canUser("manage_options"),
167
- canEdit: () => canUser("manage_options"),
168
- canRestore: () => canUser("manage_options"),
169
- canManageSettings: () => canUser("manage_options")
170
- };
171
- };
172
-
173
- // src/components/ui/empty-state.tsx
174
- var EmptyState = ({ icon, title, message, onAdd }) => {
175
- const canAdd = usePermissions().canAdd();
176
- return /* @__PURE__ */ React2.createElement(
177
- Stack,
178
- {
179
- gap: 1,
180
- alignItems: "center",
181
- justifyContent: "flex-start",
182
- height: "100%",
183
- color: "text.secondary",
184
- sx: { p: 2.5, pt: 8, pb: 5.5 }
185
- },
186
- icon,
187
- canAdd ? /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(Content, { title, message }), onAdd && /* @__PURE__ */ React2.createElement(Button2, { variant: "outlined", color: "secondary", size: "small", onClick: onAdd }, __3("Create a variable", "elementor"))) : /* @__PURE__ */ React2.createElement(
188
- Content,
189
- {
190
- title: __3("There are no variables", "elementor"),
191
- message: __3("With your current role, you can only connect and detach variables.", "elementor")
192
- }
193
- )
194
- );
195
- };
196
- function Content({ title, message }) {
197
- return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(Typography2, { align: "center", variant: "subtitle2" }, title), /* @__PURE__ */ React2.createElement(Typography2, { align: "center", variant: "caption", maxWidth: "180px" }, message));
198
- }
177
+ // src/components/ui/color-indicator.tsx
178
+ import { styled, UnstableColorIndicator } from "@elementor/ui";
179
+ var ColorIndicator = styled(UnstableColorIndicator)(({ theme }) => ({
180
+ borderRadius: `${theme.shape.borderRadius / 2}px`,
181
+ marginRight: theme.spacing(0.25)
182
+ }));
199
183
 
200
- // src/components/ui/no-search-results.tsx
201
- import * as React3 from "react";
202
- import { Link, Stack as Stack2, Typography as Typography3 } from "@elementor/ui";
203
- import { __ as __4 } from "@wordpress/i18n";
204
- var NoSearchResults = ({ searchValue, onClear, icon }) => {
205
- return /* @__PURE__ */ React3.createElement(
206
- Stack2,
207
- {
208
- gap: 1,
209
- alignItems: "center",
210
- justifyContent: "center",
211
- p: 2.5,
212
- color: "text.secondary",
213
- sx: { pb: 3.5, pt: 8 }
214
- },
215
- icon,
216
- /* @__PURE__ */ React3.createElement(Typography3, { align: "center", variant: "subtitle2" }, __4("Sorry, nothing matched", "elementor"), /* @__PURE__ */ React3.createElement("br", null), "\u201C", searchValue, "\u201D."),
217
- /* @__PURE__ */ React3.createElement(Typography3, { align: "center", variant: "caption", sx: { display: "flex", flexDirection: "column" } }, __4("Try something else.", "elementor"), /* @__PURE__ */ React3.createElement(Link, { color: "text.secondary", variant: "caption", component: "button", onClick: onClear }, __4("Clear & try again", "elementor")))
218
- );
219
- };
184
+ // src/prop-types/color-variable-prop-type.ts
185
+ import { createPropUtils } from "@elementor/editor-props";
186
+ import { z } from "@elementor/schema";
187
+ var colorVariablePropTypeUtil = createPropUtils("global-color-variable", z.string());
220
188
 
221
- // src/components/variables-manager/hooks/use-auto-edit.ts
222
- import { useCallback, useState } from "react";
223
- var useAutoEdit = () => {
224
- const [autoEditVariableId, setAutoEditVariableId] = useState(void 0);
225
- const startAutoEdit = useCallback((variableId) => {
226
- setAutoEditVariableId(variableId);
227
- }, []);
228
- const handleAutoEditComplete = useCallback(() => {
229
- setTimeout(() => {
230
- setAutoEditVariableId(void 0);
231
- }, 100);
232
- }, []);
233
- return {
234
- autoEditVariableId,
235
- startAutoEdit,
236
- handleAutoEditComplete
237
- };
238
- };
189
+ // src/service.ts
190
+ import { __ as __2 } from "@wordpress/i18n";
239
191
 
240
- // src/components/variables-manager/hooks/use-error-navigation.ts
241
- import { useCallback as useCallback2, useRef } from "react";
242
- var useErrorNavigation = () => {
243
- const currentIndexRef = useRef(0);
244
- const createNavigationCallback = useCallback2(
245
- (ids, onNavigate, onComplete) => {
246
- return () => {
247
- if (!ids?.length) {
248
- return;
249
- }
250
- const currentIndex = currentIndexRef.current;
251
- const currentId = ids[currentIndex];
252
- if (currentId) {
253
- onNavigate(currentId);
254
- const nextIndex = currentIndex + 1;
255
- if (nextIndex >= ids.length) {
256
- onComplete();
257
- currentIndexRef.current = 0;
258
- } else {
259
- currentIndexRef.current = nextIndex;
260
- }
261
- }
262
- };
263
- },
264
- []
265
- );
266
- const resetNavigation = useCallback2(() => {
267
- currentIndexRef.current = 0;
268
- }, []);
269
- return {
270
- createNavigationCallback,
271
- resetNavigation
272
- };
192
+ // src/api.ts
193
+ import { httpService } from "@elementor/http-client";
194
+ var BASE_PATH = "elementor/v1/variables";
195
+ var apiClient = {
196
+ list: () => {
197
+ return httpService().get(BASE_PATH + "/list");
198
+ },
199
+ create: (type, label, value) => {
200
+ return httpService().post(BASE_PATH + "/create", {
201
+ type,
202
+ label,
203
+ value
204
+ });
205
+ },
206
+ update: (id2, label, value) => {
207
+ return httpService().put(BASE_PATH + "/update", {
208
+ id: id2,
209
+ label,
210
+ value
211
+ });
212
+ },
213
+ delete: (id2) => {
214
+ return httpService().post(BASE_PATH + "/delete", { id: id2 });
215
+ },
216
+ restore: (id2, label, value) => {
217
+ const payload = { id: id2 };
218
+ if (label) {
219
+ payload.label = label;
220
+ }
221
+ if (value) {
222
+ payload.value = value;
223
+ }
224
+ return httpService().post(BASE_PATH + "/restore", payload);
225
+ },
226
+ batch: (payload) => {
227
+ return httpService().post(BASE_PATH + "/batch", payload);
228
+ }
273
229
  };
274
230
 
275
- // src/components/variables-manager/hooks/use-variables-manager-state.ts
276
- import { useCallback as useCallback3, useState as useState2 } from "react";
277
-
278
231
  // src/batch-operations.ts
279
232
  var generateTempId = () => {
280
233
  const timestamp = Date.now().toString(36);
@@ -335,78 +288,6 @@ var buildOperationsArray = (originalVariables, currentVariables) => {
335
288
  });
336
289
  };
337
290
 
338
- // src/hooks/use-prop-variables.ts
339
- import { useMemo } from "react";
340
- import { useBoundProp } from "@elementor/editor-controls";
341
-
342
- // src/context/variable-type-context.tsx
343
- import * as React5 from "react";
344
- import { createContext, useContext } from "react";
345
-
346
- // src/variables-registry/create-variable-type-registry.ts
347
- import { styleTransformersRegistry } from "@elementor/editor-canvas";
348
- import { stylesInheritanceTransformersRegistry } from "@elementor/editor-editing-panel";
349
-
350
- // src/transformers/inheritance-transformer.tsx
351
- import * as React4 from "react";
352
- import { createTransformer } from "@elementor/editor-canvas";
353
- import { Stack as Stack3, Typography as Typography4 } from "@elementor/ui";
354
- import { __ as __6 } from "@wordpress/i18n";
355
-
356
- // src/components/ui/color-indicator.tsx
357
- import { styled, UnstableColorIndicator } from "@elementor/ui";
358
- var ColorIndicator = styled(UnstableColorIndicator)(({ theme }) => ({
359
- borderRadius: `${theme.shape.borderRadius / 2}px`,
360
- marginRight: theme.spacing(0.25)
361
- }));
362
-
363
- // src/prop-types/color-variable-prop-type.ts
364
- import { createPropUtils } from "@elementor/editor-props";
365
- import { z } from "@elementor/schema";
366
- var colorVariablePropTypeUtil = createPropUtils("global-color-variable", z.string());
367
-
368
- // src/service.ts
369
- import { __ as __5 } from "@wordpress/i18n";
370
-
371
- // src/api.ts
372
- import { httpService } from "@elementor/http-client";
373
- var BASE_PATH = "elementor/v1/variables";
374
- var apiClient = {
375
- list: () => {
376
- return httpService().get(BASE_PATH + "/list");
377
- },
378
- create: (type, label, value) => {
379
- return httpService().post(BASE_PATH + "/create", {
380
- type,
381
- label,
382
- value
383
- });
384
- },
385
- update: (id2, label, value) => {
386
- return httpService().put(BASE_PATH + "/update", {
387
- id: id2,
388
- label,
389
- value
390
- });
391
- },
392
- delete: (id2) => {
393
- return httpService().post(BASE_PATH + "/delete", { id: id2 });
394
- },
395
- restore: (id2, label, value) => {
396
- const payload = { id: id2 };
397
- if (label) {
398
- payload.label = label;
399
- }
400
- if (value) {
401
- payload.value = value;
402
- }
403
- return httpService().post(BASE_PATH + "/restore", payload);
404
- },
405
- batch: (payload) => {
406
- return httpService().post(BASE_PATH + "/batch", payload);
407
- }
408
- };
409
-
410
291
  // src/storage.ts
411
292
  var STORAGE_KEY = "elementor-global-variables";
412
293
  var STORAGE_WATERMARK_KEY = "elementor-global-variables-watermark";
@@ -571,7 +452,7 @@ var service = {
571
452
  return apiClient.create(type, label, value).then((response) => {
572
453
  const { success, data: payload } = response.data;
573
454
  if (!success) {
574
- const errorMessage = payload?.message || __5("Unexpected response from server", "elementor");
455
+ const errorMessage = payload?.message || __2("Unexpected response from server", "elementor");
575
456
  throw new Error(errorMessage);
576
457
  }
577
458
  return payload;
@@ -593,7 +474,7 @@ var service = {
593
474
  return apiClient.update(id2, label, value).then((response) => {
594
475
  const { success, data: payload } = response.data;
595
476
  if (!success) {
596
- const errorMessage = payload?.message || __5("Unexpected response from server", "elementor");
477
+ const errorMessage = payload?.message || __2("Unexpected response from server", "elementor");
597
478
  throw new Error(errorMessage);
598
479
  }
599
480
  return payload;
@@ -726,11 +607,11 @@ var inheritanceTransformer = createTransformer((id2) => {
726
607
  const variables = service.variables();
727
608
  const variable = variables[id2];
728
609
  if (!variable) {
729
- return /* @__PURE__ */ React4.createElement("span", null, __6("Missing variable", "elementor"));
610
+ return /* @__PURE__ */ React.createElement("span", null, __3("Missing variable", "elementor"));
730
611
  }
731
612
  const showColorIndicator = variable.type === colorVariablePropTypeUtil.key;
732
613
  const css = resolveCssVariable(id2, variable);
733
- return /* @__PURE__ */ React4.createElement(Stack3, { direction: "row", spacing: 0.5, sx: { paddingInline: "1px" }, alignItems: "center" }, showColorIndicator && /* @__PURE__ */ React4.createElement(ColorIndicator, { size: "inherit", value: variable.value }), /* @__PURE__ */ React4.createElement(Typography4, { variant: "caption", overflow: "hidden", whiteSpace: "nowrap", textOverflow: "ellipsis" }, css));
614
+ return /* @__PURE__ */ React.createElement(Stack, { direction: "row", spacing: 0.5, sx: { paddingInline: "1px" }, alignItems: "center" }, showColorIndicator && /* @__PURE__ */ React.createElement(ColorIndicator, { size: "inherit", value: variable.value }), /* @__PURE__ */ React.createElement(Typography, { variant: "caption", overflow: "hidden", whiteSpace: "nowrap", textOverflow: "ellipsis" }, css));
734
615
  });
735
616
 
736
617
  // src/transformers/variable-transformer.ts
@@ -812,7 +693,161 @@ function createVariableTypeRegistry() {
812
693
  // src/variables-registry/variable-type-registry.ts
813
694
  var { registerVariableType, getVariableType, getVariableTypes, hasVariableType } = createVariableTypeRegistry();
814
695
 
696
+ // src/components/ui/delete-confirmation-dialog.tsx
697
+ import * as React2 from "react";
698
+ import { AlertOctagonFilledIcon } from "@elementor/icons";
699
+ import {
700
+ Button,
701
+ Dialog,
702
+ DialogActions,
703
+ DialogContent,
704
+ DialogContentText,
705
+ DialogTitle,
706
+ Typography as Typography2
707
+ } from "@elementor/ui";
708
+ import { __ as __4 } from "@wordpress/i18n";
709
+ var TITLE_ID = "delete-variable-dialog";
710
+ var DeleteConfirmationDialog = ({
711
+ open,
712
+ label,
713
+ closeDialog,
714
+ onConfirm
715
+ }) => {
716
+ return /* @__PURE__ */ React2.createElement(Dialog, { open, onClose: closeDialog, "aria-labelledby": TITLE_ID, maxWidth: "xs" }, /* @__PURE__ */ React2.createElement(DialogTitle, { id: TITLE_ID, display: "flex", alignItems: "center", gap: 1, sx: { lineHeight: 1 } }, /* @__PURE__ */ React2.createElement(AlertOctagonFilledIcon, { color: "error" }), __4("Delete this variable?", "elementor")), /* @__PURE__ */ React2.createElement(DialogContent, null, /* @__PURE__ */ React2.createElement(DialogContentText, { variant: "body2", color: "textPrimary" }, __4("All elements using", "elementor"), "\xA0", /* @__PURE__ */ React2.createElement(Typography2, { variant: "subtitle2", component: "span", sx: { lineBreak: "anywhere" } }, label), "\xA0", __4("will keep their current values, but the variable itself will be removed.", "elementor"))), /* @__PURE__ */ React2.createElement(DialogActions, null, /* @__PURE__ */ React2.createElement(Button, { color: "secondary", onClick: closeDialog }, __4("Not now", "elementor")), /* @__PURE__ */ React2.createElement(Button, { variant: "contained", color: "error", onClick: onConfirm }, __4("Delete", "elementor"))));
717
+ };
718
+
719
+ // src/components/ui/empty-state.tsx
720
+ import * as React3 from "react";
721
+ import { Button as Button2, Stack as Stack2, Typography as Typography3 } from "@elementor/ui";
722
+ import { __ as __5 } from "@wordpress/i18n";
723
+
724
+ // src/hooks/use-permissions.ts
725
+ import { useCurrentUserCapabilities } from "@elementor/editor-current-user";
726
+ var usePermissions = () => {
727
+ const { canUser } = useCurrentUserCapabilities();
728
+ return {
729
+ canAssign: () => canUser("edit_posts"),
730
+ canUnlink: () => canUser("edit_posts"),
731
+ canAdd: () => canUser("manage_options"),
732
+ canDelete: () => canUser("manage_options"),
733
+ canEdit: () => canUser("manage_options"),
734
+ canRestore: () => canUser("manage_options"),
735
+ canManageSettings: () => canUser("manage_options")
736
+ };
737
+ };
738
+
739
+ // src/components/ui/empty-state.tsx
740
+ var EmptyState = ({ icon, title, message, onAdd }) => {
741
+ const canAdd = usePermissions().canAdd();
742
+ return /* @__PURE__ */ React3.createElement(
743
+ Stack2,
744
+ {
745
+ gap: 1,
746
+ alignItems: "center",
747
+ justifyContent: "flex-start",
748
+ height: "100%",
749
+ color: "text.secondary",
750
+ sx: { p: 2.5, pt: 8, pb: 5.5 }
751
+ },
752
+ icon,
753
+ canAdd ? /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(Content, { title, message }), onAdd && /* @__PURE__ */ React3.createElement(Button2, { variant: "outlined", color: "secondary", size: "small", onClick: onAdd }, __5("Create a variable", "elementor"))) : /* @__PURE__ */ React3.createElement(
754
+ Content,
755
+ {
756
+ title: __5("There are no variables", "elementor"),
757
+ message: __5("With your current role, you can only connect and detach variables.", "elementor")
758
+ }
759
+ )
760
+ );
761
+ };
762
+ function Content({ title, message }) {
763
+ return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(Typography3, { align: "center", variant: "subtitle2" }, title), /* @__PURE__ */ React3.createElement(Typography3, { align: "center", variant: "caption", maxWidth: "180px" }, message));
764
+ }
765
+
766
+ // src/components/ui/no-search-results.tsx
767
+ import * as React4 from "react";
768
+ import { Link, Stack as Stack3, Typography as Typography4 } from "@elementor/ui";
769
+ import { __ as __6 } from "@wordpress/i18n";
770
+ var NoSearchResults = ({ searchValue, onClear, icon }) => {
771
+ return /* @__PURE__ */ React4.createElement(
772
+ Stack3,
773
+ {
774
+ gap: 1,
775
+ alignItems: "center",
776
+ justifyContent: "center",
777
+ p: 2.5,
778
+ color: "text.secondary",
779
+ sx: { pb: 3.5, pt: 8 }
780
+ },
781
+ icon,
782
+ /* @__PURE__ */ React4.createElement(Typography4, { align: "center", variant: "subtitle2" }, __6("Sorry, nothing matched", "elementor"), /* @__PURE__ */ React4.createElement("br", null), "\u201C", searchValue, "\u201D."),
783
+ /* @__PURE__ */ React4.createElement(Typography4, { align: "center", variant: "caption", sx: { display: "flex", flexDirection: "column" } }, __6("Try something else.", "elementor"), /* @__PURE__ */ React4.createElement(Link, { color: "text.secondary", variant: "caption", component: "button", onClick: onClear }, __6("Clear & try again", "elementor")))
784
+ );
785
+ };
786
+
787
+ // src/components/variables-manager/hooks/use-auto-edit.ts
788
+ import { useCallback, useState } from "react";
789
+ var useAutoEdit = () => {
790
+ const [autoEditVariableId, setAutoEditVariableId] = useState(void 0);
791
+ const startAutoEdit = useCallback((variableId) => {
792
+ setAutoEditVariableId(variableId);
793
+ }, []);
794
+ const handleAutoEditComplete = useCallback(() => {
795
+ setTimeout(() => {
796
+ setAutoEditVariableId(void 0);
797
+ }, 100);
798
+ }, []);
799
+ return {
800
+ autoEditVariableId,
801
+ startAutoEdit,
802
+ handleAutoEditComplete
803
+ };
804
+ };
805
+
806
+ // src/components/variables-manager/hooks/use-error-navigation.ts
807
+ import { useCallback as useCallback2, useRef } from "react";
808
+ var useErrorNavigation = () => {
809
+ const currentIndexRef = useRef(0);
810
+ const createNavigationCallback = useCallback2(
811
+ (ids, onNavigate, onComplete) => {
812
+ return () => {
813
+ if (!ids?.length) {
814
+ return;
815
+ }
816
+ const currentIndex = currentIndexRef.current;
817
+ const currentId = ids[currentIndex];
818
+ if (currentId) {
819
+ onNavigate(currentId);
820
+ const nextIndex = currentIndex + 1;
821
+ if (nextIndex >= ids.length) {
822
+ onComplete();
823
+ currentIndexRef.current = 0;
824
+ } else {
825
+ currentIndexRef.current = nextIndex;
826
+ }
827
+ }
828
+ };
829
+ },
830
+ []
831
+ );
832
+ const resetNavigation = useCallback2(() => {
833
+ currentIndexRef.current = 0;
834
+ }, []);
835
+ return {
836
+ createNavigationCallback,
837
+ resetNavigation
838
+ };
839
+ };
840
+
841
+ // src/components/variables-manager/hooks/use-variables-manager-state.ts
842
+ import { useCallback as useCallback3, useState as useState2 } from "react";
843
+
844
+ // src/hooks/use-prop-variables.ts
845
+ import { useMemo } from "react";
846
+ import { useBoundProp } from "@elementor/editor-controls";
847
+
815
848
  // src/context/variable-type-context.tsx
849
+ import * as React5 from "react";
850
+ import { createContext, useContext } from "react";
816
851
  var VariableTypeContext = createContext(null);
817
852
  function VariableTypeProvider({ children, propTypeKey }) {
818
853
  return /* @__PURE__ */ React5.createElement(VariableTypeContext.Provider, { value: propTypeKey }, children);
@@ -990,6 +1025,7 @@ var VariableManagerCreateMenu = ({
990
1025
  onClick: () => {
991
1026
  const defaultName = getDefaultName(variables, key, variable.variableType);
992
1027
  onCreate(key, defaultName, variable.defaultValue || "");
1028
+ trackVariablesManagerEvent({ action: "add", varType: variable.variableType });
993
1029
  }
994
1030
  };
995
1031
  });
@@ -1659,7 +1695,9 @@ function VariablesManagerPanel() {
1659
1695
  try {
1660
1696
  setServerError(null);
1661
1697
  resetNavigation();
1662
- return await handleSave();
1698
+ const result = await handleSave();
1699
+ trackVariablesManagerEvent({ action: "saveChanges" });
1700
+ return result;
1663
1701
  } catch (error) {
1664
1702
  const mappedError = mapServerError(error);
1665
1703
  const duplicatedIds = mappedError?.action?.data?.duplicatedIds;
@@ -1691,8 +1729,11 @@ function VariablesManagerPanel() {
1691
1729
  icon: TrashIcon,
1692
1730
  color: "error.main",
1693
1731
  onClick: (itemId) => {
1694
- if (variables[itemId]) {
1695
- setDeleteConfirmation({ id: itemId, label: variables[itemId].label });
1732
+ const variable = variables[itemId];
1733
+ if (variable) {
1734
+ setDeleteConfirmation({ id: itemId, label: variable.label });
1735
+ const variableTypeOptions = getVariableType(variable.type);
1736
+ trackVariablesManagerEvent({ action: "delete", varType: variableTypeOptions?.variableType });
1696
1737
  }
1697
1738
  }
1698
1739
  }
@@ -1959,24 +2000,6 @@ var unwrapValue = (input) => {
1959
2000
  return input;
1960
2001
  };
1961
2002
 
1962
- // src/utils/tracking.ts
1963
- import { getMixpanel } from "@elementor/mixpanel";
1964
- var trackVariableEvent = ({ varType, controlPath, action }) => {
1965
- const { dispatchEvent, config } = getMixpanel();
1966
- if (!config?.names?.variables?.[action]) {
1967
- return;
1968
- }
1969
- const name = config.names.variables[action];
1970
- dispatchEvent?.(name, {
1971
- location: config?.locations?.variables || "",
1972
- secondaryLocation: config?.secondaryLocations?.variablesPopover || "",
1973
- trigger: config?.triggers?.click || "",
1974
- var_type: varType,
1975
- control_path: controlPath,
1976
- action_type: name
1977
- });
1978
- };
1979
-
1980
2003
  // src/components/ui/form-field.tsx
1981
2004
  import * as React14 from "react";
1982
2005
  import { FormHelperText, FormLabel, Grid } from "@elementor/ui";
@@ -2481,13 +2504,21 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
2481
2504
  );
2482
2505
  }
2483
2506
  if (onSettings) {
2507
+ const handleOpenManager = () => {
2508
+ onSettings();
2509
+ trackVariablesManagerEvent({
2510
+ action: "openManager",
2511
+ varType: variableType,
2512
+ controlPath: path.join(".")
2513
+ });
2514
+ };
2484
2515
  actions.push(
2485
2516
  /* @__PURE__ */ React19.createElement(Tooltip3, { key: "settings", placement: "top", title: MANAGER_LABEL }, /* @__PURE__ */ React19.createElement(
2486
2517
  IconButton7,
2487
2518
  {
2488
2519
  id: "variables-manager-button",
2489
2520
  size: SIZE5,
2490
- onClick: onSettings,
2521
+ onClick: handleOpenManager,
2491
2522
  "aria-label": MANAGER_LABEL
2492
2523
  },
2493
2524
  /* @__PURE__ */ React19.createElement(SettingsIcon, { fontSize: SIZE5 })