@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.d.mts
CHANGED
|
@@ -413,6 +413,15 @@ declare const DisplayConditionsControl: ControlComponent$1<() => React$1.JSX.Ele
|
|
|
413
413
|
|
|
414
414
|
declare const AttributesControl: ControlComponent$1<() => React$1.JSX.Element>;
|
|
415
415
|
|
|
416
|
+
type PromotionTrackingData = {
|
|
417
|
+
target_name: string;
|
|
418
|
+
target_location?: 'widget_panel' | 'variables_manager';
|
|
419
|
+
location_l1?: string;
|
|
420
|
+
location_l2?: 'style' | 'general' | 'interactions';
|
|
421
|
+
};
|
|
422
|
+
declare const trackViewPromotion: (data: PromotionTrackingData) => void;
|
|
423
|
+
declare const trackUpgradePromotionClick: (data: PromotionTrackingData) => void;
|
|
424
|
+
|
|
416
425
|
type V4PromotionData = {
|
|
417
426
|
title: string;
|
|
418
427
|
content: string;
|
|
@@ -424,6 +433,7 @@ type V4PromotionKey = 'displayConditions' | 'customCss' | 'attributes';
|
|
|
424
433
|
type PromotionTriggerProps = {
|
|
425
434
|
promotionKey: V4PromotionKey;
|
|
426
435
|
children?: ReactNode;
|
|
436
|
+
trackingData: PromotionTrackingData;
|
|
427
437
|
};
|
|
428
438
|
type PromotionTriggerRef = {
|
|
429
439
|
toggle: () => void;
|
|
@@ -727,4 +737,4 @@ declare function useTypingBuffer(options?: UseTypingBufferOptions): {
|
|
|
727
737
|
startsWith: (haystack: string, needle: string) => boolean;
|
|
728
738
|
};
|
|
729
739
|
|
|
730
|
-
export { type AdornmentComponent, type AngleUnit, AspectRatioControl, AttributesControl, BackgroundControl, BoxShadowRepeaterControl, ChipsControl, ClearIconButton, ColorControl, type ControlActionsItems, ControlActionsProvider, ControlAdornments, ControlAdornmentsProvider, type ControlComponent$1 as ControlComponent, ControlFormLabel, type ControlReplacement, ControlReplacementsProvider, ControlToggleButtonGroup, DateTimeControl, DisplayConditionsControl, EmailFormActionControl, type EqualUnequalItems, EqualUnequalSizesControl, type ExtendedOption, FilterRepeaterControl, type FontCategory, FontFamilyControl, GapControl, HtmlTagControl, ImageControl, InlineEditingControl, InlineEditor, InlineEditorToolbar, type InlineEditorToolbarProps, ItemSelector, type ItemsActionPayload, KeyValueControl, type LengthUnit, LinkControl, LinkedDimensionsControl, NumberControl, NumberInput, PopoverContent, PopoverGridContainer, PositionControl, PromotionTrigger, type PromotionTriggerRef, PropKeyProvider, PropProvider, type PropProviderProps, QueryControl, RepeatableControl, Repeater, type RepeaterItem, SelectControl, SelectControlWrapper, type SetRepeaterValuesMeta, type SetValue, type SetValueMeta, SizeControl, StrokeControl, SvgMediaControl, SwitchControl, TextAreaControl, TextControl, type TimeUnit, type ToggleButtonGroupItem, ToggleButtonGroupUi, ToggleControl, type ToggleControlProps, TransformRepeaterControl, TransformSettingsControl, TransitionRepeaterControl, type Unit, UnstableSizeField, UrlControl, type UseTypingBufferOptions, type V4PromotionData, type V4PromotionKey, VideoMediaControl, createControl, createControlReplacementsRegistry, enqueueFont, getControlReplacements, injectIntoRepeaterItemActions, injectIntoRepeaterItemIcon, injectIntoRepeaterItemLabel, isUnitExtendedOption, registerControlReplacement, transitionProperties, transitionsItemsList, useBoundProp, useControlActions, useControlReplacement, useFontFamilies, useSyncExternalState, useTypingBuffer };
|
|
740
|
+
export { type AdornmentComponent, type AngleUnit, AspectRatioControl, AttributesControl, BackgroundControl, BoxShadowRepeaterControl, ChipsControl, ClearIconButton, ColorControl, type ControlActionsItems, ControlActionsProvider, ControlAdornments, ControlAdornmentsProvider, type ControlComponent$1 as ControlComponent, ControlFormLabel, type ControlReplacement, ControlReplacementsProvider, ControlToggleButtonGroup, DateTimeControl, DisplayConditionsControl, EmailFormActionControl, type EqualUnequalItems, EqualUnequalSizesControl, type ExtendedOption, FilterRepeaterControl, type FontCategory, FontFamilyControl, GapControl, HtmlTagControl, ImageControl, InlineEditingControl, InlineEditor, InlineEditorToolbar, type InlineEditorToolbarProps, ItemSelector, type ItemsActionPayload, KeyValueControl, type LengthUnit, LinkControl, LinkedDimensionsControl, NumberControl, NumberInput, PopoverContent, PopoverGridContainer, PositionControl, type PromotionTrackingData, PromotionTrigger, type PromotionTriggerRef, PropKeyProvider, PropProvider, type PropProviderProps, QueryControl, RepeatableControl, Repeater, type RepeaterItem, SelectControl, SelectControlWrapper, type SetRepeaterValuesMeta, type SetValue, type SetValueMeta, SizeControl, StrokeControl, SvgMediaControl, SwitchControl, TextAreaControl, TextControl, type TimeUnit, type ToggleButtonGroupItem, ToggleButtonGroupUi, ToggleControl, type ToggleControlProps, TransformRepeaterControl, TransformSettingsControl, TransitionRepeaterControl, type Unit, UnstableSizeField, UrlControl, type UseTypingBufferOptions, type V4PromotionData, type V4PromotionKey, VideoMediaControl, createControl, createControlReplacementsRegistry, enqueueFont, getControlReplacements, injectIntoRepeaterItemActions, injectIntoRepeaterItemIcon, injectIntoRepeaterItemLabel, isUnitExtendedOption, registerControlReplacement, trackUpgradePromotionClick, trackViewPromotion, transitionProperties, transitionsItemsList, useBoundProp, useControlActions, useControlReplacement, useFontFamilies, useSyncExternalState, useTypingBuffer };
|
package/dist/index.d.ts
CHANGED
|
@@ -413,6 +413,15 @@ declare const DisplayConditionsControl: ControlComponent$1<() => React$1.JSX.Ele
|
|
|
413
413
|
|
|
414
414
|
declare const AttributesControl: ControlComponent$1<() => React$1.JSX.Element>;
|
|
415
415
|
|
|
416
|
+
type PromotionTrackingData = {
|
|
417
|
+
target_name: string;
|
|
418
|
+
target_location?: 'widget_panel' | 'variables_manager';
|
|
419
|
+
location_l1?: string;
|
|
420
|
+
location_l2?: 'style' | 'general' | 'interactions';
|
|
421
|
+
};
|
|
422
|
+
declare const trackViewPromotion: (data: PromotionTrackingData) => void;
|
|
423
|
+
declare const trackUpgradePromotionClick: (data: PromotionTrackingData) => void;
|
|
424
|
+
|
|
416
425
|
type V4PromotionData = {
|
|
417
426
|
title: string;
|
|
418
427
|
content: string;
|
|
@@ -424,6 +433,7 @@ type V4PromotionKey = 'displayConditions' | 'customCss' | 'attributes';
|
|
|
424
433
|
type PromotionTriggerProps = {
|
|
425
434
|
promotionKey: V4PromotionKey;
|
|
426
435
|
children?: ReactNode;
|
|
436
|
+
trackingData: PromotionTrackingData;
|
|
427
437
|
};
|
|
428
438
|
type PromotionTriggerRef = {
|
|
429
439
|
toggle: () => void;
|
|
@@ -727,4 +737,4 @@ declare function useTypingBuffer(options?: UseTypingBufferOptions): {
|
|
|
727
737
|
startsWith: (haystack: string, needle: string) => boolean;
|
|
728
738
|
};
|
|
729
739
|
|
|
730
|
-
export { type AdornmentComponent, type AngleUnit, AspectRatioControl, AttributesControl, BackgroundControl, BoxShadowRepeaterControl, ChipsControl, ClearIconButton, ColorControl, type ControlActionsItems, ControlActionsProvider, ControlAdornments, ControlAdornmentsProvider, type ControlComponent$1 as ControlComponent, ControlFormLabel, type ControlReplacement, ControlReplacementsProvider, ControlToggleButtonGroup, DateTimeControl, DisplayConditionsControl, EmailFormActionControl, type EqualUnequalItems, EqualUnequalSizesControl, type ExtendedOption, FilterRepeaterControl, type FontCategory, FontFamilyControl, GapControl, HtmlTagControl, ImageControl, InlineEditingControl, InlineEditor, InlineEditorToolbar, type InlineEditorToolbarProps, ItemSelector, type ItemsActionPayload, KeyValueControl, type LengthUnit, LinkControl, LinkedDimensionsControl, NumberControl, NumberInput, PopoverContent, PopoverGridContainer, PositionControl, PromotionTrigger, type PromotionTriggerRef, PropKeyProvider, PropProvider, type PropProviderProps, QueryControl, RepeatableControl, Repeater, type RepeaterItem, SelectControl, SelectControlWrapper, type SetRepeaterValuesMeta, type SetValue, type SetValueMeta, SizeControl, StrokeControl, SvgMediaControl, SwitchControl, TextAreaControl, TextControl, type TimeUnit, type ToggleButtonGroupItem, ToggleButtonGroupUi, ToggleControl, type ToggleControlProps, TransformRepeaterControl, TransformSettingsControl, TransitionRepeaterControl, type Unit, UnstableSizeField, UrlControl, type UseTypingBufferOptions, type V4PromotionData, type V4PromotionKey, VideoMediaControl, createControl, createControlReplacementsRegistry, enqueueFont, getControlReplacements, injectIntoRepeaterItemActions, injectIntoRepeaterItemIcon, injectIntoRepeaterItemLabel, isUnitExtendedOption, registerControlReplacement, transitionProperties, transitionsItemsList, useBoundProp, useControlActions, useControlReplacement, useFontFamilies, useSyncExternalState, useTypingBuffer };
|
|
740
|
+
export { type AdornmentComponent, type AngleUnit, AspectRatioControl, AttributesControl, BackgroundControl, BoxShadowRepeaterControl, ChipsControl, ClearIconButton, ColorControl, type ControlActionsItems, ControlActionsProvider, ControlAdornments, ControlAdornmentsProvider, type ControlComponent$1 as ControlComponent, ControlFormLabel, type ControlReplacement, ControlReplacementsProvider, ControlToggleButtonGroup, DateTimeControl, DisplayConditionsControl, EmailFormActionControl, type EqualUnequalItems, EqualUnequalSizesControl, type ExtendedOption, FilterRepeaterControl, type FontCategory, FontFamilyControl, GapControl, HtmlTagControl, ImageControl, InlineEditingControl, InlineEditor, InlineEditorToolbar, type InlineEditorToolbarProps, ItemSelector, type ItemsActionPayload, KeyValueControl, type LengthUnit, LinkControl, LinkedDimensionsControl, NumberControl, NumberInput, PopoverContent, PopoverGridContainer, PositionControl, type PromotionTrackingData, PromotionTrigger, type PromotionTriggerRef, PropKeyProvider, PropProvider, type PropProviderProps, QueryControl, RepeatableControl, Repeater, type RepeaterItem, SelectControl, SelectControlWrapper, type SetRepeaterValuesMeta, type SetValue, type SetValueMeta, SizeControl, StrokeControl, SvgMediaControl, SwitchControl, TextAreaControl, TextControl, type TimeUnit, type ToggleButtonGroupItem, ToggleButtonGroupUi, ToggleControl, type ToggleControlProps, TransformRepeaterControl, TransformSettingsControl, TransitionRepeaterControl, type Unit, UnstableSizeField, UrlControl, type UseTypingBufferOptions, type V4PromotionData, type V4PromotionKey, VideoMediaControl, createControl, createControlReplacementsRegistry, enqueueFont, getControlReplacements, injectIntoRepeaterItemActions, injectIntoRepeaterItemIcon, injectIntoRepeaterItemLabel, isUnitExtendedOption, registerControlReplacement, trackUpgradePromotionClick, trackViewPromotion, transitionProperties, transitionsItemsList, useBoundProp, useControlActions, useControlReplacement, useFontFamilies, useSyncExternalState, useTypingBuffer };
|
package/dist/index.js
CHANGED
|
@@ -95,6 +95,8 @@ __export(index_exports, {
|
|
|
95
95
|
injectIntoRepeaterItemLabel: () => injectIntoRepeaterItemLabel,
|
|
96
96
|
isUnitExtendedOption: () => isUnitExtendedOption,
|
|
97
97
|
registerControlReplacement: () => registerControlReplacement,
|
|
98
|
+
trackUpgradePromotionClick: () => trackUpgradePromotionClick,
|
|
99
|
+
trackViewPromotion: () => trackViewPromotion,
|
|
98
100
|
transitionProperties: () => transitionProperties,
|
|
99
101
|
transitionsItemsList: () => transitionsItemsList,
|
|
100
102
|
useBoundProp: () => useBoundProp,
|
|
@@ -6728,15 +6730,63 @@ var React103 = __toESM(require("react"));
|
|
|
6728
6730
|
var import_react54 = require("react");
|
|
6729
6731
|
var import_editor_ui14 = require("@elementor/editor-ui");
|
|
6730
6732
|
var import_ui89 = require("@elementor/ui");
|
|
6733
|
+
|
|
6734
|
+
// src/utils/tracking.ts
|
|
6735
|
+
var import_editor_elements5 = require("@elementor/editor-elements");
|
|
6736
|
+
var import_events2 = require("@elementor/events");
|
|
6737
|
+
var getBaseEventProperties = (data, config) => ({
|
|
6738
|
+
app_type: config?.appTypes?.editor ?? "editor",
|
|
6739
|
+
window_name: config?.appTypes?.editor ?? "editor",
|
|
6740
|
+
interaction_type: config?.triggers?.click ?? "Click",
|
|
6741
|
+
target_name: data.target_name,
|
|
6742
|
+
target_location: data.target_location ?? "widget_panel",
|
|
6743
|
+
location_l1: data.location_l1 ?? (0, import_editor_elements5.getSelectedElements)()[0]?.type ?? "",
|
|
6744
|
+
...data.location_l2 && { location_l2: data.location_l2 }
|
|
6745
|
+
});
|
|
6746
|
+
var dispatchPromotionEvent = (data, resolveOptions) => {
|
|
6747
|
+
const { dispatchEvent, config } = (0, import_events2.getMixpanel)();
|
|
6748
|
+
const { eventName, interactionResult, interactionDescription } = resolveOptions(config);
|
|
6749
|
+
if (!eventName) {
|
|
6750
|
+
return;
|
|
6751
|
+
}
|
|
6752
|
+
dispatchEvent?.(eventName, {
|
|
6753
|
+
...getBaseEventProperties(data, config),
|
|
6754
|
+
interaction_result: interactionResult,
|
|
6755
|
+
interaction_description: interactionDescription
|
|
6756
|
+
});
|
|
6757
|
+
};
|
|
6758
|
+
var trackViewPromotion = (data) => {
|
|
6759
|
+
dispatchPromotionEvent(data, (config) => ({
|
|
6760
|
+
eventName: config?.names?.promotions?.viewPromotion,
|
|
6761
|
+
interactionResult: config?.interactionResults?.promotionViewed ?? "promotion_viewed",
|
|
6762
|
+
interactionDescription: "user_viewed_promotion"
|
|
6763
|
+
}));
|
|
6764
|
+
};
|
|
6765
|
+
var trackUpgradePromotionClick = (data) => {
|
|
6766
|
+
dispatchPromotionEvent(data, (config) => ({
|
|
6767
|
+
eventName: config?.names?.promotions?.upgradePromotionClick,
|
|
6768
|
+
interactionResult: config?.interactionResults?.upgradeNow ?? "upgrade_now",
|
|
6769
|
+
interactionDescription: "user_clicked_upgrade_now"
|
|
6770
|
+
}));
|
|
6771
|
+
};
|
|
6772
|
+
|
|
6773
|
+
// src/components/promotions/promotion-trigger.tsx
|
|
6731
6774
|
function getV4Promotion(key) {
|
|
6732
6775
|
return window.elementor?.config?.v4Promotions?.[key];
|
|
6733
6776
|
}
|
|
6734
6777
|
var PromotionTrigger = (0, import_react54.forwardRef)(
|
|
6735
|
-
({ promotionKey, children }, ref) => {
|
|
6778
|
+
({ promotionKey, children, trackingData }, ref) => {
|
|
6736
6779
|
const [isOpen, setIsOpen] = (0, import_react54.useState)(false);
|
|
6737
6780
|
const promotion = getV4Promotion(promotionKey);
|
|
6738
|
-
const toggle = ()
|
|
6739
|
-
|
|
6781
|
+
const toggle = (0, import_react54.useCallback)(() => {
|
|
6782
|
+
setIsOpen((prev) => {
|
|
6783
|
+
if (!prev) {
|
|
6784
|
+
trackViewPromotion(trackingData);
|
|
6785
|
+
}
|
|
6786
|
+
return !prev;
|
|
6787
|
+
});
|
|
6788
|
+
}, [trackingData]);
|
|
6789
|
+
(0, import_react54.useImperativeHandle)(ref, () => ({ toggle }), [toggle]);
|
|
6740
6790
|
return /* @__PURE__ */ React103.createElement(React103.Fragment, null, promotion && /* @__PURE__ */ React103.createElement(
|
|
6741
6791
|
import_editor_ui14.PromotionInfotip,
|
|
6742
6792
|
{
|
|
@@ -6748,7 +6798,8 @@ var PromotionTrigger = (0, import_react54.forwardRef)(
|
|
|
6748
6798
|
onClose: (e) => {
|
|
6749
6799
|
e.stopPropagation();
|
|
6750
6800
|
setIsOpen(false);
|
|
6751
|
-
}
|
|
6801
|
+
},
|
|
6802
|
+
onCtaClick: () => trackUpgradePromotionClick(trackingData)
|
|
6752
6803
|
},
|
|
6753
6804
|
/* @__PURE__ */ React103.createElement(
|
|
6754
6805
|
import_ui89.Box,
|
|
@@ -6767,6 +6818,7 @@ var PromotionTrigger = (0, import_react54.forwardRef)(
|
|
|
6767
6818
|
|
|
6768
6819
|
// src/components/promotions/display-conditions-control.tsx
|
|
6769
6820
|
var ARIA_LABEL = (0, import_i18n52.__)("Display Conditions", "elementor");
|
|
6821
|
+
var TRACKING_DATA = { target_name: "display_conditions", location_l2: "general" };
|
|
6770
6822
|
var DisplayConditionsControl = createControl(() => {
|
|
6771
6823
|
const triggerRef = (0, import_react55.useRef)(null);
|
|
6772
6824
|
return /* @__PURE__ */ React104.createElement(
|
|
@@ -6779,7 +6831,7 @@ var DisplayConditionsControl = createControl(() => {
|
|
|
6779
6831
|
alignItems: "center"
|
|
6780
6832
|
}
|
|
6781
6833
|
},
|
|
6782
|
-
/* @__PURE__ */ React104.createElement(PromotionTrigger, { ref: triggerRef, promotionKey: "displayConditions" }),
|
|
6834
|
+
/* @__PURE__ */ React104.createElement(PromotionTrigger, { ref: triggerRef, promotionKey: "displayConditions", trackingData: TRACKING_DATA }),
|
|
6783
6835
|
/* @__PURE__ */ React104.createElement(import_ui90.Tooltip, { title: ARIA_LABEL, placement: "top" }, /* @__PURE__ */ React104.createElement(
|
|
6784
6836
|
import_ui90.IconButton,
|
|
6785
6837
|
{
|
|
@@ -6805,6 +6857,7 @@ var import_icons35 = require("@elementor/icons");
|
|
|
6805
6857
|
var import_ui91 = require("@elementor/ui");
|
|
6806
6858
|
var import_i18n53 = require("@wordpress/i18n");
|
|
6807
6859
|
var ARIA_LABEL2 = (0, import_i18n53.__)("Attributes", "elementor");
|
|
6860
|
+
var TRACKING_DATA2 = { target_name: "attributes", location_l2: "general" };
|
|
6808
6861
|
var AttributesControl = createControl(() => {
|
|
6809
6862
|
const triggerRef = (0, import_react56.useRef)(null);
|
|
6810
6863
|
return /* @__PURE__ */ React105.createElement(
|
|
@@ -6817,7 +6870,7 @@ var AttributesControl = createControl(() => {
|
|
|
6817
6870
|
alignItems: "center"
|
|
6818
6871
|
}
|
|
6819
6872
|
},
|
|
6820
|
-
/* @__PURE__ */ React105.createElement(PromotionTrigger, { ref: triggerRef, promotionKey: "attributes" }),
|
|
6873
|
+
/* @__PURE__ */ React105.createElement(PromotionTrigger, { ref: triggerRef, promotionKey: "attributes", trackingData: TRACKING_DATA2 }),
|
|
6821
6874
|
/* @__PURE__ */ React105.createElement(import_ui91.Tooltip, { title: ARIA_LABEL2, placement: "top" }, /* @__PURE__ */ React105.createElement(
|
|
6822
6875
|
import_icons35.PlusIcon,
|
|
6823
6876
|
{
|
|
@@ -7040,7 +7093,7 @@ var usePopover = (openOnMount, onOpen) => {
|
|
|
7040
7093
|
// src/components/inline-editor-toolbar.tsx
|
|
7041
7094
|
var React109 = __toESM(require("react"));
|
|
7042
7095
|
var import_react59 = require("react");
|
|
7043
|
-
var
|
|
7096
|
+
var import_editor_elements6 = require("@elementor/editor-elements");
|
|
7044
7097
|
var import_icons39 = require("@elementor/icons");
|
|
7045
7098
|
var import_ui95 = require("@elementor/ui");
|
|
7046
7099
|
var import_react60 = require("@tiptap/react");
|
|
@@ -7234,10 +7287,10 @@ var InlineEditorToolbar = ({ editor, elementId, sx = {} }) => {
|
|
|
7234
7287
|
);
|
|
7235
7288
|
};
|
|
7236
7289
|
var checkIfElementIsClickable = (elementId) => {
|
|
7237
|
-
const container = (0,
|
|
7290
|
+
const container = (0, import_editor_elements6.getContainer)(elementId);
|
|
7238
7291
|
const type = container?.model.get("widgetType");
|
|
7239
7292
|
const isButton = type === "e-button";
|
|
7240
|
-
const hasLink = !!(0,
|
|
7293
|
+
const hasLink = !!(0, import_editor_elements6.getElementSetting)(elementId, "link")?.value?.destination;
|
|
7241
7294
|
return isButton || hasLink;
|
|
7242
7295
|
};
|
|
7243
7296
|
var toolbarButtons = {
|
|
@@ -7565,6 +7618,8 @@ var useFontFamilies = () => {
|
|
|
7565
7618
|
injectIntoRepeaterItemLabel,
|
|
7566
7619
|
isUnitExtendedOption,
|
|
7567
7620
|
registerControlReplacement,
|
|
7621
|
+
trackUpgradePromotionClick,
|
|
7622
|
+
trackViewPromotion,
|
|
7568
7623
|
transitionProperties,
|
|
7569
7624
|
transitionsItemsList,
|
|
7570
7625
|
useBoundProp,
|