PluginProbe ʕ •ᴥ•ʔ
Starter Sites & Templates by Neve / 1.4.1
Starter Sites & Templates by Neve v1.4.1
1.4.1 1.4.0 1.3.0 1.2.29 1.2.28 1.2.6 1.2.7 1.2.8 1.2.9 trunk 1.0.10 1.0.11 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.10 1.1.11 1.1.12 1.1.13 1.1.14 1.1.15 1.1.16 1.1.17 1.1.18 1.1.19 1.1.2 1.1.20 1.1.21 1.1.22 1.1.23 1.1.24 1.1.25 1.1.26 1.1.27 1.1.28 1.1.29 1.1.3 1.1.30 1.1.31 1.1.32 1.1.33 1.1.34 1.1.35 1.1.36 1.1.37 1.1.38 1.1.39 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.3 1.2.4 1.2.5
templates-patterns-collection / onboarding / src / Components / SiteSettings.js
templates-patterns-collection / onboarding / src / Components Last commit date
CustomizeControls 2 months ago Steps 2 weeks ago App.js 2 years ago CategoryButtons.js 3 weeks ago CustomTooltip.js 2 years ago EditorSelector.js 2 years ago FeaturesList.js 2 days ago Filters.js 3 weeks ago Header.js 3 weeks ago ImportError.js 2 years ago ImportForm.js 1 year ago ImportMock.js 2 years ago ImportProgress.js 1 year ago Onboarding.js 3 weeks ago ProgressBar.js 2 years ago Search.js 3 weeks ago SitePreview.js 2 years ago SiteSettings.js 2 months ago Sites.js 2 weeks ago StarterSiteCard.js 2 days ago Toast.js 2 weeks ago WelcomeMock.js 2 years ago
SiteSettings.js
333 lines
1 /* global tiobDash */
2 import { __ } from '@wordpress/i18n';
3 import { withDispatch, withSelect } from '@wordpress/data';
4 import { compose } from '@wordpress/compose';
5 // eslint-disable-next-line @wordpress/no-unsafe-wp-apis
6 import { Button, __experimentalConfirmDialog as ConfirmDialog } from '@wordpress/components';
7 import { createInterpolateElement, useState } from '@wordpress/element';
8 import PaletteControl from './CustomizeControls/PaletteControl';
9 import TypographyControl from './CustomizeControls/TypographyControl';
10 import SiteNameControl from './CustomizeControls/SiteNameControl';
11 import LogoControl from './CustomizeControls/LogoControl';
12 import ImportMock from './ImportMock';
13 import classnames from 'classnames';
14 import { track } from '../utils/rest';
15 import FeaturesControl from './CustomizeControls/FeaturesControl';
16
17 export const SiteSettings = ( {
18 general,
19 fetching,
20 siteData,
21 siteStyle,
22 setSiteStyle,
23 importDataDefault,
24 currentCustomizations,
25 trackingId,
26 setOnboardingStep,
27 step,
28 } ) => {
29 const canImport = ! siteData.upsell;
30 const { siteName, siteLogo } = currentCustomizations;
31 const [ settingsChanged, setSettingsChanged ] = useState( false );
32 const dashboardLink = tiobDash.onboardingUpsell?.dashboard;
33 const contactLink = tiobDash.onboardingUpsell?.contact;
34
35 const [ openConfirmationModal, setOpenConfirmationModal ] = useState( false );
36 const [ skipSuggestions, setSkipSuggestions ] = useState( false );
37
38 let heading =
39 step === 3
40 ? __( 'Customize design', 'templates-patterns-collection' )
41 : __( 'Select features', 'templates-patterns-collection' );
42
43 let description = __(
44 'Enhance your website with powerful plugins to fulfil your needs.',
45 'templates-patterns-collection'
46 );
47 if ( step === 3 ) {
48 description = __(
49 'Customize the design of your site, such as color and typography.',
50 'templates-patterns-collection'
51 );
52 }
53 if ( ! canImport && step === 4 ) {
54 heading = __(
55 'This is a Premium Starter Site!',
56 'templates-patterns-collection'
57 );
58 description = __(
59 'Upgrade to Neve Business plan to enjoy unlimited access to all templates in the library.',
60 'templates-patterns-collection'
61 );
62 }
63
64 const firstUpsell = createInterpolateElement(
65 __(
66 'If you are an existing Neve Pro customer, please install the premium version of the plugin from your Themeisle <a></a>.',
67 'templates-patterns-collection'
68 ),
69 {
70 a: (
71 <a
72 href={ dashboardLink }
73 target="_blank"
74 rel="external noreferrer noopener"
75 >
76 { __(
77 'account dashboard',
78 'templates-patterns-collection'
79 ) }
80 </a>
81 ),
82 }
83 );
84 const secondUpsell = createInterpolateElement(
85 __(
86 'If you have any questions, feel free to <a></a>.',
87 'templates-patterns-collection'
88 ),
89 {
90 a: (
91 <a
92 href={ contactLink }
93 target="_blank"
94 rel="external noreferrer noopener"
95 >
96 { __( 'contact us', 'templates-patterns-collection' ) }
97 </a>
98 ),
99 }
100 );
101
102 const designChoicesSubmit = () => {
103 setOnboardingStep( 4 );
104 const trackData = {
105 slug: 'neve',
106 license_id: tiobDash.license,
107 site: tiobDash.onboarding.homeUrl || '',
108 design_choices: {
109 palette: siteStyle.palette,
110 typography: siteStyle.font,
111 },
112 step_id: 3,
113 step_status: 'completed',
114 };
115 track( trackingId, trackData ).catch( ( error ) => {
116 // eslint-disable-next-line no-console
117 console.error( error );
118 } );
119 };
120
121 const identityChoicesSubmit = ( skip = false ) => {
122 const fieldsFilled = [];
123 if ( siteName ) {
124 fieldsFilled.push( 'siteName' );
125 }
126 if ( siteLogo ) {
127 fieldsFilled.push( 'siteLogo' );
128 }
129 setOnboardingStep( 5 );
130 const trackData = {
131 slug: 'neve',
132 license_id: tiobDash.license,
133 site: tiobDash.onboarding.homeUrl || '',
134 imported_items: general,
135 fields_filled: fieldsFilled,
136 step_id: 4,
137 step_status: skip ? 'skip' : 'completed',
138 };
139 track( trackingId, trackData ).catch( ( error ) => {
140 // eslint-disable-next-line no-console
141 console.error( error );
142 } );
143 };
144
145 return (
146 <div
147 className={ classnames(
148 'ob-site-settings',
149 fetching ? 'fetching' : ''
150 ) }
151 >
152 { ! fetching ? (
153 <>
154 <div className="ob-site-settings-container">
155 <div className="ob-settings-header">
156 <div className="ob-settings-info">
157 <p>{ __( 'Selected Template', 'templates-patterns-collection' ) }</p>
158 <h3>{ siteData.title }</h3>
159 </div>
160 <div className="ob-settings-actions">
161 <Button
162 className="ob-link"
163 variant="link"
164 onClick={ () => {
165 setOnboardingStep( 2 );
166 } }
167 >
168 <span className="dashicons dashicons-no-alt" />
169 </Button>
170 </div>
171 </div>
172 <div className="ob-settings-description">
173 <h2>{ heading }</h2>
174 <p>{ description }</p>
175 </div>
176 <div className="ob-settings-wrap">
177 <div className="ob-settings-top">
178 { step === 3 && (
179 <>
180 <LogoControl
181 importDataDefault={
182 importDataDefault
183 }
184 />
185 <PaletteControl
186 siteStyle={ siteStyle }
187 setSiteStyle={ setSiteStyle }
188 />
189 <TypographyControl
190 siteStyle={ siteStyle }
191 setSiteStyle={ setSiteStyle }
192 importDataDefault={
193 importDataDefault
194 }
195 />
196 </>
197 ) }
198
199 { step === 4 &&
200 ( canImport ? (
201 <>
202 <FeaturesControl />
203 </>
204 ) : (
205 <Button
206 isPrimary
207 className="ob-button full"
208 href={
209 tiobDash.onboardingUpsell
210 .upgrade
211 }
212 rel="external noreferrer noopener"
213 target="_blank"
214 >
215 { __(
216 'Unlock Access',
217 'templates-patterns-collection'
218 ) }
219 </Button>
220 ) ) }
221 </div>
222 </div>
223 </div>
224 <div className="ob-settings-bottom">
225 { step === 3 && (
226 <Button
227 disabled={ fetching }
228 isPrimary
229 className="ob-button full"
230 onClick={ designChoicesSubmit }
231 >
232 { __(
233 'Continue',
234 'templates-patterns-collection'
235 ) }
236 </Button>
237 ) }
238 { step === 4 &&
239 ( canImport ? (
240 <>
241 <Button
242 isPrimary
243 className="ob-button full"
244 onClick={ () =>{
245 setSkipSuggestions( false );
246 setOpenConfirmationModal( true );
247 }
248 }
249 disabled={ fetching }
250 >
251 { __(
252 'Import Website',
253 'templates-patterns-collection'
254 ) }
255 </Button>
256 <ConfirmDialog
257 isOpen={openConfirmationModal}
258 onConfirm={() => {
259 identityChoicesSubmit( skipSuggestions );
260 }}
261 onCancel={() => {
262 setOpenConfirmationModal(false);
263 }}
264 confirmButtonText={__('Start Import', 'templates-patterns-collection')}
265 cancelButtonText={__('Cancel', 'templates-patterns-collection')}
266 >
267 <h2 className="ob-modal-confirm-title">{ __( 'Start Import?', 'templates-patterns-collection' ) }</h2>
268 <p>{ __( 'This will override theme settings and add content to your current site.', 'templates-patterns-collection' ) }</p>
269 </ConfirmDialog>
270 </>
271 ) : (
272 <div className="ob-pro-info">
273 <h4>
274 { __(
275 'Already a customer',
276 'templates-patterns-collection'
277 ) }
278 </h4>
279 <p>{ firstUpsell }</p>
280 <p>{ secondUpsell }</p>
281 </div>
282 ) )
283 }
284 <Button
285 className="ob-link"
286 variant="link"
287 onClick={ () => {
288 if ( step === 4 ) {
289 setOnboardingStep( 3 );
290 return;
291 }
292 setOnboardingStep( 2 );
293 } }
294 >
295 { __(
296 'Go back',
297 'templates-patterns-collection'
298 ) }
299 </Button>
300 </div>
301 </>
302 ) : (
303 <ImportMock />
304 ) }
305 </div>
306 );
307 };
308
309 export default compose(
310 withSelect( ( select ) => {
311 const {
312 getFetching,
313 getCurrentSite,
314 getUserCustomSettings,
315 getTrackingId,
316 getCurrentStep,
317 } = select( 'ti-onboarding' );
318 return {
319 fetching: getFetching(),
320 siteData: getCurrentSite(),
321 currentCustomizations: getUserCustomSettings(),
322 trackingId: getTrackingId(),
323 step: getCurrentStep(),
324 };
325 } ),
326 withDispatch( ( dispatch ) => {
327 const { setOnboardingStep } = dispatch( 'ti-onboarding' );
328 return {
329 setOnboardingStep,
330 };
331 } )
332 )( SiteSettings );
333