@crystaldesign/widget-image-carousel 25.10.0-beta.9 → 25.10.0-rc.2
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/build/esm/index.js +198 -63
- package/build/types/widget-image-carousel/src/components/ImageList/index.d.ts +2 -3
- package/build/types/widget-image-carousel/src/components/ImageList/index.d.ts.map +1 -1
- package/build/types/widget-image-carousel/src/components/OpenConfiguratorButton/index.d.ts +13 -0
- package/build/types/widget-image-carousel/src/components/OpenConfiguratorButton/index.d.ts.map +1 -0
- package/build/types/widget-image-carousel/src/components/Swiper/index.d.ts +3 -3
- package/build/types/widget-image-carousel/src/components/Swiper/index.d.ts.map +1 -1
- package/build/types/widget-image-carousel/src/index.d.ts.map +1 -1
- package/build/types/widget-image-carousel/src/stories/SimpleProductList/kirchner-prod.stories.d.ts +8 -0
- package/build/types/widget-image-carousel/src/stories/SimpleProductList/kirchner-prod.stories.d.ts.map +1 -0
- package/build/types/widget-image-carousel/src/types/index.d.ts +13 -2
- package/build/types/widget-image-carousel/src/types/index.d.ts.map +1 -1
- package/build/types/widget-image-carousel/src/useImageCarousel.d.ts +3 -8
- package/build/types/widget-image-carousel/src/useImageCarousel.d.ts.map +1 -1
- package/build/umd/report.html +1 -1
- package/build/umd/widget-image-carousel.umd.min.js +1 -1
- package/package.json +2 -2
package/build/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
-
import { useState, useCallback, useEffect } from 'react';
|
|
2
|
+
import { useState, useCallback, useEffect, useMemo } from 'react';
|
|
3
3
|
import { useCss, useProductData, MediaItem, useConfiguration } from '@crystaldesign/widget-library';
|
|
4
|
-
import { useDivaCore } from '@crystaldesign/diva-core';
|
|
4
|
+
import { useDivaCore, useTranslation } from '@crystaldesign/diva-core';
|
|
5
5
|
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
6
6
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
7
7
|
import _regeneratorRuntime from '@babel/runtime/regenerator';
|
|
@@ -10,7 +10,7 @@ import { Navigation } from 'swiper/modules';
|
|
|
10
10
|
import classNames from 'classnames';
|
|
11
11
|
import 'swiper/css';
|
|
12
12
|
import 'swiper/css/navigation';
|
|
13
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
13
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
14
14
|
|
|
15
15
|
(function() {
|
|
16
16
|
const env = {"STAGE":"production"};
|
|
@@ -28,7 +28,7 @@ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol
|
|
|
28
28
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
29
29
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
30
30
|
function useImageCarousel(_ref) {
|
|
31
|
-
var
|
|
31
|
+
var productIds = _ref.productIds,
|
|
32
32
|
settings = _ref.settings;
|
|
33
33
|
var _useState = useState([]),
|
|
34
34
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -42,36 +42,54 @@ function useImageCarousel(_ref) {
|
|
|
42
42
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
43
43
|
error = _useState6[0],
|
|
44
44
|
setError = _useState6[1];
|
|
45
|
+
var _useDivaCore = useDivaCore(),
|
|
46
|
+
openComponent = _useDivaCore.actions.openComponent;
|
|
45
47
|
useCss(settings);
|
|
46
48
|
var _useProductData = useProductData({
|
|
47
|
-
productIds:
|
|
49
|
+
productIds: productIds,
|
|
48
50
|
widgetType: 'IMAGECAROUSEL'
|
|
49
51
|
}),
|
|
50
52
|
getProductsByDivaNrs = _useProductData.getProductsByDivaNrs,
|
|
51
53
|
getProductByDivaNrAndVariantId = _useProductData.getProductByDivaNrAndVariantId,
|
|
52
54
|
setSelectedProductId = _useProductData.setSelectedProductId,
|
|
53
55
|
selectedProduct = _useProductData.selectedProduct,
|
|
54
|
-
setProductCache = _useProductData.setProductCache
|
|
56
|
+
setProductCache = _useProductData.setProductCache,
|
|
57
|
+
getSimpleProductListByIds = _useProductData.getSimpleProductListByIds;
|
|
55
58
|
var onClickProduct = useCallback(function (productId) {
|
|
56
|
-
|
|
57
|
-
if (
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
var _settings$openConfigu;
|
|
60
|
+
if ((_settings$openConfigu = settings.openConfiguratorCta) !== null && _settings$openConfigu !== void 0 && _settings$openConfigu.enabled) {
|
|
61
|
+
openConfigurator(productId);
|
|
62
|
+
} else {
|
|
63
|
+
setSelectedProductId(productId);
|
|
64
|
+
if (!settings.disableScrollToTop) {
|
|
65
|
+
window.scrollTo({
|
|
66
|
+
top: 0,
|
|
67
|
+
behavior: 'smooth'
|
|
68
|
+
});
|
|
69
|
+
}
|
|
62
70
|
}
|
|
63
|
-
}, [setSelectedProductId]);
|
|
71
|
+
}, [setSelectedProductId, settings.openConfiguratorCta]);
|
|
72
|
+
var openConfigurator = function openConfigurator(productId) {
|
|
73
|
+
openComponent({
|
|
74
|
+
type: 'DIVA_WEBPLANNER',
|
|
75
|
+
parameters: {
|
|
76
|
+
productId: productId
|
|
77
|
+
},
|
|
78
|
+
openInFullscreen: true,
|
|
79
|
+
absoluteFullscreen: true
|
|
80
|
+
});
|
|
81
|
+
};
|
|
64
82
|
useEffect(function () {
|
|
65
83
|
var loadMockups = /*#__PURE__*/function () {
|
|
66
84
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
67
|
-
var _settings$mediaFuncti, mediaFunctionType, foundMedia, _foundMedia;
|
|
85
|
+
var _settings$mediaFuncti, mediaFunctionType, foundMedia, _foundMedia, _foundMedia2;
|
|
68
86
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
69
87
|
while (1) switch (_context.prev = _context.next) {
|
|
70
88
|
case 0:
|
|
71
89
|
_context.prev = 0;
|
|
72
90
|
setLoading(true);
|
|
73
91
|
if (!selectedProduct) {
|
|
74
|
-
_context.next =
|
|
92
|
+
_context.next = 26;
|
|
75
93
|
break;
|
|
76
94
|
}
|
|
77
95
|
mediaFunctionType = (_settings$mediaFuncti = settings.mediaFunctionType) !== null && _settings$mediaFuncti !== void 0 ? _settings$mediaFuncti : 'SHO';
|
|
@@ -86,7 +104,7 @@ function useImageCarousel(_ref) {
|
|
|
86
104
|
if (foundMedia) {
|
|
87
105
|
setMedia(foundMedia);
|
|
88
106
|
}
|
|
89
|
-
_context.next =
|
|
107
|
+
_context.next = 26;
|
|
90
108
|
break;
|
|
91
109
|
case 11:
|
|
92
110
|
if (!(settings.type === 'SIMILAR_PRODUCTS')) {
|
|
@@ -100,41 +118,55 @@ function useImageCarousel(_ref) {
|
|
|
100
118
|
if (_foundMedia) {
|
|
101
119
|
setMedia(_foundMedia);
|
|
102
120
|
}
|
|
103
|
-
_context.next =
|
|
121
|
+
_context.next = 26;
|
|
104
122
|
break;
|
|
105
123
|
case 18:
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
124
|
+
if (!(settings.type === 'SIMPLE_PRODUCT_LIST' && productIds)) {
|
|
125
|
+
_context.next = 25;
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
_context.next = 21;
|
|
129
|
+
return getSimpleProductList(productIds, mediaFunctionType, settings.description);
|
|
110
130
|
case 21:
|
|
111
|
-
|
|
131
|
+
_foundMedia2 = _context.sent;
|
|
132
|
+
if (_foundMedia2) {
|
|
133
|
+
setMedia(_foundMedia2);
|
|
134
|
+
}
|
|
135
|
+
_context.next = 26;
|
|
136
|
+
break;
|
|
137
|
+
case 25:
|
|
138
|
+
throw new Error('Invalid type or invalid data');
|
|
139
|
+
case 26:
|
|
140
|
+
_context.next = 32;
|
|
141
|
+
break;
|
|
142
|
+
case 28:
|
|
143
|
+
_context.prev = 28;
|
|
112
144
|
_context.t0 = _context["catch"](0);
|
|
113
145
|
console.error(_context.t0);
|
|
114
146
|
setError(_context.t0);
|
|
115
|
-
case
|
|
116
|
-
_context.prev =
|
|
147
|
+
case 32:
|
|
148
|
+
_context.prev = 32;
|
|
117
149
|
setLoading(false);
|
|
118
|
-
return _context.finish(
|
|
119
|
-
case
|
|
150
|
+
return _context.finish(32);
|
|
151
|
+
case 35:
|
|
120
152
|
case "end":
|
|
121
153
|
return _context.stop();
|
|
122
154
|
}
|
|
123
|
-
}, _callee, null, [[0,
|
|
155
|
+
}, _callee, null, [[0, 28, 32, 35]]);
|
|
124
156
|
}));
|
|
125
157
|
return function loadMockups() {
|
|
126
158
|
return _ref2.apply(this, arguments);
|
|
127
159
|
};
|
|
128
160
|
}();
|
|
129
|
-
if (selectedProduct &&
|
|
161
|
+
if (selectedProduct && productIds !== null && productIds !== void 0 && productIds.length) {
|
|
130
162
|
loadMockups();
|
|
131
163
|
}
|
|
132
|
-
}, [selectedProduct,
|
|
164
|
+
}, [selectedProduct, productIds]);
|
|
133
165
|
return {
|
|
134
166
|
media: media,
|
|
135
167
|
error: error,
|
|
136
168
|
loading: loading,
|
|
137
|
-
|
|
169
|
+
onClickProduct: onClickProduct
|
|
138
170
|
};
|
|
139
171
|
function getWallMockups(_x, _x2) {
|
|
140
172
|
return _getWallMockups.apply(this, arguments);
|
|
@@ -367,7 +399,7 @@ function useImageCarousel(_ref) {
|
|
|
367
399
|
}
|
|
368
400
|
}, _callee3);
|
|
369
401
|
}));
|
|
370
|
-
return function (
|
|
402
|
+
return function (_x9) {
|
|
371
403
|
return _ref3.apply(this, arguments);
|
|
372
404
|
};
|
|
373
405
|
}()));
|
|
@@ -401,14 +433,75 @@ function useImageCarousel(_ref) {
|
|
|
401
433
|
}));
|
|
402
434
|
return _getSimilarProductMedia.apply(this, arguments);
|
|
403
435
|
}
|
|
436
|
+
function getSimpleProductList(_x6, _x7, _x8) {
|
|
437
|
+
return _getSimpleProductList.apply(this, arguments);
|
|
438
|
+
}
|
|
439
|
+
function _getSimpleProductList() {
|
|
440
|
+
_getSimpleProductList = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(productIds, mediaFunctionType, description) {
|
|
441
|
+
var productIdsArray, products;
|
|
442
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context8) {
|
|
443
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
444
|
+
case 0:
|
|
445
|
+
productIdsArray = Array.isArray(productIds) ? productIds : productIds.split(';');
|
|
446
|
+
_context8.next = 3;
|
|
447
|
+
return getSimpleProductListByIds(productIdsArray);
|
|
448
|
+
case 3:
|
|
449
|
+
products = _context8.sent;
|
|
450
|
+
return _context8.abrupt("return", products.data.map(function (p) {
|
|
451
|
+
var _p$media$find$url, _p$media, _p$description;
|
|
452
|
+
return {
|
|
453
|
+
url: (_p$media$find$url = p === null || p === void 0 || (_p$media = p.media) === null || _p$media === void 0 || (_p$media = _p$media.find(function (m) {
|
|
454
|
+
return m.functionType === mediaFunctionType;
|
|
455
|
+
})) === null || _p$media === void 0 ? void 0 : _p$media.url) !== null && _p$media$find$url !== void 0 ? _p$media$find$url : p.image,
|
|
456
|
+
productId: p._id,
|
|
457
|
+
description: description ? (_p$description = p[description]) !== null && _p$description !== void 0 ? _p$description : description : undefined
|
|
458
|
+
};
|
|
459
|
+
}));
|
|
460
|
+
case 5:
|
|
461
|
+
case "end":
|
|
462
|
+
return _context8.stop();
|
|
463
|
+
}
|
|
464
|
+
}, _callee5);
|
|
465
|
+
}));
|
|
466
|
+
return _getSimpleProductList.apply(this, arguments);
|
|
467
|
+
}
|
|
404
468
|
}
|
|
405
469
|
|
|
470
|
+
var OpenConfiguratorButton = function OpenConfiguratorButton(_ref) {
|
|
471
|
+
var _settings$ctaText;
|
|
472
|
+
var settings = _ref.settings,
|
|
473
|
+
onClick = _ref.onClick;
|
|
474
|
+
var _useTranslation = useTranslation(),
|
|
475
|
+
t = _useTranslation.t;
|
|
476
|
+
if (!settings.enabled) return /*#__PURE__*/jsx(Fragment, {});
|
|
477
|
+
return /*#__PURE__*/jsx("button", {
|
|
478
|
+
className: classNames('widget-image-carousel-open-configurator-button', settings.className),
|
|
479
|
+
onClick: onClick,
|
|
480
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
481
|
+
style: {
|
|
482
|
+
display: 'flex',
|
|
483
|
+
alignItems: 'center',
|
|
484
|
+
justifyContent: 'center'
|
|
485
|
+
},
|
|
486
|
+
children: [/*#__PURE__*/jsx("span", {
|
|
487
|
+
className: "widget-image-carousel-open-configurator-text",
|
|
488
|
+
children: (_settings$ctaText = settings.ctaText) !== null && _settings$ctaText !== void 0 ? _settings$ctaText : t('configurator.CONFIGURE_NOW')
|
|
489
|
+
}), settings.ctaIcon && /*#__PURE__*/jsx("img", {
|
|
490
|
+
src: settings.ctaIcon,
|
|
491
|
+
alt: "Configurator Icon",
|
|
492
|
+
className: "widget-image-carousel-open-configurator-icon"
|
|
493
|
+
})]
|
|
494
|
+
})
|
|
495
|
+
});
|
|
496
|
+
};
|
|
497
|
+
|
|
406
498
|
function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
407
499
|
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
408
500
|
var SwiperComponent = function SwiperComponent(_ref) {
|
|
409
501
|
var media = _ref.media,
|
|
410
502
|
settings = _ref.settings,
|
|
411
|
-
|
|
503
|
+
onClickProduct = _ref.onClickProduct,
|
|
504
|
+
isMobile = _ref.isMobile;
|
|
412
505
|
return /*#__PURE__*/jsx("div", {
|
|
413
506
|
className: classNames(['diva-widget-image-carousel-container']),
|
|
414
507
|
children: /*#__PURE__*/jsx(Swiper, _objectSpread$1(_objectSpread$1({
|
|
@@ -417,12 +510,13 @@ var SwiperComponent = function SwiperComponent(_ref) {
|
|
|
417
510
|
className: classNames(['diva-widget-image-carousel-swiper'])
|
|
418
511
|
}, settings.sliderProp), {}, {
|
|
419
512
|
children: media.map(function (m, i) {
|
|
513
|
+
var _settings$openConfigu, _settings$openConfigu2, _settings$openConfigu3, _settings$openConfigu4;
|
|
420
514
|
return /*#__PURE__*/jsx(SwiperSlide, {
|
|
421
515
|
className: classNames(['diva-widget-image-carousel-slide']),
|
|
422
516
|
children: settings.description ? /*#__PURE__*/jsxs("div", {
|
|
423
517
|
className: classNames(['diva-widget-image-carousel-slide-description-image']),
|
|
424
518
|
onClick: function onClick() {
|
|
425
|
-
return
|
|
519
|
+
return onClickProduct(m.productId);
|
|
426
520
|
},
|
|
427
521
|
children: [/*#__PURE__*/jsx(MediaItem, {
|
|
428
522
|
mediaUrl: m.url,
|
|
@@ -430,6 +524,17 @@ var SwiperComponent = function SwiperComponent(_ref) {
|
|
|
430
524
|
config: {
|
|
431
525
|
disableSirv: false,
|
|
432
526
|
sirvProps: settings.sirvProps
|
|
527
|
+
},
|
|
528
|
+
overlay: !isMobile && (_settings$openConfigu = settings.openConfiguratorCta) !== null && _settings$openConfigu !== void 0 && _settings$openConfigu.enabled ? /*#__PURE__*/jsx(OpenConfiguratorButton, {
|
|
529
|
+
settings: settings.openConfiguratorCta,
|
|
530
|
+
onClick: function onClick() {
|
|
531
|
+
return onClickProduct(m.productId);
|
|
532
|
+
}
|
|
533
|
+
}) : undefined
|
|
534
|
+
}), ((_settings$openConfigu2 = settings.openConfiguratorCta) === null || _settings$openConfigu2 === void 0 ? void 0 : _settings$openConfigu2.enabled) && isMobile && /*#__PURE__*/jsx(OpenConfiguratorButton, {
|
|
535
|
+
settings: settings.openConfiguratorCta,
|
|
536
|
+
onClick: function onClick() {
|
|
537
|
+
return onClickProduct(m.productId);
|
|
433
538
|
}
|
|
434
539
|
}), /*#__PURE__*/jsx("div", {
|
|
435
540
|
className: classNames(['diva-widget-image-carousel-slide-description']),
|
|
@@ -437,17 +542,30 @@ var SwiperComponent = function SwiperComponent(_ref) {
|
|
|
437
542
|
children: m.description
|
|
438
543
|
})
|
|
439
544
|
})]
|
|
440
|
-
}) : /*#__PURE__*/
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
545
|
+
}) : /*#__PURE__*/jsxs(Fragment, {
|
|
546
|
+
children: [/*#__PURE__*/jsx(MediaItem, {
|
|
547
|
+
mediaUrl: m.url,
|
|
548
|
+
isCurrentlyVisible: true,
|
|
549
|
+
config: {
|
|
550
|
+
disableSirv: false,
|
|
551
|
+
sirvProps: settings.sirvProps
|
|
552
|
+
},
|
|
553
|
+
className: classNames(['diva-widget-image-carousel-slide-image']),
|
|
554
|
+
onClick: function onClick() {
|
|
555
|
+
return onClickProduct(m.productId);
|
|
556
|
+
},
|
|
557
|
+
overlay: !isMobile && (_settings$openConfigu3 = settings.openConfiguratorCta) !== null && _settings$openConfigu3 !== void 0 && _settings$openConfigu3.enabled ? /*#__PURE__*/jsx(OpenConfiguratorButton, {
|
|
558
|
+
settings: settings.openConfiguratorCta,
|
|
559
|
+
onClick: function onClick() {
|
|
560
|
+
return onClickProduct(m.productId);
|
|
561
|
+
}
|
|
562
|
+
}) : undefined
|
|
563
|
+
}), ((_settings$openConfigu4 = settings.openConfiguratorCta) === null || _settings$openConfigu4 === void 0 ? void 0 : _settings$openConfigu4.enabled) && isMobile && /*#__PURE__*/jsx(OpenConfiguratorButton, {
|
|
564
|
+
settings: settings.openConfiguratorCta,
|
|
565
|
+
onClick: function onClick() {
|
|
566
|
+
return onClickProduct(m.productId);
|
|
567
|
+
}
|
|
568
|
+
})]
|
|
451
569
|
})
|
|
452
570
|
}, i);
|
|
453
571
|
})
|
|
@@ -458,16 +576,17 @@ var SwiperComponent = function SwiperComponent(_ref) {
|
|
|
458
576
|
var ImageList = function ImageList(_ref) {
|
|
459
577
|
var media = _ref.media,
|
|
460
578
|
settings = _ref.settings,
|
|
461
|
-
|
|
579
|
+
onClickProduct = _ref.onClickProduct;
|
|
462
580
|
return /*#__PURE__*/jsx("div", {
|
|
463
581
|
className: classNames(['diva-widget-image-list']),
|
|
464
582
|
children: media.map(function (m, i) {
|
|
583
|
+
var _settings$openConfigu, _settings$openConfigu2;
|
|
465
584
|
return /*#__PURE__*/jsx("div", {
|
|
466
585
|
className: classNames(['diva-widget-image-list-item']),
|
|
467
586
|
children: settings.description ? /*#__PURE__*/jsxs("div", {
|
|
468
587
|
className: classNames(['diva-widget-image-list-item-description-image']),
|
|
469
588
|
onClick: function onClick() {
|
|
470
|
-
return
|
|
589
|
+
return onClickProduct(m.productId);
|
|
471
590
|
},
|
|
472
591
|
children: [/*#__PURE__*/jsx(MediaItem, {
|
|
473
592
|
mediaUrl: m.url,
|
|
@@ -476,23 +595,35 @@ var ImageList = function ImageList(_ref) {
|
|
|
476
595
|
disableSirv: false,
|
|
477
596
|
sirvProps: settings.sirvProps
|
|
478
597
|
}
|
|
598
|
+
}), ((_settings$openConfigu = settings.openConfiguratorCta) === null || _settings$openConfigu === void 0 ? void 0 : _settings$openConfigu.enabled) && /*#__PURE__*/jsx(OpenConfiguratorButton, {
|
|
599
|
+
settings: settings.openConfiguratorCta,
|
|
600
|
+
onClick: function onClick() {
|
|
601
|
+
return onClickProduct(m.productId);
|
|
602
|
+
}
|
|
479
603
|
}), /*#__PURE__*/jsx("div", {
|
|
480
604
|
className: classNames(['diva-widget-image-list-item-description']),
|
|
481
605
|
children: /*#__PURE__*/jsx("span", {
|
|
482
606
|
children: m.description
|
|
483
607
|
})
|
|
484
608
|
})]
|
|
485
|
-
}) : /*#__PURE__*/
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
609
|
+
}) : /*#__PURE__*/jsxs(Fragment, {
|
|
610
|
+
children: [/*#__PURE__*/jsx(MediaItem, {
|
|
611
|
+
mediaUrl: m.url,
|
|
612
|
+
isCurrentlyVisible: true,
|
|
613
|
+
config: {
|
|
614
|
+
disableSirv: false,
|
|
615
|
+
sirvProps: settings.sirvProps
|
|
616
|
+
},
|
|
617
|
+
className: classNames(['diva-widget-image-list-item-image']),
|
|
618
|
+
onClick: function onClick() {
|
|
619
|
+
return onClickProduct(m.productId);
|
|
620
|
+
}
|
|
621
|
+
}), ((_settings$openConfigu2 = settings.openConfiguratorCta) === null || _settings$openConfigu2 === void 0 ? void 0 : _settings$openConfigu2.enabled) && /*#__PURE__*/jsx(OpenConfiguratorButton, {
|
|
622
|
+
settings: settings.openConfiguratorCta,
|
|
623
|
+
onClick: function onClick() {
|
|
624
|
+
return onClickProduct(m.productId);
|
|
625
|
+
}
|
|
626
|
+
})]
|
|
496
627
|
})
|
|
497
628
|
}, i);
|
|
498
629
|
})
|
|
@@ -504,35 +635,39 @@ function MainComponent(props) {
|
|
|
504
635
|
media = _useImageCarousel.media,
|
|
505
636
|
error = _useImageCarousel.error;
|
|
506
637
|
_useImageCarousel.loading;
|
|
507
|
-
var
|
|
638
|
+
var onClickProduct = _useImageCarousel.onClickProduct;
|
|
508
639
|
var _useDivaCore = useDivaCore(),
|
|
509
640
|
isMobile = _useDivaCore.state.isMobile;
|
|
510
641
|
if (error) return /*#__PURE__*/jsx("div", {
|
|
511
642
|
children: "Error"
|
|
512
643
|
});
|
|
513
|
-
if (isMobile &&
|
|
644
|
+
if (isMobile && props.settings.avoidUsingSwiperOnMobile) {
|
|
514
645
|
return /*#__PURE__*/jsx(ImageList, {
|
|
515
646
|
media: media,
|
|
516
647
|
settings: props.settings,
|
|
517
|
-
|
|
648
|
+
onClickProduct: onClickProduct
|
|
518
649
|
});
|
|
519
650
|
}
|
|
520
651
|
return /*#__PURE__*/jsx(SwiperComponent, {
|
|
521
652
|
media: media,
|
|
522
653
|
settings: props.settings,
|
|
523
|
-
|
|
654
|
+
onClickProduct: onClickProduct,
|
|
655
|
+
isMobile: isMobile
|
|
524
656
|
});
|
|
525
657
|
}
|
|
526
658
|
|
|
527
659
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
528
660
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
529
661
|
var Main = function Main(_ref) {
|
|
530
|
-
var _parameters$productId;
|
|
531
662
|
var settings = _ref.settings,
|
|
532
663
|
parameters = _ref.parameters;
|
|
664
|
+
var productIds = useMemo(function () {
|
|
665
|
+
var _parameters$productId, _parameters$productId2;
|
|
666
|
+
return (_parameters$productId = parameters === null || parameters === void 0 || (_parameters$productId2 = parameters.productIds) === null || _parameters$productId2 === void 0 ? void 0 : _parameters$productId2.split(';')) !== null && _parameters$productId !== void 0 ? _parameters$productId : [];
|
|
667
|
+
}, [parameters === null || parameters === void 0 ? void 0 : parameters.productIds]);
|
|
533
668
|
return /*#__PURE__*/jsx(ImageCarouselComponent, {
|
|
534
669
|
settings: settings,
|
|
535
|
-
|
|
670
|
+
productIds: productIds
|
|
536
671
|
});
|
|
537
672
|
};
|
|
538
673
|
var ImageCarouselComponent = function ImageCarouselComponent(props) {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Media } from '@crystaldesign/widget-image-carousel/
|
|
3
|
-
import { Configuration } from '@crystaldesign/widget-image-carousel/types';
|
|
2
|
+
import { Configuration, Media } from '@crystaldesign/widget-image-carousel/types';
|
|
4
3
|
interface ImageListProps {
|
|
5
4
|
media: Media[];
|
|
6
5
|
settings: Configuration;
|
|
7
|
-
|
|
6
|
+
onClickProduct: (id: string) => void;
|
|
8
7
|
}
|
|
9
8
|
export declare const ImageList: React.FC<ImageListProps>;
|
|
10
9
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ImageList/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ImageList/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,4CAA4C,CAAC;AAGlF,UAAU,cAAc;IACtB,KAAK,EAAE,KAAK,EAAE,CAAC;IACf,QAAQ,EAAE,aAAa,CAAC;IACxB,cAAc,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACtC;AAED,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAiC9C,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface OpenConfiguratorButtonProps {
|
|
3
|
+
settings: {
|
|
4
|
+
enabled: boolean;
|
|
5
|
+
className: string;
|
|
6
|
+
ctaText?: string;
|
|
7
|
+
ctaIcon?: string;
|
|
8
|
+
};
|
|
9
|
+
onClick: () => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const OpenConfiguratorButton: React.FC<OpenConfiguratorButtonProps>;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
package/build/types/widget-image-carousel/src/components/OpenConfiguratorButton/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/OpenConfiguratorButton/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,UAAU,2BAA2B;IACnC,QAAQ,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACtF,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC,2BAA2B,CAWxE,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import 'swiper/css';
|
|
3
3
|
import 'swiper/css/navigation';
|
|
4
|
-
import { Media } from '@crystaldesign/widget-image-carousel/
|
|
5
|
-
import { Configuration } from '@crystaldesign/widget-image-carousel/types';
|
|
4
|
+
import { Configuration, Media } from '@crystaldesign/widget-image-carousel/types';
|
|
6
5
|
interface SwiperComponentProps {
|
|
7
6
|
media: Media[];
|
|
8
7
|
settings: Configuration;
|
|
9
|
-
|
|
8
|
+
onClickProduct: (id: string) => void;
|
|
9
|
+
isMobile: boolean;
|
|
10
10
|
}
|
|
11
11
|
export declare const SwiperComponent: React.FC<SwiperComponentProps>;
|
|
12
12
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Swiper/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,YAAY,CAAC;AACpB,OAAO,uBAAuB,CAAC;AAC/B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Swiper/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,YAAY,CAAC;AACpB,OAAO,uBAAuB,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,4CAA4C,CAAC;AAGlF,UAAU,oBAAoB;IAC5B,KAAK,EAAE,KAAK,EAAE,CAAC;IACf,QAAQ,EAAE,aAAa,CAAC;IACxB,cAAc,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAiD1D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,OAAO,KAAkB,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAkB,MAAM,0BAA0B,CAAC;AAG/E,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAO5D,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAG/D,CAAC;AAEF,QAAA,MAAM,aAAa,EAAE,mBAAmB,CAAC,aAAa,CAGrD,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
package/build/types/widget-image-carousel/src/stories/SimpleProductList/kirchner-prod.stories.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { WithDivaMock } from '@crystaldesign/diva-core';
|
|
3
|
+
import { ImageCarouselProps } from '../../types';
|
|
4
|
+
declare const meta: Meta<WithDivaMock<ImageCarouselProps>>;
|
|
5
|
+
export default meta;
|
|
6
|
+
type Story = StoryObj<WithDivaMock<ImageCarouselProps>>;
|
|
7
|
+
export declare const ImageCarousel: Story;
|
|
8
|
+
//# sourceMappingURL=kirchner-prod.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kirchner-prod.stories.d.ts","sourceRoot":"","sources":["../../../../../../src/stories/SimpleProductList/kirchner-prod.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAqB,MAAM,0BAA0B,CAAC;AAG3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAIjD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAmBhD,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC,CAAC;AA8CxD,eAAO,MAAM,aAAa,EAAE,KAE3B,CAAC"}
|
|
@@ -2,10 +2,10 @@ import { BaseConfiguration } from '@crystaldesign/widget-library';
|
|
|
2
2
|
import { SwiperProps } from 'swiper/react';
|
|
3
3
|
export interface ImageCarouselProps {
|
|
4
4
|
settings: Configuration;
|
|
5
|
-
|
|
5
|
+
productIds: string | string[];
|
|
6
6
|
}
|
|
7
7
|
export interface Configuration extends BaseConfiguration {
|
|
8
|
-
type: 'WALL_MOCKUPS' | 'SIMILAR_PRODUCTS';
|
|
8
|
+
type: 'WALL_MOCKUPS' | 'SIMILAR_PRODUCTS' | 'SIMPLE_PRODUCT_LIST';
|
|
9
9
|
mediaFunctionType?: string;
|
|
10
10
|
description?: string;
|
|
11
11
|
sliderProp?: SwiperProps;
|
|
@@ -14,5 +14,16 @@ export interface Configuration extends BaseConfiguration {
|
|
|
14
14
|
[data: string]: string;
|
|
15
15
|
};
|
|
16
16
|
avoidUsingSwiperOnMobile?: boolean;
|
|
17
|
+
openConfiguratorCta?: {
|
|
18
|
+
enabled: boolean;
|
|
19
|
+
className: string;
|
|
20
|
+
ctaText?: string;
|
|
21
|
+
ctaIcon?: string;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export interface Media {
|
|
25
|
+
url: string;
|
|
26
|
+
description?: string;
|
|
27
|
+
productId: string;
|
|
17
28
|
}
|
|
18
29
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACnG,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,aAAa,CAAC;IACxB,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC/B;AAED,MAAM,WAAW,aAAc,SAAQ,iBAAiB;IACtD,IAAI,EAAE,cAAc,GAAG,kBAAkB,GAAG,qBAAqB,CAAC;IAClE,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,WAAW,CAAC;IACzB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,SAAS,CAAC,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IACvC,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,mBAAmB,CAAC,EAAE;QACpB,OAAO,EAAE,OAAO,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAED,MAAM,WAAW,KAAK;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import { ImageCarouselProps } from './types';
|
|
2
|
-
export
|
|
3
|
-
url: string;
|
|
4
|
-
description?: string;
|
|
5
|
-
productId: string;
|
|
6
|
-
}
|
|
7
|
-
export declare function useImageCarousel({ productId, settings }: ImageCarouselProps): {
|
|
1
|
+
import { ImageCarouselProps, Media } from './types';
|
|
2
|
+
export declare function useImageCarousel({ productIds, settings }: ImageCarouselProps): {
|
|
8
3
|
media: Media[];
|
|
9
4
|
error: Error | undefined;
|
|
10
5
|
loading: boolean;
|
|
11
|
-
|
|
6
|
+
onClickProduct: (productId: string) => void;
|
|
12
7
|
};
|
|
13
8
|
//# sourceMappingURL=useImageCarousel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useImageCarousel.d.ts","sourceRoot":"","sources":["../../../../src/useImageCarousel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"useImageCarousel.d.ts","sourceRoot":"","sources":["../../../../src/useImageCarousel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAKpD,wBAAgB,gBAAgB,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,kBAAkB;;;;gCAiB7D,MAAM;EA2LrB"}
|