PluginProbe
Elementor Website Builder – more than just a page builder / 3.8.0-beta1
Elementor Website Builder – more than just a page builder v3.8.0-beta1
4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 All 457 releases
elementor / app / modules / onboarding / assets / js / components / go-pro-popover.js

go-pro-popover.js in Elementor Website Builder – more than just a page builder 3.8.0-beta1, at app/modules/onboarding/assets/js/components/go-pro-popover.js

103 lines 3.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { OnboardingContext } from '../context/context';
2
3 import PopoverDialog from 'elementor-app/ui/popover-dialog/popover-dialog';
4 import Checklist from './checklist';
5 import ChecklistItem from './checklist-item';
6 import Button from './button';
7 import { useCallback, useContext } from 'react';
8
9 export default function GoProPopover( props ) {
10 const { state, updateState } = useContext( OnboardingContext );
11
12 // Handle the Pro Upload popup window.
13 const alreadyHaveProButtonRef = useCallback( ( alreadyHaveProButton ) => {
14 if ( ! alreadyHaveProButton ) {
15 return;
16 }
17
18 alreadyHaveProButton.addEventListener( 'click', ( event ) => {
19 event.preventDefault();
20
21 elementorCommon.events.dispatchEvent( {
22 event: 'already have pro',
23 version: '',
24 details: {
25 placement: elementorAppConfig.onboarding.eventPlacement,
26 step: state.currentStep,
27 },
28 } );
29
30 // Open the Pro Upload screen in a popup.
31 window.open(
32 alreadyHaveProButton.href + '&mode=popup',
33 'elementorUploadPro',
34 `toolbar=no, menubar=no, width=728, height=531, top=100, left=100`,
35 );
36
37 // Run the callback for when the upload succeeds.
38 elementorCommon.elements.$body
39 .on( 'elementor/upload-and-install-pro/success', () => {
40 updateState( {
41 hasPro: true,
42 proNotice: {
43 type: 'success',
44 icon: 'eicon-check-circle-o',
45 message: __( 'Elementor Pro has been successfully installed.', 'elementor' ),
46 },
47 } );
48 } );
49 } );
50 }, [] );
51
52 // The buttonsConfig prop is an array of objects. To find the 'Go Pro' button, we need to iterate over the object.
53 const goProButton = props.buttonsConfig.find( ( button ) => 'go-pro' === button.id ),
54 getElProButton = {
55 text: __( 'Upgrade Now', 'elementor' ),
56 className: 'e-onboarding__go-pro-cta',
57 target: '_blank',
58 href: 'https://elementor.com/pro/?utm_source=onboarding-wizard&utm_campaign=gopro&utm_medium=wp-dash&utm_content=top-bar-dropdown&utm_term=' + elementorAppConfig.onboarding.onboardingVersion,
59 tabIndex: 0,
60 onClick: () => {
61 elementorCommon.events.dispatchEvent( {
62 event: 'get elementor pro',
63 version: '',
64 details: {
65 placement: elementorAppConfig.onboarding.eventPlacement,
66 step: state.currentStep,
67 },
68 } );
69 },
70 };
71
72 return (
73 <PopoverDialog
74 targetRef={ goProButton.elRef }
75 wrapperClass="e-onboarding__go-pro"
76 >
77 <div className="e-onboarding__go-pro-content">
78 <h2 className="e-onboarding__go-pro-title">{ __( 'Ready to Go Pro?', 'elementor' ) }</h2>
79 <Checklist>
80 <ChecklistItem>{ __( '90+ Basic & Pro widgets', 'elementor' ) }</ChecklistItem>
81 <ChecklistItem>{ __( '300+ Basic & Pro templates', 'elementor' ) }</ChecklistItem>
82 <ChecklistItem>{ __( 'Premium Support', 'elementor' ) }</ChecklistItem>
83 </Checklist>
84 <div className="e-onboarding__go-pro-paragraph">
85 { __( 'And so much more!', 'elementor' ) }
86 </div>
87 <div className="e-onboarding__go-pro-paragraph">
88 <Button buttonSettings={ getElProButton } />
89 </div>
90 <div className="e-onboarding__go-pro-paragraph">
91 <a tabIndex="0" className="e-onboarding__go-pro-already-have" ref={ alreadyHaveProButtonRef } href={ elementorAppConfig.onboarding.urls.uploadPro } rel="opener">
92 { __( 'Already have Elementor Pro?', 'elementor' ) }
93 </a>
94 </div>
95 </div>
96 </PopoverDialog>
97 );
98 }
99
100 GoProPopover.propTypes = {
101 buttonsConfig: PropTypes.array.isRequired,
102 };
103