From e3143414b5fd890e5d0b3c55a7fe489ec6e6b436 Mon Sep 17 00:00:00 2001 From: wpalani Date: Thu, 5 Sep 2024 11:19:56 -0700 Subject: [PATCH] Re-add My Products module and components --- composer.json | 1 + composer.lock | 61 ++++++++++++++++++++++++- src/app/pages/home/index.js | 7 +++ src/app/pages/home/myProductsSection.js | 53 +++++++++++++++++++++ 4 files changed, 121 insertions(+), 1 deletion(-) create mode 100644 src/app/pages/home/myProductsSection.js diff --git a/composer.json b/composer.json index 14b95d2f9..1d3b3fe72 100644 --- a/composer.json +++ b/composer.json @@ -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", diff --git a/composer.lock b/composer.lock index 389d072ed..eaf21c77c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "135f50424bef02d46a7d63de087c0374", + "content-hash": "29b583ddd0e622393a2439ceb9c10e9c", "packages": [ { "name": "doctrine/inflector", @@ -1481,6 +1481,65 @@ }, "time": "2024-08-21T14:04:06+00:00" }, + { + "name": "newfold-labs/wp-module-my-products", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/newfold-labs/wp-module-my-products.git", + "reference": "e0796b9087f5d4349ad0403a3bf55046ec620eb1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/newfold-labs/wp-module-my-products/zipball/e0796b9087f5d4349ad0403a3bf55046ec620eb1", + "reference": "e0796b9087f5d4349ad0403a3bf55046ec620eb1", + "shasum": "" + }, + "require": { + "newfold-labs/wp-module-context": "^1.0", + "newfold-labs/wp-module-data": "^2.6.1", + "newfold-labs/wp-module-features": "^1.3.0" + }, + "require-dev": { + "newfold-labs/wp-php-standards": "^1.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "NewfoldLabs\\WP\\Module\\MyProducts\\": "includes" + }, + "files": [ + "bootstrap.php" + ] + }, + "scripts": { + "fix": [ + "vendor/bin/phpcbf --standard=phpcs.xml ." + ], + "lint": [ + "vendor/bin/phpcs --standard=phpcs.xml -s ." + ] + }, + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Vara Prasad Maruboina", + "email": "varaprasad.maruboina@newfold.com" + }, + { + "name": "Girish Lokapure", + "email": "girish.lokapure@newfold.com" + } + ], + "description": "A module for rendering user-specific product data utilizing the Hiive Users API, which integrates with the Fulfilment Gateway API.", + "support": { + "source": "https://github.com/newfold-labs/wp-module-my-products/tree/1.0.3", + "issues": "https://github.com/newfold-labs/wp-module-my-products/issues" + }, + "time": "2024-08-22T21:57:38+00:00" + }, { "name": "newfold-labs/wp-module-notifications", "version": "1.5.0", diff --git a/src/app/pages/home/index.js b/src/app/pages/home/index.js index bd7f2254c..5b41b28f6 100644 --- a/src/app/pages/home/index.js +++ b/src/app/pages/home/index.js @@ -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 ( @@ -17,6 +23,7 @@ const Home = () => { + { abTestShowMyProducts && } ); }; diff --git a/src/app/pages/home/myProductsSection.js b/src/app/pages/home/myProductsSection.js new file mode 100644 index 000000000..39be23d3e --- /dev/null +++ b/src/app/pages/home/myProductsSection.js @@ -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 ( + + ); +}; + +export default MyProductsSection;