diff --git a/libraries/common/collections/media-providers/Vimeo.js b/libraries/common/collections/media-providers/Vimeo.js index 3a82b80382..02441d8f39 100644 --- a/libraries/common/collections/media-providers/Vimeo.js +++ b/libraries/common/collections/media-providers/Vimeo.js @@ -71,7 +71,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 b998badb1a..a2e327b8e6 100644 --- a/libraries/common/collections/media-providers/YouTube.js +++ b/libraries/common/collections/media-providers/YouTube.js @@ -32,6 +32,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; 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/favorites/components/Item/Item.jsx b/libraries/engage/favorites/components/Item/Item.jsx index 0970fb1531..98d447c500 100644 --- a/libraries/engage/favorites/components/Item/Item.jsx +++ b/libraries/engage/favorites/components/Item/Item.jsx @@ -178,7 +178,7 @@ const styles = { /** * Favorite Item component - * @return {JSX} + * @return {JSX.Element} */ const FavoriteItem = ({ listId, @@ -321,17 +321,17 @@ const FavoriteItem = ({ return ( -
+
- + -
+
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-gmd/pages/Category/components/Content/index.jsx b/themes/theme-gmd/pages/Category/components/Content/index.jsx index 45a544314a..1abed10cdb 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.hasChildren Whether the category has children. + * @param {boolean} props.hasProducts Whether the category has products. * @returns {JSX} */ -const CategoryContent = ({ categoryId, 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, + 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..250fc7822a 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.hasChildren Whether the category has children. + * @param {boolean} props.hasProducts Whether the category has products. * @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, 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); });