@trafilea/afrodita-components 6.39.9 → 6.39.11

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/index.js CHANGED
@@ -4669,9 +4669,9 @@ var Stopwatch = function (props) { return jsxRuntime.jsx(Icon$1, __assign$1({},
4669
4669
 
4670
4670
  var TrustBadge = function (props) { return jsxRuntime.jsx(Icon$1, __assign$1({}, props, { name: "pdp/trust_badge" }), void 0); };
4671
4671
 
4672
- var TrustPilotHalfStart = function (props) { return (jsxRuntime.jsx(Icon$1, __assign$1({}, props, { name: "pdp/trustpilot_half_start" }), void 0)); };
4672
+ var TrustPilotHalfStar = function (props) { return (jsxRuntime.jsx(Icon$1, __assign$1({}, props, { name: "pdp/trustpilot_half_star" }), void 0)); };
4673
4673
 
4674
- var TrustPilotStart = function (props) { return (jsxRuntime.jsx(Icon$1, __assign$1({}, props, { name: "pdp/trustpilot_start" }), void 0)); };
4674
+ var TrustPilotStar = function (props) { return (jsxRuntime.jsx(Icon$1, __assign$1({}, props, { name: "pdp/trustpilot_star" }), void 0)); };
4675
4675
 
4676
4676
  var Verified = function (props) { return jsxRuntime.jsx(Icon$1, __assign$1({}, props, { name: "pdp/verified" }), void 0); };
4677
4677
 
@@ -4708,8 +4708,8 @@ var PDP = /*#__PURE__*/Object.freeze({
4708
4708
  Stars: Stars,
4709
4709
  Stopwatch: Stopwatch,
4710
4710
  TrustBadge: TrustBadge,
4711
- TrustPilotHalfStart: TrustPilotHalfStart,
4712
- TrustPilotStart: TrustPilotStart,
4711
+ TrustPilotHalfStar: TrustPilotHalfStar,
4712
+ TrustPilotStar: TrustPilotStar,
4713
4713
  Verified: Verified
4714
4714
  });
4715
4715
 
@@ -5087,9 +5087,9 @@ var StyledButton$3 = newStyled(Ye.Button)(AccordionSummaryStyles.baseStyles, fun
5087
5087
  var StyledPanel$1 = newStyled(Ye.Panel)(AccordionDetailsStyles.baseStyles, function (props) { return [AccordionDetailsStyles[props.variant](props.theme)]; });
5088
5088
  var StyledContent$1 = newStyled.button(templateObject_1$24 || (templateObject_1$24 = __makeTemplateObject(["\n appearance: none;\n padding: 0;\n margin: 0;\n border: none;\n background: none;\n font-size: inherit;\n line-height: inherit;\n color: inherit;\n cursor: auto;\n user-select: text;\n writing-mode: unset;\n font-family: inherit;\n"], ["\n appearance: none;\n padding: 0;\n margin: 0;\n border: none;\n background: none;\n font-size: inherit;\n line-height: inherit;\n color: inherit;\n cursor: auto;\n user-select: text;\n writing-mode: unset;\n font-family: inherit;\n"])));
5089
5089
  var Accordion$1 = function (_a) {
5090
- var header = _a.header, headerOnOpen = _a.headerOnOpen, content = _a.content, defaultOpen = _a.defaultOpen, _b = _a.forceOpenHandler, forceOpenHandler = _b === void 0 ? false : _b, _c = _a.forceOpenValue, forceOpenValue = _c === void 0 ? false : _c, titleColor = _a.titleColor, variant = _a.variant, _d = _a.disabled, disabled = _d === void 0 ? false : _d, _e = _a.innerHTML, innerHTML = _e === void 0 ? false : _e, _f = _a.backgroundCover, backgroundCover = _f === void 0 ? { value: false, iconBgColor: 'inherit' } : _f, _g = _a.controlIconPos, controlIconPos = _g === void 0 ? 'right' : _g, openIcon = _a.openIcon, closeIcon = _a.closeIcon, onClick = _a.onClick;
5090
+ var header = _a.header, headerOnOpen = _a.headerOnOpen, content = _a.content, defaultOpen = _a.defaultOpen, _b = _a.forceOpenHandler, forceOpenHandler = _b === void 0 ? false : _b, _c = _a.forceOpenValue, forceOpenValue = _c === void 0 ? false : _c, titleColor = _a.titleColor, variant = _a.variant, _d = _a.disabled, disabled = _d === void 0 ? false : _d, _e = _a.innerHTML, innerHTML = _e === void 0 ? false : _e, _f = _a.backgroundCover, backgroundCover = _f === void 0 ? { value: false, iconBgColor: 'inherit' } : _f, _g = _a.controlIconPos, controlIconPos = _g === void 0 ? 'right' : _g, openIcon = _a.openIcon, closeIcon = _a.closeIcon, onClick = _a.onClick, testId = _a.testId;
5091
5091
  var theme = useTheme();
5092
- return (jsxRuntime.jsx(StyledDisclosure$1, __assign$1({ theme: theme, as: "div", defaultOpen: defaultOpen, variant: variant, disabled: disabled, onClick: onClick, controlIconPos: controlIconPos }, { children: function (_a) {
5092
+ return (jsxRuntime.jsx(StyledDisclosure$1, __assign$1({ "data-testid": testId, theme: theme, as: "div", defaultOpen: defaultOpen, variant: variant, disabled: disabled, onClick: onClick, controlIconPos: controlIconPos }, { children: function (_a) {
5093
5093
  var open = _a.open;
5094
5094
  var openWithForce = forceOpenHandler ? forceOpenValue : open;
5095
5095
  var ControlIcon = disabled ? openIcon : openWithForce ? closeIcon : openIcon;
@@ -20544,6 +20544,26 @@ function usePreventVerticalScroll(ref, dragThreshold) {
20544
20544
  }, [preventTouch, ref, touchStart]);
20545
20545
  }
20546
20546
 
20547
+ var sendCommandToIframe = function (command, elementId) {
20548
+ if (elementId === void 0) { elementId = 'vwo-video'; }
20549
+ var iframe = document.getElementById(elementId);
20550
+ var origin = new URL(iframe === null || iframe === void 0 ? void 0 : iframe.src).origin;
20551
+ // TODO: Add verification to only allow specific origins
20552
+ // const allowedOrigins = ['https://youtube.com'];
20553
+ // if (!allowedOrigins.includes(origin)) return;
20554
+ (iframe === null || iframe === void 0 ? void 0 : iframe.contentWindow) &&
20555
+ iframe.contentWindow.postMessage(JSON.stringify({
20556
+ event: 'command',
20557
+ func: command,
20558
+ }), origin);
20559
+ };
20560
+ var stopVideoCommand = function () {
20561
+ sendCommandToIframe('stopVideo');
20562
+ };
20563
+ var playVideoCommand = function () {
20564
+ sendCommandToIframe('playVideo');
20565
+ };
20566
+
20547
20567
  var Container$g = newStyled.div(templateObject_1$i || (templateObject_1$i = __makeTemplateObject(["\n ", "\n position: relative;\n max-height: 524px;\n overflow: hidden;\n & .slick-dots li.slick-active button:before {\n background-color: ", ";\n }\n"], ["\n ", "\n position: relative;\n max-height: 524px;\n overflow: hidden;\n & .slick-dots li.slick-active button:before {\n background-color: ", ";\n }\n"])), function (_a) {
20548
20568
  var borderRadiusVariant = _a.borderRadiusVariant;
20549
20569
  return borderRadiusVariant &&
@@ -20552,7 +20572,6 @@ var Container$g = newStyled.div(templateObject_1$i || (templateObject_1$i = __ma
20552
20572
  var theme = _a.theme;
20553
20573
  return theme.component.slideNavigation.slideDots.selectedDotColor;
20554
20574
  });
20555
- // max-height: 31.875rem;
20556
20575
  var TopTagContainer$4 = newStyled.div(templateObject_2$c || (templateObject_2$c = __makeTemplateObject(["\n position: absolute;\n left: ", ";\n top: ", ";\n"], ["\n position: absolute;\n left: ", ";\n top: ", ";\n"])), function (props) { return (props.borderRadiusVariant ? '13px' : '0'); }, function (props) { return (props.borderRadiusVariant ? '11px' : '0'); });
20557
20576
  var TopRightTagContainer$1 = newStyled.div(templateObject_3$a || (templateObject_3$a = __makeTemplateObject(["\n position: absolute;\n right: 0;\n top: 0;\n"], ["\n position: absolute;\n right: 0;\n top: 0;\n"])));
20558
20577
  var BottomTagContainer$4 = newStyled.div(templateObject_4$7 || (templateObject_4$7 = __makeTemplateObject(["\n position: absolute;\n bottom: 3.75rem;\n left: 0;\n"], ["\n position: absolute;\n bottom: 3.75rem;\n left: 0;\n"])));
@@ -20582,28 +20601,29 @@ var ImageProductSlide = function (_a) {
20582
20601
  var contents = _a.contents, _b = _a.customClick, customClick = _b === void 0 ? false : _b, topTag = _a.topTag, topRightTag = _a.topRightTag, bottomTag = _a.bottomTag, testId = _a.testId, borderRadiusVariant = _a.borderRadiusVariant, selectedValue = _a.selectedValue, onChange = _a.onChange, _c = _a.itemsOnViewport, itemsOnViewport = _c === void 0 ? 0 : _c;
20583
20602
  var slick = React$2.useRef(null);
20584
20603
  var sliderWrapper = React$2.useRef(null);
20585
- React$2.useRef(null);
20586
20604
  var _d = React$2.useState(false); _d[0]; var setIsPlaying = _d[1];
20587
20605
  usePreventVerticalScroll(sliderWrapper);
20588
20606
  var onButtonClick = React$2.useCallback(function (i) {
20589
20607
  var _a;
20590
20608
  (_a = slick.current) === null || _a === void 0 ? void 0 : _a.slickGoTo(i);
20591
20609
  }, [slick]);
20592
- var _sendCommandToIframe = function (command) {
20593
- var iframe = document.getElementById('vwo-video');
20594
- (iframe === null || iframe === void 0 ? void 0 : iframe.contentWindow) &&
20595
- iframe.contentWindow.postMessage(JSON.stringify({
20596
- event: 'command',
20597
- func: command,
20598
- }), '*');
20599
- };
20600
- var _stopVideo = function () {
20601
- _sendCommandToIframe('stopVideo');
20602
- setIsPlaying(false);
20610
+ var stopVideo = function () {
20611
+ stopVideoCommand();
20612
+ setIsPlaying(function (prevIsPlaying) {
20613
+ if (prevIsPlaying) {
20614
+ return !prevIsPlaying;
20615
+ }
20616
+ return prevIsPlaying;
20617
+ });
20603
20618
  };
20604
- var _playVideo = function () {
20605
- _sendCommandToIframe('playVideo');
20606
- setIsPlaying(true);
20619
+ var playVideo = function () {
20620
+ playVideoCommand();
20621
+ setIsPlaying(function (prevIsPlaying) {
20622
+ if (!prevIsPlaying) {
20623
+ return prevIsPlaying;
20624
+ }
20625
+ return !prevIsPlaying;
20626
+ });
20607
20627
  };
20608
20628
  React$2.useEffect(function () {
20609
20629
  var _a;
@@ -20619,7 +20639,7 @@ var ImageProductSlide = function (_a) {
20619
20639
  var activeSlide = contents[e];
20620
20640
  // If autoplay is true and iframe is the active slide, play the video
20621
20641
  var autoplay = (_a = activeSlide === null || activeSlide === void 0 ? void 0 : activeSlide.url) === null || _a === void 0 ? void 0 : _a.includes('autoplay=1');
20622
- autoplay ? _playVideo() : _stopVideo();
20642
+ autoplay ? playVideo() : stopVideo();
20623
20643
  onChange === null || onChange === void 0 ? void 0 : onChange(e);
20624
20644
  } }, settings$3, { nextArrow: jsxRuntime.jsx(NavButtonContainer$3, { children: jsxRuntime.jsx(Button$4, { children: jsxRuntime.jsx(Icon.Arrows.ChevronRight, { height: 2.125, width: 1.25, fill: "#292929" }, void 0) }, void 0) }, void 0), prevArrow: jsxRuntime.jsx(NavButtonContainer$3, { children: jsxRuntime.jsx(Button$4, { children: jsxRuntime.jsx(Icon.Arrows.ChevronLeft, { height: 2.125, width: 1.25, fill: "#292929" }, void 0) }, void 0) }, void 0), ref: slick }, { children: contents.map(function (content, idx) {
20625
20645
  var _a;
@@ -20992,7 +21012,6 @@ var Container$b = newStyled.div(templateObject_1$b || (templateObject_1$b = __ma
20992
21012
  var theme = _a.theme;
20993
21013
  return theme.component.slideNavigation.slideDots.selectedDotColor;
20994
21014
  });
20995
- // max-height: 31.875rem;
20996
21015
  var TopTagContainer$2 = newStyled.div(templateObject_2$9 || (templateObject_2$9 = __makeTemplateObject(["\n position: absolute;\n left: ", ";\n top: ", ";\n"], ["\n position: absolute;\n left: ", ";\n top: ", ";\n"])), function (props) { return (props.borderRadiusVariant ? '13px' : '0'); }, function (props) { return (props.borderRadiusVariant ? '11px' : '0'); });
20997
21016
  var BottomTagContainer$2 = newStyled.div(templateObject_3$7 || (templateObject_3$7 = __makeTemplateObject(["\n position: absolute;\n bottom: 3.75rem;\n left: 0;\n"], ["\n position: absolute;\n bottom: 3.75rem;\n left: 0;\n"])));
20998
21017
  var VideoOverlay = newStyled.div(templateObject_4$6 || (templateObject_4$6 = __makeTemplateObject(["\n content: '';\n background: transparent;\n width: 100%;\n height: 100%;\n min-height: 1px;\n position: absolute;\n top: 0;\n"], ["\n content: '';\n background: transparent;\n width: 100%;\n height: 100%;\n min-height: 1px;\n position: absolute;\n top: 0;\n"])));
@@ -21020,21 +21039,23 @@ var ImageProductSlideV3 = function (_a) {
21020
21039
  var _a;
21021
21040
  (_a = slick.current) === null || _a === void 0 ? void 0 : _a.slickGoTo(i);
21022
21041
  }, [slick]);
21023
- var _sendCommandToIframe = function (command) {
21024
- var iframe = document.getElementById('vwo-video');
21025
- (iframe === null || iframe === void 0 ? void 0 : iframe.contentWindow) &&
21026
- iframe.contentWindow.postMessage(JSON.stringify({
21027
- event: 'command',
21028
- func: command,
21029
- }), '*');
21030
- };
21031
- var _stopVideo = function () {
21032
- _sendCommandToIframe('stopVideo');
21033
- setIsPlaying(false);
21042
+ var stopVideo = function () {
21043
+ stopVideoCommand();
21044
+ setIsPlaying(function (prevIsPlaying) {
21045
+ if (prevIsPlaying) {
21046
+ return !prevIsPlaying;
21047
+ }
21048
+ return prevIsPlaying;
21049
+ });
21034
21050
  };
21035
- var _playVideo = function () {
21036
- _sendCommandToIframe('playVideo');
21037
- setIsPlaying(true);
21051
+ var playVideo = function () {
21052
+ playVideoCommand();
21053
+ setIsPlaying(function (prevIsPlaying) {
21054
+ if (!prevIsPlaying) {
21055
+ return prevIsPlaying;
21056
+ }
21057
+ return !prevIsPlaying;
21058
+ });
21038
21059
  };
21039
21060
  React$2.useEffect(function () {
21040
21061
  var _a;
@@ -21050,11 +21071,11 @@ var ImageProductSlideV3 = function (_a) {
21050
21071
  var activeSlide = images[e];
21051
21072
  // If autoplay is true and iframe is the active slide, play the video
21052
21073
  var autoplay = (_a = activeSlide === null || activeSlide === void 0 ? void 0 : activeSlide.url) === null || _a === void 0 ? void 0 : _a.includes('autoplay=1');
21053
- autoplay ? _playVideo() : _stopVideo();
21074
+ autoplay ? playVideo() : stopVideo();
21054
21075
  } }, settings$2, { nextArrow: jsxRuntime.jsx(NavButtonContainer$2, { children: jsxRuntime.jsx(Button$2, { children: jsxRuntime.jsx(Icon.Arrows.ChevronRight, { height: 2.125, width: 1.25, fill: "#292929" }, void 0) }, void 0) }, void 0), prevArrow: jsxRuntime.jsx(NavButtonContainer$2, { children: jsxRuntime.jsx(Button$2, { children: jsxRuntime.jsx(Icon.Arrows.ChevronLeft, { height: 2.125, width: 1.25, fill: "#292929" }, void 0) }, void 0) }, void 0), ref: slick }, { children: images.map(function (image) {
21055
21076
  var _a, _b;
21056
21077
  return (jsxRuntime.jsxs("div", { children: [!((_a = image === null || image === void 0 ? void 0 : image.alt) === null || _a === void 0 ? void 0 : _a.includes('-video')) && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(InnerImageZoom, { src: image.url, zoomSrc: image.url, zoomType: "hover", imgAttributes: { alt: image.alt, width: '100%', height: '510px' }, height: 510, fullscreenOnMobile: true, className: "zoomWrapper" }, void 0), jsxRuntime.jsx(TopTagContainer$2, __assign$1({ borderRadiusVariant: borderRadiusVariant, "data-testid": "topTag" }, { children: topTag }), void 0), jsxRuntime.jsx(BottomTagContainer$2, __assign$1({ "data-testid": "bottomTag" }, { children: bottomTag }), void 0)] }, void 0)), ((_b = image === null || image === void 0 ? void 0 : image.alt) === null || _b === void 0 ? void 0 : _b.includes('-video')) && (jsxRuntime.jsxs(Video, { children: [jsxRuntime.jsx("iframe", { id: "vwo-video", ref: iframeRef, allowFullScreen: true, title: image.alt, width: "100%", height: "220px", src: image === null || image === void 0 ? void 0 : image.url, allow: "accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" }, void 0), jsxRuntime.jsx(VideoOverlay, { onClick: function () {
21057
- isPlaying ? _stopVideo() : _playVideo();
21078
+ isPlaying ? stopVideo() : playVideo();
21058
21079
  } }, void 0), jsxRuntime.jsxs(VideoTag, { children: [jsxRuntime.jsx(Icon.PDP.PlayMini, { width: 1.5 }, void 0), jsxRuntime.jsx(Text, { children: "VIDEO" }, void 0)] }, void 0)] }, void 0))] }, image.key));
21059
21080
  }) }), void 0) }), void 0)] }, void 0));
21060
21081
  };
@@ -21067,21 +21088,6 @@ var ProductGalleryMobileV3 = function (_a) {
21067
21088
  };
21068
21089
  var templateObject_1$a;
21069
21090
 
21070
- var _sendCommandToIframe = function (command) {
21071
- var iframe = document.getElementById('vwo-video');
21072
- (iframe === null || iframe === void 0 ? void 0 : iframe.contentWindow) &&
21073
- iframe.contentWindow.postMessage(JSON.stringify({
21074
- event: 'command',
21075
- func: command,
21076
- }), '*' + '');
21077
- };
21078
- var _stopVideo = function () {
21079
- _sendCommandToIframe('stopVideo');
21080
- };
21081
- var _playVideo = function () {
21082
- _sendCommandToIframe('playVideo');
21083
- };
21084
-
21085
21091
  function closeZoom() {
21086
21092
  var closeButton = document.querySelectorAll('.iiz__btn.iiz__close.iiz__close--visible')[0];
21087
21093
  if (closeButton) {
@@ -21095,7 +21101,7 @@ var afterChangeSlide = function (_a) {
21095
21101
  var activeSlide = contents[slide];
21096
21102
  // If autoplay is true and iframe is the active slide, play the video
21097
21103
  var autoplay = (_b = activeSlide === null || activeSlide === void 0 ? void 0 : activeSlide.url) === null || _b === void 0 ? void 0 : _b.includes('autoplay=1');
21098
- autoplay ? _playVideo() : _stopVideo();
21104
+ autoplay ? playVideoCommand() : stopVideoCommand();
21099
21105
  setSelectedImageIndex(Math.round(slide));
21100
21106
  onChange === null || onChange === void 0 ? void 0 : onChange(slide);
21101
21107
  closeZoom();