@trafilea/afrodita-components 6.43.8 → 6.43.10

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;
@@ -4074,7 +4075,8 @@ declare type IMobileGalleryProps = {
4074
4075
  bottomTag?: JSX.Element;
4075
4076
  productImageDataTestId?: string;
4076
4077
  borderRadiusVariant?: boolean;
4077
- selectedValue?: number;
4078
+ selectedIndex?: number;
4079
+ selectedValue?: IImage;
4078
4080
  itemsOnViewport?: number;
4079
4081
  };
4080
4082
  declare const ProductGalleryMobileV4: React.FC<IMobileGalleryProps>;
@@ -6530,16 +6530,24 @@ var TextContainer$1 = newStyled.div(templateObject_2$1j || (templateObject_2$1j
6530
6530
  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
6531
  var BuyNowPayLater = function (_a) {
6532
6532
  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;
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, textTemplate = _a.textTemplate;
6534
6534
  // @ts-ignore
6535
6535
  var IconComponent = (_b = Icon === null || Icon === void 0 ? void 0 : Icon[iconFolder]) === null || _b === void 0 ? void 0 : _b[iconName];
6536
6536
  if (!IconComponent) {
6537
6537
  console.error('Icon', iconName, 'not found');
6538
6538
  return null;
6539
6539
  }
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: {
6540
+ var dynamicText = '';
6541
+ if (textTemplate) {
6542
+ dynamicText = "".concat(textTemplate.replace('{installments}', installments.toString()).trimEnd(), " ");
6543
+ }
6544
+ else if (!bnplWithAfterPay) {
6545
+ dynamicText = "Or ".concat(installments, " payments of ");
6546
+ }
6547
+ else {
6548
+ dynamicText = "or 4 interest-free payments of ";
6549
+ }
6550
+ 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
6551
  display: 'inline',
6544
6552
  fontSize: fontSize,
6545
6553
  paddingLeft: '0.25rem',
@@ -21538,7 +21546,7 @@ var Container$5 = newStyled.div({
21538
21546
  width: '100vw',
21539
21547
  position: 'fixed',
21540
21548
  overflowY: 'scroll',
21541
- zIndex: '99999',
21549
+ zIndex: '99999999999',
21542
21550
  top: 0,
21543
21551
  left: 0,
21544
21552
  display: 'flex',
@@ -21609,13 +21617,19 @@ var GalleryDetailed = function (_a) {
21609
21617
  };
21610
21618
 
21611
21619
  var ProductGalleryMobileV4 = function (_a) {
21612
- var images = _a.images, customClick = _a.customClick, topTag = _a.topTag, topRightTag = _a.topRightTag, bottomTag = _a.bottomTag, productImageDataTestId = _a.productImageDataTestId, _b = _a.borderRadiusVariant, borderRadiusVariant = _b === void 0 ? false : _b, _c = _a.selectedValue, selectedValue = _c === void 0 ? 0 : _c, _d = _a.itemsOnViewport, itemsOnViewport = _d === void 0 ? 1 : _d;
21620
+ var images = _a.images, customClick = _a.customClick, topTag = _a.topTag, topRightTag = _a.topRightTag, bottomTag = _a.bottomTag, productImageDataTestId = _a.productImageDataTestId, _b = _a.borderRadiusVariant, borderRadiusVariant = _b === void 0 ? false : _b, _c = _a.selectedIndex, selectedIndex = _c === void 0 ? 0 : _c, selectedValue = _a.selectedValue, _d = _a.itemsOnViewport, itemsOnViewport = _d === void 0 ? 1 : _d;
21613
21621
  var containerRef = useRef(null);
21614
- var _e = useState(selectedValue), selectedImageIndex = _e[0], setSelectedImageIndex = _e[1];
21622
+ var _e = useState(selectedIndex), selectedImageIndex = _e[0], setSelectedImageIndex = _e[1];
21615
21623
  var _f = useState(false), galleryOpened = _f[0], setGalleryOpened = _f[1];
21616
21624
  useEffect(function () {
21617
- setSelectedImageIndex(selectedValue);
21618
- }, [selectedValue]);
21625
+ if (selectedIndex) {
21626
+ setSelectedImageIndex(selectedIndex);
21627
+ }
21628
+ else if (selectedValue) {
21629
+ var actualIndex = images.findIndex(function (el) { return el.key === selectedValue.key; });
21630
+ setSelectedImageIndex(actualIndex);
21631
+ }
21632
+ }, [selectedIndex, selectedValue, images]);
21619
21633
  useEffect(function () {
21620
21634
  var body = document.querySelector('body');
21621
21635
  if (!body) {