@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.
- package/README.md +55 -36
- package/dist/README.md +58 -38
- package/dist/components-source/accordion/accordion-item/accordion-item.component.d.ts +31 -0
- package/dist/components-source/accordion/accordion.component.d.ts +26 -0
- package/dist/components-source/alert/alert.component.d.ts +32 -0
- package/dist/components-source/alert-modal/alert-modal.component.d.ts +78 -0
- package/dist/components-source/alert-validation/alert-validation.component.d.ts +21 -0
- package/dist/components-source/badge/badge.component.d.ts +12 -0
- package/dist/components-source/beta-tag/beta-tag.component.d.ts +5 -0
- package/dist/components-source/breadcrumb/breadcrumb.component.d.ts +11 -0
- package/dist/components-source/card-product/card-product.component.d.ts +204 -0
- package/dist/components-source/card-section/card-section.component.d.ts +31 -0
- package/dist/components-source/checkbox-selection-list/checkbox-selection-list.component.d.ts +26 -0
- package/dist/components-source/city-selector/city-selector.component.d.ts +17 -0
- package/dist/components-source/color-picker/color-picker.component.d.ts +73 -0
- package/dist/components-source/confirm-dialog/confirm-dialog.component.d.ts +10 -0
- package/dist/components-source/country-flags/country-flags.component.d.ts +12 -0
- package/dist/components-source/date-picker/date-picker.component.d.ts +27 -0
- package/dist/components-source/date-picker-range/date-picker-range.component.d.ts +26 -0
- package/dist/components-source/dropi-avatars/dropi-avatars.component.d.ts +11 -0
- package/dist/components-source/dropi-badge/dropi-badge.component.d.ts +29 -0
- package/dist/components-source/dropi-banner-external/dropi-banner-external.component.d.ts +19 -0
- package/dist/components-source/dropi-breadcrumb/dropi-breadcrumb.component.d.ts +22 -0
- package/dist/components-source/dropi-card-checkbox/dropi-card-checkbox.component.d.ts +20 -0
- package/dist/components-source/dropi-carousel/dropi-carousel.component.d.ts +52 -0
- package/dist/components-source/dropi-checkbox/dropi-checkbox.component.d.ts +11 -0
- package/dist/components-source/dropi-chips/dropi-chips.component.d.ts +17 -0
- package/dist/components-source/dropi-country-selector/countries.data.d.ts +6 -0
- package/dist/components-source/dropi-country-selector/dropi-country-selector.component.d.ts +90 -0
- package/dist/components-source/dropi-drawer/dropi-drawer.component.d.ts +20 -0
- package/dist/components-source/dropi-dropdown/dropi-dropdown.component.d.ts +20 -0
- package/dist/components-source/dropi-favorite-button/dropi-favorite-button.component.d.ts +12 -0
- package/dist/components-source/dropi-file-upload/card-view/card-view.component.d.ts +19 -0
- package/dist/components-source/dropi-file-upload/drop-zone/drop-zone.component.d.ts +38 -0
- package/dist/components-source/dropi-file-upload/dropi-file-upload.component.d.ts +18 -0
- package/dist/components-source/dropi-file-upload/file-list/file-list.component.d.ts +39 -0
- package/dist/components-source/dropi-file-upload/grid-view/grid-view.component.d.ts +15 -0
- package/dist/components-source/dropi-ilustration-icon/dropi-ilustration-icon.component.d.ts +20 -0
- package/dist/components-source/dropi-image-overlay/dropi-image-overlay.component.d.ts +8 -0
- package/dist/components-source/dropi-languages-selector/dropi-languages-selector.component.d.ts +18 -0
- package/dist/components-source/dropi-logo/dropi-logo.component.d.ts +12 -0
- package/dist/components-source/dropi-modal/dropi-modal.component.d.ts +34 -0
- package/dist/components-source/dropi-modal/p-template.directive.d.ts +9 -0
- package/dist/components-source/dropi-navbar/dropi-navbar.component.d.ts +20 -0
- package/dist/components-source/dropi-paginator/dropi-paginator.component.d.ts +21 -0
- package/dist/components-source/dropi-phone-input/dropi-phone-input.component.d.ts +55 -0
- package/dist/components-source/dropi-radio-button/dropi-radio-button.component.d.ts +17 -0
- package/dist/components-source/dropi-search/dropi-search.component.d.ts +40 -0
- package/dist/components-source/dropi-select/dropi-select.component.d.ts +34 -0
- package/dist/components-source/dropi-skeleton/dropi-skeleton.component.d.ts +14 -0
- package/dist/components-source/dropi-steps/dropi-steps.component.d.ts +64 -0
- package/dist/components-source/dropi-switch/dropi-switch.component.d.ts +11 -0
- package/dist/components-source/dropi-table/dropi-table.component.d.ts +82 -0
- package/dist/components-source/dropi-tag/dropi-tag.component.d.ts +15 -0
- package/dist/components-source/dropi-text-area/dropi-text-area.component.d.ts +14 -0
- package/dist/components-source/dropi-tooltip/dropi-tooltip.component.d.ts +28 -0
- package/dist/components-source/dropi-youtube-lazy-video/dropi-youtube-lazy-video.component.d.ts +16 -0
- package/dist/components-source/empty/empty.component.d.ts +9 -0
- package/dist/components-source/empty-state/empty-state.component.d.ts +17 -0
- package/dist/components-source/file-upload-progress-bar/file-upload-progress-bar.component.d.ts +30 -0
- package/dist/components-source/index.d.ts +85 -0
- package/dist/components-source/input/input.component.d.ts +33 -0
- package/dist/components-source/lottie-loader/lottie-loader.component.d.ts +9 -0
- package/dist/components-source/otp-send-code/otp-send-code.component.d.ts +83 -0
- package/dist/components-source/radio-selection-list/radio-selection-list.component.d.ts +30 -0
- package/dist/components-source/read-more/read-more.component.d.ts +60 -0
- package/dist/components-source/sidebar/sidebar.component.d.ts +27 -0
- package/dist/components-source/simple-stepper/simple-stepper.component.d.ts +21 -0
- package/dist/components-source/spinner/spinner.component.d.ts +9 -0
- package/dist/components-source/tabs/tabs.component.d.ts +27 -0
- package/dist/components-source/tag-type-product/tag-type-product.component.d.ts +5 -0
- package/dist/components-source/toast/toast.component.d.ts +21 -0
- package/dist/components-source/toggle/input-toggle.component.d.ts +11 -0
- package/dist/components-source/tooltip/tooltip.component.d.ts +15 -0
- package/dist/components-source/vertical-steps/vertical-steps.component.d.ts +27 -0
- package/dist/esm2022/components-source/accordion/accordion-item/accordion-item.component.mjs +51 -0
- package/dist/esm2022/components-source/accordion/accordion.component.mjs +46 -0
- package/dist/esm2022/components-source/alert/alert.component.mjs +114 -0
- package/dist/esm2022/components-source/alert-modal/alert-modal.component.mjs +247 -0
- package/dist/esm2022/components-source/alert-validation/alert-validation.component.mjs +53 -0
- package/dist/esm2022/components-source/badge/badge.component.mjs +23 -0
- package/dist/esm2022/components-source/beta-tag/beta-tag.component.mjs +11 -0
- package/dist/esm2022/components-source/breadcrumb/breadcrumb.component.mjs +26 -0
- package/dist/esm2022/components-source/card-product/card-product.component.mjs +534 -0
- package/dist/esm2022/components-source/card-section/card-section.component.mjs +91 -0
- package/dist/esm2022/components-source/checkbox-selection-list/checkbox-selection-list.component.mjs +79 -0
- package/dist/esm2022/components-source/city-selector/city-selector.component.mjs +53 -0
- package/dist/esm2022/components-source/color-picker/color-picker.component.mjs +320 -0
- package/dist/esm2022/components-source/confirm-dialog/confirm-dialog.component.mjs +27 -0
- package/dist/esm2022/components-source/country-flags/country-flags.component.mjs +27 -0
- package/dist/esm2022/components-source/date-picker/date-picker.component.mjs +73 -0
- package/dist/esm2022/components-source/date-picker-range/date-picker-range.component.mjs +67 -0
- package/dist/esm2022/components-source/dropi-avatars/dropi-avatars.component.mjs +31 -0
- package/dist/esm2022/components-source/dropi-badge/dropi-badge.component.mjs +45 -0
- package/dist/esm2022/components-source/dropi-banner-external/dropi-banner-external.component.mjs +39 -0
- package/dist/esm2022/components-source/dropi-breadcrumb/dropi-breadcrumb.component.mjs +45 -0
- package/dist/esm2022/components-source/dropi-card-checkbox/dropi-card-checkbox.component.mjs +53 -0
- package/dist/esm2022/components-source/dropi-carousel/dropi-carousel.component.mjs +243 -0
- package/dist/esm2022/components-source/dropi-checkbox/dropi-checkbox.component.mjs +31 -0
- package/dist/esm2022/components-source/dropi-chips/dropi-chips.component.mjs +38 -0
- package/dist/esm2022/components-source/dropi-country-selector/countries.data.mjs +254 -0
- package/dist/esm2022/components-source/dropi-country-selector/dropi-country-selector.component.mjs +183 -0
- package/dist/esm2022/components-source/dropi-drawer/dropi-drawer.component.mjs +69 -0
- package/dist/esm2022/components-source/dropi-dropdown/dropi-dropdown.component.mjs +59 -0
- package/dist/esm2022/components-source/dropi-favorite-button/dropi-favorite-button.component.mjs +33 -0
- package/dist/esm2022/components-source/dropi-file-upload/card-view/card-view.component.mjs +47 -0
- package/dist/esm2022/components-source/dropi-file-upload/drop-zone/drop-zone.component.mjs +115 -0
- package/dist/esm2022/components-source/dropi-file-upload/dropi-file-upload.component.mjs +66 -0
- package/dist/esm2022/components-source/dropi-file-upload/file-list/file-list.component.mjs +95 -0
- package/dist/esm2022/components-source/dropi-file-upload/grid-view/grid-view.component.mjs +37 -0
- package/dist/esm2022/components-source/dropi-ilustration-icon/dropi-ilustration-icon.component.mjs +59 -0
- package/dist/esm2022/components-source/dropi-image-overlay/dropi-image-overlay.component.mjs +31 -0
- package/dist/esm2022/components-source/dropi-languages-selector/dropi-languages-selector.component.mjs +38 -0
- package/dist/esm2022/components-source/dropi-logo/dropi-logo.component.mjs +27 -0
- package/dist/esm2022/components-source/dropi-modal/dropi-modal.component.mjs +92 -0
- package/dist/esm2022/components-source/dropi-modal/p-template.directive.mjs +22 -0
- package/dist/esm2022/components-source/dropi-navbar/dropi-navbar.component.mjs +51 -0
- package/dist/esm2022/components-source/dropi-paginator/dropi-paginator.component.mjs +89 -0
- package/dist/esm2022/components-source/dropi-phone-input/dropi-phone-input.component.mjs +155 -0
- package/dist/esm2022/components-source/dropi-radio-button/dropi-radio-button.component.mjs +48 -0
- package/dist/esm2022/components-source/dropi-search/dropi-search.component.mjs +104 -0
- package/dist/esm2022/components-source/dropi-select/dropi-select.component.mjs +96 -0
- package/dist/esm2022/components-source/dropi-skeleton/dropi-skeleton.component.mjs +39 -0
- package/dist/esm2022/components-source/dropi-steps/dropi-steps.component.mjs +97 -0
- package/dist/esm2022/components-source/dropi-switch/dropi-switch.component.mjs +22 -0
- package/dist/esm2022/components-source/dropi-table/dropi-table.component.mjs +333 -0
- package/dist/esm2022/components-source/dropi-tag/dropi-tag.component.mjs +36 -0
- package/dist/esm2022/components-source/dropi-text-area/dropi-text-area.component.mjs +53 -0
- package/dist/esm2022/components-source/dropi-tooltip/dropi-tooltip.component.mjs +78 -0
- package/dist/esm2022/components-source/dropi-youtube-lazy-video/dropi-youtube-lazy-video.component.mjs +46 -0
- package/dist/esm2022/components-source/empty/empty.component.mjs +18 -0
- package/dist/esm2022/components-source/empty-state/empty-state.component.mjs +62 -0
- package/dist/esm2022/components-source/file-upload-progress-bar/file-upload-progress-bar.component.mjs +91 -0
- package/dist/esm2022/components-source/index.mjs +107 -0
- package/dist/esm2022/components-source/input/input.component.mjs +104 -0
- package/dist/esm2022/components-source/lottie-loader/lottie-loader.component.mjs +25 -0
- package/dist/esm2022/components-source/otp-send-code/otp-send-code.component.mjs +201 -0
- package/dist/esm2022/components-source/radio-selection-list/radio-selection-list.component.mjs +89 -0
- package/dist/esm2022/components-source/read-more/read-more.component.mjs +91 -0
- package/dist/esm2022/components-source/sidebar/sidebar.component.mjs +88 -0
- package/dist/esm2022/components-source/simple-stepper/simple-stepper.component.mjs +60 -0
- package/dist/esm2022/components-source/spinner/spinner.component.mjs +19 -0
- package/dist/esm2022/components-source/tabs/tabs.component.mjs +83 -0
- package/dist/esm2022/components-source/tag-type-product/tag-type-product.component.mjs +11 -0
- package/dist/esm2022/components-source/toast/toast.component.mjs +47 -0
- package/dist/esm2022/components-source/toggle/input-toggle.component.mjs +36 -0
- package/dist/esm2022/components-source/tooltip/tooltip.component.mjs +34 -0
- package/dist/esm2022/components-source/vertical-steps/vertical-steps.component.mjs +75 -0
- package/dist/esm2022/lib/elements-registry.mjs +343 -2
- package/dist/esm2022/utilities/interfaces/ui/dropi-table.interface.mjs +2 -0
- package/dist/esm2022/utilities/interfaces/ui/input-interface.mjs +2 -0
- package/dist/esm2022/utilities/interfaces/ui/select-interface.mjs +2 -0
- package/dist/esm2022/utilities/interfaces/ui/selection-list-interface.mjs +2 -0
- package/dist/esm2022/utilities/interfaces/ui/upload.model.mjs +5 -0
- package/dist/fesm2022/dropi-ui-components.mjs +5913 -2
- package/dist/fesm2022/dropi-ui-components.mjs.map +1 -1
- package/dist/utilities/interfaces/ui/dropi-table.interface.d.ts +45 -0
- package/dist/utilities/interfaces/ui/input-interface.d.ts +33 -0
- package/dist/utilities/interfaces/ui/select-interface.d.ts +8 -0
- package/dist/utilities/interfaces/ui/selection-list-interface.d.ts +24 -0
- package/dist/utilities/interfaces/ui/upload.model.d.ts +30 -0
- package/package.json +18 -6
- package/src/components-source/alert/alert.component.ts +12 -129
- package/src/components-source/alert-modal/alert-modal.component.ts +84 -114
- package/src/components-source/alert-validation/alert-validation.component.html +8 -0
- package/src/components-source/alert-validation/alert-validation.component.scss +225 -0
- package/src/components-source/alert-validation/alert-validation.component.ts +43 -0
- package/src/components-source/beta-tag/beta-tag.component.html +1 -0
- package/src/components-source/beta-tag/beta-tag.component.scss +26 -0
- package/src/components-source/beta-tag/beta-tag.component.ts +11 -0
- package/src/components-source/breadcrumb/breadcrumb.component.html +13 -5
- package/src/components-source/breadcrumb/breadcrumb.component.scss +8 -1
- package/src/components-source/breadcrumb/breadcrumb.component.spec.ts +26 -26
- package/src/components-source/breadcrumb/breadcrumb.component.ts +10 -12
- package/src/components-source/card-product/card-product.component.spec.ts +9 -9
- package/src/components-source/card-product/card-product.component.stories.ts +2 -2
- package/src/components-source/card-product/card-product.component.ts +294 -818
- package/src/components-source/card-section/card-section.component.html +7 -7
- package/src/components-source/card-section/card-section.component.ts +41 -15
- package/src/components-source/checkbox-selection-list/checkbox-selection-list.component.ts +42 -179
- package/src/components-source/city-selector/city-selector.component.ts +37 -137
- package/src/components-source/confirm-dialog/confirm-dialog.component.html +26 -0
- package/src/components-source/confirm-dialog/confirm-dialog.component.scss +55 -0
- package/src/components-source/confirm-dialog/confirm-dialog.component.ts +22 -0
- package/src/components-source/country-flags/country-flags.component.ts +20 -12
- package/src/components-source/date-picker/date-picker.component.ts +32 -292
- package/src/components-source/date-picker-range/date-picker-range.component.html +15 -7
- package/src/components-source/date-picker-range/date-picker-range.component.ts +42 -235
- package/src/components-source/dropi-banner-external/dropi-banner-external.component.ts +24 -185
- package/src/components-source/dropi-breadcrumb/dropi-breadcrumb.component.html +21 -21
- package/src/components-source/dropi-breadcrumb/dropi-breadcrumb.component.spec.ts +9 -9
- package/src/components-source/dropi-breadcrumb/dropi-breadcrumb.component.ts +41 -23
- package/src/components-source/dropi-breadcrumb/dropi-breadcrumb.stories.ts +12 -12
- package/src/components-source/dropi-chips/dropi-chips.component.ts +22 -87
- package/src/components-source/dropi-country-selector/countries.data.ts +256 -236
- package/src/components-source/dropi-country-selector/dropi-country-selector.component.ts +37 -25
- package/src/components-source/dropi-drawer/dropi-drawer.component.ts +91 -78
- package/src/components-source/dropi-dropdown/dropi-dropdown.component.ts +44 -47
- package/src/components-source/dropi-file-upload/card-view/card-view.component.ts +33 -53
- package/src/components-source/dropi-file-upload/drop-zone/drop-zone.component.ts +52 -123
- package/src/components-source/dropi-file-upload/dropi-file-upload.component.ts +38 -294
- package/src/components-source/dropi-file-upload/file-list/file-list.component.ts +62 -43
- package/src/components-source/dropi-file-upload/grid-view/grid-view.component.ts +23 -22
- package/src/components-source/dropi-ilustration-icon/dropi-ilustration-icon.component.scss +6 -2
- package/src/components-source/dropi-image-overlay/dropi-image-overlay.component.ts +16 -71
- package/src/components-source/dropi-modal/dropi-modal.component.ts +56 -372
- package/src/components-source/dropi-navbar/dropi-navbar.component.ts +17 -17
- package/src/components-source/dropi-paginator/dropi-paginator.component.html +18 -7
- package/src/components-source/dropi-paginator/dropi-paginator.component.ts +40 -32
- package/src/components-source/dropi-phone-input/dropi-phone-input.component.html +78 -79
- package/src/components-source/dropi-phone-input/dropi-phone-input.component.ts +29 -85
- package/src/components-source/dropi-search/dropi-search.component.ts +59 -222
- package/src/components-source/dropi-select/dropi-select.component.html +82 -131
- package/src/components-source/dropi-select/dropi-select.component.ts +60 -423
- package/src/components-source/dropi-table/dropi-table.component.html +40 -23
- package/src/components-source/dropi-table/dropi-table.component.ts +130 -374
- package/src/components-source/dropi-tag/dropi-tag.component.ts +20 -90
- package/src/components-source/dropi-text-area/dropi-text-area.component.ts +22 -48
- package/src/components-source/dropi-tooltip/dropi-tooltip.component.ts +40 -129
- package/src/components-source/empty/empty.component.html +3 -0
- package/src/components-source/empty/empty.component.scss +0 -0
- package/src/components-source/empty/empty.component.ts +16 -0
- package/src/components-source/empty-state/empty-state.component.ts +47 -19
- package/src/components-source/index.ts +82 -37
- package/src/components-source/input/input.component.html +79 -63
- package/src/components-source/input/input.component.ts +51 -97
- package/src/components-source/lottie-loader/lottie-loader.component.ts +13 -16
- package/src/components-source/otp-send-code/otp-send-code.component.ts +60 -528
- package/src/components-source/radio-selection-list/radio-selection-list.component.ts +36 -97
- package/src/components-source/sidebar/sidebar.component.spec.ts +11 -11
- package/src/components-source/sidebar/sidebar.component.stories.ts +3 -3
- package/src/components-source/sidebar/sidebar.component.ts +51 -47
- package/src/components-source/simple-stepper/simple-stepper.component.ts +20 -35
- package/src/components-source/spinner/spinner.component.html +6 -0
- package/src/components-source/spinner/spinner.component.scss +15 -0
- package/src/components-source/spinner/spinner.component.ts +17 -0
- package/src/components-source/tabs/tabs.component.spec.ts +8 -8
- package/src/components-source/tabs/tabs.component.stories.ts +5 -5
- package/src/components-source/tabs/tabs.component.ts +41 -83
- package/src/components-source/toast/toast.component.ts +40 -46
- package/src/components-source/toggle/input-toggle.component.html +34 -0
- package/src/components-source/toggle/input-toggle.component.scss +0 -0
- package/src/components-source/toggle/input-toggle.component.ts +27 -0
- package/src/components-source/toggle/inputToggleConfig.ts +11 -0
- package/src/components-source/tooltip/tooltip.component.html +22 -11
- package/src/components-source/tooltip/tooltip.component.ts +28 -13
- package/src/components-source/vertical-steps/vertical-steps.component.ts +16 -78
- package/src/lib/elements-registry.ts +413 -1
- package/src/lib/router-stub.ts +7 -0
- package/src/libreria work space.code-workspace +11 -8
- package/src/utilities/interfaces/ui/dropi-table.interface.ts +60 -0
- package/src/utilities/interfaces/ui/input-interface.ts +34 -0
- package/src/utilities/interfaces/ui/select-interface.ts +8 -0
- package/src/utilities/interfaces/ui/selection-list-interface.ts +15 -0
- package/src/utilities/interfaces/ui/upload.model.ts +41 -0
|
@@ -6,21 +6,45 @@ import {
|
|
|
6
6
|
OnInit,
|
|
7
7
|
SimpleChanges,
|
|
8
8
|
HostListener,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import { Howl } from
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
9
|
+
Inject,
|
|
10
|
+
Pipe,
|
|
11
|
+
PipeTransform,
|
|
12
|
+
CUSTOM_ELEMENTS_SCHEMA,
|
|
13
|
+
} from "@angular/core";
|
|
14
|
+
import { CommonModule, TitleCasePipe } from "@angular/common";
|
|
15
|
+
import { IconComponent } from "../icon/icon.component";
|
|
16
|
+
import { DropiTagComponent } from "../dropi-tag/dropi-tag.component";
|
|
17
|
+
// import { Howl } from "howler"; // Eliminado para evitar errores de dependencia
|
|
18
|
+
import { DropiIlustrationIconComponent } from "../dropi-ilustration-icon/dropi-ilustration-icon.component";
|
|
19
|
+
import { TranslateModule } from "@ngx-translate/core";
|
|
20
|
+
|
|
21
|
+
@Pipe({
|
|
22
|
+
name: "adjustName",
|
|
23
|
+
standalone: true,
|
|
24
|
+
})
|
|
25
|
+
export class AdjustNamePipeStub implements PipeTransform {
|
|
26
|
+
transform(value: any): any {
|
|
27
|
+
return value;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@Component({
|
|
32
|
+
selector: "currency",
|
|
33
|
+
standalone: true,
|
|
34
|
+
template: "{{value}}",
|
|
35
|
+
})
|
|
36
|
+
export class CurrencyComponentStub {
|
|
37
|
+
@Input() value: any;
|
|
38
|
+
@Input() class: any;
|
|
39
|
+
@Input() style: any;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@Component({
|
|
43
|
+
selector: "app-beta-tag",
|
|
44
|
+
standalone: true,
|
|
45
|
+
template: "",
|
|
46
|
+
})
|
|
47
|
+
export class BetaTagComponentStub {}
|
|
24
48
|
|
|
25
49
|
export interface ProductData {
|
|
26
50
|
id: string | number;
|
|
@@ -38,7 +62,7 @@ export interface ProductData {
|
|
|
38
62
|
id: number;
|
|
39
63
|
name: string;
|
|
40
64
|
category_user: string;
|
|
41
|
-
icon?:
|
|
65
|
+
icon?: "verified" | "premium" | "exclusive";
|
|
42
66
|
};
|
|
43
67
|
categories: Array<{
|
|
44
68
|
name: string;
|
|
@@ -46,7 +70,6 @@ export interface ProductData {
|
|
|
46
70
|
private_user_stock?: number;
|
|
47
71
|
legacy_img?: boolean;
|
|
48
72
|
image: string;
|
|
49
|
-
// Campos opcionales para mantener compatibilidad
|
|
50
73
|
category?: string;
|
|
51
74
|
stock?: number;
|
|
52
75
|
supplierPrice?: number;
|
|
@@ -55,167 +78,160 @@ export interface ProductData {
|
|
|
55
78
|
isFavorite?: boolean;
|
|
56
79
|
}
|
|
57
80
|
|
|
58
|
-
export type CardState =
|
|
81
|
+
export type CardState = "default" | "hover" | "select";
|
|
59
82
|
|
|
60
83
|
@Component({
|
|
61
|
-
selector:
|
|
84
|
+
selector: "dropi-card-product",
|
|
62
85
|
standalone: true,
|
|
63
86
|
imports: [
|
|
64
87
|
CommonModule,
|
|
65
88
|
IconComponent,
|
|
66
89
|
DropiTagComponent,
|
|
67
|
-
|
|
90
|
+
CurrencyComponentStub,
|
|
68
91
|
TitleCasePipe,
|
|
69
|
-
|
|
70
|
-
|
|
92
|
+
AdjustNamePipeStub,
|
|
93
|
+
BetaTagComponentStub,
|
|
71
94
|
DropiIlustrationIconComponent,
|
|
72
|
-
TranslateModule
|
|
95
|
+
TranslateModule,
|
|
73
96
|
],
|
|
74
|
-
|
|
97
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
98
|
+
templateUrl: "./card-product.component.html",
|
|
75
99
|
})
|
|
76
100
|
export class CardProductComponent implements OnInit {
|
|
77
101
|
@Input() product!: ProductData;
|
|
78
|
-
@Input() state: CardState =
|
|
79
|
-
@Input() aS: boolean = true;
|
|
102
|
+
@Input() state: CardState = "default";
|
|
103
|
+
@Input() aS: boolean = true;
|
|
80
104
|
@Input() bettaTester: boolean = false;
|
|
81
105
|
@Output() onAddToCart = new EventEmitter<ProductData>();
|
|
82
106
|
@Output() onProductClick = new EventEmitter<ProductData>();
|
|
83
107
|
@Output() changeFavorite = new EventEmitter<Boolean>();
|
|
84
108
|
|
|
85
109
|
public imageError = false;
|
|
86
|
-
public brandName: string =
|
|
87
|
-
public onFavoriteHover = false;
|
|
110
|
+
public brandName: string = "";
|
|
111
|
+
public onFavoriteHover = false;
|
|
88
112
|
|
|
89
|
-
// Propiedades para almacenar las clases aleatorias generadas una sola vez
|
|
90
113
|
public randomClasses = {
|
|
91
|
-
card:
|
|
92
|
-
imageContainer:
|
|
93
|
-
image:
|
|
94
|
-
tags:
|
|
95
|
-
tagsRow:
|
|
96
|
-
favoriteButton:
|
|
97
|
-
productInfo:
|
|
98
|
-
productHeader:
|
|
99
|
-
category:
|
|
100
|
-
stockInfo:
|
|
101
|
-
stockLabel:
|
|
102
|
-
stockValue:
|
|
103
|
-
productName:
|
|
104
|
-
supplierInfo:
|
|
105
|
-
supplierLabel:
|
|
106
|
-
supplierName:
|
|
107
|
-
priceContainer:
|
|
108
|
-
priceItem:
|
|
109
|
-
priceLabel:
|
|
110
|
-
priceValue:
|
|
111
|
-
separator:
|
|
112
|
-
actionButton:
|
|
113
|
-
buttonText:
|
|
114
|
+
card: "",
|
|
115
|
+
imageContainer: "",
|
|
116
|
+
image: "",
|
|
117
|
+
tags: "",
|
|
118
|
+
tagsRow: "",
|
|
119
|
+
favoriteButton: "",
|
|
120
|
+
productInfo: "",
|
|
121
|
+
productHeader: "",
|
|
122
|
+
category: "",
|
|
123
|
+
stockInfo: "",
|
|
124
|
+
stockLabel: "",
|
|
125
|
+
stockValue: "",
|
|
126
|
+
productName: "",
|
|
127
|
+
supplierInfo: "",
|
|
128
|
+
supplierLabel: "",
|
|
129
|
+
supplierName: "",
|
|
130
|
+
priceContainer: "",
|
|
131
|
+
priceItem: "",
|
|
132
|
+
priceLabel: "",
|
|
133
|
+
priceValue: "",
|
|
134
|
+
separator: "",
|
|
135
|
+
actionButton: "",
|
|
136
|
+
buttonText: "",
|
|
114
137
|
};
|
|
115
138
|
|
|
116
|
-
// Propiedades para almacenar los arrays anti-scraping generados una sola vez
|
|
117
139
|
public mixedData = {
|
|
118
140
|
stockDivs: [] as Array<{ value: number; class: string; isReal: boolean }>,
|
|
119
|
-
supplierPriceDivs: [] as Array<{
|
|
120
|
-
|
|
141
|
+
supplierPriceDivs: [] as Array<{
|
|
142
|
+
value: number;
|
|
143
|
+
class: string;
|
|
144
|
+
isReal: boolean;
|
|
145
|
+
}>,
|
|
146
|
+
suggestedPriceDivs: [] as Array<{
|
|
147
|
+
value: number;
|
|
148
|
+
class: string;
|
|
149
|
+
isReal: boolean;
|
|
150
|
+
}>,
|
|
121
151
|
};
|
|
122
152
|
|
|
123
|
-
// Propiedades para almacenar los estilos falsos generados una sola vez
|
|
124
153
|
public fakeStyles = {
|
|
125
|
-
stock:
|
|
126
|
-
price:
|
|
154
|
+
stock: "",
|
|
155
|
+
price: "",
|
|
127
156
|
};
|
|
128
157
|
|
|
129
|
-
// Nueva propiedad para detectar si es móvil
|
|
130
158
|
public isMobile: boolean = false;
|
|
131
159
|
|
|
132
160
|
constructor(
|
|
133
|
-
private settingService:
|
|
134
|
-
private favoriteService:
|
|
135
|
-
private orderManual:
|
|
136
|
-
private router:
|
|
161
|
+
@Inject("SettingsService") private settingService: any,
|
|
162
|
+
@Inject("ProductstService") private favoriteService: any,
|
|
163
|
+
@Inject("OrderManualService") private orderManual: any,
|
|
164
|
+
@Inject("Router") private router: any,
|
|
137
165
|
) {}
|
|
138
166
|
|
|
139
167
|
ngOnInit() {
|
|
140
|
-
this.brandName =
|
|
168
|
+
this.brandName =
|
|
169
|
+
this.settingService?.getBrandInfo()?.name?.toLowerCase() || "dropi";
|
|
141
170
|
this.generateRandomClasses();
|
|
142
171
|
this.generateFakeStyles();
|
|
143
172
|
this.generateMixedData();
|
|
144
|
-
this.checkScreenSize();
|
|
173
|
+
this.checkScreenSize();
|
|
145
174
|
}
|
|
146
175
|
|
|
147
176
|
ngOnChanges(changes: SimpleChanges) {
|
|
148
|
-
|
|
149
|
-
if (changes['product'] || changes['aS']) {
|
|
177
|
+
if (changes["product"] || changes["aS"]) {
|
|
150
178
|
this.generateMixedData();
|
|
151
179
|
}
|
|
152
180
|
}
|
|
153
181
|
|
|
154
|
-
|
|
155
|
-
@HostListener('window:resize', ['$event'])
|
|
182
|
+
@HostListener("window:resize", ["$event"])
|
|
156
183
|
onResize(event: any) {
|
|
157
184
|
this.checkScreenSize();
|
|
158
185
|
}
|
|
159
186
|
|
|
160
|
-
// Método para verificar si es móvil
|
|
161
187
|
private checkScreenSize() {
|
|
162
188
|
this.isMobile = window.innerWidth <= 420;
|
|
163
189
|
}
|
|
164
190
|
|
|
165
|
-
// Método para generar todas las clases aleatorias una sola vez
|
|
166
191
|
private generateRandomClasses() {
|
|
167
192
|
this.randomClasses = {
|
|
168
|
-
card: this.generateRandomClass(
|
|
169
|
-
imageContainer: this.generateRandomClass(
|
|
170
|
-
image: this.generateRandomClass(
|
|
171
|
-
tags: this.generateRandomClass(
|
|
172
|
-
tagsRow: this.generateRandomClass(
|
|
173
|
-
favoriteButton: this.generateRandomClass(
|
|
174
|
-
productInfo: this.generateRandomClass(
|
|
175
|
-
productHeader: this.generateRandomClass(
|
|
176
|
-
category: this.generateRandomClass(
|
|
177
|
-
stockInfo: this.generateRandomClass(
|
|
178
|
-
stockLabel: this.generateRandomClass(
|
|
179
|
-
stockValue: this.generateRandomClass(
|
|
180
|
-
productName: this.generateRandomClass(
|
|
181
|
-
supplierInfo: this.generateRandomClass(
|
|
182
|
-
supplierLabel: this.generateRandomClass(
|
|
183
|
-
supplierName: this.generateRandomClass(
|
|
184
|
-
priceContainer: this.generateRandomClass(
|
|
185
|
-
priceItem: this.generateRandomClass(
|
|
186
|
-
priceLabel: this.generateRandomClass(
|
|
187
|
-
priceValue: this.generateRandomClass(
|
|
188
|
-
separator: this.generateRandomClass(
|
|
189
|
-
actionButton: this.generateRandomClass(
|
|
190
|
-
buttonText: this.generateRandomClass(
|
|
193
|
+
card: this.generateRandomClass("dropi-card-product"),
|
|
194
|
+
imageContainer: this.generateRandomClass("product-image-container"),
|
|
195
|
+
image: this.generateRandomClass("product-image"),
|
|
196
|
+
tags: this.generateRandomClass("product-tags"),
|
|
197
|
+
tagsRow: this.generateRandomClass("tags-row"),
|
|
198
|
+
favoriteButton: this.generateRandomClass("favorite-button"),
|
|
199
|
+
productInfo: this.generateRandomClass("product-info"),
|
|
200
|
+
productHeader: this.generateRandomClass("product-header"),
|
|
201
|
+
category: this.generateRandomClass("category"),
|
|
202
|
+
stockInfo: this.generateRandomClass("stock-info"),
|
|
203
|
+
stockLabel: this.generateRandomClass("stock-label"),
|
|
204
|
+
stockValue: this.generateRandomClass("stock-value"),
|
|
205
|
+
productName: this.generateRandomClass("product-name"),
|
|
206
|
+
supplierInfo: this.generateRandomClass("supplier-info"),
|
|
207
|
+
supplierLabel: this.generateRandomClass("supplier-label"),
|
|
208
|
+
supplierName: this.generateRandomClass("supplier-name"),
|
|
209
|
+
priceContainer: this.generateRandomClass("price-container"),
|
|
210
|
+
priceItem: this.generateRandomClass("price-item"),
|
|
211
|
+
priceLabel: this.generateRandomClass("price-label"),
|
|
212
|
+
priceValue: this.generateRandomClass("price-value"),
|
|
213
|
+
separator: this.generateRandomClass("separator"),
|
|
214
|
+
actionButton: this.generateRandomClass("action-button"),
|
|
215
|
+
buttonText: this.generateRandomClass("button-text"),
|
|
191
216
|
};
|
|
192
217
|
}
|
|
193
218
|
|
|
194
|
-
// Método para generar todos los arrays anti-scraping una sola vez
|
|
195
219
|
private generateMixedData() {
|
|
196
220
|
this.mixedData.stockDivs = this.generateMixedStockDivs();
|
|
197
|
-
this.mixedData.supplierPriceDivs = this.
|
|
198
|
-
this.mixedData.suggestedPriceDivs = this.
|
|
221
|
+
this.mixedData.supplierPriceDivs = this.getMixedSupplierPriceDivs();
|
|
222
|
+
this.mixedData.suggestedPriceDivs = this.getMixedSuggestedPriceDivs();
|
|
199
223
|
}
|
|
200
224
|
|
|
201
|
-
// Método para generar todos los estilos falsos una sola vez
|
|
202
225
|
private generateFakeStyles() {
|
|
203
226
|
this.fakeStyles.stock = this.generateFakeStyleVariant();
|
|
204
227
|
this.fakeStyles.price = this.generateFakeStyleVariant();
|
|
205
228
|
}
|
|
206
229
|
|
|
207
230
|
get imageUrl(): string | undefined {
|
|
208
|
-
// Si el producto tiene el campo 'image' directamente (nueva estructura)
|
|
209
231
|
if (this.product && this.product.image) {
|
|
210
|
-
|
|
211
|
-
if (this.product.legacy_img === true) {
|
|
212
|
-
return `${environment.img_server}/${this.product.image}`;
|
|
213
|
-
} else {
|
|
214
|
-
return `${environment.AWS3.cloudfront_server}/${this.product.image}`;
|
|
215
|
-
}
|
|
232
|
+
return `https://img.dropi.co/${this.product.image}`;
|
|
216
233
|
}
|
|
217
234
|
|
|
218
|
-
// Fallback: mantener compatibilidad con imageUrl directo
|
|
219
235
|
if (this.product && this.product.imageUrl) {
|
|
220
236
|
return this.product.imageUrl;
|
|
221
237
|
}
|
|
@@ -225,68 +241,71 @@ export class CardProductComponent implements OnInit {
|
|
|
225
241
|
|
|
226
242
|
onError(event: any) {
|
|
227
243
|
this.imageError = true;
|
|
228
|
-
|
|
229
|
-
event.target.src = './assets/utils/no-image.jpg';
|
|
230
|
-
} else {
|
|
231
|
-
event.target.src = './assets/utils/wb-no-image.jpg';
|
|
232
|
-
}
|
|
244
|
+
event.target.src = "./assets/utils/no-image.jpg";
|
|
233
245
|
}
|
|
234
246
|
|
|
235
247
|
get productTags(): Array<{
|
|
236
248
|
text: string;
|
|
237
|
-
type:
|
|
238
|
-
state:
|
|
249
|
+
type: "primary" | "secondary";
|
|
250
|
+
state: "default" | "warning" | "info";
|
|
239
251
|
showIcon?: boolean;
|
|
240
252
|
icon?: string;
|
|
241
253
|
}> {
|
|
242
254
|
const tags = [];
|
|
243
255
|
|
|
244
|
-
if (this.product?.type?.includes(
|
|
245
|
-
tags.push({
|
|
256
|
+
if (this.product?.type?.includes("variable")) {
|
|
257
|
+
tags.push({
|
|
258
|
+
text: "Variable",
|
|
259
|
+
type: "primary" as const,
|
|
260
|
+
state: "default" as const,
|
|
261
|
+
});
|
|
246
262
|
}
|
|
247
263
|
|
|
248
|
-
if (this.product?.type?.includes(
|
|
264
|
+
if (this.product?.type?.includes("privado")) {
|
|
249
265
|
tags.push({
|
|
250
|
-
text:
|
|
251
|
-
type:
|
|
252
|
-
state:
|
|
266
|
+
text: "Privado",
|
|
267
|
+
type: "primary" as const,
|
|
268
|
+
state: "warning" as const,
|
|
253
269
|
showIcon: true,
|
|
254
|
-
icon:
|
|
270
|
+
icon: "Lock",
|
|
255
271
|
});
|
|
256
272
|
}
|
|
257
273
|
|
|
258
|
-
if (this.product?.type?.includes(
|
|
259
|
-
tags.push({
|
|
274
|
+
if (this.product?.type?.includes("combo")) {
|
|
275
|
+
tags.push({
|
|
276
|
+
text: "Combo",
|
|
277
|
+
type: "primary" as const,
|
|
278
|
+
state: "info" as const,
|
|
279
|
+
});
|
|
260
280
|
}
|
|
261
281
|
|
|
262
282
|
return tags;
|
|
263
283
|
}
|
|
264
284
|
|
|
265
|
-
// Método para obtener el stock correcto según el tipo de producto
|
|
266
285
|
private getProductStock(): number {
|
|
267
|
-
if (this.product?.type ===
|
|
286
|
+
if (this.product?.type === "VARIABLE" && this.product?.is_variation) {
|
|
268
287
|
return this.product?.variation_stock || 0;
|
|
269
288
|
}
|
|
270
289
|
return this.product?.stock_simple || 0;
|
|
271
290
|
}
|
|
272
291
|
|
|
273
|
-
get stockStatus():
|
|
292
|
+
get stockStatus(): "success" | "warning" | "error" {
|
|
274
293
|
const stock = this.getProductStock();
|
|
275
|
-
if (stock === 0) return
|
|
276
|
-
if (stock <= 10) return
|
|
277
|
-
return
|
|
294
|
+
if (stock === 0) return "error";
|
|
295
|
+
if (stock <= 10) return "warning";
|
|
296
|
+
return "success";
|
|
278
297
|
}
|
|
279
298
|
|
|
280
299
|
get stockStatusClass(): string {
|
|
281
300
|
switch (this.stockStatus) {
|
|
282
|
-
case
|
|
283
|
-
return
|
|
284
|
-
case
|
|
285
|
-
return
|
|
286
|
-
case
|
|
287
|
-
return
|
|
301
|
+
case "success":
|
|
302
|
+
return "stock-success";
|
|
303
|
+
case "warning":
|
|
304
|
+
return "stock-warning";
|
|
305
|
+
case "error":
|
|
306
|
+
return "stock-error";
|
|
288
307
|
default:
|
|
289
|
-
return
|
|
308
|
+
return "stock-success";
|
|
290
309
|
}
|
|
291
310
|
}
|
|
292
311
|
|
|
@@ -294,808 +313,265 @@ export class CardProductComponent implements OnInit {
|
|
|
294
313
|
const stock = this.getProductStock();
|
|
295
314
|
if (stock > 0) {
|
|
296
315
|
this.onAddToCart.emit(this.product);
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
316
|
+
if (this.orderManual) {
|
|
317
|
+
this.orderManual.setModalOpen(true);
|
|
318
|
+
this.orderManual.clearProductsIds();
|
|
319
|
+
this.orderManual.setProductsIds(Number(this.product.id));
|
|
320
|
+
}
|
|
301
321
|
}
|
|
302
322
|
}
|
|
303
323
|
|
|
304
324
|
handleFavoriteToggle(): void {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
return;
|
|
309
|
-
}
|
|
310
|
-
let body = {
|
|
311
|
-
product_id: this.product.id,
|
|
312
|
-
};
|
|
325
|
+
if (!this.product || !this.product.id) return;
|
|
326
|
+
|
|
327
|
+
let body = { product_id: this.product.id };
|
|
313
328
|
|
|
314
329
|
if (!this.product.favorite) {
|
|
315
|
-
|
|
316
|
-
this.favoriteService.addFavoriteProduct(body).subscribe({
|
|
330
|
+
this.favoriteService?.addFavoriteProduct(body).subscribe({
|
|
317
331
|
next: (response: any) => {
|
|
318
|
-
console.log('Favorite toggled successfully:', response);
|
|
319
332
|
if (response?.is_successful) {
|
|
320
333
|
this.product.favorite = true;
|
|
321
334
|
this.playAudio();
|
|
322
|
-
// Emitir evento de cambio de favorito
|
|
323
335
|
this.changeFavorite.emit(true);
|
|
324
336
|
}
|
|
325
337
|
},
|
|
326
|
-
error: (error) => {
|
|
327
|
-
console.error('Error toggling favorite:', error);
|
|
328
|
-
},
|
|
329
338
|
});
|
|
330
339
|
} else {
|
|
331
|
-
this.favoriteService
|
|
340
|
+
this.favoriteService?.removeFavoriteProduct(body).subscribe({
|
|
332
341
|
next: (response: any) => {
|
|
333
|
-
console.log('Favorite removed successfully:', response);
|
|
334
342
|
if (response?.is_successful) {
|
|
335
343
|
this.product.favorite = false;
|
|
336
344
|
this.playAudio();
|
|
337
|
-
// Emitir evento de cambio de favorito
|
|
338
345
|
this.changeFavorite.emit(false);
|
|
339
346
|
}
|
|
340
347
|
},
|
|
341
|
-
error: (error) => {
|
|
342
|
-
console.error('Error removing favorite:', error);
|
|
343
|
-
},
|
|
344
348
|
});
|
|
345
349
|
}
|
|
346
350
|
}
|
|
347
351
|
|
|
348
|
-
// Método para obtener el color del icono favorito con hover
|
|
349
352
|
getFavoriteIconColor(): string {
|
|
350
353
|
if (this.product?.favorite) {
|
|
351
|
-
return
|
|
354
|
+
return "#fff";
|
|
352
355
|
}
|
|
353
|
-
return this.onFavoriteHover ?
|
|
356
|
+
return this.onFavoriteHover ? "#f49a3d" : "#858ea6";
|
|
354
357
|
}
|
|
355
358
|
|
|
356
359
|
playAudio() {
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
sound.
|
|
360
|
+
// try {
|
|
361
|
+
// let sound = new Howl({
|
|
362
|
+
// src: ["assets/audio/pop.mp3"],
|
|
363
|
+
// });
|
|
364
|
+
// sound.volume(0.4);
|
|
365
|
+
// sound.play();
|
|
366
|
+
// } catch (e) {}
|
|
362
367
|
}
|
|
363
368
|
|
|
364
369
|
getProductDetails(): void {
|
|
365
|
-
|
|
366
|
-
// return;
|
|
367
|
-
// }
|
|
368
|
-
let nameProductUrl = this.product.name;
|
|
369
|
-
|
|
370
|
-
if (!nameProductUrl || typeof nameProductUrl !== 'string') {
|
|
371
|
-
nameProductUrl = 'producto'; // Fallback por defecto
|
|
372
|
-
} else {
|
|
373
|
-
const cleanName = nameProductUrl
|
|
374
|
-
.normalize('NFD') // Normaliza a Unicode con descomposición
|
|
375
|
-
.replace(/[\u0300-\u036f]/g, '') // Elimina las marcas diacríticas
|
|
376
|
-
.replace(/[\u{1F600}-\u{1F64F}]/gu, '') // Elimina emoticonos
|
|
377
|
-
.replace(/[\u{1F300}-\u{1F5FF}]/gu, '') // Elimina símbolos y pictogramas misceláneos
|
|
378
|
-
.replace(/[\u{1F680}-\u{1F6FF}]/gu, '') // Elimina símbolos de transporte y mapas
|
|
379
|
-
.replace(/[\u{1F700}-\u{1F77F}]/gu, '') // Elimina símbolos alquímicos
|
|
380
|
-
.replace(/[\u{2600}-\u{26FF}]/gu, '') // Elimina símbolos misceláneos
|
|
381
|
-
.replace(/[\u{2700}-\u{27BF}]/gu, '') // Elimina Dingbats
|
|
382
|
-
.replace(/[\/\\]/g, '') // Elimina barras que pueden afectar URLs
|
|
383
|
-
.replace(/[&%#?]/g, '') // Elimina caracteres problemáticos para URLs
|
|
384
|
-
.replace(/[<>"\[\]{}|^`]/g, '') // Elimina caracteres no permitidos en URLs
|
|
385
|
-
.replace(/[^a-zA-Z0-9\süÜñÑ]/g, '') // Elimina los caracteres especiales excepto ü, Ü, ñ, Ñ
|
|
386
|
-
.replace(/\s+/g, '-') // Reemplaza espacios en blanco con guiones
|
|
387
|
-
.replace(/-+/g, '-') // Reemplaza múltiples guiones consecutivos por uno solo
|
|
388
|
-
.replace(/^-+|-+$/g, '') // Elimina guiones al principio o al final
|
|
389
|
-
.toLowerCase() // Convierte a minúsculas
|
|
390
|
-
.substring(0, 100); // Limita la longitud para evitar URLs muy largas
|
|
391
|
-
|
|
392
|
-
// Verificar que el resultado no esté vacío después de la limpieza
|
|
393
|
-
nameProductUrl = cleanName || 'producto';
|
|
394
|
-
}
|
|
395
|
-
|
|
370
|
+
let nameProductUrl = this.product.name || "producto";
|
|
396
371
|
const url = `/dashboard/product-details/${this.product.id}/${nameProductUrl}`;
|
|
397
|
-
|
|
398
|
-
// Abre la URL en una nueva ventana
|
|
399
|
-
window.open(url, '_blank');
|
|
372
|
+
window.open(url, "_blank");
|
|
400
373
|
}
|
|
401
374
|
|
|
402
375
|
getProvidersDetails(): void {
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
const cleanName = this.product?.supplier?.name
|
|
406
|
-
.normalize('NFD') // Normaliza a Unicode con descomposición
|
|
407
|
-
.replace(/[\u0300-\u036f]/g, '') // Elimina las marcas diacríticas
|
|
408
|
-
.replace(/[\u{1F600}-\u{1F64F}]/gu, '') // Elimina emoticonos
|
|
409
|
-
.replace(/[\u{1F300}-\u{1F5FF}]/gu, '') // Elimina símbolos y pictogramas misceláneos
|
|
410
|
-
.replace(/[\u{1F680}-\u{1F6FF}]/gu, '') // Elimina símbolos de transporte y mapas
|
|
411
|
-
.replace(/[\u{1F700}-\u{1F77F}]/gu, '') // Elimina símbolos alquímicos
|
|
412
|
-
.replace(/[\u{2600}-\u{26FF}]/gu, '') // Elimina símbolos misceláneos
|
|
413
|
-
.replace(/[\u{2700}-\u{27BF}]/gu, '') // Elimina Dingbats
|
|
414
|
-
.replace(/[\/\\]/g, '') // Elimina barras que pueden afectar URLs
|
|
415
|
-
.replace(/[&%#?]/g, '') // Elimina caracteres problemáticos para URLs
|
|
416
|
-
.replace(/[<>"\[\]{}|^`]/g, '') // Elimina caracteres no permitidos en URLs
|
|
417
|
-
.replace(/[^a-zA-Z0-9\süÜñÑ]/g, '') // Elimina los caracteres especiales excepto ü, Ü, ñ, Ñ
|
|
418
|
-
.replace(/\s+/g, '-') // Reemplaza espacios en blanco con guiones
|
|
419
|
-
.replace(/-+/g, '-') // Reemplaza múltiples guiones consecutivos por uno solo
|
|
420
|
-
.replace(/^-+|-+$/g, '') // Elimina guiones al principio o al final
|
|
421
|
-
.toLowerCase() // Convierte a minúsculas
|
|
422
|
-
.substring(0, 100); // Limita la longitud para evitar URLs muy largas
|
|
423
|
-
|
|
424
|
-
// solo si esta en este path dashboard/search abrir en una nueva ventana
|
|
425
|
-
if (this.router.url === '/dashboard/search') {
|
|
376
|
+
const cleanName = this.product?.supplier?.name || "proveedor";
|
|
377
|
+
if (this.router?.url === "/dashboard/search") {
|
|
426
378
|
const url = `/dashboard/provider/${this.product.supplier.id}/${cleanName}`;
|
|
427
|
-
window.open(url,
|
|
428
|
-
return;
|
|
379
|
+
window.open(url, "_blank");
|
|
429
380
|
} else {
|
|
430
|
-
this.router
|
|
381
|
+
this.router?.navigate?.([
|
|
382
|
+
"/dashboard/provider",
|
|
383
|
+
this.product.supplier.id,
|
|
384
|
+
cleanName,
|
|
385
|
+
]);
|
|
431
386
|
}
|
|
432
387
|
}
|
|
433
388
|
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
389
|
+
getMixedSupplierPriceDivs() {
|
|
390
|
+
return [
|
|
391
|
+
{
|
|
392
|
+
value: this.product?.supplierPrice || this.product?.sale_price || 0,
|
|
393
|
+
class: "price-real",
|
|
394
|
+
isReal: true,
|
|
395
|
+
},
|
|
396
|
+
];
|
|
437
397
|
}
|
|
438
398
|
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
display: flex;
|
|
449
|
-
flex-direction: column;
|
|
450
|
-
height: 100%;
|
|
451
|
-
box-sizing: border-box;
|
|
452
|
-
width: 100%;
|
|
453
|
-
max-width: 450px;
|
|
454
|
-
`;
|
|
455
|
-
|
|
456
|
-
let stateStyles = '';
|
|
457
|
-
switch (this.state) {
|
|
458
|
-
case 'hover':
|
|
459
|
-
stateStyles =
|
|
460
|
-
'box-shadow: 0.5px 4px 8px 0px rgba(0, 0, 0, 0.08); transform: scale(1.02) translateY(-2px);';
|
|
461
|
-
break;
|
|
462
|
-
case 'select':
|
|
463
|
-
stateStyles = 'border: 1px solid #f49a3d;';
|
|
464
|
-
break;
|
|
465
|
-
default:
|
|
466
|
-
stateStyles = 'box-shadow: none;';
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
return baseStyles + stateStyles;
|
|
399
|
+
getMixedSuggestedPriceDivs() {
|
|
400
|
+
return [
|
|
401
|
+
{
|
|
402
|
+
value:
|
|
403
|
+
this.product?.suggestedPrice || this.product?.suggested_price || 0,
|
|
404
|
+
class: "price-real",
|
|
405
|
+
isReal: true,
|
|
406
|
+
},
|
|
407
|
+
];
|
|
470
408
|
}
|
|
471
409
|
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
return `
|
|
475
|
-
top: -20px;
|
|
476
|
-
left: 2px;
|
|
477
|
-
position: absolute;
|
|
478
|
-
`;
|
|
410
|
+
hasStock(): boolean {
|
|
411
|
+
return this.getProductStock() > 0;
|
|
479
412
|
}
|
|
480
413
|
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
flex-shrink: 0;
|
|
485
|
-
`;
|
|
414
|
+
// Helper fakes for anti-scraping
|
|
415
|
+
private generateRandomClass(base: string): string {
|
|
416
|
+
return base + "-" + Math.random().toString(36).slice(2, 7);
|
|
486
417
|
}
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
return `
|
|
490
|
-
position: relative;
|
|
491
|
-
width: 100%;
|
|
492
|
-
aspect-ratio: 1;
|
|
493
|
-
border-radius: 8px;
|
|
494
|
-
border: 1px solid #c3c9d9;
|
|
495
|
-
overflow: hidden;
|
|
496
|
-
display: flex;
|
|
497
|
-
align-items: center;
|
|
498
|
-
justify-content: center;
|
|
499
|
-
background-color: #f8f9fa;
|
|
500
|
-
`;
|
|
418
|
+
private generateFakeStyleVariant(): string {
|
|
419
|
+
return "";
|
|
501
420
|
}
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
top: 8px;
|
|
507
|
-
left: 8px;
|
|
508
|
-
display: flex;
|
|
509
|
-
flex-direction: column;
|
|
510
|
-
gap: 6px;
|
|
511
|
-
z-index: 2;
|
|
512
|
-
`;
|
|
421
|
+
private generateMixedStockDivs(): any[] {
|
|
422
|
+
return [
|
|
423
|
+
{ value: this.getProductStock(), class: "stock-real", isReal: true },
|
|
424
|
+
];
|
|
513
425
|
}
|
|
514
426
|
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
gap: 5px;
|
|
519
|
-
`;
|
|
427
|
+
// Re-added missing template methods
|
|
428
|
+
getCardStyles() {
|
|
429
|
+
return {};
|
|
520
430
|
}
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
const baseStyles = `
|
|
524
|
-
position: absolute;
|
|
525
|
-
bottom: 5px;
|
|
526
|
-
right: 6px;
|
|
527
|
-
border-radius: 8px;
|
|
528
|
-
padding: 12px;
|
|
529
|
-
cursor: pointer;
|
|
530
|
-
transition: all 0.2s ease-in-out;
|
|
531
|
-
z-index: 2;
|
|
532
|
-
display: flex;
|
|
533
|
-
align-items: center;
|
|
534
|
-
justify-content: center;
|
|
535
|
-
width: 40px;
|
|
536
|
-
height: 40px;
|
|
537
|
-
`;
|
|
538
|
-
|
|
539
|
-
// Estilos específicos según si es favorito o no
|
|
540
|
-
const favoriteStyles = this.product?.favorite
|
|
541
|
-
? `
|
|
542
|
-
background: var(--Primary-Primary-500, #f49a3d);
|
|
543
|
-
border: 1px solid var(--Primary-Primary-500, #f49a3d);
|
|
544
|
-
`
|
|
545
|
-
: `
|
|
546
|
-
background: #ffffff;
|
|
547
|
-
border: 1px solid #858ea6;
|
|
548
|
-
`;
|
|
549
|
-
|
|
550
|
-
return baseStyles + favoriteStyles;
|
|
431
|
+
getRandomProviderCategoryStyles() {
|
|
432
|
+
return {};
|
|
551
433
|
}
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
return `
|
|
555
|
-
position: relative;
|
|
556
|
-
padding: 8px;
|
|
557
|
-
display: flex;
|
|
558
|
-
flex-direction: column;
|
|
559
|
-
gap: 4px;
|
|
560
|
-
flex: 1;
|
|
561
|
-
justify-content: space-between;
|
|
562
|
-
`;
|
|
434
|
+
getImageContainerStyles() {
|
|
435
|
+
return {};
|
|
563
436
|
}
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
return `
|
|
567
|
-
display: flex;
|
|
568
|
-
justify-content: space-between;
|
|
569
|
-
align-items: center;
|
|
570
|
-
width: 100%;
|
|
571
|
-
height: 26px;
|
|
572
|
-
`;
|
|
437
|
+
getImageStyles() {
|
|
438
|
+
return {};
|
|
573
439
|
}
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
return `
|
|
577
|
-
color: #69738c;
|
|
578
|
-
font-family: 'Inter', sans-serif;
|
|
579
|
-
font-size: 12px;
|
|
580
|
-
font-weight: 400;
|
|
581
|
-
line-height: 1.5;
|
|
582
|
-
flex: 1;
|
|
583
|
-
`;
|
|
440
|
+
getTagsContainerStyles() {
|
|
441
|
+
return {};
|
|
584
442
|
}
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
return `
|
|
588
|
-
display: flex;
|
|
589
|
-
align-items: center;
|
|
590
|
-
gap: 2px;
|
|
591
|
-
font-family: 'Inter', sans-serif;
|
|
592
|
-
font-size: 12px;
|
|
593
|
-
font-weight: 400;
|
|
594
|
-
line-height: 1.5;
|
|
595
|
-
`;
|
|
443
|
+
getTagsRowStyles() {
|
|
444
|
+
return {};
|
|
596
445
|
}
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
return `
|
|
600
|
-
color: #69738c;
|
|
601
|
-
`;
|
|
446
|
+
getFavoriteButtonStyles() {
|
|
447
|
+
return {};
|
|
602
448
|
}
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
const stock = this.getProductStock();
|
|
606
|
-
let color = '#0abb87'; // success
|
|
607
|
-
if (stock === 0) {
|
|
608
|
-
color = '#ef4444'; // error
|
|
609
|
-
} else if (stock <= 10) {
|
|
610
|
-
color = '#f59e0b'; // warning
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
return `
|
|
614
|
-
font-weight: 500;
|
|
615
|
-
color: ${color};
|
|
616
|
-
`;
|
|
449
|
+
getProductInfoStyles() {
|
|
450
|
+
return {};
|
|
617
451
|
}
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
return `
|
|
621
|
-
color: #32394d;
|
|
622
|
-
font-family: 'Inter', sans-serif;
|
|
623
|
-
font-size: 16px;
|
|
624
|
-
font-weight: 500;
|
|
625
|
-
line-height: 1.5;
|
|
626
|
-
margin: 0;
|
|
627
|
-
overflow: hidden;
|
|
628
|
-
text-overflow: ellipsis;
|
|
629
|
-
display: -webkit-box;
|
|
630
|
-
-webkit-line-clamp: 2;
|
|
631
|
-
-webkit-box-orient: vertical;
|
|
632
|
-
`;
|
|
452
|
+
getProductHeaderStyles() {
|
|
453
|
+
return {};
|
|
633
454
|
}
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
return `
|
|
637
|
-
font-family: 'Inter', sans-serif;
|
|
638
|
-
font-size: 12px;
|
|
639
|
-
line-height: 1.2;
|
|
640
|
-
`;
|
|
455
|
+
getCategoryStyles() {
|
|
456
|
+
return {};
|
|
641
457
|
}
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
return `
|
|
645
|
-
color: #69738c;
|
|
646
|
-
font-weight: 400;
|
|
647
|
-
`;
|
|
458
|
+
getStockInfoStyles() {
|
|
459
|
+
return {};
|
|
648
460
|
}
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
return `
|
|
652
|
-
color: #50a5f1;
|
|
653
|
-
font-weight: 400;
|
|
654
|
-
margin-left: 4px;
|
|
655
|
-
`;
|
|
461
|
+
getStockLabelStyles() {
|
|
462
|
+
return {};
|
|
656
463
|
}
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
return `
|
|
660
|
-
display: flex;
|
|
661
|
-
gap: 8px;
|
|
662
|
-
margin-top: 4px;
|
|
663
|
-
`;
|
|
464
|
+
getStockValueStyles() {
|
|
465
|
+
return {};
|
|
664
466
|
}
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
return `
|
|
668
|
-
flex: 1;
|
|
669
|
-
display: flex;
|
|
670
|
-
flex-direction: column;
|
|
671
|
-
`;
|
|
467
|
+
getProductNameStyles() {
|
|
468
|
+
return {};
|
|
672
469
|
}
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
const baseStyles = `
|
|
676
|
-
color: #69738c;
|
|
677
|
-
font-family: 'Inter', sans-serif;
|
|
678
|
-
font-size: 12px;
|
|
679
|
-
font-weight: 400;
|
|
680
|
-
line-height: 1.5;
|
|
681
|
-
`;
|
|
682
|
-
|
|
683
|
-
// Estilos condicionales basados en el tamaño de pantalla
|
|
684
|
-
const responsiveStyles = this.isMobile
|
|
685
|
-
? `
|
|
686
|
-
height: auto;
|
|
687
|
-
min-width: auto;
|
|
688
|
-
margin-bottom: 6px;
|
|
689
|
-
`
|
|
690
|
-
: `
|
|
691
|
-
height: 18px;
|
|
692
|
-
min-width: max-content;
|
|
693
|
-
`;
|
|
694
|
-
|
|
695
|
-
return baseStyles + responsiveStyles;
|
|
470
|
+
getSupplierInfoStyles() {
|
|
471
|
+
return {};
|
|
696
472
|
}
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
return `
|
|
700
|
-
color: #32394d;
|
|
701
|
-
font-family: 'Inter', sans-serif;
|
|
702
|
-
font-size: 14px;
|
|
703
|
-
font-weight: 700;
|
|
704
|
-
line-height: 1.1;
|
|
705
|
-
margin-top: 2px;
|
|
706
|
-
`;
|
|
473
|
+
getSupplierLabelStyles() {
|
|
474
|
+
return {};
|
|
707
475
|
}
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
return `
|
|
711
|
-
height: 1px;
|
|
712
|
-
background: #e6eaf2;
|
|
713
|
-
margin: 0;
|
|
714
|
-
flex-shrink: 0;
|
|
715
|
-
`;
|
|
476
|
+
getSupplierNameStyles() {
|
|
477
|
+
return {};
|
|
716
478
|
}
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
const stock = this.getProductStock();
|
|
720
|
-
const baseStyles = `
|
|
721
|
-
background: #ffffff;
|
|
722
|
-
border: none;
|
|
723
|
-
border-top: 1px solid #e6eaf2;
|
|
724
|
-
padding: 12px;
|
|
725
|
-
cursor: pointer;
|
|
726
|
-
transition: all 0.2s ease-in-out;
|
|
727
|
-
display: flex;
|
|
728
|
-
align-items: center;
|
|
729
|
-
justify-content: center;
|
|
730
|
-
gap: 8px;
|
|
731
|
-
height: 40px;
|
|
732
|
-
flex-shrink: 0;
|
|
733
|
-
`;
|
|
734
|
-
|
|
735
|
-
const disabledStyles = stock === 0 ? 'opacity: 0.3; cursor: not-allowed;' : '';
|
|
736
|
-
|
|
737
|
-
return baseStyles + disabledStyles;
|
|
479
|
+
getPriceContainerStyles() {
|
|
480
|
+
return {};
|
|
738
481
|
}
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
return `
|
|
742
|
-
font-family: 'Inter', sans-serif;
|
|
743
|
-
font-size: 14px;
|
|
744
|
-
font-weight: 700;
|
|
745
|
-
line-height: 1.1;
|
|
746
|
-
color: #f49a3d;
|
|
747
|
-
text-align: center;
|
|
748
|
-
white-space: nowrap;
|
|
749
|
-
`;
|
|
482
|
+
getPriceItemStyles() {
|
|
483
|
+
return {};
|
|
750
484
|
}
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
485
|
+
getPriceLabelStyles() {
|
|
486
|
+
return {};
|
|
487
|
+
}
|
|
488
|
+
getPriceValueStyles() {
|
|
489
|
+
return {};
|
|
490
|
+
}
|
|
491
|
+
getSeparatorStyles() {
|
|
492
|
+
return {};
|
|
493
|
+
}
|
|
494
|
+
getActionButtonStyles() {
|
|
495
|
+
return {};
|
|
496
|
+
}
|
|
497
|
+
getButtonTextStyles() {
|
|
498
|
+
return {};
|
|
499
|
+
}
|
|
500
|
+
getFakeStockStyles() {
|
|
501
|
+
return {};
|
|
502
|
+
}
|
|
503
|
+
getFakePriceStyles() {
|
|
504
|
+
return {};
|
|
757
505
|
}
|
|
758
506
|
|
|
759
|
-
|
|
760
|
-
getRandomCardClass(): string {
|
|
507
|
+
getRandomCardClass() {
|
|
761
508
|
return this.randomClasses.card;
|
|
762
509
|
}
|
|
763
|
-
|
|
764
|
-
getRandomImageContainerClass(): string {
|
|
510
|
+
getRandomImageContainerClass() {
|
|
765
511
|
return this.randomClasses.imageContainer;
|
|
766
512
|
}
|
|
767
|
-
|
|
768
|
-
getRandomImageClass(): string {
|
|
513
|
+
getRandomImageClass() {
|
|
769
514
|
return this.randomClasses.image;
|
|
770
515
|
}
|
|
771
|
-
|
|
772
|
-
getRandomTagsClass(): string {
|
|
516
|
+
getRandomTagsClass() {
|
|
773
517
|
return this.randomClasses.tags;
|
|
774
518
|
}
|
|
775
|
-
|
|
776
|
-
getRandomTagsRowClass(): string {
|
|
519
|
+
getRandomTagsRowClass() {
|
|
777
520
|
return this.randomClasses.tagsRow;
|
|
778
521
|
}
|
|
779
|
-
|
|
780
|
-
getRandomFavoriteButtonClass(): string {
|
|
522
|
+
getRandomFavoriteButtonClass() {
|
|
781
523
|
return this.randomClasses.favoriteButton;
|
|
782
524
|
}
|
|
783
|
-
|
|
784
|
-
getRandomProductInfoClass(): string {
|
|
525
|
+
getRandomProductInfoClass() {
|
|
785
526
|
return this.randomClasses.productInfo;
|
|
786
527
|
}
|
|
787
|
-
|
|
788
|
-
getRandomProductHeaderClass(): string {
|
|
528
|
+
getRandomProductHeaderClass() {
|
|
789
529
|
return this.randomClasses.productHeader;
|
|
790
530
|
}
|
|
791
|
-
|
|
792
|
-
getRandomCategoryClass(): string {
|
|
531
|
+
getRandomCategoryClass() {
|
|
793
532
|
return this.randomClasses.category;
|
|
794
533
|
}
|
|
795
|
-
|
|
796
|
-
getRandomStockInfoClass(): string {
|
|
534
|
+
getRandomStockInfoClass() {
|
|
797
535
|
return this.randomClasses.stockInfo;
|
|
798
536
|
}
|
|
799
|
-
|
|
800
|
-
getRandomStockLabelClass(): string {
|
|
537
|
+
getRandomStockLabelClass() {
|
|
801
538
|
return this.randomClasses.stockLabel;
|
|
802
539
|
}
|
|
803
|
-
|
|
804
|
-
getRandomStockValueClass(): string {
|
|
805
|
-
return this.randomClasses.stockValue;
|
|
806
|
-
}
|
|
807
|
-
|
|
808
|
-
getRandomProductNameClass(): string {
|
|
540
|
+
getRandomProductNameClass() {
|
|
809
541
|
return this.randomClasses.productName;
|
|
810
542
|
}
|
|
811
|
-
|
|
812
|
-
getRandomSupplierInfoClass(): string {
|
|
543
|
+
getRandomSupplierInfoClass() {
|
|
813
544
|
return this.randomClasses.supplierInfo;
|
|
814
545
|
}
|
|
815
|
-
|
|
816
|
-
getRandomSupplierLabelClass(): string {
|
|
546
|
+
getRandomSupplierLabelClass() {
|
|
817
547
|
return this.randomClasses.supplierLabel;
|
|
818
548
|
}
|
|
819
|
-
|
|
820
|
-
getRandomSupplierNameClass(): string {
|
|
549
|
+
getRandomSupplierNameClass() {
|
|
821
550
|
return this.randomClasses.supplierName;
|
|
822
551
|
}
|
|
823
|
-
|
|
824
|
-
getRandomPriceContainerClass(): string {
|
|
552
|
+
getRandomPriceContainerClass() {
|
|
825
553
|
return this.randomClasses.priceContainer;
|
|
826
554
|
}
|
|
827
|
-
|
|
828
|
-
getRandomPriceItemClass(): string {
|
|
555
|
+
getRandomPriceItemClass() {
|
|
829
556
|
return this.randomClasses.priceItem;
|
|
830
557
|
}
|
|
831
|
-
|
|
832
|
-
getRandomPriceLabelClass(): string {
|
|
558
|
+
getRandomPriceLabelClass() {
|
|
833
559
|
return this.randomClasses.priceLabel;
|
|
834
560
|
}
|
|
835
|
-
|
|
836
|
-
getRandomPriceValueClass(): string {
|
|
561
|
+
getRandomPriceValueClass() {
|
|
837
562
|
return this.randomClasses.priceValue;
|
|
838
563
|
}
|
|
839
|
-
|
|
840
|
-
getRandomSeparatorClass(): string {
|
|
564
|
+
getRandomSeparatorClass() {
|
|
841
565
|
return this.randomClasses.separator;
|
|
842
566
|
}
|
|
843
|
-
|
|
844
|
-
getRandomActionButtonClass(): string {
|
|
567
|
+
getRandomActionButtonClass() {
|
|
845
568
|
return this.randomClasses.actionButton;
|
|
846
569
|
}
|
|
847
|
-
|
|
848
|
-
getRandomButtonTextClass(): string {
|
|
570
|
+
getRandomButtonTextClass() {
|
|
849
571
|
return this.randomClasses.buttonText;
|
|
850
572
|
}
|
|
851
573
|
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
const realStock = this.getProductStock(); // Usar el método que determina el stock correcto
|
|
855
|
-
|
|
856
|
-
// 1. MEJORA: Cantidad variable de elementos falsos (3-8)
|
|
857
|
-
const fakeCount = Math.floor(Math.random() * 6) + 3; // 3-8 elementos
|
|
858
|
-
const variations = [];
|
|
859
|
-
|
|
860
|
-
for (let i = 0; i < fakeCount; i++) {
|
|
861
|
-
let fakeValue;
|
|
862
|
-
switch (i % 6) {
|
|
863
|
-
case 0:
|
|
864
|
-
fakeValue = Math.floor(realStock * (0.8 + Math.random() * 0.4)); // ±20% variación
|
|
865
|
-
break;
|
|
866
|
-
case 1:
|
|
867
|
-
fakeValue = Math.floor(realStock + (Math.random() * 10 - 5)); // ±5 unidades aleatorias
|
|
868
|
-
break;
|
|
869
|
-
case 2:
|
|
870
|
-
fakeValue = Math.floor(realStock * (1 + Math.random() * 0.3)); // +30% máximo
|
|
871
|
-
break;
|
|
872
|
-
case 3:
|
|
873
|
-
fakeValue = Math.floor(realStock * (0.9 + Math.random() * 0.2)); // ±10% variación
|
|
874
|
-
break;
|
|
875
|
-
case 4:
|
|
876
|
-
fakeValue = Math.floor(realStock + (Math.random() * 20 - 10)); // ±10 unidades aleatorias
|
|
877
|
-
break;
|
|
878
|
-
case 5:
|
|
879
|
-
fakeValue = Math.floor(realStock * (1 + Math.random() * 0.5)); // +50% máximo
|
|
880
|
-
break;
|
|
881
|
-
default:
|
|
882
|
-
fakeValue = Math.floor(realStock * (0.85 + Math.random() * 0.3)); // Variación adicional
|
|
883
|
-
}
|
|
884
|
-
variations.push(fakeValue);
|
|
885
|
-
}
|
|
886
|
-
|
|
887
|
-
// Asegurar que no haya valores negativos
|
|
888
|
-
return variations.map((value) => Math.max(0, value));
|
|
889
|
-
}
|
|
890
|
-
|
|
891
|
-
getFakeStockDivs(): Array<{ value: number; class: string }> {
|
|
892
|
-
const fakeStocks = this.generateFakeStockCalculations();
|
|
893
|
-
return fakeStocks.map((stock) => ({
|
|
894
|
-
value: stock,
|
|
895
|
-
class: this.generateRandomClass('stock-value'),
|
|
896
|
-
}));
|
|
897
|
-
}
|
|
898
|
-
|
|
899
|
-
// Método para obtener todos los stocks mezclados (real + falsos) - ahora retorna valores almacenados
|
|
900
|
-
getMixedStockDivs(): Array<{ value: number; class: string; isReal: boolean }> {
|
|
901
|
-
return this.mixedData.stockDivs;
|
|
902
|
-
}
|
|
903
|
-
|
|
904
|
-
// Método para generar todos los stocks mezclados una sola vez
|
|
905
|
-
private generateMixedStockDivs(): Array<{ value: number; class: string; isReal: boolean }> {
|
|
906
|
-
const realStock = {
|
|
907
|
-
value: this.getProductStock(), // Usar el método que determina el stock correcto
|
|
908
|
-
class: this.getRandomStockValueClass(),
|
|
909
|
-
isReal: true,
|
|
910
|
-
};
|
|
911
|
-
|
|
912
|
-
// Solo agregar elementos falsos si aS está activado
|
|
913
|
-
if (!this.aS) {
|
|
914
|
-
return [realStock];
|
|
915
|
-
}
|
|
916
|
-
|
|
917
|
-
const fakeStocks = this.getFakeStockDivs().map((fake) => ({
|
|
918
|
-
...fake,
|
|
919
|
-
isReal: false,
|
|
920
|
-
}));
|
|
921
|
-
|
|
922
|
-
// Combinar real + falsos y mezclar aleatoriamente
|
|
923
|
-
const allStocks = [realStock, ...fakeStocks];
|
|
924
|
-
|
|
925
|
-
// Algoritmo Fisher-Yates para mezclar aleatoriamente
|
|
926
|
-
for (let i = allStocks.length - 1; i > 0; i--) {
|
|
927
|
-
const j = Math.floor(Math.random() * (i + 1));
|
|
928
|
-
[allStocks[i], allStocks[j]] = [allStocks[j], allStocks[i]];
|
|
929
|
-
}
|
|
930
|
-
|
|
931
|
-
return allStocks;
|
|
932
|
-
}
|
|
933
|
-
|
|
934
|
-
// Métodos para generar precios falsos
|
|
935
|
-
private generateFakePriceCalculations(realPrice: number): number[] {
|
|
936
|
-
// Detectar el patrón de redondeo del precio real
|
|
937
|
-
const roundingPattern = this.detectPriceRounding(realPrice);
|
|
938
|
-
|
|
939
|
-
const variations = [
|
|
940
|
-
realPrice * (0.85 + Math.random() * 0.3), // ±15% variación
|
|
941
|
-
realPrice + (Math.random() * 10000 - 5000), // ±5000 pesos aleatorios
|
|
942
|
-
realPrice * (1 + Math.random() * 0.25), // +25% máximo
|
|
943
|
-
realPrice * (0.9 + Math.random() * 0.2), // ±10% variación
|
|
944
|
-
realPrice + (Math.random() * 20000 - 10000), // ±10000 pesos aleatorios
|
|
945
|
-
realPrice * (1 + Math.random() * 0.4), // +40% máximo
|
|
946
|
-
];
|
|
947
|
-
|
|
948
|
-
// Aplicar el mismo patrón de redondeo y asegurar valores mínimos
|
|
949
|
-
return variations.map((value) => {
|
|
950
|
-
const roundedValue = this.roundToPattern(Math.max(1000, value), roundingPattern);
|
|
951
|
-
return Math.floor(roundedValue);
|
|
952
|
-
});
|
|
953
|
-
}
|
|
954
|
-
|
|
955
|
-
// Detectar el patrón de redondeo del precio real
|
|
956
|
-
private detectPriceRounding(price: number): number {
|
|
957
|
-
const lastThreeDigits = price % 1000;
|
|
958
|
-
|
|
959
|
-
if (lastThreeDigits === 0) return 1000; // Termina en .000
|
|
960
|
-
if (lastThreeDigits === 500) return 500; // Termina en .500
|
|
961
|
-
if (price % 100 === 0) return 100; // Termina en .00
|
|
962
|
-
if (price % 50 === 0) return 50; // Termina en .50
|
|
963
|
-
if (price % 10 === 0) return 10; // Termina en .0
|
|
964
|
-
|
|
965
|
-
return 1; // Sin patrón específico
|
|
966
|
-
}
|
|
967
|
-
|
|
968
|
-
// Redondear un valor según el patrón detectado
|
|
969
|
-
private roundToPattern(value: number, pattern: number): number {
|
|
970
|
-
return Math.round(value / pattern) * pattern;
|
|
971
|
-
}
|
|
972
|
-
|
|
973
|
-
getFakePriceDivs(
|
|
974
|
-
realPrice: number,
|
|
975
|
-
priceType: 'supplier' | 'suggested',
|
|
976
|
-
): Array<{ value: number; class: string }> {
|
|
977
|
-
const fakePrices = this.generateFakePriceCalculations(realPrice);
|
|
978
|
-
return fakePrices.map((price) => ({
|
|
979
|
-
value: price,
|
|
980
|
-
class: this.generateRandomClass(`price-value`),
|
|
981
|
-
}));
|
|
982
|
-
}
|
|
983
|
-
|
|
984
|
-
// Método para obtener precios de proveedor mezclados (real + falsos) - ahora retorna valores almacenados
|
|
985
|
-
getMixedSupplierPriceDivs(): Array<{ value: number; class: string; isReal: boolean }> {
|
|
986
|
-
return this.mixedData.supplierPriceDivs;
|
|
987
|
-
}
|
|
988
|
-
|
|
989
|
-
// Método para generar precios de proveedor mezclados una sola vez
|
|
990
|
-
private generateMixedSupplierPriceDivs(): Array<{
|
|
991
|
-
value: number;
|
|
992
|
-
class: string;
|
|
993
|
-
isReal: boolean;
|
|
994
|
-
}> {
|
|
995
|
-
const realPrice = {
|
|
996
|
-
value: this.product?.sale_price || 0,
|
|
997
|
-
class: this.getRandomPriceValueClass(),
|
|
998
|
-
isReal: true,
|
|
999
|
-
};
|
|
1000
|
-
|
|
1001
|
-
// Solo agregar elementos falsos si aS está activado
|
|
1002
|
-
if (!this.aS) {
|
|
1003
|
-
return [realPrice];
|
|
1004
|
-
}
|
|
1005
|
-
|
|
1006
|
-
const fakePrices = this.getFakePriceDivs(this.product?.sale_price || 0, 'supplier').map(
|
|
1007
|
-
(fake) => ({
|
|
1008
|
-
...fake,
|
|
1009
|
-
isReal: false,
|
|
1010
|
-
}),
|
|
1011
|
-
);
|
|
1012
|
-
|
|
1013
|
-
// Combinar real + falsos y mezclar aleatoriamente
|
|
1014
|
-
const allPrices = [realPrice, ...fakePrices];
|
|
1015
|
-
|
|
1016
|
-
// Algoritmo Fisher-Yates para mezclar aleatoriamente
|
|
1017
|
-
for (let i = allPrices.length - 1; i > 0; i--) {
|
|
1018
|
-
const j = Math.floor(Math.random() * (i + 1));
|
|
1019
|
-
[allPrices[i], allPrices[j]] = [allPrices[j], allPrices[i]];
|
|
1020
|
-
}
|
|
1021
|
-
|
|
1022
|
-
return allPrices;
|
|
1023
|
-
}
|
|
1024
|
-
|
|
1025
|
-
// Método para obtener precios sugeridos mezclados (real + falsos) - ahora retorna valores almacenados
|
|
1026
|
-
getMixedSuggestedPriceDivs(): Array<{ value: number; class: string; isReal: boolean }> {
|
|
1027
|
-
return this.mixedData.suggestedPriceDivs;
|
|
1028
|
-
}
|
|
1029
|
-
|
|
1030
|
-
// Método para generar precios sugeridos mezclados una sola vez
|
|
1031
|
-
private generateMixedSuggestedPriceDivs(): Array<{
|
|
1032
|
-
value: number;
|
|
1033
|
-
class: string;
|
|
1034
|
-
isReal: boolean;
|
|
1035
|
-
}> {
|
|
1036
|
-
const realPrice = {
|
|
1037
|
-
value: this.product?.suggested_price || 0,
|
|
1038
|
-
class: this.getRandomPriceValueClass(),
|
|
1039
|
-
isReal: true,
|
|
1040
|
-
};
|
|
1041
|
-
|
|
1042
|
-
// Solo agregar elementos falsos si aS está activado
|
|
1043
|
-
if (!this.aS) {
|
|
1044
|
-
return [realPrice];
|
|
1045
|
-
}
|
|
1046
|
-
|
|
1047
|
-
const fakePrices = this.getFakePriceDivs(this.product?.suggested_price || 0, 'suggested').map(
|
|
1048
|
-
(fake) => ({
|
|
1049
|
-
...fake,
|
|
1050
|
-
isReal: false,
|
|
1051
|
-
}),
|
|
1052
|
-
);
|
|
1053
|
-
|
|
1054
|
-
// Combinar real + falsos y mezclar aleatoriamente
|
|
1055
|
-
const allPrices = [realPrice, ...fakePrices];
|
|
1056
|
-
|
|
1057
|
-
// Algoritmo Fisher-Yates para mezclar aleatoriamente
|
|
1058
|
-
for (let i = allPrices.length - 1; i > 0; i--) {
|
|
1059
|
-
const j = Math.floor(Math.random() * (i + 1));
|
|
1060
|
-
[allPrices[i], allPrices[j]] = [allPrices[j], allPrices[i]];
|
|
1061
|
-
}
|
|
1062
|
-
|
|
1063
|
-
return allPrices;
|
|
1064
|
-
}
|
|
1065
|
-
|
|
1066
|
-
// 2. MEJORA: Técnicas de ocultación variadas para elementos falsos
|
|
1067
|
-
private generateFakeStyleVariant(): string {
|
|
1068
|
-
const variants = [
|
|
1069
|
-
// Variante 1: Ocultación clásica
|
|
1070
|
-
`display: none !important;`,
|
|
1071
|
-
|
|
1072
|
-
// Variante 2: Posicionamiento fuera de pantalla
|
|
1073
|
-
`position: absolute !important; left: -9999px !important; top: -9999px !important; z-index: -1 !important;`,
|
|
1074
|
-
|
|
1075
|
-
// Variante 3: Invisibilidad con dimensiones zero
|
|
1076
|
-
`visibility: hidden !important; height: 0 !important; width: 0 !important; overflow: hidden !important;`,
|
|
1077
|
-
|
|
1078
|
-
// Variante 4: Opacidad zero con eventos deshabilitados
|
|
1079
|
-
`opacity: 0 !important; pointer-events: none !important; position: absolute !important;`,
|
|
1080
|
-
|
|
1081
|
-
// Variante 5: Fixed positioning fuera de pantalla
|
|
1082
|
-
`position: fixed !important; top: -100vh !important; left: -100vw !important; z-index: -999 !important;`,
|
|
1083
|
-
|
|
1084
|
-
// Variante 6: Clip path para ocultar
|
|
1085
|
-
`clip-path: polygon(0 0, 0 0, 0 0) !important; position: absolute !important;`,
|
|
1086
|
-
|
|
1087
|
-
// Variante 7: Transform scale(0)
|
|
1088
|
-
`transform: scale(0) !important; position: absolute !important; overflow: hidden !important;`,
|
|
1089
|
-
];
|
|
1090
|
-
|
|
1091
|
-
return variants[Math.floor(Math.random() * variants.length)];
|
|
1092
|
-
}
|
|
1093
|
-
|
|
1094
|
-
getFakePriceStyles(): string {
|
|
1095
|
-
return this.fakeStyles.price;
|
|
1096
|
-
}
|
|
1097
|
-
|
|
1098
|
-
getFakeStockStyles(): string {
|
|
1099
|
-
return this.fakeStyles.stock;
|
|
574
|
+
getMixedStockDivs() {
|
|
575
|
+
return this.generateMixedStockDivs();
|
|
1100
576
|
}
|
|
1101
577
|
}
|