@trafilea/afrodita-components 6.5.0 → 6.5.2

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
@@ -2045,6 +2045,8 @@ interface PriceLabelProps {
2045
2045
  testId?: string;
2046
2046
  clubStyle?: boolean;
2047
2047
  bordersRounded?: boolean;
2048
+ hasPricePerItem?: boolean;
2049
+ quantity?: number;
2048
2050
  }
2049
2051
  declare const PriceLabel: React__default.FC<PriceLabelProps>;
2050
2052
 
@@ -5454,7 +5454,7 @@ var templateObject_1$1A, templateObject_2$10, templateObject_3$Q;
5454
5454
  var FinalPriceStyledContainer$1 = newStyled.div(templateObject_1$1z || (templateObject_1$1z = __makeTemplateObject(["\n display: flex;\n"], ["\n display: flex;\n"])));
5455
5455
  var PriceLabelV2 = function (_a) {
5456
5456
  var _b;
5457
- var finalPrice = _a.finalPrice, originalPrice = _a.originalPrice, discount = _a.discount, clubOffer = _a.clubOffer, color = _a.color, testId = _a.testId, _c = _a.originalPriceStyled, originalPriceStyled = _c === void 0 ? false : _c, _d = _a.originalPriceUnderlined, originalPriceUnderlined = _d === void 0 ? true : _d, _e = _a.size, size = _e === void 0 ? ComponentSize.Small : _e, _f = _a.bordersRounded, bordersRounded = _f === void 0 ? false : _f, _g = _a.savingsDisplay, savingsDisplay = _g === void 0 ? true : _g, rest = __rest(_a, ["finalPrice", "originalPrice", "discount", "clubOffer", "color", "testId", "originalPriceStyled", "originalPriceUnderlined", "size", "bordersRounded", "savingsDisplay"]);
5457
+ var finalPrice = _a.finalPrice, originalPrice = _a.originalPrice, discount = _a.discount, clubOffer = _a.clubOffer, color = _a.color, testId = _a.testId, _c = _a.originalPriceStyled, originalPriceStyled = _c === void 0 ? false : _c, _d = _a.originalPriceUnderlined, originalPriceUnderlined = _d === void 0 ? true : _d, _e = _a.size, size = _e === void 0 ? ComponentSize.Small : _e, _f = _a.bordersRounded, bordersRounded = _f === void 0 ? false : _f, _g = _a.savingsDisplay, savingsDisplay = _g === void 0 ? true : _g, hasPricePerItem = _a.hasPricePerItem, _h = _a.quantity, quantity = _h === void 0 ? 0 : _h, rest = __rest(_a, ["finalPrice", "originalPrice", "discount", "clubOffer", "color", "testId", "originalPriceStyled", "originalPriceUnderlined", "size", "bordersRounded", "savingsDisplay", "hasPricePerItem", "quantity"]);
5458
5458
  var theme = useTheme();
5459
5459
  var isDiffFinalAndOriginalPrice = originalPrice !== finalPrice;
5460
5460
  var isOriginalPrice = originalPrice && isDiffFinalAndOriginalPrice;
@@ -5469,10 +5469,16 @@ var PriceLabelV2 = function (_a) {
5469
5469
  }
5470
5470
  });
5471
5471
  }
5472
- var finalPriceArray = typeof finalPrice === 'string' &&
5473
- finalPrice.includes('.') &&
5474
- finalPrice.includes(currencySymbol)
5475
- ? finalPrice.split(currencySymbol)[1].split('.')
5472
+ var priceSymbolRemoved = typeof finalPrice === 'string' && finalPrice.includes(currencySymbol)
5473
+ ? finalPrice.split(currencySymbol)[1]
5474
+ : finalPrice;
5475
+ var finalPricePerQuantity = hasPricePerItem
5476
+ ? "".concat(currencySymbol).concat((Number(priceSymbolRemoved) / quantity).toFixed(2))
5477
+ : finalPrice;
5478
+ var finalPriceArray = typeof finalPricePerQuantity === 'string' &&
5479
+ finalPricePerQuantity.includes('.') &&
5480
+ finalPricePerQuantity.includes(currencySymbol)
5481
+ ? finalPricePerQuantity.split(currencySymbol)[1].split('.')
5476
5482
  : ['', ''];
5477
5483
  var priceCommonProps = {
5478
5484
  size: ComponentSize.Small,
@@ -5505,7 +5511,7 @@ var PriceLabelV2 = function (_a) {
5505
5511
  marginTop: '-5px',
5506
5512
  } }, priceCommonProps, { size: size }, { children: currencySymbol }), void 0), jsx$1(Price, __assign$1({ finalPriceStyled: true }, priceCommonProps, { size: size }, { children: finalPriceArray[0] ? finalPriceArray[0] : (_b = "".concat(finalPrice)) === null || _b === void 0 ? void 0 : _b.split(currencySymbol)[1] }), void 0), jsx$1(Price, __assign$1({ finalPriceStyledSmall: true, style: {
5507
5513
  marginTop: '-6px',
5508
- } }, priceCommonProps, { size: size }, { children: finalPriceArray[1] ? finalPriceArray[1] : '00' }), void 0)] }), void 0), isDiscount && (jsx$1(TagContainer, __assign$1({ size: ComponentSize.Small }, { children: discount && (jsx$1(DiscountTag, __assign$1({}, discount, { size: ComponentSize.Medium, style: {
5514
+ } }, priceCommonProps, { size: size }, { children: finalPriceArray[1] ? finalPriceArray[1] : '00' }), void 0), hasPricePerItem && (jsx$1(Price, __assign$1({ size: ComponentSize.Small, color: theme.colors.pallete.secondary.color }, { children: "/each" }), void 0))] }), void 0), isDiscount && (jsx$1(TagContainer, __assign$1({ size: ComponentSize.Small }, { children: discount && (jsx$1(DiscountTag, __assign$1({}, discount, { size: ComponentSize.Medium, style: {
5509
5515
  letterSpacing: '-0.05rem',
5510
5516
  }, bordersRounded: bordersRounded, savings: savingsDisplay ? "Save ".concat(currencySymbol).concat(savetoString) : undefined }), void 0)) }), void 0)), isClubOffer && (jsx$1(TagContainer, __assign$1({ size: ComponentSize.Medium }, { children: clubOffer && (jsx$1(ClubOfferTag, __assign$1({}, clubOffer, { size: ComponentSize.Small, style: {
5511
5517
  borderRadius: '8px',