@wizishop/angular-components 15.1.135 → 15.1.137

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.
@@ -4594,7 +4594,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImpor
4594
4594
  }] } });
4595
4595
 
4596
4596
  class AlertPopupComponent {
4597
- constructor() {
4597
+ constructor(elRef, renderer) {
4598
+ this.elRef = elRef;
4599
+ this.renderer = renderer;
4598
4600
  /** Subject for notifying the user that the dialog has finished closing. */
4599
4601
  this.afterClosedPopup = new Subject();
4600
4602
  this.open = false;
@@ -4602,7 +4604,22 @@ class AlertPopupComponent {
4602
4604
  ngOnInit() {
4603
4605
  setTimeout(() => {
4604
4606
  this.open = true;
4605
- }, 50);
4607
+ }, 100);
4608
+ this.observer = new MutationObserver(() => {
4609
+ const alert = document.querySelector('.wac-alert-popup:last-child .alert');
4610
+ if (alert) {
4611
+ const bgColor = getComputedStyle(alert).backgroundColor;
4612
+ const hexColor = this.rgbToHex(bgColor);
4613
+ if ((hexColor === '#2ecc71' || hexColor === '#e95656') && !alert.classList.contains('is-loaded')) {
4614
+ alert.classList.add('is-loaded');
4615
+ this.observer.disconnect();
4616
+ }
4617
+ }
4618
+ });
4619
+ this.observer.observe(document.body, {
4620
+ childList: true,
4621
+ subtree: true
4622
+ });
4606
4623
  if (this.config.duration > 0) {
4607
4624
  this.timer = setTimeout(() => this.dismiss(), this.config.duration);
4608
4625
  }
@@ -4620,15 +4637,29 @@ class AlertPopupComponent {
4620
4637
  afterClosed() {
4621
4638
  return this.afterClosedPopup.asObservable();
4622
4639
  }
4640
+ ngOnDestroy() {
4641
+ this.observer?.disconnect();
4642
+ }
4643
+ rgbToHex(rgb) {
4644
+ const result = rgb.match(/\d+/g);
4645
+ if (!result)
4646
+ return '';
4647
+ const [r, g, b] = result.map(Number);
4648
+ return ('#' +
4649
+ [r, g, b]
4650
+ .map((x) => x.toString(16).padStart(2, '0'))
4651
+ .join('')
4652
+ .toLowerCase());
4653
+ }
4623
4654
  }
4624
- AlertPopupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: AlertPopupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
4655
+ AlertPopupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: AlertPopupComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
4625
4656
  AlertPopupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.5", type: AlertPopupComponent, selector: "wac-alert-popup", host: { classAttribute: "wac-alert-popup" }, ngImport: i0, template: "<div\r\n [class]=\"'alert ' + ((config.color) ? config.color : ' is-primary') + ((config.extraClasses) ? ' ' + config.extraClasses : '') + ((config.position) ? ' ' + config.position : '') + ((config.fullsize) ? ' fullsize' : '') + ((config.opacity) ? ' opacity-active' : '') + ((config.small) ? ' small' : '') + ((config.icon) ? ' with-icon' : '') + ((config.duration) ? '' : ' no-duration')\"\r\n [ngClass]=\"{'is-active': open, 'has-close': config.closeButton}\"\r\n>\r\n <div class=\"alert--message\">\r\n <span class=\"icon\" *ngIf=\"config.icon\">\r\n <i [class]=\"config.icon\"></i>\r\n </span>\r\n <span (click)=\"dismiss()\" class=\"wac-alert-popup__close\" *ngIf=\"!config.small || (config.small && config.closeButton)\"><i class=\"far fa-times\"></i></span>\r\n <p *ngIf=\"config.title\" class=\"wac-alert-popup__title\" [innerHTML]=\"config.title\"></p>\r\n <p *ngIf=\"config.message\" class=\"wac-alert-popup__text\" [innerHTML]=\"config.message\"></p>\r\n </div>\r\n</div>\r\n", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], encapsulation: i0.ViewEncapsulation.None });
4626
4657
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: AlertPopupComponent, decorators: [{
4627
4658
  type: Component,
4628
4659
  args: [{ selector: 'wac-alert-popup', host: {
4629
4660
  class: 'wac-alert-popup'
4630
4661
  }, encapsulation: ViewEncapsulation.None, template: "<div\r\n [class]=\"'alert ' + ((config.color) ? config.color : ' is-primary') + ((config.extraClasses) ? ' ' + config.extraClasses : '') + ((config.position) ? ' ' + config.position : '') + ((config.fullsize) ? ' fullsize' : '') + ((config.opacity) ? ' opacity-active' : '') + ((config.small) ? ' small' : '') + ((config.icon) ? ' with-icon' : '') + ((config.duration) ? '' : ' no-duration')\"\r\n [ngClass]=\"{'is-active': open, 'has-close': config.closeButton}\"\r\n>\r\n <div class=\"alert--message\">\r\n <span class=\"icon\" *ngIf=\"config.icon\">\r\n <i [class]=\"config.icon\"></i>\r\n </span>\r\n <span (click)=\"dismiss()\" class=\"wac-alert-popup__close\" *ngIf=\"!config.small || (config.small && config.closeButton)\"><i class=\"far fa-times\"></i></span>\r\n <p *ngIf=\"config.title\" class=\"wac-alert-popup__title\" [innerHTML]=\"config.title\"></p>\r\n <p *ngIf=\"config.message\" class=\"wac-alert-popup__text\" [innerHTML]=\"config.message\"></p>\r\n </div>\r\n</div>\r\n" }]
4631
- }] });
4662
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }]; } });
4632
4663
 
4633
4664
  class AlertPopupService {
4634
4665
  constructor(domService) {