From 9cd7d5c5bc1d06062cb68ab944f484d5fb46ff51 Mon Sep 17 00:00:00 2001 From: Sascha Krist Date: Tue, 1 Oct 2024 15:47:43 +0200 Subject: [PATCH 1/7] CURB-4463 Adjust filterbar visibility --- .../Category/components/Content/index.jsx | 48 ++++++++++++------- .../Category/components/Content/index.jsx | 45 ++++++++++------- 2 files changed, 61 insertions(+), 32 deletions(-) diff --git a/themes/theme-gmd/pages/Category/components/Content/index.jsx b/themes/theme-gmd/pages/Category/components/Content/index.jsx index 45a544314a..839a66084d 100644 --- a/themes/theme-gmd/pages/Category/components/Content/index.jsx +++ b/themes/theme-gmd/pages/Category/components/Content/index.jsx @@ -3,6 +3,7 @@ import PropTypes from 'prop-types'; import ProductFilters from 'Components/ProductFilters'; import { VIEW_CONTENT } from '@shopgate/engage/core'; import { SurroundPortals } from '@shopgate/engage/components'; +import { hasNewServices } from '@shopgate/engage/core/helpers'; import ProductsContent from '../ProductsContent'; import Empty from '../Empty'; import CategoryListContent from '../CategoryListContent'; @@ -10,32 +11,47 @@ import connect from './connector'; import AppBar from '../AppBar'; /** - * @param {Object} props.categoryId The category id. + * @param {Object} props The component props. + * @param {string} props.categoryId The category id. + * @param {boolean} props.hasProducts Whether the category has products. + * @param {boolean} props.hasChildren Whether the category has children. * @returns {JSX} */ -const CategoryContent = ({ categoryId, hasProducts }) => ( - - - - - +const CategoryContent = ({ categoryId, hasProducts, hasChildren }) => { + // Show filter logic for old services + let showFilters = hasProducts && !hasChildren; + // Show filter logic for new services + if (hasNewServices()) { + showFilters = hasProducts; + } - - - - -); + return ( + + + + + + + + + + + + ); +}; CategoryContent.propTypes = { categoryId: PropTypes.string.isRequired, + hasChildren: PropTypes.bool, hasProducts: PropTypes.bool, }; CategoryContent.defaultProps = { + hasChildren: false, hasProducts: false, }; diff --git a/themes/theme-ios11/pages/Category/components/Content/index.jsx b/themes/theme-ios11/pages/Category/components/Content/index.jsx index 6bb4dba1d6..9bba5f1026 100644 --- a/themes/theme-ios11/pages/Category/components/Content/index.jsx +++ b/themes/theme-ios11/pages/Category/components/Content/index.jsx @@ -3,6 +3,7 @@ import PropTypes from 'prop-types'; import ProductFilters from 'Components/ProductFilters'; import { VIEW_CONTENT } from '@shopgate/engage/core'; import { SurroundPortals } from '@shopgate/engage/components'; +import { hasNewServices } from '@shopgate/engage/core/helpers'; import ProductsContent from '../ProductsContent'; import Empty from '../Empty'; import CategoryListContent from '../CategoryListContent'; @@ -10,25 +11,37 @@ import connect from './connector'; import AppBar from '../AppBar'; /** - * @param {Object} props.categoryId The category id. + * @param {Object} props The component props. + * @param {string} props.categoryId The category id. + * @param {boolean} props.hasProducts Whether the category has products. + * @param {boolean} props.hasChildren Whether the category has children. * @returns {JSX} */ -const CategoryContent = ({ categoryId, hasChildren, hasProducts }) => ( - - - - - +const CategoryContent = ({ categoryId, hasChildren, hasProducts }) => { + // Show filter logic for old services + let showFilters = hasProducts && !hasChildren; + // Show filter logic for new services + if (hasNewServices()) { + showFilters = hasProducts; + } - - - - -); + return ( + + + + + + + + + + + ); +}; CategoryContent.propTypes = { categoryId: PropTypes.string.isRequired, From 5645a10870d94875caa20bef365e1bf13bf276d4 Mon Sep 17 00:00:00 2001 From: aylinuenal Date: Wed, 2 Oct 2024 12:06:03 +0200 Subject: [PATCH 2/7] CURB-4290 add custom classes to favorite item --- libraries/engage/favorites/components/Item/Item.jsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/engage/favorites/components/Item/Item.jsx b/libraries/engage/favorites/components/Item/Item.jsx index 62d370de33..7fe2345327 100644 --- a/libraries/engage/favorites/components/Item/Item.jsx +++ b/libraries/engage/favorites/components/Item/Item.jsx @@ -168,7 +168,7 @@ const styles = { /** * Favorite Item component - * @return {JSX} + * @return {JSX.Element} */ const FavoriteItem = ({ listId, @@ -311,17 +311,17 @@ const FavoriteItem = ({ return ( -
+
- + -
+
Date: Thu, 3 Oct 2024 11:37:14 +0200 Subject: [PATCH 3/7] CURB-4290 add additional custom class to favorite item --- libraries/engage/favorites/components/Item/Item.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/engage/favorites/components/Item/Item.jsx b/libraries/engage/favorites/components/Item/Item.jsx index 7fe2345327..cac3a92842 100644 --- a/libraries/engage/favorites/components/Item/Item.jsx +++ b/libraries/engage/favorites/components/Item/Item.jsx @@ -313,7 +313,7 @@ const FavoriteItem = ({
Date: Fri, 4 Oct 2024 11:07:24 +0200 Subject: [PATCH 4/7] Merge pull request #1283 from shopgate/CURB-4483-prevent-click-on-youtube-icon Fixed an issue when YouTube or Video logos where tapped inside iframes (cherry picked from commit 37c9ef0f73619deac53c36b5c7190900d9653f48) --- libraries/common/collections/media-providers/Vimeo.js | 5 ++++- libraries/common/collections/media-providers/YouTube.js | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libraries/common/collections/media-providers/Vimeo.js b/libraries/common/collections/media-providers/Vimeo.js index 6f71e3d34d..1ec0dad969 100644 --- a/libraries/common/collections/media-providers/Vimeo.js +++ b/libraries/common/collections/media-providers/Vimeo.js @@ -60,7 +60,10 @@ class VimeoMediaProvider extends MediaProvider { const players = []; - iframes.forEach((iframe) => { + iframes.forEach((iframe, index) => { + // Block clicks on Vimeo icon + iframes[index].sandbox = 'allow-forms allow-scripts allow-pointer-lock allow-same-origin allow-top-navigation'; + this.responsify(iframe); players.push(new window.Vimeo.Player(iframe)); }); diff --git a/libraries/common/collections/media-providers/YouTube.js b/libraries/common/collections/media-providers/YouTube.js index 9006661db9..67c312956d 100644 --- a/libraries/common/collections/media-providers/YouTube.js +++ b/libraries/common/collections/media-providers/YouTube.js @@ -21,6 +21,9 @@ class YouTubeMediaProvider extends MediaProvider { // Update the video urls to enable stopping videos via the event API. iframes.forEach((iframe, index) => { + // Block clicks on YouTube icon + iframes[index].sandbox = 'allow-forms allow-scripts allow-pointer-lock allow-same-origin allow-top-navigation'; + this.responsify(iframe); const { src } = iframe; From 806dae2ee97dbc8cff240f8c5ed1cbdcc61bba22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frithjof=20Klo=CC=88s?= Date: Fri, 4 Oct 2024 12:24:27 +0200 Subject: [PATCH 5/7] Added human readable class to favlist item title --- libraries/engage/favorites/components/Item/Item.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/engage/favorites/components/Item/Item.jsx b/libraries/engage/favorites/components/Item/Item.jsx index c0312683c3..ea50f9eb99 100644 --- a/libraries/engage/favorites/components/Item/Item.jsx +++ b/libraries/engage/favorites/components/Item/Item.jsx @@ -331,7 +331,7 @@ const FavoriteItem = ({ Date: Fri, 4 Oct 2024 17:29:33 +0200 Subject: [PATCH 6/7] CURB-4263 Fixed unit test and updated snapshots --- .../engage/components/__mocks__/index.js | 2 +- .../__snapshots__/StoreDetails.spec.jsx.snap | 6 +- .../__snapshots__/Description.spec.jsx.snap | 4 +- .../ChipLayout/__snapshots__/spec.jsx.snap | 4 +- .../More/__snapshots__/index.spec.jsx.snap | 208 ++---------- .../__snapshots__/index.spec.jsx.snap | 308 ++++-------------- .../More/components/UserMenu/index.spec.jsx | 7 +- 7 files changed, 121 insertions(+), 418 deletions(-) diff --git a/libraries/engage/components/__mocks__/index.js b/libraries/engage/components/__mocks__/index.js index ee33df194a..c678579965 100644 --- a/libraries/engage/components/__mocks__/index.js +++ b/libraries/engage/components/__mocks__/index.js @@ -101,7 +101,7 @@ export const TaxDisclaimer = () => 'TaxDisclaimer'; // HELPERS export const I18n = { - Text: () => 'I18n.Text', + Text: ({ string }) => string, Placeholder: () => null, Price: () => null, }; diff --git a/libraries/engage/locations/components/StoreList/__tests__/__snapshots__/StoreDetails.spec.jsx.snap b/libraries/engage/locations/components/StoreList/__tests__/__snapshots__/StoreDetails.spec.jsx.snap index b391aa87f2..899861f98c 100644 --- a/libraries/engage/locations/components/StoreList/__tests__/__snapshots__/StoreDetails.spec.jsx.snap +++ b/libraries/engage/locations/components/StoreList/__tests__/__snapshots__/StoreDetails.spec.jsx.snap @@ -37,7 +37,7 @@ exports[`engage > locations > StoreList > StoreDetails should render as expected className="css-1lr3f02" string="locations.hours_details" > - I18n.Text + locations.hours_details
locations > StoreList > StoreDetails should render as expected className="css-1lr3f02" string="locations.phone" > - I18n.Text + locations.phone @@ -200,7 +200,7 @@ exports[`engage > locations > StoreList > StoreDetails should render as expected className="css-1lr3f02" string="locations.map_open" > - I18n.Text + locations.map_open diff --git a/libraries/engage/product/components/Description/__tests__/__snapshots__/Description.spec.jsx.snap b/libraries/engage/product/components/Description/__tests__/__snapshots__/Description.spec.jsx.snap index 95601bf22c..876acc09a7 100644 --- a/libraries/engage/product/components/Description/__tests__/__snapshots__/Description.spec.jsx.snap +++ b/libraries/engage/product/components/Description/__tests__/__snapshots__/Description.spec.jsx.snap @@ -45,7 +45,7 @@ exports[` should not render if no data is available 1`] = ` - I18n.Text + product.description_heading
should render description if data is available 1`] = ` - I18n.Text + product.description_heading
should render with one chip 1`] = ` - I18n.Text + more
@@ -338,7 +338,7 @@ exports[` should render with two chips 1`] = ` - I18n.Text + more
diff --git a/themes/theme-ios11/pages/More/__snapshots__/index.spec.jsx.snap b/themes/theme-ios11/pages/More/__snapshots__/index.spec.jsx.snap index e66e6fc116..9ba1695930 100644 --- a/themes/theme-ios11/pages/More/__snapshots__/index.spec.jsx.snap +++ b/themes/theme-ios11/pages/More/__snapshots__/index.spec.jsx.snap @@ -1101,186 +1101,50 @@ exports[` should render as expected when the user is not logged in 1`] = data-test-id="userMenu" > -
    - -
  • - - -
    - - - -
    - -
    -
  • -
    - + + + + + -
  • - - -
    - - - -
    - -
    -
  • -
    -
+ login.signup + + + +
diff --git a/themes/theme-ios11/pages/More/components/UserMenu/__snapshots__/index.spec.jsx.snap b/themes/theme-ios11/pages/More/components/UserMenu/__snapshots__/index.spec.jsx.snap index 4af8bc3522..6cecd11015 100644 --- a/themes/theme-ios11/pages/More/components/UserMenu/__snapshots__/index.spec.jsx.snap +++ b/themes/theme-ios11/pages/More/components/UserMenu/__snapshots__/index.spec.jsx.snap @@ -329,132 +329,50 @@ exports[` should render as expected when the user is logged out and data-test-id="userMenu" > -
    - -
  • - - - - - -
  • -
    - + + + + + -
  • - - - - - -
  • -
    -
+ login.signup + + + +
@@ -527,132 +445,50 @@ exports[` should render as expected when the user is logged out and data-test-id="userMenu" > -
    - -
  • - - - - - -
  • -
    - + + + + + -
  • - - - - - -
  • -
    -
+ login.signup + + + +
diff --git a/themes/theme-ios11/pages/More/components/UserMenu/index.spec.jsx b/themes/theme-ios11/pages/More/components/UserMenu/index.spec.jsx index 7b838ac3a5..ca9d8f7d4f 100644 --- a/themes/theme-ios11/pages/More/components/UserMenu/index.spec.jsx +++ b/themes/theme-ios11/pages/More/components/UserMenu/index.spec.jsx @@ -6,11 +6,14 @@ import { isUserLoginDisabled } from '@shopgate/pwa-common/selectors/user'; import mockRenderOptions from '@shopgate/pwa-common/helpers/mocks/mockRenderOptions'; import UserMenu from './index'; +jest.mock('@shopgate/engage/components'); + jest.mock('@shopgate/pwa-common/selectors/user', () => ({ isUserLoginDisabled: jest.fn().mockReturnValue(false), })); jest.mock('@shopgate/pwa-common/components/Link', () => function Link({ children }) { return children; }); +jest.mock('@shopgate/pwa-ui-shared/Sheet', () => null); const store = createMockStore(); @@ -37,9 +40,9 @@ describe('', () => { expect(wrapper).toMatchSnapshot(); const links = wrapper.find('Link'); - expect(links.at(0).text()).toBe('login.button'); + expect(links.find('Text').at(0).prop('string')).toBe('login.button'); expect(links.at(0).prop('disabled')).toBe(false); - expect(links.at(1).text()).toBe('login.signup'); + expect(links.find('Text').at(1).prop('string')).toBe('login.signup'); expect(links.at(1).prop('disabled')).toBe(false); }); From fa5d7a0ca4b9ef75ede1c5a63c3eb5da4edb3efb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frithjof=20Klo=CC=88s?= Date: Mon, 7 Oct 2024 10:20:19 +0200 Subject: [PATCH 7/7] CURB-4463 Small improvements - re-arranged prop order --- themes/theme-gmd/pages/Category/components/Content/index.jsx | 4 ++-- .../theme-ios11/pages/Category/components/Content/index.jsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/themes/theme-gmd/pages/Category/components/Content/index.jsx b/themes/theme-gmd/pages/Category/components/Content/index.jsx index 839a66084d..1abed10cdb 100644 --- a/themes/theme-gmd/pages/Category/components/Content/index.jsx +++ b/themes/theme-gmd/pages/Category/components/Content/index.jsx @@ -13,11 +13,11 @@ import AppBar from '../AppBar'; /** * @param {Object} props The component props. * @param {string} props.categoryId The category id. - * @param {boolean} props.hasProducts Whether the category has products. * @param {boolean} props.hasChildren Whether the category has children. + * @param {boolean} props.hasProducts Whether the category has products. * @returns {JSX} */ -const CategoryContent = ({ categoryId, hasProducts, hasChildren }) => { +const CategoryContent = ({ categoryId, hasChildren, hasProducts }) => { // Show filter logic for old services let showFilters = hasProducts && !hasChildren; // Show filter logic for new services diff --git a/themes/theme-ios11/pages/Category/components/Content/index.jsx b/themes/theme-ios11/pages/Category/components/Content/index.jsx index 9bba5f1026..250fc7822a 100644 --- a/themes/theme-ios11/pages/Category/components/Content/index.jsx +++ b/themes/theme-ios11/pages/Category/components/Content/index.jsx @@ -13,8 +13,8 @@ import AppBar from '../AppBar'; /** * @param {Object} props The component props. * @param {string} props.categoryId The category id. - * @param {boolean} props.hasProducts Whether the category has products. * @param {boolean} props.hasChildren Whether the category has children. + * @param {boolean} props.hasProducts Whether the category has products. * @returns {JSX} */ const CategoryContent = ({ categoryId, hasChildren, hasProducts }) => {