@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.mjs
CHANGED
|
@@ -333,7 +333,8 @@ import * as React20 from "react";
|
|
|
333
333
|
|
|
334
334
|
// src/extensions/angie/components/angie-guide-location.tsx
|
|
335
335
|
import * as React15 from "react";
|
|
336
|
-
import { useEffect, useState as useState2 } from "react";
|
|
336
|
+
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
337
|
+
import { useCurrentUserCapabilities } from "@elementor/editor-current-user";
|
|
337
338
|
import { ThemeProvider } from "@elementor/editor-ui";
|
|
338
339
|
import { useMixpanel } from "@elementor/events";
|
|
339
340
|
import { Infotip } from "@elementor/ui";
|
|
@@ -377,15 +378,31 @@ function AngieGuideCard({ imageUrl, description, learnMoreUrl, onInstall, onClos
|
|
|
377
378
|
}
|
|
378
379
|
},
|
|
379
380
|
__3("Learn More", "elementor")
|
|
380
|
-
), /* @__PURE__ */ React14.createElement(Button, { variant: "contained", size: "small", color: "accent", onClick: onInstall }, __3("Try for free", "elementor")))));
|
|
381
|
+
), onInstall && /* @__PURE__ */ React14.createElement(Button, { variant: "contained", size: "small", color: "accent", onClick: onInstall }, __3("Try for free", "elementor")))));
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
// src/extensions/angie/hooks/use-auto-show.ts
|
|
385
|
+
import { useEffect } from "react";
|
|
386
|
+
function useAutoShow() {
|
|
387
|
+
useEffect(() => {
|
|
388
|
+
if (!window.elementor?.config?.angie?.autoShow) {
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
const id = setTimeout(() => {
|
|
392
|
+
window.dispatchEvent(new CustomEvent(ANGIE_GUIDE_TOGGLE_EVENT));
|
|
393
|
+
}, 0);
|
|
394
|
+
return () => clearTimeout(id);
|
|
395
|
+
}, []);
|
|
381
396
|
}
|
|
382
397
|
|
|
383
398
|
// src/extensions/angie/components/angie-guide-location.tsx
|
|
384
399
|
function AngieGuideLocation() {
|
|
400
|
+
useAutoShow();
|
|
385
401
|
const [anchorEl, setAnchorEl] = useState2(null);
|
|
386
402
|
const { dispatchEvent: dispatchEvent2 } = useMixpanel();
|
|
403
|
+
const { isAdmin } = useCurrentUserCapabilities();
|
|
387
404
|
const isOpen = Boolean(anchorEl);
|
|
388
|
-
|
|
405
|
+
useEffect2(() => {
|
|
389
406
|
const handleToggle = () => {
|
|
390
407
|
setAnchorEl((prev) => {
|
|
391
408
|
if (prev) {
|
|
@@ -422,7 +439,7 @@ function AngieGuideLocation() {
|
|
|
422
439
|
imageUrl: ANGIE_TOP_BAR_PROMOTION_IMAGE_URL,
|
|
423
440
|
description: ANGIE_TOP_BAR_DESCRIPTION,
|
|
424
441
|
learnMoreUrl: ANGIE_LEARN_MORE_URL,
|
|
425
|
-
onInstall: handleInstall,
|
|
442
|
+
onInstall: isAdmin ? handleInstall : void 0,
|
|
426
443
|
onClose: handleClose
|
|
427
444
|
}
|
|
428
445
|
),
|
|
@@ -492,7 +509,7 @@ function IntegrationsMenuLocation() {
|
|
|
492
509
|
|
|
493
510
|
// src/components/locations/send-feedback-popup-location.tsx
|
|
494
511
|
import * as React19 from "react";
|
|
495
|
-
import { useEffect as
|
|
512
|
+
import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
496
513
|
import { ThemeProvider as ThemeProvider2 } from "@elementor/editor-ui";
|
|
497
514
|
import { isExperimentActive } from "@elementor/editor-v1-adapters";
|
|
498
515
|
import { useMixpanel as useMixpanel2 } from "@elementor/events";
|
|
@@ -536,7 +553,7 @@ function SendFeedbackPopupLocation() {
|
|
|
536
553
|
popupId: FEEDBACK_TOGGLE_EVENT
|
|
537
554
|
});
|
|
538
555
|
const [isFetching, setIsFetching] = useState3(false);
|
|
539
|
-
|
|
556
|
+
useEffect3(() => {
|
|
540
557
|
const handler = () => {
|
|
541
558
|
popupState.toggle();
|
|
542
559
|
setIsUserConnected(checkIfUserIsConnected());
|
|
@@ -551,7 +568,7 @@ function SendFeedbackPopupLocation() {
|
|
|
551
568
|
window.removeEventListener(FEEDBACK_TOGGLE_EVENT, handler);
|
|
552
569
|
};
|
|
553
570
|
}, [popupState, trackEvent2]);
|
|
554
|
-
|
|
571
|
+
useEffect3(() => {
|
|
555
572
|
setSubmitDisabled(feedbackContent.trim().length < 10 || !isUserConnected || isFetching);
|
|
556
573
|
}, [feedbackContent, feedbackResult, isUserConnected, isFetching]);
|
|
557
574
|
const handleClose = () => {
|
|
@@ -670,7 +687,7 @@ function AppBar() {
|
|
|
670
687
|
}
|
|
671
688
|
|
|
672
689
|
// src/extensions/angie/hooks/use-action-props.ts
|
|
673
|
-
import { useEffect as
|
|
690
|
+
import { useEffect as useEffect4 } from "react";
|
|
674
691
|
import { isAngieAvailable } from "@elementor/editor-mcp";
|
|
675
692
|
import { trackEvent } from "@elementor/events";
|
|
676
693
|
import { AngieIcon } from "@elementor/icons";
|
|
@@ -678,7 +695,7 @@ import { __ as __7 } from "@wordpress/i18n";
|
|
|
678
695
|
function useActionProps() {
|
|
679
696
|
const hasAngieInstalled = isAngieAvailable();
|
|
680
697
|
const visible = !hasAngieInstalled;
|
|
681
|
-
|
|
698
|
+
useEffect4(() => {
|
|
682
699
|
if (!visible) {
|
|
683
700
|
return;
|
|
684
701
|
}
|