ng-easycommerce-v18 0.3.12-beta.1 → 0.3.14-beta.1
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 +2 -2
- package/esm2022/lib/classes/filters/filter.mjs +27 -2
- package/esm2022/lib/constants/api.constants.service.mjs +28 -42
- package/esm2022/lib/ec-components/blocks-ec/block-products-ec/block-products-ec.component.mjs +5 -3
- package/esm2022/lib/ec-components/header-ec/header-ec.component.mjs +34 -23
- package/esm2022/lib/ec-components/related-products-ec/related-products-ec.component.mjs +6 -4
- package/esm2022/lib/ec-components/widgets-ec/index.mjs +1 -2
- package/esm2022/lib/ec-components/widgets-ec/magnizoom-ec/magnizoom-ec.component.mjs +4 -2
- package/esm2022/lib/ec-services/analytics/facebook-pixel.service.mjs +4 -2
- package/esm2022/lib/ec-services/analytics/google-analytics.service.mjs +4 -2
- package/esm2022/lib/ec-services/options.service.mjs +27 -3
- package/fesm2022/ng-easycommerce-v18.mjs +149 -223
- package/fesm2022/ng-easycommerce-v18.mjs.map +1 -1
- package/lib/constants/api.constants.service.d.ts +8 -23
- package/lib/ec-components/header-ec/header-ec.component.d.ts +1 -0
- package/lib/ec-components/widgets-ec/index.d.ts +0 -1
- package/lib/ec-services/options.service.d.ts +4 -0
- package/package.json +1 -1
- package/esm2022/lib/ec-components/widgets-ec/redsys-catch-ec/redsys-catch-ec.component.mjs +0 -138
- package/lib/ec-components/widgets-ec/redsys-catch-ec/redsys-catch-ec.component.d.ts +0 -26
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, makeEnvironmentProviders, inject, Injectable,
|
|
2
|
+
import { InjectionToken, makeEnvironmentProviders, inject, PLATFORM_ID, Injectable, Inject, RendererFactory2, afterNextRender, signal, EnvironmentInjector, runInInjectionContext, Component, ChangeDetectorRef, HostListener, CUSTOM_ELEMENTS_SCHEMA, Input, Pipe, Injector, EventEmitter, Output, forwardRef, afterRender, ViewChild, computed, Renderer2, ChangeDetectionStrategy, Directive } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/common';
|
|
4
|
-
import { DOCUMENT, isPlatformBrowser, AsyncPipe, CommonModule, TitleCasePipe, JsonPipe, UpperCasePipe, Location } from '@angular/common';
|
|
4
|
+
import { isPlatformServer, DOCUMENT, isPlatformBrowser, AsyncPipe, CommonModule, TitleCasePipe, JsonPipe, UpperCasePipe, Location } from '@angular/common';
|
|
5
5
|
import { take, BehaviorSubject, shareReplay, map, catchError, of, filter, ReplaySubject, firstValueFrom, concatMap, throwError, switchMap, combineLatest } from 'rxjs';
|
|
6
6
|
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
|
7
7
|
import * as i1$1 from '@ngx-translate/core';
|
|
@@ -44,89 +44,71 @@ const provideEnvironment = (environment) => {
|
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
|
-
* Servicio que provee de datos
|
|
48
|
-
* @export
|
|
49
|
-
* @class ApiConstantsService
|
|
47
|
+
* Servicio que provee de datos relacionados con las peticiones a la API
|
|
50
48
|
*/
|
|
51
49
|
class ApiConstantsService {
|
|
50
|
+
ssrApiUrl;
|
|
52
51
|
_localStorage = inject(LocalStorageService);
|
|
53
52
|
_translate = inject(TranslateService);
|
|
54
|
-
/**
|
|
55
|
-
* Contiene los datos provisto por el frontend en el archivo environment.ts
|
|
56
|
-
*/
|
|
57
53
|
environment = inject(ENVIRONMENT_TOKEN);
|
|
54
|
+
platformId = inject(PLATFORM_ID);
|
|
55
|
+
_channel;
|
|
56
|
+
LOCALE;
|
|
57
|
+
SHOP_API_URL = 'shop-api/';
|
|
58
|
+
CMS_URL = 'cms/';
|
|
59
|
+
constructor(ssrApiUrl) {
|
|
60
|
+
this.ssrApiUrl = ssrApiUrl;
|
|
61
|
+
this._channel = this.environment.channel;
|
|
62
|
+
this.LOCALE = this.environment.locale;
|
|
63
|
+
}
|
|
58
64
|
/**
|
|
59
65
|
* Canal actual del frontend
|
|
60
66
|
*/
|
|
61
67
|
get CHANNEL() {
|
|
62
|
-
// Verificar si estamos en el navegador (no en SSR)
|
|
63
68
|
if (typeof window !== 'undefined') {
|
|
64
|
-
// Primero intenta leer de window.__env (configurado por Docker)
|
|
65
69
|
const windowEnv = window.__env;
|
|
66
|
-
if (windowEnv?.channel)
|
|
70
|
+
if (windowEnv?.channel)
|
|
67
71
|
return windowEnv.channel;
|
|
68
|
-
}
|
|
69
72
|
}
|
|
70
|
-
// Fallback al environment
|
|
71
73
|
return this._channel;
|
|
72
74
|
}
|
|
73
75
|
set CHANNEL(value) {
|
|
74
76
|
this._channel = value;
|
|
75
77
|
}
|
|
76
|
-
_channel;
|
|
77
|
-
/**
|
|
78
|
-
* Locale actual del frontend
|
|
79
|
-
*/
|
|
80
|
-
LOCALE;
|
|
81
|
-
/**
|
|
82
|
-
* URL para las peticiones a shop-api
|
|
83
|
-
*/
|
|
84
|
-
SHOP_API_URL = 'shop-api/';
|
|
85
|
-
/**
|
|
86
|
-
* URL para las peticiones a cms
|
|
87
|
-
*/
|
|
88
|
-
CMS_URL = 'cms/';
|
|
89
|
-
constructor() {
|
|
90
|
-
this._channel = this.environment.channel;
|
|
91
|
-
this.LOCALE = this.environment.locale;
|
|
92
|
-
}
|
|
93
78
|
/**
|
|
94
79
|
* URL del backend para realizar las peticiones
|
|
95
80
|
*/
|
|
96
81
|
get API_URL() {
|
|
97
|
-
// Verificar si estamos en el navegador (no en SSR)
|
|
98
82
|
if (typeof window !== 'undefined') {
|
|
99
|
-
// Primero intenta leer de window.__env (configurado por Docker)
|
|
100
83
|
const windowEnv = window.__env;
|
|
101
|
-
if (windowEnv?.apiUrl)
|
|
84
|
+
if (windowEnv?.apiUrl)
|
|
102
85
|
return windowEnv.apiUrl;
|
|
103
|
-
}
|
|
104
86
|
}
|
|
105
|
-
|
|
87
|
+
if (isPlatformServer(this.platformId)) {
|
|
88
|
+
return this.ssrApiUrl; // ⚡ URL inyectada desde server.ts
|
|
89
|
+
}
|
|
106
90
|
return this.environment.apiUrl ?? '';
|
|
107
91
|
}
|
|
108
92
|
/**
|
|
109
93
|
* Retorna la url base
|
|
110
|
-
* @returns {string}
|
|
111
94
|
*/
|
|
112
95
|
getUrlBase() {
|
|
113
96
|
return this.API_URL;
|
|
114
97
|
}
|
|
115
98
|
/**
|
|
116
99
|
* Cambia el canal actual
|
|
117
|
-
* @param code
|
|
118
|
-
* @returns
|
|
119
100
|
*/
|
|
120
|
-
setChannel(code) {
|
|
101
|
+
setChannel(code) {
|
|
102
|
+
this.CHANNEL = code;
|
|
103
|
+
}
|
|
121
104
|
setLocale(locale) {
|
|
122
105
|
this._localStorage.setItem(this.LOCALE_KEY, locale);
|
|
123
106
|
this._translate.use(locale.split('_')[0]);
|
|
124
107
|
this.LOCALE = locale;
|
|
125
108
|
}
|
|
126
|
-
//Storage key
|
|
127
109
|
LOCALE_KEY = 'LOCALE';
|
|
128
110
|
CHANNEL_KEY = 'CHANNEL';
|
|
129
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ApiConstantsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
111
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ApiConstantsService, deps: [{ token: 'API_URL' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
130
112
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ApiConstantsService, providedIn: 'root' });
|
|
131
113
|
}
|
|
132
114
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ApiConstantsService, decorators: [{
|
|
@@ -134,7 +116,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
134
116
|
args: [{
|
|
135
117
|
providedIn: 'root'
|
|
136
118
|
}]
|
|
137
|
-
}], ctorParameters: () => [
|
|
119
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
120
|
+
type: Inject,
|
|
121
|
+
args: ['API_URL']
|
|
122
|
+
}] }] });
|
|
138
123
|
|
|
139
124
|
/**
|
|
140
125
|
* Servicio que funciona como abstracción para manejar la conexión con la API
|
|
@@ -533,6 +518,10 @@ class OptionsService {
|
|
|
533
518
|
* Maneja las peticiones a la API
|
|
534
519
|
*/
|
|
535
520
|
connection = inject(ConnectionService);
|
|
521
|
+
/**
|
|
522
|
+
* Platform ID para verificar si estamos en el navegador
|
|
523
|
+
*/
|
|
524
|
+
platformId = inject(PLATFORM_ID);
|
|
536
525
|
/**
|
|
537
526
|
* Constantes del core
|
|
538
527
|
*/
|
|
@@ -643,7 +632,26 @@ class OptionsService {
|
|
|
643
632
|
* @returns
|
|
644
633
|
*/
|
|
645
634
|
removeAccents(str) {
|
|
646
|
-
|
|
635
|
+
if (isPlatformBrowser(this.platformId) && typeof String.prototype.normalize === 'function') {
|
|
636
|
+
return str.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
|
|
637
|
+
}
|
|
638
|
+
// Fallback para SSR - remover acentos manualmente
|
|
639
|
+
return str.replace(/[àáâãäå]/g, 'a')
|
|
640
|
+
.replace(/[èéêë]/g, 'e')
|
|
641
|
+
.replace(/[ìíîï]/g, 'i')
|
|
642
|
+
.replace(/[òóôõö]/g, 'o')
|
|
643
|
+
.replace(/[ùúûü]/g, 'u')
|
|
644
|
+
.replace(/[ýÿ]/g, 'y')
|
|
645
|
+
.replace(/[ñ]/g, 'n')
|
|
646
|
+
.replace(/[ç]/g, 'c')
|
|
647
|
+
.replace(/[ÀÁÂÃÄÅ]/g, 'A')
|
|
648
|
+
.replace(/[ÈÉÊË]/g, 'E')
|
|
649
|
+
.replace(/[ÌÍÎÏ]/g, 'I')
|
|
650
|
+
.replace(/[ÒÓÔÕÖ]/g, 'O')
|
|
651
|
+
.replace(/[ÙÚÛÜ]/g, 'U')
|
|
652
|
+
.replace(/[ÝŸ]/g, 'Y')
|
|
653
|
+
.replace(/[Ñ]/g, 'N')
|
|
654
|
+
.replace(/[Ç]/g, 'C');
|
|
647
655
|
}
|
|
648
656
|
/**
|
|
649
657
|
* Realiza un mapeo de los datos para darle un formato mas entendible a la
|
|
@@ -1026,7 +1034,9 @@ class FacebookPixelService {
|
|
|
1026
1034
|
this.renderer.appendChild(this.document?.body, new_analityc_script);
|
|
1027
1035
|
this.enabled = true;
|
|
1028
1036
|
}
|
|
1029
|
-
|
|
1037
|
+
if (isPlatformBrowser(this.platformId)) {
|
|
1038
|
+
setTimeout(() => this.callEvent('initialize'), 1000);
|
|
1039
|
+
}
|
|
1030
1040
|
}
|
|
1031
1041
|
/**
|
|
1032
1042
|
* Ejecuta el evento pasado por parametro.
|
|
@@ -1243,7 +1253,9 @@ class GoogleAnalyticsService {
|
|
|
1243
1253
|
this.renderer.appendChild(this.document?.head, declaration);
|
|
1244
1254
|
this.enabled = true;
|
|
1245
1255
|
}
|
|
1246
|
-
|
|
1256
|
+
if (isPlatformBrowser(this.platformId)) {
|
|
1257
|
+
setTimeout(() => this.startListeningPageViews(gtm_id), 1000);
|
|
1258
|
+
}
|
|
1247
1259
|
}
|
|
1248
1260
|
/**
|
|
1249
1261
|
*
|
|
@@ -2644,6 +2656,31 @@ class User {
|
|
|
2644
2656
|
}
|
|
2645
2657
|
}
|
|
2646
2658
|
|
|
2659
|
+
/**
|
|
2660
|
+
* Función auxiliar para remover acentos de forma segura para SSR
|
|
2661
|
+
*/
|
|
2662
|
+
function safeRemoveAccents(str) {
|
|
2663
|
+
if (typeof window !== 'undefined' && typeof String.prototype.normalize === 'function') {
|
|
2664
|
+
return str.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
|
|
2665
|
+
}
|
|
2666
|
+
// Fallback para SSR - remover acentos manualmente
|
|
2667
|
+
return str.replace(/[àáâãäå]/g, 'a')
|
|
2668
|
+
.replace(/[èéêë]/g, 'e')
|
|
2669
|
+
.replace(/[ìíîï]/g, 'i')
|
|
2670
|
+
.replace(/[òóôõö]/g, 'o')
|
|
2671
|
+
.replace(/[ùúûü]/g, 'u')
|
|
2672
|
+
.replace(/[ýÿ]/g, 'y')
|
|
2673
|
+
.replace(/[ñ]/g, 'n')
|
|
2674
|
+
.replace(/[ç]/g, 'c')
|
|
2675
|
+
.replace(/[ÀÁÂÃÄÅ]/g, 'A')
|
|
2676
|
+
.replace(/[ÈÉÊË]/g, 'E')
|
|
2677
|
+
.replace(/[ÌÍÎÏ]/g, 'I')
|
|
2678
|
+
.replace(/[ÒÓÔÕÖ]/g, 'O')
|
|
2679
|
+
.replace(/[ÙÚÛÜ]/g, 'U')
|
|
2680
|
+
.replace(/[ÝŸ]/g, 'Y')
|
|
2681
|
+
.replace(/[Ñ]/g, 'N')
|
|
2682
|
+
.replace(/[Ç]/g, 'C');
|
|
2683
|
+
}
|
|
2647
2684
|
class Filter {
|
|
2648
2685
|
data = [];
|
|
2649
2686
|
multi = false;
|
|
@@ -2663,7 +2700,7 @@ class Filter {
|
|
|
2663
2700
|
throw new Error("Method not implemented.");
|
|
2664
2701
|
}
|
|
2665
2702
|
removeAccents = (str) => {
|
|
2666
|
-
return str
|
|
2703
|
+
return safeRemoveAccents(str);
|
|
2667
2704
|
};
|
|
2668
2705
|
setSelected(element, value) {
|
|
2669
2706
|
//console.log(element, value);
|
|
@@ -6167,6 +6204,7 @@ class HeaderEcComponent extends MenuEcComponent {
|
|
|
6167
6204
|
coreConstantsService = inject(CoreConstantsService);
|
|
6168
6205
|
router = inject(Router);
|
|
6169
6206
|
cdr = inject(ChangeDetectorRef); // Inyectamos ChangeDetectorRef para forzar la actualización
|
|
6207
|
+
platformId = inject(PLATFORM_ID);
|
|
6170
6208
|
ngOnInit() {
|
|
6171
6209
|
this.channel = this.coreConstantsService.getChannel();
|
|
6172
6210
|
this.onWindowScroll();
|
|
@@ -6189,17 +6227,21 @@ class HeaderEcComponent extends MenuEcComponent {
|
|
|
6189
6227
|
});
|
|
6190
6228
|
}
|
|
6191
6229
|
onWindowScroll() {
|
|
6192
|
-
|
|
6193
|
-
|
|
6230
|
+
if (isPlatformBrowser(this.platformId)) {
|
|
6231
|
+
const scrollTop = window.scrollY;
|
|
6232
|
+
this.isScrolled = scrollTop > 80;
|
|
6233
|
+
}
|
|
6194
6234
|
}
|
|
6195
6235
|
isHomeFunction() {
|
|
6196
|
-
|
|
6197
|
-
|
|
6198
|
-
if (
|
|
6199
|
-
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
|
|
6236
|
+
if (isPlatformBrowser(this.platformId)) {
|
|
6237
|
+
const headerElement = document.querySelector('header');
|
|
6238
|
+
if (headerElement) {
|
|
6239
|
+
if (this.router.url !== '/home') {
|
|
6240
|
+
headerElement.classList.add('show-menu');
|
|
6241
|
+
}
|
|
6242
|
+
else {
|
|
6243
|
+
headerElement.classList.remove('show-menu');
|
|
6244
|
+
}
|
|
6203
6245
|
}
|
|
6204
6246
|
}
|
|
6205
6247
|
}
|
|
@@ -6223,26 +6265,30 @@ class HeaderEcComponent extends MenuEcComponent {
|
|
|
6223
6265
|
}
|
|
6224
6266
|
};
|
|
6225
6267
|
borrarInput(inputId) {
|
|
6226
|
-
if (
|
|
6227
|
-
|
|
6228
|
-
|
|
6229
|
-
input.value = '';
|
|
6230
|
-
}
|
|
6231
|
-
}
|
|
6232
|
-
else {
|
|
6233
|
-
const inputs = ['searchInput1'];
|
|
6234
|
-
inputs.forEach((id) => {
|
|
6235
|
-
const input = document.getElementById(id);
|
|
6268
|
+
if (isPlatformBrowser(this.platformId)) {
|
|
6269
|
+
if (inputId) {
|
|
6270
|
+
const input = document.getElementById(inputId);
|
|
6236
6271
|
if (input) {
|
|
6237
6272
|
input.value = '';
|
|
6238
6273
|
}
|
|
6239
|
-
}
|
|
6274
|
+
}
|
|
6275
|
+
else {
|
|
6276
|
+
const inputs = ['searchInput1'];
|
|
6277
|
+
inputs.forEach((id) => {
|
|
6278
|
+
const input = document.getElementById(id);
|
|
6279
|
+
if (input) {
|
|
6280
|
+
input.value = '';
|
|
6281
|
+
}
|
|
6282
|
+
});
|
|
6283
|
+
}
|
|
6240
6284
|
}
|
|
6241
6285
|
this.searchValue = '';
|
|
6242
6286
|
this.coreConstantsService.searchValue = '';
|
|
6243
6287
|
this.getCollectionSearch();
|
|
6244
6288
|
}
|
|
6245
6289
|
setupMobileMenu() {
|
|
6290
|
+
if (!isPlatformBrowser(this.platformId))
|
|
6291
|
+
return;
|
|
6246
6292
|
// console.log('setupMobileMenu called');
|
|
6247
6293
|
const menuMobile = document.querySelector('.menuMobile');
|
|
6248
6294
|
if (!(menuMobile instanceof HTMLElement))
|
|
@@ -6278,6 +6324,8 @@ class HeaderEcComponent extends MenuEcComponent {
|
|
|
6278
6324
|
});
|
|
6279
6325
|
}
|
|
6280
6326
|
setupSearchInputs() {
|
|
6327
|
+
if (!isPlatformBrowser(this.platformId))
|
|
6328
|
+
return;
|
|
6281
6329
|
const inputs = ['searchInput1', 'searchInput2'];
|
|
6282
6330
|
inputs.forEach(id => {
|
|
6283
6331
|
const input = document.getElementById(id);
|
|
@@ -7024,7 +7072,7 @@ class BlockProductsEcComponent extends BlockEcComponent {
|
|
|
7024
7072
|
* Permite personalización de las imágenes de las flechas mediante @Input.
|
|
7025
7073
|
*/
|
|
7026
7074
|
setupSwiperNavigation() {
|
|
7027
|
-
if (this.meta?.styles?.carrousel !== false) {
|
|
7075
|
+
if (this.meta?.styles?.carrousel !== false && isPlatformBrowser(this.platformId)) {
|
|
7028
7076
|
// Usar setTimeout para asegurar que el swiper esté inicializado
|
|
7029
7077
|
setTimeout(() => {
|
|
7030
7078
|
this.initializeSwiperWithCustomNavigation();
|
|
@@ -7036,6 +7084,8 @@ class BlockProductsEcComponent extends BlockEcComponent {
|
|
|
7036
7084
|
* Esta función puede ser movida al componente base para reutilización.
|
|
7037
7085
|
*/
|
|
7038
7086
|
initializeSwiperWithCustomNavigation() {
|
|
7087
|
+
if (!isPlatformBrowser(this.platformId))
|
|
7088
|
+
return;
|
|
7039
7089
|
const prevButton = document.getElementById(`${this.meta?.code}-prev`);
|
|
7040
7090
|
const nextButton = document.getElementById(`${this.meta?.code}-next`);
|
|
7041
7091
|
const swiperElement = document.getElementById(this.meta?.code);
|
|
@@ -7395,7 +7445,9 @@ class MagnizoomEcComponent {
|
|
|
7395
7445
|
this.image = this.document.createElement('img');
|
|
7396
7446
|
this.image.onload = () => {
|
|
7397
7447
|
this.lensSize = { width: this.image.width / 2, height: this.image.height / 2 };
|
|
7398
|
-
|
|
7448
|
+
if (isPlatformBrowser(this.platformId)) {
|
|
7449
|
+
setTimeout(() => this.render());
|
|
7450
|
+
}
|
|
7399
7451
|
};
|
|
7400
7452
|
this.image.src = src;
|
|
7401
7453
|
}
|
|
@@ -7525,157 +7577,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
7525
7577
|
args: ['mainCanvas', { static: true }]
|
|
7526
7578
|
}] } });
|
|
7527
7579
|
|
|
7528
|
-
class ComponentHelper {
|
|
7529
|
-
constructor() {
|
|
7530
|
-
this.ecOnConstruct();
|
|
7531
|
-
}
|
|
7532
|
-
ecOnInit = (params = {}) => {
|
|
7533
|
-
};
|
|
7534
|
-
ecOnConstruct = (params = {}) => {
|
|
7535
|
-
};
|
|
7536
|
-
hasParams = (params, searched) => {
|
|
7537
|
-
if (!params || !searched)
|
|
7538
|
-
return false;
|
|
7539
|
-
const q = searched.trim().toLowerCase();
|
|
7540
|
-
return params.some(p => {
|
|
7541
|
-
const code = p?.['code']?.toString().toLowerCase() ?? '';
|
|
7542
|
-
// Primero chequeo exacto, y si no, parcial
|
|
7543
|
-
return code === q || code.includes(q);
|
|
7544
|
-
});
|
|
7545
|
-
};
|
|
7546
|
-
navigateOnRouter(router, url) {
|
|
7547
|
-
router.navigateByUrl(`/${url}`);
|
|
7548
|
-
}
|
|
7549
|
-
}
|
|
7550
|
-
|
|
7551
|
-
class RedsysCatchEcComponent extends ComponentHelper {
|
|
7552
|
-
activedRoute;
|
|
7553
|
-
router;
|
|
7554
|
-
checkoutService;
|
|
7555
|
-
renderer;
|
|
7556
|
-
elementRef;
|
|
7557
|
-
document;
|
|
7558
|
-
message = '';
|
|
7559
|
-
subscription = null;
|
|
7560
|
-
constructor(activedRoute, router, checkoutService, renderer, elementRef, document) {
|
|
7561
|
-
super();
|
|
7562
|
-
this.activedRoute = activedRoute;
|
|
7563
|
-
this.router = router;
|
|
7564
|
-
this.checkoutService = checkoutService;
|
|
7565
|
-
this.renderer = renderer;
|
|
7566
|
-
this.elementRef = elementRef;
|
|
7567
|
-
this.document = document;
|
|
7568
|
-
this.hideHeaderFooter();
|
|
7569
|
-
this.ecOnConstruct();
|
|
7570
|
-
}
|
|
7571
|
-
ngOnInit() {
|
|
7572
|
-
this.subscription = combineLatest([
|
|
7573
|
-
this.activedRoute.params,
|
|
7574
|
-
this.activedRoute.queryParams
|
|
7575
|
-
]).subscribe(([queryRouter, queryParams]) => {
|
|
7576
|
-
let state;
|
|
7577
|
-
state = queryRouter['state'];
|
|
7578
|
-
if (state && state === 'statuspayment') {
|
|
7579
|
-
state = queryParams['status'];
|
|
7580
|
-
}
|
|
7581
|
-
console.log('PARAMETROS STATE -> ', state);
|
|
7582
|
-
this.handlePaymentState(state, queryParams);
|
|
7583
|
-
});
|
|
7584
|
-
this.ecOnInit();
|
|
7585
|
-
}
|
|
7586
|
-
ngOnDestroy() {
|
|
7587
|
-
if (this.subscription) {
|
|
7588
|
-
this.subscription.unsubscribe();
|
|
7589
|
-
}
|
|
7590
|
-
this.showHeaderFooter();
|
|
7591
|
-
// this.ecOnDestroy(); // Removido si no existe en ComponentHelper
|
|
7592
|
-
}
|
|
7593
|
-
hideHeaderFooter() {
|
|
7594
|
-
// Usar Renderer2 en lugar de jQuery para manipular el DOM
|
|
7595
|
-
const header = this.document.querySelector('header');
|
|
7596
|
-
const footer = this.document.querySelector('footer');
|
|
7597
|
-
if (header) {
|
|
7598
|
-
this.renderer.setStyle(header, 'display', 'none');
|
|
7599
|
-
}
|
|
7600
|
-
if (footer) {
|
|
7601
|
-
this.renderer.setStyle(footer, 'display', 'none');
|
|
7602
|
-
}
|
|
7603
|
-
}
|
|
7604
|
-
showHeaderFooter() {
|
|
7605
|
-
// Restaurar la visibilidad al destruir el componente
|
|
7606
|
-
const header = this.document.querySelector('header');
|
|
7607
|
-
const footer = this.document.querySelector('footer');
|
|
7608
|
-
if (header) {
|
|
7609
|
-
this.renderer.removeStyle(header, 'display');
|
|
7610
|
-
}
|
|
7611
|
-
if (footer) {
|
|
7612
|
-
this.renderer.removeStyle(footer, 'display');
|
|
7613
|
-
}
|
|
7614
|
-
}
|
|
7615
|
-
handlePaymentState(state, queryParams) {
|
|
7616
|
-
switch (state) {
|
|
7617
|
-
case '200':
|
|
7618
|
-
this.setStateInLocal('Su pago fue procesado con éxito.', 'success');
|
|
7619
|
-
this.storeTotalAmount(queryParams);
|
|
7620
|
-
break;
|
|
7621
|
-
case 'success':
|
|
7622
|
-
this.setStateInLocal('Su pago fue procesado con éxito.', state);
|
|
7623
|
-
this.storeTotalAmount(queryParams);
|
|
7624
|
-
break;
|
|
7625
|
-
case 'pending':
|
|
7626
|
-
this.setStateInLocal('Su pago fue procesado con éxito.', state);
|
|
7627
|
-
break;
|
|
7628
|
-
case 'failure':
|
|
7629
|
-
this.setStateInLocal('Se ha cancelado el proceso de pago.', state);
|
|
7630
|
-
this.storeTotalAmount(queryParams);
|
|
7631
|
-
break;
|
|
7632
|
-
case 'cancel':
|
|
7633
|
-
this.setStateInLocal('Se ha cancelado el proceso de pago.', state);
|
|
7634
|
-
break;
|
|
7635
|
-
case 'ok':
|
|
7636
|
-
this.setStateInSesion('Su pago fue procesado con éxito.', state);
|
|
7637
|
-
break;
|
|
7638
|
-
case 'challenge':
|
|
7639
|
-
this.setStateInSesion('Redirigiendo a autenticación del banco emisor.', state);
|
|
7640
|
-
break;
|
|
7641
|
-
case 'error':
|
|
7642
|
-
this.setStateInSesion('Algo no salio bien en la validación de sus datos.', state);
|
|
7643
|
-
break;
|
|
7644
|
-
case '0':
|
|
7645
|
-
this.setStateInLocal('Se ha cancelado el proceso de pago.', 'failure');
|
|
7646
|
-
break;
|
|
7647
|
-
default:
|
|
7648
|
-
break;
|
|
7649
|
-
}
|
|
7650
|
-
}
|
|
7651
|
-
storeTotalAmount(queryParams) {
|
|
7652
|
-
const totalAmount = queryParams['total_amount'];
|
|
7653
|
-
if (totalAmount) {
|
|
7654
|
-
localStorage.setItem('total_amount', totalAmount);
|
|
7655
|
-
}
|
|
7656
|
-
}
|
|
7657
|
-
setStateInLocal = (mensaje, state) => {
|
|
7658
|
-
this.message = mensaje;
|
|
7659
|
-
localStorage.setItem('state', state);
|
|
7660
|
-
sessionStorage.setItem('modalnews', 'false');
|
|
7661
|
-
};
|
|
7662
|
-
setStateInSesion = (mensaje, state) => {
|
|
7663
|
-
this.message = mensaje;
|
|
7664
|
-
sessionStorage.setItem('state', state);
|
|
7665
|
-
localStorage.setItem('state', state);
|
|
7666
|
-
sessionStorage.setItem('modalnews', 'false');
|
|
7667
|
-
};
|
|
7668
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: RedsysCatchEcComponent, deps: [{ token: i2.ActivatedRoute }, { token: i2.Router }, { token: CheckoutService }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Component });
|
|
7669
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: RedsysCatchEcComponent, isStandalone: true, selector: "app-redsys-catch-ec", usesInheritance: true, ngImport: i0, template: "<div id=\"container\">\r\n <div class=\"row\">\r\n <div class=\"col align-self-center\">\r\n <h4 class=\"titpage center-block text-center font-nexa font-lg my-3\">{{ message | uppercase }}</h4>\r\n </div>\r\n </div>\r\n <div class=\"row\">\r\n <div class=\"col align-self-center\">\r\n <h5 class=\"center-block text-center font-nexa my-3\">Redirigiendo en segundos...</h5>\r\n <br>\r\n <div class=\"d-flex flex-column jusitfy-content-center align-items-center\">\r\n <app-loading-full-ec></app-loading-full-ec>\r\n </div>\r\n </div>\r\n </div>\r\n</div>", styles: [".loader{border:16px solid #f3f3f3;border-top:16px solid #dc3545;border-radius:50%;width:50px;height:50px;animation:spin 2s linear infinite}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.flex-container{display:flex;justify-content:center;align-items:center;height:80vh;width:100%}.flex-container>div{width:90%;height:100px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: i1.UpperCasePipe, name: "uppercase" }, { kind: "component", type: LoadingFullEcComponent, selector: "app-loading-full-ec" }] });
|
|
7670
|
-
}
|
|
7671
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: RedsysCatchEcComponent, decorators: [{
|
|
7672
|
-
type: Component,
|
|
7673
|
-
args: [{ selector: 'app-redsys-catch-ec', standalone: true, imports: [CommonModule, LoadingFullEcComponent], template: "<div id=\"container\">\r\n <div class=\"row\">\r\n <div class=\"col align-self-center\">\r\n <h4 class=\"titpage center-block text-center font-nexa font-lg my-3\">{{ message | uppercase }}</h4>\r\n </div>\r\n </div>\r\n <div class=\"row\">\r\n <div class=\"col align-self-center\">\r\n <h5 class=\"center-block text-center font-nexa my-3\">Redirigiendo en segundos...</h5>\r\n <br>\r\n <div class=\"d-flex flex-column jusitfy-content-center align-items-center\">\r\n <app-loading-full-ec></app-loading-full-ec>\r\n </div>\r\n </div>\r\n </div>\r\n</div>", styles: [".loader{border:16px solid #f3f3f3;border-top:16px solid #dc3545;border-radius:50%;width:50px;height:50px;animation:spin 2s linear infinite}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.flex-container{display:flex;justify-content:center;align-items:center;height:80vh;width:100%}.flex-container>div{width:90%;height:100px}\n"] }]
|
|
7674
|
-
}], ctorParameters: () => [{ type: i2.ActivatedRoute }, { type: i2.Router }, { type: CheckoutService }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: Document, decorators: [{
|
|
7675
|
-
type: Inject,
|
|
7676
|
-
args: [DOCUMENT]
|
|
7677
|
-
}] }] });
|
|
7678
|
-
|
|
7679
7580
|
// export * from './rating-ec/rating-ec.component';
|
|
7680
7581
|
|
|
7681
7582
|
class BlockFormContactEcComponent extends BlockEcComponent {
|
|
@@ -8407,6 +8308,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
8407
8308
|
type: Output
|
|
8408
8309
|
}] } });
|
|
8409
8310
|
|
|
8311
|
+
class ComponentHelper {
|
|
8312
|
+
constructor() {
|
|
8313
|
+
this.ecOnConstruct();
|
|
8314
|
+
}
|
|
8315
|
+
ecOnInit = (params = {}) => {
|
|
8316
|
+
};
|
|
8317
|
+
ecOnConstruct = (params = {}) => {
|
|
8318
|
+
};
|
|
8319
|
+
hasParams = (params, searched) => {
|
|
8320
|
+
if (!params || !searched)
|
|
8321
|
+
return false;
|
|
8322
|
+
const q = searched.trim().toLowerCase();
|
|
8323
|
+
return params.some(p => {
|
|
8324
|
+
const code = p?.['code']?.toString().toLowerCase() ?? '';
|
|
8325
|
+
// Primero chequeo exacto, y si no, parcial
|
|
8326
|
+
return code === q || code.includes(q);
|
|
8327
|
+
});
|
|
8328
|
+
};
|
|
8329
|
+
navigateOnRouter(router, url) {
|
|
8330
|
+
router.navigateByUrl(`/${url}`);
|
|
8331
|
+
}
|
|
8332
|
+
}
|
|
8333
|
+
|
|
8410
8334
|
class PasswordResetEcComponent extends ComponentHelper {
|
|
8411
8335
|
authService;
|
|
8412
8336
|
toastr;
|
|
@@ -10569,9 +10493,11 @@ class RelatedProductsEcComponent extends BlockEcComponent {
|
|
|
10569
10493
|
this._relatedProductsSubject.next(relatedProducts);
|
|
10570
10494
|
res.map((products) => this._analyticsService.callEvent('view_item_list', { products: products.items, item_list_name: products.title || 'Related Products', item_list_id: products.id || 'related-products' }));
|
|
10571
10495
|
// Inicializar swiper después de que los datos estén disponibles
|
|
10572
|
-
|
|
10573
|
-
|
|
10574
|
-
|
|
10496
|
+
if (isPlatformBrowser(this.platformId)) {
|
|
10497
|
+
setTimeout(() => {
|
|
10498
|
+
this.initSwiper();
|
|
10499
|
+
}, 100);
|
|
10500
|
+
}
|
|
10575
10501
|
});
|
|
10576
10502
|
}
|
|
10577
10503
|
initSwiper() {
|
|
@@ -11823,5 +11749,5 @@ const directives = [
|
|
|
11823
11749
|
* Generated bundle index. Do not edit.
|
|
11824
11750
|
*/
|
|
11825
11751
|
|
|
11826
|
-
export { AccountEcComponent, AddressingService, AnalyticsService, AuthEcComponent, AuthService, AuthStorageService, BlockBannerBoxEcComponent, BlockBannerFullEcComponent, BlockFormContactEcComponent, BlockHtmlEcComponent, BlockNewsletterEcComponent, BlockProductsEcComponent, BlocksEcComponent, BlocksRepositoryService, BlocksService, BreadcrumbEcComponent, CartEcComponent, CartItemEcComponent, CartService, ChannelService, CheckoutEcComponent, CheckoutService, CollectionEcComponent, ConfirmAccountEcComponent, ContactEcComponent, CoreConstantsService, CouponEcComponent, CurrencyService, DopplerService, ENVIRONMENT_TOKEN, EcCurrencySymbolPipe, EcSafeHtmlPipe, FacebookPixelService, FaqsEcComponent, FiltersEcComponent, FiltersService, FiltersSortEcComponent, FooterEcComponent, ForgotPasswordEcComponent, FormService, GTMService, GoogleAnalyticsService, HeaderEcComponent, HomeEcComponent, LoadingFullEcComponent, LoadingInlineEcComponent, LoadingSectionEcComponent, LocalStorageService, LoginFormEcComponent, MagnizoomEcComponent, MetricoolPixelService, NgxLocalStorageService, OptionsService, OrderEcComponent, OrderUtilityService, OrdersListEcComponent, OrdersService, PaginationService, ParametersService, ParamsContext, PasswordResetEcComponent, PaymentService, PriceEcComponent, PriceRangeFilterComponent, ProductDetailEcComponent, ProductDetailService, ProductEcComponent, ProductOffDirective, ProductStockDirective, ProductsService, ReCaptchaEcComponent, ReCaptchaService,
|
|
11752
|
+
export { AccountEcComponent, AddressingService, AnalyticsService, AuthEcComponent, AuthService, AuthStorageService, BlockBannerBoxEcComponent, BlockBannerFullEcComponent, BlockFormContactEcComponent, BlockHtmlEcComponent, BlockNewsletterEcComponent, BlockProductsEcComponent, BlocksEcComponent, BlocksRepositoryService, BlocksService, BreadcrumbEcComponent, CartEcComponent, CartItemEcComponent, CartService, ChannelService, CheckoutEcComponent, CheckoutService, CollectionEcComponent, ConfirmAccountEcComponent, ContactEcComponent, CoreConstantsService, CouponEcComponent, CurrencyService, DopplerService, ENVIRONMENT_TOKEN, EcCurrencySymbolPipe, EcSafeHtmlPipe, FacebookPixelService, FaqsEcComponent, FiltersEcComponent, FiltersService, FiltersSortEcComponent, FooterEcComponent, ForgotPasswordEcComponent, FormService, GTMService, GoogleAnalyticsService, HeaderEcComponent, HomeEcComponent, LoadingFullEcComponent, LoadingInlineEcComponent, LoadingSectionEcComponent, LocalStorageService, LoginFormEcComponent, MagnizoomEcComponent, MetricoolPixelService, NgxLocalStorageService, OptionsService, OrderEcComponent, OrderUtilityService, OrdersListEcComponent, OrdersService, PaginationService, ParametersService, ParamsContext, PasswordResetEcComponent, PaymentService, PriceEcComponent, PriceRangeFilterComponent, ProductDetailEcComponent, ProductDetailService, ProductEcComponent, ProductOffDirective, ProductStockDirective, ProductsService, ReCaptchaEcComponent, ReCaptchaService, RegisterFormEcComponent, RegisterWholesalerFormEcComponent, RelatedProductsEcComponent, ReviewsEcComponent, ReviewsFormEcComponent, SectionContainerEcComponent, ShareEcComponent, ShipmentService, SidebarEcComponent, StoresEcComponent, SuccessEcComponent, TestService, ToastService, VariantsEcComponent, authGuard, authInterceptor, directives, provideEnvironment };
|
|
11827
11753
|
//# sourceMappingURL=ng-easycommerce-v18.mjs.map
|