@elementor/editor-components 4.2.0-946 → 4.2.0-beta2

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
@@ -1105,8 +1105,8 @@ var componentInstancePropTypeUtil = createPropUtils4(
1105
1105
  import { getMixpanel } from "@elementor/events";
1106
1106
  import { __getState as getState2 } from "@elementor/store";
1107
1107
  var FEATURE_NAME = "Components";
1108
- var trackComponentEvent = ({ action, source, ...data }) => {
1109
- if (source === "system") {
1108
+ var trackComponentEvent = ({ action, source, executedBy, ...data }) => {
1109
+ if (source === "system" || executedBy === "system") {
1110
1110
  return;
1111
1111
  }
1112
1112
  const { dispatchEvent, config } = getMixpanel();
@@ -1114,7 +1114,7 @@ var trackComponentEvent = ({ action, source, ...data }) => {
1114
1114
  return;
1115
1115
  }
1116
1116
  const name = config.names.components[action];
1117
- dispatchEvent?.(name, { ...data, source, "Feature name": FEATURE_NAME });
1117
+ dispatchEvent?.(name, { ...data, executed_by: executedBy ?? source, "Feature name": FEATURE_NAME });
1118
1118
  };
1119
1119
  var onElementDrop = (_args, element) => {
1120
1120
  if (!(element?.model?.get("widgetType") === "e-component")) {
@@ -1130,7 +1130,7 @@ var onElementDrop = (_args, element) => {
1130
1130
  const { locations, secondaryLocations } = eventsManagerConfig;
1131
1131
  trackComponentEvent({
1132
1132
  action: "instanceAdded",
1133
- source: "user",
1133
+ executedBy: "user",
1134
1134
  instance_id: instanceId,
1135
1135
  component_uid: componentUID,
1136
1136
  component_name: componentName,
@@ -1354,7 +1354,7 @@ async function detachComponentInstance({
1354
1354
  const componentUid = selectComponent(getState3(), componentId)?.uid;
1355
1355
  trackComponentEvent({
1356
1356
  action: "detached",
1357
- source: "user",
1357
+ executedBy: "user",
1358
1358
  component_uid: componentUid,
1359
1359
  instance_id: instanceId,
1360
1360
  location: trackingInfo.location,
@@ -2503,7 +2503,7 @@ async function getComponentDocuments({
2503
2503
  }
2504
2504
  async function getComponentIds(elements, cache, isRecursive) {
2505
2505
  const results = await Promise.all(
2506
- elements.map(async ({ widgetType, elType, elements: childElements, settings }) => {
2506
+ elements.filter(Boolean).map(async ({ widgetType, elType, elements: childElements, settings }) => {
2507
2507
  const ids = [];
2508
2508
  if (isComponentInstance({ widgetType, elType })) {
2509
2509
  const componentId = settings?.component_instance?.value?.component_id.value;
@@ -2554,6 +2554,9 @@ async function loadComponentsOverridableProps(componentIds) {
2554
2554
 
2555
2555
  // src/store/actions/load-components-assets.ts
2556
2556
  async function loadComponentsAssets(elements) {
2557
+ if (!elements.length) {
2558
+ return;
2559
+ }
2557
2560
  const documents = await getComponentDocuments({ elements, isRecursive: false });
2558
2561
  updateDocumentState(documents);
2559
2562
  documents.forEach((document2, id) => {
@@ -2874,7 +2877,7 @@ function createComponentView(options) {
2874
2877
  const editorSettings = this.model.get("editor_settings");
2875
2878
  trackComponentEvent({
2876
2879
  action: "edited",
2877
- source: "user",
2880
+ executedBy: "user",
2878
2881
  component_uid: editorSettings?.component_uid,
2879
2882
  component_name: editorSettings?.title,
2880
2883
  location,
@@ -3211,8 +3214,12 @@ function initLoadComponentDataAfterInstanceAdded() {
3211
3214
  });
3212
3215
  }
3213
3216
  function load(result) {
3217
+ if (!result) {
3218
+ return;
3219
+ }
3214
3220
  const containers = Array.isArray(result) ? result : [result];
3215
- loadComponentsAssets(containers.map((container) => container.model.toJSON()));
3221
+ const elements = containers.map((container) => container.model?.toJSON()).filter((element) => !!element);
3222
+ loadComponentsAssets(elements);
3216
3223
  }
3217
3224
 
3218
3225
  // src/init.ts
@@ -3300,6 +3307,8 @@ export {
3300
3307
  publishDraftComponentsInPageBeforeSave,
3301
3308
  registerComponentsReducer,
3302
3309
  resolveOverridePropValue,
3310
+ selectComponentByUid,
3311
+ selectCreatedThisSession,
3303
3312
  selectOverridableProps,
3304
3313
  selectPath,
3305
3314
  slice,