@ppg_pl/pallete 2.0.20 → 2.0.22

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.
Files changed (41) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/my-backdrop_8.cjs.entry.js +17 -4
  3. package/dist/cjs/my-backdrop_8.cjs.entry.js.map +1 -1
  4. package/dist/cjs/pallete.cjs.js +1 -1
  5. package/dist/collection/components/my-modal/my-modal.js +6 -2
  6. package/dist/collection/components/my-modal/my-modal.js.map +1 -1
  7. package/dist/collection/components/my-search/my-search.js +34 -7
  8. package/dist/collection/components/my-search/my-search.js.map +1 -1
  9. package/dist/components/gtmUtils.js +7 -0
  10. package/dist/components/gtmUtils.js.map +1 -0
  11. package/dist/components/index2.js +1 -5
  12. package/dist/components/index2.js.map +1 -1
  13. package/dist/components/index3.js +2 -1
  14. package/dist/components/index3.js.map +1 -1
  15. package/dist/components/my-colorbox2.js +2 -1
  16. package/dist/components/my-colorbox2.js.map +1 -1
  17. package/dist/components/my-colorinfo2.js +2 -1
  18. package/dist/components/my-colorinfo2.js.map +1 -1
  19. package/dist/components/my-modal2.js +8 -3
  20. package/dist/components/my-modal2.js.map +1 -1
  21. package/dist/components/my-search2.js +14 -3
  22. package/dist/components/my-search2.js.map +1 -1
  23. package/dist/esm/loader.js +1 -1
  24. package/dist/esm/my-backdrop_8.entry.js +17 -4
  25. package/dist/esm/my-backdrop_8.entry.js.map +1 -1
  26. package/dist/esm/pallete.js +1 -1
  27. package/dist/pallete/p-c49a7a8e.entry.js +2 -0
  28. package/dist/pallete/p-c49a7a8e.entry.js.map +1 -0
  29. package/dist/pallete/pallete.esm.js +1 -1
  30. package/dist/pallete/pallete.esm.js.map +1 -1
  31. package/dist/types/components/my-search/my-search.d.ts +2 -1
  32. package/dist/types/components.d.ts +4 -2
  33. package/package.json +1 -1
  34. package/www/build/p-c49a7a8e.entry.js +2 -0
  35. package/www/build/p-c49a7a8e.entry.js.map +1 -0
  36. package/www/build/pallete.esm.js +1 -1
  37. package/www/build/pallete.esm.js.map +1 -1
  38. package/dist/pallete/p-821312c7.entry.js +0 -2
  39. package/dist/pallete/p-821312c7.entry.js.map +0 -1
  40. package/www/build/p-821312c7.entry.js +0 -2
  41. package/www/build/p-821312c7.entry.js.map +0 -1
@@ -20,7 +20,7 @@ const patchBrowser = () => {
20
20
  };
21
21
 
22
22
  patchBrowser().then(options => {
23
- return index.bootstrapLazy([["my-backdrop_8.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,"my-modal",{"shop":[1],"product":[1],"baselink":[1],"selectedcolor":[1],"closeImage":[1,"close-image"],"arrowDown":[1,"arrow-down"],"chunksNum":[32],"data":[32],"preloader":[32],"loading":[32],"colors":[32],"currentColor":[32],"currentIndex":[32],"infoBoxWidth":[32],"boxWidth":[32],"padding":[32],"isMobile":[32],"showRange":[32],"colorCategories":[32],"selectedCategory":[32],"page":[32],"colorIsSelected":[32],"open":[64]},[[0,"closeInfoBox","closeInfoBoxHandler"],[9,"resize","handleResize"],[0,"searchColors","searchColorsHandler"]]],[0,"my-backdrop"],[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-loader"],[2,"my-search",{"productId":[2,"product-id"],"isMobile":[4,"is-mobile"],"searchIcon":[1,"search-icon"],"searchText":[32]},[[4,"clearSearchText","clearSearchTextHandler"]]],[0,"my-slider",{"slides":[16],"shop":[1],"product":[1],"color":[1]}]]]], options);
23
+ return index.bootstrapLazy([["my-backdrop_8.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,"my-modal",{"shop":[1],"product":[1],"baselink":[1],"selectedcolor":[1],"closeImage":[1,"close-image"],"arrowDown":[1,"arrow-down"],"chunksNum":[32],"data":[32],"preloader":[32],"loading":[32],"colors":[32],"currentColor":[32],"currentIndex":[32],"infoBoxWidth":[32],"boxWidth":[32],"padding":[32],"isMobile":[32],"showRange":[32],"colorCategories":[32],"selectedCategory":[32],"page":[32],"colorIsSelected":[32],"open":[64]},[[0,"closeInfoBox","closeInfoBoxHandler"],[9,"resize","handleResize"],[0,"searchColors","searchColorsHandler"]]],[0,"my-backdrop"],[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-loader"],[2,"my-search",{"productname":[1],"shopname":[1],"isMobile":[4,"is-mobile"],"searchIcon":[1,"search-icon"],"searchText":[32]},[[4,"clearSearchText","clearSearchTextHandler"]]],[0,"my-slider",{"slides":[16],"shop":[1],"product":[1],"color":[1]}]]]], options);
24
24
  });
25
25
 
26
26
  exports.setNonce = index.setNonce;
@@ -281,6 +281,10 @@ export class MyModal {
281
281
  componentWillLoad() {
282
282
  this.preloader = true;
283
283
  this.fetchProductData();
284
+ setDataLayer({
285
+ shop: this.shop,
286
+ product: this.product,
287
+ });
284
288
  }
285
289
  componentWillRender() {
286
290
  this.displayForMobile();
@@ -289,8 +293,8 @@ export class MyModal {
289
293
  this.openSeletedColor();
290
294
  }
291
295
  render() {
292
- var _a, _b, _c;
293
- return (h("div", { class: `my-modal`, onMouseEnter: () => this.handleReadyToClose(false), onMouseLeave: () => this.handleReadyToClose(true) }, this.preloader && (h("div", { class: 'loader' }, h("my-loader", null))), !this.preloader && this.data && (h("div", { class: `my-modal__header` }, h("div", { class: "image-wrapper" }, h("img", { src: `${APIURL}/assets/${(_a = this.data) === null || _a === void 0 ? void 0 : _a.modalLogo}?access_token=${accessToken}`, alt: "modal-logo" }), !this.preloader && this.data && (h("p", { class: "my-modal__see-more" }, (_b = this.data) === null || _b === void 0 ? void 0 : _b.modalDescription))), h("div", { class: "search-wrapper" }, !this.preloader && h("my-search", { productId: Number((_c = this.data) === null || _c === void 0 ? void 0 : _c.id), isMobile: this.isMobile }), !this.preloader && (h("button", { class: "my-modal__close", onClick: () => this.closeModalHandler() }, h("img", { src: getAssetPath(`./assets/${this.closeImage}`), alt: "closebtn" })))))), h("div", { class: 'my-modal__wrapper' }, this.loading && h("my-loader", null), !this.loading && this.colors && (h("div", { class: 'container_boxes' }, this.colors.list.length > 0 ? (this.chunks(this.colors.list).map((color, index) => {
296
+ var _a, _b;
297
+ return (h("div", { class: `my-modal`, onMouseEnter: () => this.handleReadyToClose(false), onMouseLeave: () => this.handleReadyToClose(true) }, this.preloader && (h("div", { class: 'loader' }, h("my-loader", null))), !this.preloader && this.data && (h("div", { class: `my-modal__header` }, h("div", { class: "image-wrapper" }, h("img", { src: `${APIURL}/assets/${(_a = this.data) === null || _a === void 0 ? void 0 : _a.modalLogo}?access_token=${accessToken}`, alt: "modal-logo" }), !this.preloader && this.data && (h("p", { class: "my-modal__see-more" }, (_b = this.data) === null || _b === void 0 ? void 0 : _b.modalDescription))), h("div", { class: "search-wrapper" }, !this.preloader && h("my-search", { shopname: this.shop, productname: this.data.name, isMobile: this.isMobile }), !this.preloader && (h("button", { class: "my-modal__close", onClick: () => this.closeModalHandler() }, h("img", { src: getAssetPath(`./assets/${this.closeImage}`), alt: "closebtn" })))))), h("div", { class: 'my-modal__wrapper' }, this.loading && h("my-loader", null), !this.loading && this.colors && (h("div", { class: 'container_boxes' }, this.colors.list.length > 0 ? (this.chunks(this.colors.list).map((color, index) => {
294
298
  var _a;
295
299
  return (h("div", { key: index, class: "boxes" }, h("div", { class: "boxes__list" }, color.map((c) => {
296
300
  var _a;
@@ -1 +1 @@
1
- {"version":3,"file":"my-modal.js","sourceRoot":"","sources":["../../../src/components/my-modal/my-modal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAgB,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC7H,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC7G,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAavC,MAAM,OAAO,OAAO;EAoClB;IAnCQ,oBAAe,GAAG,GAAG,CAAC;IACtB,mBAAc,GAAG,EAAE,CAAC;IACpB,mBAAc,GAAG,EAAE,CAAC;IACpB,kBAAa,GAAG,EAAE,CAAC;IACnB,qBAAgB,GAAG,IAAI,CAAC;IAkDxB,kBAAa,GAAG,GAAG,EAAE;MAC3B,IAAI,CAAC,kBAAkB,IAAI,aAAa,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;MAClE,IAAI,CAAC,kBAAkB,GAAG,SAAS,CAAC;IACtC,CAAC,CAAC;IAEM,eAAU,GAAG,GAAG,EAAE;MACxB,IAAI,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,CAAC,EAAE,EAAE;QAC7C,IAAI,CAAC,kBAAkB,GAAG,WAAW,CAAC,GAAG,EAAE;;UACzC,CAAA,MAAA,IAAI,CAAC,Y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K,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,YAAY,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAC5F,YACE,KAAK,EAAE,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAC3C,OAAO,EAAE,CAAC,CAAC,EAAE;cACX,CAAC,CAAC,cAAc,EAAE,CAAC;cACnB,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YACrB,CAAC,EACD,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,IAEf,CAAC,GAAG,CAAC,CACD,CACR,CAAC,CACE,CACP,CACG,CACP,CACG;MACL,CAAC,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,QAAQ,IAAI,CACnC,cAAQ,KAAK,EAAC,QAAQ,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,iBAAiB,EAAE,cAErD,CACV,CACG,CACP,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Method, Element, Prop, Event, EventEmitter, h, State, getAssetPath, Listen, Watch } from '@stencil/core';\nimport { APIURL, ApiService, accessToken } from '../api';\nimport { setDataLayer } from '../../gtmUtils';\nimport { Color, PaginationData, Product, ProductShopRelation } from '../../types';\nimport { fetchCategoryColorsQuery, fetchColorByName, fetchProductColorsQuery, limit } from '../api/services';\nimport { debounce } from '../../utils';\n\ndeclare global {\n interface Window {\n dataLayer: Record<string, any>[];\n }\n}\n\n@Component({\n tag: 'my-modal',\n styleUrl: 'my-modal.scss',\n assetsDirs: ['assets'],\n})\nexport class MyModal {\n private boxDesktopWidth = 130;\n private boxMobileWidth = 70;\n private desktopPadding = 75;\n private mobilePadding = 35;\n private mediumBreakpoint = 1024;\n private colorTimerInterval: ReturnType<typeof setInterval> | undefined;\n\n @Event({ bubbles: true, composed: true }) clearSearchText: EventEmitter;\n @Element() modalEl: HTMLElement;\n\n @Prop() shop: string;\n @Prop() product: string;\n @Prop() baselink: string;\n @Prop() selectedcolor: string | null;\n @Prop() closeImage = 'close.png';\n @Prop() arrowDown = 'arrow_down.png';\n\n @State() chunksNum = 12;\n @State() data: Product | null = null;\n @State() preloader = false;\n @State() loading = false;\n @State() colors: PaginationData<Color> | null = null;\n @State() currentColor: Color | null = null;\n @State() currentIndex: number | null = null;\n @State() infoBoxWidth: number | null = null;\n @State() boxWidth: number = this.boxDesktopWidth; // box width with gap\n @State() padding: number = this.desktopPadding;\n @State() isMobile: boolean = false;\n @State() showRange: boolean = false;\n @State() colorCategories: string[] | null = null;\n @State() selectedCategory: any = null;\n @State() page = 1;\n @State() colorIsSelected = false;\n debouncedSearchColorsHandler: (event: CustomEvent) => void;\n\n constructor() {\n this.debouncedSearchColorsHandler = debounce(this.searchColor.bind(this), 300);\n }\n\n @Watch('chunksNum')\n setInfoBoxWidth(newValue: number) {\n this.infoBoxWidth = newValue * this.boxWidth;\n }\n\n @Watch('data')\n watchPropHandler(newValue: Product) {\n if (newValue.Category.length > 0) {\n this.showRange = true;\n this.handleCategoryClick(newValue.Category[0].Category_id.id);\n } else {\n this.fetchProductColors(String(newValue.id));\n }\n }\n\n private clearInterval = () => {\n this.colorTimerInterval && clearInterval(this.colorTimerInterval);\n this.colorTimerInterval = undefined;\n };\n\n private colorTimer = () => {\n if (this.currentColor && this.currentColor.id) {\n this.colorTimerInterval = setInterval(() => {\n this.currentColor?.name &&\n setDataLayer({\n event: 'ColorTimer',\n shop: this.shop,\n product: this.product,\n color: this.currentColor?.name,\n timer: '10',\n });\n }, 10000);\n } else {\n this.clearInterval();\n }\n };\n\n @Method()\n async open() {\n this.modalEl.style.display = 'block';\n }\n @Event() close: EventEmitter;\n closeModalHandler() {\n this.close.emit();\n }\n\n @Event() readyToCLose: EventEmitter;\n handleReadyToClose(value: boolean) {\n this.readyToCLose.emit({ observable: value });\n }\n\n @Listen('closeInfoBox')\n closeInfoBoxHandler() {\n this.currentColor = null;\n this.currentIndex = null;\n }\n\n private chunks = (xs: Color[], y: Color[][] = []): Color[][] => {\n return xs.length === 0 ? y : this.chunks(xs.slice(this.chunksNum), y.concat([xs.slice(0, this.chunksNum)]));\n };\n\n private calculateBoxCount = () => {\n const modalWidth = this.modalEl.children && this.modalEl.children[0] && this.modalEl.children[0]?.clientWidth - this.padding;\n const boxWidth = this.boxWidth;\n\n const calc = Math.floor(modalWidth / boxWidth);\n\n const boxesCount = calc;\n\n if (!this.preloader) this.chunksNum = boxesCount;\n };\n\n private displayForMobile = () => {\n if (window.innerWidth < this.mediumBreakpoint) {\n this.boxWidth = this.boxMobileWidth;\n this.padding = this.mobilePadding;\n this.isMobile = true;\n } else {\n this.isMobile = false;\n this.boxWidth = this.boxDesktopWidth;\n this.padding = this.desktopPadding;\n }\n };\n\n @Listen('resize', { target: 'window' })\n handleResize() {\n this.calculateBoxCount();\n this.displayForMobile();\n }\n\n private fetchProductData = async () => {\n try {\n const shopResponse = await ApiService.getData(`items/Shop?filter[name][_eq]=${this.shop}`);\n const shop = shopResponse?.data[0];\n if (shop.id) {\n const response = await ApiService.getData(`items/Product?filter[name][_eq]=${this.product}&fields=*,images.*,Shop.*,Category.*.*.*.*`);\n const product = response?.data[0];\n\n if (product) {\n if (product.Shop.find((s: ProductShopRelation) => s.Shop_id === shop.id)) {\n this.data = {\n ...response.data[0],\n id: response.data[0].id,\n };\n } else {\n return null;\n }\n }\n }\n } catch (error) {\n console.error(error);\n } finally {\n this.preloader = false;\n }\n };\n\n private fetchProductColors = async (id: string, page?: number) => {\n this.loading = true;\n\n try {\n const response = await ApiService.getData(`items/Color?${fetchProductColorsQuery(id, page)}`);\n\n if (response) {\n this.colors = {\n list:\n response &&\n response.data &&\n response.data.map((item: Color) => ({\n ...item,\n })),\n pagination: response.meta,\n };\n }\n } catch (error) {\n console.error(error);\n } finally {\n this.loading = false;\n }\n };\n\n private fetchCategoryColors = async (id: number, page?: number) => {\n this.loading = true;\n\n try {\n const response = await ApiService.getData(`items/Color?${fetchCategoryColorsQuery(id, page)}`);\n\n if (response) {\n this.colors = {\n list:\n response &&\n response.data &&\n response.data.map((item: Color) => ({\n ...item,\n })),\n pagination: response.meta,\n };\n }\n } catch (error) {\n console.error(error);\n } finally {\n this.loading = false;\n }\n };\n\n async searchColor(event: CustomEvent) {\n if (event.detail === '') {\n this.fetchProductData();\n this.loading = true;\n } else {\n if (!this.data?.id) {\n return;\n }\n try {\n const response = await ApiService.getData(`items/Color?${fetchColorByName(this.data?.id, event.detail)}`);\n\n if (response) {\n this.colors = {\n list:\n response &&\n response.data &&\n response.data.map((item: Color) => ({\n ...item,\n })),\n pagination: response.meta,\n };\n }\n } catch (error) {\n console.error(error);\n } finally {\n this.loading = false;\n }\n }\n }\n\n @Listen('searchColors')\n searchColorsHandler(event: CustomEvent) {\n this.loading = true;\n this.currentColor = null;\n this.debouncedSearchColorsHandler(event);\n }\n\n private handleCategoryClick = (color?: number) => {\n if (this.selectedCategory && color && this.selectedCategory === color && !this.showRange) {\n this.data && this.fetchProductColors(String(this.data.id));\n this.selectedCategory = null;\n } else {\n color && this.fetchCategoryColors(color);\n this.selectedCategory = color;\n }\n this.currentColor = null;\n this.clearSearchText.emit();\n };\n\n // async searchColorsHandler(event: CustomEvent) {\n // this.loading = true;\n // this.currentColor = null;\n\n // // if search is empty set to first category to not showing whole product colors\n // if (event.detail === '') {\n // this.handleCategoryClick(this.selectedCategory);\n // this.loading = true;\n // }\n\n // try {\n // if (this.data && this.data.id && event.detail !== '') {\n // const response = await ApiService.getData(`items/Color?${fetchColorByNumber(Number(this.selectedCategory), event.detail)}`);\n // if (response) {\n // this.colors = {\n // list:\n // (response &&\n // response.data &&\n // response.data.map((item: Color) => ({\n // ...item,\n // }))) ||\n // [],\n // pagination: response.meta,\n // };\n // }\n // }\n // } catch (error) {\n // console.error(error);\n // } finally {\n // this.loading = false;\n // }\n // }\n private onPage = (page: number) => {\n if (this.data) {\n if (this.selectedCategory) {\n this.fetchCategoryColors(this.selectedCategory, page);\n } else {\n this.fetchProductColors(String(this.data.id), page);\n }\n }\n\n this.page = page;\n this.currentColor = null;\n this.currentIndex = null;\n };\n\n private openSeletedColor() {\n if (!this.colors?.list || !this.selectedcolor) return;\n\n if (!this.colorIsSelected) {\n const result = this.chunks(this.colors.list)\n .map((innerArray, arrayIndex) => {\n const foundColor = innerArray.find(color => color.name.trim() === this.selectedcolor?.trim()?.toUpperCase());\n\n return foundColor ? { color: foundColor, index: arrayIndex } : null;\n })\n .filter(item => item !== null);\n\n this.currentColor = result[0]?.color as any;\n this.currentIndex = result[0]?.index as any;\n this.colorIsSelected = true;\n }\n }\n\n componentWillLoad() {\n this.preloader = true;\n this.fetchProductData();\n }\n\n componentWillRender() {\n this.displayForMobile();\n this.calculateBoxCount();\n this.colorTimer();\n this.openSeletedColor();\n }\n\n render() {\n return (\n <div class={`my-modal`} onMouseEnter={() => this.handleReadyToClose(false)} onMouseLeave={() => this.handleReadyToClose(true)}>\n {this.preloader && (\n <div class={'loader'}>\n <my-loader></my-loader>\n </div>\n )}\n {!this.preloader && this.data && (\n <div class={`my-modal__header`}>\n <div class=\"image-wrapper\">\n <img src={`${APIURL}/assets/${this.data?.modalLogo}?access_token=${accessToken}`} alt=\"modal-logo\" />\n {!this.preloader && this.data && (\n <p class=\"my-modal__see-more\">\n {this.data?.modalDescription}\n {/* <img src={getAssetPath(`./assets/${this.arrowDown}`)} alt=\"arrow_down\" /> */}\n </p>\n )}\n </div>\n <div class=\"search-wrapper\">\n {!this.preloader && <my-search productId={Number(this.data?.id)} isMobile={this.isMobile}></my-search>}\n {!this.preloader && (\n <button class=\"my-modal__close\" onClick={() => this.closeModalHandler()}>\n <img src={getAssetPath(`./assets/${this.closeImage}`)} alt=\"closebtn\" />\n </button>\n )}\n </div>\n </div>\n )}\n\n {/* {this.showRange && (\n <div class={'categories'}>\n {this.data && <my-search productId={Number(this.data?.id)} isMobile={this.isMobile}></my-search>}\n\n <div class={'categories__container'} style={{ maxWidth: `${this.infoBoxWidth}px` }}>\n {this.data?.Category.map((c: ProductCategoryRelation) => (\n <my-colorbox\n key={c.id}\n onClick={() => this.handleCategoryClick(c.Category_id.id)}\n color={c.Category_id.hex}\n name={c.Category_id.category_name}\n shop={this.shop}\n product={this.product}\n isCategoryActive={this.selectedCategory === c.Category_id.id}\n isImageInsteadHex={{\n isImageInsteadHex: c?.imageInsteadHex || false,\n bigImage: c?.bigImage || '',\n }}\n ></my-colorbox>\n ))}\n </div>\n {this.isMobile && (\n <div class={'categories__slide-information'} style={{ width: `${this.infoBoxWidth}px` }}>\n <span>Przewiń w lewo</span>\n <span>Przewiń w prawo</span>\n </div>\n )}\n </div>\n )} */}\n <div class={'my-modal__wrapper'}>\n {this.loading && <my-loader></my-loader>}\n {!this.loading && this.colors && (\n <div class={'container_boxes'}>\n {this.colors.list.length > 0 ? (\n this.chunks(this.colors.list).map((color: Color[], index: number) => {\n return (\n <div key={index} class=\"boxes\">\n <div class=\"boxes__list\">\n {color.map((c: Color) => (\n <my-colorbox\n key={c.id}\n onClick={() => [\n this.currentColor?.id ? (this.currentColor?.id === c.id ? (this.currentColor = null) : (this.currentColor = c)) : (this.currentColor = c),\n (this.currentIndex = index),\n setDataLayer({\n event: 'ColorClick',\n shop: this.shop,\n product: this.product,\n color: c.name,\n }),\n this.currentColor?.id && this.clearInterval(),\n ]}\n color={c.hex}\n name={c.name}\n isActive={this.currentColor?.id === c.id}\n shop={this.shop}\n product={this.product}\n isImageInsteadHex={{\n isImageInsteadHex: c.imageInsteadHex,\n bigImage: c.bigImage,\n }}\n ></my-colorbox>\n ))}\n </div>\n\n {this.currentColor?.id && index === this.currentIndex && (\n <my-colorinfo\n currentColor={this.currentColor}\n shop={this.shop}\n product={this.product}\n data={this.data}\n isMobile={this.isMobile}\n infoBoxWidth={this.infoBoxWidth}\n baselink={this.baselink}\n ></my-colorinfo>\n )}\n </div>\n );\n })\n ) : (\n <p>Brak wyników</p>\n )}\n {this.colors.pagination.filter_count > limit && (\n <div class={'pagination'}>\n {Array.from({ length: Math.ceil(this.colors.pagination.filter_count / limit) }).map((_, i) => (\n <span\n class={i + 1 === this.page ? 'current' : ''}\n onClick={e => {\n e.preventDefault();\n this.onPage(i + 1);\n }}\n key={`#${i + 1}`}\n >\n {i + 1}\n </span>\n ))}\n </div>\n )}\n </div>\n )}\n </div>\n {!this.preloader && this.isMobile && (\n <button class=\"button\" onClick={() => this.closeModalHandler()}>\n Zamknij\n </button>\n )}\n </div>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"my-modal.js","sourceRoot":"","sources":["../../../src/components/my-modal/my-modal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAgB,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC7H,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC7G,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAavC,MAAM,OAAO,OAAO;EAoClB;IAnCQ,oBAAe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,CAAC,QAAQ,IAAI,CACnC,cAAQ,KAAK,EAAC,QAAQ,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,iBAAiB,EAAE,cAErD,CACV,CACG,CACP,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Method, Element, Prop, Event, EventEmitter, h, State, getAssetPath, Listen, Watch } from '@stencil/core';\nimport { APIURL, ApiService, accessToken } from '../api';\nimport { setDataLayer } from '../../gtmUtils';\nimport { Color, PaginationData, Product, ProductShopRelation } from '../../types';\nimport { fetchCategoryColorsQuery, fetchColorByName, fetchProductColorsQuery, limit } from '../api/services';\nimport { debounce } from '../../utils';\n\ndeclare global {\n interface Window {\n dataLayer: Record<string, any>[];\n }\n}\n\n@Component({\n tag: 'my-modal',\n styleUrl: 'my-modal.scss',\n assetsDirs: ['assets'],\n})\nexport class MyModal {\n private boxDesktopWidth = 130;\n private boxMobileWidth = 70;\n private desktopPadding = 75;\n private mobilePadding = 35;\n private mediumBreakpoint = 1024;\n private colorTimerInterval: ReturnType<typeof setInterval> | undefined;\n\n @Event({ bubbles: true, composed: true }) clearSearchText: EventEmitter;\n @Element() modalEl: HTMLElement;\n\n @Prop() shop: string;\n @Prop() product: string;\n @Prop() baselink: string;\n @Prop() selectedcolor: string | null;\n @Prop() closeImage = 'close.png';\n @Prop() arrowDown = 'arrow_down.png';\n\n @State() chunksNum = 12;\n @State() data: Product | null = null;\n @State() preloader = false;\n @State() loading = false;\n @State() colors: PaginationData<Color> | null = null;\n @State() currentColor: Color | null = null;\n @State() currentIndex: number | null = null;\n @State() infoBoxWidth: number | null = null;\n @State() boxWidth: number = this.boxDesktopWidth; // box width with gap\n @State() padding: number = this.desktopPadding;\n @State() isMobile: boolean = false;\n @State() showRange: boolean = false;\n @State() colorCategories: string[] | null = null;\n @State() selectedCategory: any = null;\n @State() page = 1;\n @State() colorIsSelected = false;\n debouncedSearchColorsHandler: (event: CustomEvent) => void;\n\n constructor() {\n this.debouncedSearchColorsHandler = debounce(this.searchColor.bind(this), 300);\n }\n\n @Watch('chunksNum')\n setInfoBoxWidth(newValue: number) {\n this.infoBoxWidth = newValue * this.boxWidth;\n }\n\n @Watch('data')\n watchPropHandler(newValue: Product) {\n if (newValue.Category.length > 0) {\n this.showRange = true;\n this.handleCategoryClick(newValue.Category[0].Category_id.id);\n } else {\n this.fetchProductColors(String(newValue.id));\n }\n }\n\n private clearInterval = () => {\n this.colorTimerInterval && clearInterval(this.colorTimerInterval);\n this.colorTimerInterval = undefined;\n };\n\n private colorTimer = () => {\n if (this.currentColor && this.currentColor.id) {\n this.colorTimerInterval = setInterval(() => {\n this.currentColor?.name &&\n setDataLayer({\n event: 'ColorTimer',\n shop: this.shop,\n product: this.product,\n color: this.currentColor?.name,\n timer: '10',\n });\n }, 10000);\n } else {\n this.clearInterval();\n }\n };\n\n @Method()\n async open() {\n this.modalEl.style.display = 'block';\n }\n @Event() close: EventEmitter;\n closeModalHandler() {\n this.close.emit();\n }\n\n @Event() readyToCLose: EventEmitter;\n handleReadyToClose(value: boolean) {\n this.readyToCLose.emit({ observable: value });\n }\n\n @Listen('closeInfoBox')\n closeInfoBoxHandler() {\n this.currentColor = null;\n this.currentIndex = null;\n }\n\n private chunks = (xs: Color[], y: Color[][] = []): Color[][] => {\n return xs.length === 0 ? y : this.chunks(xs.slice(this.chunksNum), y.concat([xs.slice(0, this.chunksNum)]));\n };\n\n private calculateBoxCount = () => {\n const modalWidth = this.modalEl.children && this.modalEl.children[0] && this.modalEl.children[0]?.clientWidth - this.padding;\n const boxWidth = this.boxWidth;\n\n const calc = Math.floor(modalWidth / boxWidth);\n\n const boxesCount = calc;\n\n if (!this.preloader) this.chunksNum = boxesCount;\n };\n\n private displayForMobile = () => {\n if (window.innerWidth < this.mediumBreakpoint) {\n this.boxWidth = this.boxMobileWidth;\n this.padding = this.mobilePadding;\n this.isMobile = true;\n } else {\n this.isMobile = false;\n this.boxWidth = this.boxDesktopWidth;\n this.padding = this.desktopPadding;\n }\n };\n\n @Listen('resize', { target: 'window' })\n handleResize() {\n this.calculateBoxCount();\n this.displayForMobile();\n }\n\n private fetchProductData = async () => {\n try {\n const shopResponse = await ApiService.getData(`items/Shop?filter[name][_eq]=${this.shop}`);\n const shop = shopResponse?.data[0];\n if (shop.id) {\n const response = await ApiService.getData(`items/Product?filter[name][_eq]=${this.product}&fields=*,images.*,Shop.*,Category.*.*.*.*`);\n const product = response?.data[0];\n\n if (product) {\n if (product.Shop.find((s: ProductShopRelation) => s.Shop_id === shop.id)) {\n this.data = {\n ...response.data[0],\n id: response.data[0].id,\n };\n } else {\n return null;\n }\n }\n }\n } catch (error) {\n console.error(error);\n } finally {\n this.preloader = false;\n }\n };\n\n private fetchProductColors = async (id: string, page?: number) => {\n this.loading = true;\n\n try {\n const response = await ApiService.getData(`items/Color?${fetchProductColorsQuery(id, page)}`);\n\n if (response) {\n this.colors = {\n list:\n response &&\n response.data &&\n response.data.map((item: Color) => ({\n ...item,\n })),\n pagination: response.meta,\n };\n }\n } catch (error) {\n console.error(error);\n } finally {\n this.loading = false;\n }\n };\n\n private fetchCategoryColors = async (id: number, page?: number) => {\n this.loading = true;\n\n try {\n const response = await ApiService.getData(`items/Color?${fetchCategoryColorsQuery(id, page)}`);\n\n if (response) {\n this.colors = {\n list:\n response &&\n response.data &&\n response.data.map((item: Color) => ({\n ...item,\n })),\n pagination: response.meta,\n };\n }\n } catch (error) {\n console.error(error);\n } finally {\n this.loading = false;\n }\n };\n\n async searchColor(event: CustomEvent) {\n if (event.detail === '') {\n this.fetchProductData();\n this.loading = true;\n } else {\n if (!this.data?.id) {\n return;\n }\n try {\n const response = await ApiService.getData(`items/Color?${fetchColorByName(this.data?.id, event.detail)}`);\n\n if (response) {\n this.colors = {\n list:\n response &&\n response.data &&\n response.data.map((item: Color) => ({\n ...item,\n })),\n pagination: response.meta,\n };\n }\n } catch (error) {\n console.error(error);\n } finally {\n this.loading = false;\n }\n }\n }\n\n @Listen('searchColors')\n searchColorsHandler(event: CustomEvent) {\n this.loading = true;\n this.currentColor = null;\n this.debouncedSearchColorsHandler(event);\n }\n\n private handleCategoryClick = (color?: number) => {\n if (this.selectedCategory && color && this.selectedCategory === color && !this.showRange) {\n this.data && this.fetchProductColors(String(this.data.id));\n this.selectedCategory = null;\n } else {\n color && this.fetchCategoryColors(color);\n this.selectedCategory = color;\n }\n this.currentColor = null;\n this.clearSearchText.emit();\n };\n\n // async searchColorsHandler(event: CustomEvent) {\n // this.loading = true;\n // this.currentColor = null;\n\n // // if search is empty set to first category to not showing whole product colors\n // if (event.detail === '') {\n // this.handleCategoryClick(this.selectedCategory);\n // this.loading = true;\n // }\n\n // try {\n // if (this.data && this.data.id && event.detail !== '') {\n // const response = await ApiService.getData(`items/Color?${fetchColorByNumber(Number(this.selectedCategory), event.detail)}`);\n // if (response) {\n // this.colors = {\n // list:\n // (response &&\n // response.data &&\n // response.data.map((item: Color) => ({\n // ...item,\n // }))) ||\n // [],\n // pagination: response.meta,\n // };\n // }\n // }\n // } catch (error) {\n // console.error(error);\n // } finally {\n // this.loading = false;\n // }\n // }\n private onPage = (page: number) => {\n if (this.data) {\n if (this.selectedCategory) {\n this.fetchCategoryColors(this.selectedCategory, page);\n } else {\n this.fetchProductColors(String(this.data.id), page);\n }\n }\n\n this.page = page;\n this.currentColor = null;\n this.currentIndex = null;\n };\n\n private openSeletedColor() {\n if (!this.colors?.list || !this.selectedcolor) return;\n\n if (!this.colorIsSelected) {\n const result = this.chunks(this.colors.list)\n .map((innerArray, arrayIndex) => {\n const foundColor = innerArray.find(color => color.name.trim() === this.selectedcolor?.trim()?.toUpperCase());\n\n return foundColor ? { color: foundColor, index: arrayIndex } : null;\n })\n .filter(item => item !== null);\n\n this.currentColor = result[0]?.color as any;\n this.currentIndex = result[0]?.index as any;\n this.colorIsSelected = true;\n }\n }\n\n componentWillLoad() {\n this.preloader = true;\n this.fetchProductData();\n setDataLayer({\n shop: this.shop,\n product: this.product,\n });\n }\n\n componentWillRender() {\n this.displayForMobile();\n this.calculateBoxCount();\n this.colorTimer();\n this.openSeletedColor();\n }\n\n render() {\n return (\n <div class={`my-modal`} onMouseEnter={() => this.handleReadyToClose(false)} onMouseLeave={() => this.handleReadyToClose(true)}>\n {this.preloader && (\n <div class={'loader'}>\n <my-loader></my-loader>\n </div>\n )}\n {!this.preloader && this.data && (\n <div class={`my-modal__header`}>\n <div class=\"image-wrapper\">\n <img src={`${APIURL}/assets/${this.data?.modalLogo}?access_token=${accessToken}`} alt=\"modal-logo\" />\n {!this.preloader && this.data && (\n <p class=\"my-modal__see-more\">\n {this.data?.modalDescription}\n {/* <img src={getAssetPath(`./assets/${this.arrowDown}`)} alt=\"arrow_down\" /> */}\n </p>\n )}\n </div>\n <div class=\"search-wrapper\">\n {!this.preloader && <my-search shopname={this.shop} productname={this.data.name} isMobile={this.isMobile}></my-search>}\n {!this.preloader && (\n <button class=\"my-modal__close\" onClick={() => this.closeModalHandler()}>\n <img src={getAssetPath(`./assets/${this.closeImage}`)} alt=\"closebtn\" />\n </button>\n )}\n </div>\n </div>\n )}\n\n {/* {this.showRange && (\n <div class={'categories'}>\n {this.data && <my-search productId={Number(this.data?.id)} isMobile={this.isMobile}></my-search>}\n\n <div class={'categories__container'} style={{ maxWidth: `${this.infoBoxWidth}px` }}>\n {this.data?.Category.map((c: ProductCategoryRelation) => (\n <my-colorbox\n key={c.id}\n onClick={() => this.handleCategoryClick(c.Category_id.id)}\n color={c.Category_id.hex}\n name={c.Category_id.category_name}\n shop={this.shop}\n product={this.product}\n isCategoryActive={this.selectedCategory === c.Category_id.id}\n isImageInsteadHex={{\n isImageInsteadHex: c?.imageInsteadHex || false,\n bigImage: c?.bigImage || '',\n }}\n ></my-colorbox>\n ))}\n </div>\n {this.isMobile && (\n <div class={'categories__slide-information'} style={{ width: `${this.infoBoxWidth}px` }}>\n <span>Przewiń w lewo</span>\n <span>Przewiń w prawo</span>\n </div>\n )}\n </div>\n )} */}\n <div class={'my-modal__wrapper'}>\n {this.loading && <my-loader></my-loader>}\n {!this.loading && this.colors && (\n <div class={'container_boxes'}>\n {this.colors.list.length > 0 ? (\n this.chunks(this.colors.list).map((color: Color[], index: number) => {\n return (\n <div key={index} class=\"boxes\">\n <div class=\"boxes__list\">\n {color.map((c: Color) => (\n <my-colorbox\n key={c.id}\n onClick={() => [\n this.currentColor?.id ? (this.currentColor?.id === c.id ? (this.currentColor = null) : (this.currentColor = c)) : (this.currentColor = c),\n (this.currentIndex = index),\n setDataLayer({\n event: 'ColorClick',\n shop: this.shop,\n product: this.product,\n color: c.name,\n }),\n this.currentColor?.id && this.clearInterval(),\n ]}\n color={c.hex}\n name={c.name}\n isActive={this.currentColor?.id === c.id}\n shop={this.shop}\n product={this.product}\n isImageInsteadHex={{\n isImageInsteadHex: c.imageInsteadHex,\n bigImage: c.bigImage,\n }}\n ></my-colorbox>\n ))}\n </div>\n\n {this.currentColor?.id && index === this.currentIndex && (\n <my-colorinfo\n currentColor={this.currentColor}\n shop={this.shop}\n product={this.product}\n data={this.data}\n isMobile={this.isMobile}\n infoBoxWidth={this.infoBoxWidth}\n baselink={this.baselink}\n ></my-colorinfo>\n )}\n </div>\n );\n })\n ) : (\n <p>Brak wyników</p>\n )}\n {this.colors.pagination.filter_count > limit && (\n <div class={'pagination'}>\n {Array.from({ length: Math.ceil(this.colors.pagination.filter_count / limit) }).map((_, i) => (\n <span\n class={i + 1 === this.page ? 'current' : ''}\n onClick={e => {\n e.preventDefault();\n this.onPage(i + 1);\n }}\n key={`#${i + 1}`}\n >\n {i + 1}\n </span>\n ))}\n </div>\n )}\n </div>\n )}\n </div>\n {!this.preloader && this.isMobile && (\n <button class=\"button\" onClick={() => this.closeModalHandler()}>\n Zamknij\n </button>\n )}\n </div>\n );\n }\n}\n"]}
@@ -1,4 +1,5 @@
1
1
  import { h, getAssetPath } from '@stencil/core';
2
+ import { setDataLayer } from '../../gtmUtils';
2
3
  function debounce(func, wait) {
3
4
  let timeout;
4
5
  return function executedFunction(...args) {
@@ -18,8 +19,9 @@ export class MySearch {
18
19
  this.debouncedInputChangeValue = debounce((value) => {
19
20
  this.fetchColorsByName(value);
20
21
  this.searchText = value;
21
- }, 300);
22
- this.productId = undefined;
22
+ }, 500);
23
+ this.productname = undefined;
24
+ this.shopname = undefined;
23
25
  this.isMobile = undefined;
24
26
  this.searchIcon = 'search.svg';
25
27
  this.searchText = null;
@@ -29,6 +31,14 @@ export class MySearch {
29
31
  this.debouncedInputChangeValue(value);
30
32
  }
31
33
  fetchColorsByNameHandle(newValue) {
34
+ if (newValue.length >= 3) {
35
+ setDataLayer({
36
+ event: 'ColorSearch',
37
+ shop: this.shopname,
38
+ product: this.productname,
39
+ search_term: newValue,
40
+ });
41
+ }
32
42
  this.fetchColorsByName(newValue);
33
43
  }
34
44
  clearSearchTextHandler() {
@@ -55,12 +65,29 @@ export class MySearch {
55
65
  static get assetsDirs() { return ["assets"]; }
56
66
  static get properties() {
57
67
  return {
58
- "productId": {
59
- "type": "number",
68
+ "productname": {
69
+ "type": "string",
70
+ "mutable": false,
71
+ "complexType": {
72
+ "original": "string",
73
+ "resolved": "string",
74
+ "references": {}
75
+ },
76
+ "required": false,
77
+ "optional": false,
78
+ "docs": {
79
+ "tags": [],
80
+ "text": ""
81
+ },
82
+ "attribute": "productname",
83
+ "reflect": false
84
+ },
85
+ "shopname": {
86
+ "type": "string",
60
87
  "mutable": false,
61
88
  "complexType": {
62
- "original": "number",
63
- "resolved": "number",
89
+ "original": "string",
90
+ "resolved": "string",
64
91
  "references": {}
65
92
  },
66
93
  "required": false,
@@ -69,7 +96,7 @@ export class MySearch {
69
96
  "tags": [],
70
97
  "text": ""
71
98
  },
72
- "attribute": "product-id",
99
+ "attribute": "shopname",
73
100
  "reflect": false
74
101
  },
75
102
  "isMobile": {
@@ -1 +1 @@
1
- {"version":3,"file":"my-search.js","sourceRoot":"","sources":["../../../src/components/my-search/my-search.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAgB,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAE5G,SAAS,QAAQ,CAAC,IAAc,EAAE,IAAY;EAC5C,IAAI,OAAsC,CAAC;EAC3C,OAAO,SAAS,gBAAgB,CAAC,GAAG,IAAW;IAC7C,MAAM,KAAK,GAAG,GAAG,EAAE;MACjB,YAAY,CAAC,OAAO,CAAC,CAAC;MACtB,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;IAChB,CAAC,CAAC;IACF,YAAY,CAAC,OAAO,CAAC,CAAC;IACtB,OAAO,GAAG,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;EACpC,CAAC,CAAC;AACJ,CAAC;AAQD,MAAM,OAAO,QAAQ;;IAOnB,sBAAiB,GAAG,CAAC,IAAY,EAAE,EAAE;MACnC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC,CAAC;IAEM,8BAAyB,GAAG,QAAQ,CAAC,CAAC,KAAa,EAAE,EAAE;MAC7D,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;MAC9B,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;IAC1B,CAAC,EAAE,GAAG,CAAC,CAAC;;;sBAXa,YAAY;sBACI,IAAI;;EAYjC,kBAAkB,CAAC,KAAY;IACrC,MAAM,KAAK,GAAI,KAAK,CAAC,MAA2B,CAAC,KAAK,CAAC;IACvD,IAAI,CAAC,yBAAyB,CAAC,KAAK,CAAC,CAAC;EACxC,CAAC;EAGD,uBAAuB,CAAC,QAAgB;IACtC,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;EACnC,CAAC;EAGD,sBAAsB;IACpB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;EACzB,CAAC;EAED,MAAM;IACJ,OAAO,CACL,WAAK,KAAK,EAAE,QAAQ;MAClB,aAAO,WAAW,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,0BAA0B,EAAE,KAAK,EAAE,IAAI,CAAC,UAAU,IAAI,EAAE,EAAE,IAAI,EAAC,MAAM,EAAC,OAAO,EAAE,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAI;MAE5K,cACE,OAAO,EAAE,GAAG,EAAE;UACZ,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;UAE3D,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACvB,CAAC;QAED,WAAK,GAAG,EAAE,YAAY,CAAC,YAAY,IAAI,CAAC,UAAU,EAAE,CAAC,EAAE,GAAG,EAAC,YAAY,GAAG,CACnE,CACL,CACP,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, h, State, Listen, getAssetPath, EventEmitter, Event, Watch } from '@stencil/core';\n\nfunction debounce(func: Function, wait: number) {\n let timeout: ReturnType<typeof setTimeout>;\n return function executedFunction(...args: any[]) {\n const later = () => {\n clearTimeout(timeout);\n func(...args);\n };\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n };\n}\n\n@Component({\n tag: 'my-search',\n styleUrl: 'my-search.scss',\n assetsDirs: ['assets'],\n scoped: true,\n})\nexport class MySearch {\n @Prop() productId: number;\n @Prop() isMobile: boolean;\n @Prop() searchIcon = 'search.svg';\n @State() searchText: string | null = null;\n @Event() searchColors: EventEmitter;\n\n fetchColorsByName = (text: string) => {\n this.searchColors.emit(text);\n };\n\n private debouncedInputChangeValue = debounce((value: string) => {\n this.fetchColorsByName(value);\n this.searchText = value;\n }, 300);\n\n private onInputChangeValue(event: Event) {\n const value = (event.target as HTMLInputElement).value;\n this.debouncedInputChangeValue(value);\n }\n\n @Watch('searchText')\n fetchColorsByNameHandle(newValue: string) {\n this.fetchColorsByName(newValue);\n }\n\n @Listen('clearSearchText', { target: 'document' })\n clearSearchTextHandler() {\n this.searchText = null;\n }\n\n render() {\n return (\n <div class={'search'}>\n <input placeholder={this.isMobile ? 'Wyszukaj kolor' : 'Wyszukaj kolor po nazwie'} value={this.searchText || ''} type=\"text\" onInput={this.onInputChangeValue.bind(this)} />\n\n <button\n onClick={() => {\n this.searchText && this.fetchColorsByName(this.searchText);\n\n this.searchText = '';\n }}\n >\n <img src={getAssetPath(`./assets/${this.searchIcon}`)} alt=\"arrow_down\" />\n </button>\n </div>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"my-search.js","sourceRoot":"","sources":["../../../src/components/my-search/my-search.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAgB,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC5G,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,SAAS,QAAQ,CAAC,IAAc,EAAE,IAAY;EAC5C,IAAI,OAAsC,CAAC;EAC3C,OAAO,SAAS,gBAAgB,CAAC,GAAG,IAAW;IAC7C,MAAM,KAAK,GAAG,GAAG,EAAE;MACjB,YAAY,CAAC,OAAO,CAAC,CAAC;MACtB,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;IAChB,CAAC,CAAC;IACF,YAAY,CAAC,OAAO,CAAC,CAAC;IACtB,OAA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kB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAI;MAE5K,cACE,OAAO,EAAE,GAAG,EAAE;UACZ,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;UAE3D,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACvB,CAAC;QAED,WAAK,GAAG,EAAE,YAAY,CAAC,YAAY,IAAI,CAAC,UAAU,EAAE,CAAC,EAAE,GAAG,EAAC,YAAY,GAAG,CACnE,CACL,CACP,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, h, State, Listen, getAssetPath, EventEmitter, Event, Watch } from '@stencil/core';\nimport { setDataLayer } from '../../gtmUtils';\n\nfunction debounce(func: Function, wait: number) {\n let timeout: ReturnType<typeof setTimeout>;\n return function executedFunction(...args: any[]) {\n const later = () => {\n clearTimeout(timeout);\n func(...args);\n };\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n };\n}\n\n@Component({\n tag: 'my-search',\n styleUrl: 'my-search.scss',\n assetsDirs: ['assets'],\n scoped: true,\n})\nexport class MySearch {\n @Prop() productname: string;\n @Prop() shopname: string;\n @Prop() isMobile: boolean;\n @Prop() searchIcon = 'search.svg';\n @State() searchText: string | null = null;\n @Event() searchColors: EventEmitter;\n\n fetchColorsByName = (text: string) => {\n this.searchColors.emit(text);\n };\n\n private debouncedInputChangeValue = debounce((value: string) => {\n this.fetchColorsByName(value);\n this.searchText = value;\n }, 500);\n\n private onInputChangeValue(event: Event) {\n const value = (event.target as HTMLInputElement).value;\n this.debouncedInputChangeValue(value);\n }\n\n @Watch('searchText')\n fetchColorsByNameHandle(newValue: string) {\n if (newValue.length >= 3) {\n setDataLayer({\n event: 'ColorSearch',\n shop: this.shopname,\n product: this.productname,\n search_term: newValue,\n });\n }\n\n this.fetchColorsByName(newValue);\n }\n\n @Listen('clearSearchText', { target: 'document' })\n clearSearchTextHandler() {\n this.searchText = null;\n }\n\n render() {\n return (\n <div class={'search'}>\n <input placeholder={this.isMobile ? 'Wyszukaj kolor' : 'Wyszukaj kolor po nazwie'} value={this.searchText || ''} type=\"text\" onInput={this.onInputChangeValue.bind(this)} />\n\n <button\n onClick={() => {\n this.searchText && this.fetchColorsByName(this.searchText);\n\n this.searchText = '';\n }}\n >\n <img src={getAssetPath(`./assets/${this.searchIcon}`)} alt=\"arrow_down\" />\n </button>\n </div>\n );\n }\n}\n"]}
@@ -0,0 +1,7 @@
1
+ const setDataLayer = (obj) => {
2
+ return window.dataLayer.push(obj);
3
+ };
4
+
5
+ export { setDataLayer as s };
6
+
7
+ //# sourceMappingURL=gtmUtils.js.map
@@ -0,0 +1 @@
1
+ {"file":"gtmUtils.js","mappings":"MAAa,YAAY,GAAG,CAAC,GAA2B;EACtD,OAAO,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACpC;;;;","names":[],"sources":["./src/gtmUtils.ts"],"sourcesContent":["export const setDataLayer = (obj: Record<string, string>) => {\n return window.dataLayer.push(obj);\n};\n"],"version":3}
@@ -1,7 +1,3 @@
1
- const setDataLayer = (obj) => {
2
- return window.dataLayer.push(obj);
3
- };
4
-
5
1
  // DEV/
6
2
  // export const APIURL = 'http://localhost:8055';
7
3
  // export const accessToken = 'iGAWx696CkipbZDOESC8CBn3BF7xPaei';
@@ -29,6 +25,6 @@ class API {
29
25
  }
30
26
  const ApiService = new API();
31
27
 
32
- export { APIURL as A, accessToken as a, ApiService as b, setDataLayer as s };
28
+ export { APIURL as A, accessToken as a, ApiService as b };
33
29
 
34
30
  //# sourceMappingURL=index2.js.map
@@ -1 +1 @@
1
- {"file":"index2.js","mappings":"MAAa,YAAY,GAAG,CAAC,GAA2B;EACtD,OAAO,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACpC;;ACFA;AACA;AACA;AAEA;MAEa,MAAM,GAAG,4BAA4B;MACrC,WAAW,GAAG,mCAAmC;AAE9D,MAAM,GAAG;EACP,MAAM,OAAO,CAAC,EAAU;IACtB,IAAI;MACF,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,GAAG,MAAM,IAAI,EAAE,EAAE,EAAE;QAC7C,MAAM,EAAE,KAAK;QAEb,OAAO,EAAE;UACP,eAAe,EAAE,UAAU,WAAW,EAAE;UACxC,cAAc,EAAE,kBAAkB;SACnC;;OAEF,CAAC,CAAC;MAEH,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC;MAEtC,OAAO,QAAQ,CAAC;KACjB;IAAC,OAAO,KAAK,EAAE;MACd,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;KACtB;GACF;CACF;MAEY,UAAU,GAAG,IAAI,GAAG;;;;","names":[],"sources":["./src/gtmUtils.ts","./src/components/api/index.ts"],"sourcesContent":["export const setDataLayer = (obj: Record<string, string>) => {\n return window.dataLayer.push(obj);\n};\n","// DEV/\n// export const APIURL = 'http://localhost:8055';\n// export const accessToken = 'iGAWx696CkipbZDOESC8CBn3BF7xPaei';\n\n// PROD\n\nexport const APIURL = 'https://color-selector.pl'; //'https://pallete-colors-backend.herokuapp.com';\nexport const accessToken = '8uZQSXi0wCxiY0UR8wp_Pe2gY86wVErp'; //'_baZ127gfvFIFmZ5umrrTBUUm6D7ve6p'\n\nclass API {\n async getData(ep: string) {\n try {\n const request = await fetch(`${APIURL}/${ep}`, {\n method: 'GET',\n\n headers: {\n 'Authorization': `Bearer ${accessToken}`,\n 'Content-Type': 'application/json',\n },\n // mode: 'no-cors',\n });\n\n const response = await request.json();\n\n return response;\n } catch (error) {\n console.error(error);\n }\n }\n}\n\nexport const ApiService = new API();\n"],"version":3}
1
+ {"file":"index2.js","mappings":"AAAA;AACA;AACA;AAEA;MAEa,MAAM,GAAG,4BAA4B;MACrC,WAAW,GAAG,mCAAmC;AAE9D,MAAM,GAAG;EACP,MAAM,OAAO,CAAC,EAAU;IACtB,IAAI;MACF,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,GAAG,MAAM,IAAI,EAAE,EAAE,EAAE;QAC7C,MAAM,EAAE,KAAK;QAEb,OAAO,EAAE;UACP,eAAe,EAAE,UAAU,WAAW,EAAE;UACxC,cAAc,EAAE,kBAAkB;SACnC;;OAEF,CAAC,CAAC;MAEH,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC;MAEtC,OAAO,QAAQ,CAAC;KACjB;IAAC,OAAO,KAAK,EAAE;MACd,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;KACtB;GACF;CACF;MAEY,UAAU,GAAG,IAAI,GAAG;;;;","names":[],"sources":["./src/components/api/index.ts"],"sourcesContent":["// DEV/\n// export const APIURL = 'http://localhost:8055';\n// export const accessToken = 'iGAWx696CkipbZDOESC8CBn3BF7xPaei';\n\n// PROD\n\nexport const APIURL = 'https://color-selector.pl'; //'https://pallete-colors-backend.herokuapp.com';\nexport const accessToken = '8uZQSXi0wCxiY0UR8wp_Pe2gY86wVErp'; //'_baZ127gfvFIFmZ5umrrTBUUm6D7ve6p'\n\nclass API {\n async getData(ep: string) {\n try {\n const request = await fetch(`${APIURL}/${ep}`, {\n method: 'GET',\n\n headers: {\n 'Authorization': `Bearer ${accessToken}`,\n 'Content-Type': 'application/json',\n },\n // mode: 'no-cors',\n });\n\n const response = await request.json();\n\n return response;\n } catch (error) {\n console.error(error);\n }\n }\n}\n\nexport const ApiService = new API();\n"],"version":3}
@@ -1,5 +1,6 @@
1
1
  import { proxyCustomElement, HTMLElement as HTMLElement$1, h } from '@stencil/core/internal/client';
2
- import { s as setDataLayer, A as APIURL, a as accessToken } from './index2.js';
2
+ import { s as setDataLayer } from './gtmUtils.js';
3
+ import { A as APIURL, a as accessToken } from './index2.js';
3
4
 
4
5
  /**
5
6
  * SSR Window 4.0.2