-
Notifications
You must be signed in to change notification settings - Fork 25
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
feature / bookings ctb added in pages and posts #1183
Changes from 3 commits
ea7ffbb
cd1ddde
9186cfa
b026e5d
5038679
26bd9ce
b914f43
3afc3fa
eba7a8c
1faef30
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { Button, Card, Title } from '@newfold/ui-component-library'; | ||
import { ReactComponent as TransformLogo } from '../../../../assets/svg/transformStore.svg'; | ||
|
||
const TransformStore = () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Change component name to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. updated |
||
return ( | ||
<Card | ||
className="wppbh-app-transform nfd-border-0 nfd-border-t md:nfd-border-t-0 nfd-shadow-none hover:nfd-bg-[#F2F9FE]" | ||
style={ { | ||
borderRadius: 0, | ||
} } | ||
> | ||
<Card.Content> | ||
<TransformLogo /> | ||
<Title size="4" className="nfd-leading-normal nfd-my-4"> | ||
{ __( 'Transform your store!', 'wp-plugin-bluehost' ) } | ||
</Title> | ||
<p> | ||
{ __( | ||
'Our eCommerce bundle includes a comprehensive suite of advanced tools designed to boost the performance of your WooCommerce store.', | ||
'wp-plugin-bluehost' | ||
) } | ||
</p> | ||
</Card.Content> | ||
<div className="nfd-flex nfd-justify-end nfd-gap-6 nfd-items-center"> | ||
<a href="admin.php?page=bluehost#/marketplace/product/6049dddb-1303-4c41-b3c0-242881697860"> | ||
<Button variant="secondary"> | ||
{ __( 'Learn More', 'wp-plugin-bluehost' ) } | ||
</Button> | ||
</a> | ||
</div> | ||
</Card> | ||
); | ||
}; | ||
|
||
export default TransformStore; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ import BlogPosts from './blogPosts'; | |
import BookingAndAppointments from './bookingAndAppointments'; | ||
import ProductsPages from './ProductsPages'; | ||
import AppStore from '../../data/store'; | ||
import TransformStore from './TransformStore'; | ||
|
||
const PagesAndPosts = () => { | ||
const { store } = useContext( AppStore ); | ||
|
@@ -78,9 +79,11 @@ const PagesAndPosts = () => { | |
<ProductsPages /> | ||
) } | ||
{ window.NewfoldRuntime.isYithBookingActive && | ||
window.NewfoldRuntime.isWoocommerceActive && ( | ||
<BookingAndAppointments /> | ||
) } | ||
window.NewfoldRuntime.isWoocommerceActive ? ( | ||
<BookingAndAppointments /> | ||
) : ( | ||
<TransformStore /> | ||
) } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Jira story requirement states:
Meaning: this card (eComm addon CTB) is intended to be shown to users who do not have the e-commerce addon in their plan (ecommerce entitlement). In this condition, we are not considering whether they have the addon or not. The condition should be:
You can check for the e-commerce entitlement using the Newfold runtime: import { NewfoldRuntime } from '@newfold-labs/wp-module-runtime';
NewfoldRuntime.hasCapability( 'isEcommerce' ) // Bool Or you can: window.NewfoldRuntime.capabilities.isEcommerce // Bool | Undefined Be careful with the second one because it can return There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. updated fix , but ecommerce entitlement we check with hasYithExtended. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the reason for not using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. isEcommerce refers to whether or not WooCommerce plugin is active, has nothing to do with the commerce addon. |
||
</div> | ||
</Container> | ||
</Page> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,68 @@ | ||
describe( 'Pages & Posts', function () { | ||
describe('Pages & Posts', function () { | ||
let NewfoldRuntime; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed |
||
|
||
before( () => { | ||
before(() => { | ||
cy.visit( | ||
'/wp-admin/admin.php?page=' + | ||
Cypress.env( 'pluginId' ) + | ||
'#/pages-and-posts' | ||
Cypress.env('pluginId') + | ||
'#/pages-and-posts' | ||
); | ||
cy.window() | ||
.its( 'NewfoldRuntime' ) | ||
.then( ( data ) => { | ||
.its('NewfoldRuntime') | ||
.then((data) => { | ||
NewfoldRuntime = data; | ||
} ); | ||
}); | ||
cy.injectAxe(); | ||
} ); | ||
}); | ||
|
||
it( 'Pages & Posts Exists', () => { | ||
cy.get( '.wppbh-app-pagesAndPosts-page' ) | ||
.contains( 'Pages & Posts' ) | ||
it('Pages & Posts Exists', () => { | ||
cy.get('.wppbh-app-pagesAndPosts-page') | ||
.contains('Pages & Posts') | ||
.scrollIntoView() | ||
.should( 'be.visible' ); | ||
} ); | ||
.should('be.visible'); | ||
}); | ||
|
||
it( 'site pages Exists', () => { | ||
cy.get( '.wppbh-app-site-page' ) | ||
.findByText( 'Site Pages' ) | ||
.should( 'exist' ); | ||
cy.get( '.wppbh-app-site-page' ) | ||
.find( 'a[href="edit.php?post_type=page"]' ) | ||
it('site pages Exists', () => { | ||
cy.get('.wppbh-app-site-page') | ||
.findByText('Site Pages') | ||
.should('exist'); | ||
cy.get('.wppbh-app-site-page') | ||
.find('a[href="edit.php?post_type=page"]') | ||
.click(); | ||
cy.url().should( 'include', 'edit.php?post_type=page' ); | ||
cy.go( 'back' ); | ||
cy.url().should('include', 'edit.php?post_type=page'); | ||
cy.go('back'); | ||
|
||
cy.get( '.wppbh-app-site-page' ) | ||
.find( 'a[href="post-new.php?post_type=page"] Button' ) | ||
cy.get('.wppbh-app-site-page') | ||
.find('a[href="post-new.php?post_type=page"] Button') | ||
.click(); | ||
cy.url().should( 'include', 'post-new.php?post_type=page' ); | ||
cy.go( 'back' ); | ||
} ); | ||
cy.url().should('include', 'post-new.php?post_type=page'); | ||
cy.go('back'); | ||
}); | ||
|
||
it( 'Blog posts Exists', () => { | ||
cy.get( '.wppbh-app-blog-posts' ) | ||
.findByText( 'Blog Posts' ) | ||
.should( 'exist' ); | ||
cy.get( '.wppbh-app-blog-posts' ).find( 'a[href="edit.php"]' ).click(); | ||
cy.url().should( 'include', 'edit.php' ); | ||
cy.go( 'back' ); | ||
it('Blog posts Exists', () => { | ||
cy.get('.wppbh-app-blog-posts') | ||
.findByText('Blog Posts') | ||
.should('exist'); | ||
cy.get('.wppbh-app-blog-posts').find('a[href="edit.php"]').click(); | ||
cy.url().should('include', 'edit.php'); | ||
cy.go('back'); | ||
|
||
cy.get( '.wppbh-app-blog-posts' ) | ||
.get( 'a[href="post-new.php"] Button' ) | ||
cy.get('.wppbh-app-blog-posts') | ||
.get('a[href="post-new.php"] Button') | ||
.click(); | ||
cy.url().should( 'include', 'post-new.php' ); | ||
cy.go( 'back' ); | ||
} ); | ||
cy.url().should('include', 'post-new.php'); | ||
cy.go('back'); | ||
}); | ||
|
||
it( 'Bookings & Appointments Exists', () => { | ||
it('Bookings & Appointments Exists', () => { | ||
if ( | ||
NewfoldRuntime.isYithBookingActive && | ||
NewfoldRuntime.isWoocommerceActive | ||
) { | ||
cy.get( '.wppbh-app-bookings' ) | ||
.findByText( 'Bookings & Appointments' ) | ||
.should( 'exist' ); | ||
cy.get( '.wppbh-app-bookings' ) | ||
cy.get('.wppbh-app-bookings') | ||
.findByText('Bookings & Appointments') | ||
.should('exist'); | ||
cy.get('.wppbh-app-bookings') | ||
.find( | ||
'a[href="edit.php?post_type=yith_booking&yith-plugin-fw-panel-skip-redirect=1"]' | ||
) | ||
|
@@ -72,9 +72,9 @@ describe( 'Pages & Posts', function () { | |
'include', | ||
'edit.php?post_type=yith_booking&yith-plugin-fw-panel-skip-redirect=1' | ||
); | ||
cy.go( 'back' ); | ||
cy.go('back'); | ||
|
||
cy.get( '.wppbh-app-bookings' ) | ||
cy.get('.wppbh-app-bookings') | ||
.find( | ||
'a[href="edit.php?post_type=yith_booking&yith-plugin-fw-panel-skip-redirect=1"] Button' | ||
) | ||
|
@@ -84,30 +84,43 @@ describe( 'Pages & Posts', function () { | |
'include', | ||
'edit.php?post_type=yith_booking&yith-plugin-fw-panel-skip-redirect=1' | ||
); | ||
cy.go( 'back' ); | ||
cy.go('back'); | ||
} else { | ||
cy.findByText( 'Bookings & Appointments' ).should( 'not.exist' ); | ||
cy.get('.wppbh-app-transform') | ||
.findByText('Transform your store!') | ||
.should('exist'); | ||
cy.get('.wppbh-app-transform') | ||
.find( | ||
'a[href="admin.php?page=bluehost#/marketplace/product/6049dddb-1303-4c41-b3c0-242881697860"]' | ||
) | ||
.first() | ||
.click(); | ||
cy.url().should( | ||
'include', | ||
'admin.php?page=bluehost#/marketplace/product/6049dddb-1303-4c41-b3c0-242881697860' | ||
); | ||
cy.go('back'); | ||
} | ||
} ); | ||
}); | ||
|
||
it( 'Products Exists', () => { | ||
if ( NewfoldRuntime.isWoocommerceActive ) { | ||
cy.get( '.wppbh-app-products' ) | ||
.findByText( 'Products' ) | ||
.should( 'exist' ); | ||
cy.get( '.wppbh-app-products' ) | ||
.find( 'a[href="edit.php?post_type=product"]' ) | ||
it('Products Exists', () => { | ||
if (NewfoldRuntime.isWoocommerceActive) { | ||
cy.get('.wppbh-app-products') | ||
.findByText('Products') | ||
.should('exist'); | ||
cy.get('.wppbh-app-products') | ||
.find('a[href="edit.php?post_type=product"]') | ||
.click(); | ||
cy.url().should( 'include', 'edit.php?post_type=product' ); | ||
cy.go( 'back' ); | ||
cy.url().should('include', 'edit.php?post_type=product'); | ||
cy.go('back'); | ||
|
||
cy.get( '.wppbh-app-products' ) | ||
.find( 'a[href="post-new.php?post_type=product"] Button' ) | ||
cy.get('.wppbh-app-products') | ||
.find('a[href="post-new.php?post_type=product"] Button') | ||
.click(); | ||
cy.url().should( 'include', 'post-new.php?post_type=product' ); | ||
cy.go( 'back' ); | ||
cy.url().should('include', 'post-new.php?post_type=product'); | ||
cy.go('back'); | ||
} else { | ||
cy.findByText( 'Products' ).should( 'not.exist' ); | ||
cy.findByText('Products').should('not.exist'); | ||
} | ||
} ); | ||
} ); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the
Assets
path alias to simplify the import path.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tried it but tests are failing as it is not able to find the path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I inspected the Vector and it looks like the Vector was converted (By the designer) from an image, which increased the size of the asset from 2kb to 45kb with no added value in our use case.
I think it's best we convert this back from
svg
topng
. We also need to properly name the asset to tie back the component name.I created a branch from your PR and made some changes to simplify the import and component naming. Check this commit: b914f43