@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.js
CHANGED
|
@@ -5,6 +5,7 @@ var reactFontawesome = require('@fortawesome/react-fontawesome');
|
|
|
5
5
|
var proSolidSvgIcons = require('@fortawesome/pro-solid-svg-icons');
|
|
6
6
|
var uuid = require('uuid');
|
|
7
7
|
var reactInternationalPhone = require('react-international-phone');
|
|
8
|
+
var friendlyChallenge = require('friendly-challenge');
|
|
8
9
|
|
|
9
10
|
/******************************************************************************
|
|
10
11
|
Copyright (c) Microsoft Corporation.
|
|
@@ -165,7 +166,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
165
166
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
166
167
|
};
|
|
167
168
|
|
|
168
|
-
var styles$
|
|
169
|
+
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"};
|
|
169
170
|
|
|
170
171
|
function getDefaultExportFromCjs (x) {
|
|
171
172
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
@@ -317,14 +318,114 @@ var AccordionSection = function (_a) {
|
|
|
317
318
|
}, shouldRenderChildren ? children : null));
|
|
318
319
|
};
|
|
319
320
|
|
|
321
|
+
var placholderimg = "3697809e28f9e0fe.png";
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Parses delimited facet values into a structured format
|
|
325
|
+
*
|
|
326
|
+
* Input format: "pressure_psi|2.90#pressure_inHg|5.91#pressure_bar|0.200"
|
|
327
|
+
* Where:
|
|
328
|
+
* - `#` separates different unit entries
|
|
329
|
+
* - `|` separates the unit key from the value
|
|
330
|
+
*/
|
|
331
|
+
/**
|
|
332
|
+
* Checks if a value is in the delimited facet format
|
|
333
|
+
*/
|
|
334
|
+
var isDelimitedFacetValue = function (value) {
|
|
335
|
+
if (typeof value !== 'string') return false;
|
|
336
|
+
// Must contain both # (entry separator) and | (key-value separator)
|
|
337
|
+
return value.includes('#') && value.includes('|');
|
|
338
|
+
};
|
|
339
|
+
/**
|
|
340
|
+
* Extracts the display unit from a raw key
|
|
341
|
+
* e.g., "pressure_psi" -> "psi"
|
|
342
|
+
* e.g., "volumeFlowRate_l/s" -> "l/s"
|
|
343
|
+
* e.g., "power_kW" -> "kW"
|
|
344
|
+
*/
|
|
345
|
+
var extractUnit = function (rawKey) {
|
|
346
|
+
var parts = rawKey.split('_');
|
|
347
|
+
if (parts.length > 1) {
|
|
348
|
+
// Return everything after the first underscore (handles units like "m/³h")
|
|
349
|
+
return parts.slice(1).join('_');
|
|
350
|
+
}
|
|
351
|
+
return rawKey;
|
|
352
|
+
};
|
|
353
|
+
/**
|
|
354
|
+
* Parses a delimited facet string into an array of entries
|
|
355
|
+
*/
|
|
356
|
+
var parseDelimitedFacetValue = function (value) {
|
|
357
|
+
if (!isDelimitedFacetValue(value)) {
|
|
358
|
+
return [];
|
|
359
|
+
}
|
|
360
|
+
var entries = value.split('#');
|
|
361
|
+
return entries.map(function (entry) {
|
|
362
|
+
var _a = entry.split('|'),
|
|
363
|
+
rawKey = _a[0],
|
|
364
|
+
val = _a[1];
|
|
365
|
+
if (!rawKey || val === undefined) return null;
|
|
366
|
+
return {
|
|
367
|
+
unit: extractUnit(rawKey),
|
|
368
|
+
value: val,
|
|
369
|
+
rawKey: rawKey
|
|
370
|
+
};
|
|
371
|
+
}).filter(function (entry) {
|
|
372
|
+
return entry !== null;
|
|
373
|
+
});
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
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"};
|
|
377
|
+
|
|
320
378
|
// Utility function to retrieve correct SCSS module class names
|
|
321
|
-
var getStyle$
|
|
379
|
+
var getStyle$2 = function (className) {
|
|
322
380
|
if (styles$2[className]) return styles$2[className];
|
|
323
381
|
var nestedMatch = Object.keys(styles$2).find(function (key) {
|
|
324
382
|
return key.includes(className);
|
|
325
383
|
});
|
|
326
384
|
return nestedMatch ? styles$2[nestedMatch] : "";
|
|
327
385
|
};
|
|
386
|
+
var FacetUnitSelector = function (_a) {
|
|
387
|
+
var entries = _a.entries,
|
|
388
|
+
_b = _a.usePlainClasses,
|
|
389
|
+
usePlainClasses = _b === void 0 ? false : _b;
|
|
390
|
+
var _c = React.useState(0),
|
|
391
|
+
selectedIndex = _c[0],
|
|
392
|
+
setSelectedIndex = _c[1];
|
|
393
|
+
var getClassName = function (name) {
|
|
394
|
+
return usePlainClasses ? name : getStyle$2(name);
|
|
395
|
+
};
|
|
396
|
+
if (!entries || entries.length === 0) return null;
|
|
397
|
+
var selectedEntry = entries[selectedIndex];
|
|
398
|
+
var handleUnitChange = function (e) {
|
|
399
|
+
setSelectedIndex(Number(e.target.value));
|
|
400
|
+
};
|
|
401
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
402
|
+
className: getClassName("facet-unit-selector")
|
|
403
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
404
|
+
className: getClassName("facet-unit-selector__value")
|
|
405
|
+
}, selectedEntry.value), entries.length > 1 ? /*#__PURE__*/React.createElement("select", {
|
|
406
|
+
className: getClassName("facet-unit-selector__dropdown"),
|
|
407
|
+
value: selectedIndex,
|
|
408
|
+
onChange: handleUnitChange,
|
|
409
|
+
"aria-label": "Select unit"
|
|
410
|
+
}, entries.map(function (entry, index) {
|
|
411
|
+
return /*#__PURE__*/React.createElement("option", {
|
|
412
|
+
key: entry.rawKey,
|
|
413
|
+
value: index
|
|
414
|
+
}, entry.unit);
|
|
415
|
+
})) : /*#__PURE__*/React.createElement("span", {
|
|
416
|
+
className: getClassName("facet-unit-selector__unit")
|
|
417
|
+
}, selectedEntry.unit));
|
|
418
|
+
};
|
|
419
|
+
|
|
420
|
+
var PLACEHOLDER_INDICATOR = "?placeholder-storybook";
|
|
421
|
+
// Utility function to retrieve correct SCSS module class names
|
|
422
|
+
var getStyle$1 = function (className) {
|
|
423
|
+
if (styles$3[className]) return styles$3[className];
|
|
424
|
+
var nestedMatch = Object.keys(styles$3).find(function (key) {
|
|
425
|
+
return key.includes(className);
|
|
426
|
+
});
|
|
427
|
+
return nestedMatch ? styles$3[nestedMatch] : "";
|
|
428
|
+
};
|
|
328
429
|
var cardSizeMapping = function (size) {
|
|
329
430
|
var classSrting;
|
|
330
431
|
if (size === "small") {
|
|
@@ -338,22 +439,10 @@ var cardSizeMapping = function (size) {
|
|
|
338
439
|
}
|
|
339
440
|
return classSrting;
|
|
340
441
|
};
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
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
|
-
}
|
|
442
|
+
// Helper function to check if image is a placeholder (from ACAS-14821)
|
|
443
|
+
var isPlaceholderImg = function (imageUrl) {
|
|
444
|
+
console.log(imageUrl);
|
|
445
|
+
return !!imageUrl && imageUrl.indexOf(PLACEHOLDER_INDICATOR) > -1;
|
|
357
446
|
};
|
|
358
447
|
var Card = function (_a) {
|
|
359
448
|
var contentCategoryLabel = _a.contentCategoryLabel,
|
|
@@ -369,7 +458,6 @@ var Card = function (_a) {
|
|
|
369
458
|
cardLink = _a.cardLink,
|
|
370
459
|
city = _a.city,
|
|
371
460
|
country = _a.country,
|
|
372
|
-
placeholder = _a.placeholder,
|
|
373
461
|
onClick = _a.onClick,
|
|
374
462
|
_b = _a.usePlainClasses,
|
|
375
463
|
usePlainClasses = _b === void 0 ? false : _b;
|
|
@@ -381,7 +469,8 @@ var Card = function (_a) {
|
|
|
381
469
|
var width = cardSizeMapping(size);
|
|
382
470
|
var categoryColour = colour ? usePlainClasses ? "cmp-card__content-category-wrapper__colour-".concat(colour) : getStyle$1("cmp-card__content-category-wrapper__colour-".concat(colour)) : "";
|
|
383
471
|
var cardFooterColour = colour ? usePlainClasses ? "cmp-card__footer--color-".concat(colour) : getStyle$1("cmp-card__footer--color-".concat(colour)) : "";
|
|
384
|
-
|
|
472
|
+
// Image placeholder fallback logic from ACAS-14821
|
|
473
|
+
var contentImage = !imageUrl ? placholderimg + PLACEHOLDER_INDICATOR : imageUrl;
|
|
385
474
|
return /*#__PURE__*/React.createElement("div", {
|
|
386
475
|
className: classnames(getClassName("cmp-card"), mode, width, className && (usePlainClasses ? className : getStyle$1(className)))
|
|
387
476
|
}, /*#__PURE__*/React.createElement("a", {
|
|
@@ -391,7 +480,7 @@ var Card = function (_a) {
|
|
|
391
480
|
}, /*#__PURE__*/React.createElement("div", {
|
|
392
481
|
className: getClassName("cmp-card__content-wrapper")
|
|
393
482
|
}, cardStyle !== "type-card-panel" && cardStyle !== "type-card-no-image" && /*#__PURE__*/React.createElement("div", {
|
|
394
|
-
className: "".concat(getClassName("cmp-card__image-wrapper"), " ").concat(
|
|
483
|
+
className: "".concat(getClassName("cmp-card__image-wrapper"), " ").concat(isPlaceholderImg(contentImage) ? getClassName("placeholderImage") : "")
|
|
395
484
|
}, /*#__PURE__*/React.createElement("picture", null, /*#__PURE__*/React.createElement("img", {
|
|
396
485
|
src: contentImage,
|
|
397
486
|
alt: imageAlt
|
|
@@ -430,7 +519,6 @@ var ProductCard = function (_a) {
|
|
|
430
519
|
cardLink = _a.cardLink,
|
|
431
520
|
cta = _a.cta,
|
|
432
521
|
cardStyle = _a.cardStyle,
|
|
433
|
-
placeholder = _a.placeholder,
|
|
434
522
|
onClick = _a.onClick,
|
|
435
523
|
_c = _a.usePlainClasses,
|
|
436
524
|
usePlainClasses = _c === void 0 ? false : _c;
|
|
@@ -440,7 +528,8 @@ var ProductCard = function (_a) {
|
|
|
440
528
|
};
|
|
441
529
|
var width = cardSizeMapping(size);
|
|
442
530
|
var mode = usePlainClasses ? "cmp-card--".concat(cardStyle) : getStyle$1("cmp-card--".concat(cardStyle));
|
|
443
|
-
|
|
531
|
+
// Image placeholder fallback logic from ACAS-14821
|
|
532
|
+
var productImage = !imageUrl || imageUrl === 'https://uk.my.edwardsvacuum.com?placeholder-storybook' ? placholderimg.src + PLACEHOLDER_INDICATOR : imageUrl;
|
|
444
533
|
return /*#__PURE__*/React.createElement("div", {
|
|
445
534
|
className: classnames(getClassName("cmp-card"), mode, width, className)
|
|
446
535
|
}, /*#__PURE__*/React.createElement("a", {
|
|
@@ -455,7 +544,7 @@ var ProductCard = function (_a) {
|
|
|
455
544
|
}, /*#__PURE__*/React.createElement("figure", null, /*#__PURE__*/React.createElement("img", {
|
|
456
545
|
src: productImage,
|
|
457
546
|
alt: imageAlt,
|
|
458
|
-
className:
|
|
547
|
+
className: isPlaceholderImg(productImage) ? "placeholderImage" : ''
|
|
459
548
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
460
549
|
className: getClassName("cmp-card--type-card-product__meta")
|
|
461
550
|
}, /*#__PURE__*/React.createElement("p", {
|
|
@@ -475,7 +564,6 @@ var ProductDetailsCard = function (_a) {
|
|
|
475
564
|
var title = _a.title;
|
|
476
565
|
_a.imageUrl;
|
|
477
566
|
var imageAlt = _a.imageAlt;
|
|
478
|
-
_a.placeholder;
|
|
479
567
|
_a.onClick;
|
|
480
568
|
var hit = _a.hit,
|
|
481
569
|
facets = _a.facets,
|
|
@@ -539,13 +627,20 @@ var ProductDetailsCard = function (_a) {
|
|
|
539
627
|
}, /*#__PURE__*/React.createElement("ul", {
|
|
540
628
|
className: getClassName("folding-specification-list")
|
|
541
629
|
}, facets && facets.map(function (facet) {
|
|
542
|
-
|
|
630
|
+
var facetValue = hit[facet.name];
|
|
631
|
+
if (!facetValue) return null;
|
|
632
|
+
// Check if value is in delimited format (e.g., "pressure_psi|2.90#pressure_bar|0.200")
|
|
633
|
+
var isDelimited = isDelimitedFacetValue(facetValue);
|
|
634
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
543
635
|
key: facet.name
|
|
544
636
|
}, /*#__PURE__*/React.createElement("strong", null, facet.label), /*#__PURE__*/React.createElement("br", null), facet.returnsHTML ? /*#__PURE__*/React.createElement("span", {
|
|
545
637
|
dangerouslySetInnerHTML: {
|
|
546
|
-
__html:
|
|
638
|
+
__html: facetValue
|
|
547
639
|
}
|
|
548
|
-
}) :
|
|
640
|
+
}) : isDelimited ? /*#__PURE__*/React.createElement(FacetUnitSelector, {
|
|
641
|
+
entries: parseDelimitedFacetValue(facetValue),
|
|
642
|
+
usePlainClasses: usePlainClasses
|
|
643
|
+
}) : facetValue);
|
|
549
644
|
})))), /*#__PURE__*/React.createElement("div", {
|
|
550
645
|
className: getClassName("cmp-card--type-product_details__spares-list")
|
|
551
646
|
}, (hit === null || hit === void 0 ? void 0 : hit.spares) && hit.spares.length > 0 && /*#__PURE__*/React.createElement(AccordionSection, {
|
|
@@ -612,7 +707,7 @@ var Button = function (_a) {
|
|
|
612
707
|
}, props), label);
|
|
613
708
|
};
|
|
614
709
|
|
|
615
|
-
var PRODUCT_DETAILS =
|
|
710
|
+
var PRODUCT_DETAILS = "productDetails";
|
|
616
711
|
var DynamicHeading = function (_a) {
|
|
617
712
|
var _b = _a.titleSize,
|
|
618
713
|
titleSize = _b === void 0 ? "h2" : _b,
|
|
@@ -623,16 +718,16 @@ var DynamicHeading = function (_a) {
|
|
|
623
718
|
};
|
|
624
719
|
var getCallToActionProps = function (type, url) {
|
|
625
720
|
var callType = type === null || type === void 0 ? void 0 : type.toLowerCase();
|
|
626
|
-
var finalUrl = url ||
|
|
627
|
-
var target =
|
|
721
|
+
var finalUrl = url || "";
|
|
722
|
+
var target = "";
|
|
628
723
|
switch (callType) {
|
|
629
|
-
case
|
|
630
|
-
target =
|
|
724
|
+
case "external":
|
|
725
|
+
target = "_blank";
|
|
631
726
|
break;
|
|
632
|
-
case
|
|
727
|
+
case "email":
|
|
633
728
|
finalUrl = "mailto:".concat(url);
|
|
634
729
|
break;
|
|
635
|
-
case
|
|
730
|
+
case "phone":
|
|
636
731
|
finalUrl = "tel:".concat(url);
|
|
637
732
|
break;
|
|
638
733
|
}
|
|
@@ -651,18 +746,17 @@ var AlgoliaDynamicSearch = function (_a, useScopedStyles, styles) {
|
|
|
651
746
|
callToActionUrl = _a.callToActionUrl,
|
|
652
747
|
callToActionTargetSelector = _a.callToActionTargetSelector,
|
|
653
748
|
_c = _a.queryType,
|
|
654
|
-
queryType = _c === void 0 ?
|
|
749
|
+
queryType = _c === void 0 ? "unknown" : _c,
|
|
655
750
|
hits = _a.hits,
|
|
656
751
|
hitCta = _a.hitCta,
|
|
657
752
|
showProductPrice = _a.showProductPrice,
|
|
658
753
|
query = _a.query,
|
|
659
754
|
_d = _a.backgroundColour,
|
|
660
|
-
backgroundColour = _d === void 0 ?
|
|
755
|
+
backgroundColour = _d === void 0 ? "" : _d,
|
|
661
756
|
_e = _a.maxResults,
|
|
662
757
|
maxResults = _e === void 0 ? 10 : _e,
|
|
663
758
|
_f = _a.isLoading,
|
|
664
759
|
isLoading = _f === void 0 ? false : _f,
|
|
665
|
-
placeholder = _a.placeholder,
|
|
666
760
|
analytics = _a.analytics,
|
|
667
761
|
facets = _a.facets,
|
|
668
762
|
innerComponents = _a.innerComponents;
|
|
@@ -685,12 +779,12 @@ var AlgoliaDynamicSearch = function (_a, useScopedStyles, styles) {
|
|
|
685
779
|
var backgroundStyles = {
|
|
686
780
|
"dark-grey": {
|
|
687
781
|
buttonStyle: "outlineWhite",
|
|
688
|
-
containerBackground: getModifierClass(
|
|
782
|
+
containerBackground: getModifierClass("hasStyleGreyBackground"),
|
|
689
783
|
textColour: "white"
|
|
690
784
|
},
|
|
691
|
-
|
|
785
|
+
silver: {
|
|
692
786
|
buttonStyle: "primary",
|
|
693
|
-
containerBackground: getModifierClass(
|
|
787
|
+
containerBackground: getModifierClass("hasStyleSilverGradientBackground"),
|
|
694
788
|
textColour: "black"
|
|
695
789
|
}
|
|
696
790
|
};
|
|
@@ -703,53 +797,53 @@ var AlgoliaDynamicSearch = function (_a, useScopedStyles, styles) {
|
|
|
703
797
|
if (!hits || hits.length === 0) {
|
|
704
798
|
return null;
|
|
705
799
|
}
|
|
706
|
-
var baseClass = getClass(
|
|
800
|
+
var baseClass = getClass("");
|
|
707
801
|
// Memoize wrapper class names
|
|
708
802
|
var wrapperClasses = React.useMemo(function () {
|
|
709
|
-
return [baseClass, widgetStyleProps.containerBackground, isLoading ? getModifierClass(
|
|
803
|
+
return [baseClass, widgetStyleProps.containerBackground, isLoading ? getModifierClass("isLoading") : "", queryType === "content" ? getModifierClass("isQueryContent") : ""].filter(Boolean).join(" ");
|
|
710
804
|
}, [baseClass, widgetStyleProps.containerBackground, isLoading, queryType, getModifierClass]);
|
|
711
805
|
return /*#__PURE__*/React.createElement("div", {
|
|
712
806
|
className: wrapperClasses
|
|
713
807
|
}, isLoading && /*#__PURE__*/React.createElement("div", {
|
|
714
|
-
className: getClass(
|
|
808
|
+
className: getClass("__placeholder")
|
|
715
809
|
}, /*#__PURE__*/React.createElement("div", {
|
|
716
|
-
className: getClass(
|
|
810
|
+
className: getClass("__placeholder__loading")
|
|
717
811
|
})), /*#__PURE__*/React.createElement("div", {
|
|
718
|
-
className: getClass(
|
|
812
|
+
className: getClass("__container")
|
|
719
813
|
}, queryType != PRODUCT_DETAILS && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
720
|
-
className: getClass(
|
|
814
|
+
className: getClass("__header")
|
|
721
815
|
}, /*#__PURE__*/React.createElement("div", {
|
|
722
|
-
className: getClass(
|
|
816
|
+
className: getClass("__header__text")
|
|
723
817
|
}, /*#__PURE__*/React.createElement(DynamicHeading, {
|
|
724
818
|
titleSize: titleSize
|
|
725
819
|
}, heading), /*#__PURE__*/React.createElement("p", null, subtext)), callToActionUrl && /*#__PURE__*/React.createElement("div", {
|
|
726
|
-
className: getClass(
|
|
820
|
+
className: getClass("__header__cta")
|
|
727
821
|
}, function () {
|
|
728
822
|
var _a = getCallToActionProps(callToActionType, callToActionUrl),
|
|
729
823
|
finalUrl = _a.finalUrl,
|
|
730
824
|
target = _a.target;
|
|
731
|
-
var isAnchor = !!callToActionTargetSelector || (callToActionType === null || callToActionType === void 0 ? void 0 : callToActionType.toLowerCase()) !==
|
|
825
|
+
var isAnchor = !!callToActionTargetSelector || (callToActionType === null || callToActionType === void 0 ? void 0 : callToActionType.toLowerCase()) !== "internal";
|
|
732
826
|
return /*#__PURE__*/React.createElement(Button$1, {
|
|
733
|
-
element: isAnchor ?
|
|
827
|
+
element: isAnchor ? "a" : "button",
|
|
734
828
|
buttonStyle: widgetStyleProps === null || widgetStyleProps === void 0 ? void 0 : widgetStyleProps.buttonStyle,
|
|
735
829
|
label: callToActionText,
|
|
736
830
|
href: isAnchor ? finalUrl : undefined,
|
|
737
831
|
target: target,
|
|
738
|
-
rel: target ===
|
|
832
|
+
rel: target === "_blank" ? "noopener noreferrer" : undefined,
|
|
739
833
|
"data-target-selector": callToActionTargetSelector,
|
|
740
834
|
onClick: !isAnchor ? function () {
|
|
741
835
|
if (finalUrl) {
|
|
742
|
-
window.open(finalUrl, target ||
|
|
836
|
+
window.open(finalUrl, target || "_self", target === "_blank" ? "noopener,noreferrer" : undefined);
|
|
743
837
|
}
|
|
744
838
|
} : undefined
|
|
745
839
|
});
|
|
746
840
|
}()))), /*#__PURE__*/React.createElement("div", {
|
|
747
|
-
className: queryType == PRODUCT_DETAILS ? getClass(
|
|
841
|
+
className: queryType == PRODUCT_DETAILS ? getClass("__cards__cardSingle") : getClass("__cards")
|
|
748
842
|
}, hits.slice(0, maxResults).map(function (hit, index) {
|
|
749
843
|
var Component = Card$1;
|
|
750
844
|
var title = hit.title;
|
|
751
845
|
var cardStyle = "";
|
|
752
|
-
var imageUrl = hit.
|
|
846
|
+
var imageUrl = hit.image;
|
|
753
847
|
var hitUtm = new URLSearchParams({
|
|
754
848
|
utm_source: "web",
|
|
755
849
|
utm_medium: "alg",
|
|
@@ -793,7 +887,6 @@ var AlgoliaDynamicSearch = function (_a, useScopedStyles, styles) {
|
|
|
793
887
|
className: cardClassName,
|
|
794
888
|
title: title,
|
|
795
889
|
imageUrl: imageUrl,
|
|
796
|
-
placeholder: hit.image ? false : true,
|
|
797
890
|
hit: hit,
|
|
798
891
|
cta: hitCta,
|
|
799
892
|
size: "",
|
|
@@ -1033,6 +1126,27 @@ var defaultQrFormTranslations = {
|
|
|
1033
1126
|
consent_requiredMessage: "Please acknowledge this consent"
|
|
1034
1127
|
};
|
|
1035
1128
|
|
|
1129
|
+
var FriendlyCaptcha = function (props) {
|
|
1130
|
+
React.useEffect(function () {
|
|
1131
|
+
console.log(props.element, "element");
|
|
1132
|
+
if (props.element) {
|
|
1133
|
+
var sdk = new friendlyChallenge.WidgetInstance(props.element, {
|
|
1134
|
+
startMode: "auto",
|
|
1135
|
+
doneCallback: function (solution) {
|
|
1136
|
+
if (props.onComplete) props.onComplete(solution);
|
|
1137
|
+
if (props.doneCallback) props.doneCallback();
|
|
1138
|
+
}
|
|
1139
|
+
});
|
|
1140
|
+
try {
|
|
1141
|
+
sdk.start();
|
|
1142
|
+
} catch (e) {
|
|
1143
|
+
console.error("FriendlyCaptcha initialization failed", e);
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
}, [props.element]);
|
|
1147
|
+
return null;
|
|
1148
|
+
};
|
|
1149
|
+
|
|
1036
1150
|
var QrForm = function (props) {
|
|
1037
1151
|
var _a;
|
|
1038
1152
|
var _b = React.useState(0),
|
|
@@ -1054,8 +1168,14 @@ var QrForm = function (props) {
|
|
|
1054
1168
|
var _g = React.useState(true);
|
|
1055
1169
|
_g[0];
|
|
1056
1170
|
var setIsLoadingCountries = _g[1];
|
|
1171
|
+
var _h = React.useState(null),
|
|
1172
|
+
captchaElRef = _h[0],
|
|
1173
|
+
setCaptchaElRef = _h[1];
|
|
1057
1174
|
// Use custom Button component if provided, otherwise use default
|
|
1058
1175
|
var Button$1 = props.ButtonComponent || Button;
|
|
1176
|
+
var _j = React.useState(false),
|
|
1177
|
+
showSubmit = _j[0],
|
|
1178
|
+
setShowSubmit = _j[1];
|
|
1059
1179
|
var i18n = __assign(__assign({}, defaultQrFormTranslations), props);
|
|
1060
1180
|
var buttonProps = props;
|
|
1061
1181
|
var consentFields = ((_a = props.consents) === null || _a === void 0 ? void 0 : _a.map(function (consent, index) {
|
|
@@ -1072,13 +1192,17 @@ var QrForm = function (props) {
|
|
|
1072
1192
|
errorMessage: consent.policyMandatory ? i18n.consent_requiredMessage : ""
|
|
1073
1193
|
};
|
|
1074
1194
|
})) || [];
|
|
1195
|
+
React.useRef(null);
|
|
1075
1196
|
React.useEffect(function () {
|
|
1076
1197
|
var initialValues = {};
|
|
1077
1198
|
props.fields.forEach(function (field) {
|
|
1078
1199
|
initialValues[field.name] = field.value || '';
|
|
1079
1200
|
});
|
|
1201
|
+
initialValues['portalId'] = props.hubspotAppId;
|
|
1202
|
+
initialValues['formId'] = props.hubspotId;
|
|
1203
|
+
initialValues['isChina'] = props.isChina ? "true" : "false";
|
|
1080
1204
|
setFormValues(initialValues);
|
|
1081
|
-
}, [props.fields]);
|
|
1205
|
+
}, [props.fields, props.hubspotAppId, props.hubspotId, props.isChina]);
|
|
1082
1206
|
React.useEffect(function () {
|
|
1083
1207
|
function loadCountries() {
|
|
1084
1208
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -1405,13 +1529,13 @@ var QrForm = function (props) {
|
|
|
1405
1529
|
onClick: formNavigate,
|
|
1406
1530
|
"data-page_target": pageIndex + 1,
|
|
1407
1531
|
buttonStyle: "primary"
|
|
1408
|
-
}) : /*#__PURE__*/React.createElement(Button$1, {
|
|
1532
|
+
}) : /*#__PURE__*/React.createElement(React.Fragment, null, (!props.captchaKey || showSubmit) && /*#__PURE__*/React.createElement(Button$1, {
|
|
1409
1533
|
label: i18n === null || i18n === void 0 ? void 0 : i18n.submit,
|
|
1410
1534
|
onClick: handleSubmit,
|
|
1411
1535
|
buttonStyle: "primary",
|
|
1412
1536
|
element: "button",
|
|
1413
1537
|
type: "submit"
|
|
1414
|
-
}));
|
|
1538
|
+
})));
|
|
1415
1539
|
if (isPartial) {
|
|
1416
1540
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
1417
1541
|
className: "qr-form-fields"
|
|
@@ -1445,7 +1569,7 @@ var QrForm = function (props) {
|
|
|
1445
1569
|
className: "bullet-point"
|
|
1446
1570
|
}, /*#__PURE__*/React.createElement("span", null, index + 1)), /*#__PURE__*/React.createElement("h3", null, pageTitles[index]));
|
|
1447
1571
|
}))), /*#__PURE__*/React.createElement("form", {
|
|
1448
|
-
action: "".concat(props.formAction
|
|
1572
|
+
action: "".concat(props.formAction),
|
|
1449
1573
|
onSubmit: handleSubmit
|
|
1450
1574
|
}, currentPage === 0 && /*#__PURE__*/React.createElement("section", {
|
|
1451
1575
|
key: 1,
|
|
@@ -1474,10 +1598,36 @@ var QrForm = function (props) {
|
|
|
1474
1598
|
}), renderFormSection({
|
|
1475
1599
|
pageIndex: 3,
|
|
1476
1600
|
sectionTitle: pageTitles[3]
|
|
1477
|
-
}), /*#__PURE__*/React.createElement("
|
|
1601
|
+
}), currentPage === pages.length - 1 && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
1602
|
+
id: "frc-widget",
|
|
1603
|
+
className: "vtba-friendly-captcha-react",
|
|
1604
|
+
"data-rad": "test",
|
|
1605
|
+
"data-sitekey": props.captchaKey,
|
|
1606
|
+
ref: function (el) {
|
|
1607
|
+
setCaptchaElRef(el);
|
|
1608
|
+
}
|
|
1609
|
+
}), !!props.captchaKey && captchaElRef && /*#__PURE__*/React.createElement(FriendlyCaptcha, {
|
|
1610
|
+
sitekey: props.captchaKey,
|
|
1611
|
+
doneCallback: function () {
|
|
1612
|
+
setShowSubmit(true);
|
|
1613
|
+
},
|
|
1614
|
+
element: captchaElRef
|
|
1615
|
+
})), /*#__PURE__*/React.createElement("input", {
|
|
1478
1616
|
type: "hidden",
|
|
1479
1617
|
name: "ip_location",
|
|
1480
1618
|
value: formValues.ip_location || ''
|
|
1619
|
+
}), /*#__PURE__*/React.createElement("input", {
|
|
1620
|
+
type: "hidden",
|
|
1621
|
+
name: "portalId",
|
|
1622
|
+
value: props.hubspotAppId
|
|
1623
|
+
}), /*#__PURE__*/React.createElement("input", {
|
|
1624
|
+
type: "hidden",
|
|
1625
|
+
name: "formId",
|
|
1626
|
+
value: props.hubspotId
|
|
1627
|
+
}), /*#__PURE__*/React.createElement("input", {
|
|
1628
|
+
type: "hidden",
|
|
1629
|
+
name: "isChina",
|
|
1630
|
+
value: props.isChina ? "true" : "false"
|
|
1481
1631
|
}))) : /*#__PURE__*/React.createElement("div", {
|
|
1482
1632
|
className: "qr-form-thank-you-page"
|
|
1483
1633
|
}, /*#__PURE__*/React.createElement("div", {
|