@dropi/ui-components 1.0.12 → 1.0.13

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 (255) hide show
  1. package/README.md +55 -36
  2. package/dist/README.md +58 -38
  3. package/dist/components-source/accordion/accordion-item/accordion-item.component.d.ts +31 -0
  4. package/dist/components-source/accordion/accordion.component.d.ts +26 -0
  5. package/dist/components-source/alert/alert.component.d.ts +32 -0
  6. package/dist/components-source/alert-modal/alert-modal.component.d.ts +78 -0
  7. package/dist/components-source/alert-validation/alert-validation.component.d.ts +21 -0
  8. package/dist/components-source/badge/badge.component.d.ts +12 -0
  9. package/dist/components-source/beta-tag/beta-tag.component.d.ts +5 -0
  10. package/dist/components-source/breadcrumb/breadcrumb.component.d.ts +11 -0
  11. package/dist/components-source/card-product/card-product.component.d.ts +204 -0
  12. package/dist/components-source/card-section/card-section.component.d.ts +31 -0
  13. package/dist/components-source/checkbox-selection-list/checkbox-selection-list.component.d.ts +26 -0
  14. package/dist/components-source/city-selector/city-selector.component.d.ts +17 -0
  15. package/dist/components-source/color-picker/color-picker.component.d.ts +73 -0
  16. package/dist/components-source/confirm-dialog/confirm-dialog.component.d.ts +10 -0
  17. package/dist/components-source/country-flags/country-flags.component.d.ts +12 -0
  18. package/dist/components-source/date-picker/date-picker.component.d.ts +27 -0
  19. package/dist/components-source/date-picker-range/date-picker-range.component.d.ts +26 -0
  20. package/dist/components-source/dropi-avatars/dropi-avatars.component.d.ts +11 -0
  21. package/dist/components-source/dropi-badge/dropi-badge.component.d.ts +29 -0
  22. package/dist/components-source/dropi-banner-external/dropi-banner-external.component.d.ts +19 -0
  23. package/dist/components-source/dropi-breadcrumb/dropi-breadcrumb.component.d.ts +22 -0
  24. package/dist/components-source/dropi-card-checkbox/dropi-card-checkbox.component.d.ts +20 -0
  25. package/dist/components-source/dropi-carousel/dropi-carousel.component.d.ts +52 -0
  26. package/dist/components-source/dropi-checkbox/dropi-checkbox.component.d.ts +11 -0
  27. package/dist/components-source/dropi-chips/dropi-chips.component.d.ts +17 -0
  28. package/dist/components-source/dropi-country-selector/countries.data.d.ts +6 -0
  29. package/dist/components-source/dropi-country-selector/dropi-country-selector.component.d.ts +90 -0
  30. package/dist/components-source/dropi-drawer/dropi-drawer.component.d.ts +20 -0
  31. package/dist/components-source/dropi-dropdown/dropi-dropdown.component.d.ts +20 -0
  32. package/dist/components-source/dropi-favorite-button/dropi-favorite-button.component.d.ts +12 -0
  33. package/dist/components-source/dropi-file-upload/card-view/card-view.component.d.ts +19 -0
  34. package/dist/components-source/dropi-file-upload/drop-zone/drop-zone.component.d.ts +38 -0
  35. package/dist/components-source/dropi-file-upload/dropi-file-upload.component.d.ts +18 -0
  36. package/dist/components-source/dropi-file-upload/file-list/file-list.component.d.ts +39 -0
  37. package/dist/components-source/dropi-file-upload/grid-view/grid-view.component.d.ts +15 -0
  38. package/dist/components-source/dropi-ilustration-icon/dropi-ilustration-icon.component.d.ts +20 -0
  39. package/dist/components-source/dropi-image-overlay/dropi-image-overlay.component.d.ts +8 -0
  40. package/dist/components-source/dropi-languages-selector/dropi-languages-selector.component.d.ts +18 -0
  41. package/dist/components-source/dropi-logo/dropi-logo.component.d.ts +12 -0
  42. package/dist/components-source/dropi-modal/dropi-modal.component.d.ts +34 -0
  43. package/dist/components-source/dropi-modal/p-template.directive.d.ts +9 -0
  44. package/dist/components-source/dropi-navbar/dropi-navbar.component.d.ts +20 -0
  45. package/dist/components-source/dropi-paginator/dropi-paginator.component.d.ts +21 -0
  46. package/dist/components-source/dropi-phone-input/dropi-phone-input.component.d.ts +55 -0
  47. package/dist/components-source/dropi-radio-button/dropi-radio-button.component.d.ts +17 -0
  48. package/dist/components-source/dropi-search/dropi-search.component.d.ts +40 -0
  49. package/dist/components-source/dropi-select/dropi-select.component.d.ts +34 -0
  50. package/dist/components-source/dropi-skeleton/dropi-skeleton.component.d.ts +14 -0
  51. package/dist/components-source/dropi-steps/dropi-steps.component.d.ts +64 -0
  52. package/dist/components-source/dropi-switch/dropi-switch.component.d.ts +11 -0
  53. package/dist/components-source/dropi-table/dropi-table.component.d.ts +82 -0
  54. package/dist/components-source/dropi-tag/dropi-tag.component.d.ts +15 -0
  55. package/dist/components-source/dropi-text-area/dropi-text-area.component.d.ts +14 -0
  56. package/dist/components-source/dropi-tooltip/dropi-tooltip.component.d.ts +28 -0
  57. package/dist/components-source/dropi-youtube-lazy-video/dropi-youtube-lazy-video.component.d.ts +16 -0
  58. package/dist/components-source/empty/empty.component.d.ts +9 -0
  59. package/dist/components-source/empty-state/empty-state.component.d.ts +17 -0
  60. package/dist/components-source/file-upload-progress-bar/file-upload-progress-bar.component.d.ts +30 -0
  61. package/dist/components-source/index.d.ts +85 -0
  62. package/dist/components-source/input/input.component.d.ts +33 -0
  63. package/dist/components-source/lottie-loader/lottie-loader.component.d.ts +9 -0
  64. package/dist/components-source/otp-send-code/otp-send-code.component.d.ts +83 -0
  65. package/dist/components-source/radio-selection-list/radio-selection-list.component.d.ts +30 -0
  66. package/dist/components-source/read-more/read-more.component.d.ts +60 -0
  67. package/dist/components-source/sidebar/sidebar.component.d.ts +27 -0
  68. package/dist/components-source/simple-stepper/simple-stepper.component.d.ts +21 -0
  69. package/dist/components-source/spinner/spinner.component.d.ts +9 -0
  70. package/dist/components-source/tabs/tabs.component.d.ts +27 -0
  71. package/dist/components-source/tag-type-product/tag-type-product.component.d.ts +5 -0
  72. package/dist/components-source/toast/toast.component.d.ts +21 -0
  73. package/dist/components-source/toggle/input-toggle.component.d.ts +11 -0
  74. package/dist/components-source/tooltip/tooltip.component.d.ts +15 -0
  75. package/dist/components-source/vertical-steps/vertical-steps.component.d.ts +27 -0
  76. package/dist/esm2022/components-source/accordion/accordion-item/accordion-item.component.mjs +51 -0
  77. package/dist/esm2022/components-source/accordion/accordion.component.mjs +46 -0
  78. package/dist/esm2022/components-source/alert/alert.component.mjs +114 -0
  79. package/dist/esm2022/components-source/alert-modal/alert-modal.component.mjs +247 -0
  80. package/dist/esm2022/components-source/alert-validation/alert-validation.component.mjs +53 -0
  81. package/dist/esm2022/components-source/badge/badge.component.mjs +23 -0
  82. package/dist/esm2022/components-source/beta-tag/beta-tag.component.mjs +11 -0
  83. package/dist/esm2022/components-source/breadcrumb/breadcrumb.component.mjs +26 -0
  84. package/dist/esm2022/components-source/card-product/card-product.component.mjs +534 -0
  85. package/dist/esm2022/components-source/card-section/card-section.component.mjs +91 -0
  86. package/dist/esm2022/components-source/checkbox-selection-list/checkbox-selection-list.component.mjs +79 -0
  87. package/dist/esm2022/components-source/city-selector/city-selector.component.mjs +53 -0
  88. package/dist/esm2022/components-source/color-picker/color-picker.component.mjs +320 -0
  89. package/dist/esm2022/components-source/confirm-dialog/confirm-dialog.component.mjs +27 -0
  90. package/dist/esm2022/components-source/country-flags/country-flags.component.mjs +27 -0
  91. package/dist/esm2022/components-source/date-picker/date-picker.component.mjs +73 -0
  92. package/dist/esm2022/components-source/date-picker-range/date-picker-range.component.mjs +67 -0
  93. package/dist/esm2022/components-source/dropi-avatars/dropi-avatars.component.mjs +31 -0
  94. package/dist/esm2022/components-source/dropi-badge/dropi-badge.component.mjs +45 -0
  95. package/dist/esm2022/components-source/dropi-banner-external/dropi-banner-external.component.mjs +39 -0
  96. package/dist/esm2022/components-source/dropi-breadcrumb/dropi-breadcrumb.component.mjs +45 -0
  97. package/dist/esm2022/components-source/dropi-card-checkbox/dropi-card-checkbox.component.mjs +53 -0
  98. package/dist/esm2022/components-source/dropi-carousel/dropi-carousel.component.mjs +243 -0
  99. package/dist/esm2022/components-source/dropi-checkbox/dropi-checkbox.component.mjs +31 -0
  100. package/dist/esm2022/components-source/dropi-chips/dropi-chips.component.mjs +38 -0
  101. package/dist/esm2022/components-source/dropi-country-selector/countries.data.mjs +254 -0
  102. package/dist/esm2022/components-source/dropi-country-selector/dropi-country-selector.component.mjs +183 -0
  103. package/dist/esm2022/components-source/dropi-drawer/dropi-drawer.component.mjs +69 -0
  104. package/dist/esm2022/components-source/dropi-dropdown/dropi-dropdown.component.mjs +59 -0
  105. package/dist/esm2022/components-source/dropi-favorite-button/dropi-favorite-button.component.mjs +33 -0
  106. package/dist/esm2022/components-source/dropi-file-upload/card-view/card-view.component.mjs +47 -0
  107. package/dist/esm2022/components-source/dropi-file-upload/drop-zone/drop-zone.component.mjs +115 -0
  108. package/dist/esm2022/components-source/dropi-file-upload/dropi-file-upload.component.mjs +66 -0
  109. package/dist/esm2022/components-source/dropi-file-upload/file-list/file-list.component.mjs +95 -0
  110. package/dist/esm2022/components-source/dropi-file-upload/grid-view/grid-view.component.mjs +37 -0
  111. package/dist/esm2022/components-source/dropi-ilustration-icon/dropi-ilustration-icon.component.mjs +59 -0
  112. package/dist/esm2022/components-source/dropi-image-overlay/dropi-image-overlay.component.mjs +31 -0
  113. package/dist/esm2022/components-source/dropi-languages-selector/dropi-languages-selector.component.mjs +38 -0
  114. package/dist/esm2022/components-source/dropi-logo/dropi-logo.component.mjs +27 -0
  115. package/dist/esm2022/components-source/dropi-modal/dropi-modal.component.mjs +92 -0
  116. package/dist/esm2022/components-source/dropi-modal/p-template.directive.mjs +22 -0
  117. package/dist/esm2022/components-source/dropi-navbar/dropi-navbar.component.mjs +51 -0
  118. package/dist/esm2022/components-source/dropi-paginator/dropi-paginator.component.mjs +89 -0
  119. package/dist/esm2022/components-source/dropi-phone-input/dropi-phone-input.component.mjs +155 -0
  120. package/dist/esm2022/components-source/dropi-radio-button/dropi-radio-button.component.mjs +48 -0
  121. package/dist/esm2022/components-source/dropi-search/dropi-search.component.mjs +104 -0
  122. package/dist/esm2022/components-source/dropi-select/dropi-select.component.mjs +96 -0
  123. package/dist/esm2022/components-source/dropi-skeleton/dropi-skeleton.component.mjs +39 -0
  124. package/dist/esm2022/components-source/dropi-steps/dropi-steps.component.mjs +97 -0
  125. package/dist/esm2022/components-source/dropi-switch/dropi-switch.component.mjs +22 -0
  126. package/dist/esm2022/components-source/dropi-table/dropi-table.component.mjs +333 -0
  127. package/dist/esm2022/components-source/dropi-tag/dropi-tag.component.mjs +36 -0
  128. package/dist/esm2022/components-source/dropi-text-area/dropi-text-area.component.mjs +53 -0
  129. package/dist/esm2022/components-source/dropi-tooltip/dropi-tooltip.component.mjs +78 -0
  130. package/dist/esm2022/components-source/dropi-youtube-lazy-video/dropi-youtube-lazy-video.component.mjs +46 -0
  131. package/dist/esm2022/components-source/empty/empty.component.mjs +18 -0
  132. package/dist/esm2022/components-source/empty-state/empty-state.component.mjs +62 -0
  133. package/dist/esm2022/components-source/file-upload-progress-bar/file-upload-progress-bar.component.mjs +91 -0
  134. package/dist/esm2022/components-source/index.mjs +107 -0
  135. package/dist/esm2022/components-source/input/input.component.mjs +104 -0
  136. package/dist/esm2022/components-source/lottie-loader/lottie-loader.component.mjs +25 -0
  137. package/dist/esm2022/components-source/otp-send-code/otp-send-code.component.mjs +201 -0
  138. package/dist/esm2022/components-source/radio-selection-list/radio-selection-list.component.mjs +89 -0
  139. package/dist/esm2022/components-source/read-more/read-more.component.mjs +91 -0
  140. package/dist/esm2022/components-source/sidebar/sidebar.component.mjs +88 -0
  141. package/dist/esm2022/components-source/simple-stepper/simple-stepper.component.mjs +60 -0
  142. package/dist/esm2022/components-source/spinner/spinner.component.mjs +19 -0
  143. package/dist/esm2022/components-source/tabs/tabs.component.mjs +83 -0
  144. package/dist/esm2022/components-source/tag-type-product/tag-type-product.component.mjs +11 -0
  145. package/dist/esm2022/components-source/toast/toast.component.mjs +47 -0
  146. package/dist/esm2022/components-source/toggle/input-toggle.component.mjs +36 -0
  147. package/dist/esm2022/components-source/tooltip/tooltip.component.mjs +34 -0
  148. package/dist/esm2022/components-source/vertical-steps/vertical-steps.component.mjs +75 -0
  149. package/dist/esm2022/lib/elements-registry.mjs +343 -2
  150. package/dist/esm2022/utilities/interfaces/ui/dropi-table.interface.mjs +2 -0
  151. package/dist/esm2022/utilities/interfaces/ui/input-interface.mjs +2 -0
  152. package/dist/esm2022/utilities/interfaces/ui/select-interface.mjs +2 -0
  153. package/dist/esm2022/utilities/interfaces/ui/selection-list-interface.mjs +2 -0
  154. package/dist/esm2022/utilities/interfaces/ui/upload.model.mjs +5 -0
  155. package/dist/fesm2022/dropi-ui-components.mjs +5913 -2
  156. package/dist/fesm2022/dropi-ui-components.mjs.map +1 -1
  157. package/dist/utilities/interfaces/ui/dropi-table.interface.d.ts +45 -0
  158. package/dist/utilities/interfaces/ui/input-interface.d.ts +33 -0
  159. package/dist/utilities/interfaces/ui/select-interface.d.ts +8 -0
  160. package/dist/utilities/interfaces/ui/selection-list-interface.d.ts +24 -0
  161. package/dist/utilities/interfaces/ui/upload.model.d.ts +30 -0
  162. package/package.json +18 -6
  163. package/src/components-source/alert/alert.component.ts +12 -129
  164. package/src/components-source/alert-modal/alert-modal.component.ts +84 -114
  165. package/src/components-source/alert-validation/alert-validation.component.html +8 -0
  166. package/src/components-source/alert-validation/alert-validation.component.scss +225 -0
  167. package/src/components-source/alert-validation/alert-validation.component.ts +43 -0
  168. package/src/components-source/beta-tag/beta-tag.component.html +1 -0
  169. package/src/components-source/beta-tag/beta-tag.component.scss +26 -0
  170. package/src/components-source/beta-tag/beta-tag.component.ts +11 -0
  171. package/src/components-source/breadcrumb/breadcrumb.component.html +13 -5
  172. package/src/components-source/breadcrumb/breadcrumb.component.scss +8 -1
  173. package/src/components-source/breadcrumb/breadcrumb.component.spec.ts +26 -26
  174. package/src/components-source/breadcrumb/breadcrumb.component.ts +10 -12
  175. package/src/components-source/card-product/card-product.component.spec.ts +9 -9
  176. package/src/components-source/card-product/card-product.component.stories.ts +2 -2
  177. package/src/components-source/card-product/card-product.component.ts +294 -818
  178. package/src/components-source/card-section/card-section.component.html +7 -7
  179. package/src/components-source/card-section/card-section.component.ts +41 -15
  180. package/src/components-source/checkbox-selection-list/checkbox-selection-list.component.ts +42 -179
  181. package/src/components-source/city-selector/city-selector.component.ts +37 -137
  182. package/src/components-source/confirm-dialog/confirm-dialog.component.html +26 -0
  183. package/src/components-source/confirm-dialog/confirm-dialog.component.scss +55 -0
  184. package/src/components-source/confirm-dialog/confirm-dialog.component.ts +22 -0
  185. package/src/components-source/country-flags/country-flags.component.ts +20 -12
  186. package/src/components-source/date-picker/date-picker.component.ts +32 -292
  187. package/src/components-source/date-picker-range/date-picker-range.component.html +15 -7
  188. package/src/components-source/date-picker-range/date-picker-range.component.ts +42 -235
  189. package/src/components-source/dropi-banner-external/dropi-banner-external.component.ts +24 -185
  190. package/src/components-source/dropi-breadcrumb/dropi-breadcrumb.component.html +21 -21
  191. package/src/components-source/dropi-breadcrumb/dropi-breadcrumb.component.spec.ts +9 -9
  192. package/src/components-source/dropi-breadcrumb/dropi-breadcrumb.component.ts +41 -23
  193. package/src/components-source/dropi-breadcrumb/dropi-breadcrumb.stories.ts +12 -12
  194. package/src/components-source/dropi-chips/dropi-chips.component.ts +22 -87
  195. package/src/components-source/dropi-country-selector/countries.data.ts +256 -236
  196. package/src/components-source/dropi-country-selector/dropi-country-selector.component.ts +37 -25
  197. package/src/components-source/dropi-drawer/dropi-drawer.component.ts +91 -78
  198. package/src/components-source/dropi-dropdown/dropi-dropdown.component.ts +44 -47
  199. package/src/components-source/dropi-file-upload/card-view/card-view.component.ts +33 -53
  200. package/src/components-source/dropi-file-upload/drop-zone/drop-zone.component.ts +52 -123
  201. package/src/components-source/dropi-file-upload/dropi-file-upload.component.ts +38 -294
  202. package/src/components-source/dropi-file-upload/file-list/file-list.component.ts +62 -43
  203. package/src/components-source/dropi-file-upload/grid-view/grid-view.component.ts +23 -22
  204. package/src/components-source/dropi-ilustration-icon/dropi-ilustration-icon.component.scss +6 -2
  205. package/src/components-source/dropi-image-overlay/dropi-image-overlay.component.ts +16 -71
  206. package/src/components-source/dropi-modal/dropi-modal.component.ts +56 -372
  207. package/src/components-source/dropi-navbar/dropi-navbar.component.ts +17 -17
  208. package/src/components-source/dropi-paginator/dropi-paginator.component.html +18 -7
  209. package/src/components-source/dropi-paginator/dropi-paginator.component.ts +40 -32
  210. package/src/components-source/dropi-phone-input/dropi-phone-input.component.html +78 -79
  211. package/src/components-source/dropi-phone-input/dropi-phone-input.component.ts +29 -85
  212. package/src/components-source/dropi-search/dropi-search.component.ts +59 -222
  213. package/src/components-source/dropi-select/dropi-select.component.html +82 -131
  214. package/src/components-source/dropi-select/dropi-select.component.ts +60 -423
  215. package/src/components-source/dropi-table/dropi-table.component.html +40 -23
  216. package/src/components-source/dropi-table/dropi-table.component.ts +130 -374
  217. package/src/components-source/dropi-tag/dropi-tag.component.ts +20 -90
  218. package/src/components-source/dropi-text-area/dropi-text-area.component.ts +22 -48
  219. package/src/components-source/dropi-tooltip/dropi-tooltip.component.ts +40 -129
  220. package/src/components-source/empty/empty.component.html +3 -0
  221. package/src/components-source/empty/empty.component.scss +0 -0
  222. package/src/components-source/empty/empty.component.ts +16 -0
  223. package/src/components-source/empty-state/empty-state.component.ts +47 -19
  224. package/src/components-source/index.ts +82 -37
  225. package/src/components-source/input/input.component.html +79 -63
  226. package/src/components-source/input/input.component.ts +51 -97
  227. package/src/components-source/lottie-loader/lottie-loader.component.ts +13 -16
  228. package/src/components-source/otp-send-code/otp-send-code.component.ts +60 -528
  229. package/src/components-source/radio-selection-list/radio-selection-list.component.ts +36 -97
  230. package/src/components-source/sidebar/sidebar.component.spec.ts +11 -11
  231. package/src/components-source/sidebar/sidebar.component.stories.ts +3 -3
  232. package/src/components-source/sidebar/sidebar.component.ts +51 -47
  233. package/src/components-source/simple-stepper/simple-stepper.component.ts +20 -35
  234. package/src/components-source/spinner/spinner.component.html +6 -0
  235. package/src/components-source/spinner/spinner.component.scss +15 -0
  236. package/src/components-source/spinner/spinner.component.ts +17 -0
  237. package/src/components-source/tabs/tabs.component.spec.ts +8 -8
  238. package/src/components-source/tabs/tabs.component.stories.ts +5 -5
  239. package/src/components-source/tabs/tabs.component.ts +41 -83
  240. package/src/components-source/toast/toast.component.ts +40 -46
  241. package/src/components-source/toggle/input-toggle.component.html +34 -0
  242. package/src/components-source/toggle/input-toggle.component.scss +0 -0
  243. package/src/components-source/toggle/input-toggle.component.ts +27 -0
  244. package/src/components-source/toggle/inputToggleConfig.ts +11 -0
  245. package/src/components-source/tooltip/tooltip.component.html +22 -11
  246. package/src/components-source/tooltip/tooltip.component.ts +28 -13
  247. package/src/components-source/vertical-steps/vertical-steps.component.ts +16 -78
  248. package/src/lib/elements-registry.ts +413 -1
  249. package/src/lib/router-stub.ts +7 -0
  250. package/src/libreria work space.code-workspace +11 -8
  251. package/src/utilities/interfaces/ui/dropi-table.interface.ts +60 -0
  252. package/src/utilities/interfaces/ui/input-interface.ts +34 -0
  253. package/src/utilities/interfaces/ui/select-interface.ts +8 -0
  254. package/src/utilities/interfaces/ui/selection-list-interface.ts +15 -0
  255. package/src/utilities/interfaces/ui/upload.model.ts +41 -0
@@ -7,8 +7,10 @@ import {
7
7
  Output,
8
8
  QueryList,
9
9
  ViewChildren,
10
- } from '@angular/core';
11
- import { CommonModule } from '@angular/common';
10
+ Inject,
11
+ CUSTOM_ELEMENTS_SCHEMA,
12
+ } from "@angular/core";
13
+ import { CommonModule } from "@angular/common";
12
14
  import {
13
15
  FormsModule,
14
16
  ReactiveFormsModule,
@@ -20,23 +22,11 @@ import {
20
22
  NG_VALIDATORS,
21
23
  NG_VALUE_ACCESSOR,
22
24
  Validator,
23
- } from '@angular/forms';
24
- import { SettingsService } from 'src/app/services/setting.service';
25
- import { Api } from 'src/app/services/api.service';
26
- import { SegurityCodeService } from 'src/app/pages/service/segurity_code/segurity-code.service';
27
- import { TwoFactorAuthService } from '@app/components/two-factor-auth/service/two-factor-auth.service';
28
- import { IconComponent } from '@app/ui/icon/icon.component';
29
- import { AlertComponent } from '@app/ui/alert/alert.component';
30
- import { AlertModalComponent } from '../alert-modal/alert-modal.component';
31
- import { LoginService } from '@app/pages/service/auth/login.service';
32
- import Swal from 'sweetalert2';
33
- import { AlertComponent2 } from '../alert-legacy/alert.component';
34
- import { catchError, finalize, tap } from 'rxjs/operators';
35
- import { EMPTY } from 'rxjs';
36
- import { TranslateModule } from '@ngx-translate/core';
25
+ } from "@angular/forms";
26
+ import { TranslateModule } from "@ngx-translate/core";
37
27
 
38
28
  export interface DialogParams {
39
- type: 'question' | 'info' | 'error' | 'success' | '';
29
+ type: "question" | "info" | "error" | "success" | "";
40
30
  tittle: string;
41
31
  message: string;
42
32
  primaryButton: string;
@@ -44,27 +34,20 @@ export interface DialogParams {
44
34
  loadingTitle?: string;
45
35
  loadingMessage?: string;
46
36
  }
37
+
47
38
  function getFormArray(size: number): FormArray {
48
39
  const arr = [];
49
40
  for (let i = 0; i < size; i++) {
50
- arr.push(new FormControl(''));
41
+ arr.push(new FormControl(""));
51
42
  }
52
43
  return new FormArray(arr);
53
44
  }
54
45
 
55
46
  @Component({
56
- selector: 'otp-send-code',
47
+ selector: "otp-send-code",
57
48
  standalone: true,
58
- imports: [
59
- ReactiveFormsModule,
60
- CommonModule,
61
- FormsModule,
62
- IconComponent,
63
- AlertComponent,
64
- AlertModalComponent,
65
- AlertComponent2,
66
- TranslateModule
67
- ],
49
+ imports: [ReactiveFormsModule, CommonModule, FormsModule, TranslateModule],
50
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
68
51
  providers: [
69
52
  {
70
53
  provide: NG_VALUE_ACCESSOR,
@@ -77,40 +60,38 @@ function getFormArray(size: number): FormArray {
77
60
  multi: true,
78
61
  },
79
62
  ],
80
- templateUrl: './otp-send-code.component.html',
81
- styleUrls: ['./otp-send-code.component.scss'],
63
+ templateUrl: "./otp-send-code.component.html",
64
+ styleUrls: ["./otp-send-code.component.scss"],
82
65
  })
83
66
  export class OtpSendCodeComponent implements ControlValueAccessor, Validator {
84
- @ViewChildren('inputEl') inputEls!: QueryList<ElementRef<HTMLInputElement>>;
67
+ @ViewChildren("inputEl") inputEls!: QueryList<ElementRef<HTMLInputElement>>;
85
68
  @Output() codeCompleted = new EventEmitter<string>();
86
69
  @Output() codeAccepted = new EventEmitter<boolean>() as EventEmitter<boolean>;
87
70
  @Input() modulename: string;
88
- // recibe el medio por donde se enviara el codigo, solo acepta email o sms
89
- @Input() engine: string = 'email'; // email | sms | auth2fa | 2fa
71
+ @Input() engine: string = "email";
90
72
  @Input() userID: number = null;
91
73
  @Input() emailSend: string = null;
92
- @Input() typeAlert: number = 1; // 1 | 2
74
+ @Input() typeAlert: number = 1;
93
75
  @Input() paramSendCode: any = {};
94
76
  @Input() showLabelContact: boolean = false;
95
- @Input() typeLabelContact: number = 1; // 1 | 2;
96
- @Input() labelContact: string = '';
97
- @Input() typeBadge: number = 2; // 0 | 1 | 2
77
+ @Input() typeLabelContact: number = 1;
78
+ @Input() labelContact: string = "";
79
+ @Input() typeBadge: number = 2;
98
80
 
99
81
  inputs = getFormArray(6);
100
82
  timeLeft: number = 30;
101
- typeTimeLeft: string = 'segundos';
102
- interval: any;
83
+ typeTimeLeft: string = "segundos";
103
84
  isVisibleAlert = false;
104
85
  isMaximumAttempts = false;
105
86
 
106
87
  paramsDialog: DialogParams = {
107
- type: 'error',
108
- tittle: 'Has alcanzado el número máximo de intentos',
109
- message: 'Inténtalo de nuevo en 10 minutos.',
110
- primaryButton: '',
111
- secondaryButton: '',
112
- loadingTitle: '',
113
- loadingMessage: '',
88
+ type: "error",
89
+ tittle: "Has alcanzado el número máximo de intentos",
90
+ message: "Inténtalo de nuevo en 10 minutos.",
91
+ primaryButton: "",
92
+ secondaryButton: "",
93
+ loadingTitle: "",
94
+ loadingMessage: "",
114
95
  };
115
96
 
116
97
  failedValidation = false;
@@ -120,28 +101,26 @@ export class OtpSendCodeComponent implements ControlValueAccessor, Validator {
120
101
  errorEmailOTP: boolean = false;
121
102
  errorSendOTP: boolean = false;
122
103
  shouldShowAlert: boolean = false;
123
-
124
104
  applySendCode: boolean = false;
125
- errorMessageValidation: string = 'El código no coincide, vuelve a intentar';
105
+ errorMessageValidation: string = "El código no coincide, vuelve a intentar";
126
106
  showLabelSendContact: boolean = false;
127
- typeContact: string = '';
107
+ typeContact: string = "";
128
108
 
129
109
  paramsAlert = {
130
- state: 'question',
131
- message: '',
110
+ state: "question",
111
+ message: "",
132
112
  show: false,
133
113
  };
134
114
 
135
115
  sendTotalSeconds = 30;
136
116
  validationTotalSeconds = 0;
137
- private intervals: Record<string, any> = {};
138
117
 
139
118
  constructor(
140
- public settingsService: SettingsService,
141
- public apiService: Api,
142
- public segurityCodeService: SegurityCodeService,
143
- public twoFactorService: TwoFactorAuthService,
144
- public loginService: LoginService,
119
+ @Inject("SettingsService") public settingsService: any,
120
+ @Inject("ApiService") public apiService: any,
121
+ @Inject("SegurityCodeService") public segurityCodeService: any,
122
+ @Inject("TwoFactorAuthService") public twoFactorService: any,
123
+ @Inject("LoginService") public loginService: any,
145
124
  private cd: ChangeDetectorRef,
146
125
  ) {}
147
126
 
@@ -149,511 +128,64 @@ export class OtpSendCodeComponent implements ControlValueAccessor, Validator {
149
128
  onTouched?: () => void;
150
129
 
151
130
  ngOnInit() {
152
- Swal.close();
153
- if (this.settingsService.dropi_loginResult?.objects !== undefined) {
154
- this.validateDefaultEngineSelectedByUser();
155
- } else {
156
- this.sendCode();
157
- }
158
- }
159
-
160
- validateDefaultEngineSelectedByUser() {
161
- this.twoFactorService.getState().subscribe(
162
- (resp: any) => {
163
- if (!resp.isSuccess) {
164
- return;
165
- }
166
-
167
- if (resp.objects.required && resp.objects.actived) {
168
- this.engine = this.engine == 'auth2fa' ? this.engine : '2fa';
169
- }
170
-
171
- this.sendCode();
172
- },
173
- (e) => {
174
- console.error('Error al consultar estado de two factor');
175
- },
176
- );
131
+ this.sendCode();
177
132
  }
178
133
 
179
134
  sendCode() {
180
- if (!this.modulename) {
181
- console.error('OTP: No se envio el nombre del modulo');
182
- return;
183
- }
184
-
185
- if (['2fa'].includes(this.engine)) {
186
- return;
187
- } else if (this.engine == 'auth2fa') {
188
- if (this.modulename == 'Recovery 2fa') {
189
- this.showLabelSendContact = true;
190
- this.typeContact = ['1', '2'].some((c) => this.paramSendCode.channel.includes(c))
191
- ? 'email'
192
- : 'sms';
193
- this.recoveryTwoFactor();
194
- this.applySendCode = true;
195
- }
196
- } else if (['email', 'sms'].includes(this.engine)) {
197
- this.typeContact = this.showLabelContact ? this.engine : '';
198
- this.showLabelSendContact = this.showLabelContact;
199
- this.securityCodeSmsOrEmail();
200
- this.applySendCode = true;
201
- }
202
- this.startCountRegresiveResendCode();
135
+ this.applySendCode = true;
203
136
  }
204
137
 
205
138
  validateCode(otpValue: string) {
206
- this.startLoadingValidation();
207
- if (['auth2fa', '2fa'].includes(this.engine)) {
208
- this.twoFactorValidate(otpValue);
209
- } else {
210
- this.securityCodeValidate(otpValue);
211
- }
212
- }
213
-
214
- recoveryTwoFactor() {
215
- this.paramsAlert.show = false;
216
- this.twoFactorService.recovery(this.paramSendCode).subscribe(
217
- (result: any) => {
218
- console.log(`OTP enviado a ${this.engine}`);
219
- if (!result.isSuccess) {
220
- this.apiService.handleResult(result);
221
- console.error('Error al enviar el codigo');
222
- }
223
- this.showSuccessAlert('Se envió con éxito un nuevo código');
224
- this.stopTimer('validationTotalSeconds');
225
- this.errorMessageValidation = '';
226
- this.enableInputs();
227
- this.clearAndFocus();
228
- this.failedValidation = false;
229
- },
230
- (e) => {
231
- this.twoFactorService.validateAlertByTokenExpired(e);
232
- this.alertErrorSendCode(e);
233
- },
234
- );
235
- }
236
-
237
- securityCodeSmsOrEmail() {
238
- const userId = this.settingsService.dropi_loginResult?.objects?.id ?? this.userID;
239
- this.paramsAlert.show = false;
240
- this.disableInputs();
241
- this.sendingCode = true;
242
- // si no se envia el nombre del modulo se retorna
243
- this.segurityCodeService
244
- .createCode({
245
- module: this.modulename,
246
- email: this.emailSend,
247
- // typeOfRecovery: this.data?.typeOfRecovery,
248
- userId: userId,
249
- engine: this.engine,
250
- })
251
- .subscribe(
252
- (result: any) => {
253
- if (!result.isSuccess) {
254
- this.apiService.handleResult(result);
255
- console.error('Error al enviar el codigo');
256
- return;
257
- }
258
- this.sendingCode = false;
259
- this.showSuccessAlert('Se envió con éxito un nuevo código');
260
- this.enableInputs();
261
- this.clearAndFocus();
262
- this.failedValidation = false;
263
- },
264
- (e) => {
265
- this.apiService.handleResult(e);
266
- },
267
- );
268
- this.startTimer();
269
- }
270
-
271
- twoFactorValidate(otpValue: string) {
272
- const isRecovery = this.modulename === 'Recovery 2fa';
273
- const payload = { ...this.paramSendCode, code: otpValue };
274
-
275
- const call$ = isRecovery
276
- ? this.twoFactorService.validateRecovery(payload)
277
- : this.twoFactorService.verify(payload);
278
-
279
- call$
280
- .pipe(
281
- tap((resp: any) => {
282
- if (!resp.isSuccess) {
283
- console.error('Código incorrecto');
284
- this.failedValidation = true;
285
- this.codeAccepted.emit(false);
286
- return; // corta aquí el happy path
287
- }
288
-
289
- // éxito
290
- this.codeCompleted.emit(otpValue);
291
- this.failedValidation = false;
292
- this.codeAccepted.emit(true);
293
-
294
- // sólo en flujo normal (no recovery)
295
- if (!isRecovery) {
296
- this.loginService.notifyActived2fa = resp.objects?.notify_actived;
297
- }
298
- }),
299
- catchError((e) => {
300
- this.twoFactorService.validateAlertByTokenExpired(e);
301
- if (isRecovery) {
302
- this.alertErrorValidateCode(e, isRecovery);
303
- } else {
304
- this.simpleAlertError();
305
- }
306
- return EMPTY; // evita un segundo subscribe
307
- }),
308
- finalize(() => this.stopLoadingValidation()),
309
- )
310
- .subscribe();
311
- }
312
-
313
- securityCodeValidate(otpValue: string) {
314
- this.startLoadingValidation();
315
- this.segurityCodeService
316
- .verifyCode({
317
- code: otpValue,
318
- module: this.modulename,
319
- email: this.emailSend,
320
- // typeOfRecovery: this.data?.typeOfRecovery,
321
- userId: this.settingsService.dropi_loginResult?.objects?.id ?? this.userID,
322
- white_brand_id: this.settingsService.getBrand().id,
323
- // environment: environmentName,
324
- })
325
- .subscribe(
326
- (resp: any) => {
327
- this.stopLoadingValidation();
328
- if (resp.isSuccess == true) {
329
- this.codeCompleted.emit(otpValue);
330
- this.codeAccepted.emit(true);
331
- this.failedValidation = false; // Reset failedValidation on success
332
- } else {
333
- console.error('Codigo incorrecto');
334
- this.failedValidation = true;
335
- this.codeAccepted.emit(false);
336
- }
337
- },
338
- (e) => {
339
- this.loadingValidation = false;
340
- this.stopLoadingValidation();
341
-
342
- this.failedValidation = true;
343
- this.codeAccepted.emit(false);
344
- console.error('Error validating otp code: Máximo de intentos');
345
- console.log(e);
346
- if (
347
- e.error.message &&
348
- e.error.message == 'Error validating otp code: Máximo de intentos'
349
- ) {
350
- this.sendAlertError();
351
- }
352
-
353
- // cerrar alerta antes de abrirla this.apiService.handleResult(e);
354
- this.apiService.handleResult('Error al verificar el codigo');
355
- },
356
- );
357
- }
358
-
359
- alertErrorSendCode(e) {
360
- const input = e?.error?.error ?? '';
361
- const [messageError, timer] = input.split('|');
362
- this.showErrorAlert((e?.error?.message ?? '') + '. ' + messageError);
363
- if (messageError.includes('Bloqueado temporalmente')) {
364
- this.failedValidation = true;
365
- this.restartTimer(timer, 'send');
366
- this.restartTimer(0, 'validate', 'Bloqueado por reenvio de código');
367
- this.clearAndFocus();
368
- this.disableInputs();
369
- }
370
- }
371
-
372
- alertErrorValidateCode(e, applyValidateSendCode = false) {
373
- this.simpleAlertError();
374
-
375
- const input = e?.error?.error ?? '';
376
- const [messageError, timer] = input.split('|');
377
-
378
- if (messageError == 'Código invalido') {
379
- this.validationTotalSeconds = 0;
380
- this.errorMessageValidation = 'El código no coincide, vuelve a intentar';
381
- } else {
382
- if (messageError.includes('Bloqueado temporalmente')) {
383
- this.restartTimer(timer, 'validate');
384
- this.disableInputs();
385
- if (
386
- applyValidateSendCode &&
387
- messageError.includes('Ha superado el máximo intento de reenvios permitidos')
388
- ) {
389
- this.alertErrorSendCode(e);
390
- }
391
- } else {
392
- this.errorMessageValidation = messageError;
393
- if (messageError.includes('Nuevo código enviado')) {
394
- this.sendTotalSeconds = 30;
395
- this.startTimer('sendTotalSeconds');
396
- this.clearAndFocus();
397
- }
398
- }
399
- }
400
- }
401
-
402
- simpleAlertError() {
403
- this.stopLoadingValidation();
404
- this.failedValidation = true;
405
- this.codeAccepted.emit(false);
139
+ this.codeCompleted.emit(otpValue);
406
140
  }
407
141
 
408
142
  writeValue(value: string): void {
409
- if (value?.length) {
410
- throw new Error('Otp input is not supposed to be prefilled with data');
411
- }
412
- this.inputs.setValue(new Array(6).fill(''));
143
+ if (value) this.inputs.setValue(value.split(""));
413
144
  }
414
145
 
415
146
  registerOnChange(fn: any): void {
416
147
  this.onChange = fn;
417
148
  }
418
-
419
149
  registerOnTouched(fn: any): void {
420
150
  this.onTouched = fn;
421
151
  }
422
-
423
152
  setDisabledState(isDisabled: boolean): void {
424
- if (isDisabled) {
425
- this.inputs.disable();
426
- } else {
427
- this.inputs.enable();
428
- }
153
+ isDisabled ? this.inputs.disable() : this.inputs.enable();
429
154
  }
430
155
 
431
- validate(control: AbstractControl<string, string>): ValidationErrors | null {
432
- if (!control.value || control.value.length < 6) {
433
- return { otpInput: 'Value is incorrect' };
434
- }
156
+ validate(control: AbstractControl): ValidationErrors | null {
435
157
  return null;
436
158
  }
437
159
 
438
- handleKeyDown(e: KeyboardEvent, idx: number) {
439
- if (e.key === 'Backspace' || e.key === 'Delete') {
440
- if (idx > 0) {
441
- setTimeout(() => this.inputEls.get(idx - 1)?.nativeElement.focus(), 0);
442
- }
443
- }
444
- }
445
-
160
+ handleKeyDown(e: KeyboardEvent, idx: number) {}
446
161
  handleInput(e: Event, idx: number) {
447
- const input = e.target as HTMLInputElement;
448
- const value = input.value;
449
- if (/^\d$/.test(value)) {
450
- this.inputs.controls[idx].setValue(value);
451
- if (idx < this.inputs.length - 1) {
452
- setTimeout(() => this.inputEls.get(idx + 1)?.nativeElement.focus(), 0);
453
- }
454
- } else {
455
- input.value = '';
456
- }
457
- this.updateValue();
458
- }
459
-
460
- handleKeyPress(e: KeyboardEvent, idx: number) {
461
- const isDigit = /\d/.test(e.key);
462
- if (e.key === 'v' && e.metaKey) {
463
- return true;
464
- }
465
- if (isDigit && idx + 1 < this.inputs.length) {
466
- setTimeout(() => this.inputEls.get(idx + 1)?.nativeElement.focus(), 0);
467
- }
468
- if (isDigit && this.inputs.controls[idx].value) {
469
- this.inputs.controls[idx].setValue('');
470
- }
471
- return isDigit;
472
- }
473
-
474
- handlePaste(e: ClipboardEvent, idx: number) {
475
- e.preventDefault();
476
- if (idx !== 0) {
477
- return;
478
- }
479
- const pasteData = e.clipboardData?.getData('text');
480
- const regex = new RegExp(`\\d{6}`);
481
- if (!pasteData || !regex.test(pasteData)) {
482
- return;
483
- }
484
- for (let i = 0; i < pasteData.length; i++) {
485
- this.inputs.controls[i].setValue(pasteData[i]);
486
- }
487
- setTimeout(() => this.inputEls.get(this.inputEls.length - 1)?.nativeElement.focus(), 0);
488
162
  this.updateValue();
489
- this.onTouched?.();
490
- }
491
-
492
- handleFocus(e: FocusEvent) {
493
- const input = e.target as HTMLInputElement;
494
- input.select();
495
- this.inputEls.forEach((el) => el.nativeElement.classList.remove('input-focused'));
496
- input.classList.add('input-focused');
497
163
  }
498
-
499
- private debounceTimer: any;
164
+ handleKeyPress(e: KeyboardEvent, idx: number) {}
165
+ handlePaste(e: ClipboardEvent, idx: number) {}
166
+ handleFocus(e: FocusEvent) {}
500
167
 
501
168
  updateValue() {
502
- const otpValue = this.inputs.value.join('');
503
- clearTimeout(this.debounceTimer);
504
- this.debounceTimer = setTimeout(() => {
505
- this.onChange?.(otpValue);
506
- if (otpValue.length === 6) {
507
- this.validateCode(otpValue);
508
- }
509
- if (otpValue.length < 6) {
510
- this.failedValidation = false;
511
- }
512
- }, 400);
513
- }
514
-
515
- disableInputs() {
516
- this.inputs.controls.forEach((ctrl) => ctrl.disable());
517
- }
518
- enableInputs() {
519
- this.inputs.controls.forEach((ctrl) => ctrl.enable());
520
- this.focusOnLast();
169
+ const otpValue = this.inputs.value.join("");
170
+ this.onChange?.(otpValue);
171
+ if (otpValue.length === 6) this.validateCode(otpValue);
521
172
  }
522
173
 
523
- clearAndFocus() {
524
- // 1) Poner todos en blanco
525
- this.inputs.controls.forEach((ctrl) => ctrl.setValue(''));
526
-
527
- // 2) Esperar a que Angular dibuje el DOM limpio
528
- this.focusOnFirst();
529
- }
530
-
531
- focusOnFirst() {
532
- setTimeout(() => {
533
- // 3) Focar el primer input
534
- const first = this.inputEls.first;
535
- if (first) {
536
- first.nativeElement.focus();
537
- }
538
- });
539
- }
540
- focusOnLast() {
541
- setTimeout(() => {
542
- // Focar el ÚLTIMO input
543
- const last = this.inputEls.last;
544
- if (last) {
545
- last.nativeElement.focus();
546
- }
547
- });
548
- }
174
+ startTimer() {}
175
+ stopTimer() {}
176
+ showSuccessAlert(msg: string) {}
177
+ showErrorAlert(msg: string) {}
549
178
 
179
+ // Restaurando métodos faltantes requeridos por el template
550
180
  isNumeric(value: string): boolean {
551
- return /^\d$/.test(value);
552
- }
553
-
554
- startLoadingValidation() {
555
- this.disableInputs();
556
- this.failedValidation = false;
557
- this.loadingValidation = true;
558
- }
559
-
560
- stopLoadingValidation() {
561
- Swal.close();
562
- this.enableInputs();
563
- this.loadingValidation = false;
564
- }
565
-
566
- sendAlertError() {
567
- this.isVisibleAlert = true;
568
- }
569
-
570
- closeModalError() {
571
- this.isVisibleAlert = false;
572
- this.isMaximumAttempts = true;
573
- }
574
-
575
- showSuccessAlert(message: string) {
576
- this.paramsAlert = { state: 'success', message, show: true };
577
- }
578
-
579
- showErrorAlert(message: string) {
580
- this.paramsAlert = { state: 'error', message, show: true };
181
+ return /^\d+$/.test(value);
581
182
  }
582
183
 
583
- startTimer(varTime = null) {
584
- if (varTime == null) {
585
- return;
586
- }
587
-
588
- if (this.intervals[varTime]) {
589
- return; // ya corre
590
- }
591
-
592
- this.intervals[varTime] = setInterval(() => {
593
- if (this[varTime] > 0) {
594
- this[varTime]--;
595
- this.cd.detectChanges();
596
- this.checkIfZero(varTime);
597
- } else {
598
- this.stopTimer();
599
- }
600
- }, 1000);
184
+ calculateMinutes(prop: string): number {
185
+ return Math.floor((this as any)[prop] / 60);
601
186
  }
602
187
 
603
- startCountRegresiveResendCode() {
604
- this.stopTimer('sendTotalSeconds');
605
- this.sendTotalSeconds = 30;
606
- this.startTimer('sendTotalSeconds');
607
- }
608
-
609
- stopTimer(varTime = null) {
610
- if (varTime == null) {
611
- return; // ya corre
612
- }
613
- clearInterval(this.intervals[varTime]);
614
- this.intervals[varTime] = null;
615
- this[varTime] = 0;
616
- }
617
-
618
- restartTimer(timer, type, message = null) {
619
- if (['validate', 'all'].includes(type)) {
620
- this.errorMessageValidation =
621
- message !== null ? message : 'El código no coincide, vuelve a intentar en:';
622
- this.stopTimer('validationTotalSeconds');
623
- this.validationTotalSeconds = timer;
624
- this.startTimer('validationTotalSeconds');
625
- }
626
-
627
- if (['send', 'all'].includes(type)) {
628
- this.stopTimer('sendTotalSeconds');
629
- this.sendTotalSeconds = timer;
630
- this.startTimer('sendTotalSeconds');
631
- }
632
- }
633
-
634
- calculateMinutes(propName: 'sendTotalSeconds' | 'validationTotalSeconds'): number {
635
- return Math.floor(this[propName] / 60);
636
- }
637
-
638
- calculateSeconds(propName: 'sendTotalSeconds' | 'validationTotalSeconds'): number {
639
- return this[propName] % 60;
640
- }
641
-
642
- // 2) Método para verificar “llegó a 0” y disparar acción puntual
643
- checkIfZero(propName: 'sendTotalSeconds' | 'validationTotalSeconds') {
644
- if (this[propName] === 0) {
645
- if (propName === 'sendTotalSeconds') {
646
- this.paramsAlert.show = false;
647
- if (this.errorMessageValidation == 'Bloqueado por reenvio de código') {
648
- this.enableInputs();
649
- this.errorMessageValidation = 'Desbloqueado, vuelve a intentar';
650
- }
651
- }
652
-
653
- if (propName === 'validationTotalSeconds') {
654
- this.enableInputs();
655
- this.errorMessageValidation = 'El código no coincide, vuelve a intentar';
656
- }
657
- }
188
+ calculateSeconds(prop: string): number {
189
+ return (this as any)[prop] % 60;
658
190
  }
659
191
  }