@elementor/editor-components 3.35.0-463 → 3.35.0-464
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.js +189 -110
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +177 -98
- package/dist/index.mjs.map +1 -1
- package/package.json +22 -22
- package/src/components/component-panel-header/component-badge.tsx +30 -29
- package/src/components/component-panel-header/component-panel-header.tsx +20 -4
- package/src/components/component-properties-panel/component-properties-panel-content.tsx +7 -2
- package/src/components/create-component-form/create-component-form.tsx +8 -5
- package/src/components/create-component-form/utils/replace-element-with-component.ts +0 -4
- package/src/components/overridable-props/overridable-prop-indicator.tsx +1 -0
- package/src/create-component-type.ts +1 -0
- package/src/mcp/save-as-component-tool.ts +8 -1
- package/src/store/actions/add-overridable-group.ts +13 -1
- package/src/store/actions/create-unpublished-component.ts +21 -9
- package/src/store/actions/delete-overridable-prop.ts +16 -2
- package/src/store/actions/set-overridable-prop.ts +20 -1
- package/src/store/store.ts +7 -0
- package/src/utils/tracking.ts +18 -3
package/dist/index.js
CHANGED
|
@@ -273,9 +273,17 @@ var selectCurrentComponentId = (0, import_store2.__createSelector)(
|
|
|
273
273
|
getCurrentComponentId,
|
|
274
274
|
(currentComponentId) => currentComponentId
|
|
275
275
|
);
|
|
276
|
+
var selectCurrentComponent = (0, import_store2.__createSelector)(
|
|
277
|
+
selectData,
|
|
278
|
+
getCurrentComponentId,
|
|
279
|
+
(data, currentComponentId) => data.find((component) => component.id === currentComponentId)
|
|
280
|
+
);
|
|
276
281
|
var useCurrentComponentId = () => {
|
|
277
282
|
return (0, import_store2.__useSelector)(selectCurrentComponentId);
|
|
278
283
|
};
|
|
284
|
+
var useCurrentComponent = () => {
|
|
285
|
+
return (0, import_store2.__useSelector)(selectCurrentComponent);
|
|
286
|
+
};
|
|
279
287
|
var selectUpdatedComponentNames = (0, import_store2.__createSelector)(
|
|
280
288
|
(state) => state[SLICE_NAME].updatedComponentNames,
|
|
281
289
|
(updatedComponentNames) => Object.entries(updatedComponentNames).map(([componentId, title]) => ({
|
|
@@ -371,7 +379,7 @@ var React10 = __toESM(require("react"));
|
|
|
371
379
|
var import_editor_current_user = require("@elementor/editor-current-user");
|
|
372
380
|
var import_editor_documents5 = require("@elementor/editor-documents");
|
|
373
381
|
var import_icons7 = require("@elementor/icons");
|
|
374
|
-
var
|
|
382
|
+
var import_store27 = require("@elementor/store");
|
|
375
383
|
var import_ui10 = require("@elementor/ui");
|
|
376
384
|
var import_i18n12 = require("@wordpress/i18n");
|
|
377
385
|
|
|
@@ -450,6 +458,42 @@ function useNavigateBack() {
|
|
|
450
458
|
}, [path, documentsManager]);
|
|
451
459
|
}
|
|
452
460
|
|
|
461
|
+
// src/utils/tracking.ts
|
|
462
|
+
var import_mixpanel = require("@elementor/mixpanel");
|
|
463
|
+
var import_store7 = require("@elementor/store");
|
|
464
|
+
var FEATURE_NAME = "Components";
|
|
465
|
+
var trackComponentEvent = ({ action, source, ...data }) => {
|
|
466
|
+
const { dispatchEvent, config } = (0, import_mixpanel.getMixpanel)();
|
|
467
|
+
if (!config?.names?.components?.[action]) {
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
470
|
+
const name = config.names.components[action];
|
|
471
|
+
dispatchEvent?.(name, { ...data, source, "Feature name": FEATURE_NAME });
|
|
472
|
+
};
|
|
473
|
+
var onElementDrop = (_args, element) => {
|
|
474
|
+
if (!(element?.model?.get("widgetType") === "e-component")) {
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
const editorSettings = element.model.get("editor_settings");
|
|
478
|
+
const componentName = editorSettings?.title;
|
|
479
|
+
const componentUID = editorSettings?.component_uid;
|
|
480
|
+
const instanceId = element.id;
|
|
481
|
+
const createdThisSession = selectCreatedThisSession((0, import_store7.__getState)());
|
|
482
|
+
const isSameSessionReuse = componentUID && createdThisSession.includes(componentUID);
|
|
483
|
+
const eventsManagerConfig = window.elementorCommon.eventsManager.config;
|
|
484
|
+
const { locations, secondaryLocations } = eventsManagerConfig;
|
|
485
|
+
trackComponentEvent({
|
|
486
|
+
action: "instanceAdded",
|
|
487
|
+
source: "user",
|
|
488
|
+
instance_id: instanceId,
|
|
489
|
+
component_uid: componentUID,
|
|
490
|
+
component_name: componentName,
|
|
491
|
+
is_same_session_reuse: isSameSessionReuse,
|
|
492
|
+
location: locations.widgetPanel,
|
|
493
|
+
secondary_location: secondaryLocations.componentsTab
|
|
494
|
+
});
|
|
495
|
+
};
|
|
496
|
+
|
|
453
497
|
// src/components/component-properties-panel/component-properties-panel.tsx
|
|
454
498
|
var React8 = __toESM(require("react"));
|
|
455
499
|
var import_editor_editing_panel = require("@elementor/editor-editing-panel");
|
|
@@ -470,13 +514,15 @@ var import_utils2 = require("@elementor/utils");
|
|
|
470
514
|
var import_i18n9 = require("@wordpress/i18n");
|
|
471
515
|
|
|
472
516
|
// src/store/actions/add-overridable-group.ts
|
|
473
|
-
var
|
|
517
|
+
var import_store9 = require("@elementor/store");
|
|
474
518
|
function addOverridableGroup({
|
|
475
519
|
componentId,
|
|
476
520
|
groupId,
|
|
477
|
-
label
|
|
521
|
+
label,
|
|
522
|
+
source
|
|
478
523
|
}) {
|
|
479
|
-
const
|
|
524
|
+
const currentComponent = selectCurrentComponent((0, import_store9.__getState)());
|
|
525
|
+
const overridableProps = selectOverridableProps((0, import_store9.__getState)(), componentId);
|
|
480
526
|
if (!overridableProps) {
|
|
481
527
|
return;
|
|
482
528
|
}
|
|
@@ -485,7 +531,7 @@ function addOverridableGroup({
|
|
|
485
531
|
label,
|
|
486
532
|
props: []
|
|
487
533
|
};
|
|
488
|
-
(0,
|
|
534
|
+
(0, import_store9.__dispatch)(
|
|
489
535
|
slice.actions.setOverridableProps({
|
|
490
536
|
componentId,
|
|
491
537
|
overridableProps: {
|
|
@@ -501,11 +547,17 @@ function addOverridableGroup({
|
|
|
501
547
|
}
|
|
502
548
|
})
|
|
503
549
|
);
|
|
550
|
+
trackComponentEvent({
|
|
551
|
+
action: "propertiesGroupCreated",
|
|
552
|
+
source,
|
|
553
|
+
component_uid: currentComponent?.uid,
|
|
554
|
+
group_name: label
|
|
555
|
+
});
|
|
504
556
|
return newGroup;
|
|
505
557
|
}
|
|
506
558
|
|
|
507
559
|
// src/store/actions/delete-overridable-group.ts
|
|
508
|
-
var
|
|
560
|
+
var import_store11 = require("@elementor/store");
|
|
509
561
|
|
|
510
562
|
// src/store/utils/groups-transformers.ts
|
|
511
563
|
var import_utils = require("@elementor/utils");
|
|
@@ -653,7 +705,7 @@ function renameGroup(groups, groupId, newLabel) {
|
|
|
653
705
|
|
|
654
706
|
// src/store/actions/delete-overridable-group.ts
|
|
655
707
|
function deleteOverridableGroup({ componentId, groupId }) {
|
|
656
|
-
const overridableProps = selectOverridableProps((0,
|
|
708
|
+
const overridableProps = selectOverridableProps((0, import_store11.__getState)(), componentId);
|
|
657
709
|
if (!overridableProps) {
|
|
658
710
|
return false;
|
|
659
711
|
}
|
|
@@ -662,7 +714,7 @@ function deleteOverridableGroup({ componentId, groupId }) {
|
|
|
662
714
|
return false;
|
|
663
715
|
}
|
|
664
716
|
const updatedGroups = deleteGroup(overridableProps.groups, groupId);
|
|
665
|
-
(0,
|
|
717
|
+
(0, import_store11.__dispatch)(
|
|
666
718
|
slice.actions.setOverridableProps({
|
|
667
719
|
componentId,
|
|
668
720
|
overridableProps: {
|
|
@@ -676,9 +728,9 @@ function deleteOverridableGroup({ componentId, groupId }) {
|
|
|
676
728
|
|
|
677
729
|
// src/store/actions/delete-overridable-prop.ts
|
|
678
730
|
var import_editor_elements2 = require("@elementor/editor-elements");
|
|
679
|
-
var
|
|
680
|
-
function deleteOverridableProp({ componentId, propKey }) {
|
|
681
|
-
const overridableProps = selectOverridableProps((0,
|
|
731
|
+
var import_store13 = require("@elementor/store");
|
|
732
|
+
function deleteOverridableProp({ componentId, propKey, source }) {
|
|
733
|
+
const overridableProps = selectOverridableProps((0, import_store13.__getState)(), componentId);
|
|
682
734
|
if (!overridableProps) {
|
|
683
735
|
return;
|
|
684
736
|
}
|
|
@@ -689,7 +741,7 @@ function deleteOverridableProp({ componentId, propKey }) {
|
|
|
689
741
|
revertElementSetting(prop.elementId, prop.propKey, prop.originValue);
|
|
690
742
|
const { [propKey]: removedProp, ...remainingProps } = overridableProps.props;
|
|
691
743
|
const updatedGroups = removePropFromAllGroups(overridableProps.groups, propKey);
|
|
692
|
-
(0,
|
|
744
|
+
(0, import_store13.__dispatch)(
|
|
693
745
|
slice.actions.setOverridableProps({
|
|
694
746
|
componentId,
|
|
695
747
|
overridableProps: {
|
|
@@ -699,6 +751,16 @@ function deleteOverridableProp({ componentId, propKey }) {
|
|
|
699
751
|
}
|
|
700
752
|
})
|
|
701
753
|
);
|
|
754
|
+
const currentComponent = selectCurrentComponent((0, import_store13.__getState)());
|
|
755
|
+
trackComponentEvent({
|
|
756
|
+
action: "propertyRemoved",
|
|
757
|
+
source,
|
|
758
|
+
component_uid: currentComponent?.uid,
|
|
759
|
+
property_id: removedProp.overrideKey,
|
|
760
|
+
property_path: removedProp.propKey,
|
|
761
|
+
property_name: removedProp.label,
|
|
762
|
+
element_type: removedProp.widgetType ?? removedProp.elType
|
|
763
|
+
});
|
|
702
764
|
}
|
|
703
765
|
function revertElementSetting(elementId, settingKey, originValue) {
|
|
704
766
|
const container = (0, import_editor_elements2.getContainer)(elementId);
|
|
@@ -713,9 +775,9 @@ function revertElementSetting(elementId, settingKey, originValue) {
|
|
|
713
775
|
}
|
|
714
776
|
|
|
715
777
|
// src/store/actions/reorder-group-props.ts
|
|
716
|
-
var
|
|
778
|
+
var import_store15 = require("@elementor/store");
|
|
717
779
|
function reorderGroupProps({ componentId, groupId, newPropsOrder }) {
|
|
718
|
-
const overridableProps = selectOverridableProps((0,
|
|
780
|
+
const overridableProps = selectOverridableProps((0, import_store15.__getState)(), componentId);
|
|
719
781
|
if (!overridableProps) {
|
|
720
782
|
return;
|
|
721
783
|
}
|
|
@@ -723,7 +785,7 @@ function reorderGroupProps({ componentId, groupId, newPropsOrder }) {
|
|
|
723
785
|
if (!group) {
|
|
724
786
|
return;
|
|
725
787
|
}
|
|
726
|
-
(0,
|
|
788
|
+
(0, import_store15.__dispatch)(
|
|
727
789
|
slice.actions.setOverridableProps({
|
|
728
790
|
componentId,
|
|
729
791
|
overridableProps: {
|
|
@@ -744,13 +806,13 @@ function reorderGroupProps({ componentId, groupId, newPropsOrder }) {
|
|
|
744
806
|
}
|
|
745
807
|
|
|
746
808
|
// src/store/actions/reorder-overridable-groups.ts
|
|
747
|
-
var
|
|
809
|
+
var import_store17 = require("@elementor/store");
|
|
748
810
|
function reorderOverridableGroups({ componentId, newOrder }) {
|
|
749
|
-
const overridableProps = selectOverridableProps((0,
|
|
811
|
+
const overridableProps = selectOverridableProps((0, import_store17.__getState)(), componentId);
|
|
750
812
|
if (!overridableProps) {
|
|
751
813
|
return;
|
|
752
814
|
}
|
|
753
|
-
(0,
|
|
815
|
+
(0, import_store17.__dispatch)(
|
|
754
816
|
slice.actions.setOverridableProps({
|
|
755
817
|
componentId,
|
|
756
818
|
overridableProps: {
|
|
@@ -765,14 +827,14 @@ function reorderOverridableGroups({ componentId, newOrder }) {
|
|
|
765
827
|
}
|
|
766
828
|
|
|
767
829
|
// src/store/actions/update-overridable-prop-params.ts
|
|
768
|
-
var
|
|
830
|
+
var import_store19 = require("@elementor/store");
|
|
769
831
|
function updateOverridablePropParams({
|
|
770
832
|
componentId,
|
|
771
833
|
overrideKey,
|
|
772
834
|
label,
|
|
773
835
|
groupId
|
|
774
836
|
}) {
|
|
775
|
-
const overridableProps = selectOverridableProps((0,
|
|
837
|
+
const overridableProps = selectOverridableProps((0, import_store19.__getState)(), componentId);
|
|
776
838
|
if (!overridableProps) {
|
|
777
839
|
return;
|
|
778
840
|
}
|
|
@@ -788,7 +850,7 @@ function updateOverridablePropParams({
|
|
|
788
850
|
groupId: newGroupId
|
|
789
851
|
};
|
|
790
852
|
const updatedGroups = movePropBetweenGroups(overridableProps.groups, overrideKey, oldGroupId, newGroupId);
|
|
791
|
-
(0,
|
|
853
|
+
(0, import_store19.__dispatch)(
|
|
792
854
|
slice.actions.setOverridableProps({
|
|
793
855
|
componentId,
|
|
794
856
|
overridableProps: {
|
|
@@ -805,9 +867,9 @@ function updateOverridablePropParams({
|
|
|
805
867
|
}
|
|
806
868
|
|
|
807
869
|
// src/components/component-panel-header/use-overridable-props.ts
|
|
808
|
-
var
|
|
870
|
+
var import_store21 = require("@elementor/store");
|
|
809
871
|
function useOverridableProps2(componentId) {
|
|
810
|
-
return (0,
|
|
872
|
+
return (0, import_store21.__useSelector)((state) => {
|
|
811
873
|
if (!componentId) {
|
|
812
874
|
return void 0;
|
|
813
875
|
}
|
|
@@ -1351,9 +1413,9 @@ var import_editor_ui4 = require("@elementor/editor-ui");
|
|
|
1351
1413
|
var import_i18n8 = require("@wordpress/i18n");
|
|
1352
1414
|
|
|
1353
1415
|
// src/store/actions/rename-overridable-group.ts
|
|
1354
|
-
var
|
|
1416
|
+
var import_store23 = require("@elementor/store");
|
|
1355
1417
|
function renameOverridableGroup({ componentId, groupId, label }) {
|
|
1356
|
-
const overridableProps = selectOverridableProps((0,
|
|
1418
|
+
const overridableProps = selectOverridableProps((0, import_store23.__getState)(), componentId);
|
|
1357
1419
|
if (!overridableProps) {
|
|
1358
1420
|
return false;
|
|
1359
1421
|
}
|
|
@@ -1362,7 +1424,7 @@ function renameOverridableGroup({ componentId, groupId, label }) {
|
|
|
1362
1424
|
return false;
|
|
1363
1425
|
}
|
|
1364
1426
|
const updatedGroups = renameGroup(overridableProps.groups, groupId, label);
|
|
1365
|
-
(0,
|
|
1427
|
+
(0, import_store23.__dispatch)(
|
|
1366
1428
|
slice.actions.setOverridableProps({
|
|
1367
1429
|
componentId,
|
|
1368
1430
|
overridableProps: {
|
|
@@ -1485,7 +1547,12 @@ function ComponentPropertiesPanelContent({ onClose }) {
|
|
|
1485
1547
|
}
|
|
1486
1548
|
const newGroupId = (0, import_utils2.generateUniqueId)("group");
|
|
1487
1549
|
const newLabel = generateUniqueLabel(groups);
|
|
1488
|
-
addOverridableGroup({
|
|
1550
|
+
addOverridableGroup({
|
|
1551
|
+
componentId: currentComponentId,
|
|
1552
|
+
groupId: newGroupId,
|
|
1553
|
+
label: newLabel,
|
|
1554
|
+
source: "user"
|
|
1555
|
+
});
|
|
1489
1556
|
(0, import_editor_documents4.setDocumentModifiedStatus)(true);
|
|
1490
1557
|
setIsAddingGroup(false);
|
|
1491
1558
|
groupLabelEditable.setEditingGroupId(newGroupId);
|
|
@@ -1499,7 +1566,7 @@ function ComponentPropertiesPanelContent({ onClose }) {
|
|
|
1499
1566
|
(0, import_editor_documents4.setDocumentModifiedStatus)(true);
|
|
1500
1567
|
};
|
|
1501
1568
|
const handlePropertyDelete = (propKey) => {
|
|
1502
|
-
deleteOverridableProp({ componentId: currentComponentId, propKey });
|
|
1569
|
+
deleteOverridableProp({ componentId: currentComponentId, propKey, source: "user" });
|
|
1503
1570
|
(0, import_editor_documents4.setDocumentModifiedStatus)(true);
|
|
1504
1571
|
};
|
|
1505
1572
|
const handlePropertyUpdate = (overrideKey, data) => {
|
|
@@ -1582,34 +1649,32 @@ var import_react6 = require("react");
|
|
|
1582
1649
|
var import_icons6 = require("@elementor/icons");
|
|
1583
1650
|
var import_ui9 = require("@elementor/ui");
|
|
1584
1651
|
var import_i18n11 = require("@wordpress/i18n");
|
|
1585
|
-
var ComponentsBadge = React9.forwardRef(
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1652
|
+
var ComponentsBadge = React9.forwardRef(({ overridablePropsCount, onClick }, ref) => {
|
|
1653
|
+
const prevCount = usePrevious(overridablePropsCount);
|
|
1654
|
+
const isFirstExposedProperty = prevCount === 0 && overridablePropsCount === 1;
|
|
1655
|
+
return /* @__PURE__ */ React9.createElement(
|
|
1656
|
+
StyledBadge,
|
|
1657
|
+
{
|
|
1658
|
+
ref,
|
|
1659
|
+
color: "primary",
|
|
1660
|
+
key: overridablePropsCount,
|
|
1661
|
+
invisible: overridablePropsCount === 0,
|
|
1662
|
+
animate: isFirstExposedProperty,
|
|
1663
|
+
anchorOrigin: { vertical: "top", horizontal: "right" },
|
|
1664
|
+
badgeContent: /* @__PURE__ */ React9.createElement(import_ui9.Box, { sx: { animation: !isFirstExposedProperty ? `${slideUp} 300ms ease-out` : "none" } }, overridablePropsCount)
|
|
1665
|
+
},
|
|
1666
|
+
/* @__PURE__ */ React9.createElement(
|
|
1667
|
+
import_ui9.ToggleButton,
|
|
1591
1668
|
{
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
animate: isFirstOverride,
|
|
1597
|
-
anchorOrigin: { vertical: "top", horizontal: "right" },
|
|
1598
|
-
badgeContent: /* @__PURE__ */ React9.createElement(import_ui9.Box, { sx: { animation: !isFirstOverride ? `${slideUp} 300ms ease-out` : "none" } }, overridesCount)
|
|
1669
|
+
value: "exposed properties",
|
|
1670
|
+
size: "tiny",
|
|
1671
|
+
onClick,
|
|
1672
|
+
"aria-label": (0, import_i18n11.__)("View exposed properties", "elementor")
|
|
1599
1673
|
},
|
|
1600
|
-
/* @__PURE__ */ React9.createElement(
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
size: "tiny",
|
|
1605
|
-
onClick,
|
|
1606
|
-
"aria-label": (0, import_i18n11.__)("View overrides", "elementor")
|
|
1607
|
-
},
|
|
1608
|
-
/* @__PURE__ */ React9.createElement(import_icons6.ComponentPropListIcon, { fontSize: "tiny" })
|
|
1609
|
-
)
|
|
1610
|
-
);
|
|
1611
|
-
}
|
|
1612
|
-
);
|
|
1674
|
+
/* @__PURE__ */ React9.createElement(import_icons6.ComponentPropListIcon, { fontSize: "tiny" })
|
|
1675
|
+
)
|
|
1676
|
+
);
|
|
1677
|
+
});
|
|
1613
1678
|
var StyledBadge = (0, import_ui9.styled)(import_ui9.Badge, { shouldForwardProp: (prop) => prop !== "animate" })(
|
|
1614
1679
|
({ theme, animate }) => ({
|
|
1615
1680
|
"& .MuiBadge-badge": {
|
|
@@ -1642,14 +1707,14 @@ var slideUp = import_ui9.keyframes`
|
|
|
1642
1707
|
// src/components/component-panel-header/component-panel-header.tsx
|
|
1643
1708
|
var MESSAGE_KEY = "components-properties-introduction";
|
|
1644
1709
|
var ComponentPanelHeader = () => {
|
|
1645
|
-
const currentComponentId =
|
|
1710
|
+
const { id: currentComponentId, uid: componentUid } = useCurrentComponent() ?? { id: null, uid: null };
|
|
1646
1711
|
const overridableProps = useOverridableProps2(currentComponentId);
|
|
1647
1712
|
const onBack = useNavigateBack();
|
|
1648
1713
|
const componentName = getComponentName();
|
|
1649
1714
|
const [isMessageSuppressed, suppressMessage] = (0, import_editor_current_user.useSuppressedMessage)(MESSAGE_KEY);
|
|
1650
1715
|
const [shouldShowIntroduction, setShouldShowIntroduction] = React10.useState(!isMessageSuppressed);
|
|
1651
1716
|
const { open: openPropertiesPanel } = usePanelActions();
|
|
1652
|
-
const
|
|
1717
|
+
const overridablePropsCount = overridableProps ? Object.keys(overridableProps.props).length : 0;
|
|
1653
1718
|
const anchorRef = React10.useRef(null);
|
|
1654
1719
|
if (!currentComponentId) {
|
|
1655
1720
|
return null;
|
|
@@ -1658,6 +1723,15 @@ var ComponentPanelHeader = () => {
|
|
|
1658
1723
|
suppressMessage();
|
|
1659
1724
|
setShouldShowIntroduction(false);
|
|
1660
1725
|
};
|
|
1726
|
+
const handleOpenPropertiesPanel = () => {
|
|
1727
|
+
openPropertiesPanel();
|
|
1728
|
+
trackComponentEvent({
|
|
1729
|
+
action: "propertiesPanelOpened",
|
|
1730
|
+
source: "user",
|
|
1731
|
+
component_uid: componentUid,
|
|
1732
|
+
properties_count: overridablePropsCount
|
|
1733
|
+
});
|
|
1734
|
+
};
|
|
1661
1735
|
return /* @__PURE__ */ React10.createElement(import_ui10.Box, null, /* @__PURE__ */ React10.createElement(
|
|
1662
1736
|
import_ui10.Stack,
|
|
1663
1737
|
{
|
|
@@ -1667,7 +1741,14 @@ var ComponentPanelHeader = () => {
|
|
|
1667
1741
|
sx: { height: 48, pl: 1.5, pr: 2, py: 1 }
|
|
1668
1742
|
},
|
|
1669
1743
|
/* @__PURE__ */ React10.createElement(import_ui10.Stack, { direction: "row", alignItems: "center" }, /* @__PURE__ */ React10.createElement(import_ui10.Tooltip, { title: (0, import_i18n12.__)("Back", "elementor") }, /* @__PURE__ */ React10.createElement(import_ui10.IconButton, { size: "tiny", onClick: onBack, "aria-label": (0, import_i18n12.__)("Back", "elementor") }, /* @__PURE__ */ React10.createElement(import_icons7.ArrowLeftIcon, { fontSize: "tiny" }))), /* @__PURE__ */ React10.createElement(import_ui10.Stack, { direction: "row", alignItems: "center", gap: 0.5 }, /* @__PURE__ */ React10.createElement(import_icons7.ComponentsFilledIcon, { fontSize: "tiny", stroke: "currentColor" }), /* @__PURE__ */ React10.createElement(import_ui10.Typography, { variant: "caption", sx: { fontWeight: 500 } }, componentName))),
|
|
1670
|
-
/* @__PURE__ */ React10.createElement(
|
|
1744
|
+
/* @__PURE__ */ React10.createElement(
|
|
1745
|
+
ComponentsBadge,
|
|
1746
|
+
{
|
|
1747
|
+
overridablePropsCount,
|
|
1748
|
+
ref: anchorRef,
|
|
1749
|
+
onClick: handleOpenPropertiesPanel
|
|
1750
|
+
}
|
|
1751
|
+
)
|
|
1671
1752
|
), /* @__PURE__ */ React10.createElement(import_ui10.Divider, null), /* @__PURE__ */ React10.createElement(
|
|
1672
1753
|
ComponentIntroduction,
|
|
1673
1754
|
{
|
|
@@ -1678,7 +1759,7 @@ var ComponentPanelHeader = () => {
|
|
|
1678
1759
|
));
|
|
1679
1760
|
};
|
|
1680
1761
|
function getComponentName() {
|
|
1681
|
-
const state = (0,
|
|
1762
|
+
const state = (0, import_store27.__getState)();
|
|
1682
1763
|
const path = state[SLICE_NAME].path;
|
|
1683
1764
|
const { instanceTitle } = path.at(-1) ?? {};
|
|
1684
1765
|
if (instanceTitle) {
|
|
@@ -1694,10 +1775,10 @@ var React19 = __toESM(require("react"));
|
|
|
1694
1775
|
var import_editor_ui9 = require("@elementor/editor-ui");
|
|
1695
1776
|
|
|
1696
1777
|
// src/hooks/use-components.ts
|
|
1697
|
-
var
|
|
1778
|
+
var import_store29 = require("@elementor/store");
|
|
1698
1779
|
var useComponents = () => {
|
|
1699
|
-
const components = (0,
|
|
1700
|
-
const isLoading = (0,
|
|
1780
|
+
const components = (0, import_store29.__useSelector)(selectComponents);
|
|
1781
|
+
const isLoading = (0, import_store29.__useSelector)(selectLoadIsPending);
|
|
1701
1782
|
return { components, isLoading };
|
|
1702
1783
|
};
|
|
1703
1784
|
|
|
@@ -1790,42 +1871,6 @@ var import_editor_canvas4 = require("@elementor/editor-canvas");
|
|
|
1790
1871
|
var import_editor_documents6 = require("@elementor/editor-documents");
|
|
1791
1872
|
var import_store31 = require("@elementor/store");
|
|
1792
1873
|
var import_i18n14 = require("@wordpress/i18n");
|
|
1793
|
-
|
|
1794
|
-
// src/utils/tracking.ts
|
|
1795
|
-
var import_mixpanel = require("@elementor/mixpanel");
|
|
1796
|
-
var import_store29 = require("@elementor/store");
|
|
1797
|
-
var trackComponentEvent = ({ action, ...data }) => {
|
|
1798
|
-
const { dispatchEvent, config } = (0, import_mixpanel.getMixpanel)();
|
|
1799
|
-
if (!config?.names?.components?.[action]) {
|
|
1800
|
-
return;
|
|
1801
|
-
}
|
|
1802
|
-
const name = config.names.components[action];
|
|
1803
|
-
dispatchEvent?.(name, data);
|
|
1804
|
-
};
|
|
1805
|
-
var onElementDrop = (_args, element) => {
|
|
1806
|
-
if (!(element?.model?.get("widgetType") === "e-component")) {
|
|
1807
|
-
return;
|
|
1808
|
-
}
|
|
1809
|
-
const editorSettings = element.model.get("editor_settings");
|
|
1810
|
-
const componentName = editorSettings?.title;
|
|
1811
|
-
const componentUID = editorSettings?.component_uid;
|
|
1812
|
-
const instanceId = element.id;
|
|
1813
|
-
const createdThisSession = selectCreatedThisSession((0, import_store29.__getState)());
|
|
1814
|
-
const isSameSessionReuse = componentUID && createdThisSession.includes(componentUID);
|
|
1815
|
-
const eventsManagerConfig = window.elementorCommon.eventsManager.config;
|
|
1816
|
-
const { locations, secondaryLocations } = eventsManagerConfig;
|
|
1817
|
-
trackComponentEvent({
|
|
1818
|
-
action: "instanceAdded",
|
|
1819
|
-
instance_id: instanceId,
|
|
1820
|
-
component_uid: componentUID,
|
|
1821
|
-
component_name: componentName,
|
|
1822
|
-
is_same_session_reuse: isSameSessionReuse,
|
|
1823
|
-
location: locations.widgetPanel,
|
|
1824
|
-
secondary_location: secondaryLocations.componentsTab
|
|
1825
|
-
});
|
|
1826
|
-
};
|
|
1827
|
-
|
|
1828
|
-
// src/create-component-type.ts
|
|
1829
1874
|
var COMPONENT_WIDGET_TYPE = "e-component";
|
|
1830
1875
|
var updateGroups = (groups, config) => {
|
|
1831
1876
|
const disableMap = new Map(Object.entries(config.disable ?? {}));
|
|
@@ -1967,6 +2012,7 @@ function createComponentView(options) {
|
|
|
1967
2012
|
const editorSettings = this.model.get("editor_settings");
|
|
1968
2013
|
trackComponentEvent({
|
|
1969
2014
|
action: "edited",
|
|
2015
|
+
source: "user",
|
|
1970
2016
|
component_uid: editorSettings?.component_uid,
|
|
1971
2017
|
component_name: editorSettings?.title,
|
|
1972
2018
|
location,
|
|
@@ -2367,8 +2413,7 @@ var createComponentModel2 = (component) => {
|
|
|
2367
2413
|
value: component.id ?? component.uid
|
|
2368
2414
|
}
|
|
2369
2415
|
}
|
|
2370
|
-
}
|
|
2371
|
-
overridable_props: component.overridableProps
|
|
2416
|
+
}
|
|
2372
2417
|
},
|
|
2373
2418
|
editor_settings: {
|
|
2374
2419
|
component_uid: component.uid
|
|
@@ -2927,19 +2972,28 @@ function findNonAtomicElementsInElement(element) {
|
|
|
2927
2972
|
var import_editor_v1_adapters5 = require("@elementor/editor-v1-adapters");
|
|
2928
2973
|
var import_store45 = require("@elementor/store");
|
|
2929
2974
|
var import_utils4 = require("@elementor/utils");
|
|
2930
|
-
async function createUnpublishedComponent(
|
|
2975
|
+
async function createUnpublishedComponent({
|
|
2976
|
+
name,
|
|
2977
|
+
element,
|
|
2978
|
+
eventData,
|
|
2979
|
+
uid,
|
|
2980
|
+
overridableProps,
|
|
2981
|
+
source
|
|
2982
|
+
}) {
|
|
2931
2983
|
const generatedUid = uid ?? (0, import_utils4.generateUniqueId)("component");
|
|
2932
|
-
const componentBase = { uid: generatedUid, name
|
|
2984
|
+
const componentBase = { uid: generatedUid, name };
|
|
2933
2985
|
(0, import_store45.__dispatch)(
|
|
2934
2986
|
slice.actions.addUnpublished({
|
|
2935
2987
|
...componentBase,
|
|
2936
|
-
elements: [element]
|
|
2988
|
+
elements: [element],
|
|
2989
|
+
overridableProps
|
|
2937
2990
|
})
|
|
2938
2991
|
);
|
|
2939
2992
|
(0, import_store45.__dispatch)(slice.actions.addCreatedThisSession(generatedUid));
|
|
2940
2993
|
const componentInstance = await replaceElementWithComponent(element, componentBase);
|
|
2941
2994
|
trackComponentEvent({
|
|
2942
2995
|
action: "created",
|
|
2996
|
+
source,
|
|
2943
2997
|
component_uid: generatedUid,
|
|
2944
2998
|
component_name: name,
|
|
2945
2999
|
...eventData
|
|
@@ -3051,6 +3105,7 @@ function CreateComponentForm() {
|
|
|
3051
3105
|
eventData.current = getComponentEventData(event.detail.element, event.detail.options);
|
|
3052
3106
|
trackComponentEvent({
|
|
3053
3107
|
action: "createClicked",
|
|
3108
|
+
source: "user",
|
|
3054
3109
|
...eventData.current
|
|
3055
3110
|
});
|
|
3056
3111
|
};
|
|
@@ -3064,11 +3119,12 @@ function CreateComponentForm() {
|
|
|
3064
3119
|
if (!element) {
|
|
3065
3120
|
throw new Error(`Can't save element as component: element not found`);
|
|
3066
3121
|
}
|
|
3067
|
-
const { uid, instanceId } = await createUnpublishedComponent(
|
|
3068
|
-
values.componentName,
|
|
3069
|
-
element.element,
|
|
3070
|
-
eventData.current
|
|
3071
|
-
|
|
3122
|
+
const { uid, instanceId } = await createUnpublishedComponent({
|
|
3123
|
+
name: values.componentName,
|
|
3124
|
+
element: element.element,
|
|
3125
|
+
eventData: eventData.current,
|
|
3126
|
+
source: "user"
|
|
3127
|
+
});
|
|
3072
3128
|
const publishedComponentId = selectComponentByUid((0, import_store47.__getState)(), uid)?.id;
|
|
3073
3129
|
if (publishedComponentId) {
|
|
3074
3130
|
switchToComponent(publishedComponentId, instanceId);
|
|
@@ -3098,6 +3154,7 @@ function CreateComponentForm() {
|
|
|
3098
3154
|
resetAndClosePopup();
|
|
3099
3155
|
trackComponentEvent({
|
|
3100
3156
|
action: "createCancelled",
|
|
3157
|
+
source: "user",
|
|
3101
3158
|
...eventData.current
|
|
3102
3159
|
});
|
|
3103
3160
|
};
|
|
@@ -4056,7 +4113,8 @@ function setOverridableProp({
|
|
|
4056
4113
|
elType,
|
|
4057
4114
|
widgetType,
|
|
4058
4115
|
originValue,
|
|
4059
|
-
originPropFields
|
|
4116
|
+
originPropFields,
|
|
4117
|
+
source
|
|
4060
4118
|
}) {
|
|
4061
4119
|
const overridableProps = selectOverridableProps((0, import_store58.__getState)(), componentId);
|
|
4062
4120
|
if (!overridableProps) {
|
|
@@ -4104,6 +4162,19 @@ function setOverridableProp({
|
|
|
4104
4162
|
}
|
|
4105
4163
|
})
|
|
4106
4164
|
);
|
|
4165
|
+
const isNewProperty = !existingOverridableProp;
|
|
4166
|
+
if (isNewProperty) {
|
|
4167
|
+
const currentComponent = selectCurrentComponent((0, import_store58.__getState)());
|
|
4168
|
+
trackComponentEvent({
|
|
4169
|
+
action: "propertyExposed",
|
|
4170
|
+
source,
|
|
4171
|
+
component_uid: currentComponent?.uid,
|
|
4172
|
+
property_id: overridableProp.overrideKey,
|
|
4173
|
+
property_path: propKey,
|
|
4174
|
+
property_name: label,
|
|
4175
|
+
element_type: widgetType ?? elType
|
|
4176
|
+
});
|
|
4177
|
+
}
|
|
4107
4178
|
return overridableProp;
|
|
4108
4179
|
}
|
|
4109
4180
|
|
|
@@ -4232,7 +4303,8 @@ function Content2({ componentId, overridableProps }) {
|
|
|
4232
4303
|
elType: elType ?? "widget",
|
|
4233
4304
|
widgetType: componentInstanceElement?.elementType.key ?? elementType.key,
|
|
4234
4305
|
originValue,
|
|
4235
|
-
originPropFields: matchingOverridableProp?.originPropFields
|
|
4306
|
+
originPropFields: matchingOverridableProp?.originPropFields,
|
|
4307
|
+
source: "user"
|
|
4236
4308
|
});
|
|
4237
4309
|
if (!overridableValue && overridablePropConfig) {
|
|
4238
4310
|
setOverridableValue({
|
|
@@ -4350,7 +4422,14 @@ var handleSaveAsComponent = async (params) => {
|
|
|
4350
4422
|
}
|
|
4351
4423
|
throw new Error("Unknown error");
|
|
4352
4424
|
}
|
|
4353
|
-
createUnpublishedComponent(
|
|
4425
|
+
await createUnpublishedComponent({
|
|
4426
|
+
name: componentName,
|
|
4427
|
+
element,
|
|
4428
|
+
eventData: null,
|
|
4429
|
+
uid,
|
|
4430
|
+
overridableProps,
|
|
4431
|
+
source: "mcp_tool"
|
|
4432
|
+
});
|
|
4354
4433
|
return {
|
|
4355
4434
|
status: "ok",
|
|
4356
4435
|
message: `Component "${componentName}" created successfully.`,
|