Skip to content

Commit

Permalink
Add Lendio to Services Page (#127)
Browse files Browse the repository at this point in the history
* add lendio to services page

* exclude lendio from render test intended for mojo items

Co-authored-by: Dave Ryan <[email protected]>
  • Loading branch information
0aveRyan and 0aveRyan authored Mar 9, 2022
1 parent f8c1135 commit b358c25
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 9 deletions.
13 changes: 7 additions & 6 deletions src/app/components/molecules/bwa-product-card/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ export default function BWAProductCard(
price,
title,
toggleFavorite,
overrideUrl = '',
...props
}
) {
const style = imageUrl ? { backgroundImage: `url(${ imageUrl })` } : {};
const detailsUrl = '#/marketplace/' + props.type + '/' + props.id;
const detailsUrl = '' !== overrideUrl ? overrideUrl : '#/marketplace/' + props.type + '/' + props.id;
return (
<div className={ `product-card ${ className }` }>
<a href={detailsUrl} aria-label={title}><div className="product-card__image" style={ style } /></a>
Expand All @@ -31,7 +32,7 @@ export default function BWAProductCard(
{ decodeEntities( title ) }
</BWAHeading>
</a>
<div className="product-card__price">{ price }</div>
{'' !== price && (<div className="product-card__price">{ price }</div>)}
</div>
<div className="product-card__action-group">
<div className={ classNames( {
Expand All @@ -42,19 +43,19 @@ export default function BWAProductCard(
'--is-favorite': isFavorite,
} ) } onClick={ toggleFavorite } />
<div className="product-card__button-group">
<Button
{buttonSecondary?.children !== null && (<Button
children={ __( 'View Details', 'bluehost-wordpress-plugin' ) }
{ ...buttonSecondary }
className="product-card__button-secondary"
isSecondary
/>
<Button
/>)}
{buttonPrimary?.children !== null && (<Button
children={ __( 'Buy Now', 'bluehost-wordpress-plugin' ) }
target="_blank"
{ ...buttonPrimary }
className="product-card__button-primary"
isPrimary
/>
/>)}
</div>
</div>
</div>
Expand Down
23 changes: 21 additions & 2 deletions src/app/pages/marketplace/services/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,28 @@ function ServicesPage( { history } ) {
}

if ( ! shimsInserted && payload.hasOwnProperty('items') ) {
payload.items.unshift({
id: 'lendio',
'buy_url': 'https://lp.lendio.com/partners-lf?source=BlueHost&affiliate=3125925044&campaign=wp&term=BLMS',
overrideUrl: 'https://lp.lendio.com/partners-lf?source=BlueHost&affiliate=3125925044&campaign=wp&term=BLMS',
images: {
'preview_url': 'https://cdn.hiive.space/bluehost/plugin/services-lendio.png',
},
marketplaceType: 'services',
prices: {
'single_domain_license': '', // removes price from card
},
name: 'Apply for a Business Loan – fast',
buttonPrimary: { children: __( 'Apply Now', 'bluehost-wordpress-plugin' ) },
buttonSecondary: { children: null },
created_timestamp: 1631853345,
sales_count: 9999999998,
});
payload.items.unshift({
id: 'blue-sky',
'buy_url': getPlatformBaseUrl('/cgi/app/#/marketplace/product/i/bluesky?utm_term=Get%20Started&utm_content=bluesky_link&utm_campaign=&utm_source=wp-admin%2Fadmin.php%3Fpage%3Dbluehost%23%2Fmarketplace%2Fservices&utm_medium=bluehost_plugin'),
images: {
'preview_url': 'https://cdn.hiive.space/bluehost/blue-sky-product-banner.png'
'preview_url': 'https://cdn.hiive.space/bluehost/blue-sky-product-banner.png',
},
marketplaceType: 'services',
prices: {
Expand All @@ -36,11 +53,12 @@ function ServicesPage( { history } ) {
return (
<BWAProductCard
className={ item.id }
buttonPrimary={ { href: item.buy_url } }
buttonPrimary={ { href: item.buy_url, ...item?.buttonPrimary } }
buttonSecondary={ {
onClick: () => {
history.push( `/marketplace/services/${ item.id }` );
},
...item?.buttonSecondary
} }
id={ item.id }
imageUrl={ item.images.preview_url }
Expand All @@ -49,6 +67,7 @@ function ServicesPage( { history } ) {
key={ item.id }
price={ item.prices.single_domain_license }
title={ item.name }
overrideUrl={ 'undefined' !== typeof item.overrideUrl ? item.overrideUrl : ''}
toggleFavorite={ () => toggleFavorite( item.id ) }
/>
);
Expand Down
2 changes: 1 addition & 1 deletion tests/cypress/integration/services.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('Services Page', function () {
});

it('Product cards render correctly', () => {
cy.get('.product-card').not('.blue-sky').as('card');
cy.get('.product-card').not('.blue-sky').not('.lendio').as('card');

cy.get('@card')
.findByRole('button', {name: 'View Details'})
Expand Down

0 comments on commit b358c25

Please sign in to comment.