@elementor/editor-variables 3.33.0-179 → 3.33.0-180

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
@@ -17,7 +17,7 @@ import {
17
17
  } from "@elementor/editor-panels";
18
18
  import { SaveChangesDialog, SearchField, ThemeProvider, useDialog } from "@elementor/editor-ui";
19
19
  import { changeEditMode } from "@elementor/editor-v1-adapters";
20
- import { AlertTriangleFilledIcon, ColorFilterIcon, TrashIcon } from "@elementor/icons";
20
+ import { AlertTriangleFilledIcon as AlertTriangleFilledIcon2, ColorFilterIcon, TrashIcon } from "@elementor/icons";
21
21
  import {
22
22
  Alert,
23
23
  AlertAction,
@@ -32,6 +32,7 @@ import {
32
32
  import { __ as __9 } from "@wordpress/i18n";
33
33
 
34
34
  // src/utils/validations.ts
35
+ import { AlertTriangleFilledIcon, InfoCircleFilledIcon } from "@elementor/icons";
35
36
  import { __, sprintf } from "@wordpress/i18n";
36
37
  var ERROR_MESSAGES = {
37
38
  MISSING_VARIABLE_NAME: __("Give your variable a name.", "elementor"),
@@ -46,7 +47,7 @@ var ERROR_MESSAGES = {
46
47
  // eslint-disable-next-line @wordpress/i18n-translator-comments
47
48
  sprintf(__("We found %1$d duplicated %2$s.", "elementor"), count, name)
48
49
  ),
49
- UNEXPECTED_ERROR: __("The save didn\u2019t go through.", "elementor"),
50
+ UNEXPECTED_ERROR: __("There was a glitch.", "elementor"),
50
51
  DUPLICATED_LABEL_ACTION: __("Take me there", "elementor"),
51
52
  DUPLICATED_LABEL_ACTION_MESSAGE: __("Please rename the variables.", "elementor"),
52
53
  UNEXPECTED_ERROR_ACTION_MESSAGE: __("Try saving your variables again.", "elementor")
@@ -68,6 +69,8 @@ var mapServerError = (error) => {
68
69
  return {
69
70
  field: "label",
70
71
  message: ERROR_MESSAGES.BATCH.DUPLICATED_LABELS(count, name),
72
+ severity: "error",
73
+ IconComponent: AlertTriangleFilledIcon,
71
74
  action: {
72
75
  label: ERROR_MESSAGES.BATCH.DUPLICATED_LABEL_ACTION,
73
76
  message: ERROR_MESSAGES.BATCH.DUPLICATED_LABEL_ACTION_MESSAGE,
@@ -80,7 +83,12 @@ var mapServerError = (error) => {
80
83
  if (error?.response?.data?.code === "batch_operation_failed") {
81
84
  return {
82
85
  field: "label",
83
- message: ERROR_MESSAGES.BATCH.UNEXPECTED_ERROR
86
+ message: ERROR_MESSAGES.BATCH.UNEXPECTED_ERROR,
87
+ severity: "secondary",
88
+ IconComponent: InfoCircleFilledIcon,
89
+ action: {
90
+ message: ERROR_MESSAGES.BATCH.UNEXPECTED_ERROR_ACTION_MESSAGE
91
+ }
84
92
  };
85
93
  }
86
94
  return void 0;
@@ -1772,9 +1780,13 @@ function VariablesManagerPanel() {
1772
1780
  content: serverError ? /* @__PURE__ */ React12.createElement(
1773
1781
  Alert,
1774
1782
  {
1775
- severity: "error",
1776
- action: serverError.action ? /* @__PURE__ */ React12.createElement(AlertAction, { onClick: serverError.action.callback }, serverError.action.label) : void 0,
1777
- icon: /* @__PURE__ */ React12.createElement(AlertTriangleFilledIcon, null)
1783
+ severity: serverError.severity ?? "error",
1784
+ action: serverError.action?.label ? /* @__PURE__ */ React12.createElement(AlertAction, { onClick: serverError.action.callback }, serverError.action.label) : void 0,
1785
+ onClose: !serverError.action?.label ? () => {
1786
+ setServerError(null);
1787
+ setIsSaveDisabled(false);
1788
+ } : void 0,
1789
+ icon: serverError.IconComponent ? /* @__PURE__ */ React12.createElement(serverError.IconComponent, null) : /* @__PURE__ */ React12.createElement(AlertTriangleFilledIcon2, null)
1778
1790
  },
1779
1791
  /* @__PURE__ */ React12.createElement(AlertTitle, null, serverError.message),
1780
1792
  serverError.action?.message
@@ -2104,7 +2116,7 @@ import { __ as __12 } from "@wordpress/i18n";
2104
2116
  // src/components/ui/edit-confirmation-dialog.tsx
2105
2117
  import * as React16 from "react";
2106
2118
  import { useState as useState8 } from "react";
2107
- import { AlertTriangleFilledIcon as AlertTriangleFilledIcon2 } from "@elementor/icons";
2119
+ import { AlertTriangleFilledIcon as AlertTriangleFilledIcon3 } from "@elementor/icons";
2108
2120
  import {
2109
2121
  Button as Button5,
2110
2122
  Checkbox,
@@ -2130,7 +2142,7 @@ var EditConfirmationDialog = ({
2130
2142
  }
2131
2143
  onConfirm?.();
2132
2144
  };
2133
- return /* @__PURE__ */ React16.createElement(Dialog2, { open: true, onClose: closeDialog, maxWidth: "xs" }, /* @__PURE__ */ React16.createElement(DialogTitle2, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React16.createElement(AlertTriangleFilledIcon2, { color: "secondary" }), __11("Changes to variables go live right away.", "elementor")), /* @__PURE__ */ React16.createElement(DialogContent2, null, /* @__PURE__ */ React16.createElement(DialogContentText2, { variant: "body2", color: "textPrimary" }, __11(
2145
+ return /* @__PURE__ */ React16.createElement(Dialog2, { open: true, onClose: closeDialog, maxWidth: "xs" }, /* @__PURE__ */ React16.createElement(DialogTitle2, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React16.createElement(AlertTriangleFilledIcon3, { color: "secondary" }), __11("Changes to variables go live right away.", "elementor")), /* @__PURE__ */ React16.createElement(DialogContent2, null, /* @__PURE__ */ React16.createElement(DialogContentText2, { variant: "body2", color: "textPrimary" }, __11(
2134
2146
  "Don't worry - all other changes you make will wait until you publish your site.",
2135
2147
  "elementor"
2136
2148
  ))), /* @__PURE__ */ React16.createElement(DialogActions2, { sx: { justifyContent: "space-between", alignItems: "center" } }, /* @__PURE__ */ React16.createElement(
@@ -2851,7 +2863,7 @@ var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
2851
2863
 
2852
2864
  // src/components/ui/tags/warning-variable-tag.tsx
2853
2865
  import * as React25 from "react";
2854
- import { AlertTriangleFilledIcon as AlertTriangleFilledIcon3 } from "@elementor/icons";
2866
+ import { AlertTriangleFilledIcon as AlertTriangleFilledIcon4 } from "@elementor/icons";
2855
2867
  import { Box as Box5, Chip, Tooltip as Tooltip5, Typography as Typography13 } from "@elementor/ui";
2856
2868
  var WarningVariableTag = React25.forwardRef(
2857
2869
  ({ label, suffix, onClick, icon, ...props }, ref) => {
@@ -2865,7 +2877,7 @@ var WarningVariableTag = React25.forwardRef(
2865
2877
  shape: "rounded",
2866
2878
  variant: "standard",
2867
2879
  onClick,
2868
- icon: /* @__PURE__ */ React25.createElement(AlertTriangleFilledIcon3, null),
2880
+ icon: /* @__PURE__ */ React25.createElement(AlertTriangleFilledIcon4, null),
2869
2881
  label: /* @__PURE__ */ React25.createElement(Tooltip5, { title: displayText, placement: "top" }, /* @__PURE__ */ React25.createElement(Box5, { sx: { display: "inline-grid", minWidth: 0 } }, /* @__PURE__ */ React25.createElement(Typography13, { variant: "caption", noWrap: true, sx: { lineHeight: 1.34 } }, displayText))),
2870
2882
  sx: {
2871
2883
  height: (theme) => theme.spacing(3.5),