@ppg_pl/tinting 0.0.5 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{index-0a139db0.js → index-b6962659.js} +51 -4
- package/dist/cjs/index-b6962659.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/modal-header_9.cjs.entry.js +165 -41
- package/dist/cjs/modal-header_9.cjs.entry.js.map +1 -1
- package/dist/cjs/tinting.cjs.js +2 -2
- package/dist/collection/components/colorbox/index.js +18 -1
- package/dist/collection/components/colorbox/index.js.map +1 -1
- package/dist/collection/components/colorinfo/index.js +128 -1
- package/dist/collection/components/colorinfo/index.js.map +1 -1
- package/dist/collection/components/component/index.js +64 -1
- package/dist/collection/components/component/index.js.map +1 -1
- package/dist/collection/components/modal/index.css +176 -1
- package/dist/collection/components/modal/index.js +50 -2
- package/dist/collection/components/modal/index.js.map +1 -1
- package/dist/collection/components/slider/index.css +24 -6
- package/dist/collection/components/slider/index.js +32 -21
- package/dist/collection/components/slider/index.js.map +1 -1
- package/dist/collection/types.js.map +1 -1
- package/dist/collection/utils/index.js +17 -0
- package/dist/collection/utils/index.js.map +1 -1
- package/dist/components/index10.js +4934 -3598
- package/dist/components/index10.js.map +1 -1
- package/dist/components/index11.js +3989 -0
- package/dist/components/index11.js.map +1 -0
- package/dist/components/index4.js +2 -13
- package/dist/components/index4.js.map +1 -1
- package/dist/components/index6.js +28 -27
- package/dist/components/index6.js.map +1 -1
- package/dist/components/index7.js +9 -53
- package/dist/components/index7.js.map +1 -1
- package/dist/components/index8.js +57 -52
- package/dist/components/index8.js.map +1 -1
- package/dist/components/index9.js +124 -5272
- package/dist/components/index9.js.map +1 -1
- package/dist/components/my-backdrop.js +1 -1
- package/dist/components/my-colorbox.js +1 -1
- package/dist/components/my-colorinfo.js +1 -1
- package/dist/components/my-component.js +18 -7
- package/dist/components/my-component.js.map +1 -1
- package/dist/components/my-modal.js +1 -1
- package/dist/components/my-slider.js +1 -1
- package/dist/esm/{index-f3be6531.js → index-cb79645d.js} +51 -4
- package/dist/esm/index-cb79645d.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/modal-header_9.entry.js +165 -41
- package/dist/esm/modal-header_9.entry.js.map +1 -1
- package/dist/esm/tinting.js +3 -3
- package/dist/tinting/p-2730a042.entry.js +15 -0
- package/dist/tinting/p-2730a042.entry.js.map +1 -0
- package/dist/tinting/p-5b9dc044.js +3 -0
- package/dist/tinting/p-5b9dc044.js.map +1 -0
- package/dist/tinting/tinting.esm.js +1 -1
- package/dist/tinting/tinting.esm.js.map +1 -1
- package/dist/types/components/colorbox/index.d.ts +3 -0
- package/dist/types/components/colorinfo/index.d.ts +17 -1
- package/dist/types/components/component/index.d.ts +8 -0
- package/dist/types/components/modal/index.d.ts +6 -1
- package/dist/types/components.d.ts +16 -2
- package/dist/types/types.d.ts +4 -0
- package/dist/types/utils/index.d.ts +6 -0
- package/package.json +3 -2
- package/www/build/p-2730a042.entry.js +15 -0
- package/www/build/p-2730a042.entry.js.map +1 -0
- package/www/build/p-5b9dc044.js +3 -0
- package/www/build/p-5b9dc044.js.map +1 -0
- package/www/build/tinting.esm.js +1 -1
- package/www/build/tinting.esm.js.map +1 -1
- package/www/index.html +76 -12
- package/dist/cjs/index-0a139db0.js.map +0 -1
- package/dist/esm/index-f3be6531.js.map +0 -1
- package/dist/tinting/p-398633de.entry.js +0 -15
- package/dist/tinting/p-398633de.entry.js.map +0 -1
- package/dist/tinting/p-b135c76f.js +0 -3
- package/dist/tinting/p-b135c76f.js.map +0 -1
- package/www/build/p-398633de.entry.js +0 -15
- package/www/build/p-398633de.entry.js.map +0 -1
- package/www/build/p-b135c76f.js +0 -3
- package/www/build/p-b135c76f.js.map +0 -1
|
@@ -168,12 +168,15 @@
|
|
|
168
168
|
}
|
|
169
169
|
.my-modal__wrapper .boxes__box-content__info__value {
|
|
170
170
|
display: flex;
|
|
171
|
-
flex-direction:
|
|
171
|
+
flex-direction: column;
|
|
172
172
|
justify-content: flex-start;
|
|
173
|
+
align-items: flex-start;
|
|
174
|
+
gap: 20px;
|
|
173
175
|
}
|
|
174
176
|
@media (max-width: 1024px) {
|
|
175
177
|
.my-modal__wrapper .boxes__box-content__info__value {
|
|
176
178
|
justify-content: flex-start;
|
|
179
|
+
margin-top: 30px;
|
|
177
180
|
}
|
|
178
181
|
}
|
|
179
182
|
@media (max-width: 768px) {
|
|
@@ -242,6 +245,39 @@
|
|
|
242
245
|
flex-direction: column;
|
|
243
246
|
}
|
|
244
247
|
}
|
|
248
|
+
.my-modal__wrapper .boxes__box-content__info__tester {
|
|
249
|
+
display: flex;
|
|
250
|
+
flex-direction: column;
|
|
251
|
+
gap: 15px;
|
|
252
|
+
width: 100%;
|
|
253
|
+
}
|
|
254
|
+
.my-modal__wrapper .boxes__box-content__info__tester .tester-text h2 {
|
|
255
|
+
margin: 0 0 10px;
|
|
256
|
+
font-size: 18px;
|
|
257
|
+
font-weight: 700;
|
|
258
|
+
}
|
|
259
|
+
.my-modal__wrapper .boxes__box-content__info__tester .tester-text p {
|
|
260
|
+
margin: 0;
|
|
261
|
+
font-size: 14px;
|
|
262
|
+
}
|
|
263
|
+
.my-modal__wrapper .boxes__box-content__info__tester .tester-buy {
|
|
264
|
+
display: flex;
|
|
265
|
+
align-items: center;
|
|
266
|
+
gap: 15px;
|
|
267
|
+
width: 100%;
|
|
268
|
+
flex-wrap: nowrap;
|
|
269
|
+
min-width: 0;
|
|
270
|
+
}
|
|
271
|
+
@media (max-width: 1024px) {
|
|
272
|
+
.my-modal__wrapper .boxes__box-content__info__tester .tester-buy {
|
|
273
|
+
flex-direction: column;
|
|
274
|
+
align-items: flex-start;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
.my-modal__wrapper .boxes__box-content__info .price {
|
|
278
|
+
font-size: 20px;
|
|
279
|
+
font-weight: 600;
|
|
280
|
+
}
|
|
245
281
|
.my-modal__wrapper .boxes__box-content__slider {
|
|
246
282
|
width: 60%;
|
|
247
283
|
min-width: 60%;
|
|
@@ -341,6 +377,28 @@
|
|
|
341
377
|
transition: all 0.7s ease-in-out;
|
|
342
378
|
border: none;
|
|
343
379
|
cursor: pointer;
|
|
380
|
+
display: flex;
|
|
381
|
+
align-items: center;
|
|
382
|
+
gap: 5px;
|
|
383
|
+
}
|
|
384
|
+
.my-modal .button .shape-icon,
|
|
385
|
+
.my-modal a .shape-icon {
|
|
386
|
+
display: inline-flex;
|
|
387
|
+
}
|
|
388
|
+
.my-modal .button .shape-icon svg,
|
|
389
|
+
.my-modal a .shape-icon svg {
|
|
390
|
+
display: block;
|
|
391
|
+
}
|
|
392
|
+
.my-modal .button .shape-icon path,
|
|
393
|
+
.my-modal .button .shape-icon .shape-icon__path,
|
|
394
|
+
.my-modal a .shape-icon path,
|
|
395
|
+
.my-modal a .shape-icon .shape-icon__path {
|
|
396
|
+
fill: currentColor;
|
|
397
|
+
transition: fill 0.7s ease-in-out;
|
|
398
|
+
}
|
|
399
|
+
.my-modal .button.fit,
|
|
400
|
+
.my-modal a.fit {
|
|
401
|
+
padding: 10px 15px;
|
|
344
402
|
}
|
|
345
403
|
.my-modal .button:hover,
|
|
346
404
|
.my-modal a:hover {
|
|
@@ -367,6 +425,50 @@
|
|
|
367
425
|
color: #232323;
|
|
368
426
|
background-color: #fff;
|
|
369
427
|
}
|
|
428
|
+
.my-modal .button.inverse svg path,
|
|
429
|
+
.my-modal a.inverse svg path {
|
|
430
|
+
fill: #fff;
|
|
431
|
+
}
|
|
432
|
+
.my-modal .button:disabled, .my-modal .button.disabled,
|
|
433
|
+
.my-modal a:disabled,
|
|
434
|
+
.my-modal a.disabled {
|
|
435
|
+
cursor: not-allowed;
|
|
436
|
+
opacity: 0.5;
|
|
437
|
+
}
|
|
438
|
+
.my-modal .button.is-loading,
|
|
439
|
+
.my-modal a.is-loading {
|
|
440
|
+
position: relative;
|
|
441
|
+
cursor: wait;
|
|
442
|
+
}
|
|
443
|
+
.my-modal .button.is-loading:hover,
|
|
444
|
+
.my-modal a.is-loading:hover {
|
|
445
|
+
background-color: inherit;
|
|
446
|
+
color: inherit;
|
|
447
|
+
}
|
|
448
|
+
.my-modal .button.is-loading .button-content,
|
|
449
|
+
.my-modal a.is-loading .button-content {
|
|
450
|
+
visibility: hidden;
|
|
451
|
+
}
|
|
452
|
+
.my-modal .button.is-loading .spinner,
|
|
453
|
+
.my-modal a.is-loading .spinner {
|
|
454
|
+
position: absolute;
|
|
455
|
+
inset: 0;
|
|
456
|
+
display: flex;
|
|
457
|
+
align-items: center;
|
|
458
|
+
justify-content: center;
|
|
459
|
+
animation: basket-spin 0.9s linear infinite;
|
|
460
|
+
color: currentColor;
|
|
461
|
+
}
|
|
462
|
+
.my-modal .button.is-loading .spinner svg,
|
|
463
|
+
.my-modal a.is-loading .spinner svg {
|
|
464
|
+
display: block;
|
|
465
|
+
}
|
|
466
|
+
.my-modal .button .button-content,
|
|
467
|
+
.my-modal a .button-content {
|
|
468
|
+
display: inline-flex;
|
|
469
|
+
align-items: center;
|
|
470
|
+
gap: 5px;
|
|
471
|
+
}
|
|
370
472
|
@media (max-width: 1024px) {
|
|
371
473
|
.my-modal .button,
|
|
372
474
|
.my-modal a {
|
|
@@ -383,4 +485,77 @@
|
|
|
383
485
|
}
|
|
384
486
|
.my-modal > .button {
|
|
385
487
|
margin: 10px auto;
|
|
488
|
+
}
|
|
489
|
+
.my-modal .basket-status {
|
|
490
|
+
cursor: default;
|
|
491
|
+
pointer-events: none;
|
|
492
|
+
max-width: 100%;
|
|
493
|
+
min-width: 0;
|
|
494
|
+
}
|
|
495
|
+
.my-modal .basket-status--success {
|
|
496
|
+
display: inline-flex;
|
|
497
|
+
align-items: center;
|
|
498
|
+
gap: 10px;
|
|
499
|
+
padding: 12px 18px;
|
|
500
|
+
background-color: #fff;
|
|
501
|
+
color: #232323;
|
|
502
|
+
border-radius: 28px 28px 28px 0;
|
|
503
|
+
box-shadow: 0px 10px 20px rgba(0, 0, 0, 0.1);
|
|
504
|
+
font-size: 14px;
|
|
505
|
+
white-space: nowrap;
|
|
506
|
+
animation: basket-success-in 0.25s ease-out;
|
|
507
|
+
max-width: 100%;
|
|
508
|
+
min-width: 0;
|
|
509
|
+
flex: 1 1 auto;
|
|
510
|
+
}
|
|
511
|
+
.my-modal .basket-status--success > span:last-child {
|
|
512
|
+
min-width: 0;
|
|
513
|
+
overflow: hidden;
|
|
514
|
+
text-overflow: ellipsis;
|
|
515
|
+
}
|
|
516
|
+
.my-modal .basket-status--success .check-icon {
|
|
517
|
+
display: inline-flex;
|
|
518
|
+
color: #2bb673;
|
|
519
|
+
}
|
|
520
|
+
.my-modal .basket-status--success .check-icon svg {
|
|
521
|
+
display: block;
|
|
522
|
+
width: 20px;
|
|
523
|
+
height: 20px;
|
|
524
|
+
}
|
|
525
|
+
.my-modal .basket-status--success strong {
|
|
526
|
+
font-weight: 700;
|
|
527
|
+
}
|
|
528
|
+
.my-modal .basket-status--success.inverse {
|
|
529
|
+
background-color: #232323;
|
|
530
|
+
color: #fff;
|
|
531
|
+
}
|
|
532
|
+
.my-modal .basket-status--success.brown {
|
|
533
|
+
background-color: #3c2114;
|
|
534
|
+
color: #fff;
|
|
535
|
+
}
|
|
536
|
+
@media (max-width: 1024px) {
|
|
537
|
+
.my-modal .basket-status--success {
|
|
538
|
+
font-size: 13px;
|
|
539
|
+
padding: 12px 22px;
|
|
540
|
+
border-radius: 22px 22px 22px 0;
|
|
541
|
+
white-space: normal;
|
|
542
|
+
width: 100%;
|
|
543
|
+
justify-content: center;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
@keyframes basket-spin {
|
|
548
|
+
to {
|
|
549
|
+
transform: rotate(360deg);
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
@keyframes basket-success-in {
|
|
553
|
+
from {
|
|
554
|
+
opacity: 0;
|
|
555
|
+
transform: translateX(-8px);
|
|
556
|
+
}
|
|
557
|
+
to {
|
|
558
|
+
opacity: 1;
|
|
559
|
+
transform: translateX(0);
|
|
560
|
+
}
|
|
386
561
|
}
|
|
@@ -65,6 +65,8 @@ export class Modal {
|
|
|
65
65
|
this.shop = undefined;
|
|
66
66
|
this.product = undefined;
|
|
67
67
|
this.baselink = undefined;
|
|
68
|
+
this.available_testers = undefined;
|
|
69
|
+
this.price = undefined;
|
|
68
70
|
this.selectedcolor = undefined;
|
|
69
71
|
this.arrowDown = 'arrow_down.png';
|
|
70
72
|
this.chunksNum = 12;
|
|
@@ -119,6 +121,9 @@ export class Modal {
|
|
|
119
121
|
handleEmitColor(event) {
|
|
120
122
|
this.onSelectedColorEmit.emit(event.detail);
|
|
121
123
|
}
|
|
124
|
+
addToBasketHandler(event) {
|
|
125
|
+
return event.detail.id;
|
|
126
|
+
}
|
|
122
127
|
handleResize() {
|
|
123
128
|
this.calculateBoxCount();
|
|
124
129
|
this.displayForMobile();
|
|
@@ -399,7 +404,7 @@ export class Modal {
|
|
|
399
404
|
var _a;
|
|
400
405
|
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("modal-header", { modalName: this.data.modalName, modalLogo: this.data.modalLogo ? `${APIURL}/assets/${this.data.modalLogo}?access_token=${accessToken}` : null, modalDescription: this.data.modalDescription, shop: this.shop, productName: this.data.name, productSamples: this.data.productSamples, selectedColorFamily: this.filters.colorFamily, isMobile: this.isMobile, onCloseModal: () => this.closeModalHandler(), onSampleSelected: event => this.handleSampleSelect(event.detail), onOnLogoClick: () => this.resetAllFilters(), onOnResetCategory: () => this.resetSelectedCategory() })), h("div", { class: 'my-modal__wrapper' }, !this.preloader && (h("div", { class: 'container_boxes' }, !this.loading && this.colorsList.length === 0 && (h("div", { class: "not-found" }, h("p", null, "Nie zaleziono wynik\u00F3w wyszukiwania pod danym has\u0142em."), h("p", null, " Wpisz inn\u0105 nazw\u0119 b\u0105d\u017A numer koloru lub skorzystaj z kolekcji kolorystycznych."))), ((_a = this.colorsList) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
|
|
401
406
|
this.chunks(this.colorsList).map((color, index) => {
|
|
402
|
-
var _a;
|
|
407
|
+
var _a, _b;
|
|
403
408
|
return (h("div", { key: index, class: "boxes" }, h("div", { class: "boxes__list" }, color.map((c) => {
|
|
404
409
|
var _a;
|
|
405
410
|
return (h("my-colorbox", { key: c.id, onClick: () => {
|
|
@@ -422,7 +427,7 @@ export class Modal {
|
|
|
422
427
|
isImageInsteadHex: c.imageInsteadHex,
|
|
423
428
|
bigImage: c.bigImage,
|
|
424
429
|
} }));
|
|
425
|
-
})), ((_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, baselink: this.baselink }))));
|
|
430
|
+
})), ((_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, baselink: this.baselink, availableTesters: (_b = this.available_testers) === null || _b === void 0 ? void 0 : _b.find((tester) => { var _a, _b, _c; return ((_a = tester.color_name) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase()) === ((_c = (_b = this.currentColor) === null || _b === void 0 ? void 0 : _b.name) === null || _c === void 0 ? void 0 : _c.trim().toLowerCase()); }), price: this.price }))));
|
|
426
431
|
}))), this.loading && h("my-loader", null)), !this.preloader && this.isMobile && (h("button", { class: "button", onClick: () => this.closeModalHandler() }, "Zamknij"))));
|
|
427
432
|
}
|
|
428
433
|
static get is() { return "my-modal"; }
|
|
@@ -490,6 +495,43 @@ export class Modal {
|
|
|
490
495
|
"attribute": "baselink",
|
|
491
496
|
"reflect": false
|
|
492
497
|
},
|
|
498
|
+
"available_testers": {
|
|
499
|
+
"type": "unknown",
|
|
500
|
+
"mutable": false,
|
|
501
|
+
"complexType": {
|
|
502
|
+
"original": "AvailableTester[] | null",
|
|
503
|
+
"resolved": "AvailableTester[] | null",
|
|
504
|
+
"references": {
|
|
505
|
+
"AvailableTester": {
|
|
506
|
+
"location": "import",
|
|
507
|
+
"path": "../../types"
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
},
|
|
511
|
+
"required": false,
|
|
512
|
+
"optional": false,
|
|
513
|
+
"docs": {
|
|
514
|
+
"tags": [],
|
|
515
|
+
"text": ""
|
|
516
|
+
}
|
|
517
|
+
},
|
|
518
|
+
"price": {
|
|
519
|
+
"type": "number",
|
|
520
|
+
"mutable": false,
|
|
521
|
+
"complexType": {
|
|
522
|
+
"original": "number | null",
|
|
523
|
+
"resolved": "null | number",
|
|
524
|
+
"references": {}
|
|
525
|
+
},
|
|
526
|
+
"required": false,
|
|
527
|
+
"optional": false,
|
|
528
|
+
"docs": {
|
|
529
|
+
"tags": [],
|
|
530
|
+
"text": ""
|
|
531
|
+
},
|
|
532
|
+
"attribute": "price",
|
|
533
|
+
"reflect": false
|
|
534
|
+
},
|
|
493
535
|
"selectedcolor": {
|
|
494
536
|
"type": "string",
|
|
495
537
|
"mutable": false,
|
|
@@ -660,6 +702,12 @@ export class Modal {
|
|
|
660
702
|
"target": undefined,
|
|
661
703
|
"capture": false,
|
|
662
704
|
"passive": false
|
|
705
|
+
}, {
|
|
706
|
+
"name": "addToBasket",
|
|
707
|
+
"method": "addToBasketHandler",
|
|
708
|
+
"target": undefined,
|
|
709
|
+
"capture": false,
|
|
710
|
+
"passive": false
|
|
663
711
|
}, {
|
|
664
712
|
"name": "resize",
|
|
665
713
|
"method": "handleResize",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/modal/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE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,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, Listen, Watch } from '@stencil/core';\nimport { APIURL, accessToken } from '../api';\nimport { setDataLayer } from '../../gtmUtils';\nimport { Color, Product } from '../../types';\nimport { fetchColors, fetchProductData, limit, updateFilters } from '../api/services';\nimport { debounce } from '../../utils';\nimport chroma from 'chroma-js';\n\ndeclare global {\n interface Window {\n dataLayer: Record<string, any>[];\n }\n}\n\n@Component({\n tag: 'my-modal',\n styleUrl: 'index.scss',\n assetsDirs: ['assets'],\n})\nexport class Modal {\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 }) onSelectedColorEmit: EventEmitter<Color>;\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() 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() 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 @State() colorsList: Color[] = [];\n @State() hasMore = true;\n @State() filters: any = {\n type: 'product' as 'product' | 'sample' | 'number' | 'name' | 'sampleInProduct',\n id: '',\n productId: '',\n page: 1,\n colorNumber: '',\n colorName: '',\n };\n\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) {\n this.filters = updateFilters(this.filters, { id: newValue.id, type: 'product' });\n this.fetchColorsData();\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 @Listen('onCurrentColor')\n handleEmitColor(event: CustomEvent<Color>) {\n this.onSelectedColorEmit.emit(event.detail);\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 sortColorsBySimilarity(colors: Color[]): Color[] {\n if (colors?.length <= 1) return colors;\n\n const sortedColors: Color[] = [];\n const remainingColors = [...colors];\n\n // Start with the first color\n sortedColors.push(remainingColors.shift()!);\n\n while (remainingColors?.length > 0) {\n // Find the most similar color to the last color in sortedColors\n const lastColor = sortedColors[sortedColors?.length - 1];\n let mostSimilarIndex = 0;\n let minDistance = Infinity;\n\n remainingColors.forEach((color, index) => {\n try {\n // Validate hex colors before calculating distance\n if (!color.hex || !lastColor.hex) {\n return;\n }\n\n const distance = chroma.distance(lastColor.hex, color.hex, 'lab');\n if (distance < minDistance) {\n minDistance = distance;\n mostSimilarIndex = index;\n }\n } catch (error) {\n console.warn(`Error calculating color distance for ${color.hex}:`, error);\n // Skip this color if it causes an error\n }\n });\n\n // Move the most similar color to sortedColors\n sortedColors.push(remainingColors.splice(mostSimilarIndex, 1)[0]);\n }\n\n return sortedColors;\n }\n\n private getColorHueGroup(hex: string): string {\n try {\n // Validate hex format and handle invalid colors\n if (!hex || typeof hex !== 'string') {\n return 'other';\n }\n\n // Basic hex validation\n const cleanHex = hex.startsWith('#') ? hex : `#${hex}`;\n if (!/^#[0-9A-Fa-f]{6}$/.test(cleanHex)) {\n console.warn(`Invalid hex color format: ${hex}`);\n return 'other';\n }\n\n const color = chroma(cleanHex);\n const hue = color.get('hsl.h');\n const saturation = color.get('hsl.s');\n const lightness = color.get('hsl.l');\n\n // Handle grayscale colors\n if (saturation < 0.1) {\n if (lightness < 0.2) return 'black';\n if (lightness > 0.8) return 'white';\n return 'gray';\n }\n\n // Group colors by hue ranges\n if (hue >= 330 || hue < 30) return 'red';\n if (hue >= 30 && hue < 90) return 'yellow';\n if (hue >= 90 && hue < 150) return 'green';\n if (hue >= 150 && hue < 210) return 'cyan';\n if (hue >= 210 && hue < 270) return 'blue';\n if (hue >= 270 && hue < 330) return 'magenta';\n\n return 'other';\n } catch (error) {\n console.warn(`Error parsing color \"${hex}\":`, error);\n return 'other';\n }\n }\n\n private sortColorsByHueAndSimilarity(colors: Color[]): Color[] {\n if (colors?.length <= 1) return colors;\n\n // Filter out colors with invalid hex values\n const validColors = colors.filter(color => {\n if (!color.hex || typeof color.hex !== 'string') {\n console.warn(`Color missing hex value:`, color);\n return false;\n }\n\n const cleanHex = color.hex.startsWith('#') ? color.hex : `#${color.hex}`;\n const isValid = /^#[0-9A-Fa-f]{6}$/.test(cleanHex);\n\n if (!isValid) {\n console.warn(`Invalid hex color format: ${color.hex} for color:`, color);\n }\n\n return isValid;\n });\n\n // Group valid colors by their hue family\n const colorGroups: Record<string, Color[]> = {\n red: [],\n yellow: [],\n green: [],\n cyan: [],\n blue: [],\n magenta: [],\n gray: [],\n black: [],\n white: [],\n other: [],\n };\n\n validColors.forEach(color => {\n const group = this.getColorHueGroup(color.hex);\n colorGroups[group].push(color);\n });\n\n // Sort each group by similarity\n const sortedGroups: Color[][] = [];\n const groupOrder = ['red', 'magenta', 'blue', 'cyan', 'green', 'yellow', 'gray', 'black', 'white', 'other'];\n\n groupOrder.forEach(groupName => {\n if (colorGroups[groupName].length > 0) {\n sortedGroups.push(this.sortColorsBySimilarity(colorGroups[groupName]));\n }\n });\n\n // Combine all sorted groups\n return sortedGroups.flat();\n }\n\n private async fetchColorsData({ reset = false } = {}) {\n if (this.loading && !reset) return;\n this.loading = true;\n\n try {\n const colors = await fetchColors(this.filters);\n\n if (reset) {\n // For new searches, sort all colors by hue and similarity\n this.colorsList = this.sortColorsByHueAndSimilarity(colors);\n } else {\n // For pagination, combine and sort all colors\n this.colorsList = this.sortColorsByHueAndSimilarity([...this.colorsList, ...colors]);\n }\n\n this.hasMore = colors.length >= limit;\n } catch (error) {\n console.error('Error fetching colors:', error);\n } finally {\n this.loading = false;\n }\n }\n\n private async loadProductData() {\n this.preloader = true;\n\n const product = await fetchProductData({ shopName: this.shop, productName: this.product });\n\n if (product) {\n this.data = product;\n this.filters = updateFilters(this.filters, { type: 'product', id: product.id });\n\n // Fetch initial colors\n await this.fetchColorsData();\n }\n\n this.preloader = false;\n }\n\n private async loadMoreColors() {\n if (this.loading || !this.hasMore) return; // Prevent spam loading\n\n this.filters = { ...this.filters, page: this.filters.page + 1 }; // Increase page for lazy loading\n\n await this.fetchColorsData({ reset: false }); // Append results\n }\n\n private updateFilterAndFetch(newFilters: Partial<typeof this.filters>) {\n if (!this.data?.id) return;\n\n this.loading = true;\n\n this.filters = updateFilters(this.filters, {\n id: this.data.id,\n sampleId: this.filters.sampleId,\n colorName: this.filters.colorName,\n ...newFilters,\n page: 1,\n });\n\n this.fetchColorsData({ reset: true }).finally(() => {\n this.loading = false;\n });\n }\n\n async searchColor(event: CustomEvent) {\n const query = event.detail?.trim();\n\n this.updateFilterAndFetch({ colorName: query });\n }\n\n @Listen('colorFamilySelected')\n handleColorFamilySelected(event: CustomEvent) {\n this.currentColor = null;\n if (event.detail === this.filters.colorFamily) {\n this.filters = updateFilters(this.filters, { colorFamily: '' });\n this.updateFilterAndFetch({ colorFamily: '' });\n } else {\n this.filters = updateFilters(this.filters, { colorFamily: event.detail });\n this.updateFilterAndFetch({ colorFamily: event.detail });\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 handleSampleSelect = (selectedSample?: any) => {\n this.currentColor = null;\n this.selectedCategory = selectedSample.value;\n\n this.updateFilterAndFetch({ sampleId: selectedSample.value, colorFamily: '' });\n };\n\n handleScroll(_event: Event, modalContent: HTMLElement) {\n if (this.loading || !this.hasMore) return;\n\n const scrollTop = modalContent.scrollTop;\n const scrollHeight = modalContent.scrollHeight;\n const clientHeight = modalContent.clientHeight;\n\n // Check if user scrolled to the bottom of the modal\n if (scrollTop + clientHeight >= scrollHeight - 50) {\n this.loadMoreColors();\n }\n }\n\n private openSeletedColor() {\n if (!this.colorsList || !this.selectedcolor) return;\n\n if (!this.colorIsSelected) {\n const result = this.chunks(this.colorsList)\n .map((innerArray, arrayIndex) => {\n const foundColor = innerArray.find(color => color.name.trim()?.toUpperCase() === 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 setDataLayer({\n shop: this.shop,\n product: this.product,\n });\n\n this.loadProductData();\n }\n\n componentWillRender() {\n this.displayForMobile();\n this.calculateBoxCount();\n this.colorTimer();\n this.openSeletedColor();\n\n const modalContent = this.modalEl.querySelector('.my-modal') as HTMLElement;\n if (modalContent) {\n modalContent.addEventListener('scroll', event => this.handleScroll(event, modalContent));\n }\n }\n\n private resetColors() {\n this.currentColor = null;\n this.currentIndex = null;\n this.colorIsSelected = false;\n }\n\n private resetAllFilters() {\n // Reset current color selection\n this.resetColors();\n\n // Reset filters to initial state\n this.filters = {\n type: 'product',\n id: this.data?.id || '',\n productId: '',\n page: 1,\n colorNumber: '',\n colorName: '',\n colorFamily: '',\n sampleId: '',\n };\n\n // Reset selected category\n this.selectedCategory = null;\n\n // Clear search text\n this.clearSearchText.emit();\n\n // Fetch colors with reset filters\n this.fetchColorsData({ reset: true });\n }\n\n private resetSelectedCategory() {\n this.resetColors();\n this.colorIsSelected = false;\n this.selectedCategory = null;\n this.filters = updateFilters(this.filters, { sampleId: '' });\n this.fetchColorsData({ reset: true });\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 <modal-header\n modalName={this.data.modalName}\n modalLogo={this.data.modalLogo ? `${APIURL}/assets/${this.data.modalLogo}?access_token=${accessToken}` : null}\n modalDescription={this.data.modalDescription}\n shop={this.shop}\n productName={this.data.name}\n productSamples={this.data.productSamples}\n selectedColorFamily={this.filters.colorFamily}\n isMobile={this.isMobile}\n onCloseModal={() => this.closeModalHandler()}\n onSampleSelected={event => this.handleSampleSelect(event.detail)}\n onOnLogoClick={() => this.resetAllFilters()}\n onOnResetCategory={() => this.resetSelectedCategory()}\n ></modal-header>\n )}\n\n <div class={'my-modal__wrapper'}>\n {!this.preloader && (\n <div class={'container_boxes'}>\n {!this.loading && this.colorsList.length === 0 && (\n <div class=\"not-found\">\n <p>Nie zaleziono wyników wyszukiwania pod danym hasłem.</p>\n <p> Wpisz inną nazwę bądź numer koloru lub skorzystaj z kolekcji kolorystycznych.</p>\n </div>\n )}\n {this.colorsList?.length > 0 &&\n this.chunks(this.colorsList).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 if (this.currentColor?.id === c.id) {\n this.currentColor = null;\n } else {\n this.currentColor = c;\n }\n this.currentIndex = index;\n setDataLayer({\n event: 'ColorClick',\n shop: this.shop,\n product: this.product,\n color: c.name,\n });\n 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 </div>\n )}\n {this.loading && <my-loader></my-loader>}\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":"index.js","sourceRoot":"","sources":["../../../src/components/modal/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAgB,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC/G,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACtF,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,MAAM,MAAM,WAAW,CAAC;AAa/B,MAAM,OAAO,KAAK;EAiDhB;IAhDQ,oBAAe,GAAG,GAAG,CAAC;IACtB,mBAAc,GAAG,EAAE,CAAC;IACpB,mBAAc,GAAG,EAAE,CAAC;IACpB,kBAAa,GAAG,EAAE,CAAC;IACnB,qBAAgB,GAAG,IAAI,CAAC;IA6DxB,kBAAa,GAAG,GAAG,EAAE;MAC3B,IAAI,CAAC,kBAAkB,IAAI,aAAa,CAAC,IAAI,CAAC,kBAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Method, Element, Prop, Event, EventEmitter, h, State, Listen, Watch } from '@stencil/core';\nimport { APIURL, accessToken } from '../api';\nimport { setDataLayer } from '../../gtmUtils';\nimport { AvailableTester, Color, Product } from '../../types';\nimport { fetchColors, fetchProductData, limit, updateFilters } from '../api/services';\nimport { debounce } from '../../utils';\nimport chroma from 'chroma-js';\n\ndeclare global {\n interface Window {\n dataLayer: Record<string, any>[];\n }\n}\n\n@Component({\n tag: 'my-modal',\n styleUrl: 'index.scss',\n assetsDirs: ['assets'],\n})\nexport class Modal {\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 }) onSelectedColorEmit: EventEmitter<Color>;\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() available_testers: AvailableTester[] | null;\n @Prop() price: number | null;\n @Prop() selectedcolor: string | null;\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() 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 @State() colorsList: Color[] = [];\n @State() hasMore = true;\n @State() filters: any = {\n type: 'product' as 'product' | 'sample' | 'number' | 'name' | 'sampleInProduct',\n id: '',\n productId: '',\n page: 1,\n colorNumber: '',\n colorName: '',\n };\n\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) {\n this.filters = updateFilters(this.filters, { id: newValue.id, type: 'product' });\n this.fetchColorsData();\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 @Listen('onCurrentColor')\n handleEmitColor(event: CustomEvent<Color>) {\n this.onSelectedColorEmit.emit(event.detail);\n }\n\n @Listen('addToBasket')\n addToBasketHandler(event: CustomEvent<{ id: number }>) {\n return event.detail.id;\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 sortColorsBySimilarity(colors: Color[]): Color[] {\n if (colors?.length <= 1) return colors;\n\n const sortedColors: Color[] = [];\n const remainingColors = [...colors];\n\n // Start with the first color\n sortedColors.push(remainingColors.shift()!);\n\n while (remainingColors?.length > 0) {\n // Find the most similar color to the last color in sortedColors\n const lastColor = sortedColors[sortedColors?.length - 1];\n let mostSimilarIndex = 0;\n let minDistance = Infinity;\n\n remainingColors.forEach((color, index) => {\n try {\n // Validate hex colors before calculating distance\n if (!color.hex || !lastColor.hex) {\n return;\n }\n\n const distance = chroma.distance(lastColor.hex, color.hex, 'lab');\n if (distance < minDistance) {\n minDistance = distance;\n mostSimilarIndex = index;\n }\n } catch (error) {\n console.warn(`Error calculating color distance for ${color.hex}:`, error);\n // Skip this color if it causes an error\n }\n });\n\n // Move the most similar color to sortedColors\n sortedColors.push(remainingColors.splice(mostSimilarIndex, 1)[0]);\n }\n\n return sortedColors;\n }\n\n private getColorHueGroup(hex: string): string {\n try {\n // Validate hex format and handle invalid colors\n if (!hex || typeof hex !== 'string') {\n return 'other';\n }\n\n // Basic hex validation\n const cleanHex = hex.startsWith('#') ? hex : `#${hex}`;\n if (!/^#[0-9A-Fa-f]{6}$/.test(cleanHex)) {\n console.warn(`Invalid hex color format: ${hex}`);\n return 'other';\n }\n\n const color = chroma(cleanHex);\n const hue = color.get('hsl.h');\n const saturation = color.get('hsl.s');\n const lightness = color.get('hsl.l');\n\n // Handle grayscale colors\n if (saturation < 0.1) {\n if (lightness < 0.2) return 'black';\n if (lightness > 0.8) return 'white';\n return 'gray';\n }\n\n // Group colors by hue ranges\n if (hue >= 330 || hue < 30) return 'red';\n if (hue >= 30 && hue < 90) return 'yellow';\n if (hue >= 90 && hue < 150) return 'green';\n if (hue >= 150 && hue < 210) return 'cyan';\n if (hue >= 210 && hue < 270) return 'blue';\n if (hue >= 270 && hue < 330) return 'magenta';\n\n return 'other';\n } catch (error) {\n console.warn(`Error parsing color \"${hex}\":`, error);\n return 'other';\n }\n }\n\n private sortColorsByHueAndSimilarity(colors: Color[]): Color[] {\n if (colors?.length <= 1) return colors;\n\n // Filter out colors with invalid hex values\n const validColors = colors.filter(color => {\n if (!color.hex || typeof color.hex !== 'string') {\n console.warn(`Color missing hex value:`, color);\n return false;\n }\n\n const cleanHex = color.hex.startsWith('#') ? color.hex : `#${color.hex}`;\n const isValid = /^#[0-9A-Fa-f]{6}$/.test(cleanHex);\n\n if (!isValid) {\n console.warn(`Invalid hex color format: ${color.hex} for color:`, color);\n }\n\n return isValid;\n });\n\n // Group valid colors by their hue family\n const colorGroups: Record<string, Color[]> = {\n red: [],\n yellow: [],\n green: [],\n cyan: [],\n blue: [],\n magenta: [],\n gray: [],\n black: [],\n white: [],\n other: [],\n };\n\n validColors.forEach(color => {\n const group = this.getColorHueGroup(color.hex);\n colorGroups[group].push(color);\n });\n\n // Sort each group by similarity\n const sortedGroups: Color[][] = [];\n const groupOrder = ['red', 'magenta', 'blue', 'cyan', 'green', 'yellow', 'gray', 'black', 'white', 'other'];\n\n groupOrder.forEach(groupName => {\n if (colorGroups[groupName].length > 0) {\n sortedGroups.push(this.sortColorsBySimilarity(colorGroups[groupName]));\n }\n });\n\n // Combine all sorted groups\n return sortedGroups.flat();\n }\n\n private async fetchColorsData({ reset = false } = {}) {\n if (this.loading && !reset) return;\n this.loading = true;\n\n try {\n const colors = await fetchColors(this.filters);\n\n if (reset) {\n // For new searches, sort all colors by hue and similarity\n this.colorsList = this.sortColorsByHueAndSimilarity(colors);\n } else {\n // For pagination, combine and sort all colors\n this.colorsList = this.sortColorsByHueAndSimilarity([...this.colorsList, ...colors]);\n }\n\n this.hasMore = colors.length >= limit;\n } catch (error) {\n console.error('Error fetching colors:', error);\n } finally {\n this.loading = false;\n }\n }\n\n private async loadProductData() {\n this.preloader = true;\n\n const product = await fetchProductData({ shopName: this.shop, productName: this.product });\n\n if (product) {\n this.data = product;\n this.filters = updateFilters(this.filters, { type: 'product', id: product.id });\n\n // Fetch initial colors\n await this.fetchColorsData();\n }\n\n this.preloader = false;\n }\n\n private async loadMoreColors() {\n if (this.loading || !this.hasMore) return; // Prevent spam loading\n\n this.filters = { ...this.filters, page: this.filters.page + 1 }; // Increase page for lazy loading\n\n await this.fetchColorsData({ reset: false }); // Append results\n }\n\n private updateFilterAndFetch(newFilters: Partial<typeof this.filters>) {\n if (!this.data?.id) return;\n\n this.loading = true;\n\n this.filters = updateFilters(this.filters, {\n id: this.data.id,\n sampleId: this.filters.sampleId,\n colorName: this.filters.colorName,\n ...newFilters,\n page: 1,\n });\n\n this.fetchColorsData({ reset: true }).finally(() => {\n this.loading = false;\n });\n }\n\n async searchColor(event: CustomEvent) {\n const query = event.detail?.trim();\n\n this.updateFilterAndFetch({ colorName: query });\n }\n\n @Listen('colorFamilySelected')\n handleColorFamilySelected(event: CustomEvent) {\n this.currentColor = null;\n if (event.detail === this.filters.colorFamily) {\n this.filters = updateFilters(this.filters, { colorFamily: '' });\n this.updateFilterAndFetch({ colorFamily: '' });\n } else {\n this.filters = updateFilters(this.filters, { colorFamily: event.detail });\n this.updateFilterAndFetch({ colorFamily: event.detail });\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 handleSampleSelect = (selectedSample?: any) => {\n this.currentColor = null;\n this.selectedCategory = selectedSample.value;\n\n this.updateFilterAndFetch({ sampleId: selectedSample.value, colorFamily: '' });\n };\n\n handleScroll(_event: Event, modalContent: HTMLElement) {\n if (this.loading || !this.hasMore) return;\n\n const scrollTop = modalContent.scrollTop;\n const scrollHeight = modalContent.scrollHeight;\n const clientHeight = modalContent.clientHeight;\n\n // Check if user scrolled to the bottom of the modal\n if (scrollTop + clientHeight >= scrollHeight - 50) {\n this.loadMoreColors();\n }\n }\n\n private openSeletedColor() {\n if (!this.colorsList || !this.selectedcolor) return;\n\n if (!this.colorIsSelected) {\n const result = this.chunks(this.colorsList)\n .map((innerArray, arrayIndex) => {\n const foundColor = innerArray.find(color => color.name.trim()?.toUpperCase() === 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 setDataLayer({\n shop: this.shop,\n product: this.product,\n });\n\n this.loadProductData();\n }\n\n componentWillRender() {\n this.displayForMobile();\n this.calculateBoxCount();\n this.colorTimer();\n this.openSeletedColor();\n\n const modalContent = this.modalEl.querySelector('.my-modal') as HTMLElement;\n if (modalContent) {\n modalContent.addEventListener('scroll', event => this.handleScroll(event, modalContent));\n }\n }\n\n private resetColors() {\n this.currentColor = null;\n this.currentIndex = null;\n this.colorIsSelected = false;\n }\n\n private resetAllFilters() {\n // Reset current color selection\n this.resetColors();\n\n // Reset filters to initial state\n this.filters = {\n type: 'product',\n id: this.data?.id || '',\n productId: '',\n page: 1,\n colorNumber: '',\n colorName: '',\n colorFamily: '',\n sampleId: '',\n };\n\n // Reset selected category\n this.selectedCategory = null;\n\n // Clear search text\n this.clearSearchText.emit();\n\n // Fetch colors with reset filters\n this.fetchColorsData({ reset: true });\n }\n\n private resetSelectedCategory() {\n this.resetColors();\n this.colorIsSelected = false;\n this.selectedCategory = null;\n this.filters = updateFilters(this.filters, { sampleId: '' });\n this.fetchColorsData({ reset: true });\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 <modal-header\n modalName={this.data.modalName}\n modalLogo={this.data.modalLogo ? `${APIURL}/assets/${this.data.modalLogo}?access_token=${accessToken}` : null}\n modalDescription={this.data.modalDescription}\n shop={this.shop}\n productName={this.data.name}\n productSamples={this.data.productSamples}\n selectedColorFamily={this.filters.colorFamily}\n isMobile={this.isMobile}\n onCloseModal={() => this.closeModalHandler()}\n onSampleSelected={event => this.handleSampleSelect(event.detail)}\n onOnLogoClick={() => this.resetAllFilters()}\n onOnResetCategory={() => this.resetSelectedCategory()}\n ></modal-header>\n )}\n\n <div class={'my-modal__wrapper'}>\n {!this.preloader && (\n <div class={'container_boxes'}>\n {!this.loading && this.colorsList.length === 0 && (\n <div class=\"not-found\">\n <p>Nie zaleziono wyników wyszukiwania pod danym hasłem.</p>\n <p> Wpisz inną nazwę bądź numer koloru lub skorzystaj z kolekcji kolorystycznych.</p>\n </div>\n )}\n {this.colorsList?.length > 0 &&\n this.chunks(this.colorsList).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 if (this.currentColor?.id === c.id) {\n this.currentColor = null;\n } else {\n this.currentColor = c;\n }\n this.currentIndex = index;\n setDataLayer({\n event: 'ColorClick',\n shop: this.shop,\n product: this.product,\n color: c.name,\n });\n 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 availableTesters={this.available_testers?.find(\n (tester: AvailableTester) => tester.color_name?.trim().toLowerCase() === this.currentColor?.name?.trim().toLowerCase(),\n )}\n price={this.price}\n ></my-colorinfo>\n )}\n </div>\n );\n })}\n </div>\n )}\n {this.loading && <my-loader></my-loader>}\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"]}
|
|
@@ -16,6 +16,11 @@
|
|
|
16
16
|
font-family: "Poppins", sans-serif;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
:host {
|
|
20
|
+
--swiper-theme-color: #007aff;
|
|
21
|
+
--swiper-navigation-size: 44px;
|
|
22
|
+
}
|
|
23
|
+
|
|
19
24
|
.slider-wrapper {
|
|
20
25
|
width: 100%;
|
|
21
26
|
position: relative;
|
|
@@ -42,7 +47,7 @@
|
|
|
42
47
|
}
|
|
43
48
|
.slider-wrapper .mySwiper2 {
|
|
44
49
|
height: 100%;
|
|
45
|
-
width:
|
|
50
|
+
width: 100%;
|
|
46
51
|
position: relative;
|
|
47
52
|
}
|
|
48
53
|
@media (max-width: 1024px) {
|
|
@@ -62,13 +67,26 @@
|
|
|
62
67
|
}
|
|
63
68
|
.slider-wrapper .mySwiper2 .swiper-button-prev::after,
|
|
64
69
|
.slider-wrapper .mySwiper2 .swiper-button-next::after {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
font-
|
|
70
|
+
content: "" !important;
|
|
71
|
+
font-family: initial !important;
|
|
72
|
+
font-size: 0 !important;
|
|
73
|
+
width: 8px;
|
|
74
|
+
height: 8px;
|
|
75
|
+
border-right: 2px solid #232323;
|
|
76
|
+
border-bottom: 2px solid #232323;
|
|
77
|
+
display: block;
|
|
78
|
+
}
|
|
79
|
+
.slider-wrapper .mySwiper2 .swiper-button-next {
|
|
80
|
+
right: 45%;
|
|
81
|
+
}
|
|
82
|
+
.slider-wrapper .mySwiper2 .swiper-button-next::after {
|
|
83
|
+
transform: rotate(-45deg);
|
|
68
84
|
}
|
|
69
85
|
.slider-wrapper .mySwiper2 .swiper-button-prev {
|
|
70
|
-
|
|
71
|
-
|
|
86
|
+
left: 45%;
|
|
87
|
+
}
|
|
88
|
+
.slider-wrapper .mySwiper2 .swiper-button-prev::after {
|
|
89
|
+
transform: rotate(135deg);
|
|
72
90
|
}
|
|
73
91
|
.slider-wrapper .mySwiper {
|
|
74
92
|
width: 20%;
|
|
@@ -18,43 +18,54 @@ export class JcSwiper {
|
|
|
18
18
|
this.color = undefined;
|
|
19
19
|
}
|
|
20
20
|
initSwiper() {
|
|
21
|
-
|
|
21
|
+
const root = this.modalEl.shadowRoot;
|
|
22
|
+
if (!root)
|
|
23
|
+
return;
|
|
24
|
+
const thumbsEl = root.querySelector('.mySwiper');
|
|
25
|
+
const sliderEl = root.querySelector('.mySwiper2');
|
|
26
|
+
const nextEl = root.querySelector('.swiper-button-next');
|
|
27
|
+
const prevEl = root.querySelector('.swiper-button-prev');
|
|
28
|
+
if (thumbsEl) {
|
|
29
|
+
this.thumbs = new Swiper(thumbsEl, {
|
|
30
|
+
modules: [Navigation, Controller],
|
|
31
|
+
slideToClickedSlide: true,
|
|
32
|
+
loop: true,
|
|
33
|
+
freeMode: true,
|
|
34
|
+
spaceBetween: 5,
|
|
35
|
+
slidesPerView: 3,
|
|
36
|
+
direction: 'vertical',
|
|
37
|
+
touchRatio: 0.2,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
if (!sliderEl)
|
|
41
|
+
return;
|
|
42
|
+
this.swiper2 = new Swiper(sliderEl, {
|
|
22
43
|
modules: [Navigation, Controller],
|
|
44
|
+
navigation: nextEl && prevEl ? { nextEl, prevEl } : undefined,
|
|
23
45
|
slideToClickedSlide: true,
|
|
24
46
|
loop: true,
|
|
25
47
|
freeMode: true,
|
|
26
|
-
|
|
27
|
-
slidesPerView: 3,
|
|
28
|
-
direction: 'vertical',
|
|
29
|
-
touchRatio: 0.2,
|
|
30
|
-
});
|
|
31
|
-
this.swiper2 = new Swiper('.mySwiper2', {
|
|
32
|
-
modules: [Navigation, Controller],
|
|
33
|
-
navigation: {
|
|
34
|
-
nextEl: '.swiper-button-next',
|
|
35
|
-
prevEl: '.swiper-button-prev',
|
|
36
|
-
},
|
|
37
|
-
loop: true,
|
|
38
|
-
loopedSlides: 3,
|
|
48
|
+
slidesPerView: 1,
|
|
39
49
|
});
|
|
40
|
-
this.swiper2
|
|
41
|
-
|
|
50
|
+
if (this.swiper2) {
|
|
51
|
+
this.swiper2.controller.control = this.swiper2;
|
|
52
|
+
}
|
|
42
53
|
}
|
|
43
54
|
componentDidLoad() {
|
|
44
55
|
this.initSwiper();
|
|
45
56
|
}
|
|
46
57
|
update() {
|
|
47
|
-
|
|
48
|
-
this.
|
|
58
|
+
var _a, _b;
|
|
59
|
+
(_a = this.thumbs) === null || _a === void 0 ? void 0 : _a.update();
|
|
60
|
+
(_b = this.swiper2) === null || _b === void 0 ? void 0 : _b.update();
|
|
49
61
|
}
|
|
50
62
|
render() {
|
|
51
63
|
return (h("div", { class: "slider-wrapper" }, h("div", { class: "swiper mySwiper2" }, h("div", { class: "swiper-wrapper" }, this.slides &&
|
|
52
64
|
this.slides.length > 0 &&
|
|
53
|
-
this.slides.map((slide) => (h("div", { key: slide.id, class: "swiper-slide" }, h("img", { src: `${APIURL}/assets/${slide.directus_files_id}?access_token=${accessToken}`, alt: "room_image" }))))), this.slides && this.slides.length >= 2 && (h("div", null, h("div", { onClick: this.colorInteraction, class: "swiper-button-next" }), h("div", { onClick: this.colorInteraction, class: "swiper-button-prev" }))))
|
|
54
|
-
this.slides.length > 0 &&
|
|
55
|
-
this.slides.map((slide) => (h("div", { key: slide.id, class: "swiper-slide" }, h("img", { src: `${APIURL}/assets/${slide.directus_files_id}?access_token=${accessToken}`, alt: "room_image" }))))))));
|
|
65
|
+
this.slides.map((slide) => (h("div", { key: slide.id, class: "swiper-slide" }, h("img", { src: `${APIURL}/assets/${slide.directus_files_id}?access_token=${accessToken}`, alt: "room_image" }))))), this.slides && this.slides.length >= 2 && (h("div", null, h("div", { onClick: this.colorInteraction, class: "swiper-button-next" }), h("div", { onClick: this.colorInteraction, class: "swiper-button-prev" }))))));
|
|
56
66
|
}
|
|
57
67
|
static get is() { return "my-slider"; }
|
|
68
|
+
static get encapsulation() { return "shadow"; }
|
|
58
69
|
static get originalStyleUrls() {
|
|
59
70
|
return {
|
|
60
71
|
"$": ["index.scss"]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/slider/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,MAAM,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/slider/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,MAAM,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAO7C,MAAM,OAAO,QAAQ;;IA0DnB,qBAAgB,GAAG,GAAG,EAAE;MACtB,YAAY,CAAC;QAC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stencil/core';\nimport Swiper, { Navigation, Controller } from 'swiper';\nimport { setDataLayer } from '../../gtmUtils';\nimport { Image } from '../../types';\nimport { APIURL, accessToken } from '../api';\n\n@Component({\n tag: 'my-slider',\n styleUrl: 'index.scss',\n shadow: true,\n})\nexport class JcSwiper {\n @Element() modalEl: HTMLElement;\n @Prop() slides: Image[];\n @Prop() shop: string;\n @Prop() product: string;\n @Prop() color: string;\n\n private thumbs: any;\n private swiper2: any;\n\n initSwiper() {\n const root = this.modalEl.shadowRoot;\n if (!root) return;\n\n const thumbsEl = root.querySelector('.mySwiper') as HTMLElement | null;\n const sliderEl = root.querySelector('.mySwiper2') as HTMLElement | null;\n const nextEl = root.querySelector('.swiper-button-next') as HTMLElement | null;\n const prevEl = root.querySelector('.swiper-button-prev') as HTMLElement | null;\n\n if (thumbsEl) {\n this.thumbs = new Swiper(thumbsEl, {\n modules: [Navigation, Controller],\n slideToClickedSlide: true,\n loop: true,\n freeMode: true,\n spaceBetween: 5,\n slidesPerView: 3,\n direction: 'vertical',\n touchRatio: 0.2,\n });\n }\n\n if (!sliderEl) return;\n\n this.swiper2 = new Swiper(sliderEl, {\n modules: [Navigation, Controller],\n navigation: nextEl && prevEl ? { nextEl, prevEl } : undefined,\n slideToClickedSlide: true,\n loop: true,\n freeMode: true,\n\n slidesPerView: 1,\n });\n\n if (this.swiper2) {\n this.swiper2.controller.control = this.swiper2;\n }\n }\n\n componentDidLoad() {\n this.initSwiper();\n }\n\n update() {\n this.thumbs?.update();\n this.swiper2?.update();\n }\n\n colorInteraction = () => {\n setDataLayer({\n event: 'ColorInteraction',\n shop: this.shop,\n product: this.product,\n color: this.color,\n });\n };\n\n render() {\n return (\n <div class=\"slider-wrapper\">\n <div class=\"swiper mySwiper2\">\n <div class=\"swiper-wrapper\">\n {this.slides &&\n this.slides.length > 0 &&\n this.slides.map((slide: Image) => (\n <div key={slide.id} class=\"swiper-slide\">\n <img src={`${APIURL}/assets/${slide.directus_files_id}?access_token=${accessToken}`} alt=\"room_image\" />\n </div>\n ))}\n </div>\n {this.slides && this.slides.length >= 2 && (\n <div>\n <div onClick={this.colorInteraction} class=\"swiper-button-next\"></div>\n <div onClick={this.colorInteraction} class=\"swiper-button-prev\"></div>\n </div>\n )}\n </div>\n {/* <div class=\"swiper mySwiper\">\n <div class=\"swiper-wrapper\">\n {this.slides &&\n this.slides.length > 0 &&\n this.slides.map((slide: Image) => (\n <div key={slide.id} class=\"swiper-slide\">\n <img src={`${APIURL}/assets/${slide.directus_files_id}?access_token=${accessToken}`} alt=\"room_image\" />\n </div>\n ))}\n </div>\n </div> */}\n </div>\n );\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["export type Shop = {\n name: string;\n date_created: string;\n date_updated: string;\n id: number;\n products: number[];\n sort: null;\n status: string;\n};\n\nexport type ProductShopRelation = {\n Product_id: number;\n Shop_id: number;\n id: number;\n};\n\nexport type ProductCategoryRelation = {\n Category_id: Category;\n Product_id: Product;\n id: number;\n imageInsteadHex?: boolean;\n bigImage?: string;\n};\n\nexport type Color = {\n hex: string;\n image: Record<string, Image>;\n links: Link[];\n name: string;\n position: number;\n buttonInverse: boolean;\n textWhite: boolean;\n id?: number;\n category?: Partial<Color>;\n number?: string;\n Category_id: Color;\n imageInsteadHex: boolean;\n bigImage: string;\n};\n\nexport type Category = {\n category_name: string;\n hex: string;\n id: number;\n name: string;\n};\n\nexport type Product = {\n colors?: Color[];\n modalDescription: string;\n modalLogo: string;\n modalName: string;\n name: string;\n Shop: ProductShopRelation[];\n useColorImage: boolean;\n images: any;\n id?: string;\n Category: ProductCategoryRelation[];\n productSamples: any[];\n};\n\nexport type Image = {\n id: number;\n directus_files_id: string;\n};\n\nexport type Link = {\n id: number;\n path: string;\n shop: string;\n};\n\nexport type ColorBoxyIsImageInsteadHex = {\n isImageInsteadHex: boolean;\n bigImage: string;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["export type Shop = {\n name: string;\n date_created: string;\n date_updated: string;\n id: number;\n products: number[];\n sort: null;\n status: string;\n};\n\nexport type ProductShopRelation = {\n Product_id: number;\n Shop_id: number;\n id: number;\n};\n\nexport type ProductCategoryRelation = {\n Category_id: Category;\n Product_id: Product;\n id: number;\n imageInsteadHex?: boolean;\n bigImage?: string;\n};\n\nexport type Color = {\n hex: string;\n image: Record<string, Image>;\n links: Link[];\n name: string;\n position: number;\n buttonInverse: boolean;\n textWhite: boolean;\n id?: number;\n category?: Partial<Color>;\n number?: string;\n Category_id: Color;\n imageInsteadHex: boolean;\n bigImage: string;\n};\n\nexport type Category = {\n category_name: string;\n hex: string;\n id: number;\n name: string;\n};\n\nexport type Product = {\n colors?: Color[];\n modalDescription: string;\n modalLogo: string;\n modalName: string;\n name: string;\n Shop: ProductShopRelation[];\n useColorImage: boolean;\n images: any;\n id?: string;\n Category: ProductCategoryRelation[];\n productSamples: any[];\n};\n\nexport type Image = {\n id: number;\n directus_files_id: string;\n};\n\nexport type Link = {\n id: number;\n path: string;\n shop: string;\n};\n\nexport type ColorBoxyIsImageInsteadHex = {\n isImageInsteadHex: boolean;\n bigImage: string;\n};\n\nexport type AvailableTester = {\n id_product_attribute: number;\n color_name: string;\n};\n"]}
|