@trafilea/afrodita-components 6.44.0 → 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.d.ts +16 -6
- package/build/index.esm.js +67 -28
- package/build/index.esm.js.map +1 -1
- package/build/index.js +68 -27
- 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,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,39 @@ var getTitleProps = function (_a) {
|
|
|
20559
20567
|
return { content: titleContent };
|
|
20560
20568
|
}
|
|
20561
20569
|
};
|
|
20562
|
-
var OfferAtCart = function (
|
|
20563
|
-
var className =
|
|
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
|
|
20567
|
-
var
|
|
20568
|
-
var
|
|
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:
|
|
20572
|
-
|
|
20573
|
-
|
|
20574
|
-
|
|
20575
|
-
|
|
20576
|
-
|
|
20577
|
-
|
|
20578
|
-
|
|
20579
|
-
|
|
20580
|
-
|
|
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));
|
|
20596
|
+
};
|
|
20597
|
+
|
|
20598
|
+
var renderBottomCopy = function (text) {
|
|
20599
|
+
if (typeof text === 'string') {
|
|
20600
|
+
return jsxRuntime.jsx("span", { dangerouslySetInnerHTML: { __html: text } }, void 0);
|
|
20601
|
+
}
|
|
20602
|
+
return text;
|
|
20582
20603
|
};
|
|
20583
20604
|
|
|
20584
20605
|
var VariantType;
|
|
@@ -20586,15 +20607,33 @@ var VariantType;
|
|
|
20586
20607
|
VariantType["V1"] = "v1";
|
|
20587
20608
|
VariantType["V2"] = "v2";
|
|
20588
20609
|
})(VariantType || (VariantType = {}));
|
|
20589
|
-
newStyled.div(templateObject_1$j || (templateObject_1$j = __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 background-color: ", ";\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 background-color: ", ";\n"])), function (_a) {
|
|
20610
|
+
var ContainerV2 = newStyled.div(templateObject_1$j || (templateObject_1$j = __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 background-color: ", ";\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 background-color: ", ";\n"])), function (_a) {
|
|
20590
20611
|
var variant = _a.variant;
|
|
20591
20612
|
return (variant === VariantType.V2 ? '#F7F7F7' : 'white');
|
|
20592
20613
|
});
|
|
20593
|
-
newStyled.div(templateObject_2$d || (templateObject_2$d = __makeTemplateObject(["\n display: flex;\n width: 100%;\n gap: 8px;\n flex-direction: column;\n"], ["\n display: flex;\n width: 100%;\n gap: 8px;\n flex-direction: column;\n"])));
|
|
20594
|
-
newStyled.div(templateObject_3$d || (templateObject_3$d = __makeTemplateObject(["\n width: 59px;\n height: 36px;\n border-radius: 8px;\n border: 1px 0px 0px 0px;\n border-color: #bbbbbb;\n border-style: solid;\n border-width: 1px;\n font-size: 12px;\n font-weight: 600;\n line-height: 16px;\n text-align: center;\n display: flex;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n"], ["\n width: 59px;\n height: 36px;\n border-radius: 8px;\n border: 1px 0px 0px 0px;\n border-color: #bbbbbb;\n border-style: solid;\n border-width: 1px;\n font-size: 12px;\n font-weight: 600;\n line-height: 16px;\n text-align: center;\n display: flex;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n"])));
|
|
20595
|
-
newStyled.div(templateObject_4$a || (templateObject_4$a = __makeTemplateObject(["\n display: grid;\n gap: 4px;\n grid-template-columns: repeat(5, 1fr);\n\n @media only screen and (max-width: 375px) {\n grid-template-columns: repeat(3, 1fr);\n }\n"], ["\n display: grid;\n gap: 4px;\n grid-template-columns: repeat(5, 1fr);\n\n @media only screen and (max-width: 375px) {\n grid-template-columns: repeat(3, 1fr);\n }\n"])));
|
|
20614
|
+
var ActionsV2 = newStyled.div(templateObject_2$d || (templateObject_2$d = __makeTemplateObject(["\n display: flex;\n width: 100%;\n gap: 8px;\n flex-direction: column;\n"], ["\n display: flex;\n width: 100%;\n gap: 8px;\n flex-direction: column;\n"])));
|
|
20615
|
+
var SizeCardItem = newStyled.div(templateObject_3$d || (templateObject_3$d = __makeTemplateObject(["\n width: 59px;\n height: 36px;\n border-radius: 8px;\n border: 1px 0px 0px 0px;\n border-color: #bbbbbb;\n border-style: solid;\n border-width: 1px;\n font-size: 12px;\n font-weight: 600;\n line-height: 16px;\n text-align: center;\n display: flex;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n"], ["\n width: 59px;\n height: 36px;\n border-radius: 8px;\n border: 1px 0px 0px 0px;\n border-color: #bbbbbb;\n border-style: solid;\n border-width: 1px;\n font-size: 12px;\n font-weight: 600;\n line-height: 16px;\n text-align: center;\n display: flex;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n"])));
|
|
20616
|
+
var SizeCardWrapper = newStyled.div(templateObject_4$a || (templateObject_4$a = __makeTemplateObject(["\n display: grid;\n gap: 4px;\n grid-template-columns: repeat(5, 1fr);\n\n @media only screen and (max-width: 375px) {\n grid-template-columns: repeat(3, 1fr);\n }\n"], ["\n display: grid;\n gap: 4px;\n grid-template-columns: repeat(5, 1fr);\n\n @media only screen and (max-width: 375px) {\n grid-template-columns: repeat(3, 1fr);\n }\n"])));
|
|
20596
20617
|
var templateObject_1$j, templateObject_2$d, templateObject_3$d, templateObject_4$a;
|
|
20597
20618
|
|
|
20619
|
+
var SizeOptions = function (_a) {
|
|
20620
|
+
var onAddToCart = _a.onAddToCart, sizeOptions = _a.sizeOptions;
|
|
20621
|
+
return (jsxRuntime.jsx(SizeCardWrapper, __assign$1({ "data-testid": "sizeCardWrapper" }, { children: sizeOptions.map(function (sizeOption) { return (jsxRuntime.jsx(SizeCardItem, __assign$1({ onClick: function () {
|
|
20622
|
+
onAddToCart(sizeOption.key);
|
|
20623
|
+
} }, { children: sizeOption.label }), sizeOption.key)); }) }), void 0));
|
|
20624
|
+
};
|
|
20625
|
+
|
|
20626
|
+
var OfferAtCartV2 = function (_a) {
|
|
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;
|
|
20628
|
+
var isMobile = useDeviceType() === 'mobile';
|
|
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;
|
|
20631
|
+
var ActionsSection = (jsxRuntime.jsx(ActionsV2, { children: showButton ? (jsxRuntime.jsx(ButtonSecondary, { wide: true, text: ctaText, size: exports.ComponentSize.Small, onClick: function () {
|
|
20632
|
+
setShowButton(false);
|
|
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));
|
|
20635
|
+
};
|
|
20636
|
+
|
|
20598
20637
|
var ImageContainer$1 = newStyled.div(function (_a) {
|
|
20599
20638
|
var width = _a.width, height = _a.height;
|
|
20600
20639
|
return ({
|
|
@@ -22247,6 +22286,7 @@ exports.MotivatorProgressBar = MotivatorProgressBar;
|
|
|
22247
22286
|
exports.MultiColorPicker = MultiColorPicker;
|
|
22248
22287
|
exports.Note = Note;
|
|
22249
22288
|
exports.OfferAtCart = OfferAtCart;
|
|
22289
|
+
exports.OfferAtCartV2 = OfferAtCartV2;
|
|
22250
22290
|
exports.OfferBanner = OfferBanner;
|
|
22251
22291
|
exports.OrderBar = OrderBar;
|
|
22252
22292
|
exports.Overlay = Overlay;
|
|
@@ -22316,6 +22356,7 @@ exports.TrackingProgressV2 = TrackingProgressV2;
|
|
|
22316
22356
|
exports.Video = Video$1;
|
|
22317
22357
|
exports.benefits = benefits;
|
|
22318
22358
|
exports.benefitsRawHtml = benefitsRawHtml;
|
|
22359
|
+
exports.benefitsRawHtmlV2 = benefitsRawHtmlV2;
|
|
22319
22360
|
exports.buildImageUrl = buildImageUrl;
|
|
22320
22361
|
exports.componentSizeMapper = componentSizeMapper;
|
|
22321
22362
|
exports.createCache = createCache;
|