class Cupom39{ constructor(discount="10",code="Hoop") { if(window.location.href.includes("hoopcompany_ecommerce/preview")) this.resetCookie(); this.discount = discount; this.code = code; this.fields = "1-1-1-1-0-0"; this.initialise(); if (this.fields.split("-")[4] == 1) setTimeout(this.initialiseGoogle(),3000); } initialiseGoogle(){ var autoComplete; function initAutocomplete(){ const input = document.getElementById("place"); const options = { componentRestrictions: { country: "br" }, fields: ["formatted_address", "geometry", "name"], types: ["(cities)"], }; autocomplete = new google.maps.places.Autocomplete(input, options); } initAutocomplete(); } initialise(){ if((this.getCookie("completedFastCupom39") == "" || 0)&&this.getCookie("hoopCliente")!=1){ this.createStyle(); this.createButton(); this.createModal(); this.stockCounter(); this.verifyCookie(); } } createModal(){ const cupomRelampagoContainer = document.createElement("div"); cupomRelampagoContainer.id = "Cupom-relampago-container"; if (this.getCookie("FastCupomClosed39") == 0 || this.getCookie("FastCupomClosed39") == ""){ cupomRelampagoContainer.classList.add("mostrar"); } const modal = document.createElement("div"); modal.classList.add("hoop-modal-promoçao"); const header = document.createElement("div"); header.classList.add("hoop-header-cupom"); const headerH2 = document.createElement("p"); headerH2.classList.add("h2"); const headerB = document.createElement("B"); headerB.textContent = "Atenção!!!"; const headerSpan = document.createElement("span"); headerSpan.textContent = "Mega Promoção no ar por tempo limitado!!!"; const headerButton = document.createElement("button"); headerButton.classList.add("hoop-fechar"); headerButton.id = "closeModal"; headerButton.textContent = "Fechar X"; headerButton.addEventListener("click", this.toggleModal); const boddy = document.createElement("div"); boddy.classList.add("hoop-boddy"); const home = document.createElement("div"); home.classList.add("hoop-home"); const title = document.createElement("div"); title.classList.add("hoop-title"); const titleH2 = document.createElement("p"); titleH2.classList.add("h2"); titleH2.textContent = "Desconto de"; const titleH1 = document.createElement("p"); titleH1.classList.add("h1"); titleH1.textContent = "R$ 20"; const hr = document.createElement("hr"); const counters = document.createElement("div"); counters.classList.add("hoop-counters"); const counterContainer = document.createElement("div"); counterContainer.classList.add("hoop-counterContainer"); const counterContainerH3 = document.createElement("p"); counterContainerH3.classList.add("h3"); const counterContainerSpan1 = document.createElement("span"); counterContainerSpan1.id = "counterStock"; const counterContainerSpan2 = document.createElement("span"); counterContainerSpan2.textContent = " Cupons Restantes"; const timerContainer = document.createElement("div"); timerContainer.classList.add("hoop-timerContainer"); const timerContainerH2 = document.createElement("p"); timerContainerH2.classList.add("h2"); const timerContainerB = document.createElement("B"); timerContainerB.textContent = "Aproveite!"; const timerContainerSpan = document.createElement("span"); timerContainerSpan.textContent = " Campanha acaba em"; timerContainerSpan.style="opacity: 0.8;"; const timer = document.createElement("div"); timer.classList.add("hoop-timer"); const dataTimer1 = document.createElement("div"); dataTimer1.classList.add("hoop-dataTimer"); dataTimer1.classList.add("hora"); const dataTimer2 = document.createElement("div"); dataTimer2.classList.add("hoop-dataTimer"); dataTimer2.classList.add("minuto"); const dataTimer3 = document.createElement("div"); dataTimer3.classList.add("hoop-dataTimer"); dataTimer3.classList.add("segundo"); const termContainer = document.createElement("div"); termContainer.classList.add("hoop-termContainer"); termContainer.style="justify-content: space-between;display: flex;width: 100%;"; const termLeft = document.createElement("div"); termLeft.classList.add("hoop-termLeft"); const checkTerm = document.createElement("input"); checkTerm.classList.add("hoop-checkTerm"); checkTerm.id = "hoop-checkTerm"; checkTerm.setAttribute("type","checkbox"); checkTerm.addEventListener("click", function() { if(document.querySelector("#hoop-checkTerm").checked){ hoopModalOptinMega.show(); } }); const labelTerm = document.createElement("label"); labelTerm.setAttribute("for","hoop-checkTerm"); labelTerm.textContent = "Aceito os termos"; const termManage = document.createElement("p"); termManage.classList.add("hoop-termManage"); termManage.textContent = "Gerenciar termos"; termManage.addEventListener("click", hoopModalOptinMega.show); const buttonContainer = document.createElement("div"); buttonContainer.classList.add("hoop-buttonContainer"); const btnCupom = document.createElement("button"); btnCupom.id = "showForm"; btnCupom.classList.add("hoop-btnCupom"); btnCupom.textContent = "Baixar cupom aqui"; btnCupom.addEventListener("click",this.showFormm); const small = document.createElement("small"); small.innerText = "*Válido para primeira compra, em pedidos acima de R$ 399,99."; const boddyForm = document.createElement("div"); boddyForm.classList.add("hoop-boddyForm"); const errorForm = document.createElement("div"); errorForm.classList.add("hoop-errorForm"); errorForm.textContent = "erro"; const formGroup0 = document.createElement("div"); formGroup0.classList.add("hoop-formGroup"); const label0 = document.createElement("label"); label0.setAttribute("for","place"); label0.textContent = " Digite sua cidade"; const input0 = document.createElement("input"); input0.setAttribute("type","text"); input0.id = "place"; const formGroup1 = document.createElement("div"); formGroup1.classList.add("hoop-formGroup"); const label1 = document.createElement("label"); label1.setAttribute("for","Name"); label1.textContent = " Digite seu nome"; const input1 = document.createElement("input"); input1.setAttribute("type","text"); input1.id = "inputName"; const formGroup2 = document.createElement("div"); formGroup2.classList.add("hoop-formGroup"); const label2 = document.createElement("label"); label2.setAttribute("for","Email"); label2.textContent = " Digite seu Email"; const input2 = document.createElement("input"); input2.setAttribute("type","text"); input2.id = "inputEmail"; const formGroup3 = document.createElement("div"); formGroup3.classList.add("hoop-formGroup"); const label3 = document.createElement("label"); label3.setAttribute("for","Telefone"); label3.textContent = " Digite seu Telefone"; const input3 = document.createElement("input"); input3.setAttribute("type","text"); input3.addEventListener("keydown",this.fMascPhone); input3.setAttribute("maxlength","15"); input3.id = "inputTel"; const formGroup4 = document.createElement("div"); formGroup4.classList.add("hoop-formGroup"); const label4 = document.createElement("label"); label4.setAttribute("for","cpf"); label4.textContent = " Digite seu Cpf"; const input4 = document.createElement("input"); input4.setAttribute("type","text"); input4.addEventListener("keydown",this.fMascCPF); input4.setAttribute("maxlength","14"); input4.id = "cpf"; const formGroup5 = document.createElement("div"); formGroup5.classList.add("hoop-formGroup"); const label5 = document.createElement("label"); label5.setAttribute("for","website"); label5.textContent = " Digite seu Website"; const input5 = document.createElement("input"); input5.setAttribute("type","text"); input5.id = "website"; const formGroup6 = document.createElement("div"); formGroup6.classList.add("hoop-formGroup"); const label6 = document.createElement("label"); label6.setAttribute("for","company"); label6.textContent = " Digite o nome de sua loja"; const input6 = document.createElement("input"); input6.setAttribute("type","text"); input6.id = "company"; const boddyFormButton = document.createElement("button"); boddyFormButton.classList.add("hoop-formButton"); boddyFormButton.style="margin-top:20px"; boddyFormButton.id = "formButton"; boddyFormButton.textContent = "Pegar cupom"; boddyFormButton.addEventListener("click",this.showCupom); const modalTermOfUse = document.createElement("div"); modalTermOfUse.classList.add("hoop-modal-termOfUse"); const textTerm = document.createElement("div"); textTerm.classList.add("hoop-textTerm"); const textTermH4 = document.createElement("p"); textTermH4.classList.add("h4"); textTermH4.textContent="Termo de Uso"; const textTermHr = document.createElement("hr"); const textTermP = document.createElement("p"); textTermP.textContent = " testetststtetetetet"; const boddyCupom = document.createElement("div"); boddyCupom.classList.add("hoop-boddyCupom"); const boddyCupomH2 = document.createElement("p"); boddyCupomH2.classList.add("h2"); boddyCupomH2.textContent = "Parabéns, aqui está seu cupom"; const boddyCupomH1 = document.createElement("p"); boddyCupomH1.classList.add("h1"); boddyCupomH1.textContent = this.code; const div_body=document.createElement("div"); div_body.id="hoop-boddy-cupom"; document.body.appendChild(cupomRelampagoContainer); cupomRelampagoContainer.appendChild(modal); modal.appendChild(header); header.appendChild(headerH2); headerH2.appendChild(headerB); headerH2.appendChild(headerSpan); header.appendChild(headerButton); modal.appendChild(div_body); div_body.appendChild(boddy); boddy.appendChild(home); home.appendChild(title); title.appendChild(titleH2); title.appendChild(titleH1); home.appendChild(hr); home.appendChild(counters); counters.appendChild(counterContainer); counterContainer.appendChild(counterContainerH3); counterContainerH3.appendChild(counterContainerSpan1); counterContainerH3.appendChild(counterContainerSpan2); counters.appendChild(timerContainer); timerContainer.appendChild(timerContainerH2); timerContainerH2.appendChild(timerContainerB); timerContainerH2.appendChild(timerContainerSpan); timerContainer.appendChild(timer); timer.appendChild(dataTimer1); timer.appendChild(dataTimer2); timer.appendChild(dataTimer3); if (this.fields.split("-")[3] == 1){ buttonContainer.appendChild(termContainer); termContainer.appendChild(termLeft); termLeft.appendChild(checkTerm); termLeft.appendChild(labelTerm); termContainer.appendChild(termManage); } boddy.appendChild(buttonContainer); buttonContainer.appendChild(btnCupom); buttonContainer.appendChild(small); modal.appendChild(boddyForm); boddyForm.appendChild(errorForm); if (this.fields.split("-")[0] == 1){ boddyForm.appendChild(formGroup1); formGroup1.appendChild(label1); formGroup1.appendChild(input1); } if (this.fields.split("-")[1] == 1){ boddyForm.appendChild(formGroup2); formGroup2.appendChild(label2); formGroup2.appendChild(input2); } if (this.fields.split("-")[2] == 1){ boddyForm.appendChild(formGroup3); formGroup3.appendChild(label3); formGroup3.appendChild(input3); } if (this.fields.split("-")[4] == 1){ boddyForm.appendChild(formGroup0); formGroup0.appendChild(label0); formGroup0.appendChild(input0); } if (this.fields.split("-")[5] == 1){ boddyForm.appendChild(formGroup4); formGroup4.appendChild(label4); formGroup4.appendChild(input4); } boddyForm.appendChild(boddyFormButton); boddyForm.appendChild(modalTermOfUse); modalTermOfUse.appendChild(textTerm); textTerm.appendChild(textTermH4); textTerm.appendChild(textTermHr); textTerm.appendChild(textTermP); modal.appendChild(boddyCupom); boddyCupom.appendChild(boddyCupomH2); boddyCupom.appendChild(boddyCupomH1); } destroy(){ document.getElementById("Cupom-relampago-container").remove(); document.getElementById("hoopWidgetCoupon").remove(); document.getElementById("styleHoop").remove(); clearInterval(window.hoopCounter); clearInterval(window.hoopCounterStock); delete window.cupom; } insertiLibLP(){ function uuidv4() { return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c => (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)); } if (window.getCookie("external_ref") == "") window.setCookie("external_ref", uuidv4(), 90); var scriptjquery = document.createElement("script"); scriptjquery.src = " //code.jquery.com/jquery-3.5.1.min.js"; scriptjquery.type = "text/javascript"; document.getElementsByTagName("body")[0].appendChild(scriptjquery); var script1 = document.createElement("script"); script1.src = "//hoopdecor.com/landing/js/jquery.fancybox.min.js"; script1.type = "text/javascript"; document.getElementsByTagName("body")[0].appendChild(script1); var script2 = document.createElement("link"); script2.href = "//hoopdecor.com/landing/css/jquery.fancybox.min.css"; script2.rel = "stylesheet"; document.getElementsByTagName("body")[0].appendChild(script2); const button = document.querySelector(".HoopWidget"); var external_ref2=window.getCookie("external_ref"); button.setAttribute("data-fancybox", ""); button.setAttribute("data-type", "iframe"); button.setAttribute("data-src", "https://hoopdecor.com/campanhaLP/226?external_ref="+external_ref2+"&popup_id="+39); button.removeAttribute("href"); button.removeAttribute("target"); if((!window.getCookie("close_lp")&& !window.getCookie("hoopCliente")) || 0 ){ window.setCookie("close_lp",1,90); script1 .addEventListener("load", function() { button.click(); }); } } createButton(){ const hoopWidgetCoupon = document.createElement("div"); hoopWidgetCoupon.id = "hoopWidgetCoupon"; hoopWidgetCoupon.classList.add("HoopWidget"); hoopWidgetCoupon.classList.add("hoop-cupom"); hoopWidgetCoupon.addEventListener("click",this.toggleModal); const tooltip = document.createElement("div"); tooltip.classList.add("hoop-tooltip"); tooltip.textContent = "Cupom"; const spanWidget = document.createElement("span"); const img = document.createElement("img"); img.setAttribute("src","https://hoopdecor.s3.sa-east-1.amazonaws.com/static/production/img/coupon-icons/coupon-icon-white.png"); img.setAttribute("width","40"); img.setAttribute("height","40"); document.body.appendChild(hoopWidgetCoupon); hoopWidgetCoupon.appendChild(tooltip); hoopWidgetCoupon.appendChild(spanWidget); spanWidget.appendChild(img) } createStyle(){ const styleTag = document.createElement("style"); styleTag.id="styleHoop"; document.head.appendChild(styleTag); styleTag.innerHTML= ":root {\n" + " --secondary-bg-color-popup: #4081d1;\n" + " --text-color-popup: #000000;\n" + " --btn-color-popup: #000000;\n" + " --btn-borderColor-popup: #4081d1;\n" + " --btn-textColor-popup: #000000;\n" + " }\n" + ".pac-container {\n" + " z-index: 10000000 !important;\n" + "} \n" + " .hoop-termContainer label { \n" + " text-transform: lowercase!important; \n" + " font-weight: normal!important; \n" + " } \n" + " #Cupom-relampago-container *{\n" + " margin: 0px;\n" + " letter-spacing: 0px !important;\n" + " padding: 0px; font-size:unset; color: unset;line-height: normal;\n" + " } #Cupom-relampago-container .h1,.h2,.h3,.h4{line-height: unset;} #Cupom-relampago-container .h1 { font-size: 2em;} #Cupom-relampago-container .h2 { font-size: 1.5em;} #Cupom-relampago-container hr{ display: none; unicode-bidi: isolate; margin-block-start: 0.5em; margin-block-end: 0.5em; margin-inline-start: auto; margin-inline-end: auto; overflow: hidden; border-style: inset; border-width: 1px;} \n" + " #Cupom-relampago-container{\n" + " width: 100vw;\n" + " height: 100vh;\n" + " position: fixed;\n" + " top: 0px;\n" + " left: 0px;\n" + " background: rgba(0,0,0,.4);\n" + " z-index: 100000;\n" + " display: none;\n" + " align-items: center;\n" + " justify-content: center;\n" + " }\n" + " #Cupom-relampago-container.mostrar{\n" + " display: flex;\n" + " }\n" + " #Cupom-relampago-container .hoop-modal-promoçao, .hoop-modal-termOfUse{\n" + " background: var(--secondary-bg-color-popup);\n" + " min-width: 200px;\n" + " padding: 0px 15px 15px 15px;\n" + " position: relative;\n" + " border-radius: 10px;\n" + " }\n" + " @keyframes modal-promocao {\n" + " from{\n" + " opacity: 0;\n" + " transform: translate3d(0,-60px,0);\n" + " }\n" + " to{\n" + " opacity: 1;\n" + " transform: translate3d(0,0,0);\n" + " }\n" + " }\n" + " @keyframes Form {\n" + " from{\n" + " opacity: 0;\n" + " }\n" + " to{\n" + " opacity: 1;\n" + " }\n" + " }\n" + "\n" + " .mostrar .hoop-modal-promoçao{\n" + " animation: modal-promocao .3s;\n" + " }\n" + " #Cupom-relampago-container .hoop-title .h1{\n" + " color: var(--text-color-popup);\n" + " text-align: center;\n" + " font-size: 150px;\n" + " z-index: 2;\n" + " font-family: fangsong;\n" + " font-style: italic;\n" + " }\n" + " #Cupom-relampago-container .hoop-boddy{\n" + "width:100%;\n" + " display: flex;\n" + " flex-direction: column;\n" + " align-items: center;\n" + "padding-top:30px;background:linear-gradient(90deg, white 27px, transparent 1%) center, linear-gradient(white 27px, transparent 1%) center, #ebebeb; background-size: 30px 30px;\n" + " }\n" + " #Cupom-relampago-container .hoop-boddy {\n" + " margin: auto auto;\n" + " }\n" + " @media only screen and (max-width: 1000px) {\n" + " #Cupom-relampago-container .hoop-buttonContainer{\n" + " margin-top:40px;\n" + " }\n" + " #Cupom-relampago-container .hoop-boddy {\n" + " width:100%;\n" + " }\n" + " #img_cupom {\n" + " width: 70%;position: relative;left: 50%;transform: translate(-50%);\n" + " }\n" + " #hoop-boddy-cupom {\n" + " display:block;\n" + " }\n" + " }\n" + " @media only screen and (min-width: 1000px) {\n" + " #Cupom-relampago-container #hoop-boddy-cupom #div_img_text .h2{\n" + " font-size: 35px;\n" + " padding: 35px 80px;\n" + " }\n" + " #Cupom-relampago-container .hoop-boddy {\n" + " width:50%;\n" + " }\n" + " #Cupom-relampago-container .hoop-modal-promoçao{\n" + " width:70%; \n"+ " }\n" + " #div_img{\n" + " width:50%\n" + " }\n" + " #Cupom-relampago-container .hoop-buttonContainer{\n" + " margin-top:20px;\n" + "margin-bottom: 20px;\n" + " }\n" + " #img_cupom {\n" + " width:57%;\n" + "position: relative;top: 50%;left: 50%;transform: translate(-50%, -50%);\n" + " }\n" + " #hoop-boddy-cupom{"+ " display:flex;"+ " }" + " }\n" + " #Cupom-relampago-container .hoop-title{\n" + "display: flex;\n" + " flex-direction: column;\n" + " justify-content: center;\n" + " align-items: center;\n" + " width: 100%;\n" + " }\n" + " #Cupom-relampago-container .hoop-title .h2{\n" + " color: var(--text-color-popup);\n" + " font-family: system-ui;\n" + " font-size: 32px;\n" + " font-weight: 300; margin-left: -150px; margin-bottom: -10px;\n" + " }\n" + " #Cupom-relampago-container .hoop-timerContainer{\n" + " display: flex;\n" + " justify-content: center; margin-top: 15px;\n" + " flex-direction: column;\n" + " align-items: center;\n" + " \n" + " }\n" + " #Cupom-relampago-container .hoop-timerContainer .h2{\n" + " color: var(--text-color-popup);\n" + " font-family: monospace;\n" + " font-weight: 900;\n" + " } .hoop-termContainer{display: flex;width: 100%;justify-content: space-between;align-items: center;min-width: 200px;max-width: 350px; font-family: system-ui;}\n" + " #Cupom-relampago-container .hoop-timer{\n" + " display: flex;\n" + " margin-top: 25px\n" + " }\n" + " #Cupom-relampago-container .hoop-timer div{\n" + " display: flex;\n" + " flex-direction: column; margin-left:20px;\n" + "background-color: white;\n" + " color:var(--text-color-popup); font-weight: 400; align-items: center; -webkit-align-items: center; height:50px;border: solid 1px var(--text-color-popup) !important; width:50px;font-size: 20px; justify-content: center; align-items: center; position:relative;\n" + " } #Cupom-relampago-container .hoop-timer div:last-child{margin-right:20px;}\n" + " #Cupom-relampago-container .hoop-timerNumber{\n" + " color: var(--text-color-popup);\n" + " font-size: 1.3rem; font-weight: 300;\n" + " background: white; border: solid 1px var(--text-color-popup); \n" + " display: flex; height: 57px; width: 55px; justify-content: center; align-items: center;\n" + " }\n" + " #Cupom-relampago-container .hoop-timer p{\n" + " color: var(--text-color-popup);\n" + " font-family: system-ui;\n" + " font-size: 0.7rem; margin-top: 10px; position: absolute; bottom:-14px\n" + " }\n" + " #Cupom-relampago-container .hoop-counterContainer{\n" + " display: flex;\n" + " align-items: center;\n" + " }\n" + " #Cupom-relampago-container .hoop-counterContainer .h2{\n" + " color: var(--text-color-popup);\n" + " font-family: monospace;\n" + " font-weight: 900;\n" + " height: 35px;\n" + " }\n" + " #Cupom-relampago-container .hoop-btnCupom, #Cupom-relampago-container .hoop-boddyForm .hoop-formButton {\n" + "\n" + " border: 3px solid var(--btn-borderColor-popup)!important;\n" + " padding: 10px 70px;\n" + " text-align: center;\n" + " text-decoration: none;\n" + " display: inline-block;\n" + " font-size: 16px;\n" + " margin: 4px 2px;\n" + " cursor: pointer;\n" + " -webkit-transition-duration: 0.4s; /* Safari */\n" + " transition-duration: 0.4s;\n" + " font-weight: 700;\n" + " font-size: 18px; width: auto;\n" + " color: var(--btn-textColor-popup)\n" + " }\n" + " #Cupom-relampago-container .hoop-btnCupom:hover {\n" + " box-shadow: 0 12px 16px 0 rgba(0,0,0,0.24),0 17px 50px 0 rgba(0,0,0,0.19);\n" + " }\n" + " #Cupom-relampago-container .hoop-header-cupom{\n" + " display:flex;\n" + " background: none;border: none;\n" + " justify-content: space-between;\n" + " align-items: center;\n" + " padding-top: 15px;\n" + " padding-bottom: 20px;\n" + " padding-left: 15px;\n" + " }\n" + "#Cupom-relampago-container .hoop-modal-termOfUse{\n" + " padding: 15px;\n" + " display: none;\n" + " justify-content: center;\n" + " height: 220px;\n" + " position: absolute;\n" + " width: 35%;\n" + " background: var(--secondary-bg-color-popup);\n" + " overflow-y: auto;\n" + " } #Cupom-relampago-container .hoop-modal-termOfUse.mostrar{display: flex;}\n" + " #Cupom-relampago-container .hoop-textTerm{\n" + " width: 90%;\n" + " }\n" + " #Cupom-relampago-container .hoop-textTerm .h4{\n" + " text-align: center;color: white;\n" + " font-family: system-ui;\n" + " font-weight: 400;\n" + " }\n" + " #Cupom-relampago-container .hoop-textTerm p{\n" + " text-align: justify; color: white;\n" + " }\n" + " #Cupom-relampago-container .hoop-termOfUseCupom span{\n" + " color: blue;\n" + " cursor: pointer;\n" + " }" + " #Cupom-relampago-container .hoop-fechar{\n" + " background-color: var(--secondary-bg-color-popup); /* Green */\n" + "color: white;border: 2px solid white;\n" + " padding: 10px 52px;\n" + " text-align: center;\n" + " text-decoration: none;\n" + " display: inline-block;\n" + " font-size: 16px;\n" + " cursor: pointer; width: auto;\n" + " }\n" + " #Cupom-relampago-container .hoop-header-cupom .h2{\n" + "\n" + " color: white; font-size: 21px; text-align:left; font-family: system-ui; font-weight: 300;\n" + " }\n" + " #Cupom-relampago-container .hoop-header-cupom b{\n" + " font-style: italic; font-weight: 600;\n" + " }\n" + " #Cupom-relampago-container .hoop-home{\n" + " display:flex;\n" + " align-content: space-between;\n" + " justify-content: space-around;\n" + " width: 100%;\n" + " }\n" + " #Cupom-relampago-container .hoop-counters{\n" + " width: 100%;\n" + " display: flex;\n" + " flex-direction: column;\n" + " align-items: center;\n" + " justify-content: center;\n" + "\n" + " \n" + " }\n" + " #Cupom-relampago-container .hoop-counterContainer .h3{\n" + "color: #dd8ba7;\n" + " font-family: system-ui;\n" + " font-size: 20px;\n" + " font-weight: 300;\n" + " }\n" + " #counterStock{\n" + " font-weight: 900;\n" + " font-family: cursive;\n" + " }\n" + " #Cupom-relampago-container .hoop-timerContainer .h2{\n" + " color: var(--text-color-popup);\n" + " font-family: system-ui;\n" + " font-size: 20px;\n" + " font-weight: 300;\n" + " }\n" + " #Cupom-relampago-container #hoop-boddy-cupom #div_img_text .h2{\n" + " color: var(--text-color-popup);\n" + " font-family: system-ui;\n" + " font-weight: bold;\n" + " text-align: center;\n" + " }\n" + " #Cupom-relampago-container .hoop-timerContainer b{\n" + " color: var(--text-color-popup);\n" + " font-family: system-ui;\n" + " font-size: 24px; font-weight: 600;\n" + "\n" + " }\n" + " #Cupom-relampago-container .hoop-buttonContainer{\n" + " display: flex;\n" + " flex-direction: column;\n" + " justify-content: center;\n" + " align-items: center;\n" + " }.hoop-termLeft{display: flex;justify-content: center;align-items: center;margin-left:10px} .hoop-checkTerm{margin-right: 8px;}.hoop-termManage{cursor: pointer; margin-right: 10px;} .hoop-checkTerm{margin-right: 8px !important;-webkit-appearance: checkbox !important;}\n" + ".hoop-termManage{color: #7FC4FD !important;}\n" + ".hoop-termLeft{color: #7FC4FD !important;}\n" + " #Cupom-relampago-container .hoop-buttonContainer small{\n" + " color: var(--text-color-popup);\n" + " font-style: italic;\n" + " padding: 0px 15%;\n" + " }#Cupom-relampago-container #termOfUseCupom{-webkit-appearance: checkbox;}\n" + " .HoopWidget {\n" + " position: fixed;\n" + " left: 20px;\n" + " bottom: 20px;\n" + " z-index: 10000;\n" + " background-color: var(--secondary-bg-color-popup);\n" + " border-radius: 50% !important;\n" + " padding: 15px;\n" + " margin: 10px;\n" + " width: 40px;\n" + " height: 40px;\n" + " font-size: 18px;\n" + " display: flex;\n" + " align-items: center;\n" + " flex-direction: column;\n" + " box-shadow: 0 10px 10px rgba(0, 0, 0, 0.1);\n" + " cursor: pointer; -webkit-box-sizing: unset;\n" + " transition: all 0.2s cubic-bezier(0.68, -0.55, 0.265, 1.55);\n" + " }\n" + "\n" + " .HoopWidget .hoop-tooltip {\n" + " position: absolute;\n" + " top: 0;\n" + " font-size: 15px;\n" + " font-family: monospace;\n" + " background-color: #ffffff;\n" + " color: white !important;\n" + " padding: 8px 18px;\n" + " border-radius: 5px;\n" + " box-shadow: 0 10px 10px rgba(0, 0, 0, 0.1);\n" + " opacity: 0;\n" + " pointer-events: none; bottom: unset; left: unset;\n" + " transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);\n" + " }\n" + "\n" + " .HoopWidget .hoop-tooltip::before {\n" + " position: absolute;\n" + " content: \"\";\n" + " height: 8px;\n" + " width: 8px;\n" + " background-color: #ffffff;\n" + " bottom: -3px;\n" + " left: 50%;\n" + " transform: translate(-50%) rotate(45deg);\n" + " transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);\n" + " }\n" + "\n" + " .HoopWidget:hover .hoop-tooltip {\n" + " top: -45px;\n" + " opacity: 1;\n" + " visibility: visible;\n" + " pointer-events: auto;\n" + " }\n" + "\n" + " .HoopWidget:hover span,\n" + " .HoopWidget:hover .hoop-tooltip {\n" + " text-shadow: 0px -1px 0px rgba(0, 0, 0, 0.1);\n" + " }\n" + "\n" + " .HoopWidget.hoop-cupom:hover,\n" + " .HoopWidget.hoop-cupom:hover .hoop-tooltip,\n" + " .HoopWidget.hoop-cupom:hover .hoop-tooltip::before {\n" + " background-color: var(--secondary-bg-color-popup);\n" + " color: #ffffff;\n" + " }\n" + " #Cupom-relampago-container .hoop-boddyForm{\n" + " display: none;\n" + " flex-direction: column;\n" + " align-items: center;\n" + " background:linear-gradient(90deg, white 27px, transparent 1%) center, linear-gradient(white 27px, transparent 1%) center, #ebebeb; background-size: 30px 30px;\n" + " padding: 60px;\n" + " \n" + " }\n" + " #Cupom-relampago-container.mostrarForm #hoop-boddy-cupom{\n" + " display: none;\n" + " }\n" + " #Cupom-relampago-container.mostrarForm .hoop-boddyForm{\n" + " display: flex;\n" + " animation: Form .6s;\n" + " }\n" + " #Cupom-relampago-container .hoop-boddyForm .hoop-formGroup{\n" + " display: flex;\n" + " flex-direction: column; margin-top:20px;\n" + " \n" + " text-align: center;\n" + " font-family: system-ui;\n" + " font-size: 1rem;\n" + " font-weight: 500;\n" + " }#Cupom-relampago-container .hoop-termOfUseCupom{margin-top:20px;}\n" + " #Cupom-relampago-container .hoop-boddyForm .hoop-errorForm{\n" + " font-family: system-ui;\n" + " font-size: 0.7rem;\n" + " font-weight: 500;\n" + " color: red;\n" + " display: none;\n" + " }\n" + " #Cupom-relampago-container .hoop-boddyForm .hoop-formGroup input{\n" + " padding: 5px 20px;\n" + " border: solid 1px black; margin-top:10px;\n" + " }\n" + " #Cupom-relampago-container .hoop-boddyCupom{\n" + " display: none;\n" + " flex-direction: column;\n" + " align-items: center;\n" + " background:linear-gradient(90deg, white 27px, transparent 1%) center, linear-gradient(white 27px, transparent 1%) center, #ebebeb; background-size: 30px 30px;\n" + " padding: 60px;\n" + " \n" + " }#Cupom-relampago-container .hoop-termOfUseCupom a{text-decoration:none;}\n" + " #Cupom-relampago-container.mostrarCupom .hoop-boddyCupom{\n" + " display: flex;\n" + " animation: Form .6s;\n" + " }\n" + " #Cupom-relampago-container .hoop-boddyCupom .h2{\n" + " font-family: system-ui;\n" + " font-size: 1.5rem;\n" + " font-weight: 400;\n" + " text-align: center;\n" + " }\n" + " #Cupom-relampago-container .hoop-boddyCupom .h1{\n" + " font-family: system-ui;\n" + " min-height: 70px;\n" + " font-size: 2.5rem;\n" + " font-weight: 700;\n" + " -webkit-box-shadow: 0px 3px 13px 0px #000000;\n" + " box-shadow: 0px 3px 13px 0px #000000;\n" + " padding: 8px 45px; margin-top:30px;\n" + " }\n" + " #Cupom-relampago-container.mostrarCupom #hoop-boddy-cupom{\n" + " display: none;\n" + " }\n" + " @media only screen and (max-width: 900px) {\n" + " #Cupom-relampago-container #hoop-boddy-cupom #div_img_text .h2{\n" + " font-size: 24px;\n" + " padding: 20px;\n" + " }\n" + " #Cupom-relampago-container .hoop-boddyCupom .h1{\n" + " font-size: 6vw;\n" + " padding: 5px 10px;\n" + " font-size: 6vw;\n" + " }\n" + " #Cupom-relampago-container .hoop-modal-promoçao{\n" + " width:70%\n" + " }\n" + " #Cupom-relampago-container .hoop-modal-promoçao{\n" + " padding: 0px 15px 15px 15px;\n" + " }\n" + " #Cupom-relampago-container .hoop-header-cupom{\n" + " padding: 7.5px;\n" + " }\n" + " #Cupom-relampago-container .hoop-header-cupom .h2{\n" + " font-size: 0.7rem;\n" + " width: 175px;\n" + " text-align: left;\n" + " font-family: system-ui;\n" + " font-weight: 300;\n" + " font-style: italic;\n" + " } .hoop-termContainer{font-size: 14px !important;flex-direction: column;}\n" + " #Cupom-relampago-container .hoop-fechar{\n" + " padding: 7px 25px;\n" + " font-size: 0.7rem;\n" + " border: 1px solid white;\n" + " }\n" + " #Cupom-relampago-container .hoop-boddy .hoop-home{\n" + " flex-direction: column;\n" + " }\n" + " #Cupom-relampago-container .hoop-boddy .hoop-home .hoop-title .h2{\n" + " font-size: 2.3rem; margin: 0px;\n" + " }\n" + " #Cupom-relampago-container .hoop-boddy .hoop-home .hoop-title .h1{\n" + " font-size: 5rem;\n" + " font-weight: 600;\n" + " margin-top: -10px;\n" + "\n" + " }\n" + " #Cupom-relampago-container .hoop-boddy hr{\n" + " display: none;\n" + " }\n" + " #Cupom-relampago-container .hoop-counterContainer .h3{\n" + " font-size: 25px;\n" + " }\n" + " #Cupom-relampago-container .hoop-counterContainer span{\n" + " font-size: 20px;\n" + " }\n" + " #Cupom-relampago-container .hoop-timerContainer .h2{\n" + " font-size: 15px;\n" + " }\n" + " #Cupom-relampago-container .hoop-timerContainer b{\n" + " font-size: 15px;\n" + " }\n" + " #Cupom-relampago-container .hoop-timer div{\n" + " font-size: 19px; height: 45px; width: 45px;\n" + " \n" + " }\n" + " #Cupom-relampago-container .hoop-timer p{\n" + " font-size: 11px;\n" + " }\n" + " #Cupom-relampago-container .hoop-btnCupom, #Cupom-relampago-container .hoop-boddyForm .hoop-formButton {\n" + " font-size: 0.9rem;\n" + " padding: 12px 30px;\n" + " }\n" + " #Cupom-relampago-container .hoop-buttonContainer small{\n" + " font-size: 0.6rem;\n" + " }\n" + " .HoopWidget {\n" + " width: 40px;\n" + " height: 40px;\n" + " z-index: 99;\n" + " }\n" + " .HoopWidget img{\n" + " width: 40px;\n" + " height: 40px;\n" + " }\n #Cupom-relampago-container .hoop-fechar{padding: 7px 15px; font-size: 0.6rem !important;}" + " }@media only screen and (max-width: 374px) {#Cupom-relampago-container .hoop-title{text-align:center; font-size: 1.95rem;} #Cupom-relampago-container .hoop-counterContainer span{ font-size: 1.1rem;} #Cupom-relampago-container .hoop-timer p{font-size: 0.5rem;} #Cupom-relampago-container .hoop-timer div{font-size: 0.8rem; height: 30px; width: 30px;} #Cupom-relampago-container .hoop-btnCupom, #Cupom-relampago-container .hoop-boddyForm .hoop-formButton{font-size: 0.68rem;}#Cupom-relampago-container .hoop-buttonContainer small{font-size: 0.5rem;} #Cupom-relampago-container .hoop-termOfUseCupom span{font-size: 0.8rem;}#Cupom-relampago-container .hoop-btnCupom, #Cupom-relampago-container .hoop-boddyForm .hoop-formButton{font-size: 0.88rem; padding: 12px 10px; width: 180px;} #Cupom-relampago-container .hoop-boddy .hoop-home .hoop-title .h2{font-size: 1.9rem;}}"; if(document.location.pathname.split("/")[2] == "blog"){ const styleTagMegaCupomBlog = document.createElement("style"); document.head.appendChild(styleTagMegaCupomBlog); styleTagMegaCupomBlog.innerHTML = "@media only screen and (max-width: 600px) { .HoopWidget{ bottom:45px;} .hoopcompany_cta{bottom:55px!important} }"; } } toggleModal(){ document.getElementById("Cupom-relampago-container").classList.toggle("mostrar"); var closed = document.getElementById("Cupom-relampago-container").classList.contains("mostrar") ? 0 : 1; Cupom39.prototype.setCookie("FastCupomClosed39",closed,this.expireAt); } getRandomInt(min, max) { min = Math.ceil(min); max = Math.floor(max); return Math.floor(Math.random() * (max - min)) + min; } uuidv4() { return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c => (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16) ); } setCookie(cname, cvalue, exdays=60) { var d = new Date(); d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); var expires = "expires=" + d.toUTCString(); document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; } getCookie(cname) { var name = cname + "="; var decodedCookie = decodeURIComponent(document.cookie); var ca = decodedCookie.split(";"); for(var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) == " ") { c = c.substring(1); } if (c.indexOf(name) == 0) { return c.substring(name.length, c.length); } } return ""; } startCounters(stock,date){ document.getElementById("counterStock").innerText = stock; // Set the date were counting down to var countDownDate = new Date(date.replace(/,/g,"-")).getTime(); // Update the count down every 1 second window.hoopCounter = setInterval(function() { // Get todays date and time var now = new Date().getTime(); // Find the distance between now and the count down date var distance = countDownDate - now; // Time calculations for days, hours, minutes and seconds var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); var seconds = Math.floor((distance % (1000 * 60)) / 1000); document.getElementsByClassName("hora")[0].innerHTML=(hours<10?("0"+hours):hours)+"
Horas
"; document.getElementsByClassName("minuto")[0].innerHTML=(minutes<10?("0"+minutes):minutes)+"Minutos
"; document.getElementsByClassName("segundo")[0].innerHTML=(seconds<10?("0"+seconds):seconds)+"Segundos
"; // If the count down is over, write some text if (distance < 1) { clearInterval(window.hoopCounter); } }, 1000); } verifyCookie(){ var data; var stock; var date; var dateNow = new Date(); var day = dateNow.getDate(); var mouth = dateNow.getMonth()+1; var hour = dateNow.getHours()+4; var minutes = dateNow.getMinutes(); if (hour > 24){ day++; hour = dateNow.getHours()+4 - 24; } if (hour == 24 && minutes > 0){ day++; hour = dateNow.getHours()+4 - 24; } if (hour < 10){ hour = 0+""+hour; } if (day < 10){ day = 0+""+day; } if (mouth < 10){ mouth = 0+""+mouth; } if (minutes < 10){ minutes = 0+""+minutes; } if (this.getCookie("fastCupom39") == "" && this.getCookie("completedFastCupom39") == ""){ date = "2024," + mouth + "," + day + "T"+ hour+":"+minutes+":00"; this.expireAt = this.getExpireAt(); stock = this.getRandomInt(100,130); data = date +"-"+ stock; this.setCookie("fastCupom39",data,this.expireAt); this.startCounters(stock,date); } else { data = this.getCookie("fastCupom39").split("-"); date = data[0]; stock = data[1]; if (!this.verifyCompleted()){ this.startCounters(stock,date); } } } resetCookie(){ this.setCookie("fastCupom39","",0); this.setCookie("FastCupomClosed39","",0); this.setCookie("completedFastCupom39","",0); } stockCounter(time = 3){ window.hoopCounterStock=setTimeout(function (){ if (!document.getElementsByClassName("mostrarCupom").length){ var teste = document.getElementById("counterStock").innerText -= Cupom39.prototype.getRandomInt(1,4); var aux = 0; if ( teste < 3){ document.getElementById("counterStock").innerText = 2; } else { document.getElementById("counterStock").innerText = teste; aux++; } var data = Cupom39.prototype.getCookie("fastCupom39").split("-"); Cupom39.prototype.setCookie("fastCupom39",data[0]+"-"+ document.getElementById("counterStock").innerText, Cupom39.prototype.getExpireAt()); if (aux>0){ Cupom39.prototype.stockCounter(time*2); } } },time*1000); } showFormm(){ var fields = "1-1-1-1-0-0"; console.log(fields); console.log(hoopModalOptinMega.canContinue || fields.split("-")[3] != 1); if(fields.split("-")[3] != 1 || document.getElementById("hoop-checkTerm").checked){ document.getElementById("Cupom-relampago-container").classList.toggle("mostrarForm"); window.sendEvent({}); }else{ alert("é preciso aceitar os termos"); } } showCupom(){ if ( Cupom39.prototype.verifyForm()|| Cupom39.prototype.getCookie("hoopCliente")==1){ Cupom39.prototype.sendEvent(document.getElementById("inputName"),document.getElementById("inputEmail"),document.getElementById("inputTel")); document.getElementById("Cupom-relampago-container").classList.remove("mostrarForm"); document.getElementById("Cupom-relampago-container").classList.add("mostrarCupom"); } } TestaCPF(strCPF) { var Soma; var Resto; Soma = 0; strCPF=strCPF.replaceAll(".","").replaceAll("-",""); if (strCPF == "00000000000") return false; for (i=1; i<=9; i++) { let c=strCPF.substring(i-1, i); if (c >= '0' && c <= '9'){ Soma = Soma + parseInt(c) * (11 - i); } else break } Resto = (Soma * 10) % 11; if ((Resto == 10) || (Resto == 11)) Resto = 0; if (Resto != parseInt(strCPF.substring(9, 10)) ) return false; Soma = 0; for (i = 1; i <= 10; i++) Soma = Soma + parseInt(strCPF.substring(i-1, i)) * (12 - i); Resto = (Soma * 10) % 11; if ((Resto == 10) || (Resto == 11)) Resto = 0; if (Resto != parseInt(strCPF.substring(10, 11) ) ) return false; return true; } verifyForm(){ var name = document.getElementById("inputName")?.value; var email = document.getElementById("inputEmail")?.value; var tel = document.getElementById("inputTel")?.value; var cpf = document.getElementById("cpf")?.value; console.log([name,email,tel,cpf]); var fields = "1-1-1-1-0-0"; if(document.getElementById("inputName")) document.getElementById("inputName").style.border = ""; if(document.getElementById("inputEmail")) document.getElementById("inputEmail").style.border = ""; if(document.getElementById("inputTel")) document.getElementById("inputTel").style.border = ""; if(document.getElementById("cpf")) document.getElementById("cpf").style.border = ""; document.getElementsByClassName("hoop-errorForm")[0].style.display = "none"; if (typeof name!="undefined"&&name.length < 3){ document.getElementsByClassName("hoop-errorForm")[0].textContent = "Nome inválido"; document.getElementsByClassName("hoop-errorForm")[0].style.display = "block"; document.getElementById("inputName").style.border = "solid 1px red"; return false } else if (typeof email!="undefined"&&email.length < 5){ document.getElementsByClassName("hoop-errorForm")[0].textContent = "Email inválido"; document.getElementsByClassName("hoop-errorForm")[0].style.display = "block"; document.getElementById("inputEmail").style.border = "solid 1px red"; return false } else if (typeof tel!="undefined"&&tel.length < 11){ document.getElementsByClassName("hoop-errorForm")[0].textContent = "Telefone inválido"; document.getElementsByClassName("hoop-errorForm")[0].style.display = "block"; document.getElementById("inputTel").style.border = "solid 1px red"; return false }else if(typeof cpf!="undefined"&&(cpf.length<14||!this.TestaCPF(cpf))) { document.getElementsByClassName("hoop-errorForm")[0].textContent = "CPF inválido"; document.getElementsByClassName("hoop-errorForm")[0].style.display = "block"; document.getElementById("cpf").style.border = "solid 1px red"; return false } else if(fields.split("-")[3] == 1 && !document.getElementById("hoop-checkTerm").checked){ document.getElementsByClassName("hoop-errorForm")[0].textContent = "É necessario aceitar os termos de uso para obter o cupom"; document.getElementsByClassName("hoop-errorForm")[0].style.display = "block"; return false; } return true; } verifyCompleted(){ var dateNow = new Date(); var dateEnd=new Date(window.getCookie("fastCupom39").split("-")[0].replace(/,/g,"-")); if ((dateNow>dateEnd || dateEnd == "Invalid Date") && this.getCookie("completedFastCupom39") == ""&&!0){ this.setCookie("completedFastCupom39","expired",this.getExpireAt()); document.getElementById("hoopWidgetCoupon").style.display = "none"; document.getElementById("Cupom-relampago-container").classList.remove("mostrar"); document.getElementById("Cupom-relampago-container").classList.remove("mostrarForm"); return 1 } return 0 } sendEvent(inputName,inputEmail,inputPhone){ var name = null; var email = null; var phone = null; var place = null; var cpf = null; var website = null; var company=null; if (inputName !== null){ name = inputName.value; }if (inputEmail !== null){ email = inputEmail.value; }if (inputPhone !== null){ phone = inputPhone.value; } if(document.getElementById("place")){ place=document.getElementById("place").value } if(document.getElementById("cpf")){ cpf=document.getElementById("cpf").value } if(document.getElementById("website")){ website=document.getElementById("website").value } if(document.getElementById("company")){ company=document.getElementById("company").value } if(this.getCookie("external_ref") == ""){ this.setCookie("external_ref",this.uuidv4(), this.getExpireAt()); } this.setCookie("completedFastCupom39","completed", this.getExpireAt()); function formatParams( params ){ return "?" + Object .keys(params) .map(function(key){ return key+"="+encodeURIComponent(params[key]) }) .join("&") } var request = new XMLHttpRequest(); var token = "08f61930e047187d91df1ec6874a7f87"; const endpoint = "https://ecomm.hoopcompany.com/api/hoopcompany_leadform/08f61930e047187d91df1ec6874a7f87"; var params = { topic_id:663, name:name, email:email, whats:phone, place:place, cpf:cpf, website:website, company_name:company, page_name: document.title, page_url: window.location.href, type: "MegaCoupon", external_ref: this.getCookie("external_ref"), origin:"mega_coupon", optins:JSON.stringify(hoopModalOptinMega.checked), hoopCliente:this.getCookie("hoopCliente")==1?1:0, }; var url = endpoint + formatParams(params); request.onreadystatechange = function (){ if (request.readyState == 4){ console.log(request); } }; request.open("POST",url); request.send(); this.setCookie("hoopCliente",1, this.getExpireAt()); } openModalTerm(){ document.getElementsByClassName("hoop-modal-termOfUse")[0].classList.toggle("mostrar"); } getExpireAt(){ return "2024-01-01"; } fMascCPF() { // input4, this.mCPF var objeto=document.getElementById("cpf"); var cpf=objeto.value; cpf=cpf.replace(/\D/g,""); cpf=cpf.replace(/(\d{3})(\d)/,"$1.$2"); cpf=cpf.replace(/(\d{3})(\d)/,"$1.$2"); cpf=cpf.replace(/(\d{3})(\d{1,2})$/,"$1-$2"); objeto.value=cpf; } fMascPhone() { // input4, this.mCPF var objeto=document.getElementById("inputTel"); var value=objeto.value; value = value.replace(/\D/g,"") value = value.replace(/(\d{2})(\d)/,"($1) $2") value = value.replace(/(\d)(\d{4})$/,"$1-$2") objeto.value=value; } } if (this.getCookie("completedFastCupom39") == ""||0){ function myTimer() { if(typeof hoopModalOptinMega != "undefined"){ window.cupom = new Cupom39("R$ 20","EUQUERO20"); } else{ setTimeout(myTimer, 1000); } } myTimer(); }