@elementor/editor-app-bar 4.1.0-beta1 → 4.1.0-beta2
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 +36 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -11
- package/src/components/locations/tools-menu-location.tsx +1 -1
- package/src/extensions/angie/components/angie-guide-card.tsx +7 -5
- package/src/extensions/angie/components/angie-guide-location.tsx +7 -3
- package/src/extensions/angie/hooks/use-action-props.ts +1 -1
- package/src/extensions/angie/hooks/use-auto-show.ts +17 -0
- package/src/extensions/angie/index.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -377,7 +377,8 @@ var React20 = __toESM(require("react"));
|
|
|
377
377
|
|
|
378
378
|
// src/extensions/angie/components/angie-guide-location.tsx
|
|
379
379
|
var React15 = __toESM(require("react"));
|
|
380
|
-
var
|
|
380
|
+
var import_react4 = require("react");
|
|
381
|
+
var import_editor_current_user = require("@elementor/editor-current-user");
|
|
381
382
|
var import_editor_ui = require("@elementor/editor-ui");
|
|
382
383
|
var import_events = require("@elementor/events");
|
|
383
384
|
var import_ui8 = require("@elementor/ui");
|
|
@@ -421,15 +422,31 @@ function AngieGuideCard({ imageUrl, description, learnMoreUrl, onInstall, onClos
|
|
|
421
422
|
}
|
|
422
423
|
},
|
|
423
424
|
(0, import_i18n3.__)("Learn More", "elementor")
|
|
424
|
-
), /* @__PURE__ */ React14.createElement(import_ui7.Button, { variant: "contained", size: "small", color: "accent", onClick: onInstall }, (0, import_i18n3.__)("Try for free", "elementor")))));
|
|
425
|
+
), onInstall && /* @__PURE__ */ React14.createElement(import_ui7.Button, { variant: "contained", size: "small", color: "accent", onClick: onInstall }, (0, import_i18n3.__)("Try for free", "elementor")))));
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
// src/extensions/angie/hooks/use-auto-show.ts
|
|
429
|
+
var import_react3 = require("react");
|
|
430
|
+
function useAutoShow() {
|
|
431
|
+
(0, import_react3.useEffect)(() => {
|
|
432
|
+
if (!window.elementor?.config?.angie?.autoShow) {
|
|
433
|
+
return;
|
|
434
|
+
}
|
|
435
|
+
const id = setTimeout(() => {
|
|
436
|
+
window.dispatchEvent(new CustomEvent(ANGIE_GUIDE_TOGGLE_EVENT));
|
|
437
|
+
}, 0);
|
|
438
|
+
return () => clearTimeout(id);
|
|
439
|
+
}, []);
|
|
425
440
|
}
|
|
426
441
|
|
|
427
442
|
// src/extensions/angie/components/angie-guide-location.tsx
|
|
428
443
|
function AngieGuideLocation() {
|
|
429
|
-
|
|
444
|
+
useAutoShow();
|
|
445
|
+
const [anchorEl, setAnchorEl] = (0, import_react4.useState)(null);
|
|
430
446
|
const { dispatchEvent: dispatchEvent2 } = (0, import_events.useMixpanel)();
|
|
447
|
+
const { isAdmin } = (0, import_editor_current_user.useCurrentUserCapabilities)();
|
|
431
448
|
const isOpen = Boolean(anchorEl);
|
|
432
|
-
(0,
|
|
449
|
+
(0, import_react4.useEffect)(() => {
|
|
433
450
|
const handleToggle = () => {
|
|
434
451
|
setAnchorEl((prev) => {
|
|
435
452
|
if (prev) {
|
|
@@ -466,7 +483,7 @@ function AngieGuideLocation() {
|
|
|
466
483
|
imageUrl: ANGIE_TOP_BAR_PROMOTION_IMAGE_URL,
|
|
467
484
|
description: ANGIE_TOP_BAR_DESCRIPTION,
|
|
468
485
|
learnMoreUrl: ANGIE_LEARN_MORE_URL,
|
|
469
|
-
onInstall: handleInstall,
|
|
486
|
+
onInstall: isAdmin ? handleInstall : void 0,
|
|
470
487
|
onClose: handleClose
|
|
471
488
|
}
|
|
472
489
|
),
|
|
@@ -536,7 +553,7 @@ function IntegrationsMenuLocation() {
|
|
|
536
553
|
|
|
537
554
|
// src/components/locations/send-feedback-popup-location.tsx
|
|
538
555
|
var React19 = __toESM(require("react"));
|
|
539
|
-
var
|
|
556
|
+
var import_react5 = require("react");
|
|
540
557
|
var import_editor_ui2 = require("@elementor/editor-ui");
|
|
541
558
|
var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
|
|
542
559
|
var import_events2 = require("@elementor/events");
|
|
@@ -557,18 +574,18 @@ var checkIfUserIsConnected = () => {
|
|
|
557
574
|
function SendFeedbackPopupLocation() {
|
|
558
575
|
const isActive = (0, import_editor_v1_adapters.isExperimentActive)(EXPERIMENT_NAME);
|
|
559
576
|
const extendedWindow = window;
|
|
560
|
-
const [isUserConnected, setIsUserConnected] = (0,
|
|
577
|
+
const [isUserConnected, setIsUserConnected] = (0, import_react5.useState)(checkIfUserIsConnected());
|
|
561
578
|
const connectUrl = extendedWindow?.elementor?.config.user.top_bar.connect_url;
|
|
562
|
-
const [feedbackContent, setFeedbackContent] = (0,
|
|
563
|
-
const [feedbackResult, setFeedbackResult] = (0,
|
|
564
|
-
const [submitDisabled, setSubmitDisabled] = (0,
|
|
579
|
+
const [feedbackContent, setFeedbackContent] = (0, import_react5.useState)("");
|
|
580
|
+
const [feedbackResult, setFeedbackResult] = (0, import_react5.useState)(null);
|
|
581
|
+
const [submitDisabled, setSubmitDisabled] = (0, import_react5.useState)(true);
|
|
565
582
|
const { dispatchEvent: trackEvent2 = (...args) => void args } = (0, import_events2.useMixpanel)();
|
|
566
583
|
const popupState = (0, import_ui12.usePopupState)({
|
|
567
584
|
variant: "dialog",
|
|
568
585
|
popupId: FEEDBACK_TOGGLE_EVENT
|
|
569
586
|
});
|
|
570
|
-
const [isFetching, setIsFetching] = (0,
|
|
571
|
-
(0,
|
|
587
|
+
const [isFetching, setIsFetching] = (0, import_react5.useState)(false);
|
|
588
|
+
(0, import_react5.useEffect)(() => {
|
|
572
589
|
const handler = () => {
|
|
573
590
|
popupState.toggle();
|
|
574
591
|
setIsUserConnected(checkIfUserIsConnected());
|
|
@@ -583,7 +600,7 @@ function SendFeedbackPopupLocation() {
|
|
|
583
600
|
window.removeEventListener(FEEDBACK_TOGGLE_EVENT, handler);
|
|
584
601
|
};
|
|
585
602
|
}, [popupState, trackEvent2]);
|
|
586
|
-
(0,
|
|
603
|
+
(0, import_react5.useEffect)(() => {
|
|
587
604
|
setSubmitDisabled(feedbackContent.trim().length < 10 || !isUserConnected || isFetching);
|
|
588
605
|
}, [feedbackContent, feedbackResult, isUserConnected, isFetching]);
|
|
589
606
|
const handleClose = () => {
|
|
@@ -684,7 +701,7 @@ function ToolsMenuLocation() {
|
|
|
684
701
|
|
|
685
702
|
// src/components/locations/utilities-menu-location.tsx
|
|
686
703
|
var React21 = __toESM(require("react"));
|
|
687
|
-
var
|
|
704
|
+
var import_react6 = require("react");
|
|
688
705
|
var MAX_TOOLBAR_ACTIONS2 = 4;
|
|
689
706
|
var { useMenuItems: useMenuItems4 } = utilitiesMenu;
|
|
690
707
|
function UtilitiesMenuLocation() {
|
|
@@ -692,7 +709,7 @@ function UtilitiesMenuLocation() {
|
|
|
692
709
|
const shouldUsePopover = menuItems.default.length > MAX_TOOLBAR_ACTIONS2 + 1;
|
|
693
710
|
const toolbarMenuItems = shouldUsePopover ? menuItems.default.slice(0, MAX_TOOLBAR_ACTIONS2) : menuItems.default;
|
|
694
711
|
const popoverMenuItems = shouldUsePopover ? menuItems.default.slice(MAX_TOOLBAR_ACTIONS2) : [];
|
|
695
|
-
return /* @__PURE__ */ React21.createElement(ToolbarMenu, null, toolbarMenuItems.map(({ MenuItem: MenuItem2, id }) => /* @__PURE__ */ React21.createElement(
|
|
712
|
+
return /* @__PURE__ */ React21.createElement(ToolbarMenu, null, toolbarMenuItems.map(({ MenuItem: MenuItem2, id }) => /* @__PURE__ */ React21.createElement(import_react6.Fragment, { key: id }, /* @__PURE__ */ React21.createElement(MenuItem2, null))), popoverMenuItems.length > 0 && /* @__PURE__ */ React21.createElement(ToolbarMenuMore, { id: "elementor-editor-app-bar-utilities-more" }, popoverMenuItems.map(({ MenuItem: MenuItem2, id }) => /* @__PURE__ */ React21.createElement(MenuItem2, { key: id }))));
|
|
696
713
|
}
|
|
697
714
|
|
|
698
715
|
// src/components/app-bar.tsx
|
|
@@ -702,7 +719,7 @@ function AppBar() {
|
|
|
702
719
|
}
|
|
703
720
|
|
|
704
721
|
// src/extensions/angie/hooks/use-action-props.ts
|
|
705
|
-
var
|
|
722
|
+
var import_react7 = require("react");
|
|
706
723
|
var import_editor_mcp = require("@elementor/editor-mcp");
|
|
707
724
|
var import_events3 = require("@elementor/events");
|
|
708
725
|
var import_icons5 = require("@elementor/icons");
|
|
@@ -710,7 +727,7 @@ var import_i18n7 = require("@wordpress/i18n");
|
|
|
710
727
|
function useActionProps() {
|
|
711
728
|
const hasAngieInstalled = (0, import_editor_mcp.isAngieAvailable)();
|
|
712
729
|
const visible = !hasAngieInstalled;
|
|
713
|
-
(0,
|
|
730
|
+
(0, import_react7.useEffect)(() => {
|
|
714
731
|
if (!visible) {
|
|
715
732
|
return;
|
|
716
733
|
}
|
|
@@ -741,7 +758,7 @@ function init() {
|
|
|
741
758
|
}
|
|
742
759
|
|
|
743
760
|
// src/extensions/connect/hooks/use-connect-link-config.tsx
|
|
744
|
-
var
|
|
761
|
+
var import_react8 = require("react");
|
|
745
762
|
var import_icons6 = require("@elementor/icons");
|
|
746
763
|
var import_i18n8 = require("@wordpress/i18n");
|
|
747
764
|
var dispatchConnectClickEvent = (eventName) => {
|
|
@@ -771,7 +788,7 @@ function useConnectLinkConfig() {
|
|
|
771
788
|
isUserConnected = extendedWindow?.elementorCommon?.config.library_connect.is_connected ?? false;
|
|
772
789
|
target = "_self";
|
|
773
790
|
}
|
|
774
|
-
const handleConnectClick = (0,
|
|
791
|
+
const handleConnectClick = (0, import_react8.useCallback)(
|
|
775
792
|
(event) => {
|
|
776
793
|
event.preventDefault();
|
|
777
794
|
if (extendedWindow.jQuery && extendedWindow.jQuery.fn?.elementorConnect) {
|