@trafilea/afrodita-components 6.39.8 → 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
@@ -4366,6 +4366,8 @@ var Messaging = /*#__PURE__*/Object.freeze({
4366
4366
 
4367
4367
  var BirthdayGifts = function (props) { return (jsxRuntime.jsx(Icon$1, __assign$1({}, props, { name: "myaccount/birthday_gifts" }), void 0)); };
4368
4368
 
4369
+ var Calendar = function (props) { return jsxRuntime.jsx(Icon$1, __assign$1({}, props, { name: "myaccount/calendar" }), void 0); };
4370
+
4369
4371
  var Cart = function (props) { return jsxRuntime.jsx(Icon$1, __assign$1({}, props, { name: "myaccount/cart" }), void 0); };
4370
4372
 
4371
4373
  var Community = function (props) { return jsxRuntime.jsx(Icon$1, __assign$1({}, props, { name: "myaccount/community" }), void 0); };
@@ -4399,6 +4401,7 @@ var VIP = function (props) { return jsxRuntime.jsx(Icon$1, __assign$1({}, props,
4399
4401
  var MyAccount = /*#__PURE__*/Object.freeze({
4400
4402
  __proto__: null,
4401
4403
  BirthdayGifts: BirthdayGifts,
4404
+ Calendar: Calendar,
4402
4405
  Cart: Cart,
4403
4406
  Community: Community,
4404
4407
  DealsOffers: DealsOffers,
@@ -19430,7 +19433,7 @@ var templateObject_1$E, templateObject_2$v;
19430
19433
 
19431
19434
  var SizeSelector = function (_a) {
19432
19435
  var _b;
19433
- 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;
19434
19437
  var activeSizeTip = hasSizeGuide
19435
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); })
19436
19439
  : null;
@@ -19438,7 +19441,7 @@ var SizeSelector = function (_a) {
19438
19441
  display: 'flex',
19439
19442
  flexDirection: inline ? 'row' : 'column',
19440
19443
  alignItems: inline ? 'center' : 'start',
19441
- } }, { 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) {
19442
19445
  var active = !size.disabled && size.label === selectedValue.label;
19443
19446
  return (jsx(SelectorSecondary, { css: {
19444
19447
  padding: '0.75rem 1rem 0.625rem',
@@ -20541,6 +20544,26 @@ function usePreventVerticalScroll(ref, dragThreshold) {
20541
20544
  }, [preventTouch, ref, touchStart]);
20542
20545
  }
20543
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
+
20544
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) {
20545
20568
  var borderRadiusVariant = _a.borderRadiusVariant;
20546
20569
  return borderRadiusVariant &&
@@ -20549,7 +20572,6 @@ var Container$g = newStyled.div(templateObject_1$i || (templateObject_1$i = __ma
20549
20572
  var theme = _a.theme;
20550
20573
  return theme.component.slideNavigation.slideDots.selectedDotColor;
20551
20574
  });
20552
- // max-height: 31.875rem;
20553
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'); });
20554
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"])));
20555
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"])));
@@ -20579,28 +20601,29 @@ var ImageProductSlide = function (_a) {
20579
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;
20580
20602
  var slick = React$2.useRef(null);
20581
20603
  var sliderWrapper = React$2.useRef(null);
20582
- React$2.useRef(null);
20583
20604
  var _d = React$2.useState(false); _d[0]; var setIsPlaying = _d[1];
20584
20605
  usePreventVerticalScroll(sliderWrapper);
20585
20606
  var onButtonClick = React$2.useCallback(function (i) {
20586
20607
  var _a;
20587
20608
  (_a = slick.current) === null || _a === void 0 ? void 0 : _a.slickGoTo(i);
20588
20609
  }, [slick]);
20589
- var _sendCommandToIframe = function (command) {
20590
- var iframe = document.getElementById('vwo-video');
20591
- (iframe === null || iframe === void 0 ? void 0 : iframe.contentWindow) &&
20592
- iframe.contentWindow.postMessage(JSON.stringify({
20593
- event: 'command',
20594
- func: command,
20595
- }), '*');
20596
- };
20597
- var _stopVideo = function () {
20598
- _sendCommandToIframe('stopVideo');
20599
- setIsPlaying(false);
20610
+ var stopVideo = function () {
20611
+ stopVideoCommand();
20612
+ setIsPlaying(function (prevIsPlaying) {
20613
+ if (prevIsPlaying) {
20614
+ return !prevIsPlaying;
20615
+ }
20616
+ return prevIsPlaying;
20617
+ });
20600
20618
  };
20601
- var _playVideo = function () {
20602
- _sendCommandToIframe('playVideo');
20603
- setIsPlaying(true);
20619
+ var playVideo = function () {
20620
+ playVideoCommand();
20621
+ setIsPlaying(function (prevIsPlaying) {
20622
+ if (!prevIsPlaying) {
20623
+ return prevIsPlaying;
20624
+ }
20625
+ return !prevIsPlaying;
20626
+ });
20604
20627
  };
20605
20628
  React$2.useEffect(function () {
20606
20629
  var _a;
@@ -20616,7 +20639,7 @@ var ImageProductSlide = function (_a) {
20616
20639
  var activeSlide = contents[e];
20617
20640
  // If autoplay is true and iframe is the active slide, play the video
20618
20641
  var autoplay = (_a = activeSlide === null || activeSlide === void 0 ? void 0 : activeSlide.url) === null || _a === void 0 ? void 0 : _a.includes('autoplay=1');
20619
- autoplay ? _playVideo() : _stopVideo();
20642
+ autoplay ? playVideo() : stopVideo();
20620
20643
  onChange === null || onChange === void 0 ? void 0 : onChange(e);
20621
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) {
20622
20645
  var _a;
@@ -20989,7 +21012,6 @@ var Container$b = newStyled.div(templateObject_1$b || (templateObject_1$b = __ma
20989
21012
  var theme = _a.theme;
20990
21013
  return theme.component.slideNavigation.slideDots.selectedDotColor;
20991
21014
  });
20992
- // max-height: 31.875rem;
20993
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'); });
20994
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"])));
20995
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"])));
@@ -21017,21 +21039,23 @@ var ImageProductSlideV3 = function (_a) {
21017
21039
  var _a;
21018
21040
  (_a = slick.current) === null || _a === void 0 ? void 0 : _a.slickGoTo(i);
21019
21041
  }, [slick]);
21020
- var _sendCommandToIframe = function (command) {
21021
- var iframe = document.getElementById('vwo-video');
21022
- (iframe === null || iframe === void 0 ? void 0 : iframe.contentWindow) &&
21023
- iframe.contentWindow.postMessage(JSON.stringify({
21024
- event: 'command',
21025
- func: command,
21026
- }), '*');
21027
- };
21028
- var _stopVideo = function () {
21029
- _sendCommandToIframe('stopVideo');
21030
- setIsPlaying(false);
21042
+ var stopVideo = function () {
21043
+ stopVideoCommand();
21044
+ setIsPlaying(function (prevIsPlaying) {
21045
+ if (prevIsPlaying) {
21046
+ return !prevIsPlaying;
21047
+ }
21048
+ return prevIsPlaying;
21049
+ });
21031
21050
  };
21032
- var _playVideo = function () {
21033
- _sendCommandToIframe('playVideo');
21034
- setIsPlaying(true);
21051
+ var playVideo = function () {
21052
+ playVideoCommand();
21053
+ setIsPlaying(function (prevIsPlaying) {
21054
+ if (!prevIsPlaying) {
21055
+ return prevIsPlaying;
21056
+ }
21057
+ return !prevIsPlaying;
21058
+ });
21035
21059
  };
21036
21060
  React$2.useEffect(function () {
21037
21061
  var _a;
@@ -21047,11 +21071,11 @@ var ImageProductSlideV3 = function (_a) {
21047
21071
  var activeSlide = images[e];
21048
21072
  // If autoplay is true and iframe is the active slide, play the video
21049
21073
  var autoplay = (_a = activeSlide === null || activeSlide === void 0 ? void 0 : activeSlide.url) === null || _a === void 0 ? void 0 : _a.includes('autoplay=1');
21050
- autoplay ? _playVideo() : _stopVideo();
21074
+ autoplay ? playVideo() : stopVideo();
21051
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) {
21052
21076
  var _a, _b;
21053
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 () {
21054
- isPlaying ? _stopVideo() : _playVideo();
21078
+ isPlaying ? stopVideo() : playVideo();
21055
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));
21056
21080
  }) }), void 0) }), void 0)] }, void 0));
21057
21081
  };
@@ -21064,21 +21088,6 @@ var ProductGalleryMobileV3 = function (_a) {
21064
21088
  };
21065
21089
  var templateObject_1$a;
21066
21090
 
21067
- var _sendCommandToIframe = function (command) {
21068
- var iframe = document.getElementById('vwo-video');
21069
- (iframe === null || iframe === void 0 ? void 0 : iframe.contentWindow) &&
21070
- iframe.contentWindow.postMessage(JSON.stringify({
21071
- event: 'command',
21072
- func: command,
21073
- }), '*' + '');
21074
- };
21075
- var _stopVideo = function () {
21076
- _sendCommandToIframe('stopVideo');
21077
- };
21078
- var _playVideo = function () {
21079
- _sendCommandToIframe('playVideo');
21080
- };
21081
-
21082
21091
  function closeZoom() {
21083
21092
  var closeButton = document.querySelectorAll('.iiz__btn.iiz__close.iiz__close--visible')[0];
21084
21093
  if (closeButton) {
@@ -21092,7 +21101,7 @@ var afterChangeSlide = function (_a) {
21092
21101
  var activeSlide = contents[slide];
21093
21102
  // If autoplay is true and iframe is the active slide, play the video
21094
21103
  var autoplay = (_b = activeSlide === null || activeSlide === void 0 ? void 0 : activeSlide.url) === null || _b === void 0 ? void 0 : _b.includes('autoplay=1');
21095
- autoplay ? _playVideo() : _stopVideo();
21104
+ autoplay ? playVideoCommand() : stopVideoCommand();
21096
21105
  setSelectedImageIndex(Math.round(slide));
21097
21106
  onChange === null || onChange === void 0 ? void 0 : onChange(slide);
21098
21107
  closeZoom();