@trafilea/afrodita-components 6.44.1 → 6.45.0

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
@@ -5396,6 +5396,14 @@ var benefitsRawHtml = [
5396
5396
  text: 'Receive it every 3 months. Cancel anytime',
5397
5397
  },
5398
5398
  ];
5399
+ var benefitsRawHtmlV2 = [
5400
+ benefitsRawHtml[0],
5401
+ benefitsRawHtml[2],
5402
+ {
5403
+ icon: __assign$1({ name: 'pdp/shipping_empty' }, commonIconProps),
5404
+ text: "<div>\n <span style=line-height:22px>Club: Free \n <span style=font-weight:600>priority shipping</span> \n always\n </span> \n <small style=display:block;line-height:18px>Free for 30 days. Only $4.99/month after.\n </small>\n </div>",
5405
+ },
5406
+ ];
5399
5407
  var sizeOptions = [
5400
5408
  {
5401
5409
  key: 'S',
@@ -6805,7 +6813,7 @@ var Rating = function (_a) {
6805
6813
  return (jsxRuntime.jsxs(Container$14, __assign$1({ as: reviewsContainerId ? 'a' : 'div' }, containerAttributes, { "data-testid": "Container", onClick: handleAnchorClick }, { children: [showRatingText && (jsxRuntime.jsx(RatingLabel, __assign$1({ color: theme.colors.shades['700'].color, "data-testid": "RatingLabel" }, { children: rating }), void 0)), jsxRuntime.jsx(StarList, { rating: rating, size: size, starsNumber: STARTS_NUMBER, fill: theme.component.stars.element.color }, void 0), jsxRuntime.jsxs(CustomLabel, __assign$1({ theme: theme, size: size, wrapWithParenthesis: wrapWithParenthesis, underline: underline, "data-testid": "CustomLabel" }, { children: [reviews ? reviews : '', " ", reviewsText ? reviewsText : ''] }), void 0)] }), void 0));
6806
6814
  };
6807
6815
 
6808
- var ImageWrapper$4 = newStyled.div(templateObject_1$1F || (templateObject_1$1F = __makeTemplateObject(["\n position: relative;\n display: flex;\n width: ", ";\n justify-content: center;\n align-items: center;\n border-radius: 8px;\n"], ["\n position: relative;\n display: flex;\n width: ", ";\n justify-content: center;\n align-items: center;\n border-radius: 8px;\n"])), function (_a) {
6816
+ var ImageWrapper$4 = newStyled.div(templateObject_1$1F || (templateObject_1$1F = __makeTemplateObject(["\n position: relative;\n display: flex;\n flex-shrink: 0;\n width: ", ";\n justify-content: center;\n align-items: center;\n border-radius: 8px;\n"], ["\n position: relative;\n display: flex;\n flex-shrink: 0;\n width: ", ";\n justify-content: center;\n align-items: center;\n border-radius: 8px;\n"])), function (_a) {
6809
6817
  var width = _a.width;
6810
6818
  return width;
6811
6819
  });
@@ -20532,17 +20540,17 @@ var JoinClubCard = function (_a) {
20532
20540
  var templateObject_1$l;
20533
20541
 
20534
20542
  var Container$i = newStyled.div(templateObject_1$k || (templateObject_1$k = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n width: 100%;\n padding: 12px;\n border: 1px solid #e5e5e5;\n border-radius: 8px;\n gap: 14px;\n margin: auto;\n"], ["\n display: flex;\n flex-direction: column;\n width: 100%;\n padding: 12px;\n border: 1px solid #e5e5e5;\n border-radius: 8px;\n gap: 14px;\n margin: auto;\n"])));
20535
- var Body = newStyled.div(templateObject_2$e || (templateObject_2$e = __makeTemplateObject(["\n display: flex;\n gap: 8px;\n width: 100%;\n height: ", ";\n"], ["\n display: flex;\n gap: 8px;\n width: 100%;\n height: ", ";\n"])), function (_a) {
20543
+ var Body = newStyled.div(templateObject_2$e || (templateObject_2$e = __makeTemplateObject(["\n display: flex;\n gap: 8px;\n width: 100%;\n height: ", ";\n margin-bottom: 1%;\n"], ["\n display: flex;\n gap: 8px;\n width: 100%;\n height: ", ";\n margin-bottom: 1%;\n"])), function (_a) {
20536
20544
  var height = _a.height;
20537
20545
  return height;
20538
20546
  });
20539
- var RightContent = newStyled.div(templateObject_3$e || (templateObject_3$e = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n gap: 8px;\n height: 100%;\n"], ["\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n gap: 8px;\n height: 100%;\n"])));
20540
- var Benefits = newStyled.div(templateObject_4$b || (templateObject_4$b = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n gap: 8px;\n height: ", ";\n padding: 6px 10px;\n border-radius: 8px;\n background-color: ", ";\n"], ["\n display: flex;\n flex-direction: column;\n gap: 8px;\n height: ", ";\n padding: 6px 10px;\n border-radius: 8px;\n background-color: ", ";\n"])), function (_a) {
20547
+ var RightContent = newStyled.div(templateObject_3$e || (templateObject_3$e = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n gap: 8px;\n height: 100%;\n width: 100%;\n"], ["\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n gap: 8px;\n height: 100%;\n width: 100%;\n"])));
20548
+ var Benefits = newStyled.div(templateObject_4$b || (templateObject_4$b = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n justify-content: space-around;\n gap: 8px;\n height: ", ";\n padding: 6px 10px;\n border-radius: 8px;\n background-color: ", ";\n"], ["\n display: flex;\n flex-direction: column;\n justify-content: space-around;\n gap: 8px;\n height: ", ";\n padding: 6px 10px;\n border-radius: 8px;\n background-color: ", ";\n"])), function (_a) {
20541
20549
  var height = _a.height;
20542
- return height;
20550
+ return height !== null && height !== void 0 ? height : '100%';
20543
20551
  }, function (_a) {
20544
- var theme = _a.theme;
20545
- return theme.colors.shades['10'].color;
20552
+ var theme = _a.theme, backgroundColor = _a.backgroundColor;
20553
+ return backgroundColor !== null && backgroundColor !== void 0 ? backgroundColor : theme.colors.shades['10'].color;
20546
20554
  });
20547
20555
  var Actions = newStyled.div(templateObject_5$9 || (templateObject_5$9 = __makeTemplateObject(["\n display: flex;\n width: 100%;\n gap: 8px;\n"], ["\n display: flex;\n width: 100%;\n gap: 8px;\n"])));
20548
20556
  var templateObject_1$k, templateObject_2$e, templateObject_3$e, templateObject_4$b, templateObject_5$9;
@@ -20559,26 +20567,32 @@ var getTitleProps = function (_a) {
20559
20567
  return { content: titleContent };
20560
20568
  }
20561
20569
  };
20562
- var OfferAtCart = function (_a) {
20563
- var className = _a.className, _b = _a.title, titleContent = _b.content, bold = _b.bold, _c = _a.image, src = _c.src, alt = _c.alt, benefits = _a.benefits, _d = _a.ctaText, ctaText = _d === void 0 ? 'Yes, I want this offer' : _d, sizeOptions = _a.sizeOptions, rating = _a.rating, onAddToCart = _a.onAddToCart;
20570
+ var OfferAtCart = function (props) {
20571
+ var className = props.className, _a = props.title, titleContent = _a.content, bold = _a.bold, image = props.image, benefits = props.benefits, _b = props.ctaText, ctaText = _b === void 0 ? 'Yes, I want this offer' : _b, sizeOptions = props.sizeOptions, rating = props.rating, bottomCopy = props.bottomCopy;
20564
20572
  var theme = useTheme();
20565
20573
  var isMobile = useDeviceType() === 'mobile';
20566
- var _e = React$2.useState(), selectedSize = _e[0], setSelectedSize = _e[1];
20567
- var _f = React$2.useState(false), showErrorMessage = _f[0], setShowErrorMessage = _f[1];
20568
- var ActionsSection = (jsxRuntime.jsxs(Actions, { children: [jsxRuntime.jsx(SimpleDropdown, { placeHolder: "Size", options: sizeOptions, onChange: function (sizeOption) {
20574
+ var _c = React$2.useState(), selectedSize = _c[0], setSelectedSize = _c[1];
20575
+ var _d = React$2.useState(false), showErrorMessage = _d[0], setShowErrorMessage = _d[1];
20576
+ var handleOnClick = function () {
20577
+ if ('sizeOptions' in props && props.sizeOptions) {
20578
+ if (selectedSize) {
20579
+ setShowErrorMessage(false);
20580
+ props.onAddToCart(selectedSize.key);
20581
+ }
20582
+ else {
20583
+ setShowErrorMessage(true);
20584
+ }
20585
+ }
20586
+ else {
20587
+ props.onAddToCart();
20588
+ }
20589
+ };
20590
+ var ActionsSection = (jsxRuntime.jsxs(Actions, { children: [sizeOptions && (jsxRuntime.jsx(SimpleDropdown, { placeHolder: "Size", options: sizeOptions, onChange: function (sizeOption) {
20569
20591
  setShowErrorMessage(false);
20570
20592
  setSelectedSize(sizeOption);
20571
- } }, void 0), jsxRuntime.jsx(ButtonSecondary, { wide: true, text: ctaText, size: exports.ComponentSize.Small, onClick: function () {
20572
- if (selectedSize) {
20573
- setShowErrorMessage(false);
20574
- onAddToCart(selectedSize.key);
20575
- }
20576
- else {
20577
- setShowErrorMessage(true);
20578
- }
20579
- } }, void 0)] }, void 0));
20580
- var ErrorMessage = showErrorMessage ? (jsxRuntime.jsx(Text$7, __assign$1({ variant: "body", weight: "demi", size: "small", color: theme.colors.semantic.urgent.color }, { children: "Please select a size first" }), void 0)) : null;
20581
- return (jsxRuntime.jsxs(Container$i, __assign$1({ className: className }, { children: [jsxRuntime.jsx(OfferAtCartTitle, __assign$1({}, getTitleProps({ content: titleContent, bold: bold })), void 0), jsxRuntime.jsxs(Body, __assign$1({ height: isMobile ? '120px' : '162px' }, { children: [jsxRuntime.jsx(OfferAtCartImage, { isMobile: isMobile, src: src, alt: alt, rating: rating }, void 0), jsxRuntime.jsxs(RightContent, { children: [jsxRuntime.jsx(Benefits, __assign$1({ height: isMobile ? '100%' : '65%' }, { children: jsxRuntime.jsx(OfferAtCartBenefits, { benefits: benefits }, void 0) }), void 0), !isMobile && ActionsSection, !isMobile && ErrorMessage] }, void 0)] }), void 0), isMobile && ActionsSection, isMobile && ErrorMessage] }), void 0));
20593
+ } }, void 0)), jsxRuntime.jsx(ButtonSecondary, { wide: true, text: ctaText, size: exports.ComponentSize.Small, onClick: handleOnClick }, void 0)] }, void 0));
20594
+ var ErrorMessage = (jsxRuntime.jsx(Text$7, __assign$1({ variant: "body", weight: "demi", size: "small", color: theme.colors.semantic.urgent.color }, { children: "Please select a size first" }), void 0));
20595
+ return (jsxRuntime.jsxs(Container$i, __assign$1({ className: className }, { children: [jsxRuntime.jsx(OfferAtCartTitle, __assign$1({}, getTitleProps({ content: titleContent, bold: bold })), void 0), jsxRuntime.jsxs(Body, __assign$1({ height: isMobile ? '120px' : '162px' }, { children: [image && (jsxRuntime.jsx(OfferAtCartImage, { isMobile: isMobile, src: image.src, alt: image.alt, rating: rating }, void 0)), jsxRuntime.jsxs(RightContent, { children: [jsxRuntime.jsx(Benefits, __assign$1({ id: "benefits" }, { children: jsxRuntime.jsx(OfferAtCartBenefits, { benefits: benefits }, void 0) }), void 0), !isMobile && ActionsSection, !isMobile && showErrorMessage && ErrorMessage] }, void 0)] }), void 0), isMobile && ActionsSection, isMobile && showErrorMessage && ErrorMessage, bottomCopy && jsxRuntime.jsx("span", { dangerouslySetInnerHTML: { __html: bottomCopy } }, void 0)] }), void 0));
20582
20596
  };
20583
20597
 
20584
20598
  var renderBottomCopy = function (text) {
@@ -20610,13 +20624,14 @@ var SizeOptions = function (_a) {
20610
20624
  };
20611
20625
 
20612
20626
  var OfferAtCartV2 = function (_a) {
20613
- var className = _a.className, _b = _a.title, titleContent = _b.content, bold = _b.bold, _c = _a.image, src = _c.src, alt = _c.alt, benefits = _a.benefits, _d = _a.ctaText, ctaText = _d === void 0 ? 'Yes, I want this offer' : _d, sizeOptions = _a.sizeOptions, rating = _a.rating, onAddToCart = _a.onAddToCart, bottomCopy = _a.bottomCopy;
20627
+ var className = _a.className, _b = _a.title, titleContent = _b.content, bold = _b.bold, image = _a.image, benefits = _a.benefits, _c = _a.ctaText, ctaText = _c === void 0 ? 'Yes, I want this offer' : _c, sizeOptions = _a.sizeOptions, rating = _a.rating, onAddToCart = _a.onAddToCart, bottomCopy = _a.bottomCopy;
20614
20628
  var isMobile = useDeviceType() === 'mobile';
20615
- var _e = React$2.useState(true), showButton = _e[0], setShowButton = _e[1];
20629
+ var _d = React$2.useState(true), showButton = _d[0], setShowButton = _d[1];
20630
+ var _e = image !== null && image !== void 0 ? image : {}, src = _e.src, alt = _e.alt;
20616
20631
  var ActionsSection = (jsxRuntime.jsx(ActionsV2, { children: showButton ? (jsxRuntime.jsx(ButtonSecondary, { wide: true, text: ctaText, size: exports.ComponentSize.Small, onClick: function () {
20617
20632
  setShowButton(false);
20618
- } }, void 0)) : (jsxRuntime.jsx(SizeOptions, { sizeOptions: sizeOptions, onAddToCart: onAddToCart }, void 0)) }, void 0));
20619
- return (jsxRuntime.jsxs(ContainerV2, __assign$1({ className: className, variant: bottomCopy ? VariantType.V2 : VariantType.V1 }, { children: [jsxRuntime.jsx(OfferAtCartTitle, __assign$1({}, getTitleProps({ content: titleContent, bold: bold })), void 0), jsxRuntime.jsxs(Body, __assign$1({ height: isMobile ? '120px' : '162px' }, { children: [jsxRuntime.jsx(OfferAtCartImage, { isMobile: isMobile, src: src, alt: alt, rating: rating }, void 0), jsxRuntime.jsx(RightContent, { children: jsxRuntime.jsx(Benefits, __assign$1({ height: isMobile ? '100%' : '65%' }, { children: jsxRuntime.jsx(OfferAtCartBenefits, { benefits: benefits }, void 0) }), void 0) }, void 0)] }), void 0), jsxRuntime.jsx("div", { children: !isMobile && ActionsSection }, void 0), isMobile && ActionsSection, bottomCopy && renderBottomCopy(bottomCopy)] }), void 0));
20633
+ } }, void 0)) : (sizeOptions && jsxRuntime.jsx(SizeOptions, { sizeOptions: sizeOptions, onAddToCart: onAddToCart }, void 0)) }, void 0));
20634
+ return (jsxRuntime.jsxs(ContainerV2, __assign$1({ className: className, variant: bottomCopy ? VariantType.V2 : VariantType.V1 }, { children: [jsxRuntime.jsx(OfferAtCartTitle, __assign$1({}, getTitleProps({ content: titleContent, bold: bold })), void 0), jsxRuntime.jsxs(Body, __assign$1({ height: isMobile ? '120px' : '162px' }, { children: [src && alt && jsxRuntime.jsx(OfferAtCartImage, { isMobile: isMobile, src: src, alt: alt, rating: rating }, void 0), jsxRuntime.jsx(RightContent, { children: jsxRuntime.jsx(Benefits, __assign$1({ height: isMobile ? '100%' : '65%' }, { children: jsxRuntime.jsx(OfferAtCartBenefits, { benefits: benefits }, void 0) }), void 0) }, void 0)] }), void 0), jsxRuntime.jsx("div", { children: !isMobile && ActionsSection }, void 0), isMobile && ActionsSection, bottomCopy && renderBottomCopy(bottomCopy)] }), void 0));
20620
20635
  };
20621
20636
 
20622
20637
  var ImageContainer$1 = newStyled.div(function (_a) {
@@ -22341,6 +22356,7 @@ exports.TrackingProgressV2 = TrackingProgressV2;
22341
22356
  exports.Video = Video$1;
22342
22357
  exports.benefits = benefits;
22343
22358
  exports.benefitsRawHtml = benefitsRawHtml;
22359
+ exports.benefitsRawHtmlV2 = benefitsRawHtmlV2;
22344
22360
  exports.buildImageUrl = buildImageUrl;
22345
22361
  exports.componentSizeMapper = componentSizeMapper;
22346
22362
  exports.createCache = createCache;