@ppg_pl/tinting 0.0.5 → 0.0.8
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/dist/cjs/{index-0a139db0.js → index-b6962659.js} +51 -4
- package/dist/cjs/index-b6962659.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/modal-header_9.cjs.entry.js +165 -41
- package/dist/cjs/modal-header_9.cjs.entry.js.map +1 -1
- package/dist/cjs/tinting.cjs.js +2 -2
- package/dist/collection/components/colorbox/index.js +18 -1
- package/dist/collection/components/colorbox/index.js.map +1 -1
- package/dist/collection/components/colorinfo/index.js +128 -1
- package/dist/collection/components/colorinfo/index.js.map +1 -1
- package/dist/collection/components/component/index.js +64 -1
- package/dist/collection/components/component/index.js.map +1 -1
- package/dist/collection/components/modal/index.css +176 -1
- package/dist/collection/components/modal/index.js +50 -2
- package/dist/collection/components/modal/index.js.map +1 -1
- package/dist/collection/components/slider/index.css +24 -6
- package/dist/collection/components/slider/index.js +32 -21
- package/dist/collection/components/slider/index.js.map +1 -1
- package/dist/collection/types.js.map +1 -1
- package/dist/collection/utils/index.js +17 -0
- package/dist/collection/utils/index.js.map +1 -1
- package/dist/components/index10.js +4934 -3598
- package/dist/components/index10.js.map +1 -1
- package/dist/components/index11.js +3989 -0
- package/dist/components/index11.js.map +1 -0
- package/dist/components/index4.js +2 -13
- package/dist/components/index4.js.map +1 -1
- package/dist/components/index6.js +28 -27
- package/dist/components/index6.js.map +1 -1
- package/dist/components/index7.js +9 -53
- package/dist/components/index7.js.map +1 -1
- package/dist/components/index8.js +57 -52
- package/dist/components/index8.js.map +1 -1
- package/dist/components/index9.js +124 -5272
- package/dist/components/index9.js.map +1 -1
- package/dist/components/my-backdrop.js +1 -1
- package/dist/components/my-colorbox.js +1 -1
- package/dist/components/my-colorinfo.js +1 -1
- package/dist/components/my-component.js +18 -7
- package/dist/components/my-component.js.map +1 -1
- package/dist/components/my-modal.js +1 -1
- package/dist/components/my-slider.js +1 -1
- package/dist/esm/{index-f3be6531.js → index-cb79645d.js} +51 -4
- package/dist/esm/index-cb79645d.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/modal-header_9.entry.js +165 -41
- package/dist/esm/modal-header_9.entry.js.map +1 -1
- package/dist/esm/tinting.js +3 -3
- package/dist/tinting/p-2730a042.entry.js +15 -0
- package/dist/tinting/p-2730a042.entry.js.map +1 -0
- package/dist/tinting/p-5b9dc044.js +3 -0
- package/dist/tinting/p-5b9dc044.js.map +1 -0
- package/dist/tinting/tinting.esm.js +1 -1
- package/dist/tinting/tinting.esm.js.map +1 -1
- package/dist/types/components/colorbox/index.d.ts +3 -0
- package/dist/types/components/colorinfo/index.d.ts +17 -1
- package/dist/types/components/component/index.d.ts +8 -0
- package/dist/types/components/modal/index.d.ts +6 -1
- package/dist/types/components.d.ts +16 -2
- package/dist/types/types.d.ts +4 -0
- package/dist/types/utils/index.d.ts +6 -0
- package/package.json +3 -2
- package/www/build/p-2730a042.entry.js +15 -0
- package/www/build/p-2730a042.entry.js.map +1 -0
- package/www/build/p-5b9dc044.js +3 -0
- package/www/build/p-5b9dc044.js.map +1 -0
- package/www/build/tinting.esm.js +1 -1
- package/www/build/tinting.esm.js.map +1 -1
- package/www/index.html +76 -12
- package/dist/cjs/index-0a139db0.js.map +0 -1
- package/dist/esm/index-f3be6531.js.map +0 -1
- package/dist/tinting/p-398633de.entry.js +0 -15
- package/dist/tinting/p-398633de.entry.js.map +0 -1
- package/dist/tinting/p-b135c76f.js +0 -3
- package/dist/tinting/p-b135c76f.js.map +0 -1
- package/www/build/p-398633de.entry.js +0 -15
- package/www/build/p-398633de.entry.js.map +0 -1
- package/www/build/p-b135c76f.js +0 -3
- package/www/build/p-b135c76f.js.map +0 -1
package/dist/cjs/tinting.cjs.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-b6962659.js');
|
|
6
6
|
|
|
7
7
|
/*
|
|
8
8
|
Stencil Client Patch Browser v3.1.0 | MIT Licensed | https://stenciljs.com
|
|
@@ -20,7 +20,7 @@ const patchBrowser = () => {
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
patchBrowser().then(options => {
|
|
23
|
-
return index.bootstrapLazy([["modal-header_9.cjs",[[2,"my-component",{"shop":[1],"product":[1],"baselink":[1],"colorname":[1],"show":[32],"readyToClose":[32],"open":[64],"close":[64]},[[0,"readyToCLose","setReadyToCloseHandler"],[0,"close","closeModalHandler"],[0,"onSelectedColorEmit","handleSelectedColor"]]],[0,"my-modal",{"shop":[1],"product":[1],"baselink":[1],"selectedcolor":[1],"arrowDown":[1,"arrow-down"],"chunksNum":[32],"data":[32],"preloader":[32],"loading":[32],"currentColor":[32],"currentIndex":[32],"infoBoxWidth":[32],"boxWidth":[32],"padding":[32],"isMobile":[32],"showRange":[32],"colorCategories":[32],"selectedCategory":[32],"page":[32],"colorIsSelected":[32],"colorsList":[32],"hasMore":[32],"filters":[32],"open":[64]},[[0,"closeInfoBox","closeInfoBoxHandler"],[0,"onCurrentColor","handleEmitColor"],[9,"resize","handleResize"],[0,"colorFamilySelected","handleColorFamilySelected"],[0,"searchColors","searchColorsHandler"]]],[0,"my-backdrop"],[0,"modal-header",{"modalName":[1,"modal-name"],"modalLogo":[1,"modal-logo"],"modalDescription":[1,"modal-description"],"selectedColorFamily":[1,"selected-color-family"],"shop":[1],"productName":[1,"product-name"],"isMobile":[4,"is-mobile"],"closeImage":[1,"close-image"],"productSamples":[16],"colorFamilies":[32]}],[0,"my-colorinfo",{"currentColor":[16],"shop":[1],"product":[1],"baselink":[1],"data":[16],"isMobile":[4,"is-mobile"],"infoBoxWidth":[2,"info-box-width"],"closeImage":[1,"close-image"]}],[0,"my-colorbox",{"color":[1],"name":[1],"shop":[1],"product":[1],"isActive":[4,"is-active"],"isCategoryActive":[4,"is-category-active"],"isImageInsteadHex":[16]}],[2,"my-search",{"productname":[1],"shopname":[1],"isMobile":[4,"is-mobile"],"searchIcon":[1,"search-icon"],"searchText":[32]},[[4,"clearSearchText","clearSearchTextHandler"]]],[2,"my-select",{"options":[16],"placeholder":[1],"isMobile":[4,"is-mobile"],"searchIcon":[1,"search-icon"],"searchText":[32],"filteredOptions":[32],"showDropdown":[32],"selectedValue":[32]},[[4,"clearSearchText","clearSearchTextHandler"]]],[
|
|
23
|
+
return index.bootstrapLazy([["modal-header_9.cjs",[[2,"my-component",{"shop":[1],"product":[1],"baselink":[1],"colorname":[1],"available_testers":[1],"price":[2],"show":[32],"readyToClose":[32],"open":[64],"close":[64]},[[0,"readyToCLose","setReadyToCloseHandler"],[0,"close","closeModalHandler"],[0,"onSelectedColorEmit","handleSelectedColor"],[0,"addToBasket","addToBasketHandler"]]],[0,"my-modal",{"shop":[1],"product":[1],"baselink":[1],"available_testers":[16],"price":[2],"selectedcolor":[1],"arrowDown":[1,"arrow-down"],"chunksNum":[32],"data":[32],"preloader":[32],"loading":[32],"currentColor":[32],"currentIndex":[32],"infoBoxWidth":[32],"boxWidth":[32],"padding":[32],"isMobile":[32],"showRange":[32],"colorCategories":[32],"selectedCategory":[32],"page":[32],"colorIsSelected":[32],"colorsList":[32],"hasMore":[32],"filters":[32],"open":[64]},[[0,"closeInfoBox","closeInfoBoxHandler"],[0,"onCurrentColor","handleEmitColor"],[0,"addToBasket","addToBasketHandler"],[9,"resize","handleResize"],[0,"colorFamilySelected","handleColorFamilySelected"],[0,"searchColors","searchColorsHandler"]]],[0,"my-backdrop"],[0,"modal-header",{"modalName":[1,"modal-name"],"modalLogo":[1,"modal-logo"],"modalDescription":[1,"modal-description"],"selectedColorFamily":[1,"selected-color-family"],"shop":[1],"productName":[1,"product-name"],"isMobile":[4,"is-mobile"],"closeImage":[1,"close-image"],"productSamples":[16],"colorFamilies":[32]}],[0,"my-colorinfo",{"currentColor":[16],"shop":[1],"product":[1],"baselink":[1],"availableTesters":[16],"price":[2],"data":[16],"isMobile":[4,"is-mobile"],"infoBoxWidth":[2,"info-box-width"],"closeImage":[1,"close-image"],"basketStatus":[32]}],[0,"my-colorbox",{"color":[1],"name":[1],"shop":[1],"product":[1],"isActive":[4,"is-active"],"isCategoryActive":[4,"is-category-active"],"isImageInsteadHex":[16]}],[2,"my-search",{"productname":[1],"shopname":[1],"isMobile":[4,"is-mobile"],"searchIcon":[1,"search-icon"],"searchText":[32]},[[4,"clearSearchText","clearSearchTextHandler"]]],[2,"my-select",{"options":[16],"placeholder":[1],"isMobile":[4,"is-mobile"],"searchIcon":[1,"search-icon"],"searchText":[32],"filteredOptions":[32],"showDropdown":[32],"selectedValue":[32]},[[4,"clearSearchText","clearSearchTextHandler"]]],[1,"my-slider",{"slides":[16],"shop":[1],"product":[1],"color":[1]}]]]], options);
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
exports.setNonce = index.setNonce;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { h } from '@stencil/core';
|
|
2
2
|
import { setDataLayer } from '../../gtmUtils';
|
|
3
|
+
import { isVeryLightColor } from '../../utils';
|
|
3
4
|
import { APIURL, accessToken } from '../api';
|
|
4
5
|
export class MyColorBox {
|
|
5
6
|
constructor() {
|
|
@@ -24,6 +25,21 @@ export class MyColorBox {
|
|
|
24
25
|
const blue = parseInt(color[5] + color[6], 16) - 20;
|
|
25
26
|
return `rgb(${red},${green},${blue})`;
|
|
26
27
|
};
|
|
28
|
+
this.isLightSwatch = () => { var _a; return !((_a = this.isImageInsteadHex) === null || _a === void 0 ? void 0 : _a.isImageInsteadHex) && isVeryLightColor(this.color); };
|
|
29
|
+
// Active category keeps its 5px solid border (all active swatches share it, so
|
|
30
|
+
// alignment is consistent). In the normal grid we use an inset box-shadow
|
|
31
|
+
// instead of a border so light swatches gain a visible edge without changing
|
|
32
|
+
// their box size and skewing the grid.
|
|
33
|
+
this.getBorder = () => {
|
|
34
|
+
if (!this.isCategoryActive)
|
|
35
|
+
return '';
|
|
36
|
+
return `5px solid ${this.isLightSwatch() ? '#d9d9d9' : this.darkenColor(this.color)}`;
|
|
37
|
+
};
|
|
38
|
+
this.getBoxShadow = () => {
|
|
39
|
+
if (this.isCategoryActive)
|
|
40
|
+
return '';
|
|
41
|
+
return this.isLightSwatch() ? 'inset 0 0 0 1px #d9d9d9' : '';
|
|
42
|
+
};
|
|
27
43
|
this.color = undefined;
|
|
28
44
|
this.name = undefined;
|
|
29
45
|
this.shop = undefined;
|
|
@@ -38,7 +54,8 @@ export class MyColorBox {
|
|
|
38
54
|
backgroundSize: ((_a = this.isImageInsteadHex) === null || _a === void 0 ? void 0 : _a.isImageInsteadHex) ? 'cover' : '',
|
|
39
55
|
backgroundImage: ((_b = this.isImageInsteadHex) === null || _b === void 0 ? void 0 : _b.isImageInsteadHex) ? `url(${APIURL}/assets/${this.isImageInsteadHex.bigImage}?access_token=${accessToken})` : '',
|
|
40
56
|
background: ((_c = this.isImageInsteadHex) === null || _c === void 0 ? void 0 : _c.isImageInsteadHex) ? this.isImageInsteadHex.bigImage : this.color,
|
|
41
|
-
border: this.
|
|
57
|
+
border: this.getBorder(),
|
|
58
|
+
boxShadow: this.getBoxShadow(),
|
|
42
59
|
} }, h("div", { class: "color-name" }, this.name)));
|
|
43
60
|
}
|
|
44
61
|
static get is() { return "my-colorbox"; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/colorbox/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAM7C,MAAM,OAAO,UAAU;;IAWrB,eAAU,GAAG,GAAG,EAAE;MAChB,IAAI,CAAC,YAAY,GAAG,U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'@stencil/core';\nimport { setDataLayer } from '../../gtmUtils';\nimport { ColorBoxyIsImageInsteadHex } from '../../types';\nimport { isVeryLightColor } from '../../utils';\nimport { APIURL, accessToken } from '../api';\n\n@Component({\n tag: 'my-colorbox',\n styleUrl: 'index.scss',\n})\nexport class MyColorBox {\n private checkTimeout: ReturnType<typeof setTimeout> | undefined;\n\n @Prop() color: string;\n @Prop() name: string;\n @Prop() shop: string;\n @Prop() product: string;\n @Prop() isActive?: boolean;\n @Prop() isCategoryActive?: boolean;\n @Prop() isImageInsteadHex?: ColorBoxyIsImageInsteadHex;\n\n colorCheck = () => {\n this.checkTimeout = setTimeout(() => {\n setDataLayer({\n event: 'ColorCheck',\n shop: this.shop,\n product: this.product,\n color: this.name,\n });\n }, 2000);\n };\n\n colorUnCheck = () => {\n if (this.checkTimeout) clearTimeout(this.checkTimeout);\n this.checkTimeout = undefined;\n };\n\n darkenColor = (color: string) => {\n const red = parseInt(color[1] + color[2], 16) - 20;\n const green = parseInt(color[3] + color[4], 16) - 20;\n const blue = parseInt(color[5] + color[6], 16) - 20;\n return `rgb(${red},${green},${blue})`;\n };\n\n private isLightSwatch = () => !this.isImageInsteadHex?.isImageInsteadHex && isVeryLightColor(this.color);\n\n // Active category keeps its 5px solid border (all active swatches share it, so\n // alignment is consistent). In the normal grid we use an inset box-shadow\n // instead of a border so light swatches gain a visible edge without changing\n // their box size and skewing the grid.\n private getBorder = () => {\n if (!this.isCategoryActive) return '';\n return `5px solid ${this.isLightSwatch() ? '#d9d9d9' : this.darkenColor(this.color)}`;\n };\n\n private getBoxShadow = () => {\n if (this.isCategoryActive) return '';\n return this.isLightSwatch() ? 'inset 0 0 0 1px #d9d9d9' : '';\n };\n\n render() {\n return (\n <div\n onMouseEnter={() => this.colorCheck()}\n onMouseLeave={() => this.colorUnCheck()}\n class={`my-color-box ${this.isActive ? 'active' : ''} ${this.isCategoryActive ? 'categoryactive' : ''}`}\n style={{\n backgroundSize: this.isImageInsteadHex?.isImageInsteadHex ? 'cover' : '',\n backgroundImage: this.isImageInsteadHex?.isImageInsteadHex ? `url(${APIURL}/assets/${this.isImageInsteadHex.bigImage}?access_token=${accessToken})` : '',\n background: this.isImageInsteadHex?.isImageInsteadHex ? this.isImageInsteadHex.bigImage : this.color,\n border: this.getBorder(),\n boxShadow: this.getBoxShadow(),\n }}\n >\n <div class=\"color-name\">{this.name}</div>\n </div>\n );\n }\n}\n"]}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { h, getAssetPath } from '@stencil/core';
|
|
2
2
|
import { setDataLayer } from '../../gtmUtils';
|
|
3
|
+
import { isVeryLightColor } from '../../utils';
|
|
3
4
|
import { APIURL, accessToken } from '../api';
|
|
4
5
|
export class MyColorInfo {
|
|
5
6
|
constructor() {
|
|
7
|
+
this.loadingTimeout = null;
|
|
8
|
+
this.successTimeout = null;
|
|
6
9
|
this.goToProduct = () => {
|
|
7
10
|
var _a;
|
|
8
11
|
this.onCurrentColor.emit(this.currentColor);
|
|
@@ -18,6 +21,13 @@ export class MyColorInfo {
|
|
|
18
21
|
this.onCloseButtonClick = () => {
|
|
19
22
|
this.closeInfoBox.emit();
|
|
20
23
|
};
|
|
24
|
+
this.getHref = () => {
|
|
25
|
+
var _a, _b, _c, _d;
|
|
26
|
+
if (this.baselink) {
|
|
27
|
+
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}`;
|
|
28
|
+
}
|
|
29
|
+
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;
|
|
30
|
+
};
|
|
21
31
|
this.renderSliderOrImage = () => {
|
|
22
32
|
var _a;
|
|
23
33
|
if (this.currentColor.imageInsteadHex) {
|
|
@@ -30,22 +40,76 @@ export class MyColorInfo {
|
|
|
30
40
|
this.capitalizeFirstLetter = (string) => {
|
|
31
41
|
return string.charAt(0).toUpperCase() + string.slice(1).toLocaleLowerCase();
|
|
32
42
|
};
|
|
43
|
+
this.isVeryLightBackground = () => {
|
|
44
|
+
if (this.currentColor.imageInsteadHex)
|
|
45
|
+
return true;
|
|
46
|
+
return isVeryLightColor(this.currentColor.hex);
|
|
47
|
+
};
|
|
48
|
+
this.getButtonClass = () => {
|
|
49
|
+
if (this.currentColor.imageInsteadHex)
|
|
50
|
+
return 'brown';
|
|
51
|
+
return this.isVeryLightBackground() ? 'inverse' : '';
|
|
52
|
+
};
|
|
53
|
+
this.handleAddToBasket = () => {
|
|
54
|
+
var _a;
|
|
55
|
+
if (!((_a = this.availableTesters) === null || _a === void 0 ? void 0 : _a.id_product_attribute))
|
|
56
|
+
return;
|
|
57
|
+
if (this.basketStatus !== 'idle')
|
|
58
|
+
return;
|
|
59
|
+
this.clearBasketTimeouts();
|
|
60
|
+
this.basketStatus = 'loading';
|
|
61
|
+
this.addToBasket.emit({
|
|
62
|
+
id: this.availableTesters.id_product_attribute,
|
|
63
|
+
});
|
|
64
|
+
this.loadingTimeout = setTimeout(() => {
|
|
65
|
+
this.basketStatus = 'success';
|
|
66
|
+
this.successTimeout = setTimeout(() => {
|
|
67
|
+
this.basketStatus = 'idle';
|
|
68
|
+
}, 2500);
|
|
69
|
+
}, 900);
|
|
70
|
+
};
|
|
33
71
|
this.currentColor = undefined;
|
|
34
72
|
this.shop = undefined;
|
|
35
73
|
this.product = undefined;
|
|
36
74
|
this.baselink = undefined;
|
|
75
|
+
this.availableTesters = undefined;
|
|
76
|
+
this.price = undefined;
|
|
37
77
|
this.data = null;
|
|
38
78
|
this.isMobile = false;
|
|
39
79
|
this.infoBoxWidth = undefined;
|
|
40
80
|
this.closeImage = 'close.png';
|
|
81
|
+
this.basketStatus = 'idle';
|
|
82
|
+
}
|
|
83
|
+
onColorChange(newColor, oldColor) {
|
|
84
|
+
if ((newColor === null || newColor === void 0 ? void 0 : newColor.name) === (oldColor === null || oldColor === void 0 ? void 0 : oldColor.name))
|
|
85
|
+
return;
|
|
86
|
+
this.resetBasketStatus();
|
|
87
|
+
}
|
|
88
|
+
disconnectedCallback() {
|
|
89
|
+
this.clearBasketTimeouts();
|
|
90
|
+
}
|
|
91
|
+
clearBasketTimeouts() {
|
|
92
|
+
if (this.loadingTimeout) {
|
|
93
|
+
clearTimeout(this.loadingTimeout);
|
|
94
|
+
this.loadingTimeout = null;
|
|
95
|
+
}
|
|
96
|
+
if (this.successTimeout) {
|
|
97
|
+
clearTimeout(this.successTimeout);
|
|
98
|
+
this.successTimeout = null;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
resetBasketStatus() {
|
|
102
|
+
this.clearBasketTimeouts();
|
|
103
|
+
this.basketStatus = 'idle';
|
|
41
104
|
}
|
|
42
105
|
render() {
|
|
106
|
+
var _a;
|
|
43
107
|
return (h("div", { class: `boxes__box-content ${this.currentColor.textWhite ? 'boxes__box-content__white' : ''}`, style: {
|
|
44
108
|
background: this.currentColor.imageInsteadHex ? 'white' : this.currentColor.hex,
|
|
45
109
|
maxWidth: `${this.infoBoxWidth && this.infoBoxWidth - 4}px`,
|
|
46
110
|
} }, this.isMobile && h("img", { class: 'closebtn', onClick: this.onCloseButtonClick, src: getAssetPath(`./assets/${this.closeImage}`), alt: "closebtn" }), h("div", { class: "boxes__box-content__info", style: {
|
|
47
111
|
maxWidth: this.isMobile ? `${this.infoBoxWidth && this.infoBoxWidth - 35}px` : ``,
|
|
48
|
-
} }, !this.isMobile && h("img", { class: 'closebtn', onClick: this.onCloseButtonClick, src: getAssetPath(`./assets/${this.closeImage}`), alt: "closebtn" }), h("h2", null, this.currentColor.name), !this.isMobile && h("h4", null, this.currentColor.number), h("div", { class: "boxes__box-content__info__value" }, h("div", { class: "boxes__box-
|
|
112
|
+
} }, !this.isMobile && h("img", { class: 'closebtn', onClick: this.onCloseButtonClick, src: getAssetPath(`./assets/${this.closeImage}`), alt: "closebtn" }), h("h2", null, this.currentColor.name), !this.isMobile && h("h4", null, this.currentColor.number), h("div", { class: "boxes__box-content__info__value" }, h("div", { class: "divider" }), h("div", { class: "boxes__box-content__info__tester" }, h("div", { class: "divider" }), h("div", { class: "tester-text" }, h("h2", null, "Zamow tester"), h("p", null, "Sprawdz go na swojej scianie.")), h("div", { class: "tester-buy" }, h("div", { class: "price" }, this.price ? `${this.price} zl` : ''), this.isMobile && h("div", { class: 'divider' }), this.basketStatus !== 'success' && (h("button", { class: `button fit ${this.getButtonClass()} ${!this.availableTesters ? 'disabled' : ''} ${this.basketStatus === 'loading' ? 'is-loading' : ''}`, onClick: this.handleAddToBasket, disabled: !this.availableTesters || this.basketStatus === 'loading' }, h("span", { class: "button-content" }, h("span", { class: "shape-icon", "aria-hidden": "true" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "15", height: "16", viewBox: "0 0 15 16" }, h("path", { class: "shape-icon__path", transform: "translate(0.0867462 0)", d: "M13.246571 12.763281L11.931726 4.961875C11.801879 4.1936703 11.13567 3.6319427 10.35657 3.63375L9.7429771 3.63375L9.7429771 3.1025C9.7429771 1.3890365 8.35394 0 6.6404767 0C4.9270134 0 3.537977 1.3890365 3.537977 3.1025L3.537977 3.63375L2.9217269 3.63375C2.1426277 3.6319427 1.4764187 4.1936703 1.3465706 4.961875L0.034383144 12.763281C-0.086738147 13.483807 0.11555123 14.221112 0.58740741 14.778946C1.0592636 15.336781 1.7528107 15.658594 2.4834456 15.658594L10.797508 15.658594C11.528143 15.658594 12.22169 15.336781 12.693546 14.778946C13.165402 14.221112 13.367692 13.483807 13.246571 12.763281L13.246571 12.763281ZM4.3348517 3.0892186C4.3348517 1.8158572 5.3671155 0.78359371 6.6404767 0.78359371C7.9138384 0.78359371 8.9461021 1.8158572 8.9461021 3.0892186L8.9461021 3.6204686L4.3348517 3.6204686L4.3348517 3.0892186ZM12.08579 14.264063C11.765244 14.643165 11.293964 14.86172 10.797508 14.86172L2.4834456 14.86172C1.9871488 14.862442 1.5158025 14.644215 1.195269 14.265309C0.87473541 13.886404 0.73765546 13.385406 0.82063317 12.896093L2.1248519 5.092031C2.1891608 4.703371 2.5278175 4.4200282 2.9217269 4.4252396L3.5353208 4.4252396L3.5353208 5.5834374C3.5353208 5.8034883 3.7137072 5.9818749 3.9337583 5.9818749C4.1538091 5.9818749 4.3321958 5.8034883 4.3321958 5.5834374L4.3321958 4.4252396L8.9461021 4.4252396L8.9461021 5.5834374C8.9461021 5.8034883 9.1244888 5.9818749 9.3445396 5.9818749C9.5645905 5.9818749 9.7429771 5.8034883 9.7429771 5.5834374L9.7429771 4.4252396L10.359227 4.4252396C10.753137 4.4200282 11.091793 4.703371 11.156102 5.092031L12.46032 12.896093C12.542204 13.384947 12.40527 13.885097 12.08579 14.264063L12.08579 14.264063Z" }))), !this.availableTesters ? 'Tester obecnie niedostepny' : 'Dodaj do koszyka'), this.basketStatus === 'loading' && (h("span", { class: "spinner", "aria-hidden": "true" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24" }, h("path", { d: "M12 2 A10 10 0 1 1 2 12", fill: "none", stroke: "currentColor", "stroke-width": "2.5", "stroke-linecap": "round" })))))), this.basketStatus === 'success' && (h("div", { class: `basket-status basket-status--success ${this.getButtonClass()}`, role: "status", "aria-live": "polite" }, h("span", { class: "check-icon", "aria-hidden": "true" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24" }, h("path", { d: "M5 12.5l4.5 4.5L19 7.5", fill: "none", stroke: "currentColor", "stroke-width": "2.5", "stroke-linecap": "round", "stroke-linejoin": "round" }))), h("span", null, h("strong", null, "Dodano"), " do koszyka"))))), h("div", { class: "boxes__box-content__info__value-product" }, 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)) && (h("a", { onClick: this.goToProduct, href: this.getHref(), class: `button ${this.getButtonClass()}` }, "wybierz kolor"))))), h("div", { class: "boxes__box-content__slider" }, this.renderSliderOrImage())));
|
|
49
113
|
}
|
|
50
114
|
static get is() { return "my-colorinfo"; }
|
|
51
115
|
static get properties() {
|
|
@@ -121,6 +185,43 @@ export class MyColorInfo {
|
|
|
121
185
|
"attribute": "baselink",
|
|
122
186
|
"reflect": false
|
|
123
187
|
},
|
|
188
|
+
"availableTesters": {
|
|
189
|
+
"type": "unknown",
|
|
190
|
+
"mutable": false,
|
|
191
|
+
"complexType": {
|
|
192
|
+
"original": "AvailableTester | null",
|
|
193
|
+
"resolved": "null | { id_product_attribute: number; color_name: string; }",
|
|
194
|
+
"references": {
|
|
195
|
+
"AvailableTester": {
|
|
196
|
+
"location": "import",
|
|
197
|
+
"path": "../../types"
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
"required": false,
|
|
202
|
+
"optional": false,
|
|
203
|
+
"docs": {
|
|
204
|
+
"tags": [],
|
|
205
|
+
"text": ""
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
"price": {
|
|
209
|
+
"type": "number",
|
|
210
|
+
"mutable": false,
|
|
211
|
+
"complexType": {
|
|
212
|
+
"original": "number | null",
|
|
213
|
+
"resolved": "null | number",
|
|
214
|
+
"references": {}
|
|
215
|
+
},
|
|
216
|
+
"required": false,
|
|
217
|
+
"optional": false,
|
|
218
|
+
"docs": {
|
|
219
|
+
"tags": [],
|
|
220
|
+
"text": ""
|
|
221
|
+
},
|
|
222
|
+
"attribute": "price",
|
|
223
|
+
"reflect": false
|
|
224
|
+
},
|
|
124
225
|
"data": {
|
|
125
226
|
"type": "unknown",
|
|
126
227
|
"mutable": false,
|
|
@@ -197,6 +298,11 @@ export class MyColorInfo {
|
|
|
197
298
|
}
|
|
198
299
|
};
|
|
199
300
|
}
|
|
301
|
+
static get states() {
|
|
302
|
+
return {
|
|
303
|
+
"basketStatus": {}
|
|
304
|
+
};
|
|
305
|
+
}
|
|
200
306
|
static get events() {
|
|
201
307
|
return [{
|
|
202
308
|
"method": "onCurrentColor",
|
|
@@ -218,6 +324,21 @@ export class MyColorInfo {
|
|
|
218
324
|
}
|
|
219
325
|
}
|
|
220
326
|
}
|
|
327
|
+
}, {
|
|
328
|
+
"method": "addToBasket",
|
|
329
|
+
"name": "addToBasket",
|
|
330
|
+
"bubbles": true,
|
|
331
|
+
"cancelable": true,
|
|
332
|
+
"composed": true,
|
|
333
|
+
"docs": {
|
|
334
|
+
"tags": [],
|
|
335
|
+
"text": ""
|
|
336
|
+
},
|
|
337
|
+
"complexType": {
|
|
338
|
+
"original": "{ id: number }",
|
|
339
|
+
"resolved": "{ id: number; }",
|
|
340
|
+
"references": {}
|
|
341
|
+
}
|
|
221
342
|
}, {
|
|
222
343
|
"method": "closeInfoBox",
|
|
223
344
|
"name": "closeInfoBox",
|
|
@@ -235,5 +356,11 @@ export class MyColorInfo {
|
|
|
235
356
|
}
|
|
236
357
|
}];
|
|
237
358
|
}
|
|
359
|
+
static get watchers() {
|
|
360
|
+
return [{
|
|
361
|
+
"propName": "currentColor",
|
|
362
|
+
"methodName": "onColorChange"
|
|
363
|
+
}];
|
|
364
|
+
}
|
|
238
365
|
}
|
|
239
366
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/colorinfo/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,YAAY,EAAE,KAAK,EAAgB,MAAM,eAAe,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAK7C,MAAM,OAAO,WAAW;;IAatB,gBAAW,GAAG,GAAG,EAAE;;MACjB,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IA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C,YAAY,CAAC,eAAe,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,oBAE3I,CACV,CACG,CACF,CACF;MACN,WAAK,KAAK,EAAC,4BAA4B,IAAE,IAAI,CAAC,mBAAmB,EAAE,CAAO,CACtE,CACP,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, h, getAssetPath, Event, EventEmitter } from '@stencil/core';\nimport { setDataLayer } from '../../gtmUtils';\nimport { Color, Product } from '../../types';\nimport { APIURL, accessToken } from '../api';\n\n@Component({\n tag: 'my-colorinfo',\n})\nexport class MyColorInfo {\n @Prop() currentColor: Color;\n @Prop() shop: string;\n @Prop() product: string;\n @Prop() baselink: string;\n @Prop() data: Product | null = null;\n @Prop() isMobile: boolean = false;\n @Prop() infoBoxWidth: number | null;\n @Prop() closeImage = 'close.png';\n @Event({ bubbles: true, composed: true }) onCurrentColor: EventEmitter<Color>;\n\n @Event() closeInfoBox: EventEmitter;\n\n goToProduct = () => {\n this.onCurrentColor.emit(this.currentColor);\n this.currentColor &&\n setDataLayer({\n event: 'GoToProduct',\n shop: this.shop,\n product: this.product,\n color: this.currentColor?.name,\n });\n\n this.closeInfoBox.emit();\n };\n\n onCloseButtonClick = () => {\n this.closeInfoBox.emit();\n };\n\n renderSliderOrImage = () => {\n if (this.currentColor.imageInsteadHex) {\n return <img class={'color-big-image'} src={`${APIURL}/assets/${this.currentColor.bigImage}?access_token=${accessToken}`} alt=\"color-image\" />;\n } else {\n return <my-slider color={this.currentColor.name} shop={this.shop} product={this.product} slides={this.data?.images}></my-slider>;\n }\n };\n\n capitalizeFirstLetter = (string: string) => {\n return string.charAt(0).toUpperCase() + string.slice(1).toLocaleLowerCase();\n };\n\n render() {\n return (\n <div\n class={`boxes__box-content ${this.currentColor.textWhite ? 'boxes__box-content__white' : ''}`}\n style={{\n background: this.currentColor.imageInsteadHex ? 'white' : this.currentColor.hex,\n maxWidth: `${this.infoBoxWidth && this.infoBoxWidth - 4}px`,\n }}\n >\n {this.isMobile && <img class={'closebtn'} onClick={this.onCloseButtonClick} src={getAssetPath(`./assets/${this.closeImage}`)} alt=\"closebtn\" />}\n <div\n class=\"boxes__box-content__info\"\n style={{\n maxWidth: this.isMobile ? `${this.infoBoxWidth && this.infoBoxWidth - 35}px` : ``,\n }}\n >\n {!this.isMobile && <img class={'closebtn'} onClick={this.onCloseButtonClick} src={getAssetPath(`./assets/${this.closeImage}`)} alt=\"closebtn\" />}\n <h2>{this.currentColor.name}</h2>\n {!this.isMobile && <h4>{this.currentColor.number}</h4>}\n\n <div class=\"boxes__box-content__info__value\">\n {/* <div class=\"boxes__box-content__info__value-image\">\n {this.currentColor?.image! && <img src={`${APIURL}/assets/${this.currentColor.image}?access_token=${accessToken}`} alt=\"color-image\" />}\n </div> */}\n <div class=\"boxes__box-content__info__value-product\">\n {/* <div>\n {!this.isMobile && <p>Produkt:</p>}\n {this.isMobile && <h2>{this.currentColor?.name}</h2>} <p>{this.product}</p>\n </div> */}\n\n {this.isMobile && <div class={'divider'}></div>}\n {this.currentColor && (\n <button onClick={this.goToProduct} class={`button ${this.currentColor.imageInsteadHex ? 'brown' : this.currentColor.buttonInverse ? 'inverse' : ''}`}>\n wybierz kolor\n </button>\n )}\n </div>\n </div>\n </div>\n <div class=\"boxes__box-content__slider\">{this.renderSliderOrImage()}</div>\n </div>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/colorinfo/index.tsx"],"names":[],"mappings":"A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AAU,IAAI,CAAC,cAAc,EAAE,EAAE,oBAExF,CACL,CACG,CACF,CACF;MACN,WAAK,KAAK,EAAC,4BAA4B,IAAE,IAAI,CAAC,mBAAmB,EAAE,CAAO,CACtE,CACP,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, State, Watch, h, getAssetPath, Event, EventEmitter } from '@stencil/core';\nimport { setDataLayer } from '../../gtmUtils';\nimport { AvailableTester, Color, Link, Product } from '../../types';\nimport { isVeryLightColor } from '../../utils';\nimport { APIURL, accessToken } from '../api';\n\n@Component({\n tag: 'my-colorinfo',\n})\nexport class MyColorInfo {\n @Prop() currentColor: Color;\n @Prop() shop: string;\n @Prop() product: string;\n @Prop() baselink: string;\n @Prop() availableTesters: AvailableTester | null;\n @Prop() price: number | null;\n @Prop() data: Product | null = null;\n @Prop() isMobile: boolean = false;\n @Prop() infoBoxWidth: number | null;\n @Prop() closeImage = 'close.png';\n @State() basketStatus: 'idle' | 'loading' | 'success' = 'idle';\n private loadingTimeout: ReturnType<typeof setTimeout> | null = null;\n private successTimeout: ReturnType<typeof setTimeout> | null = null;\n @Event({ bubbles: true, composed: true }) onCurrentColor: EventEmitter<Color>;\n @Event({ bubbles: true, composed: true }) addToBasket: EventEmitter<{ id: number }>;\n\n @Event() closeInfoBox: EventEmitter;\n\n @Watch('currentColor')\n onColorChange(newColor: Color, oldColor: Color) {\n if (newColor?.name === oldColor?.name) return;\n this.resetBasketStatus();\n }\n\n disconnectedCallback() {\n this.clearBasketTimeouts();\n }\n\n private clearBasketTimeouts() {\n if (this.loadingTimeout) {\n clearTimeout(this.loadingTimeout);\n this.loadingTimeout = null;\n }\n\n if (this.successTimeout) {\n clearTimeout(this.successTimeout);\n this.successTimeout = null;\n }\n }\n\n private resetBasketStatus() {\n this.clearBasketTimeouts();\n this.basketStatus = 'idle';\n }\n\n goToProduct = () => {\n this.onCurrentColor.emit(this.currentColor);\n this.currentColor &&\n setDataLayer({\n event: 'GoToProduct',\n shop: this.shop,\n product: this.product,\n color: this.currentColor?.name,\n });\n\n this.closeInfoBox.emit();\n };\n\n onCloseButtonClick = () => {\n this.closeInfoBox.emit();\n };\n\n getHref = () => {\n if (this.baselink) {\n return `${this.baselink}/${this?.currentColor.links?.find((link: Link) => link?.shop === this.shop)?.path}`;\n }\n return this?.currentColor.links?.find((link: Link) => link?.shop === this.shop)?.path;\n };\n\n renderSliderOrImage = () => {\n if (this.currentColor.imageInsteadHex) {\n return <img class={'color-big-image'} src={`${APIURL}/assets/${this.currentColor.bigImage}?access_token=${accessToken}`} alt=\"color-image\" />;\n } else {\n return <my-slider color={this.currentColor.name} shop={this.shop} product={this.product} slides={this.data?.images}></my-slider>;\n }\n };\n\n capitalizeFirstLetter = (string: string) => {\n return string.charAt(0).toUpperCase() + string.slice(1).toLocaleLowerCase();\n };\n\n isVeryLightBackground = (): boolean => {\n if (this.currentColor.imageInsteadHex) return true;\n return isVeryLightColor(this.currentColor.hex);\n };\n\n getButtonClass = () => {\n if (this.currentColor.imageInsteadHex) return 'brown';\n return this.isVeryLightBackground() ? 'inverse' : '';\n };\n\n handleAddToBasket = () => {\n if (!this.availableTesters?.id_product_attribute) return;\n if (this.basketStatus !== 'idle') return;\n\n this.clearBasketTimeouts();\n this.basketStatus = 'loading';\n this.addToBasket.emit({\n id: this.availableTesters.id_product_attribute,\n });\n\n this.loadingTimeout = setTimeout(() => {\n this.basketStatus = 'success';\n this.successTimeout = setTimeout(() => {\n this.basketStatus = 'idle';\n }, 2500);\n }, 900);\n };\n\n render() {\n return (\n <div\n class={`boxes__box-content ${this.currentColor.textWhite ? 'boxes__box-content__white' : ''}`}\n style={{\n background: this.currentColor.imageInsteadHex ? 'white' : this.currentColor.hex,\n maxWidth: `${this.infoBoxWidth && this.infoBoxWidth - 4}px`,\n }}\n >\n {this.isMobile && <img class={'closebtn'} onClick={this.onCloseButtonClick} src={getAssetPath(`./assets/${this.closeImage}`)} alt=\"closebtn\" />}\n <div\n class=\"boxes__box-content__info\"\n style={{\n maxWidth: this.isMobile ? `${this.infoBoxWidth && this.infoBoxWidth - 35}px` : ``,\n }}\n >\n {!this.isMobile && <img class={'closebtn'} onClick={this.onCloseButtonClick} src={getAssetPath(`./assets/${this.closeImage}`)} alt=\"closebtn\" />}\n <h2>{this.currentColor.name}</h2>\n {!this.isMobile && <h4>{this.currentColor.number}</h4>}\n\n <div class=\"boxes__box-content__info__value\">\n <div class=\"divider\"></div>\n <div class=\"boxes__box-content__info__tester\">\n <div class=\"divider\"></div>\n <div class=\"tester-text\">\n <h2>Zamow tester</h2>\n <p>Sprawdz go na swojej scianie.</p>\n </div>\n <div class=\"tester-buy\">\n <div class=\"price\">{this.price ? `${this.price} zl` : ''}</div>\n {this.isMobile && <div class={'divider'}></div>}\n {this.basketStatus !== 'success' && (\n <button\n class={`button fit ${this.getButtonClass()} ${!this.availableTesters ? 'disabled' : ''} ${\n this.basketStatus === 'loading' ? 'is-loading' : ''\n }`}\n onClick={this.handleAddToBasket}\n disabled={!this.availableTesters || this.basketStatus === 'loading'}\n >\n <span class=\"button-content\">\n <span class=\"shape-icon\" aria-hidden=\"true\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"15\" height=\"16\" viewBox=\"0 0 15 16\">\n <path\n class=\"shape-icon__path\"\n transform=\"translate(0.0867462 0)\"\n d=\"M13.246571 12.763281L11.931726 4.961875C11.801879 4.1936703 11.13567 3.6319427 10.35657 3.63375L9.7429771 3.63375L9.7429771 3.1025C9.7429771 1.3890365 8.35394 0 6.6404767 0C4.9270134 0 3.537977 1.3890365 3.537977 3.1025L3.537977 3.63375L2.9217269 3.63375C2.1426277 3.6319427 1.4764187 4.1936703 1.3465706 4.961875L0.034383144 12.763281C-0.086738147 13.483807 0.11555123 14.221112 0.58740741 14.778946C1.0592636 15.336781 1.7528107 15.658594 2.4834456 15.658594L10.797508 15.658594C11.528143 15.658594 12.22169 15.336781 12.693546 14.778946C13.165402 14.221112 13.367692 13.483807 13.246571 12.763281L13.246571 12.763281ZM4.3348517 3.0892186C4.3348517 1.8158572 5.3671155 0.78359371 6.6404767 0.78359371C7.9138384 0.78359371 8.9461021 1.8158572 8.9461021 3.0892186L8.9461021 3.6204686L4.3348517 3.6204686L4.3348517 3.0892186ZM12.08579 14.264063C11.765244 14.643165 11.293964 14.86172 10.797508 14.86172L2.4834456 14.86172C1.9871488 14.862442 1.5158025 14.644215 1.195269 14.265309C0.87473541 13.886404 0.73765546 13.385406 0.82063317 12.896093L2.1248519 5.092031C2.1891608 4.703371 2.5278175 4.4200282 2.9217269 4.4252396L3.5353208 4.4252396L3.5353208 5.5834374C3.5353208 5.8034883 3.7137072 5.9818749 3.9337583 5.9818749C4.1538091 5.9818749 4.3321958 5.8034883 4.3321958 5.5834374L4.3321958 4.4252396L8.9461021 4.4252396L8.9461021 5.5834374C8.9461021 5.8034883 9.1244888 5.9818749 9.3445396 5.9818749C9.5645905 5.9818749 9.7429771 5.8034883 9.7429771 5.5834374L9.7429771 4.4252396L10.359227 4.4252396C10.753137 4.4200282 11.091793 4.703371 11.156102 5.092031L12.46032 12.896093C12.542204 13.384947 12.40527 13.885097 12.08579 14.264063L12.08579 14.264063Z\"\n />\n </svg>\n </span>\n {!this.availableTesters ? 'Tester obecnie niedostepny' : 'Dodaj do koszyka'}\n </span>\n {this.basketStatus === 'loading' && (\n <span class=\"spinner\" aria-hidden=\"true\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\">\n <path d=\"M12 2 A10 10 0 1 1 2 12\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" />\n </svg>\n </span>\n )}\n </button>\n )}\n {this.basketStatus === 'success' && (\n <div class={`basket-status basket-status--success ${this.getButtonClass()}`} role=\"status\" aria-live=\"polite\">\n <span class=\"check-icon\" aria-hidden=\"true\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\">\n <path d=\"M5 12.5l4.5 4.5L19 7.5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" />\n </svg>\n </span>\n <span>\n <strong>Dodano</strong> do koszyka\n </span>\n </div>\n )}\n </div>\n </div>\n <div class=\"boxes__box-content__info__value-product\">\n {this.currentColor && this.currentColor.links?.find((link: Link) => link?.shop === this.shop) && (\n <a onClick={this.goToProduct} href={this.getHref()} class={`button ${this.getButtonClass()}`}>\n wybierz kolor\n </a>\n )}\n </div>\n </div>\n </div>\n <div class=\"boxes__box-content__slider\">{this.renderSliderOrImage()}</div>\n </div>\n );\n }\n}\n"]}
|
|
@@ -6,6 +6,8 @@ export class MyModalBundle {
|
|
|
6
6
|
this.product = undefined;
|
|
7
7
|
this.baselink = undefined;
|
|
8
8
|
this.colorname = undefined;
|
|
9
|
+
this.available_testers = undefined;
|
|
10
|
+
this.price = undefined;
|
|
9
11
|
this.show = false;
|
|
10
12
|
this.readyToClose = false;
|
|
11
13
|
}
|
|
@@ -25,10 +27,16 @@ export class MyModalBundle {
|
|
|
25
27
|
handleSelectedColor(event) {
|
|
26
28
|
this.onSelectedColor.emit(event.detail);
|
|
27
29
|
}
|
|
30
|
+
addToBasketHandler(event) {
|
|
31
|
+
this.addToBasket.emit(event.detail);
|
|
32
|
+
}
|
|
28
33
|
render() {
|
|
29
34
|
let content = null;
|
|
30
35
|
if (this.show) {
|
|
31
|
-
content = [
|
|
36
|
+
content = [
|
|
37
|
+
h("my-backdrop", null),
|
|
38
|
+
h("my-modal", { shop: this.shop, product: this.product, baselink: this.baselink, selectedcolor: this.colorname, available_testers: this.available_testers ? JSON.parse(this.available_testers) : null, price: this.price }),
|
|
39
|
+
];
|
|
32
40
|
}
|
|
33
41
|
return (h("div", { onClick: () => {
|
|
34
42
|
if (this.readyToClose) {
|
|
@@ -126,6 +134,40 @@ export class MyModalBundle {
|
|
|
126
134
|
},
|
|
127
135
|
"attribute": "colorname",
|
|
128
136
|
"reflect": false
|
|
137
|
+
},
|
|
138
|
+
"available_testers": {
|
|
139
|
+
"type": "string",
|
|
140
|
+
"mutable": false,
|
|
141
|
+
"complexType": {
|
|
142
|
+
"original": "string | null",
|
|
143
|
+
"resolved": "null | string",
|
|
144
|
+
"references": {}
|
|
145
|
+
},
|
|
146
|
+
"required": false,
|
|
147
|
+
"optional": false,
|
|
148
|
+
"docs": {
|
|
149
|
+
"tags": [],
|
|
150
|
+
"text": ""
|
|
151
|
+
},
|
|
152
|
+
"attribute": "available_testers",
|
|
153
|
+
"reflect": false
|
|
154
|
+
},
|
|
155
|
+
"price": {
|
|
156
|
+
"type": "number",
|
|
157
|
+
"mutable": false,
|
|
158
|
+
"complexType": {
|
|
159
|
+
"original": "number | null",
|
|
160
|
+
"resolved": "null | number",
|
|
161
|
+
"references": {}
|
|
162
|
+
},
|
|
163
|
+
"required": false,
|
|
164
|
+
"optional": false,
|
|
165
|
+
"docs": {
|
|
166
|
+
"tags": [],
|
|
167
|
+
"text": ""
|
|
168
|
+
},
|
|
169
|
+
"attribute": "price",
|
|
170
|
+
"reflect": false
|
|
129
171
|
}
|
|
130
172
|
};
|
|
131
173
|
}
|
|
@@ -156,6 +198,21 @@ export class MyModalBundle {
|
|
|
156
198
|
}
|
|
157
199
|
}
|
|
158
200
|
}
|
|
201
|
+
}, {
|
|
202
|
+
"method": "addToBasket",
|
|
203
|
+
"name": "addToBasket",
|
|
204
|
+
"bubbles": true,
|
|
205
|
+
"cancelable": true,
|
|
206
|
+
"composed": true,
|
|
207
|
+
"docs": {
|
|
208
|
+
"tags": [],
|
|
209
|
+
"text": ""
|
|
210
|
+
},
|
|
211
|
+
"complexType": {
|
|
212
|
+
"original": "{ id: number }",
|
|
213
|
+
"resolved": "{ id: number; }",
|
|
214
|
+
"references": {}
|
|
215
|
+
}
|
|
159
216
|
}];
|
|
160
217
|
}
|
|
161
218
|
static get methods() {
|
|
@@ -214,6 +271,12 @@ export class MyModalBundle {
|
|
|
214
271
|
"target": undefined,
|
|
215
272
|
"capture": false,
|
|
216
273
|
"passive": false
|
|
274
|
+
}, {
|
|
275
|
+
"name": "addToBasket",
|
|
276
|
+
"method": "addToBasketHandler",
|
|
277
|
+
"target": undefined,
|
|
278
|
+
"capture": false,
|
|
279
|
+
"passive": false
|
|
217
280
|
}];
|
|
218
281
|
}
|
|
219
282
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/component/index.tsx"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAgB,MAAM,eAAe,CAAC;AAQxG,MAAM,OAAO,aAAa
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/component/index.tsx"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAgB,MAAM,eAAe,CAAC;AAQxG,MAAM,OAAO,aAAa;;;;;;;;gBAWR,KAAK;wBACG,KAAK;;EAG7B,KAAK,CAAC,IAAI;IACR,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;EACnB,CAAC;EAGD,KAAK,CAAC,KAAK;IACT,IAAI,CAAC,IAAI,GA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G,EAAC,KAAK,EAAC,GAAG,EAAC,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAW,CAC9I,CACP,CACP,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import Helmet from '@stencil/helmet';\nimport { Component, Prop, Method, Element, State, Listen, h, Event, EventEmitter } from '@stencil/core';\nimport { Color } from '../../types';\n\n@Component({\n tag: 'my-component',\n styleUrl: 'index.scss',\n scoped: true,\n})\nexport class MyModalBundle {\n @Element() modalEl: HTMLElement;\n @Event({ bubbles: true, composed: true }) onSelectedColor: EventEmitter<Color>;\n @Event({ bubbles: true, composed: true }) addToBasket: EventEmitter<{ id: number }>;\n @Prop() shop: string;\n @Prop() product: string;\n @Prop() baselink: string;\n @Prop() colorname: string | null;\n @Prop() available_testers: string | null;\n @Prop() price: number | null;\n\n @State() show = false;\n @State() readyToClose = false;\n\n @Method()\n async open() {\n this.show = true;\n }\n\n @Method()\n async close() {\n this.show = false;\n }\n\n @Listen('readyToCLose')\n setReadyToCloseHandler(value: CustomEvent) {\n this.readyToClose = value.detail.observable;\n }\n\n @Listen('close')\n closeModalHandler() {\n this.show = false;\n this.readyToClose = false;\n }\n\n @Listen('onSelectedColorEmit')\n handleSelectedColor(event: CustomEvent<Color>) {\n this.onSelectedColor.emit(event.detail);\n }\n\n @Listen('addToBasket')\n addToBasketHandler(event: CustomEvent<{ id: number }>) {\n this.addToBasket.emit(event.detail);\n }\n\n render() {\n let content = null;\n if (this.show) {\n content = [\n <my-backdrop></my-backdrop>,\n <my-modal\n shop={this.shop}\n product={this.product}\n baselink={this.baselink}\n selectedcolor={this.colorname}\n available_testers={this.available_testers ? JSON.parse(this.available_testers) : null}\n price={this.price}\n ></my-modal>,\n ];\n }\n return (\n <div\n onClick={() => {\n if (this.readyToClose) {\n this.closeModalHandler();\n }\n }}\n >\n <Helmet>\n <script>\n {`(function (w, d, s, l, i) {\n w[l] = w[l] || [];\n w[l].push({ 'gtm.start': new Date().getTime(), 'event': 'gtm.js' });\n var f = d.getElementsByTagName(s)[0],\n j = d.createElement(s),\n dl = l != 'dataLayer' ? '&l=' + l : '';\n j.async = true;\n j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;\n f.parentNode.insertBefore(j, f);\n })(window, document, 'script', 'dataLayer', 'GTM-537BV9VT');`}\n </script>\n </Helmet>\n <div class=\"tinting-wrapper\">{content}</div>\n <noscript>\n <iframe src=\"https://www.googletagmanager.com/ns.html?id=GTM-537BV9VT\" height=\"0\" width=\"0\" style={{ display: 'none', visibility: 'hidden' }}></iframe>\n </noscript>\n </div>\n );\n }\n}\n"]}
|