@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.mjs
CHANGED
|
@@ -766,15 +766,44 @@ function AppBar() {
|
|
|
766
766
|
}
|
|
767
767
|
|
|
768
768
|
// src/extensions/angie/hooks/use-action-props.ts
|
|
769
|
-
import { useEffect as
|
|
770
|
-
import { isAngieAvailable } from "@elementor/editor-mcp";
|
|
769
|
+
import { useEffect as useEffect6 } from "react";
|
|
771
770
|
import { trackEvent } from "@elementor/events";
|
|
772
771
|
import { AngieIcon } from "@elementor/icons";
|
|
773
772
|
import { __ as __7 } from "@wordpress/i18n";
|
|
773
|
+
|
|
774
|
+
// src/hooks/use-is-angie-available.ts
|
|
775
|
+
import { useEffect as useEffect5, useState as useState5 } from "react";
|
|
776
|
+
import { isAngieAvailable } from "@elementor/editor-mcp";
|
|
777
|
+
function useIsAngieAvailable() {
|
|
778
|
+
const [available, setAvailable] = useState5(() => isAngieAvailable());
|
|
779
|
+
useEffect5(() => {
|
|
780
|
+
if (available) {
|
|
781
|
+
return;
|
|
782
|
+
}
|
|
783
|
+
if (isAngieAvailable()) {
|
|
784
|
+
setAvailable(true);
|
|
785
|
+
return;
|
|
786
|
+
}
|
|
787
|
+
const observer = new MutationObserver(() => {
|
|
788
|
+
if (isAngieAvailable()) {
|
|
789
|
+
observer.disconnect();
|
|
790
|
+
setAvailable(true);
|
|
791
|
+
}
|
|
792
|
+
});
|
|
793
|
+
observer.observe(document.body, {
|
|
794
|
+
childList: true,
|
|
795
|
+
subtree: true
|
|
796
|
+
});
|
|
797
|
+
return () => observer.disconnect();
|
|
798
|
+
}, [available]);
|
|
799
|
+
return available;
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
// src/extensions/angie/hooks/use-action-props.ts
|
|
774
803
|
function useActionProps() {
|
|
775
|
-
const hasAngieInstalled =
|
|
804
|
+
const hasAngieInstalled = useIsAngieAvailable();
|
|
776
805
|
const visible = !hasAngieInstalled;
|
|
777
|
-
|
|
806
|
+
useEffect6(() => {
|
|
778
807
|
if (!visible) {
|
|
779
808
|
return;
|
|
780
809
|
}
|
|
@@ -1424,25 +1453,43 @@ function init8() {
|
|
|
1424
1453
|
}
|
|
1425
1454
|
|
|
1426
1455
|
// src/extensions/help/hooks/use-action-props.ts
|
|
1456
|
+
import { isAngieAvailable as isAngieAvailable2, openAngieInAskMode } from "@elementor/editor-mcp";
|
|
1427
1457
|
import { HelpIcon } from "@elementor/icons";
|
|
1428
1458
|
import { __ as __20 } from "@wordpress/i18n";
|
|
1459
|
+
var HELP_CENTER_URL = "https://go.elementor.com/editor-top-bar-learn/";
|
|
1460
|
+
var HELP_CENTER_ANGIE_PROMPT = `${__20("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 = isAngieAvailable2();
|
|
1475
|
+
if (hasAngieActive) {
|
|
1476
|
+
return {
|
|
1477
|
+
title: __20("Help Center", "elementor"),
|
|
1478
|
+
icon: HelpIcon,
|
|
1479
|
+
onClick: (event) => {
|
|
1480
|
+
event.preventDefault();
|
|
1481
|
+
dispatchHelpClickEvent();
|
|
1482
|
+
openAngieInAskMode(HELP_CENTER_ANGIE_PROMPT);
|
|
1483
|
+
}
|
|
1484
|
+
};
|
|
1485
|
+
}
|
|
1430
1486
|
return {
|
|
1431
1487
|
title: __20("Help Center", "elementor"),
|
|
1432
|
-
href:
|
|
1488
|
+
href: HELP_CENTER_URL,
|
|
1433
1489
|
icon: 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
|
}
|