Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add/press2 355 support links learn more sidebar #119

Merged
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
156 changes: 102 additions & 54 deletions includes/Data/Brands.php
Original file line number Diff line number Diff line change
@@ -1,66 +1,114 @@
<?php
namespace NewfoldLabs\WP\Module\Onboarding\Data;

use function NewfoldLabs\WP\ModuleLoader\container;
use WP_Forge\Fluent\Fluent;

/**
* Contains Brand information.
*/
final class Brands {

protected static $brands = array(
'bluehost' => array(
'brand' => 'bluehost',
'name' => 'Bluehost',
'url' => 'https://bluehost.com',
'knowledgeBaseUrl' => 'https://www.bluehost.com/help/results/wordpress',
'helpUrl' => 'https://www.bluehost.com/help',
'blogUrl' => 'https://www.bluehost.com/blog/',
'facebookUrl' => 'https://www.facebook.com/bluehost',
'twitterName' => '@bluehost',
'twitterUrl' => 'https://twitter.com/bluehost',
'youtubeUrl' => 'https://www.youtube.com/user/bluehost',
'linkedinUrl' => 'https://www.linkedin.com/company/bluehost-com',
'accountUrl' => 'https://my.bluehost.com',
'domainsUrl' => 'https://my.bluehost.com/hosting/app?lil=1#/domains',
'emailUrl' => 'https://my.bluehost.com/hosting/app?lil=1#/email-office',
'hireExpertsInfo' => array(
'defaultLink' => 'admin.php?',
'fragment' => '#/marketplace/services/blue-sky',
'queryParameters' => array(
'page' => 'bluehost',
'utm_source' => 'onboarding',
'utm_medium' => 'wp_admin',
'utm_campaign' => 'wp-setup')),
),
'bluehost-india' => array(
'brand' => 'bluehost-india',
'name' => 'Bluehost',
'url' => 'https://bluehost.in',
'knowledgeBaseUrl' => 'https://www.bluehost.in/hosting/help/results/wordpress',
'helpUrl' => 'https://www.bluehost.in/hosting/help',
'blogUrl' => 'https://www.bluehost.in/tutorials',
'facebookUrl' => 'https://www.facebook.com/BlueHostIndia',
'twitterName' => '@BluehostIndia',
'twitterUrl' => 'https://twitter.com/bluehostindia',
'youtubeUrl' => null,
'linkedinUrl' => null,
'accountUrl' => 'https://my.bluehost.in',
'domainsUrl' => 'https://my.bluehost.in/hosting/app?lil=1#/domains',
'emailUrl' => 'https://my.bluehost.in/hosting/app?lil=1#/email-office',
'hireExpertsInfo' => array(
'defaultLink' => 'https://www.bluehost.in/solutions/full-service',
'utmParameters' => array(
public static function get_brands() {
$container_headers = new Fluent( container()->plugin()->headers );
$brand_plugin_name = $container_headers->getAttributes()[ 'attributes' ][ 'TextDomain' ] ?
$container_headers->getAttributes()[ 'attributes' ][ 'TextDomain' ] : '';

return array(
'bluehost' => array(
'brand' => 'bluehost',
'name' => 'Bluehost',
'url' => 'https://bluehost.com',
'knowledgeBaseUrl' => 'https://www.bluehost.com/help/results/wordpress',
'helpUrl' => 'https://www.bluehost.com/help',
'blogUrl' => 'https://www.bluehost.com/blog/',
'facebookUrl' => 'https://www.facebook.com/bluehost',
'twitterName' => '@bluehost',
'twitterUrl' => 'https://twitter.com/bluehost',
'youtubeUrl' => 'https://www.youtube.com/user/bluehost',
'linkedinUrl' => 'https://www.linkedin.com/company/bluehost-com',
'accountUrl' => 'https://my.bluehost.com',
'domainsUrl' => 'https://my.bluehost.com/hosting/app?lil=1#/domains',
'emailUrl' => 'https://my.bluehost.com/hosting/app?lil=1#/email-office',
'hireExpertsInfo' => array(
'defaultLink' => 'admin.php?',
'fragment' => '#/marketplace/services/blue-sky',
'queryParameters' => array(
'page' => 'bluehost',
'utm_source' => 'onboarding',
'utm_medium' => 'wp_admin',
'utm_campaign' => 'wp-setup'
),
),
'expertsInfo' => array(
'defaultLink' => 'https://my.bluehost.com/cgi/app/#/marketplace/product/i/bluesky',
'queryParams' => array(
'utm_source' => 'wp-onboarding',
'utm_medium' => $brand_plugin_name,
),
),
'fullServiceCreativeTeamInfo' => array(
'defaultLink' => 'https://www.bluehost.com/solutions/full-service',
'fragment' => '#full-service',
'queryParams' => array(
'utm_source' => 'wp-onboarding',
'utm_medium' => $brand_plugin_name,
),
),
'techSupportInfo' => array(
'defaultLink' => 'https://helpchat.bluehost.com/',
'queryParams' => array(
'utm_source' => 'wp-onboarding',
'utm_medium' => $brand_plugin_name,
),
),
),
'bluehost-india' => array(
'brand' => 'bluehost-india',
'name' => 'Bluehost',
'url' => 'https://bluehost.in',
'knowledgeBaseUrl' => 'https://www.bluehost.in/hosting/help/results/wordpress',
'helpUrl' => 'https://www.bluehost.in/hosting/help',
'blogUrl' => 'https://www.bluehost.in/tutorials',
'facebookUrl' => 'https://www.facebook.com/BlueHostIndia',
'twitterName' => '@BluehostIndia',
'twitterUrl' => 'https://twitter.com/bluehostindia',
'youtubeUrl' => null,
'linkedinUrl' => null,
'accountUrl' => 'https://my.bluehost.in',
'domainsUrl' => 'https://my.bluehost.in/hosting/app?lil=1#/domains',
'emailUrl' => 'https://my.bluehost.in/hosting/app?lil=1#/email-office',
'hireExpertsInfo' => array(
'defaultLink' => 'https://www.bluehost.in/solutions/full-service',
'utmParameters' => array(
'utm_source' => 'blog',
'utm_medium' => 'socialmedia',
'utm_campaign' => 'blogpost')),
),
);

/**
* Get Brand information.
*
* @return array
*/
public static function get_brands() {
return self::$brands;
'utm_campaign' => 'blogpost'
)
),
'expertsInfo' => array(
'defaultLink' => 'https://my.bluehost.in/cgi/app/#/marketplace/product/i/bluesky',
'queryParams' => array(
'utm_source' => 'wp-onboarding',
'utm_medium' => $brand_plugin_name,
),
),
'fullServiceCreativeTeamInfo' => array(
'defaultLink' => 'https://www.bluehost.in/solutions/full-service',
'fragment' => '#full-service',
'queryParams' => array(
'utm_source' => 'wp-onboarding',
'utm_medium' => $brand_plugin_name,
),
),
'techSupportInfo' => array(
'defaultLink' => 'https://helpchat.bluehost.in/',
'queryParams' => array(
'utm_source' => 'wp-onboarding',
'utm_medium' => $brand_plugin_name,
),
),
),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const SupportLink = ( {
text,
} ) => {
return (
<a href={ link } className={ baseClassName }>
<a href={ link } className={ baseClassName } target={ '_blank' }>
{ text }
</a>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { __, sprintf } from '@wordpress/i18n';
import { translations } from '../../../../../utils/locales/translations';
import { info } from '@wordpress/icons';

const getContents = ( brandName ) => {
const getContents = ( brandName, techSupportLink, fullServiceCreativeTeamLink ) => {
return {
introduction: {
heading: __( 'Basic Info', 'wp-module-onboarding' ),
Expand Down Expand Up @@ -55,11 +55,11 @@ const getContents = ( brandName ) => {
'Hire Our Full-Service Creative Studio',
'wp-module-onboarding'
),
link: '#',
link: fullServiceCreativeTeamLink,
},
support: {
text: __( 'Technical Support', 'wp-module-onboarding' ),
link: '#',
link: techSupportLink,
},
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@ const StepIntroPanel = lazy( () =>
);

const LearnMore = () => {
const { brandName } = useSelect( ( select ) => {
const { brandName, techSupportLink, fullServiceCreativeTeamLink } = useSelect( ( select ) => {
return {
brandName: select( nfdOnboardingStore ).getNewfoldBrandName(),
techSupportLink: select( nfdOnboardingStore ).getTechSupportUrl(),
fullServiceCreativeTeamLink: select( nfdOnboardingStore ).getfullServiceCreativeTeamUrl(),
};
} );

const content = getContents( brandName );
const content = getContents( brandName, techSupportLink, fullServiceCreativeTeamLink );

return (
<div className="nfd-onboarding-sidebar-learn-more__basic-info">
Expand All @@ -55,7 +57,7 @@ const LearnMore = () => {
<ButtonWhite
text={ content.help.fullService.text }
onClick={ () =>
( window.location.href = content.help.fullService.link )
( window.open( content.help.fullService.link, '_blank') )
}
/>
<SupportLink
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { __, sprintf } from '@wordpress/i18n';
import { translations } from '../../../../../utils/locales/translations';
import { color } from '@wordpress/icons';

const getContents = () => {
const getContents = ( techSupportLink, fullServiceCreativeTeamLink ) => {
return {
introduction: {
heading: __( 'Colors', 'wp-module-onboarding' ),
Expand Down Expand Up @@ -40,11 +40,11 @@ const getContents = () => {
'Hire Our Full-Service Creative Studio',
'wp-module-onboarding'
),
link: '#',
link: fullServiceCreativeTeamLink,
},
support: {
text: __( 'Technical Support', 'wp-module-onboarding' ),
link: '#',
link: techSupportLink,
},
},
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { useSelect } from '@wordpress/data';
import { lazy } from '@wordpress/element';

import { store as nfdOnboardingStore } from '../../../../../store';
import getContents from './contents';

const IllustrationPanel = lazy( () =>
Expand Down Expand Up @@ -28,7 +30,15 @@ const StepIntroPanel = lazy( () =>
);

const LearnMore = () => {
const content = getContents();

const { techSupportLink, fullServiceCreativeTeamLink } = useSelect( ( select ) => {
return {
techSupportLink: select( nfdOnboardingStore ).getTechSupportUrl(),
fullServiceCreativeTeamLink: select( nfdOnboardingStore ).getfullServiceCreativeTeamUrl(),
};
} );

const content = getContents( techSupportLink, fullServiceCreativeTeamLink );

return (
<div className="nfd-onboarding-sidebar-learn-more__design-colors">
Expand All @@ -47,7 +57,7 @@ const LearnMore = () => {
<ButtonWhite
text={ content.help.fullService.text }
onClick={ () =>
( window.location.href = content.help.fullService.link )
( window.open( content.help.fullService.link, '_blank' ) )
}
/>
<SupportLink
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { __, sprintf } from '@wordpress/i18n';
import { translations } from '../../../../../utils/locales/translations';
import { header } from '@wordpress/icons';

const getContents = () => {
const getContents = ( techSupportLink, fullServiceCreativeTeamLink ) => {
return {
introduction: {
heading: __( 'Header & Menu', 'wp-module-onboarding' ),
Expand Down Expand Up @@ -55,11 +55,11 @@ const getContents = () => {
'Hire Our Full-Service Creative Studio',
'wp-module-onboarding'
),
link: '#',
link: fullServiceCreativeTeamLink,
},
support: {
text: __( 'Technical Support', 'wp-module-onboarding' ),
link: '#',
link: techSupportLink,
},
},
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { useSelect } from '@wordpress/data';
import { lazy } from '@wordpress/element';

import { store as nfdOnboardingStore } from '../../../../../store';
import getContents from './contents';

const IllustrationPanel = lazy( () =>
Expand Down Expand Up @@ -28,7 +30,15 @@ const StepIntroPanel = lazy( () =>
);

const LearnMore = () => {
const content = getContents();

const { techSupportLink, fullServiceCreativeTeamLink } = useSelect( ( select ) => {
return {
techSupportLink: select( nfdOnboardingStore ).getTechSupportUrl(),
fullServiceCreativeTeamLink: select( nfdOnboardingStore ).getfullServiceCreativeTeamUrl(),
};
} );

const content = getContents( techSupportLink, fullServiceCreativeTeamLink );

return (
<div className="nfd-onboarding-sidebar-learn-more__design-header-menu">
Expand All @@ -47,7 +57,7 @@ const LearnMore = () => {
<ButtonWhite
text={ content.help.fullService.text }
onClick={ () =>
( window.location.href = content.help.fullService.link )
( window.open( content.help.fullService.link, '_blank' ) )
}
/>
<SupportLink
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { __, sprintf } from '@wordpress/i18n';
import { translations } from '../../../../../utils/locales/translations';
import { home } from '@wordpress/icons';

const getContents = () => {
const getContents = ( techSupportLink, fullServiceCreativeTeamLink ) => {
return {
introduction: {
heading: __( 'Home Page', 'wp-module-onboarding' ),
Expand Down Expand Up @@ -46,11 +46,11 @@ const getContents = () => {
'Hire Our Full-Service Creative Studio',
'wp-module-onboarding'
),
link: '#',
link: fullServiceCreativeTeamLink,
},
support: {
text: __( 'Technical Support', 'wp-module-onboarding' ),
link: '#',
link: techSupportLink,
},
},
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { useSelect } from '@wordpress/data';
import { lazy } from '@wordpress/element';

import { store as nfdOnboardingStore } from '../../../../../store';
import getContents from './contents';

const IllustrationPanel = lazy( () =>
Expand Down Expand Up @@ -28,7 +30,15 @@ const StepIntroPanel = lazy( () =>
);

const LearnMore = () => {
const content = getContents();

const { techSupportLink, fullServiceCreativeTeamLink } = useSelect( ( select ) => {
return {
techSupportLink: select( nfdOnboardingStore ).getTechSupportUrl(),
fullServiceCreativeTeamLink: select( nfdOnboardingStore ).getfullServiceCreativeTeamUrl(),
};
} );

const content = getContents( techSupportLink, fullServiceCreativeTeamLink );

return (
<div className="nfd-onboarding-sidebar-learn-more__design-homepage">
Expand All @@ -47,7 +57,7 @@ const LearnMore = () => {
<ButtonWhite
text={ content.help.fullService.text }
onClick={ () =>
( window.location.href = content.help.fullService.link )
( window.open( content.help.fullService.link, '_blank' ) )
}
/>
<SupportLink
Expand Down
Loading