crmbonus-component-wake 0.0.14 → 0.0.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (196) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +7 -0
  2. package/dist/cjs/app-globals-3a1e7e63.js.map +1 -0
  3. package/dist/cjs/app-modal_2.cjs.entry.js +127 -0
  4. package/dist/cjs/app-modal_2.cjs.entry.js.map +1 -0
  5. package/dist/cjs/crm-bonus.cjs.entry.js +46 -0
  6. package/dist/cjs/crm-bonus.cjs.entry.js.map +1 -0
  7. package/dist/cjs/crmbonus-component-wake.cjs.js +27 -0
  8. package/dist/cjs/crmbonus-component-wake.cjs.js.map +1 -0
  9. package/dist/cjs/crmbonus.service-a626c034.js +3795 -0
  10. package/dist/cjs/crmbonus.service-a626c034.js.map +1 -0
  11. package/dist/cjs/giftback-finish_5.cjs.entry.js +153 -0
  12. package/dist/cjs/giftback-finish_5.cjs.entry.js.map +1 -0
  13. package/dist/cjs/index-52d8a075.js +1248 -0
  14. package/dist/cjs/index-52d8a075.js.map +1 -0
  15. package/dist/cjs/index.cjs.js +11 -0
  16. package/dist/cjs/index.cjs.js.map +1 -0
  17. package/dist/cjs/loader.cjs.js +17 -0
  18. package/dist/cjs/loader.cjs.js.map +1 -0
  19. package/dist/cjs/loading-spinner.cjs.entry.js +24 -0
  20. package/dist/cjs/loading-spinner.cjs.entry.js.map +1 -0
  21. package/dist/cjs/pedido-finalizado.cjs.entry.js +28 -0
  22. package/dist/cjs/pedido-finalizado.cjs.entry.js.map +1 -0
  23. package/dist/collection/collection-manifest.json +21 -0
  24. package/dist/collection/components/crm-bonus/assets/logo.svg +18 -0
  25. package/dist/collection/components/crm-bonus/assets/success-svgrepo-com.svg +8 -0
  26. package/dist/collection/components/crm-bonus/assets/svg/logo.svg +18 -0
  27. package/dist/collection/components/crm-bonus/assets/svg/success-svgrepo-com.svg +8 -0
  28. package/dist/collection/components/crm-bonus/crm-bonus.css +12 -0
  29. package/dist/collection/components/crm-bonus/crm-bonus.js +123 -0
  30. package/dist/collection/components/crm-bonus/crm-bonus.js.map +1 -0
  31. package/dist/collection/components/crm-bonus-form/crm-bonus-form.css +32 -0
  32. package/dist/collection/components/crm-bonus-form/crm-bonus-form.js +194 -0
  33. package/dist/collection/components/crm-bonus-form/crm-bonus-form.js.map +1 -0
  34. package/dist/collection/components/crm-bonus-form/subcomponents/giftback-finish/giftback-finish.css +10 -0
  35. package/dist/collection/components/crm-bonus-form/subcomponents/giftback-finish/giftback-finish.js +20 -0
  36. package/dist/collection/components/crm-bonus-form/subcomponents/giftback-finish/giftback-finish.js.map +1 -0
  37. package/dist/collection/components/crm-bonus-form/subcomponents/giftback-pin/giftback-pin.css +54 -0
  38. package/dist/collection/components/crm-bonus-form/subcomponents/giftback-pin/giftback-pin.js +111 -0
  39. package/dist/collection/components/crm-bonus-form/subcomponents/giftback-pin/giftback-pin.js.map +1 -0
  40. package/dist/collection/components/crm-bonus-form/subcomponents/giftback-progress/giftback-progress.css +95 -0
  41. package/dist/collection/components/crm-bonus-form/subcomponents/giftback-progress/giftback-progress.js +111 -0
  42. package/dist/collection/components/crm-bonus-form/subcomponents/giftback-progress/giftback-progress.js.map +1 -0
  43. package/dist/collection/components/crm-bonus-form/subcomponents/phone/phone.input.js +75 -0
  44. package/dist/collection/components/crm-bonus-form/subcomponents/phone/phone.input.js.map +1 -0
  45. package/dist/collection/components/loading-spinner/loading-spinner.css +17 -0
  46. package/dist/collection/components/loading-spinner/loading-spinner.js +63 -0
  47. package/dist/collection/components/loading-spinner/loading-spinner.js.map +1 -0
  48. package/dist/collection/components/modal/app-modal.css +45 -0
  49. package/dist/collection/components/modal/app-modal.js +83 -0
  50. package/dist/collection/components/modal/app-modal.js.map +1 -0
  51. package/dist/collection/components/pedido/pedido.js +58 -0
  52. package/dist/collection/components/pedido/pedido.js.map +1 -0
  53. package/dist/collection/components/phone/phone-input-mask.css +47 -0
  54. package/dist/collection/components/phone/phone-input-mask.js +90 -0
  55. package/dist/collection/components/phone/phone-input-mask.js.map +1 -0
  56. package/dist/collection/contants/index.js +8 -0
  57. package/dist/collection/contants/index.js.map +1 -0
  58. package/dist/collection/contants/mocks.js +28 -0
  59. package/dist/collection/contants/mocks.js.map +1 -0
  60. package/dist/collection/dto/pin.sent.js +2 -0
  61. package/dist/collection/dto/pin.sent.js.map +1 -0
  62. package/dist/collection/dto/validate.pin.bonus.js +2 -0
  63. package/dist/collection/dto/validate.pin.bonus.js.map +1 -0
  64. package/dist/collection/index.js +11 -0
  65. package/dist/collection/index.js.map +1 -0
  66. package/dist/collection/services/crmbonus.service.js +39 -0
  67. package/dist/collection/services/crmbonus.service.js.map +1 -0
  68. package/dist/collection/utils/utils.js +4 -0
  69. package/dist/collection/utils/utils.js.map +1 -0
  70. package/dist/components/app-modal.js +8 -0
  71. package/dist/components/app-modal.js.map +1 -0
  72. package/dist/components/crm-bonus-form.js +8 -0
  73. package/dist/components/crm-bonus-form.js.map +1 -0
  74. package/dist/components/crm-bonus.js +117 -0
  75. package/dist/components/crm-bonus.js.map +1 -0
  76. package/dist/components/giftback-finish.d.ts +11 -0
  77. package/dist/components/giftback-finish.js +8 -0
  78. package/dist/components/giftback-finish.js.map +1 -0
  79. package/dist/components/giftback-pin.js +8 -0
  80. package/dist/components/giftback-pin.js.map +1 -0
  81. package/dist/components/giftback-progress.js +8 -0
  82. package/dist/components/giftback-progress.js.map +1 -0
  83. package/dist/components/index.js +9 -0
  84. package/dist/components/index.js.map +1 -0
  85. package/dist/components/loading-spinner.js +8 -0
  86. package/dist/components/loading-spinner.js.map +1 -0
  87. package/dist/components/p-17ee9996.js +52 -0
  88. package/dist/components/p-17ee9996.js.map +1 -0
  89. package/dist/{crmbonus-component-wake/phone-input-mask.entry.js → components/p-2dbfb2c7.js} +34 -9
  90. package/dist/components/p-2dbfb2c7.js.map +1 -0
  91. package/dist/components/p-563ea4c5.js +166 -0
  92. package/dist/components/p-563ea4c5.js.map +1 -0
  93. package/dist/{crmbonus-component-wake/crmbonus.service-134e7b0c.js → components/p-629fcb5b.js} +99 -169
  94. package/dist/components/p-629fcb5b.js.map +1 -0
  95. package/dist/components/p-7294e43f.js +36 -0
  96. package/dist/components/p-7294e43f.js.map +1 -0
  97. package/dist/components/p-78529eea.js +39 -0
  98. package/dist/components/p-78529eea.js.map +1 -0
  99. package/dist/components/p-8e0ed8dd.js +43 -0
  100. package/dist/components/p-8e0ed8dd.js.map +1 -0
  101. package/dist/{crmbonus-component-wake/giftback-pin.entry.js → components/p-a1781d03.js} +38 -9
  102. package/dist/components/p-a1781d03.js.map +1 -0
  103. package/dist/components/p-a88bc337.js +67 -0
  104. package/dist/components/p-a88bc337.js.map +1 -0
  105. package/dist/components/p-faf7103e.js +1064 -0
  106. package/dist/components/p-faf7103e.js.map +1 -0
  107. package/dist/components/pedido-finalizado.js +45 -0
  108. package/dist/components/pedido-finalizado.js.map +1 -0
  109. package/dist/components/phone-input-mask.js +8 -0
  110. package/dist/components/phone-input-mask.js.map +1 -0
  111. package/dist/components/phone-input.js +8 -0
  112. package/dist/components/phone-input.js.map +1 -0
  113. package/dist/crmbonus-component-wake/assets/success-svgrepo-com.svg +8 -0
  114. package/dist/crmbonus-component-wake/crmbonus-component-wake.esm.js +1 -48
  115. package/dist/crmbonus-component-wake/crmbonus-component-wake.esm.js.map +1 -1
  116. package/dist/crmbonus-component-wake/index.esm.js +1 -16
  117. package/dist/crmbonus-component-wake/index.esm.js.map +1 -1
  118. package/dist/crmbonus-component-wake/p-54e51298.entry.js +2 -0
  119. package/dist/crmbonus-component-wake/p-54e51298.entry.js.map +1 -0
  120. package/dist/crmbonus-component-wake/p-629fcb5b.js +2 -0
  121. package/dist/crmbonus-component-wake/p-629fcb5b.js.map +1 -0
  122. package/dist/crmbonus-component-wake/p-6b075110.entry.js +2 -0
  123. package/dist/crmbonus-component-wake/p-6b075110.entry.js.map +1 -0
  124. package/dist/crmbonus-component-wake/p-72510682.js +3 -0
  125. package/dist/crmbonus-component-wake/p-72510682.js.map +1 -0
  126. package/dist/crmbonus-component-wake/p-82f64f70.entry.js +2 -0
  127. package/dist/crmbonus-component-wake/p-82f64f70.entry.js.map +1 -0
  128. package/dist/crmbonus-component-wake/p-bf4b486e.entry.js +2 -0
  129. package/dist/crmbonus-component-wake/p-bf4b486e.entry.js.map +1 -0
  130. package/dist/crmbonus-component-wake/p-e1255160.js +2 -0
  131. package/dist/crmbonus-component-wake/p-e1255160.js.map +1 -0
  132. package/dist/crmbonus-component-wake/p-f0d68c31.entry.js +2 -0
  133. package/dist/crmbonus-component-wake/p-f0d68c31.entry.js.map +1 -0
  134. package/dist/env.js +5 -0
  135. package/dist/env.js.map +1 -0
  136. package/dist/esm/app-modal_2.entry.js +122 -0
  137. package/dist/esm/app-modal_2.entry.js.map +1 -0
  138. package/dist/{crmbonus-component-wake → esm}/crm-bonus.entry.js +17 -8
  139. package/dist/esm/crm-bonus.entry.js.map +1 -0
  140. package/dist/esm/crmbonus-component-wake.js +22 -0
  141. package/dist/esm/crmbonus-component-wake.js.map +1 -0
  142. package/dist/esm/crmbonus.service-83f67708.js +3793 -0
  143. package/dist/esm/crmbonus.service-83f67708.js.map +1 -0
  144. package/dist/esm/giftback-finish_5.entry.js +145 -0
  145. package/dist/esm/giftback-finish_5.entry.js.map +1 -0
  146. package/dist/esm/index-9f7bde48.js +1220 -0
  147. package/dist/esm/index-9f7bde48.js.map +1 -0
  148. package/dist/esm/index.js +7 -0
  149. package/dist/esm/index.js.map +1 -0
  150. package/dist/esm/loader.js +13 -0
  151. package/dist/esm/loader.js.map +1 -0
  152. package/dist/{crmbonus-component-wake → esm}/loading-spinner.entry.js +4 -3
  153. package/dist/esm/loading-spinner.entry.js.map +1 -0
  154. package/dist/esm/pedido-finalizado.entry.js +24 -0
  155. package/dist/esm/pedido-finalizado.entry.js.map +1 -0
  156. package/dist/index.cjs.js +1 -0
  157. package/dist/index.js +1 -0
  158. package/dist/types/components/crm-bonus/crm-bonus.d.ts +7 -4
  159. package/dist/types/components/crm-bonus-form/crm-bonus-form.d.ts +2 -1
  160. package/dist/types/components/crm-bonus-form/subcomponents/giftback-finish/giftback-finish.d.ts +3 -0
  161. package/dist/types/components/crm-bonus-form/subcomponents/phone/phone.input.d.ts +1 -0
  162. package/dist/types/components/pedido/pedido.d.ts +2 -0
  163. package/dist/types/components/phone/phone-input-mask.d.ts +2 -0
  164. package/dist/types/components.d.ts +27 -4
  165. package/dist/types/contants/index.d.ts +2 -1
  166. package/dist/types/dto/validate.pin.bonus.d.ts +10 -2
  167. package/dist/types/home/darlison/Projects/crmbonus/{crmbonus-component-wake → app/crmbonus-component}/.stencil/env.d.ts +1 -1
  168. package/dist/types/services/crmbonus.service.d.ts +2 -1
  169. package/loader/cdn.js +1 -0
  170. package/loader/index.cjs.js +1 -0
  171. package/loader/index.d.ts +24 -0
  172. package/loader/index.es2017.js +1 -0
  173. package/loader/index.js +2 -0
  174. package/loader/package.json +11 -0
  175. package/package.json +1 -1
  176. package/dist/crmbonus-component-wake/app-modal.entry.js +0 -23
  177. package/dist/crmbonus-component-wake/app-modal.entry.js.map +0 -1
  178. package/dist/crmbonus-component-wake/crm-bonus-form.entry.js +0 -94
  179. package/dist/crmbonus-component-wake/crm-bonus-form.entry.js.map +0 -1
  180. package/dist/crmbonus-component-wake/crm-bonus.entry.js.map +0 -1
  181. package/dist/crmbonus-component-wake/crmbonus.service-134e7b0c.js.map +0 -1
  182. package/dist/crmbonus-component-wake/giftback-pin.entry.js.map +0 -1
  183. package/dist/crmbonus-component-wake/giftback-progress.entry.js +0 -39
  184. package/dist/crmbonus-component-wake/giftback-progress.entry.js.map +0 -1
  185. package/dist/crmbonus-component-wake/index-b9a7a992.js +0 -3039
  186. package/dist/crmbonus-component-wake/index-b9a7a992.js.map +0 -1
  187. package/dist/crmbonus-component-wake/loading-spinner.entry.js.map +0 -1
  188. package/dist/crmbonus-component-wake/pedido-finalizado.entry.js +0 -18
  189. package/dist/crmbonus-component-wake/pedido-finalizado.entry.js.map +0 -1
  190. package/dist/crmbonus-component-wake/phone-input-mask.entry.js.map +0 -1
  191. package/dist/crmbonus-component-wake/phone-input.entry.js +0 -20
  192. package/dist/crmbonus-component-wake/phone-input.entry.js.map +0 -1
  193. package/dist/crmbonus-component-wake/shadow-css-7ad5caf8.js +0 -334
  194. package/dist/crmbonus-component-wake/shadow-css-7ad5caf8.js.map +0 -1
  195. /package/dist/{crmbonus-component-wake → esm}/app-globals-0f993ce5.js +0 -0
  196. /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,12 @@
1
+ /* :host {
2
+ display: block;
3
+ } */
4
+
5
+ .container-button {
6
+ max-width: 136px;
7
+ cursor: pointer;
8
+ }
9
+
10
+ /* padding: 0 15px 15px;
11
+ border: 1px solid #ddd;
12
+ margin-bottom: 20px; */
@@ -0,0 +1,123 @@
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
+ const customer = await this.crmBonusService.getCustomer(this.userId, this.storeName);
20
+ console.log('user', customer);
21
+ this.products = JSON.parse(this.productsInString);
22
+ this.customer = customer;
23
+ }
24
+ buildProducts() {
25
+ return this.products.map(product => ({ sku: product.SKU, value: (product.PrecoPor * product.Quantidade), variantId: product.ProdutoVarianteId, qtd: product.Quantidade }));
26
+ }
27
+ render() {
28
+ return (h("div", { key: 'a9d7d72cfb5aae0ae1c438ebfa05b02b756ebc87' }, h("div", { key: 'fc9e2f2db672a6fb539cb81b10b9f55870504736', class: "container-button" }, h("img", { key: 'fb578e25ebe38ed7241c7ca78a4e3ef4b05e5838', src: logo, onClick: () => (this.showModal = true) })), h("app-modal", { key: '823586d229a18dceaaa3d18d106ade101f714166', isOpen: this.showModal, modalTitle: `Giftback`, onModalClosed: () => (this.showModal = false) }, h("crm-bonus-form", { key: 'baf21ce5211ce87a2d332fe9211f8024f94025ec', storeName: this.storeName, products: this.buildProducts(), cartId: this.cartId, customer: this.customer }))));
29
+ }
30
+ static get is() { return "crm-bonus"; }
31
+ static get encapsulation() { return "shadow"; }
32
+ static get originalStyleUrls() {
33
+ return {
34
+ "$": ["crm-bonus.css"]
35
+ };
36
+ }
37
+ static get styleUrls() {
38
+ return {
39
+ "$": ["crm-bonus.css"]
40
+ };
41
+ }
42
+ static get assetsDirs() { return ["assets"]; }
43
+ static get properties() {
44
+ return {
45
+ "userId": {
46
+ "type": "number",
47
+ "mutable": false,
48
+ "complexType": {
49
+ "original": "number",
50
+ "resolved": "number",
51
+ "references": {}
52
+ },
53
+ "required": false,
54
+ "optional": false,
55
+ "docs": {
56
+ "tags": [],
57
+ "text": ""
58
+ },
59
+ "attribute": "userid",
60
+ "reflect": false
61
+ },
62
+ "storeName": {
63
+ "type": "any",
64
+ "mutable": false,
65
+ "complexType": {
66
+ "original": "any",
67
+ "resolved": "any",
68
+ "references": {}
69
+ },
70
+ "required": false,
71
+ "optional": false,
72
+ "docs": {
73
+ "tags": [],
74
+ "text": ""
75
+ },
76
+ "attribute": "storename",
77
+ "reflect": false
78
+ },
79
+ "productsInString": {
80
+ "type": "string",
81
+ "mutable": false,
82
+ "complexType": {
83
+ "original": "string",
84
+ "resolved": "string",
85
+ "references": {}
86
+ },
87
+ "required": false,
88
+ "optional": false,
89
+ "docs": {
90
+ "tags": [],
91
+ "text": ""
92
+ },
93
+ "attribute": "products",
94
+ "reflect": false
95
+ },
96
+ "cartId": {
97
+ "type": "any",
98
+ "mutable": false,
99
+ "complexType": {
100
+ "original": "any",
101
+ "resolved": "any",
102
+ "references": {}
103
+ },
104
+ "required": false,
105
+ "optional": false,
106
+ "docs": {
107
+ "tags": [],
108
+ "text": ""
109
+ },
110
+ "attribute": "cartid",
111
+ "reflect": false
112
+ }
113
+ };
114
+ }
115
+ static get states() {
116
+ return {
117
+ "showModal": {},
118
+ "products": {},
119
+ "customer": {}
120
+ };
121
+ }
122
+ }
123
+ //# 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":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;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,SAAS,GAAG,KAAK,CAAC;gBAE7C,uEAAgB,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,QAAQ,EAAE,IAAI,CAAC,aAAa,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,GAAG,CAChH,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 const customer = await this.crmBonusService.getCustomer(this.userId, this.storeName);\n\n console.log('user', customer);\n this.products = JSON.parse(this.productsInString);\n this.customer = customer;\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 render() {\n return (\n <div>\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 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,194 @@
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.loading = false;
17
+ this.step = StepFormEnum.STEP_PHONE;
18
+ this.sent = undefined;
19
+ this.message = undefined;
20
+ this.phone = undefined;
21
+ this.bonus = undefined;
22
+ }
23
+ async sendPin(phone) {
24
+ var _a, _b;
25
+ this.loading = true;
26
+ this.message = "";
27
+ try {
28
+ const _phone = phone.replace(/\D/g, '');
29
+ this.phone = Number(_phone);
30
+ const sent = await this.crmBonusService.sendPin(this.phone, this.storeName);
31
+ this.sent = sent;
32
+ this.step = StepFormEnum.STEP_PIN;
33
+ }
34
+ catch (error) {
35
+ 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;
36
+ }
37
+ finally {
38
+ this.loading = false;
39
+ }
40
+ }
41
+ async validateBonus(pin) {
42
+ var _a, _b;
43
+ this.loading = true;
44
+ const payload = {
45
+ pin: pin,
46
+ cellphone: this.phone.toString(),
47
+ loja_id: this.sent.storeId,
48
+ user_id: this.sent.userId,
49
+ cartId: this.cartId,
50
+ products: this.products
51
+ };
52
+ try {
53
+ this.bonus = await this.crmBonusService.validatePinBonus(payload, this.storeName);
54
+ console.log('[this.bonus]', this.bonus);
55
+ this.step = StepFormEnum.STEP_RESERVE;
56
+ }
57
+ catch (error) {
58
+ 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;
59
+ }
60
+ finally {
61
+ this.loading = false;
62
+ }
63
+ console.log('payload', payload);
64
+ }
65
+ async reserve(amount) {
66
+ this.loading = true;
67
+ this.message = "";
68
+ try {
69
+ await this.crmBonusService.reserve({
70
+ redeemed_bonus: amount,
71
+ cart_id: this.cartId,
72
+ ticket: this.cartId,
73
+ gross_value: this.bonus.totalValue,
74
+ }, this.storeName);
75
+ }
76
+ catch (error) {
77
+ this.message = "ocorreu um error ao solicitar a aplicação do bonus! tente novamente";
78
+ }
79
+ finally {
80
+ this.loading = false;
81
+ }
82
+ }
83
+ render() {
84
+ 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)));
85
+ }
86
+ static get is() { return "crm-bonus-form"; }
87
+ static get encapsulation() { return "shadow"; }
88
+ static get originalStyleUrls() {
89
+ return {
90
+ "$": ["crm-bonus-form.css"]
91
+ };
92
+ }
93
+ static get styleUrls() {
94
+ return {
95
+ "$": ["crm-bonus-form.css"]
96
+ };
97
+ }
98
+ static get properties() {
99
+ return {
100
+ "storeName": {
101
+ "type": "any",
102
+ "mutable": false,
103
+ "complexType": {
104
+ "original": "any",
105
+ "resolved": "any",
106
+ "references": {}
107
+ },
108
+ "required": false,
109
+ "optional": false,
110
+ "docs": {
111
+ "tags": [],
112
+ "text": ""
113
+ },
114
+ "attribute": "storename",
115
+ "reflect": false
116
+ },
117
+ "cartId": {
118
+ "type": "any",
119
+ "mutable": false,
120
+ "complexType": {
121
+ "original": "any",
122
+ "resolved": "any",
123
+ "references": {}
124
+ },
125
+ "required": false,
126
+ "optional": false,
127
+ "docs": {
128
+ "tags": [],
129
+ "text": ""
130
+ },
131
+ "attribute": "cart-id",
132
+ "reflect": false
133
+ },
134
+ "products": {
135
+ "type": "unknown",
136
+ "mutable": false,
137
+ "complexType": {
138
+ "original": "Array<IProduct>",
139
+ "resolved": "IProduct[]",
140
+ "references": {
141
+ "Array": {
142
+ "location": "global",
143
+ "id": "global::Array"
144
+ },
145
+ "IProduct": {
146
+ "location": "import",
147
+ "path": "../../dto/validate.pin.bonus",
148
+ "id": "src/dto/validate.pin.bonus.ts::IProduct"
149
+ }
150
+ }
151
+ },
152
+ "required": false,
153
+ "optional": false,
154
+ "docs": {
155
+ "tags": [],
156
+ "text": ""
157
+ }
158
+ },
159
+ "customer": {
160
+ "type": "unknown",
161
+ "mutable": false,
162
+ "complexType": {
163
+ "original": "ICustomer",
164
+ "resolved": "ICustomer",
165
+ "references": {
166
+ "ICustomer": {
167
+ "location": "import",
168
+ "path": "../../dto/validate.pin.bonus",
169
+ "id": "src/dto/validate.pin.bonus.ts::ICustomer"
170
+ }
171
+ }
172
+ },
173
+ "required": false,
174
+ "optional": false,
175
+ "docs": {
176
+ "tags": [],
177
+ "text": ""
178
+ },
179
+ "defaultValue": "{\n phone: \"\",\n birthDate: \"\",\n document: \"\",\n name: \"\"\n }"
180
+ }
181
+ };
182
+ }
183
+ static get states() {
184
+ return {
185
+ "loading": {},
186
+ "step": {},
187
+ "sent": {},
188
+ "message": {},
189
+ "phone": {},
190
+ "bonus": {}
191
+ };
192
+ }
193
+ }
194
+ //# sourceMappingURL=crm-bonus-form.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crm-bonus-form.js","sourceRoot":"","sources":["../../../../src/components/crm-bonus-form/crm-bonus-form.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAGlE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAO9C,MAAM,OAAO,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,KAAK,CAAC,OAAO,CAAC,KAAa;;QAC9B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAElB,IAAI,CAAC;YACD,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,MA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,YAAY,IAAI,0EAAmB,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC,cAAsB,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,GAAI;YACtJ,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\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}"]}
@@ -0,0 +1,10 @@
1
+ .message-finish {
2
+ align-content: center;
3
+ text-align: center;
4
+ }
5
+
6
+ .message-finish p {
7
+ color: #777676;
8
+ font-size: xx-large;
9
+ font-family: sans-serif;
10
+ }
@@ -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' }, "B\u00F4nus Aplicado com sucesso!!!")));
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,iGAAoC,CAClC,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>Bônus Aplicado com sucesso!!!</p>\n </div>\n )\n }\n}"]}
@@ -0,0 +1,54 @@
1
+ :host {
2
+ display: block;
3
+ font-family: Arial, sans-serif;
4
+ }
5
+
6
+ .form-container-pin {
7
+ display: flex;
8
+ justify-content: space-around;
9
+ }
10
+
11
+ .pin-container {
12
+ display: flex;
13
+ gap: 10px;
14
+ margin: 10px 0;
15
+ }
16
+
17
+ input {
18
+ width: 40px;
19
+ height: 40px;
20
+ font-size: 18px;
21
+ text-align: center;
22
+ border: 1px solid #ccc;
23
+ border-radius: 5px;
24
+ }
25
+
26
+ button {
27
+ padding: 10px 20px;
28
+ background-color: #ddd;
29
+ border: none;
30
+ border-radius: 5px;
31
+ cursor: pointer;
32
+ }
33
+
34
+ button:hover {
35
+ background-color: #bbb;
36
+ }
37
+
38
+ .success {
39
+ color: green;
40
+ margin-top: 10px;
41
+ }
42
+
43
+ .button {
44
+ top: 50%;
45
+ background-color: #6c6c7e;
46
+ color: #fff;
47
+ border: none;
48
+ border-radius: 10px;
49
+ padding: 15px;
50
+ min-height: 30px;
51
+ min-width: 120px;
52
+ font-size: 20px;
53
+ cursor: pointer;
54
+ }
@@ -0,0 +1,111 @@
1
+ import { h } from "@stencil/core";
2
+ export class GiftbackPin {
3
+ constructor() {
4
+ this.sent = undefined;
5
+ this.validate = undefined;
6
+ this.pin = ['', '', '', ''];
7
+ this.isVerified = false;
8
+ this.loading = false;
9
+ }
10
+ handleInput(event, index) {
11
+ const input = event.target;
12
+ const value = input.value.slice(0, 1); // Limitar a um único dígito
13
+ this.pin[index] = value;
14
+ // Focar no próximo campo, se possível
15
+ if (value && index < this.pin.length - 1) {
16
+ const nextInput = input.nextElementSibling;
17
+ nextInput === null || nextInput === void 0 ? void 0 : nextInput.focus();
18
+ }
19
+ this.pin = [...this.pin];
20
+ }
21
+ validatePin() {
22
+ console.log('this.pin', this.pin);
23
+ this.validate(this.pin.join(""));
24
+ }
25
+ verifyPin() {
26
+ const pinCode = this.pin.join('');
27
+ if (pinCode === '9999') {
28
+ this.isVerified = true;
29
+ }
30
+ }
31
+ render() {
32
+ return (h("div", { key: 'fb696be7cae1986e09ac4bce2dba643353cec273', class: "form-container-pin" }, h("div", { key: '6daab87b9f214ee32be1e95e5570325dfb1b5317' }, h("p", { key: '92e8857410286b5f11152eaddd55cbffaa9af347' }, "Insira o PIN de 4 d\u00EDgitos enviado por SMS."), h("div", { key: '2ab858fc62bdae300a90f0d695d01a17159c16db', class: "pin-container" }, this.pin.map((_, index) => (h("input", { type: "text", maxLength: 1, value: this.pin[index], onInput: (event) => this.handleInput(event, index) }))))), h("button", { key: '1d04d747cf6a3b7db59a9560224b8c49b54d48c7', class: `button ${this.loading ? 'disabled' : ''} `, disabled: this.loading, onClick: () => this.validatePin() }, !this.loading ? "Enviar" : h("loading-spinner", { size: "15px", color: "#fff" }))));
33
+ }
34
+ static get is() { return "giftback-pin"; }
35
+ static get encapsulation() { return "shadow"; }
36
+ static get originalStyleUrls() {
37
+ return {
38
+ "$": ["giftback-pin.css"]
39
+ };
40
+ }
41
+ static get styleUrls() {
42
+ return {
43
+ "$": ["giftback-pin.css"]
44
+ };
45
+ }
46
+ static get properties() {
47
+ return {
48
+ "sent": {
49
+ "type": "unknown",
50
+ "mutable": false,
51
+ "complexType": {
52
+ "original": "IPinSent",
53
+ "resolved": "IPinSent",
54
+ "references": {
55
+ "IPinSent": {
56
+ "location": "import",
57
+ "path": "../../../../dto/pin.sent",
58
+ "id": "src/dto/pin.sent.ts::IPinSent"
59
+ }
60
+ }
61
+ },
62
+ "required": false,
63
+ "optional": false,
64
+ "docs": {
65
+ "tags": [],
66
+ "text": ""
67
+ }
68
+ },
69
+ "validate": {
70
+ "type": "unknown",
71
+ "mutable": false,
72
+ "complexType": {
73
+ "original": "(pin: string) => void",
74
+ "resolved": "(pin: string) => void",
75
+ "references": {}
76
+ },
77
+ "required": false,
78
+ "optional": false,
79
+ "docs": {
80
+ "tags": [],
81
+ "text": ""
82
+ }
83
+ },
84
+ "loading": {
85
+ "type": "boolean",
86
+ "mutable": false,
87
+ "complexType": {
88
+ "original": "boolean",
89
+ "resolved": "boolean",
90
+ "references": {}
91
+ },
92
+ "required": false,
93
+ "optional": false,
94
+ "docs": {
95
+ "tags": [],
96
+ "text": ""
97
+ },
98
+ "attribute": "loading",
99
+ "reflect": false,
100
+ "defaultValue": "false"
101
+ }
102
+ };
103
+ }
104
+ static get states() {
105
+ return {
106
+ "pin": {},
107
+ "isVerified": {}
108
+ };
109
+ }
110
+ }
111
+ //# sourceMappingURL=giftback-pin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"giftback-pin.js","sourceRoot":"","sources":["../../../../../../src/components/crm-bonus-form/subcomponents/giftback-pin/giftback-pin.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAQ1D,MAAM,OAAO,WAAW;;;;mBAKK,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;0BACV,KAAK;uBAET,KAAK;;IAEhC,WAAW,CAAC,KAAY,EAAE,KAAa;QACnC,MAAM,KAAK,GAAG,KAAK,CAAC,MAA0B,CAAC;QAC/C,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,4BAA4B;QACnE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;QAExB,sCAAsC;QACtC,IAAI,KAAK,IAAI,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvC,MAAM,SAAS,GAAG,KAAK,CAAC,kBAAsC,CAAC;YAC/D,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,KAAK,EAAE,CAAC;QACvB,CAAC;QAED,IAAI,CAAC,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAED,WAAW;QACP,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;QAClC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAA;IACpC,CAAC;IAED,SAAS;QACL,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAClC,IAAI,OAAO,KAAK,MAAM,EAAE,CAAC;YACrB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QAC3B,CAAC;IACL,CAAC;IAED,MAAM;QACF,OAAO,CACH,4DAAK,KAAK,EAAC,oBAAoB;YAC3B;gBACI,8GAAiD;gBACjD,4DAAK,KAAK,EAAC,eAAe,IACrB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,CACxB,aACI,IAAI,EAAC,MAAM,EACX,SAAS,EAAE,CAAC,EACZ,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EACtB,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,GACpD,CACL,CAAC,CACA,CACJ;YAEN,+DAAQ,KAAK,EAAE,UAAU,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,IAE7G,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,uBAAiB,IAAI,EAAC,MAAM,EAAC,KAAK,EAAC,MAAM,GAAG,CAEtE,CAGP,CACT,CAAC;IACN,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import { Component, h, Prop, State } from '@stencil/core';\nimport { IPinSent } from '../../../../dto/pin.sent';\n\n@Component({\n tag: 'giftback-pin',\n styleUrl: 'giftback-pin.css',\n shadow: true,\n})\nexport class GiftbackPin {\n\n @Prop() sent: IPinSent;\n @Prop() validate: (pin: string) => void;\n\n @State() pin: string[] = ['', '', '', ''];\n @State() isVerified: boolean = false;\n\n @Prop() loading: boolean = false;\n\n handleInput(event: Event, index: number) {\n const input = event.target as HTMLInputElement;\n const value = input.value.slice(0, 1); // Limitar a um único dígito\n this.pin[index] = value;\n\n // Focar no próximo campo, se possível\n if (value && index < this.pin.length - 1) {\n const nextInput = input.nextElementSibling as HTMLInputElement;\n nextInput?.focus();\n }\n\n this.pin = [...this.pin];\n }\n\n validatePin() {\n console.log('this.pin', this.pin);\n this.validate(this.pin.join(\"\"))\n }\n\n verifyPin() {\n const pinCode = this.pin.join('');\n if (pinCode === '9999') {\n this.isVerified = true;\n }\n }\n\n render() {\n return (\n <div class=\"form-container-pin\">\n <div >\n <p>Insira o PIN de 4 dígitos enviado por SMS.</p>\n <div class=\"pin-container\">\n {this.pin.map((_, index) => (\n <input\n type=\"text\"\n maxLength={1}\n value={this.pin[index]}\n onInput={(event) => this.handleInput(event, index)}\n />\n ))}\n </div>\n </div>\n\n <button class={`button ${this.loading ? 'disabled' : ''} `} disabled={this.loading} onClick={() => this.validatePin()}>\n {\n !this.loading ? \"Enviar\" : <loading-spinner size=\"15px\" color=\"#fff\" />\n }\n </button>\n {/* <button onClick={() => this.verifyPin()}>Enviar</button>\n {this.isVerified && <p class=\"success\">Código verificado com sucesso!</p>} */}\n </div>\n );\n }\n}\n"]}