diff --git a/components/blueTags/BlueTagProduct.tsx b/components/blueTags/BlueTagProduct.tsx new file mode 100644 index 0000000..75b9c32 --- /dev/null +++ b/components/blueTags/BlueTagProduct.tsx @@ -0,0 +1,30 @@ +import { useEffect } from "preact/hooks"; + +interface Props{ + blueProductId: string; +} + +const TagBlueProduct = ({ blueProductId }:Props) => { + useEffect(() => { + window.blue_q = window.blue_q || []; + window.blue_q.push( + { event: "setCampaignId", value: "236D6DD2-E221-52CF-59E8647FC96917D8" }, + { event: "setProductId", value: blueProductId }, + { event: "setPageType", value: "product" } + ); + + const script = document.createElement('script'); + script.type = 'text/javascript'; + script.src = '//event.getblue.io/js/blue-tag.min.js'; + script.async = true; + document.head.appendChild(script); + + return () => { + document.head.removeChild(script); + }; + }, [blueProductId]); + + return null; +}; + +export default TagBlueProduct; \ No newline at end of file diff --git a/components/blueTags/BlueTagVisit.tsx b/components/blueTags/BlueTagVisit.tsx new file mode 100644 index 0000000..7202d62 --- /dev/null +++ b/components/blueTags/BlueTagVisit.tsx @@ -0,0 +1,35 @@ +import { useEffect } from "preact/hooks"; + +declare global { + interface Window { + blue_q?: Array<{ event: string; value: string }>; + } +} + +const BlueTagVisit = () => { + useEffect(() => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.src = "//event.getblue.io/js/blue-tag.min.js"; + script.async = true; + document.head.appendChild(script); + + const eventData = [ + { event: "setCampaignId", value: "236D6DD2-E221-52CF-59E8647FC96917D8" }, + { event: "setPageType", value: "visit" }, + ]; + + window.blue_q = window.blue_q || []; + window.blue_q.push(...eventData); + + console.log("tag visit"); + + eventData.forEach(({ event, value }) => { + window.blue_q!.push({ event, value }); + }); + }, []); + + return null; +}; + +export default BlueTagVisit; diff --git a/components/product/ProductCard.tsx b/components/product/ProductCard.tsx index 0ba439c..7f1150f 100644 --- a/components/product/ProductCard.tsx +++ b/components/product/ProductCard.tsx @@ -305,6 +305,20 @@ function ProductCard( /> )} + {/* Tag produto restrito*/} + {ProductWarning && ( +