crmbonus-component-wake 1.0.41 → 1.0.43
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 +15 -10
- package/dist/cjs/app-modal_4.cjs.entry.js.map +1 -1
- package/dist/cjs/crm-bonus.cjs.entry.js +4 -4
- package/dist/cjs/crm-bonus.cjs.entry.js.map +1 -1
- package/dist/cjs/{crmbonus.service-e46a5941.js → crmbonus.service-ad521d7d.js} +12 -12
- package/dist/cjs/crmbonus.service-ad521d7d.js.map +1 -0
- package/dist/cjs/pedido-finalizado.cjs.entry.js +1 -1
- package/dist/collection/components/crm-bonus/crm-bonus.js +3 -3
- package/dist/collection/components/crm-bonus/crm-bonus.js.map +1 -1
- package/dist/collection/components/crm-bonus-form/crm-bonus-form.js +14 -9
- package/dist/collection/components/crm-bonus-form/crm-bonus-form.js.map +1 -1
- package/dist/collection/dto/validate.pin.bonus.js.map +1 -1
- package/dist/collection/services/crmbonus.service.js +10 -10
- 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 +5 -5
- package/dist/components/crm-bonus.js.map +1 -1
- package/dist/components/{p-84832959.js → p-0ebfe0d3.js} +16 -11
- package/dist/components/p-0ebfe0d3.js.map +1 -0
- package/dist/components/{p-a7e4526b.js → p-aeaad64e.js} +12 -12
- package/dist/components/p-aeaad64e.js.map +1 -0
- package/dist/components/pedido-finalizado.js +1 -1
- package/dist/crmbonus-component-wake/crmbonus-component-wake.esm.js +1 -1
- package/dist/crmbonus-component-wake/{p-e67e5649.entry.js → p-04db24fc.entry.js} +2 -2
- package/dist/crmbonus-component-wake/p-04db24fc.entry.js.map +1 -0
- package/dist/crmbonus-component-wake/p-60249052.entry.js +2 -0
- package/dist/crmbonus-component-wake/p-60249052.entry.js.map +1 -0
- package/dist/crmbonus-component-wake/{p-3fa8e7b2.entry.js → p-6de2e9c3.entry.js} +2 -2
- package/dist/crmbonus-component-wake/{p-a7e4526b.js → p-aeaad64e.js} +2 -2
- package/dist/crmbonus-component-wake/p-aeaad64e.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 +15 -10
- package/dist/esm/app-modal_4.entry.js.map +1 -1
- package/dist/esm/crm-bonus.entry.js +4 -4
- package/dist/esm/crm-bonus.entry.js.map +1 -1
- package/dist/esm/{crmbonus.service-1b7f193d.js → crmbonus.service-dda2d96b.js} +12 -12
- package/dist/esm/crmbonus.service-dda2d96b.js.map +1 -0
- package/dist/esm/pedido-finalizado.entry.js +1 -1
- package/dist/types/dto/validate.pin.bonus.d.ts +14 -9
- package/dist/types/home/darlison/Projects/crmbonus/app/crmbonus-component/.stencil/env.d.ts +1 -1
- package/dist/types/services/crmbonus.service.d.ts +1 -1
- package/package.json +1 -1
- package/dist/cjs/crmbonus.service-e46a5941.js.map +0 -1
- package/dist/components/p-84832959.js.map +0 -1
- package/dist/components/p-a7e4526b.js.map +0 -1
- package/dist/crmbonus-component-wake/p-a7e4526b.js.map +0 -1
- package/dist/crmbonus-component-wake/p-b5e9ea5d.entry.js +0 -2
- package/dist/crmbonus-component-wake/p-b5e9ea5d.entry.js.map +0 -1
- package/dist/crmbonus-component-wake/p-e67e5649.entry.js.map +0 -1
- package/dist/esm/crmbonus.service-1b7f193d.js.map +0 -1
- /package/dist/crmbonus-component-wake/{p-3fa8e7b2.entry.js.map → p-6de2e9c3.entry.js.map} +0 -0
@@ -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-ad521d7d.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{}";
|
@@ -63,10 +63,12 @@ const CrmBonusForm = class {
|
|
63
63
|
const payload = {
|
64
64
|
pin: pin,
|
65
65
|
cellphone: this.phone.toString(),
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
66
|
+
storeId: this.sent.storeId.toString(),
|
67
|
+
userId: this.sent.userId.toString(),
|
68
|
+
checkoutId: this.cartId,
|
69
|
+
checkoutProducts: this.products,
|
70
|
+
name: null,
|
71
|
+
storeName: this.storeName
|
70
72
|
};
|
71
73
|
try {
|
72
74
|
this.bonus = await this.crmBonusService.validatePinBonus(payload, this.storeName);
|
@@ -98,18 +100,21 @@ const CrmBonusForm = class {
|
|
98
100
|
}
|
99
101
|
async reserve(amount) {
|
100
102
|
await this.crmBonusService.reserve({
|
101
|
-
|
102
|
-
|
103
|
+
redeemedBonus: amount,
|
104
|
+
cartId: this.cartId,
|
103
105
|
ticket: this.cartId,
|
104
|
-
|
105
|
-
|
106
|
+
grossValue: Number(this.bonus.totalValue),
|
107
|
+
storeName: this.storeName,
|
108
|
+
storeId: this.bonus.storeId.toString(),
|
109
|
+
userId: this.bonus.userId
|
110
|
+
});
|
106
111
|
}
|
107
112
|
handleCancel() {
|
108
113
|
this.step = index$1.StepFormEnum.STEP_PHONE;
|
109
114
|
this.cancel();
|
110
115
|
}
|
111
116
|
render() {
|
112
|
-
return (index.h(index.Host, { key: '
|
117
|
+
return (index.h(index.Host, { key: '42f30d9d144911d341eac720507b3eba4f1bae72' }, this.step == index$1.StepFormEnum.STEP_NAME && index.h("name-input", { key: 'fb1668693ceb8c359d7bd6f4ed4e375206f9769f', loading: this.loadingModal, value: this.customer.name, applyName: (name) => this.handleCustomerName(name) }), this.step === index$1.StepFormEnum.STEP_PIN && index.h("giftback-pin", { key: 'bffbdd4db2f183ac8947fdbaa1216f8b6851d76b', 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: '411ef7c01bb9a83e30559873d7d087d8f31f6969', 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: 'f4924e85e201d692ebcbe67bee5070a66d4b730a' }), index.h("p", { key: '9b364a2cabc105fb5512e544a86fbc48b91b9c90', class: "message-error" }, this.message)));
|
113
118
|
}
|
114
119
|
};
|
115
120
|
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,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,EAAC,YAAY,IACnBA,oEAAQ,CACN,CACJ,CACJ,EACT;KACJ;;;;ACtCL,MAAM,eAAe,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T;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 = 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 loja_id: this.sent.storeId,\n user_id: this.sent.userId,\n cartId: this.cartId,\n products: this.products\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 redeemed_bonus: amount,\n cart_id: this.cartId,\n ticket: this.cartId,\n gross_value: this.bonus.totalValue,\n }, this.storeName);\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-bon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AI,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 = 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}
|
@@ -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-ad521d7d.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}";
|
@@ -108,7 +108,7 @@ const CrmBonus = class {
|
|
108
108
|
}
|
109
109
|
}
|
110
110
|
buildProducts() {
|
111
|
-
return this.products.map(product => ({ sku: product.SKU, value: (product.PrecoPor * product.Quantidade),
|
111
|
+
return this.products.map(product => ({ sku: product.SKU, value: (product.PrecoPor * product.Quantidade), productVariantId: product.ProdutoVarianteId.toString(), quantity: product.Quantidade }));
|
112
112
|
}
|
113
113
|
handleCloseModal() {
|
114
114
|
this.showModal = false;
|
@@ -149,8 +149,8 @@ const CrmBonus = class {
|
|
149
149
|
this.showModal = true;
|
150
150
|
}
|
151
151
|
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: '
|
152
|
+
return (index.h("div", { key: 'b7fba875c1ae6e160ed019daecf2bc9f9d0d0296', class: "section-cart-crm" }, index.h("p", { key: 'b5e93f5b71b9dada90ca05682316c4b98657449b', class: "text-left fbits-responsive-carrinho-desconto-texto" }, "Giftback"), index.h("div", { key: '4662d8297a7d97a68bd5d08e119f5be4d90d2518', class: "container-button" }, this.canCancel ? index.h("phone-cancel-input", { value: this.amountCancel, sendPin: () => { this.cancel(); }, loading: this.loading })
|
153
|
+
: index.h("phone-input", { value: this.customer.phone, sendPin: (phone) => { this.handleSendPin(phone); }, loading: this.loading })), index.h("p", { key: '302ec7adb4cc51598c1af2664cbdef8b8552c19e', class: "message-alert" }, this.message), index.h("app-modal", { key: 'c32d7a682f7334cee9c7c9e8d269141a3292901f', isOpen: this.showModal, modalTitle: `Giftback`, onModalClosed: () => (this.showModal = false) }, index.h("crm-bonus-form", { key: '33fabd73d4686520a289c8a4881db709177e63e3', 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
154
|
}
|
155
155
|
static get assetsDirs() { return ["assets"]; }
|
156
156
|
};
|
@@ -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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,EACtB,aAAa,EAAE,OAAO,IAAI,CAAC,SAAS,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), variantId: product.ProdutoVarianteId, qtd: 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,GAAoB,IAAIA,gCAAe,EAAE,CAAC;yBAInC,KAAK;;;;;;wBAOJ;YAC7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S,GAAGA,gCAAoB,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,OAAO,EAAE,QAAQ,IAAI,CAAC,MAAM,EAAE,CAAA,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,GAAI;cACtHA,yBAAa,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC,KAAK,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,GAAI,CAEvH,EACNA,gEAAG,KAAK,EAAC,eAAe,IAAG,IAAI,CAAC,OAAO,CAAK,EAC5CA,wEACE,MAAM,EAAE,IAAI,CAAC,SAAS,EACtB,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,OAAO,IAAI,CAAC,SAAS,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}
|
@@ -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-service-staging-d15ba5377115.herokuapp.com"; //"https://typically-workable-perch.ngrok-free.app"; // "http://localhost:3500";
|
3754
|
+
const CRM_BONUS_API_URL = "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() {
|
@@ -3764,35 +3764,35 @@ class CrmBonusService {
|
|
3764
3764
|
});
|
3765
3765
|
}
|
3766
3766
|
async getCustomer(userId, store) {
|
3767
|
-
const response = await this.axiosInstance.get(`/
|
3767
|
+
const response = await this.axiosInstance.get(`/store/${store}/customer/${userId}`, { headers: { 'Content-Type': 'application/json' } });
|
3768
3768
|
console.log('response.data', response.data);
|
3769
3769
|
return response.data;
|
3770
3770
|
}
|
3771
3771
|
async updateOrder(updateOrderDTO) {
|
3772
|
-
const response = await this.axiosInstance.
|
3772
|
+
const response = await this.axiosInstance.patch(`/checkouts/${updateOrderDTO.cartId}/updateOrder`, {
|
3773
3773
|
orderId: updateOrderDTO.orderId,
|
3774
|
-
|
3774
|
+
externalId: updateOrderDTO.cartIdCrm
|
3775
3775
|
}, { headers: { 'Content-Type': 'application/json' } });
|
3776
3776
|
console.log('response', response.data);
|
3777
3777
|
}
|
3778
3778
|
async sendPin(phone, name, store) {
|
3779
|
-
const response = await this.axiosInstance.post("/
|
3779
|
+
const response = await this.axiosInstance.post("/crmbonus/send-pin", { cellphone: phone, name: name, storeName: store }, { headers: { store } });
|
3780
3780
|
return {
|
3781
|
-
storeId: response.data.
|
3782
|
-
userId: response.data.
|
3781
|
+
storeId: response.data.storeId,
|
3782
|
+
userId: response.data.userId
|
3783
3783
|
};
|
3784
3784
|
}
|
3785
3785
|
async validatePinBonus(payload, store) {
|
3786
3786
|
console.log('[validatePinBonus]', payload);
|
3787
|
-
const response = await this.axiosInstance.post("/
|
3787
|
+
const response = await this.axiosInstance.post("/crmbonus/process-pin-bonus", payload, { headers: { store } });
|
3788
3788
|
return response.data;
|
3789
3789
|
}
|
3790
|
-
async reserve(payload
|
3791
|
-
const response = await this.axiosInstance.post("/
|
3790
|
+
async reserve(payload) {
|
3791
|
+
const response = await this.axiosInstance.post("/crmbonus/redeem-bonus", payload);
|
3792
3792
|
return response.data;
|
3793
3793
|
}
|
3794
3794
|
async cancel(cartId, store) {
|
3795
|
-
const response = await this.axiosInstance.post("/
|
3795
|
+
const response = await this.axiosInstance.post("/crmbonus/cancel-apply-bonus", {
|
3796
3796
|
ticket: cartId
|
3797
3797
|
}, { headers: { store } });
|
3798
3798
|
return response.data;
|
@@ -3801,4 +3801,4 @@ class CrmBonusService {
|
|
3801
3801
|
|
3802
3802
|
exports.CrmBonusService = CrmBonusService;
|
3803
3803
|
|
3804
|
-
//# sourceMappingURL=crmbonus.service-
|
3804
|
+
//# sourceMappingURL=crmbonus.service-ad521d7d.js.map
|