@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.d.ts CHANGED
@@ -3374,8 +3374,9 @@ interface SizeSelectorProps {
3374
3374
  width?: string;
3375
3375
  hasSizeGuide?: boolean;
3376
3376
  sizeTipReferences?: SizeTip[];
3377
+ showExtendedSize?: boolean;
3377
3378
  }
3378
- declare const SizeSelector: ({ label, sizes, selectedValue, onChange, onClickSizeTip, inline, width, hasSizeGuide, sizeTipReferences, }: SizeSelectorProps) => _emotion_react_jsx_runtime.JSX.Element;
3379
+ declare const SizeSelector: ({ label, sizes, selectedValue, onChange, onClickSizeTip, inline, width, hasSizeGuide, sizeTipReferences, showExtendedSize, }: SizeSelectorProps) => _emotion_react_jsx_runtime.JSX.Element;
3379
3380
 
3380
3381
  interface SliderNavigationProps {
3381
3382
  children: JSX.Element | JSX.Element[] | StyledComponent<any>;
@@ -19407,7 +19407,7 @@ var templateObject_1$E, templateObject_2$v;
19407
19407
 
19408
19408
  var SizeSelector = function (_a) {
19409
19409
  var _b;
19410
- 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;
19410
+ 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;
19411
19411
  var activeSizeTip = hasSizeGuide
19412
19412
  ? 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); })
19413
19413
  : null;
@@ -19415,7 +19415,7 @@ var SizeSelector = function (_a) {
19415
19415
  display: 'flex',
19416
19416
  flexDirection: inline ? 'row' : 'column',
19417
19417
  alignItems: inline ? 'center' : 'start',
19418
- } }, { 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) {
19418
+ } }, { 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) {
19419
19419
  var active = !size.disabled && size.label === selectedValue.label;
19420
19420
  return (jsx(SelectorSecondary, { css: {
19421
19421
  padding: '0.75rem 1rem 0.625rem',
@@ -20518,6 +20518,26 @@ function usePreventVerticalScroll(ref, dragThreshold) {
20518
20518
  }, [preventTouch, ref, touchStart]);
20519
20519
  }
20520
20520
 
20521
+ var sendCommandToIframe = function (command, elementId) {
20522
+ if (elementId === void 0) { elementId = 'vwo-video'; }
20523
+ var iframe = document.getElementById(elementId);
20524
+ var origin = new URL(iframe === null || iframe === void 0 ? void 0 : iframe.src).origin;
20525
+ // TODO: Add verification to only allow specific origins
20526
+ // const allowedOrigins = ['https://youtube.com'];
20527
+ // if (!allowedOrigins.includes(origin)) return;
20528
+ (iframe === null || iframe === void 0 ? void 0 : iframe.contentWindow) &&
20529
+ iframe.contentWindow.postMessage(JSON.stringify({
20530
+ event: 'command',
20531
+ func: command,
20532
+ }), origin);
20533
+ };
20534
+ var stopVideoCommand = function () {
20535
+ sendCommandToIframe('stopVideo');
20536
+ };
20537
+ var playVideoCommand = function () {
20538
+ sendCommandToIframe('playVideo');
20539
+ };
20540
+
20521
20541
  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) {
20522
20542
  var borderRadiusVariant = _a.borderRadiusVariant;
20523
20543
  return borderRadiusVariant &&
@@ -20526,7 +20546,6 @@ var Container$g = newStyled.div(templateObject_1$i || (templateObject_1$i = __ma
20526
20546
  var theme = _a.theme;
20527
20547
  return theme.component.slideNavigation.slideDots.selectedDotColor;
20528
20548
  });
20529
- // max-height: 31.875rem;
20530
20549
  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'); });
20531
20550
  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"])));
20532
20551
  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"])));
@@ -20556,28 +20575,29 @@ var ImageProductSlide = function (_a) {
20556
20575
  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;
20557
20576
  var slick = useRef(null);
20558
20577
  var sliderWrapper = useRef(null);
20559
- useRef(null);
20560
20578
  var _d = useState(false); _d[0]; var setIsPlaying = _d[1];
20561
20579
  usePreventVerticalScroll(sliderWrapper);
20562
20580
  var onButtonClick = useCallback(function (i) {
20563
20581
  var _a;
20564
20582
  (_a = slick.current) === null || _a === void 0 ? void 0 : _a.slickGoTo(i);
20565
20583
  }, [slick]);
20566
- var _sendCommandToIframe = function (command) {
20567
- var iframe = document.getElementById('vwo-video');
20568
- (iframe === null || iframe === void 0 ? void 0 : iframe.contentWindow) &&
20569
- iframe.contentWindow.postMessage(JSON.stringify({
20570
- event: 'command',
20571
- func: command,
20572
- }), '*');
20573
- };
20574
- var _stopVideo = function () {
20575
- _sendCommandToIframe('stopVideo');
20576
- setIsPlaying(false);
20584
+ var stopVideo = function () {
20585
+ stopVideoCommand();
20586
+ setIsPlaying(function (prevIsPlaying) {
20587
+ if (prevIsPlaying) {
20588
+ return !prevIsPlaying;
20589
+ }
20590
+ return prevIsPlaying;
20591
+ });
20577
20592
  };
20578
- var _playVideo = function () {
20579
- _sendCommandToIframe('playVideo');
20580
- setIsPlaying(true);
20593
+ var playVideo = function () {
20594
+ playVideoCommand();
20595
+ setIsPlaying(function (prevIsPlaying) {
20596
+ if (!prevIsPlaying) {
20597
+ return prevIsPlaying;
20598
+ }
20599
+ return !prevIsPlaying;
20600
+ });
20581
20601
  };
20582
20602
  useEffect(function () {
20583
20603
  var _a;
@@ -20593,7 +20613,7 @@ var ImageProductSlide = function (_a) {
20593
20613
  var activeSlide = contents[e];
20594
20614
  // If autoplay is true and iframe is the active slide, play the video
20595
20615
  var autoplay = (_a = activeSlide === null || activeSlide === void 0 ? void 0 : activeSlide.url) === null || _a === void 0 ? void 0 : _a.includes('autoplay=1');
20596
- autoplay ? _playVideo() : _stopVideo();
20616
+ autoplay ? playVideo() : stopVideo();
20597
20617
  onChange === null || onChange === void 0 ? void 0 : onChange(e);
20598
20618
  } }, settings$3, { nextArrow: jsx$1(NavButtonContainer$3, { children: jsx$1(Button$4, { children: jsx$1(Icon.Arrows.ChevronRight, { height: 2.125, width: 1.25, fill: "#292929" }, void 0) }, void 0) }, void 0), prevArrow: jsx$1(NavButtonContainer$3, { children: jsx$1(Button$4, { children: jsx$1(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) {
20599
20619
  var _a;
@@ -20966,7 +20986,6 @@ var Container$b = newStyled.div(templateObject_1$b || (templateObject_1$b = __ma
20966
20986
  var theme = _a.theme;
20967
20987
  return theme.component.slideNavigation.slideDots.selectedDotColor;
20968
20988
  });
20969
- // max-height: 31.875rem;
20970
20989
  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'); });
20971
20990
  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"])));
20972
20991
  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"])));
@@ -20994,21 +21013,23 @@ var ImageProductSlideV3 = function (_a) {
20994
21013
  var _a;
20995
21014
  (_a = slick.current) === null || _a === void 0 ? void 0 : _a.slickGoTo(i);
20996
21015
  }, [slick]);
20997
- var _sendCommandToIframe = function (command) {
20998
- var iframe = document.getElementById('vwo-video');
20999
- (iframe === null || iframe === void 0 ? void 0 : iframe.contentWindow) &&
21000
- iframe.contentWindow.postMessage(JSON.stringify({
21001
- event: 'command',
21002
- func: command,
21003
- }), '*');
21004
- };
21005
- var _stopVideo = function () {
21006
- _sendCommandToIframe('stopVideo');
21007
- setIsPlaying(false);
21016
+ var stopVideo = function () {
21017
+ stopVideoCommand();
21018
+ setIsPlaying(function (prevIsPlaying) {
21019
+ if (prevIsPlaying) {
21020
+ return !prevIsPlaying;
21021
+ }
21022
+ return prevIsPlaying;
21023
+ });
21008
21024
  };
21009
- var _playVideo = function () {
21010
- _sendCommandToIframe('playVideo');
21011
- setIsPlaying(true);
21025
+ var playVideo = function () {
21026
+ playVideoCommand();
21027
+ setIsPlaying(function (prevIsPlaying) {
21028
+ if (!prevIsPlaying) {
21029
+ return prevIsPlaying;
21030
+ }
21031
+ return !prevIsPlaying;
21032
+ });
21012
21033
  };
21013
21034
  useEffect(function () {
21014
21035
  var _a;
@@ -21024,11 +21045,11 @@ var ImageProductSlideV3 = function (_a) {
21024
21045
  var activeSlide = images[e];
21025
21046
  // If autoplay is true and iframe is the active slide, play the video
21026
21047
  var autoplay = (_a = activeSlide === null || activeSlide === void 0 ? void 0 : activeSlide.url) === null || _a === void 0 ? void 0 : _a.includes('autoplay=1');
21027
- autoplay ? _playVideo() : _stopVideo();
21048
+ autoplay ? playVideo() : stopVideo();
21028
21049
  } }, settings$2, { nextArrow: jsx$1(NavButtonContainer$2, { children: jsx$1(Button$2, { children: jsx$1(Icon.Arrows.ChevronRight, { height: 2.125, width: 1.25, fill: "#292929" }, void 0) }, void 0) }, void 0), prevArrow: jsx$1(NavButtonContainer$2, { children: jsx$1(Button$2, { children: jsx$1(Icon.Arrows.ChevronLeft, { height: 2.125, width: 1.25, fill: "#292929" }, void 0) }, void 0) }, void 0), ref: slick }, { children: images.map(function (image) {
21029
21050
  var _a, _b;
21030
21051
  return (jsxs$1("div", { children: [!((_a = image === null || image === void 0 ? void 0 : image.alt) === null || _a === void 0 ? void 0 : _a.includes('-video')) && (jsxs$1(Fragment$2, { children: [jsx$1(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), jsx$1(TopTagContainer$2, __assign$1({ borderRadiusVariant: borderRadiusVariant, "data-testid": "topTag" }, { children: topTag }), void 0), jsx$1(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')) && (jsxs$1(Video, { children: [jsx$1("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), jsx$1(VideoOverlay, { onClick: function () {
21031
- isPlaying ? _stopVideo() : _playVideo();
21052
+ isPlaying ? stopVideo() : playVideo();
21032
21053
  } }, void 0), jsxs$1(VideoTag, { children: [jsx$1(Icon.PDP.PlayMini, { width: 1.5 }, void 0), jsx$1(Text, { children: "VIDEO" }, void 0)] }, void 0)] }, void 0))] }, image.key));
21033
21054
  }) }), void 0) }), void 0)] }, void 0));
21034
21055
  };
@@ -21041,21 +21062,6 @@ var ProductGalleryMobileV3 = function (_a) {
21041
21062
  };
21042
21063
  var templateObject_1$a;
21043
21064
 
21044
- var _sendCommandToIframe = function (command) {
21045
- var iframe = document.getElementById('vwo-video');
21046
- (iframe === null || iframe === void 0 ? void 0 : iframe.contentWindow) &&
21047
- iframe.contentWindow.postMessage(JSON.stringify({
21048
- event: 'command',
21049
- func: command,
21050
- }), '*' + '');
21051
- };
21052
- var _stopVideo = function () {
21053
- _sendCommandToIframe('stopVideo');
21054
- };
21055
- var _playVideo = function () {
21056
- _sendCommandToIframe('playVideo');
21057
- };
21058
-
21059
21065
  function closeZoom() {
21060
21066
  var closeButton = document.querySelectorAll('.iiz__btn.iiz__close.iiz__close--visible')[0];
21061
21067
  if (closeButton) {
@@ -21069,7 +21075,7 @@ var afterChangeSlide = function (_a) {
21069
21075
  var activeSlide = contents[slide];
21070
21076
  // If autoplay is true and iframe is the active slide, play the video
21071
21077
  var autoplay = (_b = activeSlide === null || activeSlide === void 0 ? void 0 : activeSlide.url) === null || _b === void 0 ? void 0 : _b.includes('autoplay=1');
21072
- autoplay ? _playVideo() : _stopVideo();
21078
+ autoplay ? playVideoCommand() : stopVideoCommand();
21073
21079
  setSelectedImageIndex(Math.round(slide));
21074
21080
  onChange === null || onChange === void 0 ? void 0 : onChange(slide);
21075
21081
  closeZoom();