ng-easycommerce-v18 0.3.18-beta.2 → 0.3.18-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/README.md +6 -0
  2. package/esm2022/lib/constants/core.constants.service.mjs +5 -5
  3. package/esm2022/lib/ec-components/abstractions-components/menu-ec.component.mjs +17 -1
  4. package/esm2022/lib/ec-components/auth-ec/login-form-ec/login-form-ec.component.mjs +26 -16
  5. package/esm2022/lib/ec-components/auth-ec/password-reset-ec/password-reset-ec.component.mjs +25 -21
  6. package/esm2022/lib/ec-components/blocks-ec/block-products-ec/block-products-ec.component.mjs +2 -16
  7. package/esm2022/lib/ec-components/filters-ec/filters-ec.component.mjs +36 -7
  8. package/esm2022/lib/ec-components/header-ec/header-ec.component.mjs +5 -5
  9. package/esm2022/lib/ec-components/product-detail-ec/product-detail-ec.component.mjs +12 -7
  10. package/esm2022/lib/ec-components/stores-ec/stores-ec.component.mjs +18 -9
  11. package/esm2022/lib/ec-components/widgets-ec/decidir-ec/decidir-ec.component.mjs +12 -6
  12. package/esm2022/lib/ec-components/widgets-ec/magnizoom-ec/magnizoom-ec.component.mjs +6 -4
  13. package/esm2022/lib/ec-services/analytics/google-analytics.service.mjs +4 -4
  14. package/esm2022/lib/ec-services/analytics/gtm.service.mjs +10 -6
  15. package/esm2022/lib/ec-services/analytics/metricool-pixel.service.mjs +17 -18
  16. package/esm2022/lib/interfaces/filter.mjs +1 -1
  17. package/esm2022/lib/interfaces/options.mjs +1 -1
  18. package/fesm2022/ng-easycommerce-v18.mjs +179 -109
  19. package/fesm2022/ng-easycommerce-v18.mjs.map +1 -1
  20. package/lib/ec-components/abstractions-components/menu-ec.component.d.ts +12 -0
  21. package/lib/ec-components/auth-ec/login-form-ec/login-form-ec.component.d.ts +2 -0
  22. package/lib/ec-components/filters-ec/filters-ec.component.d.ts +12 -4
  23. package/lib/ec-services/analytics/google-analytics.service.d.ts +1 -1
  24. package/lib/ec-services/analytics/gtm.service.d.ts +2 -2
  25. package/lib/interfaces/filter.d.ts +1 -0
  26. package/lib/interfaces/options.d.ts +2 -0
  27. package/package.json +1 -1
@@ -466,7 +466,7 @@ class CoreConstantsService {
466
466
  */
467
467
  window;
468
468
  constructor() {
469
- if (isPlatformBrowser(this.platformId)) {
469
+ if (isPlatformBrowser(this.platformId) && typeof window !== 'undefined') {
470
470
  this.window = window;
471
471
  }
472
472
  }
@@ -505,7 +505,7 @@ class CoreConstantsService {
505
505
  */
506
506
  get FRONTEND_URL() {
507
507
  // Verificar si estamos en el navegador
508
- if (isPlatformBrowser(this.platformId)) {
508
+ if (isPlatformBrowser(this.platformId) && typeof window !== 'undefined') {
509
509
  // Primero intenta leer de window.__env (configurado por Docker/CI)
510
510
  const windowEnv = this.window?.__env;
511
511
  if (windowEnv?.frontendUrl) {
@@ -526,7 +526,7 @@ class CoreConstantsService {
526
526
  }
527
527
  }
528
528
  // Para SSR, intentar construir desde el document si está disponible
529
- if (this.document?.location) {
529
+ if (typeof document !== 'undefined' && this.document?.location) {
530
530
  return `${this.document.location.protocol}//${this.document.location.host}`;
531
531
  }
532
532
  // Intentar obtener desde environment
@@ -606,7 +606,7 @@ class CoreConstantsService {
606
606
  * Retorna `true` si la vista es mobile, `false` caso contrario.
607
607
  * @returns {boolean}
608
608
  */
609
- mobileScreen = () => this.window && this.window?.innerWidth < 750 || false;
609
+ mobileScreen = () => isPlatformBrowser(this.platformId) && typeof window !== 'undefined' && this.window && this.window?.innerWidth < 750 || false;
610
610
  /**
611
611
  * Contiene los valores para la moneda actual
612
612
  */
@@ -1459,7 +1459,7 @@ class GoogleAnalyticsService {
1459
1459
  * @param gtm_id id provisto por Google Tag Manager.
1460
1460
  */
1461
1461
  initialize(gtm_id) {
1462
- if (typeof document !== 'undefined' && !document.getElementById('google_tag_manager')) {
1462
+ if (isPlatformBrowser(this.platformId) && this.document && !this.document.getElementById('google_tag_manager')) {
1463
1463
  console.log('hay elemento');
1464
1464
  const declaration = this.renderer.createElement('script');
1465
1465
  declaration.async = true;
@@ -1467,8 +1467,8 @@ class GoogleAnalyticsService {
1467
1467
  declaration.src = `https://www.googletagmanager.com/gtag/js?id=${gtm_id}`;
1468
1468
  const initialization = this.renderer.createElement('script');
1469
1469
  initialization.text = `window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', '${gtm_id}')`;
1470
- this.renderer.appendChild(this.document?.head, initialization);
1471
- this.renderer.appendChild(this.document?.head, declaration);
1470
+ this.renderer.appendChild(this.document.head, initialization);
1471
+ this.renderer.appendChild(this.document.head, declaration);
1472
1472
  this.enabled = true;
1473
1473
  }
1474
1474
  setTimeout(() => this.startListeningPageViews(gtm_id), 1000);
@@ -1728,6 +1728,7 @@ class GTMService {
1728
1728
  window;
1729
1729
  rendererFactory = inject(RendererFactory2);
1730
1730
  document = null;
1731
+ platformId = inject(PLATFORM_ID);
1731
1732
  /**
1732
1733
  * Servicio de ruteo de angular.
1733
1734
  */
@@ -1736,7 +1737,7 @@ class GTMService {
1736
1737
  * Configuración de Google Tag Manager.
1737
1738
  */
1738
1739
  config = { id: null };
1739
- platformId = inject(PLATFORM_ID);
1740
+ // private platformId: any = inject(PLATFORM_ID) // Eliminada duplicidad, ya está declarada arriba
1740
1741
  constructor() {
1741
1742
  this.renderer = this.rendererFactory.createRenderer(null, null);
1742
1743
  if (isPlatformBrowser(this.platformId)) {
@@ -1769,12 +1770,15 @@ class GTMService {
1769
1770
  */
1770
1771
  addGtmToDom() {
1771
1772
  return new Promise((resolve, reject) => {
1773
+ if (!isPlatformBrowser(this.platformId) || !this.document) {
1774
+ // No manipular el DOM en SSR
1775
+ return resolve(false);
1776
+ }
1772
1777
  if (this.isLoaded) {
1773
1778
  return resolve(this.isLoaded);
1774
1779
  }
1775
- //const doc = this.browserGlobals.documentRef();
1776
1780
  this.pushOnDataLayer({ 'gtm.start': new Date().getTime(), event: 'gtm.js' });
1777
- const gtmScript = this.document?.createElement('script'); //doc.createElement('script');
1781
+ const gtmScript = this.document.createElement('script');
1778
1782
  if (gtmScript) {
1779
1783
  gtmScript.id = 'GTMscript';
1780
1784
  gtmScript.async = true;
@@ -1785,7 +1789,7 @@ class GTMService {
1785
1789
  gtmScript.addEventListener('error', () => {
1786
1790
  return reject(false);
1787
1791
  });
1788
- this.document?.head.insertBefore(gtmScript, this.document.head.firstChild);
1792
+ this.document.head.insertBefore(gtmScript, this.document.head.firstChild);
1789
1793
  }
1790
1794
  });
1791
1795
  }
@@ -1802,7 +1806,7 @@ class GTMService {
1802
1806
  initialize(config) {
1803
1807
  this.config = config || this.config;
1804
1808
  this.addGtmToDom().then(() => {
1805
- this.router.events.forEach(item => {
1809
+ this.router.events.forEach((item) => {
1806
1810
  if (item instanceof NavigationEnd) {
1807
1811
  const gtmTag = {
1808
1812
  event: 'page',
@@ -2176,9 +2180,6 @@ class MetricoolPixelService {
2176
2180
  */
2177
2181
  renderer;
2178
2182
  constructor() {
2179
- if (isPlatformBrowser(this.platformId)) {
2180
- this.document = document;
2181
- }
2182
2183
  this.renderer = this.rendererFactory.createRenderer(null, null);
2183
2184
  }
2184
2185
  /**
@@ -2186,20 +2187,22 @@ class MetricoolPixelService {
2186
2187
  * @param pixel_hash hash provisto por Metricool Pixel.
2187
2188
  */
2188
2189
  initialize = (pixel_hash) => {
2189
- let new_analityc_script = this.renderer.createElement('script');
2190
- new_analityc_script.type = 'text/javascript';
2191
- new_analityc_script.text = `
2192
- function loadScript(a) {
2193
- var b = document.getElementsByTagName("head")[0], c = document.createElement("script");
2194
- c.type = "text/javascript",
2195
- c.src = "https://tracker.metricool.com/resources/be.js",
2196
- c.onreadystatechange = a,
2197
- c.onload = a, b.appendChild(c)
2198
- } loadScript(function () {
2199
- beTracker.t({ hash: "${pixel_hash}" })
2200
- });
2201
- `;
2202
- this.renderer.appendChild(this.document?.body, new_analityc_script);
2190
+ if (isPlatformBrowser(this.platformId) && this.document) {
2191
+ let new_analityc_script = this.renderer.createElement('script');
2192
+ new_analityc_script.type = 'text/javascript';
2193
+ new_analityc_script.text = `
2194
+ function loadScript(a) {
2195
+ var b = document.getElementsByTagName("head")[0], c = document.createElement("script");
2196
+ c.type = "text/javascript",
2197
+ c.src = "https://tracker.metricool.com/resources/be.js",
2198
+ c.onreadystatechange = a,
2199
+ c.onload = a, b.appendChild(c)
2200
+ } loadScript(function () {
2201
+ beTracker.t({ hash: "${pixel_hash}" })
2202
+ });
2203
+ `;
2204
+ this.renderer.appendChild(this.document.body, new_analityc_script);
2205
+ }
2203
2206
  };
2204
2207
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MetricoolPixelService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2205
2208
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MetricoolPixelService, providedIn: 'root' });
@@ -6386,6 +6389,22 @@ class MenuEcComponent {
6386
6389
  hasVisibleProperty(category) {
6387
6390
  return category.isVisible === true;
6388
6391
  }
6392
+ filterVisibleTree(list) {
6393
+ return (list ?? [])
6394
+ .filter((n) => n?.isVisible === true)
6395
+ .map(n => ({ ...n, children: this.filterVisibleTree(n.children) }));
6396
+ }
6397
+ // Exponé streams ya filtrados
6398
+ categoriesVisible$ = this.categories$.pipe(map((list) => this.filterVisibleTree(list)));
6399
+ sectionsVisible$ = this.sections$.pipe(map((list) => this.filterVisibleTree(list)));
6400
+ attributesVisible$ = this.attributes$.pipe(map((list) => this.filterVisibleTree(list)));
6401
+ // Helpers de conveniencia opcionales
6402
+ getVisibleChildren(node) {
6403
+ return this.filterVisibleTree(node?.children);
6404
+ }
6405
+ hasVisibleChildren(node) {
6406
+ return this.getVisibleChildren(node).length > 0;
6407
+ }
6389
6408
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MenuEcComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
6390
6409
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: MenuEcComponent, isStandalone: true, selector: "lib-footer-ec", ngImport: i0, template: '<p>Menu and Footer Helper Component</p>', isInline: true });
6391
6410
  }
@@ -6596,7 +6615,7 @@ class HeaderEcComponent extends MenuEcComponent {
6596
6615
  }
6597
6616
  }
6598
6617
  isHomeFunction() {
6599
- if (isPlatformBrowser(this.platformId)) {
6618
+ if (isPlatformBrowser(this.platformId) && typeof document !== 'undefined') {
6600
6619
  const headerElement = document.querySelector('header');
6601
6620
  if (headerElement) {
6602
6621
  if (this.router.url !== '/home') {
@@ -6628,7 +6647,7 @@ class HeaderEcComponent extends MenuEcComponent {
6628
6647
  }
6629
6648
  };
6630
6649
  borrarInput(inputId) {
6631
- if (isPlatformBrowser(this.platformId)) {
6650
+ if (isPlatformBrowser(this.platformId) && typeof document !== 'undefined') {
6632
6651
  if (inputId) {
6633
6652
  const input = document.getElementById(inputId);
6634
6653
  if (input) {
@@ -6650,7 +6669,7 @@ class HeaderEcComponent extends MenuEcComponent {
6650
6669
  this.getCollectionSearch();
6651
6670
  }
6652
6671
  setupMobileMenu() {
6653
- if (!isPlatformBrowser(this.platformId))
6672
+ if (!isPlatformBrowser(this.platformId) || typeof document === 'undefined')
6654
6673
  return;
6655
6674
  // console.log('setupMobileMenu called');
6656
6675
  const menuMobile = document.querySelector('.menuMobile');
@@ -6687,7 +6706,7 @@ class HeaderEcComponent extends MenuEcComponent {
6687
6706
  });
6688
6707
  }
6689
6708
  setupSearchInputs() {
6690
- if (!isPlatformBrowser(this.platformId))
6709
+ if (!isPlatformBrowser(this.platformId) || typeof document === 'undefined')
6691
6710
  return;
6692
6711
  const inputs = ['searchInput1', 'searchInput2'];
6693
6712
  inputs.forEach(id => {
@@ -7563,26 +7582,12 @@ class BlockProductsEcComponent extends BlockEcComponent {
7563
7582
  * Esta función puede ser movida al componente base para reutilización.
7564
7583
  */
7565
7584
  initializeSwiperWithCustomNavigation() {
7566
- if (!isPlatformBrowser(this.platformId))
7585
+ if (!isPlatformBrowser(this.platformId) || typeof document === 'undefined')
7567
7586
  return;
7568
7587
  const prevButton = document.getElementById(`${this.meta?.code}-prev`);
7569
7588
  const nextButton = document.getElementById(`${this.meta?.code}-next`);
7570
7589
  const swiperElement = document.getElementById(this.meta?.code);
7571
7590
  if (prevButton && nextButton && swiperElement) {
7572
- // console.log('Configurando navegación personalizada para:', this.meta?.code);
7573
- const swiperConfig = this.getSwiperConfiguration();
7574
- // Verificar si el Swiper ya está inicializado
7575
- if (!swiperElement.swiper) {
7576
- this.initializeNewSwiper(swiperElement, swiperConfig);
7577
- }
7578
- else {
7579
- this.updateExistingSwiper(swiperElement);
7580
- }
7581
- // Configurar los event listeners para los botones
7582
- this.setupNavigationEventListeners(prevButton, nextButton, swiperElement);
7583
- // console.log('Event listeners configurados para los botones de navegación');
7584
- }
7585
- else {
7586
7591
  // console.log('No se pudieron encontrar los elementos:', {
7587
7592
  // prevButton: !!prevButton,
7588
7593
  // nextButton: !!nextButton,
@@ -7913,8 +7918,10 @@ class MagnizoomEcComponent {
7913
7918
  this.document = inject(DOCUMENT); // Solo se inyecta en el navegador
7914
7919
  }
7915
7920
  afterRender(() => {
7916
- this.initContext();
7917
- this.loadImage(this.imageSrc);
7921
+ if (isPlatformBrowser(this.platformId)) {
7922
+ this.initContext();
7923
+ this.loadImage(this.imageSrc);
7924
+ }
7918
7925
  });
7919
7926
  }
7920
7927
  ngOnInit() {
@@ -7926,7 +7933,7 @@ class MagnizoomEcComponent {
7926
7933
  this.context = this.canvas.getContext('2d');
7927
7934
  }
7928
7935
  loadImage(src) {
7929
- if (this.document) {
7936
+ if (isPlatformBrowser(this.platformId) && this.document) {
7930
7937
  this.image = this.document.createElement('img');
7931
7938
  this.image.onload = () => {
7932
7939
  this.lensSize = { width: this.image.width / 2, height: this.image.height / 2 };
@@ -8537,10 +8544,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
8537
8544
  }] } });
8538
8545
 
8539
8546
  class LoginFormEcComponent {
8547
+ platformId;
8540
8548
  _authService = inject(AuthService);
8541
8549
  _formBuilder = inject(FormBuilder);
8542
8550
  _toastService = inject(ToastService);
8543
8551
  _router = inject(Router);
8552
+ constructor(platformId) {
8553
+ this.platformId = platformId;
8554
+ }
8544
8555
  showPassword = false;
8545
8556
  /**
8546
8557
  * Parametro para indicar si tras loguear
@@ -8585,20 +8596,23 @@ class LoginFormEcComponent {
8585
8596
  this._toastService.show('login-success');
8586
8597
  this.loggedIn = true;
8587
8598
  if (this.inCart) {
8588
- // Si se está en el carrito, se cierra el modal de login
8589
- const modal = document.getElementById('modalInvitado');
8590
- if (modal) {
8591
- const modalInstance = window.bootstrap?.Modal?.getInstance(modal);
8592
- if (modalInstance) {
8593
- modalInstance.hide();
8594
- }
8595
- else {
8596
- const closeButton = modal.querySelector('[data-bs-dismiss="modal"]');
8597
- if (closeButton) {
8598
- closeButton.click();
8599
+ // Solo manipula el DOM si está en el navegador
8600
+ if (isPlatformBrowser(this.platformId)) {
8601
+ const modal = document.getElementById('modalInvitado');
8602
+ if (modal) {
8603
+ const modalInstance = window.bootstrap?.Modal?.getInstance(modal);
8604
+ if (modalInstance) {
8605
+ modalInstance.hide();
8606
+ }
8607
+ else {
8608
+ const closeButton = modal.querySelector('[data-bs-dismiss="modal"]');
8609
+ if (closeButton) {
8610
+ closeButton.click();
8611
+ }
8599
8612
  }
8600
8613
  }
8601
8614
  }
8615
+ // La navegación funciona en SSR y browser
8602
8616
  this._router.navigateByUrl('/checkout');
8603
8617
  }
8604
8618
  else {
@@ -8633,13 +8647,16 @@ class LoginFormEcComponent {
8633
8647
  togglePassword() {
8634
8648
  this.showPassword = !this.showPassword;
8635
8649
  }
8636
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LoginFormEcComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
8650
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LoginFormEcComponent, deps: [{ token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Component });
8637
8651
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: LoginFormEcComponent, isStandalone: true, selector: "app-login-form-ec", inputs: { redirect: "redirect", redirectTo: "redirectTo", inCart: "inCart" }, outputs: { ready: "ready" }, ngImport: i0, template: "<div class=\"d-flex flex-column position-relative\">\r\n <h1 class=\"right-line ff-ubuntu-light mb-4\"><span>Ingresar</span></h1>\r\n <p class=\"ff-ubuntu-light font-sm pr-4 mb-4\">\r\n Si ya est\u00E1s registrado. Ingresa en tu cuenta con tu email y la\r\n contrase\u00F1a adecuada.\r\n </p>\r\n <div class=\"w-md-50 w-100 text-center\">\r\n <form [formGroup]=\"loginForm()\" (submit)=\"login($event)\">\r\n <input class=\"form-control mb-4 radius-0\" type=\"email\" formControlName=\"username\"\r\n placeholder=\"Correo Electr\u00F3nico\">\r\n <input class=\"form-control mb-4 radius-0\" type=\"password\" formControlName=\"password\"\r\n placeholder=\"Contrase\u00F1a\">\r\n\r\n <div class=\"row d-flex flex-column\">\r\n <div class=\"col-12 mb-4\">\r\n <button type=\"submit\"\r\n class=\"bg-gray border-0 px-4 py-2 color-white ff-ubuntu-light\">INGRESAR</button>\r\n </div>\r\n <div class=\"col-12 d-flex justify-content-center align-items-center\">\r\n <a [routerLink]=\"'/auth/forgot-password'\" class=\"font-md ff-ubuntu-light\">\r\n \u00BFOlvid\u00F3 su contrase\u00F1a?\r\n </a>\r\n </div>\r\n </div>\r\n </form>\r\n </div>\r\n @if(loading){\r\n <app-loading-section-ec></app-loading-section-ec>\r\n }\r\n</div>", styles: [""], dependencies: [{ kind: "component", type: LoadingSectionEcComponent, selector: "app-loading-section-ec" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$4.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$4.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$4.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }] });
8638
8652
  }
8639
8653
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LoginFormEcComponent, decorators: [{
8640
8654
  type: Component,
8641
8655
  args: [{ selector: 'app-login-form-ec', standalone: true, imports: [LoadingSectionEcComponent, ReactiveFormsModule, RouterLink, JsonPipe], template: "<div class=\"d-flex flex-column position-relative\">\r\n <h1 class=\"right-line ff-ubuntu-light mb-4\"><span>Ingresar</span></h1>\r\n <p class=\"ff-ubuntu-light font-sm pr-4 mb-4\">\r\n Si ya est\u00E1s registrado. Ingresa en tu cuenta con tu email y la\r\n contrase\u00F1a adecuada.\r\n </p>\r\n <div class=\"w-md-50 w-100 text-center\">\r\n <form [formGroup]=\"loginForm()\" (submit)=\"login($event)\">\r\n <input class=\"form-control mb-4 radius-0\" type=\"email\" formControlName=\"username\"\r\n placeholder=\"Correo Electr\u00F3nico\">\r\n <input class=\"form-control mb-4 radius-0\" type=\"password\" formControlName=\"password\"\r\n placeholder=\"Contrase\u00F1a\">\r\n\r\n <div class=\"row d-flex flex-column\">\r\n <div class=\"col-12 mb-4\">\r\n <button type=\"submit\"\r\n class=\"bg-gray border-0 px-4 py-2 color-white ff-ubuntu-light\">INGRESAR</button>\r\n </div>\r\n <div class=\"col-12 d-flex justify-content-center align-items-center\">\r\n <a [routerLink]=\"'/auth/forgot-password'\" class=\"font-md ff-ubuntu-light\">\r\n \u00BFOlvid\u00F3 su contrase\u00F1a?\r\n </a>\r\n </div>\r\n </div>\r\n </form>\r\n </div>\r\n @if(loading){\r\n <app-loading-section-ec></app-loading-section-ec>\r\n }\r\n</div>" }]
8642
- }], propDecorators: { redirect: [{
8656
+ }], ctorParameters: () => [{ type: Object, decorators: [{
8657
+ type: Inject,
8658
+ args: [PLATFORM_ID]
8659
+ }] }], propDecorators: { redirect: [{
8643
8660
  type: Input
8644
8661
  }], redirectTo: [{
8645
8662
  type: Input
@@ -9067,30 +9084,34 @@ class PasswordResetEcComponent extends ComponentHelper {
9067
9084
  };
9068
9085
  sendToLogin = () => this.router.navigateByUrl('/auth/login');
9069
9086
  showPassword = () => {
9070
- const passwordInput = document.getElementById('contraseña1');
9071
- const showIcon = document.getElementById('show1');
9072
- const hideIcon = document.getElementById('hide1');
9073
- if (passwordInput.type === 'password') {
9074
- passwordInput.type = 'text';
9075
- }
9076
- else {
9077
- passwordInput.type = 'password';
9087
+ if (typeof document !== 'undefined') {
9088
+ const passwordInput = document.getElementById('contraseña1');
9089
+ const showIcon = document.getElementById('show1');
9090
+ const hideIcon = document.getElementById('hide1');
9091
+ if (passwordInput && passwordInput.type === 'password') {
9092
+ passwordInput.type = 'text';
9093
+ }
9094
+ else if (passwordInput) {
9095
+ passwordInput.type = 'password';
9096
+ }
9097
+ showIcon?.classList.toggle('d-none');
9098
+ hideIcon?.classList.toggle('d-none');
9078
9099
  }
9079
- showIcon?.classList.toggle('d-none');
9080
- hideIcon?.classList.toggle('d-none');
9081
9100
  };
9082
9101
  showPassword2 = () => {
9083
- const passwordInput = document.getElementById('contraseña2');
9084
- const showIcon = document.getElementById('show2');
9085
- const hideIcon = document.getElementById('hide2');
9086
- if (passwordInput.type === 'password') {
9087
- passwordInput.type = 'text';
9088
- }
9089
- else {
9090
- passwordInput.type = 'password';
9102
+ if (typeof document !== 'undefined') {
9103
+ const passwordInput = document.getElementById('contraseña2');
9104
+ const showIcon = document.getElementById('show2');
9105
+ const hideIcon = document.getElementById('hide2');
9106
+ if (passwordInput && passwordInput.type === 'password') {
9107
+ passwordInput.type = 'text';
9108
+ }
9109
+ else if (passwordInput) {
9110
+ passwordInput.type = 'password';
9111
+ }
9112
+ showIcon?.classList.toggle('d-none');
9113
+ hideIcon?.classList.toggle('d-none');
9091
9114
  }
9092
- showIcon?.classList.toggle('d-none');
9093
- hideIcon?.classList.toggle('d-none');
9094
9115
  };
9095
9116
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: PasswordResetEcComponent, deps: [{ token: AuthService }, { token: ToastService }, { token: i2.ActivatedRoute }, { token: i2.Router }, { token: i1$4.FormBuilder }], target: i0.ɵɵFactoryTarget.Component });
9096
9117
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: PasswordResetEcComponent, isStandalone: true, selector: "app-password-reset-ec", usesInheritance: true, ngImport: i0, template: "<div class=\"container\">\r\n <div class=\"row justify-content-center py-5\">\r\n <div class=\"col-12 col-md-6 col-lg-4\">\r\n @if(!ready){\r\n <form [formGroup]=\"formGroup\" (submit)=\"sendNewPassword($event)\">\r\n <div class=\"mb-4 text-center\">\r\n <h3>{{ 'set-new-password' | translate }}</h3>\r\n </div>\r\n <div class=\"mb-3\">\r\n <label class=\"form-label\">{{ 'set-password' | translate }}</label>\r\n <div class=\"input-group\">\r\n <input type=\"password\" formControlName=\"first\" class=\"form-control\" id=\"contrase\u00F1a1\" />\r\n <button class=\"btn btn-outline-secondary btn-password\" type=\"button\" (click)=\"showPassword()\">\r\n <i id=\"show1\" class=\"fas fa-eye i-show-password\"></i>\r\n <i id=\"hide1\" class=\"fas fa-eye-slash d-none i-show-password\"></i>\r\n </button>\r\n </div>\r\n </div>\r\n <div class=\"mb-3\">\r\n <label class=\"form-label\">{{ 'repeat-password' | translate }}</label>\r\n <div class=\"input-group\">\r\n <input type=\"password\" formControlName=\"second\" class=\"form-control\" id=\"contrase\u00F1a2\" />\r\n <button class=\"btn btn-outline-secondary btn-password\" type=\"button\" (click)=\"showPassword2()\">\r\n <i id=\"show2\" class=\"fas fa-eye i-show-password\"></i>\r\n <i id=\"hide2\" class=\"fas fa-eye-slash d-none i-show-password\"></i>\r\n </button>\r\n </div>\r\n </div>\r\n <div class=\"mt-4 text-center\">\r\n <button type=\"submit\" class=\"comprar w-100\">{{ 'update' | translate }}</button>\r\n </div>\r\n @if(loading){\r\n <app-loading-inline-ec></app-loading-inline-ec>\r\n }\r\n </form>\r\n }@else {<div class=\"row justify-content-center mt-5 mb-5\">\r\n <div class=\"text-center\">\r\n <div class=\"mb-4\">\r\n <h3>{{ 'updated-password' | translate }}</h3>\r\n </div>\r\n <div class=\"mb-4\">\r\n <h5>{{ 'updated-password-detail' | translate }}</h5>\r\n </div>\r\n <button class=\"comprar\" (click)=\"sendToLogin()\">{{ 'login' | translate }}</button>\r\n </div>\r\n </div>}\r\n\r\n\r\n\r\n </div>\r\n </div>\r\n</div>", styles: [""], dependencies: [{ kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1$2.TranslatePipe, name: "translate" }, { kind: "component", type: LoadingInlineEcComponent, selector: "app-loading-inline-ec", inputs: ["type"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$4.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$4.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$4.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }] });
@@ -9146,6 +9167,8 @@ class FiltersEcComponent {
9146
9167
  console.error('Filter or selected element is undefined:', { filter, selected });
9147
9168
  return;
9148
9169
  }
9170
+ if (selected.isVisible !== true)
9171
+ return;
9149
9172
  if (typeof filter.setSelected !== 'function') {
9150
9173
  console.error('filter.setSelected is not a function. Filter might not be an instance of the expected class:', filter);
9151
9174
  return;
@@ -9184,7 +9207,9 @@ class FiltersEcComponent {
9184
9207
  });
9185
9208
  }
9186
9209
  // close = () => {
9187
- // this.document.getElementById("filtros").classList.remove('in');
9210
+ // if (typeof document !== 'undefined') {
9211
+ // this.document.getElementById("filtros").classList.remove('in');
9212
+ // }
9188
9213
  // return true;
9189
9214
  // };
9190
9215
  close = () => {
@@ -9194,7 +9219,9 @@ class FiltersEcComponent {
9194
9219
  return true;
9195
9220
  };
9196
9221
  scrollUp = () => {
9197
- window.scroll(0, 0);
9222
+ if (typeof window !== 'undefined') {
9223
+ window.scroll(0, 0);
9224
+ }
9198
9225
  return true;
9199
9226
  };
9200
9227
  hasAppliedFilters() {
@@ -9215,13 +9242,36 @@ class FiltersEcComponent {
9215
9242
  }) ?? false;
9216
9243
  }
9217
9244
  /**
9218
- * Verifica si una categoría tiene la propiedad isVisible y está marcada como visible
9219
- * @param category - La categoría a verificar
9220
- * @returns true si la categoría es visible, false en caso contrario
9221
- */
9245
+ * Verifica si una categoría tiene la propiedad isVisible y está marcada como visible
9246
+ * @param category - La categoría a verificar
9247
+ * @returns true si la categoría es visible, false en caso contrario
9248
+ */
9222
9249
  hasVisibleProperty(category) {
9223
9250
  return category.isVisible === true;
9224
9251
  }
9252
+ /** Lista visible (filtra recursivo por isVisible) */
9253
+ getVisibleData(filter) {
9254
+ if (!filter)
9255
+ return [];
9256
+ return this.filterVisibleTree(filter.data);
9257
+ }
9258
+ /** Children visibles de un nodo */
9259
+ getVisibleChildren(node) {
9260
+ return this.filterVisibleTree(node?.children ?? []);
9261
+ }
9262
+ /** Tiene hijos visibles? */
9263
+ hasVisibleChildren(node) {
9264
+ return this.getVisibleChildren(node).length > 0;
9265
+ }
9266
+ /** Utilidad recursiva */
9267
+ filterVisibleTree(list = []) {
9268
+ return (list ?? [])
9269
+ .filter(n => n.isVisible === true)
9270
+ .map(n => ({
9271
+ ...n,
9272
+ children: this.filterVisibleTree(n.children ?? [])
9273
+ }));
9274
+ }
9225
9275
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FiltersEcComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
9226
9276
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: FiltersEcComponent, isStandalone: true, selector: "lib-filters-ec", inputs: { setSelect: "setSelect" }, ngImport: i0, template: "<p>filters-ec works!</p>\r\n", styles: [""] });
9227
9277
  }
@@ -9373,9 +9423,12 @@ class ProductDetailEcComponent {
9373
9423
  this._meta.updateTag({ property: 'og:type', content: 'product' });
9374
9424
  }
9375
9425
  decodeHtml(html) {
9376
- const txt = document.createElement('textarea');
9377
- txt.innerHTML = html;
9378
- return txt.value;
9426
+ if (typeof document !== 'undefined') {
9427
+ const txt = document.createElement('textarea');
9428
+ txt.innerHTML = html;
9429
+ return txt.value;
9430
+ }
9431
+ return html;
9379
9432
  }
9380
9433
  sanitizedHtml(html) {
9381
9434
  const decodedHtml = this.decodeHtml(html);
@@ -9425,9 +9478,11 @@ class ProductDetailEcComponent {
9425
9478
  goToSection(section) {
9426
9479
  this.showFormContact = true;
9427
9480
  setTimeout(() => {
9428
- const element = document.getElementById(section);
9429
- if (element) {
9430
- element.scrollIntoView({ behavior: 'smooth' });
9481
+ if (typeof document !== 'undefined') {
9482
+ const element = document.getElementById(section);
9483
+ if (element) {
9484
+ element.scrollIntoView({ behavior: 'smooth' });
9485
+ }
9431
9486
  }
9432
9487
  }, 500);
9433
9488
  }
@@ -10486,7 +10541,9 @@ class DecidirEcComponent extends ComponentHelper {
10486
10541
  }
10487
10542
  ngOnDestroy() {
10488
10543
  // Remover el listener de mensajes
10489
- window.removeEventListener('message', this.handleIframeMessage, false);
10544
+ if (typeof window !== 'undefined') {
10545
+ window.removeEventListener('message', this.handleIframeMessage, false);
10546
+ }
10490
10547
  // console.log("SE DESTROZA");
10491
10548
  }
10492
10549
  ngOnChanges() {
@@ -10566,11 +10623,13 @@ class DecidirEcComponent extends ComponentHelper {
10566
10623
  this.url = this.sanitizer.bypassSecurityTrustResourceUrl('assets/decidirFormEc.html');
10567
10624
  this.loading = false;
10568
10625
  // Escuchar mensajes del iframe para manejar la comunicación
10569
- window.addEventListener('message', this.handleIframeMessage.bind(this), false);
10626
+ if (typeof window !== 'undefined') {
10627
+ window.addEventListener('message', this.handleIframeMessage.bind(this), false);
10628
+ }
10570
10629
  };
10571
10630
  handleIframeMessage = (event) => {
10572
10631
  // Verificar el origen por seguridad
10573
- if (event.origin !== window.location.origin) {
10632
+ if (typeof window !== 'undefined' && event.origin !== window.location.origin) {
10574
10633
  return;
10575
10634
  }
10576
10635
  if (event.data && event.data.type === 'DECIDIR_PAYMENT') {
@@ -10612,8 +10671,10 @@ class DecidirEcComponent extends ComponentHelper {
10612
10671
  });
10613
10672
  };
10614
10673
  resizeIframe = (obj) => {
10615
- obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';
10616
- obj.style.width = obj.contentWindow.document.body.scrollWidth + 'px';
10674
+ if (obj && obj.contentWindow && typeof obj.contentWindow.document !== 'undefined') {
10675
+ obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';
10676
+ obj.style.width = obj.contentWindow.document.body.scrollWidth + 'px';
10677
+ }
10617
10678
  };
10618
10679
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DecidirEcComponent, deps: [{ token: i0.Renderer2 }, { token: ConnectionService }, { token: ToastService }, { token: CoreConstantsService }, { token: ApiConstantsService }, { token: CartService }, { token: i2.ActivatedRoute }, { token: i1$5.DomSanitizer }, { token: ParametersService }], target: i0.ɵɵFactoryTarget.Component });
10619
10680
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: DecidirEcComponent, isStandalone: true, selector: "app-decidir-ec", inputs: { paymentServiceInst: "paymentServiceInst", method: "method", total_amount: "total_amount", allData: "allData", user_data: "user_data" }, outputs: { ready: "ready" }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<div class=\"text-center\">\r\n <h3>Continuar con el pago en Decidir</h3>\r\n @if (method) {\r\n <p class=\"px-5\">{{ method.description }}</p>\r\n <p class=\"px-5\">{{ method.instructions }}</p>\r\n }\r\n @if (!loading) {\r\n <button class=\"btn btn-outline-secondary comprar\" (click)=\"openModal()\">Pagar</button>\r\n } @else {\r\n <div class=\"d-flex flex-column jusitfy-content-center align-items-center mt-2\">\r\n <app-loading-full-ec></app-loading-full-ec>\r\n </div>\r\n }\r\n </div>\r\n\r\n@if (showModal) {\r\n<div class=\"modal-backdrop\" (click)=\"clickClose()\">\r\n <div class=\"modal-dialog modal-lg\" (click)=\"$event.stopPropagation()\">\r\n <div class=\"modal-content\">\r\n\r\n <div class=\"modal-body\">\r\n <div class=\"payment-container\">\r\n \r\n <!-- Iframe del formulario de decidir -->\r\n <div class=\"iframe-container\">\r\n <iframe [src]=\"url\" frameborder=\"0\" class=\"payment-iframe\"></iframe>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n}\r\n", styles: [".modal-backdrop{position:fixed;top:0;left:0;width:100%;height:100%;background-color:#0009;display:flex;justify-content:center;align-items:center;z-index:1050;backdrop-filter:blur(2px)}.modal-dialog{max-width:90%;max-height:90%;width:800px;background:#fff;border-radius:16px;overflow:hidden;box-shadow:0 20px 60px #0000004d;animation:modalFadeIn .3s ease-out}.modal-dialog.modal-lg{max-width:900px;width:90%}@keyframes modalFadeIn{0%{opacity:0;transform:scale(.9) translateY(-20px)}to{opacity:1;transform:scale(1) translateY(0)}}.modal-content{display:flex;flex-direction:column;height:100%;border:none;border-radius:16px;background:#fff}.modal-header{padding:1.5rem 2rem;border-bottom:1px solid #e9ecef;background:linear-gradient(135deg,#f8f9fa,#e9ecef);display:flex;justify-content:space-between;align-items:center;position:relative}.modal-header:after{content:\"\";position:absolute;bottom:0;left:0;right:0;height:1px;background:linear-gradient(90deg,transparent 0%,#dee2e6 50%,transparent 100%)}.modal-header .modal-title{margin:0;font-size:1.5rem;font-weight:700;color:#2c3e50;text-shadow:0 1px 2px rgba(0,0,0,.1)}.modal-header .btn-close{background:none;border:none;font-size:1.8rem;color:#6c757d;cursor:pointer;padding:0;width:35px;height:35px;display:flex;align-items:center;justify-content:center;border-radius:50%;transition:all .3s ease;position:relative}.modal-header .btn-close:hover{background-color:#dc3545;color:#fff;transform:rotate(90deg);box-shadow:0 4px 12px #dc35454d}.modal-header .btn-close:active{transform:rotate(90deg) scale(.95)}.modal-body{padding:0;flex:1;overflow:hidden;background:#fff}.payment-container{height:100%;display:flex;flex-direction:column;background:#fff}.cards-accepted{padding:1.5rem 2rem;text-align:center;border-bottom:1px solid #e9ecef;background:linear-gradient(135deg,#fff,#f8f9fa);position:relative}.cards-accepted:after{content:\"\";position:absolute;bottom:0;left:5%;right:5%;height:1px;background:linear-gradient(90deg,transparent 0%,#dee2e6 50%,transparent 100%)}.cards-accepted .cards-img{height:45px;max-width:100%;object-fit:contain;filter:drop-shadow(0 2px 4px rgba(0,0,0,.1));transition:transform .2s ease}.cards-accepted .cards-img:hover{transform:scale(1.05)}.iframe-container{flex:1;padding:1.5rem;background:#fff;position:relative}.iframe-container:before{content:\"\";position:absolute;top:0;left:1.5rem;right:1.5rem;height:1px;background:linear-gradient(90deg,transparent 0%,#e9ecef 50%,transparent 100%)}.payment-iframe{width:100%;height:620px;border:none;border-radius:12px;background:#fff;box-shadow:inset 0 2px 8px #0000000d}.half-width{width:49%!important}.ml-1{margin-left:1%}#card-form{height:450px}.iframeStyle{height:520px;width:100%}@media only screen and (max-width: 1024px){.modal-dialog,.modal-dialog.modal-lg{max-width:95%;width:95%}.payment-iframe{height:650px}.modal-header{padding:1rem 1.5rem}.modal-header .modal-title{font-size:1.125rem}.cards-accepted{padding:.75rem 1.5rem}}@media only screen and (max-width: 680px){.modal-dialog{max-width:98%;width:98%;margin:1rem;max-height:calc(100vh - 2rem)}.modal-dialog.modal-lg{max-width:98%;width:98%}.payment-iframe{height:550px}.modal-header{padding:1rem}.modal-header .modal-title{font-size:1rem}.modal-header .btn-close{width:28px;height:28px;font-size:1.25rem}.cards-accepted{padding:.5rem 1rem}.cards-accepted .cards-img{height:35px}.iframe-container{padding:.5rem}}@media only screen and (max-width: 480px){.modal-dialog{margin:.5rem;max-height:calc(100vh - 1rem);border-radius:8px}.modal-content{border-radius:8px}.payment-iframe{height:500px}.cards-accepted .cards-img{height:30px}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "component", type: LoadingFullEcComponent, selector: "app-loading-full-ec" }] });
@@ -12032,11 +12093,13 @@ class StoresEcComponent extends ComponentHelper {
12032
12093
  });
12033
12094
  const center = bounds.getCenter();
12034
12095
  const style = [{ "elementType": "geometry", "stylers": [{ "color": "#212121" }] }, { "elementType": "labels.icon", "stylers": [{ "visibility": "off" }] }, { "elementType": "labels.text.fill", "stylers": [{ "color": "#757575" }] }, { "elementType": "labels.text.stroke", "stylers": [{ "color": "#212121" }] }, { "featureType": "administrative", "elementType": "geometry", "stylers": [{ "color": "#757575" }] }, { "featureType": "administrative.country", "elementType": "labels.text.fill", "stylers": [{ "color": "#9e9e9e" }] }, { "featureType": "administrative.locality", "elementType": "labels.text.fill", "stylers": [{ "color": "#bdbdbd" }] }, { "featureType": "poi", "elementType": "labels.text.fill", "stylers": [{ "color": "#757575" }] }, { "featureType": "poi.business", "stylers": [{ "visibility": "off" }] }, { "featureType": "poi.park", "elementType": "geometry", "stylers": [{ "color": "#181818" }] }, { "featureType": "poi.park", "elementType": "labels.text.fill", "stylers": [{ "color": "#616161" }] }, { "featureType": "poi.park", "elementType": "labels.text.stroke", "stylers": [{ "color": "#1b1b1b" }] }, { "featureType": "road", "elementType": "geometry.fill", "stylers": [{ "color": "#2c2c2c" }] }, { "featureType": "road", "elementType": "labels.icon", "stylers": [{ "visibility": "off" }] }, { "featureType": "road", "elementType": "labels.text.fill", "stylers": [{ "color": "#8a8a8a" }] }, { "featureType": "road.arterial", "elementType": "geometry", "stylers": [{ "color": "#373737" }] }, { "featureType": "road.arterial", "elementType": "labels", "stylers": [{ "visibility": "off" }] }, { "featureType": "road.highway", "elementType": "geometry", "stylers": [{ "color": "#3c3c3c" }] }, { "featureType": "road.highway", "elementType": "labels", "stylers": [{ "visibility": "off" }] }, { "featureType": "road.highway.controlled_access", "elementType": "geometry", "stylers": [{ "color": "#4e4e4e" }] }, { "featureType": "road.local", "stylers": [{ "visibility": "off" }] }, { "featureType": "road.local", "elementType": "labels.text.fill", "stylers": [{ "color": "#616161" }] }, { "featureType": "transit", "stylers": [{ "visibility": "off" }] }, { "featureType": "transit", "elementType": "labels.text.fill", "stylers": [{ "color": "#757575" }] }, { "featureType": "water", "elementType": "geometry", "stylers": [{ "color": "#000000" }] }, { "featureType": "water", "elementType": "labels.text.fill", "stylers": [{ "color": "#3d3d3d" }] }];
12035
- this.map = new google.maps.Map(document.getElementById('map'), {
12036
- zoom: 12,
12037
- center: center, // Centrar el mapa en el centro calculado
12038
- styles: style // Aplica los estilos personalizados
12039
- });
12096
+ if (typeof document !== 'undefined' && typeof window !== 'undefined') {
12097
+ this.map = new google.maps.Map(document.getElementById('map'), {
12098
+ zoom: 12,
12099
+ center: center, // Centrar el mapa en el centro calculado
12100
+ styles: style // Aplica los estilos personalizados
12101
+ });
12102
+ }
12040
12103
  this.locations.forEach(location => {
12041
12104
  const marker = new google.maps.Marker({
12042
12105
  position: { lat: location.lat, lng: location.lng },
@@ -12050,8 +12113,12 @@ class StoresEcComponent extends ComponentHelper {
12050
12113
  marker.set('id', location.id); // Associate marker with its ID
12051
12114
  this.markers.push(marker);
12052
12115
  marker.addListener('click', () => {
12053
- const elemento = document.getElementById(location.id);
12054
- const contenedor = document.getElementById('home');
12116
+ let elemento = null;
12117
+ let contenedor = null;
12118
+ if (typeof document !== 'undefined') {
12119
+ elemento = document.getElementById(location.id);
12120
+ contenedor = document.getElementById('home');
12121
+ }
12055
12122
  if (elemento && contenedor) {
12056
12123
  contenedor.scrollTo({
12057
12124
  top: elemento.offsetTop - contenedor.offsetTop + contenedor.scrollTop,
@@ -12079,7 +12146,10 @@ class StoresEcComponent extends ComponentHelper {
12079
12146
  showStoreOnMap(storeCode) {
12080
12147
  this.stopBounce();
12081
12148
  const marker = this.markers.find(m => m.get('id') === storeCode);
12082
- const elemento = document.getElementById(storeCode);
12149
+ let elemento = null;
12150
+ if (typeof document !== 'undefined') {
12151
+ elemento = document.getElementById(storeCode);
12152
+ }
12083
12153
  if (this.ultimoElementoSeleccionado !== null) {
12084
12154
  // Quitar la clase del último elemento seleccionado
12085
12155
  this.ultimoElementoSeleccionado.classList.remove('selected');