@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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-app-bar",
|
|
3
3
|
"description": "App Bar extension for @elementor/editor",
|
|
4
|
-
"version": "4.1.0-
|
|
4
|
+
"version": "4.1.0-beta2",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Elementor Team",
|
|
7
7
|
"homepage": "https://elementor.com/",
|
|
@@ -40,17 +40,18 @@
|
|
|
40
40
|
"dev": "tsup --config=../../tsup.dev.ts"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@elementor/editor-
|
|
44
|
-
"@elementor/
|
|
45
|
-
"@elementor/
|
|
46
|
-
"@elementor/editor
|
|
47
|
-
"@elementor/editor-
|
|
48
|
-
"@elementor/editor-
|
|
49
|
-
"@elementor/editor-
|
|
43
|
+
"@elementor/editor-current-user": "4.1.0-beta2",
|
|
44
|
+
"@elementor/editor-ui": "4.1.0-beta2",
|
|
45
|
+
"@elementor/http-client": "4.1.0-beta2",
|
|
46
|
+
"@elementor/editor": "4.1.0-beta2",
|
|
47
|
+
"@elementor/editor-documents": "4.1.0-beta2",
|
|
48
|
+
"@elementor/editor-mcp": "4.1.0-beta2",
|
|
49
|
+
"@elementor/editor-responsive": "4.1.0-beta2",
|
|
50
|
+
"@elementor/editor-v1-adapters": "4.1.0-beta2",
|
|
50
51
|
"@elementor/icons": "~1.75.1",
|
|
51
|
-
"@elementor/locations": "4.1.0-
|
|
52
|
-
"@elementor/menus": "4.1.0-
|
|
53
|
-
"@elementor/events": "4.1.0-
|
|
52
|
+
"@elementor/locations": "4.1.0-beta2",
|
|
53
|
+
"@elementor/menus": "4.1.0-beta2",
|
|
54
|
+
"@elementor/events": "4.1.0-beta2",
|
|
54
55
|
"@elementor/ui": "1.37.5",
|
|
55
56
|
"@wordpress/i18n": "^5.13.0"
|
|
56
57
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
import AngieGuideLocation from '../../extensions/angie/components/angie-guide-location';
|
|
3
|
+
import { AngieGuideLocation } from '../../extensions/angie/components/angie-guide-location';
|
|
4
4
|
import { toolsMenu } from '../../locations';
|
|
5
5
|
import ToolbarMenu from '../ui/toolbar-menu';
|
|
6
6
|
import ToolbarMenuMore from '../ui/toolbar-menu-more';
|
|
@@ -6,11 +6,11 @@ type Props = {
|
|
|
6
6
|
imageUrl: string;
|
|
7
7
|
description: string;
|
|
8
8
|
learnMoreUrl: string;
|
|
9
|
-
onInstall
|
|
9
|
+
onInstall?: () => void;
|
|
10
10
|
onClose: () => void;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
export
|
|
13
|
+
export function AngieGuideCard( { imageUrl, description, learnMoreUrl, onInstall, onClose }: Props ) {
|
|
14
14
|
return (
|
|
15
15
|
<ClickAwayListener onClickAway={ onClose }>
|
|
16
16
|
<Stack sx={ { width: 296 } } data-testid="e-angie-guide-card">
|
|
@@ -42,9 +42,11 @@ export default function AngieGuideCard( { imageUrl, description, learnMoreUrl, o
|
|
|
42
42
|
>
|
|
43
43
|
{ __( 'Learn More', 'elementor' ) }
|
|
44
44
|
</Button>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
{ onInstall && (
|
|
46
|
+
<Button variant="contained" size="small" color="accent" onClick={ onInstall }>
|
|
47
|
+
{ __( 'Try for free', 'elementor' ) }
|
|
48
|
+
</Button>
|
|
49
|
+
) }
|
|
48
50
|
</Stack>
|
|
49
51
|
</Stack>
|
|
50
52
|
</ClickAwayListener>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
|
+
import { useCurrentUserCapabilities } from '@elementor/editor-current-user';
|
|
3
4
|
import { ThemeProvider } from '@elementor/editor-ui';
|
|
4
5
|
import { useMixpanel } from '@elementor/events';
|
|
5
6
|
import { Infotip } from '@elementor/ui';
|
|
@@ -13,11 +14,14 @@ import {
|
|
|
13
14
|
ANGIE_TOP_BAR_PROMOTION_IMAGE_URL,
|
|
14
15
|
CREATE_WIDGET_EVENT,
|
|
15
16
|
} from '../angie-consts';
|
|
16
|
-
import AngieGuideCard from '../components/angie-guide-card';
|
|
17
|
+
import { AngieGuideCard } from '../components/angie-guide-card';
|
|
18
|
+
import { useAutoShow } from '../hooks/use-auto-show';
|
|
17
19
|
|
|
18
|
-
export
|
|
20
|
+
export function AngieGuideLocation() {
|
|
21
|
+
useAutoShow();
|
|
19
22
|
const [ anchorEl, setAnchorEl ] = useState< Element | null >( null );
|
|
20
23
|
const { dispatchEvent } = useMixpanel();
|
|
24
|
+
const { isAdmin } = useCurrentUserCapabilities();
|
|
21
25
|
|
|
22
26
|
const isOpen = Boolean( anchorEl );
|
|
23
27
|
|
|
@@ -63,7 +67,7 @@ export default function AngieGuideLocation() {
|
|
|
63
67
|
imageUrl={ ANGIE_TOP_BAR_PROMOTION_IMAGE_URL }
|
|
64
68
|
description={ ANGIE_TOP_BAR_DESCRIPTION }
|
|
65
69
|
learnMoreUrl={ ANGIE_LEARN_MORE_URL }
|
|
66
|
-
onInstall={ handleInstall }
|
|
70
|
+
onInstall={ isAdmin ? handleInstall : undefined }
|
|
67
71
|
onClose={ handleClose }
|
|
68
72
|
/>
|
|
69
73
|
}
|
|
@@ -6,7 +6,7 @@ import { __ } from '@wordpress/i18n';
|
|
|
6
6
|
|
|
7
7
|
import { AI_WIDGET_CTA_VIEWED_EVENT, ANGIE_GUIDE_TOGGLE_EVENT } from '../angie-consts';
|
|
8
8
|
|
|
9
|
-
export
|
|
9
|
+
export function useActionProps() {
|
|
10
10
|
const hasAngieInstalled = isAngieAvailable();
|
|
11
11
|
const visible = ! hasAngieInstalled;
|
|
12
12
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
import { ANGIE_GUIDE_TOGGLE_EVENT } from '../angie-consts';
|
|
4
|
+
|
|
5
|
+
export function useAutoShow() {
|
|
6
|
+
useEffect( () => {
|
|
7
|
+
if ( ! window.elementor?.config?.angie?.autoShow ) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const id = setTimeout( () => {
|
|
12
|
+
window.dispatchEvent( new CustomEvent( ANGIE_GUIDE_TOGGLE_EVENT ) );
|
|
13
|
+
}, 0 );
|
|
14
|
+
|
|
15
|
+
return () => clearTimeout( id );
|
|
16
|
+
}, [] );
|
|
17
|
+
}
|