Skip to content
This repository has been archived by the owner on Jan 30, 2025. It is now read-only.

Commit

Permalink
Re-add My Products module and components
Browse files Browse the repository at this point in the history
  • Loading branch information
wpalani committed Sep 5, 2024
1 parent e1d997c commit e314341
Show file tree
Hide file tree
Showing 4 changed files with 121 additions and 1 deletion.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
"newfold-labs/wp-module-loader": "^1.0.10",
"newfold-labs/wp-module-marketplace": "^2.4.0",
"newfold-labs/wp-module-migration": "^1.0.11",
"newfold-labs/wp-module-my-products": "^1.0.3",
"newfold-labs/wp-module-notifications": "^1.5.0",
"newfold-labs/wp-module-onboarding": "^2.3.11",
"newfold-labs/wp-module-patterns": "^2.4.1",
Expand Down
61 changes: 60 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions src/app/pages/home/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +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 MyProductSection from './myProductsSection';

const Home = () => {
const abTestShowMyProducts = NewfoldRuntime.hasCapability(
'abTestShowMyProducts'
);

return (
<Page className="wppbh-home">
<WelcomeSection />
Expand All @@ -17,6 +23,7 @@ const Home = () => {
</div>
</Container.Block>
</Container>
{ abTestShowMyProducts && <MyProductSection /> }
</Page>
);
};
Expand Down
53 changes: 53 additions & 0 deletions src/app/pages/home/myProductsSection.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import apiFetch from '@wordpress/api-fetch';
import { useState, useEffect } from '@wordpress/element';
import { NewfoldRuntime } from '@newfold-labs/wp-module-runtime';
import { isJarvis } from '../../util/helpers';
import { default as NewfoldMyProducts } from '@modules/wp-module-my-products/components/myProducts';

// 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'
),
title: __( 'My Products', 'bluehost-wordpress-plugin' ),
subTitle: __(
'A list of products associated with your Bluehost hosting package. For more information, check out the ',
'bluehost-wordpress-plugin'
),
renewalText: __(
'Bluehost Account Manager',
'bluehost-wordpress-plugin'
),
renewalCenterUrl: 'https://www.bluehost.com/my-account/renewal-center',
},
};

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

const MyProductsSection = () => {
return (
<NewfoldMyProducts
methods={ moduleMethods }
constants={ moduleConstants }
/>
);
};

export default MyProductsSection;

0 comments on commit e314341

Please sign in to comment.