Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const SKUSelectorWrapper: StorefrontFC = props => {
const valuesFromContext = useProduct()
const dispatch = useProductDispatch()
const { imageHeight, imageWidth } = useResponsiveValues(
pick(['imageHeight', 'imageWidth'], props)
)
const skuItems =
props.skuItems != null
? props.skuItems
: valuesFromContext?.product?.items ?? []
const skuSelected =
props.skuSelected != null
? props.skuSelected
: valuesFromContext.selectedItem
const shouldNotShow =
skuItems.length === 0 ||
!skuSelected?.variations ||
const ProductImagesWrapper = props => {
const valuesFromContext = useProduct() || {}
const { aspectRatio, maxHeight, showNavigationArrows, showPaginationDots } = useResponsiveValues(
pick(['aspectRatio', 'maxHeight', 'showNavigationArrows', 'showPaginationDots'], props)
)
const { selectedItem } = valuesFromContext
const images = useMemo(
() =>
props.images != null
? props.images
: map(generateImageConfig, path(['images'], selectedItem) || []),
[props.images, selectedItem]
)
const videos = useMemo(
() =>
props.videos != null
? props.videos
: path(['videos'], selectedItem) || [],