@trafilea/afrodita-components 6.43.9 → 6.43.11

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
@@ -1454,8 +1454,9 @@ interface BuyNowPayLaterProps {
1454
1454
  iconColor?: string;
1455
1455
  fontSize?: string;
1456
1456
  bnplWithAfterPay?: boolean;
1457
+ textTemplate?: string;
1457
1458
  }
1458
- declare const BuyNowPayLater: ({ displayBNPL, installments, installmentPrice, iconFolder, iconName, showLogo, iconColor, fontSize, bnplWithAfterPay, }: BuyNowPayLaterProps) => JSX.Element | null;
1459
+ declare const BuyNowPayLater: ({ displayBNPL, installments, installmentPrice, iconFolder, iconName, showLogo, iconColor, fontSize, bnplWithAfterPay, textTemplate, }: BuyNowPayLaterProps) => JSX.Element | null;
1459
1460
 
1460
1461
  interface CloseButtonProps {
1461
1462
  onClick: () => void;
@@ -3125,15 +3125,10 @@ var formatPrice = function (value, _a) {
3125
3125
  currency: currency,
3126
3126
  maximumFractionDigits: 3,
3127
3127
  }).format(valueToFormat);
3128
- if (currency === 'NZD') {
3129
- // intlFormat does not support NZD$ currency format
3130
- var resultOverridden = result.replace('NZ$', 'NZD$');
3131
- return resultOverridden;
3132
- }
3133
3128
  if (currency === 'SGD') {
3134
3129
  // intlFormat does not support singapure currency
3135
3130
  var onlyValue = result.slice(result.indexOf('SGD') + 4);
3136
- var resultOverridden = "SGD$".concat(onlyValue);
3131
+ var resultOverridden = "S$".concat(onlyValue);
3137
3132
  return resultOverridden;
3138
3133
  }
3139
3134
  return result;
@@ -3482,7 +3477,7 @@ var PriceLabelV2$1 = function (_a) {
3482
3477
  var isOriginalPrice = originalPrice && isDiffFinalAndOriginalPrice;
3483
3478
  var isDiscount = discount && isDiffFinalAndOriginalPrice;
3484
3479
  var isClubOffer = clubOffer && isDiffFinalAndOriginalPrice;
3485
- var supportedCurrencies = ['AU$', 'CA$', '£', 'NZD$', 'SGD$'];
3480
+ var supportedCurrencies = ['AU$', 'CA$', '£', 'NZ$', 'S$'];
3486
3481
  var currencySymbol = '$';
3487
3482
  if (typeof productFinalPrice === 'string') {
3488
3483
  supportedCurrencies.forEach(function (availableCurrency) {
@@ -3554,7 +3549,7 @@ var PriceLabelV3 = function (_a) {
3554
3549
  var isOriginalPrice = originalPrice && isDiffFinalAndOriginalPrice;
3555
3550
  var isDiscount = discount && isDiffFinalAndOriginalPrice;
3556
3551
  var isClubOffer = clubOffer && isDiffFinalAndOriginalPrice;
3557
- var supportedCurrencies = ['AU$', 'CA$', '£', 'NZD$', 'SGD$'];
3552
+ var supportedCurrencies = ['AU$', 'CA$', '£', 'NZ$', 'S$'];
3558
3553
  var currencySymbol = '$';
3559
3554
  if (typeof finalPrice === 'string') {
3560
3555
  supportedCurrencies.forEach(function (availableCurrency) {
@@ -3625,7 +3620,7 @@ var PriceLabel = function (_a) {
3625
3620
  var theme = useTheme();
3626
3621
  var isDiffFinalAndOriginalPrice = originalPrice !== finalPrice;
3627
3622
  var isOriginalPrice = originalPrice && isDiffFinalAndOriginalPrice;
3628
- var supportedCurrencies = ['AU$', 'CA$', '£', 'NZD$', 'SGD$'];
3623
+ var supportedCurrencies = ['AU$', 'CA$', '£', 'NZ$', 'S$'];
3629
3624
  var currencySymbol = '$';
3630
3625
  if (typeof finalPrice === 'string') {
3631
3626
  supportedCurrencies.forEach(function (availableCurrency) {
@@ -3661,7 +3656,7 @@ var PriceLabelV2 = function (_a) {
3661
3656
  var theme = useTheme();
3662
3657
  var isDiffFinalAndOriginalPrice = originalPrice !== finalPrice;
3663
3658
  var isOriginalPrice = originalPrice && isDiffFinalAndOriginalPrice;
3664
- var supportedCurrencies = ['AU$', 'CA$', '£', 'NZD$', 'SGD$'];
3659
+ var supportedCurrencies = ['AU$', 'CA$', '£', 'NZ$', 'S$'];
3665
3660
  var currencySymbol = '$';
3666
3661
  if (typeof finalPrice === 'string') {
3667
3662
  supportedCurrencies.forEach(function (availableCurrency) {
@@ -6530,16 +6525,24 @@ var TextContainer$1 = newStyled.div(templateObject_2$1j || (templateObject_2$1j
6530
6525
  var IconWrapper$1 = newStyled.div(templateObject_3$11 || (templateObject_3$11 = __makeTemplateObject(["\n display: inline;\n top: -1px;\n position: relative;\n\n svg {\n vertical-align: -webkit-baseline-middle;\n }\n"], ["\n display: inline;\n top: -1px;\n position: relative;\n\n svg {\n vertical-align: -webkit-baseline-middle;\n }\n"])));
6531
6526
  var BuyNowPayLater = function (_a) {
6532
6527
  var _b;
6533
- var displayBNPL = _a.displayBNPL, installments = _a.installments, installmentPrice = _a.installmentPrice, _c = _a.iconFolder, iconFolder = _c === void 0 ? 'PDP' : _c, iconName = _a.iconName, _d = _a.showLogo, showLogo = _d === void 0 ? true : _d, _e = _a.iconColor, iconColor = _e === void 0 ? '#292929' : _e, fontSize = _a.fontSize, _f = _a.bnplWithAfterPay, bnplWithAfterPay = _f === void 0 ? false : _f;
6528
+ var displayBNPL = _a.displayBNPL, installments = _a.installments, installmentPrice = _a.installmentPrice, _c = _a.iconFolder, iconFolder = _c === void 0 ? 'PDP' : _c, iconName = _a.iconName, _d = _a.showLogo, showLogo = _d === void 0 ? true : _d, _e = _a.iconColor, iconColor = _e === void 0 ? '#292929' : _e, fontSize = _a.fontSize, _f = _a.bnplWithAfterPay, bnplWithAfterPay = _f === void 0 ? false : _f, textTemplate = _a.textTemplate;
6534
6529
  // @ts-ignore
6535
6530
  var IconComponent = (_b = Icon === null || Icon === void 0 ? void 0 : Icon[iconFolder]) === null || _b === void 0 ? void 0 : _b[iconName];
6536
6531
  if (!IconComponent) {
6537
6532
  console.error('Icon', iconName, 'not found');
6538
6533
  return null;
6539
6534
  }
6540
- return (jsx$1(Container$19, __assign$1({ displayBNPL: displayBNPL }, { children: jsxs$1(TextContainer$1, __assign$1({ style: { fontSize: fontSize }, "data-testid": "mainText" }, { children: [jsxs$1("div", { children: [!bnplWithAfterPay
6541
- ? "Or ".concat(installments, " payments of ")
6542
- : "or 4 interest-free payments of ", jsx$1(Text$7, __assign$1({ variant: "body", weight: "bold", style: {
6535
+ var dynamicText = '';
6536
+ if (textTemplate) {
6537
+ dynamicText = "".concat(textTemplate.replace('{installments}', installments.toString()).trimEnd(), " ");
6538
+ }
6539
+ else if (!bnplWithAfterPay) {
6540
+ dynamicText = "Or ".concat(installments, " payments of ");
6541
+ }
6542
+ else {
6543
+ dynamicText = "or 4 interest-free payments of ";
6544
+ }
6545
+ return (jsx$1(Container$19, __assign$1({ displayBNPL: displayBNPL }, { children: jsxs$1(TextContainer$1, __assign$1({ style: { fontSize: fontSize }, "data-testid": "mainText" }, { children: [jsxs$1("div", { children: [dynamicText, jsx$1(Text$7, __assign$1({ variant: "body", weight: "bold", style: {
6543
6546
  display: 'inline',
6544
6547
  fontSize: fontSize,
6545
6548
  paddingLeft: '0.25rem',
@@ -6998,7 +7001,7 @@ var PriceLabelV4 = function (_a) {
6998
7001
  var theme = useTheme();
6999
7002
  var isMobile = useWindowDimensions().isMobile;
7000
7003
  var productFinalPrice = clubPrice;
7001
- var supportedCurrencies = ['AU$', 'CA$', '£', 'NZD$', 'SGD$'];
7004
+ var supportedCurrencies = ['AU$', 'CA$', '£', 'NZ$', 'S$'];
7002
7005
  var currencySymbol = '$';
7003
7006
  if (typeof productFinalPrice === 'string') {
7004
7007
  supportedCurrencies.forEach(function (availableCurrency) {