Skip to content

Commit

Permalink
moved myproducts in home section
Browse files Browse the repository at this point in the history
  • Loading branch information
girish-lokapure committed Jul 23, 2024
1 parent 942640e commit 2cfea42
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/app/pages/home/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
import { Container, Page } from '@newfold/ui-component-library';
import { NewfoldRuntime } from '@newfold-labs/wp-module-runtime';
import WebinarsBanner from 'App/components/webinars-banner';
import AccountCard from './accountCard';
import HelpCard from './helpCard';
import WelcomeSection from './welcomeSection';
import ProductSection from './productSection';

const abTestShowMyProducts = NewfoldRuntime.hasCapability(
'abTestShowMyProducts'
);

console.log( NewfoldRuntime.hasCapability( 'abTestShowMyProducts' ) );

const Home = () => {
return (
Expand All @@ -17,6 +25,7 @@ const Home = () => {
</div>
</Container.Block>
</Container>
{ abTestShowMyProducts && <ProductSection /> }
</Page>
);
};
Expand Down
63 changes: 63 additions & 0 deletions src/app/pages/home/productSection.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import { Container } from '@newfold/ui-component-library';
import apiFetch from '@wordpress/api-fetch';
import { useState, useEffect } from '@wordpress/element';
import { NewfoldRuntime } from '@newfold-labs/wp-module-runtime';
import { default as NewfoldProducts } from '@newfold-labs/wp-module-my-products/components/product';
import { isJarvis } from '../../util/helpers';

// constants to pass to module
const moduleConstants = {
text: {
error: __(
'Oops, there was an error loading products, please try again later.',
'bluehost-wordpress-plugin'
),
noProducts: __(
'Sorry, no products. Please, try again later.',
'bluehost-wordpress-plugin'
),
jarvisText: __(
'Please login to your account manager to see products.',
'bluehost-wordpress-plugin'
),
},
};

// methods to pass to module
const moduleMethods = {
apiFetch,
useState,
useEffect,
NewfoldRuntime,
isJarvis,
};

const ProductSection = () => {
return (
<Container className="wppbh-products-section">
<Container.Header
title={ __( 'My Products', 'bluehost-wordpress-plugin' ) }
>
<p>
{ __(
'A list of products associated with your Bluehost hosting package. For more information, check out the ',
'bluehost-wordpress-plugin'
) }

<a href="https://www.bluehost.com/my-account/renewal-center">
{ __(
'Bluehost Account Manager',
'bluehost-wordpress-plugin'
) }
</a>
</p>
</Container.Header>
<NewfoldProducts
methods={ moduleMethods }
constants={ moduleConstants }
/>
</Container>
);
};

export default ProductSection;

0 comments on commit 2cfea42

Please sign in to comment.