From 2cfea42bf93dcc57e3622182df7bf8369a00df34 Mon Sep 17 00:00:00 2001 From: "lokapure.girish" Date: Tue, 23 Jul 2024 18:34:21 +0530 Subject: [PATCH] moved myproducts in home section --- src/app/pages/home/index.js | 9 ++++ src/app/pages/home/productSection.js | 63 ++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 src/app/pages/home/productSection.js diff --git a/src/app/pages/home/index.js b/src/app/pages/home/index.js index bd7f2254c..ea829614a 100644 --- a/src/app/pages/home/index.js +++ b/src/app/pages/home/index.js @@ -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 ( @@ -17,6 +25,7 @@ const Home = () => { + { abTestShowMyProducts && } ); }; diff --git a/src/app/pages/home/productSection.js b/src/app/pages/home/productSection.js new file mode 100644 index 000000000..049e5b740 --- /dev/null +++ b/src/app/pages/home/productSection.js @@ -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 ( + + +

+ { __( + 'A list of products associated with your Bluehost hosting package. For more information, check out the ', + 'bluehost-wordpress-plugin' + ) } + + + { __( + 'Bluehost Account Manager', + 'bluehost-wordpress-plugin' + ) } + +

+
+ +
+ ); +}; + +export default ProductSection;