crmbonus-component-wake 2.0.68 → 2.0.70
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/crm-bonus.cjs.entry.js +2 -1
- package/dist/cjs/crm-bonus.cjs.entry.js.map +1 -1
- package/dist/cjs/crm-giftback-form.cjs.entry.js +16 -7
- package/dist/cjs/crm-giftback-form.cjs.entry.js.map +1 -1
- package/dist/collection/components/crm-bonus/crm-bonus.js +2 -1
- package/dist/collection/components/crm-bonus/crm-bonus.js.map +1 -1
- package/dist/collection/components/giftback-form/giftback-form.js +16 -7
- package/dist/collection/components/giftback-form/giftback-form.js.map +1 -1
- package/dist/components/crm-bonus.js +3 -2
- package/dist/components/crm-bonus.js.map +1 -1
- package/dist/components/crm-giftback-form.js +1 -1
- package/dist/components/{p-186149f6.js → p-c9c64c39.js} +17 -8
- package/dist/components/p-c9c64c39.js.map +1 -0
- package/dist/crmbonus-component-wake/crmbonus-component-wake.esm.js +1 -1
- package/dist/crmbonus-component-wake/p-4cbbddf4.entry.js +2 -0
- package/dist/crmbonus-component-wake/p-4cbbddf4.entry.js.map +1 -0
- package/dist/crmbonus-component-wake/p-8465c068.entry.js +2 -0
- package/dist/crmbonus-component-wake/p-8465c068.entry.js.map +1 -0
- package/dist/esm/crm-bonus.entry.js +2 -1
- package/dist/esm/crm-bonus.entry.js.map +1 -1
- package/dist/esm/crm-giftback-form.entry.js +16 -7
- package/dist/esm/crm-giftback-form.entry.js.map +1 -1
- package/package.json +1 -1
- package/dist/components/p-186149f6.js.map +0 -1
- package/dist/crmbonus-component-wake/p-187d03f5.entry.js +0 -2
- package/dist/crmbonus-component-wake/p-187d03f5.entry.js.map +0 -1
- package/dist/crmbonus-component-wake/p-a793a384.entry.js +0 -2
- package/dist/crmbonus-component-wake/p-a793a384.entry.js.map +0 -1
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["giftbackFormCss","CrmGiftbackFormStyle0","CrmBonus","this","crmBonusService","CrmBonusService","getInstance","StepFormEnum","STEP_PHONE","setStep","step","processBonus","sucess","validateBonus","handleSendPin","phone","message","sendPin","componentWillLoad","error","config","getInfoCustomization","storeName","handleApply","bonus","localStorage","getItem","getKeyReserveByCartId","cartId","JSON","parse","STEP_RESERVE","convertStringToNumber","_phone","replace","Number","loading","pinInfo","STEP_PIN","_b","_a","response","data","changePhone","pin","payload","cellphone","toString","storeId","userId","checkoutId","checkoutProducts","products","name","validatePinBonus","hasBonus","STEP_NO_BONUS","_error","includes","handleCancel","cancel","save","reserveApply","amount","reserve","setItem","stringify","removeItem","redeemedBonus","ticket","grossValue","totalValue","render","h","key","class","giftbackTitle","value","customer","handlerSubmit","resend","validate","amountRedeemed","i18next","t","storename"],"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}\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 { 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 { 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\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\n @Method()\n async processBonus() {\n this.sucess = \"\";\n await this.validateBonus(\"2018\")\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 componentWillLoad() {\n this.sucess = \"\";\n this.error = \"\"\n this.config = getInfoCustomization(this.storeName);\n\n this.handleApply()\n\n }\n\n handleApply() {\n const bonus = localStorage.getItem(getKeyReserveByCartId(this.cartId));\n\n if (bonus) {\n this.bonus = JSON.parse(bonus);\n this.step = StepFormEnum.STEP_RESERVE;\n }\n\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.storeName);\n\n this.step = StepFormEnum.STEP_PIN;\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 if (this.sucess) {\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.phone.toString(),\n storeId: this.pinInfo.storeId.toString(),\n userId: this.pinInfo.userId.toString(),\n checkoutId: this.cartId,\n checkoutProducts: this.products,\n name: null,\n storeName: this.storeName\n }\n\n try {\n this.bonus = await this.crmBonusService.validatePinBonus(payload);\n\n if (!this.bonus.hasBonus) {\n this.loading = false;\n this.step = StepFormEnum.STEP_NO_BONUS;\n return\n }\n\n this.sucess = \"Código validado com sucesso!\";\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 // localStorage.removeItem(this.cartId);\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 localStorage.setItem(getKeyReserveByCartId(this.cartId), JSON.stringify(this.bonus));\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 <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={(amountRedeemed: number) => this.reserveApply(amountRedeemed)}\n />\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}"],"mappings":"kMAAA,MAAMA,E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