@elementor/editor-components 3.35.0-463 → 3.35.0-465

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
@@ -250,9 +250,17 @@ var selectCurrentComponentId = createSelector(
250
250
  getCurrentComponentId,
251
251
  (currentComponentId) => currentComponentId
252
252
  );
253
+ var selectCurrentComponent = createSelector(
254
+ selectData,
255
+ getCurrentComponentId,
256
+ (data, currentComponentId) => data.find((component) => component.id === currentComponentId)
257
+ );
253
258
  var useCurrentComponentId = () => {
254
259
  return useSelector(selectCurrentComponentId);
255
260
  };
261
+ var useCurrentComponent = () => {
262
+ return useSelector(selectCurrentComponent);
263
+ };
256
264
  var selectUpdatedComponentNames = createSelector(
257
265
  (state) => state[SLICE_NAME].updatedComponentNames,
258
266
  (updatedComponentNames) => Object.entries(updatedComponentNames).map(([componentId, title]) => ({
@@ -348,7 +356,7 @@ import * as React10 from "react";
348
356
  import { useSuppressedMessage } from "@elementor/editor-current-user";
349
357
  import { getV1DocumentsManager as getV1DocumentsManager3 } from "@elementor/editor-documents";
350
358
  import { ArrowLeftIcon, ComponentsFilledIcon } from "@elementor/icons";
351
- import { __getState as getState9 } from "@elementor/store";
359
+ import { __getState as getState10 } from "@elementor/store";
352
360
  import { Box as Box7, Divider as Divider2, IconButton as IconButton4, Stack as Stack6, Tooltip as Tooltip3, Typography as Typography6 } from "@elementor/ui";
353
361
  import { __ as __12 } from "@wordpress/i18n";
354
362
 
@@ -427,6 +435,42 @@ function useNavigateBack() {
427
435
  }, [path, documentsManager]);
428
436
  }
429
437
 
438
+ // src/utils/tracking.ts
439
+ import { getMixpanel } from "@elementor/mixpanel";
440
+ import { __getState as getState2 } from "@elementor/store";
441
+ var FEATURE_NAME = "Components";
442
+ var trackComponentEvent = ({ action, source, ...data }) => {
443
+ const { dispatchEvent, config } = getMixpanel();
444
+ if (!config?.names?.components?.[action]) {
445
+ return;
446
+ }
447
+ const name = config.names.components[action];
448
+ dispatchEvent?.(name, { ...data, source, "Feature name": FEATURE_NAME });
449
+ };
450
+ var onElementDrop = (_args, element) => {
451
+ if (!(element?.model?.get("widgetType") === "e-component")) {
452
+ return;
453
+ }
454
+ const editorSettings = element.model.get("editor_settings");
455
+ const componentName = editorSettings?.title;
456
+ const componentUID = editorSettings?.component_uid;
457
+ const instanceId = element.id;
458
+ const createdThisSession = selectCreatedThisSession(getState2());
459
+ const isSameSessionReuse = componentUID && createdThisSession.includes(componentUID);
460
+ const eventsManagerConfig = window.elementorCommon.eventsManager.config;
461
+ const { locations, secondaryLocations } = eventsManagerConfig;
462
+ trackComponentEvent({
463
+ action: "instanceAdded",
464
+ source: "user",
465
+ instance_id: instanceId,
466
+ component_uid: componentUID,
467
+ component_name: componentName,
468
+ is_same_session_reuse: isSameSessionReuse,
469
+ location: locations.widgetPanel,
470
+ secondary_location: secondaryLocations.componentsTab
471
+ });
472
+ };
473
+
430
474
  // src/components/component-properties-panel/component-properties-panel.tsx
431
475
  import * as React8 from "react";
432
476
  import { ElementProvider, usePanelActions as useEditingPanelActions } from "@elementor/editor-editing-panel";
@@ -447,13 +491,15 @@ import { generateUniqueId as generateUniqueId2 } from "@elementor/utils";
447
491
  import { __ as __9 } from "@wordpress/i18n";
448
492
 
449
493
  // src/store/actions/add-overridable-group.ts
450
- import { __dispatch as dispatch, __getState as getState2 } from "@elementor/store";
494
+ import { __dispatch as dispatch, __getState as getState3 } from "@elementor/store";
451
495
  function addOverridableGroup({
452
496
  componentId,
453
497
  groupId,
454
- label
498
+ label,
499
+ source
455
500
  }) {
456
- const overridableProps = selectOverridableProps(getState2(), componentId);
501
+ const currentComponent = selectCurrentComponent(getState3());
502
+ const overridableProps = selectOverridableProps(getState3(), componentId);
457
503
  if (!overridableProps) {
458
504
  return;
459
505
  }
@@ -478,11 +524,17 @@ function addOverridableGroup({
478
524
  }
479
525
  })
480
526
  );
527
+ trackComponentEvent({
528
+ action: "propertiesGroupCreated",
529
+ source,
530
+ component_uid: currentComponent?.uid,
531
+ group_name: label
532
+ });
481
533
  return newGroup;
482
534
  }
483
535
 
484
536
  // src/store/actions/delete-overridable-group.ts
485
- import { __dispatch as dispatch2, __getState as getState3 } from "@elementor/store";
537
+ import { __dispatch as dispatch2, __getState as getState4 } from "@elementor/store";
486
538
 
487
539
  // src/store/utils/groups-transformers.ts
488
540
  import { generateUniqueId } from "@elementor/utils";
@@ -630,7 +682,7 @@ function renameGroup(groups, groupId, newLabel) {
630
682
 
631
683
  // src/store/actions/delete-overridable-group.ts
632
684
  function deleteOverridableGroup({ componentId, groupId }) {
633
- const overridableProps = selectOverridableProps(getState3(), componentId);
685
+ const overridableProps = selectOverridableProps(getState4(), componentId);
634
686
  if (!overridableProps) {
635
687
  return false;
636
688
  }
@@ -653,9 +705,9 @@ function deleteOverridableGroup({ componentId, groupId }) {
653
705
 
654
706
  // src/store/actions/delete-overridable-prop.ts
655
707
  import { getContainer, updateElementSettings } from "@elementor/editor-elements";
656
- import { __dispatch as dispatch3, __getState as getState4 } from "@elementor/store";
657
- function deleteOverridableProp({ componentId, propKey }) {
658
- const overridableProps = selectOverridableProps(getState4(), componentId);
708
+ import { __dispatch as dispatch3, __getState as getState5 } from "@elementor/store";
709
+ function deleteOverridableProp({ componentId, propKey, source }) {
710
+ const overridableProps = selectOverridableProps(getState5(), componentId);
659
711
  if (!overridableProps) {
660
712
  return;
661
713
  }
@@ -676,6 +728,16 @@ function deleteOverridableProp({ componentId, propKey }) {
676
728
  }
677
729
  })
678
730
  );
731
+ const currentComponent = selectCurrentComponent(getState5());
732
+ trackComponentEvent({
733
+ action: "propertyRemoved",
734
+ source,
735
+ component_uid: currentComponent?.uid,
736
+ property_id: removedProp.overrideKey,
737
+ property_path: removedProp.propKey,
738
+ property_name: removedProp.label,
739
+ element_type: removedProp.widgetType ?? removedProp.elType
740
+ });
679
741
  }
680
742
  function revertElementSetting(elementId, settingKey, originValue) {
681
743
  const container = getContainer(elementId);
@@ -690,9 +752,9 @@ function revertElementSetting(elementId, settingKey, originValue) {
690
752
  }
691
753
 
692
754
  // src/store/actions/reorder-group-props.ts
693
- import { __dispatch as dispatch4, __getState as getState5 } from "@elementor/store";
755
+ import { __dispatch as dispatch4, __getState as getState6 } from "@elementor/store";
694
756
  function reorderGroupProps({ componentId, groupId, newPropsOrder }) {
695
- const overridableProps = selectOverridableProps(getState5(), componentId);
757
+ const overridableProps = selectOverridableProps(getState6(), componentId);
696
758
  if (!overridableProps) {
697
759
  return;
698
760
  }
@@ -721,9 +783,9 @@ function reorderGroupProps({ componentId, groupId, newPropsOrder }) {
721
783
  }
722
784
 
723
785
  // src/store/actions/reorder-overridable-groups.ts
724
- import { __dispatch as dispatch5, __getState as getState6 } from "@elementor/store";
786
+ import { __dispatch as dispatch5, __getState as getState7 } from "@elementor/store";
725
787
  function reorderOverridableGroups({ componentId, newOrder }) {
726
- const overridableProps = selectOverridableProps(getState6(), componentId);
788
+ const overridableProps = selectOverridableProps(getState7(), componentId);
727
789
  if (!overridableProps) {
728
790
  return;
729
791
  }
@@ -742,14 +804,14 @@ function reorderOverridableGroups({ componentId, newOrder }) {
742
804
  }
743
805
 
744
806
  // src/store/actions/update-overridable-prop-params.ts
745
- import { __dispatch as dispatch6, __getState as getState7 } from "@elementor/store";
807
+ import { __dispatch as dispatch6, __getState as getState8 } from "@elementor/store";
746
808
  function updateOverridablePropParams({
747
809
  componentId,
748
810
  overrideKey,
749
811
  label,
750
812
  groupId
751
813
  }) {
752
- const overridableProps = selectOverridableProps(getState7(), componentId);
814
+ const overridableProps = selectOverridableProps(getState8(), componentId);
753
815
  if (!overridableProps) {
754
816
  return;
755
817
  }
@@ -1344,9 +1406,9 @@ import { useEditable } from "@elementor/editor-ui";
1344
1406
  import { __ as __8 } from "@wordpress/i18n";
1345
1407
 
1346
1408
  // src/store/actions/rename-overridable-group.ts
1347
- import { __dispatch as dispatch7, __getState as getState8 } from "@elementor/store";
1409
+ import { __dispatch as dispatch7, __getState as getState9 } from "@elementor/store";
1348
1410
  function renameOverridableGroup({ componentId, groupId, label }) {
1349
- const overridableProps = selectOverridableProps(getState8(), componentId);
1411
+ const overridableProps = selectOverridableProps(getState9(), componentId);
1350
1412
  if (!overridableProps) {
1351
1413
  return false;
1352
1414
  }
@@ -1478,7 +1540,12 @@ function ComponentPropertiesPanelContent({ onClose }) {
1478
1540
  }
1479
1541
  const newGroupId = generateUniqueId2("group");
1480
1542
  const newLabel = generateUniqueLabel(groups);
1481
- addOverridableGroup({ componentId: currentComponentId, groupId: newGroupId, label: newLabel });
1543
+ addOverridableGroup({
1544
+ componentId: currentComponentId,
1545
+ groupId: newGroupId,
1546
+ label: newLabel,
1547
+ source: "user"
1548
+ });
1482
1549
  setDocumentModifiedStatus2(true);
1483
1550
  setIsAddingGroup(false);
1484
1551
  groupLabelEditable.setEditingGroupId(newGroupId);
@@ -1492,7 +1559,7 @@ function ComponentPropertiesPanelContent({ onClose }) {
1492
1559
  setDocumentModifiedStatus2(true);
1493
1560
  };
1494
1561
  const handlePropertyDelete = (propKey) => {
1495
- deleteOverridableProp({ componentId: currentComponentId, propKey });
1562
+ deleteOverridableProp({ componentId: currentComponentId, propKey, source: "user" });
1496
1563
  setDocumentModifiedStatus2(true);
1497
1564
  };
1498
1565
  const handlePropertyUpdate = (overrideKey, data) => {
@@ -1575,34 +1642,32 @@ import { useEffect, useRef as useRef2 } from "react";
1575
1642
  import { ComponentPropListIcon as ComponentPropListIcon3 } from "@elementor/icons";
1576
1643
  import { Badge, Box as Box6, keyframes, styled as styled2, ToggleButton } from "@elementor/ui";
1577
1644
  import { __ as __11 } from "@wordpress/i18n";
1578
- var ComponentsBadge = React9.forwardRef(
1579
- ({ overridesCount, onClick }, ref) => {
1580
- const prevCount = usePrevious(overridesCount);
1581
- const isFirstOverride = prevCount === 0 && overridesCount === 1;
1582
- return /* @__PURE__ */ React9.createElement(
1583
- StyledBadge,
1645
+ var ComponentsBadge = React9.forwardRef(({ overridablePropsCount, onClick }, ref) => {
1646
+ const prevCount = usePrevious(overridablePropsCount);
1647
+ const isFirstExposedProperty = prevCount === 0 && overridablePropsCount === 1;
1648
+ return /* @__PURE__ */ React9.createElement(
1649
+ StyledBadge,
1650
+ {
1651
+ ref,
1652
+ color: "primary",
1653
+ key: overridablePropsCount,
1654
+ invisible: overridablePropsCount === 0,
1655
+ animate: isFirstExposedProperty,
1656
+ anchorOrigin: { vertical: "top", horizontal: "right" },
1657
+ badgeContent: /* @__PURE__ */ React9.createElement(Box6, { sx: { animation: !isFirstExposedProperty ? `${slideUp} 300ms ease-out` : "none" } }, overridablePropsCount)
1658
+ },
1659
+ /* @__PURE__ */ React9.createElement(
1660
+ ToggleButton,
1584
1661
  {
1585
- ref,
1586
- color: "primary",
1587
- key: overridesCount,
1588
- invisible: overridesCount === 0,
1589
- animate: isFirstOverride,
1590
- anchorOrigin: { vertical: "top", horizontal: "right" },
1591
- badgeContent: /* @__PURE__ */ React9.createElement(Box6, { sx: { animation: !isFirstOverride ? `${slideUp} 300ms ease-out` : "none" } }, overridesCount)
1662
+ value: "exposed properties",
1663
+ size: "tiny",
1664
+ onClick,
1665
+ "aria-label": __11("View exposed properties", "elementor")
1592
1666
  },
1593
- /* @__PURE__ */ React9.createElement(
1594
- ToggleButton,
1595
- {
1596
- value: "overrides",
1597
- size: "tiny",
1598
- onClick,
1599
- "aria-label": __11("View overrides", "elementor")
1600
- },
1601
- /* @__PURE__ */ React9.createElement(ComponentPropListIcon3, { fontSize: "tiny" })
1602
- )
1603
- );
1604
- }
1605
- );
1667
+ /* @__PURE__ */ React9.createElement(ComponentPropListIcon3, { fontSize: "tiny" })
1668
+ )
1669
+ );
1670
+ });
1606
1671
  var StyledBadge = styled2(Badge, { shouldForwardProp: (prop) => prop !== "animate" })(
1607
1672
  ({ theme, animate }) => ({
1608
1673
  "& .MuiBadge-badge": {
@@ -1635,14 +1700,14 @@ var slideUp = keyframes`
1635
1700
  // src/components/component-panel-header/component-panel-header.tsx
1636
1701
  var MESSAGE_KEY = "components-properties-introduction";
1637
1702
  var ComponentPanelHeader = () => {
1638
- const currentComponentId = useCurrentComponentId();
1703
+ const { id: currentComponentId, uid: componentUid } = useCurrentComponent() ?? { id: null, uid: null };
1639
1704
  const overridableProps = useOverridableProps2(currentComponentId);
1640
1705
  const onBack = useNavigateBack();
1641
1706
  const componentName = getComponentName();
1642
1707
  const [isMessageSuppressed, suppressMessage] = useSuppressedMessage(MESSAGE_KEY);
1643
1708
  const [shouldShowIntroduction, setShouldShowIntroduction] = React10.useState(!isMessageSuppressed);
1644
1709
  const { open: openPropertiesPanel } = usePanelActions();
1645
- const overridesCount = overridableProps ? Object.keys(overridableProps.props).length : 0;
1710
+ const overridablePropsCount = overridableProps ? Object.keys(overridableProps.props).length : 0;
1646
1711
  const anchorRef = React10.useRef(null);
1647
1712
  if (!currentComponentId) {
1648
1713
  return null;
@@ -1651,6 +1716,15 @@ var ComponentPanelHeader = () => {
1651
1716
  suppressMessage();
1652
1717
  setShouldShowIntroduction(false);
1653
1718
  };
1719
+ const handleOpenPropertiesPanel = () => {
1720
+ openPropertiesPanel();
1721
+ trackComponentEvent({
1722
+ action: "propertiesPanelOpened",
1723
+ source: "user",
1724
+ component_uid: componentUid,
1725
+ properties_count: overridablePropsCount
1726
+ });
1727
+ };
1654
1728
  return /* @__PURE__ */ React10.createElement(Box7, null, /* @__PURE__ */ React10.createElement(
1655
1729
  Stack6,
1656
1730
  {
@@ -1660,7 +1734,14 @@ var ComponentPanelHeader = () => {
1660
1734
  sx: { height: 48, pl: 1.5, pr: 2, py: 1 }
1661
1735
  },
1662
1736
  /* @__PURE__ */ React10.createElement(Stack6, { direction: "row", alignItems: "center" }, /* @__PURE__ */ React10.createElement(Tooltip3, { title: __12("Back", "elementor") }, /* @__PURE__ */ React10.createElement(IconButton4, { size: "tiny", onClick: onBack, "aria-label": __12("Back", "elementor") }, /* @__PURE__ */ React10.createElement(ArrowLeftIcon, { fontSize: "tiny" }))), /* @__PURE__ */ React10.createElement(Stack6, { direction: "row", alignItems: "center", gap: 0.5 }, /* @__PURE__ */ React10.createElement(ComponentsFilledIcon, { fontSize: "tiny", stroke: "currentColor" }), /* @__PURE__ */ React10.createElement(Typography6, { variant: "caption", sx: { fontWeight: 500 } }, componentName))),
1663
- /* @__PURE__ */ React10.createElement(ComponentsBadge, { overridesCount, ref: anchorRef, onClick: openPropertiesPanel })
1737
+ /* @__PURE__ */ React10.createElement(
1738
+ ComponentsBadge,
1739
+ {
1740
+ overridablePropsCount,
1741
+ ref: anchorRef,
1742
+ onClick: handleOpenPropertiesPanel
1743
+ }
1744
+ )
1664
1745
  ), /* @__PURE__ */ React10.createElement(Divider2, null), /* @__PURE__ */ React10.createElement(
1665
1746
  ComponentIntroduction,
1666
1747
  {
@@ -1671,7 +1752,7 @@ var ComponentPanelHeader = () => {
1671
1752
  ));
1672
1753
  };
1673
1754
  function getComponentName() {
1674
- const state = getState9();
1755
+ const state = getState10();
1675
1756
  const path = state[SLICE_NAME].path;
1676
1757
  const { instanceTitle } = path.at(-1) ?? {};
1677
1758
  if (instanceTitle) {
@@ -1785,42 +1866,6 @@ import {
1785
1866
  import { getCurrentDocument } from "@elementor/editor-documents";
1786
1867
  import { __getState as getState11 } from "@elementor/store";
1787
1868
  import { __ as __14 } from "@wordpress/i18n";
1788
-
1789
- // src/utils/tracking.ts
1790
- import { getMixpanel } from "@elementor/mixpanel";
1791
- import { __getState as getState10 } from "@elementor/store";
1792
- var trackComponentEvent = ({ action, ...data }) => {
1793
- const { dispatchEvent, config } = getMixpanel();
1794
- if (!config?.names?.components?.[action]) {
1795
- return;
1796
- }
1797
- const name = config.names.components[action];
1798
- dispatchEvent?.(name, data);
1799
- };
1800
- var onElementDrop = (_args, element) => {
1801
- if (!(element?.model?.get("widgetType") === "e-component")) {
1802
- return;
1803
- }
1804
- const editorSettings = element.model.get("editor_settings");
1805
- const componentName = editorSettings?.title;
1806
- const componentUID = editorSettings?.component_uid;
1807
- const instanceId = element.id;
1808
- const createdThisSession = selectCreatedThisSession(getState10());
1809
- const isSameSessionReuse = componentUID && createdThisSession.includes(componentUID);
1810
- const eventsManagerConfig = window.elementorCommon.eventsManager.config;
1811
- const { locations, secondaryLocations } = eventsManagerConfig;
1812
- trackComponentEvent({
1813
- action: "instanceAdded",
1814
- instance_id: instanceId,
1815
- component_uid: componentUID,
1816
- component_name: componentName,
1817
- is_same_session_reuse: isSameSessionReuse,
1818
- location: locations.widgetPanel,
1819
- secondary_location: secondaryLocations.componentsTab
1820
- });
1821
- };
1822
-
1823
- // src/create-component-type.ts
1824
1869
  var COMPONENT_WIDGET_TYPE = "e-component";
1825
1870
  var updateGroups = (groups, config) => {
1826
1871
  const disableMap = new Map(Object.entries(config.disable ?? {}));
@@ -1962,6 +2007,7 @@ function createComponentView(options) {
1962
2007
  const editorSettings = this.model.get("editor_settings");
1963
2008
  trackComponentEvent({
1964
2009
  action: "edited",
2010
+ source: "user",
1965
2011
  component_uid: editorSettings?.component_uid,
1966
2012
  component_name: editorSettings?.title,
1967
2013
  location,
@@ -2389,8 +2435,7 @@ var createComponentModel2 = (component) => {
2389
2435
  value: component.id ?? component.uid
2390
2436
  }
2391
2437
  }
2392
- },
2393
- overridable_props: component.overridableProps
2438
+ }
2394
2439
  },
2395
2440
  editor_settings: {
2396
2441
  component_uid: component.uid
@@ -2949,19 +2994,28 @@ function findNonAtomicElementsInElement(element) {
2949
2994
  import { __privateRunCommand as runCommand3 } from "@elementor/editor-v1-adapters";
2950
2995
  import { __dispatch as dispatch12 } from "@elementor/store";
2951
2996
  import { generateUniqueId as generateUniqueId3 } from "@elementor/utils";
2952
- async function createUnpublishedComponent(name, element, eventData, overridableProps, uid) {
2997
+ async function createUnpublishedComponent({
2998
+ name,
2999
+ element,
3000
+ eventData,
3001
+ uid,
3002
+ overridableProps,
3003
+ source
3004
+ }) {
2953
3005
  const generatedUid = uid ?? generateUniqueId3("component");
2954
- const componentBase = { uid: generatedUid, name, overridableProps };
3006
+ const componentBase = { uid: generatedUid, name };
2955
3007
  dispatch12(
2956
3008
  slice.actions.addUnpublished({
2957
3009
  ...componentBase,
2958
- elements: [element]
3010
+ elements: [element],
3011
+ overridableProps
2959
3012
  })
2960
3013
  );
2961
3014
  dispatch12(slice.actions.addCreatedThisSession(generatedUid));
2962
3015
  const componentInstance = await replaceElementWithComponent(element, componentBase);
2963
3016
  trackComponentEvent({
2964
3017
  action: "created",
3018
+ source,
2965
3019
  component_uid: generatedUid,
2966
3020
  component_name: name,
2967
3021
  ...eventData
@@ -3073,6 +3127,7 @@ function CreateComponentForm() {
3073
3127
  eventData.current = getComponentEventData(event.detail.element, event.detail.options);
3074
3128
  trackComponentEvent({
3075
3129
  action: "createClicked",
3130
+ source: "user",
3076
3131
  ...eventData.current
3077
3132
  });
3078
3133
  };
@@ -3086,11 +3141,12 @@ function CreateComponentForm() {
3086
3141
  if (!element) {
3087
3142
  throw new Error(`Can't save element as component: element not found`);
3088
3143
  }
3089
- const { uid, instanceId } = await createUnpublishedComponent(
3090
- values.componentName,
3091
- element.element,
3092
- eventData.current
3093
- );
3144
+ const { uid, instanceId } = await createUnpublishedComponent({
3145
+ name: values.componentName,
3146
+ element: element.element,
3147
+ eventData: eventData.current,
3148
+ source: "user"
3149
+ });
3094
3150
  const publishedComponentId = selectComponentByUid(getState15(), uid)?.id;
3095
3151
  if (publishedComponentId) {
3096
3152
  switchToComponent(publishedComponentId, instanceId);
@@ -3120,6 +3176,7 @@ function CreateComponentForm() {
3120
3176
  resetAndClosePopup();
3121
3177
  trackComponentEvent({
3122
3178
  action: "createCancelled",
3179
+ source: "user",
3123
3180
  ...eventData.current
3124
3181
  });
3125
3182
  };
@@ -4011,10 +4068,10 @@ function InstanceEditingPanel() {
4011
4068
  import * as React30 from "react";
4012
4069
  import {
4013
4070
  ControlReplacementsProvider as ControlReplacementsProvider2,
4014
- createControl,
4015
4071
  PropKeyProvider as PropKeyProvider2,
4016
4072
  PropProvider as PropProvider2,
4017
- useBoundProp as useBoundProp2
4073
+ useBoundProp as useBoundProp2,
4074
+ useControlReplacement
4018
4075
  } from "@elementor/editor-controls";
4019
4076
  import { createTopLevelObjectType as createTopLevelObjectType2, getControlReplacements as getControlReplacements2, useElement as useElement3 } from "@elementor/editor-editing-panel";
4020
4077
  function OverridablePropControl({
@@ -4022,7 +4079,6 @@ function OverridablePropControl({
4022
4079
  ...props
4023
4080
  }) {
4024
4081
  const { elementType } = useElement3();
4025
- const Control = createControl(OriginalControl2);
4026
4082
  const { value, bind, setValue, placeholder, ...propContext } = useBoundProp2(componentOverridablePropTypeUtil);
4027
4083
  const componentId = useCurrentComponentId();
4028
4084
  const overridableProps = useOverridableProps(componentId);
@@ -4071,9 +4127,20 @@ function OverridablePropControl({
4071
4127
  },
4072
4128
  placeholder: objectPlaceholder
4073
4129
  },
4074
- /* @__PURE__ */ React30.createElement(PropKeyProvider2, { bind }, /* @__PURE__ */ React30.createElement(ControlReplacementsProvider2, { replacements: filteredReplacements }, /* @__PURE__ */ React30.createElement(Control, { ...props })))
4130
+ /* @__PURE__ */ React30.createElement(PropKeyProvider2, { bind }, /* @__PURE__ */ React30.createElement(ControlReplacementsProvider2, { replacements: filteredReplacements }, /* @__PURE__ */ React30.createElement(ControlWithReplacements, { OriginalControl: OriginalControl2, props })))
4075
4131
  ));
4076
4132
  }
4133
+ function ControlWithReplacements({
4134
+ OriginalControl: OriginalControl2,
4135
+ props
4136
+ }) {
4137
+ const { ControlToRender, isReplaced } = useControlReplacement(OriginalControl2);
4138
+ if (isReplaced) {
4139
+ const ReplacementControl = ControlToRender;
4140
+ return /* @__PURE__ */ React30.createElement(ReplacementControl, { ...props, OriginalControl: OriginalControl2 });
4141
+ }
4142
+ return /* @__PURE__ */ React30.createElement(OriginalControl2, { ...props });
4143
+ }
4077
4144
 
4078
4145
  // src/components/overridable-props/overridable-prop-indicator.tsx
4079
4146
  import * as React32 from "react";
@@ -4096,7 +4163,8 @@ function setOverridableProp({
4096
4163
  elType,
4097
4164
  widgetType,
4098
4165
  originValue,
4099
- originPropFields
4166
+ originPropFields,
4167
+ source
4100
4168
  }) {
4101
4169
  const overridableProps = selectOverridableProps(getState17(), componentId);
4102
4170
  if (!overridableProps) {
@@ -4144,6 +4212,19 @@ function setOverridableProp({
4144
4212
  }
4145
4213
  })
4146
4214
  );
4215
+ const isNewProperty = !existingOverridableProp;
4216
+ if (isNewProperty) {
4217
+ const currentComponent = selectCurrentComponent(getState17());
4218
+ trackComponentEvent({
4219
+ action: "propertyExposed",
4220
+ source,
4221
+ component_uid: currentComponent?.uid,
4222
+ property_id: overridableProp.overrideKey,
4223
+ property_path: propKey,
4224
+ property_name: label,
4225
+ element_type: widgetType ?? elType
4226
+ });
4227
+ }
4147
4228
  return overridableProp;
4148
4229
  }
4149
4230
 
@@ -4272,7 +4353,8 @@ function Content2({ componentId, overridableProps }) {
4272
4353
  elType: elType ?? "widget",
4273
4354
  widgetType: componentInstanceElement?.elementType.key ?? elementType.key,
4274
4355
  originValue,
4275
- originPropFields: matchingOverridableProp?.originPropFields
4356
+ originPropFields: matchingOverridableProp?.originPropFields,
4357
+ source: "user"
4276
4358
  });
4277
4359
  if (!overridableValue && overridablePropConfig) {
4278
4360
  setOverridableValue({
@@ -4390,7 +4472,14 @@ var handleSaveAsComponent = async (params) => {
4390
4472
  }
4391
4473
  throw new Error("Unknown error");
4392
4474
  }
4393
- createUnpublishedComponent(componentName, element, null, overridableProps, uid);
4475
+ await createUnpublishedComponent({
4476
+ name: componentName,
4477
+ element,
4478
+ eventData: null,
4479
+ uid,
4480
+ overridableProps,
4481
+ source: "mcp_tool"
4482
+ });
4394
4483
  return {
4395
4484
  status: "ok",
4396
4485
  message: `Component "${componentName}" created successfully.`,