@elementor/editor-controls 4.0.0-676 → 4.0.0-678

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
@@ -2600,11 +2600,11 @@ var ToggleControl = createControl(
2600
2600
  // src/controls/number-control.tsx
2601
2601
  import * as React55 from "react";
2602
2602
  import { numberPropTypeUtil } from "@elementor/editor-props";
2603
- import { InputAdornment as InputAdornment3 } from "@elementor/ui";
2603
+ import { InputAdornment as InputAdornment3, Typography as Typography4 } from "@elementor/ui";
2604
2604
  var isEmptyOrNaN = (value) => value === null || value === void 0 || value === "" || Number.isNaN(Number(value));
2605
2605
  var renderSuffix = (propType) => {
2606
2606
  if (propType.meta?.suffix) {
2607
- return /* @__PURE__ */ React55.createElement(InputAdornment3, { position: "end" }, propType.meta.suffix);
2607
+ return /* @__PURE__ */ React55.createElement(InputAdornment3, { position: "end" }, /* @__PURE__ */ React55.createElement(Typography4, { variant: "caption", color: "text.secondary" }, propType.meta.suffix));
2608
2608
  }
2609
2609
  return /* @__PURE__ */ React55.createElement(React55.Fragment, null);
2610
2610
  };
@@ -2953,7 +2953,7 @@ import { __ as __20 } from "@wordpress/i18n";
2953
2953
  import * as React58 from "react";
2954
2954
  import { useCallback as useCallback2, useEffect as useEffect8, useState as useState8 } from "react";
2955
2955
  import { PopoverBody, PopoverHeader as PopoverHeader2, PopoverMenuList, SearchField } from "@elementor/editor-ui";
2956
- import { Box as Box8, Divider as Divider2, Link, Stack as Stack9, Typography as Typography4 } from "@elementor/ui";
2956
+ import { Box as Box8, Divider as Divider2, Link, Stack as Stack9, Typography as Typography5 } from "@elementor/ui";
2957
2957
  import { debounce } from "@elementor/utils";
2958
2958
  import { __ as __19 } from "@wordpress/i18n";
2959
2959
 
@@ -3030,8 +3030,8 @@ var ItemSelector = ({
3030
3030
  overflow: "hidden"
3031
3031
  },
3032
3032
  /* @__PURE__ */ React58.createElement(IconComponent, { fontSize: "large" }),
3033
- /* @__PURE__ */ React58.createElement(Box8, { sx: { maxWidth: 160, overflow: "hidden" } }, /* @__PURE__ */ React58.createElement(Typography4, { align: "center", variant: "subtitle2", color: "text.secondary" }, __19("Sorry, nothing matched", "elementor")), /* @__PURE__ */ React58.createElement(
3034
- Typography4,
3033
+ /* @__PURE__ */ React58.createElement(Box8, { sx: { maxWidth: 160, overflow: "hidden" } }, /* @__PURE__ */ React58.createElement(Typography5, { align: "center", variant: "subtitle2", color: "text.secondary" }, __19("Sorry, nothing matched", "elementor")), /* @__PURE__ */ React58.createElement(
3034
+ Typography5,
3035
3035
  {
3036
3036
  variant: "subtitle2",
3037
3037
  color: "text.secondary",
@@ -3049,7 +3049,7 @@ var ItemSelector = ({
3049
3049
  /* @__PURE__ */ React58.createElement("span", null, "\u201D.")
3050
3050
  )),
3051
3051
  /* @__PURE__ */ React58.createElement(
3052
- Typography4,
3052
+ Typography5,
3053
3053
  {
3054
3054
  align: "center",
3055
3055
  variant: "caption",
@@ -3655,7 +3655,7 @@ import * as React67 from "react";
3655
3655
  import { getElementLabel } from "@elementor/editor-elements";
3656
3656
  import { stringPropTypeUtil as stringPropTypeUtil8 } from "@elementor/editor-props";
3657
3657
  import { MenuListItem as MenuListItem3 } from "@elementor/editor-ui";
3658
- import { Select as Select2, styled as styled6, Typography as Typography5 } from "@elementor/ui";
3658
+ import { Select as Select2, styled as styled6, Typography as Typography6 } from "@elementor/ui";
3659
3659
  import { __ as __24 } from "@wordpress/i18n";
3660
3660
 
3661
3661
  // src/components/conditional-control-infotip.tsx
@@ -3730,7 +3730,7 @@ var HtmlTagControl = createControl(({ options, onChange, fallbackLabels = {} })
3730
3730
  }
3731
3731
  const placeholderOption = findOptionByValue(placeholder);
3732
3732
  const displayText = placeholderOption?.label || placeholder;
3733
- return /* @__PURE__ */ React67.createElement(Typography5, { component: "span", variant: "caption", color: "text.tertiary" }, displayText);
3733
+ return /* @__PURE__ */ React67.createElement(Typography6, { component: "span", variant: "caption", color: "text.tertiary" }, displayText);
3734
3734
  };
3735
3735
  const findOptionByValue = (searchValue) => options.find((opt) => opt.value === searchValue);
3736
3736
  return /* @__PURE__ */ React67.createElement(ControlActions, null, /* @__PURE__ */ React67.createElement(ConditionalControlInfotip, { ...infoTipProps }, /* @__PURE__ */ React67.createElement(
@@ -5132,7 +5132,7 @@ import * as React95 from "react";
5132
5132
  import { useRef as useRef21 } from "react";
5133
5133
  import { transformFunctionsPropTypeUtil, transformPropTypeUtil } from "@elementor/editor-props";
5134
5134
  import { AdjustmentsIcon as AdjustmentsIcon2, InfoCircleFilledIcon as InfoCircleFilledIcon2 } from "@elementor/icons";
5135
- import { bindTrigger as bindTrigger4, Box as Box18, IconButton as IconButton7, Tooltip as Tooltip8, Typography as Typography6, usePopupState as usePopupState6 } from "@elementor/ui";
5135
+ import { bindTrigger as bindTrigger4, Box as Box18, IconButton as IconButton7, Tooltip as Tooltip8, Typography as Typography7, usePopupState as usePopupState6 } from "@elementor/ui";
5136
5136
  import { __ as __47 } from "@wordpress/i18n";
5137
5137
 
5138
5138
  // src/controls/transform-control/initial-values.ts
@@ -5674,7 +5674,7 @@ var ToolTip = /* @__PURE__ */ React95.createElement(
5674
5674
  sx: { display: "flex", gap: 0.5, p: 2, width: 320, borderRadius: 1 }
5675
5675
  },
5676
5676
  /* @__PURE__ */ React95.createElement(InfoCircleFilledIcon2, { sx: { color: "secondary.main" } }),
5677
- /* @__PURE__ */ React95.createElement(Typography6, { variant: "body2", color: "text.secondary", fontSize: "14px" }, __47("You can use each kind of transform only once per element.", "elementor"))
5677
+ /* @__PURE__ */ React95.createElement(Typography7, { variant: "body2", color: "text.secondary", fontSize: "14px" }, __47("You can use each kind of transform only once per element.", "elementor"))
5678
5678
  );
5679
5679
  var Repeater2 = ({
5680
5680
  headerRef,
@@ -5740,7 +5740,7 @@ import {
5740
5740
  selectionSizePropTypeUtil as selectionSizePropTypeUtil2
5741
5741
  } from "@elementor/editor-props";
5742
5742
  import { InfoCircleFilledIcon as InfoCircleFilledIcon3 } from "@elementor/icons";
5743
- import { Alert as Alert2, AlertTitle as AlertTitle3, Box as Box20, Typography as Typography7 } from "@elementor/ui";
5743
+ import { Alert as Alert2, AlertTitle as AlertTitle3, Box as Box20, Typography as Typography8 } from "@elementor/ui";
5744
5744
  import { __ as __50 } from "@wordpress/i18n";
5745
5745
 
5746
5746
  // src/controls/selection-size-control.tsx
@@ -6228,7 +6228,7 @@ var disableAddItemTooltipContent = /* @__PURE__ */ React98.createElement(
6228
6228
  icon: /* @__PURE__ */ React98.createElement(InfoCircleFilledIcon3, null)
6229
6229
  },
6230
6230
  /* @__PURE__ */ React98.createElement(AlertTitle3, null, __50("Transitions", "elementor")),
6231
- /* @__PURE__ */ React98.createElement(Box20, { component: "span" }, /* @__PURE__ */ React98.createElement(Typography7, { variant: "body2" }, __50("Switch to 'Normal' state to add a transition.", "elementor")))
6231
+ /* @__PURE__ */ React98.createElement(Box20, { component: "span" }, /* @__PURE__ */ React98.createElement(Typography8, { variant: "body2" }, __50("Switch to 'Normal' state to add a transition.", "elementor")))
6232
6232
  );
6233
6233
  var TransitionRepeaterControl = createControl(
6234
6234
  ({
@@ -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 = () => setIsOpen((prev) => !prev);
6724
- useImperativeHandle(ref, () => ({ toggle }), []);
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,