crmbonus-component-wake 0.0.18 → 0.0.20
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/app-globals-3a1e7e63.js +7 -0
- package/dist/cjs/app-globals-3a1e7e63.js.map +1 -0
- package/dist/cjs/app-modal_2.cjs.entry.js +127 -0
- package/dist/cjs/app-modal_2.cjs.entry.js.map +1 -0
- package/dist/cjs/crm-bonus.cjs.entry.js +46 -0
- package/dist/cjs/crm-bonus.cjs.entry.js.map +1 -0
- package/dist/cjs/crmbonus-component-wake.cjs.js +27 -0
- package/dist/cjs/crmbonus-component-wake.cjs.js.map +1 -0
- package/dist/cjs/crmbonus.service-a626c034.js +3795 -0
- package/dist/cjs/crmbonus.service-a626c034.js.map +1 -0
- package/dist/cjs/giftback-finish_5.cjs.entry.js +153 -0
- package/dist/cjs/giftback-finish_5.cjs.entry.js.map +1 -0
- package/dist/cjs/index-52d8a075.js +1248 -0
- package/dist/cjs/index-52d8a075.js.map +1 -0
- package/dist/cjs/index.cjs.js +11 -0
- package/dist/cjs/index.cjs.js.map +1 -0
- package/dist/cjs/loader.cjs.js +17 -0
- package/dist/cjs/loader.cjs.js.map +1 -0
- package/dist/cjs/loading-spinner.cjs.entry.js +24 -0
- package/dist/cjs/loading-spinner.cjs.entry.js.map +1 -0
- package/dist/cjs/pedido-finalizado.cjs.entry.js +28 -0
- package/dist/cjs/pedido-finalizado.cjs.entry.js.map +1 -0
- package/dist/collection/collection-manifest.json +21 -0
- package/dist/collection/components/crm-bonus/assets/logo.svg +18 -0
- package/dist/collection/components/crm-bonus/assets/success-svgrepo-com.svg +8 -0
- package/dist/collection/components/crm-bonus/assets/svg/logo.svg +18 -0
- package/dist/collection/components/crm-bonus/assets/svg/success-svgrepo-com.svg +8 -0
- package/dist/collection/components/crm-bonus/crm-bonus.css +20 -0
- package/dist/collection/components/crm-bonus/crm-bonus.js +123 -0
- package/dist/collection/components/crm-bonus/crm-bonus.js.map +1 -0
- package/dist/collection/components/crm-bonus-form/crm-bonus-form.css +32 -0
- package/dist/collection/components/crm-bonus-form/crm-bonus-form.js +194 -0
- package/dist/collection/components/crm-bonus-form/crm-bonus-form.js.map +1 -0
- package/dist/collection/components/crm-bonus-form/subcomponents/giftback-finish/giftback-finish.css +10 -0
- package/dist/collection/components/crm-bonus-form/subcomponents/giftback-finish/giftback-finish.js +20 -0
- package/dist/collection/components/crm-bonus-form/subcomponents/giftback-finish/giftback-finish.js.map +1 -0
- package/dist/collection/components/crm-bonus-form/subcomponents/giftback-pin/giftback-pin.css +54 -0
- package/dist/collection/components/crm-bonus-form/subcomponents/giftback-pin/giftback-pin.js +111 -0
- package/dist/collection/components/crm-bonus-form/subcomponents/giftback-pin/giftback-pin.js.map +1 -0
- package/dist/collection/components/crm-bonus-form/subcomponents/giftback-progress/giftback-progress.css +95 -0
- package/dist/collection/components/crm-bonus-form/subcomponents/giftback-progress/giftback-progress.js +111 -0
- package/dist/collection/components/crm-bonus-form/subcomponents/giftback-progress/giftback-progress.js.map +1 -0
- package/dist/collection/components/crm-bonus-form/subcomponents/phone/phone.input.js +75 -0
- package/dist/collection/components/crm-bonus-form/subcomponents/phone/phone.input.js.map +1 -0
- package/dist/collection/components/loading-spinner/loading-spinner.css +17 -0
- package/dist/collection/components/loading-spinner/loading-spinner.js +63 -0
- package/dist/collection/components/loading-spinner/loading-spinner.js.map +1 -0
- package/dist/collection/components/modal/app-modal.css +45 -0
- package/dist/collection/components/modal/app-modal.js +83 -0
- package/dist/collection/components/modal/app-modal.js.map +1 -0
- package/dist/collection/components/pedido/pedido.js +58 -0
- package/dist/collection/components/pedido/pedido.js.map +1 -0
- package/dist/collection/components/phone/phone-input-mask.css +47 -0
- package/dist/collection/components/phone/phone-input-mask.js +90 -0
- package/dist/collection/components/phone/phone-input-mask.js.map +1 -0
- package/dist/collection/contants/index.js +8 -0
- package/dist/collection/contants/index.js.map +1 -0
- package/dist/collection/contants/mocks.js +28 -0
- package/dist/collection/contants/mocks.js.map +1 -0
- package/dist/collection/dto/pin.sent.js +2 -0
- package/dist/collection/dto/pin.sent.js.map +1 -0
- package/dist/collection/dto/validate.pin.bonus.js +2 -0
- package/dist/collection/dto/validate.pin.bonus.js.map +1 -0
- package/dist/collection/index.js +11 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/collection/services/crmbonus.service.js +39 -0
- package/dist/collection/services/crmbonus.service.js.map +1 -0
- package/dist/collection/utils/utils.js +4 -0
- package/dist/collection/utils/utils.js.map +1 -0
- package/dist/components/app-modal.js +8 -0
- package/dist/components/app-modal.js.map +1 -0
- package/dist/components/crm-bonus-form.js +8 -0
- package/dist/components/crm-bonus-form.js.map +1 -0
- package/dist/components/crm-bonus.js +117 -0
- package/dist/components/crm-bonus.js.map +1 -0
- package/dist/components/giftback-finish.js +8 -0
- package/dist/components/giftback-finish.js.map +1 -0
- package/dist/components/giftback-pin.js +8 -0
- package/dist/components/giftback-pin.js.map +1 -0
- package/dist/components/giftback-progress.js +8 -0
- package/dist/components/giftback-progress.js.map +1 -0
- package/dist/components/index.js +9 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/loading-spinner.js +8 -0
- package/dist/components/loading-spinner.js.map +1 -0
- package/dist/components/p-17ee9996.js +52 -0
- package/dist/components/p-17ee9996.js.map +1 -0
- package/dist/{crmbonus-component-wake/phone-input-mask.entry.js → components/p-2dbfb2c7.js} +29 -8
- package/dist/components/p-2dbfb2c7.js.map +1 -0
- package/dist/components/p-563ea4c5.js +166 -0
- package/dist/components/p-563ea4c5.js.map +1 -0
- package/dist/{crmbonus-component-wake/crmbonus.service-ce105f62.js → components/p-629fcb5b.js} +90 -165
- package/dist/components/p-629fcb5b.js.map +1 -0
- package/dist/{crmbonus-component-wake/giftback-finish.entry.js → components/p-7294e43f.js} +25 -8
- package/dist/components/p-7294e43f.js.map +1 -0
- package/dist/components/p-78529eea.js +39 -0
- package/dist/components/p-78529eea.js.map +1 -0
- package/dist/{crmbonus-component-wake/app-modal.entry.js → components/p-8e0ed8dd.js} +28 -8
- package/dist/components/p-8e0ed8dd.js.map +1 -0
- package/dist/{crmbonus-component-wake/giftback-pin.entry.js → components/p-a1781d03.js} +37 -8
- package/dist/components/p-a1781d03.js.map +1 -0
- package/dist/{crmbonus-component-wake/giftback-progress.entry.js → components/p-a88bc337.js} +36 -8
- package/dist/components/p-a88bc337.js.map +1 -0
- package/dist/components/p-faf7103e.js +1064 -0
- package/dist/components/p-faf7103e.js.map +1 -0
- package/dist/components/pedido-finalizado.js +45 -0
- package/dist/components/pedido-finalizado.js.map +1 -0
- package/dist/components/phone-input-mask.js +8 -0
- package/dist/components/phone-input-mask.js.map +1 -0
- package/dist/components/phone-input.js +8 -0
- package/dist/components/phone-input.js.map +1 -0
- package/dist/crmbonus-component-wake/crmbonus-component-wake.esm.js +1 -48
- package/dist/crmbonus-component-wake/crmbonus-component-wake.esm.js.map +1 -1
- package/dist/crmbonus-component-wake/index.esm.js +1 -16
- package/dist/crmbonus-component-wake/index.esm.js.map +1 -1
- package/dist/crmbonus-component-wake/p-54e51298.entry.js +2 -0
- package/dist/crmbonus-component-wake/p-54e51298.entry.js.map +1 -0
- package/dist/crmbonus-component-wake/p-629fcb5b.js +2 -0
- package/dist/crmbonus-component-wake/p-629fcb5b.js.map +1 -0
- package/dist/crmbonus-component-wake/p-6b075110.entry.js +2 -0
- package/dist/crmbonus-component-wake/p-6b075110.entry.js.map +1 -0
- package/dist/crmbonus-component-wake/p-72510682.js +3 -0
- package/dist/crmbonus-component-wake/p-72510682.js.map +1 -0
- package/dist/crmbonus-component-wake/p-ba53f0f3.entry.js +2 -0
- package/dist/crmbonus-component-wake/p-ba53f0f3.entry.js.map +1 -0
- package/dist/crmbonus-component-wake/p-bf4b486e.entry.js +2 -0
- package/dist/crmbonus-component-wake/p-bf4b486e.entry.js.map +1 -0
- package/dist/crmbonus-component-wake/p-e1255160.js +2 -0
- package/dist/crmbonus-component-wake/p-e1255160.js.map +1 -0
- package/dist/crmbonus-component-wake/p-f0d68c31.entry.js +2 -0
- package/dist/crmbonus-component-wake/p-f0d68c31.entry.js.map +1 -0
- package/dist/env.js +5 -0
- package/dist/env.js.map +1 -0
- package/dist/{crmbonus-component-wake/crm-bonus-form.entry.js → esm/app-modal_2.entry.js} +25 -5
- package/dist/esm/app-modal_2.entry.js.map +1 -0
- package/dist/{crmbonus-component-wake → esm}/crm-bonus.entry.js +5 -4
- package/dist/esm/crm-bonus.entry.js.map +1 -0
- package/dist/esm/crmbonus-component-wake.js +22 -0
- package/dist/esm/crmbonus-component-wake.js.map +1 -0
- package/dist/esm/crmbonus.service-83f67708.js +3793 -0
- package/dist/esm/crmbonus.service-83f67708.js.map +1 -0
- package/dist/esm/giftback-finish_5.entry.js +145 -0
- package/dist/esm/giftback-finish_5.entry.js.map +1 -0
- package/dist/esm/index-9f7bde48.js +1220 -0
- package/dist/esm/index-9f7bde48.js.map +1 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/loader.js +13 -0
- package/dist/esm/loader.js.map +1 -0
- package/dist/{crmbonus-component-wake → esm}/loading-spinner.entry.js +3 -2
- package/dist/esm/loading-spinner.entry.js.map +1 -0
- package/dist/{crmbonus-component-wake → esm}/pedido-finalizado.entry.js +2 -2
- package/dist/esm/pedido-finalizado.entry.js.map +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
- package/dist/crmbonus-component-wake/app-modal.entry.js.map +0 -1
- package/dist/crmbonus-component-wake/crm-bonus-form.entry.js.map +0 -1
- package/dist/crmbonus-component-wake/crm-bonus.entry.js.map +0 -1
- package/dist/crmbonus-component-wake/crmbonus.service-ce105f62.js.map +0 -1
- package/dist/crmbonus-component-wake/giftback-finish.entry.js.map +0 -1
- package/dist/crmbonus-component-wake/giftback-pin.entry.js.map +0 -1
- package/dist/crmbonus-component-wake/giftback-progress.entry.js.map +0 -1
- package/dist/crmbonus-component-wake/index-f557ce7c.js +0 -3039
- package/dist/crmbonus-component-wake/index-f557ce7c.js.map +0 -1
- package/dist/crmbonus-component-wake/loading-spinner.entry.js.map +0 -1
- package/dist/crmbonus-component-wake/pedido-finalizado.entry.js.map +0 -1
- package/dist/crmbonus-component-wake/phone-input-mask.entry.js.map +0 -1
- package/dist/crmbonus-component-wake/phone-input.entry.js +0 -21
- package/dist/crmbonus-component-wake/phone-input.entry.js.map +0 -1
- package/dist/crmbonus-component-wake/shadow-css-7ad5caf8.js +0 -334
- package/dist/crmbonus-component-wake/shadow-css-7ad5caf8.js.map +0 -1
- /package/dist/{crmbonus-component-wake → esm}/app-globals-0f993ce5.js +0 -0
- /package/dist/{crmbonus-component-wake → esm}/app-globals-0f993ce5.js.map +0 -0
@@ -0,0 +1,153 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
4
|
+
|
5
|
+
const index = require('./index-52d8a075.js');
|
6
|
+
|
7
|
+
const successSvgrepoComSvg = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pg0KPCEtLSBVcGxvYWRlZCB0bzogU1ZHIFJlcG8sIHd3dy5zdmdyZXBvLmNvbSwgR2VuZXJhdG9yOiBTVkcgUmVwbyBNaXhlciBUb29scyAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiANCgkgdmlld0JveD0iMCAwIDUwIDUwIiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxjaXJjbGUgc3R5bGU9ImZpbGw6IzI1QUU4ODsiIGN4PSIyNSIgY3k9IjI1IiByPSIyNSIvPg0KPHBvbHlsaW5lIHN0eWxlPSJmaWxsOm5vbmU7c3Ryb2tlOiNGRkZGRkY7c3Ryb2tlLXdpZHRoOjI7c3Ryb2tlLWxpbmVjYXA6cm91bmQ7c3Ryb2tlLWxpbmVqb2luOnJvdW5kO3N0cm9rZS1taXRlcmxpbWl0OjEwOyIgcG9pbnRzPSINCgkzOCwxNSAyMiwzMyAxMiwyNSAiLz4NCjwvc3ZnPg==';
|
8
|
+
|
9
|
+
const giftbackFinishCss = ".message-finish{align-content:center;text-align:center}.message-finish p{color:#777676;font-size:xx-large;font-family:sans-serif}";
|
10
|
+
const GiftbackFinishStyle0 = giftbackFinishCss;
|
11
|
+
|
12
|
+
const GiftbackFinish = class {
|
13
|
+
constructor(hostRef) {
|
14
|
+
index.registerInstance(this, hostRef);
|
15
|
+
}
|
16
|
+
render() {
|
17
|
+
return (index.h("div", { key: 'e72f82799146a6e94acbdd62324e07cdf9f77009', class: "message-finish" }, index.h("img", { key: '46e2436a3dbe4745225c3b9674e6bf6c299ad63e', src: successSvgrepoComSvg, width: 80 }), index.h("p", { key: '270e42050956f7f3d1ae9b90f314211fa310f797' }, "B\u00F4nus Aplicado com sucesso!!!")));
|
18
|
+
}
|
19
|
+
};
|
20
|
+
GiftbackFinish.style = GiftbackFinishStyle0;
|
21
|
+
|
22
|
+
const giftbackPinCss = ":host{display:block;font-family:Arial, sans-serif}.form-container-pin{display:flex;justify-content:space-around}.pin-container{display:flex;gap:10px;margin:10px 0}input{width:40px;height:40px;font-size:18px;text-align:center;border:1px solid #ccc;border-radius:5px}button{padding:10px 20px;background-color:#ddd;border:none;border-radius:5px;cursor:pointer}button:hover{background-color:#bbb}.success{color:green;margin-top:10px}.button{top:50%;background-color:#6c6c7e;color:#fff;border:none;border-radius:10px;padding:15px;min-height:30px;min-width:120px;font-size:20px;cursor:pointer}";
|
23
|
+
const GiftbackPinStyle0 = giftbackPinCss;
|
24
|
+
|
25
|
+
const GiftbackPin = class {
|
26
|
+
constructor(hostRef) {
|
27
|
+
index.registerInstance(this, hostRef);
|
28
|
+
this.sent = undefined;
|
29
|
+
this.validate = undefined;
|
30
|
+
this.pin = ['', '', '', ''];
|
31
|
+
this.isVerified = false;
|
32
|
+
this.loading = false;
|
33
|
+
}
|
34
|
+
handleInput(event, index) {
|
35
|
+
const input = event.target;
|
36
|
+
const value = input.value.slice(0, 1); // Limitar a um único dígito
|
37
|
+
this.pin[index] = value;
|
38
|
+
// Focar no próximo campo, se possível
|
39
|
+
if (value && index < this.pin.length - 1) {
|
40
|
+
const nextInput = input.nextElementSibling;
|
41
|
+
nextInput === null || nextInput === void 0 ? void 0 : nextInput.focus();
|
42
|
+
}
|
43
|
+
this.pin = [...this.pin];
|
44
|
+
}
|
45
|
+
validatePin() {
|
46
|
+
console.log('this.pin', this.pin);
|
47
|
+
this.validate(this.pin.join(""));
|
48
|
+
}
|
49
|
+
verifyPin() {
|
50
|
+
const pinCode = this.pin.join('');
|
51
|
+
if (pinCode === '9999') {
|
52
|
+
this.isVerified = true;
|
53
|
+
}
|
54
|
+
}
|
55
|
+
render() {
|
56
|
+
return (index.h("div", { key: 'fb696be7cae1986e09ac4bce2dba643353cec273', class: "form-container-pin" }, index.h("div", { key: '6daab87b9f214ee32be1e95e5570325dfb1b5317' }, index.h("p", { key: '92e8857410286b5f11152eaddd55cbffaa9af347' }, "Insira o PIN de 4 d\u00EDgitos enviado por SMS."), index.h("div", { key: '2ab858fc62bdae300a90f0d695d01a17159c16db', class: "pin-container" }, this.pin.map((_, index$1) => (index.h("input", { type: "text", maxLength: 1, value: this.pin[index$1], onInput: (event) => this.handleInput(event, index$1) }))))), index.h("button", { key: '1d04d747cf6a3b7db59a9560224b8c49b54d48c7', class: `button ${this.loading ? 'disabled' : ''} `, disabled: this.loading, onClick: () => this.validatePin() }, !this.loading ? "Enviar" : index.h("loading-spinner", { size: "15px", color: "#fff" }))));
|
57
|
+
}
|
58
|
+
};
|
59
|
+
GiftbackPin.style = GiftbackPinStyle0;
|
60
|
+
|
61
|
+
const giftbackProgressCss = ":host{display:flex;font-family:Arial, sans-serif;border-radius:10px;padding:16px;max-width:100%;flex-direction:column}.giftback-container{display:flex;flex-direction:column}.giftback-container p{font-size:medium}h3{margin:0 0 10px;font-size:18px}p{margin:5px 0;font-size:14px}.validity{font-size:12px;color:#888}.progress-container{display:flex;align-items:center;margin:10px 0}progress-container span{font-size:12px;color:#666}input[type='range']{flex:1;margin:0 10px;appearance:none;background-color:#ccc;height:6px;border-radius:3px;outline:none;cursor:pointer}input[type='range']::-webkit-slider-thumb{appearance:none;width:14px;height:14px;border-radius:50%;background-color:#555;cursor:pointer}.remaining{font-weight:bold;font-size:14px;color:#333}.button{top:50%;background-color:#6c6c7e;color:#fff;border:none;border-radius:10px;padding:10px;min-height:30px;min-width:120px;font-size:19px;cursor:pointer}.disabled{opacity:0.6;cursor:not-allowed}.footer-button-giftback{display:flex;justify-content:end;margin-top:14px}";
|
62
|
+
const GiftbackProgressStyle0 = giftbackProgressCss;
|
63
|
+
|
64
|
+
const GiftbackProgress = class {
|
65
|
+
constructor(hostRef) {
|
66
|
+
index.registerInstance(this, hostRef);
|
67
|
+
this.usedValue = 0;
|
68
|
+
this.loading = false;
|
69
|
+
this.bonus = {
|
70
|
+
totalBonus: 0,
|
71
|
+
cartId: "",
|
72
|
+
minimumPurchase: 0,
|
73
|
+
bonusBalance: 0,
|
74
|
+
calculatedValue: 0,
|
75
|
+
firstValidityDate: ""
|
76
|
+
};
|
77
|
+
this.reserve = undefined;
|
78
|
+
}
|
79
|
+
componentWillLoad() {
|
80
|
+
this.usedValue = parseFloat(this.bonus.bonusBalance.toString());
|
81
|
+
}
|
82
|
+
handleSliderChange(event) {
|
83
|
+
const input = event.target;
|
84
|
+
this.usedValue = parseFloat(input.value);
|
85
|
+
}
|
86
|
+
async handleReserve() {
|
87
|
+
this.reserve(this.usedValue);
|
88
|
+
}
|
89
|
+
render() {
|
90
|
+
const remainingGiftback = this.bonus.minimumPurchase - this.bonus.totalValue;
|
91
|
+
return (index.h("div", { key: '2776b6595fb2327040dd6367b3a449e548c61071', class: "giftback-container" }, index.h("p", { key: '4c372a1651a1c47301114eac800ed6b0b4468253' }, "Voc\u00EA possui at\u00E9 ", index.h("strong", { key: 'dbc855a1f69a7f361b669641a3107845a5eb6c90' }, "R$ ", this.bonus.totalBonus.toFixed(2)), " de Giftback nessa compra!"), index.h("p", { key: '6cbb90dffbc56eb2154c994535560b806d098357', class: "validity" }, "V\u00E1lido at\u00E9: ", this.bonus.firstValidityDate), index.h("p", { key: '8627a67e6c50117b11338243b3a75877be933c93' }, "Voc\u00EA est\u00E1 utilizando ", index.h("strong", { key: '5f33968f5093f8fa4bd3356edaeedd5615e1f8ed' }, "R$ ", this.usedValue.toFixed(2)), " nessa compra"), index.h("div", { key: '7a0f8ba1f90dc90b63165711ede6ff5b2675cd2a', class: "progress-container" }, index.h("span", { key: '5ff34809c9bf65da14da6c2d517469f369f9f229' }, "R$ 0"), index.h("input", { key: '9e6dd1ebc75af146a9c4b3ecb14fdd0b735a2aaf', disabled: true, type: "range", min: "0", step: "0.01", max: this.bonus.totalBonus, value: this.usedValue, onInput: (event) => this.handleSliderChange(event) }), index.h("span", { key: 'fbec542c319bbe4fbfe949634afadbf8a0767549' }, "R$ ", this.bonus.totalBonus.toFixed(2))), index.h("p", { key: '89674dea3607e2e3af91a5cb82f5fa85666477f3', class: "remaining" }, "Faltam ", index.h("strong", { key: '96609b76717648932e71f56d3fbaa30a1cd9c742' }, "R$ ", remainingGiftback > 0 ? remainingGiftback.toFixed(2) : Number(0).toFixed(2)), " para utilizar o valor total do Giftback."), index.h("div", { key: 'a0b45a1749e930c057aff3025fbff3cad23023fb', class: "footer-button-giftback" }, index.h("button", { key: 'c8d54cadf35b81e284b5ec052849c3e3b8c13a55', class: `button ${this.loading ? 'disabled' : ''} `, disabled: this.loading, onClick: () => this.handleReserve() }, !this.loading ? "Aplicar" : index.h("loading-spinner", { size: "10px", color: "#fff" })))));
|
92
|
+
}
|
93
|
+
};
|
94
|
+
GiftbackProgress.style = GiftbackProgressStyle0;
|
95
|
+
|
96
|
+
const PhoneInput = class {
|
97
|
+
constructor(hostRef) {
|
98
|
+
index.registerInstance(this, hostRef);
|
99
|
+
this.sendPin = undefined;
|
100
|
+
this.loading = undefined;
|
101
|
+
this.value = undefined;
|
102
|
+
}
|
103
|
+
async validatePhone() {
|
104
|
+
const phone = await this.phoneInputMask.getPhone();
|
105
|
+
await this.sendPin(phone);
|
106
|
+
}
|
107
|
+
render() {
|
108
|
+
return (index.h("div", { key: 'e61b8c94eadb746b3bb163b58f2eb0d6edb5da2b', class: "form-container" }, index.h("phone-input-mask", { key: 'bdbf45fc9484c60d0178b3ced6194e8f2b7622a5', initialValue: this.value, ref: ref => this.phoneInputMask = ref }), index.h("button", { key: '757ab72b47a673bcd27236ef9a50b201a6e75477', class: `button ${this.loading ? 'disabled' : ''} `, disabled: this.loading, onClick: () => this.validatePhone() }, !this.loading ? "validar" : index.h("loading-spinner", { size: "25px", color: "#fff" }))));
|
109
|
+
}
|
110
|
+
};
|
111
|
+
|
112
|
+
const phoneInputMaskCss = ".inline-text-field-container{display:flex;flex-direction:column}@supports (top: max(0%)){.mdc-text-field--outlined{padding-right:max(16px, var(--mdc-shape-small, 4px))}}@supports (top: max(0%)){.mdc-text-field--outlined{padding-left:max(16px, calc(var(--mdc-shape-small, 4px) + 4px))}}.mdc-text-field--outlined{height:55px;overflow:visible}.phone{width:300px;height:50px;font-size:18px;padding:10px;color:grey;border:1px solid #d3c6c6;outline:none}.mdc-text-field{border-top-left-radius:4px;border-top-left-radius:var(--mdc-shape-small, 4px);border-top-right-radius:4px;border-top-right-radius:var(--mdc-shape-small, 4px);border-bottom-right-radius:0;border-bottom-left-radius:0;display:inline-flex;align-items:baseline;padding:0 16px;position:relative;box-sizing:border-box;overflow:hidden;will-change:opacity, transform, color}";
|
113
|
+
const PhoneInputMaskStyle0 = phoneInputMaskCss;
|
114
|
+
|
115
|
+
const PhoneInputMask = class {
|
116
|
+
constructor(hostRef) {
|
117
|
+
index.registerInstance(this, hostRef);
|
118
|
+
this.phone = '';
|
119
|
+
this.initialValue = undefined;
|
120
|
+
}
|
121
|
+
componentWillLoad() {
|
122
|
+
this.phone = this.initialValue;
|
123
|
+
}
|
124
|
+
formatPhone(value) {
|
125
|
+
const cleaned = value.replace(/\D/g, ''); // Remove tudo que não for número
|
126
|
+
const match = cleaned.match(/^(\d{0,2})(\d{0,5})(\d{0,4})$/);
|
127
|
+
if (!match)
|
128
|
+
return value;
|
129
|
+
const part1 = match[1] ? `(${match[1]}` : '';
|
130
|
+
const part2 = match[2] ? `) ${match[2]}` : '';
|
131
|
+
const part3 = match[3] ? `-${match[3]}` : '';
|
132
|
+
return `${part1}${part2}${part3}`;
|
133
|
+
}
|
134
|
+
handleInput(event) {
|
135
|
+
const input = event.target;
|
136
|
+
this.phone = this.formatPhone(input.value);
|
137
|
+
}
|
138
|
+
async getPhone() {
|
139
|
+
return this.phone;
|
140
|
+
}
|
141
|
+
render() {
|
142
|
+
return (index.h("input", { key: 'af9b2988d3866d22465821bcd16be45f3cd12ae4', id: "phone", type: "tel", class: "phone", value: this.phone, onInput: (event) => this.handleInput(event), placeholder: "(12) 94567-8910" }));
|
143
|
+
}
|
144
|
+
};
|
145
|
+
PhoneInputMask.style = PhoneInputMaskStyle0;
|
146
|
+
|
147
|
+
exports.giftback_finish = GiftbackFinish;
|
148
|
+
exports.giftback_pin = GiftbackPin;
|
149
|
+
exports.giftback_progress = GiftbackProgress;
|
150
|
+
exports.phone_input = PhoneInput;
|
151
|
+
exports.phone_input_mask = PhoneInputMask;
|
152
|
+
|
153
|
+
//# sourceMappingURL=giftback-finish_5.cjs.entry.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"file":"giftback-finish.giftback-pin.giftback-progress.phone-input.phone-input-mask.entry.cjs.js","mappings":";;;;;;AAAA,MAAM,oBAAoB,GAAG,4rBAA4rB;;ACAztB,MAAM,iBAAiB,GAAG,mIAAmI,CAAC;AAC9J,6BAAe,iBAAiB;;MCOnB,cAAc;;;;IACvB,MAAM;QACF,QACIA,kEAAK,KAAK,EAAC,gBAAgB,IACvBA,kEAAK,GAAG,EAAEC,oBAAO,E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AAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC;QAC9C,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC;QAE7C,OAAO,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,EAAE,CAAC;KACrC;IAEO,WAAW,CAAC,KAAY;QAC5B,MAAM,KAAK,GAAG,KAAK,CAAC,MAA0B,CAAC;QAC/C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;KAC9C;IAGM,MAAM,QAAQ;QACjB,OAAO,IAAI,CAAC,KAAK,CAAC;KACrB;IAED,MAAM;QACF,QACIA,oEACI,EAAE,EAAC,OAAO,EACV,IAAI,EAAC,KAAK,EACV,KAAK,EAAC,OAAO,EACb,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,OAAO,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,EAC3C,WAAW,EAAC,iBAAiB,GAC/B,EACJ;KACL;;;;;;;;;;","names":["h","success","index"],"sources":["src/components/crm-bonus/assets/svg/success-svgrepo-com.svg","src/components/crm-bonus-form/subcomponents/giftback-finish/giftback-finish.css?tag=giftback-finish&encapsulation=shadow","src/components/crm-bonus-form/subcomponents/giftback-finish/giftback-finish.tsx","src/components/crm-bonus-form/subcomponents/giftback-pin/giftback-pin.css?tag=giftback-pin&encapsulation=shadow","src/components/crm-bonus-form/subcomponents/giftback-pin/giftback-pin.tsx","src/components/crm-bonus-form/subcomponents/giftback-progress/giftback-progress.css?tag=giftback-progress&encapsulation=shadow","src/components/crm-bonus-form/subcomponents/giftback-progress/giftback-progress.tsx","src/components/crm-bonus-form/subcomponents/phone/phone.input.tsx","src/components/phone/phone-input-mask.css?tag=phone-input-mask&encapsulation=shadow","src/components/phone/phone-input-mask.tsx"],"sourcesContent":["<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\r\n<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->\r\n<svg version=\"1.1\" id=\"Capa_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" \r\n\t viewBox=\"0 0 50 50\" xml:space=\"preserve\">\r\n<circle style=\"fill:#25AE88;\" cx=\"25\" cy=\"25\" r=\"25\"/>\r\n<polyline style=\"fill:none;stroke:#FFFFFF;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;\" points=\"\r\n\t38,15 22,33 12,25 \"/>\r\n</svg>",".message-finish {\n align-content: center;\n text-align: center;\n}\n\n.message-finish p {\n color: #777676;\n font-size: xx-large;\n font-family: sans-serif;\n}","import { Component, h } from \"@stencil/core\";\nimport success from '../../../crm-bonus/assets/svg/success-svgrepo-com.svg'\n\n@Component({\n tag: 'giftback-finish',\n styleUrl: 'giftback-finish.css',\n shadow: true\n})\nexport class GiftbackFinish {\n render() {\n return (\n <div class=\"message-finish\">\n <img src={success} width={80} />\n <p>Bônus Aplicado com sucesso!!!</p>\n </div>\n )\n }\n}",":host {\n display: block;\n font-family: Arial, sans-serif;\n}\n\n.form-container-pin {\n display: flex;\n justify-content: space-around;\n}\n\n.pin-container {\n display: flex;\n gap: 10px;\n margin: 10px 0;\n}\n\ninput {\n width: 40px;\n height: 40px;\n font-size: 18px;\n text-align: center;\n border: 1px solid #ccc;\n border-radius: 5px;\n}\n\nbutton {\n padding: 10px 20px;\n background-color: #ddd;\n border: none;\n border-radius: 5px;\n cursor: pointer;\n}\n\nbutton:hover {\n background-color: #bbb;\n}\n\n.success {\n color: green;\n margin-top: 10px;\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}","import { Component, h, Prop, State } from '@stencil/core';\nimport { IPinSent } from '../../../../dto/pin.sent';\n\n@Component({\n tag: 'giftback-pin',\n styleUrl: 'giftback-pin.css',\n shadow: true,\n})\nexport class GiftbackPin {\n\n @Prop() sent: IPinSent;\n @Prop() validate: (pin: string) => void;\n\n @State() pin: string[] = ['', '', '', ''];\n @State() isVerified: boolean = false;\n\n @Prop() loading: boolean = false;\n\n handleInput(event: Event, index: number) {\n const input = event.target as HTMLInputElement;\n const value = input.value.slice(0, 1); // Limitar a um único dígito\n this.pin[index] = value;\n\n // Focar no próximo campo, se possível\n if (value && index < this.pin.length - 1) {\n const nextInput = input.nextElementSibling as HTMLInputElement;\n nextInput?.focus();\n }\n\n this.pin = [...this.pin];\n }\n\n validatePin() {\n console.log('this.pin', this.pin);\n this.validate(this.pin.join(\"\"))\n }\n\n verifyPin() {\n const pinCode = this.pin.join('');\n if (pinCode === '9999') {\n this.isVerified = true;\n }\n }\n\n render() {\n return (\n <div class=\"form-container-pin\">\n <div >\n <p>Insira o PIN de 4 dígitos enviado por SMS.</p>\n <div class=\"pin-container\">\n {this.pin.map((_, index) => (\n <input\n type=\"text\"\n maxLength={1}\n value={this.pin[index]}\n onInput={(event) => this.handleInput(event, index)}\n />\n ))}\n </div>\n </div>\n\n <button class={`button ${this.loading ? 'disabled' : ''} `} disabled={this.loading} onClick={() => this.validatePin()}>\n {\n !this.loading ? \"Enviar\" : <loading-spinner size=\"15px\" color=\"#fff\" />\n }\n </button>\n {/* <button onClick={() => this.verifyPin()}>Enviar</button>\n {this.isVerified && <p class=\"success\">Código verificado com sucesso!</p>} */}\n </div>\n );\n }\n}\n",":host {\n display: flex;\n font-family: Arial, sans-serif;\n /* background-color: #f8f4eb; */\n border-radius: 10px;\n padding: 16px;\n /* box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); */\n max-width: 100%;\n flex-direction: column;\n}\n\n.giftback-container {\n display: flex;\n flex-direction: column;\n}\n\n.giftback-container p {\n font-size: medium;\n}\n\nh3 {\n margin: 0 0 10px;\n font-size: 18px;\n}\n\np {\n margin: 5px 0;\n font-size: 14px;\n}\n\n.validity {\n font-size: 12px;\n color: #888;\n}\n\n.progress-container {\n display: flex;\n align-items: center;\n margin: 10px 0;\n}\n\nprogress-container span {\n font-size: 12px;\n color: #666;\n}\n\ninput[type='range'] {\n flex: 1;\n margin: 0 10px;\n appearance: none;\n background-color: #ccc;\n height: 6px;\n border-radius: 3px;\n outline: none;\n cursor: pointer;\n}\n\ninput[type='range']::-webkit-slider-thumb {\n appearance: none;\n width: 14px;\n height: 14px;\n border-radius: 50%;\n background-color: #555;\n cursor: pointer;\n}\n\n.remaining {\n font-weight: bold;\n font-size: 14px;\n color: #333;\n}\n\n.button {\n top: 50%;\n background-color: #6c6c7e;\n color: #fff;\n border: none;\n border-radius: 10px;\n padding: 10px;\n min-height: 30px;\n min-width: 120px;\n font-size: 19px;\n cursor: pointer;\n}\n\n.disabled {\n opacity: 0.6;\n cursor: not-allowed;\n}\n\n.footer-button-giftback {\n display: flex;\n justify-content: end;\n margin-top: 14px;\n}","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 // @Prop() maxValue: number = 50; // Valor máximo de Giftback permitido na compra\n // @Prop() totalGiftback: number = 300; // Valor total disponível de Giftback\n // @Prop() validityDate: string = '30/10/2024'; // Data de validade\n\n @State() usedValue: number = 0; // Valor inicial de Giftback utilizado\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\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() {\n this.reserve(this.usedValue);\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é: {this.bonus.firstValidityDate}</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 <button class={`button ${this.loading ? 'disabled' : ''} `} disabled={this.loading} onClick={() => this.handleReserve()}>\n {\n !this.loading ? \"Aplicar\" : <loading-spinner size=\"10px\" color=\"#fff\" />\n }\n </button>\n </div>\n </div>\n );\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={`button ${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}",".inline-text-field-container {\n display: flex;\n flex-direction: column;\n}\n\n@supports (top: max(0%)) {\n .mdc-text-field--outlined {\n padding-right: max(16px, var(--mdc-shape-small, 4px));\n }\n}\n\n@supports (top: max(0%)) {\n .mdc-text-field--outlined {\n padding-left: max(16px, calc(var(--mdc-shape-small, 4px) + 4px));\n }\n}\n\n.mdc-text-field--outlined {\n height: 55px;\n overflow: visible;\n}\n\n.phone {\n width: 300px;\n height: 50px;\n font-size: 18px;\n padding: 10px;\n color: grey;\n border: 1px solid #d3c6c6;\n outline: none;\n}\n\n.mdc-text-field {\n border-top-left-radius: 4px;\n border-top-left-radius: var(--mdc-shape-small, 4px);\n border-top-right-radius: 4px;\n border-top-right-radius: var(--mdc-shape-small, 4px);\n border-bottom-right-radius: 0;\n border-bottom-left-radius: 0;\n display: inline-flex;\n align-items: baseline;\n padding: 0 16px;\n position: relative;\n box-sizing: border-box;\n overflow: hidden;\n will-change: opacity, transform, color;\n}","import { Component, h, Method, Prop, State } from '@stencil/core';\n\n@Component({\n tag: 'phone-input-mask',\n styleUrl: 'phone-input-mask.css',\n shadow: true,\n})\nexport class PhoneInputMask {\n @State() phone: string = '';\n @Prop() initialValue: string;\n\n componentWillLoad() {\n this.phone = this.initialValue; \n }\n\n\n private formatPhone(value: string): string {\n const cleaned = value.replace(/\\D/g, ''); // Remove tudo que não for número\n const match = cleaned.match(/^(\\d{0,2})(\\d{0,5})(\\d{0,4})$/);\n if (!match) return value;\n\n const part1 = match[1] ? `(${match[1]}` : '';\n const part2 = match[2] ? `) ${match[2]}` : '';\n const part3 = match[3] ? `-${match[3]}` : '';\n\n return `${part1}${part2}${part3}`;\n }\n\n private handleInput(event: Event): void {\n const input = event.target as HTMLInputElement;\n this.phone = this.formatPhone(input.value);\n }\n\n @Method()\n public async getPhone() {\n return this.phone;\n }\n\n render() {\n return (\n <input\n id=\"phone\"\n type=\"tel\"\n class=\"phone\"\n value={this.phone}\n onInput={(event) => this.handleInput(event)}\n placeholder=\"(12) 94567-8910\"\n />\n );\n }\n}\n"],"version":3}
|