Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PRESS4-495 | Added yith docs urls to learn more links #250

Merged
merged 3 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('lodash', 'moment', 'react', 'wp-api-fetch', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => 'eecc12c22373ac174970');
<?php return array('dependencies' => array('lodash', 'moment', 'react', 'wp-api-fetch', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => '69f35e99750e633d9e55');
29 changes: 12 additions & 17 deletions src/components/YITHPlugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,22 @@ import booking from "../icons/brands/yith-woocommerce-booking.svg";
import customizeAccount from "../icons/brands/yith-woocommerce-customize-myaccount-page.svg";
import gift from "../icons/brands/yith-woocommerce-gift-card.svg";
import wishList from "../icons/brands/yith-woocommerce-wishlist.svg";
import { RuntimeSdk } from "../sdk/runtime";
import {
YITH_WOOCOMMERCE_ACCOUNT_PAGE,
YITH_WOOCOMMERCE_AJAX_PRODUCT_FILTER,
YITH_WOOCOMMERCE_BOOKING_APPOINTMENTS,
YITH_WOOCOMMERCE_GIFT_CARDS,
YITH_WOOCOMMERCE_WISHLIST
} from "../constants";

export function YITHPlugins({ woo, wpModules }) {
const isBluehost = RuntimeSdk?.brandSettings?.brand?.includes("bluehost");
const yithPluginsMap = new Map([
[
"fc4cbc14-470d-471b-b448-c6666e5b763d",
{
title: "nfd_slug_yith_woocommerce_booking",
name: "YITH Booking and Appointment for WooCommerce",
learnMore:
isBluehost &&
"https://www.bluehost.com/help/article/yith-booking-and-appointment-for-woocommerce",
learnMore: YITH_WOOCOMMERCE_BOOKING_APPOINTMENTS,
image: booking,
},
],
Expand All @@ -43,9 +46,7 @@ export function YITHPlugins({ woo, wpModules }) {
{
title: "nfd_slug_yith_woocommerce_wishlist",
name: "YITH WooCommerce Wishlist",
learnMore:
isBluehost &&
"https://www.bluehost.com/help/article/yith-woocommerce-wishlist",
learnMore: YITH_WOOCOMMERCE_WISHLIST,
image: wishList,
},
],
Expand All @@ -54,9 +55,7 @@ export function YITHPlugins({ woo, wpModules }) {
{
title: "nfd_slug_yith_woocommerce_ajax_product_filter",
name: "YITH WooCommerce Ajax Product Filter",
learnMore:
isBluehost &&
"https://www.bluehost.com/help/article/yith-woocommerce-ajax-product-filter",
learnMore: YITH_WOOCOMMERCE_AJAX_PRODUCT_FILTER,
image: filter,
},
],
Expand All @@ -65,9 +64,7 @@ export function YITHPlugins({ woo, wpModules }) {
{
title: "nfd_slug_yith_woocommerce_gift_cards",
name: "YITH WooCommerce Gift Cards",
learnMore:
isBluehost &&
"https://www.bluehost.com/help/article/yith-woocommerce-gift-cards",
learnMore: YITH_WOOCOMMERCE_GIFT_CARDS,
image: gift,
},
],
Expand All @@ -76,9 +73,7 @@ export function YITHPlugins({ woo, wpModules }) {
{
title: "nfd_slug_yith_woocommerce_customize_myaccount_page",
name: "YITH WooCommerce Customize My Account Page",
learnMore:
isBluehost &&
"https://www.bluehost.com/help/article/yith-woocommerce-customize-my-account-page",
learnMore: YITH_WOOCOMMERCE_ACCOUNT_PAGE,
image: customizeAccount,
},
],
Expand Down
15 changes: 6 additions & 9 deletions src/configs/ProductsAndServices.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ import {
wcPluginStatusParser,
wcProductsParser,
} from "./selectors";
import { RuntimeSdk } from "../sdk/runtime";
import {
YITH_WOOCOMMERCE_BOOKING_APPOINTMENTS,
YITH_WOOCOMMERCE_GIFT_CARDS
} from "../constants";

const getUrl = (href) => {
let [page, qs] = href.split("?");
Expand All @@ -26,8 +29,6 @@ const getUrl = (href) => {
return `${page}?${query}`;
};

const isBluehost = RuntimeSdk?.brandSettings?.brand?.includes("bluehost");

function defineFeatureState() {
return {
isDisabled: (data) => data?.plugins?.isWCActive === false,
Expand Down Expand Up @@ -159,9 +160,7 @@ export const ProductsAndServicesDefinition = (props) => ({
assets: ({ isActive }) => ({
Image: CalendarIcon,
ActionIcon: isActive,
learnMoreUrl:
isBluehost &&
"https://www.bluehost.com/help/article/yith-booking-and-appointment-for-woocommerce",
learnMoreUrl: YITH_WOOCOMMERCE_BOOKING_APPOINTMENTS,
}),
text: (state) => ({
title: __(
Expand Down Expand Up @@ -217,9 +216,7 @@ export const ProductsAndServicesDefinition = (props) => ({
assets: ({ isActive }) => ({
Image: GiftIcon,
ActionIcon: isActive,
learnMoreUrl:
isBluehost &&
"https://www.bluehost.com/help/article/yith-woocommerce-gift-cards",
learnMoreUrl: YITH_WOOCOMMERCE_GIFT_CARDS,
}),
text: (state) => ({
title: __("YITH WooCommerce Gift Cards", "wp-module-ecommerce"),
Expand Down
30 changes: 12 additions & 18 deletions src/configs/YITHPlugins.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ import { MarketplaceSdk } from '../sdk/marketplace';
import { PluginsSdk } from '../sdk/plugins';
import { createPluginInstallAction } from './actions';
import { findUpsellWithName, wcPluginStatusParser } from './selectors';
import { RuntimeSdk } from '../sdk/runtime';
import {
YITH_WOOCOMMERCE_ACCOUNT_PAGE,
YITH_WOOCOMMERCE_AJAX_PRODUCT_FILTER,
YITH_WOOCOMMERCE_BOOKING_APPOINTMENTS,
YITH_WOOCOMMERCE_GIFT_CARDS,
YITH_WOOCOMMERCE_WISHLIST
} from '../constants';

export function defineFeatureState() {
return {
Expand All @@ -28,8 +34,6 @@ export function defineFeatureState() {
};
}

const isBluehost = RuntimeSdk?.brandSettings?.brand?.includes('bluehost');

export const YITHPluginsDefinitions = (props) => ({
dataDependencies: {
plugins: async () => PluginsSdk.queries.status('all'),
Expand All @@ -43,9 +47,7 @@ export const YITHPluginsDefinitions = (props) => ({
assets: () => ({
Image: Booking,
ActionIcon: null,
learnMoreUrl:
isBluehost &&
'https://www.bluehost.com/help/article/yith-booking-and-appointment-for-woocommerce',
learnMoreUrl: YITH_WOOCOMMERCE_BOOKING_APPOINTMENTS,
}),
text: ({ isActive }) => ({
title: __(
Expand Down Expand Up @@ -120,9 +122,7 @@ export const YITHPluginsDefinitions = (props) => ({
name: 'nfd_slug_yith_woocommerce_wishlist',
assets: () => ({
Image: WishList,
learnMoreUrl:
isBluehost &&
'https://www.bluehost.com/help/article/yith-woocommerce-wishlist',
learnMoreUrl: YITH_WOOCOMMERCE_WISHLIST,
}),
text: ({ isActive }) => ({
title: __('YITH WooCommerce Wishlist', 'wp-module-ecommerce'),
Expand Down Expand Up @@ -158,9 +158,7 @@ export const YITHPluginsDefinitions = (props) => ({
name: 'nfd_slug_yith_woocommerce_ajax_product_filter',
assets: () => ({
Image: Filter,
learnMoreUrl:
isBluehost &&
'https://www.bluehost.com/help/article/yith-woocommerce-ajax-product-filter',
learnMoreUrl: YITH_WOOCOMMERCE_AJAX_PRODUCT_FILTER,
}),
text: ({ isActive }) => ({
title: __(
Expand Down Expand Up @@ -201,9 +199,7 @@ export const YITHPluginsDefinitions = (props) => ({
name: 'nfd_slug_yith_woocommerce_gift_cards',
assets: () => ({
Image: Gift,
learnMoreUrl:
isBluehost &&
'https://www.bluehost.com/help/article/yith-woocommerce-gift-cards',
learnMoreUrl: YITH_WOOCOMMERCE_GIFT_CARDS,
}),
text: ({ isActive }) => ({
title: __('YITH WooCommerce Gift Cards', 'wp-module-ecommerce'),
Expand Down Expand Up @@ -241,9 +237,7 @@ export const YITHPluginsDefinitions = (props) => ({
name: 'nfd_slug_yith_woocommerce_customize_myaccount_page',
assets: () => ({
Image: CustomizeAccount,
learnMoreUrl:
isBluehost &&
'https://www.bluehost.com/help/article/yith-woocommerce-customize-my-account-page',
learnMoreUrl: YITH_WOOCOMMERCE_ACCOUNT_PAGE,
}),
text: ({ isActive }) => ({
title: __(
Expand Down
5 changes: 5 additions & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const YITH_WOOCOMMERCE_BOOKING_APPOINTMENTS = "https://docs.yithemes.com/yith-woocommerce-booking-extended/";
export const YITH_WOOCOMMERCE_WISHLIST = "https://docs.yithemes.com/yith-woocommerce-wishlist-extended/";
export const YITH_WOOCOMMERCE_AJAX_PRODUCT_FILTER = "https://docs.yithemes.com/yith-woocommerce-ajax-product-filter-extended/";
export const YITH_WOOCOMMERCE_GIFT_CARDS = "https://docs.yithemes.com/yith-woocommerce-gift-cards-extended/";
export const YITH_WOOCOMMERCE_ACCOUNT_PAGE = "https://docs.yithemes.com/yith-woocommerce-customize-myaccount-page-extended/";
Loading