@asantemedia-org/edwardsvacuum-design-system 1.6.58 → 1.6.63
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/assets/3697809e28f9e0fe.png +0 -0
- package/dist/index.css +67 -1
- package/dist/index.esm.css +67 -1
- package/dist/index.esm.js +211 -61
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +211 -61
- package/dist/index.js.map +1 -1
- package/dist/index.scss +67 -1
- package/dist/stories/components/Card/card.d.ts +3 -3
- package/dist/stories/components/FacetUnitSelector/FacetUnitSelector.d.ts +8 -0
- package/dist/stories/components/FacetUnitSelector/index.d.ts +1 -0
- package/dist/stories/experiences/Algolia-dynamic-search/algolia-dynamic-search-base.d.ts +3 -3
- package/dist/stories/experiences/Algolia-dynamic-search/algolia-dynamic-search.types.d.ts +0 -1
- package/dist/stories/experiences/QRFormJourney/Friendly-captcha/FriendlyCaptcha.d.ts +10 -0
- package/dist/stories/experiences/QRFormJourney/Qr-form/Qr-form.d.ts +2 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/helpers/formatFacetValue.d.ts +26 -0
- package/package.json +3 -2
package/dist/index.esm.js
CHANGED
|
@@ -3,6 +3,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
|
3
3
|
import { faChevronDown, faChevronRight, faArrowRight } from '@fortawesome/pro-solid-svg-icons';
|
|
4
4
|
import { v4 } from 'uuid';
|
|
5
5
|
import { PhoneInput } from 'react-international-phone';
|
|
6
|
+
import { WidgetInstance } from 'friendly-challenge';
|
|
6
7
|
|
|
7
8
|
/******************************************************************************
|
|
8
9
|
Copyright (c) Microsoft Corporation.
|
|
@@ -163,7 +164,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
163
164
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
164
165
|
};
|
|
165
166
|
|
|
166
|
-
var styles$
|
|
167
|
+
var styles$3 = {"cmp-card":"card-module__cmp-card___45x9k","cmp-card__link":"card-module__cmp-card__link___OdszC","cmp-card__content-wrapper":"card-module__cmp-card__content-wrapper___gh335","cmp-card__content-category-wrapper":"card-module__cmp-card__content-category-wrapper___2vOjQ","cmp-card__content-category-wrapper__colour-edwards-red":"card-module__cmp-card__content-category-wrapper__colour-edwards-red___DYmt8","cmp-card__city-country":"card-module__cmp-card__city-country___dI13-","cmp-card__image-wrapper":"card-module__cmp-card__image-wrapper___IhPHw","placeholderImage":"card-module__placeholderImage___AXOh5","cmp-card--type-card-overlay":"card-module__cmp-card--type-card-overlay___344ul","cmp-card__title-wrapper":"card-module__cmp-card__title-wrapper___XHfZg","cmp-card__date":"card-module__cmp-card__date___7w-Ka","cmp-card__title":"card-module__cmp-card__title___cFKG8","cmp-card__footer":"card-module__cmp-card__footer___xcNXM","cmp-card--type-card-no-image":"card-module__cmp-card--type-card-no-image___G75ye","cmp-card--type-card-product":"card-module__cmp-card--type-card-product___IfqTr","cmp-card--type-card-product__wrapper":"card-module__cmp-card--type-card-product__wrapper___kulaR","cmp-card--type-card-product-no-image__wrapper":"card-module__cmp-card--type-card-product-no-image__wrapper___ot5Xe","cmp-card--type-card-product__image":"card-module__cmp-card--type-card-product__image___Bkb0A","cmp-card--type-card-product__meta":"card-module__cmp-card--type-card-product__meta___a7Tzc","cmp-card--type-card-product__title":"card-module__cmp-card--type-card-product__title___0JMQp","cmp-card--type-card-product__cta":"card-module__cmp-card--type-card-product__cta___qDSNo","cmp-card--type-card-product__prices":"card-module__cmp-card--type-card-product__prices___KWPS7","cmp-card--type-card-product__prices--login":"card-module__cmp-card--type-card-product__prices--login___gMhTo","show_prices":"card-module__show_prices___gjVhn","cmp-card--type-card-panel":"card-module__cmp-card--type-card-panel___95jYv","cmp-card__footer--color-malachite":"card-module__cmp-card__footer--color-malachite___jEnvy","cmp-card__footer--color-amethyst":"card-module__cmp-card__footer--color-amethyst___N55PL","cmp-card__footer--color-smokey-quartz-bright":"card-module__cmp-card__footer--color-smokey-quartz-bright___1mqyn","cmp-card__footer--color-olivine-bright":"card-module__cmp-card__footer--color-olivine-bright___O2urI","cmp-card--type-careers":"card-module__cmp-card--type-careers___Wqzcf","cmp-card--type-product_details":"card-module__cmp-card--type-product_details___vsNOc","cmp-card--type-product_details__product-info":"card-module__cmp-card--type-product_details__product-info___5L009","cmp-card--type-product_details__header":"card-module__cmp-card--type-product_details__header___Vb3-U","cmp-card--type-product_details__header__title":"card-module__cmp-card--type-product_details__header__title___4KSqX","cmp-card--type-product_details__header__product-code":"card-module__cmp-card--type-product_details__header__product-code___zf7yq","cmp-card--type-product_details__header__product-image":"card-module__cmp-card--type-product_details__header__product-image___Kyy35","cmp-card--type-product_details__spares-list":"card-module__cmp-card--type-product_details__spares-list___VQ31R","folding-spares-list":"card-module__folding-spares-list___ls5-n","folding-specification-list":"card-module__folding-specification-list___tIfSl","facet-value-list":"card-module__facet-value-list___HtnIT","facet-value-unit":"card-module__facet-value-unit___b722z","folding-specification-holder":"card-module__folding-specification-holder___OtcQQ","folding-spares-holder":"card-module__folding-spares-holder___OhMpO"};
|
|
167
168
|
|
|
168
169
|
function getDefaultExportFromCjs (x) {
|
|
169
170
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
@@ -315,14 +316,114 @@ var AccordionSection = function (_a) {
|
|
|
315
316
|
}, shouldRenderChildren ? children : null));
|
|
316
317
|
};
|
|
317
318
|
|
|
319
|
+
var placholderimg = "3697809e28f9e0fe.png";
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Parses delimited facet values into a structured format
|
|
323
|
+
*
|
|
324
|
+
* Input format: "pressure_psi|2.90#pressure_inHg|5.91#pressure_bar|0.200"
|
|
325
|
+
* Where:
|
|
326
|
+
* - `#` separates different unit entries
|
|
327
|
+
* - `|` separates the unit key from the value
|
|
328
|
+
*/
|
|
329
|
+
/**
|
|
330
|
+
* Checks if a value is in the delimited facet format
|
|
331
|
+
*/
|
|
332
|
+
var isDelimitedFacetValue = function (value) {
|
|
333
|
+
if (typeof value !== 'string') return false;
|
|
334
|
+
// Must contain both # (entry separator) and | (key-value separator)
|
|
335
|
+
return value.includes('#') && value.includes('|');
|
|
336
|
+
};
|
|
337
|
+
/**
|
|
338
|
+
* Extracts the display unit from a raw key
|
|
339
|
+
* e.g., "pressure_psi" -> "psi"
|
|
340
|
+
* e.g., "volumeFlowRate_l/s" -> "l/s"
|
|
341
|
+
* e.g., "power_kW" -> "kW"
|
|
342
|
+
*/
|
|
343
|
+
var extractUnit = function (rawKey) {
|
|
344
|
+
var parts = rawKey.split('_');
|
|
345
|
+
if (parts.length > 1) {
|
|
346
|
+
// Return everything after the first underscore (handles units like "m/³h")
|
|
347
|
+
return parts.slice(1).join('_');
|
|
348
|
+
}
|
|
349
|
+
return rawKey;
|
|
350
|
+
};
|
|
351
|
+
/**
|
|
352
|
+
* Parses a delimited facet string into an array of entries
|
|
353
|
+
*/
|
|
354
|
+
var parseDelimitedFacetValue = function (value) {
|
|
355
|
+
if (!isDelimitedFacetValue(value)) {
|
|
356
|
+
return [];
|
|
357
|
+
}
|
|
358
|
+
var entries = value.split('#');
|
|
359
|
+
return entries.map(function (entry) {
|
|
360
|
+
var _a = entry.split('|'),
|
|
361
|
+
rawKey = _a[0],
|
|
362
|
+
val = _a[1];
|
|
363
|
+
if (!rawKey || val === undefined) return null;
|
|
364
|
+
return {
|
|
365
|
+
unit: extractUnit(rawKey),
|
|
366
|
+
value: val,
|
|
367
|
+
rawKey: rawKey
|
|
368
|
+
};
|
|
369
|
+
}).filter(function (entry) {
|
|
370
|
+
return entry !== null;
|
|
371
|
+
});
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
var styles$2 = {"facet-unit-selector":"FacetUnitSelector-module__facet-unit-selector___1Zdhx","facet-unit-selector__value":"FacetUnitSelector-module__facet-unit-selector__value___E-LAN","facet-unit-selector__unit":"FacetUnitSelector-module__facet-unit-selector__unit___TxIk7","facet-unit-selector__dropdown":"FacetUnitSelector-module__facet-unit-selector__dropdown___Xj3dK"};
|
|
375
|
+
|
|
318
376
|
// Utility function to retrieve correct SCSS module class names
|
|
319
|
-
var getStyle$
|
|
377
|
+
var getStyle$2 = function (className) {
|
|
320
378
|
if (styles$2[className]) return styles$2[className];
|
|
321
379
|
var nestedMatch = Object.keys(styles$2).find(function (key) {
|
|
322
380
|
return key.includes(className);
|
|
323
381
|
});
|
|
324
382
|
return nestedMatch ? styles$2[nestedMatch] : "";
|
|
325
383
|
};
|
|
384
|
+
var FacetUnitSelector = function (_a) {
|
|
385
|
+
var entries = _a.entries,
|
|
386
|
+
_b = _a.usePlainClasses,
|
|
387
|
+
usePlainClasses = _b === void 0 ? false : _b;
|
|
388
|
+
var _c = useState(0),
|
|
389
|
+
selectedIndex = _c[0],
|
|
390
|
+
setSelectedIndex = _c[1];
|
|
391
|
+
var getClassName = function (name) {
|
|
392
|
+
return usePlainClasses ? name : getStyle$2(name);
|
|
393
|
+
};
|
|
394
|
+
if (!entries || entries.length === 0) return null;
|
|
395
|
+
var selectedEntry = entries[selectedIndex];
|
|
396
|
+
var handleUnitChange = function (e) {
|
|
397
|
+
setSelectedIndex(Number(e.target.value));
|
|
398
|
+
};
|
|
399
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
400
|
+
className: getClassName("facet-unit-selector")
|
|
401
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
402
|
+
className: getClassName("facet-unit-selector__value")
|
|
403
|
+
}, selectedEntry.value), entries.length > 1 ? /*#__PURE__*/React.createElement("select", {
|
|
404
|
+
className: getClassName("facet-unit-selector__dropdown"),
|
|
405
|
+
value: selectedIndex,
|
|
406
|
+
onChange: handleUnitChange,
|
|
407
|
+
"aria-label": "Select unit"
|
|
408
|
+
}, entries.map(function (entry, index) {
|
|
409
|
+
return /*#__PURE__*/React.createElement("option", {
|
|
410
|
+
key: entry.rawKey,
|
|
411
|
+
value: index
|
|
412
|
+
}, entry.unit);
|
|
413
|
+
})) : /*#__PURE__*/React.createElement("span", {
|
|
414
|
+
className: getClassName("facet-unit-selector__unit")
|
|
415
|
+
}, selectedEntry.unit));
|
|
416
|
+
};
|
|
417
|
+
|
|
418
|
+
var PLACEHOLDER_INDICATOR = "?placeholder-storybook";
|
|
419
|
+
// Utility function to retrieve correct SCSS module class names
|
|
420
|
+
var getStyle$1 = function (className) {
|
|
421
|
+
if (styles$3[className]) return styles$3[className];
|
|
422
|
+
var nestedMatch = Object.keys(styles$3).find(function (key) {
|
|
423
|
+
return key.includes(className);
|
|
424
|
+
});
|
|
425
|
+
return nestedMatch ? styles$3[nestedMatch] : "";
|
|
426
|
+
};
|
|
326
427
|
var cardSizeMapping = function (size) {
|
|
327
428
|
var classSrting;
|
|
328
429
|
if (size === "small") {
|
|
@@ -336,22 +437,10 @@ var cardSizeMapping = function (size) {
|
|
|
336
437
|
}
|
|
337
438
|
return classSrting;
|
|
338
439
|
};
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
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
|
-
}
|
|
440
|
+
// Helper function to check if image is a placeholder (from ACAS-14821)
|
|
441
|
+
var isPlaceholderImg = function (imageUrl) {
|
|
442
|
+
console.log(imageUrl);
|
|
443
|
+
return !!imageUrl && imageUrl.indexOf(PLACEHOLDER_INDICATOR) > -1;
|
|
355
444
|
};
|
|
356
445
|
var Card = function (_a) {
|
|
357
446
|
var contentCategoryLabel = _a.contentCategoryLabel,
|
|
@@ -367,7 +456,6 @@ var Card = function (_a) {
|
|
|
367
456
|
cardLink = _a.cardLink,
|
|
368
457
|
city = _a.city,
|
|
369
458
|
country = _a.country,
|
|
370
|
-
placeholder = _a.placeholder,
|
|
371
459
|
onClick = _a.onClick,
|
|
372
460
|
_b = _a.usePlainClasses,
|
|
373
461
|
usePlainClasses = _b === void 0 ? false : _b;
|
|
@@ -379,7 +467,8 @@ var Card = function (_a) {
|
|
|
379
467
|
var width = cardSizeMapping(size);
|
|
380
468
|
var categoryColour = colour ? usePlainClasses ? "cmp-card__content-category-wrapper__colour-".concat(colour) : getStyle$1("cmp-card__content-category-wrapper__colour-".concat(colour)) : "";
|
|
381
469
|
var cardFooterColour = colour ? usePlainClasses ? "cmp-card__footer--color-".concat(colour) : getStyle$1("cmp-card__footer--color-".concat(colour)) : "";
|
|
382
|
-
|
|
470
|
+
// Image placeholder fallback logic from ACAS-14821
|
|
471
|
+
var contentImage = !imageUrl ? placholderimg + PLACEHOLDER_INDICATOR : imageUrl;
|
|
383
472
|
return /*#__PURE__*/React.createElement("div", {
|
|
384
473
|
className: classnames(getClassName("cmp-card"), mode, width, className && (usePlainClasses ? className : getStyle$1(className)))
|
|
385
474
|
}, /*#__PURE__*/React.createElement("a", {
|
|
@@ -389,7 +478,7 @@ var Card = function (_a) {
|
|
|
389
478
|
}, /*#__PURE__*/React.createElement("div", {
|
|
390
479
|
className: getClassName("cmp-card__content-wrapper")
|
|
391
480
|
}, cardStyle !== "type-card-panel" && cardStyle !== "type-card-no-image" && /*#__PURE__*/React.createElement("div", {
|
|
392
|
-
className: "".concat(getClassName("cmp-card__image-wrapper"), " ").concat(
|
|
481
|
+
className: "".concat(getClassName("cmp-card__image-wrapper"), " ").concat(isPlaceholderImg(contentImage) ? getClassName("placeholderImage") : "")
|
|
393
482
|
}, /*#__PURE__*/React.createElement("picture", null, /*#__PURE__*/React.createElement("img", {
|
|
394
483
|
src: contentImage,
|
|
395
484
|
alt: imageAlt
|
|
@@ -428,7 +517,6 @@ var ProductCard = function (_a) {
|
|
|
428
517
|
cardLink = _a.cardLink,
|
|
429
518
|
cta = _a.cta,
|
|
430
519
|
cardStyle = _a.cardStyle,
|
|
431
|
-
placeholder = _a.placeholder,
|
|
432
520
|
onClick = _a.onClick,
|
|
433
521
|
_c = _a.usePlainClasses,
|
|
434
522
|
usePlainClasses = _c === void 0 ? false : _c;
|
|
@@ -438,7 +526,8 @@ var ProductCard = function (_a) {
|
|
|
438
526
|
};
|
|
439
527
|
var width = cardSizeMapping(size);
|
|
440
528
|
var mode = usePlainClasses ? "cmp-card--".concat(cardStyle) : getStyle$1("cmp-card--".concat(cardStyle));
|
|
441
|
-
|
|
529
|
+
// Image placeholder fallback logic from ACAS-14821
|
|
530
|
+
var productImage = !imageUrl || imageUrl === 'https://uk.my.edwardsvacuum.com?placeholder-storybook' ? placholderimg.src + PLACEHOLDER_INDICATOR : imageUrl;
|
|
442
531
|
return /*#__PURE__*/React.createElement("div", {
|
|
443
532
|
className: classnames(getClassName("cmp-card"), mode, width, className)
|
|
444
533
|
}, /*#__PURE__*/React.createElement("a", {
|
|
@@ -453,7 +542,7 @@ var ProductCard = function (_a) {
|
|
|
453
542
|
}, /*#__PURE__*/React.createElement("figure", null, /*#__PURE__*/React.createElement("img", {
|
|
454
543
|
src: productImage,
|
|
455
544
|
alt: imageAlt,
|
|
456
|
-
className:
|
|
545
|
+
className: isPlaceholderImg(productImage) ? "placeholderImage" : ''
|
|
457
546
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
458
547
|
className: getClassName("cmp-card--type-card-product__meta")
|
|
459
548
|
}, /*#__PURE__*/React.createElement("p", {
|
|
@@ -473,7 +562,6 @@ var ProductDetailsCard = function (_a) {
|
|
|
473
562
|
var title = _a.title;
|
|
474
563
|
_a.imageUrl;
|
|
475
564
|
var imageAlt = _a.imageAlt;
|
|
476
|
-
_a.placeholder;
|
|
477
565
|
_a.onClick;
|
|
478
566
|
var hit = _a.hit,
|
|
479
567
|
facets = _a.facets,
|
|
@@ -537,13 +625,20 @@ var ProductDetailsCard = function (_a) {
|
|
|
537
625
|
}, /*#__PURE__*/React.createElement("ul", {
|
|
538
626
|
className: getClassName("folding-specification-list")
|
|
539
627
|
}, facets && facets.map(function (facet) {
|
|
540
|
-
|
|
628
|
+
var facetValue = hit[facet.name];
|
|
629
|
+
if (!facetValue) return null;
|
|
630
|
+
// Check if value is in delimited format (e.g., "pressure_psi|2.90#pressure_bar|0.200")
|
|
631
|
+
var isDelimited = isDelimitedFacetValue(facetValue);
|
|
632
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
541
633
|
key: facet.name
|
|
542
634
|
}, /*#__PURE__*/React.createElement("strong", null, facet.label), /*#__PURE__*/React.createElement("br", null), facet.returnsHTML ? /*#__PURE__*/React.createElement("span", {
|
|
543
635
|
dangerouslySetInnerHTML: {
|
|
544
|
-
__html:
|
|
636
|
+
__html: facetValue
|
|
545
637
|
}
|
|
546
|
-
}) :
|
|
638
|
+
}) : isDelimited ? /*#__PURE__*/React.createElement(FacetUnitSelector, {
|
|
639
|
+
entries: parseDelimitedFacetValue(facetValue),
|
|
640
|
+
usePlainClasses: usePlainClasses
|
|
641
|
+
}) : facetValue);
|
|
547
642
|
})))), /*#__PURE__*/React.createElement("div", {
|
|
548
643
|
className: getClassName("cmp-card--type-product_details__spares-list")
|
|
549
644
|
}, (hit === null || hit === void 0 ? void 0 : hit.spares) && hit.spares.length > 0 && /*#__PURE__*/React.createElement(AccordionSection, {
|
|
@@ -610,7 +705,7 @@ var Button = function (_a) {
|
|
|
610
705
|
}, props), label);
|
|
611
706
|
};
|
|
612
707
|
|
|
613
|
-
var PRODUCT_DETAILS =
|
|
708
|
+
var PRODUCT_DETAILS = "productDetails";
|
|
614
709
|
var DynamicHeading = function (_a) {
|
|
615
710
|
var _b = _a.titleSize,
|
|
616
711
|
titleSize = _b === void 0 ? "h2" : _b,
|
|
@@ -621,16 +716,16 @@ var DynamicHeading = function (_a) {
|
|
|
621
716
|
};
|
|
622
717
|
var getCallToActionProps = function (type, url) {
|
|
623
718
|
var callType = type === null || type === void 0 ? void 0 : type.toLowerCase();
|
|
624
|
-
var finalUrl = url ||
|
|
625
|
-
var target =
|
|
719
|
+
var finalUrl = url || "";
|
|
720
|
+
var target = "";
|
|
626
721
|
switch (callType) {
|
|
627
|
-
case
|
|
628
|
-
target =
|
|
722
|
+
case "external":
|
|
723
|
+
target = "_blank";
|
|
629
724
|
break;
|
|
630
|
-
case
|
|
725
|
+
case "email":
|
|
631
726
|
finalUrl = "mailto:".concat(url);
|
|
632
727
|
break;
|
|
633
|
-
case
|
|
728
|
+
case "phone":
|
|
634
729
|
finalUrl = "tel:".concat(url);
|
|
635
730
|
break;
|
|
636
731
|
}
|
|
@@ -649,18 +744,17 @@ var AlgoliaDynamicSearch = function (_a, useScopedStyles, styles) {
|
|
|
649
744
|
callToActionUrl = _a.callToActionUrl,
|
|
650
745
|
callToActionTargetSelector = _a.callToActionTargetSelector,
|
|
651
746
|
_c = _a.queryType,
|
|
652
|
-
queryType = _c === void 0 ?
|
|
747
|
+
queryType = _c === void 0 ? "unknown" : _c,
|
|
653
748
|
hits = _a.hits,
|
|
654
749
|
hitCta = _a.hitCta,
|
|
655
750
|
showProductPrice = _a.showProductPrice,
|
|
656
751
|
query = _a.query,
|
|
657
752
|
_d = _a.backgroundColour,
|
|
658
|
-
backgroundColour = _d === void 0 ?
|
|
753
|
+
backgroundColour = _d === void 0 ? "" : _d,
|
|
659
754
|
_e = _a.maxResults,
|
|
660
755
|
maxResults = _e === void 0 ? 10 : _e,
|
|
661
756
|
_f = _a.isLoading,
|
|
662
757
|
isLoading = _f === void 0 ? false : _f,
|
|
663
|
-
placeholder = _a.placeholder,
|
|
664
758
|
analytics = _a.analytics,
|
|
665
759
|
facets = _a.facets,
|
|
666
760
|
innerComponents = _a.innerComponents;
|
|
@@ -683,12 +777,12 @@ var AlgoliaDynamicSearch = function (_a, useScopedStyles, styles) {
|
|
|
683
777
|
var backgroundStyles = {
|
|
684
778
|
"dark-grey": {
|
|
685
779
|
buttonStyle: "outlineWhite",
|
|
686
|
-
containerBackground: getModifierClass(
|
|
780
|
+
containerBackground: getModifierClass("hasStyleGreyBackground"),
|
|
687
781
|
textColour: "white"
|
|
688
782
|
},
|
|
689
|
-
|
|
783
|
+
silver: {
|
|
690
784
|
buttonStyle: "primary",
|
|
691
|
-
containerBackground: getModifierClass(
|
|
785
|
+
containerBackground: getModifierClass("hasStyleSilverGradientBackground"),
|
|
692
786
|
textColour: "black"
|
|
693
787
|
}
|
|
694
788
|
};
|
|
@@ -701,53 +795,53 @@ var AlgoliaDynamicSearch = function (_a, useScopedStyles, styles) {
|
|
|
701
795
|
if (!hits || hits.length === 0) {
|
|
702
796
|
return null;
|
|
703
797
|
}
|
|
704
|
-
var baseClass = getClass(
|
|
798
|
+
var baseClass = getClass("");
|
|
705
799
|
// Memoize wrapper class names
|
|
706
800
|
var wrapperClasses = useMemo(function () {
|
|
707
|
-
return [baseClass, widgetStyleProps.containerBackground, isLoading ? getModifierClass(
|
|
801
|
+
return [baseClass, widgetStyleProps.containerBackground, isLoading ? getModifierClass("isLoading") : "", queryType === "content" ? getModifierClass("isQueryContent") : ""].filter(Boolean).join(" ");
|
|
708
802
|
}, [baseClass, widgetStyleProps.containerBackground, isLoading, queryType, getModifierClass]);
|
|
709
803
|
return /*#__PURE__*/React.createElement("div", {
|
|
710
804
|
className: wrapperClasses
|
|
711
805
|
}, isLoading && /*#__PURE__*/React.createElement("div", {
|
|
712
|
-
className: getClass(
|
|
806
|
+
className: getClass("__placeholder")
|
|
713
807
|
}, /*#__PURE__*/React.createElement("div", {
|
|
714
|
-
className: getClass(
|
|
808
|
+
className: getClass("__placeholder__loading")
|
|
715
809
|
})), /*#__PURE__*/React.createElement("div", {
|
|
716
|
-
className: getClass(
|
|
810
|
+
className: getClass("__container")
|
|
717
811
|
}, queryType != PRODUCT_DETAILS && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
718
|
-
className: getClass(
|
|
812
|
+
className: getClass("__header")
|
|
719
813
|
}, /*#__PURE__*/React.createElement("div", {
|
|
720
|
-
className: getClass(
|
|
814
|
+
className: getClass("__header__text")
|
|
721
815
|
}, /*#__PURE__*/React.createElement(DynamicHeading, {
|
|
722
816
|
titleSize: titleSize
|
|
723
817
|
}, heading), /*#__PURE__*/React.createElement("p", null, subtext)), callToActionUrl && /*#__PURE__*/React.createElement("div", {
|
|
724
|
-
className: getClass(
|
|
818
|
+
className: getClass("__header__cta")
|
|
725
819
|
}, function () {
|
|
726
820
|
var _a = getCallToActionProps(callToActionType, callToActionUrl),
|
|
727
821
|
finalUrl = _a.finalUrl,
|
|
728
822
|
target = _a.target;
|
|
729
|
-
var isAnchor = !!callToActionTargetSelector || (callToActionType === null || callToActionType === void 0 ? void 0 : callToActionType.toLowerCase()) !==
|
|
823
|
+
var isAnchor = !!callToActionTargetSelector || (callToActionType === null || callToActionType === void 0 ? void 0 : callToActionType.toLowerCase()) !== "internal";
|
|
730
824
|
return /*#__PURE__*/React.createElement(Button$1, {
|
|
731
|
-
element: isAnchor ?
|
|
825
|
+
element: isAnchor ? "a" : "button",
|
|
732
826
|
buttonStyle: widgetStyleProps === null || widgetStyleProps === void 0 ? void 0 : widgetStyleProps.buttonStyle,
|
|
733
827
|
label: callToActionText,
|
|
734
828
|
href: isAnchor ? finalUrl : undefined,
|
|
735
829
|
target: target,
|
|
736
|
-
rel: target ===
|
|
830
|
+
rel: target === "_blank" ? "noopener noreferrer" : undefined,
|
|
737
831
|
"data-target-selector": callToActionTargetSelector,
|
|
738
832
|
onClick: !isAnchor ? function () {
|
|
739
833
|
if (finalUrl) {
|
|
740
|
-
window.open(finalUrl, target ||
|
|
834
|
+
window.open(finalUrl, target || "_self", target === "_blank" ? "noopener,noreferrer" : undefined);
|
|
741
835
|
}
|
|
742
836
|
} : undefined
|
|
743
837
|
});
|
|
744
838
|
}()))), /*#__PURE__*/React.createElement("div", {
|
|
745
|
-
className: queryType == PRODUCT_DETAILS ? getClass(
|
|
839
|
+
className: queryType == PRODUCT_DETAILS ? getClass("__cards__cardSingle") : getClass("__cards")
|
|
746
840
|
}, hits.slice(0, maxResults).map(function (hit, index) {
|
|
747
841
|
var Component = Card$1;
|
|
748
842
|
var title = hit.title;
|
|
749
843
|
var cardStyle = "";
|
|
750
|
-
var imageUrl = hit.
|
|
844
|
+
var imageUrl = hit.image;
|
|
751
845
|
var hitUtm = new URLSearchParams({
|
|
752
846
|
utm_source: "web",
|
|
753
847
|
utm_medium: "alg",
|
|
@@ -791,7 +885,6 @@ var AlgoliaDynamicSearch = function (_a, useScopedStyles, styles) {
|
|
|
791
885
|
className: cardClassName,
|
|
792
886
|
title: title,
|
|
793
887
|
imageUrl: imageUrl,
|
|
794
|
-
placeholder: hit.image ? false : true,
|
|
795
888
|
hit: hit,
|
|
796
889
|
cta: hitCta,
|
|
797
890
|
size: "",
|
|
@@ -1031,6 +1124,27 @@ var defaultQrFormTranslations = {
|
|
|
1031
1124
|
consent_requiredMessage: "Please acknowledge this consent"
|
|
1032
1125
|
};
|
|
1033
1126
|
|
|
1127
|
+
var FriendlyCaptcha = function (props) {
|
|
1128
|
+
useEffect(function () {
|
|
1129
|
+
console.log(props.element, "element");
|
|
1130
|
+
if (props.element) {
|
|
1131
|
+
var sdk = new WidgetInstance(props.element, {
|
|
1132
|
+
startMode: "auto",
|
|
1133
|
+
doneCallback: function (solution) {
|
|
1134
|
+
if (props.onComplete) props.onComplete(solution);
|
|
1135
|
+
if (props.doneCallback) props.doneCallback();
|
|
1136
|
+
}
|
|
1137
|
+
});
|
|
1138
|
+
try {
|
|
1139
|
+
sdk.start();
|
|
1140
|
+
} catch (e) {
|
|
1141
|
+
console.error("FriendlyCaptcha initialization failed", e);
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
}, [props.element]);
|
|
1145
|
+
return null;
|
|
1146
|
+
};
|
|
1147
|
+
|
|
1034
1148
|
var QrForm = function (props) {
|
|
1035
1149
|
var _a;
|
|
1036
1150
|
var _b = useState(0),
|
|
@@ -1052,8 +1166,14 @@ var QrForm = function (props) {
|
|
|
1052
1166
|
var _g = useState(true);
|
|
1053
1167
|
_g[0];
|
|
1054
1168
|
var setIsLoadingCountries = _g[1];
|
|
1169
|
+
var _h = useState(null),
|
|
1170
|
+
captchaElRef = _h[0],
|
|
1171
|
+
setCaptchaElRef = _h[1];
|
|
1055
1172
|
// Use custom Button component if provided, otherwise use default
|
|
1056
1173
|
var Button$1 = props.ButtonComponent || Button;
|
|
1174
|
+
var _j = useState(false),
|
|
1175
|
+
showSubmit = _j[0],
|
|
1176
|
+
setShowSubmit = _j[1];
|
|
1057
1177
|
var i18n = __assign(__assign({}, defaultQrFormTranslations), props);
|
|
1058
1178
|
var buttonProps = props;
|
|
1059
1179
|
var consentFields = ((_a = props.consents) === null || _a === void 0 ? void 0 : _a.map(function (consent, index) {
|
|
@@ -1070,13 +1190,17 @@ var QrForm = function (props) {
|
|
|
1070
1190
|
errorMessage: consent.policyMandatory ? i18n.consent_requiredMessage : ""
|
|
1071
1191
|
};
|
|
1072
1192
|
})) || [];
|
|
1193
|
+
useRef(null);
|
|
1073
1194
|
useEffect(function () {
|
|
1074
1195
|
var initialValues = {};
|
|
1075
1196
|
props.fields.forEach(function (field) {
|
|
1076
1197
|
initialValues[field.name] = field.value || '';
|
|
1077
1198
|
});
|
|
1199
|
+
initialValues['portalId'] = props.hubspotAppId;
|
|
1200
|
+
initialValues['formId'] = props.hubspotId;
|
|
1201
|
+
initialValues['isChina'] = props.isChina ? "true" : "false";
|
|
1078
1202
|
setFormValues(initialValues);
|
|
1079
|
-
}, [props.fields]);
|
|
1203
|
+
}, [props.fields, props.hubspotAppId, props.hubspotId, props.isChina]);
|
|
1080
1204
|
useEffect(function () {
|
|
1081
1205
|
function loadCountries() {
|
|
1082
1206
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -1403,13 +1527,13 @@ var QrForm = function (props) {
|
|
|
1403
1527
|
onClick: formNavigate,
|
|
1404
1528
|
"data-page_target": pageIndex + 1,
|
|
1405
1529
|
buttonStyle: "primary"
|
|
1406
|
-
}) : /*#__PURE__*/React.createElement(Button$1, {
|
|
1530
|
+
}) : /*#__PURE__*/React.createElement(React.Fragment, null, (!props.captchaKey || showSubmit) && /*#__PURE__*/React.createElement(Button$1, {
|
|
1407
1531
|
label: i18n === null || i18n === void 0 ? void 0 : i18n.submit,
|
|
1408
1532
|
onClick: handleSubmit,
|
|
1409
1533
|
buttonStyle: "primary",
|
|
1410
1534
|
element: "button",
|
|
1411
1535
|
type: "submit"
|
|
1412
|
-
}));
|
|
1536
|
+
})));
|
|
1413
1537
|
if (isPartial) {
|
|
1414
1538
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
1415
1539
|
className: "qr-form-fields"
|
|
@@ -1443,7 +1567,7 @@ var QrForm = function (props) {
|
|
|
1443
1567
|
className: "bullet-point"
|
|
1444
1568
|
}, /*#__PURE__*/React.createElement("span", null, index + 1)), /*#__PURE__*/React.createElement("h3", null, pageTitles[index]));
|
|
1445
1569
|
}))), /*#__PURE__*/React.createElement("form", {
|
|
1446
|
-
action: "".concat(props.formAction
|
|
1570
|
+
action: "".concat(props.formAction),
|
|
1447
1571
|
onSubmit: handleSubmit
|
|
1448
1572
|
}, currentPage === 0 && /*#__PURE__*/React.createElement("section", {
|
|
1449
1573
|
key: 1,
|
|
@@ -1472,10 +1596,36 @@ var QrForm = function (props) {
|
|
|
1472
1596
|
}), renderFormSection({
|
|
1473
1597
|
pageIndex: 3,
|
|
1474
1598
|
sectionTitle: pageTitles[3]
|
|
1475
|
-
}), /*#__PURE__*/React.createElement("
|
|
1599
|
+
}), currentPage === pages.length - 1 && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
1600
|
+
id: "frc-widget",
|
|
1601
|
+
className: "vtba-friendly-captcha-react",
|
|
1602
|
+
"data-rad": "test",
|
|
1603
|
+
"data-sitekey": props.captchaKey,
|
|
1604
|
+
ref: function (el) {
|
|
1605
|
+
setCaptchaElRef(el);
|
|
1606
|
+
}
|
|
1607
|
+
}), !!props.captchaKey && captchaElRef && /*#__PURE__*/React.createElement(FriendlyCaptcha, {
|
|
1608
|
+
sitekey: props.captchaKey,
|
|
1609
|
+
doneCallback: function () {
|
|
1610
|
+
setShowSubmit(true);
|
|
1611
|
+
},
|
|
1612
|
+
element: captchaElRef
|
|
1613
|
+
})), /*#__PURE__*/React.createElement("input", {
|
|
1476
1614
|
type: "hidden",
|
|
1477
1615
|
name: "ip_location",
|
|
1478
1616
|
value: formValues.ip_location || ''
|
|
1617
|
+
}), /*#__PURE__*/React.createElement("input", {
|
|
1618
|
+
type: "hidden",
|
|
1619
|
+
name: "portalId",
|
|
1620
|
+
value: props.hubspotAppId
|
|
1621
|
+
}), /*#__PURE__*/React.createElement("input", {
|
|
1622
|
+
type: "hidden",
|
|
1623
|
+
name: "formId",
|
|
1624
|
+
value: props.hubspotId
|
|
1625
|
+
}), /*#__PURE__*/React.createElement("input", {
|
|
1626
|
+
type: "hidden",
|
|
1627
|
+
name: "isChina",
|
|
1628
|
+
value: props.isChina ? "true" : "false"
|
|
1479
1629
|
}))) : /*#__PURE__*/React.createElement("div", {
|
|
1480
1630
|
className: "qr-form-thank-you-page"
|
|
1481
1631
|
}, /*#__PURE__*/React.createElement("div", {
|