@revjet/react-revjet-tag
Advanced tools
Comparing version 5.2.1 to 5.2.2
@@ -26,2 +26,23 @@ "use strict"; | ||
const use_elements_props_1 = require("../hooks/use-elements-props"); | ||
const EmptyStyle = {}; | ||
const HiddenStyle = { | ||
width: '1px', | ||
height: '1px', | ||
position: 'absolute', | ||
visibility: 'hidden' | ||
}; | ||
const ResetStyleSheet = { | ||
border: 'none', | ||
left: 0, | ||
margin: 0, | ||
opacity: 1, | ||
overflow: 'hidden', | ||
padding: 0, | ||
position: 'relative', | ||
top: 0 | ||
}; | ||
const AdditionalIframeProps = { | ||
allowtransparency: 'false', | ||
importance: 'high' | ||
}; | ||
function Banner(props) { | ||
@@ -43,3 +64,3 @@ var _a; | ||
const { width, height } = (0, commons_1.getContentSize)(properties, response); | ||
const [autoHideStyle, setAutoHideStyle] = (0, react_1.useState)({}); | ||
const [autoHideStyle, setAutoHideStyle] = (0, react_1.useState)(autoHide ? HiddenStyle : EmptyStyle); | ||
const iframeRefCallback = (0, react_1.useCallback)((iframeNode) => { | ||
@@ -76,3 +97,3 @@ setIframeRef(iframeNode); | ||
if (!autoHide) { | ||
setAutoHideStyle({}); | ||
setAutoHideStyle(EmptyStyle); | ||
} | ||
@@ -83,11 +104,6 @@ }, [autoHide]); | ||
if (!elementsInitialized) { | ||
setAutoHideStyle({ | ||
width: '1px', | ||
height: '1px', | ||
position: 'absolute', | ||
visibility: 'hidden' | ||
}); | ||
setAutoHideStyle(HiddenStyle); | ||
} | ||
else if (elementsInitialized && !hideCreative) { | ||
setAutoHideStyle({}); | ||
setAutoHideStyle(EmptyStyle); | ||
} | ||
@@ -100,12 +116,2 @@ } | ||
}), [width, height]); | ||
const resetStyleSheet = (0, react_1.useMemo)(() => ({ | ||
border: 'none', | ||
left: 0, | ||
margin: 0, | ||
opacity: 1, | ||
overflow: 'hidden', | ||
padding: 0, | ||
position: 'relative', | ||
top: 0 | ||
}), []); | ||
const autoScaleWrapperStyleSheet = (0, react_1.useMemo)(() => { | ||
@@ -120,3 +126,3 @@ if (autoScale) { | ||
else { | ||
return {}; | ||
return EmptyStyle; | ||
} | ||
@@ -126,7 +132,7 @@ }, [autoScale, autoScaleMode]); | ||
display: 'inline-block', | ||
...resetStyleSheet, | ||
...ResetStyleSheet, | ||
...sizeStyleSheet, | ||
...autoScaleWrapperStyleSheet, | ||
...autoHideStyle | ||
}), [resetStyleSheet, sizeStyleSheet, autoScaleWrapperStyleSheet, autoHideStyle]); | ||
}), [sizeStyleSheet, autoScaleWrapperStyleSheet, autoHideStyle]); | ||
const autoScaleHolderStyleSheet = (0, react_1.useMemo)(() => { | ||
@@ -163,3 +169,3 @@ if (wrapperHeight != null && wrapperWidth != null && autoScale) { | ||
else { | ||
return {}; | ||
return EmptyStyle; | ||
} | ||
@@ -169,6 +175,6 @@ }, [autoScale, autoScaleMode, width, height, wrapperWidth, wrapperHeight]); | ||
display: 'block', | ||
...resetStyleSheet, | ||
...ResetStyleSheet, | ||
...sizeStyleSheet, | ||
...autoScaleHolderStyleSheet | ||
}), [resetStyleSheet, sizeStyleSheet, autoScaleHolderStyleSheet]); | ||
}), [sizeStyleSheet, autoScaleHolderStyleSheet]); | ||
const autoScaleIframeStyleSheet = (0, react_1.useMemo)(() => { | ||
@@ -189,3 +195,3 @@ if (autoScale && wrapperWidth != null && wrapperHeight != null) { | ||
else { | ||
return {}; | ||
return EmptyStyle; | ||
} | ||
@@ -195,17 +201,13 @@ }, [autoScale, autoScaleMode, width, height, wrapperWidth, wrapperHeight]); | ||
return { | ||
...resetStyleSheet, | ||
...ResetStyleSheet, | ||
...sizeStyleSheet, | ||
...autoScaleIframeStyleSheet | ||
}; | ||
}, [resetStyleSheet, sizeStyleSheet, autoScaleIframeStyleSheet]); | ||
}, [sizeStyleSheet, autoScaleIframeStyleSheet]); | ||
const encodedSlotOptions = (0, react_1.useMemo)(() => (0, commons_1.getEncodedSlotOptions)(_opts), [_opts]); | ||
const iframeProps = (0, react_1.useMemo)(() => ({ | ||
allowtransparency: 'false', | ||
importance: 'high' | ||
}), []); | ||
return (react_1.default.createElement("ins", { ref: wrapperRefCallback, style: wrapperStyleSheet }, | ||
react_1.default.createElement("ins", { style: holderStyleSheet }, | ||
react_1.default.createElement("iframe", { ref: iframeRefCallback, style: iframeStyleSheet, frameBorder: 0, marginWidth: 0, marginHeight: 0, scrolling: "no", name: "revjet-single-iframe", loading: "eager", "data-revjet-options": encodedSlotOptions, srcDoc: adContent, ...iframeProps })))); | ||
react_1.default.createElement("iframe", { ref: iframeRefCallback, style: iframeStyleSheet, frameBorder: 0, marginWidth: 0, marginHeight: 0, scrolling: "no", name: "revjet-single-iframe", loading: "eager", "data-revjet-options": encodedSlotOptions, srcDoc: adContent, ...AdditionalIframeProps })))); | ||
} | ||
exports.Banner = Banner; | ||
//# sourceMappingURL=banner.js.map |
@@ -65,4 +65,9 @@ "use strict"; | ||
const [dynamicHeightStyle, setDynamicHeightStyle] = (0, react_1.useState)(EmptyStyle); | ||
const [autoHideStyle, setAutoHideStyle] = (0, react_1.useState)(EmptyStyle); | ||
const [autoHideStyle, setAutoHideStyle] = (0, react_1.useState)(autoHide ? HiddenStyle : EmptyStyle); | ||
(0, react_1.useEffect)(() => { | ||
if (!autoHide) { | ||
setAutoHideStyle(EmptyStyle); | ||
} | ||
}, [autoHide]); | ||
(0, react_1.useEffect)(() => { | ||
if (responsiveHeight !== 'dynamic') { | ||
@@ -72,7 +77,2 @@ setDynamicHeightStyle(EmptyStyle); | ||
}, [responsiveHeight]); | ||
(0, react_1.useEffect)(() => { | ||
if (!autoHide) { | ||
setAutoHideStyle(EmptyStyle); | ||
} | ||
}, [autoHide]); | ||
const iframeRefCallback = (0, react_1.useCallback)((iframeNode) => { | ||
@@ -79,0 +79,0 @@ setIframeRef(iframeNode); |
{ | ||
"name": "@revjet/react-revjet-tag", | ||
"version": "5.2.1", | ||
"version": "5.2.2", | ||
"description": "React RevJet Tag", | ||
@@ -5,0 +5,0 @@ "author": "Vladimir Marteev <vladimir.marteev@revjet.com>", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1575
129857