@dropi/ui-components 1.0.0
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.
- package/.gitignore +13 -0
- package/CONTRIBUTING.md +188 -0
- package/MIGRATION_STEPS.md +39 -0
- package/PUBLISH_CHECKLIST.md +97 -0
- package/QUICK_START.md +108 -0
- package/README.md +146 -0
- package/jest.config.ts +21 -0
- package/ng-package.json +8 -0
- package/package.json +66 -0
- package/project.json +48 -0
- package/publish.sh +113 -0
- package/src/components-source/accordion/accordion-item/accordion-item.component.html +12 -0
- package/src/components-source/accordion/accordion-item/accordion-item.component.scss +47 -0
- package/src/components-source/accordion/accordion-item/accordion-item.component.spec.ts +122 -0
- package/src/components-source/accordion/accordion-item/accordion-item.component.ts +42 -0
- package/src/components-source/accordion/accordion.component.html +3 -0
- package/src/components-source/accordion/accordion.component.scss +5 -0
- package/src/components-source/accordion/accordion.component.spec.ts +243 -0
- package/src/components-source/accordion/accordion.component.stories.ts +111 -0
- package/src/components-source/accordion/accordion.component.ts +43 -0
- package/src/components-source/alert/alert.component.html +28 -0
- package/src/components-source/alert/alert.component.scss +154 -0
- package/src/components-source/alert/alert.component.spec.ts +185 -0
- package/src/components-source/alert/alert.component.stories.ts +310 -0
- package/src/components-source/alert/alert.component.ts +203 -0
- package/src/components-source/alert-legacy/alert.component.html +21 -0
- package/src/components-source/alert-legacy/alert.component.scss +42 -0
- package/src/components-source/alert-legacy/alert.component.spec.ts +159 -0
- package/src/components-source/alert-legacy/alert.component.ts +33 -0
- package/src/components-source/alert-modal/alert-modal.component.html +124 -0
- package/src/components-source/alert-modal/alert-modal.component.scss +203 -0
- package/src/components-source/alert-modal/alert-modal.component.spec.ts +557 -0
- package/src/components-source/alert-modal/alert-modal.component.stories.ts +295 -0
- package/src/components-source/alert-modal/alert-modal.component.ts +294 -0
- package/src/components-source/alert-modal/services/template-alert-modal.service.ts +75 -0
- package/src/components-source/badge/badge.component.html +49 -0
- package/src/components-source/badge/badge.component.scss +57 -0
- package/src/components-source/badge/badge.component.spec.ts +181 -0
- package/src/components-source/badge/badge.component.ts +21 -0
- package/src/components-source/breadcrumb/breadcrumb.component.html +5 -0
- package/src/components-source/breadcrumb/breadcrumb.component.scss +46 -0
- package/src/components-source/breadcrumb/breadcrumb.component.spec.ts +279 -0
- package/src/components-source/breadcrumb/breadcrumb.component.ts +24 -0
- package/src/components-source/card-product/card-product.component.html +173 -0
- package/src/components-source/card-product/card-product.component.spec.ts +601 -0
- package/src/components-source/card-product/card-product.component.stories.ts +322 -0
- package/src/components-source/card-product/card-product.component.ts +1101 -0
- package/src/components-source/card-section/card-section.component.html +22 -0
- package/src/components-source/card-section/card-section.component.scss +14 -0
- package/src/components-source/card-section/card-section.component.spec.ts +333 -0
- package/src/components-source/card-section/card-section.component.stories.ts +141 -0
- package/src/components-source/card-section/card-section.component.ts +35 -0
- package/src/components-source/checkbox-selection-list/checkbox-selection-list.component.html +38 -0
- package/src/components-source/checkbox-selection-list/checkbox-selection-list.component.scss +147 -0
- package/src/components-source/checkbox-selection-list/checkbox-selection-list.component.spec.ts +555 -0
- package/src/components-source/checkbox-selection-list/checkbox-selection-list.component.stories.ts +157 -0
- package/src/components-source/checkbox-selection-list/checkbox-selection-list.component.ts +219 -0
- package/src/components-source/city-selector/city-selector.component.html +22 -0
- package/src/components-source/city-selector/city-selector.component.scss +1 -0
- package/src/components-source/city-selector/city-selector.component.spec.ts +278 -0
- package/src/components-source/city-selector/city-selector.component.stories.ts +200 -0
- package/src/components-source/city-selector/city-selector.component.ts +151 -0
- package/src/components-source/color-picker/color-picker.component.html +54 -0
- package/src/components-source/color-picker/color-picker.component.scss +203 -0
- package/src/components-source/color-picker/color-picker.component.spec.ts +148 -0
- package/src/components-source/color-picker/color-picker.component.stories.ts +70 -0
- package/src/components-source/color-picker/color-picker.component.ts +353 -0
- package/src/components-source/country-flags/country-flags.component.html +10 -0
- package/src/components-source/country-flags/country-flags.component.scss +34 -0
- package/src/components-source/country-flags/country-flags.component.spec.ts +78 -0
- package/src/components-source/country-flags/country-flags.component.ts +18 -0
- package/src/components-source/date-picker/date-picker.component.html +35 -0
- package/src/components-source/date-picker/date-picker.component.scss +388 -0
- package/src/components-source/date-picker/date-picker.component.spec.ts +510 -0
- package/src/components-source/date-picker/date-picker.component.stories.ts +444 -0
- package/src/components-source/date-picker/date-picker.component.ts +313 -0
- package/src/components-source/date-picker/date-picker.stories.spec.ts +150 -0
- package/src/components-source/date-picker-range/date-picker-range.component.html +45 -0
- package/src/components-source/date-picker-range/date-picker-range.component.scss +229 -0
- package/src/components-source/date-picker-range/date-picker-range.component.spec.ts +555 -0
- package/src/components-source/date-picker-range/date-picker-range.component.ts +254 -0
- package/src/components-source/dropi-avatars/dropi-avatars.component.html +17 -0
- package/src/components-source/dropi-avatars/dropi-avatars.component.scss +58 -0
- package/src/components-source/dropi-avatars/dropi-avatars.component.spec.ts +403 -0
- package/src/components-source/dropi-avatars/dropi-avatars.component.ts +24 -0
- package/src/components-source/dropi-badge/dropi-badge.component.html +12 -0
- package/src/components-source/dropi-badge/dropi-badge.component.scss +50 -0
- package/src/components-source/dropi-badge/dropi-badge.component.spec.ts +108 -0
- package/src/components-source/dropi-badge/dropi-badge.component.stories.ts +140 -0
- package/src/components-source/dropi-badge/dropi-badge.component.ts +39 -0
- package/src/components-source/dropi-banner-external/dropi-banner-external.component.html +67 -0
- package/src/components-source/dropi-banner-external/dropi-banner-external.component.scss +46 -0
- package/src/components-source/dropi-banner-external/dropi-banner-external.component.spec.ts +170 -0
- package/src/components-source/dropi-banner-external/dropi-banner-external.component.stories.ts +203 -0
- package/src/components-source/dropi-banner-external/dropi-banner-external.component.ts +204 -0
- package/src/components-source/dropi-breadcrumb/dropi-breadcrumb.component.html +65 -0
- package/src/components-source/dropi-breadcrumb/dropi-breadcrumb.component.scss +65 -0
- package/src/components-source/dropi-breadcrumb/dropi-breadcrumb.component.spec.ts +125 -0
- package/src/components-source/dropi-breadcrumb/dropi-breadcrumb.component.ts +38 -0
- package/src/components-source/dropi-breadcrumb/dropi-breadcrumb.stories.ts +133 -0
- package/src/components-source/dropi-button/dropi-button.component.html +37 -0
- package/src/components-source/dropi-button/dropi-button.component.scss +266 -0
- package/src/components-source/dropi-button/dropi-button.component.spec.ts +264 -0
- package/src/components-source/dropi-button/dropi-button.component.stories.ts +221 -0
- package/src/components-source/dropi-button/dropi-button.component.ts +82 -0
- package/src/components-source/dropi-card-checkbox/dropi-card-checkbox.component.html +24 -0
- package/src/components-source/dropi-card-checkbox/dropi-card-checkbox.component.scss +85 -0
- package/src/components-source/dropi-card-checkbox/dropi-card-checkbox.component.spec.ts +157 -0
- package/src/components-source/dropi-card-checkbox/dropi-card-checkbox.component.stories.ts +209 -0
- package/src/components-source/dropi-card-checkbox/dropi-card-checkbox.component.ts +41 -0
- package/src/components-source/dropi-carousel/dropi-carousel.component.html +57 -0
- package/src/components-source/dropi-carousel/dropi-carousel.component.scss +156 -0
- package/src/components-source/dropi-carousel/dropi-carousel.component.spec.ts +224 -0
- package/src/components-source/dropi-carousel/dropi-carousel.component.ts +266 -0
- package/src/components-source/dropi-carousel/dropi-carousel.stories.ts +365 -0
- package/src/components-source/dropi-checkbox/dropi-checkbox.component.css +39 -0
- package/src/components-source/dropi-checkbox/dropi-checkbox.component.html +18 -0
- package/src/components-source/dropi-checkbox/dropi-checkbox.component.spec.ts +155 -0
- package/src/components-source/dropi-checkbox/dropi-checkbox.component.stories.ts +101 -0
- package/src/components-source/dropi-checkbox/dropi-checkbox.component.ts +25 -0
- package/src/components-source/dropi-chips/dropi-chips.component.html +10 -0
- package/src/components-source/dropi-chips/dropi-chips.component.scss +54 -0
- package/src/components-source/dropi-chips/dropi-chips.component.spec.ts +356 -0
- package/src/components-source/dropi-chips/dropi-chips.component.stories.ts +275 -0
- package/src/components-source/dropi-chips/dropi-chips.component.ts +100 -0
- package/src/components-source/dropi-country-selector/countries.data.ts +239 -0
- package/src/components-source/dropi-country-selector/dropi-country-selector.component.html +59 -0
- package/src/components-source/dropi-country-selector/dropi-country-selector.component.scss +126 -0
- package/src/components-source/dropi-country-selector/dropi-country-selector.component.spec.ts +244 -0
- package/src/components-source/dropi-country-selector/dropi-country-selector.component.stories.ts +117 -0
- package/src/components-source/dropi-country-selector/dropi-country-selector.component.ts +179 -0
- package/src/components-source/dropi-drawer/dropi-drawer.component.html +23 -0
- package/src/components-source/dropi-drawer/dropi-drawer.component.scss +88 -0
- package/src/components-source/dropi-drawer/dropi-drawer.component.spec.ts +84 -0
- package/src/components-source/dropi-drawer/dropi-drawer.component.ts +90 -0
- package/src/components-source/dropi-dropdown/dropi-dropdown.component.html +30 -0
- package/src/components-source/dropi-dropdown/dropi-dropdown.component.scss +58 -0
- package/src/components-source/dropi-dropdown/dropi-dropdown.component.spec.ts +213 -0
- package/src/components-source/dropi-dropdown/dropi-dropdown.component.stories.ts +143 -0
- package/src/components-source/dropi-dropdown/dropi-dropdown.component.ts +53 -0
- package/src/components-source/dropi-favorite-button/dropi-favorite-button.component.html +23 -0
- package/src/components-source/dropi-favorite-button/dropi-favorite-button.component.scss +21 -0
- package/src/components-source/dropi-favorite-button/dropi-favorite-button.component.spec.ts +240 -0
- package/src/components-source/dropi-favorite-button/dropi-favorite-button.component.ts +31 -0
- package/src/components-source/dropi-file-upload/card-view/card-view.component.html +154 -0
- package/src/components-source/dropi-file-upload/card-view/card-view.component.scss +118 -0
- package/src/components-source/dropi-file-upload/card-view/card-view.component.ts +72 -0
- package/src/components-source/dropi-file-upload/drop-zone/drop-zone.coment.stories.ts +179 -0
- package/src/components-source/dropi-file-upload/drop-zone/drop-zone.component.html +111 -0
- package/src/components-source/dropi-file-upload/drop-zone/drop-zone.component.scss +90 -0
- package/src/components-source/dropi-file-upload/drop-zone/drop-zone.component.ts +172 -0
- package/src/components-source/dropi-file-upload/dropi-file-upload.component.html +42 -0
- package/src/components-source/dropi-file-upload/dropi-file-upload.component.scss +31 -0
- package/src/components-source/dropi-file-upload/dropi-file-upload.component.spec.ts +398 -0
- package/src/components-source/dropi-file-upload/dropi-file-upload.component.stories.ts +139 -0
- package/src/components-source/dropi-file-upload/dropi-file-upload.component.ts +329 -0
- package/src/components-source/dropi-file-upload/file-list/file-list.component.html +51 -0
- package/src/components-source/dropi-file-upload/file-list/file-list.component.scss +60 -0
- package/src/components-source/dropi-file-upload/file-list/file-list.component.ts +84 -0
- package/src/components-source/dropi-file-upload/grid-view/grid-view.component.html +77 -0
- package/src/components-source/dropi-file-upload/grid-view/grid-view.component.scss +85 -0
- package/src/components-source/dropi-file-upload/grid-view/grid-view.component.ts +35 -0
- package/src/components-source/dropi-ilustration-icon/dropi-ilustration-icon.component.html +38 -0
- package/src/components-source/dropi-ilustration-icon/dropi-ilustration-icon.component.scss +59 -0
- package/src/components-source/dropi-ilustration-icon/dropi-ilustration-icon.component.spec.ts +214 -0
- package/src/components-source/dropi-ilustration-icon/dropi-ilustration-icon.component.ts +65 -0
- package/src/components-source/dropi-image-overlay/dropi-image-overlay.component.html +54 -0
- package/src/components-source/dropi-image-overlay/dropi-image-overlay.component.scss +210 -0
- package/src/components-source/dropi-image-overlay/dropi-image-overlay.component.spec.ts +145 -0
- package/src/components-source/dropi-image-overlay/dropi-image-overlay.component.ts +76 -0
- package/src/components-source/dropi-image-overlay/dropi-image-overlay.stories.ts +267 -0
- package/src/components-source/dropi-languages-selector/dropi-languages-selector.component.html +17 -0
- package/src/components-source/dropi-languages-selector/dropi-languages-selector.component.scss +82 -0
- package/src/components-source/dropi-languages-selector/dropi-languages-selector.component.spec.ts +152 -0
- package/src/components-source/dropi-languages-selector/dropi-languages-selector.component.ts +41 -0
- package/src/components-source/dropi-logo/dropi-logo.component.html +3 -0
- package/src/components-source/dropi-logo/dropi-logo.component.scss +20 -0
- package/src/components-source/dropi-logo/dropi-logo.component.spec.ts +274 -0
- package/src/components-source/dropi-logo/dropi-logo.component.ts +24 -0
- package/src/components-source/dropi-modal/dropi-modal-stack.service.ts +75 -0
- package/src/components-source/dropi-modal/dropi-modal.component.html +55 -0
- package/src/components-source/dropi-modal/dropi-modal.component.scss +274 -0
- package/src/components-source/dropi-modal/dropi-modal.component.spec.ts +46 -0
- package/src/components-source/dropi-modal/dropi-modal.component.stories.ts +392 -0
- package/src/components-source/dropi-modal/dropi-modal.component.ts +392 -0
- package/src/components-source/dropi-modal/p-template.directive.ts +11 -0
- package/src/components-source/dropi-navbar/dropi-navbar.component.html +41 -0
- package/src/components-source/dropi-navbar/dropi-navbar.component.scss +227 -0
- package/src/components-source/dropi-navbar/dropi-navbar.component.spec.ts +110 -0
- package/src/components-source/dropi-navbar/dropi-navbar.component.ts +52 -0
- package/src/components-source/dropi-paginator/dropi-paginator.component.html +64 -0
- package/src/components-source/dropi-paginator/dropi-paginator.component.scss +43 -0
- package/src/components-source/dropi-paginator/dropi-paginator.component.spec.ts +285 -0
- package/src/components-source/dropi-paginator/dropi-paginator.component.stories.ts +345 -0
- package/src/components-source/dropi-paginator/dropi-paginator.component.ts +85 -0
- package/src/components-source/dropi-phone-input/dropi-phone-input.component.html +93 -0
- package/src/components-source/dropi-phone-input/dropi-phone-input.component.scss +224 -0
- package/src/components-source/dropi-phone-input/dropi-phone-input.component.spec.ts +376 -0
- package/src/components-source/dropi-phone-input/dropi-phone-input.component.ts +203 -0
- package/src/components-source/dropi-phone-input/numeric-input.directive.ts +17 -0
- package/src/components-source/dropi-radio-button/dropi-radio-button.component.html +8 -0
- package/src/components-source/dropi-radio-button/dropi-radio-button.component.scss +33 -0
- package/src/components-source/dropi-radio-button/dropi-radio-button.component.spec.ts +225 -0
- package/src/components-source/dropi-radio-button/dropi-radio-button.component.ts +48 -0
- package/src/components-source/dropi-search/dropi-search.component.html +124 -0
- package/src/components-source/dropi-search/dropi-search.component.scss +116 -0
- package/src/components-source/dropi-search/dropi-search.component.spec.ts +483 -0
- package/src/components-source/dropi-search/dropi-search.component.stories.ts +267 -0
- package/src/components-source/dropi-search/dropi-search.component.ts +230 -0
- package/src/components-source/dropi-select/dropi-select.component.html +158 -0
- package/src/components-source/dropi-select/dropi-select.component.scss +275 -0
- package/src/components-source/dropi-select/dropi-select.component.spec.ts +386 -0
- package/src/components-source/dropi-select/dropi-select.component.stories.ts +686 -0
- package/src/components-source/dropi-select/dropi-select.component.ts +465 -0
- package/src/components-source/dropi-skeleton/dropi-skeleton.component.html +10 -0
- package/src/components-source/dropi-skeleton/dropi-skeleton.component.scss +28 -0
- package/src/components-source/dropi-skeleton/dropi-skeleton.component.spec.ts +273 -0
- package/src/components-source/dropi-skeleton/dropi-skeleton.component.stories.ts +145 -0
- package/src/components-source/dropi-skeleton/dropi-skeleton.component.ts +30 -0
- package/src/components-source/dropi-steps/dropi-steps.component.html +29 -0
- package/src/components-source/dropi-steps/dropi-steps.component.scss +110 -0
- package/src/components-source/dropi-steps/dropi-steps.component.spec.ts +228 -0
- package/src/components-source/dropi-steps/dropi-steps.component.stories.ts +231 -0
- package/src/components-source/dropi-steps/dropi-steps.component.ts +98 -0
- package/src/components-source/dropi-switch/dropi-switch.component.html +4 -0
- package/src/components-source/dropi-switch/dropi-switch.component.scss +50 -0
- package/src/components-source/dropi-switch/dropi-switch.component.spec.ts +105 -0
- package/src/components-source/dropi-switch/dropi-switch.component.stories.ts +106 -0
- package/src/components-source/dropi-switch/dropi-switch.component.ts +22 -0
- package/src/components-source/dropi-table/dropi-table.component.html +395 -0
- package/src/components-source/dropi-table/dropi-table.component.scss +506 -0
- package/src/components-source/dropi-table/dropi-table.component.spec.ts +578 -0
- package/src/components-source/dropi-table/dropi-table.component.stories.ts +313 -0
- package/src/components-source/dropi-table/dropi-table.component.ts +580 -0
- package/src/components-source/dropi-tag/dropi-tag.component.html +17 -0
- package/src/components-source/dropi-tag/dropi-tag.component.scss +50 -0
- package/src/components-source/dropi-tag/dropi-tag.component.spec.ts +267 -0
- package/src/components-source/dropi-tag/dropi-tag.component.stories.ts +290 -0
- package/src/components-source/dropi-tag/dropi-tag.component.ts +92 -0
- package/src/components-source/dropi-text-area/droip-text-area.component.stories.ts +138 -0
- package/src/components-source/dropi-text-area/dropi-text-area.component.html +63 -0
- package/src/components-source/dropi-text-area/dropi-text-area.component.scss +106 -0
- package/src/components-source/dropi-text-area/dropi-text-area.component.spec.ts +507 -0
- package/src/components-source/dropi-text-area/dropi-text-area.component.ts +80 -0
- package/src/components-source/dropi-tooltip/dropi-tooltip.component.html +70 -0
- package/src/components-source/dropi-tooltip/dropi-tooltip.component.scss +250 -0
- package/src/components-source/dropi-tooltip/dropi-tooltip.component.spec.ts +423 -0
- package/src/components-source/dropi-tooltip/dropi-tooltip.component.ts +153 -0
- package/src/components-source/dropi-youtube-lazy-video/dropi-youtube-lazy-video.component.html +20 -0
- package/src/components-source/dropi-youtube-lazy-video/dropi-youtube-lazy-video.component.scss +63 -0
- package/src/components-source/dropi-youtube-lazy-video/dropi-youtube-lazy-video.component.spec.ts +121 -0
- package/src/components-source/dropi-youtube-lazy-video/dropi-youtube-lazy-video.component.ts +43 -0
- package/src/components-source/dropi-youtube-lazy-video/dropi-youtube-lazy-video.stories.ts +125 -0
- package/src/components-source/empty-state/empty-state.component.html +30 -0
- package/src/components-source/empty-state/empty-state.component.scss +76 -0
- package/src/components-source/empty-state/empty-state.component.spec.ts +244 -0
- package/src/components-source/empty-state/empty-state.component.stories.ts +198 -0
- package/src/components-source/empty-state/empty-state.component.ts +34 -0
- package/src/components-source/file-upload-progress-bar/file-upload-progress-bar.component.html +81 -0
- package/src/components-source/file-upload-progress-bar/file-upload-progress-bar.component.scss +86 -0
- package/src/components-source/file-upload-progress-bar/file-upload-progress-bar.component.spec.ts +27 -0
- package/src/components-source/file-upload-progress-bar/file-upload-progress-bar.component.stories.ts +149 -0
- package/src/components-source/file-upload-progress-bar/file-upload-progress-bar.component.ts +89 -0
- package/src/components-source/foundations/dropi-border-radius-demo/dropi-border-radius-demo.component.scss +32 -0
- package/src/components-source/foundations/dropi-border-radius-demo/dropi-border-radius-demo.component.ts +17 -0
- package/src/components-source/foundations/foundations.component.html +183 -0
- package/src/components-source/foundations/foundations.component.scss +31 -0
- package/src/components-source/foundations/foundations.component.ts +26 -0
- package/src/components-source/icon/icon-names.const.ts +270 -0
- package/src/components-source/icon/icon.component.html +3 -0
- package/src/components-source/icon/icon.component.scss +4 -0
- package/src/components-source/icon/icon.component.spec.ts +304 -0
- package/src/components-source/icon/icon.component.ts +53 -0
- package/src/components-source/index.ts +89 -0
- package/src/components-source/input/input.component.html +97 -0
- package/src/components-source/input/input.component.scss +149 -0
- package/src/components-source/input/input.component.spec.ts +243 -0
- package/src/components-source/input/input.component.stories.ts +269 -0
- package/src/components-source/input/input.component.ts +119 -0
- package/src/components-source/lottie-loader/lottie-loader.component.html +16 -0
- package/src/components-source/lottie-loader/lottie-loader.component.scss +32 -0
- package/src/components-source/lottie-loader/lottie-loader.component.spec.ts +103 -0
- package/src/components-source/lottie-loader/lottie-loader.component.ts +20 -0
- package/src/components-source/otp-send-code/mock-otp-services.ts +214 -0
- package/src/components-source/otp-send-code/otp-send-code.component.html +151 -0
- package/src/components-source/otp-send-code/otp-send-code.component.scss +156 -0
- package/src/components-source/otp-send-code/otp-send-code.component.spec.ts +419 -0
- package/src/components-source/otp-send-code/otp-send-code.component.stories.ts +190 -0
- package/src/components-source/otp-send-code/otp-send-code.component.ts +659 -0
- package/src/components-source/radio-selection-list/radio-selection-list.component.html +107 -0
- package/src/components-source/radio-selection-list/radio-selection-list.component.scss +280 -0
- package/src/components-source/radio-selection-list/radio-selection-list.component.spec.ts +243 -0
- package/src/components-source/radio-selection-list/radio-selection-list.component.stories.ts +313 -0
- package/src/components-source/radio-selection-list/radio-selection-list.component.ts +143 -0
- package/src/components-source/read-more/read-more.component.html +14 -0
- package/src/components-source/read-more/read-more.component.scss +16 -0
- package/src/components-source/read-more/read-more.component.spec.ts +272 -0
- package/src/components-source/read-more/read-more.component.stories.ts +131 -0
- package/src/components-source/read-more/read-more.component.ts +88 -0
- package/src/components-source/sidebar/sidebar.component.html +42 -0
- package/src/components-source/sidebar/sidebar.component.scss +70 -0
- package/src/components-source/sidebar/sidebar.component.spec.ts +354 -0
- package/src/components-source/sidebar/sidebar.component.stories.ts +145 -0
- package/src/components-source/sidebar/sidebar.component.ts +105 -0
- package/src/components-source/simple-stepper/simple-stepper.component.html +17 -0
- package/src/components-source/simple-stepper/simple-stepper.component.scss +117 -0
- package/src/components-source/simple-stepper/simple-stepper.component.spec.ts +348 -0
- package/src/components-source/simple-stepper/simple-stepper.component.stories.ts +104 -0
- package/src/components-source/simple-stepper/simple-stepper.component.ts +69 -0
- package/src/components-source/storybook-doc-components/avatars-storybook/avatars-storybook.component.html +192 -0
- package/src/components-source/storybook-doc-components/avatars-storybook/avatars-storybook.component.scss +15 -0
- package/src/components-source/storybook-doc-components/avatars-storybook/avatars-storybook.component.ts +17 -0
- package/src/components-source/storybook-doc-components/border-radius-storybook/border-radius-storybook.component.html +22 -0
- package/src/components-source/storybook-doc-components/border-radius-storybook/border-radius-storybook.component.scss +0 -0
- package/src/components-source/storybook-doc-components/border-radius-storybook/border-radius-storybook.component.ts +54 -0
- package/src/components-source/storybook-doc-components/breakpoints-and-grids-storybook/breakpoints-and-grids-storybook.component.css +81 -0
- package/src/components-source/storybook-doc-components/breakpoints-and-grids-storybook/breakpoints-and-grids-storybook.component.html +143 -0
- package/src/components-source/storybook-doc-components/breakpoints-and-grids-storybook/breakpoints-and-grids-storybook.component.ts +97 -0
- package/src/components-source/storybook-doc-components/colors-storybook/colors-storybook.component.css +10 -0
- package/src/components-source/storybook-doc-components/colors-storybook/colors-storybook.component.html +63 -0
- package/src/components-source/storybook-doc-components/colors-storybook/colors-storybook.component.ts +542 -0
- package/src/components-source/storybook-doc-components/dropi-modal/dropi-modal.component.html +132 -0
- package/src/components-source/storybook-doc-components/dropi-modal/dropi-modal.component.scss +15 -0
- package/src/components-source/storybook-doc-components/dropi-modal/dropi-modal.component.ts +67 -0
- package/src/components-source/storybook-doc-components/dropi-toast/dropi-toast.component.html +156 -0
- package/src/components-source/storybook-doc-components/dropi-toast/dropi-toast.component.scss +13 -0
- package/src/components-source/storybook-doc-components/dropi-toast/dropi-toast.component.ts +55 -0
- package/src/components-source/storybook-doc-components/flags-storybook/flags-storybook.component.css +0 -0
- package/src/components-source/storybook-doc-components/flags-storybook/flags-storybook.component.html +99 -0
- package/src/components-source/storybook-doc-components/flags-storybook/flags-storybook.component.ts +19 -0
- package/src/components-source/storybook-doc-components/icons-storybook/icons-storybook.component.css +82 -0
- package/src/components-source/storybook-doc-components/icons-storybook/icons-storybook.component.html +111 -0
- package/src/components-source/storybook-doc-components/icons-storybook/icons-storybook.component.ts +196 -0
- package/src/components-source/storybook-doc-components/logo-storybook/logo-foundations.component.ts +19 -0
- package/src/components-source/storybook-doc-components/logo-storybook/logo-storybook.component.css +0 -0
- package/src/components-source/storybook-doc-components/logo-storybook/logo-storybook.component.html +104 -0
- package/src/components-source/storybook-doc-components/lustration-storybook/lustration-storybook.component.css +0 -0
- package/src/components-source/storybook-doc-components/lustration-storybook/lustration-storybook.component.html +218 -0
- package/src/components-source/storybook-doc-components/lustration-storybook/lustration-storybook.component.ts +20 -0
- package/src/components-source/storybook-doc-components/shadow-storybook/shadow-storybook.component.html +21 -0
- package/src/components-source/storybook-doc-components/shadow-storybook/shadow-storybook.component.scss +0 -0
- package/src/components-source/storybook-doc-components/shadow-storybook/shadow-storybook.component.ts +66 -0
- package/src/components-source/storybook-doc-components/spacing-storybook/spacing-storybook.component.html +33 -0
- package/src/components-source/storybook-doc-components/spacing-storybook/spacing-storybook.component.scss +0 -0
- package/src/components-source/storybook-doc-components/spacing-storybook/spacing-storybook.component.ts +37 -0
- package/src/components-source/storybook-doc-components/story-page/story-page.component.html +74 -0
- package/src/components-source/storybook-doc-components/story-page/story-page.component.scss +103 -0
- package/src/components-source/storybook-doc-components/story-page/story-page.component.ts +424 -0
- package/src/components-source/storybook-doc-components/template-breakpoint-storybook/template-breakpoint-storybook.component.html +35 -0
- package/src/components-source/storybook-doc-components/template-breakpoint-storybook/template-breakpoint-storybook.component.scss +64 -0
- package/src/components-source/storybook-doc-components/template-breakpoint-storybook/template-breakpoint-storybook.component.ts +71 -0
- package/src/components-source/storybook-doc-components/tillte-table-documentation/tillte-table-documentation.component.html +44 -0
- package/src/components-source/storybook-doc-components/tillte-table-documentation/tillte-table-documentation.component.scss +270 -0
- package/src/components-source/storybook-doc-components/tillte-table-documentation/tillte-table-documentation.component.ts +153 -0
- package/src/components-source/tabs/tabs.component.html +26 -0
- package/src/components-source/tabs/tabs.component.scss +62 -0
- package/src/components-source/tabs/tabs.component.spec.ts +212 -0
- package/src/components-source/tabs/tabs.component.stories.ts +203 -0
- package/src/components-source/tabs/tabs.component.ts +138 -0
- package/src/components-source/tag-type-product/tag-type-product.component.html +1 -0
- package/src/components-source/tag-type-product/tag-type-product.component.scss +10 -0
- package/src/components-source/tag-type-product/tag-type-product.component.spec.ts +38 -0
- package/src/components-source/tag-type-product/tag-type-product.component.ts +9 -0
- package/src/components-source/toast/toast.component.html +37 -0
- package/src/components-source/toast/toast.component.scss +142 -0
- package/src/components-source/toast/toast.component.spec.ts +368 -0
- package/src/components-source/toast/toast.component.ts +59 -0
- package/src/components-source/toast/toast.stories.ts +69 -0
- package/src/components-source/tooltip/tooltip.component.html +46 -0
- package/src/components-source/tooltip/tooltip.component.scss +44 -0
- package/src/components-source/tooltip/tooltip.component.spec.ts +327 -0
- package/src/components-source/tooltip/tooltip.component.ts +24 -0
- package/src/components-source/ui-dropi.module.ts +125 -0
- package/src/components-source/ui-inventory.json +1138 -0
- package/src/components-source/vertical-steps/vertical-steps.component.html +35 -0
- package/src/components-source/vertical-steps/vertical-steps.component.scss +143 -0
- package/src/components-source/vertical-steps/vertical-steps.component.spec.ts +121 -0
- package/src/components-source/vertical-steps/vertical-steps.component.stories.ts +216 -0
- package/src/components-source/vertical-steps/vertical-steps.component.ts +151 -0
- package/src/index.ts +31 -0
- package/src/lib/bootstrap.ts +28 -0
- package/src/lib/dropi-ui-elements/dropi-ui-elements.component.html +1 -0
- package/src/lib/dropi-ui-elements/dropi-ui-elements.component.scss +0 -0
- package/src/lib/dropi-ui-elements/dropi-ui-elements.component.spec.ts +21 -0
- package/src/lib/dropi-ui-elements/dropi-ui-elements.component.ts +9 -0
- package/src/lib/elements-registry.ts +66 -0
- package/src/lib/elements.module.ts +22 -0
- package/src/styles.scss +152 -0
- package/src/test-setup.ts +6 -0
- package/tsconfig.json +28 -0
- package/tsconfig.lib.json +18 -0
- package/tsconfig.lib.prod.json +9 -0
- package/tsconfig.spec.json +12 -0
|
@@ -0,0 +1,659 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ChangeDetectorRef,
|
|
3
|
+
Component,
|
|
4
|
+
ElementRef,
|
|
5
|
+
EventEmitter,
|
|
6
|
+
Input,
|
|
7
|
+
Output,
|
|
8
|
+
QueryList,
|
|
9
|
+
ViewChildren,
|
|
10
|
+
} from '@angular/core';
|
|
11
|
+
import { CommonModule } from '@angular/common';
|
|
12
|
+
import {
|
|
13
|
+
FormsModule,
|
|
14
|
+
ReactiveFormsModule,
|
|
15
|
+
FormArray,
|
|
16
|
+
FormControl,
|
|
17
|
+
AbstractControl,
|
|
18
|
+
ValidationErrors,
|
|
19
|
+
ControlValueAccessor,
|
|
20
|
+
NG_VALIDATORS,
|
|
21
|
+
NG_VALUE_ACCESSOR,
|
|
22
|
+
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';
|
|
37
|
+
|
|
38
|
+
export interface DialogParams {
|
|
39
|
+
type: 'question' | 'info' | 'error' | 'success' | '';
|
|
40
|
+
tittle: string;
|
|
41
|
+
message: string;
|
|
42
|
+
primaryButton: string;
|
|
43
|
+
secondaryButton?: string;
|
|
44
|
+
loadingTitle?: string;
|
|
45
|
+
loadingMessage?: string;
|
|
46
|
+
}
|
|
47
|
+
function getFormArray(size: number): FormArray {
|
|
48
|
+
const arr = [];
|
|
49
|
+
for (let i = 0; i < size; i++) {
|
|
50
|
+
arr.push(new FormControl(''));
|
|
51
|
+
}
|
|
52
|
+
return new FormArray(arr);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@Component({
|
|
56
|
+
selector: 'otp-send-code',
|
|
57
|
+
standalone: true,
|
|
58
|
+
imports: [
|
|
59
|
+
ReactiveFormsModule,
|
|
60
|
+
CommonModule,
|
|
61
|
+
FormsModule,
|
|
62
|
+
IconComponent,
|
|
63
|
+
AlertComponent,
|
|
64
|
+
AlertModalComponent,
|
|
65
|
+
AlertComponent2,
|
|
66
|
+
TranslateModule
|
|
67
|
+
],
|
|
68
|
+
providers: [
|
|
69
|
+
{
|
|
70
|
+
provide: NG_VALUE_ACCESSOR,
|
|
71
|
+
useExisting: OtpSendCodeComponent,
|
|
72
|
+
multi: true,
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
provide: NG_VALIDATORS,
|
|
76
|
+
useExisting: OtpSendCodeComponent,
|
|
77
|
+
multi: true,
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
templateUrl: './otp-send-code.component.html',
|
|
81
|
+
styleUrls: ['./otp-send-code.component.scss'],
|
|
82
|
+
})
|
|
83
|
+
export class OtpSendCodeComponent implements ControlValueAccessor, Validator {
|
|
84
|
+
@ViewChildren('inputEl') inputEls!: QueryList<ElementRef<HTMLInputElement>>;
|
|
85
|
+
@Output() codeCompleted = new EventEmitter<string>();
|
|
86
|
+
@Output() codeAccepted = new EventEmitter<boolean>() as EventEmitter<boolean>;
|
|
87
|
+
@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
|
|
90
|
+
@Input() userID: number = null;
|
|
91
|
+
@Input() emailSend: string = null;
|
|
92
|
+
@Input() typeAlert: number = 1; // 1 | 2
|
|
93
|
+
@Input() paramSendCode: any = {};
|
|
94
|
+
@Input() showLabelContact: boolean = false;
|
|
95
|
+
@Input() typeLabelContact: number = 1; // 1 | 2;
|
|
96
|
+
@Input() labelContact: string = '';
|
|
97
|
+
@Input() typeBadge: number = 2; // 0 | 1 | 2
|
|
98
|
+
|
|
99
|
+
inputs = getFormArray(6);
|
|
100
|
+
timeLeft: number = 30;
|
|
101
|
+
typeTimeLeft: string = 'segundos';
|
|
102
|
+
interval: any;
|
|
103
|
+
isVisibleAlert = false;
|
|
104
|
+
isMaximumAttempts = false;
|
|
105
|
+
|
|
106
|
+
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: '',
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
failedValidation = false;
|
|
117
|
+
loadingValidation = false;
|
|
118
|
+
sendingCode = false;
|
|
119
|
+
emailOTP: string = null;
|
|
120
|
+
errorEmailOTP: boolean = false;
|
|
121
|
+
errorSendOTP: boolean = false;
|
|
122
|
+
shouldShowAlert: boolean = false;
|
|
123
|
+
|
|
124
|
+
applySendCode: boolean = false;
|
|
125
|
+
errorMessageValidation: string = 'El código no coincide, vuelve a intentar';
|
|
126
|
+
showLabelSendContact: boolean = false;
|
|
127
|
+
typeContact: string = '';
|
|
128
|
+
|
|
129
|
+
paramsAlert = {
|
|
130
|
+
state: 'question',
|
|
131
|
+
message: '',
|
|
132
|
+
show: false,
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
sendTotalSeconds = 30;
|
|
136
|
+
validationTotalSeconds = 0;
|
|
137
|
+
private intervals: Record<string, any> = {};
|
|
138
|
+
|
|
139
|
+
constructor(
|
|
140
|
+
public settingsService: SettingsService,
|
|
141
|
+
public apiService: Api,
|
|
142
|
+
public segurityCodeService: SegurityCodeService,
|
|
143
|
+
public twoFactorService: TwoFactorAuthService,
|
|
144
|
+
public loginService: LoginService,
|
|
145
|
+
private cd: ChangeDetectorRef,
|
|
146
|
+
) {}
|
|
147
|
+
|
|
148
|
+
onChange?: (value: string) => void;
|
|
149
|
+
onTouched?: () => void;
|
|
150
|
+
|
|
151
|
+
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
|
+
);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
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();
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
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);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
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(''));
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
registerOnChange(fn: any): void {
|
|
416
|
+
this.onChange = fn;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
registerOnTouched(fn: any): void {
|
|
420
|
+
this.onTouched = fn;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
setDisabledState(isDisabled: boolean): void {
|
|
424
|
+
if (isDisabled) {
|
|
425
|
+
this.inputs.disable();
|
|
426
|
+
} else {
|
|
427
|
+
this.inputs.enable();
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
validate(control: AbstractControl<string, string>): ValidationErrors | null {
|
|
432
|
+
if (!control.value || control.value.length < 6) {
|
|
433
|
+
return { otpInput: 'Value is incorrect' };
|
|
434
|
+
}
|
|
435
|
+
return null;
|
|
436
|
+
}
|
|
437
|
+
|
|
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
|
+
|
|
446
|
+
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
|
+
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
|
+
}
|
|
498
|
+
|
|
499
|
+
private debounceTimer: any;
|
|
500
|
+
|
|
501
|
+
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();
|
|
521
|
+
}
|
|
522
|
+
|
|
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
|
+
}
|
|
549
|
+
|
|
550
|
+
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 };
|
|
581
|
+
}
|
|
582
|
+
|
|
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);
|
|
601
|
+
}
|
|
602
|
+
|
|
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
|
+
}
|
|
658
|
+
}
|
|
659
|
+
}
|