@elementor/editor-app-bar 4.3.0-998 → 4.3.0-beta1

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 CHANGED
@@ -26,6 +26,7 @@ declare function Link({ icon: Icon, title, visible, showExternalLinkIcon, ...pro
26
26
  type Props = {
27
27
  title: string;
28
28
  icon: ElementType;
29
+ id?: string;
29
30
  selected?: boolean;
30
31
  disabled?: boolean;
31
32
  visible?: boolean;
package/dist/index.d.ts CHANGED
@@ -26,6 +26,7 @@ declare function Link({ icon: Icon, title, visible, showExternalLinkIcon, ...pro
26
26
  type Props = {
27
27
  title: string;
28
28
  icon: ElementType;
29
+ id?: string;
29
30
  selected?: boolean;
30
31
  disabled?: boolean;
31
32
  visible?: boolean;
package/dist/index.js CHANGED
@@ -241,8 +241,8 @@ var import_ui13 = require("@elementor/ui");
241
241
  // src/constants.ts
242
242
  var MIN_APP_BAR_WIDTH = 800;
243
243
  var DEFAULT_MAX_TOOLBAR_ACTIONS = {
244
- tools: 5,
245
- utilities: 4
244
+ tools: 6,
245
+ utilities: 5
246
246
  };
247
247
 
248
248
  // src/contexts/app-bar-size-context.tsx
@@ -556,7 +556,7 @@ function AngieGuideLocation() {
556
556
  ]
557
557
  }
558
558
  },
559
- /* @__PURE__ */ React16.createElement("span", null)
559
+ /* @__PURE__ */ React16.createElement("span", { style: { display: "contents" } })
560
560
  ));
561
561
  }
562
562
 
@@ -762,10 +762,10 @@ var { useMenuItems: useMenuItems4 } = utilitiesMenu;
762
762
  function UtilitiesMenuLocation() {
763
763
  const menuItems = useMenuItems4();
764
764
  const { utilities: maxToolbarActions } = useMaxToolbarActions();
765
- const shouldUsePopover = menuItems.default.length > maxToolbarActions + 1;
765
+ const shouldUsePopover = menuItems.default.length > maxToolbarActions;
766
766
  const toolbarMenuItems = shouldUsePopover ? menuItems.default.slice(0, maxToolbarActions) : menuItems.default;
767
767
  const popoverMenuItems = shouldUsePopover ? menuItems.default.slice(maxToolbarActions) : [];
768
- return /* @__PURE__ */ React22.createElement(ToolbarMenu, null, toolbarMenuItems.map(({ MenuItem: MenuItem2, id }) => /* @__PURE__ */ React22.createElement(import_react8.Fragment, { key: id }, /* @__PURE__ */ React22.createElement(MenuItem2, null))), popoverMenuItems.length > 0 && /* @__PURE__ */ React22.createElement(ToolbarMenuMore, { id: "elementor-editor-app-bar-utilities-more" }, popoverMenuItems.map(({ MenuItem: MenuItem2, id }) => /* @__PURE__ */ React22.createElement(MenuItem2, { key: id }))));
768
+ return /* @__PURE__ */ React22.createElement(ToolbarMenu, null, popoverMenuItems.length > 0 && /* @__PURE__ */ React22.createElement(ToolbarMenuMore, { id: "elementor-editor-app-bar-utilities-more" }, popoverMenuItems.map(({ MenuItem: MenuItem2, id }) => /* @__PURE__ */ React22.createElement(MenuItem2, { key: id }))), toolbarMenuItems.map(({ MenuItem: MenuItem2, id }) => /* @__PURE__ */ React22.createElement(import_react8.Fragment, { key: id }, /* @__PURE__ */ React22.createElement(MenuItem2, null))));
769
769
  }
770
770
 
771
771
  // src/components/app-bar.tsx
@@ -798,15 +798,44 @@ function AppBar() {
798
798
  }
799
799
 
800
800
  // src/extensions/angie/hooks/use-action-props.ts
801
- var import_react10 = require("react");
802
- var import_editor_mcp = require("@elementor/editor-mcp");
801
+ var import_react11 = require("react");
803
802
  var import_events3 = require("@elementor/events");
804
803
  var import_icons5 = require("@elementor/icons");
805
804
  var import_i18n7 = require("@wordpress/i18n");
805
+
806
+ // src/hooks/use-is-angie-available.ts
807
+ var import_react10 = require("react");
808
+ var import_editor_mcp = require("@elementor/editor-mcp");
809
+ function useIsAngieAvailable() {
810
+ const [available, setAvailable] = (0, import_react10.useState)(() => (0, import_editor_mcp.isAngieAvailable)());
811
+ (0, import_react10.useEffect)(() => {
812
+ if (available) {
813
+ return;
814
+ }
815
+ if ((0, import_editor_mcp.isAngieAvailable)()) {
816
+ setAvailable(true);
817
+ return;
818
+ }
819
+ const observer = new MutationObserver(() => {
820
+ if ((0, import_editor_mcp.isAngieAvailable)()) {
821
+ observer.disconnect();
822
+ setAvailable(true);
823
+ }
824
+ });
825
+ observer.observe(document.body, {
826
+ childList: true,
827
+ subtree: true
828
+ });
829
+ return () => observer.disconnect();
830
+ }, [available]);
831
+ return available;
832
+ }
833
+
834
+ // src/extensions/angie/hooks/use-action-props.ts
806
835
  function useActionProps() {
807
- const hasAngieInstalled = (0, import_editor_mcp.isAngieAvailable)();
836
+ const hasAngieInstalled = useIsAngieAvailable();
808
837
  const visible = !hasAngieInstalled;
809
- (0, import_react10.useEffect)(() => {
838
+ (0, import_react11.useEffect)(() => {
810
839
  if (!visible) {
811
840
  return;
812
841
  }
@@ -837,7 +866,7 @@ function init() {
837
866
  }
838
867
 
839
868
  // src/extensions/connect/hooks/use-connect-link-config.tsx
840
- var import_react11 = require("react");
869
+ var import_react12 = require("react");
841
870
  var import_icons6 = require("@elementor/icons");
842
871
  var import_i18n8 = require("@wordpress/i18n");
843
872
  var dispatchConnectClickEvent = (eventName) => {
@@ -867,7 +896,7 @@ function useConnectLinkConfig() {
867
896
  isUserConnected = extendedWindow?.elementorCommon?.config.library_connect.is_connected ?? false;
868
897
  target = "_self";
869
898
  }
870
- const handleConnectClick = (0, import_react11.useCallback)(
899
+ const handleConnectClick = (0, import_react12.useCallback)(
871
900
  (event) => {
872
901
  event.preventDefault();
873
902
  if (extendedWindow.jQuery && extendedWindow.jQuery.fn?.elementorConnect) {
@@ -1295,7 +1324,7 @@ function useActionProps3() {
1295
1324
  function init5() {
1296
1325
  toolsMenu.registerToggleAction({
1297
1326
  id: "document-settings-button",
1298
- priority: 3,
1327
+ priority: 5,
1299
1328
  useProps: useActionProps3
1300
1329
  });
1301
1330
  }
@@ -1309,6 +1338,7 @@ function useActionProps4() {
1309
1338
  return {
1310
1339
  title: (0, import_i18n16.__)("Add Element", "elementor"),
1311
1340
  icon: import_icons14.PlusIcon,
1341
+ id: "ele-add-element",
1312
1342
  onClick: () => {
1313
1343
  const extendedWindow = window;
1314
1344
  const config = extendedWindow?.elementorCommon?.eventsManager?.config;
@@ -1423,25 +1453,43 @@ function init8() {
1423
1453
  }
1424
1454
 
1425
1455
  // src/extensions/help/hooks/use-action-props.ts
1456
+ var import_editor_mcp2 = require("@elementor/editor-mcp");
1426
1457
  var import_icons17 = require("@elementor/icons");
1427
1458
  var import_i18n20 = require("@wordpress/i18n");
1459
+ var HELP_CENTER_URL = "https://go.elementor.com/editor-top-bar-learn/";
1460
+ var HELP_CENTER_ANGIE_PROMPT = `${(0, import_i18n20.__)("Help me with", "elementor")} `;
1461
+ var dispatchHelpClickEvent = () => {
1462
+ const extendedWindow = window;
1463
+ const config = extendedWindow?.elementorCommon?.eventsManager?.config;
1464
+ if (config) {
1465
+ extendedWindow.elementorCommon.eventsManager.dispatchEvent(config.names.topBar.help, {
1466
+ location: config.locations.topBar,
1467
+ secondaryLocation: config.secondaryLocations.help,
1468
+ trigger: config.triggers.click,
1469
+ element: config.elements.buttonIcon
1470
+ });
1471
+ }
1472
+ };
1428
1473
  function useActionProps6() {
1474
+ const hasAngieActive = (0, import_editor_mcp2.isAngieAvailable)();
1475
+ if (hasAngieActive) {
1476
+ return {
1477
+ title: (0, import_i18n20.__)("Help Center", "elementor"),
1478
+ icon: import_icons17.HelpIcon,
1479
+ onClick: (event) => {
1480
+ event.preventDefault();
1481
+ dispatchHelpClickEvent();
1482
+ (0, import_editor_mcp2.openAngieInAskMode)(HELP_CENTER_ANGIE_PROMPT);
1483
+ }
1484
+ };
1485
+ }
1429
1486
  return {
1430
1487
  title: (0, import_i18n20.__)("Help Center", "elementor"),
1431
- href: "https://go.elementor.com/editor-top-bar-learn/",
1488
+ href: HELP_CENTER_URL,
1432
1489
  icon: import_icons17.HelpIcon,
1433
1490
  target: "_blank",
1434
1491
  onClick: () => {
1435
- const extendedWindow = window;
1436
- const config = extendedWindow?.elementorCommon?.eventsManager?.config;
1437
- if (config) {
1438
- extendedWindow.elementorCommon.eventsManager.dispatchEvent(config.names.topBar.help, {
1439
- location: config.locations.topBar,
1440
- secondaryLocation: config.secondaryLocations.help,
1441
- trigger: config.triggers.click,
1442
- element: config.elements.buttonIcon
1443
- });
1444
- }
1492
+ dispatchHelpClickEvent();
1445
1493
  }
1446
1494
  };
1447
1495
  }
@@ -1487,7 +1535,7 @@ function useActionProps7() {
1487
1535
  function init10() {
1488
1536
  toolsMenu.registerToggleAction({
1489
1537
  id: "open-history",
1490
- priority: 15,
1538
+ priority: 3,
1491
1539
  useProps: useActionProps7
1492
1540
  });
1493
1541
  }