@ppg_pl/pallete 0.0.6 → 2.0.0

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 (68) hide show
  1. package/README.md +9 -1
  2. package/dist/cjs/{index-160fcb6c.js → index-53e78fc8.js} +3 -1
  3. package/dist/cjs/index-53e78fc8.js.map +1 -0
  4. package/dist/cjs/loader.cjs.js +2 -2
  5. package/dist/cjs/my-backdrop_8.cjs.entry.js +527 -261
  6. package/dist/cjs/my-backdrop_8.cjs.entry.js.map +1 -1
  7. package/dist/cjs/pallete.cjs.js +2 -2
  8. package/dist/collection/components/api/index.js +4 -2
  9. package/dist/collection/components/api/index.js.map +1 -1
  10. package/dist/collection/components/api/services.js +31 -64
  11. package/dist/collection/components/api/services.js.map +1 -1
  12. package/dist/collection/components/my-colorinfo/my-colorinfo.js +6 -4
  13. package/dist/collection/components/my-colorinfo/my-colorinfo.js.map +1 -1
  14. package/dist/collection/components/my-loader/my-loader.css +1 -1
  15. package/dist/collection/components/my-modal/my-modal.js +65 -47
  16. package/dist/collection/components/my-modal/my-modal.js.map +1 -1
  17. package/dist/collection/components/my-search/my-search.js +28 -2
  18. package/dist/collection/components/my-search/my-search.js.map +1 -1
  19. package/dist/collection/components/my-slider/index.js +5 -8
  20. package/dist/collection/components/my-slider/index.js.map +1 -1
  21. package/dist/collection/types.js.map +1 -1
  22. package/dist/components/index2.js +25 -3
  23. package/dist/components/index2.js.map +1 -1
  24. package/dist/components/my-colorinfo2.js +4 -3
  25. package/dist/components/my-colorinfo2.js.map +1 -1
  26. package/dist/components/my-loader2.js +1 -1
  27. package/dist/components/my-loader2.js.map +1 -1
  28. package/dist/components/my-modal2.js +482 -256
  29. package/dist/components/my-modal2.js.map +1 -1
  30. package/dist/components/my-search2.js +20 -3
  31. package/dist/components/my-search2.js.map +1 -1
  32. package/dist/esm/{index-943c259f.js → index-b0145abf.js} +3 -1
  33. package/dist/esm/index-b0145abf.js.map +1 -0
  34. package/dist/esm/loader.js +3 -3
  35. package/dist/esm/my-backdrop_8.entry.js +527 -261
  36. package/dist/esm/my-backdrop_8.entry.js.map +1 -1
  37. package/dist/esm/pallete.js +3 -3
  38. package/dist/pallete/p-037cfde2.entry.js +2 -0
  39. package/dist/pallete/p-037cfde2.entry.js.map +1 -0
  40. package/dist/pallete/{p-c77aaa54.js → p-c6a049a2.js} +2 -2
  41. package/dist/pallete/p-c6a049a2.js.map +1 -0
  42. package/dist/pallete/pallete.esm.js +1 -1
  43. package/dist/pallete/pallete.esm.js.map +1 -1
  44. package/dist/types/components/api/index.d.ts +2 -1
  45. package/dist/types/components/api/services.d.ts +3 -3
  46. package/dist/types/components/my-modal/my-modal.d.ts +1 -0
  47. package/dist/types/components/my-search/my-search.d.ts +2 -0
  48. package/dist/types/components/my-slider/index.d.ts +2 -2
  49. package/dist/types/components.d.ts +5 -4
  50. package/dist/types/types.d.ts +35 -24
  51. package/package.json +5 -5
  52. package/www/build/p-037cfde2.entry.js +2 -0
  53. package/www/build/p-037cfde2.entry.js.map +1 -0
  54. package/www/build/{p-c77aaa54.js → p-c6a049a2.js} +2 -2
  55. package/www/build/p-c6a049a2.js.map +1 -0
  56. package/www/build/pallete.esm.js +1 -1
  57. package/www/build/pallete.esm.js.map +1 -1
  58. package/www/index.html +1 -1
  59. package/dist/cjs/index-160fcb6c.js.map +0 -1
  60. package/dist/esm/index-943c259f.js.map +0 -1
  61. package/dist/pallete/p-9a7eff4f.entry.js +0 -2
  62. package/dist/pallete/p-9a7eff4f.entry.js.map +0 -1
  63. package/dist/pallete/p-c77aaa54.js.map +0 -1
  64. package/www/build/p-825a7d1d.js +0 -163
  65. package/www/build/p-9a7eff4f.entry.js +0 -2
  66. package/www/build/p-9a7eff4f.entry.js.map +0 -1
  67. package/www/build/p-c77aaa54.js.map +0 -1
  68. package/www/build/p-fd390eef.css +0 -3
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-160fcb6c.js');
5
+ const index = require('./index-53e78fc8.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([["my-backdrop_8.cjs",[[2,"my-component",{"shop":[1],"product":[1],"show":[32],"readyToClose":[32],"open":[64]},[[0,"readyToCLose","setReadyToCloseHandler"],[0,"close","closeModalHandler"]]],[0,"my-modal",{"shop":[1],"product":[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],"open":[64]},[[0,"closeInfoBox","closeInfoBoxHandler"],[9,"resize","handleResize"],[0,"searchColors","searchColorsHandler"]]],[0,"my-backdrop"],[0,"my-colorinfo",{"currentColor":[16],"shop":[1],"product":[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"]}],[2,"my-loader"],[2,"my-search",{"productId":[2,"product-id"],"isMobile":[4,"is-mobile"],"searchIcon":[1,"search-icon"],"searchText":[32]}],[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],"show":[32],"readyToClose":[32],"open":[64]},[[0,"readyToCLose","setReadyToCloseHandler"],[0,"close","closeModalHandler"]]],[0,"my-modal",{"shop":[1],"product":[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],"open":[64]},[[0,"closeInfoBox","closeInfoBoxHandler"],[9,"resize","handleResize"],[0,"searchColors","searchColorsHandler"]]],[0,"my-backdrop"],[0,"my-colorinfo",{"currentColor":[16],"shop":[1],"product":[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"]}],[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);
24
24
  });
25
25
 
26
26
  exports.setNonce = index.setNonce;
@@ -1,10 +1,12 @@
1
- export const APIURL = 'https://pallete-colors-backend.herokuapp.com';
1
+ export const APIURL = 'http://147.135.211.144:8055'; //'https://pallete-colors-backend.herokuapp.com';
2
+ export const accessToken = 'uBKzhiNM4rkdZSe_PQvKJp9pE-DSTmtu';
2
3
  class API {
3
4
  async getData(ep) {
4
5
  try {
5
- const request = await fetch(`${APIURL}/api/${ep}`, {
6
+ const request = await fetch(`${APIURL}/${ep}`, {
6
7
  method: 'GET',
7
8
  headers: {
9
+ 'Authorization': `Bearer ${accessToken}`,
8
10
  'Content-Type': 'application/json',
9
11
  },
10
12
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/api/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,MAAM,GAAG,8CAA8C,CAAC;AAErE,MAAM,GAAG;EACP,KAAK,CAAC,OAAO,CAAC,EAAU;IACtB,IAAI;MACF,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,GAAG,MAAM,QAAQ,EAAE,EAAE,EAAE;QACjD,MAAM,EAAE,KAAK;QAEb,OAAO,EAAE;UACP,cAAc,EAAE,kBAAkB;SACnC;OACF,CAAC,CAAC;MACH,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;EACH,CAAC;CACF;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,GAAG,EAAE,CAAC","sourcesContent":["export const APIURL = 'https://pallete-colors-backend.herokuapp.com';\n\nclass API {\n async getData(ep: string) {\n try {\n const request = await fetch(`${APIURL}/api/${ep}`, {\n method: 'GET',\n\n headers: {\n 'Content-Type': 'application/json',\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"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/api/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,MAAM,GAAG,6BAA6B,CAAC,CAAC,iDAAiD;AACtG,MAAM,CAAC,MAAM,WAAW,GAAG,kCAAkC,CAAC;AAE9D,MAAM,GAAG;EACP,KAAK,CAAC,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;OACF,CAAC,CAAC;MACH,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;EACH,CAAC;CACF;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,GAAG,EAAE,CAAC","sourcesContent":["export const APIURL = 'http://147.135.211.144:8055'; //'https://pallete-colors-backend.herokuapp.com';\nexport const accessToken = 'uBKzhiNM4rkdZSe_PQvKJp9pE-DSTmtu';\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 });\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"]}
@@ -1,82 +1,49 @@
1
1
  import qs from 'qs';
2
+ export const limit = 100;
2
3
  export const fetchProductColorsQuery = (id, page) => qs.stringify({
3
- filters: {
4
+ fields: ['*', 'products.*'].join(','),
5
+ filter: {
4
6
  products: {
5
- id: {
6
- $eq: id,
7
+ Product_id: {
8
+ _eq: id,
7
9
  },
8
10
  },
9
11
  },
10
- sort: ['position:asc'],
11
- populate: ['image', 'category', 'links', 'links.shop'],
12
- pagination: {
13
- page: page || 1,
14
- pageSize: 100,
15
- },
12
+ meta: '*',
13
+ page: page || 1,
14
+ limit,
16
15
  }, {
17
- encodeValuesOnly: true, // prettify url
16
+ encodeValuesOnly: true,
18
17
  });
19
- export const fetchCategoryColorsQuery = (color) => qs.stringify({
20
- filters: {
21
- category: {
22
- id: {
23
- $eq: color.id,
18
+ export const fetchCategoryColorsQuery = (id, page) => qs.stringify({
19
+ fields: ['*', 'Category.*', 'products.*'].join(','),
20
+ filter: {
21
+ Category: {
22
+ Category_id: {
23
+ _eq: id,
24
24
  },
25
25
  },
26
26
  },
27
- sort: ['position:asc'],
28
- populate: ['image', 'category', 'links', 'links.shop'],
29
- pagination: {
30
- page: 1,
31
- pageSize: 100,
32
- },
27
+ meta: '*',
28
+ page: page || 1,
29
+ limit,
33
30
  }, {
34
- encodeValuesOnly: true, // prettify url
31
+ encodeValuesOnly: true,
35
32
  });
36
- export const fetchColorByNumber = (productId, colorNumber) => qs.stringify({
37
- filters: {
38
- $or: [
39
- {
40
- $and: [
41
- {
42
- number: {
43
- $contains: colorNumber,
44
- },
45
- },
46
- {
47
- products: {
48
- id: {
49
- $eq: productId,
50
- },
51
- },
52
- },
53
- ],
54
- },
55
- {
56
- $and: [
57
- {
58
- name: {
59
- $contains: colorNumber,
60
- },
61
- },
62
- {
63
- products: {
64
- id: {
65
- $eq: productId,
66
- },
67
- },
68
- },
69
- ],
33
+ export const fetchColorByNumber = (id, colorNumber) => qs.stringify({
34
+ fields: ['*', 'Category.*'].join(','),
35
+ filter: {
36
+ Category: {
37
+ Category_id: {
38
+ _eq: id,
70
39
  },
71
- ],
72
- },
73
- sort: ['position:asc'],
74
- populate: ['image', 'category', 'product', 'links', 'links.shop'],
75
- pagination: {
76
- page: 1,
77
- pageSize: 100,
40
+ },
41
+ number: {
42
+ _contains: colorNumber,
43
+ },
78
44
  },
45
+ meta: '*',
79
46
  }, {
80
- encodeValuesOnly: true, // prettify url
47
+ encodeValuesOnly: true,
81
48
  });
82
49
  //# sourceMappingURL=services.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"services.js","sourceRoot":"","sources":["../../../src/components/api/services.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AAGpB,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,EAAU,EAAE,IAAa,EAAE,EAAE,CACnE,EAAE,CAAC,SAAS,CACV;EACE,OAAO,EAAE;IACP,QAAQ,EAAE;MACR,EAAE,EAAE;QACF,GAAG,EAAE,EAAE;OACR;KACF;GACF;EACD,IAAI,EAAE,CAAC,cAAc,CAAC;EACtB,QAAQ,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,CAAC;EACtD,UAAU,EAAE;IACV,IAAI,EAAE,IAAI,IAAI,CAAC;IACf,QAAQ,EAAE,GAAG;G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ACF,CAAC","sourcesContent":["import qs from 'qs';\nimport { Color } from '../../types';\n\nexport const fetchProductColorsQuery = (id: string, page?: number) =>\n qs.stringify(\n {\n filters: {\n products: {\n id: {\n $eq: id,\n },\n },\n },\n sort: ['position:asc'],\n populate: ['image', 'category', 'links', 'links.shop'],\n pagination: {\n page: page || 1,\n pageSize: 100,\n },\n },\n {\n encodeValuesOnly: true, // prettify url\n },\n );\n\nexport const fetchCategoryColorsQuery = (color: Color) =>\n qs.stringify(\n {\n filters: {\n category: {\n id: {\n $eq: color.id,\n },\n },\n },\n sort: ['position:asc'],\n populate: ['image', 'category', 'links', 'links.shop'],\n pagination: {\n page: 1,\n pageSize: 100,\n },\n },\n {\n encodeValuesOnly: true, // prettify url\n },\n );\n\nexport const fetchColorByNumber = (productId: number, colorNumber: string) =>\n qs.stringify(\n {\n filters: {\n $or: [\n {\n $and: [\n {\n number: {\n $contains: colorNumber,\n },\n },\n {\n products: {\n id: {\n $eq: productId,\n },\n },\n },\n ],\n },\n {\n $and: [\n {\n name: {\n $contains: colorNumber,\n },\n },\n {\n products: {\n id: {\n $eq: productId,\n },\n },\n },\n ],\n },\n ],\n },\n sort: ['position:asc'],\n populate: ['image', 'category', 'product', 'links', 'links.shop'],\n pagination: {\n page: 1,\n pageSize: 100,\n },\n },\n {\n encodeValuesOnly: true, // prettify url\n },\n );\n"]}
1
+ {"version":3,"file":"services.js","sourceRoot":"","sources":["../../../src/components/api/services.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAC;AAEzB,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,EAAU,EAAE,IAAa,EAAE,EAAE,CACnE,EAAE,CAAC,SAAS,CACV;EACE,MAAM,EAAE,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;EACrC,MAAM,EAAE;IACN,QAAQ,EAAE;MACR,UAAU,EAAE;QACV,GAAG,EAAE,EAAE;OACR;KACF;GACF;EAED,IAAI,EAAE,GAAG;EACT,IAAI,EAAE,IAAI,IAAI,CAAC;EACf,KAAK;CACN,EACD;EACE,gBAAgB,EAAE,IAAI;CACvB,CACF,CAAC;AAEJ,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,EAAU,EAAE,IAAa,EAAE,EAAE,CACpE,EAAE,CAAC,SAAS,CACV;EACE,MAAM,EAAE,CAAC,GAAG,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;EACnD,MAAM,EAAE;IACN,QAAQ,EAAE;MACR,WAAW,EAAE;QACX,GAAG,EAAE,EAAE;OACR;KACF;GACF;EACD,IAAI,EAAE,GAAG;EACT,IAAI,EAAE,IAAI,IAAI,CAAC;EACf,KAAK;CACN,EACD;EACE,gBAAgB,EAAE,IAAI;CACvB,CACF,CAAC;AAEJ,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EAAU,EAAE,WAAmB,EAAE,EAAE,CACpE,EAAE,CAAC,SAAS,CACV;EACE,MAAM,EAAE,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;EACrC,MAAM,EAAE;IACN,QAAQ,EAAE;MACR,WAAW,EAAE;QACX,GAAG,EAAE,EAAE;OACR;KACF;IACD,MAAM,EAAE;MACN,SAAS,EAAE,WAAW;KACvB;GACF;EACD,IAAI,EAAE,GAAG;CACV,EAED;EACE,gBAAgB,EAAE,IAAI;CACvB,CACF,CAAC","sourcesContent":["import qs from 'qs';\n\nexport const limit = 100;\n\nexport const fetchProductColorsQuery = (id: string, page?: number) =>\n qs.stringify(\n {\n fields: ['*', 'products.*'].join(','),\n filter: {\n products: {\n Product_id: {\n _eq: id,\n },\n },\n },\n\n meta: '*',\n page: page || 1,\n limit,\n },\n {\n encodeValuesOnly: true,\n },\n );\n\nexport const fetchCategoryColorsQuery = (id: number, page?: number) =>\n qs.stringify(\n {\n fields: ['*', 'Category.*', 'products.*'].join(','),\n filter: {\n Category: {\n Category_id: {\n _eq: id,\n },\n },\n },\n meta: '*',\n page: page || 1,\n limit,\n },\n {\n encodeValuesOnly: true,\n },\n );\n\nexport const fetchColorByNumber = (id: number, colorNumber: string) =>\n qs.stringify(\n {\n fields: ['*', 'Category.*'].join(','),\n filter: {\n Category: {\n Category_id: {\n _eq: id,\n },\n },\n number: {\n _contains: colorNumber,\n },\n },\n meta: '*',\n },\n\n {\n encodeValuesOnly: true,\n },\n );\n"]}
@@ -1,5 +1,6 @@
1
1
  import { h, getAssetPath } from '@stencil/core';
2
2
  import { setDataLayer } from '../../gtmUtils';
3
+ import { APIURL, accessToken } from '../api';
3
4
  export class MyColorInfo {
4
5
  constructor() {
5
6
  this.goToProduct = () => {
@@ -24,13 +25,14 @@ export class MyColorInfo {
24
25
  this.closeImage = 'close.png';
25
26
  }
26
27
  render() {
27
- var _a, _b, _c, _d, _e, _f, _g;
28
+ var _a, _b, _c, _d, _e, _f;
29
+ console.log('current', this.currentColor);
28
30
  return (h("div", { class: `boxes__box-content ${this.currentColor.textWhite ? 'boxes__box-content__white' : ''}`, style: {
29
31
  background: this.currentColor.hex,
30
32
  maxWidth: `${this.infoBoxWidth && this.infoBoxWidth - 4}px`,
31
33
  } }, this.isMobile && h("img", { class: 'closebtn', onClick: this.onCloseButtonClick, src: getAssetPath(`./assets/${this.closeImage}`), alt: "closebtn" }), h("div", { class: "boxes__box-content__info", style: {
32
34
  maxWidth: this.isMobile ? `${this.infoBoxWidth && this.infoBoxWidth - 35}px` : ``,
33
- } }, !this.isMobile && h("img", { class: 'closebtn', onClick: this.onCloseButtonClick, src: getAssetPath(`./assets/${this.closeImage}`), alt: "closebtn" }), !this.isMobile && h("h2", null, this.currentColor.name), !this.isMobile && h("h4", null, this.currentColor.number), !this.isMobile && h("div", { class: "divider" }), h("div", { class: "boxes__box-content__info__value" }, h("div", { class: "boxes__box-content__info__value-image" }, ((_a = this.currentColor) === null || _a === void 0 ? void 0 : _a.image.data) && h("img", { src: `${(_e = (_d = (_c = (_b = this.currentColor) === null || _b === void 0 ? void 0 : _b.image) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.attributes) === null || _e === void 0 ? void 0 : _e.formats.thumbnail.url}`, alt: "color-image" })), h("div", { class: "boxes__box-content__info__value-product" }, h("div", null, !this.isMobile && h("p", null, "Produkt:"), this.isMobile && h("h2", null, this.currentColor.name), " ", h("p", null, this.product)), this.isMobile && h("div", { class: 'divider' }), this.currentColor && this.currentColor.links.find((link) => { var _a, _b, _c; return ((_c = (_b = (_a = link === null || link === void 0 ? void 0 : link.shop) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.attributes) === null || _c === void 0 ? void 0 : _c.name) === this.shop; }) && (h("a", { onClick: this.goToProduct, class: `${this.currentColor.buttonInverse ? 'inverse' : ''}`, target: "_blank", href: (_f = this === null || this === void 0 ? void 0 : this.currentColor.links.find((link) => { var _a, _b, _c; return ((_c = (_b = (_a = link === null || link === void 0 ? void 0 : link.shop) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.attributes) === null || _c === void 0 ? void 0 : _c.name) === this.shop; })) === null || _f === void 0 ? void 0 : _f.path }, "przejd\u017A do produktu"))))), h("div", { class: "boxes__box-content__slider" }, h("my-slider", { color: this.currentColor.name, shop: this.shop, product: this.product, slides: (_g = this.data) === null || _g === void 0 ? void 0 : _g.images.data }), ' ')));
35
+ } }, !this.isMobile && h("img", { class: 'closebtn', onClick: this.onCloseButtonClick, src: getAssetPath(`./assets/${this.closeImage}`), alt: "closebtn" }), !this.isMobile && h("h2", null, this.currentColor.name), !this.isMobile && h("h4", null, this.currentColor.number), !this.isMobile && h("div", { class: "divider" }), h("div", { class: "boxes__box-content__info__value" }, h("div", { class: "boxes__box-content__info__value-image" }, ((_a = this.currentColor) === null || _a === void 0 ? void 0 : _a.image) && h("img", { src: `${APIURL}/assets/${this.currentColor.image}?access_token=${accessToken}`, alt: "color-image" })), h("div", { class: "boxes__box-content__info__value-product" }, h("div", null, !this.isMobile && h("p", null, "Produkt:"), this.isMobile && h("h2", null, (_b = this.currentColor) === null || _b === void 0 ? void 0 : _b.name), " ", h("p", null, this.product)), this.isMobile && h("div", { class: 'divider' }), this.currentColor && ((_c = this.currentColor.links) === null || _c === void 0 ? void 0 : _c.find((link) => (link === null || link === void 0 ? void 0 : link.shop) === this.shop)) && (h("a", { onClick: this.goToProduct, class: `${this.currentColor.buttonInverse ? 'inverse' : ''}`, target: "_blank", href: (_e = (_d = this === null || this === void 0 ? void 0 : this.currentColor.links) === null || _d === void 0 ? void 0 : _d.find((link) => (link === null || link === void 0 ? void 0 : link.shop) === this.shop)) === null || _e === void 0 ? void 0 : _e.path }, "przejd\u017A do produktu"))))), h("div", { class: "boxes__box-content__slider" }, h("my-slider", { color: this.currentColor.name, shop: this.shop, product: this.product, slides: (_f = this.data) === null || _f === void 0 ? void 0 : _f.images }), ' ')));
34
36
  }
35
37
  static get is() { return "my-colorinfo"; }
36
38
  static get properties() {
@@ -40,7 +42,7 @@ export class MyColorInfo {
40
42
  "mutable": false,
41
43
  "complexType": {
42
44
  "original": "Color",
43
- "resolved": "{ hex: string; image: Record<string, Data<Image>>; links: Link[]; name: string; position: number; buttonInverse: boolean; textWhite: boolean; id?: number | undefined; category?: Data<Partial<Color>> | undefined; number?: string | undefined; }",
45
+ "resolved": "{ hex: string; image: Record<string, Image>; links: Link[]; name: string; position: number; buttonInverse: boolean; textWhite: boolean; id?: number | undefined; category?: Partial<Color> | undefined; number?: string | undefined; Category_id: Color; }",
44
46
  "references": {
45
47
  "Color": {
46
48
  "location": "import",
@@ -94,7 +96,7 @@ export class MyColorInfo {
94
96
  "mutable": false,
95
97
  "complexType": {
96
98
  "original": "Product | null",
97
- "resolved": "null | { colors?: Color[] | undefined; modalDescription: string; modalLogo: Record<string, Data<Image>>; modalName: string; name: string; createdAt: string; locale: string; publishedAt: string; shops: Data<Shop>[]; images: Record<string, Data<Image>[]>; id?: string | undefined; categories?: any; }",
99
+ "resolved": "null | { colors?: Color[] | undefined; modalDescription: string; modalLogo: string; modalName: string; name: string; Shop: ProductShopRelation[]; useColorImage: boolean; images: any; id?: string | undefined; Category: ProductCategoryRelation[]; }",
98
100
  "references": {
99
101
  "Product": {
100
102
  "location": "import",
@@ -1 +1 @@
1
- {"version":3,"file":"my-colorinfo.js","sourceRoot":"","sources":["../../../src/components/my-colorinfo/my-colorinfo.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;AAK9C,MAAM,OAAO,WAAW;;IAWtB,gBAAW,GAAG,GAAG,EAAE;;MACjB,IAAI,CAAC,YAAY;QACf,YAAY,CAAC;UACX,KAAK,EAAE,aAAa;UACpB,IAAI,EAAE,IAAI,CAAC,IAAI;UACf,OAAO,EAAE,IAAI,CAAC,OAAO;UACrB,KAAK,EAAE,MAAA,IAAI,CAAC,YAAY,0CAAE,IAAI;SAC/B,CAAC,CAAC;IACP,CAAC,CAAC;IAEF,uBAAkB,GAAG,GAAG,EAAE;MACxB,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;IAC3B,CAAC,CAAC;;;;gBAnB6B,IAAI;oBACP,KAAK;;sBAEZ,WAAW;;EAkBhC,MAAM;;IACJ,OAAO,CACL,WACE,KAAK,EAAE,sBAAsB,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,EAAE,EAAE,EAC7F,KAAK,EAAE;QACL,UAAU,EAAE,IAAI,CAAC,YAAY,CAAC,GAAG;QACjC,QAAQ,EAAE,GAAG,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,GAAG,CAAC,IAAI;OAC5D;MAEA,IAAI,CAAC,QAAQ,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, h, getAssetPath, Event, EventEmitter } from '@stencil/core';\nimport { setDataLayer } from '../../gtmUtils';\nimport { Color, Link, Product } from '../../types';\n@Component({\n tag: 'my-colorinfo',\n})\nexport class MyColorInfo {\n @Prop() currentColor: Color;\n @Prop() shop: string;\n @Prop() product: string;\n @Prop() data: Product | null = null;\n @Prop() isMobile: boolean = false;\n @Prop() infoBoxWidth: number | null;\n @Prop() closeImage = 'close.png';\n\n @Event() closeInfoBox: EventEmitter;\n\n goToProduct = () => {\n this.currentColor &&\n setDataLayer({\n event: 'GoToProduct',\n shop: this.shop,\n product: this.product,\n color: this.currentColor?.name,\n });\n };\n\n onCloseButtonClick = () => {\n this.closeInfoBox.emit();\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.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 {!this.isMobile && <h2>{this.currentColor.name}</h2>}\n {!this.isMobile && <h4>{this.currentColor.number}</h4>}\n {!this.isMobile && <div class=\"divider\"></div>}\n <div class=\"boxes__box-content__info__value\">\n <div class=\"boxes__box-content__info__value-image\">\n {this.currentColor?.image.data! && <img src={`${this.currentColor?.image?.data?.attributes?.formats.thumbnail.url}`} 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 && this.currentColor.links.find((link: Link) => link?.shop?.data?.attributes?.name === this.shop) && (\n <a\n onClick={this.goToProduct}\n class={`${this.currentColor.buttonInverse ? 'inverse' : ''}`}\n target=\"_blank\"\n href={this?.currentColor.links.find((link: Link) => link?.shop?.data?.attributes?.name === this.shop)?.path}\n >\n przejdź do produktu\n </a>\n )}\n </div>\n </div>\n </div>\n <div class=\"boxes__box-content__slider\">\n <my-slider color={this.currentColor.name} shop={this.shop} product={this.product} slides={this.data?.images.data}></my-slider>{' '}\n </div>\n </div>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"my-colorinfo.js","sourceRoot":"","sources":["../../../src/components/my-colorinfo/my-colorinfo.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;AAI7C,MAAM,OAAO,WAAW;;IAWtB,gBAAW,GAAG,GAAG,EAAE;;MACjB,IAAI,CAAC,YAAY;QACf,YAAY,CAAC;UACX,KAAK,EAAE,aAAa;UACpB,IAAI,EAAE,IAAI,CAAC,IAAI;UACf,OAAO,EAAE,IAAI,CAAC,OAAO;UACrB,KAAK,EAAE,MAAA,IAAI,CAAC,YAAY,0CAAE,IAAI;SAC/B,CAAC,CAAC;IACP,CAAC,CAAC;IAEF,uBAAkB,GAAG,GAAG,EAAE;MACxB,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;IAC3B,CAAC,CAAC;;;;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,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,MAAA,IAAI,CAAC,IAAI,0CAAE,MAAM,GAAc;QAAC,GAAG,CACzH,CACF,CACP,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, h, getAssetPath, Event, EventEmitter } from '@stencil/core';\nimport { setDataLayer } from '../../gtmUtils';\nimport { Color, Link, Product } from '../../types';\nimport { APIURL, accessToken } from '../api';\n@Component({\n tag: 'my-colorinfo',\n})\nexport class MyColorInfo {\n @Prop() currentColor: Color;\n @Prop() shop: string;\n @Prop() product: string;\n @Prop() data: Product | null = null;\n @Prop() isMobile: boolean = false;\n @Prop() infoBoxWidth: number | null;\n @Prop() closeImage = 'close.png';\n\n @Event() closeInfoBox: EventEmitter;\n\n goToProduct = () => {\n this.currentColor &&\n setDataLayer({\n event: 'GoToProduct',\n shop: this.shop,\n product: this.product,\n color: this.currentColor?.name,\n });\n };\n\n onCloseButtonClick = () => {\n this.closeInfoBox.emit();\n };\n\n render() {\n console.log('current', this.currentColor);\n return (\n <div\n class={`boxes__box-content ${this.currentColor.textWhite ? 'boxes__box-content__white' : ''}`}\n style={{\n background: 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 {!this.isMobile && <h2>{this.currentColor.name}</h2>}\n {!this.isMobile && <h4>{this.currentColor.number}</h4>}\n {!this.isMobile && <div class=\"divider\"></div>}\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 && this.currentColor.links?.find((link: Link) => link?.shop === this.shop) && (\n <a\n onClick={this.goToProduct}\n class={`${this.currentColor.buttonInverse ? 'inverse' : ''}`}\n target=\"_blank\"\n href={this?.currentColor.links?.find((link: Link) => link?.shop === this.shop)?.path}\n >\n przejdź do produktu\n </a>\n )}\n </div>\n </div>\n </div>\n <div class=\"boxes__box-content__slider\">\n <my-slider color={this.currentColor.name} shop={this.shop} product={this.product} slides={this.data?.images}></my-slider>{' '}\n </div>\n </div>\n );\n }\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  display: flex;
3
3
  justify-content: center;
4
4
  align-items: center;
5
- height: 100px;
5
+ height: 190px;
6
6
  overflow: hidden;
7
7
  }
8
8
 
@@ -1,7 +1,7 @@
1
1
  import { h, getAssetPath } from '@stencil/core';
2
- import { ApiService } from '../api';
2
+ import { APIURL, ApiService, accessToken } from '../api';
3
3
  import { setDataLayer } from '../../gtmUtils';
4
- import { fetchCategoryColorsQuery, fetchColorByNumber, fetchProductColorsQuery } from '../api/services';
4
+ import { fetchCategoryColorsQuery, fetchColorByNumber, fetchProductColorsQuery, limit } from '../api/services';
5
5
  export class MyModal {
6
6
  constructor() {
7
7
  this.boxDesktopWidth = 130;
@@ -57,10 +57,18 @@ export class MyModal {
57
57
  };
58
58
  this.fetchProductData = async () => {
59
59
  try {
60
- const response = await ApiService.getData(`products?populate[0]=modalLogo&populate[1]=images&populate[2]=shops&populate[3]=categories&filters[name][$contains]=${this.product}`);
61
- if (response) {
62
- if (response.data[0].attributes.shops.data.find((shop) => shop.attributes.name === this.shop).id) {
63
- this.data = Object.assign(Object.assign({}, response.data[0].attributes), { id: response.data[0].id });
60
+ const shopResponse = await ApiService.getData(`items/Shop?filter[name][_eq]=${this.shop}`);
61
+ const shop = shopResponse === null || shopResponse === void 0 ? void 0 : shopResponse.data[0];
62
+ if (shop.id) {
63
+ const response = await ApiService.getData(`items/Product?filter[name][_eq]=${this.product}&fields=*,images.*,Shop.*,Category.*.*.*.*`);
64
+ const product = response === null || response === void 0 ? void 0 : response.data[0];
65
+ if (product) {
66
+ if (product.Shop.find((s) => s.Shop_id === shop.id)) {
67
+ this.data = Object.assign(Object.assign({}, response.data[0]), { id: response.data[0].id });
68
+ }
69
+ else {
70
+ return null;
71
+ }
64
72
  }
65
73
  }
66
74
  }
@@ -71,17 +79,16 @@ export class MyModal {
71
79
  this.preloader = false;
72
80
  }
73
81
  };
74
- // TODO:
75
82
  this.fetchProductColors = async (id, page) => {
76
83
  this.loading = true;
77
84
  try {
78
- const response = await ApiService.getData(`colors?${fetchProductColorsQuery(id, page)}`);
85
+ const response = await ApiService.getData(`items/Color?${fetchProductColorsQuery(id, page)}`);
79
86
  if (response) {
80
87
  this.colors = {
81
88
  list: response &&
82
89
  response.data &&
83
- response.data.map((item) => (Object.assign({ id: item.id }, item.attributes))),
84
- pagination: response.meta.pagination,
90
+ response.data.map((item) => (Object.assign({}, item))),
91
+ pagination: response.meta,
85
92
  };
86
93
  }
87
94
  }
@@ -92,16 +99,16 @@ export class MyModal {
92
99
  this.loading = false;
93
100
  }
94
101
  };
95
- this.fetchCategoryColors = async (color) => {
102
+ this.fetchCategoryColors = async (id, page) => {
96
103
  this.loading = true;
97
104
  try {
98
- const response = await ApiService.getData(`colors?${fetchCategoryColorsQuery(color)}`);
105
+ const response = await ApiService.getData(`items/Color?${fetchCategoryColorsQuery(id, page)}`);
99
106
  if (response) {
100
107
  this.colors = {
101
108
  list: response &&
102
109
  response.data &&
103
- response.data.map((item) => (Object.assign({ id: item.id }, item.attributes))),
104
- pagination: response.meta.pagination,
110
+ response.data.map((item) => (Object.assign({}, item))),
111
+ pagination: response.meta,
105
112
  };
106
113
  }
107
114
  }
@@ -112,29 +119,21 @@ export class MyModal {
112
119
  this.loading = false;
113
120
  }
114
121
  };
115
- // private onIntersection = async (entries: any) => {
116
- // console.log(entries[0]);
117
- // if (entries[0].intersectionRatio === 0) {
118
- // console.log('d');
119
- // }
120
- // };
121
- // private handleObserve = () => {
122
- // console.log(this.modalEl.shadowRoot);
123
- // const boxesList: any = (this.modalEl as any).querySelector('.my-modal__wrapper');
124
- // console.log(boxesList);
125
- // if (boxesList) {
126
- // this.observer = new IntersectionObserver(this.onIntersection);
127
- // this.observer.observe(boxesList);
128
- // }
129
- // };
130
122
  this.onPage = (page) => {
131
- this.data && this.fetchProductColors(String(this.data.id), page);
123
+ if (this.data) {
124
+ if (this.selectedCategory) {
125
+ this.fetchCategoryColors(this.selectedCategory, page);
126
+ }
127
+ else {
128
+ this.fetchProductColors(String(this.data.id), page);
129
+ }
130
+ }
132
131
  this.page = page;
133
132
  this.currentColor = null;
134
133
  this.currentIndex = null;
135
134
  };
136
135
  this.handleCategoryClick = (color) => {
137
- if (this.selectedCategory && color && this.selectedCategory.id === color.id && !this.showRange) {
136
+ if (this.selectedCategory && color && this.selectedCategory === color && !this.showRange) {
138
137
  this.data && this.fetchProductColors(String(this.data.id));
139
138
  this.selectedCategory = null;
140
139
  }
@@ -143,6 +142,7 @@ export class MyModal {
143
142
  this.selectedCategory = color;
144
143
  }
145
144
  this.currentColor = null;
145
+ this.clearSearchText.emit();
146
146
  };
147
147
  this.shop = undefined;
148
148
  this.product = undefined;
@@ -168,9 +168,9 @@ export class MyModal {
168
168
  this.infoBoxWidth = newValue * this.boxWidth;
169
169
  }
170
170
  watchPropHandler(newValue) {
171
- if (newValue.categories.data.length > 0) {
171
+ if (newValue.Category.length > 0) {
172
172
  this.showRange = true;
173
- this.handleCategoryClick(newValue.categories.data[0]);
173
+ this.handleCategoryClick(newValue.Category[0].Category_id.id);
174
174
  }
175
175
  else {
176
176
  this.fetchProductColors(String(newValue.id));
@@ -194,21 +194,23 @@ export class MyModal {
194
194
  this.displayForMobile();
195
195
  }
196
196
  async searchColorsHandler(event) {
197
- var _a;
197
+ this.loading = true;
198
+ this.currentColor = null;
198
199
  // if search is empty set to first category to not showing whole product colors
199
200
  if (event.detail === '') {
200
- this.handleCategoryClick((_a = this.data) === null || _a === void 0 ? void 0 : _a.categories.data[0]);
201
+ this.handleCategoryClick(this.selectedCategory);
202
+ this.loading = true;
201
203
  }
202
204
  try {
203
205
  if (this.data && this.data.id && event.detail !== '') {
204
- this.selectedCategory = null;
205
- const response = await ApiService.getData(`colors?${fetchColorByNumber(Number(this.data.id), event.detail)}`);
206
+ const response = await ApiService.getData(`items/Color?${fetchColorByNumber(Number(this.selectedCategory), event.detail)}`);
206
207
  if (response) {
207
208
  this.colors = {
208
- list: response &&
209
+ list: (response &&
209
210
  response.data &&
210
- response.data.map((item) => (Object.assign({ id: item.id }, item.attributes))),
211
- pagination: response.meta.pagination,
211
+ response.data.map((item) => (Object.assign({}, item)))) ||
212
+ [],
213
+ pagination: response.meta,
212
214
  };
213
215
  }
214
216
  }
@@ -216,6 +218,9 @@ export class MyModal {
216
218
  catch (error) {
217
219
  console.error(error);
218
220
  }
221
+ finally {
222
+ this.loading = false;
223
+ }
219
224
  }
220
225
  componentWillLoad() {
221
226
  this.preloader = true;
@@ -227,11 +232,9 @@ export class MyModal {
227
232
  this.colorTimer();
228
233
  }
229
234
  render() {
230
- var _a, _b, _c, _d, _e, _f, _g;
231
- 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 && (h("button", { class: "my-modal__close", onClick: () => this.closeModalHandler() }, h("img", { src: getAssetPath(`./assets/${this.closeImage}`), alt: "closebtn" }))), !this.preloader && this.data && this.data.modalLogo && h("img", { src: `${(_d = (_c = (_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a.modalLogo) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.attributes) === null || _d === void 0 ? void 0 : _d.url}`, alt: "modal-logo" }), !this.preloader && (h("p", { class: "my-modal__see-more" }, (_e = this.data) === null || _e === void 0 ? void 0 : _e.modalDescription)), this.showRange && (h("div", { class: 'categories' }, this.data && h("my-search", { productId: Number((_f = this.data) === null || _f === void 0 ? void 0 : _f.id), isMobile: this.isMobile }), h("div", { class: 'categories__container', style: { maxWidth: `${this.infoBoxWidth}px` } }, (_g = this.data) === null || _g === void 0 ? void 0 : _g.categories.data.map((c) => {
232
- var _a;
233
- return (h("my-colorbox", { key: c.id, onClick: () => this.handleCategoryClick(c), color: c.attributes.hex, name: c.attributes.name, shop: this.shop, product: this.product, isCategoryActive: ((_a = this.selectedCategory) === null || _a === void 0 ? void 0 : _a.id) === c.id }));
234
- })), this.isMobile && (h("div", { class: 'categories__slide-information', style: { width: `${this.infoBoxWidth}px` } }, h("span", null, "Przewi\u0144 w lewo"), h("span", null, "Przewi\u0144 w prawo"))))), 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) => {
235
+ var _a, _b, _c, _d;
236
+ console.log(this.colors);
237
+ 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 && (h("button", { class: "my-modal__close", onClick: () => this.closeModalHandler() }, h("img", { src: getAssetPath(`./assets/${this.closeImage}`), alt: "closebtn" }))), !this.preloader && this.data && this.data.modalLogo && 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)), this.showRange && (h("div", { class: 'categories' }, this.data && h("my-search", { productId: Number((_c = this.data) === null || _c === void 0 ? void 0 : _c.id), isMobile: this.isMobile }), h("div", { class: 'categories__container', style: { maxWidth: `${this.infoBoxWidth}px` } }, (_d = this.data) === null || _d === void 0 ? void 0 : _d.Category.map((c) => (h("my-colorbox", { key: c.id, onClick: () => this.handleCategoryClick(c.Category_id.id), color: c.Category_id.hex, name: c.Category_id.category_name, shop: this.shop, product: this.product, isCategoryActive: this.selectedCategory === c.Category_id.id })))), this.isMobile && (h("div", { class: 'categories__slide-information', style: { width: `${this.infoBoxWidth}px` } }, h("span", null, "Przewi\u0144 w lewo"), h("span", null, "Przewi\u0144 w prawo"))))), 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) => {
235
238
  var _a;
236
239
  return (h("div", { key: index, class: "boxes" }, h("div", { class: "boxes__list" }, color.map((c) => {
237
240
  var _a;
@@ -250,10 +253,10 @@ export class MyModal {
250
253
  ];
251
254
  }, color: c.hex, name: c.name, isActive: ((_a = this.currentColor) === null || _a === void 0 ? void 0 : _a.id) === c.id, shop: this.shop, product: this.product }));
252
255
  })), ((_a = this.currentColor) === null || _a === void 0 ? void 0 : _a.id) && index === this.currentIndex && (h("my-colorinfo", { currentColor: this.currentColor, shop: this.shop, product: this.product, data: this.data, isMobile: this.isMobile, infoBoxWidth: this.infoBoxWidth }))));
253
- })) : (h("p", null, "Brak wynik\u00F3w")), this.colors.pagination.pageCount > 1 && (h("div", { class: 'pagination' }, Array.from({ length: this.colors.pagination.pageCount }).map((page, i) => (h("span", { class: i + 1 === this.page ? 'current' : '', onClick: e => {
256
+ })) : (h("p", null, "Brak wynik\u00F3w")), this.colors.pagination.filter_count > limit && (h("div", { class: 'pagination' }, Array.from({ length: Math.ceil(this.colors.pagination.filter_count / limit) }).map((_, i) => (h("span", { class: i + 1 === this.page ? 'current' : '', onClick: e => {
254
257
  e.preventDefault();
255
258
  this.onPage(i + 1);
256
- }, key: `#${i + 1 + page}` }, i + 1)))))))), ' ', !this.preloader && this.isMobile && (h("button", { class: "button", onClick: () => this.closeModalHandler() }, "Zamknij"))));
259
+ }, key: `#${i + 1}` }, i + 1)))))))), !this.preloader && this.isMobile && (h("button", { class: "button", onClick: () => this.closeModalHandler() }, "Zamknij"))));
257
260
  }
258
261
  static get is() { return "my-modal"; }
259
262
  static get originalStyleUrls() {
@@ -362,6 +365,21 @@ export class MyModal {
362
365
  }
363
366
  static get events() {
364
367
  return [{
368
+ "method": "clearSearchText",
369
+ "name": "clearSearchText",
370
+ "bubbles": true,
371
+ "cancelable": true,
372
+ "composed": true,
373
+ "docs": {
374
+ "tags": [],
375
+ "text": ""
376
+ },
377
+ "complexType": {
378
+ "original": "any",
379
+ "resolved": "any",
380
+ "references": {}
381
+ }
382
+ }, {
365
383
  "method": "close",
366
384
  "name": "close",
367
385
  "bubbles": true,