@trafilea/afrodita-components 6.39.9 → 6.39.10

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
@@ -19433,7 +19433,7 @@ var templateObject_1$E, templateObject_2$v;
19433
19433
 
19434
19434
  var SizeSelector = function (_a) {
19435
19435
  var _b;
19436
- var label = _a.label, sizes = _a.sizes, selectedValue = _a.selectedValue, onChange = _a.onChange, onClickSizeTip = _a.onClickSizeTip, _c = _a.inline, inline = _c === void 0 ? false : _c, width = _a.width, _d = _a.hasSizeGuide, hasSizeGuide = _d === void 0 ? false : _d, sizeTipReferences = _a.sizeTipReferences;
19436
+ var label = _a.label, sizes = _a.sizes, selectedValue = _a.selectedValue, onChange = _a.onChange, onClickSizeTip = _a.onClickSizeTip, _c = _a.inline, inline = _c === void 0 ? false : _c, width = _a.width, _d = _a.hasSizeGuide, hasSizeGuide = _d === void 0 ? false : _d, sizeTipReferences = _a.sizeTipReferences, _e = _a.showExtendedSize, showExtendedSize = _e === void 0 ? false : _e;
19437
19437
  var activeSizeTip = hasSizeGuide
19438
19438
  ? sizeTipReferences === null || sizeTipReferences === void 0 ? void 0 : sizeTipReferences.find(function (sizeTip) { return (sizeTip === null || sizeTip === void 0 ? void 0 : sizeTip.size) === (selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.label); })
19439
19439
  : null;
@@ -19441,7 +19441,7 @@ var SizeSelector = function (_a) {
19441
19441
  display: 'flex',
19442
19442
  flexDirection: inline ? 'row' : 'column',
19443
19443
  alignItems: inline ? 'center' : 'start',
19444
- } }, { children: [jsxs(Text$7, __assign$1({ variant: "body", weight: "regular", size: "small", css: { alignSelf: inline ? 'start' : 'inherit', padding: inline ? '0.75rem 0' : '0' } }, { children: [label, !inline && (jsx(Text$7, __assign$1({ variant: "label", weight: "demi", size: "regular" }, { children: selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.description }), void 0))] }), void 0), hasSizeGuide && (jsxs(Row, __assign$1({ "data-testid": "sizing-tip" }, { children: [jsx(Icon.Actions.CircleInfo, { width: 1.2 }, void 0), jsx(Text$7, __assign$1({ variant: "body", weight: "demi", size: "small", css: { display: 'flex' } }, { children: "Sizing Tip:" }), void 0), jsx(Text$7, __assign$1({ variant: "body", weight: "regular", size: "small" }, { children: activeSizeTip === null || activeSizeTip === void 0 ? void 0 : activeSizeTip.tip }), void 0), onClickSizeTip && (jsx(SizeFitGuide, { hideIcon: true, onClick: onClickSizeTip, title: (_b = activeSizeTip === null || activeSizeTip === void 0 ? void 0 : activeSizeTip.cta) !== null && _b !== void 0 ? _b : 'Size and Fit Guide' }, void 0))] }), void 0)), jsx(ButtonsContainer, __assign$1({ inline: inline }, { children: sizes === null || sizes === void 0 ? void 0 : sizes.map(function (size) {
19444
+ } }, { children: [jsxs(Text$7, __assign$1({ variant: "body", weight: "regular", size: "small", css: { alignSelf: inline ? 'start' : 'inherit', padding: inline ? '0.75rem 0' : '0' } }, { children: [label, !inline && !showExtendedSize && (jsx(Text$7, __assign$1({ variant: "label", weight: "demi", size: "regular" }, { children: selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.description }), void 0))] }), void 0), hasSizeGuide && (jsxs(Row, __assign$1({ "data-testid": "sizing-tip" }, { children: [jsx(Icon.Actions.CircleInfo, { width: 1.2 }, void 0), jsx(Text$7, __assign$1({ variant: "body", weight: "demi", size: "small", css: { display: 'flex' } }, { children: "Sizing Tip:" }), void 0), jsx(Text$7, __assign$1({ variant: "body", weight: "regular", size: "small" }, { children: activeSizeTip === null || activeSizeTip === void 0 ? void 0 : activeSizeTip.tip }), void 0), onClickSizeTip && (jsx(SizeFitGuide, { hideIcon: true, onClick: onClickSizeTip, title: (_b = activeSizeTip === null || activeSizeTip === void 0 ? void 0 : activeSizeTip.cta) !== null && _b !== void 0 ? _b : 'Size and Fit Guide' }, void 0))] }), void 0)), jsx(ButtonsContainer, __assign$1({ inline: inline }, { children: sizes === null || sizes === void 0 ? void 0 : sizes.map(function (size) {
19445
19445
  var active = !size.disabled && size.label === selectedValue.label;
19446
19446
  return (jsx(SelectorSecondary, { css: {
19447
19447
  padding: '0.75rem 1rem 0.625rem',
@@ -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();