@crystaldesign/product-detail-page 25.3.0-beta.39 → 25.3.0-beta.42
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 +87 -850
- package/build/types/widget-product-detail-page/src/components/UiElement/index.d.ts.map +1 -0
- package/build/types/{product-detail-page → widget-product-detail-page}/src/components/mainComponents/Variants/Group/index.d.ts.map +1 -1
- package/build/types/{product-detail-page → widget-product-detail-page}/src/stories/boho/boho.stories.d.ts.map +1 -1
- package/build/types/{product-detail-page → widget-product-detail-page}/src/stories/boho/hqViewer.stories.d.ts.map +1 -1
- package/build/types/{product-detail-page → widget-product-detail-page}/src/stories/boho/hqViewerLiviqueTest.stories.d.ts.map +1 -1
- package/build/types/{product-detail-page → widget-product-detail-page}/src/stories/boho/lueck-pdp.stories.d.ts.map +1 -1
- package/build/types/{product-detail-page → widget-product-detail-page}/src/types/index.d.ts +11 -46
- package/build/types/widget-product-detail-page/src/types/index.d.ts.map +1 -0
- package/build/types/{product-detail-page → widget-product-detail-page}/src/useDetailPage.d.ts.map +1 -1
- package/build/types/{product-detail-page → widget-product-detail-page}/src/utils/filterContent.d.ts +2 -2
- package/build/types/widget-product-detail-page/src/utils/filterContent.d.ts.map +1 -0
- package/build/types/{product-detail-page → widget-product-detail-page}/src/utils/resolveReferences.d.ts +2 -2
- package/build/types/widget-product-detail-page/src/utils/resolveReferences.d.ts.map +1 -0
- package/build/umd/product-detail-page.umd.min.js +1 -1
- package/build/umd/report.html +1 -1
- package/package.json +4 -4
- package/build/types/product-detail-page/src/components/UiElement/index.d.ts.map +0 -1
- package/build/types/product-detail-page/src/components/mainComponents/Gallery/ArActionIcon/index.d.ts +0 -11
- package/build/types/product-detail-page/src/components/mainComponents/Gallery/ArActionIcon/index.d.ts.map +0 -1
- package/build/types/product-detail-page/src/components/mainComponents/Gallery/MediaItem/ArItem/index.d.ts +0 -15
- package/build/types/product-detail-page/src/components/mainComponents/Gallery/MediaItem/ArItem/index.d.ts.map +0 -1
- package/build/types/product-detail-page/src/components/mainComponents/Gallery/MediaItem/SirvItem/index.d.ts +0 -10
- package/build/types/product-detail-page/src/components/mainComponents/Gallery/MediaItem/SirvItem/index.d.ts.map +0 -1
- package/build/types/product-detail-page/src/components/mainComponents/Gallery/MediaItem/index.d.ts +0 -12
- package/build/types/product-detail-page/src/components/mainComponents/Gallery/MediaItem/index.d.ts.map +0 -1
- package/build/types/product-detail-page/src/components/mainComponents/Gallery/PageNumber/index.d.ts +0 -8
- package/build/types/product-detail-page/src/components/mainComponents/Gallery/PageNumber/index.d.ts.map +0 -1
- package/build/types/product-detail-page/src/components/mainComponents/Gallery/Thumb/index.d.ts +0 -9
- package/build/types/product-detail-page/src/components/mainComponents/Gallery/Thumb/index.d.ts.map +0 -1
- package/build/types/product-detail-page/src/components/mainComponents/Gallery/index.d.ts +0 -10
- package/build/types/product-detail-page/src/components/mainComponents/Gallery/index.d.ts.map +0 -1
- package/build/types/product-detail-page/src/components/mainComponents/Gallery/useGallery.d.ts +0 -12
- package/build/types/product-detail-page/src/components/mainComponents/Gallery/useGallery.d.ts.map +0 -1
- package/build/types/product-detail-page/src/components/mainComponents/Text/index.d.ts +0 -8
- package/build/types/product-detail-page/src/components/mainComponents/Text/index.d.ts.map +0 -1
- package/build/types/product-detail-page/src/components/mainComponents/actions/ActionGroup/index.d.ts +0 -8
- package/build/types/product-detail-page/src/components/mainComponents/actions/ActionGroup/index.d.ts.map +0 -1
- package/build/types/product-detail-page/src/components/mainComponents/actions/ActionIcon/index.d.ts +0 -8
- package/build/types/product-detail-page/src/components/mainComponents/actions/ActionIcon/index.d.ts.map +0 -1
- package/build/types/product-detail-page/src/components/mainComponents/actions/PdpAction/index.d.ts +0 -8
- package/build/types/product-detail-page/src/components/mainComponents/actions/PdpAction/index.d.ts.map +0 -1
- package/build/types/product-detail-page/src/types/index.d.ts.map +0 -1
- package/build/types/product-detail-page/src/utils/filterContent.d.ts.map +0 -1
- package/build/types/product-detail-page/src/utils/replaceActions.d.ts +0 -19
- package/build/types/product-detail-page/src/utils/replaceActions.d.ts.map +0 -1
- package/build/types/product-detail-page/src/utils/replaceTemplateStrings.d.ts +0 -28
- package/build/types/product-detail-page/src/utils/replaceTemplateStrings.d.ts.map +0 -1
- package/build/types/product-detail-page/src/utils/resolveReferences.d.ts.map +0 -1
- package/build/types/product-detail-page/src/utils/updateCssInDom.d.ts +0 -8
- package/build/types/product-detail-page/src/utils/updateCssInDom.d.ts.map +0 -1
- /package/build/types/{product-detail-page → widget-product-detail-page}/src/components/UiElement/index.d.ts +0 -0
- /package/build/types/{product-detail-page → widget-product-detail-page}/src/components/index.d.ts +0 -0
- /package/build/types/{product-detail-page → widget-product-detail-page}/src/components/index.d.ts.map +0 -0
- /package/build/types/{product-detail-page → widget-product-detail-page}/src/components/mainComponents/Info/TabsInfo/Tab/index.d.ts +0 -0
- /package/build/types/{product-detail-page → widget-product-detail-page}/src/components/mainComponents/Info/TabsInfo/Tab/index.d.ts.map +0 -0
- /package/build/types/{product-detail-page → widget-product-detail-page}/src/components/mainComponents/Info/TabsInfo/index.d.ts +0 -0
- /package/build/types/{product-detail-page → widget-product-detail-page}/src/components/mainComponents/Info/TabsInfo/index.d.ts.map +0 -0
- /package/build/types/{product-detail-page → widget-product-detail-page}/src/components/mainComponents/Info/index.d.ts +0 -0
- /package/build/types/{product-detail-page → widget-product-detail-page}/src/components/mainComponents/Info/index.d.ts.map +0 -0
- /package/build/types/{product-detail-page → widget-product-detail-page}/src/components/mainComponents/Price/index.d.ts +0 -0
- /package/build/types/{product-detail-page → widget-product-detail-page}/src/components/mainComponents/Price/index.d.ts.map +0 -0
- /package/build/types/{product-detail-page → widget-product-detail-page}/src/components/mainComponents/Tabs/index.d.ts +0 -0
- /package/build/types/{product-detail-page → widget-product-detail-page}/src/components/mainComponents/Tabs/index.d.ts.map +0 -0
- /package/build/types/{product-detail-page → widget-product-detail-page}/src/components/mainComponents/Variants/Group/index.d.ts +0 -0
- /package/build/types/{product-detail-page → widget-product-detail-page}/src/components/mainComponents/Variants/index.d.ts +0 -0
- /package/build/types/{product-detail-page → widget-product-detail-page}/src/components/mainComponents/Variants/index.d.ts.map +0 -0
- /package/build/types/{product-detail-page → widget-product-detail-page}/src/components/mainComponents/Variants/useVariants.d.ts +0 -0
- /package/build/types/{product-detail-page → widget-product-detail-page}/src/components/mainComponents/Variants/useVariants.d.ts.map +0 -0
- /package/build/types/{product-detail-page → widget-product-detail-page}/src/index.d.ts +0 -0
- /package/build/types/{product-detail-page → widget-product-detail-page}/src/index.d.ts.map +0 -0
- /package/build/types/{product-detail-page → widget-product-detail-page}/src/stories/boho/boho.stories.d.ts +0 -0
- /package/build/types/{product-detail-page → widget-product-detail-page}/src/stories/boho/hqViewer.stories.d.ts +0 -0
- /package/build/types/{product-detail-page → widget-product-detail-page}/src/stories/boho/hqViewerLiviqueTest.stories.d.ts +0 -0
- /package/build/types/{product-detail-page → widget-product-detail-page}/src/stories/boho/lueck-pdp.stories.d.ts +0 -0
- /package/build/types/{product-detail-page → widget-product-detail-page}/src/useDetailPage.d.ts +0 -0
- /package/build/types/{product-detail-page → widget-product-detail-page}/src/utils/getVariant.d.ts +0 -0
- /package/build/types/{product-detail-page → widget-product-detail-page}/src/utils/getVariant.d.ts.map +0 -0
package/build/esm/index.js
CHANGED
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
-
import
|
|
2
|
+
import { useState, useRef, useEffect, useMemo, useCallback } from 'react';
|
|
3
|
+
import { replaceTemplatesInObject, Action, ActionGroup, Text, Gallery, useCss, useProductData, replaceActions } from '@crystaldesign/widget-library';
|
|
4
|
+
import { useTranslation, DivaUtils, getLogger, useDivaCore, DivaError } from '@crystaldesign/diva-core';
|
|
5
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
3
6
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
4
|
-
import { Navigation, Thumbs } from 'swiper/modules';
|
|
5
|
-
import { Swiper, SwiperSlide } from 'swiper/react';
|
|
6
|
-
import { useLayer, Arrow } from 'react-laag';
|
|
7
|
-
import QRCode from 'react-qr-code';
|
|
8
|
-
import { useDivaCore, useTranslation, DivaUtils, getLogger, DivaError } from '@crystaldesign/diva-core';
|
|
9
|
-
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
10
|
-
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
11
7
|
import classnames from 'classnames';
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
15
|
-
import _regeneratorRuntime from '@babel/runtime/regenerator';
|
|
8
|
+
import { Swiper, SwiperSlide } from 'swiper/react';
|
|
9
|
+
import { Navigation } from 'swiper/modules';
|
|
16
10
|
import cloneDeep from 'lodash/cloneDeep';
|
|
11
|
+
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
12
|
+
import flatten from 'flat';
|
|
17
13
|
import DivaUtils$1 from '@crystaldesign/diva-utils';
|
|
18
14
|
|
|
19
15
|
(function() {
|
|
@@ -28,432 +24,6 @@ import DivaUtils$1 from '@crystaldesign/diva-utils';
|
|
|
28
24
|
globalThis.process = { env:env };
|
|
29
25
|
})();
|
|
30
26
|
|
|
31
|
-
function ownKeys$7(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; }
|
|
32
|
-
function _objectSpread$7(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$7(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$7(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
33
|
-
var ArActionIcon = function ArActionIcon(_ref) {
|
|
34
|
-
var _config$className;
|
|
35
|
-
var config = _ref.config,
|
|
36
|
-
url = _ref.url,
|
|
37
|
-
htmlArElement = _ref.htmlArElement;
|
|
38
|
-
var _useDivaCore = useDivaCore(),
|
|
39
|
-
_useDivaCore$state = _useDivaCore.state,
|
|
40
|
-
isMobile = _useDivaCore$state.isMobile,
|
|
41
|
-
arViewerBaseUrl = _useDivaCore$state.apiConfig.arViewerBaseUrl;
|
|
42
|
-
var userAgent = navigator.userAgent.toLowerCase();
|
|
43
|
-
var supportAr = !(userAgent.includes('fxios') || userAgent.includes('firefox') || userAgent.includes('edgios') && userAgent.includes('iphone'));
|
|
44
|
-
var useTooltip = !isMobile || !supportAr;
|
|
45
|
-
var _useState = useState(false),
|
|
46
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
47
|
-
isOpen = _useState2[0],
|
|
48
|
-
setOpen = _useState2[1];
|
|
49
|
-
var _useLayer = useLayer({
|
|
50
|
-
isOpen: isOpen && useTooltip,
|
|
51
|
-
auto: true,
|
|
52
|
-
onOutsideClick: function onOutsideClick() {
|
|
53
|
-
return setOpen(false);
|
|
54
|
-
},
|
|
55
|
-
placement: 'top-start',
|
|
56
|
-
triggerOffset: 10
|
|
57
|
-
}),
|
|
58
|
-
arrowProps = _useLayer.arrowProps,
|
|
59
|
-
layerProps = _useLayer.layerProps,
|
|
60
|
-
renderLayer = _useLayer.renderLayer,
|
|
61
|
-
triggerProps = _useLayer.triggerProps;
|
|
62
|
-
useEffect(function () {
|
|
63
|
-
if (isOpen && !useTooltip) {
|
|
64
|
-
htmlArElement.activateAR();
|
|
65
|
-
}
|
|
66
|
-
}, [isOpen]);
|
|
67
|
-
useEffect(function () {
|
|
68
|
-
var _htmlArElement$shadow;
|
|
69
|
-
var element = (_htmlArElement$shadow = htmlArElement.shadowRoot) === null || _htmlArElement$shadow === void 0 ? void 0 : _htmlArElement$shadow.getElementById('default-ar-button');
|
|
70
|
-
if (element !== null && element !== void 0 && element.style) element.style.display = 'none';
|
|
71
|
-
}, []);
|
|
72
|
-
if (!url || !arViewerBaseUrl) return /*#__PURE__*/jsx(Fragment, {});
|
|
73
|
-
var finalURL = arViewerBaseUrl + '/arViewer?arMedia=' + url;
|
|
74
|
-
return /*#__PURE__*/jsx("div", _objectSpread$7(_objectSpread$7({}, triggerProps), {}, {
|
|
75
|
-
onClick: function onClick() {
|
|
76
|
-
return setOpen(!isOpen);
|
|
77
|
-
},
|
|
78
|
-
className: 'diva-pdp-ar-action-icon ' + ((_config$className = config.className) !== null && _config$className !== void 0 ? _config$className : ''),
|
|
79
|
-
children: isOpen && useTooltip && renderLayer(/*#__PURE__*/jsxs("div", _objectSpread$7(_objectSpread$7({}, layerProps), {}, {
|
|
80
|
-
className: "ar-tooltip",
|
|
81
|
-
children: [/*#__PURE__*/jsxs("div", {
|
|
82
|
-
className: "ar-tooltip-container",
|
|
83
|
-
onClick: function onClick(e) {
|
|
84
|
-
return e.stopPropagation();
|
|
85
|
-
},
|
|
86
|
-
children: [/*#__PURE__*/jsx(QRCode, {
|
|
87
|
-
value: finalURL,
|
|
88
|
-
className: "qr-code",
|
|
89
|
-
onClick: function onClick() {
|
|
90
|
-
return window.open(finalURL, '_blank');
|
|
91
|
-
}
|
|
92
|
-
}), /*#__PURE__*/jsx("div", {
|
|
93
|
-
className: "text",
|
|
94
|
-
children: !!config.text && config.text
|
|
95
|
-
}), /*#__PURE__*/jsx("div", {
|
|
96
|
-
className: "close",
|
|
97
|
-
onClick: function onClick() {
|
|
98
|
-
return setOpen(false);
|
|
99
|
-
}
|
|
100
|
-
})]
|
|
101
|
-
}), /*#__PURE__*/jsx(Arrow, _objectSpread$7({
|
|
102
|
-
onPointerEnterCapture: undefined,
|
|
103
|
-
onPointerLeaveCapture: undefined
|
|
104
|
-
}, arrowProps))]
|
|
105
|
-
})))
|
|
106
|
-
}));
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
function useGallery (_ref) {
|
|
110
|
-
var product = _ref.product,
|
|
111
|
-
_ref$config = _ref.config,
|
|
112
|
-
functionTypes = _ref$config.functionTypes,
|
|
113
|
-
add2DImage = _ref$config.add2DImage,
|
|
114
|
-
add3DImageAsFallback = _ref$config.add3DImageAsFallback;
|
|
115
|
-
var _useState = useState([]),
|
|
116
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
117
|
-
medias = _useState2[0],
|
|
118
|
-
setMedias = _useState2[1];
|
|
119
|
-
var _useState3 = useState(false),
|
|
120
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
121
|
-
sirvLoaded = _useState4[0],
|
|
122
|
-
setSirvLoaded = _useState4[1];
|
|
123
|
-
var _useDivaCore = useDivaCore(),
|
|
124
|
-
baseSirvUrls = _useDivaCore.state.apiConfig.baseSirvUrls;
|
|
125
|
-
useEffect(function () {
|
|
126
|
-
var _product$media;
|
|
127
|
-
var newMedias = [];
|
|
128
|
-
var _loop = function _loop() {
|
|
129
|
-
var _product$media$filter, _product$media2;
|
|
130
|
-
var functionType = functionTypes[i];
|
|
131
|
-
newMedias = [].concat(_toConsumableArray(newMedias), _toConsumableArray((_product$media$filter = (_product$media2 = product.media) === null || _product$media2 === void 0 ? void 0 : _product$media2.filter(function (m, i) {
|
|
132
|
-
return m.functionType === functionType;
|
|
133
|
-
})) !== null && _product$media$filter !== void 0 ? _product$media$filter : []));
|
|
134
|
-
};
|
|
135
|
-
for (var i = 0; i < functionTypes.length; i++) {
|
|
136
|
-
_loop();
|
|
137
|
-
}
|
|
138
|
-
if (add3DImageAsFallback && product.image && !((_product$media = product.media) !== null && _product$media !== void 0 && _product$media.find(function (m) {
|
|
139
|
-
return m.functionType == 'ART' || m.functionType == 'PROD';
|
|
140
|
-
}))) newMedias.push({
|
|
141
|
-
url: product.image
|
|
142
|
-
});
|
|
143
|
-
if (add2DImage && product.image2D) newMedias.push({
|
|
144
|
-
url: product.image2D
|
|
145
|
-
});
|
|
146
|
-
setMedias(newMedias);
|
|
147
|
-
}, [product]);
|
|
148
|
-
useEffect(function () {
|
|
149
|
-
var hasSirvMedia = false;
|
|
150
|
-
var _loop2 = function _loop2(i) {
|
|
151
|
-
if (medias.find(function (m) {
|
|
152
|
-
var _m$url;
|
|
153
|
-
return (_m$url = m.url) === null || _m$url === void 0 ? void 0 : _m$url.includes(baseSirvUrls[i]);
|
|
154
|
-
})) hasSirvMedia = true;
|
|
155
|
-
};
|
|
156
|
-
for (var i = 0; i < (baseSirvUrls !== null && baseSirvUrls !== void 0 ? baseSirvUrls : []).length && !hasSirvMedia; i++) {
|
|
157
|
-
_loop2(i);
|
|
158
|
-
}
|
|
159
|
-
if (!hasSirvMedia) return;
|
|
160
|
-
var loadSirv = function loadSirv() {
|
|
161
|
-
return new Promise(function (resolve) {
|
|
162
|
-
var script = document.createElement('script');
|
|
163
|
-
script.src = 'https://scripts.sirv.com/sirvjs/v3/sirv.js?modules=lazyimage,zoom,spin';
|
|
164
|
-
script.type = 'text/javascript';
|
|
165
|
-
script.async = true;
|
|
166
|
-
script.onload = resolve;
|
|
167
|
-
document.body.appendChild(script);
|
|
168
|
-
});
|
|
169
|
-
};
|
|
170
|
-
loadSirv().then(function () {
|
|
171
|
-
setSirvLoaded(true);
|
|
172
|
-
});
|
|
173
|
-
}, [medias]);
|
|
174
|
-
return {
|
|
175
|
-
medias: medias,
|
|
176
|
-
sirvLoaded: sirvLoaded
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
function ownKeys$6(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; }
|
|
181
|
-
function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$6(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$6(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
182
|
-
var SirvMediaItem = function SirvMediaItem(_ref) {
|
|
183
|
-
var _ref$media = _ref.media,
|
|
184
|
-
url = _ref$media.url,
|
|
185
|
-
functionType = _ref$media.functionType,
|
|
186
|
-
_ref$config = _ref.config,
|
|
187
|
-
sirvProps = _ref$config.sirvProps,
|
|
188
|
-
specificSirvProps = _ref$config.specificSirvProps,
|
|
189
|
-
sirvWrapperProps = _ref$config.sirvWrapperProps;
|
|
190
|
-
var props = functionType && specificSirvProps !== null && specificSirvProps !== void 0 && specificSirvProps[functionType] ? specificSirvProps[functionType] : sirvProps;
|
|
191
|
-
var urlObj = new URL(url !== null && url !== void 0 ? url : '');
|
|
192
|
-
urlObj.searchParams.append('crop.type', 'trim');
|
|
193
|
-
urlObj.searchParams.append('crop.pad.x', '10%');
|
|
194
|
-
urlObj.searchParams.append('crop.pad.y', '10%');
|
|
195
|
-
return /*#__PURE__*/jsx("div", _objectSpread$6(_objectSpread$6({
|
|
196
|
-
className: "Sirv custom"
|
|
197
|
-
}, sirvWrapperProps), {}, {
|
|
198
|
-
children: /*#__PURE__*/jsx("div", _objectSpread$6(_objectSpread$6({
|
|
199
|
-
"data-src": urlObj.toString()
|
|
200
|
-
}, props), {}, {
|
|
201
|
-
className: 'diva-sirv-img'
|
|
202
|
-
}))
|
|
203
|
-
}));
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
function styleInject(css, ref) {
|
|
207
|
-
if ( ref === void 0 ) ref = {};
|
|
208
|
-
var insertAt = ref.insertAt;
|
|
209
|
-
|
|
210
|
-
if (!css || typeof document === 'undefined') { return; }
|
|
211
|
-
|
|
212
|
-
var head = document.head || document.getElementsByTagName('head')[0];
|
|
213
|
-
var style = document.createElement('style');
|
|
214
|
-
style.type = 'text/css';
|
|
215
|
-
|
|
216
|
-
if (insertAt === 'top') {
|
|
217
|
-
if (head.firstChild) {
|
|
218
|
-
head.insertBefore(style, head.firstChild);
|
|
219
|
-
} else {
|
|
220
|
-
head.appendChild(style);
|
|
221
|
-
}
|
|
222
|
-
} else {
|
|
223
|
-
head.appendChild(style);
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
if (style.styleSheet) {
|
|
227
|
-
style.styleSheet.cssText = css;
|
|
228
|
-
} else {
|
|
229
|
-
style.appendChild(document.createTextNode(css));
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
var divaAr = "diva-ar-msJ2C";
|
|
234
|
-
var css_248z$2 = "/* This keeps child nodes hidden while the element loads */\n.diva-ar-msJ2C :not(:defined) > * {\n display: none;\n}\n\nmodel-viewer.diva-ar-msJ2C {\n overflow-x: hidden;\n}\n\n@keyframes circle-qKefP {\n from {\n transform: translateX(-50%) rotate(0deg) translateX(50px) rotate(0deg);\n }\n to {\n transform: translateX(-50%) rotate(360deg) translateX(50px) rotate(-360deg);\n }\n}\n\n@keyframes elongate-EJuQ- {\n from {\n transform: translateX(100px);\n }\n to {\n transform: translateX(-100px);\n }\n}\n\nmodel-viewer.diva-ar-msJ2C > #ar-prompt {\n position: absolute;\n left: 50%;\n bottom: 175px;\n animation: elongate-EJuQ- 2s infinite ease-in-out alternate;\n display: none;\n}\n\nmodel-viewer.diva-ar-msJ2C[ar-status='session-started'] > #ar-prompt {\n display: block;\n}\n\nmodel-viewer.diva-ar-msJ2C > #ar-prompt > img {\n animation: circle-qKefP 4s linear infinite;\n}\n\nmodel-viewer.diva-ar-msJ2C > #ar-failure {\n position: absolute;\n left: 50%;\n transform: translateX(-50%);\n bottom: 175px;\n display: none;\n}\n\nmodel-viewer.diva-ar-msJ2C[ar-tracking='not-tracking'] > #ar-failure {\n display: block;\n}\n";
|
|
235
|
-
styleInject(css_248z$2);
|
|
236
|
-
|
|
237
|
-
if (!window.customElements.get('model-viewer')) {
|
|
238
|
-
import('@google/model-viewer');
|
|
239
|
-
}
|
|
240
|
-
var ArViewer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
241
|
-
_ref.cameraArButton;
|
|
242
|
-
var media = _ref.media;
|
|
243
|
-
var _useDivaCore = useDivaCore(),
|
|
244
|
-
_useDivaCore$state = _useDivaCore.state,
|
|
245
|
-
baseCdnUrl = _useDivaCore$state.apiConfig.baseCdnUrl,
|
|
246
|
-
isFirefox = _useDivaCore$state.isFirefox;
|
|
247
|
-
return /*#__PURE__*/jsxs("model-viewer", {
|
|
248
|
-
ref: ref,
|
|
249
|
-
src: media.url,
|
|
250
|
-
"environment-image": 'neutral',
|
|
251
|
-
shadowIntensity: 1,
|
|
252
|
-
shadowSoftness: 1,
|
|
253
|
-
exposure: 1,
|
|
254
|
-
"camera-controls": true,
|
|
255
|
-
ar: true,
|
|
256
|
-
"ar-modes": !isFirefox ? 'webxr quick-look' : '',
|
|
257
|
-
"ar-scale": 'fixed',
|
|
258
|
-
style: {
|
|
259
|
-
overscrollBehavior: 'none',
|
|
260
|
-
width: '100%',
|
|
261
|
-
height: '100%',
|
|
262
|
-
touchAction: 'none'
|
|
263
|
-
},
|
|
264
|
-
"class": classnames(divaAr, 'diva-pdp-ar'),
|
|
265
|
-
"touch-action": "pan-y",
|
|
266
|
-
children: [/*#__PURE__*/jsx("div", {
|
|
267
|
-
id: "ar-prompt",
|
|
268
|
-
children: /*#__PURE__*/jsx("img", {
|
|
269
|
-
src: baseCdnUrl + '/static/images/hand.png'
|
|
270
|
-
})
|
|
271
|
-
}), /*#__PURE__*/jsx("button", {
|
|
272
|
-
id: "ar-failure",
|
|
273
|
-
children: "AR is not tracking!"
|
|
274
|
-
})]
|
|
275
|
-
});
|
|
276
|
-
});
|
|
277
|
-
|
|
278
|
-
var MediaItem = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
279
|
-
var media = _ref.media,
|
|
280
|
-
config = _ref.config;
|
|
281
|
-
_ref.isCurrentlyVisible;
|
|
282
|
-
var useSirv = false;
|
|
283
|
-
var _useDivaCore = useDivaCore(),
|
|
284
|
-
baseSirvUrls = _useDivaCore.state.apiConfig.baseSirvUrls;
|
|
285
|
-
if (media.url && baseSirvUrls !== null && baseSirvUrls !== void 0 && baseSirvUrls.find(function (base) {
|
|
286
|
-
var _media$url;
|
|
287
|
-
return (_media$url = media.url) === null || _media$url === void 0 ? void 0 : _media$url.includes(base);
|
|
288
|
-
})) useSirv = true;
|
|
289
|
-
if (useSirv) return /*#__PURE__*/jsx(SirvMediaItem, {
|
|
290
|
-
media: media,
|
|
291
|
-
config: config
|
|
292
|
-
}, media.url);
|
|
293
|
-
if (media.mediaType == 'AR') return /*#__PURE__*/jsx(ArViewer, {
|
|
294
|
-
ref: ref,
|
|
295
|
-
media: media
|
|
296
|
-
});
|
|
297
|
-
return /*#__PURE__*/jsx("img", {
|
|
298
|
-
className: "gallery-image",
|
|
299
|
-
src: media.url
|
|
300
|
-
}, media.url);
|
|
301
|
-
});
|
|
302
|
-
|
|
303
|
-
var Thumb = function Thumb(_ref) {
|
|
304
|
-
var _media$url;
|
|
305
|
-
var media = _ref.media,
|
|
306
|
-
medias = _ref.medias;
|
|
307
|
-
var _useDivaCore = useDivaCore(),
|
|
308
|
-
baseSirvUrls = _useDivaCore.state.apiConfig.baseSirvUrls;
|
|
309
|
-
function addCrop(url) {
|
|
310
|
-
var res = new URL(url);
|
|
311
|
-
if (url && baseSirvUrls !== null && baseSirvUrls !== void 0 && baseSirvUrls.find(function (base) {
|
|
312
|
-
return url.includes(base);
|
|
313
|
-
})) {
|
|
314
|
-
res.searchParams.append('crop.type', 'trim');
|
|
315
|
-
res.searchParams.append('crop.pad.x', '10%');
|
|
316
|
-
res.searchParams.append('crop.pad.y', '10%');
|
|
317
|
-
}
|
|
318
|
-
return res;
|
|
319
|
-
}
|
|
320
|
-
if (media.mediaType == 'AR') {
|
|
321
|
-
var _ref2, _medias$find$url, _medias$find;
|
|
322
|
-
var mainImageUrl = addCrop((_ref2 = (_medias$find$url = (_medias$find = medias.find(function (m) {
|
|
323
|
-
return m.functionType == 'ART';
|
|
324
|
-
})) === null || _medias$find === void 0 ? void 0 : _medias$find.url) !== null && _medias$find$url !== void 0 ? _medias$find$url : medias[0].url) !== null && _ref2 !== void 0 ? _ref2 : '');
|
|
325
|
-
return /*#__PURE__*/jsxs(Fragment, {
|
|
326
|
-
children: [/*#__PURE__*/jsx("img", {
|
|
327
|
-
className: "gallery-image-thumb",
|
|
328
|
-
src: mainImageUrl.toString()
|
|
329
|
-
}), /*#__PURE__*/jsx("div", {
|
|
330
|
-
className: 'ar-icon-thumb',
|
|
331
|
-
style: {
|
|
332
|
-
backgroundColor: 'white',
|
|
333
|
-
border: 'solid',
|
|
334
|
-
borderWidth: '0.1px',
|
|
335
|
-
borderRadius: '100%'
|
|
336
|
-
}
|
|
337
|
-
})]
|
|
338
|
-
});
|
|
339
|
-
}
|
|
340
|
-
var urlObj = addCrop((_media$url = media.url) !== null && _media$url !== void 0 ? _media$url : '');
|
|
341
|
-
return /*#__PURE__*/jsx("img", {
|
|
342
|
-
className: "gallery-image-thumb",
|
|
343
|
-
src: urlObj.toString()
|
|
344
|
-
});
|
|
345
|
-
};
|
|
346
|
-
|
|
347
|
-
var gallery = "gallery-jOl8d";
|
|
348
|
-
var css_248z$1 = ".gallery-jOl8d .gallery-thumb .swiper-slide {\n opacity: 0.4;\n}\n.gallery-jOl8d .gallery-thumb .swiper-slide-thumb-active {\n opacity: 1;\n}\n\n/*navigation*/\n.gallery-jOl8d.diva-pdp-gallery .swiper-button-prev,\n.gallery-jOl8d.diva-pdp-gallery .swiper-button-next {\n position: absolute;\n top: 50%;\n top: var(--swiper-navigation-top-offset, 50%);\n width: calc(var(--swiper-navigation-size) / 44 * 27);\n height: var(--swiper-navigation-size);\n margin-top: calc(0px - (var(--swiper-navigation-size) / 2));\n z-index: 10;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--swiper-theme-color);\n color: var(--swiper-navigation-color, var(--swiper-theme-color));\n}\n.gallery-jOl8d.diva-pdp-gallery .swiper-button-prev.swiper-button-disabled,\n.gallery-jOl8d.diva-pdp-gallery .swiper-button-next.swiper-button-disabled {\n opacity: 0.35;\n cursor: auto;\n pointer-events: none;\n}\n.gallery-jOl8d.diva-pdp-gallery .swiper-button-prev.swiper-button-hidden,\n.gallery-jOl8d.diva-pdp-gallery .swiper-button-next.swiper-button-hidden {\n opacity: 0;\n cursor: auto;\n pointer-events: none;\n}\n.gallery-jOl8d.diva-pdp-gallery .swiper-navigation-disabled .swiper-button-prev,\n.gallery-jOl8d.diva-pdp-gallery .swiper-navigation-disabled .swiper-button-next {\n display: none !important;\n}\n.gallery-jOl8d.diva-pdp-gallery .swiper-button-prev svg,\n.gallery-jOl8d.diva-pdp-gallery .swiper-button-next svg {\n width: 100%;\n height: 100%;\n -o-object-fit: contain;\n object-fit: contain;\n transform-origin: center;\n}\n.gallery-jOl8d.diva-pdp-gallery .swiper-rtl .swiper-button-prev svg,\n.gallery-jOl8d.diva-pdp-gallery .swiper-rtl .swiper-button-next svg {\n transform: rotate(180deg);\n}\n.gallery-jOl8d.diva-pdp-gallery .swiper-button-prev,\n.gallery-jOl8d.diva-pdp-gallery .swiper-rtl .swiper-button-next {\n left: 10px;\n left: var(--swiper-navigation-sides-offset, 10px);\n right: auto;\n}\n.gallery-jOl8d.diva-pdp-gallery .swiper-button-next,\n.gallery-jOl8d.diva-pdp-gallery .swiper-rtl .swiper-button-prev {\n right: 10px;\n right: var(--swiper-navigation-sides-offset, 10px);\n left: auto;\n}\n.gallery-jOl8d.diva-pdp-gallery .swiper-button-lock {\n display: none;\n}\n/* Navigation font start */\n.gallery-jOl8d.diva-pdp-gallery .swiper-button-prev:after,\n.gallery-jOl8d.diva-pdp-gallery .swiper-button-next:after {\n text-transform: none !important;\n}\n.gallery-jOl8d.diva-pdp-gallery .swiper-button-prev:after,\n.gallery-jOl8d.diva-pdp-gallery .swiper-button-next:after {\n font-family: swiper-icons;\n font-size: var(--swiper-navigation-size);\n letter-spacing: 0;\n font-feature-settings: ;\n font-variant: normal;\n font-variant: initial;\n line-height: 1;\n}\n.gallery-jOl8d.diva-pdp-gallery .swiper-button-prev:after,\n.gallery-jOl8d.diva-pdp-gallery .swiper-rtl .swiper-button-next:after {\n content: 'prev';\n}\n.gallery-jOl8d.diva-pdp-gallery .swiper-button-next,\n.gallery-jOl8d.diva-pdp-gallery .swiper-rtl .swiper-button-prev {\n right: 10px;\n right: var(--swiper-navigation-sides-offset, 10px);\n left: auto;\n}\n.gallery-jOl8d.diva-pdp-gallery .swiper-button-next:after,\n.gallery-jOl8d.diva-pdp-gallery .swiper-rtl .swiper-button-prev:after {\n content: 'next';\n}\n/* Navigation font end */\n\n/*swiper min css*/\n\n@font-face {\n font-family: swiper-icons;\n src: url('data:application/font-woff;charset=utf-8;base64, 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');\n font-weight: 400;\n font-style: normal;\n}\n\n.gallery-jOl8d.diva-pdp-gallery .swiper {\n margin-left: auto;\n margin-right: auto;\n position: relative;\n overflow: hidden;\n list-style: none;\n padding: 0;\n z-index: 1;\n}\n.gallery-jOl8d.diva-pdp-gallery .swiper-vertical > .swiper-wrapper {\n flex-direction: column;\n}\n.gallery-jOl8d.diva-pdp-gallery .swiper-wrapper {\n position: relative;\n width: 100%;\n height: 100%;\n z-index: 1;\n display: flex;\n transition-property: transform;\n box-sizing: content-box;\n}\n.gallery-jOl8d.diva-pdp-gallery .swiper-android .swiper-slide,\n.gallery-jOl8d.diva-pdp-gallery .swiper-wrapper {\n transform: translate3d(0px, 0, 0);\n}\n.gallery-jOl8d.diva-pdp-gallery .swiper-pointer-events {\n touch-action: pan-y;\n}\n.gallery-jOl8d.diva-pdp-gallery .swiper-pointer-events.swiper-vertical {\n touch-action: pan-x;\n}\n.gallery-jOl8d.diva-pdp-gallery .swiper-slide {\n flex-shrink: 0;\n width: 100%;\n height: 100%;\n position: relative;\n transition-property: transform;\n}\n\n.gallery-jOl8d.diva-pdp-gallery .swiper-slide-invisible-blank {\n visibility: hidden;\n}\n.gallery-jOl8d.diva-pdp-gallery .swiper-autoheight,\n.gallery-jOl8d.diva-pdp-gallery .swiper-autoheight .swiper-slide {\n height: auto;\n}\n.gallery-jOl8d.diva-pdp-gallery .swiper-autoheight .swiper-wrapper {\n align-items: flex-start;\n transition-property: transform, height;\n}\n.gallery-jOl8d.diva-pdp-gallery .swiper-backface-hidden .swiper-slide {\n transform: translateZ(0);\n backface-visibility: hidden;\n}\n.gallery-jOl8d.diva-pdp-gallery .swiper-horizontal.swiper-css-mode > .swiper-wrapper {\n scroll-snap-type: x mandatory;\n}\n.gallery-jOl8d.diva-pdp-gallery .swiper-vertical.swiper-css-mode > .swiper-wrapper {\n scroll-snap-type: y mandatory;\n}\n.gallery-jOl8d.diva-pdp-gallery .swiper-centered > .swiper-wrapper::before {\n content: '';\n flex-shrink: 0;\n order: 9999;\n}\n[dir=\"ltr\"] .gallery-jOl8d.diva-pdp-gallery .swiper-centered.swiper-horizontal > .swiper-wrapper > .swiper-slide:first-child {\n margin-left: var(--swiper-centered-offset-before);\n}\n[dir=\"rtl\"] .gallery-jOl8d.diva-pdp-gallery .swiper-centered.swiper-horizontal > .swiper-wrapper > .swiper-slide:first-child {\n margin-right: var(--swiper-centered-offset-before);\n}\n.gallery-jOl8d.diva-pdp-gallery .swiper-centered.swiper-horizontal > .swiper-wrapper::before {\n height: 100%;\n min-height: 1px;\n width: var(--swiper-centered-offset-after);\n}\n.gallery-jOl8d.diva-pdp-gallery .swiper-centered.swiper-vertical > .swiper-wrapper > .swiper-slide:first-child {\n margin-top: var(--swiper-centered-offset-before);\n}\n.gallery-jOl8d.diva-pdp-gallery .swiper-centered.swiper-vertical > .swiper-wrapper::before {\n width: 100%;\n min-width: 1px;\n height: var(--swiper-centered-offset-after);\n}\n.gallery-jOl8d.diva-pdp-gallery .swiper-centered > .swiper-wrapper > .swiper-slide {\n scroll-snap-align: center center;\n}\n";
|
|
349
|
-
styleInject(css_248z$1);
|
|
350
|
-
|
|
351
|
-
var PageNumber = function PageNumber(_ref) {
|
|
352
|
-
var index = _ref.index,
|
|
353
|
-
length = _ref.length;
|
|
354
|
-
return /*#__PURE__*/jsx("div", {
|
|
355
|
-
className: "gallery-page-number",
|
|
356
|
-
children: index + 1 + '/' + length
|
|
357
|
-
});
|
|
358
|
-
};
|
|
359
|
-
|
|
360
|
-
function ownKeys$5(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; }
|
|
361
|
-
function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$5(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$5(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
362
|
-
var focusable = '.smv-cursor-zoom-in, .sirv-zoom-wrapper, .sirv-zoom-map-lens ,.sirv-zoom-map, .sirv-deepzoom, .smv-icon, canvas, .diva-sirv-img, input, select, option, textarea, button, video, label';
|
|
363
|
-
var noSwiping = 'canvas, model-viewer, .sirv-zoom-map, .zoom-controls, .smv-icon';
|
|
364
|
-
var Gallery = function Gallery(_ref) {
|
|
365
|
-
var _medias$find;
|
|
366
|
-
var config = _ref.config,
|
|
367
|
-
product = _ref.product;
|
|
368
|
-
var _useState = useState(null),
|
|
369
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
370
|
-
thumbsSwiper = _useState2[0],
|
|
371
|
-
setThumbsSwiper = _useState2[1];
|
|
372
|
-
var _useState3 = useState(null),
|
|
373
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
374
|
-
swiper = _useState4[0],
|
|
375
|
-
setSwiper = _useState4[1];
|
|
376
|
-
var _useState5 = useState(0),
|
|
377
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
378
|
-
currentIndex = _useState6[0],
|
|
379
|
-
setCurrentIndex = _useState6[1];
|
|
380
|
-
var className = config.className;
|
|
381
|
-
var _useGallery = useGallery({
|
|
382
|
-
product: product,
|
|
383
|
-
config: config
|
|
384
|
-
}),
|
|
385
|
-
medias = _useGallery.medias;
|
|
386
|
-
var htmlArElement = useRef(null);
|
|
387
|
-
if (!medias.length) return /*#__PURE__*/jsx(Fragment, {});
|
|
388
|
-
var arUrl = (_medias$find = medias.find(function (m) {
|
|
389
|
-
return m.mediaType == 'AR';
|
|
390
|
-
})) === null || _medias$find === void 0 ? void 0 : _medias$find.url;
|
|
391
|
-
return /*#__PURE__*/jsxs("div", {
|
|
392
|
-
className: classnames(gallery, ' diva-pdp-gallery', className),
|
|
393
|
-
children: [config.arIconProps && (htmlArElement === null || htmlArElement === void 0 ? void 0 : htmlArElement.current) && arUrl && /*#__PURE__*/jsx(ArActionIcon, {
|
|
394
|
-
config: config.arIconProps,
|
|
395
|
-
url: arUrl,
|
|
396
|
-
htmlArElement: htmlArElement === null || htmlArElement === void 0 ? void 0 : htmlArElement.current
|
|
397
|
-
}), config.showPageNumber && swiper && /*#__PURE__*/jsx(PageNumber, {
|
|
398
|
-
index: currentIndex,
|
|
399
|
-
length: medias.length
|
|
400
|
-
}), /*#__PURE__*/jsx(Swiper, _objectSpread$5(_objectSpread$5({
|
|
401
|
-
onSwiper: setSwiper,
|
|
402
|
-
resizeObserver: false,
|
|
403
|
-
onSlideChange: function onSlideChange(swiper) {
|
|
404
|
-
setCurrentIndex(swiper.realIndex);
|
|
405
|
-
},
|
|
406
|
-
focusableElements: focusable,
|
|
407
|
-
noSwipingSelector: noSwiping,
|
|
408
|
-
navigation: true,
|
|
409
|
-
thumbs: {
|
|
410
|
-
swiper: thumbsSwiper && !thumbsSwiper.destroyed ? thumbsSwiper : null
|
|
411
|
-
},
|
|
412
|
-
modules: [Navigation, Thumbs],
|
|
413
|
-
className: "gallery-main"
|
|
414
|
-
}, config.sliderProp), {}, {
|
|
415
|
-
children: medias.map(function (media, i) {
|
|
416
|
-
return /*#__PURE__*/jsx(SwiperSlide, {
|
|
417
|
-
id: 'gallery media index ' + i,
|
|
418
|
-
children: /*#__PURE__*/jsx(MediaItem, {
|
|
419
|
-
media: media,
|
|
420
|
-
config: config,
|
|
421
|
-
isCurrentlyVisible: i === (swiper === null || swiper === void 0 ? void 0 : swiper.activeIndex),
|
|
422
|
-
ref: htmlArElement
|
|
423
|
-
})
|
|
424
|
-
}, i);
|
|
425
|
-
})
|
|
426
|
-
})), /*#__PURE__*/jsx(Swiper, _objectSpread$5(_objectSpread$5({
|
|
427
|
-
onSwiper: setThumbsSwiper,
|
|
428
|
-
resizeObserver: false,
|
|
429
|
-
slidesPerView: medias.length < 5 ? medias.length : 6,
|
|
430
|
-
modules: [Navigation, Thumbs],
|
|
431
|
-
className: "gallery-thumb"
|
|
432
|
-
}, config.thumbSliderProp), {}, {
|
|
433
|
-
children: medias.map(function (media, i) {
|
|
434
|
-
return /*#__PURE__*/jsx(SwiperSlide, {
|
|
435
|
-
id: 'thumb media index ' + i,
|
|
436
|
-
children: /*#__PURE__*/jsx(Thumb, {
|
|
437
|
-
media: media,
|
|
438
|
-
medias: medias
|
|
439
|
-
}, i)
|
|
440
|
-
}, i + 't');
|
|
441
|
-
})
|
|
442
|
-
}))]
|
|
443
|
-
});
|
|
444
|
-
};
|
|
445
|
-
|
|
446
|
-
var Text = function Text(_ref) {
|
|
447
|
-
var _config$className;
|
|
448
|
-
var config = _ref.config;
|
|
449
|
-
return /*#__PURE__*/jsx("div", {
|
|
450
|
-
className: 'diva-pdp-text ' + ((_config$className = config.className) !== null && _config$className !== void 0 ? _config$className : ''),
|
|
451
|
-
dangerouslySetInnerHTML: {
|
|
452
|
-
__html: config.text.replaceAll('\n', '<br/>')
|
|
453
|
-
}
|
|
454
|
-
});
|
|
455
|
-
};
|
|
456
|
-
|
|
457
27
|
var Price = function Price(_ref) {
|
|
458
28
|
var _config$className;
|
|
459
29
|
var addedPrice = _ref.addedPrice,
|
|
@@ -505,42 +75,32 @@ var Info = function Info(_ref) {
|
|
|
505
75
|
throw new Error('Info type ' + config.type + ' not implemented!');
|
|
506
76
|
};
|
|
507
77
|
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
iconClass = _ref$config.iconClass,
|
|
512
|
-
textClass = _ref$config.textClass,
|
|
513
|
-
onClick = _ref$config.onClick,
|
|
514
|
-
onDoubleClick = _ref$config.onDoubleClick,
|
|
515
|
-
text = _ref$config.text,
|
|
516
|
-
className = _ref$config.className;
|
|
517
|
-
return /*#__PURE__*/jsxs("button", {
|
|
518
|
-
className: 'diva-pdp-action ' + (className !== null && className !== void 0 ? className : ''),
|
|
519
|
-
onDoubleClick: onDoubleClick ? onClick : undefined,
|
|
520
|
-
onClick: !onDoubleClick ? onClick : undefined,
|
|
521
|
-
children: [typeof text == 'string' && /*#__PURE__*/jsx("div", {
|
|
522
|
-
className: textClass,
|
|
523
|
-
children: text
|
|
524
|
-
}), icon !== undefined && /*#__PURE__*/jsx("img", {
|
|
525
|
-
src: icon
|
|
526
|
-
}), iconClass !== undefined && /*#__PURE__*/jsx("div", {
|
|
527
|
-
className: iconClass
|
|
528
|
-
})]
|
|
529
|
-
});
|
|
530
|
-
};
|
|
78
|
+
function styleInject(css, ref) {
|
|
79
|
+
if ( ref === void 0 ) ref = {};
|
|
80
|
+
var insertAt = ref.insertAt;
|
|
531
81
|
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
var
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
}
|
|
82
|
+
if (!css || typeof document === 'undefined') { return; }
|
|
83
|
+
|
|
84
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
|
85
|
+
var style = document.createElement('style');
|
|
86
|
+
style.type = 'text/css';
|
|
87
|
+
|
|
88
|
+
if (insertAt === 'top') {
|
|
89
|
+
if (head.firstChild) {
|
|
90
|
+
head.insertBefore(style, head.firstChild);
|
|
91
|
+
} else {
|
|
92
|
+
head.appendChild(style);
|
|
93
|
+
}
|
|
94
|
+
} else {
|
|
95
|
+
head.appendChild(style);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (style.styleSheet) {
|
|
99
|
+
style.styleSheet.cssText = css;
|
|
100
|
+
} else {
|
|
101
|
+
style.appendChild(document.createTextNode(css));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
544
104
|
|
|
545
105
|
var variants = "variants-HWTGr";
|
|
546
106
|
var css_248z = "/*navigation*/\n.variants-HWTGr.classification-group .swiper-button-prev,\n.variants-HWTGr.classification-group .swiper-button-next {\n position: absolute;\n top: 50%;\n top: var(--swiper-navigation-top-offset, 50%);\n width: calc(var(--swiper-navigation-size) / 44 * 27);\n height: var(--swiper-navigation-size);\n margin-top: calc(0px - (var(--swiper-navigation-size) / 2));\n z-index: 10;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--swiper-theme-color);\n color: var(--swiper-navigation-color, var(--swiper-theme-color));\n}\n.variants-HWTGr.classification-group .swiper-button-prev.swiper-button-disabled,\n.variants-HWTGr.classification-group .swiper-button-next.swiper-button-disabled {\n opacity: 0.35;\n cursor: auto;\n pointer-events: none;\n}\n.variants-HWTGr.classification-group .swiper-button-prev.swiper-button-hidden,\n.variants-HWTGr.classification-group .swiper-button-next.swiper-button-hidden {\n opacity: 0;\n cursor: auto;\n pointer-events: none;\n}\n.variants-HWTGr.classification-group .swiper-navigation-disabled .swiper-button-prev,\n.variants-HWTGr.classification-group .swiper-navigation-disabled .swiper-button-next {\n display: none !important;\n}\n.variants-HWTGr.classification-group .swiper-button-prev svg,\n.variants-HWTGr.classification-group .swiper-button-next svg {\n width: 100%;\n height: 100%;\n -o-object-fit: contain;\n object-fit: contain;\n transform-origin: center;\n}\n.variants-HWTGr.classification-group .swiper-rtl .swiper-button-prev svg,\n.variants-HWTGr.classification-group .swiper-rtl .swiper-button-next svg {\n transform: rotate(180deg);\n}\n.variants-HWTGr.classification-group .swiper-button-prev,\n.variants-HWTGr.classification-group .swiper-rtl .swiper-button-next {\n left: 10px;\n left: var(--swiper-navigation-sides-offset, 10px);\n right: auto;\n}\n.variants-HWTGr.classification-group .swiper-button-next,\n.variants-HWTGr.classification-group .swiper-rtl .swiper-button-prev {\n right: 10px;\n right: var(--swiper-navigation-sides-offset, 10px);\n left: auto;\n}\n.variants-HWTGr.classification-group .swiper-button-lock {\n display: none;\n}\n/* Navigation font start */\n.variants-HWTGr.classification-group .swiper-button-prev:after,\n.variants-HWTGr.classification-group .swiper-button-next:after {\n text-transform: none !important;\n}\n.variants-HWTGr.classification-group .swiper-button-prev:after,\n.variants-HWTGr.classification-group .swiper-button-next:after {\n font-family: swiper-icons;\n font-size: var(--swiper-navigation-size);\n letter-spacing: 0;\n font-feature-settings: ;\n font-variant: normal;\n font-variant: initial;\n line-height: 1;\n}\n.variants-HWTGr.classification-group .swiper-button-prev:after,\n.variants-HWTGr.classification-group .swiper-rtl .swiper-button-next:after {\n content: 'prev';\n}\n.variants-HWTGr.classification-group .swiper-button-next,\n.variants-HWTGr.classification-group .swiper-rtl .swiper-button-prev {\n right: 10px;\n right: var(--swiper-navigation-sides-offset, 10px);\n left: auto;\n}\n.variants-HWTGr.classification-group .swiper-button-next:after,\n.variants-HWTGr.classification-group .swiper-rtl .swiper-button-prev:after {\n content: 'next';\n}\n/* Navigation font end */\n\n/*swiper min css*/\n\n@font-face {\n font-family: swiper-icons;\n src: url('data:application/font-woff;charset=utf-8;base64, d09GRgABAAAAAAZgABAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAAGRAAAABoAAAAci6qHkUdERUYAAAWgAAAAIwAAACQAYABXR1BPUwAABhQAAAAuAAAANuAY7+xHU1VCAAAFxAAAAFAAAABm2fPczU9TLzIAAAHcAAAASgAAAGBP9V5RY21hcAAAAkQAAACIAAABYt6F0cBjdnQgAAACzAAAAAQAAAAEABEBRGdhc3AAAAWYAAAACAAAAAj//wADZ2x5ZgAAAywAAADMAAAD2MHtryVoZWFkAAABbAAAADAAAAA2E2+eoWhoZWEAAAGcAAAAHwAAACQC9gDzaG10eAAAAigAAAAZAAAArgJkABFsb2NhAAAC0AAAAFoAAABaFQAUGG1heHAAAAG8AAAAHwAAACAAcABAbmFtZQAAA/gAAAE5AAACXvFdBwlwb3N0AAAFNAAAAGIAAACE5s74hXjaY2BkYGAAYpf5Hu/j+W2+MnAzMYDAzaX6QjD6/4//Bxj5GA8AuRwMYGkAPywL13jaY2BkYGA88P8Agx4j+/8fQDYfA1AEBWgDAIB2BOoAeNpjYGRgYNBh4GdgYgABEMnIABJzYNADCQAACWgAsQB42mNgYfzCOIGBlYGB0YcxjYGBwR1Kf2WQZGhhYGBiYGVmgAFGBiQQkOaawtDAoMBQxXjg/wEGPcYDDA4wNUA2CCgwsAAAO4EL6gAAeNpj2M0gyAACqxgGNWBkZ2D4/wMA+xkDdgAAAHjaY2BgYGaAYBkGRgYQiAHyGMF8FgYHIM3DwMHABGQrMOgyWDLEM1T9/w8UBfEMgLzE////P/5//f/V/xv+r4eaAAeMbAxwIUYmIMHEgKYAYjUcsDAwsLKxc3BycfPw8jEQA/gZBASFhEVExcQlJKWkZWTl5BUUlZRVVNXUNTQZBgMAAMR+E+gAEQFEAAAAKgAqACoANAA+AEgAUgBcAGYAcAB6AIQAjgCYAKIArAC2AMAAygDUAN4A6ADyAPwBBgEQARoBJAEuATgBQgFMAVYBYAFqAXQBfgGIAZIBnAGmAbIBzgHsAAB42u2NMQ6CUAyGW568x9AneYYgm4MJbhKFaExIOAVX8ApewSt4Bic4AfeAid3VOBixDxfPYEza5O+Xfi04YADggiUIULCuEJK8VhO4bSvpdnktHI5QCYtdi2sl8ZnXaHlqUrNKzdKcT8cjlq+rwZSvIVczNiezsfnP/uznmfPFBNODM2K7MTQ45YEAZqGP81AmGGcF3iPqOop0r1SPTaTbVkfUe4HXj97wYE+yNwWYxwWu4v1ugWHgo3S1XdZEVqWM7ET0cfnLGxWfkgR42o2PvWrDMBSFj/IHLaF0zKjRgdiVMwScNRAoWUoH78Y2icB/yIY09An6AH2Bdu/UB+yxopYshQiEvnvu0dURgDt8QeC8PDw7Fpji3fEA4z/PEJ6YOB5hKh4dj3EvXhxPqH/SKUY3rJ7srZ4FZnh1PMAtPhwP6fl2PMJMPDgeQ4rY8YT6Gzao0eAEA409DuggmTnFnOcSCiEiLMgxCiTI6Cq5DZUd3Qmp10vO0LaLTd2cjN4fOumlc7lUYbSQcZFkutRG7g6JKZKy0RmdLY680CDnEJ+UMkpFFe1RN7nxdVpXrC4aTtnaurOnYercZg2YVmLN/d/gczfEimrE/fs/bOuq29Zmn8tloORaXgZgGa78yO9/cnXm2BpaGvq25Dv9S4E9+5SIc9PqupJKhYFSSl47+Qcr1mYNAAAAeNptw0cKwkAAAMDZJA8Q7OUJvkLsPfZ6zFVERPy8qHh2YER+3i/BP83vIBLLySsoKimrqKqpa2hp6+jq6RsYGhmbmJqZSy0sraxtbO3sHRydnEMU4uR6yx7JJXveP7WrDycAAAAAAAH//wACeNpjYGRgYOABYhkgZgJCZgZNBkYGLQZtIJsFLMYAAAw3ALgAeNolizEKgDAQBCchRbC2sFER0YD6qVQiBCv/H9ezGI6Z5XBAw8CBK/m5iQQVauVbXLnOrMZv2oLdKFa8Pjuru2hJzGabmOSLzNMzvutpB3N42mNgZGBg4GKQYzBhYMxJLMlj4GBgAYow/P/PAJJhLM6sSoWKfWCAAwDAjgbRAAB42mNgYGBkAIIbCZo5IPrmUn0hGA0AO8EFTQAA');\n font-weight: 400;\n font-style: normal;\n}\n\n.variants-HWTGr.classification-group .swiper {\n position: relative;\n overflow: hidden;\n list-style: none;\n padding: 0;\n z-index: 1;\n}\n.variants-HWTGr.classification-group .swiper-vertical.swiper {\n width: 100%;\n}\n\n.variants-HWTGr.classification-group .swiper-vertical > .swiper-wrapper {\n flex-direction: column;\n}\n.variants-HWTGr.classification-group .swiper-wrapper {\n position: relative;\n width: 100%;\n height: 100%;\n z-index: 1;\n display: flex;\n transition-property: transform;\n box-sizing: content-box;\n}\n.variants-HWTGr.classification-group .swiper-android .swiper-slide,\n.variants-HWTGr.classification-group .swiper-wrapper {\n transform: translate3d(0px, 0, 0);\n}\n.variants-HWTGr.classification-group .swiper-pointer-events {\n touch-action: pan-y;\n}\n.variants-HWTGr.classification-group .swiper-pointer-events.swiper-vertical {\n touch-action: pan-x;\n}\n.variants-HWTGr.classification-group .swiper-slide {\n flex-shrink: 0;\n height: 100%;\n position: relative;\n transition-property: transform;\n}\n\n.variants-HWTGr.classification-group .swiper-vertical .swiper-slide {\n height: auto;\n}\n\n.variants-HWTGr.classification-group .swiper-slide-invisible-blank {\n visibility: hidden;\n}\n.variants-HWTGr.classification-group .swiper-autoheight,\n.variants-HWTGr.classification-group .swiper-autoheight .swiper-slide {\n height: auto;\n}\n.variants-HWTGr.classification-group .swiper-autoheight .swiper-wrapper {\n align-items: flex-start;\n transition-property: transform, height;\n}\n.variants-HWTGr.classification-group .swiper-backface-hidden .swiper-slide {\n transform: translateZ(0);\n backface-visibility: hidden;\n}\n.variants-HWTGr.classification-group .swiper-horizontal.swiper-css-mode > .swiper-wrapper {\n scroll-snap-type: x mandatory;\n}\n.variants-HWTGr.classification-group .swiper-vertical.swiper-css-mode > .swiper-wrapper {\n scroll-snap-type: y mandatory;\n}\n.variants-HWTGr.classification-group .swiper-centered > .swiper-wrapper::before {\n content: '';\n flex-shrink: 0;\n order: 9999;\n}\n[dir=\"ltr\"] .variants-HWTGr.classification-group .swiper-centered.swiper-horizontal > .swiper-wrapper > .swiper-slide:first-child {\n margin-left: var(--swiper-centered-offset-before);\n}\n[dir=\"rtl\"] .variants-HWTGr.classification-group .swiper-centered.swiper-horizontal > .swiper-wrapper > .swiper-slide:first-child {\n margin-right: var(--swiper-centered-offset-before);\n}\n.variants-HWTGr.classification-group .swiper-centered.swiper-horizontal > .swiper-wrapper::before {\n height: 100%;\n min-height: 1px;\n width: var(--swiper-centered-offset-after);\n}\n.variants-HWTGr.classification-group .swiper-centered.swiper-vertical > .swiper-wrapper > .swiper-slide:first-child {\n margin-top: var(--swiper-centered-offset-before);\n}\n.variants-HWTGr.classification-group .swiper-centered.swiper-vertical > .swiper-wrapper::before {\n width: 100%;\n min-width: 1px;\n height: var(--swiper-centered-offset-after);\n}\n.variants-HWTGr.classification-group .swiper-centered > .swiper-wrapper > .swiper-slide {\n scroll-snap-align: center center;\n}\n";
|
|
@@ -585,90 +145,8 @@ var compareCodexes = function compareCodexes(codex1, codex2) {
|
|
|
585
145
|
return false;
|
|
586
146
|
};
|
|
587
147
|
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
*
|
|
591
|
-
* @param content the content to parse
|
|
592
|
-
* @param product the product data to use
|
|
593
|
-
* @param language the language to use
|
|
594
|
-
*/
|
|
595
|
-
function replaceTemplateStrings (content, product, language) {
|
|
596
|
-
if (typeof content == 'string') return content;
|
|
597
|
-
var flatProduct = flatten(product);
|
|
598
|
-
return recursiveReplaceTemplates(content, flatProduct, language);
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
/**
|
|
602
|
-
* Replaces the template string in all fields of the content object with the actual product data
|
|
603
|
-
*
|
|
604
|
-
* @param content the content to parse
|
|
605
|
-
* @param product the flattend version of the product data
|
|
606
|
-
*/
|
|
607
|
-
function recursiveReplaceTemplates(content, product, language) {
|
|
608
|
-
for (var _i = 0, _Object$entries = Object.entries(content); _i < _Object$entries.length; _i++) {
|
|
609
|
-
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
610
|
-
key = _Object$entries$_i[0],
|
|
611
|
-
value = _Object$entries$_i[1];
|
|
612
|
-
if (typeof content[key] === 'string' && key != 'link') {
|
|
613
|
-
content[key] = replaceTemplateString(value, product, language);
|
|
614
|
-
} else if (_typeof(content[key]) === 'object') {
|
|
615
|
-
//check if the object is a language dictionary, if so replace it with the value for the current language
|
|
616
|
-
var keys = Object.keys(content[key]);
|
|
617
|
-
if (keys.includes(language) || keys.includes('de')) {
|
|
618
|
-
var _content$key$language;
|
|
619
|
-
content[key] = replaceTemplateString((_content$key$language = content[key][language]) !== null && _content$key$language !== void 0 ? _content$key$language : content[key].de, product, language);
|
|
620
|
-
} else {
|
|
621
|
-
content[key] = recursiveReplaceTemplates(content[key], product, language);
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
return content;
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
/**
|
|
629
|
-
* replaces the templates in on string with the actual product data
|
|
630
|
-
*
|
|
631
|
-
* @param template the templatestring to parse
|
|
632
|
-
* @param product the flattend version of the product data
|
|
633
|
-
* @param locale the locale to use, if any
|
|
634
|
-
*/
|
|
635
|
-
function replaceTemplateString(template, product, locale) {
|
|
636
|
-
var matches = checkForTemplateStrings(template);
|
|
637
|
-
for (var _i2 = 0, _matches = matches; _i2 < _matches.length; _i2++) {
|
|
638
|
-
var _product$locale, _product, _product2;
|
|
639
|
-
var match = _matches[_i2];
|
|
640
|
-
//if a locale is provided, check if there is a locale version of the field (fallback is 'de'), if not use the default
|
|
641
|
-
var productField = match.replace('product.', '');
|
|
642
|
-
var value = void 0;
|
|
643
|
-
if (locale) value = (_product$locale = (_product = product[productField + '_locales']) === null || _product === void 0 ? void 0 : _product[locale]) !== null && _product$locale !== void 0 ? _product$locale : (_product2 = product[productField + '_locales']) === null || _product2 === void 0 ? void 0 : _product2.de;
|
|
644
|
-
if (!value) value = product[productField];
|
|
645
|
-
if (value != undefined) template = template.replace('${' + match + '}', value);
|
|
646
|
-
}
|
|
647
|
-
return template;
|
|
648
|
-
}
|
|
649
|
-
|
|
650
|
-
/**
|
|
651
|
-
* Extracts all substrings that are inside ${...}
|
|
652
|
-
*
|
|
653
|
-
* @param input the template to parse
|
|
654
|
-
* @returns a list of values extracted form the template
|
|
655
|
-
*/
|
|
656
|
-
function checkForTemplateStrings(input) {
|
|
657
|
-
// Regular expression to match ${...}
|
|
658
|
-
var regex = /\$\{([^}]+)\}/g;
|
|
659
|
-
var matches = [];
|
|
660
|
-
var match;
|
|
661
|
-
|
|
662
|
-
// Find all matches
|
|
663
|
-
while ((match = regex.exec(input)) !== null) {
|
|
664
|
-
// Extract the content inside ${...}
|
|
665
|
-
matches.push(match[1]);
|
|
666
|
-
}
|
|
667
|
-
return matches;
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
function ownKeys$4(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; }
|
|
671
|
-
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$4(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
148
|
+
function ownKeys$3(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; }
|
|
149
|
+
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
672
150
|
var Group = function Group(_ref) {
|
|
673
151
|
var _config$classificatio, _config$classificatio2, _group$, _classificationConfig;
|
|
674
152
|
var onChange = _ref.onChange,
|
|
@@ -706,7 +184,11 @@ var Group = function Group(_ref) {
|
|
|
706
184
|
var variant = getVariantFromCodex(product, products, groups, groupKey, item.codex);
|
|
707
185
|
var link = (_classificationConfig3 = classificationConfig === null || classificationConfig === void 0 || (_classificationConfig4 = classificationConfig.action) === null || _classificationConfig4 === void 0 ? void 0 : _classificationConfig4.link) !== null && _classificationConfig3 !== void 0 ? _classificationConfig3 : (_config$defaultVarian = config.defaultVariantAction) === null || _config$defaultVarian === void 0 ? void 0 : _config$defaultVarian.link;
|
|
708
186
|
if (link) {
|
|
709
|
-
|
|
187
|
+
var _replaceTemplatesInOb = replaceTemplatesInObject({
|
|
188
|
+
link: link
|
|
189
|
+
}, variant, i18n.language),
|
|
190
|
+
newLink = _replaceTemplatesInOb.link;
|
|
191
|
+
link = newLink;
|
|
710
192
|
}
|
|
711
193
|
if (uiType == 'IMAGE_AND_TEXT' && image) {
|
|
712
194
|
return /*#__PURE__*/jsxs("div", {
|
|
@@ -783,12 +265,12 @@ var Group = function Group(_ref) {
|
|
|
783
265
|
children: [typeof classificationText == 'string' && /*#__PURE__*/jsx("div", {
|
|
784
266
|
className: "classification-group-title",
|
|
785
267
|
children: classificationText
|
|
786
|
-
}), /*#__PURE__*/jsx(Swiper, _objectSpread$
|
|
268
|
+
}), /*#__PURE__*/jsx(Swiper, _objectSpread$3(_objectSpread$3({
|
|
787
269
|
onSwiper: setSwiperRef,
|
|
788
270
|
className: "classification-variants-slider",
|
|
789
271
|
resizeObserver: false,
|
|
790
272
|
modules: [Navigation]
|
|
791
|
-
}, _objectSpread$
|
|
273
|
+
}, _objectSpread$3(_objectSpread$3({}, config.sliderProp), classificationConfig !== null && classificationConfig !== void 0 && classificationConfig.sliderProp ? classificationConfig === null || classificationConfig === void 0 ? void 0 : classificationConfig.sliderProp : {})), {}, {
|
|
792
274
|
children: elements.map(function (e, index) {
|
|
793
275
|
return /*#__PURE__*/jsx(SwiperSlide, {
|
|
794
276
|
style: {
|
|
@@ -801,7 +283,7 @@ var Group = function Group(_ref) {
|
|
|
801
283
|
children: e
|
|
802
284
|
}, index);
|
|
803
285
|
})
|
|
804
|
-
})), moreIconVisible && /*#__PURE__*/jsx(
|
|
286
|
+
})), moreIconVisible && /*#__PURE__*/jsx(Action, {
|
|
805
287
|
config: config.moreIcon
|
|
806
288
|
})]
|
|
807
289
|
});
|
|
@@ -1002,17 +484,6 @@ var Variants = function Variants(_ref) {
|
|
|
1002
484
|
});
|
|
1003
485
|
};
|
|
1004
486
|
|
|
1005
|
-
var ActionIcon = function ActionIcon(_ref) {
|
|
1006
|
-
var _config$className;
|
|
1007
|
-
var config = _ref.config;
|
|
1008
|
-
return /*#__PURE__*/jsx("div", {
|
|
1009
|
-
className: 'diva-pdp-action-icon ' + ((_config$className = config.className) !== null && _config$className !== void 0 ? _config$className : ''),
|
|
1010
|
-
children: config.action && /*#__PURE__*/jsx(PdpAction, {
|
|
1011
|
-
config: config.action
|
|
1012
|
-
})
|
|
1013
|
-
});
|
|
1014
|
-
};
|
|
1015
|
-
|
|
1016
487
|
var Tabs = function Tabs(_ref) {
|
|
1017
488
|
var _ref$config = _ref.config,
|
|
1018
489
|
tabs = _ref$config.tabs,
|
|
@@ -1066,7 +537,7 @@ var _UiElemet = function UiElemet(_ref) {
|
|
|
1066
537
|
case 'GALLERY':
|
|
1067
538
|
return /*#__PURE__*/jsx(Gallery, {
|
|
1068
539
|
config: content,
|
|
1069
|
-
|
|
540
|
+
products: [product]
|
|
1070
541
|
});
|
|
1071
542
|
case 'TEXT':
|
|
1072
543
|
return /*#__PURE__*/jsx(Text, {
|
|
@@ -1083,7 +554,7 @@ var _UiElemet = function UiElemet(_ref) {
|
|
|
1083
554
|
config: content
|
|
1084
555
|
});
|
|
1085
556
|
case 'ACTIONS':
|
|
1086
|
-
return /*#__PURE__*/jsx(
|
|
557
|
+
return /*#__PURE__*/jsx(ActionGroup, {
|
|
1087
558
|
config: content
|
|
1088
559
|
});
|
|
1089
560
|
case 'VARIANTS':
|
|
@@ -1093,10 +564,6 @@ var _UiElemet = function UiElemet(_ref) {
|
|
|
1093
564
|
onChange: selectProduct,
|
|
1094
565
|
product: product
|
|
1095
566
|
});
|
|
1096
|
-
case 'ACTIONICON':
|
|
1097
|
-
return /*#__PURE__*/jsx(ActionIcon, {
|
|
1098
|
-
config: content
|
|
1099
|
-
});
|
|
1100
567
|
case 'TABS':
|
|
1101
568
|
return /*#__PURE__*/jsx(Tabs, {
|
|
1102
569
|
config: content,
|
|
@@ -1120,8 +587,8 @@ var _UiElemet = function UiElemet(_ref) {
|
|
|
1120
587
|
}
|
|
1121
588
|
};
|
|
1122
589
|
|
|
1123
|
-
function ownKeys$
|
|
1124
|
-
function _objectSpread$
|
|
590
|
+
function ownKeys$2(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; }
|
|
591
|
+
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1125
592
|
|
|
1126
593
|
/**
|
|
1127
594
|
* Filters the content based on the current settings
|
|
@@ -1134,7 +601,7 @@ function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t
|
|
|
1134
601
|
*/
|
|
1135
602
|
function filterContent (content, isMobile, isPortrait, product, language) {
|
|
1136
603
|
if (typeof content == 'string') return content;
|
|
1137
|
-
var flatProduct = flatten
|
|
604
|
+
var flatProduct = flatten(product);
|
|
1138
605
|
return filterContent$1(content, isMobile, isPortrait, flatProduct, language);
|
|
1139
606
|
}
|
|
1140
607
|
|
|
@@ -1159,7 +626,7 @@ function filterContent$1(content, isMobile, isPortrait, product, language) {
|
|
|
1159
626
|
if (innerContent) filteredContainer.push(innerContent);
|
|
1160
627
|
}
|
|
1161
628
|
if (filteredContainer.length === 0) return null;
|
|
1162
|
-
return _objectSpread$
|
|
629
|
+
return _objectSpread$2(_objectSpread$2({}, content), {}, _defineProperty({}, key, filteredContainer));
|
|
1163
630
|
}
|
|
1164
631
|
if (isVisible(content, isMobile, isPortrait, product, language)) {
|
|
1165
632
|
return content;
|
|
@@ -1181,7 +648,7 @@ function isVisible(content, isMobile, isPortrait, product, language) {
|
|
|
1181
648
|
if (typeof content == 'string') {
|
|
1182
649
|
return true;
|
|
1183
650
|
}
|
|
1184
|
-
var rule =
|
|
651
|
+
var rule = replaceTemplatesInObject((_content$rule = content.rule) !== null && _content$rule !== void 0 ? _content$rule : {}, product, language);
|
|
1185
652
|
var visibleForDevices = content.onlyFor || ((_content$rule2 = content.rule) === null || _content$rule2 === void 0 ? void 0 : _content$rule2.visibleForDevices);
|
|
1186
653
|
if (visibleForDevices !== null && visibleForDevices !== void 0 && visibleForDevices.includes('DESKTOP') && isMobile) return false;
|
|
1187
654
|
if (visibleForDevices !== null && visibleForDevices !== void 0 && visibleForDevices.includes('LANDSCAPE') && (!isMobile || !isPortrait)) return false;
|
|
@@ -1200,8 +667,8 @@ function isVisible(content, isMobile, isPortrait, product, language) {
|
|
|
1200
667
|
return true;
|
|
1201
668
|
}
|
|
1202
669
|
|
|
1203
|
-
function ownKeys$
|
|
1204
|
-
function _objectSpread$
|
|
670
|
+
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; }
|
|
671
|
+
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; }
|
|
1205
672
|
/**
|
|
1206
673
|
* Replaces the references in the content with the actual content
|
|
1207
674
|
* @param content the current content to parse
|
|
@@ -1224,27 +691,9 @@ function resolveReferences(content, fullContent) {
|
|
|
1224
691
|
var element = resolveReferences(container[i], fullContent);
|
|
1225
692
|
parsedContainer.push(element);
|
|
1226
693
|
}
|
|
1227
|
-
return _objectSpread$
|
|
694
|
+
return _objectSpread$1(_objectSpread$1({}, content), {}, {
|
|
1228
695
|
containers: parsedContainer
|
|
1229
696
|
});
|
|
1230
|
-
} else if ('actions' in content) {
|
|
1231
|
-
var _content$actions;
|
|
1232
|
-
//resolve references in actions arrays, i.e. ActionGroupConfig
|
|
1233
|
-
var actions = (_content$actions = content.actions) !== null && _content$actions !== void 0 ? _content$actions : [];
|
|
1234
|
-
for (var _i = 0; _i < actions.length; _i++) {
|
|
1235
|
-
var openMenu = actions[_i].openMenu;
|
|
1236
|
-
if (openMenu) {
|
|
1237
|
-
openMenu.content = resolveReferences(openMenu.content, fullContent);
|
|
1238
|
-
}
|
|
1239
|
-
}
|
|
1240
|
-
return content;
|
|
1241
|
-
} else if ('action' in content) {
|
|
1242
|
-
var _content$action;
|
|
1243
|
-
//resolve references in single action, i.e. ActionIconConfig, VariantsConfig
|
|
1244
|
-
if ((_content$action = content.action) !== null && _content$action !== void 0 && _content$action.openMenu) {
|
|
1245
|
-
content.action.openMenu.content = resolveReferences(content.action.openMenu.content, fullContent);
|
|
1246
|
-
}
|
|
1247
|
-
return content;
|
|
1248
697
|
} else {
|
|
1249
698
|
return content;
|
|
1250
699
|
}
|
|
@@ -1272,132 +721,6 @@ function getContentById(id, content) {
|
|
|
1272
721
|
return null;
|
|
1273
722
|
}
|
|
1274
723
|
|
|
1275
|
-
/**
|
|
1276
|
-
* Make sure that the CSS is in the dome and that it has the current content
|
|
1277
|
-
*
|
|
1278
|
-
* @param url an url to a css file
|
|
1279
|
-
* @param css the css content as text
|
|
1280
|
-
*/
|
|
1281
|
-
function updateCssInDom (url, css) {
|
|
1282
|
-
if (url) {
|
|
1283
|
-
var element = document.getElementById('DIVA-PDP-STYLE-URL');
|
|
1284
|
-
if (element) {
|
|
1285
|
-
var _element$parentNode;
|
|
1286
|
-
(_element$parentNode = element.parentNode) === null || _element$parentNode === void 0 || _element$parentNode.removeChild(element);
|
|
1287
|
-
}
|
|
1288
|
-
element = document.createElement('link');
|
|
1289
|
-
element.rel = 'stylesheet';
|
|
1290
|
-
element.type = 'text/css';
|
|
1291
|
-
element.id = 'DIVA-PDP-STYLE-URL';
|
|
1292
|
-
element.href = url;
|
|
1293
|
-
document.head.appendChild(element);
|
|
1294
|
-
}
|
|
1295
|
-
if (css) {
|
|
1296
|
-
var finalCss = Array.isArray(css) ? css.join(' ') : css;
|
|
1297
|
-
var _element = document.getElementById('DIVA-PDP-STYLE');
|
|
1298
|
-
if (_element) {
|
|
1299
|
-
var _element$parentNode2;
|
|
1300
|
-
(_element$parentNode2 = _element.parentNode) === null || _element$parentNode2 === void 0 || _element$parentNode2.removeChild(_element);
|
|
1301
|
-
}
|
|
1302
|
-
_element = document.createElement('style');
|
|
1303
|
-
_element.type = 'text/css';
|
|
1304
|
-
_element.id = 'DIVA-PDP-STYLE';
|
|
1305
|
-
_element.appendChild(document.createTextNode(finalCss));
|
|
1306
|
-
document.head.appendChild(_element);
|
|
1307
|
-
}
|
|
1308
|
-
}
|
|
1309
|
-
|
|
1310
|
-
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; }
|
|
1311
|
-
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; }
|
|
1312
|
-
|
|
1313
|
-
/**
|
|
1314
|
-
* Replace the configurated actions with an onClick function
|
|
1315
|
-
*
|
|
1316
|
-
* Needs to be called after the references are resolved, but before the templates are replaced.
|
|
1317
|
-
* The onClick function accepts a product id, which can differ from the current product, so the translation has to be done in the function
|
|
1318
|
-
*
|
|
1319
|
-
* @param content the content to replace the actions in
|
|
1320
|
-
* @param productVariants the current product variants, needed for the side menu renderer
|
|
1321
|
-
* @param product the current product, needed for the side menu renderer and the is also passed with the event
|
|
1322
|
-
* @param language the language to use, needed to translated the action
|
|
1323
|
-
* @param selectProduct the function to select a product, needed for the side menu renderer
|
|
1324
|
-
* @param openComponentFunction the function to open a component, called when an action with openComponent config is clicked
|
|
1325
|
-
* @param onEventFunction the function to handle an event, called when an action with onEvent config is clicked, the current product is passed with the event
|
|
1326
|
-
* @param openSideMenuFunction the function to open a side menu, called when an action with openMenu config is clicked, a side menu is opened with the rendered content
|
|
1327
|
-
*/
|
|
1328
|
-
function replaceActions (content, productVariants, product, language, selectProduct, openComponentFunction, onEventFunction, openSideMenuFunction) {
|
|
1329
|
-
if (typeof content == 'string') return content;
|
|
1330
|
-
return recursiveReplaceActions(content, productVariants, product, language, selectProduct, openComponentFunction, onEventFunction, openSideMenuFunction);
|
|
1331
|
-
}
|
|
1332
|
-
|
|
1333
|
-
/**
|
|
1334
|
-
* Recursively replace the actions in the content with an onClick function
|
|
1335
|
-
*
|
|
1336
|
-
* @param content the content to replace the actions in
|
|
1337
|
-
* @param productVariants the current product variants
|
|
1338
|
-
* @param product the current product
|
|
1339
|
-
* @param language the language to use
|
|
1340
|
-
* @param selectProduct the function to select a product
|
|
1341
|
-
* @param openComponentFunction the function to open a component
|
|
1342
|
-
* @param onEventFunction the function to handle an event
|
|
1343
|
-
* @param openSideMenuFunction the function to open a side menu
|
|
1344
|
-
*/
|
|
1345
|
-
function recursiveReplaceActions(content, productVariants, product, language, selectProduct, openComponentFunction, onEventFunction, openSideMenuFunction) {
|
|
1346
|
-
var keys = Object.keys(content);
|
|
1347
|
-
var openComponent = undefined;
|
|
1348
|
-
var onEvent = undefined;
|
|
1349
|
-
var openMenu = undefined;
|
|
1350
|
-
for (var _i = 0, _keys = keys; _i < _keys.length; _i++) {
|
|
1351
|
-
var key = _keys[_i];
|
|
1352
|
-
if (key === 'openComponent') {
|
|
1353
|
-
openComponent = content[key];
|
|
1354
|
-
delete content[key];
|
|
1355
|
-
} else if (key === 'onEvent') {
|
|
1356
|
-
onEvent = content[key];
|
|
1357
|
-
delete content[key];
|
|
1358
|
-
} else if (key === 'openMenu') {
|
|
1359
|
-
openMenu = content[key];
|
|
1360
|
-
delete content[key];
|
|
1361
|
-
} else if (_typeof(content[key]) === 'object') {
|
|
1362
|
-
content[key] = recursiveReplaceActions(content[key], productVariants, product, language, selectProduct, openComponentFunction, onEventFunction, openSideMenuFunction);
|
|
1363
|
-
}
|
|
1364
|
-
}
|
|
1365
|
-
if (openComponent || onEvent || openMenu) {
|
|
1366
|
-
content['onClick'] = function (e, productId) {
|
|
1367
|
-
var _productVariants$find;
|
|
1368
|
-
var currentProduct = (_productVariants$find = productVariants.find(function (variant) {
|
|
1369
|
-
return variant._id === productId;
|
|
1370
|
-
})) !== null && _productVariants$find !== void 0 ? _productVariants$find : product;
|
|
1371
|
-
var flatProduct = flatten$1(currentProduct);
|
|
1372
|
-
if (openComponent) {
|
|
1373
|
-
var translatedOpenComponent = recursiveReplaceTemplates(openComponent, flatProduct, language);
|
|
1374
|
-
openComponentFunction(translatedOpenComponent);
|
|
1375
|
-
}
|
|
1376
|
-
if (onEvent) {
|
|
1377
|
-
onEventFunction({
|
|
1378
|
-
type: onEvent,
|
|
1379
|
-
data: currentProduct
|
|
1380
|
-
});
|
|
1381
|
-
}
|
|
1382
|
-
if (openMenu) {
|
|
1383
|
-
var translatedOpenMenu = recursiveReplaceTemplates(openMenu, flatProduct, language);
|
|
1384
|
-
openSideMenuFunction(_objectSpread$1(_objectSpread$1({}, translatedOpenMenu), {}, {
|
|
1385
|
-
content: /*#__PURE__*/React.createElement(_UiElemet, {
|
|
1386
|
-
content: translatedOpenMenu.content,
|
|
1387
|
-
product: currentProduct,
|
|
1388
|
-
productVariants: productVariants,
|
|
1389
|
-
selectProduct: selectProduct
|
|
1390
|
-
})
|
|
1391
|
-
}));
|
|
1392
|
-
}
|
|
1393
|
-
};
|
|
1394
|
-
}
|
|
1395
|
-
return content;
|
|
1396
|
-
}
|
|
1397
|
-
|
|
1398
|
-
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
1399
|
-
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; } }
|
|
1400
|
-
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; }
|
|
1401
724
|
var LOG = getLogger('ProductDetailPage', 'ProductDetailPage');
|
|
1402
725
|
function useDetailPage(_ref) {
|
|
1403
726
|
var settings = _ref.settings,
|
|
@@ -1409,131 +732,46 @@ function useDetailPage(_ref) {
|
|
|
1409
732
|
isPortrait = _useDivaCore$state$di.isPortrait,
|
|
1410
733
|
_useDivaCore$actions = _useDivaCore.actions,
|
|
1411
734
|
onEvent = _useDivaCore$actions.onEvent,
|
|
1412
|
-
openComponent = _useDivaCore$actions.openComponent
|
|
1413
|
-
|
|
1414
|
-
subscribeEvents = _useDivaCore$actions.subscribeEvents,
|
|
735
|
+
openComponent = _useDivaCore$actions.openComponent;
|
|
736
|
+
_useDivaCore$actions.openSideMenu;
|
|
737
|
+
var subscribeEvents = _useDivaCore$actions.subscribeEvents,
|
|
1415
738
|
unSubscribeEvents = _useDivaCore$actions.unSubscribeEvents,
|
|
1416
|
-
closeComponentInFullscreen = _useDivaCore$actions.closeComponentInFullscreen
|
|
1417
|
-
handler = _useDivaCore.handler;
|
|
739
|
+
closeComponentInFullscreen = _useDivaCore$actions.closeComponentInFullscreen;
|
|
1418
740
|
var _useTranslation = useTranslation(),
|
|
1419
741
|
i18n = _useTranslation.i18n;
|
|
1420
|
-
var _useState = useState(
|
|
742
|
+
var _useState = useState(false),
|
|
1421
743
|
_useState2 = _slicedToArray(_useState, 2),
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
var _useState3 = useState(
|
|
744
|
+
parsingError = _useState2[0],
|
|
745
|
+
setError = _useState2[1];
|
|
746
|
+
var _useState3 = useState(undefined),
|
|
1425
747
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
var _useState5 = useState(
|
|
748
|
+
currentProduct = _useState4[0],
|
|
749
|
+
setCurrentProduct = _useState4[1];
|
|
750
|
+
var _useState5 = useState(null),
|
|
1429
751
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
1434
|
-
productVariants = _useState8[0],
|
|
1435
|
-
setProductVariants = _useState8[1];
|
|
1436
|
-
var _useState9 = useState(null),
|
|
1437
|
-
_useState10 = _slicedToArray(_useState9, 2),
|
|
1438
|
-
parsedContent = _useState10[0],
|
|
1439
|
-
setParsedContent = _useState10[1];
|
|
752
|
+
parsedContent = _useState6[0],
|
|
753
|
+
setParsedContent = _useState6[1];
|
|
754
|
+
useCss(settings);
|
|
1440
755
|
useEffect(function () {
|
|
1441
756
|
DivaUtils$1.businessMetrics.setConfiguratorSessionId();
|
|
1442
757
|
}, []);
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
}, [
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
_context.prev = 2;
|
|
1457
|
-
if (!productData) {
|
|
1458
|
-
_context.next = 8;
|
|
1459
|
-
break;
|
|
1460
|
-
}
|
|
1461
|
-
setProductVariants(productData);
|
|
1462
|
-
newVariants = productData;
|
|
1463
|
-
_context.next = 13;
|
|
1464
|
-
break;
|
|
1465
|
-
case 8:
|
|
1466
|
-
_context.next = 10;
|
|
1467
|
-
return handler.productHandler.apiGetProductVariants(productId, true);
|
|
1468
|
-
case 10:
|
|
1469
|
-
products = _context.sent;
|
|
1470
|
-
setProductVariants(products);
|
|
1471
|
-
newVariants = products;
|
|
1472
|
-
case 13:
|
|
1473
|
-
_iterator = _createForOfIteratorHelper(newVariants);
|
|
1474
|
-
_context.prev = 14;
|
|
1475
|
-
_iterator.s();
|
|
1476
|
-
case 16:
|
|
1477
|
-
if ((_step = _iterator.n()).done) {
|
|
1478
|
-
_context.next = 23;
|
|
1479
|
-
break;
|
|
1480
|
-
}
|
|
1481
|
-
product = _step.value;
|
|
1482
|
-
if (!(product._id == productId)) {
|
|
1483
|
-
_context.next = 21;
|
|
1484
|
-
break;
|
|
1485
|
-
}
|
|
1486
|
-
LOG.businessEvent('onLoadProductPDP', 'ProductDetailPage', 'Neues Product in PDP geladen.', {
|
|
1487
|
-
productId: productId,
|
|
1488
|
-
catalogName: product.modelName,
|
|
1489
|
-
catalogCodex: product.catCodex
|
|
1490
|
-
});
|
|
1491
|
-
return _context.abrupt("break", 23);
|
|
1492
|
-
case 21:
|
|
1493
|
-
_context.next = 16;
|
|
1494
|
-
break;
|
|
1495
|
-
case 23:
|
|
1496
|
-
_context.next = 28;
|
|
1497
|
-
break;
|
|
1498
|
-
case 25:
|
|
1499
|
-
_context.prev = 25;
|
|
1500
|
-
_context.t0 = _context["catch"](14);
|
|
1501
|
-
_iterator.e(_context.t0);
|
|
1502
|
-
case 28:
|
|
1503
|
-
_context.prev = 28;
|
|
1504
|
-
_iterator.f();
|
|
1505
|
-
return _context.finish(28);
|
|
1506
|
-
case 31:
|
|
1507
|
-
selectProduct(productId, newVariants);
|
|
1508
|
-
_context.next = 38;
|
|
1509
|
-
break;
|
|
1510
|
-
case 34:
|
|
1511
|
-
_context.prev = 34;
|
|
1512
|
-
_context.t1 = _context["catch"](2);
|
|
1513
|
-
//TODO: show the diva error page?
|
|
1514
|
-
LOG.error(new DivaError('Error loading products', {
|
|
1515
|
-
cause: _context.t1
|
|
1516
|
-
}));
|
|
1517
|
-
setError(true);
|
|
1518
|
-
case 38:
|
|
1519
|
-
_context.prev = 38;
|
|
1520
|
-
setLoading(false);
|
|
1521
|
-
return _context.finish(38);
|
|
1522
|
-
case 41:
|
|
1523
|
-
case "end":
|
|
1524
|
-
return _context.stop();
|
|
1525
|
-
}
|
|
1526
|
-
}, _callee, null, [[2, 34, 38, 41], [14, 25, 28, 31]]);
|
|
1527
|
-
}));
|
|
1528
|
-
return function (_x) {
|
|
1529
|
-
return _ref2.apply(this, arguments);
|
|
1530
|
-
};
|
|
1531
|
-
})()(productId);
|
|
1532
|
-
}, [productData, productId]);
|
|
758
|
+
var productIds = useMemo(function () {
|
|
759
|
+
return productId ? [productId] : undefined;
|
|
760
|
+
}, [productId]);
|
|
761
|
+
var _useProductData = useProductData({
|
|
762
|
+
productIds: productIds,
|
|
763
|
+
variants: productData,
|
|
764
|
+
onProductLoaded: function onProductLoaded(variants) {
|
|
765
|
+
selectProduct(productId, variants);
|
|
766
|
+
}
|
|
767
|
+
}),
|
|
768
|
+
productVariants = _useProductData.productVariants,
|
|
769
|
+
loadingError = _useProductData.error,
|
|
770
|
+
loading = _useProductData.loading;
|
|
1533
771
|
useEffect(function () {
|
|
1534
772
|
if (!currentProduct) return;
|
|
1535
773
|
try {
|
|
1536
|
-
var _parsedContent = parseContent(isMobile, isPortrait, productVariants, currentProduct, i18n.language,
|
|
774
|
+
var _parsedContent = parseContent(isMobile, isPortrait, productVariants, currentProduct, i18n.language, openComponent, onEvent, settings.content);
|
|
1537
775
|
if (!_parsedContent) {
|
|
1538
776
|
LOG.warn('No content to render, check the configuration');
|
|
1539
777
|
}
|
|
@@ -1550,10 +788,9 @@ function useDetailPage(_ref) {
|
|
|
1550
788
|
return p._id === productId;
|
|
1551
789
|
});
|
|
1552
790
|
if (!currentProduct) {
|
|
1553
|
-
LOG.error(new DivaError('Product not found'
|
|
1554
|
-
cause: error
|
|
1555
|
-
}));
|
|
791
|
+
LOG.error(new DivaError('Product not found'));
|
|
1556
792
|
setError(true);
|
|
793
|
+
return;
|
|
1557
794
|
}
|
|
1558
795
|
setCurrentProduct(currentProduct);
|
|
1559
796
|
}, [productVariants]);
|
|
@@ -1593,7 +830,7 @@ function useDetailPage(_ref) {
|
|
|
1593
830
|
};
|
|
1594
831
|
return {
|
|
1595
832
|
loading: loading,
|
|
1596
|
-
error:
|
|
833
|
+
error: parsingError || loadingError,
|
|
1597
834
|
content: parsedContent,
|
|
1598
835
|
productVariants: productVariants,
|
|
1599
836
|
product: currentProduct,
|
|
@@ -1612,15 +849,15 @@ function useDetailPage(_ref) {
|
|
|
1612
849
|
* @param product the product data to use
|
|
1613
850
|
* @param language the language to use
|
|
1614
851
|
*/
|
|
1615
|
-
function parseContent(isMobile, isPortrait, productVariants, product, language,
|
|
852
|
+
function parseContent(isMobile, isPortrait, productVariants, product, language, openComponentFunction, onEventFunction, content) {
|
|
1616
853
|
var finalContent = null;
|
|
1617
854
|
if (content) {
|
|
1618
855
|
var clonedContent = cloneDeep(content);
|
|
1619
856
|
var pureContent = resolveReferences(clonedContent, content);
|
|
1620
857
|
var filteredContent = filterContent(pureContent, isMobile, isPortrait, product, language);
|
|
1621
858
|
if (!filteredContent) return null;
|
|
1622
|
-
var withActionsContent = replaceActions(filteredContent, productVariants, product, language,
|
|
1623
|
-
finalContent =
|
|
859
|
+
var withActionsContent = replaceActions(filteredContent, productVariants, product, language, openComponentFunction, onEventFunction);
|
|
860
|
+
finalContent = replaceTemplatesInObject(withActionsContent, product, language);
|
|
1624
861
|
}
|
|
1625
862
|
return finalContent;
|
|
1626
863
|
}
|