@asantemedia-org/edwardsvacuum-design-system 1.6.58 → 1.6.59

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/dist/index.js CHANGED
@@ -317,6 +317,9 @@ var AccordionSection = function (_a) {
317
317
  }, shouldRenderChildren ? children : null));
318
318
  };
319
319
 
320
+ var placholderimg = "3697809e28f9e0fe.png";
321
+
322
+ var PLACEHOLDER_INDICATOR = "?placeholder-storybook";
320
323
  // Utility function to retrieve correct SCSS module class names
321
324
  var getStyle$1 = function (className) {
322
325
  if (styles$2[className]) return styles$2[className];
@@ -338,22 +341,10 @@ var cardSizeMapping = function (size) {
338
341
  }
339
342
  return classSrting;
340
343
  };
341
- var getImageUrl = function (imageUrl) {
342
- if (imageUrl) {
343
- return imageUrl; // If an image URL is provided, use it.
344
- }
345
- try {
346
- // Try loading from local assets (works in Storybook)
347
- return require("../../../assets/edwards-webshop-placeholder.png").default.src;
348
- } catch (error) {
349
- // If that fails, load from node_modules (works in host app)
350
- try {
351
- return require("@asantemedia-org/edwardsvacuum-design-system/dist/assets/edwards-webshop-placeholder.png").default;
352
- } catch (error) {
353
- console.error("Placeholder image not found in either local assets or node_modules.", error);
354
- return ""; // Fallback empty string if no image is found
355
- }
356
- }
344
+ // Helper function to check if image is a placeholder (from ACAS-14821)
345
+ var isPlaceholderImg = function (imageUrl) {
346
+ console.log(imageUrl);
347
+ return !!imageUrl && imageUrl.indexOf(PLACEHOLDER_INDICATOR) > -1;
357
348
  };
358
349
  var Card = function (_a) {
359
350
  var contentCategoryLabel = _a.contentCategoryLabel,
@@ -369,7 +360,6 @@ var Card = function (_a) {
369
360
  cardLink = _a.cardLink,
370
361
  city = _a.city,
371
362
  country = _a.country,
372
- placeholder = _a.placeholder,
373
363
  onClick = _a.onClick,
374
364
  _b = _a.usePlainClasses,
375
365
  usePlainClasses = _b === void 0 ? false : _b;
@@ -381,7 +371,8 @@ var Card = function (_a) {
381
371
  var width = cardSizeMapping(size);
382
372
  var categoryColour = colour ? usePlainClasses ? "cmp-card__content-category-wrapper__colour-".concat(colour) : getStyle$1("cmp-card__content-category-wrapper__colour-".concat(colour)) : "";
383
373
  var cardFooterColour = colour ? usePlainClasses ? "cmp-card__footer--color-".concat(colour) : getStyle$1("cmp-card__footer--color-".concat(colour)) : "";
384
- var contentImage = getImageUrl(imageUrl);
374
+ // Image placeholder fallback logic from ACAS-14821
375
+ var contentImage = !imageUrl ? placholderimg + PLACEHOLDER_INDICATOR : imageUrl;
385
376
  return /*#__PURE__*/React.createElement("div", {
386
377
  className: classnames(getClassName("cmp-card"), mode, width, className && (usePlainClasses ? className : getStyle$1(className)))
387
378
  }, /*#__PURE__*/React.createElement("a", {
@@ -391,7 +382,7 @@ var Card = function (_a) {
391
382
  }, /*#__PURE__*/React.createElement("div", {
392
383
  className: getClassName("cmp-card__content-wrapper")
393
384
  }, cardStyle !== "type-card-panel" && cardStyle !== "type-card-no-image" && /*#__PURE__*/React.createElement("div", {
394
- className: "".concat(getClassName("cmp-card__image-wrapper"), " ").concat(!imageUrl || placeholder ? getClassName("placeholderImage") : "")
385
+ className: "".concat(getClassName("cmp-card__image-wrapper"), " ").concat(isPlaceholderImg(contentImage) ? getClassName("placeholderImage") : "")
395
386
  }, /*#__PURE__*/React.createElement("picture", null, /*#__PURE__*/React.createElement("img", {
396
387
  src: contentImage,
397
388
  alt: imageAlt
@@ -430,7 +421,6 @@ var ProductCard = function (_a) {
430
421
  cardLink = _a.cardLink,
431
422
  cta = _a.cta,
432
423
  cardStyle = _a.cardStyle,
433
- placeholder = _a.placeholder,
434
424
  onClick = _a.onClick,
435
425
  _c = _a.usePlainClasses,
436
426
  usePlainClasses = _c === void 0 ? false : _c;
@@ -440,7 +430,8 @@ var ProductCard = function (_a) {
440
430
  };
441
431
  var width = cardSizeMapping(size);
442
432
  var mode = usePlainClasses ? "cmp-card--".concat(cardStyle) : getStyle$1("cmp-card--".concat(cardStyle));
443
- var productImage = getImageUrl(imageUrl);
433
+ // Image placeholder fallback logic from ACAS-14821
434
+ var productImage = !imageUrl || imageUrl === 'https://uk.my.edwardsvacuum.com?placeholder-storybook' ? placholderimg.src + PLACEHOLDER_INDICATOR : imageUrl;
444
435
  return /*#__PURE__*/React.createElement("div", {
445
436
  className: classnames(getClassName("cmp-card"), mode, width, className)
446
437
  }, /*#__PURE__*/React.createElement("a", {
@@ -455,7 +446,7 @@ var ProductCard = function (_a) {
455
446
  }, /*#__PURE__*/React.createElement("figure", null, /*#__PURE__*/React.createElement("img", {
456
447
  src: productImage,
457
448
  alt: imageAlt,
458
- className: !imageUrl || placeholder ? "placeholderImage" : undefined
449
+ className: isPlaceholderImg(productImage) ? "placeholderImage" : ''
459
450
  }))), /*#__PURE__*/React.createElement("div", {
460
451
  className: getClassName("cmp-card--type-card-product__meta")
461
452
  }, /*#__PURE__*/React.createElement("p", {
@@ -475,7 +466,6 @@ var ProductDetailsCard = function (_a) {
475
466
  var title = _a.title;
476
467
  _a.imageUrl;
477
468
  var imageAlt = _a.imageAlt;
478
- _a.placeholder;
479
469
  _a.onClick;
480
470
  var hit = _a.hit,
481
471
  facets = _a.facets,
@@ -612,7 +602,7 @@ var Button = function (_a) {
612
602
  }, props), label);
613
603
  };
614
604
 
615
- var PRODUCT_DETAILS = 'productDetails';
605
+ var PRODUCT_DETAILS = "productDetails";
616
606
  var DynamicHeading = function (_a) {
617
607
  var _b = _a.titleSize,
618
608
  titleSize = _b === void 0 ? "h2" : _b,
@@ -623,16 +613,16 @@ var DynamicHeading = function (_a) {
623
613
  };
624
614
  var getCallToActionProps = function (type, url) {
625
615
  var callType = type === null || type === void 0 ? void 0 : type.toLowerCase();
626
- var finalUrl = url || '';
627
- var target = '';
616
+ var finalUrl = url || "";
617
+ var target = "";
628
618
  switch (callType) {
629
- case 'external':
630
- target = '_blank';
619
+ case "external":
620
+ target = "_blank";
631
621
  break;
632
- case 'email':
622
+ case "email":
633
623
  finalUrl = "mailto:".concat(url);
634
624
  break;
635
- case 'phone':
625
+ case "phone":
636
626
  finalUrl = "tel:".concat(url);
637
627
  break;
638
628
  }
@@ -651,18 +641,17 @@ var AlgoliaDynamicSearch = function (_a, useScopedStyles, styles) {
651
641
  callToActionUrl = _a.callToActionUrl,
652
642
  callToActionTargetSelector = _a.callToActionTargetSelector,
653
643
  _c = _a.queryType,
654
- queryType = _c === void 0 ? 'unknown' : _c,
644
+ queryType = _c === void 0 ? "unknown" : _c,
655
645
  hits = _a.hits,
656
646
  hitCta = _a.hitCta,
657
647
  showProductPrice = _a.showProductPrice,
658
648
  query = _a.query,
659
649
  _d = _a.backgroundColour,
660
- backgroundColour = _d === void 0 ? '' : _d,
650
+ backgroundColour = _d === void 0 ? "" : _d,
661
651
  _e = _a.maxResults,
662
652
  maxResults = _e === void 0 ? 10 : _e,
663
653
  _f = _a.isLoading,
664
654
  isLoading = _f === void 0 ? false : _f,
665
- placeholder = _a.placeholder,
666
655
  analytics = _a.analytics,
667
656
  facets = _a.facets,
668
657
  innerComponents = _a.innerComponents;
@@ -685,12 +674,12 @@ var AlgoliaDynamicSearch = function (_a, useScopedStyles, styles) {
685
674
  var backgroundStyles = {
686
675
  "dark-grey": {
687
676
  buttonStyle: "outlineWhite",
688
- containerBackground: getModifierClass('hasStyleGreyBackground'),
677
+ containerBackground: getModifierClass("hasStyleGreyBackground"),
689
678
  textColour: "white"
690
679
  },
691
- "silver": {
680
+ silver: {
692
681
  buttonStyle: "primary",
693
- containerBackground: getModifierClass('hasStyleSilverGradientBackground'),
682
+ containerBackground: getModifierClass("hasStyleSilverGradientBackground"),
694
683
  textColour: "black"
695
684
  }
696
685
  };
@@ -703,53 +692,53 @@ var AlgoliaDynamicSearch = function (_a, useScopedStyles, styles) {
703
692
  if (!hits || hits.length === 0) {
704
693
  return null;
705
694
  }
706
- var baseClass = getClass('');
695
+ var baseClass = getClass("");
707
696
  // Memoize wrapper class names
708
697
  var wrapperClasses = React.useMemo(function () {
709
- return [baseClass, widgetStyleProps.containerBackground, isLoading ? getModifierClass('isLoading') : '', queryType === 'content' ? getModifierClass('isQueryContent') : ''].filter(Boolean).join(' ');
698
+ return [baseClass, widgetStyleProps.containerBackground, isLoading ? getModifierClass("isLoading") : "", queryType === "content" ? getModifierClass("isQueryContent") : ""].filter(Boolean).join(" ");
710
699
  }, [baseClass, widgetStyleProps.containerBackground, isLoading, queryType, getModifierClass]);
711
700
  return /*#__PURE__*/React.createElement("div", {
712
701
  className: wrapperClasses
713
702
  }, isLoading && /*#__PURE__*/React.createElement("div", {
714
- className: getClass('__placeholder')
703
+ className: getClass("__placeholder")
715
704
  }, /*#__PURE__*/React.createElement("div", {
716
- className: getClass('__placeholder__loading')
705
+ className: getClass("__placeholder__loading")
717
706
  })), /*#__PURE__*/React.createElement("div", {
718
- className: getClass('__container')
707
+ className: getClass("__container")
719
708
  }, queryType != PRODUCT_DETAILS && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
720
- className: getClass('__header')
709
+ className: getClass("__header")
721
710
  }, /*#__PURE__*/React.createElement("div", {
722
- className: getClass('__header__text')
711
+ className: getClass("__header__text")
723
712
  }, /*#__PURE__*/React.createElement(DynamicHeading, {
724
713
  titleSize: titleSize
725
714
  }, heading), /*#__PURE__*/React.createElement("p", null, subtext)), callToActionUrl && /*#__PURE__*/React.createElement("div", {
726
- className: getClass('__header__cta')
715
+ className: getClass("__header__cta")
727
716
  }, function () {
728
717
  var _a = getCallToActionProps(callToActionType, callToActionUrl),
729
718
  finalUrl = _a.finalUrl,
730
719
  target = _a.target;
731
- var isAnchor = !!callToActionTargetSelector || (callToActionType === null || callToActionType === void 0 ? void 0 : callToActionType.toLowerCase()) !== 'internal';
720
+ var isAnchor = !!callToActionTargetSelector || (callToActionType === null || callToActionType === void 0 ? void 0 : callToActionType.toLowerCase()) !== "internal";
732
721
  return /*#__PURE__*/React.createElement(Button$1, {
733
- element: isAnchor ? 'a' : 'button',
722
+ element: isAnchor ? "a" : "button",
734
723
  buttonStyle: widgetStyleProps === null || widgetStyleProps === void 0 ? void 0 : widgetStyleProps.buttonStyle,
735
724
  label: callToActionText,
736
725
  href: isAnchor ? finalUrl : undefined,
737
726
  target: target,
738
- rel: target === '_blank' ? 'noopener noreferrer' : undefined,
727
+ rel: target === "_blank" ? "noopener noreferrer" : undefined,
739
728
  "data-target-selector": callToActionTargetSelector,
740
729
  onClick: !isAnchor ? function () {
741
730
  if (finalUrl) {
742
- window.open(finalUrl, target || '_self', target === '_blank' ? 'noopener,noreferrer' : undefined);
731
+ window.open(finalUrl, target || "_self", target === "_blank" ? "noopener,noreferrer" : undefined);
743
732
  }
744
733
  } : undefined
745
734
  });
746
735
  }()))), /*#__PURE__*/React.createElement("div", {
747
- className: queryType == PRODUCT_DETAILS ? getClass('__cards__cardSingle') : getClass('__cards')
736
+ className: queryType == PRODUCT_DETAILS ? getClass("__cards__cardSingle") : getClass("__cards")
748
737
  }, hits.slice(0, maxResults).map(function (hit, index) {
749
738
  var Component = Card$1;
750
739
  var title = hit.title;
751
740
  var cardStyle = "";
752
- var imageUrl = hit.imageUrl || placeholder;
741
+ var imageUrl = hit.imageUrl;
753
742
  var hitUtm = new URLSearchParams({
754
743
  utm_source: "web",
755
744
  utm_medium: "alg",
@@ -793,7 +782,6 @@ var AlgoliaDynamicSearch = function (_a, useScopedStyles, styles) {
793
782
  className: cardClassName,
794
783
  title: title,
795
784
  imageUrl: imageUrl,
796
- placeholder: hit.image ? false : true,
797
785
  hit: hit,
798
786
  cta: hitCta,
799
787
  size: "",