@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/dist/index.mjs CHANGED
@@ -98,7 +98,7 @@ var initialState = {
98
98
  loadStatus: "idle",
99
99
  styles: {},
100
100
  createdThisSession: [],
101
- archivedData: [],
101
+ archivedThisSession: [],
102
102
  path: [],
103
103
  currentComponentId: null,
104
104
  updatedComponentNames: {}
@@ -135,13 +135,11 @@ var slice = createSlice({
135
135
  state.createdThisSession.push(payload);
136
136
  },
137
137
  archive: (state, { payload }) => {
138
- state.data = state.data.filter((component) => {
139
- const isArchived = component.id === payload;
140
- if (isArchived) {
141
- state.archivedData.push(component);
142
- }
143
- return !isArchived;
144
- });
138
+ const component = state.data.find((comp) => comp.id === payload);
139
+ if (component) {
140
+ component.isArchived = true;
141
+ state.archivedThisSession.push(payload);
142
+ }
145
143
  },
146
144
  setCurrentComponentId: (state, { payload }) => {
147
145
  state.currentComponentId = payload;
@@ -184,7 +182,7 @@ var slice = createSlice({
184
182
  }
185
183
  });
186
184
  var selectData = (state) => state[SLICE_NAME].data;
187
- var selectArchivedData = (state) => state[SLICE_NAME].archivedData;
185
+ var selectArchivedThisSession = (state) => state[SLICE_NAME].archivedThisSession;
188
186
  var selectLoadStatus = (state) => state[SLICE_NAME].loadStatus;
189
187
  var selectStylesDefinitions = (state) => state[SLICE_NAME].styles ?? {};
190
188
  var selectUnpublishedData = (state) => state[SLICE_NAME].unpublishedData;
@@ -205,7 +203,7 @@ var selectComponents = createSelector(
205
203
  name: item.name,
206
204
  overridableProps: item.overridableProps
207
205
  })),
208
- ...data
206
+ ...data.filter((component) => !component.isArchived)
209
207
  ]
210
208
  );
211
209
  var selectUnpublishedComponents = createSelector(
@@ -255,10 +253,6 @@ var selectCurrentComponentId = createSelector(
255
253
  var useCurrentComponentId = () => {
256
254
  return useSelector(selectCurrentComponentId);
257
255
  };
258
- var selectArchivedComponents = createSelector(
259
- selectArchivedData,
260
- (archivedData) => archivedData
261
- );
262
256
  var selectUpdatedComponentNames = createSelector(
263
257
  (state) => state[SLICE_NAME].updatedComponentNames,
264
258
  (updatedComponentNames) => Object.entries(updatedComponentNames).map(([componentId, title]) => ({
@@ -5025,13 +5019,11 @@ var failedNotification = (message) => ({
5025
5019
  });
5026
5020
  var updateArchivedComponentBeforeSave = async () => {
5027
5021
  try {
5028
- const archivedComponents = selectArchivedComponents(getState24());
5022
+ const archivedComponents = selectArchivedThisSession(getState24());
5029
5023
  if (!archivedComponents.length) {
5030
5024
  return;
5031
5025
  }
5032
- const result = await apiClient.updateArchivedComponents(
5033
- archivedComponents.map((component) => component.id)
5034
- );
5026
+ const result = await apiClient.updateArchivedComponents(archivedComponents);
5035
5027
  const failedIds = result.failedIds.join(", ");
5036
5028
  if (failedIds) {
5037
5029
  notify5(failedNotification(failedIds));