crmbonus-component-wake 2.0.93 → 2.0.95

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.
Files changed (35) hide show
  1. package/dist/cjs/countdown-timer_5.cjs.entry.js +10 -10
  2. package/dist/cjs/countdown-timer_5.cjs.entry.js.map +1 -1
  3. package/dist/cjs/crm-bonus.cjs.entry.js +5 -5
  4. package/dist/cjs/crm-bonus.cjs.entry.js.map +1 -1
  5. package/dist/collection/components/crm-bonus/crm-bonus.js +5 -5
  6. package/dist/collection/components/crm-bonus/crm-bonus.js.map +1 -1
  7. package/dist/collection/components/giftback-form/subcomponents/giftback-info/giftback-info.js +10 -10
  8. package/dist/collection/components/giftback-form/subcomponents/giftback-info/giftback-info.js.map +1 -1
  9. package/dist/collection/components/tooltip/crm-tooltip.css +2 -2
  10. package/dist/components/crm-bonus.js +8 -8
  11. package/dist/components/crm-bonus.js.map +1 -1
  12. package/dist/components/crm-giftback-form.js +1 -1
  13. package/dist/components/crm-tooltip.js +1 -1
  14. package/dist/components/giftback-info.js +1 -1
  15. package/dist/components/{p-645bae5b.js → p-2e88599d.js} +3 -3
  16. package/dist/components/{p-645bae5b.js.map → p-2e88599d.js.map} +1 -1
  17. package/dist/components/{p-284d8322.js → p-53259f8a.js} +2 -2
  18. package/dist/components/{p-284d8322.js.map → p-53259f8a.js.map} +1 -1
  19. package/dist/components/{p-03183a03.js → p-f9381072.js} +11 -11
  20. package/dist/components/p-f9381072.js.map +1 -0
  21. package/dist/crmbonus-component-wake/crmbonus-component-wake.esm.js +1 -1
  22. package/dist/crmbonus-component-wake/p-5f8b033a.entry.js +2 -0
  23. package/dist/crmbonus-component-wake/p-5f8b033a.entry.js.map +1 -0
  24. package/dist/crmbonus-component-wake/p-94356545.entry.js +2 -0
  25. package/dist/crmbonus-component-wake/p-94356545.entry.js.map +1 -0
  26. package/dist/esm/countdown-timer_5.entry.js +10 -10
  27. package/dist/esm/countdown-timer_5.entry.js.map +1 -1
  28. package/dist/esm/crm-bonus.entry.js +5 -5
  29. package/dist/esm/crm-bonus.entry.js.map +1 -1
  30. package/package.json +1 -1
  31. package/dist/components/p-03183a03.js.map +0 -1
  32. package/dist/crmbonus-component-wake/p-1e41bdcf.entry.js +0 -2
  33. package/dist/crmbonus-component-wake/p-1e41bdcf.entry.js.map +0 -1
  34. package/dist/crmbonus-component-wake/p-7dd955cf.entry.js +0 -2
  35. package/dist/crmbonus-component-wake/p-7dd955cf.entry.js.map +0 -1
@@ -4,9 +4,9 @@ import { S as StepFormEnum } from './p-24bdfca4.js';
4
4
  import { i as instance } from './p-e8c19a64.js';
5
5
  import { d as defineCustomElement$b } from './p-078fe899.js';
6
6
  import { d as defineCustomElement$a } from './p-2f30297f.js';
7
- import { d as defineCustomElement$9 } from './p-645bae5b.js';
8
- import { d as defineCustomElement$8 } from './p-284d8322.js';
9
- import { d as defineCustomElement$7 } from './p-03183a03.js';
7
+ import { d as defineCustomElement$9 } from './p-2e88599d.js';
8
+ import { d as defineCustomElement$8 } from './p-53259f8a.js';
9
+ import { d as defineCustomElement$7 } from './p-f9381072.js';
10
10
  import { d as defineCustomElement$6 } from './p-f1fb885c.js';
11
11
  import { d as defineCustomElement$5 } from './p-169fe768.js';
12
12
  import { d as defineCustomElement$4 } from './p-f0449fc0.js';
@@ -73,10 +73,10 @@ const CrmBonus$1 = /*@__PURE__*/ proxyCustomElement(class CrmBonus extends H {
73
73
  }
74
74
  async resetBonus() {
75
75
  console.log('[START RESET BONUS]!!!!!');
76
- const used = localStorage.getItem("bc:used");
77
- if (used == "use") {
78
- await this.crmBonusService.cancelBonus(this.cartId, this.storeName);
79
- }
76
+ // const used = localStorage.getItem("bc:used");
77
+ // if (used == "use") {
78
+ // await this.crmBonusService.cancelBonus(this.cartId, this.storeName);
79
+ // }
80
80
  try {
81
81
  await this.crmBonusRef.processBonus(this.buildProducts(), true);
82
82
  console.log('[BONUS RESETADO]!!!!!');
@@ -243,7 +243,7 @@ const CrmBonus$1 = /*@__PURE__*/ proxyCustomElement(class CrmBonus extends H {
243
243
  this.showModal = true;
244
244
  }
245
245
  render() {
246
- return (h("loading-container", { key: '498f7bfb3f6ab94723c2c33013082be2b0136906', loading: this.loading_reprocess }, h("crm-giftback-form", { key: '0c1f8afd3c777f085add4663f590758432d240c9', style: { position: "relative" }, ref: ref => this.crmBonusRef = ref, storeName: this.storeName, products: this.buildProducts(), cartId: this.cartId, customer: this.customer, loadProducts: () => this.buildProducts() })));
246
+ return (h("loading-container", { key: '2344629dcd6addbeca290195a76ff901c02ef143', loading: this.loading_reprocess }, h("crm-giftback-form", { key: 'dbbd58488ceb615ee9505e95c14374f359bacaff', style: { position: "relative" }, ref: ref => this.crmBonusRef = ref, storeName: this.storeName, products: this.buildProducts(), cartId: this.cartId, customer: this.customer, loadProducts: () => this.buildProducts() })));
247
247
  }
248
248
  static get assetsDirs() { return ["assets"]; }
249
249
  static get watchers() { return {
@@ -1 +1 @@
1
- {"file":"crm-bonus.js","mappings":";;;;;;;;;;;;;;;AAQA,IAAY,eAEX;AAFD,WAAY,eAAe;IACvB,iCAAc,CAAA;AAClB,CAAC,EAFW,eAAe,KAAf,eAAe;;SCNX,mBAAmB,CAAC,eAAoC,EAAE;IAEtE,MAAM,QAAQ,GAAoB,EAAE,CAAC;IAErC,KAAM,MAAM,EAAE,IAAI,YAAY,EAAG;QAC7B,IAAI,SAAS,GAAG,WAAW,CAAC,EAAE,CAAC,OAAO,CAAC,CAAA;QAEvC,QAAQ,CAAC,IAAI,CACT;YACI,GAAG,EAAE,EAAE,CAAC,GAAG;YACX,KAAK,GAAG,EAAE,CAAC,QAAQ,GAAG,EAAE,CAAC,UAAU,CAAC;YACpC,gBAAgB,EAAE,EAAE,CAAC,iBAAiB,CAAC,QAAQ,EAAE;YACjD,QAAQ,EAAE,EAAE,CAAC,UAAU;YACvB,QAAQ,GAAG,SAAS,GAAG,CAAC,CAAC,CAAC;SAC7B,CACJ,CAAA;KACJ;IAED,OAAO,QAA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;KACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["CrmBonus","i18next"],"sources":["src/dto/validate.pin.bonus.ts","src/helpers/build.payload.helper.ts","src/components/crm-bonus/crm-bonus.css?tag=crm-bonus&encapsulation=scoped","src/components/crm-bonus/crm-bonus.tsx"],"sourcesContent":["export interface IProduct {\n productVariantId: string;\n sku: string;\n value: number;\n quantity: number;\n discount: number;\n}\n\nexport enum AjustesTipoEnum {\n P = \"Promocao\" \n}\n\nexport interface IAjustes {\n Tipo: AjustesTipoEnum;\n Valor: number;\n}\n\nexport interface IProductWake {\n ProdutoVarianteId: number;\n SKU: string;\n PrecoPor: number;\n Quantidade: number;\n Ajustes: IAjustes[];\n}\n\nexport interface ICustomer {\n birthDate: string;\n document: string;\n name: string;\n phone: string;\n}\n\nexport interface IProccesPinBonusDto {\n storeName: string;\n name: string;\n checkoutId: string;\n checkoutProducts: Array<IProduct>;\n storeId: string;\n userId: string;\n cellphone: number;\n pin: string;\n\n}\n\nexport interface IBonus {\n hasBonus: boolean;\n bonusBalance: number;\n totalBonus: number;\n minimumPurchase: number;\n bonusIds: string;\n firstValidityDate: string\n history: [\n {\n validityStart: string;\n validityEnd: string;\n value: number\n },\n {\n validityStart: string;\n validityEnd: string\n value: number\n }\n ]\n storeId: number;\n userId: number;\n cartId: string\n calculatedValue: number;\n totalValue: number\n}\n\n\nexport interface IReserveDTO {\n storeName: string;\n cartId: string;\n grossValue: number;\n redeemedBonus: number;\n ticket: string;\n storeId: string;\n userId: number;\n}","import { AjustesTipoEnum, IAjustes, IProduct, IProductWake } from \"../dto/validate.pin.bonus\";\n\nexport function buildProductsByWake(productsWake: Array<IProductWake> = []): Array<IProduct> {\n\n const products: Array<IProduct> = [];\n\n for ( const pw of productsWake ) {\n let discounts = getDiscount(pw.Ajustes)\n\n products.push(\n {\n sku: pw.SKU,\n value: (pw.PrecoPor * pw.Quantidade),\n productVariantId: pw.ProdutoVarianteId.toString(),\n quantity: pw.Quantidade,\n discount: (discounts * -1)\n }\n )\n }\n\n return products;\n}\n\nfunction getDiscount(ajustes: IAjustes[] = []) {\n \n let discounts = 0;\n \n for(const discount of ajustes) {\n if(discount.Tipo === AjustesTipoEnum.P) {\n discounts += discount.Valor;\n }\n }\n\n return discounts;\n}","\n.container-button {\n /* max-width: 100%; */\n cursor: pointer;\n padding: 5px 5px 5px 14px;\n /* display: flex; */\n}\n\n/* padding: 0 15px 15px;\nborder: 1px solid #ddd;\nmargin-bottom: 20px; */\n\n.section-crm {\n border: 1px solid #dbd4d4;\n /* min-height: 50px; */\n text-align: -webkit-center;\n margin-bottom: 20px;\n}\n\n.section-cart-crm {\n margin-top: 10px;\n}\n\n.section-cart-crm p {\n padding: 0;\n margin: 0px 0px 0px 15px;\n}\n\n.button {\n top: 50%;\n background-color: #6c6c7e;\n color: #fff;\n border: none;\n /* border-radius: 10px; */\n padding: 15px;\n min-height: 30px;\n min-width: 120px;\n font-size: 20px;\n cursor: pointer;\n margin-left: 10px;\n height: 70px;\n}\n\n.form-container {\n width: 97%;\n display: flex;\n justify-content: space-around;\n}\n\n\n.btn {\n display: inline-block;\n padding: 6px 12px;\n margin-bottom: 0;\n font-size: 14px;\n font-weight: 400;\n line-height: 1.42857143;\n text-align: center;\n white-space: nowrap;\n vertical-align: middle;\n -ms-touch-action: manipulation;\n touch-action: manipulation;\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n background-image: none;\n border: 1px solid transparent;\n border-radius: 0px;\n}\n\n.form-container .btnCrm {\n background: #00162e;\n border-color: #00162e;\n width: 30%;\n color: #fff;\n}\n\n.message-alert {\n font-family: sans-serif;\n color: #df4d4d;\n margin-top: 5px;\n}","import { Component, Method, Prop, State, Watch, h } from '@stencil/core';\nimport { IProduct, IProductWake, ICustomer } from '../../dto/validate.pin.bonus';\nimport { CrmBonusService } from '../../services/crmbonus.service';\nimport { IPinSent } from '../../components';\nimport { StepFormEnum } from '../../contants';\n\nimport i18next from '../../i18n/i18n'\nimport { buildProductsByWake } from '../../helpers/build.payload.helper';\n\n@Component({\n tag: 'crm-bonus',\n styleUrl: 'crm-bonus.css',\n scoped: true,\n assetsDirs: ['assets']\n})\nexport class CrmBonus {\n\n private crmBonusService: CrmBonusService = CrmBonusService.getInstance();\n\n private crmBonusRef: HTMLCrmGiftbackFormElement;\n\n @State() showModal: boolean = false;\n @Prop({ attribute: 'userid' }) userId: number;\n @Prop({ attribute: 'storename' }) storeName;\n @Prop({ attribute: 'products' }) productsInString: string;\n @Prop({ attribute: 'cartid' }) cartId;\n\n @State() products: Array<IProductWake>;\n @State() customer: ICustomer = {\n birthDate: \"\",\n document: \"\",\n name: \"\",\n phone: \"\"\n };\n\n @State() loading: boolean = false;\n @State() message: string;\n @State() phone: number;\n @State() canCancel: boolean = false;\n @State() amountCancel: string;\n @State() sent: IPinSent;\n\n @State() session: string;\n @State() loading_reprocess = false;\n\n @Method()\n async resetBonus() {\n console.log('[START RESET BONUS]!!!!!');\n const used = localStorage.getItem(\"bc:used\");\n\n if (used == \"use\") {\n await this.crmBonusService.cancelBonus(this.cartId, this.storeName);\n }\n\n try {\n await this.crmBonusRef.processBonus(this.buildProducts(), true);\n console.log('[BONUS RESETADO]!!!!!');\n } catch (err) {\n\n this.loading = false;\n console.log('[error ao reprocessar bonous]');\n await this.crmBonusRef.setStep(StepFormEnum.STEP_PHONE);\n } finally {\n this.loading = false;\n }\n }\n\n @Method()\n async reprocess(products: Array<any>) {\n this.loading_reprocess = true\n\n console.log('[reprocess]');\n try {\n console.log('[update products list]');\n this.productsInString = JSON.stringify(products);\n await this.handleLoad();\n\n await this.resetBonus();\n } catch (err) {\n console.debug('[watchProducts]', err.message);\n } finally {\n this.loading_reprocess = false\n }\n }\n\n @Watch(\"productsInString\")\n async watchProducts(newValue: string) {\n try {\n console.log('[update products list]');\n this.productsInString = newValue;\n await this.handleLoad();\n\n await this.resetBonus();\n } catch (err) {\n console.debug('[watchProducts]', err.message);\n }\n }\n\n async componentWillLoad() {\n i18next.changeLanguage(i18next.language);\n\n await this.loadSession();\n await this.loadConfigStore()\n await this.handleLoad();\n }\n\n async loadConfigStore() {\n await this.crmBonusService.getCustomization(this.storeName);\n }\n\n async handleLoad() {\n try {\n if (this.userId) {\n this.customer = await this.crmBonusService.getCustomer(this.userId, this.storeName);\n console.log('customer', this.customer);\n }\n\n const amount = localStorage.getItem(this.cartId);\n\n if (amount) {\n this.canCancel = true;\n this.amountCancel = amount;\n }\n\n } catch (error) {\n console.log('info customer')\n }\n\n this.buildAndGetProducts();\n }\n\n\n async loadSession() {\n this.session = await this.crmBonusService.getToken(this.storeName);\n\n setTimeout(() => {\n this.loadSession()\n }, 1500000)\n\n }\n\n async buildAndGetProducts() {\n const key = `bc-products:${this.cartId}`;\n\n localStorage.setItem(key, this.productsInString);\n\n const productsInCart = JSON.parse(this.productsInString);\n const products_in_cache = JSON.parse(localStorage.getItem(key));\n\n const products: Array<IProductWake> = []\n\n for (const product_cart of productsInCart) {\n\n const [pro] = products_in_cache.filter(p => p.ProdutoVarianteId == product_cart.ProdutoVarianteId)\n\n if (pro) {\n products.push({\n ...product_cart,\n PrecoPor: pro.PrecoPor,\n Quantidade: pro.Quantidade,\n Ajustes: pro.Ajustes\n })\n } else {\n products.push(product_cart)\n }\n\n }\n\n this.products = products; //cache_products ? JSON.parse(cache_products) : JSON.parse(this.productsInString);\n\n }\n\n public async sendPin(phone: string) {\n this.loading = true;\n this.message = \"\";\n\n try {\n\n const _phone = phone.replace(/\\D/g, '');\n this.phone = Number(_phone);\n\n this.sent = await this.crmBonusService.sendPin(this.phone, this.customer.name, this.storeName);;\n\n await this.crmBonusRef.setStep(StepFormEnum.STEP_PIN);\n\n this.showModal = true;\n } catch (error) {\n this.message = error?.response?.data?.message\n } finally {\n this.loading = false\n }\n }\n\n public async sendPinName(customerName: string) {\n this.loading = true;\n this.message = \"\";\n\n try {\n this.customer.name = customerName;\n\n this.sent = await this.crmBonusService.sendPin(this.phone, this.customer.name, this.storeName);;\n\n await this.crmBonusRef.setStep(StepFormEnum.STEP_PIN);\n\n this.showModal = true;\n } catch (error) {\n this.message = error?.response?.data?.message\n } finally {\n this.loading = false\n }\n }\n\n buildProducts(): IProduct[] {\n return buildProductsByWake(this.products);\n }\n\n handleCloseModal() {\n this.showModal = false;\n }\n\n save(amount: number) {\n localStorage.setItem(this.cartId, amount.toString());\n this.canCancel = true;\n this.amountCancel = amount.toString()\n }\n\n async cancel() {\n this.message = \"\";\n this.loading = true;\n try {\n await this.crmBonusService.cancel(this.cartId);\n this.canCancel = false;\n\n localStorage.removeItem(this.cartId);\n } catch (error) {\n this.message = \"Não consegui cancelar o bônus, tente novamente!\"\n } finally {\n this.loading = false;\n }\n }\n\n async handleSendPin(phone: string) {\n this.message = \"\"\n if (!phone) {\n this.message = \"Informe seu telefone\";\n return;\n }\n\n this.customer.phone = phone;\n const _phone = phone.replace(/\\D/g, '');\n this.phone = Number(_phone);\n\n if (this.customer.name) {\n return this.sendPin(phone)\n }\n\n await this.crmBonusRef.setStep(StepFormEnum.STEP_NAME);\n this.showModal = true;\n }\n\n render() {\n\n return (\n <loading-container loading={this.loading_reprocess} >\n <crm-giftback-form\n style={{ position: \"relative\" }}\n ref={ref => this.crmBonusRef = ref}\n storeName={this.storeName}\n products={this.buildProducts()}\n cartId={this.cartId}\n customer={this.customer}\n loadProducts={() => this.buildProducts()}\n \n />\n </loading-container>\n )\n }\n}\n"],"version":3}
1
+ {"file":"crm-bonus.js","mappings":";;;;;;;;;;;;;;;AAQA,IAAY,eAEX;AAFD,WAAY,eAAe;IACvB,iCAAc,CAAA;AAClB,CAAC,EAFW,eAAe,KAAf,eAAe;;SCNX,mBAAmB,CAAC,eAAoC,EAAE;IAEtE,MAAM,QAAQ,GAAoB,EAAE,CAAC;IAErC,KAAM,MAAM,EAAE,IAAI,YAAY,EAAG;QAC7B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AQ,EAAE,IAAI,CAAC,aAAa,EAAE,EAC9B,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,YAAY,EAAE,MAAM,IAAI,CAAC,aAAa,EAAE,GAExC,CACgB,EACrB;KACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["CrmBonus","i18next"],"sources":["src/dto/validate.pin.bonus.ts","src/helpers/build.payload.helper.ts","src/components/crm-bonus/crm-bonus.css?tag=crm-bonus&encapsulation=scoped","src/components/crm-bonus/crm-bonus.tsx"],"sourcesContent":["export interface IProduct {\n productVariantId: string;\n sku: string;\n value: number;\n quantity: number;\n discount: number;\n}\n\nexport enum AjustesTipoEnum {\n P = \"Promocao\" \n}\n\nexport interface IAjustes {\n Tipo: AjustesTipoEnum;\n Valor: number;\n}\n\nexport interface IProductWake {\n ProdutoVarianteId: number;\n SKU: string;\n PrecoPor: number;\n Quantidade: number;\n Ajustes: IAjustes[];\n}\n\nexport interface ICustomer {\n birthDate: string;\n document: string;\n name: string;\n phone: string;\n}\n\nexport interface IProccesPinBonusDto {\n storeName: string;\n name: string;\n checkoutId: string;\n checkoutProducts: Array<IProduct>;\n storeId: string;\n userId: string;\n cellphone: number;\n pin: string;\n\n}\n\nexport interface IBonus {\n hasBonus: boolean;\n bonusBalance: number;\n totalBonus: number;\n minimumPurchase: number;\n bonusIds: string;\n firstValidityDate: string\n history: [\n {\n validityStart: string;\n validityEnd: string;\n value: number\n },\n {\n validityStart: string;\n validityEnd: string\n value: number\n }\n ]\n storeId: number;\n userId: number;\n cartId: string\n calculatedValue: number;\n totalValue: number\n}\n\n\nexport interface IReserveDTO {\n storeName: string;\n cartId: string;\n grossValue: number;\n redeemedBonus: number;\n ticket: string;\n storeId: string;\n userId: number;\n}","import { AjustesTipoEnum, IAjustes, IProduct, IProductWake } from \"../dto/validate.pin.bonus\";\n\nexport function buildProductsByWake(productsWake: Array<IProductWake> = []): Array<IProduct> {\n\n const products: Array<IProduct> = [];\n\n for ( const pw of productsWake ) {\n let discounts = getDiscount(pw.Ajustes)\n\n products.push(\n {\n sku: pw.SKU,\n value: (pw.PrecoPor * pw.Quantidade),\n productVariantId: pw.ProdutoVarianteId.toString(),\n quantity: pw.Quantidade,\n discount: (discounts * -1)\n }\n )\n }\n\n return products;\n}\n\nfunction getDiscount(ajustes: IAjustes[] = []) {\n \n let discounts = 0;\n \n for(const discount of ajustes) {\n if(discount.Tipo === AjustesTipoEnum.P) {\n discounts += discount.Valor;\n }\n }\n\n return discounts;\n}","\n.container-button {\n /* max-width: 100%; */\n cursor: pointer;\n padding: 5px 5px 5px 14px;\n /* display: flex; */\n}\n\n/* padding: 0 15px 15px;\nborder: 1px solid #ddd;\nmargin-bottom: 20px; */\n\n.section-crm {\n border: 1px solid #dbd4d4;\n /* min-height: 50px; */\n text-align: -webkit-center;\n margin-bottom: 20px;\n}\n\n.section-cart-crm {\n margin-top: 10px;\n}\n\n.section-cart-crm p {\n padding: 0;\n margin: 0px 0px 0px 15px;\n}\n\n.button {\n top: 50%;\n background-color: #6c6c7e;\n color: #fff;\n border: none;\n /* border-radius: 10px; */\n padding: 15px;\n min-height: 30px;\n min-width: 120px;\n font-size: 20px;\n cursor: pointer;\n margin-left: 10px;\n height: 70px;\n}\n\n.form-container {\n width: 97%;\n display: flex;\n justify-content: space-around;\n}\n\n\n.btn {\n display: inline-block;\n padding: 6px 12px;\n margin-bottom: 0;\n font-size: 14px;\n font-weight: 400;\n line-height: 1.42857143;\n text-align: center;\n white-space: nowrap;\n vertical-align: middle;\n -ms-touch-action: manipulation;\n touch-action: manipulation;\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n background-image: none;\n border: 1px solid transparent;\n border-radius: 0px;\n}\n\n.form-container .btnCrm {\n background: #00162e;\n border-color: #00162e;\n width: 30%;\n color: #fff;\n}\n\n.message-alert {\n font-family: sans-serif;\n color: #df4d4d;\n margin-top: 5px;\n}","import { Component, Method, Prop, State, Watch, h } from '@stencil/core';\nimport { IProduct, IProductWake, ICustomer } from '../../dto/validate.pin.bonus';\nimport { CrmBonusService } from '../../services/crmbonus.service';\nimport { IPinSent } from '../../components';\nimport { StepFormEnum } from '../../contants';\n\nimport i18next from '../../i18n/i18n'\nimport { buildProductsByWake } from '../../helpers/build.payload.helper';\n\n@Component({\n tag: 'crm-bonus',\n styleUrl: 'crm-bonus.css',\n scoped: true,\n assetsDirs: ['assets']\n})\nexport class CrmBonus {\n\n private crmBonusService: CrmBonusService = CrmBonusService.getInstance();\n\n private crmBonusRef: HTMLCrmGiftbackFormElement;\n\n @State() showModal: boolean = false;\n @Prop({ attribute: 'userid' }) userId: number;\n @Prop({ attribute: 'storename' }) storeName;\n @Prop({ attribute: 'products' }) productsInString: string;\n @Prop({ attribute: 'cartid' }) cartId;\n\n @State() products: Array<IProductWake>;\n @State() customer: ICustomer = {\n birthDate: \"\",\n document: \"\",\n name: \"\",\n phone: \"\"\n };\n\n @State() loading: boolean = false;\n @State() message: string;\n @State() phone: number;\n @State() canCancel: boolean = false;\n @State() amountCancel: string;\n @State() sent: IPinSent;\n\n @State() session: string;\n @State() loading_reprocess = false;\n\n @Method()\n async resetBonus() {\n console.log('[START RESET BONUS]!!!!!');\n // const used = localStorage.getItem(\"bc:used\");\n\n // if (used == \"use\") {\n // await this.crmBonusService.cancelBonus(this.cartId, this.storeName);\n // }\n\n try {\n await this.crmBonusRef.processBonus(this.buildProducts(), true);\n console.log('[BONUS RESETADO]!!!!!');\n } catch (err) {\n\n this.loading = false;\n console.log('[error ao reprocessar bonous]');\n await this.crmBonusRef.setStep(StepFormEnum.STEP_PHONE);\n } finally {\n this.loading = false;\n }\n }\n\n @Method()\n async reprocess(products: Array<any>) {\n this.loading_reprocess = true\n\n console.log('[reprocess]');\n try {\n console.log('[update products list]');\n this.productsInString = JSON.stringify(products);\n await this.handleLoad();\n\n await this.resetBonus();\n } catch (err) {\n console.debug('[watchProducts]', err.message);\n } finally {\n this.loading_reprocess = false\n }\n }\n\n @Watch(\"productsInString\")\n async watchProducts(newValue: string) {\n try {\n console.log('[update products list]');\n this.productsInString = newValue;\n await this.handleLoad();\n\n await this.resetBonus();\n } catch (err) {\n console.debug('[watchProducts]', err.message);\n }\n }\n\n async componentWillLoad() {\n i18next.changeLanguage(i18next.language);\n\n await this.loadSession();\n await this.loadConfigStore()\n await this.handleLoad();\n }\n\n async loadConfigStore() {\n await this.crmBonusService.getCustomization(this.storeName);\n }\n\n async handleLoad() {\n try {\n if (this.userId) {\n this.customer = await this.crmBonusService.getCustomer(this.userId, this.storeName);\n console.log('customer', this.customer);\n }\n\n const amount = localStorage.getItem(this.cartId);\n\n if (amount) {\n this.canCancel = true;\n this.amountCancel = amount;\n }\n\n } catch (error) {\n console.log('info customer')\n }\n\n this.buildAndGetProducts();\n }\n\n\n async loadSession() {\n this.session = await this.crmBonusService.getToken(this.storeName);\n\n setTimeout(() => {\n this.loadSession()\n }, 1500000)\n\n }\n\n async buildAndGetProducts() {\n const key = `bc-products:${this.cartId}`;\n\n localStorage.setItem(key, this.productsInString);\n\n const productsInCart = JSON.parse(this.productsInString);\n const products_in_cache = JSON.parse(localStorage.getItem(key));\n\n const products: Array<IProductWake> = []\n\n for (const product_cart of productsInCart) {\n\n const [pro] = products_in_cache.filter(p => p.ProdutoVarianteId == product_cart.ProdutoVarianteId)\n\n if (pro) {\n products.push({\n ...product_cart,\n PrecoPor: pro.PrecoPor,\n Quantidade: pro.Quantidade,\n Ajustes: pro.Ajustes\n })\n } else {\n products.push(product_cart)\n }\n\n }\n\n this.products = products; //cache_products ? JSON.parse(cache_products) : JSON.parse(this.productsInString);\n\n }\n\n public async sendPin(phone: string) {\n this.loading = true;\n this.message = \"\";\n\n try {\n\n const _phone = phone.replace(/\\D/g, '');\n this.phone = Number(_phone);\n\n this.sent = await this.crmBonusService.sendPin(this.phone, this.customer.name, this.storeName);;\n\n await this.crmBonusRef.setStep(StepFormEnum.STEP_PIN);\n\n this.showModal = true;\n } catch (error) {\n this.message = error?.response?.data?.message\n } finally {\n this.loading = false\n }\n }\n\n public async sendPinName(customerName: string) {\n this.loading = true;\n this.message = \"\";\n\n try {\n this.customer.name = customerName;\n\n this.sent = await this.crmBonusService.sendPin(this.phone, this.customer.name, this.storeName);;\n\n await this.crmBonusRef.setStep(StepFormEnum.STEP_PIN);\n\n this.showModal = true;\n } catch (error) {\n this.message = error?.response?.data?.message\n } finally {\n this.loading = false\n }\n }\n\n buildProducts(): IProduct[] {\n return buildProductsByWake(this.products);\n }\n\n handleCloseModal() {\n this.showModal = false;\n }\n\n save(amount: number) {\n localStorage.setItem(this.cartId, amount.toString());\n this.canCancel = true;\n this.amountCancel = amount.toString()\n }\n\n async cancel() {\n this.message = \"\";\n this.loading = true;\n try {\n await this.crmBonusService.cancel(this.cartId);\n this.canCancel = false;\n\n localStorage.removeItem(this.cartId);\n } catch (error) {\n this.message = \"Não consegui cancelar o bônus, tente novamente!\"\n } finally {\n this.loading = false;\n }\n }\n\n async handleSendPin(phone: string) {\n this.message = \"\"\n if (!phone) {\n this.message = \"Informe seu telefone\";\n return;\n }\n\n this.customer.phone = phone;\n const _phone = phone.replace(/\\D/g, '');\n this.phone = Number(_phone);\n\n if (this.customer.name) {\n return this.sendPin(phone)\n }\n\n await this.crmBonusRef.setStep(StepFormEnum.STEP_NAME);\n this.showModal = true;\n }\n\n render() {\n\n return (\n <loading-container loading={this.loading_reprocess} >\n <crm-giftback-form\n style={{ position: \"relative\" }}\n ref={ref => this.crmBonusRef = ref}\n storeName={this.storeName}\n products={this.buildProducts()}\n cartId={this.cartId}\n customer={this.customer}\n loadProducts={() => this.buildProducts()}\n \n />\n </loading-container>\n )\n }\n}\n"],"version":3}
@@ -1,4 +1,4 @@
1
- import { C as CrmBonus, d as defineCustomElement$1 } from './p-645bae5b.js';
1
+ import { C as CrmBonus, d as defineCustomElement$1 } from './p-2e88599d.js';
2
2
 
3
3
  const CrmGiftbackForm = CrmBonus;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,4 +1,4 @@
1
- import { T as Tooltip, d as defineCustomElement$1 } from './p-284d8322.js';
1
+ import { T as Tooltip, d as defineCustomElement$1 } from './p-53259f8a.js';
2
2
 
3
3
  const CrmTooltip = Tooltip;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,4 +1,4 @@
1
- import { G as GiftbackInfo$1, d as defineCustomElement$1 } from './p-03183a03.js';
1
+ import { G as GiftbackInfo$1, d as defineCustomElement$1 } from './p-f9381072.js';
2
2
 
3
3
  const GiftbackInfo = GiftbackInfo$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -6,8 +6,8 @@ import { i as instance } from './p-e8c19a64.js';
6
6
  import { g as getKeyReserveByCartId, U as USED_KEY } from './p-f9aeffc1.js';
7
7
  import { d as defineCustomElement$8 } from './p-078fe899.js';
8
8
  import { d as defineCustomElement$7 } from './p-2f30297f.js';
9
- import { d as defineCustomElement$6 } from './p-284d8322.js';
10
- import { d as defineCustomElement$5 } from './p-03183a03.js';
9
+ import { d as defineCustomElement$6 } from './p-53259f8a.js';
10
+ import { d as defineCustomElement$5 } from './p-f9381072.js';
11
11
  import { d as defineCustomElement$4 } from './p-169fe768.js';
12
12
  import { d as defineCustomElement$3 } from './p-f0449fc0.js';
13
13
  import { d as defineCustomElement$2 } from './p-3dd9a571.js';
@@ -307,4 +307,4 @@ defineCustomElement();
307
307
 
308
308
  export { CrmBonus as C, defineCustomElement as d };
309
309
 
310
- //# sourceMappingURL=p-645bae5b.js.map
310
+ //# sourceMappingURL=p-2e88599d.js.map
@@ -1 +1 @@
1
- {"file":"p-645bae5b.js","mappings":";;;;;;;;;;;;;;;AAAA,MAAM,eAAe,GAAG,i+BAAi+B,CAAC;AAC1/B,8BAAe,eAAe;;MCajB,QAAQ;;;;;QAGX,oBAAe,GAAoB,eAAe,CAA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AE,MAAM,IAAI,CAAC,WAAW,EAAE,EAChC,MAAM,EAAE,MAAM,IAAI,CAAC,OAAO,EAAE,EAC5B,QAAQ,EAAE,CAAC,IAAI,KAAK,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,EAC5C,OAAO,EAAE,IAAI,CAAC,OAAO,IAEpB,IAAI,CAAC,MAAM,IAAI,0DAAG,KAAK,EAAC,kBAAkB,IAAE,IAAI,CAAC,MAAM,CAAK,EAC5D,IAAI,CAAC,KAAK,IAAI,0DAAG,KAAK,EAAC,mBAAmB,IAAE,IAAI,CAAC,KAAK,CAAK,CAEnD,EAIX,IAAI,CAAC,IAAI,KAAK,YAAY,CAAC,YAAY;YACvC,sEACE,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,MAAM,EAAE,MAAM,IAAI,CAAC,YAAY,EAAE,EACjC,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,OAAO,EAAE,MAAM,IAAI,CAAC,YAAY,EAAE,GAClC,EAIF,IAAI,CAAC,IAAI,KAAK,YAAY,CAAC,aAAa;aAEtC,4DAAK,KAAK,EAAC,mBAAmB,IAC3BA,QAAO,CAAC,CAAC,CAAC,YAAY,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC,CAC9D,CACP,CAGC,EACP;KACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["i18next"],"sources":["src/components/giftback-form/giftback-form.css?tag=crm-giftback-form","src/components/giftback-form/giftback-form.tsx"],"sourcesContent":["* {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n}\n\n:host {\n --crmfont-sizebodymd: 14px;\n --crmline-heightbodymd: 20px;\n --crmletter-spacingtitle-md: 0px\n}\n\n.container-message {\n font-family: Roboto;\n font-size: var(--crmfont-sizebodymd);\n font-weight: 400;\n line-height: var(--crmline-heightbodymd);\n letter-spacing: var(--crmletter-spacingtitle-md);\n text-align: left;\n text-underline-position: from-font;\n text-decoration-skip-ink: none;\n}\n\n.crm-container-form {\n display: flex;\n flex-direction: column;\n justify-content: space-around;\n height: auto;\n padding: 20px 24px 20px 24px;\n border: 1px solid #CCCC;\n writing-mode: horizontal-tb;\n gap: 16px;\n border-top: 1px solid #ccc !important;\n border-bottom: 1px solid #ccc !important;\n}\n\n/* .fbits-responsive-carrinho-desconto {\n overflow: hidden;\n border: 1px solid #ccc;\n border-top: 0;\n border-bottom: 0;\n} */\n\n.crm-phone-form {\n display: flex;\n flex-direction: column;\n height: 100%;\n /* justify-content: space-around; */\n gap: 16px;\n}\n\n.crm-subtitle {\n font-size: 14px;\n color: var(--crm-btn);\n font-weight: 100;\n}\n\n.crm-title {\n font-weight: 700;\n line-height: 20px;\n color: #262626;\n font-size: 16px;\n}\n\n.crm-message-info {\n color: #619013;\n font-weight: 500;\n font-size: 12px;\n}\n\n.crm-message-error {\n color: #E11D48;\n font-weight: 500;\n font-size: 12px;\n}","import { Component, Method, Prop, State, h } from \"@stencil/core\";\nimport { CrmBonusService } from \"../../services/crmbonus.service\";\nimport { StatusGiftBackProcess, StepFormEnum } from \"../../contants\";\nimport { IPinSent } from '../../dto/pin.sent'\nimport { IBonus, ICustomer, IProccesPinBonusDto, IProduct } from \"../../dto/validate.pin.bonus\";\nimport { IInfoStore, getInfoCustomization } from \"../../helpers/info.config.helper\";\n\nimport i18next from \"../../i18n/i18n\"\nimport { USED_KEY, getKeyReserveByCartId } from \"../../utils/keys.storage\";\n\n@Component({\n tag: 'crm-giftback-form',\n styleUrl: 'giftback-form.css'\n})\nexport class CrmBonus {\n // private phoneInputMask: HTMLPhoneFormElement;\n\n private crmBonusService: CrmBonusService = CrmBonusService.getInstance();\n\n @Prop({ attribute: 'storename' }) storeName;\n @Prop() cartId;\n @Prop() products: Array<IProduct>;\n @Prop() customer: ICustomer;\n @Prop() loadProducts: () => void;\n\n @State() value: string;\n @State() loading: boolean = false;\n @State() message: string;\n @State() phone: string;\n @State() pinInfo: IPinSent;\n @State() step: StepFormEnum = StepFormEnum.STEP_PHONE;\n @State() bonus: IBonus;\n\n @State() sucess: string = \"\";\n @State() error: string = \"\";\n @State() config: IInfoStore;\n\n @State() hasApplyBonus = false;\n\n\n @Method()\n async setStep(step: StepFormEnum) {\n this.step = step\n }\n\n @Method()\n async processBonus(products: IProduct[] = [], hasNewProduct = false) {\n this.sucess = \"\";\n\n console.log('processBonus', [])\n if (hasNewProduct) {\n this.products = products;\n }\n\n const _bonus = localStorage.getItem(getKeyReserveByCartId(this.cartId));\n\n if (_bonus) {\n\n const bonus = JSON.parse(_bonus)\n\n this.bonus = bonus;\n\n this.phone = bonus.phone;\n this.pinInfo = {\n storeId: bonus.storeId,\n userId: bonus.userId\n }\n \n await this.validateBonus(\"2018\");\n //this.step = StepFormEnum.STEP_RESERVE;\n\n }\n\n\n }\n\n async handleSendPin(phone: string) {\n\n this.message = \"\"\n if (!phone) {\n this.message = \"Informe seu telefone\";\n return;\n }\n\n this.phone = phone;\n\n this.sendPin()\n }\n\n async componentWillLoad() {\n this.sucess = \"\";\n this.error = \"\"\n this.config = getInfoCustomization(this.storeName);\n\n const phoneAgain = this.getPhoneNumberAgain();\n\n console.log('phoneAgain', phoneAgain)\n\n if(phoneAgain) {\n this.step = StepFormEnum.STEP_PHONE;\n return\n } \n\n await this.processBonus();\n\n }\n\n getPhoneNumberAgain() {\n const consulta_bonus = localStorage.getItem(getKeyReserveByCartId(this.cartId));\n\n if(!consulta_bonus) return false;\n\n const bonus = JSON.parse(consulta_bonus);\n\n return !bonus.hasBonus;\n }\n\n private convertStringToNumber(): number {\n const _phone = this.phone.replace(/\\D/g, '');\n return Number(_phone);\n }\n\n public async sendPin() {\n this.loading = true;\n this.message = \"\";\n this.sucess = \"\";\n this.error = \"\"\n\n try {\n\n const _phone = this.convertStringToNumber()\n\n this.pinInfo = await this.crmBonusService.sendPin(_phone, this.customer?.name, this.storeName);\n\n if (localStorage.getItem(`bc:${this.phone}`)) {\n await this.validateBonus(\"2018\");\n this.step = StepFormEnum.STEP_RESERVE;\n } else {\n this.step = StepFormEnum.STEP_PIN;\n }\n\n } catch (error) {\n this.message = error?.response?.data?.message\n } finally {\n this.loading = false\n }\n }\n\n changePhone() {\n this.sucess = \"\";\n this.error = \"\"\n this.step = StepFormEnum.STEP_PHONE;\n }\n\n public async validateBonus(pin: string) {\n\n console.log('this.phone', this.phone)\n\n this.loadProducts();\n\n const used_or_no = localStorage.getItem(USED_KEY);\n\n if (used_or_no == \"dontUse\") {\n this.step = StepFormEnum.STEP_RESERVE;\n return\n }\n\n this.loading = true;\n this.sucess = \"\";\n this.error = \"\";\n const payload: IProccesPinBonusDto = {\n pin: pin,\n cellphone: this.convertStringToNumber(),\n storeId: this.pinInfo.storeId.toString(),\n userId: this.pinInfo.userId.toString(),\n checkoutId: this.cartId,\n checkoutProducts: this.products,\n name: this.customer?.name,\n storeName: this.storeName\n }\n\n try {\n this.bonus = await this.crmBonusService.validatePinBonus(payload);\n\n if (!this.bonus.hasBonus) {\n\n localStorage.setItem(getKeyReserveByCartId(this.cartId), JSON.stringify({ ...this.bonus, phone: this.phone }));\n\n this.loading = false;\n this.step = StepFormEnum.STEP_NO_BONUS;\n return\n }\n\n this.sucess = \"Código validado com sucesso!\";\n localStorage.setItem(getKeyReserveByCartId(this.cartId), JSON.stringify({ ...this.bonus, phone: this.phone }));\n localStorage.setItem(`bc:${this.phone}`, StatusGiftBackProcess.VALIDATE)\n\n localStorage.setItem(USED_KEY, \"use\");\n localStorage.setItem(this.cartId, this.bonus.bonusBalance.toString());\n\n this.step = StepFormEnum.STEP_RESERVE;\n\n } catch (error) {\n const _error: string = error?.response?.data?.message;\n\n if (_error.includes(\"Pin\")) {\n this.error = \"Código inválido!\"\n } else {\n this.error = _error;\n this.step = StepFormEnum.STEP_NO_BONUS;\n }\n\n\n } finally {\n this.loading = false;\n }\n }\n\n public handleCancel() {\n // this.step = StepFormEnum.STEP_PHONE;\n this.cancel()\n }\n\n async cancel() {\n this.message = \"\";\n this.loading = true;\n try {\n await this.crmBonusService.cancel(this.cartId);\n\n localStorage.setItem(USED_KEY, \"dontUse\");\n this.save(0)\n } catch (error) {\n this.message = \"Não consegui cancelar o bônus, tente novamente!\"\n } finally {\n this.loading = false;\n }\n }\n\n public async reserveApply(amount: number) {\n this.loading = true;\n this.message = \"\";\n try {\n await this.reserve(amount);\n this.save(amount);\n\n } catch (error) {\n this.message = \"ocorreu um error ao solicitar a aplicação do bonus! tente novamente\"\n\n this.step = StepFormEnum.STEP_NO_BONUS;\n localStorage.removeItem(this.cartId);\n } finally {\n this.loading = false;\n }\n }\n\n save(amount: number) {\n localStorage.setItem(this.cartId, amount.toString());\n }\n\n public async reserve(amount: number) {\n\n await this.crmBonusService.reserve({\n redeemedBonus: amount,\n cartId: this.cartId,\n ticket: this.cartId,\n grossValue: Number(this.bonus.totalValue),\n storeName: this.storeName,\n storeId: this.bonus.storeId.toString(),\n userId: this.bonus.userId\n });\n }\n\n render() {\n return (\n <div class=\"crm-container-form fbits-responsive-carrinho-desconto\" >\n\n {/* <loading-container /> */}\n\n <label class=\"crm-title\">{this.config.giftbackTitle}</label>\n\n {this.step === StepFormEnum.STEP_PHONE &&\n <phone-form\n value={this.customer.phone}\n config={this.config}\n loading={this.loading}\n handlerSubmit={(phone) => this.handleSendPin(phone)}\n />}\n {\n this.step === StepFormEnum.STEP_PIN &&\n <pin-form\n config={this.config}\n phone={this.phone}\n cancel={() => this.changePhone()}\n resend={() => this.sendPin()}\n validate={(data) => this.validateBonus(data)}\n loading={this.loading}\n >\n {this.sucess && <p class=\"crm-message-info\">{this.sucess}</p>}\n {this.error && <p class=\"crm-message-error\">{this.error}</p>}\n\n </pin-form>\n }\n\n {\n this.step === StepFormEnum.STEP_RESERVE &&\n <giftback-info\n loading={this.loading}\n cancel={() => this.handleCancel()}\n bonus={this.bonus}\n reserve={() => this.processBonus()}\n />\n }\n\n {\n this.step === StepFormEnum.STEP_NO_BONUS &&\n (\n <div class=\"container-message\">\n {i18next.t(\"noGiftback\", { storename: this.config.giftbackTitle })}\n </div>\n )\n\n }\n </div>\n )\n }\n}"],"version":3}
1
+ {"file":"p-2e88599d.js","mappings":";;;;;;;;;;;;;;;AAAA,MAAM,eAAe,GAAG,i+BAAi+B,CAAC;AAC1/B,8BAAe,eAAe;;MCajB,QAAQ;;;;;QAGX,oBAAe,GAAoB,eAAe,CAAC,WAAW,EAAE,CAAC;;;;;;;uBAS7C,KAAK;;;;oBAIH,YAAY,CAAC,UAAU;;sBAG3B,EAAE;qBACH,EAAE;;6BAGF,KAAK;;IAI9B,MAAM,OAAO,CAAC,IAAkB;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;KACjB;IAGD,MAAM,YAAY,CAAC,WAAuB,EAAE,EAAE,aAAa,GAAG,KAAK;QACjE,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QAEjB,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,EAAE,CAAC,CAAA;QAC/B,IAAI,aAAa,EAAE;YACjB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;SAC1B;QAED,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,qBAAqB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QAExE,IAAI,MAAM,EAAE;YAEV,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;YAEhC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;YAEnB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;YACzB,IAAI,CAAC,OAAO,GAAG;gBACb,OAAO,EAAE,KAAK,CAAC,OAAO;gBACtB,MAAM,EAAE,KAAK,CAAC,MAAM;aACrB,CAAA;YAED,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;;SAGlC;KAGF;IAED,MAAM,aAAa,CAAC,KAAa;QAE/B,IAAI,CAAC,OAAO,GAAG,EA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src/components/giftback-form/giftback-form.tsx"],"sourcesContent":["* {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n}\n\n:host {\n --crmfont-sizebodymd: 14px;\n --crmline-heightbodymd: 20px;\n --crmletter-spacingtitle-md: 0px\n}\n\n.container-message {\n font-family: Roboto;\n font-size: var(--crmfont-sizebodymd);\n font-weight: 400;\n line-height: var(--crmline-heightbodymd);\n letter-spacing: var(--crmletter-spacingtitle-md);\n text-align: left;\n text-underline-position: from-font;\n text-decoration-skip-ink: none;\n}\n\n.crm-container-form {\n display: flex;\n flex-direction: column;\n justify-content: space-around;\n height: auto;\n padding: 20px 24px 20px 24px;\n border: 1px solid #CCCC;\n writing-mode: horizontal-tb;\n gap: 16px;\n border-top: 1px solid #ccc !important;\n border-bottom: 1px solid #ccc !important;\n}\n\n/* .fbits-responsive-carrinho-desconto {\n overflow: hidden;\n border: 1px solid #ccc;\n border-top: 0;\n border-bottom: 0;\n} */\n\n.crm-phone-form {\n display: flex;\n flex-direction: column;\n height: 100%;\n /* justify-content: space-around; */\n gap: 16px;\n}\n\n.crm-subtitle {\n font-size: 14px;\n color: var(--crm-btn);\n font-weight: 100;\n}\n\n.crm-title {\n font-weight: 700;\n line-height: 20px;\n color: #262626;\n font-size: 16px;\n}\n\n.crm-message-info {\n color: #619013;\n font-weight: 500;\n font-size: 12px;\n}\n\n.crm-message-error {\n color: #E11D48;\n font-weight: 500;\n font-size: 12px;\n}","import { Component, Method, Prop, State, h } from \"@stencil/core\";\nimport { CrmBonusService } from \"../../services/crmbonus.service\";\nimport { StatusGiftBackProcess, StepFormEnum } from \"../../contants\";\nimport { IPinSent } from '../../dto/pin.sent'\nimport { IBonus, ICustomer, IProccesPinBonusDto, IProduct } from \"../../dto/validate.pin.bonus\";\nimport { IInfoStore, getInfoCustomization } from \"../../helpers/info.config.helper\";\n\nimport i18next from \"../../i18n/i18n\"\nimport { USED_KEY, getKeyReserveByCartId } from \"../../utils/keys.storage\";\n\n@Component({\n tag: 'crm-giftback-form',\n styleUrl: 'giftback-form.css'\n})\nexport class CrmBonus {\n // private phoneInputMask: HTMLPhoneFormElement;\n\n private crmBonusService: CrmBonusService = CrmBonusService.getInstance();\n\n @Prop({ attribute: 'storename' }) storeName;\n @Prop() cartId;\n @Prop() products: Array<IProduct>;\n @Prop() customer: ICustomer;\n @Prop() loadProducts: () => void;\n\n @State() value: string;\n @State() loading: boolean = false;\n @State() message: string;\n @State() phone: string;\n @State() pinInfo: IPinSent;\n @State() step: StepFormEnum = StepFormEnum.STEP_PHONE;\n @State() bonus: IBonus;\n\n @State() sucess: string = \"\";\n @State() error: string = \"\";\n @State() config: IInfoStore;\n\n @State() hasApplyBonus = false;\n\n\n @Method()\n async setStep(step: StepFormEnum) {\n this.step = step\n }\n\n @Method()\n async processBonus(products: IProduct[] = [], hasNewProduct = false) {\n this.sucess = \"\";\n\n console.log('processBonus', [])\n if (hasNewProduct) {\n this.products = products;\n }\n\n const _bonus = localStorage.getItem(getKeyReserveByCartId(this.cartId));\n\n if (_bonus) {\n\n const bonus = JSON.parse(_bonus)\n\n this.bonus = bonus;\n\n this.phone = bonus.phone;\n this.pinInfo = {\n storeId: bonus.storeId,\n userId: bonus.userId\n }\n \n await this.validateBonus(\"2018\");\n //this.step = StepFormEnum.STEP_RESERVE;\n\n }\n\n\n }\n\n async handleSendPin(phone: string) {\n\n this.message = \"\"\n if (!phone) {\n this.message = \"Informe seu telefone\";\n return;\n }\n\n this.phone = phone;\n\n this.sendPin()\n }\n\n async componentWillLoad() {\n this.sucess = \"\";\n this.error = \"\"\n this.config = getInfoCustomization(this.storeName);\n\n const phoneAgain = this.getPhoneNumberAgain();\n\n console.log('phoneAgain', phoneAgain)\n\n if(phoneAgain) {\n this.step = StepFormEnum.STEP_PHONE;\n return\n } \n\n await this.processBonus();\n\n }\n\n getPhoneNumberAgain() {\n const consulta_bonus = localStorage.getItem(getKeyReserveByCartId(this.cartId));\n\n if(!consulta_bonus) return false;\n\n const bonus = JSON.parse(consulta_bonus);\n\n return !bonus.hasBonus;\n }\n\n private convertStringToNumber(): number {\n const _phone = this.phone.replace(/\\D/g, '');\n return Number(_phone);\n }\n\n public async sendPin() {\n this.loading = true;\n this.message = \"\";\n this.sucess = \"\";\n this.error = \"\"\n\n try {\n\n const _phone = this.convertStringToNumber()\n\n this.pinInfo = await this.crmBonusService.sendPin(_phone, this.customer?.name, this.storeName);\n\n if (localStorage.getItem(`bc:${this.phone}`)) {\n await this.validateBonus(\"2018\");\n this.step = StepFormEnum.STEP_RESERVE;\n } else {\n this.step = StepFormEnum.STEP_PIN;\n }\n\n } catch (error) {\n this.message = error?.response?.data?.message\n } finally {\n this.loading = false\n }\n }\n\n changePhone() {\n this.sucess = \"\";\n this.error = \"\"\n this.step = StepFormEnum.STEP_PHONE;\n }\n\n public async validateBonus(pin: string) {\n\n console.log('this.phone', this.phone)\n\n this.loadProducts();\n\n const used_or_no = localStorage.getItem(USED_KEY);\n\n if (used_or_no == \"dontUse\") {\n this.step = StepFormEnum.STEP_RESERVE;\n return\n }\n\n this.loading = true;\n this.sucess = \"\";\n this.error = \"\";\n const payload: IProccesPinBonusDto = {\n pin: pin,\n cellphone: this.convertStringToNumber(),\n storeId: this.pinInfo.storeId.toString(),\n userId: this.pinInfo.userId.toString(),\n checkoutId: this.cartId,\n checkoutProducts: this.products,\n name: this.customer?.name,\n storeName: this.storeName\n }\n\n try {\n this.bonus = await this.crmBonusService.validatePinBonus(payload);\n\n if (!this.bonus.hasBonus) {\n\n localStorage.setItem(getKeyReserveByCartId(this.cartId), JSON.stringify({ ...this.bonus, phone: this.phone }));\n\n this.loading = false;\n this.step = StepFormEnum.STEP_NO_BONUS;\n return\n }\n\n this.sucess = \"Código validado com sucesso!\";\n localStorage.setItem(getKeyReserveByCartId(this.cartId), JSON.stringify({ ...this.bonus, phone: this.phone }));\n localStorage.setItem(`bc:${this.phone}`, StatusGiftBackProcess.VALIDATE)\n\n localStorage.setItem(USED_KEY, \"use\");\n localStorage.setItem(this.cartId, this.bonus.bonusBalance.toString());\n\n this.step = StepFormEnum.STEP_RESERVE;\n\n } catch (error) {\n const _error: string = error?.response?.data?.message;\n\n if (_error.includes(\"Pin\")) {\n this.error = \"Código inválido!\"\n } else {\n this.error = _error;\n this.step = StepFormEnum.STEP_NO_BONUS;\n }\n\n\n } finally {\n this.loading = false;\n }\n }\n\n public handleCancel() {\n // this.step = StepFormEnum.STEP_PHONE;\n this.cancel()\n }\n\n async cancel() {\n this.message = \"\";\n this.loading = true;\n try {\n await this.crmBonusService.cancel(this.cartId);\n\n localStorage.setItem(USED_KEY, \"dontUse\");\n this.save(0)\n } catch (error) {\n this.message = \"Não consegui cancelar o bônus, tente novamente!\"\n } finally {\n this.loading = false;\n }\n }\n\n public async reserveApply(amount: number) {\n this.loading = true;\n this.message = \"\";\n try {\n await this.reserve(amount);\n this.save(amount);\n\n } catch (error) {\n this.message = \"ocorreu um error ao solicitar a aplicação do bonus! tente novamente\"\n\n this.step = StepFormEnum.STEP_NO_BONUS;\n localStorage.removeItem(this.cartId);\n } finally {\n this.loading = false;\n }\n }\n\n save(amount: number) {\n localStorage.setItem(this.cartId, amount.toString());\n }\n\n public async reserve(amount: number) {\n\n await this.crmBonusService.reserve({\n redeemedBonus: amount,\n cartId: this.cartId,\n ticket: this.cartId,\n grossValue: Number(this.bonus.totalValue),\n storeName: this.storeName,\n storeId: this.bonus.storeId.toString(),\n userId: this.bonus.userId\n });\n }\n\n render() {\n return (\n <div class=\"crm-container-form fbits-responsive-carrinho-desconto\" >\n\n {/* <loading-container /> */}\n\n <label class=\"crm-title\">{this.config.giftbackTitle}</label>\n\n {this.step === StepFormEnum.STEP_PHONE &&\n <phone-form\n value={this.customer.phone}\n config={this.config}\n loading={this.loading}\n handlerSubmit={(phone) => this.handleSendPin(phone)}\n />}\n {\n this.step === StepFormEnum.STEP_PIN &&\n <pin-form\n config={this.config}\n phone={this.phone}\n cancel={() => this.changePhone()}\n resend={() => this.sendPin()}\n validate={(data) => this.validateBonus(data)}\n loading={this.loading}\n >\n {this.sucess && <p class=\"crm-message-info\">{this.sucess}</p>}\n {this.error && <p class=\"crm-message-error\">{this.error}</p>}\n\n </pin-form>\n }\n\n {\n this.step === StepFormEnum.STEP_RESERVE &&\n <giftback-info\n loading={this.loading}\n cancel={() => this.handleCancel()}\n bonus={this.bonus}\n reserve={() => this.processBonus()}\n />\n }\n\n {\n this.step === StepFormEnum.STEP_NO_BONUS &&\n (\n <div class=\"container-message\">\n {i18next.t(\"noGiftback\", { storename: this.config.giftbackTitle })}\n </div>\n )\n\n }\n </div>\n )\n }\n}"],"version":3}
@@ -2,7 +2,7 @@ import { p as proxyCustomElement, H, h } from './p-3e84f78c.js';
2
2
 
3
3
  const infoCircleSvgrepoComSvg = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPg0KPHN2ZyB3aWR0aD0iODAwcHgiIGhlaWdodD0iODAwcHgiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCjxwYXRoIGQ9Ik0xMiAxNy43NUMxMi40MTQyIDE3Ljc1IDEyLjc1IDE3LjQxNDIgMTIuNzUgMTdWMTFDMTIuNzUgMTAuNTg1OCAxMi40MTQyIDEwLjI1IDEyIDEwLjI1QzExLjU4NTggMTAuMjUgMTEuMjUgMTAuNTg1OCAxMS4yNSAxMVYxN0MxMS4yNSAxNy40MTQyIDExLjU4NTggMTcuNzUgMTIgMTcuNzVaIiBmaWxsPSIjMUMyNzRDIi8+DQo8cGF0aCBkPSJNMTIgN0MxMi41NTIzIDcgMTMgNy40NDc3MiAxMyA4QzEzIDguNTUyMjggMTIuNTUyMyA5IDEyIDlDMTEuNDQ3NyA5IDExIDguNTUyMjggMTEgOEMxMSA3LjQ0NzcyIDExLjQ0NzcgNyAxMiA3WiIgZmlsbD0iIzFDMjc0QyIvPg0KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xLjI1IDEyQzEuMjUgNi4wNjI5NCA2LjA2Mjk0IDEuMjUgMTIgMS4yNUMxNy45MzcxIDEuMjUgMjIuNzUgNi4wNjI5NCAyMi43NSAxMkMyMi43NSAxNy45MzcxIDE3LjkzNzEgMjIuNzUgMTIgMjIuNzVDNi4wNjI5NCAyMi43NSAxLjI1IDE3LjkzNzEgMS4yNSAxMlpNMTIgMi43NUM2Ljg5MTM3IDIuNzUgMi43NSA2Ljg5MTM3IDIuNzUgMTJDMi43NSAxNy4xMDg2IDYuODkxMzcgMjEuMjUgMTIgMjEuMjVDMTcuMTA4NiAyMS4yNSAyMS4yNSAxNy4xMDg2IDIxLjI1IDEyQzIxLjI1IDYuODkxMzcgMTcuMTA4NiAyLjc1IDEyIDIuNzVaIiBmaWxsPSIjMUMyNzRDIi8+DQo8L3N2Zz4=';
4
4
 
5
- const crmTooltipCss = ".crm-tooltip-container {\n display: flex;\n\n & img {\n width: 16px;\n margin-left: 3px;\n position: relative;\n }\n}\n\n.crm-tooltip {\n position: relative;\n display: inline-block;\n}\n\n.crm-tooltip .tooltiptext {\n visibility: hidden;\n background-color: black;\n color: #fff;\n text-align: center;\n padding: 8px 12px;\n border-radius: 0px;\n position: absolute;\n z-index: 1;\n min-width: 271px;\n top: 100%;\n left: 50%;\n margin-left: -238px;\n}\n\n@media (max-width: 410px) {\n .crm-tooltip .tooltiptext {\n margin-left: -14px;\n }\n\n .crm-tooltip #crm-role-description {\n margin-left: -151px;\n }\n}\n\n@media (max-width: 250px) {\n .crm-tooltip .tooltiptext {\n margin-left: -201px;\n }\n}\n\n.crm-tooltip:hover .tooltiptext {\n visibility: visible;\n}";
5
+ const crmTooltipCss = ".crm-tooltip-container {\n display: flex;\n\n & img {\n width: 16px;\n margin-left: 3px;\n position: relative;\n }\n}\n\n.crm-tooltip {\n position: relative;\n display: inline-block;\n}\n\n.crm-tooltip .tooltiptext {\n visibility: hidden;\n background-color: black;\n color: #fff;\n text-align: center;\n padding: 8px 12px;\n border-radius: 0px;\n position: absolute;\n z-index: 1;\n min-width: 271px;\n top: 100%;\n left: 50%;\n margin-left: -238px;\n}\n\n@container (max-width: 410px) {\n .crm-tooltip .tooltiptext {\n margin-left: -14px;\n }\n\n .crm-tooltip #crm-role-description {\n margin-left: -151px;\n }\n}\n\n@container (max-width: 250px) {\n .crm-tooltip .tooltiptext {\n margin-left: -201px;\n }\n}\n\n.crm-tooltip:hover .tooltiptext {\n visibility: visible;\n}";
6
6
  const CrmTooltipStyle0 = crmTooltipCss;
7
7
 
8
8
  const Tooltip = /*@__PURE__*/ proxyCustomElement(class Tooltip extends H {
@@ -37,4 +37,4 @@ defineCustomElement();
37
37
 
38
38
  export { Tooltip as T, defineCustomElement as d };
39
39
 
40
- //# sourceMappingURL=p-284d8322.js.map
40
+ //# sourceMappingURL=p-53259f8a.js.map
@@ -1 +1 @@
1
- {"file":"p-284d8322.js","mappings":";;AAAA,MAAM,uBAAuB,GAAG,wvCAAwvC;;ACAxxC,MAAM,aAAa,GAAG,i3BAAi3B,CAAC;AACx4B,yBAAe,aAAa;;MCOf,OAAO;;;;;;;IAKhB,MAAM;QACF,QACI,4DAAK,KAAK,EAAC,mCAAmC,IAC1C,4DAAK,GAAG,EAAEA,uBAAI,GAAI,EAClB,6DAAM,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAC,aAAa,IAAE,IAAI,CAAC,IAAI,CAAQ,CAC7D,EACR;KACL;;;;;;;;;;;;;;;;;;;;;;;","names":["info"],"sources":["src/assets/svg/info-circle-svgrepo-com.svg","src/components/tooltip/crm-tooltip.css?tag=crm-tooltip","src/components/tooltip/tooltip.tsx"],"sourcesContent":["<?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 {\n display: flex;\n\n & img {\n width: 16px;\n margin-left: 3px;\n position: relative;\n }\n}\n\n.crm-tooltip {\n position: relative;\n display: inline-block;\n}\n\n.crm-tooltip .tooltiptext {\n visibility: hidden;\n background-color: black;\n color: #fff;\n text-align: center;\n padding: 8px 12px;\n border-radius: 0px;\n position: absolute;\n z-index: 1;\n min-width: 271px;\n top: 100%;\n left: 50%;\n margin-left: -238px;\n}\n\n@media (max-width: 410px) {\n .crm-tooltip .tooltiptext {\n margin-left: -14px;\n }\n\n .crm-tooltip #crm-role-description {\n margin-left: -151px;\n }\n}\n\n@media (max-width: 250px) {\n .crm-tooltip .tooltiptext {\n margin-left: -201px;\n }\n}\n\n.crm-tooltip:hover .tooltiptext {\n visibility: visible;\n}","import { Component, h, Prop } from \"@stencil/core\";\nimport info from '../../assets/svg/info-circle-svgrepo-com.svg';\n\n\n@Component({\n tag: 'crm-tooltip',\n styleUrl: 'crm-tooltip.css'\n})\nexport class Tooltip {\n\n @Prop() text: string;\n @Prop() identity: string;\n\n render() {\n return (\n <div class=\"crm-tooltip-container crm-tooltip\">\n <img src={info} />\n <span id={this.identity} class=\"tooltiptext\">{this.text}</span>\n </div>\n );\n }\n}"],"version":3}
1
+ {"file":"p-53259f8a.js","mappings":";;AAAA,MAAM,uBAAuB,GAAG,wvCAAwvC;;ACAxxC,MAAM,aAAa,GAAG,y3BAAy3B,CAAC;AACh5B,yBAAe,aAAa;;MCOf,OAAO;;;;;;;IAKhB,MAAM;QACF,QACI,4DAAK,KAAK,EAAC,mCAAmC,IAC1C,4DAAK,GAAG,EAAEA,uBAAI,GAAI,EAClB,6DAAM,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAC,aAAa,IAAE,IAAI,CAAC,IAAI,CAAQ,CAC7D,EACR;KACL;;;;;;;;;;;;;;;;;;;;;;;","names":["info"],"sources":["src/assets/svg/info-circle-svgrepo-com.svg","src/components/tooltip/crm-tooltip.css?tag=crm-tooltip","src/components/tooltip/tooltip.tsx"],"sourcesContent":["<?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 {\n display: flex;\n\n & img {\n width: 16px;\n margin-left: 3px;\n position: relative;\n }\n}\n\n.crm-tooltip {\n position: relative;\n display: inline-block;\n}\n\n.crm-tooltip .tooltiptext {\n visibility: hidden;\n background-color: black;\n color: #fff;\n text-align: center;\n padding: 8px 12px;\n border-radius: 0px;\n position: absolute;\n z-index: 1;\n min-width: 271px;\n top: 100%;\n left: 50%;\n margin-left: -238px;\n}\n\n@container (max-width: 410px) {\n .crm-tooltip .tooltiptext {\n margin-left: -14px;\n }\n\n .crm-tooltip #crm-role-description {\n margin-left: -151px;\n }\n}\n\n@container (max-width: 250px) {\n .crm-tooltip .tooltiptext {\n margin-left: -201px;\n }\n}\n\n.crm-tooltip:hover .tooltiptext {\n visibility: visible;\n}","import { Component, h, Prop } from \"@stencil/core\";\nimport info from '../../assets/svg/info-circle-svgrepo-com.svg';\n\n\n@Component({\n tag: 'crm-tooltip',\n styleUrl: 'crm-tooltip.css'\n})\nexport class Tooltip {\n\n @Prop() text: string;\n @Prop() identity: string;\n\n render() {\n return (\n <div class=\"crm-tooltip-container crm-tooltip\">\n <img src={info} />\n <span id={this.identity} class=\"tooltiptext\">{this.text}</span>\n </div>\n );\n }\n}"],"version":3}
@@ -2,7 +2,7 @@ import { p as proxyCustomElement, H, h } from './p-3e84f78c.js';
2
2
  import { i as instance } from './p-e8c19a64.js';
3
3
  import { U as USED_KEY } from './p-f9aeffc1.js';
4
4
  import { d as defineLimit, a as formatDateToBr } from './p-d3bfac80.js';
5
- import { d as defineCustomElement$1 } from './p-284d8322.js';
5
+ import { d as defineCustomElement$1 } from './p-53259f8a.js';
6
6
 
7
7
  const giftbackInfoCss = ":host{--text-color:#6D6D5F}.giftback-container{display:flex;flex-direction:column;gap:14px}h3{font-size:1.2rem;margin-bottom:8px;color:#333}.container-description{display:flex;align-items:center;gap:5px;margin:0 0 10px 0}.container-description p{font-size:14px;font-weight:400;margin:0px}p{font-size:14px;color:#000}.value-display h2{color:#6D6D5F;font-size:1.6rem;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;font-size:0.9rem;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;font-size:14px;color:#262626;line-height:20px}.info-icon{font-size:0.9rem;cursor:pointer;color:#888}h3{font-size:1.2rem;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-size:16px;font-weight:700;color:var(--text-color);transform:translateX(-50%);white-space:nowrap;}.options-option{display:flex}";
8
8
  const GiftbackInfoStyle0 = giftbackInfoCss;
@@ -15,17 +15,17 @@ const GiftbackInfo = /*@__PURE__*/ proxyCustomElement(class GiftbackInfo extends
15
15
  this.selectedOption = 'none';
16
16
  this.loading = false;
17
17
  this.bonus = {
18
- totalBonus: 150,
18
+ totalBonus: 0,
19
19
  cartId: "",
20
- minimumPurchase: 500,
21
- bonusBalance: 50,
22
- calculatedValue: 150,
20
+ minimumPurchase: 0,
21
+ bonusBalance: 0,
22
+ calculatedValue: 0,
23
23
  firstValidityDate: "",
24
- totalValue: 400
24
+ totalValue: 0
25
25
  };
26
26
  this.reserve = undefined;
27
27
  this.cancel = undefined;
28
- this.sliderPosition = 50;
28
+ this.sliderPosition = 0;
29
29
  }
30
30
  changedBonus() {
31
31
  this.updateBonus();
@@ -71,11 +71,11 @@ const GiftbackInfo = /*@__PURE__*/ proxyCustomElement(class GiftbackInfo extends
71
71
  const remainingGiftback = this.bonus.minimumPurchase - this.bonus.totalValue;
72
72
  const translateDescription = instance.t("giftDescription", { amount: `${this.bonus.totalBonus.toFixed(2).replace(".", ",")}`, custom_name: "Giftback" });
73
73
  const limit = defineLimit(remainingGiftback);
74
- return (h("div", { key: 'c1176784d8fe227f26ea11facef2897619b5e1a4', class: "giftback-container" }, h("div", { key: 'f17f2ab172829eea4b2b239a119c05bb418a9ab7', class: "container-description" }, h("p", { key: '9764f9d185761cbd6458c922d56e5cea11a69bdd', innerHTML: translateDescription }), h("crm-tooltip", { key: '7429e9509544335bc21886c785fe47d3855c240a', identity: "crm-role-description", text: instance.t("labelUseGiftback", { minimumPurchase: this.bonus.minimumPurchase, expírationDate: formatDateToBr(this.bonus.firstValidityDate) }) })), h("div", { key: 'd6b3a9c9745510e50b1ad2c1a58c4b8998f825a6', class: "slider-wrapper" }, h("div", { key: 'be44d7c3709865d80f93e54f1ac4e58a026d6d0b', class: "slider-value", style: {
74
+ return (h("div", { key: '06bd5fda8f1b1dff75d27133fb27a222ea79475d', class: "giftback-container" }, h("div", { key: 'e770facaaf3c938dda000885ef42fe30f4b88eaf', class: "container-description" }, h("p", { key: '7d7aa390bb8f2c7a1973b38f0071522e7943af47', innerHTML: translateDescription }), h("crm-tooltip", { key: 'f209c195a0fcd7c4bec0b6227549ba139c41f637', identity: "crm-role-description", text: instance.t("labelUseGiftback", { minimumPurchase: this.bonus.minimumPurchase, expírationDate: formatDateToBr(this.bonus.firstValidityDate) }) })), h("div", { key: '6160a64dd8a3eea3b1f554349c2d6d0fc7113641', class: "slider-wrapper" }, h("div", { key: 'e3ca74f1b47613bd0b05339bd2856a942172cb0f', class: "slider-value", style: {
75
75
  left: `calc(${this.sliderPosition}% - 20px)`, // Ajuste para centralizar o texto
76
- } }, "R$ ", this.usedValue.toFixed(2).replace(".", ",")), h("input", { key: '49c16e5ff1dffcb431f449993dd134cae5129451', id: "position_value_id", disabled: true, type: "range", min: "0", max: this.bonus.totalBonus, value: this.usedValue, class: "slider", step: "0.01", onInput: (event) => this.handleSliderChange(event), style: {
76
+ } }, "R$ ", this.usedValue.toFixed(2).replace(".", ",")), h("input", { key: 'e748d506d25076173a1da4ae02a4869969228e16', id: "position_value_id", disabled: true, type: "range", min: "0", max: this.bonus.totalBonus, value: this.usedValue, class: "slider", step: "0.01", onInput: (event) => this.handleSliderChange(event), style: {
77
77
  background: `linear-gradient(to right, #6D6D5F ${this.sliderPosition}%, #ddd ${this.sliderPosition}%)`,
78
- } })), limit.isComplete && (h("p", { key: 'cf1969a181b2723ee801b4ea767bcef601761b58' }, instance.t("maxAmount"))), !limit.isComplete && (h("div", { key: 'f4d9cfcf895ac76fc7fe4bd84a8eeb0598b2c5a8', class: "container-description" }, h("p", { key: 'fa2074e6e43c96d4fbe1be21744c283dc79c9fb2' }, "Adicione ", h("strong", { key: 'f3f1ba8d8fb1522c8a3c633887c38113d16c9421' }, "R$ ", remainingGiftback < 0 ? "0,00" : remainingGiftback.toFixed(2).replace(".", ",")), " ao carrinho para atingir o valor m\u00E1ximo! ", h("crm-tooltip", { key: '5688ae6e5d56896828c85abc2d1e686716b30b99', identity: "crm-max-description", text: instance.t("labelamountPartial") })))), h("div", { key: '933b5d3dfe851a1ec25da562c68294528252b3ff', class: "options" }, h("div", { key: 'ce0c0ff87f36cea8bdec040dfff336a20bfca767', class: "options-option" }, h("input", { key: '780e9d3fc0b3e30c774255a8a22190a9a31c6f94', type: "radio", name: "giftbackOption", value: "use", checked: this.selectedOption === 'use', onChange: () => this.handleOptionChange('use') }), h("p", { key: 'accc8fefb955ce25f1b1d58c83e26732c9a9e63a' }, "Usar o meu Giftback")), h("div", { key: '9bff7c08c9ad32fbec92af3a7a2d15675f04b903', class: "options-option" }, h("input", { key: 'd27fc0ad93f0f9202ee180ab65910bddf836e1f5', type: "radio", name: "giftbackOption", value: "dontUse", checked: this.selectedOption === 'dontUse', onChange: () => this.handleOptionChange('dontUse') }), h("p", { key: '89bb7edfd129907ebf8dd8514ff2ec6d800d65e0' }, "N\u00E3o usar o meu Giftback"))), h("div", { key: '1ee7b71ffc3aef9bde5cd48be793c74c42855d8f', class: "info-box" }, "O Giftback ser\u00E1 aplicado na pr\u00F3xima etapa.")));
78
+ } })), limit.isComplete && (h("p", { key: '49b1525e9e04c7fc08db78a9c999540fdd0df6ea' }, instance.t("maxAmount"))), !limit.isComplete && (h("div", { key: '771cdc242af285229b6d23fd9738627f2e419385', class: "container-description" }, h("p", { key: '43dca214826cb8dc2a292400c5b02f40e7ce620a' }, "Adicione ", h("strong", { key: '3ffbe7777e5e3be5283012de568eddfe3ff1b23d' }, "R$ ", remainingGiftback < 0 ? "0,00" : remainingGiftback.toFixed(2).replace(".", ",")), " ao carrinho para atingir o valor m\u00E1ximo! ", h("crm-tooltip", { key: '71bae07de4470c5f9234e74a632713803cda2d7e', identity: "crm-max-description", text: instance.t("labelamountPartial") })))), h("div", { key: '23c5cbcea13c5cad47384815b6277fced7529f84', class: "options" }, h("div", { key: '5212788f1c1c258324ba83057c60fd0ecb76e29c', class: "options-option" }, h("input", { key: '14bf5fceb36b5b9db660e5e067e1ed9c89d31b81', type: "radio", name: "giftbackOption", value: "use", checked: this.selectedOption === 'use', onChange: () => this.handleOptionChange('use') }), h("p", { key: '487dc829efdca6754c967fcc85c58cb2cb7c63e1' }, "Usar o meu Giftback")), h("div", { key: 'd90651744aa5d3904b61be7d4adc1ec49e3c6676', class: "options-option" }, h("input", { key: '4ed8e68cfd86b871668e9de19d4c5420487f4e52', type: "radio", name: "giftbackOption", value: "dontUse", checked: this.selectedOption === 'dontUse', onChange: () => this.handleOptionChange('dontUse') }), h("p", { key: '344fbf40dadc0ef4e3a870e5251a1beb3b5ffd27' }, "N\u00E3o usar o meu Giftback"))), h("div", { key: '3b9a91dad6803aac48b96100c2bbded009677aa1', class: "info-box" }, "O Giftback ser\u00E1 aplicado na pr\u00F3xima etapa.")));
79
79
  }
80
80
  static get watchers() { return {
81
81
  "bonus": ["changedBonus"]
@@ -114,4 +114,4 @@ defineCustomElement();
114
114
 
115
115
  export { GiftbackInfo as G, defineCustomElement as d };
116
116
 
117
- //# sourceMappingURL=p-03183a03.js.map
117
+ //# sourceMappingURL=p-f9381072.js.map
@@ -0,0 +1 @@
1
+ {"file":"p-f9381072.js","mappings":";;;;;;AAAA,MAAM,eAAe,GAAG,k7DAAk7D,CAAC;AAC38D,2BAAe,eAAe;;MCUjB,YAAY;;;;yBACQ,CAAC;8BACI,MAAM;uBAEb,KAAK;qBACC;YAC7B,UAAU,EAAE,CAAC;YACb,MAAM,EAAE,EAAE;YACV,eAAe,EAAE,CAAC;YAClB,YAAY,EAAE,CAAC;YACf,eAAe,EAAE,CAAC;YAClB,iBAAiB,EAAE,EAAE;YACrB,UAAU,EAAE,CAAC;SAChB;;;8BAIiC,CAAC;;IAGnC,YAAY;QACR,IAAI,CAAC,WAAW,EAAE,CAAA;KACrB;IAEO,WAAW;QACf,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC;QACzC,IAAI,CAAC,mBAAmB,CAAC,C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KAAK,CAAC,EAClD,KAAK,EAAE;gBACH,UAAU,EAAE,qCAAqC,IAAI,CAAC,cAAc,WAAW,IAAI,CAAC,cAAc,IAAI;aACzG,GACH,CACA,EAGF,KAAK,CAAC,UAAU,KACZ,4DACKA,QAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CACvB,CACP,EAID,CAAC,KAAK,CAAC,UAAU,KACb,4DAAK,KAAK,EAAC,uBAAuB,IAC9B,yEACa,wEAAY,iBAAiB,GAAG,CAAC,GAAG,MAAM,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAU,qDACtG,oEAAa,QAAQ,EAAC,qBAAqB,EAAC,IAAI,EAAEA,QAAO,CAAC,CAAC,CAAC,oBAAoB,CAAC,GAAI,CAC7F,CACF,CACT,EAIL,4DAAK,KAAK,EAAC,SAAS,IAChB,4DAAK,KAAK,EAAC,gBAAgB,IACvB,8DACI,IAAI,EAAC,OAAO,EACZ,IAAI,EAAC,gBAAgB,EACrB,KAAK,EAAC,KAAK,EACX,OAAO,EAAE,IAAI,CAAC,cAAc,KAAK,KAAK,EACtC,QAAQ,EAAE,MAAM,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,GAChD,EACF,kFAA0B,CACxB,EACN,4DAAK,KAAK,EAAC,gBAAgB,IACvB,8DACI,IAAI,EAAC,OAAO,EACZ,IAAI,EAAC,gBAAgB,EACrB,KAAK,EAAC,SAAS,EACf,OAAO,EAAE,IAAI,CAAC,cAAc,KAAK,SAAS,EAC1C,QAAQ,EAAE,MAAM,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC,GACpD,EACF,2FAA8B,CAC5B,CACJ,EACN,4DAAK,KAAK,EAAC,UAAU,2DAEf,CACJ,EACR;KACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["i18next"],"sources":["src/components/giftback-form/subcomponents/giftback-info/giftback-info.css?tag=giftback-info","src/components/giftback-form/subcomponents/giftback-info/giftback-info.tsx"],"sourcesContent":[":host {\n --text-color: #6D6D5F\n}\n\n.giftback-container {\n display: flex;\n flex-direction: column;\n gap: 14px;\n}\n\nh3 {\n font-size: 1.2rem;\n margin-bottom: 8px;\n color: #333;\n}\n\n.container-description {\n display: flex;\n align-items: center;\n gap: 5px;\n margin: 0 0 10px 0;\n}\n\n.container-description p {\n font-size: 14px;\n font-weight: 400;\n margin: 0px;\n}\n\n\np {\n font-size: 14px;\n color: #000;\n}\n\n.value-display h2 {\n color: #6D6D5F;\n /* Verde para o valor atual */\n font-size: 1.6rem;\n margin: 16px 0;\n}\n\ninput[type='range'] {\n width: 100%;\n margin: 12px 0;\n -webkit-appearance: none;\n background: #ddd;\n height: 4px;\n border-radius: 4px;\n outline: none;\n padding: 3px 0px 3px 3px;\n}\n\n/* input[type='range']::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 16px;\n height: 16px;\n background: var(--text-color);\n border-radius: 50%;\n cursor: pointer;\n} */\n\ninput[type=\"range\"]::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 20px;\n height: 20px;\n background: rgb(109, 109, 95);\n /* Cor do botão */\n border-radius: 50%;\n cursor: pointer;\n}\n\n.options {\n margin: 0px 0;\n display: flex;\n gap: 10px;\n flex-direction: column;\n}\n\n.options label {\n display: flex;\n margin: 0px 0;\n font-size: 0.9rem;\n color: #333;\n align-items: center;\n}\n\n.options input[type='radio'] {\n margin-right: 8px;\n height: 16px;\n width: 16px;\n}\n\n.options input[type='radio'] {\n appearance: none;\n -webkit-appearance: none;\n margin-right: 8px;\n width: 16px;\n height: 16px;\n border: 2px solid #ddd;\n border-radius: 50%;\n background-color: #fff;\n cursor: pointer;\n transition: all 0.3s;\n padding: 0px;\n}\n\n.options input[type='radio']:checked {\n border-color: #000;\n background-color: #FAFAFA;\n border: 4px solid #000;\n}\n\n.info-box {\n background-color: #f9f9f9;\n border: 1px solid #e0e0e0;\n border-radius: 4px;\n padding: 8px;\n font-size: 14px;\n color: #262626;\n line-height: 20px;\n}\n\n.info-icon {\n font-size: 0.9rem;\n cursor: pointer;\n color: #888;\n}\n\nh3 {\n font-size: 1.2rem;\n margin-bottom: 8px;\n color: #333;\n}\n\n.slider-wrapper {\n position: relative;\n margin: 21px 0px 0px 0px;\n}\n\n.slider {\n width: 100%;\n -webkit-appearance: none;\n background: #ddd;\n height: 4px;\n border-radius: 2px;\n outline: none;\n}\n\n.slider::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 16px;\n height: 16px;\n background: var(--text-color);\n /* Azul para o slider */\n border-radius: 50%;\n cursor: pointer;\n}\n\n.slider-value {\n position: absolute;\n top: -30px;\n /* Posição acima do slider */\n font-size: 16px;\n font-weight: 700;\n color: var(--text-color);\n /* Verde para o texto */\n transform: translateX(-50%);\n white-space: nowrap;\n /* margin-left: 23px; */\n}\n\n.options-option {\n display: flex;\n}\n\n\n/* ########################################## */\n","import { Component, Prop, State, Watch, h } from \"@stencil/core\";\nimport { IBonus } from \"../../../../dto/validate.pin.bonus\";\n\nimport i18next from '../../../../i18n/i18n'\nimport { USED_KEY } from \"../../../../utils/keys.storage\";\nimport { defineLimit, formatDateToBr } from \"../../../../utils/utils\";\n\n@Component({\n tag: 'giftback-info',\n styleUrls: ['giftback-info.css']\n})\nexport class GiftbackInfo {\n @State() usedValue: number = 0;\n @State() selectedOption: string = 'none';\n\n @Prop() loading: boolean = false;\n @Prop() bonus: Partial<IBonus> = {\n totalBonus: 0,\n cartId: \"\",\n minimumPurchase: 0,\n bonusBalance: 0,\n calculatedValue: 0,\n firstValidityDate: \"\",\n totalValue: 0\n };\n @Prop() reserve: (amountRedeemed: number) => void;\n @Prop() cancel: () => void;\n\n @State() sliderPosition: number = 0;\n\n @Watch(\"bonus\")\n changedBonus() {\n this.updateBonus()\n }\n\n private updateBonus() {\n this.usedValue = this.bonus.bonusBalance;\n this.buildPositionSlider(0, this.bonus.totalBonus);\n }\n\n componentWillLoad() {\n this.updateBonus();\n this.selectedOption = localStorage.getItem(USED_KEY);\n }\n\n handleSliderChange(event: Event) {\n const input = event.target as HTMLInputElement;\n this.usedValue = parseFloat(input.value);\n\n // Calculando a posição do texto com base no valor do slider\n // const percentage = ((this.usedValue - parseInt(input.min)) / (parseInt(input.max) - parseInt(input.min))) * 100;\n // this.sliderPosition = percentage;\n\n this.buildPositionSlider(parseFloat(input.min), parseFloat(input.max))\n }\n\n componentDidLoad() {\n const input: any = document.getElementById(\"position_value_id\")\n\n input.value = this.bonus.bonusBalance;\n }\n\n\n private buildPositionSlider(min: number, max: number) {\n // Calculando a posição do texto com base no valor do slider\n const percentage = ((this.usedValue - min) / (max - min)) * 100;\n this.sliderPosition = percentage;\n }\n\n async handleOptionChange(option: string) {\n this.selectedOption = option;\n\n localStorage.setItem(USED_KEY, option);\n switch (this.selectedOption) {\n case 'use':\n await this.reserve(this.usedValue)\n break;\n case 'dontUse':\n await this.cancel();\n break;\n default:\n }\n }\n\n render() {\n const remainingGiftback = this.bonus.minimumPurchase - this.bonus.totalValue;\n\n const translateDescription = i18next.t(\"giftDescription\", { amount: `${this.bonus.totalBonus.toFixed(2).replace(\".\", \",\")}`, custom_name: \"Giftback\" })\n\n const limit = defineLimit(remainingGiftback)\n return (\n\n <div class=\"giftback-container\">\n <div class=\"container-description\">\n <p innerHTML={translateDescription}></p>\n <crm-tooltip identity=\"crm-role-description\" text={i18next.t(\"labelUseGiftback\", { minimumPurchase: this.bonus.minimumPurchase, expírationDate: formatDateToBr(this.bonus.firstValidityDate) })} />\n </div>\n <div class=\"slider-wrapper\">\n <div\n class=\"slider-value\"\n style={{\n left: `calc(${this.sliderPosition}% - 20px)`, // Ajuste para centralizar o texto\n\n }}\n >\n R$ {this.usedValue.toFixed(2).replace(\".\", \",\")}\n </div>\n <input\n id=\"position_value_id\"\n disabled\n type=\"range\"\n min=\"0\"\n max={this.bonus.totalBonus}\n value={this.usedValue}\n class=\"slider\"\n step=\"0.01\"\n onInput={(event) => this.handleSliderChange(event)}\n style={{\n background: `linear-gradient(to right, #6D6D5F ${this.sliderPosition}%, #ddd ${this.sliderPosition}%)`,\n }}\n />\n </div>\n\n {\n limit.isComplete && (\n <p>\n {i18next.t(\"maxAmount\")}\n </p>\n )\n }\n\n {\n !limit.isComplete && (\n <div class=\"container-description\">\n <p>\n Adicione <strong>R$ {remainingGiftback < 0 ? \"0,00\" : remainingGiftback.toFixed(2).replace(\".\", \",\")}</strong> ao carrinho para atingir o valor\n máximo! <crm-tooltip identity=\"crm-max-description\" text={i18next.t(\"labelamountPartial\")} />\n </p>\n </div>\n )\n }\n\n\n <div class=\"options\">\n <div class=\"options-option\">\n <input\n type=\"radio\"\n name=\"giftbackOption\"\n value=\"use\"\n checked={this.selectedOption === 'use'}\n onChange={() => this.handleOptionChange('use')}\n />\n <p>Usar o meu Giftback</p>\n </div>\n <div class=\"options-option\">\n <input\n type=\"radio\"\n name=\"giftbackOption\"\n value=\"dontUse\"\n checked={this.selectedOption === 'dontUse'}\n onChange={() => this.handleOptionChange('dontUse')}\n />\n <p>Não usar o meu Giftback</p>\n </div>\n </div>\n <div class=\"info-box\">\n O Giftback será aplicado na próxima etapa.\n </div>\n </div>\n );\n }\n}"],"version":3}
@@ -1,2 +1,2 @@
1
- import{p as e,b as n}from"./p-3d6152b1.js";export{s as setNonce}from"./p-3d6152b1.js";import{g as o}from"./p-e1255160.js";var a=()=>{const n=import.meta.url;const o={};if(n!==""){o.resourcesUrl=new URL(".",n).href}return e(o)};a().then((async e=>{await o();return n([["p-1e41bdcf",[[2,"crm-bonus",{userId:[2,"userid"],storeName:[8,"storename"],productsInString:[1,"products"],cartId:[8,"cartid"],showModal:[32],products:[32],customer:[32],loading:[32],message:[32],phone:[32],canCancel:[32],amountCancel:[32],sent:[32],session:[32],loading_reprocess:[32],resetBonus:[64],reprocess:[64]},null,{productsInString:["watchProducts"]}]]],["p-d0462c81",[[1,"crm-bonus-form",{storeName:[8,"storename"],cartId:[8,"cart-id"],products:[16],customer:[16],sent:[16],stepNext:[2,"step-next"],phone:[2],loadingModal:[4,"loading-modal"],saveStore:[16],cancel:[16],handleCustomerName:[16],loading:[32],step:[32],message:[32],bonus:[32],setStep:[64]}]]],["p-e8113d86",[[0,"crm-bonus-note",{cartId:[8,"cartid"],storename:[8],url:[32],config:[32],bonus:[32]}]]],["p-74206c91",[[0,"phone-cancel-input",{sendPin:[16],loading:[4],value:[1]}]]],["p-03b77c41",[[0,"phone-input",{sendPin:[16],loading:[4],value:[1]}]]],["p-5e62b863",[[1,"app-modal",{isOpen:[516,"is-open"],modalTitle:[1,"modal-title"]}]]],["p-5941788b",[[0,"pedido-finalizado",{cartId:[1,"cartid"],orderId:[2,"orderid"],metadadoString:[1,"metadado"]}]]],["p-c2ff5149",[[0,"crm-button",{txtBtn:[1,"txt-btn"],loading:[4],handleClick:[16]}]]],["p-5eddbe5e",[[1,"phone-input-mask",{initialValue:[1,"initial-value"],disabled:[4],phone:[32],message:[32],getPhone:[64]}]]],["p-53c1694c",[[1,"loading-spinner",{size:[1],color:[1]}]]],["p-7dd955cf",[[0,"phone-form",{value:[1],loading:[4],handlerSubmit:[16],config:[16]}],[1,"pin-form",{validate:[16],cancel:[16],resend:[16],sent:[16],loading:[4],phone:[1],config:[16],pin:[32],isVerified:[32],canResend:[32]}],[0,"giftback-info",{loading:[4],bonus:[16],reserve:[16],cancel:[16],usedValue:[32],selectedOption:[32],sliderPosition:[32]},null,{bonus:["changedBonus"]}],[1,"countdown-timer",{downtime:[16],counter:[32]}],[0,"crm-tooltip",{text:[1],identity:[1]}]]],["p-f25a70b6",[[0,"crm-giftback-form",{storeName:[8,"storename"],cartId:[8,"cart-id"],products:[16],customer:[16],loadProducts:[16],value:[32],loading:[32],message:[32],phone:[32],pinInfo:[32],step:[32],bonus:[32],sucess:[32],error:[32],config:[32],hasApplyBonus:[32],setStep:[64],processBonus:[64]}],[4,"loading-container",{loading:[4]}]]],["p-b7a8f915",[[1,"giftback-pin",{sent:[16],validate:[16],cancel:[16],loading:[4],pin:[32],isVerified:[32]}],[1,"giftback-progress",{loading:[4],bonus:[16],reserve:[16],cancel:[16],usedValue:[32]}],[0,"name-input",{value:[1],loading:[4],applyName:[16],cancel:[16],newValue:[32],message:[32]}],[1,"giftback-finish"]]]],e)}));
1
+ import{p as e,b as n}from"./p-3d6152b1.js";export{s as setNonce}from"./p-3d6152b1.js";import{g as o}from"./p-e1255160.js";var a=()=>{const n=import.meta.url;const o={};if(n!==""){o.resourcesUrl=new URL(".",n).href}return e(o)};a().then((async e=>{await o();return n([["p-94356545",[[2,"crm-bonus",{userId:[2,"userid"],storeName:[8,"storename"],productsInString:[1,"products"],cartId:[8,"cartid"],showModal:[32],products:[32],customer:[32],loading:[32],message:[32],phone:[32],canCancel:[32],amountCancel:[32],sent:[32],session:[32],loading_reprocess:[32],resetBonus:[64],reprocess:[64]},null,{productsInString:["watchProducts"]}]]],["p-d0462c81",[[1,"crm-bonus-form",{storeName:[8,"storename"],cartId:[8,"cart-id"],products:[16],customer:[16],sent:[16],stepNext:[2,"step-next"],phone:[2],loadingModal:[4,"loading-modal"],saveStore:[16],cancel:[16],handleCustomerName:[16],loading:[32],step:[32],message:[32],bonus:[32],setStep:[64]}]]],["p-e8113d86",[[0,"crm-bonus-note",{cartId:[8,"cartid"],storename:[8],url:[32],config:[32],bonus:[32]}]]],["p-74206c91",[[0,"phone-cancel-input",{sendPin:[16],loading:[4],value:[1]}]]],["p-03b77c41",[[0,"phone-input",{sendPin:[16],loading:[4],value:[1]}]]],["p-5e62b863",[[1,"app-modal",{isOpen:[516,"is-open"],modalTitle:[1,"modal-title"]}]]],["p-5941788b",[[0,"pedido-finalizado",{cartId:[1,"cartid"],orderId:[2,"orderid"],metadadoString:[1,"metadado"]}]]],["p-c2ff5149",[[0,"crm-button",{txtBtn:[1,"txt-btn"],loading:[4],handleClick:[16]}]]],["p-5eddbe5e",[[1,"phone-input-mask",{initialValue:[1,"initial-value"],disabled:[4],phone:[32],message:[32],getPhone:[64]}]]],["p-53c1694c",[[1,"loading-spinner",{size:[1],color:[1]}]]],["p-5f8b033a",[[0,"phone-form",{value:[1],loading:[4],handlerSubmit:[16],config:[16]}],[1,"pin-form",{validate:[16],cancel:[16],resend:[16],sent:[16],loading:[4],phone:[1],config:[16],pin:[32],isVerified:[32],canResend:[32]}],[0,"giftback-info",{loading:[4],bonus:[16],reserve:[16],cancel:[16],usedValue:[32],selectedOption:[32],sliderPosition:[32]},null,{bonus:["changedBonus"]}],[1,"countdown-timer",{downtime:[16],counter:[32]}],[0,"crm-tooltip",{text:[1],identity:[1]}]]],["p-f25a70b6",[[0,"crm-giftback-form",{storeName:[8,"storename"],cartId:[8,"cart-id"],products:[16],customer:[16],loadProducts:[16],value:[32],loading:[32],message:[32],phone:[32],pinInfo:[32],step:[32],bonus:[32],sucess:[32],error:[32],config:[32],hasApplyBonus:[32],setStep:[64],processBonus:[64]}],[4,"loading-container",{loading:[4]}]]],["p-b7a8f915",[[1,"giftback-pin",{sent:[16],validate:[16],cancel:[16],loading:[4],pin:[32],isVerified:[32]}],[1,"giftback-progress",{loading:[4],bonus:[16],reserve:[16],cancel:[16],usedValue:[32]}],[0,"name-input",{value:[1],loading:[4],applyName:[16],cancel:[16],newValue:[32],message:[32]}],[1,"giftback-finish"]]]],e)}));
2
2
  //# sourceMappingURL=crmbonus-component-wake.esm.js.map
@@ -0,0 +1,2 @@
1
+ import{r as e,h as i,H as t}from"./p-3d6152b1.js";import{i as n}from"./p-e8c19a64.js";import{U as o}from"./p-f9aeffc1.js";import{d as a,a as c}from"./p-d3bfac80.js";const r=class{constructor(i){e(this,i);this.downtime=undefined;this.counter=30}componentWillLoad(){this.intervalId=setInterval((()=>{if(this.counter>0){this.counter--}else{clearInterval(this.intervalId);this.downtime()}}),1e3)}disconnectedCallback(){clearInterval(this.intervalId)}render(){return i("label",{key:"6313656b73bec34e3e4e5099c2bd7633e025588e"},this.counter,"s")}};const s="data:image/svg+xml;base64,PD94bWwgdm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uNzUgMTJDMi43NSAxNy4xMDg2IDYuODkxMzcgMjEuMjUgMTIgMjEuMjVDMTcuMTA4NiAyMS4yNSAyMS4yNSAxNy4xMDg2IDIxLjI1IDEyQzIxLjI1IDYuODkxMzcgMTcuMTA4NiAyLjc1IDEyIDIuNzVaIiBmaWxsPSIjMUMyNzRDIi8+DQo8L3N2Zz4=";const d=".crm-tooltip-container {\n display: flex;\n\n & img {\n width: 16px;\n margin-left: 3px;\n position: relative;\n }\n}\n\n.crm-tooltip {\n position: relative;\n display: inline-block;\n}\n\n.crm-tooltip .tooltiptext {\n visibility: hidden;\n background-color: black;\n color: #fff;\n text-align: center;\n padding: 8px 12px;\n border-radius: 0px;\n position: absolute;\n z-index: 1;\n min-width: 271px;\n top: 100%;\n left: 50%;\n margin-left: -238px;\n}\n\n@container (max-width: 410px) {\n .crm-tooltip .tooltiptext {\n margin-left: -14px;\n }\n\n .crm-tooltip #crm-role-description {\n margin-left: -151px;\n }\n}\n\n@container (max-width: 250px) {\n .crm-tooltip .tooltiptext {\n margin-left: -201px;\n }\n}\n\n.crm-tooltip:hover .tooltiptext {\n visibility: visible;\n}";const p=d;const l=class{constructor(i){e(this,i);this.text=undefined;this.identity=undefined}render(){return i("div",{key:"8d7de09a39f9f3412c5ee51e884a9900f65ad261",class:"crm-tooltip-container crm-tooltip"},i("img",{key:"7605616f8135d1009a4c8f6a272cedfd66f10b88",src:s}),i("span",{key:"5b7b384d39f5c6b4d733ad129bd99ba8670bde8e",id:this.identity,class:"tooltiptext"},this.text))}};l.style=p;const f=":host{--text-color:#6D6D5F}.giftback-container{display:flex;flex-direction:column;gap:14px}h3{font-size:1.2rem;margin-bottom:8px;color:#333}.container-description{display:flex;align-items:center;gap:5px;margin:0 0 10px 0}.container-description p{font-size:14px;font-weight:400;margin:0px}p{font-size:14px;color:#000}.value-display h2{color:#6D6D5F;font-size:1.6rem;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;font-size:0.9rem;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;font-size:14px;color:#262626;line-height:20px}.info-icon{font-size:0.9rem;cursor:pointer;color:#888}h3{font-size:1.2rem;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-size:16px;font-weight:700;color:var(--text-color);transform:translateX(-50%);white-space:nowrap;}.options-option{display:flex}";const b=f;const h=class{constructor(i){e(this,i);this.usedValue=0;this.selectedOption="none";this.loading=false;this.bonus={totalBonus:0,cartId:"",minimumPurchase:0,bonusBalance:0,calculatedValue:0,firstValidityDate:"",totalValue:0};this.reserve=undefined;this.cancel=undefined;this.sliderPosition=0}changedBonus(){this.updateBonus()}updateBonus(){this.usedValue=this.bonus.bonusBalance;this.buildPositionSlider(0,this.bonus.totalBonus)}componentWillLoad(){this.updateBonus();this.selectedOption=localStorage.getItem(o)}handleSliderChange(e){const i=e.target;this.usedValue=parseFloat(i.value);this.buildPositionSlider(parseFloat(i.min),parseFloat(i.max))}componentDidLoad(){const e=document.getElementById("position_value_id");e.value=this.bonus.bonusBalance}buildPositionSlider(e,i){const t=(this.usedValue-e)/(i-e)*100;this.sliderPosition=t}async handleOptionChange(e){this.selectedOption=e;localStorage.setItem(o,e);switch(this.selectedOption){case"use":await this.reserve(this.usedValue);break;case"dontUse":await this.cancel();break}}render(){const e=this.bonus.minimumPurchase-this.bonus.totalValue;const t=n.t("giftDescription",{amount:`${this.bonus.totalBonus.toFixed(2).replace(".",",")}`,custom_name:"Giftback"});const o=a(e);return i("div",{key:"06bd5fda8f1b1dff75d27133fb27a222ea79475d",class:"giftback-container"},i("div",{key:"e770facaaf3c938dda000885ef42fe30f4b88eaf",class:"container-description"},i("p",{key:"7d7aa390bb8f2c7a1973b38f0071522e7943af47",innerHTML:t}),i("crm-tooltip",{key:"f209c195a0fcd7c4bec0b6227549ba139c41f637",identity:"crm-role-description",text:n.t("labelUseGiftback",{minimumPurchase:this.bonus.minimumPurchase,expírationDate:c(this.bonus.firstValidityDate)})})),i("div",{key:"6160a64dd8a3eea3b1f554349c2d6d0fc7113641",class:"slider-wrapper"},i("div",{key:"e3ca74f1b47613bd0b05339bd2856a942172cb0f",class:"slider-value",style:{left:`calc(${this.sliderPosition}% - 20px)`}},"R$ ",this.usedValue.toFixed(2).replace(".",",")),i("input",{key:"e748d506d25076173a1da4ae02a4869969228e16",id:"position_value_id",disabled:true,type:"range",min:"0",max:this.bonus.totalBonus,value:this.usedValue,class:"slider",step:"0.01",onInput:e=>this.handleSliderChange(e),style:{background:`linear-gradient(to right, #6D6D5F ${this.sliderPosition}%, #ddd ${this.sliderPosition}%)`}})),o.isComplete&&i("p",{key:"49b1525e9e04c7fc08db78a9c999540fdd0df6ea"},n.t("maxAmount")),!o.isComplete&&i("div",{key:"771cdc242af285229b6d23fd9738627f2e419385",class:"container-description"},i("p",{key:"43dca214826cb8dc2a292400c5b02f40e7ce620a"},"Adicione ",i("strong",{key:"3ffbe7777e5e3be5283012de568eddfe3ff1b23d"},"R$ ",e<0?"0,00":e.toFixed(2).replace(".",","))," ao carrinho para atingir o valor máximo! ",i("crm-tooltip",{key:"71bae07de4470c5f9234e74a632713803cda2d7e",identity:"crm-max-description",text:n.t("labelamountPartial")}))),i("div",{key:"23c5cbcea13c5cad47384815b6277fced7529f84",class:"options"},i("div",{key:"5212788f1c1c258324ba83057c60fd0ecb76e29c",class:"options-option"},i("input",{key:"14bf5fceb36b5b9db660e5e067e1ed9c89d31b81",type:"radio",name:"giftbackOption",value:"use",checked:this.selectedOption==="use",onChange:()=>this.handleOptionChange("use")}),i("p",{key:"487dc829efdca6754c967fcc85c58cb2cb7c63e1"},"Usar o meu Giftback")),i("div",{key:"d90651744aa5d3904b61be7d4adc1ec49e3c6676",class:"options-option"},i("input",{key:"4ed8e68cfd86b871668e9de19d4c5420487f4e52",type:"radio",name:"giftbackOption",value:"dontUse",checked:this.selectedOption==="dontUse",onChange:()=>this.handleOptionChange("dontUse")}),i("p",{key:"344fbf40dadc0ef4e3a870e5251a1beb3b5ffd27"},"Não usar o meu Giftback"))),i("div",{key:"3b9a91dad6803aac48b96100c2bbded009677aa1",class:"info-box"},"O Giftback será aplicado na próxima etapa."))}static get watchers(){return{bonus:["changedBonus"]}}};h.style=b;const x="*{margin:0;padding:0;box-sizing:border-box}:host{--crmfont-sizebodymd:14px;--crmline-heightbodymd:20px;--crmletter-spacingtitle-md:0px}.container-message{font-family:Roboto;font-size:var(--crmfont-sizebodymd);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:14px;color:var(--crm-btn);font-weight:100}.crm-title{font-weight:700;line-height:20px;color:#262626;font-size:16px}.crm-message-info{color:#619013;font-weight:500;font-size:12px}.crm-message-error{color:#E11D48;font-weight:500;font-size:12px}";const g=x;const m=class{constructor(i){e(this,i);this.value=undefined;this.loading=undefined;this.handlerSubmit=undefined;this.config=undefined}async handlePhone(){const e=await this.phoneInputMask.getPhone();await this.handlerSubmit(e)}render(){var e;return i(t,{key:"d41578c99f54f76083ad62b2d3e53b969f51c323",class:"crm-phone-form"},i("label",{key:"2c615b13f79cfed14b8c14b713216b5d53e05769",class:"crm-subtitle"},"Digite o seu celular para verificar se há desconto disponível nessa compra:"),i("phone-input-mask",{key:"05383570a3518ef1ae3d0085f8411662eb719486",initialValue:this.value,ref:e=>this.phoneInputMask=e}),i("crm-button",{key:"90289afc0783e5f78a8091c7f53c657721f13641",txtBtn:((e=this.config)===null||e===void 0?void 0:e.btnApplyBonusLabel)||"Avançar",loading:this.loading,handleClick:()=>this.handlePhone()}))}};m.style=g;const u=":host{display:block;font-family:Arial, sans-serif}.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;font-size:14px;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;font-size:20px;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;font-size:19px;cursor:pointer}.crm-description{font-size:14px;width:100%;display:flex;gap:9px}.crm-description a{font-weight:bold;cursor:pointer;text-decoration:underline}.crm-description div{display:flex;gap:5px}";const y=u;const k="*{margin:0;padding:0;box-sizing:border-box}:host{--crmfont-sizebodymd:14px;--crmline-heightbodymd:20px;--crmletter-spacingtitle-md:0px}.container-message{font-family:Roboto;font-size:var(--crmfont-sizebodymd);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:14px;color:var(--crm-btn);font-weight:100}.crm-title{font-weight:700;line-height:20px;color:#262626;font-size:16px}.crm-message-info{color:#619013;font-weight:500;font-size:12px}.crm-message-error{color:#E11D48;font-weight:500;font-size:12px}";const M=k;const I=class{constructor(i){e(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(e,i){const t=e.target;const n=t.value.slice(0,1);this.pin[i]=n;if(n&&i<this.pin.length-1){const e=t.nextElementSibling;e===null||e===void 0?void 0:e.focus()}this.pin=[...this.pin]}validatePin(){this.validate(this.pin.join(""))}verifyPin(){const e=this.pin.join("");if(e==="9999"){this.isVerified=true}}handleTimeout(){this.canResend=true}async handleResend(){await this.resend();this.canResend=false;this.pin=["","","",""]}render(){var e;return i("div",{key:"4feca5ebbdcba078f526bcbbb1e8f59cd9f69d2f",class:"crm-phone-form"},i("label",{key:"51653ca43a050fd67dfba6a8525bfe3791076cff",class:"crm-subtitle"},n.t("pin-sutitle")," ",i("strong",{key:"8a47e532dc3bd566d23057e675261b50c97442c8"},"+55 ",this.phone)),i("div",{key:"eb367b999bb7c491e9cc792b8ea279bff71de435",class:"pin-container"},this.pin.map(((e,t)=>i("input",{type:"text",maxLength:1,value:this.pin[t],onInput:e=>this.handleInput(e,t)})))),i("slot",{key:"377bc33633df2c82ab1970c88e20bdbd9181d525"}),i("p",{key:"96769dc2bac4842ed9e259735381f25451bbe77d",class:"crm-description"}," Não recebeu?",!this.canResend&&i("label",{key:"9c3f25a357ae41aef6c16b11598a1cbd9ea32982"}," Reenviar em ",i("countdown-timer",{key:"a7a98f65cdcf0a88df4ce2f98d8694b0cf5c974c",downtime:()=>this.handleTimeout()})," "),this.canResend&&i("div",{key:"178c9b536d81f49d10240c55edfbe7dbb02076bb"},i("a",{key:"8b07796bd9a3349cdf994ccd963fe4333466eb22",onClick:()=>this.handleResend()},"Reenviar"),i("a",{key:"59289faea47104ec3ebc9818a43dbd205fc0a2bf",onClick:()=>this.cancel()},"Trocar número"))),i("crm-button",{key:"feecbd5c1681ae1adb8bd9ca8ba01b96252f6c5c",txtBtn:((e=this.config)===null||e===void 0?void 0:e.btnApplyBonusLabel)||"Avançar",loading:this.loading,handleClick:()=>this.validatePin()}))}};I.style=y+M;export{r as countdown_timer,l as crm_tooltip,h as giftback_info,m as phone_form,I as pin_form};
2
+ //# sourceMappingURL=p-5f8b033a.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["CountdownTimer","componentWillLoad","this","intervalId","setInterval","counter","clearInterval","downtime","disconnectedCallback","render","h","key","infoCircleSvgrepoComSvg","crmTooltipCss","CrmTooltipStyle0","Tooltip","class","src","info","id","identity","text","giftbackInfoCss","GiftbackInfoStyle0","GiftbackInfo","totalBonus","cartId","minimumPurchase","bonusBalance","calculatedValue","firstValidityDate","totalValue","changedBonus","updateBonus","usedValue","bonus","buildPositionSlider","selectedOption","localStorage","getItem","USED_KEY","handleSliderChange","event","input","target","parseFloat","value","min","max","componentDidLoad","document","getElementById","percentage","sliderPosition","handleOptionChange","option","setItem","reserve","cancel","remainingGiftback","translateDescription","i18next","t","amount","toFixed","replace","custom_name","limit","defineLimit","innerHTML","formatDateToBr","style","left","disabled","type","step","onInput","background","isComplete","name","checked","onChange","giftbackFormCss","PhoneFormStyle0","PhoneForm","handlePhone","phone","phoneInputMask","getPhone","handlerSubmit","Host","initialValue","ref","txtBtn","_a","config","btnApplyBonusLabel","loading","handleClick","pinFormCss","PinFormStyle0","PinFormStyle1","GiftbackPin","canResend","handleInput","index","slice","pin","length","nextInput","nextElementSibling","focus","validatePin","validate","join","verifyPin","pinCode","isVerified","handleTimeout","handleResend","resend","map","_","maxLength","onClick"],"sources":["src/components/countdown-timer/countdown-timer.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/giftback-form/giftback-form.css?tag=phone-form","src/components/giftback-form/subcomponents/phone-form/phone-form.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, h, Prop, State } from '@stencil/core';\n\n@Component({\n tag: 'countdown-timer',\n shadow: true,\n})\nexport class CountdownTimer {\n\n @Prop() downtime: () => void;\n\n @State() counter: number = 30;\n private intervalId: NodeJS.Timer;\n\n componentWillLoad() {\n this.intervalId = setInterval(() => {\n if (this.counter > 0) {\n this.counter--;\n } else {\n clearInterval(this.intervalId);\n\n this.downtime()\n }\n }, 1000); // Intervalo de 1 segundo\n }\n\n disconnectedCallback() {\n clearInterval(this.intervalId);\n }\n\n render() {\n return (\n <label>{this.counter}s</label>\n );\n }\n}\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 {\n display: flex;\n\n & img {\n width: 16px;\n margin-left: 3px;\n position: relative;\n }\n}\n\n.crm-tooltip {\n position: relative;\n display: inline-block;\n}\n\n.crm-tooltip .tooltiptext {\n visibility: hidden;\n background-color: black;\n color: #fff;\n text-align: center;\n padding: 8px 12px;\n border-radius: 0px;\n position: absolute;\n z-index: 1;\n min-width: 271px;\n top: 100%;\n left: 50%;\n margin-left: -238px;\n}\n\n@container (max-width: 410px) {\n .crm-tooltip .tooltiptext {\n margin-left: -14px;\n }\n\n .crm-tooltip #crm-role-description {\n margin-left: -151px;\n }\n}\n\n@container (max-width: 250px) {\n .crm-tooltip .tooltiptext {\n margin-left: -201px;\n }\n}\n\n.crm-tooltip:hover .tooltiptext {\n visibility: visible;\n}","import { Component, h, Prop } from \"@stencil/core\";\nimport info from '../../assets/svg/info-circle-svgrepo-com.svg';\n\n\n@Component({\n tag: 'crm-tooltip',\n styleUrl: 'crm-tooltip.css'\n})\nexport class Tooltip {\n\n @Prop() text: string;\n @Prop() identity: string;\n\n render() {\n return (\n <div class=\"crm-tooltip-container crm-tooltip\">\n <img src={info} />\n <span id={this.identity} class=\"tooltiptext\">{this.text}</span>\n </div>\n );\n }\n}",":host {\n --text-color: #6D6D5F\n}\n\n.giftback-container {\n display: flex;\n flex-direction: column;\n gap: 14px;\n}\n\nh3 {\n font-size: 1.2rem;\n margin-bottom: 8px;\n color: #333;\n}\n\n.container-description {\n display: flex;\n align-items: center;\n gap: 5px;\n margin: 0 0 10px 0;\n}\n\n.container-description p {\n font-size: 14px;\n font-weight: 400;\n margin: 0px;\n}\n\n\np {\n font-size: 14px;\n color: #000;\n}\n\n.value-display h2 {\n color: #6D6D5F;\n /* Verde para o valor atual */\n font-size: 1.6rem;\n margin: 16px 0;\n}\n\ninput[type='range'] {\n width: 100%;\n margin: 12px 0;\n -webkit-appearance: none;\n background: #ddd;\n height: 4px;\n border-radius: 4px;\n outline: none;\n padding: 3px 0px 3px 3px;\n}\n\n/* input[type='range']::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 16px;\n height: 16px;\n background: var(--text-color);\n border-radius: 50%;\n cursor: pointer;\n} */\n\ninput[type=\"range\"]::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 20px;\n height: 20px;\n background: rgb(109, 109, 95);\n /* Cor do botão */\n border-radius: 50%;\n cursor: pointer;\n}\n\n.options {\n margin: 0px 0;\n display: flex;\n gap: 10px;\n flex-direction: column;\n}\n\n.options label {\n display: flex;\n margin: 0px 0;\n font-size: 0.9rem;\n color: #333;\n align-items: center;\n}\n\n.options input[type='radio'] {\n margin-right: 8px;\n height: 16px;\n width: 16px;\n}\n\n.options input[type='radio'] {\n appearance: none;\n -webkit-appearance: none;\n margin-right: 8px;\n width: 16px;\n height: 16px;\n border: 2px solid #ddd;\n border-radius: 50%;\n background-color: #fff;\n cursor: pointer;\n transition: all 0.3s;\n padding: 0px;\n}\n\n.options input[type='radio']:checked {\n border-color: #000;\n background-color: #FAFAFA;\n border: 4px solid #000;\n}\n\n.info-box {\n background-color: #f9f9f9;\n border: 1px solid #e0e0e0;\n border-radius: 4px;\n padding: 8px;\n font-size: 14px;\n color: #262626;\n line-height: 20px;\n}\n\n.info-icon {\n font-size: 0.9rem;\n cursor: pointer;\n color: #888;\n}\n\nh3 {\n font-size: 1.2rem;\n margin-bottom: 8px;\n color: #333;\n}\n\n.slider-wrapper {\n position: relative;\n margin: 21px 0px 0px 0px;\n}\n\n.slider {\n width: 100%;\n -webkit-appearance: none;\n background: #ddd;\n height: 4px;\n border-radius: 2px;\n outline: none;\n}\n\n.slider::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 16px;\n height: 16px;\n background: var(--text-color);\n /* Azul para o slider */\n border-radius: 50%;\n cursor: pointer;\n}\n\n.slider-value {\n position: absolute;\n top: -30px;\n /* Posição acima do slider */\n font-size: 16px;\n font-weight: 700;\n color: var(--text-color);\n /* Verde para o texto */\n transform: translateX(-50%);\n white-space: nowrap;\n /* margin-left: 23px; */\n}\n\n.options-option {\n display: flex;\n}\n\n\n/* ########################################## */\n","import { Component, Prop, State, Watch, h } from \"@stencil/core\";\nimport { IBonus } from \"../../../../dto/validate.pin.bonus\";\n\nimport i18next from '../../../../i18n/i18n'\nimport { USED_KEY } from \"../../../../utils/keys.storage\";\nimport { defineLimit, formatDateToBr } from \"../../../../utils/utils\";\n\n@Component({\n tag: 'giftback-info',\n styleUrls: ['giftback-info.css']\n})\nexport class GiftbackInfo {\n @State() usedValue: number = 0;\n @State() selectedOption: string = 'none';\n\n @Prop() loading: boolean = false;\n @Prop() bonus: Partial<IBonus> = {\n totalBonus: 0,\n cartId: \"\",\n minimumPurchase: 0,\n bonusBalance: 0,\n calculatedValue: 0,\n firstValidityDate: \"\",\n totalValue: 0\n };\n @Prop() reserve: (amountRedeemed: number) => void;\n @Prop() cancel: () => void;\n\n @State() sliderPosition: number = 0;\n\n @Watch(\"bonus\")\n changedBonus() {\n this.updateBonus()\n }\n\n private updateBonus() {\n this.usedValue = this.bonus.bonusBalance;\n this.buildPositionSlider(0, this.bonus.totalBonus);\n }\n\n componentWillLoad() {\n this.updateBonus();\n this.selectedOption = localStorage.getItem(USED_KEY);\n }\n\n handleSliderChange(event: Event) {\n const input = event.target as HTMLInputElement;\n this.usedValue = parseFloat(input.value);\n\n // Calculando a posição do texto com base no valor do slider\n // const percentage = ((this.usedValue - parseInt(input.min)) / (parseInt(input.max) - parseInt(input.min))) * 100;\n // this.sliderPosition = percentage;\n\n this.buildPositionSlider(parseFloat(input.min), parseFloat(input.max))\n }\n\n componentDidLoad() {\n const input: any = document.getElementById(\"position_value_id\")\n\n input.value = this.bonus.bonusBalance;\n }\n\n\n private buildPositionSlider(min: number, max: number) {\n // Calculando a posição do texto com base no valor do slider\n const percentage = ((this.usedValue - min) / (max - min)) * 100;\n this.sliderPosition = percentage;\n }\n\n async handleOptionChange(option: string) {\n this.selectedOption = option;\n\n localStorage.setItem(USED_KEY, option);\n switch (this.selectedOption) {\n case 'use':\n await this.reserve(this.usedValue)\n break;\n case 'dontUse':\n await this.cancel();\n break;\n default:\n }\n }\n\n render() {\n const remainingGiftback = this.bonus.minimumPurchase - this.bonus.totalValue;\n\n const translateDescription = i18next.t(\"giftDescription\", { amount: `${this.bonus.totalBonus.toFixed(2).replace(\".\", \",\")}`, custom_name: \"Giftback\" })\n\n const limit = defineLimit(remainingGiftback)\n return (\n\n <div class=\"giftback-container\">\n <div class=\"container-description\">\n <p innerHTML={translateDescription}></p>\n <crm-tooltip identity=\"crm-role-description\" text={i18next.t(\"labelUseGiftback\", { minimumPurchase: this.bonus.minimumPurchase, expírationDate: formatDateToBr(this.bonus.firstValidityDate) })} />\n </div>\n <div class=\"slider-wrapper\">\n <div\n class=\"slider-value\"\n style={{\n left: `calc(${this.sliderPosition}% - 20px)`, // Ajuste para centralizar o texto\n\n }}\n >\n R$ {this.usedValue.toFixed(2).replace(\".\", \",\")}\n </div>\n <input\n id=\"position_value_id\"\n disabled\n type=\"range\"\n min=\"0\"\n max={this.bonus.totalBonus}\n value={this.usedValue}\n class=\"slider\"\n step=\"0.01\"\n onInput={(event) => this.handleSliderChange(event)}\n style={{\n background: `linear-gradient(to right, #6D6D5F ${this.sliderPosition}%, #ddd ${this.sliderPosition}%)`,\n }}\n />\n </div>\n\n {\n limit.isComplete && (\n <p>\n {i18next.t(\"maxAmount\")}\n </p>\n )\n }\n\n {\n !limit.isComplete && (\n <div class=\"container-description\">\n <p>\n Adicione <strong>R$ {remainingGiftback < 0 ? \"0,00\" : remainingGiftback.toFixed(2).replace(\".\", \",\")}</strong> ao carrinho para atingir o valor\n máximo! <crm-tooltip identity=\"crm-max-description\" text={i18next.t(\"labelamountPartial\")} />\n </p>\n </div>\n )\n }\n\n\n <div class=\"options\">\n <div class=\"options-option\">\n <input\n type=\"radio\"\n name=\"giftbackOption\"\n value=\"use\"\n checked={this.selectedOption === 'use'}\n onChange={() => this.handleOptionChange('use')}\n />\n <p>Usar o meu Giftback</p>\n </div>\n <div class=\"options-option\">\n <input\n type=\"radio\"\n name=\"giftbackOption\"\n value=\"dontUse\"\n checked={this.selectedOption === 'dontUse'}\n onChange={() => this.handleOptionChange('dontUse')}\n />\n <p>Não usar o meu Giftback</p>\n </div>\n </div>\n <div class=\"info-box\">\n O Giftback será aplicado na próxima etapa.\n </div>\n </div>\n );\n }\n}","* {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n}\n\n:host {\n --crmfont-sizebodymd: 14px;\n --crmline-heightbodymd: 20px;\n --crmletter-spacingtitle-md: 0px\n}\n\n.container-message {\n font-family: Roboto;\n font-size: var(--crmfont-sizebodymd);\n font-weight: 400;\n line-height: var(--crmline-heightbodymd);\n letter-spacing: var(--crmletter-spacingtitle-md);\n text-align: left;\n text-underline-position: from-font;\n text-decoration-skip-ink: none;\n}\n\n.crm-container-form {\n display: flex;\n flex-direction: column;\n justify-content: space-around;\n height: auto;\n padding: 20px 24px 20px 24px;\n border: 1px solid #CCCC;\n writing-mode: horizontal-tb;\n gap: 16px;\n border-top: 1px solid #ccc !important;\n border-bottom: 1px solid #ccc !important;\n}\n\n/* .fbits-responsive-carrinho-desconto {\n overflow: hidden;\n border: 1px solid #ccc;\n border-top: 0;\n border-bottom: 0;\n} */\n\n.crm-phone-form {\n display: flex;\n flex-direction: column;\n height: 100%;\n /* justify-content: space-around; */\n gap: 16px;\n}\n\n.crm-subtitle {\n font-size: 14px;\n color: var(--crm-btn);\n font-weight: 100;\n}\n\n.crm-title {\n font-weight: 700;\n line-height: 20px;\n color: #262626;\n font-size: 16px;\n}\n\n.crm-message-info {\n color: #619013;\n font-weight: 500;\n font-size: 12px;\n}\n\n.crm-message-error {\n color: #E11D48;\n font-weight: 500;\n font-size: 12px;\n}","import { Component, Host, Prop, h } from \"@stencil/core\";\nimport { IInfoStore } from \"../../../../helpers/info.config.helper\";\n\n@Component({\n tag: 'phone-form',\n styleUrl: '../../giftback-form.css'\n})\nexport class PhoneForm {\n\n private phoneInputMask: HTMLPhoneInputMaskElement;\n\n @Prop() value: string;\n @Prop() loading: boolean;\n @Prop() handlerSubmit: (phone: string) => void;\n\n @Prop() config: IInfoStore;\n\n\n async handlePhone() {\n\n const phone = await this.phoneInputMask.getPhone()\n\n await this.handlerSubmit(phone);\n }\n\n\n render() {\n return (\n <Host class=\"crm-phone-form\">\n <label class=\"crm-subtitle\" >Digite o seu celular para verificar se há desconto disponível nessa compra:</label>\n <phone-input-mask initialValue={this.value} ref={ref => this.phoneInputMask = ref} />\n\n <crm-button txtBtn={this.config?.btnApplyBonusLabel || \"Avançar\"} loading={this.loading} handleClick={() => this.handlePhone() } />\n </Host>\n )\n }\n}",":host {\n display: block;\n font-family: Arial, sans-serif;\n}\n\n.form-container-pin {\n display: flex;\n flex-direction: column;\n align-items: center;\n}\n\n.pin-container {\n display: flex;\n /* margin: 26px 0; */\n justify-content: start;\n gap: 10px;\n}\n\n.pin-container input {\n width: 100%;\n height: 48px;\n font-size: 14px;\n text-align: center;\n border: 1px solid #ccc;\n border-radius: 5px;\n}\n\nbutton {\n padding: 10px 20px;\n background-color: #ddd;\n border: none;\n border-radius: 5px;\n cursor: pointer;\n}\n\n\n.success {\n color: green;\n margin-top: 10px;\n}\n\n.button {\n top: 50%;\n background-color: #6c6c7e;\n color: #fff;\n border: none;\n border-radius: 10px;\n padding: 15px;\n min-height: 30px;\n min-width: 120px;\n font-size: 20px;\n cursor: pointer;\n}\n\n.button-cancel {\n top: 50%;\n background-color: #ffffff;\n color: #1e1c1c;\n border: 1px solid gray;\n border-radius: 10px;\n padding: 10px;\n min-height: 30px;\n min-width: 120px;\n font-size: 19px;\n cursor: pointer;\n}\n\n.crm-description {\n font-size: 14px;\n width: 100%;\n display: flex;\n gap: 9px;\n}\n\n.crm-description a {\n font-weight: bold;\n cursor: pointer;\n text-decoration: underline;\n}\n\n.crm-description div {\n display: flex;\n gap: 5px;\n}","* {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n}\n\n:host {\n --crmfont-sizebodymd: 14px;\n --crmline-heightbodymd: 20px;\n --crmletter-spacingtitle-md: 0px\n}\n\n.container-message {\n font-family: Roboto;\n font-size: var(--crmfont-sizebodymd);\n font-weight: 400;\n line-height: var(--crmline-heightbodymd);\n letter-spacing: var(--crmletter-spacingtitle-md);\n text-align: left;\n text-underline-position: from-font;\n text-decoration-skip-ink: none;\n}\n\n.crm-container-form {\n display: flex;\n flex-direction: column;\n justify-content: space-around;\n height: auto;\n padding: 20px 24px 20px 24px;\n border: 1px solid #CCCC;\n writing-mode: horizontal-tb;\n gap: 16px;\n border-top: 1px solid #ccc !important;\n border-bottom: 1px solid #ccc !important;\n}\n\n/* .fbits-responsive-carrinho-desconto {\n overflow: hidden;\n border: 1px solid #ccc;\n border-top: 0;\n border-bottom: 0;\n} */\n\n.crm-phone-form {\n display: flex;\n flex-direction: column;\n height: 100%;\n /* justify-content: space-around; */\n gap: 16px;\n}\n\n.crm-subtitle {\n font-size: 14px;\n color: var(--crm-btn);\n font-weight: 100;\n}\n\n.crm-title {\n font-weight: 700;\n line-height: 20px;\n color: #262626;\n font-size: 16px;\n}\n\n.crm-message-info {\n color: #619013;\n font-weight: 500;\n font-size: 12px;\n}\n\n.crm-message-error {\n color: #E11D48;\n font-weight: 500;\n font-size: 12px;\n}","import { Component, h, Prop, State } from '@stencil/core';\nimport { IPinSent } from '../../../../dto/pin.sent';\nimport i18next from '../../../../i18n/i18n'\nimport { IInfoStore } from '../../../../helpers/info.config.helper';\n\n@Component({\n tag: 'pin-form',\n styleUrls: ['pin-form.css', '../../giftback-form.css'],\n shadow: true,\n})\nexport class GiftbackPin {\n\n @Prop() validate: (pin: string) => void;\n @Prop() cancel: () => void;\n @Prop() resend: () => void;\n\n @Prop() sent: IPinSent;\n @Prop() loading: boolean = false;\n @Prop() phone: string;\n @Prop() config: IInfoStore;\n\n @State() pin: string[] = ['', '', '', ''];\n @State() isVerified: boolean = false;\n @State() canResend: boolean = false;\n\n componentWillLoad() {\n this.canResend = false;\n }\n\n handleInput(event: Event, index: number) {\n const input = event.target as HTMLInputElement;\n const value = input.value.slice(0, 1); // Limitar a um único dígito\n this.pin[index] = value;\n\n // Focar no próximo campo, se possível\n if (value && index < this.pin.length - 1) {\n const nextInput = input.nextElementSibling as HTMLInputElement;\n nextInput?.focus();\n }\n\n this.pin = [...this.pin];\n }\n\n validatePin() {\n this.validate(this.pin.join(\"\"))\n }\n\n verifyPin() {\n const pinCode = this.pin.join('');\n if (pinCode === '9999') {\n this.isVerified = true;\n }\n }\n\n handleTimeout() {\n this.canResend = true;\n }\n\n async handleResend() {\n await this.resend();\n\n this.canResend = false;\n this.pin = ['', '', '', '']\n }\n\n render() {\n return (\n <div class=\"crm-phone-form\">\n <label class=\"crm-subtitle\" >{i18next.t('pin-sutitle')} <strong>+55 {this.phone}</strong></label>\n <div class=\"pin-container\">\n {this.pin.map((_, index) => (\n <input\n type=\"text\"\n maxLength={1}\n value={this.pin[index]}\n onInput={(event) => this.handleInput(event, index)}\n />\n ))}\n </div>\n\n <slot></slot>\n\n <p class=\"crm-description\"> Não recebeu?\n {\n !this.canResend && <label> Reenviar em <countdown-timer downtime={() => this.handleTimeout()} /> </label>\n }\n {\n this.canResend && (\n <div >\n <a onClick={() => this.handleResend()}>Reenviar</a>\n <a onClick={() => this.cancel()}>Trocar número</a>\n </div>\n )\n }\n </p>\n <crm-button txtBtn={this.config?.btnApplyBonusLabel || \"Avançar\"} loading={this.loading} handleClick={() => this.validatePin()} />\n </div >\n );\n }\n}\n"],"mappings":"2KAMaA,EAAc,M,8DAII,E,CAG3B,iBAAAC,GACIC,KAAKC,WAAaC,aAAY,KAC1B,GAAIF,KAAKG,QAAU,EAAG,CAClBH,KAAKG,S,KACF,CACHC,cAAcJ,KAAKC,YAEnBD,KAAKK,U,IAEV,I,CAGP,oBAAAC,GACIF,cAAcJ,KAAKC,W,CAGvB,MAAAM,GACI,OACIC,EAAA,SAAAC,IAAA,4CAAQT,KAAKG,QAAO,I,GC/BhC,MAAMO,EAA0B,yvCCAhC,MAAMC,EAAgB,03BACtB,MAAAC,EAAeD,E,MCOFE,EAAO,M,qEAKhB,MAAAN,GACI,OACIC,EAAA,OAAAC,IAAA,2CAAKK,MAAM,qCACPN,EAAA,OAAAC,IAAA,2CAAKM,IAAKC,IACVR,EAAA,QAAAC,IAAA,2CAAMQ,GAAIjB,KAAKkB,SAAUJ,MAAM,eAAed,KAAKmB,M,aCjBnE,MAAMC,EAAkB,m7DACxB,MAAAC,EAAeD,E,MCUFE,EAAY,M,wCACQ,E,oBACK,O,aAEP,M,WACM,CAC7BC,WAAY,EACZC,OAAQ,GACRC,gBAAiB,EACjBC,aAAc,EACdC,gBAAiB,EACjBC,kBAAmB,GACnBC,WAAY,G,iEAKkB,C,CAGlC,YAAAC,GACI9B,KAAK+B,a,CAGD,WAAAA,GACJ/B,KAAKgC,UAAYhC,KAAKiC,MAAMP,aAC5B1B,KAAKkC,oBAAoB,EAAGlC,KAAKiC,MAAMV,W,CAG3C,iBAAAxB,GACIC,KAAK+B,cACL/B,KAAKmC,eAAiBC,aAAaC,QAAQC,E,CAG/C,kBAAAC,CAAmBC,GACf,MAAMC,EAAQD,EAAME,OACpB1C,KAAKgC,UAAYW,WAAWF,EAAMG,OAMlC5C,KAAKkC,oBAAoBS,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,EAAA,SAAAC,IAAA,2CAAOK,MAAM,gBAAiB6C,EAAQC,EAAE,eAAc,IAAEpD,EAAA,UAAAC,IAAA,mDAAaT,KAAKoF,QAC1E5E,EAAA,OAAAC,IAAA,2CAAKK,MAAM,iBACNd,KAAKyG,IAAIc,KAAI,CAACC,EAAGjB,IACd/F,EAAA,SACIgE,KAAK,OACLiD,UAAW,EACX7E,MAAO5C,KAAKyG,IAAIF,GAChB7B,QAAUlC,GAAUxC,KAAKsG,YAAY9D,EAAO+D,QAKxD/F,EAAA,QAAAC,IAAA,6CAEAD,EAAA,KAAAC,IAAA,2CAAGK,MAAM,mBAAiB,iBAEjBd,KAAKqG,WAAa7F,EAAA,SAAAC,IAAA,4DAAoBD,EAAA,mBAAAC,IAAA,2CAAiBJ,SAAU,IAAML,KAAKoH,kBAAmB,KAGhGpH,KAAKqG,WACD7F,EAAA,OAAAC,IAAA,4CACID,EAAA,KAAAC,IAAA,2CAAGiH,QAAS,IAAM1H,KAAKqH,gBAAc,YACrC7G,EAAA,KAAAC,IAAA,2CAAGiH,QAAS,IAAM1H,KAAKwD,UAAQ,mBAK/ChD,EAAA,cAAAC,IAAA,2CAAYkF,SAAQC,EAAA5F,KAAK6F,UAAM,MAAAD,SAAA,SAAAA,EAAEE,qBAAsB,UAAWC,QAAS/F,KAAK+F,QAASC,YAAa,IAAMhG,KAAK8G,gB","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ import{r as t,h as s}from"./p-3d6152b1.js";import{C as i}from"./p-9c859043.js";import{S as e}from"./p-24bdfca4.js";import{i as o}from"./p-e8c19a64.js";import"./p-f9aeffc1.js";var n;(function(t){t["P"]="Promocao"})(n||(n={}));function a(t=[]){const s=[];for(const i of t){let t=c(i.Ajustes);s.push({sku:i.SKU,value:i.PrecoPor*i.Quantidade,productVariantId:i.ProdutoVarianteId.toString(),quantity:i.Quantidade,discount:t*-1})}return s}function c(t=[]){let s=0;for(const i of t){if(i.Tipo===n.P){s+=i.Valor}}return s}const r=".container-button.sc-crm-bonus{cursor:pointer;padding:5px 5px 5px 14px}.section-crm.sc-crm-bonus{border:1px solid #dbd4d4;text-align:-webkit-center;margin-bottom:20px}.section-cart-crm.sc-crm-bonus{margin-top:10px}.section-cart-crm.sc-crm-bonus p.sc-crm-bonus{padding:0;margin:0px 0px 0px 15px}.button.sc-crm-bonus{top:50%;background-color:#6c6c7e;color:#fff;border:none;padding:15px;min-height:30px;min-width:120px;font-size:20px;cursor:pointer;margin-left:10px;height:70px}.form-container.sc-crm-bonus{width:97%;display:flex;justify-content:space-around}.btn.sc-crm-bonus{display:inline-block;padding:6px 12px;margin-bottom:0;font-size:14px;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.sc-crm-bonus .btnCrm.sc-crm-bonus{background:#00162e;border-color:#00162e;width:30%;color:#fff}.message-alert.sc-crm-bonus{font-family:sans-serif;color:#df4d4d;margin-top:5px}";const h=r;const d=class{constructor(s){t(this,s);this.crmBonusService=i.getInstance();this.showModal=false;this.userId=undefined;this.storeName=undefined;this.productsInString=undefined;this.cartId=undefined;this.products=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}async resetBonus(){console.log("[START 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(e.STEP_PHONE)}finally{this.loading=false}}async reprocess(t){this.loading_reprocess=true;console.log("[reprocess]");try{console.log("[update products list]");this.productsInString=JSON.stringify(t);await this.handleLoad();await this.resetBonus()}catch(t){console.debug("[watchProducts]",t.message)}finally{this.loading_reprocess=false}}async watchProducts(t){try{console.log("[update products list]");this.productsInString=t;await this.handleLoad();await this.resetBonus()}catch(t){console.debug("[watchProducts]",t.message)}}async componentWillLoad(){o.changeLanguage(o.language);await this.loadSession();await this.loadConfigStore();await this.handleLoad()}async loadConfigStore(){await this.crmBonusService.getCustomization(this.storeName)}async handleLoad(){try{if(this.userId){this.customer=await this.crmBonusService.getCustomer(this.userId,this.storeName);console.log("customer",this.customer)}const t=localStorage.getItem(this.cartId);if(t){this.canCancel=true;this.amountCancel=t}}catch(t){console.log("info customer")}this.buildAndGetProducts()}async loadSession(){this.session=await this.crmBonusService.getToken(this.storeName);setTimeout((()=>{this.loadSession()}),15e5)}async buildAndGetProducts(){const t=`bc-products:${this.cartId}`;localStorage.setItem(t,this.productsInString);const s=JSON.parse(this.productsInString);const i=JSON.parse(localStorage.getItem(t));const e=[];for(const t of s){const[s]=i.filter((s=>s.ProdutoVarianteId==t.ProdutoVarianteId));if(s){e.push(Object.assign(Object.assign({},t),{PrecoPor:s.PrecoPor,Quantidade:s.Quantidade,Ajustes:s.Ajustes}))}else{e.push(t)}}this.products=e}async sendPin(t){var s,i;this.loading=true;this.message="";try{const s=t.replace(/\D/g,"");this.phone=Number(s);this.sent=await this.crmBonusService.sendPin(this.phone,this.customer.name,this.storeName);await this.crmBonusRef.setStep(e.STEP_PIN);this.showModal=true}catch(t){this.message=(i=(s=t===null||t===void 0?void 0:t.response)===null||s===void 0?void 0:s.data)===null||i===void 0?void 0:i.message}finally{this.loading=false}}async sendPinName(t){var s,i;this.loading=true;this.message="";try{this.customer.name=t;this.sent=await this.crmBonusService.sendPin(this.phone,this.customer.name,this.storeName);await this.crmBonusRef.setStep(e.STEP_PIN);this.showModal=true}catch(t){this.message=(i=(s=t===null||t===void 0?void 0:t.response)===null||s===void 0?void 0:s.data)===null||i===void 0?void 0:i.message}finally{this.loading=false}}buildProducts(){return a(this.products)}handleCloseModal(){this.showModal=false}save(t){localStorage.setItem(this.cartId,t.toString());this.canCancel=true;this.amountCancel=t.toString()}async cancel(){this.message="";this.loading=true;try{await this.crmBonusService.cancel(this.cartId);this.canCancel=false;localStorage.removeItem(this.cartId)}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 s=t.replace(/\D/g,"");this.phone=Number(s);if(this.customer.name){return this.sendPin(t)}await this.crmBonusRef.setStep(e.STEP_NAME);this.showModal=true}render(){return s("loading-container",{key:"2344629dcd6addbeca290195a76ff901c02ef143",loading:this.loading_reprocess},s("crm-giftback-form",{key:"dbbd58488ceb615ee9505e95c14374f359bacaff",style:{position:"relative"},ref:t=>this.crmBonusRef=t,storeName:this.storeName,products:this.buildProducts(),cartId:this.cartId,customer:this.customer,loadProducts:()=>this.buildProducts()}))}static get assetsDirs(){return["assets"]}static get watchers(){return{productsInString:["watchProducts"]}}};d.style=h;export{d as crm_bonus};
2
+ //# sourceMappingURL=p-94356545.entry.js.map