diff --git a/.github/actions/setup_ubuntu/action.yml b/.github/actions/setup_ubuntu/action.yml index 9f4cbfcb31..73e5d6db77 100644 --- a/.github/actions/setup_ubuntu/action.yml +++ b/.github/actions/setup_ubuntu/action.yml @@ -28,6 +28,8 @@ runs: node ./scripts/check-dependencies.js # Install Snyk CLI + # TODO: Ticket W-12425059. Revisit Snyk CLI integration to monitor manifest files on generated projects. + # TODO: Latest Snyk CLI version is currently failing on npm i. We use the alternative Snyk GitHub integration. # sudo npm install -g snyk # Install Lighthouse CI CLI diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e757702007..912f26a32b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -191,11 +191,13 @@ jobs: with: path: packages/pwa-kit-create-app/local-npm-repo/verdaccio.log -# - name: Audit Generated Project -# if: env.IS_NOT_FORK == 'true' && env.IS_TEMPLATE_FROM_RETAIL_REACT_APP == 'true' && env.DEVELOP == 'true' -# uses: "./.github/actions/snyk" -# with: -# snyk_token: ${{ secrets.SNYK_TOKEN }} + # TODO: Ticket W-12425059. Revisit Snyk CLI integration to monitor manifest files on generated projects. + # TODO: Update the SNYK_TOKEN stored in GitHub with a token generated from the proper Snyk org. + # - name: Audit Generated Project + # if: env.IS_NOT_FORK == 'true' && env.IS_TEMPLATE_FROM_RETAIL_REACT_APP == 'true' && env.DEVELOP == 'true' + # uses: "./.github/actions/snyk" + # with: + # snyk_token: ${{ secrets.SNYK_TOKEN }} - name: Send metrics to Datadog if: env.IS_NOT_FORK == 'true' && env.IS_TEMPLATE_FROM_RETAIL_REACT_APP == 'true' diff --git a/packages/template-retail-react-app/app/components/experience/image-tile/index.jsx b/packages/template-retail-react-app/app/components/experience/image-tile/index.jsx new file mode 100644 index 0000000000..36b75fe520 --- /dev/null +++ b/packages/template-retail-react-app/app/components/experience/image-tile/index.jsx @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2023, Salesforce, Inc. + * All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause + */ +import React from 'react' +import PropTypes from 'prop-types' +import {Image} from '@chakra-ui/react' + +/** + * Simple ImageTile component that can be used inside any Layout component. + * @param image Object containing the image url, _type and focalPoint. + * @returns {JSX.Element} + */ +const ImageTile = ({image}) => { + return ( +
+
+ + + + {image?.alt} + +
+
+ ) +} + +ImageTile.propTypes = { + image: PropTypes.shape({ + _type: PropTypes.string, + focalPoint: PropTypes.shape({ + _type: PropTypes.string, + x: PropTypes.number, + y: PropTypes.number + }), + url: PropTypes.string, + alt: PropTypes.string, + src: PropTypes.string || PropTypes.object + }) +} + +export default ImageTile diff --git a/packages/template-retail-react-app/app/components/experience/image-tile/index.test.js b/packages/template-retail-react-app/app/components/experience/image-tile/index.test.js new file mode 100644 index 0000000000..b323371005 --- /dev/null +++ b/packages/template-retail-react-app/app/components/experience/image-tile/index.test.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2023, salesforce.com, inc. + * All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause + */ +import React from 'react' +import {renderWithProviders} from '../../../utils/test-utils' +import ImageTile from './index' +import {getAssetUrl} from 'pwa-kit-react-sdk/ssr/universal/utils' + +test('ImageTile renders without errors', () => { + const {getByTestId} = renderWithProviders( + + ) + + const image = getByTestId('image-tile-image') + + expect(image).toHaveAttribute('src', `${getAssetUrl('static/img/hero.png')}`) +}) diff --git a/packages/test-commerce-sdk-react/app/components/_app-config/index.tsx b/packages/test-commerce-sdk-react/app/components/_app-config/index.tsx index 7f80b9d8d3..a42deedce5 100644 --- a/packages/test-commerce-sdk-react/app/components/_app-config/index.tsx +++ b/packages/test-commerce-sdk-react/app/components/_app-config/index.tsx @@ -30,10 +30,9 @@ const AppConfig = (props: AppConfigProps): ReactElement => { return (