@elementor/editor-controls 4.0.0-676 → 4.0.0-677
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 +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +64 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +60 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/components/promotions/attributes-control.tsx +2 -1
- package/src/components/promotions/display-conditions-control.tsx +2 -1
- package/src/components/promotions/promotion-trigger.tsx +14 -4
- package/src/index.ts +2 -0
- package/src/utils/tracking.ts +61 -0
package/dist/index.mjs
CHANGED
|
@@ -6710,18 +6710,66 @@ import { __ as __52 } from "@wordpress/i18n";
|
|
|
6710
6710
|
|
|
6711
6711
|
// src/components/promotions/promotion-trigger.tsx
|
|
6712
6712
|
import * as React103 from "react";
|
|
6713
|
-
import { forwardRef as forwardRef11, useImperativeHandle, useState as useState17 } from "react";
|
|
6713
|
+
import { forwardRef as forwardRef11, useCallback as useCallback4, useImperativeHandle, useState as useState17 } from "react";
|
|
6714
6714
|
import { PromotionChip as PromotionChip2, PromotionInfotip } from "@elementor/editor-ui";
|
|
6715
6715
|
import { Box as Box25 } from "@elementor/ui";
|
|
6716
|
+
|
|
6717
|
+
// src/utils/tracking.ts
|
|
6718
|
+
import { getSelectedElements as getSelectedElements2 } from "@elementor/editor-elements";
|
|
6719
|
+
import { getMixpanel } from "@elementor/events";
|
|
6720
|
+
var getBaseEventProperties = (data, config) => ({
|
|
6721
|
+
app_type: config?.appTypes?.editor ?? "editor",
|
|
6722
|
+
window_name: config?.appTypes?.editor ?? "editor",
|
|
6723
|
+
interaction_type: config?.triggers?.click ?? "Click",
|
|
6724
|
+
target_name: data.target_name,
|
|
6725
|
+
target_location: data.target_location ?? "widget_panel",
|
|
6726
|
+
location_l1: data.location_l1 ?? getSelectedElements2()[0]?.type ?? "",
|
|
6727
|
+
...data.location_l2 && { location_l2: data.location_l2 }
|
|
6728
|
+
});
|
|
6729
|
+
var dispatchPromotionEvent = (data, resolveOptions) => {
|
|
6730
|
+
const { dispatchEvent, config } = getMixpanel();
|
|
6731
|
+
const { eventName, interactionResult, interactionDescription } = resolveOptions(config);
|
|
6732
|
+
if (!eventName) {
|
|
6733
|
+
return;
|
|
6734
|
+
}
|
|
6735
|
+
dispatchEvent?.(eventName, {
|
|
6736
|
+
...getBaseEventProperties(data, config),
|
|
6737
|
+
interaction_result: interactionResult,
|
|
6738
|
+
interaction_description: interactionDescription
|
|
6739
|
+
});
|
|
6740
|
+
};
|
|
6741
|
+
var trackViewPromotion = (data) => {
|
|
6742
|
+
dispatchPromotionEvent(data, (config) => ({
|
|
6743
|
+
eventName: config?.names?.promotions?.viewPromotion,
|
|
6744
|
+
interactionResult: config?.interactionResults?.promotionViewed ?? "promotion_viewed",
|
|
6745
|
+
interactionDescription: "user_viewed_promotion"
|
|
6746
|
+
}));
|
|
6747
|
+
};
|
|
6748
|
+
var trackUpgradePromotionClick = (data) => {
|
|
6749
|
+
dispatchPromotionEvent(data, (config) => ({
|
|
6750
|
+
eventName: config?.names?.promotions?.upgradePromotionClick,
|
|
6751
|
+
interactionResult: config?.interactionResults?.upgradeNow ?? "upgrade_now",
|
|
6752
|
+
interactionDescription: "user_clicked_upgrade_now"
|
|
6753
|
+
}));
|
|
6754
|
+
};
|
|
6755
|
+
|
|
6756
|
+
// src/components/promotions/promotion-trigger.tsx
|
|
6716
6757
|
function getV4Promotion(key) {
|
|
6717
6758
|
return window.elementor?.config?.v4Promotions?.[key];
|
|
6718
6759
|
}
|
|
6719
6760
|
var PromotionTrigger = forwardRef11(
|
|
6720
|
-
({ promotionKey, children }, ref) => {
|
|
6761
|
+
({ promotionKey, children, trackingData }, ref) => {
|
|
6721
6762
|
const [isOpen, setIsOpen] = useState17(false);
|
|
6722
6763
|
const promotion = getV4Promotion(promotionKey);
|
|
6723
|
-
const toggle = (
|
|
6724
|
-
|
|
6764
|
+
const toggle = useCallback4(() => {
|
|
6765
|
+
setIsOpen((prev) => {
|
|
6766
|
+
if (!prev) {
|
|
6767
|
+
trackViewPromotion(trackingData);
|
|
6768
|
+
}
|
|
6769
|
+
return !prev;
|
|
6770
|
+
});
|
|
6771
|
+
}, [trackingData]);
|
|
6772
|
+
useImperativeHandle(ref, () => ({ toggle }), [toggle]);
|
|
6725
6773
|
return /* @__PURE__ */ React103.createElement(React103.Fragment, null, promotion && /* @__PURE__ */ React103.createElement(
|
|
6726
6774
|
PromotionInfotip,
|
|
6727
6775
|
{
|
|
@@ -6733,7 +6781,8 @@ var PromotionTrigger = forwardRef11(
|
|
|
6733
6781
|
onClose: (e) => {
|
|
6734
6782
|
e.stopPropagation();
|
|
6735
6783
|
setIsOpen(false);
|
|
6736
|
-
}
|
|
6784
|
+
},
|
|
6785
|
+
onCtaClick: () => trackUpgradePromotionClick(trackingData)
|
|
6737
6786
|
},
|
|
6738
6787
|
/* @__PURE__ */ React103.createElement(
|
|
6739
6788
|
Box25,
|
|
@@ -6752,6 +6801,7 @@ var PromotionTrigger = forwardRef11(
|
|
|
6752
6801
|
|
|
6753
6802
|
// src/components/promotions/display-conditions-control.tsx
|
|
6754
6803
|
var ARIA_LABEL = __52("Display Conditions", "elementor");
|
|
6804
|
+
var TRACKING_DATA = { target_name: "display_conditions", location_l2: "general" };
|
|
6755
6805
|
var DisplayConditionsControl = createControl(() => {
|
|
6756
6806
|
const triggerRef = useRef25(null);
|
|
6757
6807
|
return /* @__PURE__ */ React104.createElement(
|
|
@@ -6764,7 +6814,7 @@ var DisplayConditionsControl = createControl(() => {
|
|
|
6764
6814
|
alignItems: "center"
|
|
6765
6815
|
}
|
|
6766
6816
|
},
|
|
6767
|
-
/* @__PURE__ */ React104.createElement(PromotionTrigger, { ref: triggerRef, promotionKey: "displayConditions" }),
|
|
6817
|
+
/* @__PURE__ */ React104.createElement(PromotionTrigger, { ref: triggerRef, promotionKey: "displayConditions", trackingData: TRACKING_DATA }),
|
|
6768
6818
|
/* @__PURE__ */ React104.createElement(Tooltip9, { title: ARIA_LABEL, placement: "top" }, /* @__PURE__ */ React104.createElement(
|
|
6769
6819
|
IconButton8,
|
|
6770
6820
|
{
|
|
@@ -6790,6 +6840,7 @@ import { PlusIcon as PlusIcon3 } from "@elementor/icons";
|
|
|
6790
6840
|
import { Stack as Stack19, Tooltip as Tooltip10 } from "@elementor/ui";
|
|
6791
6841
|
import { __ as __53 } from "@wordpress/i18n";
|
|
6792
6842
|
var ARIA_LABEL2 = __53("Attributes", "elementor");
|
|
6843
|
+
var TRACKING_DATA2 = { target_name: "attributes", location_l2: "general" };
|
|
6793
6844
|
var AttributesControl = createControl(() => {
|
|
6794
6845
|
const triggerRef = useRef26(null);
|
|
6795
6846
|
return /* @__PURE__ */ React105.createElement(
|
|
@@ -6802,7 +6853,7 @@ var AttributesControl = createControl(() => {
|
|
|
6802
6853
|
alignItems: "center"
|
|
6803
6854
|
}
|
|
6804
6855
|
},
|
|
6805
|
-
/* @__PURE__ */ React105.createElement(PromotionTrigger, { ref: triggerRef, promotionKey: "attributes" }),
|
|
6856
|
+
/* @__PURE__ */ React105.createElement(PromotionTrigger, { ref: triggerRef, promotionKey: "attributes", trackingData: TRACKING_DATA2 }),
|
|
6806
6857
|
/* @__PURE__ */ React105.createElement(Tooltip10, { title: ARIA_LABEL2, placement: "top" }, /* @__PURE__ */ React105.createElement(
|
|
6807
6858
|
PlusIcon3,
|
|
6808
6859
|
{
|
|
@@ -7574,6 +7625,8 @@ export {
|
|
|
7574
7625
|
injectIntoRepeaterItemLabel,
|
|
7575
7626
|
isUnitExtendedOption,
|
|
7576
7627
|
registerControlReplacement,
|
|
7628
|
+
trackUpgradePromotionClick,
|
|
7629
|
+
trackViewPromotion,
|
|
7577
7630
|
transitionProperties,
|
|
7578
7631
|
transitionsItemsList,
|
|
7579
7632
|
useBoundProp,
|