crmbonus-component-wake 0.0.26 → 0.0.27
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 +134 -0
- package/dist/cjs/app-modal_2.cjs.entry.js.map +1 -0
- package/dist/cjs/crm-bonus.cjs.entry.js +55 -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-8412ddbf.js +3798 -0
- package/dist/cjs/crmbonus.service-8412ddbf.js.map +1 -0
- package/dist/cjs/giftback-finish_5.cjs.entry.js +155 -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 +36 -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 +132 -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 +216 -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 +74 -0
- package/dist/collection/components/crm-bonus-form/subcomponents/giftback-pin/giftback-pin.js +127 -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 +109 -0
- package/dist/collection/components/crm-bonus-form/subcomponents/giftback-progress/giftback-progress.js +127 -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 +83 -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/update.order.dto.js +2 -0
- package/dist/collection/dto/update.order.dto.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 +42 -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 +126 -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/{crmbonus-component-wake/crmbonus.service-5208f883.js → components/p-374de9ae.js} +91 -166
- package/dist/components/p-374de9ae.js.map +1 -0
- package/dist/components/p-462c12d8.js +69 -0
- package/dist/components/p-462c12d8.js.map +1 -0
- package/dist/{crmbonus-component-wake/giftback-pin.entry.js → components/p-6442ffce.js} +39 -9
- package/dist/components/p-6442ffce.js.map +1 -0
- package/dist/components/p-878ce0aa.js +174 -0
- package/dist/components/p-878ce0aa.js.map +1 -0
- package/dist/components/p-8fcf8924.js +52 -0
- package/dist/components/p-8fcf8924.js.map +1 -0
- package/dist/components/p-cb5a1fdf.js +39 -0
- package/dist/components/p-cb5a1fdf.js.map +1 -0
- package/dist/components/p-cbade307.js +36 -0
- package/dist/components/p-cbade307.js.map +1 -0
- package/dist/{crmbonus-component-wake/phone-input-mask.entry.js → components/p-e40cf14d.js} +30 -9
- package/dist/components/p-e40cf14d.js.map +1 -0
- package/dist/components/p-e816fb90.js +43 -0
- package/dist/components/p-e816fb90.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 +54 -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-374de9ae.js +2 -0
- package/dist/crmbonus-component-wake/p-374de9ae.js.map +1 -0
- package/dist/crmbonus-component-wake/p-4306a717.entry.js +2 -0
- package/dist/crmbonus-component-wake/p-4306a717.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-9985f639.entry.js +2 -0
- package/dist/crmbonus-component-wake/p-9985f639.entry.js.map +1 -0
- package/dist/crmbonus-component-wake/p-be1a56de.entry.js +2 -0
- package/dist/crmbonus-component-wake/p-be1a56de.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-e2f165e8.entry.js +2 -0
- package/dist/crmbonus-component-wake/p-e2f165e8.entry.js.map +1 -0
- package/dist/crmbonus-component-wake/p-f74e4a71.entry.js +2 -0
- package/dist/crmbonus-component-wake/p-f74e4a71.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} +26 -6
- 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-053a9e38.js +3796 -0
- package/dist/esm/crmbonus.service-053a9e38.js.map +1 -0
- package/dist/esm/giftback-finish_5.entry.js +147 -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 +4 -3
- package/dist/esm/loading-spinner.entry.js.map +1 -0
- package/dist/{crmbonus-component-wake → esm}/pedido-finalizado.entry.js +3 -3
- 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 +0 -23
- 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-5208f883.js.map +0 -1
- package/dist/crmbonus-component-wake/giftback-finish.entry.js +0 -19
- 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 +0 -40
- 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,18 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 703 103" fill="none" preserveAspectRatio="xMidYMid meet" aria-hidden="true" role="img">
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M689.2 57.5004L647.1 99.6004L637.3 89.8004L679.4 47.7004H636V33.9004H695C696.9 33.9004 698.5 34.5004 699.7 35.5004C700 35.7004 700.2 35.9004 700.4 36.1004C700.6 36.3004 700.8 36.5004 700.9 36.7004V36.8004V36.9004C702 38.1004 702.7 39.8004 702.7 41.8004V43.6004V67.0004V100.7H688.9V80.8004V57.5004H689.2Z" fill="url(#paint0_linear_1629_188)"></path>
|
3
|
+
<path d="M52.7 76.4998H67.7C65.3 91.7998 51.9 102.5 35.2 102.5C15.2 102.5 0 87.2998 0 67.3998C0 47.6998 15.2 32.2998 35.2 32.2998C51.9 32.2998 65.3 42.8998 67.7 58.2998H52.7C50.9 50.7998 44.2 45.6998 35.2 45.6998C22.9 45.6998 14.8 55.3998 14.8 67.3998C14.8 79.4998 22.9 89.0998 35.2 89.0998C44.2 89.1998 50.9 84.0998 52.7 76.4998Z" fill="currentColor"></path>
|
4
|
+
<path d="M117.2 32.7002V46.6002C106.6 47.0002 98.5002 51.0002 92.5002 58.8002V100.8H77.7002V34.1002H92.5002V43.2002C98.6002 36.5002 107 32.7002 117.2 32.7002Z" fill="currentColor"></path>
|
5
|
+
<path d="M237.4 62.5997V100.8H222.8V62.5997C222.8 50.7997 216.6 45.6997 207 45.6997C200.5 45.6997 194.2 48.0997 189.3 54.7997C189.7 56.8997 189.9 59.2997 189.9 61.7997V100.8H175.2V61.7997C175.2 49.9997 169 45.7997 160.3 45.7997C153.3 45.7997 147.1 48.5997 142.3 55.2997V100.9H127.5V34.1997H142.3V39.8997C147.3 35.3997 153.2 32.4997 162 32.4997C171.5 32.4997 179.2 35.7997 184.1 42.1997C190.6 35.7997 198.2 32.4997 207.9 32.4997C225.5 32.3997 237.4 42.8997 237.4 62.5997Z" fill="currentColor"></path>
|
6
|
+
<path d="M320 67.3C320 86.9 304.8 102.5 286.1 102.5C277.6 102.5 270.3 99.9 264.8 95.5V100.8H250V0H264.8V39.2C270.3 34.9 277.6 32.4 286.1 32.4C304.8 32.4 320 48 320 67.3ZM305.2 67.3C305.2 55.5 296.3 45.7 283.9 45.7C276.5 45.7 269.7 48.1 264.7 55.1V79.7C269.7 86.7 276.5 89.2 283.9 89.2C296.3 89.2 305.2 79.2 305.2 67.3Z" fill="currentColor"></path>
|
7
|
+
<path d="M399.2 67.5004C399.2 87.9004 384.4 102.6 363.7 102.6C343 102.6 328.2 87.9004 328.2 67.5004C328.2 47.1004 343 32.4004 363.7 32.4004C384.4 32.4004 399.2 47.0004 399.2 67.5004ZM384.4 67.5004C384.4 54.9004 375.7 45.8004 363.7 45.8004C351.7 45.8004 343 54.9004 343 67.5004C343 80.0004 351.7 89.2004 363.7 89.2004C375.7 89.2004 384.4 79.9004 384.4 67.5004Z" fill="currentColor"></path>
|
8
|
+
<path d="M474.3 63.5997V100.8H459.5V64.4996C459.5 52.2996 453 45.7997 442.2 45.7997C435.8 45.7997 428.9 49.2996 423.6 55.8996V100.9H408.8V34.1996H423.6V40.1996C429.4 35.1996 436.7 32.4996 445.2 32.4996C462.5 32.3996 474.3 44.2997 474.3 63.5997Z" fill="currentColor"></path>
|
9
|
+
<path d="M550.4 34.0996V100.8H535.8V94.2996C530 99.5996 522.7 102.5 514.1 102.5C496.8 102.5 485.1 90.1996 485.1 70.9996V34.0996H499.7V70.1996C499.7 82.3996 506.4 89.1996 517 89.1996C523.5 89.1996 530.3 85.4996 535.7 78.6996V34.0996H550.4Z" fill="currentColor"></path>
|
10
|
+
<path d="M591.5 90.5002C600.2 90.5002 606.1 87.7002 606.1 82.4002C606.1 78.4002 602.8 75.6002 597.2 74.6002L582.4 72.0002C572.2 70.3002 562.7 65.2002 562.7 53.1002C562.7 40.2002 573.9 32.2002 590.5 32.2002C603.4 32.2002 618.3 36.6002 619.7 54.1002H606.1C605.4 46.9002 599 44.0002 590.5 44.0002C582 44.0002 577.3 47.1002 577.3 51.8002C577.3 55.3002 579.9 58.8002 587.7 60.0002L600.2 62.0002C610.3 63.8002 620.2 68.2002 620.2 81.2002C620.2 95.3002 607.9 102.5 591.1 102.5C575.3 102.5 561.9 96.3002 560.2 78.7002L573.8 78.8002C575.3 87.0002 581.4 90.5002 591.5 90.5002Z" fill="currentColor"></path>
|
11
|
+
<defs>
|
12
|
+
<linearGradient id="paint0_linear_1629_188" x1="636.833" y1="97.8261" x2="713.46" y2="26.6582" gradientUnits="userSpaceOnUse">
|
13
|
+
<stop stop-color="#F7A830"></stop>
|
14
|
+
<stop offset="0.6353" stop-color="#F08336"></stop>
|
15
|
+
<stop offset="1" stop-color="#EA5346"></stop>
|
16
|
+
</linearGradient>
|
17
|
+
</defs>
|
18
|
+
</svg>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
3
|
+
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
4
|
+
viewBox="0 0 50 50" xml:space="preserve">
|
5
|
+
<circle style="fill:#25AE88;" cx="25" cy="25" r="25"/>
|
6
|
+
<polyline style="fill:none;stroke:#FFFFFF;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;" points="
|
7
|
+
38,15 22,33 12,25 "/>
|
8
|
+
</svg>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
/* :host {
|
2
|
+
display: block;
|
3
|
+
} */
|
4
|
+
|
5
|
+
.container-button {
|
6
|
+
max-width: 136px;
|
7
|
+
cursor: pointer;
|
8
|
+
padding: 10px;
|
9
|
+
}
|
10
|
+
|
11
|
+
/* padding: 0 15px 15px;
|
12
|
+
border: 1px solid #ddd;
|
13
|
+
margin-bottom: 20px; */
|
14
|
+
|
15
|
+
.section-crm {
|
16
|
+
border: 1px solid #dbd4d4;
|
17
|
+
/* min-height: 50px; */
|
18
|
+
text-align: -webkit-center;
|
19
|
+
margin-bottom: 20px;
|
20
|
+
}
|
@@ -0,0 +1,132 @@
|
|
1
|
+
import { h } from "@stencil/core";
|
2
|
+
import logo from "./assets/svg/logo.svg";
|
3
|
+
import { CrmBonusService } from "../../services/crmbonus.service";
|
4
|
+
export class CrmBonus {
|
5
|
+
constructor() {
|
6
|
+
this.crmBonusService = new CrmBonusService();
|
7
|
+
this.showModal = false;
|
8
|
+
this.userId = undefined;
|
9
|
+
this.storeName = undefined;
|
10
|
+
this.productsInString = undefined;
|
11
|
+
this.cartId = undefined;
|
12
|
+
this.products = undefined;
|
13
|
+
this.customer = undefined;
|
14
|
+
}
|
15
|
+
async componentWillLoad() {
|
16
|
+
await this.handleLoad();
|
17
|
+
}
|
18
|
+
async handleLoad() {
|
19
|
+
try {
|
20
|
+
if (this.userId) {
|
21
|
+
this.customer = await this.crmBonusService.getCustomer(this.userId, this.storeName);
|
22
|
+
console.log('user', this.customer);
|
23
|
+
}
|
24
|
+
}
|
25
|
+
catch (error) {
|
26
|
+
console.log('info customer');
|
27
|
+
}
|
28
|
+
this.products = JSON.parse(this.productsInString);
|
29
|
+
}
|
30
|
+
buildProducts() {
|
31
|
+
return this.products.map(product => ({ sku: product.SKU, value: (product.PrecoPor * product.Quantidade), variantId: product.ProdutoVarianteId, qtd: product.Quantidade }));
|
32
|
+
}
|
33
|
+
handleCloseModal() {
|
34
|
+
this.showModal = false;
|
35
|
+
}
|
36
|
+
render() {
|
37
|
+
return (h("div", { key: 'c9db6de8e4503b454fd69302ec52808ed4d46812', class: "section-crm" }, h("div", { key: '4dcfd2946439206652ca8668ca37bbe35d5e0e2d', class: "container-button" }, h("img", { key: '07391e65e467aaebf1f1fabdc0d7dcf3fc1d5182', src: logo, onClick: () => (this.showModal = true) })), h("app-modal", { key: '8aa6c41f5faf07e6389a755faed661803b689cd5', isOpen: this.showModal, modalTitle: `Giftback`, onModalClosed: () => (this.showModal = false) }, h("crm-bonus-form", { key: 'e5903b6dd43617e619230490a23ffaaf5d77c9c6', cancel: () => this.handleCloseModal(), storeName: this.storeName, products: this.buildProducts(), cartId: this.cartId, customer: this.customer }))));
|
38
|
+
}
|
39
|
+
static get is() { return "crm-bonus"; }
|
40
|
+
static get encapsulation() { return "shadow"; }
|
41
|
+
static get originalStyleUrls() {
|
42
|
+
return {
|
43
|
+
"$": ["crm-bonus.css"]
|
44
|
+
};
|
45
|
+
}
|
46
|
+
static get styleUrls() {
|
47
|
+
return {
|
48
|
+
"$": ["crm-bonus.css"]
|
49
|
+
};
|
50
|
+
}
|
51
|
+
static get assetsDirs() { return ["assets"]; }
|
52
|
+
static get properties() {
|
53
|
+
return {
|
54
|
+
"userId": {
|
55
|
+
"type": "number",
|
56
|
+
"mutable": false,
|
57
|
+
"complexType": {
|
58
|
+
"original": "number",
|
59
|
+
"resolved": "number",
|
60
|
+
"references": {}
|
61
|
+
},
|
62
|
+
"required": false,
|
63
|
+
"optional": false,
|
64
|
+
"docs": {
|
65
|
+
"tags": [],
|
66
|
+
"text": ""
|
67
|
+
},
|
68
|
+
"attribute": "userid",
|
69
|
+
"reflect": false
|
70
|
+
},
|
71
|
+
"storeName": {
|
72
|
+
"type": "any",
|
73
|
+
"mutable": false,
|
74
|
+
"complexType": {
|
75
|
+
"original": "any",
|
76
|
+
"resolved": "any",
|
77
|
+
"references": {}
|
78
|
+
},
|
79
|
+
"required": false,
|
80
|
+
"optional": false,
|
81
|
+
"docs": {
|
82
|
+
"tags": [],
|
83
|
+
"text": ""
|
84
|
+
},
|
85
|
+
"attribute": "storename",
|
86
|
+
"reflect": false
|
87
|
+
},
|
88
|
+
"productsInString": {
|
89
|
+
"type": "string",
|
90
|
+
"mutable": false,
|
91
|
+
"complexType": {
|
92
|
+
"original": "string",
|
93
|
+
"resolved": "string",
|
94
|
+
"references": {}
|
95
|
+
},
|
96
|
+
"required": false,
|
97
|
+
"optional": false,
|
98
|
+
"docs": {
|
99
|
+
"tags": [],
|
100
|
+
"text": ""
|
101
|
+
},
|
102
|
+
"attribute": "products",
|
103
|
+
"reflect": false
|
104
|
+
},
|
105
|
+
"cartId": {
|
106
|
+
"type": "any",
|
107
|
+
"mutable": false,
|
108
|
+
"complexType": {
|
109
|
+
"original": "any",
|
110
|
+
"resolved": "any",
|
111
|
+
"references": {}
|
112
|
+
},
|
113
|
+
"required": false,
|
114
|
+
"optional": false,
|
115
|
+
"docs": {
|
116
|
+
"tags": [],
|
117
|
+
"text": ""
|
118
|
+
},
|
119
|
+
"attribute": "cartid",
|
120
|
+
"reflect": false
|
121
|
+
}
|
122
|
+
};
|
123
|
+
}
|
124
|
+
static get states() {
|
125
|
+
return {
|
126
|
+
"showModal": {},
|
127
|
+
"products": {},
|
128
|
+
"customer": {}
|
129
|
+
};
|
130
|
+
}
|
131
|
+
}
|
132
|
+
//# sourceMappingURL=crm-bonus.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"crm-bonus.js","sourceRoot":"","sources":["../../../../src/components/crm-bonus/crm-bonus.tsx"],"names":[],"mappings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AAM;QACJ,OAAO,CACL,4DAAK,KAAK,EAAC,aAAa;YACtB,4DAAK,KAAK,EAAC,kBAAkB;gBAC3B,4DAAK,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,GAAI,CACtD;YACN,kEACE,MAAM,EAAE,IAAI,CAAC,SAAS,EACtB,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;gBAE7C,uEAAgB,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,CACxJ,CACR,CACP,CAAA;IACH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, State, h } from '@stencil/core';\nimport logo from './assets/svg/logo.svg';\nimport { IProduct, IProductWake, ICustomer } from '../../dto/validate.pin.bonus';\nimport { CrmBonusService } from '../../services/crmbonus.service';\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 @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\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 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 render() {\n return (\n <div class=\"section-crm\">\n <div class=\"container-button\">\n <img src={logo} onClick={() => (this.showModal = true)} />\n </div>\n <app-modal\n isOpen={this.showModal}\n modalTitle={`Giftback`}\n onModalClosed={() => (this.showModal = false)}\n >\n <crm-bonus-form cancel={() => this.handleCloseModal()} storeName={this.storeName} products={this.buildProducts()} cartId={this.cartId} customer={this.customer} />\n </app-modal>\n </div>\n )\n }\n}\n"]}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
.form-container {
|
2
|
+
width: 100%;
|
3
|
+
display: flex;
|
4
|
+
justify-content: center;
|
5
|
+
justify-content: space-around;
|
6
|
+
}
|
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
|
+
.disabled {
|
22
|
+
opacity: 0.6;
|
23
|
+
cursor: not-allowed;
|
24
|
+
}
|
25
|
+
|
26
|
+
.message-error {
|
27
|
+
color: #d11111;
|
28
|
+
font-weight: bold;
|
29
|
+
font-family: Arial;
|
30
|
+
font-size: small;
|
31
|
+
margin-left: 16px;
|
32
|
+
}
|
@@ -0,0 +1,216 @@
|
|
1
|
+
import { Host, h } from "@stencil/core";
|
2
|
+
import { CrmBonusService } from "../../services/crmbonus.service";
|
3
|
+
import { StepFormEnum } from "../../contants";
|
4
|
+
export class CrmBonusForm {
|
5
|
+
constructor() {
|
6
|
+
this.crmBonusService = new CrmBonusService();
|
7
|
+
this.storeName = undefined;
|
8
|
+
this.cartId = undefined;
|
9
|
+
this.products = undefined;
|
10
|
+
this.customer = {
|
11
|
+
phone: "",
|
12
|
+
birthDate: "",
|
13
|
+
document: "",
|
14
|
+
name: ""
|
15
|
+
};
|
16
|
+
this.cancel = undefined;
|
17
|
+
this.loading = false;
|
18
|
+
this.step = StepFormEnum.STEP_PHONE;
|
19
|
+
this.sent = undefined;
|
20
|
+
this.message = undefined;
|
21
|
+
this.phone = undefined;
|
22
|
+
this.bonus = undefined;
|
23
|
+
}
|
24
|
+
async sendPin(phone) {
|
25
|
+
var _a, _b;
|
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
|
+
}
|
41
|
+
}
|
42
|
+
async validateBonus(pin) {
|
43
|
+
var _a, _b;
|
44
|
+
this.loading = true;
|
45
|
+
this.message = "";
|
46
|
+
const payload = {
|
47
|
+
pin: pin,
|
48
|
+
cellphone: this.phone.toString(),
|
49
|
+
loja_id: this.sent.storeId,
|
50
|
+
user_id: this.sent.userId,
|
51
|
+
cartId: this.cartId,
|
52
|
+
products: this.products
|
53
|
+
};
|
54
|
+
try {
|
55
|
+
this.bonus = await this.crmBonusService.validatePinBonus(payload, this.storeName);
|
56
|
+
console.log('[this.bonus]', this.bonus);
|
57
|
+
this.step = StepFormEnum.STEP_RESERVE;
|
58
|
+
}
|
59
|
+
catch (error) {
|
60
|
+
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;
|
61
|
+
}
|
62
|
+
finally {
|
63
|
+
this.loading = false;
|
64
|
+
}
|
65
|
+
console.log('payload', payload);
|
66
|
+
}
|
67
|
+
async reserve(amount) {
|
68
|
+
this.loading = true;
|
69
|
+
this.message = "";
|
70
|
+
try {
|
71
|
+
await this.crmBonusService.reserve({
|
72
|
+
redeemed_bonus: amount,
|
73
|
+
cart_id: this.cartId,
|
74
|
+
ticket: this.cartId,
|
75
|
+
gross_value: this.bonus.totalValue,
|
76
|
+
}, this.storeName);
|
77
|
+
this.step = StepFormEnum.STEP_APPLY;
|
78
|
+
}
|
79
|
+
catch (error) {
|
80
|
+
this.message = "ocorreu um error ao solicitar a aplicação do bonus! tente novamente";
|
81
|
+
}
|
82
|
+
finally {
|
83
|
+
this.loading = false;
|
84
|
+
}
|
85
|
+
}
|
86
|
+
handleCancel() {
|
87
|
+
this.step = StepFormEnum.STEP_PHONE;
|
88
|
+
this.cancel();
|
89
|
+
}
|
90
|
+
render() {
|
91
|
+
return (h(Host, { key: '3097220f8802f698c4c1163fa359dfbf3089921f' }, this.step === StepFormEnum.STEP_PHONE && h("phone-input", { key: '039f1d21f8b40f00b24722fe26d5a5539f9d8226', value: this.customer.phone, sendPin: (phone) => this.sendPin(phone), loading: this.loading }), this.step === StepFormEnum.STEP_PIN && h("giftback-pin", { key: '600a4adff83b3afa5d82c4fd484ab07757323ebb', cancel: () => this.handleCancel(), sent: this.sent, validate: (data) => this.validateBonus(data), loading: this.loading }), this.step === StepFormEnum.STEP_RESERVE && h("giftback-progress", { key: 'd3f430232255cc602f0cdb6c7fe4b4cc41588fdc', loading: this.loading, cancel: () => this.handleCancel(), bonus: this.bonus, reserve: (amountRedeemed) => this.reserve(amountRedeemed) }), this.step === StepFormEnum.STEP_APPLY && h("giftback-finish", { key: '6cac259c8b3d7a2fc00dd9feeb28abaad948009e' }), h("p", { key: 'f21ea87102b5aea7122aa983bed22257b7f73721', class: "message-error" }, this.message)));
|
92
|
+
}
|
93
|
+
static get is() { return "crm-bonus-form"; }
|
94
|
+
static get encapsulation() { return "shadow"; }
|
95
|
+
static get originalStyleUrls() {
|
96
|
+
return {
|
97
|
+
"$": ["crm-bonus-form.css"]
|
98
|
+
};
|
99
|
+
}
|
100
|
+
static get styleUrls() {
|
101
|
+
return {
|
102
|
+
"$": ["crm-bonus-form.css"]
|
103
|
+
};
|
104
|
+
}
|
105
|
+
static get properties() {
|
106
|
+
return {
|
107
|
+
"storeName": {
|
108
|
+
"type": "any",
|
109
|
+
"mutable": false,
|
110
|
+
"complexType": {
|
111
|
+
"original": "any",
|
112
|
+
"resolved": "any",
|
113
|
+
"references": {}
|
114
|
+
},
|
115
|
+
"required": false,
|
116
|
+
"optional": false,
|
117
|
+
"docs": {
|
118
|
+
"tags": [],
|
119
|
+
"text": ""
|
120
|
+
},
|
121
|
+
"attribute": "storename",
|
122
|
+
"reflect": false
|
123
|
+
},
|
124
|
+
"cartId": {
|
125
|
+
"type": "any",
|
126
|
+
"mutable": false,
|
127
|
+
"complexType": {
|
128
|
+
"original": "any",
|
129
|
+
"resolved": "any",
|
130
|
+
"references": {}
|
131
|
+
},
|
132
|
+
"required": false,
|
133
|
+
"optional": false,
|
134
|
+
"docs": {
|
135
|
+
"tags": [],
|
136
|
+
"text": ""
|
137
|
+
},
|
138
|
+
"attribute": "cart-id",
|
139
|
+
"reflect": false
|
140
|
+
},
|
141
|
+
"products": {
|
142
|
+
"type": "unknown",
|
143
|
+
"mutable": false,
|
144
|
+
"complexType": {
|
145
|
+
"original": "Array<IProduct>",
|
146
|
+
"resolved": "IProduct[]",
|
147
|
+
"references": {
|
148
|
+
"Array": {
|
149
|
+
"location": "global",
|
150
|
+
"id": "global::Array"
|
151
|
+
},
|
152
|
+
"IProduct": {
|
153
|
+
"location": "import",
|
154
|
+
"path": "../../dto/validate.pin.bonus",
|
155
|
+
"id": "src/dto/validate.pin.bonus.ts::IProduct"
|
156
|
+
}
|
157
|
+
}
|
158
|
+
},
|
159
|
+
"required": false,
|
160
|
+
"optional": false,
|
161
|
+
"docs": {
|
162
|
+
"tags": [],
|
163
|
+
"text": ""
|
164
|
+
}
|
165
|
+
},
|
166
|
+
"customer": {
|
167
|
+
"type": "unknown",
|
168
|
+
"mutable": false,
|
169
|
+
"complexType": {
|
170
|
+
"original": "ICustomer",
|
171
|
+
"resolved": "ICustomer",
|
172
|
+
"references": {
|
173
|
+
"ICustomer": {
|
174
|
+
"location": "import",
|
175
|
+
"path": "../../dto/validate.pin.bonus",
|
176
|
+
"id": "src/dto/validate.pin.bonus.ts::ICustomer"
|
177
|
+
}
|
178
|
+
}
|
179
|
+
},
|
180
|
+
"required": false,
|
181
|
+
"optional": false,
|
182
|
+
"docs": {
|
183
|
+
"tags": [],
|
184
|
+
"text": ""
|
185
|
+
},
|
186
|
+
"defaultValue": "{\n phone: \"\",\n birthDate: \"\",\n document: \"\",\n name: \"\"\n }"
|
187
|
+
},
|
188
|
+
"cancel": {
|
189
|
+
"type": "unknown",
|
190
|
+
"mutable": false,
|
191
|
+
"complexType": {
|
192
|
+
"original": "() => void",
|
193
|
+
"resolved": "() => void",
|
194
|
+
"references": {}
|
195
|
+
},
|
196
|
+
"required": false,
|
197
|
+
"optional": false,
|
198
|
+
"docs": {
|
199
|
+
"tags": [],
|
200
|
+
"text": ""
|
201
|
+
}
|
202
|
+
}
|
203
|
+
};
|
204
|
+
}
|
205
|
+
static get states() {
|
206
|
+
return {
|
207
|
+
"loading": {},
|
208
|
+
"step": {},
|
209
|
+
"sent": {},
|
210
|
+
"message": {},
|
211
|
+
"phone": {},
|
212
|
+
"bonus": {}
|
213
|
+
};
|
214
|
+
}
|
215
|
+
}
|
216
|
+
//# sourceMappingURL=crm-bonus-form.js.map
|
@@ -0,0 +1 @@
|
|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AE,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC,cAAsB,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,GAAI;YAChN,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, Prop, State, h } from \"@stencil/core\";\nimport { CrmBonusService } from \"../../services/crmbonus.service\";\nimport { IPinSent } from \"../../components\";\nimport { IBonus, ICustomer, IProccesPinBonusDto, IProduct } from \"../../dto/validate.pin.bonus\";\nimport { StepFormEnum } from \"../../contants\";\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() cancel: () => void;\n\n @State() loading: boolean = false;\n\n @State() step: number = StepFormEnum.STEP_PHONE;\n\n @State() sent: IPinSent;\n\n @State() message: string;\n\n @State() phone: number;\n\n @State() bonus: IBonus;\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 const sent = await this.crmBonusService.sendPin(this.phone, this.storeName);\n this.sent = sent;\n this.step = StepFormEnum.STEP_PIN;\n } catch (error) {\n this.message = error?.response?.data?.message\n } finally {\n this.loading = false\n }\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 reserve(amount: number) {\n this.loading = true;\n this.message = \"\";\n try {\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 this.step = StepFormEnum.STEP_APPLY;\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 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.reserve(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
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
import { h } from "@stencil/core";
|
2
|
+
import success from "../../../crm-bonus/assets/svg/success-svgrepo-com.svg";
|
3
|
+
export class GiftbackFinish {
|
4
|
+
render() {
|
5
|
+
return (h("div", { key: 'e72f82799146a6e94acbdd62324e07cdf9f77009', class: "message-finish" }, h("img", { key: '46e2436a3dbe4745225c3b9674e6bf6c299ad63e', src: success, width: 80 }), h("p", { key: '270e42050956f7f3d1ae9b90f314211fa310f797' }, "Legal! O B\u00F4nus ser\u00E1 aplicado na sua compra.")));
|
6
|
+
}
|
7
|
+
static get is() { return "giftback-finish"; }
|
8
|
+
static get encapsulation() { return "shadow"; }
|
9
|
+
static get originalStyleUrls() {
|
10
|
+
return {
|
11
|
+
"$": ["giftback-finish.css"]
|
12
|
+
};
|
13
|
+
}
|
14
|
+
static get styleUrls() {
|
15
|
+
return {
|
16
|
+
"$": ["giftback-finish.css"]
|
17
|
+
};
|
18
|
+
}
|
19
|
+
}
|
20
|
+
//# sourceMappingURL=giftback-finish.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"giftback-finish.js","sourceRoot":"","sources":["../../../../../../src/components/crm-bonus-form/subcomponents/giftback-finish/giftback-finish.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,OAAO,MAAM,uDAAuD,CAAA;AAO3E,MAAM,OAAO,cAAc;IACvB,MAAM;QACF,OAAO,CACH,4DAAK,KAAK,EAAC,gBAAgB;YACvB,4DAAK,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,GAAI;YAChC,oHAAkD,CAChD,CACT,CAAA;IACL,CAAC;;;;;;;;;CACJ","sourcesContent":["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>Legal! O Bônus será aplicado na sua compra.</p>\n </div>\n )\n }\n}"]}
|
@@ -0,0 +1,74 @@
|
|
1
|
+
:host {
|
2
|
+
display: block;
|
3
|
+
font-family: Arial, sans-serif;
|
4
|
+
}
|
5
|
+
|
6
|
+
.form-container-pin {
|
7
|
+
display: flex;
|
8
|
+
flex-direction: column;
|
9
|
+
align-items: center;
|
10
|
+
}
|
11
|
+
|
12
|
+
.pin-container {
|
13
|
+
display: flex;
|
14
|
+
gap: 10px;
|
15
|
+
margin: 26px 0;
|
16
|
+
}
|
17
|
+
|
18
|
+
input {
|
19
|
+
width: 58px;
|
20
|
+
height: 40px;
|
21
|
+
font-size: 18px;
|
22
|
+
text-align: center;
|
23
|
+
border: 1px solid #ccc;
|
24
|
+
border-radius: 5px;
|
25
|
+
}
|
26
|
+
|
27
|
+
button {
|
28
|
+
padding: 10px 20px;
|
29
|
+
background-color: #ddd;
|
30
|
+
border: none;
|
31
|
+
border-radius: 5px;
|
32
|
+
cursor: pointer;
|
33
|
+
}
|
34
|
+
|
35
|
+
button:hover {
|
36
|
+
background-color: #bbb;
|
37
|
+
}
|
38
|
+
|
39
|
+
.success {
|
40
|
+
color: green;
|
41
|
+
margin-top: 10px;
|
42
|
+
}
|
43
|
+
|
44
|
+
.button {
|
45
|
+
top: 50%;
|
46
|
+
background-color: #6c6c7e;
|
47
|
+
color: #fff;
|
48
|
+
border: none;
|
49
|
+
border-radius: 10px;
|
50
|
+
padding: 15px;
|
51
|
+
min-height: 30px;
|
52
|
+
min-width: 120px;
|
53
|
+
font-size: 20px;
|
54
|
+
cursor: pointer;
|
55
|
+
}
|
56
|
+
|
57
|
+
.button-cancel {
|
58
|
+
top: 50%;
|
59
|
+
background-color: #ffffff;
|
60
|
+
color: #1e1c1c;
|
61
|
+
border: 1px solid gray;
|
62
|
+
border-radius: 10px;
|
63
|
+
padding: 10px;
|
64
|
+
min-height: 30px;
|
65
|
+
min-width: 120px;
|
66
|
+
font-size: 19px;
|
67
|
+
cursor: pointer;
|
68
|
+
}
|
69
|
+
|
70
|
+
.footer-button {
|
71
|
+
display: flex;
|
72
|
+
justify-content: space-between;
|
73
|
+
width: 100%;
|
74
|
+
}
|