File size: 1,925 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import page from '@automattic/calypso-router';
import { getSiteFragment } from 'calypso/lib/route';
import MarketplaceThankYou from 'calypso/my-sites/checkout/checkout-thank-you/marketplace/marketplace-thank-you';
import MarketplaceProductInstall from 'calypso/my-sites/marketplace/pages/marketplace-product-install';
import MarketplaceTest from 'calypso/my-sites/marketplace/pages/marketplace-test';
import SignupSuccess from 'calypso/my-sites/marketplace/pages/submission-success/signup-success';

export function renderPluginsInstallPage( context, next ) {
	const { productSlug } = context.params;
	context.primary = <MarketplaceProductInstall pluginSlug={ productSlug } />;
	next();
}

export function renderThemesInstallPage( context, next ) {
	const { themeSlug } = context.params;
	context.primary = <MarketplaceProductInstall themeSlug={ themeSlug } />;
	next();
}

export function renderMarketplaceThankYou( context, next ) {
	const { plugins, themes, continueWithPluginBundle, onboarding, styleVariation } = context.query;
	const pluginSlugs = plugins ? plugins.split( ',' ) : [];
	const themeSlugs = themes ? themes.split( ',' ) : [];

	context.primary = (
		<MarketplaceThankYou
			pluginSlugs={ pluginSlugs }
			themeSlugs={ themeSlugs }
			isOnboardingFlow={ onboarding !== undefined }
			styleVariationSlug={ styleVariation }
			continueWithPluginBundle={ continueWithPluginBundle }
		/>
	);
	next();
}

export function renderMarketplaceSignupSuccess( context, next ) {
	const { productSlug } = context.params;

	context.primary = <SignupSuccess productSlug={ productSlug } />;
	next();
}

export function renderMarketplaceTestPage( context, next ) {
	context.primary = <MarketplaceTest />;
	next();
}

export function redirectToHome( { path } ) {
	const siteFragment = getSiteFragment( path );
	if ( siteFragment ) {
		return page.redirect( `/home/${ siteFragment }` );
	}
	return page.redirect( '/home' );
}