@trafilea/afrodita-components 6.44.1 → 6.45.1
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 +14 -6
- package/build/index.esm.js +44 -32
- package/build/index.esm.js.map +1 -1
- package/build/index.js +44 -31
- package/build/index.js.map +1 -1
- package/package.json +1 -1
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,10 +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
|
|
6809
|
-
var width = _a.width;
|
|
6810
|
-
return width;
|
|
6811
|
-
});
|
|
6816
|
+
var ImageWrapper$4 = newStyled.div(templateObject_1$1F || (templateObject_1$1F = __makeTemplateObject(["\n position: relative;\n display: flex;\n flex-shrink: 0;\n justify-content: center;\n align-items: center;\n border-radius: 8px;\n"], ["\n position: relative;\n display: flex;\n flex-shrink: 0;\n justify-content: center;\n align-items: center;\n border-radius: 8px;\n"])));
|
|
6812
6817
|
var RatingWrapper = newStyled.div(templateObject_2$1h || (templateObject_2$1h = __makeTemplateObject(["\n position: absolute;\n bottom: 5px;\n left: 50%;\n transform: translateX(-50%);\n display: flex;\n justify-content: center;\n align-items: center;\n background-color: white;\n border-radius: 8px;\n padding: 4px 8px;\n width: 95%;\n"], ["\n position: absolute;\n bottom: 5px;\n left: 50%;\n transform: translateX(-50%);\n display: flex;\n justify-content: center;\n align-items: center;\n background-color: white;\n border-radius: 8px;\n padding: 4px 8px;\n width: 95%;\n"])));
|
|
6813
6818
|
var RatingText = newStyled.span(templateObject_3$10 || (templateObject_3$10 = __makeTemplateObject(["\n font-size: ", ";\n font-weight: 600;\n margin-bottom: -3%;\n color: #292929;\n"], ["\n font-size: ", ";\n font-weight: 600;\n margin-bottom: -3%;\n color: #292929;\n"])), function (_a) {
|
|
6814
6819
|
var fontSize = _a.fontSize;
|
|
@@ -6818,7 +6823,7 @@ var templateObject_1$1F, templateObject_2$1h, templateObject_3$10;
|
|
|
6818
6823
|
|
|
6819
6824
|
var OfferAtCartImage = function (_a) {
|
|
6820
6825
|
var isMobile = _a.isMobile, src = _a.src, alt = _a.alt, rating = _a.rating;
|
|
6821
|
-
return (jsxRuntime.jsxs(ImageWrapper$4,
|
|
6826
|
+
return (jsxRuntime.jsxs(ImageWrapper$4, { children: [!!rating && (jsxRuntime.jsxs(RatingWrapper, { children: [jsxRuntime.jsx(Rating, { rating: rating, size: isMobile ? exports.ComponentSize.XXSmall : exports.ComponentSize.XSmall }, void 0), jsxRuntime.jsxs(RatingText, __assign$1({ fontSize: isMobile ? '9px' : '13px' }, { children: [rating, "/5"] }), void 0)] }, void 0)), jsxRuntime.jsx(Image$3, { src: src, alt: alt, width: "100%", height: "100%", objectFit: "cover", borderRadius: "8px" }, void 0)] }, void 0));
|
|
6822
6827
|
};
|
|
6823
6828
|
|
|
6824
6829
|
var OfferAtCartTitle = function (_a) {
|
|
@@ -20532,17 +20537,17 @@ var JoinClubCard = function (_a) {
|
|
|
20532
20537
|
var templateObject_1$l;
|
|
20533
20538
|
|
|
20534
20539
|
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) {
|
|
20540
|
+
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
20541
|
var height = _a.height;
|
|
20537
20542
|
return height;
|
|
20538
20543
|
});
|
|
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) {
|
|
20544
|
+
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"])));
|
|
20545
|
+
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
20546
|
var height = _a.height;
|
|
20542
|
-
return height;
|
|
20547
|
+
return height !== null && height !== void 0 ? height : '100%';
|
|
20543
20548
|
}, function (_a) {
|
|
20544
|
-
var theme = _a.theme;
|
|
20545
|
-
return theme.colors.shades['10'].color;
|
|
20549
|
+
var theme = _a.theme, backgroundColor = _a.backgroundColor;
|
|
20550
|
+
return backgroundColor !== null && backgroundColor !== void 0 ? backgroundColor : theme.colors.shades['10'].color;
|
|
20546
20551
|
});
|
|
20547
20552
|
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
20553
|
var templateObject_1$k, templateObject_2$e, templateObject_3$e, templateObject_4$b, templateObject_5$9;
|
|
@@ -20559,26 +20564,32 @@ var getTitleProps = function (_a) {
|
|
|
20559
20564
|
return { content: titleContent };
|
|
20560
20565
|
}
|
|
20561
20566
|
};
|
|
20562
|
-
var OfferAtCart = function (
|
|
20563
|
-
var className =
|
|
20567
|
+
var OfferAtCart = function (props) {
|
|
20568
|
+
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
20569
|
var theme = useTheme();
|
|
20565
20570
|
var isMobile = useDeviceType() === 'mobile';
|
|
20566
|
-
var
|
|
20567
|
-
var
|
|
20568
|
-
var
|
|
20571
|
+
var _c = React$2.useState(), selectedSize = _c[0], setSelectedSize = _c[1];
|
|
20572
|
+
var _d = React$2.useState(false), showErrorMessage = _d[0], setShowErrorMessage = _d[1];
|
|
20573
|
+
var handleOnClick = function () {
|
|
20574
|
+
if ('sizeOptions' in props && props.sizeOptions) {
|
|
20575
|
+
if (selectedSize) {
|
|
20576
|
+
setShowErrorMessage(false);
|
|
20577
|
+
props.onAddToCart(selectedSize.key);
|
|
20578
|
+
}
|
|
20579
|
+
else {
|
|
20580
|
+
setShowErrorMessage(true);
|
|
20581
|
+
}
|
|
20582
|
+
}
|
|
20583
|
+
else {
|
|
20584
|
+
props.onAddToCart();
|
|
20585
|
+
}
|
|
20586
|
+
};
|
|
20587
|
+
var ActionsSection = (jsxRuntime.jsxs(Actions, { children: [sizeOptions && (jsxRuntime.jsx(SimpleDropdown, { placeHolder: "Size", options: sizeOptions, onChange: function (sizeOption) {
|
|
20569
20588
|
setShowErrorMessage(false);
|
|
20570
20589
|
setSelectedSize(sizeOption);
|
|
20571
|
-
} }, void 0), jsxRuntime.jsx(ButtonSecondary, { wide: true, text: ctaText, size: exports.ComponentSize.Small, onClick:
|
|
20572
|
-
|
|
20573
|
-
|
|
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));
|
|
20590
|
+
} }, void 0)), jsxRuntime.jsx(ButtonSecondary, { wide: true, text: ctaText, size: exports.ComponentSize.Small, onClick: handleOnClick }, void 0)] }, void 0));
|
|
20591
|
+
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));
|
|
20592
|
+
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
20593
|
};
|
|
20583
20594
|
|
|
20584
20595
|
var renderBottomCopy = function (text) {
|
|
@@ -20610,13 +20621,14 @@ var SizeOptions = function (_a) {
|
|
|
20610
20621
|
};
|
|
20611
20622
|
|
|
20612
20623
|
var OfferAtCartV2 = function (_a) {
|
|
20613
|
-
var className = _a.className, _b = _a.title, titleContent = _b.content, bold = _b.bold,
|
|
20624
|
+
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
20625
|
var isMobile = useDeviceType() === 'mobile';
|
|
20615
|
-
var
|
|
20626
|
+
var _d = React$2.useState(true), showButton = _d[0], setShowButton = _d[1];
|
|
20627
|
+
var _e = image !== null && image !== void 0 ? image : {}, src = _e.src, alt = _e.alt;
|
|
20616
20628
|
var ActionsSection = (jsxRuntime.jsx(ActionsV2, { children: showButton ? (jsxRuntime.jsx(ButtonSecondary, { wide: true, text: ctaText, size: exports.ComponentSize.Small, onClick: function () {
|
|
20617
20629
|
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));
|
|
20630
|
+
} }, void 0)) : (sizeOptions && jsxRuntime.jsx(SizeOptions, { sizeOptions: sizeOptions, onAddToCart: onAddToCart }, void 0)) }, void 0));
|
|
20631
|
+
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
20632
|
};
|
|
20621
20633
|
|
|
20622
20634
|
var ImageContainer$1 = newStyled.div(function (_a) {
|
|
@@ -22341,6 +22353,7 @@ exports.TrackingProgressV2 = TrackingProgressV2;
|
|
|
22341
22353
|
exports.Video = Video$1;
|
|
22342
22354
|
exports.benefits = benefits;
|
|
22343
22355
|
exports.benefitsRawHtml = benefitsRawHtml;
|
|
22356
|
+
exports.benefitsRawHtmlV2 = benefitsRawHtmlV2;
|
|
22344
22357
|
exports.buildImageUrl = buildImageUrl;
|
|
22345
22358
|
exports.componentSizeMapper = componentSizeMapper;
|
|
22346
22359
|
exports.createCache = createCache;
|