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

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.d.mts CHANGED
@@ -1306,6 +1306,12 @@ declare const slice: typeof baseSlice;
1306
1306
 
1307
1307
  type ComponentsSlice = SliceState<typeof slice>;
1308
1308
 
1309
+ declare const selectComponentByUid: (state: ComponentsSlice, componentUid: string) => PublishedComponent | UnpublishedComponent | undefined;
1310
+ declare const selectCreatedThisSession: ((state: ComponentsSlice) => string[]) & reselect.OutputSelectorFields<(args_0: string[]) => string[], {
1311
+ clearCache: () => void;
1312
+ }> & {
1313
+ clearCache: () => void;
1314
+ };
1309
1315
  declare const selectOverridableProps: ((state: ComponentsSlice, componentId: number) => OverridableProps | undefined) & reselect.OutputSelectorFields<(args_0: PublishedComponent | undefined) => OverridableProps | undefined, {
1310
1316
  clearCache: () => void;
1311
1317
  }> & {
@@ -1404,14 +1410,18 @@ declare const resolveOverridePropValue: (originalPropValue: ComponentInstanceOve
1404
1410
 
1405
1411
  declare function switchToComponent(componentId: number, componentInstanceId?: string | null, element?: HTMLElement | null): Promise<void>;
1406
1412
 
1407
- type Source = 'user' | 'mcp_tool' | 'system';
1413
+ type ExecutedBy = 'user' | 'mcp_tool' | 'system';
1414
+ /** @deprecated since 4.2.1 - use `ExecutedBy` instead */
1415
+ type Source = ExecutedBy;
1408
1416
  type ComponentEventData = Record<string, unknown> & {
1409
1417
  action: 'createClicked' | 'created' | 'createCancelled' | 'instanceAdded' | 'edited' | 'propertyExposed' | 'propertyRemoved' | 'propertiesPanelOpened' | 'propertiesGroupCreated' | 'detached';
1410
- source: Source;
1418
+ executedBy?: ExecutedBy;
1419
+ /** @deprecated since 4.2.1 - use `executedBy` instead */
1420
+ source?: Source;
1411
1421
  };
1412
- declare const trackComponentEvent: ({ action, source, ...data }: ComponentEventData) => void;
1422
+ declare const trackComponentEvent: ({ action, source, executedBy, ...data }: ComponentEventData) => void;
1413
1423
  declare const onElementDrop: (_args: unknown, element: V1Element) => void;
1414
1424
 
1415
1425
  declare const getComponentDocumentData: (id: number) => Promise<Document | null>;
1416
1426
 
1417
- export { COMPONENT_WIDGET_TYPE, type Component, type ComponentFormValues, type ComponentId, type ComponentInstanceOverride, type ComponentInstanceOverrideProp, type ComponentInstanceOverridePropValue, type ComponentInstanceOverridesPropValue, type ComponentInstanceProp, type ComponentInstancePropValue, ComponentInstanceProvider, ComponentItem, type ComponentItemProps, ComponentName, type ComponentOverridableProp, type ComponentOverridablePropValue, ComponentSearch, ComponentsList, type ComponentsPathItem, type ComponentsSlice, type ComponentsState, DetachAction, type DocumentSaveStatus, EditComponentAction, EmptySearchResult, type ExtendedWindow, EmptyState as InstanceEmptyState, InstancePanelBody, InstancePanelHeader, LoadingComponents, type OriginPropFields, type OriginalElementData, type OverridableProp, OverridablePropProvider, type OverridableProps, type OverridablePropsGroup, type PublishedComponent, SLICE_NAME, type SanitizeAttributes, SearchProvider, type Source, type UnpublishedComponent, type UpdatedComponentName, apiClient, componentInstanceOverridePropTypeUtil, componentInstanceOverridesPropTypeUtil, componentInstancePropTypeUtil, componentOverridablePropTypeUtil, componentsActions, componentsSelectors, createComponentsAction, filterValidOverridableProps, getComponentDocumentData, getContainerByOriginId, getOverridableProp, getPropTypeForComponentOverride, init, isComponentInstance, loadComponentsAssets, onElementDrop, publishDraftComponentsInPageBeforeSave, registerComponentsReducer, resolveOverridePropValue, selectOverridableProps, selectPath, slice, switchToComponent, trackComponentEvent, updateOverridableProp, useComponentInstanceElement, useComponents, useComponentsPermissions, useCurrentComponent, useCurrentComponentId, useFilteredComponents, useInstancePanelData, useIsSanitizedComponent, useOverridablePropValue, useOverridableProps, useSanitizeOverridableProps };
1427
+ export { COMPONENT_WIDGET_TYPE, type Component, type ComponentFormValues, type ComponentId, type ComponentInstanceOverride, type ComponentInstanceOverrideProp, type ComponentInstanceOverridePropValue, type ComponentInstanceOverridesPropValue, type ComponentInstanceProp, type ComponentInstancePropValue, ComponentInstanceProvider, ComponentItem, type ComponentItemProps, ComponentName, type ComponentOverridableProp, type ComponentOverridablePropValue, ComponentSearch, ComponentsList, type ComponentsPathItem, type ComponentsSlice, type ComponentsState, DetachAction, type DocumentSaveStatus, EditComponentAction, EmptySearchResult, type ExecutedBy, type ExtendedWindow, EmptyState as InstanceEmptyState, InstancePanelBody, InstancePanelHeader, LoadingComponents, type OriginPropFields, type OriginalElementData, type OverridableProp, OverridablePropProvider, type OverridableProps, type OverridablePropsGroup, type PublishedComponent, SLICE_NAME, type SanitizeAttributes, SearchProvider, type Source, type UnpublishedComponent, type UpdatedComponentName, apiClient, componentInstanceOverridePropTypeUtil, componentInstanceOverridesPropTypeUtil, componentInstancePropTypeUtil, componentOverridablePropTypeUtil, componentsActions, componentsSelectors, createComponentsAction, filterValidOverridableProps, getComponentDocumentData, getContainerByOriginId, getOverridableProp, getPropTypeForComponentOverride, init, isComponentInstance, loadComponentsAssets, onElementDrop, publishDraftComponentsInPageBeforeSave, registerComponentsReducer, resolveOverridePropValue, selectComponentByUid, selectCreatedThisSession, selectOverridableProps, selectPath, slice, switchToComponent, trackComponentEvent, updateOverridableProp, useComponentInstanceElement, useComponents, useComponentsPermissions, useCurrentComponent, useCurrentComponentId, useFilteredComponents, useInstancePanelData, useIsSanitizedComponent, useOverridablePropValue, useOverridableProps, useSanitizeOverridableProps };
package/dist/index.d.ts CHANGED
@@ -1306,6 +1306,12 @@ declare const slice: typeof baseSlice;
1306
1306
 
1307
1307
  type ComponentsSlice = SliceState<typeof slice>;
1308
1308
 
1309
+ declare const selectComponentByUid: (state: ComponentsSlice, componentUid: string) => PublishedComponent | UnpublishedComponent | undefined;
1310
+ declare const selectCreatedThisSession: ((state: ComponentsSlice) => string[]) & reselect.OutputSelectorFields<(args_0: string[]) => string[], {
1311
+ clearCache: () => void;
1312
+ }> & {
1313
+ clearCache: () => void;
1314
+ };
1309
1315
  declare const selectOverridableProps: ((state: ComponentsSlice, componentId: number) => OverridableProps | undefined) & reselect.OutputSelectorFields<(args_0: PublishedComponent | undefined) => OverridableProps | undefined, {
1310
1316
  clearCache: () => void;
1311
1317
  }> & {
@@ -1404,14 +1410,18 @@ declare const resolveOverridePropValue: (originalPropValue: ComponentInstanceOve
1404
1410
 
1405
1411
  declare function switchToComponent(componentId: number, componentInstanceId?: string | null, element?: HTMLElement | null): Promise<void>;
1406
1412
 
1407
- type Source = 'user' | 'mcp_tool' | 'system';
1413
+ type ExecutedBy = 'user' | 'mcp_tool' | 'system';
1414
+ /** @deprecated since 4.2.1 - use `ExecutedBy` instead */
1415
+ type Source = ExecutedBy;
1408
1416
  type ComponentEventData = Record<string, unknown> & {
1409
1417
  action: 'createClicked' | 'created' | 'createCancelled' | 'instanceAdded' | 'edited' | 'propertyExposed' | 'propertyRemoved' | 'propertiesPanelOpened' | 'propertiesGroupCreated' | 'detached';
1410
- source: Source;
1418
+ executedBy?: ExecutedBy;
1419
+ /** @deprecated since 4.2.1 - use `executedBy` instead */
1420
+ source?: Source;
1411
1421
  };
1412
- declare const trackComponentEvent: ({ action, source, ...data }: ComponentEventData) => void;
1422
+ declare const trackComponentEvent: ({ action, source, executedBy, ...data }: ComponentEventData) => void;
1413
1423
  declare const onElementDrop: (_args: unknown, element: V1Element) => void;
1414
1424
 
1415
1425
  declare const getComponentDocumentData: (id: number) => Promise<Document | null>;
1416
1426
 
1417
- export { COMPONENT_WIDGET_TYPE, type Component, type ComponentFormValues, type ComponentId, type ComponentInstanceOverride, type ComponentInstanceOverrideProp, type ComponentInstanceOverridePropValue, type ComponentInstanceOverridesPropValue, type ComponentInstanceProp, type ComponentInstancePropValue, ComponentInstanceProvider, ComponentItem, type ComponentItemProps, ComponentName, type ComponentOverridableProp, type ComponentOverridablePropValue, ComponentSearch, ComponentsList, type ComponentsPathItem, type ComponentsSlice, type ComponentsState, DetachAction, type DocumentSaveStatus, EditComponentAction, EmptySearchResult, type ExtendedWindow, EmptyState as InstanceEmptyState, InstancePanelBody, InstancePanelHeader, LoadingComponents, type OriginPropFields, type OriginalElementData, type OverridableProp, OverridablePropProvider, type OverridableProps, type OverridablePropsGroup, type PublishedComponent, SLICE_NAME, type SanitizeAttributes, SearchProvider, type Source, type UnpublishedComponent, type UpdatedComponentName, apiClient, componentInstanceOverridePropTypeUtil, componentInstanceOverridesPropTypeUtil, componentInstancePropTypeUtil, componentOverridablePropTypeUtil, componentsActions, componentsSelectors, createComponentsAction, filterValidOverridableProps, getComponentDocumentData, getContainerByOriginId, getOverridableProp, getPropTypeForComponentOverride, init, isComponentInstance, loadComponentsAssets, onElementDrop, publishDraftComponentsInPageBeforeSave, registerComponentsReducer, resolveOverridePropValue, selectOverridableProps, selectPath, slice, switchToComponent, trackComponentEvent, updateOverridableProp, useComponentInstanceElement, useComponents, useComponentsPermissions, useCurrentComponent, useCurrentComponentId, useFilteredComponents, useInstancePanelData, useIsSanitizedComponent, useOverridablePropValue, useOverridableProps, useSanitizeOverridableProps };
1427
+ export { COMPONENT_WIDGET_TYPE, type Component, type ComponentFormValues, type ComponentId, type ComponentInstanceOverride, type ComponentInstanceOverrideProp, type ComponentInstanceOverridePropValue, type ComponentInstanceOverridesPropValue, type ComponentInstanceProp, type ComponentInstancePropValue, ComponentInstanceProvider, ComponentItem, type ComponentItemProps, ComponentName, type ComponentOverridableProp, type ComponentOverridablePropValue, ComponentSearch, ComponentsList, type ComponentsPathItem, type ComponentsSlice, type ComponentsState, DetachAction, type DocumentSaveStatus, EditComponentAction, EmptySearchResult, type ExecutedBy, type ExtendedWindow, EmptyState as InstanceEmptyState, InstancePanelBody, InstancePanelHeader, LoadingComponents, type OriginPropFields, type OriginalElementData, type OverridableProp, OverridablePropProvider, type OverridableProps, type OverridablePropsGroup, type PublishedComponent, SLICE_NAME, type SanitizeAttributes, SearchProvider, type Source, type UnpublishedComponent, type UpdatedComponentName, apiClient, componentInstanceOverridePropTypeUtil, componentInstanceOverridesPropTypeUtil, componentInstancePropTypeUtil, componentOverridablePropTypeUtil, componentsActions, componentsSelectors, createComponentsAction, filterValidOverridableProps, getComponentDocumentData, getContainerByOriginId, getOverridableProp, getPropTypeForComponentOverride, init, isComponentInstance, loadComponentsAssets, onElementDrop, publishDraftComponentsInPageBeforeSave, registerComponentsReducer, resolveOverridePropValue, selectComponentByUid, selectCreatedThisSession, selectOverridableProps, selectPath, slice, switchToComponent, trackComponentEvent, updateOverridableProp, useComponentInstanceElement, useComponents, useComponentsPermissions, useCurrentComponent, useCurrentComponentId, useFilteredComponents, useInstancePanelData, useIsSanitizedComponent, useOverridablePropValue, useOverridableProps, useSanitizeOverridableProps };
package/dist/index.js CHANGED
@@ -66,6 +66,8 @@ __export(index_exports, {
66
66
  publishDraftComponentsInPageBeforeSave: () => publishDraftComponentsInPageBeforeSave,
67
67
  registerComponentsReducer: () => registerComponentsReducer,
68
68
  resolveOverridePropValue: () => resolveOverridePropValue,
69
+ selectComponentByUid: () => selectComponentByUid,
70
+ selectCreatedThisSession: () => selectCreatedThisSession,
69
71
  selectOverridableProps: () => selectOverridableProps,
70
72
  selectPath: () => selectPath,
71
73
  slice: () => slice,
@@ -1182,8 +1184,8 @@ var componentInstancePropTypeUtil = (0, import_editor_props4.createPropUtils)(
1182
1184
  var import_events = require("@elementor/events");
1183
1185
  var import_store8 = require("@elementor/store");
1184
1186
  var FEATURE_NAME = "Components";
1185
- var trackComponentEvent = ({ action, source, ...data }) => {
1186
- if (source === "system") {
1187
+ var trackComponentEvent = ({ action, source, executedBy, ...data }) => {
1188
+ if (source === "system" || executedBy === "system") {
1187
1189
  return;
1188
1190
  }
1189
1191
  const { dispatchEvent, config } = (0, import_events.getMixpanel)();
@@ -1191,7 +1193,7 @@ var trackComponentEvent = ({ action, source, ...data }) => {
1191
1193
  return;
1192
1194
  }
1193
1195
  const name = config.names.components[action];
1194
- dispatchEvent?.(name, { ...data, source, "Feature name": FEATURE_NAME });
1196
+ dispatchEvent?.(name, { ...data, executed_by: executedBy ?? source, "Feature name": FEATURE_NAME });
1195
1197
  };
1196
1198
  var onElementDrop = (_args, element) => {
1197
1199
  if (!(element?.model?.get("widgetType") === "e-component")) {
@@ -1207,7 +1209,7 @@ var onElementDrop = (_args, element) => {
1207
1209
  const { locations, secondaryLocations } = eventsManagerConfig;
1208
1210
  trackComponentEvent({
1209
1211
  action: "instanceAdded",
1210
- source: "user",
1212
+ executedBy: "user",
1211
1213
  instance_id: instanceId,
1212
1214
  component_uid: componentUID,
1213
1215
  component_name: componentName,
@@ -1431,7 +1433,7 @@ async function detachComponentInstance({
1431
1433
  const componentUid = selectComponent((0, import_store10.__getState)(), componentId)?.uid;
1432
1434
  trackComponentEvent({
1433
1435
  action: "detached",
1434
- source: "user",
1436
+ executedBy: "user",
1435
1437
  component_uid: componentUid,
1436
1438
  instance_id: instanceId,
1437
1439
  location: trackingInfo.location,
@@ -2929,7 +2931,7 @@ function createComponentView(options) {
2929
2931
  const editorSettings = this.model.get("editor_settings");
2930
2932
  trackComponentEvent({
2931
2933
  action: "edited",
2932
- source: "user",
2934
+ executedBy: "user",
2933
2935
  component_uid: editorSettings?.component_uid,
2934
2936
  component_name: editorSettings?.title,
2935
2937
  location,
@@ -3356,6 +3358,8 @@ function init() {
3356
3358
  publishDraftComponentsInPageBeforeSave,
3357
3359
  registerComponentsReducer,
3358
3360
  resolveOverridePropValue,
3361
+ selectComponentByUid,
3362
+ selectCreatedThisSession,
3359
3363
  selectOverridableProps,
3360
3364
  selectPath,
3361
3365
  slice,