@elementor/editor-interactions 4.1.0-764 → 4.1.0-765
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 +49 -40
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +49 -40
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -12
- package/src/components/interactions-list.tsx +14 -4
- package/src/components/interactions-tab.tsx +0 -3
package/dist/index.js
CHANGED
|
@@ -635,41 +635,6 @@ var PopupStateProvider = ({ children }) => {
|
|
|
635
635
|
return /* @__PURE__ */ React3.createElement(PopupStateContext.Provider, { value: { openByDefault, triggerDefaultOpen, resetDefaultOpen } }, children);
|
|
636
636
|
};
|
|
637
637
|
|
|
638
|
-
// src/utils/tracking.ts
|
|
639
|
-
var import_editor_elements3 = require("@elementor/editor-elements");
|
|
640
|
-
var import_events = require("@elementor/events");
|
|
641
|
-
var TRIGGER_LABELS2 = {
|
|
642
|
-
load: "On page load",
|
|
643
|
-
scrollIn: "Scroll into view",
|
|
644
|
-
scrollOut: "Scroll out of view",
|
|
645
|
-
scrollOn: "While scrolling",
|
|
646
|
-
hover: "Hover",
|
|
647
|
-
click: "Click"
|
|
648
|
-
};
|
|
649
|
-
var capitalize2 = (s) => s.charAt(0).toUpperCase() + s.slice(1);
|
|
650
|
-
var trackInteractionCreated = (elementId, item) => {
|
|
651
|
-
const { dispatchEvent, config } = (0, import_events.getMixpanel)();
|
|
652
|
-
if (!config?.names?.interactions?.created) {
|
|
653
|
-
return;
|
|
654
|
-
}
|
|
655
|
-
const trigger = extractString(item.value.trigger);
|
|
656
|
-
const effect = extractString(item.value.animation.value.effect);
|
|
657
|
-
const type = extractString(item.value.animation.value.type);
|
|
658
|
-
dispatchEvent?.(config.names.interactions.created, {
|
|
659
|
-
app_type: config?.appTypes?.editor,
|
|
660
|
-
window_name: config?.appTypes?.editor,
|
|
661
|
-
interaction_type: config?.triggers?.click,
|
|
662
|
-
target_name: (0, import_editor_elements3.getElementLabel)(elementId),
|
|
663
|
-
interaction_result: "interaction_created",
|
|
664
|
-
target_location: config?.locations?.widgetPanel,
|
|
665
|
-
location_l1: (0, import_editor_elements3.getElementLabel)(elementId),
|
|
666
|
-
location_l2: "interactions",
|
|
667
|
-
interaction_description: "interaction_created",
|
|
668
|
-
interaction_trigger: TRIGGER_LABELS2[trigger] ?? capitalize2(trigger),
|
|
669
|
-
interaction_effect: effect === "custom" ? capitalize2(effect) : `${capitalize2(effect)} ${capitalize2(type)}`
|
|
670
|
-
});
|
|
671
|
-
};
|
|
672
|
-
|
|
673
638
|
// src/components/interactions-list.tsx
|
|
674
639
|
var React10 = __toESM(require("react"));
|
|
675
640
|
var import_react9 = require("react");
|
|
@@ -717,6 +682,41 @@ function syncGridOverlay(trigger, start, end, relativeTo) {
|
|
|
717
682
|
}
|
|
718
683
|
}
|
|
719
684
|
|
|
685
|
+
// src/utils/tracking.ts
|
|
686
|
+
var import_editor_elements3 = require("@elementor/editor-elements");
|
|
687
|
+
var import_events = require("@elementor/events");
|
|
688
|
+
var TRIGGER_LABELS2 = {
|
|
689
|
+
load: "On page load",
|
|
690
|
+
scrollIn: "Scroll into view",
|
|
691
|
+
scrollOut: "Scroll out of view",
|
|
692
|
+
scrollOn: "While scrolling",
|
|
693
|
+
hover: "Hover",
|
|
694
|
+
click: "Click"
|
|
695
|
+
};
|
|
696
|
+
var capitalize2 = (s) => s.charAt(0).toUpperCase() + s.slice(1);
|
|
697
|
+
var trackInteractionCreated = (elementId, item) => {
|
|
698
|
+
const { dispatchEvent, config } = (0, import_events.getMixpanel)();
|
|
699
|
+
if (!config?.names?.interactions?.created) {
|
|
700
|
+
return;
|
|
701
|
+
}
|
|
702
|
+
const trigger = extractString(item.value.trigger);
|
|
703
|
+
const effect = extractString(item.value.animation.value.effect);
|
|
704
|
+
const type = extractString(item.value.animation.value.type);
|
|
705
|
+
dispatchEvent?.(config.names.interactions.created, {
|
|
706
|
+
app_type: config?.appTypes?.editor,
|
|
707
|
+
window_name: config?.appTypes?.editor,
|
|
708
|
+
interaction_type: config?.triggers?.click,
|
|
709
|
+
target_name: (0, import_editor_elements3.getElementLabel)(elementId),
|
|
710
|
+
interaction_result: "interaction_created",
|
|
711
|
+
target_location: config?.locations?.widgetPanel,
|
|
712
|
+
location_l1: (0, import_editor_elements3.getElementLabel)(elementId),
|
|
713
|
+
location_l2: "interactions",
|
|
714
|
+
interaction_description: "interaction_created",
|
|
715
|
+
interaction_trigger: TRIGGER_LABELS2[trigger] ?? capitalize2(trigger),
|
|
716
|
+
interaction_effect: effect === "custom" ? capitalize2(effect) : `${capitalize2(effect)} ${capitalize2(type)}`
|
|
717
|
+
});
|
|
718
|
+
};
|
|
719
|
+
|
|
720
720
|
// src/components/interaction-details.tsx
|
|
721
721
|
var React7 = __toESM(require("react"));
|
|
722
722
|
var import_react6 = require("react");
|
|
@@ -1145,6 +1145,7 @@ function InteractionsList(props) {
|
|
|
1145
1145
|
const { interactions, onSelectInteractions, onPlayInteraction, triggerCreateOnShowEmpty } = props;
|
|
1146
1146
|
const { elementId } = useInteractionsContext();
|
|
1147
1147
|
const hasInitializedRef = (0, import_react9.useRef)(false);
|
|
1148
|
+
const newlyCreatedIdsRef = (0, import_react9.useRef)(/* @__PURE__ */ new Set());
|
|
1148
1149
|
const handleUpdateInteractions = (0, import_react9.useCallback)(
|
|
1149
1150
|
(newInteractions) => {
|
|
1150
1151
|
onSelectInteractions(newInteractions);
|
|
@@ -1154,9 +1155,11 @@ function InteractionsList(props) {
|
|
|
1154
1155
|
(0, import_react9.useEffect)(() => {
|
|
1155
1156
|
if (triggerCreateOnShowEmpty && !hasInitializedRef.current && (!interactions.items || interactions.items?.length === 0)) {
|
|
1156
1157
|
hasInitializedRef.current = true;
|
|
1158
|
+
const newItem = createDefaultInteractionItem();
|
|
1159
|
+
newlyCreatedIdsRef.current.add(extractString(newItem.value.interaction_id));
|
|
1157
1160
|
const newState = {
|
|
1158
1161
|
version: 1,
|
|
1159
|
-
items: [
|
|
1162
|
+
items: [newItem]
|
|
1160
1163
|
};
|
|
1161
1164
|
handleUpdateInteractions(newState);
|
|
1162
1165
|
}
|
|
@@ -1177,11 +1180,11 @@ function InteractionsList(props) {
|
|
|
1177
1180
|
if (meta?.action?.type === "add") {
|
|
1178
1181
|
const addedItem = meta.action.payload[0]?.item;
|
|
1179
1182
|
if (addedItem) {
|
|
1180
|
-
|
|
1183
|
+
newlyCreatedIdsRef.current.add(extractString(addedItem.value.interaction_id));
|
|
1181
1184
|
}
|
|
1182
1185
|
}
|
|
1183
1186
|
},
|
|
1184
|
-
[interactions, handleUpdateInteractions
|
|
1187
|
+
[interactions, handleUpdateInteractions]
|
|
1185
1188
|
);
|
|
1186
1189
|
const handleInteractionChange = (0, import_react9.useCallback)(
|
|
1187
1190
|
(index, newInteractionValue) => {
|
|
@@ -1229,7 +1232,14 @@ function InteractionsList(props) {
|
|
|
1229
1232
|
);
|
|
1230
1233
|
syncGridOverlay(trigger, start, end, relativeTo);
|
|
1231
1234
|
},
|
|
1232
|
-
onPopoverClose: () =>
|
|
1235
|
+
onPopoverClose: (value) => {
|
|
1236
|
+
dispatchScrollInteraction(null);
|
|
1237
|
+
const id = extractString(value.value.interaction_id);
|
|
1238
|
+
if (newlyCreatedIdsRef.current.has(id)) {
|
|
1239
|
+
newlyCreatedIdsRef.current.delete(id);
|
|
1240
|
+
trackInteractionCreated(elementId, value);
|
|
1241
|
+
}
|
|
1242
|
+
},
|
|
1233
1243
|
actions: (value) => /* @__PURE__ */ React10.createElement(import_ui6.Tooltip, { key: "preview", placement: "top", title: (0, import_i18n6.__)("Preview", "elementor") }, /* @__PURE__ */ React10.createElement(
|
|
1234
1244
|
import_ui6.IconButton,
|
|
1235
1245
|
{
|
|
@@ -1257,7 +1267,6 @@ function InteractionsTabContent({ elementId }) {
|
|
|
1257
1267
|
{
|
|
1258
1268
|
onCreateInteraction: () => {
|
|
1259
1269
|
firstInteractionState[1](true);
|
|
1260
|
-
trackInteractionCreated(elementId, createDefaultInteractionItem());
|
|
1261
1270
|
}
|
|
1262
1271
|
}
|
|
1263
1272
|
));
|