@elementor/editor-app-bar 4.4.0-1065 → 4.4.0-1067
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 +64 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +62 -15
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -12
- package/src/extensions/angie/hooks/use-action-props.ts +2 -2
- package/src/extensions/help/hooks/use-action-props.ts +34 -12
- package/src/hooks/use-is-angie-available.ts +33 -0
package/dist/index.js
CHANGED
|
@@ -798,15 +798,44 @@ function AppBar() {
|
|
|
798
798
|
}
|
|
799
799
|
|
|
800
800
|
// src/extensions/angie/hooks/use-action-props.ts
|
|
801
|
-
var
|
|
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 = (
|
|
836
|
+
const hasAngieInstalled = useIsAngieAvailable();
|
|
808
837
|
const visible = !hasAngieInstalled;
|
|
809
|
-
(0,
|
|
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
|
|
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,
|
|
899
|
+
const handleConnectClick = (0, import_react12.useCallback)(
|
|
871
900
|
(event) => {
|
|
872
901
|
event.preventDefault();
|
|
873
902
|
if (extendedWindow.jQuery && extendedWindow.jQuery.fn?.elementorConnect) {
|
|
@@ -1424,25 +1453,43 @@ function init8() {
|
|
|
1424
1453
|
}
|
|
1425
1454
|
|
|
1426
1455
|
// src/extensions/help/hooks/use-action-props.ts
|
|
1456
|
+
var import_editor_mcp2 = require("@elementor/editor-mcp");
|
|
1427
1457
|
var import_icons17 = require("@elementor/icons");
|
|
1428
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
|
+
};
|
|
1429
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
|
+
}
|
|
1430
1486
|
return {
|
|
1431
1487
|
title: (0, import_i18n20.__)("Help Center", "elementor"),
|
|
1432
|
-
href:
|
|
1488
|
+
href: HELP_CENTER_URL,
|
|
1433
1489
|
icon: import_icons17.HelpIcon,
|
|
1434
1490
|
target: "_blank",
|
|
1435
1491
|
onClick: () => {
|
|
1436
|
-
|
|
1437
|
-
const config = extendedWindow?.elementorCommon?.eventsManager?.config;
|
|
1438
|
-
if (config) {
|
|
1439
|
-
extendedWindow.elementorCommon.eventsManager.dispatchEvent(config.names.topBar.help, {
|
|
1440
|
-
location: config.locations.topBar,
|
|
1441
|
-
secondaryLocation: config.secondaryLocations.help,
|
|
1442
|
-
trigger: config.triggers.click,
|
|
1443
|
-
element: config.elements.buttonIcon
|
|
1444
|
-
});
|
|
1445
|
-
}
|
|
1492
|
+
dispatchHelpClickEvent();
|
|
1446
1493
|
}
|
|
1447
1494
|
};
|
|
1448
1495
|
}
|