crmbonus-component-wake 1.0.32 → 1.0.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/dist/cjs/app-modal_4.cjs.entry.js +6 -6
  2. package/dist/cjs/app-modal_4.cjs.entry.js.map +1 -1
  3. package/dist/cjs/crm-bonus-note.cjs.entry.js +26 -0
  4. package/dist/cjs/crm-bonus-note.cjs.entry.js.map +1 -0
  5. package/dist/cjs/crm-bonus.cjs.entry.js +29 -6
  6. package/dist/cjs/crm-bonus.cjs.entry.js.map +1 -1
  7. package/dist/cjs/crmbonus-component-wake.cjs.js +1 -1
  8. package/dist/cjs/{crmbonus.service-8412ddbf.js → crmbonus.service-e6b51638.js} +8 -1
  9. package/dist/cjs/crmbonus.service-e6b51638.js.map +1 -0
  10. package/dist/cjs/giftback-finish_3.cjs.entry.js +3 -3
  11. package/dist/cjs/loader.cjs.js +1 -1
  12. package/dist/cjs/loading-spinner.cjs.entry.js +1 -1
  13. package/dist/cjs/pedido-finalizado.cjs.entry.js +2 -2
  14. package/dist/cjs/phone-input-mask.cjs.entry.js +1 -1
  15. package/dist/collection/collection-manifest.json +1 -0
  16. package/dist/collection/components/crm-bonus/crm-bonus.css +6 -0
  17. package/dist/collection/components/crm-bonus/crm-bonus.js +28 -4
  18. package/dist/collection/components/crm-bonus/crm-bonus.js.map +1 -1
  19. package/dist/collection/components/crm-bonus-form/crm-bonus-form.js +4 -4
  20. package/dist/collection/components/crm-bonus-form/crm-bonus-form.js.map +1 -1
  21. package/dist/collection/components/crm-bonus-form/subcomponents/giftback-finish/giftback-finish.js +1 -1
  22. package/dist/collection/components/crm-bonus-form/subcomponents/giftback-pin/giftback-pin.js +1 -1
  23. package/dist/collection/components/crm-bonus-form/subcomponents/giftback-progress/giftback-progress.js +1 -1
  24. package/dist/collection/components/crm-bonus-form/subcomponents/phone/phone.input.js +1 -1
  25. package/dist/collection/components/crm-bonus-form/subcomponents/phone-cancel/phone.cancel.input.js +1 -1
  26. package/dist/collection/components/crm-bonus-form/subcomponents/phone-cancel/phone.cancel.input.js.map +1 -1
  27. package/dist/collection/components/loading-spinner/loading-spinner.js +1 -1
  28. package/dist/collection/components/modal/app-modal.js +1 -1
  29. package/dist/collection/components/note/crm-bonus-note.css +34 -0
  30. package/dist/collection/components/note/crm-bonus-note.js +29 -0
  31. package/dist/collection/components/note/crm-bonus-note.js.map +1 -0
  32. package/dist/collection/components/pedido/pedido.js +1 -1
  33. package/dist/collection/components/phone/phone-input-mask.js +1 -1
  34. package/dist/collection/services/crmbonus.service.js +7 -0
  35. package/dist/collection/services/crmbonus.service.js.map +1 -1
  36. package/dist/components/app-modal.js +1 -1
  37. package/dist/components/crm-bonus-form.js +1 -1
  38. package/dist/components/crm-bonus-note.d.ts +11 -0
  39. package/dist/components/crm-bonus-note.js +42 -0
  40. package/dist/components/crm-bonus-note.js.map +1 -0
  41. package/dist/components/crm-bonus.js +39 -15
  42. package/dist/components/crm-bonus.js.map +1 -1
  43. package/dist/components/giftback-finish.js +1 -1
  44. package/dist/components/giftback-pin.js +1 -1
  45. package/dist/components/giftback-progress.js +1 -1
  46. package/dist/components/loading-spinner.js +1 -1
  47. package/dist/components/{p-374de9ae.js → p-39df4263.js} +8 -1
  48. package/dist/components/p-39df4263.js.map +1 -0
  49. package/dist/components/{p-09bc92e2.js → p-4c2f324f.js} +2 -2
  50. package/dist/components/{p-09bc92e2.js.map → p-4c2f324f.js.map} +1 -1
  51. package/dist/components/{p-bad9f0ec.js → p-6a629b94.js} +3 -3
  52. package/dist/components/{p-bad9f0ec.js.map → p-6a629b94.js.map} +1 -1
  53. package/dist/components/{p-13b9e80b.js → p-af4650fb.js} +3 -3
  54. package/dist/components/{p-13b9e80b.js.map → p-af4650fb.js.map} +1 -1
  55. package/dist/components/{p-db0aa2d4.js → p-b1a8e30d.js} +2 -2
  56. package/dist/components/{p-db0aa2d4.js.map → p-b1a8e30d.js.map} +1 -1
  57. package/dist/components/{p-19a2f475.js → p-c4a9f453.js} +4 -4
  58. package/dist/components/p-c4a9f453.js.map +1 -0
  59. package/dist/components/{p-5753850f.js → p-cbade307.js} +2 -2
  60. package/dist/components/{p-5753850f.js.map → p-cbade307.js.map} +1 -1
  61. package/dist/components/{p-5de96a58.js → p-cf18373a.js} +4 -4
  62. package/dist/components/{p-5de96a58.js.map → p-cf18373a.js.map} +1 -1
  63. package/dist/components/{p-7aff1ad5.js → p-d04e8a4e.js} +2 -2
  64. package/dist/components/{p-7aff1ad5.js.map → p-d04e8a4e.js.map} +1 -1
  65. package/dist/components/{p-2e9efe46.js → p-e0fe93e9.js} +8 -8
  66. package/dist/components/p-e0fe93e9.js.map +1 -0
  67. package/dist/components/pedido-finalizado.js +2 -2
  68. package/dist/components/phone-cancel-input.js +1 -1
  69. package/dist/components/phone-input-mask.js +1 -1
  70. package/dist/components/phone-input.js +1 -1
  71. package/dist/crmbonus-component-wake/crmbonus-component-wake.esm.js +1 -1
  72. package/dist/crmbonus-component-wake/crmbonus-component-wake.esm.js.map +1 -1
  73. package/dist/crmbonus-component-wake/p-0521617e.entry.js +2 -0
  74. package/dist/crmbonus-component-wake/p-0521617e.entry.js.map +1 -0
  75. package/dist/crmbonus-component-wake/{p-9399d79f.entry.js → p-2fdbb9ec.entry.js} +2 -2
  76. package/dist/crmbonus-component-wake/{p-374de9ae.js → p-39df4263.js} +2 -2
  77. package/dist/crmbonus-component-wake/p-39df4263.js.map +1 -0
  78. package/dist/crmbonus-component-wake/p-61fafdba.entry.js +2 -0
  79. package/dist/crmbonus-component-wake/p-61fafdba.entry.js.map +1 -0
  80. package/dist/crmbonus-component-wake/{p-3024dc0b.entry.js → p-8c44a0a5.entry.js} +2 -2
  81. package/dist/crmbonus-component-wake/{p-3f336c1d.entry.js → p-ae916fdb.entry.js} +2 -2
  82. package/dist/crmbonus-component-wake/{p-8a5448aa.entry.js → p-cf8e81f9.entry.js} +2 -2
  83. package/dist/crmbonus-component-wake/p-f6dd48cc.entry.js +2 -0
  84. package/dist/crmbonus-component-wake/p-f6dd48cc.entry.js.map +1 -0
  85. package/dist/esm/app-modal_4.entry.js +6 -6
  86. package/dist/esm/app-modal_4.entry.js.map +1 -1
  87. package/dist/esm/crm-bonus-note.entry.js +22 -0
  88. package/dist/esm/crm-bonus-note.entry.js.map +1 -0
  89. package/dist/esm/crm-bonus.entry.js +29 -6
  90. package/dist/esm/crm-bonus.entry.js.map +1 -1
  91. package/dist/esm/crmbonus-component-wake.js +1 -1
  92. package/dist/esm/{crmbonus.service-053a9e38.js → crmbonus.service-d2bfcb1d.js} +8 -1
  93. package/dist/esm/crmbonus.service-d2bfcb1d.js.map +1 -0
  94. package/dist/esm/giftback-finish_3.entry.js +3 -3
  95. package/dist/esm/loader.js +1 -1
  96. package/dist/esm/loading-spinner.entry.js +1 -1
  97. package/dist/esm/pedido-finalizado.entry.js +2 -2
  98. package/dist/esm/phone-input-mask.entry.js +1 -1
  99. package/dist/types/components/crm-bonus/crm-bonus.d.ts +3 -1
  100. package/dist/types/components/crm-bonus-form/crm-bonus-form.d.ts +1 -1
  101. package/dist/types/components/note/crm-bonus-note.d.ts +5 -0
  102. package/dist/types/components.d.ts +15 -2
  103. package/dist/types/services/crmbonus.service.d.ts +1 -0
  104. package/package.json +1 -1
  105. package/dist/cjs/crmbonus.service-8412ddbf.js.map +0 -1
  106. package/dist/components/p-19a2f475.js.map +0 -1
  107. package/dist/components/p-2e9efe46.js.map +0 -1
  108. package/dist/components/p-374de9ae.js.map +0 -1
  109. package/dist/crmbonus-component-wake/p-240c3f01.entry.js +0 -2
  110. package/dist/crmbonus-component-wake/p-240c3f01.entry.js.map +0 -1
  111. package/dist/crmbonus-component-wake/p-374de9ae.js.map +0 -1
  112. package/dist/crmbonus-component-wake/p-e1e8d2d5.entry.js +0 -2
  113. package/dist/crmbonus-component-wake/p-e1e8d2d5.entry.js.map +0 -1
  114. package/dist/esm/crmbonus.service-053a9e38.js.map +0 -1
  115. /package/dist/crmbonus-component-wake/{p-9399d79f.entry.js.map → p-2fdbb9ec.entry.js.map} +0 -0
  116. /package/dist/crmbonus-component-wake/{p-3024dc0b.entry.js.map → p-8c44a0a5.entry.js.map} +0 -0
  117. /package/dist/crmbonus-component-wake/{p-3f336c1d.entry.js.map → p-ae916fdb.entry.js.map} +0 -0
  118. /package/dist/crmbonus-component-wake/{p-8a5448aa.entry.js.map → p-cf8e81f9.entry.js.map} +0 -0
@@ -1,16 +1,16 @@
1
1
  import { p as proxyCustomElement, H, h } from './p-faf7103e.js';
2
- import { C as CrmBonusService } from './p-374de9ae.js';
3
- import { d as defineCustomElement$9, S as StepFormEnum } from './p-2e9efe46.js';
4
- import { d as defineCustomElement$a } from './p-09bc92e2.js';
5
- import { d as defineCustomElement$8 } from './p-5753850f.js';
6
- import { d as defineCustomElement$7 } from './p-13b9e80b.js';
7
- import { d as defineCustomElement$6 } from './p-bad9f0ec.js';
8
- import { d as defineCustomElement$5 } from './p-db0aa2d4.js';
9
- import { d as defineCustomElement$4 } from './p-19a2f475.js';
10
- import { d as defineCustomElement$3 } from './p-5de96a58.js';
11
- import { d as defineCustomElement$2 } from './p-7aff1ad5.js';
2
+ import { C as CrmBonusService } from './p-39df4263.js';
3
+ import { d as defineCustomElement$9, S as StepFormEnum } from './p-e0fe93e9.js';
4
+ import { d as defineCustomElement$a } from './p-4c2f324f.js';
5
+ import { d as defineCustomElement$8 } from './p-cbade307.js';
6
+ import { d as defineCustomElement$7 } from './p-af4650fb.js';
7
+ import { d as defineCustomElement$6 } from './p-6a629b94.js';
8
+ import { d as defineCustomElement$5 } from './p-b1a8e30d.js';
9
+ import { d as defineCustomElement$4 } from './p-c4a9f453.js';
10
+ import { d as defineCustomElement$3 } from './p-cf18373a.js';
11
+ import { d as defineCustomElement$2 } from './p-d04e8a4e.js';
12
12
 
13
- const crmBonusCss = ".container-button{cursor:pointer;padding:5px 5px 5px 14px;}.section-crm{border:1px solid #dbd4d4;text-align:-webkit-center;margin-bottom:20px}.section-cart-crm{margin-top:10px}.section-cart-crm p{padding:0;margin:0px 0px 0px 15px}.button{top:50%;background-color:#6c6c7e;color:#fff;border:none;padding:15px;min-height:30px;min-width:120px;font-size:20px;cursor:pointer;margin-left:10px;height:70px}.form-container{width:97%;display:flex;justify-content:space-around}.btn{display:inline-block;padding:6px 12px;margin-bottom:0;font-size:14px;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-image:none;border:1px solid transparent;border-radius:0px}.form-container .btnCrm{background:#00162e;border-color:#00162e;width:30%;color:#fff}";
13
+ const crmBonusCss = ".container-button{cursor:pointer;padding:5px 5px 5px 14px;}.section-crm{border:1px solid #dbd4d4;text-align:-webkit-center;margin-bottom:20px}.section-cart-crm{margin-top:10px}.section-cart-crm p{padding:0;margin:0px 0px 0px 15px}.button{top:50%;background-color:#6c6c7e;color:#fff;border:none;padding:15px;min-height:30px;min-width:120px;font-size:20px;cursor:pointer;margin-left:10px;height:70px}.form-container{width:97%;display:flex;justify-content:space-around}.btn{display:inline-block;padding:6px 12px;margin-bottom:0;font-size:14px;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-image:none;border:1px solid transparent;border-radius:0px}.form-container .btnCrm{background:#00162e;border-color:#00162e;width:30%;color:#fff}.message-alert{font-family:sans-serif;color:#df4d4d;margin-top:5px}";
14
14
  const CrmBonusStyle0 = crmBonusCss;
15
15
 
16
16
  const CrmBonus$1 = /*@__PURE__*/ proxyCustomElement(class CrmBonus extends H {
@@ -35,6 +35,7 @@ const CrmBonus$1 = /*@__PURE__*/ proxyCustomElement(class CrmBonus extends H {
35
35
  this.message = undefined;
36
36
  this.phone = undefined;
37
37
  this.canCancel = false;
38
+ this.amountCancel = undefined;
38
39
  this.sent = undefined;
39
40
  }
40
41
  async componentWillLoad() {
@@ -46,6 +47,12 @@ const CrmBonus$1 = /*@__PURE__*/ proxyCustomElement(class CrmBonus extends H {
46
47
  this.customer = await this.crmBonusService.getCustomer(this.userId, this.storeName);
47
48
  console.log('user', this.customer);
48
49
  }
50
+ const amount = localStorage.getItem(this.cartId);
51
+ console.log('amount', amount);
52
+ if (amount) {
53
+ this.canCancel = true;
54
+ this.amountCancel = amount;
55
+ }
49
56
  }
50
57
  catch (error) {
51
58
  console.log('info customer');
@@ -76,12 +83,28 @@ const CrmBonus$1 = /*@__PURE__*/ proxyCustomElement(class CrmBonus extends H {
76
83
  handleCloseModal() {
77
84
  this.showModal = false;
78
85
  }
79
- save() {
80
- localStorage.setItem('@BYCODERS', this.cartId);
86
+ save(amount) {
87
+ localStorage.setItem(this.cartId, amount.toString());
88
+ this.canCancel = true;
89
+ this.amountCancel = amount.toString();
90
+ }
91
+ async cancel() {
92
+ this.message = "";
93
+ this.loading = true;
94
+ try {
95
+ await this.crmBonusService.cancel(this.cartId, this.storeName);
96
+ this.canCancel = false;
97
+ }
98
+ catch (error) {
99
+ this.message = "Não consegui cancelar o bônus, tente novamente!";
100
+ }
101
+ finally {
102
+ this.loading = false;
103
+ }
81
104
  }
82
105
  render() {
83
- return (h("div", { key: '881de45f9b1d135bcf29f0bb64acba9dd6db2625', class: "section-cart-crm" }, h("p", { key: '220974c8e1b717514a83a739e912aa7f08589506', class: "text-left fbits-responsive-carrinho-desconto-texto" }, "Giftback"), h("div", { key: '7a33ec85d3a3acbc5b1f7c35967bd07ec4fc883a', class: "container-button" }, this.canCancel ? h("phone-cancel-input", { value: this.customer.phone, sendPin: () => { }, loading: this.loading })
84
- : h("phone-input", { value: this.customer.phone, sendPin: (phone) => { this.sendPin(phone); }, loading: this.loading })), h("app-modal", { key: '98c78ae810b68e0396dce2928c2116d2e4d20fa8', isOpen: this.showModal, modalTitle: `Giftback`, onModalClosed: () => (this.showModal = false) }, h("crm-bonus-form", { key: '2a22c6a17a4646f7631943fb6017f53372814724', 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 }))));
106
+ return (h("div", { key: '0392d18435b29da7594c5ddec8dca0a5a2c892f6', class: "section-cart-crm" }, h("p", { key: '7f5cb65fe1ebce8397d5d6c8d3d13d09ad55d8db', class: "text-left fbits-responsive-carrinho-desconto-texto" }, "Giftback"), h("div", { key: '82922b373a5c6d0eb72d59826c5b10425fa9fb81', class: "container-button" }, this.canCancel ? h("phone-cancel-input", { value: this.amountCancel, sendPin: () => { this.cancel(); }, loading: this.loading })
107
+ : h("phone-input", { value: this.customer.phone, sendPin: (phone) => { this.sendPin(phone); }, loading: this.loading })), h("p", { key: '113c2653a276730fd3ecd675f50a0f147c656620', class: "message-alert" }, this.message), h("app-modal", { key: 'ffda850ab8dc0534e56f868554eaaa794b168427', isOpen: this.showModal, modalTitle: `Giftback`, onModalClosed: () => (this.showModal = false) }, h("crm-bonus-form", { key: '3b3493173363fd799f26b37e6d94f9455e19f2bf', saveStore: (amount) => this.save(amount), ref: ref => this.crmBonusRef = ref, sent: this.sent, phone: this.phone, cancel: () => this.handleCloseModal(), storeName: this.storeName, products: this.buildProducts(), cartId: this.cartId, customer: this.customer }))));
85
108
  }
86
109
  static get assetsDirs() { return ["assets"]; }
87
110
  static get style() { return CrmBonusStyle0; }
@@ -97,6 +120,7 @@ const CrmBonus$1 = /*@__PURE__*/ proxyCustomElement(class CrmBonus extends H {
97
120
  "message": [32],
98
121
  "phone": [32],
99
122
  "canCancel": [32],
123
+ "amountCancel": [32],
100
124
  "sent": [32]
101
125
  }]);
102
126
  function defineCustomElement$1() {
@@ -1 +1 @@
1
- {"file":"crm-bonus.js","mappings":";;;;;;;;;;;;AAAA,MAAM,WAAW,GAAG,s7BAAs7B,CAAC;AAC38B,uBAAe,WAAW;;MCWb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AS,GAAG,KAAK,CAAC,IAE7C,uEAAgB,SAAS,EAAE,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,IAAI,CAAC,WAAW,GAAG,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC,gBAAgB,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,QAAQ,EAAE,IAAI,CAAC,aAAa,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,GAAI,CAC9P,CACR,EACP;KACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["CrmBonus"],"sources":["src/components/crm-bonus/crm-bonus.css?tag=crm-bonus&encapsulation=shadow","src/components/crm-bonus/crm-bonus.tsx"],"sourcesContent":["/* :host {\n display: block;\n} */\n\n.container-button {\n /* max-width: 100%; */\n cursor: pointer;\n padding: 5px 5px 5px 14px;\n /* display: flex; */\n}\n\n/* padding: 0 15px 15px;\nborder: 1px solid #ddd;\nmargin-bottom: 20px; */\n\n.section-crm {\n border: 1px solid #dbd4d4;\n /* min-height: 50px; */\n text-align: -webkit-center;\n margin-bottom: 20px;\n}\n\n.section-cart-crm {\n margin-top: 10px;\n}\n\n.section-cart-crm p {\n padding: 0;\n margin: 0px 0px 0px 15px;\n}\n\n.button {\n top: 50%;\n background-color: #6c6c7e;\n color: #fff;\n border: none;\n /* border-radius: 10px; */\n padding: 15px;\n min-height: 30px;\n min-width: 120px;\n font-size: 20px;\n cursor: pointer;\n margin-left: 10px;\n height: 70px;\n}\n\n.form-container {\n width: 97%;\n display: flex;\n justify-content: space-around;\n}\n\n\n.btn {\n display: inline-block;\n padding: 6px 12px;\n margin-bottom: 0;\n font-size: 14px;\n font-weight: 400;\n line-height: 1.42857143;\n text-align: center;\n white-space: nowrap;\n vertical-align: middle;\n -ms-touch-action: manipulation;\n touch-action: manipulation;\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n background-image: none;\n border: 1px solid transparent;\n border-radius: 0px;\n}\n\n.form-container .btnCrm {\n background: #00162e;\n border-color: #00162e;\n width: 30%;\n color: #fff;\n}","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 <p class=\"text-left fbits-responsive-carrinho-desconto-texto\">Giftback</p>\n <div class=\"container-button\">\n {/* <img src={logo} onClick={() => (this.showModal = true)} /> */}\n {\n this.canCancel ? <phone-cancel-input value={this.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"],"version":3}
1
+ {"file":"crm-bonus.js","mappings":";;;;;;;;;;;;AAAA,MAAM,WAAW,GAAG,y/BAAy/B,CAAC;AAC9gC,uBAAe,WAAW;;MCWbA,UAAQ;;;;;QAEX,oBAAe,GAAoB,IAAI,eAAe,EAAE,CAAC;yBAInC,KAAK;;;;;;wBAOJ;YAC7B,SAAS,EAAE,EAAE;YACb,QAAQ,EAAE,EAAE;YACZ,IAAI,EAAE,EAAE;YACR,KAAK,EAAE,EAAE;SACV;uBAE2B,KAAK;;;yBAGH,KAAK;;;;IAKnC,MAAM,iBAAiB;QACrB,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;KACzB;IAED,MAAM,UAAU;QACd,IAAI;YACF,IAAI,IAAI,CAAC,MAA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AGzB,IAAI,CAAC,SAAS,GAAG,0BAAoB,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,OAAO,EAAE,QAAQ,IAAI,CAAC,MAAM,EAAE,CAAA,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,GAAI;cACtH,mBAAa,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC,KAAK,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,GAAI,CAEjH,EACN,0DAAG,KAAK,EAAC,eAAe,IAAG,IAAI,CAAC,OAAO,CAAK,EAC5C,kEACE,MAAM,EAAE,IAAI,CAAC,SAAS,EACtB,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,OAAO,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,IAE7C,uEAAgB,SAAS,EAAE,CAAC,MAAc,KAAK,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,GAAG,IAAI,IAAI,CAAC,WAAW,GAAG,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC,gBAAgB,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,QAAQ,EAAE,IAAI,CAAC,aAAa,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,GAAI,CAClR,CACR,EACP;KACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["CrmBonus"],"sources":["src/components/crm-bonus/crm-bonus.css?tag=crm-bonus&encapsulation=shadow","src/components/crm-bonus/crm-bonus.tsx"],"sourcesContent":["/* :host {\n display: block;\n} */\n\n.container-button {\n /* max-width: 100%; */\n cursor: pointer;\n padding: 5px 5px 5px 14px;\n /* display: flex; */\n}\n\n/* padding: 0 15px 15px;\nborder: 1px solid #ddd;\nmargin-bottom: 20px; */\n\n.section-crm {\n border: 1px solid #dbd4d4;\n /* min-height: 50px; */\n text-align: -webkit-center;\n margin-bottom: 20px;\n}\n\n.section-cart-crm {\n margin-top: 10px;\n}\n\n.section-cart-crm p {\n padding: 0;\n margin: 0px 0px 0px 15px;\n}\n\n.button {\n top: 50%;\n background-color: #6c6c7e;\n color: #fff;\n border: none;\n /* border-radius: 10px; */\n padding: 15px;\n min-height: 30px;\n min-width: 120px;\n font-size: 20px;\n cursor: pointer;\n margin-left: 10px;\n height: 70px;\n}\n\n.form-container {\n width: 97%;\n display: flex;\n justify-content: space-around;\n}\n\n\n.btn {\n display: inline-block;\n padding: 6px 12px;\n margin-bottom: 0;\n font-size: 14px;\n font-weight: 400;\n line-height: 1.42857143;\n text-align: center;\n white-space: nowrap;\n vertical-align: middle;\n -ms-touch-action: manipulation;\n touch-action: manipulation;\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n background-image: none;\n border: 1px solid transparent;\n border-radius: 0px;\n}\n\n.form-container .btnCrm {\n background: #00162e;\n border-color: #00162e;\n width: 30%;\n color: #fff;\n}\n\n.message-alert {\n font-family: sans-serif;\n color: #df4d4d;\n margin-top: 5px;\n}","import { Component, Prop, State, h } from '@stencil/core';\nimport { IProduct, IProductWake, ICustomer } from '../../dto/validate.pin.bonus';\nimport { CrmBonusService } from '../../services/crmbonus.service';\nimport { IPinSent } from '../../components';\nimport { StepFormEnum } from '../../contants';\n\n@Component({\n tag: 'crm-bonus',\n styleUrl: 'crm-bonus.css',\n shadow: true,\n assetsDirs: ['assets']\n})\nexport class CrmBonus {\n\n private crmBonusService: CrmBonusService = new CrmBonusService();\n\n private crmBonusRef: HTMLCrmBonusFormElement;\n\n @State() showModal: boolean = false;\n @Prop({ attribute: 'userid' }) userId: number;\n @Prop({ attribute: 'storename' }) storeName;\n @Prop({ attribute: 'products' }) productsInString: string;\n @Prop({ attribute: 'cartid' }) cartId;\n\n @State() products: Array<IProductWake>;\n @State() customer: ICustomer = {\n birthDate: \"\",\n document: \"\",\n name: \"\",\n phone: \"\"\n };\n\n @State() loading: boolean = false;\n @State() message: string;\n @State() phone: number;\n @State() canCancel: boolean = false;\n @State() amountCancel: string;\n @State() sent: IPinSent;\n\n\n async componentWillLoad() {\n await this.handleLoad();\n }\n\n async handleLoad() {\n try {\n if (this.userId) {\n this.customer = await this.crmBonusService.getCustomer(this.userId, this.storeName);\n console.log('user', this.customer);\n }\n\n const amount = localStorage.getItem(this.cartId);\n console.log('amount', amount)\n\n if (amount) {\n this.canCancel = true;\n this.amountCancel = amount;\n }\n\n } catch (error) {\n console.log('info customer')\n }\n this.products = JSON.parse(this.productsInString);\n }\n\n public async sendPin(phone: string) {\n this.loading = true;\n this.message = \"\";\n\n try {\n const _phone = phone.replace(/\\D/g, '');\n this.phone = Number(_phone);\n this.sent = await this.crmBonusService.sendPin(this.phone, this.storeName);;\n await this.crmBonusRef.setStep(StepFormEnum.STEP_PIN);\n this.showModal = true;\n } catch (error) {\n this.message = error?.response?.data?.message\n } finally {\n this.loading = false\n }\n }\n\n buildProducts(): IProduct[] {\n return this.products.map(product => ({ sku: product.SKU, value: (product.PrecoPor * product.Quantidade), variantId: product.ProdutoVarianteId, qtd: product.Quantidade }))\n }\n\n handleCloseModal() {\n this.showModal = false;\n }\n\n save(amount: number) {\n localStorage.setItem(this.cartId, amount.toString());\n this.canCancel = true;\n this.amountCancel = amount.toString()\n }\n\n async cancel() {\n this.message = \"\";\n this.loading = true;\n try {\n await this.crmBonusService.cancel(this.cartId, this.storeName);\n this.canCancel = false;\n } catch (error) {\n this.message = \"Não consegui cancelar o bônus, tente novamente!\"\n } finally {\n this.loading = false;\n }\n }\n\n render() {\n return (\n <div class=\"section-cart-crm\">\n <p class=\"text-left fbits-responsive-carrinho-desconto-texto\">Giftback</p>\n <div class=\"container-button\">\n {/* <img src={logo} onClick={() => (this.showModal = true)} /> */}\n {\n this.canCancel ? <phone-cancel-input value={this.amountCancel} sendPin={() => { this.cancel() }} loading={this.loading} />\n : <phone-input value={this.customer.phone} sendPin={(phone) => { this.sendPin(phone) }} loading={this.loading} />\n }\n </div>\n <p class=\"message-alert\" >{this.message}</p>\n <app-modal\n isOpen={this.showModal}\n modalTitle={`Giftback`}\n onModalClosed={() => (this.showModal = false)}\n >\n <crm-bonus-form saveStore={(amount: number) => this.save(amount)} ref={ref => this.crmBonusRef = ref} sent={this.sent} phone={this.phone} cancel={() => this.handleCloseModal()} storeName={this.storeName} products={this.buildProducts()} cartId={this.cartId} customer={this.customer} />\n </app-modal>\n </div>\n )\n }\n}\n"],"version":3}
@@ -1,4 +1,4 @@
1
- import { G as GiftbackFinish$1, d as defineCustomElement$1 } from './p-5753850f.js';
1
+ import { G as GiftbackFinish$1, d as defineCustomElement$1 } from './p-cbade307.js';
2
2
 
3
3
  const GiftbackFinish = GiftbackFinish$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,4 +1,4 @@
1
- import { G as GiftbackPin$1, d as defineCustomElement$1 } from './p-13b9e80b.js';
1
+ import { G as GiftbackPin$1, d as defineCustomElement$1 } from './p-af4650fb.js';
2
2
 
3
3
  const GiftbackPin = GiftbackPin$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,4 +1,4 @@
1
- import { G as GiftbackProgress$1, d as defineCustomElement$1 } from './p-bad9f0ec.js';
1
+ import { G as GiftbackProgress$1, d as defineCustomElement$1 } from './p-6a629b94.js';
2
2
 
3
3
  const GiftbackProgress = GiftbackProgress$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,4 +1,4 @@
1
- import { L as LoadingSpinner$1, d as defineCustomElement$1 } from './p-db0aa2d4.js';
1
+ import { L as LoadingSpinner$1, d as defineCustomElement$1 } from './p-b1a8e30d.js';
2
2
 
3
3
  const LoadingSpinner = LoadingSpinner$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -3789,8 +3789,15 @@ class CrmBonusService {
3789
3789
  const response = await this.axiosInstance.post("/api/crm-bonus/redeem-bonus", payload, { headers: { store } });
3790
3790
  return response.data;
3791
3791
  }
3792
+ async cancel(cartId, store) {
3793
+ const response = await this.axiosInstance.post("/api/crm-bonus/cancel-bonus", {
3794
+ num_pedido: cartId,
3795
+ used_bonus: true
3796
+ }, { headers: { store } });
3797
+ return response.data;
3798
+ }
3792
3799
  }
3793
3800
 
3794
3801
  export { CrmBonusService as C };
3795
3802
 
3796
- //# sourceMappingURL=p-374de9ae.js.map
3803
+ //# sourceMappingURL=p-39df4263.js.map