crmbonus-component-wake 0.0.20 → 0.0.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (187) hide show
  1. package/dist/crmbonus-component-wake/app-modal.entry.js +23 -0
  2. package/dist/crmbonus-component-wake/app-modal.entry.js.map +1 -0
  3. package/dist/{esm/app-modal_2.entry.js → crmbonus-component-wake/crm-bonus-form.entry.js} +13 -26
  4. package/dist/crmbonus-component-wake/crm-bonus-form.entry.js.map +1 -0
  5. package/dist/{esm → crmbonus-component-wake}/crm-bonus.entry.js +16 -8
  6. package/dist/crmbonus-component-wake/crm-bonus.entry.js.map +1 -0
  7. package/dist/crmbonus-component-wake/crmbonus-component-wake.esm.js +48 -1
  8. package/dist/crmbonus-component-wake/crmbonus-component-wake.esm.js.map +1 -1
  9. package/dist/{cjs/crmbonus.service-a626c034.js → crmbonus-component-wake/crmbonus.service-5e579e1c.js} +165 -92
  10. package/dist/crmbonus-component-wake/crmbonus.service-5e579e1c.js.map +1 -0
  11. package/dist/{components/p-629fcb5b.js → crmbonus-component-wake/crmbonus.service-72c64bc3.js} +166 -91
  12. package/dist/crmbonus-component-wake/crmbonus.service-72c64bc3.js.map +1 -0
  13. package/dist/crmbonus-component-wake/crmbonus.service-a0dea046.js +3868 -0
  14. package/dist/crmbonus-component-wake/crmbonus.service-a0dea046.js.map +1 -0
  15. package/dist/{esm/crmbonus.service-83f67708.js → crmbonus-component-wake/crmbonus.service-ce105f62.js} +165 -90
  16. package/dist/crmbonus-component-wake/crmbonus.service-ce105f62.js.map +1 -0
  17. package/dist/crmbonus-component-wake/giftback-finish.entry.js +19 -0
  18. package/dist/crmbonus-component-wake/giftback-finish.entry.js.map +1 -0
  19. package/dist/crmbonus-component-wake/giftback-pin.entry.js +44 -0
  20. package/dist/crmbonus-component-wake/giftback-pin.entry.js.map +1 -0
  21. package/dist/crmbonus-component-wake/giftback-progress.entry.js +40 -0
  22. package/dist/crmbonus-component-wake/giftback-progress.entry.js.map +1 -0
  23. package/dist/crmbonus-component-wake/index-f557ce7c.js +3039 -0
  24. package/dist/crmbonus-component-wake/index-f557ce7c.js.map +1 -0
  25. package/dist/crmbonus-component-wake/index.esm.js +16 -1
  26. package/dist/crmbonus-component-wake/index.esm.js.map +1 -1
  27. package/dist/{esm → crmbonus-component-wake}/loading-spinner.entry.js +3 -4
  28. package/dist/crmbonus-component-wake/loading-spinner.entry.js.map +1 -0
  29. package/dist/{esm → crmbonus-component-wake}/pedido-finalizado.entry.js +3 -3
  30. package/dist/crmbonus-component-wake/pedido-finalizado.entry.js.map +1 -0
  31. package/dist/{components/p-2dbfb2c7.js → crmbonus-component-wake/phone-input-mask.entry.js} +9 -30
  32. package/dist/crmbonus-component-wake/phone-input-mask.entry.js.map +1 -0
  33. package/dist/crmbonus-component-wake/phone-input.entry.js +21 -0
  34. package/dist/crmbonus-component-wake/phone-input.entry.js.map +1 -0
  35. package/dist/crmbonus-component-wake/shadow-css-7ad5caf8.js +334 -0
  36. package/dist/crmbonus-component-wake/shadow-css-7ad5caf8.js.map +1 -0
  37. package/dist/types/components/crm-bonus/crm-bonus.d.ts +1 -0
  38. package/dist/types/components/crm-bonus-form/crm-bonus-form.d.ts +2 -0
  39. package/dist/types/components/crm-bonus-form/subcomponents/giftback-pin/giftback-pin.d.ts +1 -0
  40. package/dist/types/components/crm-bonus-form/subcomponents/giftback-progress/giftback-progress.d.ts +1 -0
  41. package/dist/types/components.d.ts +6 -0
  42. package/package.json +1 -1
  43. package/dist/cjs/app-globals-3a1e7e63.js +0 -7
  44. package/dist/cjs/app-globals-3a1e7e63.js.map +0 -1
  45. package/dist/cjs/app-modal_2.cjs.entry.js +0 -127
  46. package/dist/cjs/app-modal_2.cjs.entry.js.map +0 -1
  47. package/dist/cjs/crm-bonus.cjs.entry.js +0 -46
  48. package/dist/cjs/crm-bonus.cjs.entry.js.map +0 -1
  49. package/dist/cjs/crmbonus-component-wake.cjs.js +0 -27
  50. package/dist/cjs/crmbonus-component-wake.cjs.js.map +0 -1
  51. package/dist/cjs/crmbonus.service-a626c034.js.map +0 -1
  52. package/dist/cjs/giftback-finish_5.cjs.entry.js +0 -153
  53. package/dist/cjs/giftback-finish_5.cjs.entry.js.map +0 -1
  54. package/dist/cjs/index-52d8a075.js +0 -1248
  55. package/dist/cjs/index-52d8a075.js.map +0 -1
  56. package/dist/cjs/index.cjs.js +0 -11
  57. package/dist/cjs/index.cjs.js.map +0 -1
  58. package/dist/cjs/loader.cjs.js +0 -17
  59. package/dist/cjs/loader.cjs.js.map +0 -1
  60. package/dist/cjs/loading-spinner.cjs.entry.js +0 -24
  61. package/dist/cjs/loading-spinner.cjs.entry.js.map +0 -1
  62. package/dist/cjs/pedido-finalizado.cjs.entry.js +0 -28
  63. package/dist/cjs/pedido-finalizado.cjs.entry.js.map +0 -1
  64. package/dist/collection/collection-manifest.json +0 -21
  65. package/dist/collection/components/crm-bonus/assets/logo.svg +0 -18
  66. package/dist/collection/components/crm-bonus/assets/success-svgrepo-com.svg +0 -8
  67. package/dist/collection/components/crm-bonus/assets/svg/logo.svg +0 -18
  68. package/dist/collection/components/crm-bonus/assets/svg/success-svgrepo-com.svg +0 -8
  69. package/dist/collection/components/crm-bonus/crm-bonus.css +0 -20
  70. package/dist/collection/components/crm-bonus/crm-bonus.js +0 -123
  71. package/dist/collection/components/crm-bonus/crm-bonus.js.map +0 -1
  72. package/dist/collection/components/crm-bonus-form/crm-bonus-form.css +0 -32
  73. package/dist/collection/components/crm-bonus-form/crm-bonus-form.js +0 -194
  74. package/dist/collection/components/crm-bonus-form/crm-bonus-form.js.map +0 -1
  75. package/dist/collection/components/crm-bonus-form/subcomponents/giftback-finish/giftback-finish.css +0 -10
  76. package/dist/collection/components/crm-bonus-form/subcomponents/giftback-finish/giftback-finish.js +0 -20
  77. package/dist/collection/components/crm-bonus-form/subcomponents/giftback-finish/giftback-finish.js.map +0 -1
  78. package/dist/collection/components/crm-bonus-form/subcomponents/giftback-pin/giftback-pin.css +0 -54
  79. package/dist/collection/components/crm-bonus-form/subcomponents/giftback-pin/giftback-pin.js +0 -111
  80. package/dist/collection/components/crm-bonus-form/subcomponents/giftback-pin/giftback-pin.js.map +0 -1
  81. package/dist/collection/components/crm-bonus-form/subcomponents/giftback-progress/giftback-progress.css +0 -95
  82. package/dist/collection/components/crm-bonus-form/subcomponents/giftback-progress/giftback-progress.js +0 -111
  83. package/dist/collection/components/crm-bonus-form/subcomponents/giftback-progress/giftback-progress.js.map +0 -1
  84. package/dist/collection/components/crm-bonus-form/subcomponents/phone/phone.input.js +0 -75
  85. package/dist/collection/components/crm-bonus-form/subcomponents/phone/phone.input.js.map +0 -1
  86. package/dist/collection/components/loading-spinner/loading-spinner.css +0 -17
  87. package/dist/collection/components/loading-spinner/loading-spinner.js +0 -63
  88. package/dist/collection/components/loading-spinner/loading-spinner.js.map +0 -1
  89. package/dist/collection/components/modal/app-modal.css +0 -45
  90. package/dist/collection/components/modal/app-modal.js +0 -83
  91. package/dist/collection/components/modal/app-modal.js.map +0 -1
  92. package/dist/collection/components/pedido/pedido.js +0 -58
  93. package/dist/collection/components/pedido/pedido.js.map +0 -1
  94. package/dist/collection/components/phone/phone-input-mask.css +0 -47
  95. package/dist/collection/components/phone/phone-input-mask.js +0 -90
  96. package/dist/collection/components/phone/phone-input-mask.js.map +0 -1
  97. package/dist/collection/contants/index.js +0 -8
  98. package/dist/collection/contants/index.js.map +0 -1
  99. package/dist/collection/contants/mocks.js +0 -28
  100. package/dist/collection/contants/mocks.js.map +0 -1
  101. package/dist/collection/dto/pin.sent.js +0 -2
  102. package/dist/collection/dto/pin.sent.js.map +0 -1
  103. package/dist/collection/dto/validate.pin.bonus.js +0 -2
  104. package/dist/collection/dto/validate.pin.bonus.js.map +0 -1
  105. package/dist/collection/index.js +0 -11
  106. package/dist/collection/index.js.map +0 -1
  107. package/dist/collection/services/crmbonus.service.js +0 -39
  108. package/dist/collection/services/crmbonus.service.js.map +0 -1
  109. package/dist/collection/utils/utils.js +0 -4
  110. package/dist/collection/utils/utils.js.map +0 -1
  111. package/dist/components/app-modal.js +0 -8
  112. package/dist/components/app-modal.js.map +0 -1
  113. package/dist/components/crm-bonus-form.js +0 -8
  114. package/dist/components/crm-bonus-form.js.map +0 -1
  115. package/dist/components/crm-bonus.js +0 -117
  116. package/dist/components/crm-bonus.js.map +0 -1
  117. package/dist/components/giftback-finish.js +0 -8
  118. package/dist/components/giftback-finish.js.map +0 -1
  119. package/dist/components/giftback-pin.js +0 -8
  120. package/dist/components/giftback-pin.js.map +0 -1
  121. package/dist/components/giftback-progress.js +0 -8
  122. package/dist/components/giftback-progress.js.map +0 -1
  123. package/dist/components/index.js +0 -9
  124. package/dist/components/index.js.map +0 -1
  125. package/dist/components/loading-spinner.js +0 -8
  126. package/dist/components/loading-spinner.js.map +0 -1
  127. package/dist/components/p-17ee9996.js +0 -52
  128. package/dist/components/p-17ee9996.js.map +0 -1
  129. package/dist/components/p-2dbfb2c7.js.map +0 -1
  130. package/dist/components/p-563ea4c5.js +0 -166
  131. package/dist/components/p-563ea4c5.js.map +0 -1
  132. package/dist/components/p-629fcb5b.js.map +0 -1
  133. package/dist/components/p-7294e43f.js +0 -36
  134. package/dist/components/p-7294e43f.js.map +0 -1
  135. package/dist/components/p-78529eea.js +0 -39
  136. package/dist/components/p-78529eea.js.map +0 -1
  137. package/dist/components/p-8e0ed8dd.js +0 -43
  138. package/dist/components/p-8e0ed8dd.js.map +0 -1
  139. package/dist/components/p-a1781d03.js +0 -72
  140. package/dist/components/p-a1781d03.js.map +0 -1
  141. package/dist/components/p-a88bc337.js +0 -67
  142. package/dist/components/p-a88bc337.js.map +0 -1
  143. package/dist/components/p-faf7103e.js +0 -1064
  144. package/dist/components/p-faf7103e.js.map +0 -1
  145. package/dist/components/pedido-finalizado.js +0 -45
  146. package/dist/components/pedido-finalizado.js.map +0 -1
  147. package/dist/components/phone-input-mask.js +0 -8
  148. package/dist/components/phone-input-mask.js.map +0 -1
  149. package/dist/components/phone-input.js +0 -8
  150. package/dist/components/phone-input.js.map +0 -1
  151. package/dist/crmbonus-component-wake/p-54e51298.entry.js +0 -2
  152. package/dist/crmbonus-component-wake/p-54e51298.entry.js.map +0 -1
  153. package/dist/crmbonus-component-wake/p-629fcb5b.js +0 -2
  154. package/dist/crmbonus-component-wake/p-629fcb5b.js.map +0 -1
  155. package/dist/crmbonus-component-wake/p-6b075110.entry.js +0 -2
  156. package/dist/crmbonus-component-wake/p-6b075110.entry.js.map +0 -1
  157. package/dist/crmbonus-component-wake/p-72510682.js +0 -3
  158. package/dist/crmbonus-component-wake/p-72510682.js.map +0 -1
  159. package/dist/crmbonus-component-wake/p-ba53f0f3.entry.js +0 -2
  160. package/dist/crmbonus-component-wake/p-ba53f0f3.entry.js.map +0 -1
  161. package/dist/crmbonus-component-wake/p-bf4b486e.entry.js +0 -2
  162. package/dist/crmbonus-component-wake/p-bf4b486e.entry.js.map +0 -1
  163. package/dist/crmbonus-component-wake/p-e1255160.js +0 -2
  164. package/dist/crmbonus-component-wake/p-e1255160.js.map +0 -1
  165. package/dist/crmbonus-component-wake/p-f0d68c31.entry.js +0 -2
  166. package/dist/crmbonus-component-wake/p-f0d68c31.entry.js.map +0 -1
  167. package/dist/env.js +0 -5
  168. package/dist/env.js.map +0 -1
  169. package/dist/esm/app-modal_2.entry.js.map +0 -1
  170. package/dist/esm/crm-bonus.entry.js.map +0 -1
  171. package/dist/esm/crmbonus-component-wake.js +0 -22
  172. package/dist/esm/crmbonus-component-wake.js.map +0 -1
  173. package/dist/esm/crmbonus.service-83f67708.js.map +0 -1
  174. package/dist/esm/giftback-finish_5.entry.js +0 -145
  175. package/dist/esm/giftback-finish_5.entry.js.map +0 -1
  176. package/dist/esm/index-9f7bde48.js +0 -1220
  177. package/dist/esm/index-9f7bde48.js.map +0 -1
  178. package/dist/esm/index.js +0 -7
  179. package/dist/esm/index.js.map +0 -1
  180. package/dist/esm/loader.js +0 -13
  181. package/dist/esm/loader.js.map +0 -1
  182. package/dist/esm/loading-spinner.entry.js.map +0 -1
  183. package/dist/esm/pedido-finalizado.entry.js.map +0 -1
  184. package/dist/index.cjs.js +0 -1
  185. package/dist/index.js +0 -1
  186. /package/dist/{esm → crmbonus-component-wake}/app-globals-0f993ce5.js +0 -0
  187. /package/dist/{esm → crmbonus-component-wake}/app-globals-0f993ce5.js.map +0 -0
@@ -1,166 +0,0 @@
1
- import { p as proxyCustomElement, H, h, d as Host } from './p-faf7103e.js';
2
- import { C as CrmBonusService } from './p-629fcb5b.js';
3
- import { d as defineCustomElement$6 } from './p-7294e43f.js';
4
- import { d as defineCustomElement$5 } from './p-a1781d03.js';
5
- import { d as defineCustomElement$4 } from './p-a88bc337.js';
6
- import { d as defineCustomElement$3 } from './p-78529eea.js';
7
- import { d as defineCustomElement$2 } from './p-17ee9996.js';
8
- import { d as defineCustomElement$1 } from './p-2dbfb2c7.js';
9
-
10
- var StepFormEnum;
11
- (function (StepFormEnum) {
12
- StepFormEnum[StepFormEnum["STEP_PHONE"] = 1] = "STEP_PHONE";
13
- StepFormEnum[StepFormEnum["STEP_PIN"] = 2] = "STEP_PIN";
14
- StepFormEnum[StepFormEnum["STEP_RESERVE"] = 3] = "STEP_RESERVE";
15
- StepFormEnum[StepFormEnum["STEP_APPLY"] = 4] = "STEP_APPLY";
16
- })(StepFormEnum || (StepFormEnum = {}));
17
-
18
- const crmBonusFormCss = ".form-container{width:100%;display:flex;justify-content:center;justify-content:space-around}.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}.disabled{opacity:0.6;cursor:not-allowed}.message-error{color:#d11111;font-weight:bold;font-family:Arial;font-size:small;margin-left:16px}";
19
- const CrmBonusFormStyle0 = crmBonusFormCss;
20
-
21
- const CrmBonusForm = /*@__PURE__*/ proxyCustomElement(class CrmBonusForm extends H {
22
- constructor() {
23
- super();
24
- this.__registerHost();
25
- this.__attachShadow();
26
- this.crmBonusService = new CrmBonusService();
27
- this.storeName = undefined;
28
- this.cartId = undefined;
29
- this.products = undefined;
30
- this.customer = {
31
- phone: "",
32
- birthDate: "",
33
- document: "",
34
- name: ""
35
- };
36
- this.loading = false;
37
- this.step = StepFormEnum.STEP_PHONE;
38
- this.sent = undefined;
39
- this.message = undefined;
40
- this.phone = undefined;
41
- this.bonus = undefined;
42
- }
43
- async sendPin(phone) {
44
- var _a, _b;
45
- this.loading = true;
46
- this.message = "";
47
- try {
48
- const _phone = phone.replace(/\D/g, '');
49
- this.phone = Number(_phone);
50
- const sent = await this.crmBonusService.sendPin(this.phone, this.storeName);
51
- this.sent = sent;
52
- this.step = StepFormEnum.STEP_PIN;
53
- }
54
- catch (error) {
55
- 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;
56
- }
57
- finally {
58
- this.loading = false;
59
- }
60
- }
61
- async validateBonus(pin) {
62
- var _a, _b;
63
- this.loading = true;
64
- const payload = {
65
- pin: pin,
66
- cellphone: this.phone.toString(),
67
- loja_id: this.sent.storeId,
68
- user_id: this.sent.userId,
69
- cartId: this.cartId,
70
- products: this.products
71
- };
72
- try {
73
- this.bonus = await this.crmBonusService.validatePinBonus(payload, this.storeName);
74
- console.log('[this.bonus]', this.bonus);
75
- this.step = StepFormEnum.STEP_RESERVE;
76
- }
77
- catch (error) {
78
- 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;
79
- }
80
- finally {
81
- this.loading = false;
82
- }
83
- console.log('payload', payload);
84
- }
85
- async reserve(amount) {
86
- this.loading = true;
87
- this.message = "";
88
- try {
89
- await this.crmBonusService.reserve({
90
- redeemed_bonus: amount,
91
- cart_id: this.cartId,
92
- ticket: this.cartId,
93
- gross_value: this.bonus.totalValue,
94
- }, this.storeName);
95
- }
96
- catch (error) {
97
- this.message = "ocorreu um error ao solicitar a aplicação do bonus! tente novamente";
98
- }
99
- finally {
100
- this.loading = false;
101
- }
102
- }
103
- render() {
104
- return (h(Host, { key: '5a1b20b7243430f94b179ade85728592c077fa2e' }, this.step === StepFormEnum.STEP_PHONE && h("phone-input", { key: '9d0a8683efee3c35307c96899320696c30b3f411', value: this.customer.phone, sendPin: (phone) => this.sendPin(phone), loading: this.loading }), this.step === StepFormEnum.STEP_PIN && h("giftback-pin", { key: '6a4212e62ddd6c550eb43e414fa1b87365b0724e', sent: this.sent, validate: (data) => this.validateBonus(data), loading: this.loading }), this.step === StepFormEnum.STEP_RESERVE && h("giftback-progress", { key: '94bd68421255cc6a0c269466b9e8c664f8c771be', bonus: this.bonus, reserve: (amountRedeemed) => this.reserve(amountRedeemed) }), this.step === StepFormEnum.STEP_APPLY && h("giftback-finish", { key: 'd354369a81be61afd3c9b4133b07e624de5534c1' }), h("p", { key: 'bb80d97f27a67fdcea667fcaad6f5a300e3e8491', class: "message-error" }, this.message)));
105
- }
106
- static get style() { return CrmBonusFormStyle0; }
107
- }, [1, "crm-bonus-form", {
108
- "storeName": [8, "storename"],
109
- "cartId": [8, "cart-id"],
110
- "products": [16],
111
- "customer": [16],
112
- "loading": [32],
113
- "step": [32],
114
- "sent": [32],
115
- "message": [32],
116
- "phone": [32],
117
- "bonus": [32]
118
- }]);
119
- function defineCustomElement() {
120
- if (typeof customElements === "undefined") {
121
- return;
122
- }
123
- const components = ["crm-bonus-form", "giftback-finish", "giftback-pin", "giftback-progress", "loading-spinner", "phone-input", "phone-input-mask"];
124
- components.forEach(tagName => { switch (tagName) {
125
- case "crm-bonus-form":
126
- if (!customElements.get(tagName)) {
127
- customElements.define(tagName, CrmBonusForm);
128
- }
129
- break;
130
- case "giftback-finish":
131
- if (!customElements.get(tagName)) {
132
- defineCustomElement$6();
133
- }
134
- break;
135
- case "giftback-pin":
136
- if (!customElements.get(tagName)) {
137
- defineCustomElement$5();
138
- }
139
- break;
140
- case "giftback-progress":
141
- if (!customElements.get(tagName)) {
142
- defineCustomElement$4();
143
- }
144
- break;
145
- case "loading-spinner":
146
- if (!customElements.get(tagName)) {
147
- defineCustomElement$3();
148
- }
149
- break;
150
- case "phone-input":
151
- if (!customElements.get(tagName)) {
152
- defineCustomElement$2();
153
- }
154
- break;
155
- case "phone-input-mask":
156
- if (!customElements.get(tagName)) {
157
- defineCustomElement$1();
158
- }
159
- break;
160
- } });
161
- }
162
- defineCustomElement();
163
-
164
- export { CrmBonusForm as C, defineCustomElement as d };
165
-
166
- //# sourceMappingURL=p-563ea4c5.js.map
@@ -1 +0,0 @@
1
- {"file":"p-563ea4c5.js","mappings":";;;;;;;;;AAAA,IAAY,YAKX;AALD,WAAY,YAAY;IACpB,2DAAc,CAAA;IACd,uDAAY,CAAA;IACZ,+DAAgB,CAAA;IAChB,2DAAc,CAAA;AAClB,CAAC,EALW,YAAY,KAAZ,YAAY;;ACAxB,MAAM,eAAe,GAAG,sYAAsY,CAAC;AAC/Z,2BAAe,eAAe;;MCUjB,YAAY;;;;;QAEb,oBAAe,GAAoB,IAAI,eAAe,EAAE,CAAC;;;;wBAKnC;YAC1B,KAAK,EAAE,EAAE;YACT,SAAS,EAAE,EAAE;YACb,QAAQ,EAAE,EAAE;YACZ,IAAI,EAAE,EAAE;SACX;uBAE2B,KAAK;oBAET,YAAY,CAAC,UAAU;;;;;;IAUxC,MAAM,OAAO,CAAC,KAAa;;QAC9B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAElB,IAAI;YACA,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YACxC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;YAC5B,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;YAC5E,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;YACjB,IAAI,CAAC,IAAI,GAAG,YAAY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;;;;;;;;;;;;;;;","names":[],"sources":["src/contants/index.ts","src/components/crm-bonus-form/crm-bonus-form.css?tag=crm-bonus-form&encapsulation=shadow","src/components/crm-bonus-form/crm-bonus-form.tsx"],"sourcesContent":["export enum StepFormEnum {\n STEP_PHONE = 1,\n STEP_PIN = 2,\n STEP_RESERVE = 3,\n STEP_APPLY = 4\n}",".form-container {\n width: 100%;\n display: flex;\n justify-content: center;\n justify-content: space-around;\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}\n\n.disabled {\n opacity: 0.6;\n cursor: not-allowed;\n}\n\n.message-error {\n color: #d11111;\n font-weight: bold;\n font-family: Arial;\n font-size: small;\n margin-left: 16px;\n}","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\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 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 } 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 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 sent={this.sent} validate={(data) => this.validateBonus(data)} loading={this.loading} />}\n\n {this.step === StepFormEnum.STEP_RESERVE && <giftback-progress 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}"],"version":3}