crmbonus-component-wake 0.0.27 → 1.0.28
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 +152 -0
- package/dist/cjs/app-modal_4.cjs.entry.js.map +1 -0
- package/dist/cjs/crm-bonus.cjs.entry.js +37 -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/{giftback-finish_5.cjs.entry.js → giftback-finish_3.cjs.entry.js} +6 -59
- package/dist/cjs/giftback-finish_3.cjs.entry.js.map +1 -0
- package/dist/cjs/index-296f70bf.js +11 -0
- package/dist/cjs/index-296f70bf.js.map +1 -0
- 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 +1 -1
- package/dist/cjs/phone-input-mask.cjs.entry.js +45 -0
- package/dist/cjs/phone-input-mask.cjs.entry.js.map +1 -0
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/crm-bonus/crm-bonus.css +54 -1
- package/dist/collection/components/crm-bonus/crm-bonus.js +43 -5
- package/dist/collection/components/crm-bonus/crm-bonus.js.map +1 -1
- package/dist/collection/components/crm-bonus-form/crm-bonus-form.css +0 -13
- package/dist/collection/components/crm-bonus-form/crm-bonus-form.js +125 -30
- 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 +3 -3
- package/dist/collection/components/crm-bonus-form/subcomponents/giftback-progress/giftback-progress.js.map +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/phone.input.js.map +1 -1
- package/dist/collection/components/crm-bonus-form/subcomponents/phone-cancel/phone.cancel.input.js +75 -0
- package/dist/collection/components/crm-bonus-form/subcomponents/phone-cancel/phone.cancel.input.js.map +1 -0
- 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/pedido/pedido.js +1 -1
- package/dist/collection/components/phone/phone-input-mask.css +16 -7
- package/dist/collection/components/phone/phone-input-mask.js +19 -1
- package/dist/collection/components/phone/phone-input-mask.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.js +62 -21
- 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-cb5a1fdf.js → p-03918b34.js} +2 -2
- package/dist/components/{p-cb5a1fdf.js.map → p-03918b34.js.map} +1 -1
- package/dist/components/{p-cbade307.js → p-2667d525.js} +2 -2
- package/dist/components/{p-cbade307.js.map → p-2667d525.js.map} +1 -1
- package/dist/components/{p-8fcf8924.js → p-3d431add.js} +4 -4
- package/dist/components/{p-8fcf8924.js.map → p-3d431add.js.map} +1 -1
- package/dist/components/{p-e40cf14d.js → p-3d7c9042.js} +5 -3
- package/dist/components/p-3d7c9042.js.map +1 -0
- package/dist/components/{p-6442ffce.js → p-3e80a758.js} +3 -3
- package/dist/components/{p-6442ffce.js.map → p-3e80a758.js.map} +1 -1
- package/dist/components/p-a7c9d0d8.js +52 -0
- package/dist/components/p-a7c9d0d8.js.map +1 -0
- package/dist/components/{p-878ce0aa.js → p-b4c3e6bf.js} +36 -54
- package/dist/components/p-b4c3e6bf.js.map +1 -0
- package/dist/components/{p-462c12d8.js → p-c5913818.js} +5 -5
- package/dist/components/p-c5913818.js.map +1 -0
- package/dist/components/{p-e816fb90.js → p-f6396f4c.js} +2 -2
- package/dist/components/{p-e816fb90.js.map → p-f6396f4c.js.map} +1 -1
- package/dist/components/pedido-finalizado.js +1 -1
- package/dist/components/phone-cancel-input.d.ts +11 -0
- package/dist/components/phone-cancel-input.js +8 -0
- package/dist/components/phone-cancel-input.js.map +1 -0
- 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-562a34f1.entry.js +2 -0
- package/dist/crmbonus-component-wake/p-562a34f1.entry.js.map +1 -0
- package/dist/crmbonus-component-wake/p-8e6cdd1e.js +2 -0
- package/dist/crmbonus-component-wake/p-8e6cdd1e.js.map +1 -0
- package/dist/crmbonus-component-wake/p-9163a847.entry.js +2 -0
- package/dist/crmbonus-component-wake/p-9163a847.entry.js.map +1 -0
- package/dist/crmbonus-component-wake/{p-f74e4a71.entry.js → p-a603a26e.entry.js} +2 -2
- package/dist/crmbonus-component-wake/p-e9c2ed46.entry.js +2 -0
- package/dist/crmbonus-component-wake/p-e9c2ed46.entry.js.map +1 -0
- package/dist/crmbonus-component-wake/{p-4306a717.entry.js → p-ef75ecd5.entry.js} +2 -2
- package/dist/crmbonus-component-wake/p-fafb8311.entry.js +2 -0
- package/dist/crmbonus-component-wake/p-fafb8311.entry.js.map +1 -0
- package/dist/esm/app-modal_4.entry.js +145 -0
- package/dist/esm/app-modal_4.entry.js.map +1 -0
- package/dist/esm/crm-bonus.entry.js +37 -6
- package/dist/esm/crm-bonus.entry.js.map +1 -1
- package/dist/esm/crmbonus-component-wake.js +1 -1
- package/dist/esm/{giftback-finish_5.entry.js → giftback-finish_3.entry.js} +7 -58
- package/dist/esm/giftback-finish_3.entry.js.map +1 -0
- package/dist/esm/index-2bfaba2b.js +11 -0
- package/dist/esm/index-2bfaba2b.js.map +1 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/loading-spinner.entry.js +1 -1
- package/dist/esm/pedido-finalizado.entry.js +1 -1
- package/dist/esm/phone-input-mask.entry.js +41 -0
- package/dist/esm/phone-input-mask.entry.js.map +1 -0
- package/dist/types/components/crm-bonus/crm-bonus.d.ts +9 -0
- package/dist/types/components/crm-bonus-form/crm-bonus-form.d.ts +8 -4
- package/dist/types/components/crm-bonus-form/subcomponents/giftback-progress/giftback-progress.d.ts +1 -1
- package/dist/types/components/crm-bonus-form/subcomponents/phone-cancel/phone.cancel.input.d.ts +8 -0
- package/dist/types/components/phone/phone-input-mask.d.ts +1 -0
- package/dist/types/components.d.ts +32 -0
- package/package.json +1 -1
- package/dist/cjs/app-modal_2.cjs.entry.js +0 -134
- package/dist/cjs/app-modal_2.cjs.entry.js.map +0 -1
- package/dist/cjs/giftback-finish_5.cjs.entry.js.map +0 -1
- package/dist/components/p-462c12d8.js.map +0 -1
- package/dist/components/p-878ce0aa.js.map +0 -1
- package/dist/components/p-e40cf14d.js.map +0 -1
- package/dist/crmbonus-component-wake/p-9985f639.entry.js +0 -2
- package/dist/crmbonus-component-wake/p-9985f639.entry.js.map +0 -1
- package/dist/crmbonus-component-wake/p-be1a56de.entry.js +0 -2
- package/dist/crmbonus-component-wake/p-be1a56de.entry.js.map +0 -1
- package/dist/crmbonus-component-wake/p-e2f165e8.entry.js +0 -2
- package/dist/crmbonus-component-wake/p-e2f165e8.entry.js.map +0 -1
- package/dist/esm/app-modal_2.entry.js +0 -129
- package/dist/esm/app-modal_2.entry.js.map +0 -1
- package/dist/esm/giftback-finish_5.entry.js.map +0 -1
- /package/dist/crmbonus-component-wake/{p-f74e4a71.entry.js.map → p-a603a26e.entry.js.map} +0 -0
- /package/dist/crmbonus-component-wake/{p-4306a717.entry.js.map → p-ef75ecd5.entry.js.map} +0 -0
@@ -6,6 +6,7 @@
|
|
6
6
|
"components/crm-bonus-form/subcomponents/giftback-pin/giftback-pin.js",
|
7
7
|
"components/crm-bonus-form/subcomponents/giftback-progress/giftback-progress.js",
|
8
8
|
"components/crm-bonus-form/subcomponents/phone/phone.input.js",
|
9
|
+
"components/crm-bonus-form/subcomponents/phone-cancel/phone.cancel.input.js",
|
9
10
|
"components/loading-spinner/loading-spinner.js",
|
10
11
|
"components/modal/app-modal.js",
|
11
12
|
"components/pedido/pedido.js",
|
@@ -3,9 +3,10 @@
|
|
3
3
|
} */
|
4
4
|
|
5
5
|
.container-button {
|
6
|
-
max-width:
|
6
|
+
max-width: 100%;
|
7
7
|
cursor: pointer;
|
8
8
|
padding: 10px;
|
9
|
+
display: flex;
|
9
10
|
}
|
10
11
|
|
11
12
|
/* padding: 0 15px 15px;
|
@@ -17,4 +18,56 @@ margin-bottom: 20px; */
|
|
17
18
|
/* min-height: 50px; */
|
18
19
|
text-align: -webkit-center;
|
19
20
|
margin-bottom: 20px;
|
21
|
+
}
|
22
|
+
|
23
|
+
.section-cart-crm {
|
24
|
+
/* border: 1px solid #dbd4d4; */
|
25
|
+
/* min-height: 50px; */
|
26
|
+
text-align: -webkit-center;
|
27
|
+
margin-bottom: 20px;
|
28
|
+
}
|
29
|
+
|
30
|
+
.button {
|
31
|
+
top: 50%;
|
32
|
+
background-color: #6c6c7e;
|
33
|
+
color: #fff;
|
34
|
+
border: none;
|
35
|
+
/* border-radius: 10px; */
|
36
|
+
padding: 15px;
|
37
|
+
min-height: 30px;
|
38
|
+
min-width: 120px;
|
39
|
+
font-size: 20px;
|
40
|
+
cursor: pointer;
|
41
|
+
margin-left: 10px;
|
42
|
+
height: 70px;
|
43
|
+
}
|
44
|
+
|
45
|
+
.form-container {
|
46
|
+
width: 100%;
|
47
|
+
display: flex;
|
48
|
+
justify-content: center;
|
49
|
+
justify-content: space-around;
|
50
|
+
}
|
51
|
+
|
52
|
+
|
53
|
+
.btn {
|
54
|
+
display: inline-block;
|
55
|
+
padding: 6px 12px;
|
56
|
+
margin-bottom: 0;
|
57
|
+
font-size: 14px;
|
58
|
+
font-weight: 400;
|
59
|
+
line-height: 1.42857143;
|
60
|
+
text-align: center;
|
61
|
+
white-space: nowrap;
|
62
|
+
vertical-align: middle;
|
63
|
+
-ms-touch-action: manipulation;
|
64
|
+
touch-action: manipulation;
|
65
|
+
cursor: pointer;
|
66
|
+
-webkit-user-select: none;
|
67
|
+
-moz-user-select: none;
|
68
|
+
-ms-user-select: none;
|
69
|
+
user-select: none;
|
70
|
+
background-image: none;
|
71
|
+
border: 1px solid transparent;
|
72
|
+
border-radius: 4px;
|
20
73
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { h } from "@stencil/core";
|
2
|
-
import logo from "./assets/svg/logo.svg";
|
3
2
|
import { CrmBonusService } from "../../services/crmbonus.service";
|
3
|
+
import { StepFormEnum } from "../../contants";
|
4
4
|
export class CrmBonus {
|
5
5
|
constructor() {
|
6
6
|
this.crmBonusService = new CrmBonusService();
|
@@ -10,7 +10,17 @@ export class CrmBonus {
|
|
10
10
|
this.productsInString = undefined;
|
11
11
|
this.cartId = undefined;
|
12
12
|
this.products = undefined;
|
13
|
-
this.customer =
|
13
|
+
this.customer = {
|
14
|
+
birthDate: "",
|
15
|
+
document: "",
|
16
|
+
name: "",
|
17
|
+
phone: ""
|
18
|
+
};
|
19
|
+
this.loading = false;
|
20
|
+
this.message = undefined;
|
21
|
+
this.phone = undefined;
|
22
|
+
this.canCancel = false;
|
23
|
+
this.sent = undefined;
|
14
24
|
}
|
15
25
|
async componentWillLoad() {
|
16
26
|
await this.handleLoad();
|
@@ -18,7 +28,7 @@ export class CrmBonus {
|
|
18
28
|
async handleLoad() {
|
19
29
|
try {
|
20
30
|
if (this.userId) {
|
21
|
-
this.customer = await this.crmBonusService.getCustomer(this.userId, this.storeName);
|
31
|
+
// this.customer = await this.crmBonusService.getCustomer(this.userId, this.storeName);
|
22
32
|
console.log('user', this.customer);
|
23
33
|
}
|
24
34
|
}
|
@@ -27,14 +37,37 @@ export class CrmBonus {
|
|
27
37
|
}
|
28
38
|
this.products = JSON.parse(this.productsInString);
|
29
39
|
}
|
40
|
+
async sendPin(phone) {
|
41
|
+
var _a, _b;
|
42
|
+
this.loading = true;
|
43
|
+
this.message = "";
|
44
|
+
try {
|
45
|
+
const _phone = phone.replace(/\D/g, '');
|
46
|
+
this.phone = Number(_phone);
|
47
|
+
this.sent = await this.crmBonusService.sendPin(this.phone, this.storeName);
|
48
|
+
;
|
49
|
+
await this.crmBonusRef.setStep(StepFormEnum.STEP_PIN);
|
50
|
+
this.showModal = true;
|
51
|
+
}
|
52
|
+
catch (error) {
|
53
|
+
this.message = (_b = (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.message;
|
54
|
+
}
|
55
|
+
finally {
|
56
|
+
this.loading = false;
|
57
|
+
}
|
58
|
+
}
|
30
59
|
buildProducts() {
|
31
60
|
return this.products.map(product => ({ sku: product.SKU, value: (product.PrecoPor * product.Quantidade), variantId: product.ProdutoVarianteId, qtd: product.Quantidade }));
|
32
61
|
}
|
33
62
|
handleCloseModal() {
|
34
63
|
this.showModal = false;
|
35
64
|
}
|
65
|
+
save() {
|
66
|
+
localStorage.setItem('@BYCODERS', this.cartId);
|
67
|
+
}
|
36
68
|
render() {
|
37
|
-
return (h("div", { key: '
|
69
|
+
return (h("div", { key: '18d08a3d03ae5106cf01a426751db8300847f95c', class: "section-cart-crm" }, h("div", { key: 'dd9e939b78616cea4ea0b77ac32fe15afe63c9f9', class: "container-button" }, this.canCancel ? h("phone-cancel-input", { value: this.customer.phone, sendPin: () => { }, loading: this.loading })
|
70
|
+
: h("phone-input", { value: this.customer.phone, sendPin: (phone) => { this.sendPin(phone); }, loading: this.loading })), h("app-modal", { key: '1ea4bbfc4725c76a93f29494b1fa75a5cddc01c2', isOpen: this.showModal, modalTitle: `Giftback`, onModalClosed: () => (this.showModal = false) }, h("crm-bonus-form", { key: '791172ad0eedeb3d2a0da2e965e1298a9bc1003d', saveStore: () => this.save(), 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 }))));
|
38
71
|
}
|
39
72
|
static get is() { return "crm-bonus"; }
|
40
73
|
static get encapsulation() { return "shadow"; }
|
@@ -125,7 +158,12 @@ export class CrmBonus {
|
|
125
158
|
return {
|
126
159
|
"showModal": {},
|
127
160
|
"products": {},
|
128
|
-
"customer": {}
|
161
|
+
"customer": {},
|
162
|
+
"loading": {},
|
163
|
+
"message": {},
|
164
|
+
"phone": {},
|
165
|
+
"canCancel": {},
|
166
|
+
"sent": {}
|
129
167
|
};
|
130
168
|
}
|
131
169
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"crm-bonus.js","sourceRoot":"","sources":["../../../../src/components/crm-bonus/crm-bonus.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;
|
1
|
+
{"version":3,"file":"crm-bonus.js","sourceRoot":"","sources":["../../../../src/components/crm-bonus/crm-bonus.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAElE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAQ9C,MAAM,OAAO,QAAQ;;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;;;IAGnC,KAAK,CAAC,iBAAiB;QACrB,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,U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AAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,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,CAC9P,CACR,CACP,CAAA;IACH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["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() sent: IPinSent;\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 } 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() {\n localStorage.setItem('@BYCODERS', this.cartId)\n }\n\n render() {\n return (\n <div class=\"section-cart-crm\">\n <div class=\"container-button\">\n {/* <img src={logo} onClick={() => (this.showModal = true)} /> */}\n {\n this.canCancel ? <phone-cancel-input value={this.customer.phone} sendPin={() => { }} loading={this.loading} /> \n : <phone-input value={this.customer.phone} sendPin={(phone) => { this.sendPin(phone) }} loading={this.loading} />\n }\n \n </div>\n <app-modal\n isOpen={this.showModal}\n modalTitle={`Giftback`}\n onModalClosed={() => (this.showModal = false)}\n >\n <crm-bonus-form saveStore={() => this.save()} 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"]}
|
@@ -5,19 +5,6 @@
|
|
5
5
|
justify-content: space-around;
|
6
6
|
}
|
7
7
|
|
8
|
-
.button {
|
9
|
-
top: 50%;
|
10
|
-
background-color: #6c6c7e;
|
11
|
-
color: #fff;
|
12
|
-
border: none;
|
13
|
-
border-radius: 10px;
|
14
|
-
padding: 15px;
|
15
|
-
min-height: 30px;
|
16
|
-
min-width: 120px;
|
17
|
-
font-size: 20px;
|
18
|
-
cursor: pointer;
|
19
|
-
}
|
20
|
-
|
21
8
|
.disabled {
|
22
9
|
opacity: 0.6;
|
23
10
|
cursor: not-allowed;
|
@@ -13,31 +13,18 @@ export class CrmBonusForm {
|
|
13
13
|
document: "",
|
14
14
|
name: ""
|
15
15
|
};
|
16
|
+
this.sent = undefined;
|
17
|
+
this.stepNext = undefined;
|
18
|
+
this.phone = undefined;
|
19
|
+
this.saveStore = undefined;
|
16
20
|
this.cancel = undefined;
|
17
21
|
this.loading = false;
|
18
|
-
this.step = StepFormEnum.
|
19
|
-
this.sent = undefined;
|
22
|
+
this.step = StepFormEnum.STEP_RESERVE;
|
20
23
|
this.message = undefined;
|
21
|
-
this.phone = undefined;
|
22
24
|
this.bonus = undefined;
|
23
25
|
}
|
24
|
-
async
|
25
|
-
|
26
|
-
this.loading = true;
|
27
|
-
this.message = "";
|
28
|
-
try {
|
29
|
-
const _phone = phone.replace(/\D/g, '');
|
30
|
-
this.phone = Number(_phone);
|
31
|
-
const sent = await this.crmBonusService.sendPin(this.phone, this.storeName);
|
32
|
-
this.sent = sent;
|
33
|
-
this.step = StepFormEnum.STEP_PIN;
|
34
|
-
}
|
35
|
-
catch (error) {
|
36
|
-
this.message = (_b = (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.message;
|
37
|
-
}
|
38
|
-
finally {
|
39
|
-
this.loading = false;
|
40
|
-
}
|
26
|
+
async setStep(step) {
|
27
|
+
this.step = step;
|
41
28
|
}
|
42
29
|
async validateBonus(pin) {
|
43
30
|
var _a, _b;
|
@@ -64,17 +51,13 @@ export class CrmBonusForm {
|
|
64
51
|
}
|
65
52
|
console.log('payload', payload);
|
66
53
|
}
|
67
|
-
async
|
54
|
+
async reserveApply(amount) {
|
68
55
|
this.loading = true;
|
69
56
|
this.message = "";
|
70
57
|
try {
|
71
|
-
await this.
|
72
|
-
redeemed_bonus: amount,
|
73
|
-
cart_id: this.cartId,
|
74
|
-
ticket: this.cartId,
|
75
|
-
gross_value: this.bonus.totalValue,
|
76
|
-
}, this.storeName);
|
58
|
+
await this.reserve(amount);
|
77
59
|
this.step = StepFormEnum.STEP_APPLY;
|
60
|
+
this.saveStore();
|
78
61
|
}
|
79
62
|
catch (error) {
|
80
63
|
this.message = "ocorreu um error ao solicitar a aplicação do bonus! tente novamente";
|
@@ -83,12 +66,20 @@ export class CrmBonusForm {
|
|
83
66
|
this.loading = false;
|
84
67
|
}
|
85
68
|
}
|
69
|
+
async reserve(amount) {
|
70
|
+
await this.crmBonusService.reserve({
|
71
|
+
redeemed_bonus: amount,
|
72
|
+
cart_id: this.cartId,
|
73
|
+
ticket: this.cartId,
|
74
|
+
gross_value: this.bonus.totalValue,
|
75
|
+
}, this.storeName);
|
76
|
+
}
|
86
77
|
handleCancel() {
|
87
78
|
this.step = StepFormEnum.STEP_PHONE;
|
88
79
|
this.cancel();
|
89
80
|
}
|
90
81
|
render() {
|
91
|
-
return (h(Host, { key: '
|
82
|
+
return (h(Host, { key: '3e21a03b8cb534556026804922838f6162df9e30' }, this.step === StepFormEnum.STEP_PIN && h("giftback-pin", { key: '31b04dde37001453cbf2595505dd9c2520b2252c', cancel: () => this.handleCancel(), sent: this.sent, validate: (data) => this.validateBonus(data), loading: this.loading }), this.step === StepFormEnum.STEP_RESERVE && h("giftback-progress", { key: 'c85dbb4ac66a094d0b5a28b152104c6b202984cf', loading: this.loading, cancel: () => this.handleCancel(), bonus: this.bonus, reserve: (amountRedeemed) => this.reserveApply(amountRedeemed) }), this.step === StepFormEnum.STEP_APPLY && h("giftback-finish", { key: '4efa471bb962b48cae34b1c5ebfed518afd3ac31' }), h("p", { key: '5cce361016e738b76353e16a0d61f08b4abe22fc', class: "message-error" }, this.message)));
|
92
83
|
}
|
93
84
|
static get is() { return "crm-bonus-form"; }
|
94
85
|
static get encapsulation() { return "shadow"; }
|
@@ -185,6 +176,82 @@ export class CrmBonusForm {
|
|
185
176
|
},
|
186
177
|
"defaultValue": "{\n phone: \"\",\n birthDate: \"\",\n document: \"\",\n name: \"\"\n }"
|
187
178
|
},
|
179
|
+
"sent": {
|
180
|
+
"type": "unknown",
|
181
|
+
"mutable": false,
|
182
|
+
"complexType": {
|
183
|
+
"original": "IPinSent",
|
184
|
+
"resolved": "IPinSent",
|
185
|
+
"references": {
|
186
|
+
"IPinSent": {
|
187
|
+
"location": "import",
|
188
|
+
"path": "../../dto/pin.sent",
|
189
|
+
"id": "src/dto/pin.sent.ts::IPinSent"
|
190
|
+
}
|
191
|
+
}
|
192
|
+
},
|
193
|
+
"required": false,
|
194
|
+
"optional": false,
|
195
|
+
"docs": {
|
196
|
+
"tags": [],
|
197
|
+
"text": ""
|
198
|
+
}
|
199
|
+
},
|
200
|
+
"stepNext": {
|
201
|
+
"type": "number",
|
202
|
+
"mutable": false,
|
203
|
+
"complexType": {
|
204
|
+
"original": "StepFormEnum",
|
205
|
+
"resolved": "StepFormEnum.STEP_APPLY | StepFormEnum.STEP_PHONE | StepFormEnum.STEP_PIN | StepFormEnum.STEP_RESERVE",
|
206
|
+
"references": {
|
207
|
+
"StepFormEnum": {
|
208
|
+
"location": "import",
|
209
|
+
"path": "../../contants",
|
210
|
+
"id": "src/contants/index.ts::StepFormEnum"
|
211
|
+
}
|
212
|
+
}
|
213
|
+
},
|
214
|
+
"required": false,
|
215
|
+
"optional": false,
|
216
|
+
"docs": {
|
217
|
+
"tags": [],
|
218
|
+
"text": ""
|
219
|
+
},
|
220
|
+
"attribute": "step-next",
|
221
|
+
"reflect": false
|
222
|
+
},
|
223
|
+
"phone": {
|
224
|
+
"type": "number",
|
225
|
+
"mutable": false,
|
226
|
+
"complexType": {
|
227
|
+
"original": "number",
|
228
|
+
"resolved": "number",
|
229
|
+
"references": {}
|
230
|
+
},
|
231
|
+
"required": false,
|
232
|
+
"optional": false,
|
233
|
+
"docs": {
|
234
|
+
"tags": [],
|
235
|
+
"text": ""
|
236
|
+
},
|
237
|
+
"attribute": "phone",
|
238
|
+
"reflect": false
|
239
|
+
},
|
240
|
+
"saveStore": {
|
241
|
+
"type": "unknown",
|
242
|
+
"mutable": false,
|
243
|
+
"complexType": {
|
244
|
+
"original": "() => void",
|
245
|
+
"resolved": "() => void",
|
246
|
+
"references": {}
|
247
|
+
},
|
248
|
+
"required": false,
|
249
|
+
"optional": false,
|
250
|
+
"docs": {
|
251
|
+
"tags": [],
|
252
|
+
"text": ""
|
253
|
+
}
|
254
|
+
},
|
188
255
|
"cancel": {
|
189
256
|
"type": "unknown",
|
190
257
|
"mutable": false,
|
@@ -206,11 +273,39 @@ export class CrmBonusForm {
|
|
206
273
|
return {
|
207
274
|
"loading": {},
|
208
275
|
"step": {},
|
209
|
-
"sent": {},
|
210
276
|
"message": {},
|
211
|
-
"phone": {},
|
212
277
|
"bonus": {}
|
213
278
|
};
|
214
279
|
}
|
280
|
+
static get methods() {
|
281
|
+
return {
|
282
|
+
"setStep": {
|
283
|
+
"complexType": {
|
284
|
+
"signature": "(step: StepFormEnum) => Promise<void>",
|
285
|
+
"parameters": [{
|
286
|
+
"name": "step",
|
287
|
+
"type": "StepFormEnum",
|
288
|
+
"docs": ""
|
289
|
+
}],
|
290
|
+
"references": {
|
291
|
+
"Promise": {
|
292
|
+
"location": "global",
|
293
|
+
"id": "global::Promise"
|
294
|
+
},
|
295
|
+
"StepFormEnum": {
|
296
|
+
"location": "import",
|
297
|
+
"path": "../../contants",
|
298
|
+
"id": "src/contants/index.ts::StepFormEnum"
|
299
|
+
}
|
300
|
+
},
|
301
|
+
"return": "Promise<void>"
|
302
|
+
},
|
303
|
+
"docs": {
|
304
|
+
"text": "",
|
305
|
+
"tags": []
|
306
|
+
}
|
307
|
+
}
|
308
|
+
};
|
309
|
+
}
|
215
310
|
}
|
216
311
|
//# sourceMappingURL=crm-bonus-form.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"crm-bonus-form.js","sourceRoot":"","sources":["../../../../src/components/crm-bonus-form/crm-bonus-form.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;
|
1
|
+
{"version":3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AAM;QACF,OAAO,CACH,EAAC,IAAI;YAEA,IAAI,CAAC,IAAI,KAAK,YAAY,CAAC,QAAQ,IAAI,qEAAc,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,GAAI;YAEhL,IAAI,CAAC,IAAI,KAAK,YAAY,CAAC,YAAY,IAAI,0EAAmB,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC,cAAsB,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC,GAAI;YACrN,IAAI,CAAC,IAAI,KAAK,YAAY,CAAC,UAAU,IAAI,yEAAmB;YAC7D,0DAAG,KAAK,EAAC,eAAe,IAAE,IAAI,CAAC,OAAO,CAAK,CACxC,CACV,CAAA;IACL,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["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\n @Prop() saveStore: () => void;\n\n @Prop() cancel: () => void;\n\n @State() loading: boolean = false;\n\n @State() step: number = StepFormEnum.STEP_RESERVE;\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()\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 {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}"]}
|
package/dist/collection/components/crm-bonus-form/subcomponents/giftback-finish/giftback-finish.js
CHANGED
@@ -2,7 +2,7 @@ import { h } from "@stencil/core";
|
|
2
2
|
import success from "../../../crm-bonus/assets/svg/success-svgrepo-com.svg";
|
3
3
|
export class GiftbackFinish {
|
4
4
|
render() {
|
5
|
-
return (h("div", { key: '
|
5
|
+
return (h("div", { key: '4fd9a7731194fbe8e9dbe0e2fc9d4241f0baf733', class: "message-finish" }, h("img", { key: 'ba423d92f1672f14be34334fd0495f38f1f70f4a', src: success, width: 80 }), h("p", { key: '75d6b9648c1357ced70ad43cb94091da73224179' }, "Legal! O B\u00F4nus ser\u00E1 aplicado na sua compra.")));
|
6
6
|
}
|
7
7
|
static get is() { return "giftback-finish"; }
|
8
8
|
static get encapsulation() { return "shadow"; }
|
package/dist/collection/components/crm-bonus-form/subcomponents/giftback-pin/giftback-pin.js
CHANGED
@@ -30,7 +30,7 @@ export class GiftbackPin {
|
|
30
30
|
}
|
31
31
|
}
|
32
32
|
render() {
|
33
|
-
return (h("div", { key: '
|
33
|
+
return (h("div", { key: 'eb95118bcc7de8cf50c3ffa97656e5635a9b72de', class: "form-container-pin" }, h("div", { key: 'cc149d68ccf12e688fe477079c15931ce0ea6536' }, h("p", { key: 'fbcbb77d526981fca9129e2a1acbc55eba5c9d33' }, "Insira o PIN de 4 d\u00EDgitos enviado por SMS."), h("div", { key: 'ac9887bbc7ef732fd95c890b459b8962652c6fef', class: "pin-container" }, this.pin.map((_, index) => (h("input", { type: "text", maxLength: 1, value: this.pin[index], onInput: (event) => this.handleInput(event, index) }))))), h("div", { key: 'ca835c16a8aa1177c80cc37f43faaa2f1a7af025', class: "footer-button" }, h("button", { key: '6eabe644de6085a1780bec151503c09aa123e459', class: "button-cancel", disabled: this.loading, onClick: () => this.cancel() }, "Cancelar"), h("button", { key: '2b6dd05d209e86ce5dc0d1113b38b16d541e107f', class: `button ${this.loading ? 'disabled' : ''} `, disabled: this.loading, onClick: () => this.validatePin() }, !this.loading ? "Enviar" : h("loading-spinner", { size: "15px", color: "#fff" })))));
|
34
34
|
}
|
35
35
|
static get is() { return "giftback-pin"; }
|
36
36
|
static get encapsulation() { return "shadow"; }
|
@@ -21,12 +21,12 @@ export class GiftbackProgress {
|
|
21
21
|
const input = event.target;
|
22
22
|
this.usedValue = parseFloat(input.value);
|
23
23
|
}
|
24
|
-
async handleReserve() {
|
25
|
-
this.reserve(
|
24
|
+
async handleReserve(value) {
|
25
|
+
this.reserve(value);
|
26
26
|
}
|
27
27
|
render() {
|
28
28
|
const remainingGiftback = this.bonus.minimumPurchase - this.bonus.totalValue;
|
29
|
-
return (h("div", { key: '
|
29
|
+
return (h("div", { key: 'e6f36ce0f31f70d5402cf89f20b54b7d4f4de7f6', class: "giftback-container" }, h("p", { key: '6075406b5eaefb21357161f6980bf6a0e709b98c' }, "Voc\u00EA possui at\u00E9 ", h("strong", { key: 'f80192384fe4b189469fb7ee16de266270a8e30c' }, "R$ ", this.bonus.totalBonus.toFixed(2)), " de Giftback nessa compra!"), h("p", { key: '453c0a71fe2f8cb2ebf9a6e6b8b55397ee3a9d5b', class: "validity" }, "V\u00E1lido at\u00E9: ", new Date(this.bonus.firstValidityDate).toLocaleDateString('pt-Br')), h("p", { key: 'ae7d8bbdb67801ff3b336ce9bcafb381a52c41e1' }, "Voc\u00EA est\u00E1 utilizando ", h("strong", { key: '7aa9370121720872deddd9596edbf841ccb4119b' }, "R$ ", this.usedValue.toFixed(2)), " nessa compra"), h("div", { key: '010aac89dd4192cc992d342fc334f6719620663e', class: "progress-container" }, h("span", { key: 'b2d0ee511ef6e32cdefeadcb0d740682c6da5124' }, "R$ 0"), h("input", { key: '3b659919ff940fa353c819fbc395c5fd15ad386b', disabled: true, type: "range", min: "0", step: "0.01", max: this.bonus.totalBonus, value: this.usedValue, onInput: (event) => this.handleSliderChange(event) }), h("span", { key: '60e99bf9891b4172f68f8abfbcdf18175a0cc6b0' }, "R$ ", this.bonus.totalBonus.toFixed(2))), h("p", { key: '07d1bd092cf438bb2e6b1ca0838d4215e73c4ef0', class: "remaining" }, "Faltam ", h("strong", { key: '180966167d48f8ea247ea785a4d35d37c6b5944b' }, "R$ ", remainingGiftback > 0 ? remainingGiftback.toFixed(2) : Number(0).toFixed(2)), " para utilizar o valor total do Giftback."), h("div", { key: '277aed85f840f66a517fa23849dadacddda43f5a', class: "footer-button-giftback" }, h("button", { key: '30c0779c496b54b86e0c4025528aa1e348f69c1c', class: "button-cancel", disabled: this.loading, onClick: () => this.cancel() }, "Cancelar"), h("button", { key: 'ec7e9d6982c5910b8c6fc9fef7310072a07d00c1', class: `button ${this.loading ? 'disabled' : ''} `, disabled: this.loading, onClick: () => this.handleReserve(this.usedValue) }, !this.loading ? "Aplicar" : h("loading-spinner", { size: "10px", color: "#fff" })))));
|
30
30
|
}
|
31
31
|
static get is() { return "giftback-progress"; }
|
32
32
|
static get encapsulation() { return "shadow"; }
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"giftback-progress.js","sourceRoot":"","sources":["../../../../../../src/components/crm-bonus-form/subcomponents/giftback-progress/giftback-progress.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAQ1D,MAAM,OAAO,gBAAgB;;yBACI,CAAC;uBAEH,KAAK;qBAEC;YAC7B,UAAU,EAAE,CAAC;YACb,MAAM,EAAE,EAAE;YACV,eAAe,EAAE,CAAC;YAClB,YAAY,EAAE,CAAC;YACf,eAAe,EAAE,CAAC;YAClB,iBAAiB,EAAE,EAAE;SACxB;;;;IAKD,iBAAiB;QACb,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC,CAAC;IACpE,CAAC;IAED,kBAAkB,CAAC,KAAY;QAC3B,MAAM,KAAK,GAAG,KAAK,CAAC,MAA0B,CAAC;QAC/C,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,aAAa;
|
1
|
+
{"version":3,"file":"giftback-progress.js","sourceRoot":"","sources":["../../../../../../src/components/crm-bonus-form/subcomponents/giftback-progress/giftback-progress.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAQ1D,MAAM,OAAO,gBAAgB;;yBACI,CAAC;uBAEH,KAAK;qBAEC;YAC7B,UAAU,EAAE,CAAC;YACb,MAAM,EAAE,EAAE;YACV,eAAe,EAAE,CAAC;YAClB,YAAY,EAAE,CAAC;YACf,eAAe,EAAE,CAAC;YAClB,iBAAiB,EAAE,EAAE;SACxB;;;;IAKD,iBAAiB;QACb,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC,CAAC;IACpE,CAAC;IAED,kBAAkB,CAAC,KAAY;QAC3B,MAAM,KAAK,GAAG,KAAK,CAAC,MAA0B,CAAC;QAC/C,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,KAAa;QAC7B,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACxB,CAAC;I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AI,CAAC,MAAM,EAAE,eAEzE;gBAET,+DAAQ,KAAK,EAAE,UAAU,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,IAE7H,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,uBAAiB,IAAI,EAAC,MAAM,EAAC,KAAK,EAAC,MAAM,GAAG,CAEvE,CACP,CACJ,CACT,CAAC;IACN,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import { Component, h, State, Prop } from '@stencil/core';\nimport { IBonus } from '../../../../dto/validate.pin.bonus';\n\n@Component({\n tag: 'giftback-progress',\n styleUrl: 'giftback-progress.css',\n shadow: true,\n})\nexport class GiftbackProgress {\n @State() usedValue: number = 0;\n\n @Prop() loading: boolean = false;\n\n @Prop() bonus: Partial<IBonus> = {\n totalBonus: 0,\n cartId: \"\",\n minimumPurchase: 0,\n bonusBalance: 0,\n calculatedValue: 0,\n firstValidityDate: \"\"\n };\n\n @Prop() reserve: (amountRedeemed: number) => void;\n @Prop() cancel: () => void;\n\n componentWillLoad() {\n this.usedValue = parseFloat(this.bonus.bonusBalance.toString());\n }\n\n handleSliderChange(event: Event) {\n const input = event.target as HTMLInputElement;\n this.usedValue = parseFloat(input.value);\n }\n\n async handleReserve(value: number) {\n this.reserve(value);\n }\n\n render() {\n const remainingGiftback = this.bonus.minimumPurchase - this.bonus.totalValue;\n\n return (\n <div class=\"giftback-container\">\n <p>\n Você possui até <strong>R$ {this.bonus.totalBonus.toFixed(2)}</strong> de Giftback nessa compra!\n </p>\n <p class=\"validity\">Válido até: {new Date(this.bonus.firstValidityDate).toLocaleDateString('pt-Br')}</p>\n\n <p>Você está utilizando <strong>R$ {this.usedValue.toFixed(2)}</strong> nessa compra</p>\n\n <div class=\"progress-container\">\n <span>R$ 0</span>\n <input\n disabled\n type=\"range\"\n min=\"0\"\n step=\"0.01\"\n max={this.bonus.totalBonus}\n value={this.usedValue}\n onInput={(event) => this.handleSliderChange(event)}\n />\n <span>R$ {this.bonus.totalBonus.toFixed(2)}</span>\n </div>\n\n <p class=\"remaining\">\n Faltam <strong>R$ {remainingGiftback > 0 ? remainingGiftback.toFixed(2) : Number(0).toFixed(2)}</strong> para utilizar o valor total do Giftback.\n </p>\n\n <div class=\"footer-button-giftback\">\n\n <button class=\"button-cancel\" disabled={this.loading} onClick={() => this.cancel()} >\n Cancelar\n </button>\n\n <button class={`button ${this.loading ? 'disabled' : ''} `} disabled={this.loading} onClick={() => this.handleReserve(this.usedValue)}>\n {\n !this.loading ? \"Aplicar\" : <loading-spinner size=\"10px\" color=\"#fff\" />\n }\n </button>\n </div>\n </div>\n );\n }\n}\n"]}
|
@@ -10,7 +10,7 @@ export class PhoneInput {
|
|
10
10
|
await this.sendPin(phone);
|
11
11
|
}
|
12
12
|
render() {
|
13
|
-
return (h("div", { key: '
|
13
|
+
return (h("div", { key: 'f24f14d158d9565b17aa024837d4e62e6b64c7a3', class: "form-container" }, h("phone-input-mask", { key: '88bf98c7f35b4a4211354a826fa16c922838d228', initialValue: this.value, ref: ref => this.phoneInputMask = ref }), h("button", { key: 'e822c98fb3a1c347f6d97a3008837ac79d55569f', class: `btn ${this.loading ? 'disabled' : ''} `, disabled: this.loading, onClick: () => this.validatePhone() }, !this.loading ? "validar" : h("loading-spinner", { size: "25px", color: "#fff" }))));
|
14
14
|
}
|
15
15
|
static get is() { return "phone-input"; }
|
16
16
|
static get properties() {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"phone.input.js","sourceRoot":"","sources":["../../../../../../src/components/crm-bonus-form/subcomponents/phone/phone.input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAKnD,MAAM,OAAO,UAAU;;;;;;IAQnB,KAAK,CAAC,aAAa;QACf,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;QACnD,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IAED,MAAM;QACF,OAAO,CACH,4DAAK,KAAK,EAAC,gBAAgB;YACvB,yEAAkB,YAAY,EAAE,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,cAAc,GAAG,GAAG,GAAI;YACrF,+DAAQ,KAAK,EAAE,
|
1
|
+
{"version":3,"file":"phone.input.js","sourceRoot":"","sources":["../../../../../../src/components/crm-bonus-form/subcomponents/phone/phone.input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAKnD,MAAM,OAAO,UAAU;;;;;;IAQnB,KAAK,CAAC,aAAa;QACf,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;QACnD,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IAED,MAAM;QACF,OAAO,CACH,4DAAK,KAAK,EAAC,gBAAgB;YACvB,yEAAkB,YAAY,EAAE,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,cAAc,GAAG,GAAG,GAAI;YACrF,+DAAQ,KAAK,EAAE,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE,IAE5G,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,uBAAiB,IAAI,EAAC,MAAM,EAAC,KAAK,EAAC,MAAM,GAAG,CAEvE,CACP,CACT,CAAA;IACL,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["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 ${this.loading ? 'disabled' : ''} `} disabled={this.loading} onClick={() => this.validatePhone()}>\n {\n !this.loading ? \"validar\" : <loading-spinner size=\"25px\" color=\"#fff\" />\n }\n </button>\n </div>\n )\n }\n}"]}
|