@elementor/editor-variables 3.33.0-179 → 3.33.0-181
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 +57 -45
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +14 -14
- package/src/components/variables-manager/variables-manager-panel.tsx +19 -3
- package/src/utils/validations.ts +13 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-variables",
|
|
3
|
-
"version": "3.33.0-
|
|
3
|
+
"version": "3.33.0-181",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Elementor Team",
|
|
6
6
|
"homepage": "https://elementor.com/",
|
|
@@ -39,20 +39,20 @@
|
|
|
39
39
|
"dev": "tsup --config=../../tsup.dev.ts"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@elementor/editor": "3.33.0-
|
|
43
|
-
"@elementor/editor-canvas": "3.33.0-
|
|
44
|
-
"@elementor/editor-controls": "3.33.0-
|
|
45
|
-
"@elementor/editor-current-user": "3.33.0-
|
|
46
|
-
"@elementor/editor-editing-panel": "3.33.0-
|
|
47
|
-
"@elementor/editor-mcp": "3.33.0-
|
|
48
|
-
"@elementor/editor-panels": "3.33.0-
|
|
49
|
-
"@elementor/editor-props": "3.33.0-
|
|
50
|
-
"@elementor/editor-ui": "3.33.0-
|
|
51
|
-
"@elementor/editor-v1-adapters": "3.33.0-
|
|
52
|
-
"@elementor/http-client": "3.33.0-
|
|
42
|
+
"@elementor/editor": "3.33.0-181",
|
|
43
|
+
"@elementor/editor-canvas": "3.33.0-181",
|
|
44
|
+
"@elementor/editor-controls": "3.33.0-181",
|
|
45
|
+
"@elementor/editor-current-user": "3.33.0-181",
|
|
46
|
+
"@elementor/editor-editing-panel": "3.33.0-181",
|
|
47
|
+
"@elementor/editor-mcp": "3.33.0-181",
|
|
48
|
+
"@elementor/editor-panels": "3.33.0-181",
|
|
49
|
+
"@elementor/editor-props": "3.33.0-181",
|
|
50
|
+
"@elementor/editor-ui": "3.33.0-181",
|
|
51
|
+
"@elementor/editor-v1-adapters": "3.33.0-181",
|
|
52
|
+
"@elementor/http-client": "3.33.0-181",
|
|
53
53
|
"@elementor/icons": "1.53.0",
|
|
54
|
-
"@elementor/mixpanel": "3.33.0-
|
|
55
|
-
"@elementor/schema": "3.33.0-
|
|
54
|
+
"@elementor/mixpanel": "3.33.0-181",
|
|
55
|
+
"@elementor/schema": "3.33.0-181",
|
|
56
56
|
"@elementor/ui": "1.36.14",
|
|
57
57
|
"@wordpress/i18n": "^5.13.0"
|
|
58
58
|
},
|
|
@@ -114,10 +114,12 @@ export function VariablesManagerPanel() {
|
|
|
114
114
|
setIsSaveDisabled( false );
|
|
115
115
|
} );
|
|
116
116
|
}
|
|
117
|
+
|
|
117
118
|
setServerError( mappedError );
|
|
118
119
|
setIsSaveDisabled( true );
|
|
119
120
|
resetNavigation();
|
|
120
121
|
}
|
|
122
|
+
|
|
121
123
|
return { success: false, error: mappedError };
|
|
122
124
|
} finally {
|
|
123
125
|
setIsSaving( false );
|
|
@@ -238,15 +240,29 @@ export function VariablesManagerPanel() {
|
|
|
238
240
|
content={
|
|
239
241
|
serverError ? (
|
|
240
242
|
<Alert
|
|
241
|
-
severity=
|
|
243
|
+
severity={ serverError.severity ?? 'error' }
|
|
242
244
|
action={
|
|
243
|
-
serverError.action ? (
|
|
245
|
+
serverError.action?.label ? (
|
|
244
246
|
<AlertAction onClick={ serverError.action.callback }>
|
|
245
247
|
{ serverError.action.label }
|
|
246
248
|
</AlertAction>
|
|
247
249
|
) : undefined
|
|
248
250
|
}
|
|
249
|
-
|
|
251
|
+
onClose={
|
|
252
|
+
! serverError.action?.label
|
|
253
|
+
? () => {
|
|
254
|
+
setServerError( null );
|
|
255
|
+
setIsSaveDisabled( false );
|
|
256
|
+
}
|
|
257
|
+
: undefined
|
|
258
|
+
}
|
|
259
|
+
icon={
|
|
260
|
+
serverError.IconComponent ? (
|
|
261
|
+
<serverError.IconComponent />
|
|
262
|
+
) : (
|
|
263
|
+
<AlertTriangleFilledIcon />
|
|
264
|
+
)
|
|
265
|
+
}
|
|
250
266
|
>
|
|
251
267
|
<AlertTitle>{ serverError.message }</AlertTitle>
|
|
252
268
|
{ serverError.action?.message }
|
package/src/utils/validations.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import { AlertTriangleFilledIcon, InfoCircleFilledIcon } from '@elementor/icons';
|
|
1
3
|
import { __, sprintf } from '@wordpress/i18n';
|
|
2
4
|
|
|
3
5
|
import { type TVariable, type TVariablesList } from '../storage';
|
|
@@ -14,7 +16,7 @@ export const ERROR_MESSAGES = {
|
|
|
14
16
|
DUPLICATED_LABELS: ( count: number, name: string ) =>
|
|
15
17
|
// eslint-disable-next-line @wordpress/i18n-translator-comments
|
|
16
18
|
sprintf( __( 'We found %1$d duplicated %2$s.', 'elementor' ), count, name ),
|
|
17
|
-
UNEXPECTED_ERROR: __( '
|
|
19
|
+
UNEXPECTED_ERROR: __( 'There was a glitch.', 'elementor' ),
|
|
18
20
|
DUPLICATED_LABEL_ACTION: __( 'Take me there', 'elementor' ),
|
|
19
21
|
DUPLICATED_LABEL_ACTION_MESSAGE: __( 'Please rename the variables.', 'elementor' ),
|
|
20
22
|
UNEXPECTED_ERROR_ACTION_MESSAGE: __( 'Try saving your variables again.', 'elementor' ),
|
|
@@ -39,7 +41,7 @@ export type ErrorResponse = {
|
|
|
39
41
|
};
|
|
40
42
|
|
|
41
43
|
export type ErrorAction = {
|
|
42
|
-
label
|
|
44
|
+
label?: string;
|
|
43
45
|
message?: string;
|
|
44
46
|
callback?: () => void;
|
|
45
47
|
data?: {
|
|
@@ -51,6 +53,8 @@ export type MappedError = {
|
|
|
51
53
|
field: string;
|
|
52
54
|
message: string;
|
|
53
55
|
action?: ErrorAction;
|
|
56
|
+
severity?: 'error' | 'secondary';
|
|
57
|
+
IconComponent?: React.ElementType;
|
|
54
58
|
};
|
|
55
59
|
|
|
56
60
|
export const mapServerError = ( error: ErrorResponse ): MappedError | undefined => {
|
|
@@ -70,6 +74,8 @@ export const mapServerError = ( error: ErrorResponse ): MappedError | undefined
|
|
|
70
74
|
return {
|
|
71
75
|
field: 'label',
|
|
72
76
|
message: ERROR_MESSAGES.BATCH.DUPLICATED_LABELS( count, name ),
|
|
77
|
+
severity: 'error',
|
|
78
|
+
IconComponent: AlertTriangleFilledIcon,
|
|
73
79
|
action: {
|
|
74
80
|
label: ERROR_MESSAGES.BATCH.DUPLICATED_LABEL_ACTION,
|
|
75
81
|
message: ERROR_MESSAGES.BATCH.DUPLICATED_LABEL_ACTION_MESSAGE,
|
|
@@ -84,6 +90,11 @@ export const mapServerError = ( error: ErrorResponse ): MappedError | undefined
|
|
|
84
90
|
return {
|
|
85
91
|
field: 'label',
|
|
86
92
|
message: ERROR_MESSAGES.BATCH.UNEXPECTED_ERROR,
|
|
93
|
+
severity: 'secondary',
|
|
94
|
+
IconComponent: InfoCircleFilledIcon,
|
|
95
|
+
action: {
|
|
96
|
+
message: ERROR_MESSAGES.BATCH.UNEXPECTED_ERROR_ACTION_MESSAGE,
|
|
97
|
+
},
|
|
87
98
|
};
|
|
88
99
|
}
|
|
89
100
|
|