@elementor/editor-components 3.35.0-452 → 3.35.0-454

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@elementor/editor-components",
3
3
  "description": "Elementor editor components",
4
- "version": "3.35.0-452",
4
+ "version": "3.35.0-454",
5
5
  "private": false,
6
6
  "author": "Elementor Team",
7
7
  "homepage": "https://elementor.com/",
@@ -40,30 +40,30 @@
40
40
  "dev": "tsup --config=../../tsup.dev.ts"
41
41
  },
42
42
  "dependencies": {
43
- "@elementor/editor": "3.35.0-452",
44
- "@elementor/editor-canvas": "3.35.0-452",
45
- "@elementor/editor-controls": "3.35.0-452",
46
- "@elementor/editor-documents": "3.35.0-452",
47
- "@elementor/editor-editing-panel": "3.35.0-452",
48
- "@elementor/editor-elements": "3.35.0-452",
49
- "@elementor/editor-elements-panel": "3.35.0-452",
50
- "@elementor/editor-mcp": "3.35.0-452",
51
- "@elementor/editor-panels": "3.35.0-452",
52
- "@elementor/editor-props": "3.35.0-452",
53
- "@elementor/editor-styles-repository": "3.35.0-452",
54
- "@elementor/editor-ui": "3.35.0-452",
55
- "@elementor/editor-v1-adapters": "3.35.0-452",
56
- "@elementor/http-client": "3.35.0-452",
43
+ "@elementor/editor": "3.35.0-454",
44
+ "@elementor/editor-canvas": "3.35.0-454",
45
+ "@elementor/editor-controls": "3.35.0-454",
46
+ "@elementor/editor-documents": "3.35.0-454",
47
+ "@elementor/editor-editing-panel": "3.35.0-454",
48
+ "@elementor/editor-elements": "3.35.0-454",
49
+ "@elementor/editor-elements-panel": "3.35.0-454",
50
+ "@elementor/editor-mcp": "3.35.0-454",
51
+ "@elementor/editor-panels": "3.35.0-454",
52
+ "@elementor/editor-props": "3.35.0-454",
53
+ "@elementor/editor-styles-repository": "3.35.0-454",
54
+ "@elementor/editor-ui": "3.35.0-454",
55
+ "@elementor/editor-v1-adapters": "3.35.0-454",
56
+ "@elementor/http-client": "3.35.0-454",
57
57
  "@elementor/icons": "^1.63.0",
58
- "@elementor/mixpanel": "3.35.0-452",
59
- "@elementor/query": "3.35.0-452",
60
- "@elementor/schema": "3.35.0-452",
61
- "@elementor/store": "3.35.0-452",
58
+ "@elementor/mixpanel": "3.35.0-454",
59
+ "@elementor/query": "3.35.0-454",
60
+ "@elementor/schema": "3.35.0-454",
61
+ "@elementor/store": "3.35.0-454",
62
62
  "@elementor/ui": "1.36.17",
63
- "@elementor/utils": "3.35.0-452",
63
+ "@elementor/utils": "3.35.0-454",
64
64
  "@wordpress/i18n": "^5.13.0",
65
- "@elementor/editor-notifications": "3.35.0-452",
66
- "@elementor/editor-current-user": "3.35.0-452"
65
+ "@elementor/editor-notifications": "3.35.0-454",
66
+ "@elementor/editor-current-user": "3.35.0-454"
67
67
  },
68
68
  "peerDependencies": {
69
69
  "react": "^18.3.1",
@@ -27,7 +27,7 @@ type ComponentsState = {
27
27
  loadStatus: Status;
28
28
  styles: StylesDefinition;
29
29
  createdThisSession: Component[ 'uid' ][];
30
- archivedData: PublishedComponent[];
30
+ archivedThisSession: ComponentId[];
31
31
  path: ComponentsPathItem[];
32
32
  currentComponentId: V1Document[ 'id' ] | null;
33
33
  updatedComponentNames: Record< number, string >;
@@ -47,7 +47,7 @@ export const initialState: ComponentsState = {
47
47
  loadStatus: 'idle',
48
48
  styles: {},
49
49
  createdThisSession: [],
50
- archivedData: [],
50
+ archivedThisSession: [],
51
51
  path: [],
52
52
  currentComponentId: null,
53
53
  updatedComponentNames: {},
@@ -87,14 +87,12 @@ export const slice = createSlice( {
87
87
  state.createdThisSession.push( payload );
88
88
  },
89
89
  archive: ( state, { payload }: PayloadAction< number > ) => {
90
- state.data = state.data.filter( ( component ) => {
91
- const isArchived = component.id === payload;
92
- if ( isArchived ) {
93
- state.archivedData.push( component );
94
- }
95
-
96
- return ! isArchived;
97
- } );
90
+ const component = state.data.find( ( comp ) => comp.id === payload );
91
+
92
+ if ( component ) {
93
+ component.isArchived = true;
94
+ state.archivedThisSession.push( payload );
95
+ }
98
96
  },
99
97
  setCurrentComponentId: ( state, { payload }: PayloadAction< V1Document[ 'id' ] | null > ) => {
100
98
  state.currentComponentId = payload;
@@ -144,7 +142,7 @@ export const slice = createSlice( {
144
142
  } );
145
143
 
146
144
  const selectData = ( state: ComponentsSlice ) => state[ SLICE_NAME ].data;
147
- const selectArchivedData = ( state: ComponentsSlice ) => state[ SLICE_NAME ].archivedData;
145
+ export const selectArchivedThisSession = ( state: ComponentsSlice ) => state[ SLICE_NAME ].archivedThisSession;
148
146
  const selectLoadStatus = ( state: ComponentsSlice ) => state[ SLICE_NAME ].loadStatus;
149
147
  const selectStylesDefinitions = ( state: ComponentsSlice ) => state[ SLICE_NAME ].styles ?? {};
150
148
  const selectUnpublishedData = ( state: ComponentsSlice ) => state[ SLICE_NAME ].unpublishedData;
@@ -170,7 +168,7 @@ export const selectComponents = createSelector(
170
168
  name: item.name,
171
169
  overridableProps: item.overridableProps,
172
170
  } ) ),
173
- ...data,
171
+ ...data.filter( ( component ) => ! component.isArchived ),
174
172
  ]
175
173
  );
176
174
  export const selectUnpublishedComponents = createSelector(
@@ -226,10 +224,6 @@ export const useCurrentComponentId = () => {
226
224
  return useSelector( selectCurrentComponentId );
227
225
  };
228
226
 
229
- export const selectArchivedComponents = createSelector(
230
- selectArchivedData,
231
- ( archivedData: PublishedComponent[] ) => archivedData
232
- );
233
227
  export const selectUpdatedComponentNames = createSelector(
234
228
  ( state: ComponentsSlice ) => state[ SLICE_NAME ].updatedComponentNames,
235
229
  ( updatedComponentNames ) =>
@@ -2,7 +2,7 @@ import { type NotificationData, notify } from '@elementor/editor-notifications';
2
2
  import { __getState as getState } from '@elementor/store';
3
3
 
4
4
  import { apiClient } from '../api';
5
- import { selectArchivedComponents } from '../store/store';
5
+ import { selectArchivedThisSession } from '../store/store';
6
6
 
7
7
  const failedNotification = ( message: string ): NotificationData => ( {
8
8
  type: 'error',
@@ -12,15 +12,13 @@ const failedNotification = ( message: string ): NotificationData => ( {
12
12
 
13
13
  export const updateArchivedComponentBeforeSave = async () => {
14
14
  try {
15
- const archivedComponents = selectArchivedComponents( getState() );
15
+ const archivedComponents = selectArchivedThisSession( getState() );
16
16
 
17
17
  if ( ! archivedComponents.length ) {
18
18
  return;
19
19
  }
20
20
 
21
- const result = await apiClient.updateArchivedComponents(
22
- archivedComponents.map( ( component ) => component.id )
23
- );
21
+ const result = await apiClient.updateArchivedComponents( archivedComponents );
24
22
 
25
23
  const failedIds = result.failedIds.join( ', ' );
26
24
 
package/src/types.ts CHANGED
@@ -15,6 +15,7 @@ export type Component = PublishedComponent | UnpublishedComponent;
15
15
 
16
16
  export type PublishedComponent = BaseComponent & {
17
17
  id: number;
18
+ isArchived?: boolean;
18
19
  };
19
20
 
20
21
  export type UnpublishedComponent = BaseComponent & {