crmbonus-component-wake 1.0.43 → 1.0.45
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/app-modal_4.cjs.entry.js +4 -6
- package/dist/cjs/app-modal_4.cjs.entry.js.map +1 -1
- package/dist/cjs/crm-bonus.cjs.entry.js +10 -5
- package/dist/cjs/crm-bonus.cjs.entry.js.map +1 -1
- package/dist/cjs/crmbonus-component-wake.cjs.js +1 -1
- package/dist/cjs/{crmbonus.service-ad521d7d.js → crmbonus.service-d804521b.js} +52 -15
- package/dist/cjs/crmbonus.service-d804521b.js.map +1 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/pedido-finalizado.cjs.entry.js +3 -6
- package/dist/cjs/pedido-finalizado.cjs.entry.js.map +1 -1
- package/dist/collection/components/crm-bonus/crm-bonus.js +11 -5
- package/dist/collection/components/crm-bonus/crm-bonus.js.map +1 -1
- package/dist/collection/components/crm-bonus-form/crm-bonus-form.js +3 -5
- package/dist/collection/components/crm-bonus-form/crm-bonus-form.js.map +1 -1
- package/dist/collection/components/pedido/pedido.js +2 -5
- package/dist/collection/components/pedido/pedido.js.map +1 -1
- package/dist/collection/services/crmbonus.service.js +50 -13
- package/dist/collection/services/crmbonus.service.js.map +1 -1
- package/dist/components/crm-bonus-form.js +1 -1
- package/dist/components/crm-bonus.js +13 -7
- package/dist/components/crm-bonus.js.map +1 -1
- package/dist/components/{p-aeaad64e.js → p-96d4b7f8.js} +52 -15
- package/dist/components/p-96d4b7f8.js.map +1 -0
- package/dist/components/{p-0ebfe0d3.js → p-c3888e1e.js} +5 -7
- package/dist/components/p-c3888e1e.js.map +1 -0
- package/dist/components/pedido-finalizado.js +3 -6
- package/dist/components/pedido-finalizado.js.map +1 -1
- package/dist/crmbonus-component-wake/crmbonus-component-wake.esm.js +1 -1
- package/dist/crmbonus-component-wake/crmbonus-component-wake.esm.js.map +1 -1
- package/dist/crmbonus-component-wake/p-64a22e59.entry.js +2 -0
- package/dist/crmbonus-component-wake/p-64a22e59.entry.js.map +1 -0
- package/dist/crmbonus-component-wake/p-75ba6bac.entry.js +2 -0
- package/dist/crmbonus-component-wake/p-75ba6bac.entry.js.map +1 -0
- package/dist/crmbonus-component-wake/p-9686d220.entry.js +2 -0
- package/dist/crmbonus-component-wake/p-9686d220.entry.js.map +1 -0
- package/dist/crmbonus-component-wake/p-96d4b7f8.js +2 -0
- package/dist/crmbonus-component-wake/p-96d4b7f8.js.map +1 -0
- package/dist/env.js +1 -1
- package/dist/env.js.map +1 -1
- package/dist/esm/app-modal_4.entry.js +4 -6
- package/dist/esm/app-modal_4.entry.js.map +1 -1
- package/dist/esm/crm-bonus.entry.js +10 -5
- package/dist/esm/crm-bonus.entry.js.map +1 -1
- package/dist/esm/crmbonus-component-wake.js +1 -1
- package/dist/esm/{crmbonus.service-dda2d96b.js → crmbonus.service-06ce5e98.js} +52 -15
- package/dist/esm/crmbonus.service-06ce5e98.js.map +1 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/pedido-finalizado.entry.js +3 -6
- package/dist/esm/pedido-finalizado.entry.js.map +1 -1
- package/dist/types/components/crm-bonus/crm-bonus.d.ts +2 -0
- package/dist/types/home/darlison/Projects/crmbonus/app/crmbonus-component/.stencil/env.d.ts +1 -1
- package/dist/types/services/crmbonus.service.d.ts +6 -2
- package/package.json +1 -1
- package/dist/cjs/crmbonus.service-ad521d7d.js.map +0 -1
- package/dist/components/p-0ebfe0d3.js.map +0 -1
- package/dist/components/p-aeaad64e.js.map +0 -1
- package/dist/crmbonus-component-wake/p-04db24fc.entry.js +0 -2
- package/dist/crmbonus-component-wake/p-04db24fc.entry.js.map +0 -1
- package/dist/crmbonus-component-wake/p-60249052.entry.js +0 -2
- package/dist/crmbonus-component-wake/p-60249052.entry.js.map +0 -1
- package/dist/crmbonus-component-wake/p-6de2e9c3.entry.js +0 -2
- package/dist/crmbonus-component-wake/p-6de2e9c3.entry.js.map +0 -1
- package/dist/crmbonus-component-wake/p-aeaad64e.js +0 -2
- package/dist/crmbonus-component-wake/p-aeaad64e.js.map +0 -1
- package/dist/esm/crmbonus.service-dda2d96b.js.map +0 -1
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
5
|
const index = require('./index-52d8a075.js');
|
6
|
-
const crmbonus_service = require('./crmbonus.service-
|
6
|
+
const crmbonus_service = require('./crmbonus.service-d804521b.js');
|
7
7
|
const index$1 = require('./index-861e0cbe.js');
|
8
8
|
|
9
9
|
const appModalCss = ".modal-backdrop{position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0, 0, 0, 0.5);display:none;justify-content:center;align-items:center;z-index:1000}.modal-backdrop.visible{display:flex}.modal{background:white;border-radius:8px;padding:1rem;max-width:500px;width:90%;box-shadow:0 2px 10px rgba(0, 0, 0, 0.3)}.modal-header{display:flex;justify-content:space-between;align-items:center;border-bottom:1px solid #ddd;margin-bottom:1rem}.close-button{background:none;border:none;font-size:1.5rem;cursor:pointer}.modal-body{}";
|
@@ -31,7 +31,7 @@ const CrmBonusFormStyle0 = crmBonusFormCss;
|
|
31
31
|
const CrmBonusForm = class {
|
32
32
|
constructor(hostRef) {
|
33
33
|
index.registerInstance(this, hostRef);
|
34
|
-
this.crmBonusService =
|
34
|
+
this.crmBonusService = crmbonus_service.CrmBonusService.getInstance();
|
35
35
|
this.storeName = undefined;
|
36
36
|
this.cartId = undefined;
|
37
37
|
this.products = undefined;
|
@@ -71,8 +71,7 @@ const CrmBonusForm = class {
|
|
71
71
|
storeName: this.storeName
|
72
72
|
};
|
73
73
|
try {
|
74
|
-
this.bonus = await this.crmBonusService.validatePinBonus(payload
|
75
|
-
console.log('[this.bonus]', this.bonus);
|
74
|
+
this.bonus = await this.crmBonusService.validatePinBonus(payload);
|
76
75
|
this.step = index$1.StepFormEnum.STEP_RESERVE;
|
77
76
|
}
|
78
77
|
catch (error) {
|
@@ -81,7 +80,6 @@ const CrmBonusForm = class {
|
|
81
80
|
finally {
|
82
81
|
this.loading = false;
|
83
82
|
}
|
84
|
-
console.log('payload', payload);
|
85
83
|
}
|
86
84
|
async reserveApply(amount) {
|
87
85
|
this.loading = true;
|
@@ -114,7 +112,7 @@ const CrmBonusForm = class {
|
|
114
112
|
this.cancel();
|
115
113
|
}
|
116
114
|
render() {
|
117
|
-
return (index.h(index.Host, { key: '
|
115
|
+
return (index.h(index.Host, { key: '6e71114a1e7b254f5f3a1fa907c96bb2c2f36171' }, this.step == index$1.StepFormEnum.STEP_NAME && index.h("name-input", { key: 'd44a3757015d8af2062f98d2cc0271dd2d9e79af', loading: this.loadingModal, value: this.customer.name, applyName: (name) => this.handleCustomerName(name) }), this.step === index$1.StepFormEnum.STEP_PIN && index.h("giftback-pin", { key: '74e74078485e3f75d053f54300acb5e99c84533a', cancel: () => this.handleCancel(), sent: this.sent, validate: (data) => this.validateBonus(data), loading: this.loading }), this.step === index$1.StepFormEnum.STEP_RESERVE && index.h("giftback-progress", { key: '2b9c3cd91e20af1efca4590b6f94e694b2f4c03f', loading: this.loading, cancel: () => this.handleCancel(), bonus: this.bonus, reserve: (amountRedeemed) => this.reserveApply(amountRedeemed) }), this.step === index$1.StepFormEnum.STEP_APPLY && index.h("giftback-finish", { key: 'f66d8c5da16a1a48a1b1be8b48a61a62676fa753' }), index.h("p", { key: 'c68f26529c21ce047819449f0414538f5e9771f8', class: "message-error" }, this.message)));
|
118
116
|
}
|
119
117
|
};
|
120
118
|
CrmBonusForm.style = CrmBonusFormStyle0;
|
@@ -1 +1 @@
|
|
1
|
-
{"file":"app-modal.crm-bonus-form.phone-cancel-input.phone-input.entry.cjs.js","mappings":";;;;;;;;AAAA,MAAM,WAAW,GAAG,+hBAA+hB,CAAC;AACpjB,uBAAe,WAAW;;MCMb,QAAQ;;;;sBAG0B,KAAK;;;IAQxC,UAAU;QACd,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;KAC3B;IAED,MAAM;QACF,QAC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AM,GAAG,CAEvE,CACP,EACT;KACJ;;;;;;;;","names":["h","CrmBonusService","StepFormEnum","Host"],"sources":["src/components/modal/app-modal.css?tag=app-modal&encapsulation=shadow","src/components/modal/app-modal.tsx","src/components/crm-bonus-form/crm-bonus-form.css?tag=crm-bonus-form&encapsulation=shadow","src/components/crm-bonus-form/crm-bonus-form.tsx","src/components/crm-bonus-form/subcomponents/phone-cancel/phone.cancel.input.tsx","src/components/crm-bonus-form/subcomponents/phone/phone.input.tsx"],"sourcesContent":[".modal-backdrop {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.5);\n display: none;\n justify-content: center;\n align-items: center;\n z-index: 1000;\n }\n \n .modal-backdrop.visible {\n display: flex;\n }\n \n .modal {\n background: white;\n border-radius: 8px;\n padding: 1rem;\n max-width: 500px;\n width: 90%;\n box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);\n }\n \n .modal-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n border-bottom: 1px solid #ddd;\n margin-bottom: 1rem;\n }\n \n .close-button {\n background: none;\n border: none;\n font-size: 1.5rem;\n cursor: pointer;\n }\n \n .modal-body {\n /* padding: 1rem 0; */\n }\n ","import { Component, Event, EventEmitter, Prop, h } from \"@stencil/core\";\n\n@Component({\n tag: 'app-modal',\n styleUrl: 'app-modal.css',\n shadow: true,\n})\nexport class AppModal {\n\n // Controle da visibilidade do modal\n @Prop({ reflect: true }) isOpen: boolean = false;\n\n // Título do modal\n @Prop() modalTitle: string;\n\n // Evento emitido ao fechar o modal\n @Event() modalClosed: EventEmitter<void>;\n\n private closeModal() {\n this.modalClosed.emit();\n }\n\n render() {\n return (\n <div class={`modal-backdrop ${this.isOpen ? 'visible' : ''}`}>\n <div class=\"modal\">\n <div class=\"modal-header\">\n <h3>{this.modalTitle}</h3>\n <button class=\"close-button\" onClick={() => this.closeModal()}>\n ×\n </button>\n </div>\n <div class=\"modal-body\">\n <slot />\n </div>\n </div>\n </div>\n )\n }\n}",".form-container {\n width: 100%;\n display: flex;\n justify-content: center;\n justify-content: space-around;\n}\n\n.disabled {\n opacity: 0.6;\n cursor: not-allowed;\n}\n\n.message-error {\n color: #d11111;\n font-weight: bold;\n font-family: Arial;\n font-size: small;\n margin-left: 16px;\n}","import { Component, Host, Method, Prop, State, h } from \"@stencil/core\";\nimport { CrmBonusService } from \"../../services/crmbonus.service\";\nimport { IBonus, ICustomer, IProccesPinBonusDto, IProduct } from \"../../dto/validate.pin.bonus\";\nimport { StepFormEnum } from \"../../contants\";\nimport { IPinSent } from '../../dto/pin.sent';\n\n@Component({\n tag: 'crm-bonus-form',\n styleUrl: 'crm-bonus-form.css',\n shadow: true\n})\nexport class CrmBonusForm {\n\n private crmBonusService: CrmBonusService = new CrmBonusService();\n\n @Prop({ attribute: 'storename' }) storeName;\n @Prop() cartId;\n @Prop() products: Array<IProduct>;\n @Prop() customer: ICustomer = {\n phone: \"\",\n birthDate: \"\",\n document: \"\",\n name: \"\"\n };\n @Prop() sent: IPinSent;\n @Prop() stepNext: StepFormEnum;\n @Prop() phone: number;\n @Prop() loadingModal: boolean;\n\n @Prop() saveStore: (amount: number) => void;\n\n @Prop() cancel: () => void;\n\n @Prop() handleCustomerName: (name: string) => void;\n\n @State() loading: boolean = false;\n\n @State() step: number = StepFormEnum.STEP_NAME;\n\n @State() message: string;\n\n @State() bonus: IBonus;\n\n @Method()\n async setStep(step: StepFormEnum) {\n this.step = step\n }\n\n public async validateBonus(pin: string) {\n this.loading = true;\n this.message = \"\";\n const payload: IProccesPinBonusDto = {\n pin: pin,\n cellphone: this.phone.toString(),\n storeId: this.sent.storeId.toString(),\n userId: this.sent.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, this.storeName);\n\n console.log('[this.bonus]', this.bonus);\n this.step = StepFormEnum.STEP_RESERVE;\n } catch (error) {\n this.message = error?.response?.data?.message\n } finally {\n this.loading = false;\n }\n console.log('payload', payload)\n }\n\n public async reserveApply(amount: number) {\n this.loading = true;\n this.message = \"\";\n try {\n await this.reserve(amount);\n\n this.step = StepFormEnum.STEP_APPLY;\n\n this.saveStore(amount);\n } catch (error) {\n this.message = \"ocorreu um error ao solicitar a aplicação do bonus! tente novamente\"\n } finally {\n this.loading = false;\n }\n }\n\n public async reserve(amount: number) {\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 public handleCancel() {\n this.step = StepFormEnum.STEP_PHONE;\n this.cancel()\n }\n\n render() {\n return (\n <Host>\n {/* {this.step === StepFormEnum.STEP_PHONE && <phone-input value={this.customer.phone} sendPin={(phone) => this.sendPin(phone)} loading={this.loading} />} */}\n \n {this.step == StepFormEnum.STEP_NAME && <name-input loading={this.loadingModal} value={this.customer.name} applyName={(name) => this.handleCustomerName(name)} />}\n {this.step === StepFormEnum.STEP_PIN && <giftback-pin cancel={() => this.handleCancel()} sent={this.sent} validate={(data) => this.validateBonus(data)} loading={this.loading} />}\n\n {this.step === StepFormEnum.STEP_RESERVE && <giftback-progress loading={this.loading} cancel={() => this.handleCancel()} bonus={this.bonus} reserve={(amountRedeemed: number) => this.reserveApply(amountRedeemed)} />}\n {this.step === StepFormEnum.STEP_APPLY && <giftback-finish />}\n <p class=\"message-error\">{this.message}</p>\n </Host>\n )\n }\n}","import { Component, Prop, h } from \"@stencil/core\";\n\n@Component({\n tag: 'phone-cancel-input'\n})\nexport class PhoneCancelInput {\n\n private phoneInputMask: HTMLPhoneInputMaskElement;\n\n @Prop() sendPin: Function;\n @Prop() loading: boolean;\n @Prop() value: string;\n\n async validatePhone() {\n const phone = await this.phoneInputMask.getPhone();\n await this.sendPin(phone);\n }\n\n render() {\n return (\n <div class=\"form-container\">\n <phone-input-mask initialValue={`Valor aplicado R$ ${this.value}`} ref={ref => this.phoneInputMask = ref} disabled={true} />\n <button class={`btn btn-success btnCrm ${this.loading ? 'disabled' : ''} `} disabled={this.loading} onClick={() => this.validatePhone()}>\n {\n !this.loading ? \"Cancelar\" : <loading-spinner size=\"11px\" color=\"#fff\" />\n }\n </button>\n </div>\n )\n }\n}","import { Component, Prop, h } from \"@stencil/core\";\n\n@Component({\n tag: 'phone-input'\n})\nexport class PhoneInput {\n\n private phoneInputMask: HTMLPhoneInputMaskElement;\n\n @Prop() sendPin: Function;\n @Prop() loading: boolean;\n @Prop() value: string;\n\n async validatePhone() {\n const phone = await this.phoneInputMask.getPhone();\n await this.sendPin(phone);\n }\n\n render() {\n return (\n <div class=\"form-container\">\n <phone-input-mask initialValue={this.value} ref={ref => this.phoneInputMask = ref} />\n <button class={`btn btn-success btnCrm ${this.loading ? 'disabled' : ''} `} disabled={this.loading} onClick={() => this.validatePhone()}>\n {\n !this.loading ? \"validar\" : <loading-spinner size=\"11px\" color=\"#fff\" />\n }\n </button>\n </div>\n )\n }\n}"],"version":3}
|
1
|
+
{"file":"app-modal.crm-bonus-form.phone-cancel-input.phone-input.entry.cjs.js","mappings":";;;;;;;;AAAA,MAAM,WAAW,GAAG,+hBAA+hB,CAAC;AACpjB,uBAAe,WAAW;;MCMb,QAAQ;;;;sBAG0B,KAAK;;;IAQxC,UAAU;QACd,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;KAC3B;IAED,MAAM;QACF,QACIA,kEAAK,KAAK,EAAE,kBAAkB,IAAI,CAAC,MAAM,GAAG,SAAS,GAAG,EAAE,EAAE,IACxDA,kEAAK,KAAK,EAAC,OAAO,IACdA,kEAAK,KAAK,EAAC,cAAc,IACrBA,mEAAK,IAAI,CAAC,UAAU,CAAM,EAC1BA,qEAAQ,KAAK,EAAC,cAAc,EAAC,OAAO,EAAE,MAAM,IAAI,CAAC,UAAU,EAAE,aAEpD,CACP,EACNA,kEAAK,KAAK,EAA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EAAE,OAAO,EAAE,MAAM,IAAI,CAAC,aAAa,EAAE,IAE/H,CAAC,IAAI,CAAC,OAAO,GAAG,UAAU,GAAGA,6BAAiB,IAAI,EAAC,MAAM,EAAC,KAAK,EAAC,MAAM,GAAG,CAExE,CACP,EACT;KACJ;;;MCxBQ,UAAU;;;;;;;IAQnB,MAAM,aAAa;QACf,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;QACnD,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;KAC7B;IAED,MAAM;QACF,QACIA,kEAAK,KAAK,EAAC,gBAAgB,IACvBA,+EAAkB,YAAY,EAAE,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,IAAI,IAAI,CAAC,cAAc,GAAG,GAAG,GAAI,EACrFA,qEAAQ,KAAK,EAAE,0BAA0B,IAAI,CAAC,OAAO,GAAG,UAAU,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC,aAAa,EAAE,IAE/H,CAAC,IAAI,CAAC,OAAO,GAAG,SAAS,GAAGA,6BAAiB,IAAI,EAAC,MAAM,EAAC,KAAK,EAAC,MAAM,GAAG,CAEvE,CACP,EACT;KACJ;;;;;;;;","names":["h","CrmBonusService","StepFormEnum","Host"],"sources":["src/components/modal/app-modal.css?tag=app-modal&encapsulation=shadow","src/components/modal/app-modal.tsx","src/components/crm-bonus-form/crm-bonus-form.css?tag=crm-bonus-form&encapsulation=shadow","src/components/crm-bonus-form/crm-bonus-form.tsx","src/components/crm-bonus-form/subcomponents/phone-cancel/phone.cancel.input.tsx","src/components/crm-bonus-form/subcomponents/phone/phone.input.tsx"],"sourcesContent":[".modal-backdrop {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.5);\n display: none;\n justify-content: center;\n align-items: center;\n z-index: 1000;\n }\n \n .modal-backdrop.visible {\n display: flex;\n }\n \n .modal {\n background: white;\n border-radius: 8px;\n padding: 1rem;\n max-width: 500px;\n width: 90%;\n box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);\n }\n \n .modal-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n border-bottom: 1px solid #ddd;\n margin-bottom: 1rem;\n }\n \n .close-button {\n background: none;\n border: none;\n font-size: 1.5rem;\n cursor: pointer;\n }\n \n .modal-body {\n /* padding: 1rem 0; */\n }\n ","import { Component, Event, EventEmitter, Prop, h } from \"@stencil/core\";\n\n@Component({\n tag: 'app-modal',\n styleUrl: 'app-modal.css',\n shadow: true,\n})\nexport class AppModal {\n\n // Controle da visibilidade do modal\n @Prop({ reflect: true }) isOpen: boolean = false;\n\n // Título do modal\n @Prop() modalTitle: string;\n\n // Evento emitido ao fechar o modal\n @Event() modalClosed: EventEmitter<void>;\n\n private closeModal() {\n this.modalClosed.emit();\n }\n\n render() {\n return (\n <div class={`modal-backdrop ${this.isOpen ? 'visible' : ''}`}>\n <div class=\"modal\">\n <div class=\"modal-header\">\n <h3>{this.modalTitle}</h3>\n <button class=\"close-button\" onClick={() => this.closeModal()}>\n ×\n </button>\n </div>\n <div class=\"modal-body\">\n <slot />\n </div>\n </div>\n </div>\n )\n }\n}",".form-container {\n width: 100%;\n display: flex;\n justify-content: center;\n justify-content: space-around;\n}\n\n.disabled {\n opacity: 0.6;\n cursor: not-allowed;\n}\n\n.message-error {\n color: #d11111;\n font-weight: bold;\n font-family: Arial;\n font-size: small;\n margin-left: 16px;\n}","import { Component, Host, Method, Prop, State, h } from \"@stencil/core\";\nimport { CrmBonusService } from \"../../services/crmbonus.service\";\nimport { IBonus, ICustomer, IProccesPinBonusDto, IProduct } from \"../../dto/validate.pin.bonus\";\nimport { StepFormEnum } from \"../../contants\";\nimport { IPinSent } from '../../dto/pin.sent';\n\n@Component({\n tag: 'crm-bonus-form',\n styleUrl: 'crm-bonus-form.css',\n shadow: true\n})\nexport class CrmBonusForm {\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 phone: \"\",\n birthDate: \"\",\n document: \"\",\n name: \"\"\n };\n @Prop() sent: IPinSent;\n @Prop() stepNext: StepFormEnum;\n @Prop() phone: number;\n @Prop() loadingModal: boolean;\n\n @Prop() saveStore: (amount: number) => void;\n\n @Prop() cancel: () => void;\n\n @Prop() handleCustomerName: (name: string) => void;\n\n @State() loading: boolean = false;\n\n @State() step: number = StepFormEnum.STEP_NAME;\n\n @State() message: string;\n\n @State() bonus: IBonus;\n\n @Method()\n async setStep(step: StepFormEnum) {\n this.step = step\n }\n\n public async validateBonus(pin: string) {\n this.loading = true;\n this.message = \"\";\n const payload: IProccesPinBonusDto = {\n pin: pin,\n cellphone: this.phone.toString(),\n storeId: this.sent.storeId.toString(),\n userId: this.sent.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 this.step = StepFormEnum.STEP_RESERVE;\n } catch (error) {\n this.message = error?.response?.data?.message\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\n this.step = StepFormEnum.STEP_APPLY;\n\n this.saveStore(amount);\n } catch (error) {\n this.message = \"ocorreu um error ao solicitar a aplicação do bonus! tente novamente\"\n } finally {\n this.loading = false;\n }\n }\n\n public async reserve(amount: number) {\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 public handleCancel() {\n this.step = StepFormEnum.STEP_PHONE;\n this.cancel()\n }\n\n render() {\n return (\n <Host>\n {/* {this.step === StepFormEnum.STEP_PHONE && <phone-input value={this.customer.phone} sendPin={(phone) => this.sendPin(phone)} loading={this.loading} />} */}\n \n {this.step == StepFormEnum.STEP_NAME && <name-input loading={this.loadingModal} value={this.customer.name} applyName={(name) => this.handleCustomerName(name)} />}\n {this.step === StepFormEnum.STEP_PIN && <giftback-pin cancel={() => this.handleCancel()} sent={this.sent} validate={(data) => this.validateBonus(data)} loading={this.loading} />}\n\n {this.step === StepFormEnum.STEP_RESERVE && <giftback-progress loading={this.loading} cancel={() => this.handleCancel()} bonus={this.bonus} reserve={(amountRedeemed: number) => this.reserveApply(amountRedeemed)} />}\n {this.step === StepFormEnum.STEP_APPLY && <giftback-finish />}\n <p class=\"message-error\">{this.message}</p>\n </Host>\n )\n }\n}","import { Component, Prop, h } from \"@stencil/core\";\n\n@Component({\n tag: 'phone-cancel-input'\n})\nexport class PhoneCancelInput {\n\n private phoneInputMask: HTMLPhoneInputMaskElement;\n\n @Prop() sendPin: Function;\n @Prop() loading: boolean;\n @Prop() value: string;\n\n async validatePhone() {\n const phone = await this.phoneInputMask.getPhone();\n await this.sendPin(phone);\n }\n\n render() {\n return (\n <div class=\"form-container\">\n <phone-input-mask initialValue={`Valor aplicado R$ ${this.value}`} ref={ref => this.phoneInputMask = ref} disabled={true} />\n <button class={`btn btn-success btnCrm ${this.loading ? 'disabled' : ''} `} disabled={this.loading} onClick={() => this.validatePhone()}>\n {\n !this.loading ? \"Cancelar\" : <loading-spinner size=\"11px\" color=\"#fff\" />\n }\n </button>\n </div>\n )\n }\n}","import { Component, Prop, h } from \"@stencil/core\";\n\n@Component({\n tag: 'phone-input'\n})\nexport class PhoneInput {\n\n private phoneInputMask: HTMLPhoneInputMaskElement;\n\n @Prop() sendPin: Function;\n @Prop() loading: boolean;\n @Prop() value: string;\n\n async validatePhone() {\n const phone = await this.phoneInputMask.getPhone();\n await this.sendPin(phone);\n }\n\n render() {\n return (\n <div class=\"form-container\">\n <phone-input-mask initialValue={this.value} ref={ref => this.phoneInputMask = ref} />\n <button class={`btn btn-success btnCrm ${this.loading ? 'disabled' : ''} `} disabled={this.loading} onClick={() => this.validatePhone()}>\n {\n !this.loading ? \"validar\" : <loading-spinner size=\"11px\" color=\"#fff\" />\n }\n </button>\n </div>\n )\n }\n}"],"version":3}
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
5
|
const index = require('./index-52d8a075.js');
|
6
|
-
const crmbonus_service = require('./crmbonus.service-
|
6
|
+
const crmbonus_service = require('./crmbonus.service-d804521b.js');
|
7
7
|
const index$1 = require('./index-861e0cbe.js');
|
8
8
|
|
9
9
|
const crmBonusCss = ".container-button{cursor:pointer;padding:5px 5px 5px 14px;}.section-crm{border:1px solid #dbd4d4;text-align:-webkit-center;margin-bottom:20px}.section-cart-crm{margin-top:10px}.section-cart-crm p{padding:0;margin:0px 0px 0px 15px}.button{top:50%;background-color:#6c6c7e;color:#fff;border:none;padding:15px;min-height:30px;min-width:120px;font-size:20px;cursor:pointer;margin-left:10px;height:70px}.form-container{width:97%;display:flex;justify-content:space-around}.btn{display:inline-block;padding:6px 12px;margin-bottom:0;font-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 .btnCrm{background:#00162e;border-color:#00162e;width:30%;color:#fff}.message-alert{font-family:sans-serif;color:#df4d4d;margin-top:5px}";
|
@@ -12,7 +12,7 @@ const CrmBonusStyle0 = crmBonusCss;
|
|
12
12
|
const CrmBonus = class {
|
13
13
|
constructor(hostRef) {
|
14
14
|
index.registerInstance(this, hostRef);
|
15
|
-
this.crmBonusService =
|
15
|
+
this.crmBonusService = crmbonus_service.CrmBonusService.getInstance();
|
16
16
|
this.showModal = false;
|
17
17
|
this.userId = undefined;
|
18
18
|
this.storeName = undefined;
|
@@ -31,8 +31,10 @@ const CrmBonus = class {
|
|
31
31
|
this.canCancel = false;
|
32
32
|
this.amountCancel = undefined;
|
33
33
|
this.sent = undefined;
|
34
|
+
this.session = undefined;
|
34
35
|
}
|
35
36
|
async componentWillLoad() {
|
37
|
+
await this.loadSession();
|
36
38
|
await this.handleLoad();
|
37
39
|
}
|
38
40
|
async handleLoad() {
|
@@ -52,6 +54,9 @@ const CrmBonus = class {
|
|
52
54
|
}
|
53
55
|
this.buildAndGetProducts();
|
54
56
|
}
|
57
|
+
async loadSession() {
|
58
|
+
this.session = await this.crmBonusService.getToken(this.storeName);
|
59
|
+
}
|
55
60
|
async buildAndGetProducts() {
|
56
61
|
const key = `bc-products:${this.cartId}`;
|
57
62
|
const cache_products = localStorage.getItem(key);
|
@@ -122,7 +127,7 @@ const CrmBonus = class {
|
|
122
127
|
this.message = "";
|
123
128
|
this.loading = true;
|
124
129
|
try {
|
125
|
-
await this.crmBonusService.cancel(this.cartId
|
130
|
+
await this.crmBonusService.cancel(this.cartId);
|
126
131
|
this.canCancel = false;
|
127
132
|
localStorage.removeItem(this.cartId);
|
128
133
|
}
|
@@ -149,8 +154,8 @@ const CrmBonus = class {
|
|
149
154
|
this.showModal = true;
|
150
155
|
}
|
151
156
|
render() {
|
152
|
-
return (index.h("div", { key: '
|
153
|
-
: index.h("phone-input", { value: this.customer.phone, sendPin: (phone) => { this.handleSendPin(phone); }, loading: this.loading })), index.h("p", { key: '
|
157
|
+
return (index.h("div", { key: 'd21b06d2e19ac37704bea558df60f7ab08ecc868', class: "section-cart-crm" }, index.h("p", { key: '2e46e7eea083c5a70249f99bc7fe09129efa01a2', class: "text-left fbits-responsive-carrinho-desconto-texto" }, "Giftback"), index.h("div", { key: 'e0a309488b616c9b0f0875218923ee9a891b7339', class: "container-button" }, this.canCancel ? index.h("phone-cancel-input", { value: this.amountCancel, sendPin: () => { this.cancel(); }, loading: this.loading })
|
158
|
+
: index.h("phone-input", { value: this.customer.phone, sendPin: (phone) => { this.handleSendPin(phone); }, loading: this.loading })), index.h("p", { key: '978f0509978dc3b27f81deb712230b4f5bb91066', class: "message-alert" }, this.message), index.h("app-modal", { key: '91ecefdc47006236a375aecfe195b1aadb69fe19', isOpen: this.showModal, modalTitle: `Giftback`, onModalClosed: () => (this.showModal = false) }, index.h("crm-bonus-form", { key: '04c3aeaa2c59ae355a1ce8be64776c110d974dc4', loadingModal: this.loading, saveStore: (amount) => this.save(amount), ref: ref => this.crmBonusRef = ref, sent: this.sent, phone: this.phone, cancel: () => this.handleCloseModal(), storeName: this.storeName, products: this.buildProducts(), cartId: this.cartId, customer: this.customer, handleCustomerName: (name) => this.sendPinName(name) }))));
|
154
159
|
}
|
155
160
|
static get assetsDirs() { return ["assets"]; }
|
156
161
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"file":"crm-bonus.entry.cjs.js","mappings":";;;;;;;;AAAA,MAAM,WAAW,GAAG,y/BAAy/B,CAAC;AAC9gC,uBAAe,WAAW;;MCWb,QAAQ;;;QAEX,oBAAe,GAAoB,IAAIA,gCAAe,EAAE,CAAC;yBAInC,KAAK;;;;;;wBAOJ;YAC7B,SAAS,EAAE,EAAE;YACb,QAAQ,EAAE,EAAE;YACZ,IAAI,EAAE,EAAE;YACR,KAAK,EAAE,EAAE;SACV;uBAE2B,KAAK;;;yBAGH,KAAK;;;;IAKnC,MAAM,iBAAiB;QACrB,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;KACzB;IAED,MAAM,UAAU;QACd,IAAI;YACF,IAAI,IAAI,CAAC,MAAM,EAAE;gBACf,IAAI,CAAC,QAAQ,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;gBACpF,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;aACpC;YAED,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CA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,GAAG,KAAK,CAAC,IAE7CA,6EACE,YAAY,EAAE,IAAI,CAAC,OAAO,EAC1B,SAAS,EAAE,CAAC,MAAc,KAAK,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAChD,GAAG,EAAE,GAAG,IAAI,IAAI,CAAC,WAAW,GAAG,GAAG,EAClC,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,MAAM,EAAE,MAAM,IAAI,CAAC,gBAAgB,EAAE,EACrC,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,QAAQ,EAAE,IAAI,CAAC,aAAa,EAAE,EAC9B,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAC5C,kBAAkB,EAAE,CAAC,IAAY,KAAK,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,GAC5D,CACQ,CACR,EACP;KACF;;;;;;;","names":["CrmBonusService","StepFormEnum","h"],"sources":["src/components/crm-bonus/crm-bonus.css?tag=crm-bonus&encapsulation=shadow","src/components/crm-bonus/crm-bonus.tsx"],"sourcesContent":["/* :host {\n display: block;\n} */\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, 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\n@Component({\n tag: 'crm-bonus',\n styleUrl: 'crm-bonus.css',\n shadow: true,\n assetsDirs: ['assets']\n})\nexport class CrmBonus {\n\n private crmBonusService: CrmBonusService = new CrmBonusService();\n\n private crmBonusRef: HTMLCrmBonusFormElement;\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\n async componentWillLoad() {\n await this.handleLoad();\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('user', 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 buildAndGetProducts() {\n const key = `bc-products:${this.cartId}`;\n const cache_products = localStorage.getItem(key)\n\n if (!cache_products) {\n localStorage.setItem(key, this.productsInString);\n }\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 })\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 this.products.map(product => ({ sku: product.SKU, value: (product.PrecoPor * product.Quantidade), productVariantId: product.ProdutoVarianteId.toString(), quantity: product.Quantidade }))\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, this.storeName);\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 return (\n <div class=\"section-cart-crm\">\n <p class=\"text-left fbits-responsive-carrinho-desconto-texto\">Giftback</p>\n <div class=\"container-button\">\n {/* <img src={logo} onClick={() => (this.showModal = true)} /> */}\n {\n this.canCancel ? <phone-cancel-input value={this.amountCancel} sendPin={() => { this.cancel() }} loading={this.loading} />\n : <phone-input value={this.customer.phone} sendPin={(phone) => { this.handleSendPin(phone) }} loading={this.loading} />\n }\n </div>\n <p class=\"message-alert\" >{this.message}</p>\n <app-modal\n isOpen={this.showModal}\n modalTitle={`Giftback`}\n onModalClosed={() => (this.showModal = false)}\n >\n <crm-bonus-form\n loadingModal={this.loading}\n saveStore={(amount: number) => this.save(amount)}\n ref={ref => this.crmBonusRef = ref}\n sent={this.sent}\n phone={this.phone}\n cancel={() => this.handleCloseModal()}\n storeName={this.storeName}\n products={this.buildProducts()}\n cartId={this.cartId} customer={this.customer}\n handleCustomerName={(name: string) => this.sendPinName(name)}\n />\n </app-modal>\n </div>\n )\n }\n}\n"],"version":3}
|
1
|
+
{"file":"crm-bonus.entry.cjs.js","mappings":";;;;;;;;AAAA,MAAM,WAAW,GAAG,y/BAAy/B,CAAC;AAC9gC,uBAAe,WAAW;;MCWb,QAAQ;;;QAEX,oBAAe,GAAoBA,gCAAe,CAAC,WAAW,EAAE,CAAC;yBAI3C,KAAK;;;;;;wBAOJ;YAC7B,SAAS,EAAE,EAAE;YACb,QA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FormEnum","h"],"sources":["src/components/crm-bonus/crm-bonus.css?tag=crm-bonus&encapsulation=shadow","src/components/crm-bonus/crm-bonus.tsx"],"sourcesContent":["/* :host {\n display: block;\n} */\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, 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\n@Component({\n tag: 'crm-bonus',\n styleUrl: 'crm-bonus.css',\n shadow: true,\n assetsDirs: ['assets']\n})\nexport class CrmBonus {\n\n private crmBonusService: CrmBonusService = CrmBonusService.getInstance();\n\n private crmBonusRef: HTMLCrmBonusFormElement;\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\n async componentWillLoad() {\n await this.loadSession()\n await this.handleLoad();\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('user', 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 }\n\n async buildAndGetProducts() {\n const key = `bc-products:${this.cartId}`;\n const cache_products = localStorage.getItem(key)\n\n if (!cache_products) {\n localStorage.setItem(key, this.productsInString);\n }\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 })\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 this.products.map(product => ({ sku: product.SKU, value: (product.PrecoPor * product.Quantidade), productVariantId: product.ProdutoVarianteId.toString(), quantity: product.Quantidade }))\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 return (\n <div class=\"section-cart-crm\">\n <p class=\"text-left fbits-responsive-carrinho-desconto-texto\">Giftback</p>\n <div class=\"container-button\">\n {/* <img src={logo} onClick={() => (this.showModal = true)} /> */}\n {\n this.canCancel ? <phone-cancel-input value={this.amountCancel} sendPin={() => { this.cancel() }} loading={this.loading} />\n : <phone-input value={this.customer.phone} sendPin={(phone) => { this.handleSendPin(phone) }} loading={this.loading} />\n }\n </div>\n <p class=\"message-alert\" >{this.message}</p>\n <app-modal\n isOpen={this.showModal}\n modalTitle={`Giftback`}\n onModalClosed={() => (this.showModal = false)}\n >\n <crm-bonus-form\n loadingModal={this.loading}\n saveStore={(amount: number) => this.save(amount)}\n ref={ref => this.crmBonusRef = ref}\n sent={this.sent}\n phone={this.phone}\n cancel={() => this.handleCloseModal()}\n storeName={this.storeName}\n products={this.buildProducts()}\n cartId={this.cartId} customer={this.customer}\n handleCustomerName={(name: string) => this.sendPinName(name)}\n />\n </app-modal>\n </div>\n )\n }\n}\n"],"version":3}
|
@@ -19,7 +19,7 @@ var patchBrowser = () => {
|
|
19
19
|
|
20
20
|
patchBrowser().then(async (options) => {
|
21
21
|
await appGlobals.globalScripts();
|
22
|
-
return index.bootstrapLazy([["crm-bonus.cjs",[[1,"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]}]]],["crm-bonus-note.cjs",[[0,"crm-bonus-note",{"cartId":[8,"cartid"],"url":[32]}]]],["pedido-finalizado.cjs",[[0,"pedido-finalizado",{"cartId":[1,"cartid"],"orderId":[2,"orderid"],"metadadoString":[1,"metadado"]}]]],["phone-input-mask.cjs",[[1,"phone-input-mask",{"initialValue":[1,"initial-value"],"disabled":[4],"phone":[32],"getPhone":[64]}]]],["loading-spinner.cjs",[[1,"loading-spinner",{"size":[1],"color":[1]}]]],["giftback-finish_4.cjs",[[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"]]],["app-modal_4.cjs",[[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]}],[0,"phone-cancel-input",{"sendPin":[16],"loading":[4],"value":[1]}],[0,"phone-input",{"sendPin":[16],"loading":[4],"value":[1]}],[1,"app-modal",{"isOpen":[516,"is-open"],"modalTitle":[1,"modal-title"]}]]]], options);
|
22
|
+
return index.bootstrapLazy([["crm-bonus.cjs",[[1,"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]}]]],["crm-bonus-note.cjs",[[0,"crm-bonus-note",{"cartId":[8,"cartid"],"url":[32]}]]],["pedido-finalizado.cjs",[[0,"pedido-finalizado",{"cartId":[1,"cartid"],"orderId":[2,"orderid"],"metadadoString":[1,"metadado"]}]]],["phone-input-mask.cjs",[[1,"phone-input-mask",{"initialValue":[1,"initial-value"],"disabled":[4],"phone":[32],"getPhone":[64]}]]],["loading-spinner.cjs",[[1,"loading-spinner",{"size":[1],"color":[1]}]]],["giftback-finish_4.cjs",[[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"]]],["app-modal_4.cjs",[[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]}],[0,"phone-cancel-input",{"sendPin":[16],"loading":[4],"value":[1]}],[0,"phone-input",{"sendPin":[16],"loading":[4],"value":[1]}],[1,"app-modal",{"isOpen":[516,"is-open"],"modalTitle":[1,"modal-title"]}]]]], options);
|
23
23
|
});
|
24
24
|
|
25
25
|
exports.setNonce = index.setNonce;
|
@@ -3751,7 +3751,7 @@ axios.default = axios;
|
|
3751
3751
|
// this module should only have a default export
|
3752
3752
|
const axios$1 = axios;
|
3753
3753
|
|
3754
|
-
const CRM_BONUS_API_URL = "https://crmbonus-wake-hub-staging-5daedbc4e22b.herokuapp.com/api"
|
3754
|
+
const CRM_BONUS_API_URL = "https://wake-middleware.crmbonus.com/api"; // "https://crmbonus-wake-hub-staging-5daedbc4e22b.herokuapp.com/api" //"https://crmbonus-service-staging-d15ba5377115.herokuapp.com"; //"https://typically-workable-perch.ngrok-free.app"; // "http://localhost:3500";
|
3755
3755
|
|
3756
3756
|
class CrmBonusService {
|
3757
3757
|
constructor() {
|
@@ -3763,42 +3763,79 @@ class CrmBonusService {
|
|
3763
3763
|
},
|
3764
3764
|
});
|
3765
3765
|
}
|
3766
|
+
static getInstance() {
|
3767
|
+
if (this._instance) {
|
3768
|
+
return this._instance;
|
3769
|
+
}
|
3770
|
+
this._instance = new CrmBonusService();
|
3771
|
+
return this._instance;
|
3772
|
+
}
|
3766
3773
|
async getCustomer(userId, store) {
|
3767
|
-
|
3768
|
-
|
3769
|
-
|
3774
|
+
var _a, _b;
|
3775
|
+
const headers = {
|
3776
|
+
'Content-Type': 'application/json',
|
3777
|
+
'Authorization': `Bearer ${this.token}`
|
3778
|
+
};
|
3779
|
+
const response = await this.axiosInstance.get(`/store/${store}/customer/${userId}`, { headers: headers });
|
3780
|
+
this.token = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.token;
|
3781
|
+
return (_b = response === null || response === void 0 ? void 0 : response.data) === null || _b === void 0 ? void 0 : _b.customer;
|
3770
3782
|
}
|
3771
3783
|
async updateOrder(updateOrderDTO) {
|
3772
|
-
const
|
3784
|
+
const headers = {
|
3785
|
+
'Content-Type': 'application/json',
|
3786
|
+
'Authorization': `Bearer ${this.token}`
|
3787
|
+
};
|
3788
|
+
await this.axiosInstance.patch(`/checkouts/${updateOrderDTO.cartId}/updateOrder`, {
|
3773
3789
|
orderId: updateOrderDTO.orderId,
|
3774
3790
|
externalId: updateOrderDTO.cartIdCrm
|
3775
|
-
}, { headers:
|
3776
|
-
console.log('response', response.data);
|
3791
|
+
}, { headers: headers });
|
3777
3792
|
}
|
3778
3793
|
async sendPin(phone, name, store) {
|
3779
|
-
const
|
3794
|
+
const headers = {
|
3795
|
+
'Content-Type': 'application/json',
|
3796
|
+
'Authorization': `Bearer ${this.token}`
|
3797
|
+
};
|
3798
|
+
const response = await this.axiosInstance.post("/crmbonus/send-pin", { cellphone: phone, name: name, storeName: store }, { headers: headers });
|
3780
3799
|
return {
|
3781
3800
|
storeId: response.data.storeId,
|
3782
3801
|
userId: response.data.userId
|
3783
3802
|
};
|
3784
3803
|
}
|
3785
|
-
async validatePinBonus(payload
|
3786
|
-
|
3787
|
-
|
3804
|
+
async validatePinBonus(payload) {
|
3805
|
+
const headers = {
|
3806
|
+
'Content-Type': 'application/json',
|
3807
|
+
'Authorization': `Bearer ${this.token}`
|
3808
|
+
};
|
3809
|
+
const response = await this.axiosInstance.post("/crmbonus/process-pin-bonus", payload, { headers });
|
3788
3810
|
return response.data;
|
3789
3811
|
}
|
3790
3812
|
async reserve(payload) {
|
3791
|
-
const
|
3813
|
+
const headers = {
|
3814
|
+
'Content-Type': 'application/json',
|
3815
|
+
'Authorization': `Bearer ${this.token}`
|
3816
|
+
};
|
3817
|
+
const response = await this.axiosInstance.post("/crmbonus/redeem-bonus", payload, { headers });
|
3792
3818
|
return response.data;
|
3793
3819
|
}
|
3794
|
-
async cancel(cartId
|
3820
|
+
async cancel(cartId) {
|
3821
|
+
const headers = {
|
3822
|
+
'Content-Type': 'application/json',
|
3823
|
+
'Authorization': `Bearer ${this.token}`
|
3824
|
+
};
|
3795
3825
|
const response = await this.axiosInstance.post("/crmbonus/cancel-apply-bonus", {
|
3796
3826
|
ticket: cartId
|
3797
|
-
}, { headers
|
3827
|
+
}, { headers });
|
3798
3828
|
return response.data;
|
3799
3829
|
}
|
3830
|
+
async getToken(store) {
|
3831
|
+
var _a, _b;
|
3832
|
+
const response = await this.axiosInstance.post("/wake/requestToken", { storeName: store });
|
3833
|
+
this.token = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.token;
|
3834
|
+
return (_b = response === null || response === void 0 ? void 0 : response.data) === null || _b === void 0 ? void 0 : _b.token;
|
3835
|
+
}
|
3800
3836
|
}
|
3837
|
+
CrmBonusService._instance = null;
|
3801
3838
|
|
3802
3839
|
exports.CrmBonusService = CrmBonusService;
|
3803
3840
|
|
3804
|
-
//# sourceMappingURL=crmbonus.service-
|
3841
|
+
//# sourceMappingURL=crmbonus.service-d804521b.js.map
|