-
Notifications
You must be signed in to change notification settings - Fork 882
/
ElementorFill.js
145 lines (139 loc) · 5.92 KB
/
ElementorFill.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
// External dependencies.
import { Fill } from "@wordpress/components";
import { Fragment, useEffect } from "@wordpress/element";
import { __ } from "@wordpress/i18n";
import { get } from "lodash";
import PropTypes from "prop-types";
import { InternalLinkingSuggestionsUpsell } from "../../../components/modals/InternalLinkingSuggestionsUpsell";
// Internal dependencies.
import CollapsibleCornerstone from "../../../containers/CollapsibleCornerstone";
import { useFirstEligibleNotification } from "../../../hooks/use-first-eligible-notification";
import InsightsModal from "../../../insights/components/insights-modal";
import Alert from "../../containers/Alert";
import { KeywordInput, ReadabilityAnalysis, SeoAnalysis, InclusiveLanguageAnalysis } from "@yoast/externals/components";
import SidebarItem from "../../../components/SidebarItem";
import SearchAppearanceModal from "../../../components/modals/editorModals/SearchAppearanceModal";
import SocialAppearanceModal from "../../../components/modals/editorModals/SocialAppearanceModal";
import PremiumSEOAnalysisModal from "../../../components/modals/PremiumSEOAnalysisModal";
import SidebarCollapsible from "../../../components/SidebarCollapsible";
import SchemaTabContainer from "../../../containers/SchemaTab";
import AdvancedSettings from "../../../containers/AdvancedSettings";
import SEMrushRelatedKeyphrases from "../../../containers/SEMrushRelatedKeyphrases";
import WincherSEOPerformanceModal from "../../../containers/WincherSEOPerformanceModal";
import { isWordProofIntegrationActive } from "../../../helpers/wordproof";
import WordProofAuthenticationModals from "../../../components/modals/WordProofAuthenticationModals";
import KeywordUpsell from "../../../components/modals/KeywordUpsell";
import { ErrorBoundary } from "@yoast/ui-library";
import { ElementorErrorFallback } from "../elementor-error-fallback";
/* eslint-disable complexity */
/**
* Creates the ElementorFill component.
*
* @param {Object} props The props.
*
* @returns {wp.Element} The Sidebar component.
*
* @constructor
*/
export default function ElementorFill( { isLoading, onLoad, settings } ) {
const webinarIntroUrl = get( window, "wpseoScriptData.webinarIntroElementorUrl", "https://yoa.st/webinar-intro-elementor" );
const FirstEligibleNotification = useFirstEligibleNotification( { webinarIntroUrl } );
useEffect( () => {
setTimeout( () => {
if ( isLoading ) {
onLoad();
}
} );
} );
if ( isLoading ) {
return null;
}
return (
<>
{ isWordProofIntegrationActive() && <WordProofAuthenticationModals /> }
<Fill name="YoastElementor">
<ErrorBoundary FallbackComponent={ ElementorErrorFallback }>
<SidebarItem renderPriority={ 1 }>
<Alert />
{ FirstEligibleNotification && <FirstEligibleNotification /> }
</SidebarItem>
{ settings.isKeywordAnalysisActive && <SidebarItem renderPriority={ 8 }>
<KeywordInput
isSEMrushIntegrationActive={ settings.isSEMrushIntegrationActive }
/>
{ ! window.wpseoScriptData.metabox.isPremium && <Fill name="YoastRelatedKeyphrases">
<SEMrushRelatedKeyphrases />
</Fill> }
</SidebarItem> }
{ settings.isKeywordAnalysisActive && <SidebarItem renderPriority={ 10 }>
<Fragment>
<SeoAnalysis
shouldUpsell={ settings.shouldUpsell }
shouldUpsellWordFormRecognition={ settings.isWordFormRecognitionActive }
shouldUpsellHighlighting={ settings.shouldUpsell }
/>
{ settings.shouldUpsell && <PremiumSEOAnalysisModal /> }
</Fragment>
</SidebarItem> }
{ settings.isContentAnalysisActive && <SidebarItem renderPriority={ 15 }>
<ReadabilityAnalysis
shouldUpsell={ settings.shouldUpsell }
shouldUpsellHighlighting={ settings.shouldUpsell }
/>
</SidebarItem> }
{ settings.isInclusiveLanguageAnalysisActive && <SidebarItem renderPriority={ 19 }>
<InclusiveLanguageAnalysis
shouldUpsellHighlighting={ settings.shouldUpsell }
/>
</SidebarItem> }
{ settings.isKeywordAnalysisActive && <SidebarItem key="additional-keywords-upsell" renderPriority={ 22 }>
{ settings.shouldUpsell && <KeywordUpsell /> }
</SidebarItem> }
{ settings.isKeywordAnalysisActive && settings.isWincherIntegrationActive &&
<SidebarItem key="wincher-seo-performance" renderPriority={ 23 }>
<WincherSEOPerformanceModal location="sidebar" />
</SidebarItem> }
{ settings.shouldUpsell && <SidebarItem key="internal-linking-suggestions-upsell" renderPriority={ 24 }>
<InternalLinkingSuggestionsUpsell />
</SidebarItem> }
<SidebarItem renderPriority={ 25 }>
<SearchAppearanceModal />
</SidebarItem>
{ ( settings.useOpenGraphData || settings.useTwitterData ) && <SidebarItem key="social-appearance" renderPriority={ 26 }>
<SocialAppearanceModal
useOpenGraphData={ settings.useOpenGraphData }
useTwitterData={ settings.useTwitterData }
/>
</SidebarItem> }
{ settings.displaySchemaSettings && <SidebarItem renderPriority={ 28 }>
<SidebarCollapsible
title={ __( "Schema", "wordpress-seo" ) }
>
<SchemaTabContainer />
</SidebarCollapsible>
</SidebarItem> }
{ settings.displayAdvancedTab && <SidebarItem renderPriority={ 29 }>
<SidebarCollapsible
title={ __( "Advanced", "wordpress-seo" ) }
buttonId="yoast-seo-elementor-advanced-button"
>
<AdvancedSettings location="sidebar" />
</SidebarCollapsible>
</SidebarItem> }
{ settings.isCornerstoneActive && <SidebarItem renderPriority={ 30 }>
<CollapsibleCornerstone />
</SidebarItem> }
{ settings.isInsightsEnabled && <SidebarItem renderPriority={ 32 }>
<InsightsModal location="elementor" />
</SidebarItem> }
</ErrorBoundary>
</Fill>
</>
);
}
ElementorFill.propTypes = {
isLoading: PropTypes.bool.isRequired,
onLoad: PropTypes.func.isRequired,
settings: PropTypes.object.isRequired,
};
/* eslint-enable complexity */