ng-easycommerce 1.1.3 → 1.1.4-redirecciones.2
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 +8 -0
- package/bundles/ng-easycommerce.umd.js +174 -38
- package/bundles/ng-easycommerce.umd.js.map +1 -1
- package/bundles/ng-easycommerce.umd.min.js +1 -1
- package/bundles/ng-easycommerce.umd.min.js.map +1 -1
- package/esm2015/lib/ec-component/blocks-ec/block-banner-boxes-ec/block-banner-boxes-ec.component.js +2 -2
- package/esm2015/lib/ec-component/blocks-ec/block-banner-full-ec/block-banner-full-ec.component.js +2 -2
- package/esm2015/lib/ec-directive/add-action-redirect.directive.js +155 -26
- package/esm2015/lib/interfaces/block.js +1 -1
- package/esm2015/lib/services/blocks/blocks.service.js +20 -12
- package/esm5/lib/ec-component/blocks-ec/block-banner-boxes-ec/block-banner-boxes-ec.component.js +2 -2
- package/esm5/lib/ec-component/blocks-ec/block-banner-full-ec/block-banner-full-ec.component.js +2 -2
- package/esm5/lib/ec-directive/add-action-redirect.directive.js +155 -27
- package/esm5/lib/interfaces/block.js +1 -1
- package/esm5/lib/services/blocks/blocks.service.js +20 -12
- package/fesm2015/ng-easycommerce.js +175 -38
- package/fesm2015/ng-easycommerce.js.map +1 -1
- package/fesm5/ng-easycommerce.js +175 -39
- package/fesm5/ng-easycommerce.js.map +1 -1
- package/lib/ec-directive/add-action-redirect.directive.d.ts +14 -2
- package/lib/interfaces/block.d.ts +1 -1
- package/ng-easycommerce.metadata.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
# Version 1.1.4-redirecciones.1
|
|
2
|
+
- Banners: se resuelven explícitamente los destinos `taxon`/`category`, `attribute` y `url`, respetando el tipo de redirección configurado.
|
|
3
|
+
- Banners: las plantillas del core aplican `ecAddActionRedirect` a los enlaces; los destinos incompletos ya no generan navegación accidental a `/`.
|
|
4
|
+
|
|
5
|
+
# Version 1.1.4
|
|
6
|
+
- Navegación: `AddActionRedirectDirective` normaliza URLs absolutas del mismo origen para el Angular Router, respeta el `base href` y conserva query parameters y fragmentos.
|
|
7
|
+
- Navegación: se mantiene el comportamiento nativo para clics modificados, botón central y enlaces con `target` explícito.
|
|
8
|
+
|
|
1
9
|
# Version 1.1.3
|
|
2
10
|
- Carrito: se incorpora la recuperación ante `409 CART_NOT_ACTIVE`; la mutación rechazada se cancela, el carrito activo se recupera automáticamente y la operación original no se reintenta.
|
|
3
11
|
- Carrito: las pestañas del mismo navegador actualizan el resumen desde backend mediante señales de invalidación, con protección frente a eventos y respuestas obsoletas.
|
|
@@ -8205,17 +8205,25 @@
|
|
|
8205
8205
|
? banner.translations[_this.consts.getLocale()].mobileImageName
|
|
8206
8206
|
: banner.translations[_this.consts.getLocale()].imageName); };
|
|
8207
8207
|
this.formUrl = function (banner) {
|
|
8208
|
-
var
|
|
8209
|
-
|
|
8210
|
-
|
|
8211
|
-
|
|
8212
|
-
|
|
8213
|
-
|
|
8214
|
-
|
|
8215
|
-
|
|
8216
|
-
|
|
8217
|
-
|
|
8218
|
-
|
|
8208
|
+
var _a, _b, _c, _d;
|
|
8209
|
+
if (!banner)
|
|
8210
|
+
return '/';
|
|
8211
|
+
var type = String(banner.redirectionType || '').toLowerCase();
|
|
8212
|
+
var element = type === 'attribute'
|
|
8213
|
+
? 'attributes'
|
|
8214
|
+
: type === 'taxon' || type === 'category'
|
|
8215
|
+
? 'categories'
|
|
8216
|
+
: null;
|
|
8217
|
+
if (!element)
|
|
8218
|
+
return '/';
|
|
8219
|
+
var associations = element === 'categories' ? banner.taxons : banner.attributes;
|
|
8220
|
+
if (!Array.isArray(associations) || associations.length !== 1)
|
|
8221
|
+
return '/';
|
|
8222
|
+
var association = associations[0];
|
|
8223
|
+
var slug = ((_a = association) === null || _a === void 0 ? void 0 : _a.slug) || ((_d = (_c = (_b = association) === null || _b === void 0 ? void 0 : _b.translations) === null || _c === void 0 ? void 0 : _c[_this.consts.getLocale()]) === null || _d === void 0 ? void 0 : _d.slug);
|
|
8224
|
+
return typeof slug === 'string' && slug.trim()
|
|
8225
|
+
? '/collection/' + element + '/' + encodeURIComponent(slug.trim())
|
|
8226
|
+
: '/';
|
|
8219
8227
|
};
|
|
8220
8228
|
this.sendResponse = function (response_obj) {
|
|
8221
8229
|
return _this.connection.post(_this.contactFormResponseAPI(), _this.prepareData(response_obj));
|
|
@@ -9314,7 +9322,7 @@
|
|
|
9314
9322
|
BlockBannerBoxesEcComponent = __decorate$J([
|
|
9315
9323
|
core.Component({
|
|
9316
9324
|
selector: 'app-block-banner-boxes-ec',
|
|
9317
|
-
template: "<section [ngClass]=\"trimClassBlock(meta.code) + ' container-fluid'\" *ngIf=\"banners.length\"\n [style.background-color]=\"meta.styles?.backgroundColor\"\n [style.background-image]=\"meta.styles?.backgroundImage ? 'url(' + consts.mediaUrl() + meta.styles?.backgroundImage +')' : 'inherit'\">\n\n\n <div class=\"block-boxes\">\n <div class=\"row\" *ngIf=\"meta.name\">\n <div class=\"col-12 mt-4\">\n <h2 class=\"font-weight-normal font-gd\">\n <span>{{meta.name}}</span>\n </h2>\n </div>\n </div>\n\n <!-- Si es formato fijo -->\n <ng-container *ngIf=\"meta.styles && meta.styles.carrousel == false ; else carrousel\">\n\n <div class=\"banner-content\">\n\n <div class=\"row g-0\">\n <div [class]=\"'item '+ ' col-md-6 ' + ' col-lg-' + (12/banners.length) \"\n *ngFor=\"let banner of banners; let i = index\" [id]=\"i\">\n <img class=\"img-fluid\" [src]=\"consts.mediaBannerUrl() + getImage(banner)\" alt=\"\">\n <
|
|
9325
|
+
template: "<section [ngClass]=\"trimClassBlock(meta.code) + ' container-fluid'\" *ngIf=\"banners.length\"\n [style.background-color]=\"meta.styles?.backgroundColor\"\n [style.background-image]=\"meta.styles?.backgroundImage ? 'url(' + consts.mediaUrl() + meta.styles?.backgroundImage +')' : 'inherit'\">\n\n\n <div class=\"block-boxes\">\n <div class=\"row\" *ngIf=\"meta.name\">\n <div class=\"col-12 mt-4\">\n <h2 class=\"font-weight-normal font-gd\">\n <span>{{meta.name}}</span>\n </h2>\n </div>\n </div>\n\n <!-- Si es formato fijo -->\n <ng-container *ngIf=\"meta.styles && meta.styles.carrousel == false ; else carrousel\">\n\n <div class=\"banner-content\">\n\n <div class=\"row g-0\">\n <div [class]=\"'item '+ ' col-md-6 ' + ' col-lg-' + (12/banners.length) \"\n *ngFor=\"let banner of banners; let i = index\" [id]=\"i\">\n <a [ecAddActionRedirect]=\"banner\" [isTransparent]=\"false\" class=\"d-block\">\n <img class=\"img-fluid\" [src]=\"consts.mediaBannerUrl() + getImage(banner)\" alt=\"\">\n </a>\n <a [ecAddActionRedirect]=\"banner\" [isTransparent]=\"false\" class=\"position-absolute d-block w-100 top-0 start-0 h-100\">\n <h2 [class]=\"'item-title px-2 item-position-vertical-'+ (banner.styles?.description?.position)\" \n [style.color]=\"(banner.styles?.description?.color) ? banner.styles?.description?.color : '#000'\">\n {{banner.title}}\n </h2>\n <p *ngIf=\"banner.subtitle\"\n [style.color]=\"(banner.styles?.description?.color) ? banner.styles?.description?.color : '#000' \"\n [class]=\"'px-4 item-subtitle item-position-vertical-' + (banner.styles?.description?.position)\">\n {{banner.subtitle}}\n </p>\n <div [class]=\"'item-position-vertical-' + (banner.styles?.button?.position)\">\n <span *ngIf=\"banner.styles?.button?.text\"\n [class]=\"'item-button btn btn-light'\">\n {{banner.styles.button.text}}\n </span>\n </div>\n </a>\n </div>\n\n </div>\n </div>\n\n </ng-container>\n\n <!-- Si es Carrousel -->\n <ng-template #carrousel>\n\n\n <!-- carrousel mobile -->\n <ng-container *ngIf=\"consts.mobile(); else carrouselNormal\">\n <div class=\"banner-content mobile carrousel\">\n\n <div class=\"row my-2\">\n\n <div class=\"col-12 item-carrousel\" *ngFor=\"let banner of banners; let i = index\" [id]=\"i\">\n <a [ecAddActionRedirect]=\"banner\" [isTransparent]=\"false\">\n <img class=\"img-fluid\" [src]=\"consts.mediaBannerUrl() + getImage(banner)\" alt=\"\">\n <div class=\"position-absolute w-100 top-0 start-0 h-100\">\n <h2 *ngIf=\"banner.title\" [class]=\"'item-title-fullpx-2 item-position-vertical-'+ (banner.styles?.description?.position)\"\n [style.color]=\"(banner.styles?.description?.color) ? banner.styles?.description?.color : '#fff' \">\n {{banner.title}}\n </h2>\n <p *ngIf=\"banner.subtitle\"\n [style.color]=\"(banner.styles?.description?.color) ? banner.styles?.description?.color : '#000' \"\n [class]=\"'px-4 item-subtitle item-position-vertical-' + (banner.styles?.description?.position)\">\n {{banner.subtitle}}\n </p>\n <div [class]=\"'item-position-vertical-' + (banner.styles?.button?.position)\">\n <span *ngIf=\"banner.styles?.button?.text\"\n [class]=\"'item-button btn btn-light'\">\n {{banner.styles.button.text}}\n </span>\n </div>\n </div>\n </a>\n\n </div>\n\n </div>\n </div>\n </ng-container>\n\n <!-- carrousel desktop -->\n <ng-template #carrouselNormal>\n\n <owl-carousel-o [options]=\"options\">\n <ng-template carouselSlide *ngFor=\"let banner of banners; let i = index\" [id]=\"i\">\n\n <div class=\"banner-content carrousel\">\n <a [ecAddActionRedirect]=\"banner\" [isTransparent]=\"false\" class=\"d-block\">\n <img [src]=\"consts.mediaBannerUrl() + getImage(banner)\" alt=\"\">\n </a>\n <a [ecAddActionRedirect]=\"banner\" [isTransparent]=\"false\" class=\"position-absolute d-block w-100 top-0 start-0 h-100\">\n <h2 *ngIf=\"banner.title\" \n [class]=\"'item-title-full px-2 item-position-vertical-'+ (banner.styles?.description?.position)\"\n style=\"color:#fff\">\n {{banner.title}}\n </h2>\n <p *ngIf=\"banner.subtitle\"\n [style.color]=\"(banner.styles?.description?.color) ? banner.styles?.description?.color : '#000' \"\n [class]=\"'px-4 item-subtitle-full item-position-vertical-' + (banner.styles?.description?.position)\">\n {{banner.subtitle}}\n </p>\n <div [class]=\"'item-position-vertical-' + (banner.styles?.button?.position)\">\n <span *ngIf=\"banner.styles?.button?.text\"\n [style.background-color]=\"(banner.styles?.button?.color) ? banner.styles?.button?.color : '#fff' \"\n [class]=\"'item-button-full btn btn-light'\">\n {{banner.styles.button.text}}\n </span>\n </div>\n </a>\n </div>\n <!-- <div *ngIf=\"!banner.url; else externalUrl\" class=\"item-carrousel\">\n <a [routerLink]=\"formUrl(banner)\">\n <img [src]=\"consts.mediaBannerUrl() + getImage(banner)\" alt=\"\"></a>\n </div>\n <ng-template #externalUrl>\n <div class=\"item-carrousel\">\n <a href=\"{{banner.url}}\">\n <img [src]=\"consts.mediaBannerUrl() + getImage(banner)\" alt=\"\">\n <div class=\"bottom-left\">\n {{banner.title}}\n </div>\n\n </a>\n </div>\n </ng-template> -->\n </ng-template>\n </owl-carousel-o>\n\n </ng-template>\n\n </ng-template>\n </div>\n</section>\n",
|
|
9318
9326
|
styles: [".item{position:relative}.item-title{top:30%}.item-title-full{top:50%}.item-subtitle-full{top:60%}.item-subtitle{top:40%}.item-button{top:60%}.item-button.item-position-vertical-center{left:50%;transform:translate(-50%)}.item-button.item-position-vertical-left{left:10%}.item-button.item-position-vertical-right{right:5%;transform:translate(-50%)}.item-button-full{top:70%}.item-button-full.item-position-vertical-center{left:50%;transform:translate(-50%)}.item-button-full.item-position-vertical-left{left:10%}.item-button-full.item-position-vertical-right{right:5%;transform:translate(-50%)}.item-position-vertical-left{text-align:left}.item-position-vertical-center{text-align:center}.item-position-vertical-right{text-align:right}h2.item-title-full::after{content:none}"]
|
|
9319
9327
|
})
|
|
9320
9328
|
], BlockBannerBoxesEcComponent);
|
|
@@ -9445,7 +9453,7 @@
|
|
|
9445
9453
|
BlockBannerFullEcComponent = __decorate$K([
|
|
9446
9454
|
core.Component({
|
|
9447
9455
|
selector: 'app-block-banner-full-ec',
|
|
9448
|
-
template: "<section [ngClass]=\"trimClassBlock(meta.code) + ' container-fluid px-0'\" *ngIf=\"banners.length\"\n [style.background-color]=\"meta.styles?.backgroundColor\"\n [style.background-image]=\"meta.styles?.backgroundImage ? 'url(' + consts.mediaUrl() + meta.styles?.backgroundImage +')' : 'inherit'\">\n\n\n <!-- si es formato fijo -->\n <ng-container *ngIf=\"banners.length == 1;else carrousel \">\n\n <div class=\"row justify-content-center\">\n <!-- banner sin boton -->\n <a *ngIf=\"!banners[0].styles?.button?.text; else fullwithButton\"
|
|
9456
|
+
template: "<section [ngClass]=\"trimClassBlock(meta.code) + ' container-fluid px-0'\" *ngIf=\"banners.length\"\n [style.background-color]=\"meta.styles?.backgroundColor\"\n [style.background-image]=\"meta.styles?.backgroundImage ? 'url(' + consts.mediaUrl() + meta.styles?.backgroundImage +')' : 'inherit'\">\n\n\n <!-- si es formato fijo -->\n <ng-container *ngIf=\"banners.length == 1;else carrousel \">\n\n <div class=\"row justify-content-center\">\n <!-- banner sin boton -->\n <a *ngIf=\"!banners[0].styles?.button?.text; else fullwithButton\" [ecAddActionRedirect]=\"banners[0]\" [isTransparent]=\"false\">\n <div class=\"item col-12\">\n <img class=\"img-fluid\" [src]=\"consts.mediaBannerUrl() + getImage(banners[0])\" alt=\"\">\n <div class=\"position-absolute w-100 h-100 start-0 top-0\">\n <h2 *ngIf=\"banners[0].title\" [class]=\"'item-title-full px-2 item-position-vertical-' + (banners[0].styles?.description?.position)\"\n [style.color]=\"(banners[0].styles?.description?.color) ? banners[0].styles?.description?.color : '#fff' \">\n {{banners[0].title}}\n </h2>\n <p *ngIf=\"banners[0].subtitle\"\n [style.color]=\"(banners[0].styles?.description?.color) ? banners[0].styles?.description?.color : '#000' \"\n [class]=\"'px-4 item-subtitle-full item-position-vertical-' + (banners[0].styles?.description?.position)\">\n {{banners[0].subtitle}}\n </p>\n </div>\n </div>\n </a>\n\n <!-- banner fijo con boton -->\n <ng-template #fullwithButton>\n <div class=\"item col-12\">\n <img class=\"img-fluid\" [src]=\"consts.mediaBannerUrl() + getImage(banners[0])\" alt=\"\">\n <div class=\"position-absolute w-100 h-100 start-0 top-0\">\n <h2 *ngIf=\"banners[0].title\" [class]=\"'item-title-full px-2 item-position-vertical-' + (banners[0].styles?.description?.position)\"\n [style.color]=\"(banners[0].styles?.description?.color) ? banners[0].styles?.description?.color : '#000' \">\n {{banners[0].title}}\n </h2>\n <p *ngIf=\"banners[0].subtitle\"\n [style.color]=\"(banners[0].styles?.description?.color) ? banners[0].styles?.description?.color : '#000' \"\n [class]=\"'px-4 item-subtitle-full item-position-vertical-' + (banners[0].styles?.description?.position)\">\n {{banners[0].subtitle}}\n </p>\n <div [class]=\"'item-position-vertical-' + (banners[0].styles?.button?.position)\">\n <a *ngIf=\"banners[0].styles?.button?.text\" [ecAddActionRedirect]=\"banners[0]\" [isTransparent]=\"false\"\n [class]=\"'item-button-full btn btn-light '\">\n {{banners[0].styles.button.text}}\n </a>\n </div>\n </div>\n </div>\n\n </ng-template>\n </div>\n </ng-container>\n\n\n <!-- si es carrousel -->\n <ng-template #carrousel>\n\n <owl-carousel-o [options]=\"options\">\n <ng-template carouselSlide *ngFor=\"let banner of banners\" [id]=\"banner.id\">\n\n <!-- banner sin boton -->\n <div class=\"item\" *ngIf=\"!banner.styles?.button?.text; else carrouselwithButton\">\n <a *ngIf=\"banner.url || formUrl(banner) !== '/'; else onlyImage\" [ecAddActionRedirect]=\"banner\" [isTransparent]=\"false\">\n <img [src]=\"consts.mediaBannerUrl() + getImage(banner)\" alt=\"\">\n </a>\n <ng-template #onlyImage>\n <img [src]=\"consts.mediaBannerUrl() + getImage(banner)\" alt=\"\">\n </ng-template>\n </div>\n\n <!-- banner con boton -->\n <ng-template #carrouselwithButton>\n <div class=\"item\">\n <img [src]=\"consts.mediaBannerUrl() + getImage(banner)\" alt=\"\">\n <div class=\"position-absolute w-100 h-100 start-0 top-0\">\n <h2 *ngIf=\"banner.title\"\n [class]=\"'item-title-full px-2 item-position-vertical-'+ (banner.styles?.description?.position)\"\n [style.color]=\"(banner.styles?.description?.color) ? banner.styles?.description?.color : '#000' \">\n {{banner.title}}\n </h2>\n <p *ngIf=\"banner.subtitle\"\n [style.color]=\"(banner.styles?.description?.color) ? banner.styles?.description?.color : '#000' \"\n [class]=\"'px-4 item-subtitle-full item-position-vertical-' + (banner.styles?.description?.position)\">\n {{banner.subtitle}}\n </p>\n <div [class]=\"'item-position-vertical-' + (banner.styles?.button?.position)\">\n <a *ngIf=\"banner.styles?.button?.text\" [ecAddActionRedirect]=\"banner\" [isTransparent]=\"false\"\n [class]=\"'item-button-full btn btn-light'\">\n {{banner.styles.button.text}}\n </a>\n </div>\n </div>\n <!-- <a *ngIf=\"!banner.url && (formUrl(banner) != '/')\" [routerLink]=\"formUrl(banner)\"\n class=\"btn btn-outline-light rounded-0 py-3 px-4 btn-conoce btn-caption-banner\">\n Conocé Mas</a>\n <a *ngIf=\"banner.url\" href=\"{{banner.url}}\"\n class=\"btn btn-outline-light rounded-0 py-3 px-4 btn-conoce btn-caption-banner\">\n Conocé Mas</a> -->\n </div>\n </ng-template>\n\n\n <!-- <div class=\"item\">\n <a *ngIf=\"banner.url; else onlyImage\" href=\"{{banner.url}}\">\n <img [src]=\"consts.mediaBannerUrl() + getImage(banner)\" alt=\"\">\n </a>\n <ng-template #onlyImage>\n <img [src]=\"consts.mediaBannerUrl() + getImage(banner)\" alt=\"\">\n </ng-template>\n <div class=\"carousel-caption d-block\">\n <a *ngIf=\"!banner.url && (formUrl(banner) != '/')\" [routerLink]=\"formUrl(banner)\"\n class=\"btn btn-outline-light rounded-0 py-3 px-4 btn-conoce btn-caption-banner\">\n Conocé Mas</a>\n <a *ngIf=\"banner.url\" href=\"{{banner.url}}\"\n class=\"btn btn-outline-light rounded-0 py-3 px-4 btn-conoce btn-caption-banner\">\n Conocé Mas</a>\n </div>\n </div> -->\n </ng-template>\n </owl-carousel-o>\n </ng-template>\n</section>\n",
|
|
9449
9457
|
styles: [".owl-theme .owl-nav{background:0 0!important}.item{position:relative}.item-title{top:30%}.item-title-full{top:50%}.item-subtitle-full{top:60%}.item-subtitle{top:40%}.item-button{top:60%}.item-button.item-position-vertical-center{left:50%;transform:translate(-50%)}.item-button.item-position-vertical-left{left:10%}.item-button.item-position-vertical-right{right:5%;transform:translate(-50%)}.item-button-full{top:70%}.item-button-full.item-position-vertical-center{left:50%;transform:translate(-50%)}.item-button-full.item-position-vertical-left{left:10%}.item-button-full.item-position-vertical-right{right:5%;transform:translate(-50%)}.item-position-vertical-left{text-align:left}.item-position-vertical-center{text-align:center}.item-position-vertical-right{text-align:right}h2.item-title-full::after{content:none}"]
|
|
9450
9458
|
})
|
|
9451
9459
|
], BlockBannerFullEcComponent);
|
|
@@ -27130,19 +27138,20 @@
|
|
|
27130
27138
|
return ParamsContext;
|
|
27131
27139
|
}());
|
|
27132
27140
|
var AddActionRedirectDirective = /** @class */ (function () {
|
|
27133
|
-
function AddActionRedirectDirective(document, elementRef, renderer, blocksService, router) {
|
|
27134
|
-
var _this = this;
|
|
27141
|
+
function AddActionRedirectDirective(document, elementRef, renderer, blocksService, router, locationStrategy) {
|
|
27135
27142
|
this.document = document;
|
|
27136
27143
|
this.elementRef = elementRef;
|
|
27137
27144
|
this.renderer = renderer;
|
|
27138
27145
|
this.blocksService = blocksService;
|
|
27139
27146
|
this.router = router;
|
|
27147
|
+
this.locationStrategy = locationStrategy;
|
|
27140
27148
|
this.redirectUrl = '';
|
|
27141
27149
|
this.linstenEvent = null;
|
|
27142
27150
|
this.transparent = true;
|
|
27143
|
-
this.
|
|
27144
|
-
|
|
27145
|
-
|
|
27151
|
+
this.targetManaged = false;
|
|
27152
|
+
this.originalTarget = null;
|
|
27153
|
+
this.relManaged = false;
|
|
27154
|
+
this.originalRel = null;
|
|
27146
27155
|
}
|
|
27147
27156
|
Object.defineProperty(AddActionRedirectDirective.prototype, "ecAddActionRedirect", {
|
|
27148
27157
|
set: function (value) {
|
|
@@ -27168,11 +27177,20 @@
|
|
|
27168
27177
|
AddActionRedirectDirective.prototype.ngOnInit = function () { };
|
|
27169
27178
|
AddActionRedirectDirective.prototype.ngOnChanges = function (changes) {
|
|
27170
27179
|
var _this = this;
|
|
27171
|
-
var _a;
|
|
27180
|
+
var _a, _b, _c;
|
|
27181
|
+
var element = this.elementRef.nativeElement;
|
|
27182
|
+
var target = this.targetManaged ? this.originalTarget : element.getAttribute('target');
|
|
27183
|
+
var rel = this.relManaged ? this.originalRel : element.getAttribute('rel');
|
|
27172
27184
|
if (this.linstenEvent) {
|
|
27173
27185
|
this.linstenEvent();
|
|
27174
27186
|
this.linstenEvent = null;
|
|
27175
27187
|
}
|
|
27188
|
+
this.restoreManagedAttribute('target', this.targetManaged, this.originalTarget);
|
|
27189
|
+
this.restoreManagedAttribute('rel', this.relManaged, this.originalRel);
|
|
27190
|
+
this.targetManaged = false;
|
|
27191
|
+
this.originalTarget = null;
|
|
27192
|
+
this.relManaged = false;
|
|
27193
|
+
this.originalRel = null;
|
|
27176
27194
|
this.transparent && this.renderer.setStyle(this.elementRef.nativeElement, 'color', 'transparent');
|
|
27177
27195
|
(_a = this.classStr) === null || _a === void 0 ? void 0 : _a.split(" ").forEach(function (cl) {
|
|
27178
27196
|
try {
|
|
@@ -27182,23 +27200,126 @@
|
|
|
27182
27200
|
console.log('add class directive -> ', error);
|
|
27183
27201
|
}
|
|
27184
27202
|
});
|
|
27185
|
-
|
|
27203
|
+
var configuredUrl = typeof ((_b = this.banner) === null || _b === void 0 ? void 0 : _b.url) === 'string' ? this.banner.url.trim() : '';
|
|
27204
|
+
var type = typeof ((_c = this.banner) === null || _c === void 0 ? void 0 : _c.redirectionType) === 'string'
|
|
27205
|
+
? this.banner.redirectionType.toLowerCase()
|
|
27206
|
+
: '';
|
|
27207
|
+
var hasConfiguredDestination = false;
|
|
27208
|
+
if (type === 'url') {
|
|
27209
|
+
this.redirectUrl = configuredUrl;
|
|
27210
|
+
hasConfiguredDestination = !!configuredUrl;
|
|
27211
|
+
}
|
|
27212
|
+
else if (type === 'attribute' || type === 'taxon' || type === 'category') {
|
|
27213
|
+
this.redirectUrl = this.blocksService.formUrl(this.banner);
|
|
27214
|
+
}
|
|
27215
|
+
else {
|
|
27216
|
+
// Keep the previous URL-first behavior for legacy payloads without a type.
|
|
27217
|
+
this.redirectUrl = configuredUrl || this.blocksService.formUrl(this.banner);
|
|
27218
|
+
hasConfiguredDestination = !!configuredUrl;
|
|
27219
|
+
}
|
|
27220
|
+
if (!this.redirectUrl || (this.redirectUrl === '/' && !hasConfiguredDestination)) {
|
|
27221
|
+
this.renderer.removeAttribute(element, 'href');
|
|
27222
|
+
return;
|
|
27223
|
+
}
|
|
27186
27224
|
var accessibleLabel = this.getAccessibleLabel();
|
|
27187
27225
|
if (accessibleLabel) {
|
|
27188
27226
|
this.renderer.setAttribute(this.elementRef.nativeElement, 'aria-label', accessibleLabel);
|
|
27189
27227
|
}
|
|
27190
|
-
this.renderer.setProperty(this.elementRef.nativeElement, "href", this.redirectUrl);
|
|
27191
27228
|
if (this.isExternalUrl(this.redirectUrl)) {
|
|
27192
|
-
this.renderer.
|
|
27193
|
-
|
|
27229
|
+
this.renderer.setProperty(element, "href", this.redirectUrl);
|
|
27230
|
+
var effectiveTarget = target === null ? '_blank' : target;
|
|
27231
|
+
if (target === null) {
|
|
27232
|
+
this.renderer.setAttribute(element, "target", "_blank");
|
|
27233
|
+
this.targetManaged = true;
|
|
27234
|
+
this.originalTarget = null;
|
|
27235
|
+
}
|
|
27236
|
+
if (effectiveTarget.trim().toLowerCase() === '_blank') {
|
|
27237
|
+
var relTokens = (rel || '').split(/\s+/).filter(Boolean);
|
|
27238
|
+
var existingRelTokens = relTokens.map(function (token) { return token.toLowerCase(); });
|
|
27239
|
+
if (existingRelTokens.indexOf('noopener') === -1)
|
|
27240
|
+
relTokens.push('noopener');
|
|
27241
|
+
if (existingRelTokens.indexOf('noreferrer') === -1)
|
|
27242
|
+
relTokens.push('noreferrer');
|
|
27243
|
+
var secureRel = relTokens.join(' ');
|
|
27244
|
+
if (secureRel !== rel) {
|
|
27245
|
+
this.renderer.setAttribute(element, "rel", secureRel);
|
|
27246
|
+
this.relManaged = true;
|
|
27247
|
+
this.originalRel = rel;
|
|
27248
|
+
}
|
|
27249
|
+
}
|
|
27194
27250
|
}
|
|
27195
27251
|
else {
|
|
27196
|
-
this.
|
|
27197
|
-
this.renderer.
|
|
27198
|
-
|
|
27199
|
-
|
|
27200
|
-
|
|
27201
|
-
|
|
27252
|
+
var routerUrl_1 = this.toRouterUrl(this.redirectUrl);
|
|
27253
|
+
this.renderer.setProperty(element, "href", this.locationStrategy.prepareExternalUrl(routerUrl_1));
|
|
27254
|
+
if (target === null) {
|
|
27255
|
+
this.linstenEvent = this.renderer.listen(element, 'click', function (evt) {
|
|
27256
|
+
if (!_this.shouldHandleSpaClick(evt))
|
|
27257
|
+
return;
|
|
27258
|
+
evt.preventDefault();
|
|
27259
|
+
_this.router.navigateByUrl(routerUrl_1);
|
|
27260
|
+
});
|
|
27261
|
+
}
|
|
27262
|
+
}
|
|
27263
|
+
};
|
|
27264
|
+
AddActionRedirectDirective.prototype.shouldHandleSpaClick = function (event) {
|
|
27265
|
+
return !event.defaultPrevented && event.button === 0 &&
|
|
27266
|
+
!event.ctrlKey && !event.metaKey && !event.shiftKey && !event.altKey;
|
|
27267
|
+
};
|
|
27268
|
+
AddActionRedirectDirective.prototype.toRouterUrl = function (url) {
|
|
27269
|
+
var routerUrl;
|
|
27270
|
+
if (this.isAbsoluteUrl(url) || url.startsWith('#') || url.startsWith('?')) {
|
|
27271
|
+
var target = new URL(url, this.getDocumentHref());
|
|
27272
|
+
routerUrl = target.pathname + target.search + target.hash;
|
|
27273
|
+
}
|
|
27274
|
+
else {
|
|
27275
|
+
routerUrl = this.router.serializeUrl(this.router.parseUrl(url));
|
|
27276
|
+
}
|
|
27277
|
+
return this.stripBaseHref(routerUrl);
|
|
27278
|
+
};
|
|
27279
|
+
AddActionRedirectDirective.prototype.stripBaseHref = function (url) {
|
|
27280
|
+
var pathEnd = url.search(/[?#]/);
|
|
27281
|
+
var path = pathEnd === -1 ? url : url.substring(0, pathEnd);
|
|
27282
|
+
var suffix = pathEnd === -1 ? '' : url.substring(pathEnd);
|
|
27283
|
+
var baseHref = this.locationStrategy.getBaseHref();
|
|
27284
|
+
if (!baseHref)
|
|
27285
|
+
return url;
|
|
27286
|
+
try {
|
|
27287
|
+
var current = new URL(this.getDocumentHref());
|
|
27288
|
+
var base = new URL(baseHref, current.href);
|
|
27289
|
+
var basePath = base.origin === current.origin ? base.pathname : '';
|
|
27290
|
+
basePath = basePath.replace(/\/index\.html$/i, '').replace(/\/+$/, '');
|
|
27291
|
+
if (!basePath || basePath === '/')
|
|
27292
|
+
return url;
|
|
27293
|
+
if (path === basePath)
|
|
27294
|
+
return '/' + suffix;
|
|
27295
|
+
if (path.indexOf(basePath + '/') === 0) {
|
|
27296
|
+
return path.substring(basePath.length) + suffix;
|
|
27297
|
+
}
|
|
27298
|
+
}
|
|
27299
|
+
catch (e) {
|
|
27300
|
+
// Keep the URL unchanged when the browser cannot resolve the base href.
|
|
27301
|
+
}
|
|
27302
|
+
return url;
|
|
27303
|
+
};
|
|
27304
|
+
AddActionRedirectDirective.prototype.getDocumentHref = function () {
|
|
27305
|
+
var location = this.document && this.document.location;
|
|
27306
|
+
if (location && location.href)
|
|
27307
|
+
return location.href;
|
|
27308
|
+
if (location && location.origin)
|
|
27309
|
+
return location.origin + '/';
|
|
27310
|
+
return 'http://localhost/';
|
|
27311
|
+
};
|
|
27312
|
+
AddActionRedirectDirective.prototype.isAbsoluteUrl = function (url) {
|
|
27313
|
+
return /^[a-z][a-z\d+.-]*:/i.test(url) || url.indexOf('//') === 0;
|
|
27314
|
+
};
|
|
27315
|
+
AddActionRedirectDirective.prototype.restoreManagedAttribute = function (name, managed, originalValue) {
|
|
27316
|
+
if (!managed)
|
|
27317
|
+
return;
|
|
27318
|
+
if (originalValue === null) {
|
|
27319
|
+
this.renderer.removeAttribute(this.elementRef.nativeElement, name);
|
|
27320
|
+
}
|
|
27321
|
+
else {
|
|
27322
|
+
this.renderer.setAttribute(this.elementRef.nativeElement, name, originalValue);
|
|
27202
27323
|
}
|
|
27203
27324
|
};
|
|
27204
27325
|
AddActionRedirectDirective.prototype.getAccessibleLabel = function () {
|
|
@@ -27218,22 +27339,36 @@
|
|
|
27218
27339
|
return ((_k = (_j = this.banner) === null || _j === void 0 ? void 0 : _j.name) === null || _k === void 0 ? void 0 : _k.trim()) || 'Ver más';
|
|
27219
27340
|
};
|
|
27220
27341
|
AddActionRedirectDirective.prototype.isExternalUrl = function (url) {
|
|
27221
|
-
|
|
27222
|
-
if (!url)
|
|
27223
|
-
return false;
|
|
27224
|
-
if (url.startsWith('/') || url.startsWith('#'))
|
|
27342
|
+
if (!url || !this.isAbsoluteUrl(url))
|
|
27225
27343
|
return false;
|
|
27226
27344
|
try {
|
|
27227
|
-
var
|
|
27228
|
-
var target = new URL(url,
|
|
27229
|
-
if (
|
|
27345
|
+
var current = new URL(this.getDocumentHref());
|
|
27346
|
+
var target = new URL(url, current.href);
|
|
27347
|
+
if (target.origin !== current.origin)
|
|
27230
27348
|
return true;
|
|
27231
|
-
return target.
|
|
27349
|
+
return this.isOutsideBaseHref(target.pathname, current);
|
|
27232
27350
|
}
|
|
27233
27351
|
catch (e) {
|
|
27234
27352
|
return true;
|
|
27235
27353
|
}
|
|
27236
27354
|
};
|
|
27355
|
+
AddActionRedirectDirective.prototype.isOutsideBaseHref = function (pathname, current) {
|
|
27356
|
+
var baseHref = this.locationStrategy.getBaseHref();
|
|
27357
|
+
if (!baseHref)
|
|
27358
|
+
return false;
|
|
27359
|
+
try {
|
|
27360
|
+
var base = new URL(baseHref, current.href);
|
|
27361
|
+
if (base.origin !== current.origin)
|
|
27362
|
+
return false;
|
|
27363
|
+
var basePath = base.pathname.replace(/\/index\.html$/i, '').replace(/\/+$/, '');
|
|
27364
|
+
if (!basePath || basePath === '/')
|
|
27365
|
+
return false;
|
|
27366
|
+
return pathname !== basePath && pathname.indexOf(basePath + '/') !== 0;
|
|
27367
|
+
}
|
|
27368
|
+
catch (e) {
|
|
27369
|
+
return false;
|
|
27370
|
+
}
|
|
27371
|
+
};
|
|
27237
27372
|
AddActionRedirectDirective.prototype.ngOnDestroy = function () {
|
|
27238
27373
|
this.linstenEvent && this.linstenEvent();
|
|
27239
27374
|
};
|
|
@@ -27242,7 +27377,8 @@
|
|
|
27242
27377
|
{ type: core.ElementRef },
|
|
27243
27378
|
{ type: core.Renderer2 },
|
|
27244
27379
|
{ type: BlocksService },
|
|
27245
|
-
{ type: router.Router }
|
|
27380
|
+
{ type: router.Router },
|
|
27381
|
+
{ type: common.LocationStrategy }
|
|
27246
27382
|
]; };
|
|
27247
27383
|
__decorate$2a([
|
|
27248
27384
|
core.Input()
|