crmbonus-component-wake 2.0.117 → 2.0.119
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{cart.helper-63c75a64.js → cart.helper-09e4daf4.js} +2 -2
- package/dist/cjs/{cart.helper-63c75a64.js.map → cart.helper-09e4daf4.js.map} +1 -1
- package/dist/cjs/crm-bonus-form.cjs.entry.js +1 -1
- package/dist/cjs/crm-bonus-note.cjs.entry.js +2 -2
- package/dist/cjs/crm-bonus.cjs.entry.js +4 -4
- package/dist/cjs/crm-bonus.cjs.entry.js.map +1 -1
- package/dist/cjs/crm-giftback-form_2.cjs.entry.js +1 -1
- package/dist/cjs/{crmbonus.service-566fc43f.js → crmbonus.service-8dff0944.js} +2 -2
- package/dist/cjs/{crmbonus.service-566fc43f.js.map → crmbonus.service-8dff0944.js.map} +1 -1
- package/dist/cjs/pedido-finalizado.cjs.entry.js +2 -2
- package/dist/collection/components/crm-bonus/crm-bonus.js +2 -2
- package/dist/collection/components/crm-bonus/crm-bonus.js.map +1 -1
- package/dist/components/crm-bonus-form.js +1 -1
- package/dist/components/crm-bonus-note.js +1 -1
- package/dist/components/crm-bonus.js +5 -5
- package/dist/components/crm-bonus.js.map +1 -1
- package/dist/components/crm-giftback-form.js +1 -1
- package/dist/components/{p-a61d6a12.js → p-06a20bea.js} +2 -2
- package/dist/components/{p-a61d6a12.js.map → p-06a20bea.js.map} +1 -1
- package/dist/components/{p-c0ce1213.js → p-22dc683b.js} +2 -2
- package/dist/components/{p-c0ce1213.js.map → p-22dc683b.js.map} +1 -1
- package/dist/components/{p-e9895f08.js → p-2f3e90b8.js} +2 -2
- package/dist/components/{p-e9895f08.js.map → p-2f3e90b8.js.map} +1 -1
- package/dist/components/pedido-finalizado.js +2 -2
- package/dist/crmbonus-component-wake/crmbonus-component-wake.esm.js +1 -1
- package/dist/crmbonus-component-wake/{p-a61d6a12.js → p-06a20bea.js} +2 -2
- package/dist/crmbonus-component-wake/{p-e9895f08.js → p-2f3e90b8.js} +2 -2
- package/dist/crmbonus-component-wake/{p-e9895f08.js.map → p-2f3e90b8.js.map} +1 -1
- package/dist/crmbonus-component-wake/p-4a36599f.entry.js +2 -0
- package/dist/crmbonus-component-wake/p-4a36599f.entry.js.map +1 -0
- package/dist/crmbonus-component-wake/{p-432e371d.entry.js → p-55eef7f5.entry.js} +2 -2
- package/dist/crmbonus-component-wake/{p-a63f44b6.entry.js → p-6f63c678.entry.js} +2 -2
- package/dist/crmbonus-component-wake/{p-7e6797e3.entry.js → p-da78db17.entry.js} +2 -2
- package/dist/crmbonus-component-wake/{p-571f0bb1.entry.js → p-fd697405.entry.js} +2 -2
- package/dist/env.js +1 -1
- package/dist/env.js.map +1 -1
- package/dist/esm/{cart.helper-69d64e28.js → cart.helper-035a4633.js} +2 -2
- package/dist/esm/{cart.helper-69d64e28.js.map → cart.helper-035a4633.js.map} +1 -1
- package/dist/esm/crm-bonus-form.entry.js +1 -1
- package/dist/esm/crm-bonus-note.entry.js +2 -2
- package/dist/esm/crm-bonus.entry.js +4 -4
- package/dist/esm/crm-bonus.entry.js.map +1 -1
- package/dist/esm/crm-giftback-form_2.entry.js +1 -1
- package/dist/esm/{crmbonus.service-ad8702ce.js → crmbonus.service-d99af814.js} +2 -2
- package/dist/esm/{crmbonus.service-ad8702ce.js.map → crmbonus.service-d99af814.js.map} +1 -1
- package/dist/esm/pedido-finalizado.entry.js +2 -2
- package/dist/types/home/darlison/Projects/Bycoders/crmbonus/crmbonus-component/.stencil/env.d.ts +1 -1
- package/package.json +1 -1
- package/dist/crmbonus-component-wake/p-7df4432d.entry.js +0 -2
- package/dist/crmbonus-component-wake/p-7df4432d.entry.js.map +0 -1
- /package/dist/crmbonus-component-wake/{p-a61d6a12.js.map → p-06a20bea.js.map} +0 -0
- /package/dist/crmbonus-component-wake/{p-432e371d.entry.js.map → p-55eef7f5.entry.js.map} +0 -0
- /package/dist/crmbonus-component-wake/{p-a63f44b6.entry.js.map → p-6f63c678.entry.js.map} +0 -0
- /package/dist/crmbonus-component-wake/{p-7e6797e3.entry.js.map → p-da78db17.entry.js.map} +0 -0
- /package/dist/crmbonus-component-wake/{p-571f0bb1.entry.js.map → p-fd697405.entry.js.map} +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
import { r as registerInstance, h } from './index-e8724c8f.js';
|
2
|
-
import { C as CrmBonusService } from './crmbonus.service-
|
3
|
-
import { C as CartWake, g as getCart } from './cart.helper-
|
2
|
+
import { C as CrmBonusService } from './crmbonus.service-d99af814.js';
|
3
|
+
import { C as CartWake, g as getCart } from './cart.helper-035a4633.js';
|
4
4
|
import './keys.storage-8c76fcd7.js';
|
5
5
|
|
6
6
|
const Pedido = class {
|
package/dist/types/home/darlison/Projects/Bycoders/crmbonus/crmbonus-component/.stencil/env.d.ts
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
export declare const CRM_BONUS_API_URL = "
|
1
|
+
export declare const CRM_BONUS_API_URL = "https://wake-middleware.crmbonus.com/api";
|
2
2
|
export declare const CHECKOUT_CART_WAKE = "http://localhost:3001";
|
package/package.json
CHANGED
@@ -1,2 +0,0 @@
|
|
1
|
-
import{r as t,h as s}from"./p-3d6152b1.js";import{C as i}from"./p-e9895f08.js";import{S as o}from"./p-7cfea8fe.js";import{i as e}from"./p-e8c19a64.js";import{C as n,g as a}from"./p-a61d6a12.js";import"./p-f9aeffc1.js";var r;(function(t){t["P"]="Promocao"})(r||(r={}));function c(t=[]){const s=[];for(const i of t){let t=h(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 h(t=[]){let s=0;for(const i of t){if(i.Tipo===r.P){s+=i.Valor}}return s}const l=".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 d=l;const u=class{constructor(s){t(this,s);this.crmBonusService=i.getInstance();this.cart=undefined;this.showModal=false;this.cartWake=undefined;this.customer={birthDate:"",document:"",name:"",phone:""};this.loading=false;this.message=undefined;this.phone=undefined;this.canCancel=false;this.amountCancel=undefined;this.sent=undefined;this.session=undefined;this.loading_reprocess=false}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(o.STEP_PHONE)}finally{this.loading=false}}async reprocess(){this.loading_reprocess=true;try{this.cartWake=this.cart?new n(JSON.parse(this.cart)):await a();console.log("cart",this.cartWake);await this.resetBonus()}catch(t){console.debug("[watchProducts]",t.message)}finally{this.loading_reprocess=false}}async componentWillLoad(){e.changeLanguage(e.language);await this.handleLoad();await this.loadSession();await this.loadConfigStore()}async loadConfigStore(){await this.crmBonusService.getCustomization(this.cartWake.store.name)}async handleLoad(){try{this.cartWake=this.cart?new n(this.cart):await a();console.log("cart",this.cartWake);if(this.cartWake.user.id){this.customer=await this.crmBonusService.getCustomer(this.cartWake.user.id,this.cartWake.store.name);console.log("customer",this.customer)}const t=localStorage.getItem(this.cartWake.id);if(t){this.canCancel=true;this.amountCancel=t}await this.buildAndGetProducts(this.cartWake.products)}catch(t){console.log("info customer")}}async loadSession(){console.log("this.storeName",this.cartWake.store.name);this.session=await this.crmBonusService.getToken(this.cartWake.store.name);setTimeout((()=>{this.loadSession()}),15e5)}async buildAndGetProducts(t){const s=`bc-products:${this.cartWake.id}`;const i=JSON.stringify(t);localStorage.setItem(s,i);const o=JSON.parse(localStorage.getItem(s));const e=[];for(const s of t){const[t]=o.filter((t=>t.ProdutoVarianteId==s.ProdutoVarianteId));const[i={Valor:0}]=t.Ajustes.filter((t=>t.Tipo==="Formula"));if(t){e.push(Object.assign(Object.assign({},s),{PrecoPor:t.PrecoPor+i.Valor*-1,Quantidade:t.Quantidade,Ajustes:t.Ajustes}))}else{e.push(s)}}this.cartWake.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.cartWake.store.name);await this.crmBonusRef.setStep(o.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.cartWake.store.name);await this.crmBonusRef.setStep(o.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 c(this.cartWake.products)}handleCloseModal(){this.showModal=false}save(t){localStorage.setItem(this.cartWake.id,t.toString());this.canCancel=true;this.amountCancel=t.toString()}async cancel(){this.message="";this.loading=true;try{await this.crmBonusService.cancel(this.cartWake.id);this.canCancel=false;localStorage.removeItem(this.cartWake.id)}catch(t){this.message="Não consegui cancelar o bônus, tente novamente!"}finally{this.loading=false}}async handleSendPin(t){this.message="";if(!t){this.message="Informe seu telefone";return}this.customer.phone=t;const s=t.replace(/\D/g,"");this.phone=Number(s);if(this.customer.name){return this.sendPin(t)}await this.crmBonusRef.setStep(o.STEP_NAME);this.showModal=true}render(){return s("loading-container",{key:"aaf89a1bdcfec70d7175049061bc728194f1dc82",loading:this.loading_reprocess},s("crm-giftback-form",{key:"96322e1d19ad37846af67000055fd2741cfb0020",style:{position:"relative"},ref:t=>this.crmBonusRef=t,storeName:this.cartWake.store.name,products:this.buildProducts(),cartId:this.cartWake.id,customer:this.customer,loadProducts:()=>this.buildProducts()}))}static get assetsDirs(){return["assets"]}};u.style=d;export{u as crm_bonus};
|
2
|
-
//# sourceMappingURL=p-7df4432d.entry.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["AjustesTipoEnum","buildProductsByWake","productsWake","products","pw","discounts","getDiscount","Ajustes","push","sku","SKU","value","PrecoPor","Quantidade","productVariantId","ProdutoVarianteId","toString","quantity","discount","ajustes","Tipo","P","Valor","crmBonusCss","CrmBonusStyle0","CrmBonus","this","crmBonusService","CrmBonusService","getInstance","birthDate","document","name","phone","resetBonus","console","log","crmBonusRef","processBonus","buildProducts","err","loading","setStep","StepFormEnum","STEP_PHONE","reprocess","loading_reprocess","cartWake","cart","CartWake","JSON","parse","getCart","debug","message","componentWillLoad","i18next","changeLanguage","language","handleLoad","loadSession","loadConfigStore","getCustomization","store","user","id","customer","getCustomer","amount","localStorage","getItem","canCancel","amountCancel","buildAndGetProducts","error","session","getToken","setTimeout","key","productsString","stringify","setItem","products_in_cache","product_cart","pro","filter","p","ajuste","aj","Object","assign","sendPin","_phone","replace","Number","sent","STEP_PIN","showModal","_b","_a","response","data","sendPinName","customerName","handleCloseModal","save","cancel","removeItem","handleSendPin","STEP_NAME","render","h","style","position","ref","storeName","cartId","loadProducts"],"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 IUser {\n id: number;\n}\n\nexport interface IStore {\n name: string;\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, 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';\nimport { getCart } from '../../helpers/cart.helper';\nimport { CartWake } from '../../objectvalues/cart.wake';\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 @Prop() cart;\n\n @State() showModal: boolean = false;\n \n @State() cartWake: CartWake;\n \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 \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() {\n this.loading_reprocess = true\n\n try {\n\n this.cartWake = this.cart ? new CartWake(JSON.parse(this.cart)) : await getCart();\n\n console.log('cart', this.cartWake)\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.handleLoad();\n\n await this.loadSession();\n await this.loadConfigStore()\n }\n\n async loadConfigStore() {\n await this.crmBonusService.getCustomization(this.cartWake.store.name);\n }\n\n async handleLoad() {\n try {\n\n this.cartWake = this.cart ? new CartWake(this.cart) : await getCart();\n\n console.log('cart', this.cartWake)\n\n if (this.cartWake.user.id) {\n this.customer = await this.crmBonusService.getCustomer(this.cartWake.user.id, this.cartWake.store.name);\n console.log('customer', this.customer);\n }\n\n const amount = localStorage.getItem(this.cartWake.id);\n\n if (amount) {\n this.canCancel = true;\n this.amountCancel = amount;\n }\n\n await this.buildAndGetProducts(this.cartWake.products);\n } catch (error) {\n console.log('info customer')\n }\n }\n\n async loadSession() {\n console.log('this.storeName', this.cartWake.store.name)\n this.session = await this.crmBonusService.getToken(this.cartWake.store.name);\n\n setTimeout(() => {\n this.loadSession()\n }, 1500000)\n\n }\n\n async buildAndGetProducts(productsWake: IProductWake[]) {\n\n const key = `bc-products:${this.cartWake.id}`;\n\n const productsString = JSON.stringify(productsWake)\n\n localStorage.setItem(key, productsString);\n\n const products_in_cache = JSON.parse(localStorage.getItem(key));\n\n const products: Array<IProductWake> = []\n\n for (const product_cart of productsWake) {\n\n const [pro] = products_in_cache.filter(p => p.ProdutoVarianteId == product_cart.ProdutoVarianteId)\n\n const [ajuste = { Valor: 0 }] = pro.Ajustes.filter(aj => aj.Tipo === \"Formula\")\n\n if (pro) {\n products.push({\n ...product_cart,\n PrecoPor: pro.PrecoPor + (ajuste.Valor * -1),\n Quantidade: pro.Quantidade,\n Ajustes: pro.Ajustes\n })\n } else {\n products.push(product_cart)\n }\n\n }\n\n this.cartWake.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.cartWake.store.name);;\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.cartWake.store.name);\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.cartWake.products);\n }\n\n handleCloseModal() {\n this.showModal = false;\n }\n\n save(amount: number) {\n localStorage.setItem(this.cartWake.id, 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.cartWake.id);\n this.canCancel = false;\n\n localStorage.removeItem(this.cartWake.id);\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.cartWake.store.name}\n products={this.buildProducts()}\n cartId={this.cartWake.id}\n customer={this.customer}\n loadProducts={() => this.buildProducts()}\n\n />\n </loading-container>\n )\n }\n}\n"],"mappings":"0NAQA,IAAYA,GAAZ,SAAYA,GACRA,EAAA,eACH,EAFD,CAAYA,MAAe,K,SCNXC,EAAoBC,EAAoC,IAEpE,MAAMC,EAA4B,GAElC,IAAM,MAAMC,KAAMF,EAAe,CAC7B,IAAIG,EAAYC,EAAYF,EAAGG,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CAAKrC,GACHC,aAAaY,QAAQvD,KAAKqB,SAASkB,GAAIG,EAAOpD,YAC9CU,KAAK6C,UAAY,KACjB7C,KAAK8C,aAAeJ,EAAOpD,U,CAG7B,YAAM0F,GACJhF,KAAK4B,QAAU,GACf5B,KAAKe,QAAU,KACf,UACQf,KAAKC,gBAAgB+E,OAAOhF,KAAKqB,SAASkB,IAChDvC,KAAK6C,UAAY,MAEjBF,aAAasC,WAAWjF,KAAKqB,SAASkB,G,CACtC,MAAOS,GACPhD,KAAK4B,QAAU,iD,SAEf5B,KAAKe,QAAU,K,EAInB,mBAAMmE,CAAc3E,GAClBP,KAAK4B,QAAU,GACf,IAAKrB,EAAO,CACVP,KAAK4B,QAAU,uBACf,M,CAGF5B,KAAKwC,SAASjC,MAAQA,EACtB,MAAM2D,EAAS3D,EAAM4D,QAAQ,MAAO,IACpCnE,KAAKO,MAAQ6D,OAAOF,GAEpB,GAAIlE,KAAKwC,SAASlC,KAAM,CACtB,OAAON,KAAKiE,QAAQ1D,E,OAGhBP,KAAKW,YAAYK,QAAQC,EAAakE,WAC5CnF,KAAKuE,UAAY,I,CAGnB,MAAAa,GAEE,OACEC,EAAA,qBAAAjC,IAAA,2CAAmBrC,QAASf,KAAKoB,mBAC/BiE,EAAA,qBAAAjC,IAAA,2CACEkC,MAAO,CAAEC,SAAU,YACnBC,IAAKA,GAAOxF,KAAKW,YAAc6E,EAC/BC,UAAWzF,KAAKqB,SAASgB,MAAM/B,KAC/B7B,SAAUuB,KAAKa,gBACf6E,OAAQ1F,KAAKqB,SAASkB,GACtBC,SAAUxC,KAAKwC,SACfmD,aAAc,IAAM3F,KAAKa,kB","ignoreList":[]}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|