crmbonus-component-wake 2.1.39-ngrok → 2.1.41-ngrok
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.
- package/dist/cjs/countdown-timer_11.cjs.entry.js +26 -13
- package/dist/cjs/countdown-timer_11.cjs.entry.js.map +1 -1
- package/dist/collection/components/crm-bonus/crm-bonus.js +19 -1
- package/dist/collection/components/crm-bonus/crm-bonus.js.map +1 -1
- package/dist/collection/helpers/build.payload.helper.js +7 -12
- package/dist/collection/helpers/build.payload.helper.js.map +1 -1
- package/dist/components/crm-bonus.js +26 -13
- package/dist/components/crm-bonus.js.map +1 -1
- package/dist/crmbonus-component-wake/crmbonus-component-wake.esm.js +1 -1
- package/dist/crmbonus-component-wake/p-60742512.entry.js +2 -0
- package/dist/crmbonus-component-wake/p-60742512.entry.js.map +1 -0
- package/dist/esm/countdown-timer_11.entry.js +26 -13
- package/dist/esm/countdown-timer_11.entry.js.map +1 -1
- package/package.json +1 -1
- package/dist/crmbonus-component-wake/p-0b369ee2.entry.js +0 -2
- package/dist/crmbonus-component-wake/p-0b369ee2.entry.js.map +0 -1
@@ -0,0 +1 @@
|
|
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","hasOriginalPrice","PrecoDe","PrecoPor","hasDiscountInProduct","existsPromotionProduct","Ajustes","filter","adj","PP","includes","Tipo","promotion_product","length","discounts","getDiscount","price","priceOrignal","value","Quantidade","originalValue","discounts_value","push","sku","SKU","productVariantId","ProdutoVarianteId","toString","quantity","discount","ajustes","config_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","_a","getElementById","setTimeout","observerHandle","i18next","changeLanguage","language","componentDidLoad","loadSession","handleLoad","loadConfigStore","error","elements","getElementsByTagName","event","target","href","id","customization","infoBonus","Promise","all","getCustomization","store","getInfoBonusByCartIdAndStoreName","reservedInfo","keepStoreFrontStyle","styles","fetchCustomer","userId","storeName","getCustomer","user","then","customer","amount","canCancel","amountCancel","buildAndGetProducts","cart","CartWake","JSON","parse","session","getToken","productsString","stringify","setItem","products_in_cache","product_cart","pro","p","Object","assign","sendPin","_phone","replace","Number","sent","STEP_PIN","showModal","_b","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","storeId","pinInfo","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","input","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 \r\n // let discounts_formula = getDiscountFormula(pw.Ajustes);\r\n\r\n const hasOriginalPrice = (pw.PrecoDe < pw.PrecoPor);\r\n const hasDiscountInProduct = (pw.PrecoPor < pw.PrecoDe);\r\n const existsPromotionProduct = pw.Ajustes.filter(adj => [AjustesTipoEnum.PP].includes(adj.Tipo))\r\n const promotion_product = (existsPromotionProduct.length > 0)\r\n\r\n let discounts = getDiscount(pw.Ajustes, hasOriginalPrice);\r\n\r\n let price = hasOriginalPrice ? pw.PrecoPor : pw.PrecoDe;\r\n const priceOrignal = hasOriginalPrice ? pw.PrecoPor : pw.PrecoDe;\r\n\r\n if(!promotion_product && hasDiscountInProduct) {\r\n price = pw.PrecoPor;\r\n }\r\n\r\n var value = (price * pw.Quantidade);\r\n var originalValue = (priceOrignal * pw.Quantidade);\r\n\r\n var discounts_value = (discounts * -1); \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[] = [], hasOriginalPrice: boolean) {\r\n \r\n let discounts = 0;\r\n const config_ajustes = [AjustesTipoEnum.P, AjustesTipoEnum.CC];\r\n\r\n if(!hasOriginalPrice) {\r\n config_ajustes.push(AjustesTipoEnum.PP);\r\n }\r\n\r\n for(const discount of ajustes) {\r\n if(config_ajustes.includes(discount.Tipo)) {\r\n discounts += discount.Valor;\r\n }\r\n }\r\n\r\n return discounts;\r\n}\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 document.getElementById('validarCupom')?.addEventListener('click', async () => {\r\n console.log(\"[CRMBONUS] - cupom sendo submetido!\");\r\n setTimeout(async () => {\r\n await this.reprocess();\r\n }, 2000);\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 try {\r\n await this.loadSession();\r\n this.handleLoad();\r\n await this.loadConfigStore();\r\n } catch (error) {\r\n console.log('bc:err....')\r\n } finally {\r\n this.loading_reprocess = false;\r\n }\r\n }\r\n\r\n private async observerHandle() {\r\n const elements = document.getElementsByTagName('a');\r\n\r\n document.addEventListener('click', (event) => {\r\n //@ts-ignore\r\n console.log('Clique detectado em:', event.target.href);\r\n console.log('Clique detectado em:', event.target);\r\n \r\n //@ts-ignore\r\n if (['validarCupom'].includes(event.target.id)) {\r\n setTimeout(async () => {\r\n await this.reprocess();\r\n this.observerHandle();\r\n }, 2000);\r\n }\r\n });\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\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 console.log('[_bonus]', _bonus);\r\n if (_bonus) {\r\n\r\n const bonus = JSON.parse(_bonus)\r\n \r\n if(!bonus.storeId || !bonus.userId) {\r\n return;\r\n }\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 }\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,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,WACDhU,EAAA,OAAAC,IAAA,4CACID,EAAA,KAAAC,IAAA,2CAAGiK,QAAS,IAAM3L,KAAKqW,gBAAc,YACrC5U,EAAA,KAAAC,IAAA,2CAAGiK,QAAS,IAAM3L,KAAK0K,UAAQ,mBAK/CjJ,EAAA,cAAAC,IAAA,2CAAYmK,SAAQtF,EAAAvG,KAAK4M,UAAM,MAAArG,SAAA,SAAAA,EAAE8N,qBAAsB,UAAWnP,QAASlF,KAAKkF,QAAS0G,YAAa,IAAM5L,KAAK+V,gB","ignoreList":[]}
|
@@ -64,14 +64,18 @@ function buildProductsByWake(productsWake = []) {
|
|
64
64
|
for (const pw of productsWake) {
|
65
65
|
// let discounts_formula = getDiscountFormula(pw.Ajustes);
|
66
66
|
const hasOriginalPrice = (pw.PrecoDe < pw.PrecoPor);
|
67
|
+
const hasDiscountInProduct = (pw.PrecoPor < pw.PrecoDe);
|
68
|
+
const existsPromotionProduct = pw.Ajustes.filter(adj => [AjustesTipoEnum.PP].includes(adj.Tipo));
|
69
|
+
const promotion_product = (existsPromotionProduct.length > 0);
|
67
70
|
let discounts = getDiscount(pw.Ajustes, hasOriginalPrice);
|
68
|
-
|
71
|
+
let price = hasOriginalPrice ? pw.PrecoPor : pw.PrecoDe;
|
69
72
|
const priceOrignal = hasOriginalPrice ? pw.PrecoPor : pw.PrecoDe;
|
73
|
+
if (!promotion_product && hasDiscountInProduct) {
|
74
|
+
price = pw.PrecoPor;
|
75
|
+
}
|
70
76
|
var value = (price * pw.Quantidade);
|
71
77
|
var originalValue = (priceOrignal * pw.Quantidade);
|
72
78
|
var discounts_value = (discounts * -1);
|
73
|
-
const existsPromotionProduct = pw.Ajustes.filter(adj => [AjustesTipoEnum.PP].includes(adj.Tipo));
|
74
|
-
const promotion_product = (existsPromotionProduct.length > 0);
|
75
79
|
products.push({
|
76
80
|
sku: pw.SKU,
|
77
81
|
value: value,
|
@@ -97,15 +101,6 @@ function getDiscount(ajustes = [], hasOriginalPrice) {
|
|
97
101
|
}
|
98
102
|
return discounts;
|
99
103
|
}
|
100
|
-
// function getDiscountFormula(ajustes: IAjustes[] = []) {
|
101
|
-
// let discounts = 0;
|
102
|
-
// for(const discount of ajustes) {
|
103
|
-
// if([AjustesTipoEnum.F].includes(discount.Tipo)) {
|
104
|
-
// discounts += (discount.Valor * -1);
|
105
|
-
// }
|
106
|
-
// }
|
107
|
-
// return discounts;
|
108
|
-
// }
|
109
104
|
|
110
105
|
const crmBonusCss = ".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}";
|
111
106
|
const CrmBonusStyle0 = crmBonusCss;
|
@@ -171,6 +166,7 @@ const CrmBonus$1 = class {
|
|
171
166
|
}
|
172
167
|
}
|
173
168
|
async componentWillLoad() {
|
169
|
+
var _a;
|
174
170
|
this.loading_reprocess = true;
|
175
171
|
window.addEventListener('productRemovedFromCart', async () => {
|
176
172
|
console.log('[CRMBONUS] - productRemovedFromCart');
|
@@ -186,6 +182,12 @@ const CrmBonus$1 = class {
|
|
186
182
|
await this.reprocess();
|
187
183
|
});
|
188
184
|
});
|
185
|
+
(_a = document.getElementById('validarCupom')) === null || _a === void 0 ? void 0 : _a.addEventListener('click', async () => {
|
186
|
+
console.log("[CRMBONUS] - cupom sendo submetido!");
|
187
|
+
setTimeout(async () => {
|
188
|
+
await this.reprocess();
|
189
|
+
}, 2000);
|
190
|
+
});
|
189
191
|
await this.observerHandle();
|
190
192
|
instance.changeLanguage(instance.language);
|
191
193
|
}
|
@@ -204,6 +206,18 @@ const CrmBonus$1 = class {
|
|
204
206
|
}
|
205
207
|
async observerHandle() {
|
206
208
|
const elements = document.getElementsByTagName('a');
|
209
|
+
document.addEventListener('click', (event) => {
|
210
|
+
//@ts-ignore
|
211
|
+
console.log('Clique detectado em:', event.target.href);
|
212
|
+
console.log('Clique detectado em:', event.target);
|
213
|
+
//@ts-ignore
|
214
|
+
if (['validarCupom'].includes(event.target.id)) {
|
215
|
+
setTimeout(async () => {
|
216
|
+
await this.reprocess();
|
217
|
+
this.observerHandle();
|
218
|
+
}, 2000);
|
219
|
+
}
|
220
|
+
});
|
207
221
|
//@ts-ignore
|
208
222
|
for (let el of elements) {
|
209
223
|
console.log('[el.href]', el.href);
|
@@ -276,7 +290,6 @@ const CrmBonus$1 = class {
|
|
276
290
|
}, 1500000);
|
277
291
|
}
|
278
292
|
async buildAndGetProducts(productsWake) {
|
279
|
-
console.log();
|
280
293
|
const key = `bc-products:${this.cartWake.id}`;
|
281
294
|
const productsString = JSON.stringify(productsWake);
|
282
295
|
localStorage.setItem(key, productsString);
|