@ppg_pl/pallete 2.0.9 → 2.0.11

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.
@@ -96,8 +96,10 @@ const MyColorInfo = class {
96
96
  constructor(hostRef) {
97
97
  index$1.registerInstance(this, hostRef);
98
98
  this.closeInfoBox = index$1.createEvent(this, "closeInfoBox", 7);
99
- this.goToProduct = () => {
99
+ this.close = index$1.createEvent(this, "close", 7);
100
+ this.goToProduct = (e) => {
100
101
  var _a;
102
+ e.preventDefault();
101
103
  this.currentColor &&
102
104
  setDataLayer({
103
105
  event: 'GoToProduct',
@@ -105,6 +107,8 @@ const MyColorInfo = class {
105
107
  product: this.product,
106
108
  color: (_a = this.currentColor) === null || _a === void 0 ? void 0 : _a.name,
107
109
  });
110
+ this.getHref();
111
+ this.closeModalHandler();
108
112
  };
109
113
  this.onCloseButtonClick = () => {
110
114
  this.closeInfoBox.emit();
@@ -120,10 +124,12 @@ const MyColorInfo = class {
120
124
  };
121
125
  this.getHref = () => {
122
126
  var _a, _b, _c, _d;
127
+ let link;
123
128
  if (this.baselink) {
124
- return `${this.baselink}/${(_b = (_a = this === null || this === void 0 ? void 0 : this.currentColor.links) === null || _a === void 0 ? void 0 : _a.find((link) => (link === null || link === void 0 ? void 0 : link.shop) === this.shop)) === null || _b === void 0 ? void 0 : _b.path}`;
129
+ link = `${this.baselink}/${(_b = (_a = this === null || this === void 0 ? void 0 : this.currentColor.links) === null || _a === void 0 ? void 0 : _a.find((link) => (link === null || link === void 0 ? void 0 : link.shop) === this.shop)) === null || _b === void 0 ? void 0 : _b.path}`;
125
130
  }
126
- return (_d = (_c = this === null || this === void 0 ? void 0 : this.currentColor.links) === null || _c === void 0 ? void 0 : _c.find((link) => (link === null || link === void 0 ? void 0 : link.shop) === this.shop)) === null || _d === void 0 ? void 0 : _d.path;
131
+ link = (_d = (_c = this === null || this === void 0 ? void 0 : this.currentColor.links) === null || _c === void 0 ? void 0 : _c.find((link) => (link === null || link === void 0 ? void 0 : link.shop) === this.shop)) === null || _d === void 0 ? void 0 : _d.path;
132
+ window.open(link, '_self');
127
133
  };
128
134
  this.capitalizeFirstLetter = (string) => {
129
135
  return string.charAt(0).toUpperCase() + string.slice(1).toLocaleLowerCase();
@@ -137,6 +143,9 @@ const MyColorInfo = class {
137
143
  this.infoBoxWidth = undefined;
138
144
  this.closeImage = 'close.png';
139
145
  }
146
+ closeModalHandler() {
147
+ this.close.emit();
148
+ }
140
149
  render() {
141
150
  var _a;
142
151
  return (index$1.h("div", { class: `boxes__box-content ${this.currentColor.textWhite ? 'boxes__box-content__white' : ''}`, style: {
@@ -144,7 +153,7 @@ const MyColorInfo = class {
144
153
  maxWidth: `${this.infoBoxWidth && this.infoBoxWidth - 4}px`,
145
154
  } }, this.isMobile && index$1.h("img", { class: 'closebtn', onClick: this.onCloseButtonClick, src: index$1.getAssetPath(`./assets/${this.closeImage}`), alt: "closebtn" }), index$1.h("div", { class: "boxes__box-content__info", style: {
146
155
  maxWidth: this.isMobile ? `${this.infoBoxWidth && this.infoBoxWidth - 35}px` : ``,
147
- } }, !this.isMobile && index$1.h("img", { class: 'closebtn', onClick: this.onCloseButtonClick, src: index$1.getAssetPath(`./assets/${this.closeImage}`), alt: "closebtn" }), !this.isMobile && index$1.h("h2", null, this.capitalizeFirstLetter(this.currentColor.name)), !this.isMobile && index$1.h("h4", null, this.currentColor.number), index$1.h("div", { class: "boxes__box-content__info__value" }, index$1.h("div", { class: "boxes__box-content__info__value-product" }, this.isMobile && index$1.h("div", { class: 'divider' }), this.currentColor && ((_a = this.currentColor.links) === null || _a === void 0 ? void 0 : _a.find((link) => (link === null || link === void 0 ? void 0 : link.shop) === this.shop)) && (index$1.h("a", { onClick: this.goToProduct, class: `${this.currentColor.imageInsteadHex ? 'brown' : this.currentColor.buttonInverse ? 'inverse' : ''}`, href: this.getHref() }, "wybierz kolor"))))), index$1.h("div", { class: "boxes__box-content__slider" }, this.renderSliderOrImage())));
156
+ } }, !this.isMobile && index$1.h("img", { class: 'closebtn', onClick: this.onCloseButtonClick, src: index$1.getAssetPath(`./assets/${this.closeImage}`), alt: "closebtn" }), !this.isMobile && index$1.h("h2", null, this.capitalizeFirstLetter(this.currentColor.name)), !this.isMobile && index$1.h("h4", null, this.currentColor.number), index$1.h("div", { class: "boxes__box-content__info__value" }, index$1.h("div", { class: "boxes__box-content__info__value-product" }, this.isMobile && index$1.h("div", { class: 'divider' }), this.currentColor && ((_a = this.currentColor.links) === null || _a === void 0 ? void 0 : _a.find((link) => (link === null || link === void 0 ? void 0 : link.shop) === this.shop)) && (index$1.h("button", { onClick: this.goToProduct, class: `button ${this.currentColor.imageInsteadHex ? 'brown' : this.currentColor.buttonInverse ? 'inverse' : ''}` }, "wybierz kolor"))))), index$1.h("div", { class: "boxes__box-content__slider" }, this.renderSliderOrImage())));
148
157
  }
149
158
  };
150
159