Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function ErrorMessage() {
const handles = useCssHandles(CSS_HANDLES)
const className = `${handles.errorMessage} c-danger`
return (
{message => (
<>{' '}{/* this space is necessary */}
<span>
{message}
</span>
)}
)
}
const AutocompleteInput = ({
onClearInput,
compactMode,
value,
hasIconLeft,
iconBlockClass,
iconClasses,
autoFocus,
...restProps
}) => {
const inputRef = useRef(null)
const handles = useCssHandles(CSS_HANDLES)
useEffect(() => {
const changeClassInput = () => {
if (compactMode) {
inputRef.current.placeholder = ''
inputRef.current.classList.add(handles.paddingInput)
}
}
changeClassInput()
autoFocus && inputRef.current.focus()
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])
const suffix = (
subhead,
callToActionMode,
callToActionText,
callToActionUrl,
textPosition,
textAlignment,
imageUrl,
mobileImageUrl,
imageActionUrl,
intl,
htmlId,
}) => {
const {
hints: { mobile },
} = useRuntime()
const handles = useCssHandles(CSS_HANDLES)
const paddingClass =
textPosition === textPostionValues.LEFT ? 'pr4-ns' : 'pl4-ns'
// We ignore textAlignment tokens when full image mode
const alignToken = isFullModeStyle
? safelyGetToken(alignTokens, textPosition, 'textPosition')
: safelyGetToken(alignTokens, textAlignment, 'textAlignment')
const itemsToken = isFullModeStyle
? safelyGetToken(itemsTokens, textPosition, 'textPosition')
: safelyGetToken(itemsTokens, textAlignment, 'textAlignment')
const justifyToken = safelyGetToken(
justifyTokens,
textPosition,
'textPosition'
)
const flexOrderToken = safelyGetToken(
function NetworkStatusToast({ intl }) {
const runtime = useRuntime()
const [offline, setOffline] = useState(false)
// Useful to dismissable toast flow.
const [showingOffline, setShowingOffline] = useState(false)
const { showToast, hideToast, toastState } = useContext(ToastContext)
const toastConfig = useMemo(
() => ({
message: intl.formatMessage({
id: 'store/store.network-status.offline',
}),
dismissable: pathOr(false, ['hints', 'mobile'], runtime),
duration: Infinity,
}),
[intl, runtime]
)
const ProductSpecificationsWrapper = ({
hiddenSpecifications,
visibleSpecifications,
specifications: propsSpecifications,
tabsMode, // This is a legacy prop passed by product-details
showSpecificationsTab = false,
collapsible = 'always',
}) => {
const productContext = useProduct()
const specifications =
propsSpecifications || getSpecifications(productContext)
return (
)
}
const {
push,
subscribe, // eslint-disable-line no-unused-vars
...props
} = this.props
// Use the push function from the pixel for backward-compatibility
return (
{context => }
)
}
}
return hoistNonReactStatics(Pixel(DataLayer), WrappedComponent)
}
const ProductSpecifications = ({
tabsMode,
specifications,
collapsible = 'always',
hiddenSpecifications,
visibleSpecifications,
shouldCollapseInTabChange,
}) => {
const [currentTab, setCurrentTab] = useState(0)
const [collapsed, setCollapsed] = useState(true)
const handles = useCssHandles(CSS_HANDLES)
const { isMobile } = useDevice()
const shouldBeCollapsible = Boolean(
collapsible === 'always' ||
(collapsible === 'mobileOnly' && isMobile) ||
(collapsible === 'desktopOnly' && !isMobile)
)
const handleTabChange = tabIndex => {
setCurrentTab(tabIndex)
if (shouldCollapseInTabChange) {
setCollapsed(true)
}
}
const getSpecificationItems = () => {
const ProductDescription = ({ description, collapseContent, title, intl }) => {
if (!description) {
return null
}
const descriptionParsed = useMemo(() => HtmlParser(description), [
description,
])
const handles = useCssHandles(CSS_HANDLES)
return (
<div>
{txt => (
<h2>
{title ? formatIOMessage({ id: title, intl }) : txt}
</h2>
)}
<div>
{collapseContent ? (
</div></div>
const ThumbnailSwiper = ({
isThumbsVertical,
slides,
swiperParams,
thumbUrls,
position,
onThumbClick,
activeIndex,
thumbnailAspectRatio,
thumbnailMaxHeight,
}) => {
const hasThumbs = slides.length > 1
const handles = useCssHandles(CSS_HANDLES)
const thumbClasses = classNames(`${handles.carouselGaleryThumbs} dn h-auto`, {
'db-ns': hasThumbs,
mt3: !isThumbsVertical,
'w-20 bottom-0 top-0 absolute': isThumbsVertical,
'left-0':
isThumbsVertical && position === THUMBS_POSITION_HORIZONTAL.LEFT,
'right-0':
isThumbsVertical && position === THUMBS_POSITION_HORIZONTAL.RIGHT,
})
return (
<div data-testid="thumbnail-swiper">
{slides.map((slide, i) => {
const itemContainerClasses = classNames('swiper-slide mb5 pointer',</div>
const ProductBrand = ({
displayMode = DISPLAY_MODE.LOGO,
fallbackToText = true,
loadingPlaceholder = DISPLAY_MODE.LOGO,
/** TODO: decide whether the prop width should be supported
* It makes sense at surface, but setting both width and height
* messes with the alignment of the logo, due to how our image
* server handles resizing. */
height = 100,
excludeBrands,
logoWithLink,
brandName: brandNameProp,
brandId: brandIdProp,
}) => {
const { brandName, brandId } = useBrandInfoProps(brandNameProp, brandIdProp)
const handles = useCssHandles(CSS_HANDLES)
if (!brandName || !brandId) {
return null
}
/** Certain brands (e.g. placeholder brands) can be filtered out via theme config */
if (shouldExcludeBrand(brandName, brandId, excludeBrands)) {
return null
}
const brandNameElement = (
<span>{brandName}</span>
)
const BrandContainer = ({ children }) => (
<div>{children}</div>