@asantemedia-org/edwardsvacuum-design-system 1.6.57 → 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.
Binary file
package/dist/index.esm.js CHANGED
@@ -315,6 +315,9 @@ var AccordionSection = function (_a) {
315
315
  }, shouldRenderChildren ? children : null));
316
316
  };
317
317
 
318
+ var placholderimg = "3697809e28f9e0fe.png";
319
+
320
+ var PLACEHOLDER_INDICATOR = "?placeholder-storybook";
318
321
  // Utility function to retrieve correct SCSS module class names
319
322
  var getStyle$1 = function (className) {
320
323
  if (styles$2[className]) return styles$2[className];
@@ -336,22 +339,10 @@ var cardSizeMapping = function (size) {
336
339
  }
337
340
  return classSrting;
338
341
  };
339
- var getImageUrl = function (imageUrl) {
340
- if (imageUrl) {
341
- return imageUrl; // If an image URL is provided, use it.
342
- }
343
- try {
344
- // Try loading from local assets (works in Storybook)
345
- return require("../../../assets/edwards-webshop-placeholder.png").default.src;
346
- } catch (error) {
347
- // If that fails, load from node_modules (works in host app)
348
- try {
349
- return require("@asantemedia-org/edwardsvacuum-design-system/dist/assets/edwards-webshop-placeholder.png").default;
350
- } catch (error) {
351
- console.error("Placeholder image not found in either local assets or node_modules.", error);
352
- return ""; // Fallback empty string if no image is found
353
- }
354
- }
342
+ // Helper function to check if image is a placeholder (from ACAS-14821)
343
+ var isPlaceholderImg = function (imageUrl) {
344
+ console.log(imageUrl);
345
+ return !!imageUrl && imageUrl.indexOf(PLACEHOLDER_INDICATOR) > -1;
355
346
  };
356
347
  var Card = function (_a) {
357
348
  var contentCategoryLabel = _a.contentCategoryLabel,
@@ -367,7 +358,6 @@ var Card = function (_a) {
367
358
  cardLink = _a.cardLink,
368
359
  city = _a.city,
369
360
  country = _a.country,
370
- placeholder = _a.placeholder,
371
361
  onClick = _a.onClick,
372
362
  _b = _a.usePlainClasses,
373
363
  usePlainClasses = _b === void 0 ? false : _b;
@@ -379,7 +369,8 @@ var Card = function (_a) {
379
369
  var width = cardSizeMapping(size);
380
370
  var categoryColour = colour ? usePlainClasses ? "cmp-card__content-category-wrapper__colour-".concat(colour) : getStyle$1("cmp-card__content-category-wrapper__colour-".concat(colour)) : "";
381
371
  var cardFooterColour = colour ? usePlainClasses ? "cmp-card__footer--color-".concat(colour) : getStyle$1("cmp-card__footer--color-".concat(colour)) : "";
382
- var contentImage = getImageUrl(imageUrl);
372
+ // Image placeholder fallback logic from ACAS-14821
373
+ var contentImage = !imageUrl ? placholderimg + PLACEHOLDER_INDICATOR : imageUrl;
383
374
  return /*#__PURE__*/React.createElement("div", {
384
375
  className: classnames(getClassName("cmp-card"), mode, width, className && (usePlainClasses ? className : getStyle$1(className)))
385
376
  }, /*#__PURE__*/React.createElement("a", {
@@ -389,7 +380,7 @@ var Card = function (_a) {
389
380
  }, /*#__PURE__*/React.createElement("div", {
390
381
  className: getClassName("cmp-card__content-wrapper")
391
382
  }, cardStyle !== "type-card-panel" && cardStyle !== "type-card-no-image" && /*#__PURE__*/React.createElement("div", {
392
- className: "".concat(getClassName("cmp-card__image-wrapper"), " ").concat(!imageUrl || placeholder ? getClassName("placeholderImage") : "")
383
+ className: "".concat(getClassName("cmp-card__image-wrapper"), " ").concat(isPlaceholderImg(contentImage) ? getClassName("placeholderImage") : "")
393
384
  }, /*#__PURE__*/React.createElement("picture", null, /*#__PURE__*/React.createElement("img", {
394
385
  src: contentImage,
395
386
  alt: imageAlt
@@ -428,7 +419,6 @@ var ProductCard = function (_a) {
428
419
  cardLink = _a.cardLink,
429
420
  cta = _a.cta,
430
421
  cardStyle = _a.cardStyle,
431
- placeholder = _a.placeholder,
432
422
  onClick = _a.onClick,
433
423
  _c = _a.usePlainClasses,
434
424
  usePlainClasses = _c === void 0 ? false : _c;
@@ -438,7 +428,8 @@ var ProductCard = function (_a) {
438
428
  };
439
429
  var width = cardSizeMapping(size);
440
430
  var mode = usePlainClasses ? "cmp-card--".concat(cardStyle) : getStyle$1("cmp-card--".concat(cardStyle));
441
- var productImage = getImageUrl(imageUrl);
431
+ // Image placeholder fallback logic from ACAS-14821
432
+ var productImage = !imageUrl || imageUrl === 'https://uk.my.edwardsvacuum.com?placeholder-storybook' ? placholderimg.src + PLACEHOLDER_INDICATOR : imageUrl;
442
433
  return /*#__PURE__*/React.createElement("div", {
443
434
  className: classnames(getClassName("cmp-card"), mode, width, className)
444
435
  }, /*#__PURE__*/React.createElement("a", {
@@ -453,7 +444,7 @@ var ProductCard = function (_a) {
453
444
  }, /*#__PURE__*/React.createElement("figure", null, /*#__PURE__*/React.createElement("img", {
454
445
  src: productImage,
455
446
  alt: imageAlt,
456
- className: !imageUrl || placeholder ? "placeholderImage" : undefined
447
+ className: isPlaceholderImg(productImage) ? "placeholderImage" : ''
457
448
  }))), /*#__PURE__*/React.createElement("div", {
458
449
  className: getClassName("cmp-card--type-card-product__meta")
459
450
  }, /*#__PURE__*/React.createElement("p", {
@@ -473,7 +464,6 @@ var ProductDetailsCard = function (_a) {
473
464
  var title = _a.title;
474
465
  _a.imageUrl;
475
466
  var imageAlt = _a.imageAlt;
476
- _a.placeholder;
477
467
  _a.onClick;
478
468
  var hit = _a.hit,
479
469
  facets = _a.facets,
@@ -610,7 +600,7 @@ var Button = function (_a) {
610
600
  }, props), label);
611
601
  };
612
602
 
613
- var PRODUCT_DETAILS = 'productDetails';
603
+ var PRODUCT_DETAILS = "productDetails";
614
604
  var DynamicHeading = function (_a) {
615
605
  var _b = _a.titleSize,
616
606
  titleSize = _b === void 0 ? "h2" : _b,
@@ -621,16 +611,16 @@ var DynamicHeading = function (_a) {
621
611
  };
622
612
  var getCallToActionProps = function (type, url) {
623
613
  var callType = type === null || type === void 0 ? void 0 : type.toLowerCase();
624
- var finalUrl = url || '';
625
- var target = '';
614
+ var finalUrl = url || "";
615
+ var target = "";
626
616
  switch (callType) {
627
- case 'external':
628
- target = '_blank';
617
+ case "external":
618
+ target = "_blank";
629
619
  break;
630
- case 'email':
620
+ case "email":
631
621
  finalUrl = "mailto:".concat(url);
632
622
  break;
633
- case 'phone':
623
+ case "phone":
634
624
  finalUrl = "tel:".concat(url);
635
625
  break;
636
626
  }
@@ -649,18 +639,17 @@ var AlgoliaDynamicSearch = function (_a, useScopedStyles, styles) {
649
639
  callToActionUrl = _a.callToActionUrl,
650
640
  callToActionTargetSelector = _a.callToActionTargetSelector,
651
641
  _c = _a.queryType,
652
- queryType = _c === void 0 ? 'unknown' : _c,
642
+ queryType = _c === void 0 ? "unknown" : _c,
653
643
  hits = _a.hits,
654
644
  hitCta = _a.hitCta,
655
645
  showProductPrice = _a.showProductPrice,
656
646
  query = _a.query,
657
647
  _d = _a.backgroundColour,
658
- backgroundColour = _d === void 0 ? '' : _d,
648
+ backgroundColour = _d === void 0 ? "" : _d,
659
649
  _e = _a.maxResults,
660
650
  maxResults = _e === void 0 ? 10 : _e,
661
651
  _f = _a.isLoading,
662
652
  isLoading = _f === void 0 ? false : _f,
663
- placeholder = _a.placeholder,
664
653
  analytics = _a.analytics,
665
654
  facets = _a.facets,
666
655
  innerComponents = _a.innerComponents;
@@ -683,12 +672,12 @@ var AlgoliaDynamicSearch = function (_a, useScopedStyles, styles) {
683
672
  var backgroundStyles = {
684
673
  "dark-grey": {
685
674
  buttonStyle: "outlineWhite",
686
- containerBackground: getModifierClass('hasStyleGreyBackground'),
675
+ containerBackground: getModifierClass("hasStyleGreyBackground"),
687
676
  textColour: "white"
688
677
  },
689
- "silver": {
678
+ silver: {
690
679
  buttonStyle: "primary",
691
- containerBackground: getModifierClass('hasStyleSilverGradientBackground'),
680
+ containerBackground: getModifierClass("hasStyleSilverGradientBackground"),
692
681
  textColour: "black"
693
682
  }
694
683
  };
@@ -701,53 +690,53 @@ var AlgoliaDynamicSearch = function (_a, useScopedStyles, styles) {
701
690
  if (!hits || hits.length === 0) {
702
691
  return null;
703
692
  }
704
- var baseClass = getClass('');
693
+ var baseClass = getClass("");
705
694
  // Memoize wrapper class names
706
695
  var wrapperClasses = useMemo(function () {
707
- return [baseClass, widgetStyleProps.containerBackground, isLoading ? getModifierClass('isLoading') : '', queryType === 'content' ? getModifierClass('isQueryContent') : ''].filter(Boolean).join(' ');
696
+ return [baseClass, widgetStyleProps.containerBackground, isLoading ? getModifierClass("isLoading") : "", queryType === "content" ? getModifierClass("isQueryContent") : ""].filter(Boolean).join(" ");
708
697
  }, [baseClass, widgetStyleProps.containerBackground, isLoading, queryType, getModifierClass]);
709
698
  return /*#__PURE__*/React.createElement("div", {
710
699
  className: wrapperClasses
711
700
  }, isLoading && /*#__PURE__*/React.createElement("div", {
712
- className: getClass('__placeholder')
701
+ className: getClass("__placeholder")
713
702
  }, /*#__PURE__*/React.createElement("div", {
714
- className: getClass('__placeholder__loading')
703
+ className: getClass("__placeholder__loading")
715
704
  })), /*#__PURE__*/React.createElement("div", {
716
- className: getClass('__container')
705
+ className: getClass("__container")
717
706
  }, queryType != PRODUCT_DETAILS && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
718
- className: getClass('__header')
707
+ className: getClass("__header")
719
708
  }, /*#__PURE__*/React.createElement("div", {
720
- className: getClass('__header__text')
709
+ className: getClass("__header__text")
721
710
  }, /*#__PURE__*/React.createElement(DynamicHeading, {
722
711
  titleSize: titleSize
723
712
  }, heading), /*#__PURE__*/React.createElement("p", null, subtext)), callToActionUrl && /*#__PURE__*/React.createElement("div", {
724
- className: getClass('__header__cta')
713
+ className: getClass("__header__cta")
725
714
  }, function () {
726
715
  var _a = getCallToActionProps(callToActionType, callToActionUrl),
727
716
  finalUrl = _a.finalUrl,
728
717
  target = _a.target;
729
- var isAnchor = !!callToActionTargetSelector || (callToActionType === null || callToActionType === void 0 ? void 0 : callToActionType.toLowerCase()) !== 'internal';
718
+ var isAnchor = !!callToActionTargetSelector || (callToActionType === null || callToActionType === void 0 ? void 0 : callToActionType.toLowerCase()) !== "internal";
730
719
  return /*#__PURE__*/React.createElement(Button$1, {
731
- element: isAnchor ? 'a' : 'button',
720
+ element: isAnchor ? "a" : "button",
732
721
  buttonStyle: widgetStyleProps === null || widgetStyleProps === void 0 ? void 0 : widgetStyleProps.buttonStyle,
733
722
  label: callToActionText,
734
723
  href: isAnchor ? finalUrl : undefined,
735
724
  target: target,
736
- rel: target === '_blank' ? 'noopener noreferrer' : undefined,
725
+ rel: target === "_blank" ? "noopener noreferrer" : undefined,
737
726
  "data-target-selector": callToActionTargetSelector,
738
727
  onClick: !isAnchor ? function () {
739
728
  if (finalUrl) {
740
- window.open(finalUrl, target || '_self', target === '_blank' ? 'noopener,noreferrer' : undefined);
729
+ window.open(finalUrl, target || "_self", target === "_blank" ? "noopener,noreferrer" : undefined);
741
730
  }
742
731
  } : undefined
743
732
  });
744
733
  }()))), /*#__PURE__*/React.createElement("div", {
745
- className: queryType == PRODUCT_DETAILS ? getClass('__cards__cardSingle') : getClass('__cards')
734
+ className: queryType == PRODUCT_DETAILS ? getClass("__cards__cardSingle") : getClass("__cards")
746
735
  }, hits.slice(0, maxResults).map(function (hit, index) {
747
736
  var Component = Card$1;
748
737
  var title = hit.title;
749
738
  var cardStyle = "";
750
- var imageUrl = hit.imageUrl || placeholder;
739
+ var imageUrl = hit.imageUrl;
751
740
  var hitUtm = new URLSearchParams({
752
741
  utm_source: "web",
753
742
  utm_medium: "alg",
@@ -791,7 +780,6 @@ var AlgoliaDynamicSearch = function (_a, useScopedStyles, styles) {
791
780
  className: cardClassName,
792
781
  title: title,
793
782
  imageUrl: imageUrl,
794
- placeholder: hit.image ? false : true,
795
783
  hit: hit,
796
784
  cta: hitCta,
797
785
  size: "",
@@ -1026,6 +1014,7 @@ var defaultQrFormTranslations = {
1026
1014
  label_city: "City",
1027
1015
  label_postcodeOrZip: "Postcode or ZIP",
1028
1016
  consent_acceptPolicy: "I accept the policy",
1017
+ consent_viewPolicy: "View Policy",
1029
1018
  consent_default: "Consent",
1030
1019
  consent_requiredMessage: "Please acknowledge this consent"
1031
1020
  };
@@ -1059,7 +1048,11 @@ var QrForm = function (props) {
1059
1048
  return {
1060
1049
  type: consent.type === "info" ? "info" : "checkbox",
1061
1050
  name: "consent_".concat(index + 1),
1062
- label: consent.policyText ? consent.policyText : consent.policyLink ? "".concat(i18n.consent_acceptPolicy, ": ").concat(consent.policyLink) : "".concat(i18n.consent_default).concat(index + 1),
1051
+ label: consent.policyLink ? /*#__PURE__*/React.createElement("span", null, consent.policyText || i18n.consent_acceptPolicy, " ", /*#__PURE__*/React.createElement("a", {
1052
+ href: consent.policyLink,
1053
+ target: "_blank",
1054
+ rel: "noopener noreferrer"
1055
+ }, i18n.consent_viewPolicy || "View Policy")) : consent.policyText ? consent.policyText : "".concat(i18n.consent_default).concat(index + 1),
1063
1056
  value: "true",
1064
1057
  required: !!consent.policyMandatory,
1065
1058
  errorMessage: consent.policyMandatory ? i18n.consent_requiredMessage : ""