crmbonus-component-wake 2.1.35-homolog → 2.1.37-homolog

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +0,0 @@
1
- import{r as t,h as i,H as e}from"./p-8c362346.js";import{C as o,U as s,g as n,a,b as r,c,p as d}from"./p-bea5a5c2.js";import{d as l,S as h,i as p,g as u,M as f}from"./p-b4f52f79.js";import{d as b,a as g}from"./p-af3ba015.js";const m=class{constructor(i){t(this,i);this.downtime=undefined;this.dataCriacao=undefined;this.minutos=6;this.segundos=60;this.tempoRestante=undefined}componentWillLoad(){const t=this.minutos*this.segundos*1e3;const i=new Date(this.dataCriacao);const e=new Date;const o=e.getTime()-i.getTime();if(o>=t){this.tempoRestante=0;this.onTempoEsgotado()}else{this.tempoRestante=t-o;this.startCountdown()}}disconnectedCallback(){clearInterval(this.intervalId)}startCountdown(){this.intervalId=setInterval((()=>{this.tempoRestante-=1e3;if(this.tempoRestante<=0){this.tempoRestante=0;clearInterval(this.intervalId);this.onTempoEsgotado()}}),1e3)}onTempoEsgotado(){console.log("Tempo esgotado! Executando ação...");this.downtime()}render(){const t=Math.floor(this.tempoRestante/6e4);const e=Math.floor(this.tempoRestante%6e4/1e3);const o=`${String(t).padStart(2,"0")}:${String(e).padStart(2,"0")}`;return i("label",{key:"ed1e0654cba5b152adcadb10cf9dfd6909c07a1f"}," ",o)}};var x;(function(t){t["P"]="Promocao";t["CC"]="ContaCorrente";t["PP"]="PromocaoProduto";t["F"]="Formula"})(x||(x={}));function y(t=[]){const i=[];for(const n of t){let t=v(n.Ajustes);var e=n.PrecoDe*n.Quantidade;var o=n.PrecoDe*n.Quantidade;var s=t*-1;const a=n.Ajustes.filter((t=>[x.PP].includes(t.Tipo)));const r=a.length>0;i.push({sku:n.SKU,value:e,originalValue:o,productVariantId:n.ProdutoVarianteId.toString(),quantity:n.Quantidade,discount:e<s?e:s,promotion_product:r})}return i}function v(t=[]){let i=0;for(const e of t){if([x.P,x.CC,x.PP].includes(e.Tipo)){i+=e.Valor}}return i}const w=".container-button{cursor:pointer;padding:5px 5px 5px 14px;}.section-crm{border:1px solid #dbd4d4;text-align:-webkit-center;margin-bottom:20px}.section-cart-crm{margin-top:10px}.section-cart-crm p{padding:0;margin:0px 0px 0px 15px}.button{top:50%;background-color:#6c6c7e;color:#fff;border:none;padding:15px;min-height:30px;min-width:120px;cursor:pointer;margin-left:10px;height:70px}.form-container{width:97%;display:flex;justify-content:space-around}.btn{display:inline-block;padding:6px 12px;margin-bottom:0;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-image:none;border:1px solid transparent;border-radius:0px}.form-container .btnCrm{background:#00162e;border-color:#00162e;width:30%;color:#fff}.message-alert{color:#df4d4d;margin-top:5px}";const k=w;const I=class{constructor(i){t(this,i);this.crmBonusService=o.getInstance();this.cart=undefined;this.canhidden=false;this.showModal=false;this.cartWake=undefined;this.customer={birthDate:"",document:"",name:"",phone:""};this.loading=false;this.message=undefined;this.phone=undefined;this.canCancel=false;this.amountCancel=undefined;this.sent=undefined;this.session=undefined;this.loading_reprocess=false;this.styles=l;this.reservedInfo=undefined}async resetBonus(){console.log("[CRMBONUS] - reset bonus");try{await this.crmBonusRef.processBonus(this.buildProducts(),true);console.log("[BONUS RESETADO]!!!!!")}catch(t){this.loading=false;console.log("[error ao reprocessar bonous]");await this.crmBonusRef.setStep(h.STEP_PHONE)}finally{this.loading=false}}async setloading(){this.loading_reprocess=!this.loading_reprocess}async reprocess(){console.log("[CRMBONUS] - reprocess");this.loading_reprocess=true;try{const t=localStorage.getItem(s);if(!t)return;this.cartWake=await n();await this.resetBonus()}catch(t){console.debug("[watchProducts]",t.message)}finally{this.loading_reprocess=false}}async componentWillLoad(){this.loading_reprocess=true;window.addEventListener("productRemovedFromCart",(async()=>{console.log("[CRMBONUS] - productRemovedFromCart");await this.reprocess()}));window.addEventListener("productAddedToCart",(async()=>{console.log("[CRMBONUS] - productAddedToCart");await this.reprocess()}));document.querySelectorAll("form").forEach((t=>{t.addEventListener("submit",(async()=>{console.log("[CRMBONUS] - Formulário está sendo submetido!");await this.reprocess()}))}));await this.observerHandle();p.changeLanguage(p.language)}async componentDidLoad(){await this.loadSession();this.handleLoad();await this.loadConfigStore();this.loading_reprocess=false}async observerHandle(){const t=document.getElementsByTagName("a");for(let i of t){console.log("[el.href]",i.href);if(i.href.includes("Produto/Delete")){i.addEventListener("click",(async()=>{console.log("[CRMBONUS] - Produto removido do carrinho");setTimeout((async()=>{await this.reprocess();this.observerHandle()}),2e3)}))}if(i.href.includes("Produto/Add")){i.addEventListener("click",(async()=>{console.log("[CRMBONUS] - Produto adicionado ao carrinho");setTimeout((async()=>{await this.reprocess();this.observerHandle()}),2e3)}))}}}async loadConfigStore(){const[t,i]=await Promise.all([this.crmBonusService.getCustomization(this.cartWake.store.name),a(this.cartWake.id,this.cartWake.store.name)]);this.reservedInfo=i;if(t.keepStoreFrontStyle){this.styles=null}}async fetchCustomer(t,i){try{return await this.crmBonusService.getCustomer(t,i)}catch(t){console.error("[fetchCustomer] Error fetching customer:",t);return null}}async handleLoad(){try{const t=localStorage.getItem(this.cartWake.id);if(t){this.canCancel=true;this.amountCancel=t}await this.buildAndGetProducts(this.cartWake.products)}catch(t){console.log("info customer")}}async loadSession(){this.cartWake=this.cart?new r(JSON.parse(this.cart)):await n();console.log("[bc:carregou carrinho]");this.session=await this.crmBonusService.getToken(this.cartWake.store.name);console.log("[bc:carregou session]");setTimeout((()=>{this.loadSession()}),15e5)}async buildAndGetProducts(t){console.log();const i=`bc-products:${this.cartWake.id}`;const e=JSON.stringify(t);localStorage.setItem(i,e);const o=JSON.parse(localStorage.getItem(i));const s=[];for(const i of t){const[t]=o.filter((t=>t.ProdutoVarianteId==i.ProdutoVarianteId));if(t){s.push(Object.assign(Object.assign({},i),{PrecoPor:t.PrecoPor,PrecoDe:t.PrecoDe,Quantidade:t.Quantidade,Ajustes:t.Ajustes}))}else{s.push(i)}}this.cartWake.products=s}async sendPin(t){var i,e;this.loading=true;this.message="";try{const i=t.replace(/\D/g,"");this.phone=Number(i);this.sent=await this.crmBonusService.sendPin(this.phone,this.customer.name,this.cartWake.store.name);await this.crmBonusRef.setStep(h.STEP_PIN);this.showModal=true}catch(t){this.message=(e=(i=t===null||t===void 0?void 0:t.response)===null||i===void 0?void 0:i.data)===null||e===void 0?void 0:e.message}finally{this.loading=false}}async sendPinName(t){var i,e;this.loading=true;this.message="";try{this.customer.name=t;this.sent=await this.crmBonusService.sendPin(this.phone,this.customer.name,this.cartWake.store.name);await this.crmBonusRef.setStep(h.STEP_PIN);this.showModal=true}catch(t){this.message=(e=(i=t===null||t===void 0?void 0:t.response)===null||i===void 0?void 0:i.data)===null||e===void 0?void 0:e.message}finally{this.loading=false}}buildProducts(){return y(this.cartWake.products)}handleCloseModal(){this.showModal=false}save(t){localStorage.setItem(this.cartWake.id,t.toString());this.canCancel=true;this.amountCancel=t.toString()}async cancel(){this.message="";this.loading=true;try{await this.crmBonusService.cancel(this.cartWake.id);this.canCancel=false;localStorage.removeItem(this.cartWake.id)}catch(t){this.message="Não consegui cancelar o bônus, tente novamente!"}finally{this.loading=false}}async handleSendPin(t){this.message="";if(!t){this.message="Informe seu telefone";return}this.customer.phone=t;const i=t.replace(/\D/g,"");this.phone=Number(i);if(this.customer.name){return this.sendPin(t)}await this.crmBonusRef.setStep(h.STEP_NAME);this.showModal=true}render(){if(this.canhidden){return null}return i("loading-container",{loading:this.loading_reprocess,text:"carregando..."},!this.loading_reprocess&&i("crm-giftback-form",{customStyles:this.styles,style:{position:"relative"},ref:t=>this.crmBonusRef=t,storeName:this.cartWake.store.name,products:this.buildProducts(),cartId:this.cartWake.id,customer:this.customer,loadProducts:()=>this.buildProducts(),loadAll:()=>this.handleLoad(),reservedInfo:this.reservedInfo}))}static get assetsDirs(){return["assets"]}};I.style=k;const M="input,button{margin:0;padding:10px;}.crm-contaner-button{height:auto;width:auto}.crm-button{height:48px;width:100%;border:1px solid #000;padding:14px 20px;background-color:#000;color:#fff;line-height:20px;font-weight:500;cursor:pointer}";const N=M;const D=class{constructor(i){t(this,i);this.txtBtn=undefined;this.loading=undefined;this.handleClick=undefined}render(){return i("div",{key:"785b4975fb6538dbe2cdb7b99d5801abc72c534a",class:"crm-contaner-button"},i("button",{key:"1e41951aa024e9f3b9b1836e8386bd369d022f76",class:"crm-button",onClick:()=>this.handleClick()},!this.loading?this.txtBtn:i("loading-spinner",{size:"15px",color:"#fff"})))}};D.style=N;const S="*{margin:0;padding:0;box-sizing:border-box}:host{--crmfont-sizebodymd:14px;--crmline-heightbodymd:20px;--crmletter-spacingtitle-md:0px}.container-message{font-weight:400;line-height:var(--crmline-heightbodymd);letter-spacing:var(--crmletter-spacingtitle-md);text-align:left;text-underline-position:from-font;text-decoration-skip-ink:none}.crm-container-form{display:flex;flex-direction:column;justify-content:space-around;height:auto;padding:20px 24px 20px 24px;border:1px solid #CCCC;writing-mode:horizontal-tb;gap:16px;border-top:1px solid #ccc !important;border-bottom:1px solid #ccc !important}.crm-phone-form{display:flex;flex-direction:column;height:100%;gap:16px}.crm-subtitle{font-size:.875rem;line-height:1.25rem}.crm-title{font-weight:700;line-height:20px;color:#262626;}.crm-message-info{color:#619013;font-weight:500;}.crm-message-error{color:#E11D48;font-weight:500;}";const C=S;const j=class{constructor(i){t(this,i);this.crmBonusService=o.getInstance();this.storeName=undefined;this.cartId=undefined;this.products=undefined;this.customer=undefined;this.loadProducts=undefined;this.loadAll=undefined;this.customStyles=undefined;this.reservedInfo=undefined;this.value=undefined;this.loading=false;this.message=undefined;this.phone=undefined;this.pinInfo=undefined;this.step=h.STEP_RESERVE;this.bonus=undefined;this.sucess="";this.error="";this.config=undefined;this.hasApplyBonus=false;this.loadingAllComponent=false}async setStep(t){this.step=t}async processBonus(t=[],i=false){await this.loadProducts();this.sucess="";if(i){this.products=t}const e=localStorage.getItem(c(this.cartId));if(e){const t=JSON.parse(e);this.bonus=t;this.phone=t.phone;this.pinInfo={storeId:t.storeId,userId:t.userId};await this.validateBonus("2018")}}async handleSendPin(t){await this.loadAll();this.message="";if(!t){this.message="Informe seu telefone";return}this.phone=t;this.sendPin()}async componentWillLoad(){this.sucess="";this.error="";this.config=u(this.storeName);const t=this.getPhoneNumberAgain();if(t){this.step=h.STEP_PHONE;return}await this.processBonus()}getPhoneNumberAgain(){const t=localStorage.getItem(c(this.cartId));if(!t)return true;const i=JSON.parse(t);return!i.hasBonus}convertStringToNumber(){var t;const i=(t=this.phone)===null||t===void 0?void 0:t.replace(/\D/g,"");return Number(i)}async sendPin(){var t,i,e;this.loading=true;this.message="";this.sucess="";this.error="";try{const i=this.convertStringToNumber();const e=localStorage.getItem(`bc:${this.phone}`);if(!e){this.pinInfo=await this.crmBonusService.sendPin(i,(t=this.customer)===null||t===void 0?void 0:t.name,this.storeName)}if(e){const t=JSON.parse(e);this.pinInfo={storeId:t.storeId,userId:t.userId};await this.validateBonus("2018")}else{this.step=h.STEP_PIN}}catch(t){this.message=(e=(i=t===null||t===void 0?void 0:t.response)===null||i===void 0?void 0:i.data)===null||e===void 0?void 0:e.message}finally{this.loading=false}}changePhone(){this.sucess="";this.error="";this.step=h.STEP_PHONE}async validateBonus(t){var i,e,o,n,a,r,d,l,p,u,f,b;this.loadingAllComponent=true;await this.loadProducts();const g=localStorage.getItem(s);if(g=="dontUse"){this.step=h.STEP_RESERVE;return}this.loading=true;this.sucess="";this.error="";const m=((i=this.pinInfo)===null||i===void 0?void 0:i.storeId)||((o=(e=this.reservedInfo)===null||e===void 0?void 0:e.metadata)===null||o===void 0?void 0:o.storeId);const x=((n=this.pinInfo)===null||n===void 0?void 0:n.userId)||((r=(a=this.reservedInfo)===null||a===void 0?void 0:a.metadata)===null||r===void 0?void 0:r.userId);const y=(l=(d=this.reservedInfo)===null||d===void 0?void 0:d.metadata)===null||l===void 0?void 0:l.cellphone;const v={pin:t,cellphone:y||this.convertStringToNumber(),storeId:m.toString(),userId:x.toString(),checkoutId:this.cartId,checkoutProducts:this.products,name:(p=this.customer)===null||p===void 0?void 0:p.name,storeName:this.storeName};try{this.bonus=await this.crmBonusService.validatePinBonus(v);if(!this.bonus.hasBonus){localStorage.setItem(c(this.cartId),JSON.stringify(Object.assign(Object.assign({},this.bonus),{phone:this.phone})));this.loading=false;this.step=h.STEP_NO_BONUS;return}this.sucess="Código validado com sucesso!";localStorage.setItem(c(this.cartId),JSON.stringify(Object.assign(Object.assign({},this.bonus),{phone:this.phone})));localStorage.setItem(`bc:${this.phone}`,JSON.stringify(this.bonus));localStorage.setItem(s,"use");localStorage.setItem(this.cartId,this.bonus.bonusBalance.toString());this.updateMetadata({storeId:Number(m),userId:Number(x)},v.cellphone);console.log("RESERVE",this.bonus);this.step=h.STEP_RESERVE}catch(t){const i=(f=(u=t===null||t===void 0?void 0:t.response)===null||u===void 0?void 0:u.data)===null||f===void 0?void 0:f.response;const e=(b=t===null||t===void 0?void 0:t.response)===null||b===void 0?void 0:b.data;if(i&&i.includes("Pin")){this.error="Código inválido!"}else if([403,500].includes(e.statusCode)){this.error="ocorreu um error, atualize a pagina e tente novamente!"}else{this.error=i;this.step=h.STEP_NO_BONUS}}finally{this.loading=false;this.loadingAllComponent=false}}async updateMetadata(t,i){try{if(this.reservedInfo.isExpired()){console.log("[CRM:updateMetadata]");await d(this.storeName,this.cartId,{createdAt:Date.now(),url:window.location.href,storeId:t.storeId,userId:t.userId,cellphone:i});localStorage.removeItem("bc:time")}else{await d(this.storeName,this.cartId,{url:window.location.href,storeId:t.storeId,userId:t.userId,cellphone:i})}}catch(t){console.error("[CRMBONUS:updateMetadata]: ",t)}}handleCancel(){this.cancel()}async cancel(){this.message="";this.loading=true;try{await this.crmBonusService.cancel(this.cartId);localStorage.setItem(s,"dontUse");await this.updateMetadata({storeId:null,userId:null},null)}catch(t){this.message="Não consegui cancelar o bônus, tente novamente!"}finally{this.loading=false}}async reserveApply(t){this.loading=true;this.message="";try{await this.reserve(t)}catch(t){this.message="ocorreu um error ao solicitar a aplicação do bonus! tente novamente";this.step=h.STEP_NO_BONUS;localStorage.removeItem(this.cartId)}finally{this.loading=false}}async reserve(t){await this.crmBonusService.reserve({redeemedBonus:t,cartId:this.cartId,ticket:this.cartId,grossValue:Number(this.bonus.totalValue),storeName:this.storeName,storeId:this.bonus.storeId.toString(),userId:this.bonus.userId})}render(){return i("div",{key:"939a74f8d91ab9c880ffb2486967a7800a6d2ce6",class:"crm-container-form fbits-responsive-carrinho-desconto",style:this.customStyles},i("label",{key:"b51c241a72ae22911293ad3dd28190f22982c8cb",class:"crm-title"},this.config.giftbackTitle),this.error&&i("label",{key:"9ca50e050603ad594b3086c82f2a31e08d8dec12",class:"crm-message-error"},this.error),this.step===h.STEP_PHONE&&i("phone-form",{key:"ab8cd8263aaf2729f9af29937a40e029bf17193d",value:this.customer.phone,config:this.config,loading:this.loading,handlerSubmit:t=>this.handleSendPin(t)}),this.step===h.STEP_PIN&&i("pin-form",{key:"da1680e62073ae2a3656fcef4ec85ec8b8d862cf",config:this.config,phone:this.phone,cancel:()=>this.changePhone(),resend:()=>this.sendPin(),validate:t=>this.validateBonus(t),loading:this.loading},this.sucess&&i("p",{key:"72486a002bbcb2cfad2f8ab32fbdda1e8dff143e",class:"crm-message-info"},this.sucess),this.error&&i("p",{key:"dcddaee2dd0e7b6d50ef0377ae7a721ba5c8256c",class:"crm-message-error"},this.error)),this.step===h.STEP_RESERVE&&i("giftback-info",{key:"b237add0b03aa26f20bdf42264b01ad890670145",storeName:this.storeName,infoBonus:this.reservedInfo,config:this.config,loading:this.loading,cancel:()=>this.handleCancel(),bonus:this.bonus,reserve:()=>this.processBonus(),cartId:this.cartId}),this.step===h.STEP_NO_BONUS&&i("div",{key:"6583e51ae1988bd5c797665e3119eed3aeb7a354",class:"container-message"},p.t("noGiftback",{storename:this.config.giftbackTitle})))}};j.style=C;const A="data:image/svg+xml;base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ljg5MTM3IDIuNzUgMTJDMi43NSAxNy4xMDg2IDYuODkxMzcgMjEuMjUgMTIgMjEuMjVDMTcuMTA4NiAyMS4yNSAyMS4yNSAxNy4xMDg2IDIxLjI1IDEyQzIxLjI1IDYuODkxMzcgMTcuMTA4NiAyLjc1IDEyIDIuNzVaIiBmaWxsPSIjMUMyNzRDIi8+DQo8L3N2Zz4=";const T=".crm-tooltip-container {\r\n display: flex;\r\n\r\n & img {\r\n width: 16px;\r\n margin-left: 3px;\r\n position: relative;\r\n }\r\n}\r\n\r\n.crm-tooltip {\r\n position: relative;\r\n display: inline-block;\r\n}\r\n\r\n.crm-tooltip .tooltiptext {\r\n visibility: hidden;\r\n background-color: black;\r\n color: #fff;\r\n text-align: center;\r\n padding: 8px 12px;\r\n border-radius: 0px;\r\n position: absolute;\r\n z-index: 1;\r\n min-width: 271px;\r\n top: 100%;\r\n left: 50%;\r\n margin-left: -238px;\r\n}\r\n\r\n@container (max-width: 410px) {\r\n .crm-tooltip .tooltiptext {\r\n margin-left: -14px;\r\n }\r\n\r\n .crm-tooltip #crm-role-description {\r\n margin-left: -151px;\r\n }\r\n}\r\n\r\n@container (max-width: 250px) {\r\n .crm-tooltip .tooltiptext {\r\n margin-left: -201px;\r\n }\r\n}\r\n\r\n.crm-tooltip:hover .tooltiptext {\r\n visibility: visible;\r\n}";const z=T;const P=class{constructor(i){t(this,i);this.text=undefined;this.identity=undefined}render(){return i("div",{key:"01d82d0172ca5f0dbb0b8ea278b4a5d438c13dd5",class:"crm-tooltip-container crm-tooltip"},i("img",{key:"3b632cc38e8ff206402a2bfaadba9f9d2d747095",src:A}),i("span",{key:"08310e35ac945bda0e9356ecad8742698016f262",id:this.identity,class:"tooltiptext"},this.text))}};P.style=z;const U=":host{--text-color:#6D6D5F}.giftback-container{display:flex;flex-direction:column;gap:14px}h3{margin-bottom:8px;color:#333}.container-description{display:flex;align-items:center;gap:5px;margin:0 0 10px 0}.container-description p{font-weight:400;margin:0px}p{color:#000}.value-display h2{color:#6D6D5F;margin:16px 0}input[type='range']{width:100%;margin:12px 0;-webkit-appearance:none;background:#ddd;height:4px;border-radius:4px;outline:none;padding:3px 0px 3px 3px}input[type=\"range\"]::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:20px;height:20px;background:rgb(109, 109, 95);border-radius:50%;cursor:pointer}.options{margin:0px 0;display:flex;gap:10px;flex-direction:column}.options label{display:flex;margin:0px 0;color:#333;align-items:center}.options input[type='radio']{margin-right:8px;height:16px;width:16px}.options input[type='radio']{appearance:none;-webkit-appearance:none;margin-right:8px;width:16px;height:16px;border:2px solid #ddd;border-radius:50%;background-color:#fff;cursor:pointer;transition:all 0.3s;padding:0px}.options input[type='radio']:checked{border-color:#000;background-color:#FAFAFA;border:4px solid #000}.info-box{background-color:#f9f9f9;border:1px solid #e0e0e0;border-radius:4px;padding:8px;color:#262626;line-height:20px}.info-icon{cursor:pointer;color:#888}h3{margin-bottom:8px;color:#333}.slider-wrapper{position:relative;margin:21px 0px 0px 0px}.slider{width:100%;-webkit-appearance:none;background:#ddd;height:4px;border-radius:2px;outline:none}.slider::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:16px;height:16px;background:var(--text-color);border-radius:50%;cursor:pointer}.slider-value{position:absolute;top:-30px;font-weight:700;color:var(--text-color);transform:translateX(-50%);white-space:nowrap;}.options-option{display:flex}";const E=U;const O=class{constructor(i){t(this,i);this.usedValue=0;this.selectedOption="none";this.cartId=undefined;this.loading=false;this.bonus={totalBonus:0,cartId:"",minimumPurchase:0,bonusBalance:0,calculatedValue:0,firstValidityDate:"",totalValue:0};this.reserve=undefined;this.cancel=undefined;this.config=undefined;this.infoBonus=undefined;this.storeName=undefined;this.sliderPosition=0;this.sliderValuePosition=0;this.loadingTime=false}changedBonus(){this.updateBonus()}updateBonus(){this.usedValue=this.bonus.bonusBalance;this.buildPositionSlider(0,this.bonus.totalBonus)}componentWillLoad(){this.updateBonus();this.selectedOption=localStorage.getItem(s)}handleSliderChange(t){const i=t.target;this.usedValue=parseFloat(i.value);this.buildPositionSlider(parseFloat(i.min),parseFloat(i.max))}componentDidLoad(){var t;if(this.bonus){this._refIinputRange.value=(t=this.bonus)===null||t===void 0?void 0:t.bonusBalance.toString()}}buildPositionSlider(t,i){const e=i*.1;const o=(this.usedValue-t)/(i-t)*100;this.sliderPosition=o;this.sliderValuePosition=o+(this.usedValue<=e?10:0)}async handleOptionChange(t){this.selectedOption=t;localStorage.setItem(s,t);await d(this.storeName,this.cartId,Object.assign(Object.assign({},this.infoBonus.metadata),{createdAt:null}));switch(this.selectedOption){case"use":await this.reserve(this.usedValue);break;case"dontUse":await this.cancel();break}}showTime(){if(!this.infoBonus)return false;return!this.infoBonus.isExpired()}getTime(){var t,i;const e=new Date((i=(t=this.infoBonus)===null||t===void 0?void 0:t.metadata)===null||i===void 0?void 0:i.createdAt);const o=new Date(e);o.setMinutes(o.getMinutes()+6);return{createdAt:e,expiration:o}}async downtime(){await d(this.storeName,this.bonus.cartId,{createdAt:null})}render(){var t,e,o,s,n,a,r;console.log("this.bonus",this.bonus);const c=this.bonus.minimumPurchase-this.bonus.totalValue;const d=p.t("giftDescription",{amount:`${(e=(t=this.bonus)===null||t===void 0?void 0:t.totalBonus)===null||e===void 0?void 0:e.toFixed(2).replace(".",",")}`,custom_name:"Giftback"});const l=b(c);return i("div",{key:"baf90a1de29b3275c1c3cfd31f9d004ca3187a84",class:"giftback-container"},i("div",{key:"57af5fe5b40b3292a275065f577a9444470f8bf0",class:"container-description"},i("p",{key:"fff28c85077c36854f37d5f23f2908fa47197dac",innerHTML:d}),i("crm-tooltip",{key:"b66b1914dfa5e0806f85a9695840fdd4bd52d21e",identity:"crm-role-description",text:p.t("labelUseGiftback",{minimumPurchase:this.bonus.minimumPurchase,expírationDate:g(this.bonus.firstValidityDate)})})),i("div",{key:"e13afe9428744084443697df22048ac05b41ffd0",class:"slider-wrapper"},i("div",{key:"1826a50e4e1b474322dbb0020db0154fe9ed5b80",class:"slider-value",style:{left:`calc(${this.sliderValuePosition}% - 20px)`}},"R$ ",this.usedValue.toFixed(2).replace(".",",")),i("input",{key:"73b42919b8e4e0223dc8490a6190697d1975e96d",ref:t=>this._refIinputRange=t,id:"position_value_id",disabled:true,type:"range",min:"0",max:this.bonus.totalBonus,value:this.usedValue,class:"slider",step:"0.01",onInput:t=>this.handleSliderChange(t),style:{background:`linear-gradient(to right, #6D6D5F ${this.sliderPosition}%, #ddd ${this.sliderPosition}%)`}})),l.isComplete&&i("p",{key:"b9b853490c112bf3e98d14c2ceee25d0b7604983"},p.t("maxAmount")),!l.isComplete&&i("div",{key:"50b23f6c4bde42ca12b077a33f0ffbde25601e3d",class:"container-description"},i("p",{key:"73bfbcc779b8775aecc63050816909ba9120af3e"},"Adicione ",i("strong",{key:"6d5a2ea943a1d3eee80b0f4d0cdda159a300bb25"},"R$ ",c<0?"0,00":c.toFixed(2).replace(".",","))," ao carrinho para atingir o valor máximo!"),i("crm-tooltip",{key:"5a5bbbeb32abd51fbfb84c63d3e7a06f8d459ea0",identity:"crm-max-description",text:p.t("labelamountPartial")})),i("div",{key:"ea3f6aa8f4668b759b912bac36d9780e183a6180",class:"options"},i("div",{key:"6f7f70930c8cd97f1215301d823f8631d071b472",class:"options-option"},i("input",{key:"35b4f8380f34becd4dc94c1bcb1572c2b3401db8",disabled:this.showTime(),type:"radio",name:"giftbackOption",value:"use",checked:this.selectedOption==="use",onChange:()=>this.handleOptionChange("use")}),i("p",{key:"228beeb474e10a67811925bee00e5c1d0f5d64b6"},"Usar o meu ",(o=this.config)===null||o===void 0?void 0:o.giftbackTitle)),i("div",{key:"2a9ad1052f869057d5e36c3eba0cf1a24af88e1b",class:"options-option"},i("input",{key:"3cc3fae293fda510873f9c5f4d906308affca8e1",disabled:this.showTime(),type:"radio",name:"giftbackOption",value:"dontUse",checked:this.selectedOption==="dontUse",onChange:()=>this.handleOptionChange("dontUse")}),i("p",{key:"364f7de414a6f536680f849fe3efdee803d9a596"},"Não usar o meu ",(s=this.config)===null||s===void 0?void 0:s.giftbackTitle))),this.showTime()&&i("div",{key:"8fe525904208e2fc13ebd80615bbe7856cc2dc2c",class:"info-box"},"Após ",i("countdown-timer",{key:"3913bc9060980620654f03a987f62f628d6ee440",dataCriacao:new Date((a=(n=this.infoBonus)===null||n===void 0?void 0:n.metadata)===null||a===void 0?void 0:a.createdAt).toString(),downtime:()=>{window.location.reload()}}),", você poderá alterar sua escolha de usar ou não o Giftback."),!((r=this===null||this===void 0?void 0:this.infoBonus)===null||r===void 0?void 0:r.isBonusProcessed)&&i("div",{key:"aecd80b9920c8b483d38a1c24a6b38ce03d52b64",class:"info-box"},"O Giftback será aplicado na próxima etapa."))}static get watchers(){return{bonus:["changedBonus"]}}};O.style=E;const L=".loading-container{position:absolute;top:0;left:0;width:100%;height:100%;background-color:rgba(0, 0, 0, 0.5);display:flex;justify-content:center;align-items:center;z-index:1000;flex-direction:column;}.loading-container p{margin:6px 0px;color:white;font-size:large}.loading-spinner{width:40px;height:40px;border:5px solid rgba(255, 255, 255, 0.3);border-top:5px solid white;border-radius:50%;animation:spin 1s linear infinite;}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.relative-xy{position:relative}";const B=L;const R=class{constructor(i){t(this,i);this.loading=true;this.text=null}render(){return i("div",{key:"5e323e6b562ee4d770bb2c9f786a23d6b47ce06e",class:"relative-xy"},this.loading&&i("div",{key:"31183c82285ec32c7de0348885d0fd30e4a82502",class:"loading-container"},i("div",{key:"1de235c7594a15e822d044364de0700d3c9e1fa4",class:"loading-spinner"}),this.text&&i("p",{key:"82daa6b96a1e14d83be2fc22fd879b3a41896d0e"},this.text)),i("slot",{key:"09c654783fde15f7b34c4a0804fcec07cfa28b30"}))}};R.style=B;const V=".spinner{display:inline-block;border:4px solid transparent;border-radius:50%;border-top-color:var(--color, #0078d7);animation:spin 1s linear infinite}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}";const F=V;const G=class{constructor(i){t(this,i);this.size="50px";this.color="#0078d7"}render(){return i("div",{key:"e1916d264937b0470cd5b1581c87184061b40c3a",class:"spinner",style:{width:this.size,height:this.size,borderColor:`${this.color} transparent transparent transparent`}})}};G.style=F;const $="*{margin:0;padding:0;box-sizing:border-box}:host{--crmfont-sizebodymd:14px;--crmline-heightbodymd:20px;--crmletter-spacingtitle-md:0px}.container-message{font-weight:400;line-height:var(--crmline-heightbodymd);letter-spacing:var(--crmletter-spacingtitle-md);text-align:left;text-underline-position:from-font;text-decoration-skip-ink:none}.crm-container-form{display:flex;flex-direction:column;justify-content:space-around;height:auto;padding:20px 24px 20px 24px;border:1px solid #CCCC;writing-mode:horizontal-tb;gap:16px;border-top:1px solid #ccc !important;border-bottom:1px solid #ccc !important}.crm-phone-form{display:flex;flex-direction:column;height:100%;gap:16px}.crm-subtitle{font-size:.875rem;line-height:1.25rem}.crm-title{font-weight:700;line-height:20px;color:#262626;}.crm-message-info{color:#619013;font-weight:500;}.crm-message-error{color:#E11D48;font-weight:500;}";const Q=$;const W=class{constructor(i){t(this,i);this.value=undefined;this.loading=undefined;this.handlerSubmit=undefined;this.config=undefined}async handlePhone(){const t=await this.phoneInputMask.getPhone();await this.handlerSubmit(t)}render(){var t;return i(e,{key:"b27f64d8464d4c6b259d2d5f0113f55a6f809afb",class:"crm-phone-form"},i("p",{key:"6f279841f43cd7f70f7a1b5340288b9c2d11c551",class:"crm-subtitle"},"Digite o seu celular para verificar se há desconto disponível nessa compra:"),i("phone-input-mask",{key:"7e86f63998a4f35d134b8f4e867a5e5c0b9df20a",initialValue:this.value,ref:t=>this.phoneInputMask=t}),i("crm-button",{key:"462b7cc91f166c8fc588a5c922ba943a6715dca5",txtBtn:((t=this.config)===null||t===void 0?void 0:t.btnApplyBonusLabel)||"Avançar",loading:this.loading,handleClick:()=>this.handlePhone()}))}};W.style=Q;const Z="*{margin:0;padding:0;box-sizing:border-box}.phone{display:block;width:100%;height:24px;padding:6px 12px;line-height:1.42857143;color:#555;background-color:#fff;background-image:none;border:1px solid #ccc;border-radius:0px;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, .075);box-shadow:inset 0 1px 1px rgba(0, 0, 0, .075);-webkit-transition:border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;-o-transition:border-color ease-in-out .15s, box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s, box-shadow ease-in-out .15s}.phone-input-form{width:100%;height:48px;padding:13px 16px 13px 16px;border:1px solid #CCCCCC;}.crm-erro-msg{color:#E11D48;font-weight:500;margin-top:11px}";const _=Z;const J=class{constructor(i){t(this,i);this.phone="";this.message="";this.initialValue=undefined;this.disabled=undefined}componentWillLoad(){this.phone=this.initialValue}formatPhone(t){const i=t.replace(/\D/g,"");const e=i.match(/^(\d{0,2})(\d{0,5})(\d{0,4})$/);if(!e)return t;const o=e[1]?`(${e[1]}`:"";const s=e[2]?`) ${e[2]}`:"";const n=e[3]?` ${e[3]}`:"";return`${o}${s}${n}`}handleInput(t){const i=t.target;this.phone=this.formatPhone(i.value);if(!this.validatePhoneNumber(i.value)){this.message=f}else{this.message=""}console.log("phone",this.phone)}validatePhoneNumber(t){if(t.length<15){return true}const i=/^\(\d{2}\) \d{5} \d{4}$/;return i.test(t)}async getPhone(){return this.phone}render(){return i("div",{key:"bbb0389d0a7ccb8651b8ee20e92dd4cdc94e3617"},i("input",{key:"b36cc9e65314cb786c7f94fee6b4992ba30a82e6",disabled:this.disabled,id:"phone",type:"text",class:"phone-input-form",value:this.phone,onInput:t=>this.handleInput(t),placeholder:"(99) 99999 9999"}),i("p",{key:"81e48cda38cd9a8fc7d753d269425bd4288c57b1",class:"crm-erro-msg"},this.message))}};J.style=_;const H=":host{display:block}.form-container-pin{display:flex;flex-direction:column;align-items:center}.pin-container{display:flex;justify-content:start;gap:10px}.pin-container input{width:100%;height:48px;text-align:center;border:1px solid #ccc;border-radius:5px}button{padding:10px 20px;background-color:#ddd;border:none;border-radius:5px;cursor:pointer}.success{color:green;margin-top:10px}.button{top:50%;background-color:#6c6c7e;color:#fff;border:none;border-radius:10px;padding:15px;min-height:30px;min-width:120px;cursor:pointer}.button-cancel{top:50%;background-color:#ffffff;color:#1e1c1c;border:1px solid gray;border-radius:10px;padding:10px;min-height:30px;min-width:120px;cursor:pointer}.crm-description{width:100%;display:flex;gap:9px;flex-wrap:wrap}.crm-description a{font-weight:bold;cursor:pointer;text-decoration:underline}.crm-description div{display:flex;gap:5px}";const X=H;const Y="*{margin:0;padding:0;box-sizing:border-box}:host{--crmfont-sizebodymd:14px;--crmline-heightbodymd:20px;--crmletter-spacingtitle-md:0px}.container-message{font-weight:400;line-height:var(--crmline-heightbodymd);letter-spacing:var(--crmletter-spacingtitle-md);text-align:left;text-underline-position:from-font;text-decoration-skip-ink:none}.crm-container-form{display:flex;flex-direction:column;justify-content:space-around;height:auto;padding:20px 24px 20px 24px;border:1px solid #CCCC;writing-mode:horizontal-tb;gap:16px;border-top:1px solid #ccc !important;border-bottom:1px solid #ccc !important}.crm-phone-form{display:flex;flex-direction:column;height:100%;gap:16px}.crm-subtitle{font-size:.875rem;line-height:1.25rem}.crm-title{font-weight:700;line-height:20px;color:#262626;}.crm-message-info{color:#619013;font-weight:500;}.crm-message-error{color:#E11D48;font-weight:500;}";const K=Y;const q=class{constructor(i){t(this,i);this.validate=undefined;this.cancel=undefined;this.resend=undefined;this.sent=undefined;this.loading=false;this.phone=undefined;this.config=undefined;this.pin=["","","",""];this.isVerified=false;this.canResend=false}componentWillLoad(){this.canResend=false}handleInput(t,i){const e=t.target;const o=e.value.slice(0,1);this.pin[i]=o;if(o&&i<this.pin.length-1){const t=e.nextElementSibling;t===null||t===void 0?void 0:t.focus()}this.pin=[...this.pin]}validatePin(){localStorage.removeItem("bc:resend");this.validate(this.pin.join(""))}verifyPin(){const t=this.pin.join("");if(t==="9999"){this.isVerified=true}}handleTimeout(){localStorage.removeItem("bc:resend");this.canResend=true}async handleResend(){await this.resend();this.canResend=false;this.pin=["","","",""];localStorage.removeItem("bc:resend")}buildTime(){const t=localStorage.getItem("bc:resend");if(t){return t}const i=new Date;i.setSeconds(i.getSeconds()+30);localStorage.setItem("bc:resend",i.toString());return i.toString()}render(){var t;return i("div",{key:"3f60e4c74c925daf656092812f40ae0d1f3b5a99",class:"crm-phone-form"},i("label",{key:"d0c023e22ff7eb8978ee6cc0ca4ced8192c53c20",class:"crm-subtitle"},p.t("pin-sutitle")," ",i("strong",{key:"05bb0e2493c99abaa29031a7cc787260266bb417"},"+55 ",this.phone)),i("div",{key:"24c8eb55625f3b880741086c66decd96ecf40044",class:"pin-container"},this.pin.map(((t,e)=>i("input",{type:"text",maxLength:1,value:this.pin[e],onInput:t=>this.handleInput(t,e)})))),i("slot",{key:"02276aa80396d16f779a92a381e75506fa37d56d"}),i("p",{key:"27af068858b3ead8a70b8ec961d367c7beb04d94",class:"crm-description"}," Não recebeu?",!this.canResend&&i("label",{key:"8ef93baf6f92142292078e5e4bcc125ff12b80d7"}," Reenviar em",i("countdown-timer",{key:"f3a0c60c7a88229e37add445886c44b00c60913f",minutos:0,segundos:30,dataCriacao:this.buildTime(),downtime:()=>this.handleTimeout()})," "),this.canResend&&i("div",{key:"2d1b5b028a7085d912acb0d0c696436e8aa75a29"},i("a",{key:"ad9aea2c6f167f1270c75b8dbd2ee79879f7567d",onClick:()=>this.handleResend()},"Reenviar"),i("a",{key:"b0734ab0e472c5cf24fa083c0a712e4f29cf8d79",onClick:()=>this.cancel()},"Trocar número"))),i("crm-button",{key:"39095211d007c871f48971509c3ff52b0f257c29",txtBtn:((t=this.config)===null||t===void 0?void 0:t.btnApplyBonusLabel)||"Avançar",loading:this.loading,handleClick:()=>this.validatePin()}))}};q.style=X+K;export{m as countdown_timer,I as crm_bonus,D as crm_button,j as crm_giftback_form,P as crm_tooltip,O as giftback_info,R as loading_container,G as loading_spinner,W as phone_form,J as phone_input_mask,q as pin_form};
2
- //# sourceMappingURL=p-99e8c3f7.entry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["CountdownTimer","componentWillLoad","tempoTotal","this","minutos","segundos","data","Date","dataCriacao","agora","tempoPassado","getTime","tempoRestante","onTempoEsgotado","startCountdown","disconnectedCallback","clearInterval","intervalId","setInterval","console","log","downtime","render","Math","floor","tempoFormatado","String","padStart","h","key","AjustesTipoEnum","buildProductsByWake","productsWake","products","pw","discounts","getDiscount","Ajustes","value","PrecoDe","Quantidade","originalValue","discounts_value","existsPromotionProduct","filter","adj","PP","includes","Tipo","promotion_product","length","push","sku","SKU","productVariantId","ProdutoVarianteId","toString","quantity","discount","ajustes","P","CC","Valor","crmBonusCss","CrmBonusStyle0","CrmBonus","crmBonusService","CrmBonusService","getInstance","birthDate","document","name","phone","defaultStyles","resetBonus","crmBonusRef","processBonus","buildProducts","err","loading","setStep","StepFormEnum","STEP_PHONE","setloading","loading_reprocess","reprocess","isUse","localStorage","getItem","USED_KEY","cartWake","getCart","debug","message","window","addEventListener","async","querySelectorAll","forEach","el","observerHandle","i18next","changeLanguage","language","componentDidLoad","loadSession","handleLoad","loadConfigStore","elements","getElementsByTagName","href","setTimeout","customization","infoBonus","Promise","all","getCustomization","store","getInfoBonusByCartIdAndStoreName","id","reservedInfo","keepStoreFrontStyle","styles","fetchCustomer","userId","storeName","getCustomer","error","amount","canCancel","amountCancel","buildAndGetProducts","cart","CartWake","JSON","parse","session","getToken","productsString","stringify","setItem","products_in_cache","product_cart","pro","p","Object","assign","PrecoPor","sendPin","_phone","replace","Number","sent","customer","STEP_PIN","showModal","_b","_a","response","sendPinName","customerName","handleCloseModal","save","cancel","removeItem","handleSendPin","STEP_NAME","canhidden","text","customStyles","style","position","ref","cartId","loadProducts","loadAll","crmButtonCss","CrmButtonStyle0","Button","class","onClick","handleClick","txtBtn","size","color","giftbackFormCss","CrmGiftbackFormStyle0","STEP_RESERVE","step","hasNewProduct","sucess","_bonus","getKeyReserveByCartId","bonus","pinInfo","storeId","validateBonus","config","getInfoCustomization","phoneAgain","getPhoneNumberAgain","consulta_bonus","hasBonus","convertStringToNumber","pinInfoCache","_c","changePhone","pin","loadingAllComponent","used_or_no","metadata","_d","_f","_e","cellphone","_h","_g","payload","checkoutId","checkoutProducts","_j","validatePinBonus","STEP_NO_BONUS","bonusBalance","updateMetadata","_error","_l","_k","_m","statusCode","isExpired","persisteMetadata","createdAt","now","url","location","handleCancel","reserveApply","reserve","redeemedBonus","ticket","grossValue","totalValue","giftbackTitle","handlerSubmit","resend","validate","t","storename","infoCircleSvgrepoComSvg","crmTooltipCss","CrmTooltipStyle0","Tooltip","src","info","identity","giftbackInfoCss","GiftbackInfoStyle0","GiftbackInfo","totalBonus","minimumPurchase","calculatedValue","firstValidityDate","changedBonus","updateBonus","usedValue","buildPositionSlider","selectedOption","handleSliderChange","event","input","target","parseFloat","min","max","_refIinputRange","percentage_init","percentage","sliderPosition","sliderValuePosition","handleOptionChange","option","showTime","expiration","setMinutes","getMinutes","remainingGiftback","translateDescription","toFixed","custom_name","limit","defineLimit","innerHTML","formatDateToBr","left","disabled","type","onInput","background","isComplete","checked","onChange","reload","isBonusProcessed","loadingContainerCss","LoadingContainerStyle0","LoadingContainer","loadingSpinnerCss","LoadingSpinnerStyle0","LoadingSpinner","width","height","borderColor","PhoneFormStyle0","PhoneForm","handlePhone","phoneInputMask","getPhone","Host","initialValue","btnApplyBonusLabel","phoneInputMaskCss","PhoneInputMaskStyle0","PhoneInputMask","formatPhone","cleaned","match","part1","part2","part3","handleInput","validatePhoneNumber","MESSAGE_ERROR_INVALID_NUMBER","phoneRegex","test","placeholder","pinFormCss","PinFormStyle0","PinFormStyle1","GiftbackPin","canResend","index","slice","nextInput","nextElementSibling","focus","validatePin","join","verifyPin","pinCode","isVerified","handleTimeout","handleResend","buildTime","resendDate","date","setSeconds","getSeconds","map","_","maxLength"],"sources":["src/components/countdown-timer/countdown-timer.tsx","src/dto/validate.pin.bonus.ts","src/helpers/build.payload.helper.ts","src/components/crm-bonus/crm-bonus.css?tag=crm-bonus&encapsulation=shadow","src/components/crm-bonus/crm-bonus.tsx","src/components/button/crm-button.css?tag=crm-button","src/components/button/index.tsx","src/components/giftback-form/giftback-form.css?tag=crm-giftback-form","src/components/giftback-form/giftback-form.tsx","src/assets/svg/info-circle-svgrepo-com.svg","src/components/tooltip/crm-tooltip.css?tag=crm-tooltip","src/components/tooltip/tooltip.tsx","src/components/giftback-form/subcomponents/giftback-info/giftback-info.css?tag=giftback-info","src/components/giftback-form/subcomponents/giftback-info/giftback-info.tsx","src/components/loading-container/loading-container.css?tag=loading-container","src/components/loading-container/loading-container.tsx","src/components/loading-spinner/loading-spinner.css?tag=loading-spinner&encapsulation=shadow","src/components/loading-spinner/loading-spinner.tsx","src/components/giftback-form/giftback-form.css?tag=phone-form","src/components/giftback-form/subcomponents/phone-form/phone-form.tsx","src/components/phone/phone-input-mask.css?tag=phone-input-mask&encapsulation=shadow","src/components/phone/phone-input-mask.tsx","src/components/giftback-form/subcomponents/pin-form/pin-form.css?tag=pin-form&encapsulation=shadow","src/components/giftback-form/giftback-form.css?tag=pin-form&encapsulation=shadow","src/components/giftback-form/subcomponents/pin-form/pin-form.tsx"],"sourcesContent":["import { Component, Prop, State, h } from '@stencil/core';\r\n\r\n@Component({\r\n tag: 'countdown-timer',\r\n})\r\nexport class CountdownTimer {\r\n\r\n @Prop() downtime: () => void;\r\n @Prop() dataCriacao: string;\r\n @Prop() minutos: number = 6;\r\n @Prop() segundos: number = 60;\r\n\r\n @State() tempoRestante: number; // em milissegundos\r\n\r\n private intervalId: any;\r\n\r\n componentWillLoad() {\r\n const tempoTotal = this.minutos * this.segundos * 1000;\r\n const data = new Date(this.dataCriacao);\r\n const agora = new Date();\r\n const tempoPassado = agora.getTime() - data.getTime();\r\n\r\n if (tempoPassado >= tempoTotal) {\r\n this.tempoRestante = 0;\r\n this.onTempoEsgotado();\r\n } else {\r\n this.tempoRestante = tempoTotal - tempoPassado;\r\n this.startCountdown();\r\n }\r\n }\r\n\r\n disconnectedCallback() {\r\n clearInterval(this.intervalId);\r\n }\r\n\r\n startCountdown() {\r\n this.intervalId = setInterval(() => {\r\n this.tempoRestante -= 1000;\r\n if (this.tempoRestante <= 0) {\r\n this.tempoRestante = 0;\r\n clearInterval(this.intervalId);\r\n this.onTempoEsgotado();\r\n }\r\n }, 1000);\r\n }\r\n\r\n onTempoEsgotado() {\r\n console.log('Tempo esgotado! Executando ação...');\r\n this.downtime()\r\n }\r\n\r\n render() {\r\n const minutos = Math.floor(this.tempoRestante / 60000);\r\n const segundos = Math.floor((this.tempoRestante % 60000) / 1000);\r\n const tempoFormatado = `${String(minutos).padStart(2, '0')}:${String(segundos).padStart(2, '0')}`;\r\n\r\n return (\r\n <label> {tempoFormatado}</label>\r\n );\r\n }\r\n}\r\n","export interface IProduct {\r\n productVariantId: string;\r\n sku: string;\r\n value: number;\r\n originalValue: number;\r\n quantity: number;\r\n discount: number;\r\n promotion_product: boolean;\r\n}\r\n\r\nexport enum AjustesTipoEnum {\r\n P = \"Promocao\",\r\n CC = \"ContaCorrente\",\r\n PP = \"PromocaoProduto\",\r\n F = \"Formula\"\r\n}\r\n\r\nexport interface IAjustes {\r\n Tipo: AjustesTipoEnum;\r\n Valor: number;\r\n}\r\n\r\nexport interface IUser {\r\n id: number;\r\n}\r\n\r\nexport interface IStore {\r\n name: string;\r\n}\r\n\r\nexport interface IProductWake {\r\n ProdutoVarianteId: number;\r\n SKU: string;\r\n PrecoPor: number;\r\n PrecoDe: number;\r\n Quantidade: number;\r\n Ajustes: IAjustes[];\r\n}\r\n\r\nexport interface ICustomer {\r\n birthDate: string;\r\n document: string;\r\n name: string;\r\n phone: string;\r\n}\r\n\r\nexport interface IProccesPinBonusDto {\r\n storeName: string;\r\n name: string;\r\n checkoutId: string;\r\n checkoutProducts: Array<IProduct>;\r\n storeId: string;\r\n userId: string;\r\n cellphone: number;\r\n pin: string;\r\n\r\n}\r\n\r\nexport interface IBonus {\r\n hasBonus: boolean;\r\n bonusBalance: number;\r\n totalBonus: number;\r\n minimumPurchase: number;\r\n bonusIds: string;\r\n firstValidityDate: string\r\n history: [\r\n {\r\n validityStart: string;\r\n validityEnd: string;\r\n value: number\r\n },\r\n {\r\n validityStart: string;\r\n validityEnd: string\r\n value: number\r\n }\r\n ]\r\n storeId: number;\r\n userId: number;\r\n cartId: string\r\n calculatedValue: number;\r\n totalValue: number\r\n}\r\n\r\n\r\nexport interface IReserveDTO {\r\n storeName: string;\r\n cartId: string;\r\n grossValue: number;\r\n redeemedBonus: number;\r\n ticket: string;\r\n storeId: string;\r\n userId: number;\r\n}","import { AjustesTipoEnum, IAjustes, IProduct, IProductWake } from \"../dto/validate.pin.bonus\";\r\n\r\nexport function buildProductsByWake(productsWake: Array<IProductWake> = []): Array<IProduct> {\r\n\r\n const products: Array<IProduct> = [];\r\n\r\n for ( const pw of productsWake ) {\r\n let discounts = getDiscount(pw.Ajustes)\r\n // let discounts_formula = getDiscountFormula(pw.Ajustes);\r\n\r\n var value = (pw.PrecoDe * pw.Quantidade);\r\n var originalValue = (pw.PrecoDe * pw.Quantidade);\r\n\r\n var discounts_value = (discounts * -1)\r\n\r\n const existsPromotionProduct = pw.Ajustes.filter(adj => [AjustesTipoEnum.PP].includes(adj.Tipo))\r\n\r\n const promotion_product = (existsPromotionProduct.length > 0)\r\n\r\n products.push(\r\n {\r\n sku: pw.SKU,\r\n value: value,\r\n originalValue: originalValue,\r\n productVariantId: pw.ProdutoVarianteId.toString(),\r\n quantity: pw.Quantidade,\r\n discount: value < discounts_value ? value : discounts_value,\r\n promotion_product\r\n }\r\n )\r\n }\r\n\r\n return products;\r\n}\r\n\r\nfunction getDiscount(ajustes: IAjustes[] = []) {\r\n \r\n let discounts = 0;\r\n \r\n for(const discount of ajustes) {\r\n if([AjustesTipoEnum.P, AjustesTipoEnum.CC, AjustesTipoEnum.PP].includes(discount.Tipo)) {\r\n discounts += discount.Valor;\r\n }\r\n }\r\n\r\n return discounts;\r\n}\r\n\r\n// function getDiscountFormula(ajustes: IAjustes[] = []) {\r\n \r\n// let discounts = 0;\r\n \r\n// for(const discount of ajustes) {\r\n// if([AjustesTipoEnum.F].includes(discount.Tipo)) {\r\n// discounts += (discount.Valor * -1);\r\n// }\r\n// }\r\n\r\n// return discounts;\r\n// }","\r\n.container-button {\r\n /* max-width: 100%; */\r\n cursor: pointer;\r\n padding: 5px 5px 5px 14px;\r\n /* display: flex; */\r\n}\r\n\r\n/* padding: 0 15px 15px;\r\nborder: 1px solid #ddd;\r\nmargin-bottom: 20px; */\r\n\r\n.section-crm {\r\n border: 1px solid #dbd4d4;\r\n /* min-height: 50px; */\r\n text-align: -webkit-center;\r\n margin-bottom: 20px;\r\n}\r\n\r\n.section-cart-crm {\r\n margin-top: 10px;\r\n}\r\n\r\n.section-cart-crm p {\r\n padding: 0;\r\n margin: 0px 0px 0px 15px;\r\n}\r\n\r\n.button {\r\n top: 50%;\r\n background-color: #6c6c7e;\r\n color: #fff;\r\n border: none;\r\n /* border-radius: 10px; */\r\n padding: 15px;\r\n min-height: 30px;\r\n min-width: 120px;\r\n /* font-size: 20px; */\r\n cursor: pointer;\r\n margin-left: 10px;\r\n height: 70px;\r\n}\r\n\r\n.form-container {\r\n width: 97%;\r\n display: flex;\r\n justify-content: space-around;\r\n}\r\n\r\n\r\n.btn {\r\n display: inline-block;\r\n padding: 6px 12px;\r\n margin-bottom: 0;\r\n /* font-size: 14px; */\r\n font-weight: 400;\r\n line-height: 1.42857143;\r\n text-align: center;\r\n white-space: nowrap;\r\n vertical-align: middle;\r\n -ms-touch-action: manipulation;\r\n touch-action: manipulation;\r\n cursor: pointer;\r\n -webkit-user-select: none;\r\n -moz-user-select: none;\r\n -ms-user-select: none;\r\n user-select: none;\r\n background-image: none;\r\n border: 1px solid transparent;\r\n border-radius: 0px;\r\n}\r\n\r\n.form-container .btnCrm {\r\n background: #00162e;\r\n border-color: #00162e;\r\n width: 30%;\r\n color: #fff;\r\n}\r\n\r\n.message-alert {\r\n color: #df4d4d;\r\n margin-top: 5px;\r\n}","import { Component, Method, Prop, State, h } from '@stencil/core';\r\nimport { IProduct, IProductWake, ICustomer } from '../../dto/validate.pin.bonus';\r\nimport { CrmBonusService } from '../../services/crmbonus.service';\r\nimport { IPinSent } from '../../components';\r\nimport { defaultStyles, StepFormEnum } from '../../contants';\r\n\r\nimport i18next from '../../i18n/i18n'\r\nimport { buildProductsByWake } from '../../helpers/build.payload.helper';\r\nimport { getCart, getInfoBonusByCartIdAndStoreName } from '../../helpers/cart.helper';\r\nimport { CartWake } from '../../objectvalues/cart.wake';\r\nimport { USED_KEY } from '../../utils/keys.storage';\r\nimport { ReservedInfoDTO } from '../../dto/reserved-info.dto';\r\n\r\n@Component({\r\n tag: 'crm-bonus',\r\n styleUrl: 'crm-bonus.css',\r\n assetsDirs: ['assets'],\r\n // scoped: true\r\n shadow: true\r\n})\r\nexport class CrmBonus {\r\n\r\n private crmBonusService: CrmBonusService = CrmBonusService.getInstance();\r\n\r\n private crmBonusRef: HTMLCrmGiftbackFormElement;\r\n\r\n @Prop() cart;\r\n @Prop() canhidden: boolean = false;\r\n\r\n @State() showModal: boolean = false;\r\n\r\n @State() cartWake: CartWake;\r\n\r\n @State() customer: ICustomer = {\r\n birthDate: \"\",\r\n document: \"\",\r\n name: \"\",\r\n phone: \"\"\r\n };\r\n\r\n @State() loading: boolean = false;\r\n @State() message: string;\r\n @State() phone: number;\r\n @State() canCancel: boolean = false;\r\n @State() amountCancel: string;\r\n @State() sent: IPinSent;\r\n\r\n @State() session: string;\r\n @State() loading_reprocess = false;\r\n @State() styles = defaultStyles;\r\n @State() reservedInfo: ReservedInfoDTO;\r\n\r\n @Method()\r\n async resetBonus() {\r\n console.log('[CRMBONUS] - reset bonus');\r\n\r\n try {\r\n await this.crmBonusRef.processBonus(this.buildProducts(), true);\r\n console.log('[BONUS RESETADO]!!!!!');\r\n } catch (err) {\r\n\r\n this.loading = false;\r\n console.log('[error ao reprocessar bonous]');\r\n await this.crmBonusRef.setStep(StepFormEnum.STEP_PHONE);\r\n } finally {\r\n this.loading = false;\r\n }\r\n }\r\n\r\n @Method()\r\n async setloading() {\r\n this.loading_reprocess = !this.loading_reprocess;\r\n }\r\n\r\n @Method()\r\n async reprocess() {\r\n console.log(\"[CRMBONUS] - reprocess\")\r\n this.loading_reprocess = true\r\n\r\n try {\r\n\r\n const isUse = localStorage.getItem(USED_KEY);\r\n\r\n if (!isUse) return;\r\n\r\n this.cartWake = await getCart();\r\n await this.resetBonus();\r\n } catch (err) {\r\n console.debug('[watchProducts]', err.message);\r\n } finally {\r\n this.loading_reprocess = false\r\n }\r\n }\r\n\r\n async componentWillLoad() {\r\n this.loading_reprocess = true;\r\n window.addEventListener('productRemovedFromCart', async () => {\r\n console.log('[CRMBONUS] - productRemovedFromCart');\r\n await this.reprocess()\r\n });\r\n\r\n window.addEventListener('productAddedToCart', async () => {\r\n console.log('[CRMBONUS] - productAddedToCart');\r\n await this.reprocess();\r\n });\r\n\r\n document.querySelectorAll('form').forEach((el) => {\r\n el.addEventListener(\"submit\", async () => {\r\n console.log(\"[CRMBONUS] - Formulário está sendo submetido!\");\r\n await this.reprocess();\r\n });\r\n });\r\n\r\n await this.observerHandle();\r\n\r\n i18next.changeLanguage(i18next.language);\r\n }\r\n\r\n async componentDidLoad() {\r\n await this.loadSession();\r\n this.handleLoad();\r\n await this.loadConfigStore();\r\n\r\n this.loading_reprocess = false;\r\n }\r\n\r\n private async observerHandle() {\r\n const elements = document.getElementsByTagName('a');\r\n\r\n //@ts-ignore\r\n for (let el of elements) {\r\n console.log('[el.href]', el.href);\r\n if (el.href.includes('Produto/Delete')) {\r\n el.addEventListener('click', async () => {\r\n console.log('[CRMBONUS] - Produto removido do carrinho');\r\n\r\n setTimeout(async () => {\r\n await this.reprocess();\r\n this.observerHandle();\r\n }, 2000);\r\n\r\n });\r\n }\r\n\r\n if (el.href.includes('Produto/Add')) {\r\n el.addEventListener('click', async () => {\r\n console.log('[CRMBONUS] - Produto adicionado ao carrinho');\r\n setTimeout(async () => {\r\n await this.reprocess();\r\n this.observerHandle();\r\n }, 2000);\r\n });\r\n }\r\n }\r\n }\r\n\r\n async loadConfigStore() {\r\n const [customization, infoBonus] = await Promise.all([\r\n this.crmBonusService.getCustomization(this.cartWake.store.name),\r\n getInfoBonusByCartIdAndStoreName(this.cartWake.id, this.cartWake.store.name)\r\n ]);\r\n\r\n this.reservedInfo = infoBonus;\r\n\r\n if (customization.keepStoreFrontStyle) {\r\n this.styles = null;\r\n }\r\n }\r\n\r\n async fetchCustomer(userId: number, storeName: string) {\r\n try {\r\n return await this.crmBonusService.getCustomer(userId, storeName);\r\n } catch (error) {\r\n console.error('[fetchCustomer] Error fetching customer:', error);\r\n return null;\r\n }\r\n }\r\n\r\n async handleLoad() {\r\n try {\r\n if (this.cartWake.user.id) {\r\n // this.fetchCustomer(this.cartWake.user.id, this.cartWake.store.name).then((customer) => {\r\n // if (customer) {\r\n // this.customer = customer;\r\n // }\r\n // });\r\n }\r\n\r\n const amount = localStorage.getItem(this.cartWake.id);\r\n\r\n if (amount) {\r\n this.canCancel = true;\r\n this.amountCancel = amount;\r\n }\r\n\r\n await this.buildAndGetProducts(this.cartWake.products);\r\n } catch (error) {\r\n console.log('info customer')\r\n }\r\n }\r\n\r\n async loadSession() {\r\n this.cartWake = this.cart ? new CartWake(JSON.parse(this.cart)) : await getCart();\r\n console.log('[bc:carregou carrinho]');\r\n\r\n this.session = await this.crmBonusService.getToken(this.cartWake.store.name);\r\n console.log('[bc:carregou session]');\r\n setTimeout(() => {\r\n this.loadSession()\r\n }, 1500000)\r\n }\r\n\r\n async buildAndGetProducts(productsWake: IProductWake[]) {\r\n console.log()\r\n\r\n const key = `bc-products:${this.cartWake.id}`;\r\n\r\n const productsString = JSON.stringify(productsWake)\r\n\r\n localStorage.setItem(key, productsString);\r\n\r\n const products_in_cache = JSON.parse(localStorage.getItem(key));\r\n\r\n const products: Array<IProductWake> = []\r\n\r\n for (const product_cart of productsWake) {\r\n\r\n const [pro] = products_in_cache.filter(p => p.ProdutoVarianteId == product_cart.ProdutoVarianteId)\r\n\r\n //const [ajuste = { Valor: 0 }] = pro.Ajustes.filter(aj => aj.Tipo === \"Formula\")\r\n\r\n if (pro) {\r\n products.push({\r\n ...product_cart,\r\n PrecoPor: pro.PrecoPor,\r\n PrecoDe: pro.PrecoDe,\r\n Quantidade: pro.Quantidade,\r\n Ajustes: pro.Ajustes\r\n })\r\n } else {\r\n products.push(product_cart)\r\n }\r\n\r\n }\r\n\r\n this.cartWake.products = products; //cache_products ? JSON.parse(cache_products) : JSON.parse(this.productsInString);\r\n\r\n }\r\n\r\n public async sendPin(phone: string) {\r\n this.loading = true;\r\n this.message = \"\";\r\n\r\n try {\r\n\r\n const _phone = phone.replace(/\\D/g, '');\r\n this.phone = Number(_phone);\r\n\r\n this.sent = await this.crmBonusService.sendPin(this.phone, this.customer.name, this.cartWake.store.name);;\r\n\r\n await this.crmBonusRef.setStep(StepFormEnum.STEP_PIN);\r\n\r\n this.showModal = true;\r\n } catch (error) {\r\n this.message = error?.response?.data?.message\r\n } finally {\r\n this.loading = false\r\n }\r\n }\r\n\r\n public async sendPinName(customerName: string) {\r\n this.loading = true;\r\n this.message = \"\";\r\n\r\n try {\r\n this.customer.name = customerName;\r\n\r\n this.sent = await this.crmBonusService.sendPin(this.phone, this.customer.name, this.cartWake.store.name);\r\n\r\n await this.crmBonusRef.setStep(StepFormEnum.STEP_PIN);\r\n\r\n this.showModal = true;\r\n } catch (error) {\r\n this.message = error?.response?.data?.message\r\n } finally {\r\n this.loading = false\r\n }\r\n }\r\n\r\n buildProducts(): IProduct[] {\r\n return buildProductsByWake(this.cartWake.products);\r\n }\r\n\r\n handleCloseModal() {\r\n this.showModal = false;\r\n }\r\n\r\n save(amount: number) {\r\n localStorage.setItem(this.cartWake.id, amount.toString());\r\n this.canCancel = true;\r\n this.amountCancel = amount.toString()\r\n }\r\n\r\n async cancel() {\r\n this.message = \"\";\r\n this.loading = true;\r\n try {\r\n await this.crmBonusService.cancel(this.cartWake.id);\r\n this.canCancel = false;\r\n\r\n localStorage.removeItem(this.cartWake.id);\r\n } catch (error) {\r\n this.message = \"Não consegui cancelar o bônus, tente novamente!\"\r\n } finally {\r\n this.loading = false;\r\n }\r\n }\r\n\r\n async handleSendPin(phone: string) {\r\n this.message = \"\"\r\n if (!phone) {\r\n this.message = \"Informe seu telefone\";\r\n return;\r\n }\r\n\r\n this.customer.phone = phone;\r\n const _phone = phone.replace(/\\D/g, '');\r\n this.phone = Number(_phone);\r\n\r\n if (this.customer.name) {\r\n return this.sendPin(phone)\r\n }\r\n\r\n await this.crmBonusRef.setStep(StepFormEnum.STEP_NAME);\r\n this.showModal = true;\r\n }\r\n\r\n render() {\r\n\r\n if (this.canhidden) {\r\n return null;\r\n }\r\n\r\n return (\r\n <loading-container loading={this.loading_reprocess} text='carregando...' >\r\n \r\n {\r\n !this.loading_reprocess && (\r\n <crm-giftback-form\r\n customStyles={this.styles}\r\n style={{ position: \"relative\" }}\r\n ref={ref => this.crmBonusRef = ref}\r\n storeName={this.cartWake.store.name}\r\n products={this.buildProducts()}\r\n cartId={this.cartWake.id}\r\n customer={this.customer}\r\n loadProducts={() => this.buildProducts()}\r\n loadAll={() => this.handleLoad()}\r\n reservedInfo={this.reservedInfo}\r\n />\r\n )\r\n }\r\n </loading-container>\r\n )\r\n }\r\n}\r\n","input, button {\r\n margin: 0;\r\n padding: 10px; /* Ajuste o valor conforme necessário */\r\n}\r\n\r\n.crm-contaner-button {\r\n height: auto;\r\n width: auto;\r\n}\r\n\r\n.crm-button {\r\n height: 48px;\r\n width: 100%;\r\n border: 1px solid #000;\r\n padding: 14px 20px;\r\n background-color: #000;\r\n color: #fff;\r\n /* font-size: 14px; */\r\n line-height: 20px;\r\n font-weight: 500;\r\n cursor: pointer;\r\n}","import { Component, Prop, h } from \"@stencil/core\";\r\n\r\n@Component({\r\n tag: 'crm-button',\r\n styleUrl: 'crm-button.css'\r\n})\r\nexport class Button {\r\n\r\n @Prop() txtBtn: string;\r\n @Prop() loading: boolean;\r\n\r\n @Prop() handleClick: () => void;\r\n\r\n render() {\r\n return (\r\n <div class=\"crm-contaner-button\">\r\n <button class=\"crm-button\" onClick={() => this.handleClick()}>\r\n {\r\n !this.loading ? this.txtBtn : <loading-spinner size=\"15px\" color=\"#fff\" />\r\n }\r\n </button>\r\n </div>\r\n )\r\n }\r\n}","* {\r\n margin: 0;\r\n padding: 0;\r\n box-sizing: border-box;\r\n}\r\n\r\n:host {\r\n --crmfont-sizebodymd: 14px;\r\n --crmline-heightbodymd: 20px;\r\n --crmletter-spacingtitle-md: 0px\r\n}\r\n\r\n.container-message {\r\n /* font-size: var(--crmfont-sizebodymd); */\r\n font-weight: 400;\r\n line-height: var(--crmline-heightbodymd);\r\n letter-spacing: var(--crmletter-spacingtitle-md);\r\n text-align: left;\r\n text-underline-position: from-font;\r\n text-decoration-skip-ink: none;\r\n}\r\n\r\n.crm-container-form {\r\n display: flex;\r\n flex-direction: column;\r\n justify-content: space-around;\r\n height: auto;\r\n padding: 20px 24px 20px 24px;\r\n border: 1px solid #CCCC;\r\n writing-mode: horizontal-tb;\r\n gap: 16px;\r\n border-top: 1px solid #ccc !important;\r\n border-bottom: 1px solid #ccc !important;\r\n}\r\n\r\n/* .fbits-responsive-carrinho-desconto {\r\n overflow: hidden;\r\n border: 1px solid #ccc;\r\n border-top: 0;\r\n border-bottom: 0;\r\n} */\r\n\r\n.crm-phone-form {\r\n display: flex;\r\n flex-direction: column;\r\n height: 100%;\r\n /* justify-content: space-around; */\r\n gap: 16px;\r\n}\r\n\r\n.crm-subtitle {\r\n /* font-size: 14px; */\r\n font-size: .875rem;\r\n line-height: 1.25rem;\r\n \r\n}\r\n\r\n.crm-title {\r\n font-weight: 700;\r\n line-height: 20px;\r\n color: #262626;\r\n /* font-size: 16px; */\r\n}\r\n\r\n.crm-message-info {\r\n color: #619013;\r\n font-weight: 500;\r\n /* font-size: 12px; */\r\n}\r\n\r\n.crm-message-error {\r\n color: #E11D48;\r\n font-weight: 500;\r\n /* font-size: 12px; */\r\n}","import { Component, Method, Prop, State, h } from \"@stencil/core\";\r\nimport { CrmBonusService } from \"../../services/crmbonus.service\";\r\nimport { StepFormEnum } from \"../../contants\";\r\nimport { IPinSent } from '../../dto/pin.sent'\r\nimport { IBonus, ICustomer, IProccesPinBonusDto, IProduct } from \"../../dto/validate.pin.bonus\";\r\nimport { IInfoStore, getInfoCustomization } from \"../../helpers/info.config.helper\";\r\n\r\nimport i18next from \"../../i18n/i18n\"\r\nimport { USED_KEY, getKeyReserveByCartId } from \"../../utils/keys.storage\";\r\nimport { persisteMetadata } from \"../../helpers/cart.helper\";\r\nimport { ReservedInfoDTO } from \"../../dto/reserved-info.dto\";\r\n\r\n@Component({\r\n tag: 'crm-giftback-form',\r\n styleUrl: 'giftback-form.css',\r\n shadow: false\r\n})\r\nexport class CrmBonus {\r\n // private phoneInputMask: HTMLPhoneFormElement;\r\n\r\n private crmBonusService: CrmBonusService = CrmBonusService.getInstance();\r\n\r\n @Prop({ attribute: 'storename' }) storeName;\r\n @Prop() cartId;\r\n @Prop() products: Array<IProduct>;\r\n @Prop() customer: ICustomer;\r\n @Prop() loadProducts: () => void;\r\n @Prop() loadAll: () => void;\r\n\r\n @Prop() customStyles;\r\n @Prop() reservedInfo: ReservedInfoDTO;\r\n\r\n @State() value: string;\r\n @State() loading: boolean = false;\r\n @State() message: string;\r\n @State() phone: string;\r\n @State() pinInfo: IPinSent;\r\n @State() step: StepFormEnum = StepFormEnum.STEP_RESERVE;\r\n @State() bonus: IBonus;\r\n\r\n @State() sucess: string = \"\";\r\n @State() error: string = \"\";\r\n @State() config: IInfoStore;\r\n @State() hasApplyBonus = false;\r\n\r\n @State() loadingAllComponent = false;\r\n\r\n @Method()\r\n async setStep(step: StepFormEnum) {\r\n this.step = step\r\n }\r\n\r\n @Method()\r\n async processBonus(products: IProduct[] = [], hasNewProduct = false) {\r\n await this.loadProducts();\r\n this.sucess = \"\";\r\n\r\n if (hasNewProduct) {\r\n this.products = products;\r\n }\r\n\r\n const _bonus = localStorage.getItem(getKeyReserveByCartId(this.cartId));\r\n\r\n if (_bonus) {\r\n\r\n const bonus = JSON.parse(_bonus)\r\n\r\n this.bonus = bonus;\r\n\r\n this.phone = bonus.phone;\r\n this.pinInfo = {\r\n storeId: bonus.storeId,\r\n userId: bonus.userId\r\n }\r\n\r\n await this.validateBonus(\"2018\");\r\n //this.step = StepFormEnum.STEP_RESERVE;\r\n\r\n }\r\n }\r\n\r\n async handleSendPin(phone: string) {\r\n await this.loadAll()\r\n this.message = \"\"\r\n if (!phone) {\r\n this.message = \"Informe seu telefone\";\r\n return;\r\n }\r\n\r\n this.phone = phone;\r\n\r\n this.sendPin();\r\n }\r\n\r\n async componentWillLoad() {\r\n this.sucess = \"\";\r\n this.error = \"\"\r\n this.config = getInfoCustomization(this.storeName);\r\n\r\n const phoneAgain = this.getPhoneNumberAgain();\r\n\r\n if (phoneAgain) {\r\n this.step = StepFormEnum.STEP_PHONE;\r\n return\r\n }\r\n\r\n await this.processBonus();\r\n\r\n }\r\n\r\n getPhoneNumberAgain() {\r\n const consulta_bonus = localStorage.getItem(getKeyReserveByCartId(this.cartId));\r\n\r\n if (!consulta_bonus) return true;\r\n\r\n const bonus = JSON.parse(consulta_bonus);\r\n\r\n return !bonus.hasBonus;\r\n }\r\n\r\n private convertStringToNumber(): number {\r\n const _phone = this.phone?.replace(/\\D/g, '');\r\n return Number(_phone);\r\n }\r\n\r\n public async sendPin() {\r\n this.loading = true;\r\n this.message = \"\";\r\n this.sucess = \"\";\r\n this.error = \"\"\r\n\r\n try {\r\n\r\n const _phone = this.convertStringToNumber();\r\n const pinInfoCache = localStorage.getItem(`bc:${this.phone}`);\r\n\r\n if (!pinInfoCache) {\r\n this.pinInfo = await this.crmBonusService.sendPin(_phone, this.customer?.name, this.storeName);\r\n }\r\n\r\n if (pinInfoCache) {\r\n\r\n const bonus = JSON.parse(pinInfoCache);\r\n\r\n this.pinInfo = {\r\n storeId: bonus.storeId,\r\n userId: bonus.userId\r\n }\r\n\r\n await this.validateBonus(\"2018\");\r\n // this.step = StepFormEnum.STEP_RESERVE;\r\n } else {\r\n this.step = StepFormEnum.STEP_PIN;\r\n }\r\n\r\n } catch (error) {\r\n this.message = error?.response?.data?.message\r\n } finally {\r\n this.loading = false\r\n }\r\n }\r\n\r\n changePhone() {\r\n this.sucess = \"\";\r\n this.error = \"\"\r\n this.step = StepFormEnum.STEP_PHONE;\r\n }\r\n\r\n public async validateBonus(pin: string) {\r\n this.loadingAllComponent = true;\r\n await this.loadProducts();\r\n\r\n const used_or_no = localStorage.getItem(USED_KEY);\r\n\r\n if (used_or_no == \"dontUse\") {\r\n this.step = StepFormEnum.STEP_RESERVE;\r\n return\r\n }\r\n\r\n this.loading = true;\r\n this.sucess = \"\";\r\n this.error = \"\";\r\n\r\n const storeId = this.pinInfo?.storeId || this.reservedInfo?.metadata?.storeId;\r\n const userId = this.pinInfo?.userId || this.reservedInfo?.metadata?.userId;\r\n const cellphone = this.reservedInfo?.metadata?.cellphone;\r\n\r\n const payload: IProccesPinBonusDto = {\r\n pin: pin,\r\n cellphone: cellphone || this.convertStringToNumber(),\r\n storeId: storeId.toString(),\r\n userId: userId.toString(),\r\n checkoutId: this.cartId,\r\n checkoutProducts: this.products,\r\n name: this.customer?.name,\r\n storeName: this.storeName\r\n }\r\n\r\n try {\r\n this.bonus = await this.crmBonusService.validatePinBonus(payload);\r\n\r\n if (!this.bonus.hasBonus) {\r\n\r\n localStorage.setItem(getKeyReserveByCartId(this.cartId), JSON.stringify({ ...this.bonus, phone: this.phone }));\r\n\r\n this.loading = false;\r\n this.step = StepFormEnum.STEP_NO_BONUS;\r\n return\r\n }\r\n\r\n this.sucess = \"Código validado com sucesso!\";\r\n localStorage.setItem(getKeyReserveByCartId(this.cartId), JSON.stringify({ ...this.bonus, phone: this.phone }));\r\n localStorage.setItem(`bc:${this.phone}`, JSON.stringify(this.bonus));\r\n\r\n localStorage.setItem(USED_KEY, \"use\");\r\n localStorage.setItem(this.cartId, this.bonus.bonusBalance.toString());\r\n\r\n this.updateMetadata({ storeId: Number(storeId), userId: Number(userId) }, payload.cellphone);\r\n\r\n console.log('RESERVE', this.bonus)\r\n this.step = StepFormEnum.STEP_RESERVE;\r\n\r\n } catch (error) {\r\n const _error: string = error?.response?.data?.response;\r\n const response = error?.response?.data;\r\n\r\n if (_error && _error.includes(\"Pin\")) {\r\n this.error = \"Código inválido!\"\r\n } else if ([403, 500].includes(response.statusCode)) {\r\n this.error = \"ocorreu um error, atualize a pagina e tente novamente!\"\r\n } else {\r\n this.error = _error;\r\n this.step = StepFormEnum.STEP_NO_BONUS;\r\n }\r\n } finally {\r\n this.loading = false;\r\n this.loadingAllComponent = false;\r\n }\r\n }\r\n\r\n private async updateMetadata(pinInfo: IPinSent, cellphone: number) {\r\n try {\r\n if (this.reservedInfo.isExpired()) {\r\n console.log('[CRM:updateMetadata]')\r\n await persisteMetadata(this.storeName, this.cartId, {\r\n createdAt: Date.now(),\r\n url: window.location.href,\r\n storeId: pinInfo.storeId,\r\n userId: pinInfo.userId,\r\n cellphone: cellphone,\r\n });\r\n\r\n localStorage.removeItem(\"bc:time\");\r\n } else {\r\n await persisteMetadata(this.storeName, this.cartId, {\r\n url: window.location.href,\r\n storeId: pinInfo.storeId,\r\n userId: pinInfo.userId,\r\n cellphone: cellphone,\r\n });\r\n }\r\n } catch (error) {\r\n console.error('[CRMBONUS:updateMetadata]: ', error);\r\n }\r\n }\r\n\r\n public handleCancel() {\r\n // this.step = StepFormEnum.STEP_PHONE;\r\n this.cancel()\r\n }\r\n\r\n async cancel() {\r\n this.message = \"\";\r\n this.loading = true;\r\n try {\r\n await this.crmBonusService.cancel(this.cartId);\r\n\r\n localStorage.setItem(USED_KEY, \"dontUse\");\r\n // this.save(0)\r\n await this.updateMetadata({ storeId: null, userId: null }, null);\r\n } catch (error) {\r\n this.message = \"Não consegui cancelar o bônus, tente novamente!\"\r\n } finally {\r\n this.loading = false;\r\n }\r\n }\r\n\r\n public async reserveApply(amount: number) {\r\n this.loading = true;\r\n this.message = \"\";\r\n try {\r\n await this.reserve(amount);\r\n // this.save(amount);\r\n\r\n } catch (error) {\r\n this.message = \"ocorreu um error ao solicitar a aplicação do bonus! tente novamente\"\r\n\r\n this.step = StepFormEnum.STEP_NO_BONUS;\r\n localStorage.removeItem(this.cartId);\r\n } finally {\r\n this.loading = false;\r\n }\r\n }\r\n\r\n // save(amount: number) {\r\n // localStorage.setItem(this.cartId, amount.toString());\r\n // }\r\n\r\n public async reserve(amount: number) {\r\n\r\n await this.crmBonusService.reserve({\r\n redeemedBonus: amount,\r\n cartId: this.cartId,\r\n ticket: this.cartId,\r\n grossValue: Number(this.bonus.totalValue),\r\n storeName: this.storeName,\r\n storeId: this.bonus.storeId.toString(),\r\n userId: this.bonus.userId\r\n });\r\n }\r\n\r\n render() {\r\n return (\r\n <div class=\"crm-container-form fbits-responsive-carrinho-desconto\" style={this.customStyles} >\r\n \r\n <label class=\"crm-title\">{this.config.giftbackTitle}</label>\r\n\r\n {\r\n this.error && (<label class=\"crm-message-error\">{this.error}</label>)\r\n }\r\n\r\n {this.step === StepFormEnum.STEP_PHONE &&\r\n <phone-form\r\n value={this.customer.phone}\r\n config={this.config}\r\n loading={this.loading}\r\n handlerSubmit={(phone) => this.handleSendPin(phone)}\r\n />}\r\n {\r\n this.step === StepFormEnum.STEP_PIN &&\r\n <pin-form\r\n config={this.config}\r\n phone={this.phone}\r\n cancel={() => this.changePhone()}\r\n resend={() => this.sendPin()}\r\n validate={(data) => this.validateBonus(data)}\r\n loading={this.loading}\r\n >\r\n {this.sucess && <p class=\"crm-message-info\">{this.sucess}</p>}\r\n {this.error && <p class=\"crm-message-error\">{this.error}</p>}\r\n\r\n </pin-form>\r\n }\r\n\r\n {\r\n this.step === StepFormEnum.STEP_RESERVE &&\r\n <giftback-info\r\n storeName={this.storeName}\r\n infoBonus={this.reservedInfo}\r\n config={this.config}\r\n loading={this.loading}\r\n cancel={() => this.handleCancel()}\r\n bonus={this.bonus}\r\n reserve={() => this.processBonus()}\r\n cartId={this.cartId}\r\n />\r\n }\r\n\r\n {\r\n this.step === StepFormEnum.STEP_NO_BONUS &&\r\n (\r\n <div class=\"container-message\">\r\n {i18next.t(\"noGiftback\", { storename: this.config.giftbackTitle })}\r\n </div>\r\n )\r\n\r\n }\r\n </div>\r\n )\r\n }\r\n}","<?xml version=\"1.0\" encoding=\"utf-8\"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->\r\n<svg width=\"800px\" height=\"800px\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\r\n<path d=\"M12 17.75C12.4142 17.75 12.75 17.4142 12.75 17V11C12.75 10.5858 12.4142 10.25 12 10.25C11.5858 10.25 11.25 10.5858 11.25 11V17C11.25 17.4142 11.5858 17.75 12 17.75Z\" fill=\"#1C274C\"/>\r\n<path d=\"M12 7C12.5523 7 13 7.44772 13 8C13 8.55228 12.5523 9 12 9C11.4477 9 11 8.55228 11 8C11 7.44772 11.4477 7 12 7Z\" fill=\"#1C274C\"/>\r\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M1.25 12C1.25 6.06294 6.06294 1.25 12 1.25C17.9371 1.25 22.75 6.06294 22.75 12C22.75 17.9371 17.9371 22.75 12 22.75C6.06294 22.75 1.25 17.9371 1.25 12ZM12 2.75C6.89137 2.75 2.75 6.89137 2.75 12C2.75 17.1086 6.89137 21.25 12 21.25C17.1086 21.25 21.25 17.1086 21.25 12C21.25 6.89137 17.1086 2.75 12 2.75Z\" fill=\"#1C274C\"/>\r\n</svg>",".crm-tooltip-container {\r\n display: flex;\r\n\r\n & img {\r\n width: 16px;\r\n margin-left: 3px;\r\n position: relative;\r\n }\r\n}\r\n\r\n.crm-tooltip {\r\n position: relative;\r\n display: inline-block;\r\n}\r\n\r\n.crm-tooltip .tooltiptext {\r\n visibility: hidden;\r\n background-color: black;\r\n color: #fff;\r\n text-align: center;\r\n padding: 8px 12px;\r\n border-radius: 0px;\r\n position: absolute;\r\n z-index: 1;\r\n min-width: 271px;\r\n top: 100%;\r\n left: 50%;\r\n margin-left: -238px;\r\n}\r\n\r\n@container (max-width: 410px) {\r\n .crm-tooltip .tooltiptext {\r\n margin-left: -14px;\r\n }\r\n\r\n .crm-tooltip #crm-role-description {\r\n margin-left: -151px;\r\n }\r\n}\r\n\r\n@container (max-width: 250px) {\r\n .crm-tooltip .tooltiptext {\r\n margin-left: -201px;\r\n }\r\n}\r\n\r\n.crm-tooltip:hover .tooltiptext {\r\n visibility: visible;\r\n}","import { Component, h, Prop } from \"@stencil/core\";\r\nimport info from '../../assets/svg/info-circle-svgrepo-com.svg';\r\n\r\n\r\n@Component({\r\n tag: 'crm-tooltip',\r\n styleUrl: 'crm-tooltip.css'\r\n})\r\nexport class Tooltip {\r\n\r\n @Prop() text: string;\r\n @Prop() identity: string;\r\n\r\n render() {\r\n return (\r\n <div class=\"crm-tooltip-container crm-tooltip\">\r\n <img src={info} />\r\n <span id={this.identity} class=\"tooltiptext\">{this.text}</span>\r\n </div>\r\n );\r\n }\r\n}",":host {\r\n --text-color: #6D6D5F\r\n}\r\n\r\n.giftback-container {\r\n display: flex;\r\n flex-direction: column;\r\n gap: 14px;\r\n}\r\n\r\nh3 {\r\n /* font-size: 1.2rem; */\r\n margin-bottom: 8px;\r\n color: #333;\r\n}\r\n\r\n.container-description {\r\n display: flex;\r\n align-items: center;\r\n gap: 5px;\r\n margin: 0 0 10px 0;\r\n}\r\n\r\n.container-description p {\r\n /* font-size: 14px; */\r\n font-weight: 400;\r\n margin: 0px;\r\n}\r\n\r\n\r\np {\r\n /* font-size: 14px; */\r\n color: #000;\r\n}\r\n\r\n.value-display h2 {\r\n color: #6D6D5F;\r\n /* Verde para o valor atual */\r\n /* font-size: 1.6rem; */\r\n margin: 16px 0;\r\n}\r\n\r\ninput[type='range'] {\r\n width: 100%;\r\n margin: 12px 0;\r\n -webkit-appearance: none;\r\n background: #ddd;\r\n height: 4px;\r\n border-radius: 4px;\r\n outline: none;\r\n padding: 3px 0px 3px 3px;\r\n}\r\n\r\n/* input[type='range']::-webkit-slider-thumb {\r\n -webkit-appearance: none;\r\n appearance: none;\r\n width: 16px;\r\n height: 16px;\r\n background: var(--text-color);\r\n border-radius: 50%;\r\n cursor: pointer;\r\n} */\r\n\r\ninput[type=\"range\"]::-webkit-slider-thumb {\r\n -webkit-appearance: none;\r\n appearance: none;\r\n width: 20px;\r\n height: 20px;\r\n background: rgb(109, 109, 95);\r\n /* Cor do botão */\r\n border-radius: 50%;\r\n cursor: pointer;\r\n}\r\n\r\n.options {\r\n margin: 0px 0;\r\n display: flex;\r\n gap: 10px;\r\n flex-direction: column;\r\n}\r\n\r\n.options label {\r\n display: flex;\r\n margin: 0px 0;\r\n /* font-size: 0.9rem; */\r\n color: #333;\r\n align-items: center;\r\n}\r\n\r\n.options input[type='radio'] {\r\n margin-right: 8px;\r\n height: 16px;\r\n width: 16px;\r\n}\r\n\r\n.options input[type='radio'] {\r\n appearance: none;\r\n -webkit-appearance: none;\r\n margin-right: 8px;\r\n width: 16px;\r\n height: 16px;\r\n border: 2px solid #ddd;\r\n border-radius: 50%;\r\n background-color: #fff;\r\n cursor: pointer;\r\n transition: all 0.3s;\r\n padding: 0px;\r\n}\r\n\r\n.options input[type='radio']:checked {\r\n border-color: #000;\r\n background-color: #FAFAFA;\r\n border: 4px solid #000;\r\n}\r\n\r\n.info-box {\r\n background-color: #f9f9f9;\r\n border: 1px solid #e0e0e0;\r\n border-radius: 4px;\r\n padding: 8px;\r\n /* font-size: 14px; */\r\n color: #262626;\r\n line-height: 20px;\r\n}\r\n\r\n.info-icon {\r\n /* font-size: 0.9rem; */\r\n cursor: pointer;\r\n color: #888;\r\n}\r\n\r\nh3 {\r\n /* font-size: 1.2rem; */\r\n margin-bottom: 8px;\r\n color: #333;\r\n}\r\n\r\n.slider-wrapper {\r\n position: relative;\r\n margin: 21px 0px 0px 0px;\r\n}\r\n\r\n.slider {\r\n width: 100%;\r\n -webkit-appearance: none;\r\n background: #ddd;\r\n height: 4px;\r\n border-radius: 2px;\r\n outline: none;\r\n}\r\n\r\n.slider::-webkit-slider-thumb {\r\n -webkit-appearance: none;\r\n appearance: none;\r\n width: 16px;\r\n height: 16px;\r\n background: var(--text-color);\r\n /* Azul para o slider */\r\n border-radius: 50%;\r\n cursor: pointer;\r\n}\r\n\r\n.slider-value {\r\n position: absolute;\r\n top: -30px;\r\n /* Posição acima do slider */\r\n /* font-size: 16px; */\r\n font-weight: 700;\r\n color: var(--text-color);\r\n /* Verde para o texto */\r\n transform: translateX(-50%);\r\n white-space: nowrap;\r\n /* margin-left: 23px; */\r\n}\r\n\r\n.options-option {\r\n display: flex;\r\n}\r\n\r\n\r\n/* ########################################## */\r\n","import { Component, Prop, State, Watch, h } from \"@stencil/core\";\r\nimport { IBonus } from \"../../../../dto/validate.pin.bonus\";\r\n\r\nimport i18next from '../../../../i18n/i18n'\r\nimport { USED_KEY } from \"../../../../utils/keys.storage\";\r\nimport { defineLimit, formatDateToBr } from \"../../../../utils/utils\";\r\nimport { IInfoStore } from \"../../../../helpers/info.config.helper\";\r\nimport { ReservedInfoDTO } from \"../../../../dto/reserved-info.dto\";\r\nimport { persisteMetadata } from \"../../../../helpers/cart.helper\";\r\n\r\n@Component({\r\n tag: 'giftback-info',\r\n styleUrls: ['giftback-info.css']\r\n})\r\nexport class GiftbackInfo {\r\n\r\n private _refIinputRange: HTMLInputElement;\r\n\r\n @State() usedValue: number = 0;\r\n @State() selectedOption: string = 'none';\r\n\r\n @Prop() cartId;\r\n @Prop() loading: boolean = false;\r\n @Prop() bonus: Partial<IBonus> = {\r\n totalBonus: 0,\r\n cartId: \"\",\r\n minimumPurchase: 0,\r\n bonusBalance: 0,\r\n calculatedValue: 0,\r\n firstValidityDate: \"\",\r\n totalValue: 0\r\n };\r\n @Prop() reserve: (amountRedeemed: number) => void;\r\n @Prop() cancel: () => void;\r\n @Prop() config: IInfoStore;\r\n @Prop() infoBonus: ReservedInfoDTO;\r\n @Prop() storeName: string\r\n\r\n @State() sliderPosition: number = 0;\r\n @State() sliderValuePosition: number = 0;\r\n\r\n @State() loadingTime = false;\r\n\r\n @Watch(\"bonus\")\r\n changedBonus() {\r\n this.updateBonus()\r\n }\r\n\r\n private updateBonus() {\r\n this.usedValue = this.bonus.bonusBalance;\r\n this.buildPositionSlider(0, this.bonus.totalBonus);\r\n }\r\n\r\n componentWillLoad() {\r\n this.updateBonus();\r\n this.selectedOption = localStorage.getItem(USED_KEY);\r\n }\r\n\r\n handleSliderChange(event: Event) {\r\n const input = event.target as HTMLInputElement;\r\n this.usedValue = parseFloat(input.value);\r\n\r\n // Calculando a posição do texto com base no valor do slider\r\n // const percentage = ((this.usedValue - parseInt(input.min)) / (parseInt(input.max) - parseInt(input.min))) * 100;\r\n // this.sliderPosition = percentage;\r\n\r\n this.buildPositionSlider(parseFloat(input.min), parseFloat(input.max))\r\n }\r\n\r\n componentDidLoad() {\r\n if (this.bonus) {\r\n this._refIinputRange.value = this.bonus?.bonusBalance.toString();\r\n }\r\n }\r\n\r\n private buildPositionSlider(min: number, max: number) {\r\n\r\n const percentage_init = max * 0.1;\r\n\r\n // Calculando a posição do texto com base no valor do slider\r\n const percentage = ((this.usedValue - min) / (max - min)) * 100;\r\n\r\n this.sliderPosition = percentage;\r\n this.sliderValuePosition = percentage + (this.usedValue <= percentage_init ? 10 : 0);\r\n }\r\n\r\n async handleOptionChange(option: string) {\r\n this.selectedOption = option;\r\n\r\n localStorage.setItem(USED_KEY, option);\r\n\r\n await persisteMetadata(this.storeName, this.cartId, { ...this.infoBonus.metadata, createdAt: null })\r\n\r\n switch (this.selectedOption) {\r\n case 'use':\r\n await this.reserve(this.usedValue);\r\n break;\r\n case 'dontUse':\r\n await this.cancel();\r\n break;\r\n default:\r\n }\r\n }\r\n\r\n showTime() {\r\n if (!this.infoBonus) return false;\r\n\r\n return !this.infoBonus.isExpired();\r\n\r\n // return this.infoBonus.isBonusProcessed\r\n }\r\n\r\n getTime() {\r\n\r\n const createdAt = new Date(this.infoBonus?.metadata?.createdAt);\r\n const expiration = new Date(createdAt);\r\n expiration.setMinutes(expiration.getMinutes() + 6);\r\n\r\n return {\r\n createdAt,\r\n expiration\r\n }\r\n }\r\n\r\n async downtime() {\r\n await persisteMetadata(this.storeName, this.bonus.cartId, {\r\n createdAt: null,\r\n })\r\n }\r\n\r\n render() {\r\n console.log('this.bonus', this.bonus)\r\n const remainingGiftback = this.bonus.minimumPurchase - this.bonus.totalValue;\r\n\r\n const translateDescription = i18next.t(\"giftDescription\", { amount: `${this.bonus?.totalBonus?.toFixed(2).replace(\".\", \",\")}`, custom_name: \"Giftback\" })\r\n\r\n const limit = defineLimit(remainingGiftback);\r\n\r\n return (\r\n\r\n <div class=\"giftback-container\">\r\n <div class=\"container-description\">\r\n <p innerHTML={translateDescription}></p>\r\n <crm-tooltip identity=\"crm-role-description\" text={i18next.t(\"labelUseGiftback\", { minimumPurchase: this.bonus.minimumPurchase, expírationDate: formatDateToBr(this.bonus.firstValidityDate) })} />\r\n </div>\r\n <div class=\"slider-wrapper\">\r\n <div\r\n class=\"slider-value\"\r\n style={{\r\n left: `calc(${this.sliderValuePosition}% - 20px)`, // Ajuste para centralizar o texto\r\n\r\n }}\r\n >\r\n R$ {this.usedValue.toFixed(2).replace(\".\", \",\")}\r\n </div>\r\n <input\r\n ref={ref => this._refIinputRange = ref}\r\n id=\"position_value_id\"\r\n disabled\r\n type=\"range\"\r\n min=\"0\"\r\n max={this.bonus.totalBonus}\r\n value={this.usedValue}\r\n class=\"slider\"\r\n step=\"0.01\"\r\n onInput={(event) => this.handleSliderChange(event)}\r\n style={{\r\n background: `linear-gradient(to right, #6D6D5F ${this.sliderPosition}%, #ddd ${this.sliderPosition}%)`,\r\n }}\r\n />\r\n </div>\r\n\r\n {\r\n limit.isComplete && (\r\n <p>\r\n {i18next.t(\"maxAmount\")}\r\n </p>\r\n )\r\n }\r\n\r\n {\r\n !limit.isComplete && (\r\n <div class=\"container-description\">\r\n <p>\r\n Adicione <strong>R$ {remainingGiftback < 0 ? \"0,00\" : remainingGiftback.toFixed(2).replace(\".\", \",\")}</strong> ao carrinho para atingir o valor\r\n máximo!\r\n </p>\r\n <crm-tooltip identity=\"crm-max-description\" text={i18next.t(\"labelamountPartial\")} />\r\n </div>\r\n )\r\n }\r\n\r\n\r\n <div class=\"options\">\r\n <div class=\"options-option\">\r\n <input\r\n disabled={this.showTime()}\r\n type=\"radio\"\r\n name=\"giftbackOption\"\r\n value=\"use\"\r\n checked={this.selectedOption === 'use'}\r\n onChange={() => this.handleOptionChange('use')}\r\n />\r\n <p>Usar o meu {this.config?.giftbackTitle}</p>\r\n </div>\r\n <div class=\"options-option\">\r\n <input\r\n disabled={this.showTime()}\r\n type=\"radio\"\r\n name=\"giftbackOption\"\r\n value=\"dontUse\"\r\n checked={this.selectedOption === 'dontUse'}\r\n onChange={() => this.handleOptionChange('dontUse')}\r\n />\r\n <p>Não usar o meu {this.config?.giftbackTitle}</p>\r\n </div>\r\n </div>\r\n\r\n {\r\n this.showTime() &&\r\n (\r\n <div class=\"info-box\">\r\n Após <countdown-timer dataCriacao={new Date(this.infoBonus?.metadata?.createdAt).toString()} downtime={() => { window.location.reload() }} />, você poderá alterar sua escolha de usar ou não o Giftback.\r\n </div>\r\n )\r\n }\r\n\r\n {\r\n !this?.infoBonus?.isBonusProcessed && (\r\n <div class=\"info-box\">\r\n O Giftback será aplicado na próxima etapa.\r\n </div>\r\n )\r\n }\r\n\r\n </div>\r\n );\r\n }\r\n}","/* Estilo para centralizar o container do loading */\r\n.loading-container {\r\n position: absolute;\r\n /* Fixa o loading na tela */\r\n top: 0;\r\n left: 0;\r\n width: 100%;\r\n /* Tamanho total da tela */\r\n height: 100%;\r\n background-color: rgba(0, 0, 0, 0.5);\r\n /* Fundo semitransparente */\r\n display: flex;\r\n /* Centraliza o conteúdo */\r\n justify-content: center;\r\n align-items: center;\r\n z-index: 1000;\r\n flex-direction: column;\r\n /* Coloca o loading acima de outros elementos */\r\n}\r\n\r\n.loading-container p {\r\n margin: 6px 0px;\r\n color: white;\r\n font-size: large;\r\n}\r\n\r\n/* Estilo do spinner (círculo giratório) */\r\n.loading-spinner {\r\n width: 40px;\r\n height: 40px;\r\n border: 5px solid rgba(255, 255, 255, 0.3);\r\n /* Borda semitransparente */\r\n border-top: 5px solid white;\r\n /* Borda que será animada */\r\n border-radius: 50%;\r\n /* Faz o círculo */\r\n animation: spin 1s linear infinite;\r\n /* Gira continuamente */\r\n}\r\n\r\n/* Keyframes para a animação de rotação */\r\n@keyframes spin {\r\n 0% {\r\n transform: rotate(0deg);\r\n }\r\n\r\n 100% {\r\n transform: rotate(360deg);\r\n }\r\n}\r\n\r\n.relative-xy {\r\n position: relative;\r\n}","import { Component, Prop, h } from \"@stencil/core\";\r\n\r\n@Component({\r\n tag: 'loading-container',\r\n styleUrl: 'loading-container.css'\r\n})\r\nexport class LoadingContainer {\r\n\r\n @Prop() loading: boolean = true;\r\n @Prop() text: string = null;\r\n\r\n render() {\r\n return (\r\n <div class=\"relative-xy\">\r\n {\r\n this.loading && (\r\n <div class=\"loading-container\">\r\n <div class=\"loading-spinner\"></div>\r\n {this.text && <p>{this.text}</p>}\r\n </div>\r\n )\r\n }\r\n <slot></slot>\r\n </div>\r\n )\r\n }\r\n}",".spinner {\r\n display: inline-block;\r\n border: 4px solid transparent;\r\n border-radius: 50%;\r\n border-top-color: var(--color, #0078d7);\r\n animation: spin 1s linear infinite;\r\n}\r\n\r\n@keyframes spin {\r\n 0% {\r\n transform: rotate(0deg);\r\n }\r\n\r\n 100% {\r\n transform: rotate(360deg);\r\n }\r\n}","import { Component, h, Prop } from '@stencil/core';\r\n\r\n@Component({\r\n tag: 'loading-spinner',\r\n styleUrl: 'loading-spinner.css',\r\n shadow: true,\r\n})\r\nexport class LoadingSpinner {\r\n @Prop() size: string = '50px'; // Tamanho do spinner (padrão 50px)\r\n @Prop() color: string = '#0078d7'; // Cor do spinner (padrão azul)\r\n\r\n render() {\r\n return (\r\n <div class=\"spinner\" style={{ width: this.size, height: this.size, borderColor: `${this.color} transparent transparent transparent` }}></div>\r\n );\r\n }\r\n}\r\n","* {\r\n margin: 0;\r\n padding: 0;\r\n box-sizing: border-box;\r\n}\r\n\r\n:host {\r\n --crmfont-sizebodymd: 14px;\r\n --crmline-heightbodymd: 20px;\r\n --crmletter-spacingtitle-md: 0px\r\n}\r\n\r\n.container-message {\r\n /* font-size: var(--crmfont-sizebodymd); */\r\n font-weight: 400;\r\n line-height: var(--crmline-heightbodymd);\r\n letter-spacing: var(--crmletter-spacingtitle-md);\r\n text-align: left;\r\n text-underline-position: from-font;\r\n text-decoration-skip-ink: none;\r\n}\r\n\r\n.crm-container-form {\r\n display: flex;\r\n flex-direction: column;\r\n justify-content: space-around;\r\n height: auto;\r\n padding: 20px 24px 20px 24px;\r\n border: 1px solid #CCCC;\r\n writing-mode: horizontal-tb;\r\n gap: 16px;\r\n border-top: 1px solid #ccc !important;\r\n border-bottom: 1px solid #ccc !important;\r\n}\r\n\r\n/* .fbits-responsive-carrinho-desconto {\r\n overflow: hidden;\r\n border: 1px solid #ccc;\r\n border-top: 0;\r\n border-bottom: 0;\r\n} */\r\n\r\n.crm-phone-form {\r\n display: flex;\r\n flex-direction: column;\r\n height: 100%;\r\n /* justify-content: space-around; */\r\n gap: 16px;\r\n}\r\n\r\n.crm-subtitle {\r\n /* font-size: 14px; */\r\n font-size: .875rem;\r\n line-height: 1.25rem;\r\n \r\n}\r\n\r\n.crm-title {\r\n font-weight: 700;\r\n line-height: 20px;\r\n color: #262626;\r\n /* font-size: 16px; */\r\n}\r\n\r\n.crm-message-info {\r\n color: #619013;\r\n font-weight: 500;\r\n /* font-size: 12px; */\r\n}\r\n\r\n.crm-message-error {\r\n color: #E11D48;\r\n font-weight: 500;\r\n /* font-size: 12px; */\r\n}","import { Component, Host, Prop, h } from \"@stencil/core\";\r\nimport { IInfoStore } from \"../../../../helpers/info.config.helper\";\r\n\r\n@Component({\r\n tag: 'phone-form',\r\n styleUrl: '../../giftback-form.css',\r\n shadow: false\r\n})\r\nexport class PhoneForm {\r\n\r\n private phoneInputMask: HTMLPhoneInputMaskElement;\r\n\r\n @Prop() value: string;\r\n @Prop() loading: boolean;\r\n @Prop() handlerSubmit: (phone: string) => void;\r\n\r\n @Prop() config: IInfoStore;\r\n\r\n\r\n async handlePhone() {\r\n\r\n const phone = await this.phoneInputMask.getPhone()\r\n\r\n await this.handlerSubmit(phone);\r\n }\r\n\r\n\r\n render() {\r\n return (\r\n <Host class=\"crm-phone-form\">\r\n <p class=\"crm-subtitle\" >Digite o seu celular para verificar se há desconto disponível nessa compra:</p>\r\n <phone-input-mask initialValue={this.value} ref={ref => this.phoneInputMask = ref} />\r\n\r\n <crm-button txtBtn={this.config?.btnApplyBonusLabel || \"Avançar\"} loading={this.loading} handleClick={() => this.handlePhone() } />\r\n </Host>\r\n )\r\n }\r\n}","* {\r\n margin: 0;\r\n padding: 0;\r\n box-sizing: border-box;\r\n}\r\n\r\n.phone {\r\n display: block;\r\n width: 100%;\r\n height: 24px;\r\n padding: 6px 12px;\r\n /* font-size: 14px; */\r\n line-height: 1.42857143;\r\n color: #555;\r\n background-color: #fff;\r\n background-image: none;\r\n border: 1px solid #ccc;\r\n border-radius: 0px;\r\n -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);\r\n box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);\r\n -webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;\r\n -o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;\r\n transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;\r\n}\r\n\r\n\r\n.phone-input-form {\r\n width: 100%;\r\n height: 48px;\r\n padding: 13px 16px 13px 16px;\r\n border: 1px solid #CCCCCC;\r\n /* font-size: 14px; */\r\n}\r\n\r\n.crm-erro-msg {\r\n color: #E11D48;\r\n /* font-size: 12px; */\r\n font-weight: 500;\r\n margin-top: 11px;\r\n}\r\n","import { Component, h, Method, Prop, State } from '@stencil/core';\r\nimport { MESSAGE_ERROR_INVALID_NUMBER } from '../../contants';\r\n\r\n@Component({\r\n tag: 'phone-input-mask',\r\n styleUrl: 'phone-input-mask.css',\r\n shadow: true,\r\n})\r\nexport class PhoneInputMask {\r\n @State() phone: string = '';\r\n @State() message: string = \"\";\r\n\r\n @Prop() initialValue: string;\r\n @Prop() disabled: boolean;\r\n\r\n componentWillLoad() {\r\n this.phone = this.initialValue;\r\n }\r\n\r\n private formatPhone(value: string): string {\r\n\r\n const cleaned = value.replace(/\\D/g, ''); // Remove tudo que não for número\r\n const match = cleaned.match(/^(\\d{0,2})(\\d{0,5})(\\d{0,4})$/);\r\n\r\n if (!match) return value;\r\n\r\n const part1 = match[1] ? `(${match[1]}` : '';\r\n const part2 = match[2] ? `) ${match[2]}` : '';\r\n const part3 = match[3] ? ` ${match[3]}` : '';\r\n\r\n return `${part1}${part2}${part3}`;\r\n }\r\n\r\n private handleInput(event: Event): void {\r\n const input = event.target as HTMLInputElement;\r\n this.phone = this.formatPhone(input.value);\r\n\r\n if(!this.validatePhoneNumber(input.value)) {\r\n this.message = MESSAGE_ERROR_INVALID_NUMBER\r\n } else {\r\n this.message = \"\"\r\n }\r\n\r\n console.log('phone', this.phone)\r\n }\r\n\r\n validatePhoneNumber(phone: string): boolean {\r\n if(phone.length < 15) {\r\n return true\r\n }\r\n const phoneRegex = /^\\(\\d{2}\\) \\d{5} \\d{4}$/; // Valida formato (99) 99999-9999\r\n return phoneRegex.test(phone);\r\n }\r\n\r\n @Method()\r\n public async getPhone() {\r\n return this.phone;\r\n }\r\n\r\n render() {\r\n return (\r\n <div>\r\n <input\r\n disabled={this.disabled}\r\n id=\"phone\"\r\n type=\"text\"\r\n class=\"phone-input-form\"\r\n value={this.phone}\r\n onInput={(event) => this.handleInput(event)}\r\n placeholder=\"(99) 99999 9999\"\r\n />\r\n <p class=\"crm-erro-msg\">{this.message}</p>\r\n </div>\r\n\r\n );\r\n }\r\n}\r\n",":host {\r\n display: block;\r\n}\r\n\r\n.form-container-pin {\r\n display: flex;\r\n flex-direction: column;\r\n align-items: center;\r\n}\r\n\r\n.pin-container {\r\n display: flex;\r\n /* margin: 26px 0; */\r\n justify-content: start;\r\n gap: 10px;\r\n}\r\n\r\n.pin-container input {\r\n width: 100%;\r\n height: 48px;\r\n /* font-size: 14px; */\r\n text-align: center;\r\n border: 1px solid #ccc;\r\n border-radius: 5px;\r\n}\r\n\r\nbutton {\r\n padding: 10px 20px;\r\n background-color: #ddd;\r\n border: none;\r\n border-radius: 5px;\r\n cursor: pointer;\r\n}\r\n\r\n\r\n.success {\r\n color: green;\r\n margin-top: 10px;\r\n}\r\n\r\n.button {\r\n top: 50%;\r\n background-color: #6c6c7e;\r\n color: #fff;\r\n border: none;\r\n border-radius: 10px;\r\n padding: 15px;\r\n min-height: 30px;\r\n min-width: 120px;\r\n /* font-size: 20px; */\r\n cursor: pointer;\r\n}\r\n\r\n.button-cancel {\r\n top: 50%;\r\n background-color: #ffffff;\r\n color: #1e1c1c;\r\n border: 1px solid gray;\r\n border-radius: 10px;\r\n padding: 10px;\r\n min-height: 30px;\r\n min-width: 120px;\r\n /* font-size: 19px; */\r\n cursor: pointer;\r\n}\r\n\r\n.crm-description {\r\n /* font-size: 14px; */\r\n width: 100%;\r\n display: flex;\r\n gap: 9px;\r\n flex-wrap: wrap;\r\n}\r\n\r\n.crm-description a {\r\n font-weight: bold;\r\n cursor: pointer;\r\n text-decoration: underline;\r\n}\r\n\r\n.crm-description div {\r\n display: flex;\r\n gap: 5px;\r\n}","* {\r\n margin: 0;\r\n padding: 0;\r\n box-sizing: border-box;\r\n}\r\n\r\n:host {\r\n --crmfont-sizebodymd: 14px;\r\n --crmline-heightbodymd: 20px;\r\n --crmletter-spacingtitle-md: 0px\r\n}\r\n\r\n.container-message {\r\n /* font-size: var(--crmfont-sizebodymd); */\r\n font-weight: 400;\r\n line-height: var(--crmline-heightbodymd);\r\n letter-spacing: var(--crmletter-spacingtitle-md);\r\n text-align: left;\r\n text-underline-position: from-font;\r\n text-decoration-skip-ink: none;\r\n}\r\n\r\n.crm-container-form {\r\n display: flex;\r\n flex-direction: column;\r\n justify-content: space-around;\r\n height: auto;\r\n padding: 20px 24px 20px 24px;\r\n border: 1px solid #CCCC;\r\n writing-mode: horizontal-tb;\r\n gap: 16px;\r\n border-top: 1px solid #ccc !important;\r\n border-bottom: 1px solid #ccc !important;\r\n}\r\n\r\n/* .fbits-responsive-carrinho-desconto {\r\n overflow: hidden;\r\n border: 1px solid #ccc;\r\n border-top: 0;\r\n border-bottom: 0;\r\n} */\r\n\r\n.crm-phone-form {\r\n display: flex;\r\n flex-direction: column;\r\n height: 100%;\r\n /* justify-content: space-around; */\r\n gap: 16px;\r\n}\r\n\r\n.crm-subtitle {\r\n /* font-size: 14px; */\r\n font-size: .875rem;\r\n line-height: 1.25rem;\r\n \r\n}\r\n\r\n.crm-title {\r\n font-weight: 700;\r\n line-height: 20px;\r\n color: #262626;\r\n /* font-size: 16px; */\r\n}\r\n\r\n.crm-message-info {\r\n color: #619013;\r\n font-weight: 500;\r\n /* font-size: 12px; */\r\n}\r\n\r\n.crm-message-error {\r\n color: #E11D48;\r\n font-weight: 500;\r\n /* font-size: 12px; */\r\n}","import { Component, h, Prop, State } from '@stencil/core';\r\nimport { IPinSent } from '../../../../dto/pin.sent';\r\nimport i18next from '../../../../i18n/i18n'\r\nimport { IInfoStore } from '../../../../helpers/info.config.helper';\r\n\r\n@Component({\r\n tag: 'pin-form',\r\n styleUrls: ['pin-form.css', '../../giftback-form.css'],\r\n shadow: true,\r\n})\r\nexport class GiftbackPin {\r\n\r\n @Prop() validate: (pin: string) => void;\r\n @Prop() cancel: () => void;\r\n @Prop() resend: () => void;\r\n\r\n @Prop() sent: IPinSent;\r\n @Prop() loading: boolean = false;\r\n @Prop() phone: string;\r\n @Prop() config: IInfoStore;\r\n\r\n @State() pin: string[] = ['', '', '', ''];\r\n @State() isVerified: boolean = false;\r\n @State() canResend: boolean = false;\r\n\r\n componentWillLoad() {\r\n this.canResend = false;\r\n }\r\n\r\n handleInput(event: Event, index: number) {\r\n const input = event.target as HTMLInputElement;\r\n const value = input.value.slice(0, 1); // Limitar a um único dígito\r\n this.pin[index] = value;\r\n\r\n // Focar no próximo campo, se possível\r\n if (value && index < this.pin.length - 1) {\r\n const nextInput = input.nextElementSibling as HTMLInputElement;\r\n nextInput?.focus();\r\n }\r\n\r\n this.pin = [...this.pin];\r\n }\r\n\r\n validatePin() {\r\n localStorage.removeItem(\"bc:resend\")\r\n this.validate(this.pin.join(\"\"))\r\n }\r\n\r\n verifyPin() {\r\n const pinCode = this.pin.join('');\r\n if (pinCode === '9999') {\r\n this.isVerified = true;\r\n }\r\n }\r\n\r\n handleTimeout() {\r\n localStorage.removeItem(\"bc:resend\")\r\n this.canResend = true;\r\n }\r\n\r\n async handleResend() {\r\n await this.resend();\r\n\r\n this.canResend = false;\r\n this.pin = ['', '', '', ''];\r\n localStorage.removeItem(\"bc:resend\")\r\n }\r\n\r\n buildTime() {\r\n const resendDate = localStorage.getItem(\"bc:resend\");\r\n\r\n if(resendDate) {\r\n return resendDate;\r\n }\r\n\r\n const date = new Date();\r\n date.setSeconds(date.getSeconds() + 30);\r\n localStorage.setItem(\"bc:resend\", date.toString());\r\n\r\n return date.toString();\r\n }\r\n\r\n render() {\r\n return (\r\n <div class=\"crm-phone-form\">\r\n <label class=\"crm-subtitle\" >{i18next.t('pin-sutitle')} <strong>+55 {this.phone}</strong></label>\r\n <div class=\"pin-container\">\r\n {this.pin.map((_, index) => (\r\n <input\r\n type=\"text\"\r\n maxLength={1}\r\n value={this.pin[index]}\r\n onInput={(event) => this.handleInput(event, index)}\r\n />\r\n ))}\r\n </div>\r\n\r\n <slot></slot>\r\n\r\n <p class=\"crm-description\"> Não recebeu?\r\n {\r\n !this.canResend && <label> Reenviar em \r\n <countdown-timer minutos={0} segundos={30} dataCriacao={this.buildTime()} downtime={() => this.handleTimeout()} /> </label>\r\n }\r\n {\r\n this.canResend && (\r\n <div >\r\n <a onClick={() => this.handleResend()}>Reenviar</a>\r\n <a onClick={() => this.cancel()}>Trocar número</a>\r\n </div>\r\n )\r\n }\r\n </p>\r\n <crm-button txtBtn={this.config?.btnApplyBonusLabel || \"Avançar\"} loading={this.loading} handleClick={() => this.validatePin()} />\r\n </div >\r\n );\r\n }\r\n}\r\n"],"mappings":"uOAKaA,EAAc,M,yFAIG,E,cACC,G,6BAM3B,iBAAAC,GACI,MAAMC,EAAaC,KAAKC,QAAUD,KAAKE,SAAW,IAClD,MAAMC,EAAO,IAAIC,KAAKJ,KAAKK,aAC3B,MAAMC,EAAQ,IAAIF,KAClB,MAAMG,EAAeD,EAAME,UAAYL,EAAKK,UAE5C,GAAID,GAAgBR,EAAY,CAC5BC,KAAKS,cAAgB,EACrBT,KAAKU,iB,KACF,CACHV,KAAKS,cAAgBV,EAAaQ,EAClCP,KAAKW,gB,EAIb,oBAAAC,GACIC,cAAcb,KAAKc,W,CAGvB,cAAAH,GACIX,KAAKc,WAAaC,aAAY,KAC1Bf,KAAKS,eAAiB,IACtB,GAAIT,KAAKS,eAAiB,EAAG,CACzBT,KAAKS,cAAgB,EACrBI,cAAcb,KAAKc,YACnBd,KAAKU,iB,IAEV,I,CAGP,eAAAA,GACIM,QAAQC,IAAI,sCACZjB,KAAKkB,U,CAGT,MAAAC,GACI,MAAMlB,EAAUmB,KAAKC,MAAMrB,KAAKS,cAAgB,KAChD,MAAMP,EAAWkB,KAAKC,MAAOrB,KAAKS,cAAgB,IAAS,KAC3D,MAAMa,EAAiB,GAAGC,OAAOtB,GAASuB,SAAS,EAAG,QAAQD,OAAOrB,GAAUsB,SAAS,EAAG,OAE3F,OACIC,EAAA,SAAAC,IAAA,gDAASJ,E,GC/CrB,IAAYK,GAAZ,SAAYA,GACRA,EAAA,gBACAA,EAAA,sBACAA,EAAA,wBACAA,EAAA,cACH,EALD,CAAYA,MAAe,K,SCRXC,EAAoBC,EAAoC,IAEpE,MAAMC,EAA4B,GA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