crmbonus-component-wake 1.0.32 → 1.0.33
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 +6 -6
- package/dist/cjs/app-modal_4.cjs.entry.js.map +1 -1
- package/dist/cjs/crm-bonus-note.cjs.entry.js +26 -0
- package/dist/cjs/crm-bonus-note.cjs.entry.js.map +1 -0
- package/dist/cjs/crm-bonus.cjs.entry.js +29 -6
- 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-8412ddbf.js → crmbonus.service-e6b51638.js} +8 -1
- package/dist/cjs/crmbonus.service-e6b51638.js.map +1 -0
- package/dist/cjs/giftback-finish_3.cjs.entry.js +3 -3
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/loading-spinner.cjs.entry.js +1 -1
- package/dist/cjs/pedido-finalizado.cjs.entry.js +2 -2
- package/dist/cjs/phone-input-mask.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/crm-bonus/crm-bonus.css +6 -0
- package/dist/collection/components/crm-bonus/crm-bonus.js +28 -4
- package/dist/collection/components/crm-bonus/crm-bonus.js.map +1 -1
- package/dist/collection/components/crm-bonus-form/crm-bonus-form.js +4 -4
- package/dist/collection/components/crm-bonus-form/crm-bonus-form.js.map +1 -1
- package/dist/collection/components/crm-bonus-form/subcomponents/giftback-finish/giftback-finish.js +1 -1
- package/dist/collection/components/crm-bonus-form/subcomponents/giftback-pin/giftback-pin.js +1 -1
- package/dist/collection/components/crm-bonus-form/subcomponents/giftback-progress/giftback-progress.js +1 -1
- package/dist/collection/components/crm-bonus-form/subcomponents/phone/phone.input.js +1 -1
- package/dist/collection/components/crm-bonus-form/subcomponents/phone-cancel/phone.cancel.input.js +1 -1
- package/dist/collection/components/crm-bonus-form/subcomponents/phone-cancel/phone.cancel.input.js.map +1 -1
- package/dist/collection/components/loading-spinner/loading-spinner.js +1 -1
- package/dist/collection/components/modal/app-modal.js +1 -1
- package/dist/collection/components/note/crm-bonus-note.css +34 -0
- package/dist/collection/components/note/crm-bonus-note.js +29 -0
- package/dist/collection/components/note/crm-bonus-note.js.map +1 -0
- package/dist/collection/components/pedido/pedido.js +1 -1
- package/dist/collection/components/phone/phone-input-mask.js +1 -1
- package/dist/collection/services/crmbonus.service.js +7 -0
- package/dist/collection/services/crmbonus.service.js.map +1 -1
- package/dist/components/app-modal.js +1 -1
- package/dist/components/crm-bonus-form.js +1 -1
- package/dist/components/crm-bonus-note.d.ts +11 -0
- package/dist/components/crm-bonus-note.js +42 -0
- package/dist/components/crm-bonus-note.js.map +1 -0
- package/dist/components/crm-bonus.js +39 -15
- package/dist/components/crm-bonus.js.map +1 -1
- package/dist/components/giftback-finish.js +1 -1
- package/dist/components/giftback-pin.js +1 -1
- package/dist/components/giftback-progress.js +1 -1
- package/dist/components/loading-spinner.js +1 -1
- package/dist/components/{p-374de9ae.js → p-39df4263.js} +8 -1
- package/dist/components/p-39df4263.js.map +1 -0
- package/dist/components/{p-09bc92e2.js → p-4c2f324f.js} +2 -2
- package/dist/components/{p-09bc92e2.js.map → p-4c2f324f.js.map} +1 -1
- package/dist/components/{p-bad9f0ec.js → p-6a629b94.js} +3 -3
- package/dist/components/{p-bad9f0ec.js.map → p-6a629b94.js.map} +1 -1
- package/dist/components/{p-13b9e80b.js → p-af4650fb.js} +3 -3
- package/dist/components/{p-13b9e80b.js.map → p-af4650fb.js.map} +1 -1
- package/dist/components/{p-db0aa2d4.js → p-b1a8e30d.js} +2 -2
- package/dist/components/{p-db0aa2d4.js.map → p-b1a8e30d.js.map} +1 -1
- package/dist/components/{p-19a2f475.js → p-c4a9f453.js} +4 -4
- package/dist/components/p-c4a9f453.js.map +1 -0
- package/dist/components/{p-5753850f.js → p-cbade307.js} +2 -2
- package/dist/components/{p-5753850f.js.map → p-cbade307.js.map} +1 -1
- package/dist/components/{p-5de96a58.js → p-cf18373a.js} +4 -4
- package/dist/components/{p-5de96a58.js.map → p-cf18373a.js.map} +1 -1
- package/dist/components/{p-7aff1ad5.js → p-d04e8a4e.js} +2 -2
- package/dist/components/{p-7aff1ad5.js.map → p-d04e8a4e.js.map} +1 -1
- package/dist/components/{p-2e9efe46.js → p-e0fe93e9.js} +8 -8
- package/dist/components/p-e0fe93e9.js.map +1 -0
- package/dist/components/pedido-finalizado.js +2 -2
- package/dist/components/phone-cancel-input.js +1 -1
- package/dist/components/phone-input-mask.js +1 -1
- package/dist/components/phone-input.js +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-0521617e.entry.js +2 -0
- package/dist/crmbonus-component-wake/p-0521617e.entry.js.map +1 -0
- package/dist/crmbonus-component-wake/{p-9399d79f.entry.js → p-2fdbb9ec.entry.js} +2 -2
- package/dist/crmbonus-component-wake/{p-374de9ae.js → p-39df4263.js} +2 -2
- package/dist/crmbonus-component-wake/p-39df4263.js.map +1 -0
- package/dist/crmbonus-component-wake/p-61fafdba.entry.js +2 -0
- package/dist/crmbonus-component-wake/p-61fafdba.entry.js.map +1 -0
- package/dist/crmbonus-component-wake/{p-3024dc0b.entry.js → p-8c44a0a5.entry.js} +2 -2
- package/dist/crmbonus-component-wake/{p-3f336c1d.entry.js → p-ae916fdb.entry.js} +2 -2
- package/dist/crmbonus-component-wake/{p-8a5448aa.entry.js → p-cf8e81f9.entry.js} +2 -2
- package/dist/crmbonus-component-wake/p-f6dd48cc.entry.js +2 -0
- package/dist/crmbonus-component-wake/p-f6dd48cc.entry.js.map +1 -0
- package/dist/esm/app-modal_4.entry.js +6 -6
- package/dist/esm/app-modal_4.entry.js.map +1 -1
- package/dist/esm/crm-bonus-note.entry.js +22 -0
- package/dist/esm/crm-bonus-note.entry.js.map +1 -0
- package/dist/esm/crm-bonus.entry.js +29 -6
- package/dist/esm/crm-bonus.entry.js.map +1 -1
- package/dist/esm/crmbonus-component-wake.js +1 -1
- package/dist/esm/{crmbonus.service-053a9e38.js → crmbonus.service-d2bfcb1d.js} +8 -1
- package/dist/esm/crmbonus.service-d2bfcb1d.js.map +1 -0
- package/dist/esm/giftback-finish_3.entry.js +3 -3
- package/dist/esm/loader.js +1 -1
- package/dist/esm/loading-spinner.entry.js +1 -1
- package/dist/esm/pedido-finalizado.entry.js +2 -2
- package/dist/esm/phone-input-mask.entry.js +1 -1
- package/dist/types/components/crm-bonus/crm-bonus.d.ts +3 -1
- package/dist/types/components/crm-bonus-form/crm-bonus-form.d.ts +1 -1
- package/dist/types/components/note/crm-bonus-note.d.ts +5 -0
- package/dist/types/components.d.ts +15 -2
- package/dist/types/services/crmbonus.service.d.ts +1 -0
- package/package.json +1 -1
- package/dist/cjs/crmbonus.service-8412ddbf.js.map +0 -1
- package/dist/components/p-19a2f475.js.map +0 -1
- package/dist/components/p-2e9efe46.js.map +0 -1
- package/dist/components/p-374de9ae.js.map +0 -1
- package/dist/crmbonus-component-wake/p-240c3f01.entry.js +0 -2
- package/dist/crmbonus-component-wake/p-240c3f01.entry.js.map +0 -1
- package/dist/crmbonus-component-wake/p-374de9ae.js.map +0 -1
- package/dist/crmbonus-component-wake/p-e1e8d2d5.entry.js +0 -2
- package/dist/crmbonus-component-wake/p-e1e8d2d5.entry.js.map +0 -1
- package/dist/esm/crmbonus.service-053a9e38.js.map +0 -1
- /package/dist/crmbonus-component-wake/{p-9399d79f.entry.js.map → p-2fdbb9ec.entry.js.map} +0 -0
- /package/dist/crmbonus-component-wake/{p-3024dc0b.entry.js.map → p-8c44a0a5.entry.js.map} +0 -0
- /package/dist/crmbonus-component-wake/{p-3f336c1d.entry.js.map → p-ae916fdb.entry.js.map} +0 -0
- /package/dist/crmbonus-component-wake/{p-8a5448aa.entry.js.map → p-cf8e81f9.entry.js.map} +0 -0
@@ -1,16 +1,16 @@
|
|
1
1
|
import { p as proxyCustomElement, H, h } from './p-faf7103e.js';
|
2
|
-
import { C as CrmBonusService } from './p-
|
3
|
-
import { d as defineCustomElement$9, S as StepFormEnum } from './p-
|
4
|
-
import { d as defineCustomElement$a } from './p-
|
5
|
-
import { d as defineCustomElement$8 } from './p-
|
6
|
-
import { d as defineCustomElement$7 } from './p-
|
7
|
-
import { d as defineCustomElement$6 } from './p-
|
8
|
-
import { d as defineCustomElement$5 } from './p-
|
9
|
-
import { d as defineCustomElement$4 } from './p-
|
10
|
-
import { d as defineCustomElement$3 } from './p-
|
11
|
-
import { d as defineCustomElement$2 } from './p-
|
2
|
+
import { C as CrmBonusService } from './p-39df4263.js';
|
3
|
+
import { d as defineCustomElement$9, S as StepFormEnum } from './p-e0fe93e9.js';
|
4
|
+
import { d as defineCustomElement$a } from './p-4c2f324f.js';
|
5
|
+
import { d as defineCustomElement$8 } from './p-cbade307.js';
|
6
|
+
import { d as defineCustomElement$7 } from './p-af4650fb.js';
|
7
|
+
import { d as defineCustomElement$6 } from './p-6a629b94.js';
|
8
|
+
import { d as defineCustomElement$5 } from './p-b1a8e30d.js';
|
9
|
+
import { d as defineCustomElement$4 } from './p-c4a9f453.js';
|
10
|
+
import { d as defineCustomElement$3 } from './p-cf18373a.js';
|
11
|
+
import { d as defineCustomElement$2 } from './p-d04e8a4e.js';
|
12
12
|
|
13
|
-
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}";
|
13
|
+
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}";
|
14
14
|
const CrmBonusStyle0 = crmBonusCss;
|
15
15
|
|
16
16
|
const CrmBonus$1 = /*@__PURE__*/ proxyCustomElement(class CrmBonus extends H {
|
@@ -35,6 +35,7 @@ const CrmBonus$1 = /*@__PURE__*/ proxyCustomElement(class CrmBonus extends H {
|
|
35
35
|
this.message = undefined;
|
36
36
|
this.phone = undefined;
|
37
37
|
this.canCancel = false;
|
38
|
+
this.amountCancel = undefined;
|
38
39
|
this.sent = undefined;
|
39
40
|
}
|
40
41
|
async componentWillLoad() {
|
@@ -46,6 +47,12 @@ const CrmBonus$1 = /*@__PURE__*/ proxyCustomElement(class CrmBonus extends H {
|
|
46
47
|
this.customer = await this.crmBonusService.getCustomer(this.userId, this.storeName);
|
47
48
|
console.log('user', this.customer);
|
48
49
|
}
|
50
|
+
const amount = localStorage.getItem(this.cartId);
|
51
|
+
console.log('amount', amount);
|
52
|
+
if (amount) {
|
53
|
+
this.canCancel = true;
|
54
|
+
this.amountCancel = amount;
|
55
|
+
}
|
49
56
|
}
|
50
57
|
catch (error) {
|
51
58
|
console.log('info customer');
|
@@ -76,12 +83,28 @@ const CrmBonus$1 = /*@__PURE__*/ proxyCustomElement(class CrmBonus extends H {
|
|
76
83
|
handleCloseModal() {
|
77
84
|
this.showModal = false;
|
78
85
|
}
|
79
|
-
save() {
|
80
|
-
localStorage.setItem(
|
86
|
+
save(amount) {
|
87
|
+
localStorage.setItem(this.cartId, amount.toString());
|
88
|
+
this.canCancel = true;
|
89
|
+
this.amountCancel = amount.toString();
|
90
|
+
}
|
91
|
+
async cancel() {
|
92
|
+
this.message = "";
|
93
|
+
this.loading = true;
|
94
|
+
try {
|
95
|
+
await this.crmBonusService.cancel(this.cartId, this.storeName);
|
96
|
+
this.canCancel = false;
|
97
|
+
}
|
98
|
+
catch (error) {
|
99
|
+
this.message = "Não consegui cancelar o bônus, tente novamente!";
|
100
|
+
}
|
101
|
+
finally {
|
102
|
+
this.loading = false;
|
103
|
+
}
|
81
104
|
}
|
82
105
|
render() {
|
83
|
-
return (h("div", { key: '
|
84
|
-
: h("phone-input", { value: this.customer.phone, sendPin: (phone) => { this.sendPin(phone); }, loading: this.loading })), h("app-modal", { key: '
|
106
|
+
return (h("div", { key: '0392d18435b29da7594c5ddec8dca0a5a2c892f6', class: "section-cart-crm" }, h("p", { key: '7f5cb65fe1ebce8397d5d6c8d3d13d09ad55d8db', class: "text-left fbits-responsive-carrinho-desconto-texto" }, "Giftback"), h("div", { key: '82922b373a5c6d0eb72d59826c5b10425fa9fb81', class: "container-button" }, this.canCancel ? h("phone-cancel-input", { value: this.amountCancel, sendPin: () => { this.cancel(); }, loading: this.loading })
|
107
|
+
: h("phone-input", { value: this.customer.phone, sendPin: (phone) => { this.sendPin(phone); }, loading: this.loading })), h("p", { key: '113c2653a276730fd3ecd675f50a0f147c656620', class: "message-alert" }, this.message), h("app-modal", { key: 'ffda850ab8dc0534e56f868554eaaa794b168427', isOpen: this.showModal, modalTitle: `Giftback`, onModalClosed: () => (this.showModal = false) }, h("crm-bonus-form", { key: '3b3493173363fd799f26b37e6d94f9455e19f2bf', 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 }))));
|
85
108
|
}
|
86
109
|
static get assetsDirs() { return ["assets"]; }
|
87
110
|
static get style() { return CrmBonusStyle0; }
|
@@ -97,6 +120,7 @@ const CrmBonus$1 = /*@__PURE__*/ proxyCustomElement(class CrmBonus extends H {
|
|
97
120
|
"message": [32],
|
98
121
|
"phone": [32],
|
99
122
|
"canCancel": [32],
|
123
|
+
"amountCancel": [32],
|
100
124
|
"sent": [32]
|
101
125
|
}]);
|
102
126
|
function defineCustomElement$1() {
|
@@ -1 +1 @@
|
|
1
|
-
{"file":"crm-bonus.js","mappings":";;;;;;;;;;;;AAAA,MAAM,WAAW,GAAG,
|
1
|
+
{"file":"crm-bonus.js","mappings":";;;;;;;;;;;;AAAA,MAAM,WAAW,GAAG,y/BAAy/B,CAAC;AAC9gC,uBAAe,WAAW;;MCWbA,UAAQ;;;;;QAEX,oBAAe,GAAoB,IAAI,eAAe,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,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AAQ,IAAI,CAAC,MAAM,EAAE,CAAA,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,GAAI;cACtH,mBAAa,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC,KAAK,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,GAAI,CAEjH,EACN,0DAAG,KAAK,EAAC,eAAe,IAAG,IAAI,CAAC,OAAO,CAAK,EAC5C,kEACE,MAAM,EAAE,IAAI,CAAC,SAAS,EACtB,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,OAAO,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,IAE7C,uEAAgB,SAAS,EAAE,CAAC,MAAc,KAAK,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,GAAG,IAAI,IAAI,CAAC,WAAW,GAAG,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC,gBAAgB,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,QAAQ,EAAE,IAAI,CAAC,aAAa,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,GAAI,CAClR,CACR,EACP;KACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["CrmBonus"],"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 console.log('amount', amount)\n\n if (amount) {\n this.canCancel = true;\n this.amountCancel = amount;\n }\n\n } catch (error) {\n console.log('info customer')\n }\n this.products = JSON.parse(this.productsInString);\n }\n\n public async sendPin(phone: string) {\n this.loading = true;\n this.message = \"\";\n\n try {\n const _phone = phone.replace(/\\D/g, '');\n this.phone = Number(_phone);\n this.sent = await this.crmBonusService.sendPin(this.phone, this.storeName);;\n await this.crmBonusRef.setStep(StepFormEnum.STEP_PIN);\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 } catch (error) {\n this.message = \"Não consegui cancelar o bônus, tente novamente!\"\n } finally {\n this.loading = false;\n }\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.sendPin(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 saveStore={(amount: number) => 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} />\n </app-modal>\n </div>\n )\n }\n}\n"],"version":3}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { G as GiftbackProgress$1, d as defineCustomElement$1 } from './p-
|
1
|
+
import { G as GiftbackProgress$1, d as defineCustomElement$1 } from './p-6a629b94.js';
|
2
2
|
|
3
3
|
const GiftbackProgress = GiftbackProgress$1;
|
4
4
|
const defineCustomElement = defineCustomElement$1;
|
@@ -3789,8 +3789,15 @@ class CrmBonusService {
|
|
3789
3789
|
const response = await this.axiosInstance.post("/api/crm-bonus/redeem-bonus", payload, { headers: { store } });
|
3790
3790
|
return response.data;
|
3791
3791
|
}
|
3792
|
+
async cancel(cartId, store) {
|
3793
|
+
const response = await this.axiosInstance.post("/api/crm-bonus/cancel-bonus", {
|
3794
|
+
num_pedido: cartId,
|
3795
|
+
used_bonus: true
|
3796
|
+
}, { headers: { store } });
|
3797
|
+
return response.data;
|
3798
|
+
}
|
3792
3799
|
}
|
3793
3800
|
|
3794
3801
|
export { CrmBonusService as C };
|
3795
3802
|
|
3796
|
-
//# sourceMappingURL=p-
|
3803
|
+
//# sourceMappingURL=p-39df4263.js.map
|