@thecb/components 11.2.17-beta.5 → 11.3.0-beta.0

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.cjs.js CHANGED
@@ -24397,6 +24397,39 @@ function useConditionallyAddValidator(condition, validatorFn, addValidator, remo
24397
24397
  }, [condition, addValidator, removeValidator]);
24398
24398
  }
24399
24399
 
24400
+ /**
24401
+ * A custom hook to dynamically load the Cloudflare Turnstile script.
24402
+ *
24403
+ * @param {string} verifyURL - The URL of the Turnstile verification script.
24404
+ */
24405
+ var useTurnstileScript = function useTurnstileScript(verifyURL) {
24406
+ var _useState = React.useState(false),
24407
+ _useState2 = _slicedToArray(_useState, 2),
24408
+ isLoaded = _useState2[0],
24409
+ setIsLoaded = _useState2[1];
24410
+ React.useEffect(function () {
24411
+ if (typeof window === "undefined") {
24412
+ setIsLoaded(false);
24413
+ return;
24414
+ }
24415
+ if (window.turnstile && window.turnstile.render) {
24416
+ setIsLoaded(true);
24417
+ return;
24418
+ }
24419
+ var script = document.createElement("script");
24420
+ script.src = "".concat(verifyURL, "?render=explicit");
24421
+ script.onload = function () {
24422
+ setIsLoaded(true);
24423
+ };
24424
+ script.defer = true;
24425
+ document.getElementsByTagName("head")[0].appendChild(script);
24426
+ return function () {
24427
+ setIsLoaded(false);
24428
+ };
24429
+ }, [verifyURL]);
24430
+ return isLoaded;
24431
+ };
24432
+
24400
24433
 
24401
24434
 
24402
24435
  var index$1 = /*#__PURE__*/Object.freeze({
@@ -24404,7 +24437,8 @@ var index$1 = /*#__PURE__*/Object.freeze({
24404
24437
  useOutsideClick: useOutsideClickHook,
24405
24438
  useScrollTo: useScrollTo,
24406
24439
  useToastNotification: useToastNotification,
24407
- useConditionallyAddValidator: useConditionallyAddValidator
24440
+ useConditionallyAddValidator: useConditionallyAddValidator,
24441
+ useTurnstileScript: useTurnstileScript
24408
24442
  });
24409
24443
 
24410
24444
  var hoverColor$4 = "#116285";
@@ -25657,80 +25691,9 @@ var ImageBox = function ImageBox(_ref) {
25657
25691
  }));
25658
25692
  };
25659
25693
 
25660
- var color$a = "#15749D";
25661
- var fallbackValues$s = {
25662
- color: color$a
25663
- };
25664
-
25665
- var SpinnerSvgAnimation = styled__default.svg.withConfig({
25666
- displayName: "Spinner__SpinnerSvgAnimation",
25667
- componentId: "sc-vhupl9-0"
25668
- })(["animation:rotate 2s linear infinite;margin:-25px 0 0 -25px;width:", "px;height:", "px;& .path{stroke:", ";stroke-linecap:round;animation:dash 1.5s ease-in-out infinite;}@keyframes rotate{100%{transform:rotate(360deg);}}@keyframes dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0;}50%{stroke-dasharray:90,150;stroke-dashoffset:-35;}100%{stroke-dasharray:90,150;stroke-dashoffset:-124;}}", ""], function (_ref) {
25669
- var size = _ref.size;
25670
- return size;
25671
- }, function (_ref2) {
25672
- var size = _ref2.size;
25673
- return size;
25674
- }, function (_ref3) {
25675
- var color = _ref3.color;
25676
- return color;
25677
- }, function (_ref4) {
25678
- var centerSpinner = _ref4.centerSpinner;
25679
- return centerSpinner ? styled.css(["margin:0;"]) : "";
25680
- });
25681
- var SpinnerContainer$2 = styled__default.div.withConfig({
25682
- displayName: "Spinner__SpinnerContainer",
25683
- componentId: "sc-vhupl9-1"
25684
- })(["width:100%;display:flex;flex-direction:row;align-items:center;justify-content:center;line-height:1;", ""], function (_ref5) {
25685
- var centerSpinner = _ref5.centerSpinner,
25686
- size = _ref5.size;
25687
- return centerSpinner ? styled.css(["width:", "px;height:", "px;"], size, size) : "";
25688
- });
25689
-
25690
- /*
25691
- `centerSpinner` prop alters existing styling of spinner to allow it to properly center itself within
25692
- containers. Default is false to preserve legacy behavior for past uses.
25693
- */
25694
-
25695
- var Spinner$1 = function Spinner(_ref6) {
25696
- var _ref6$size = _ref6.size,
25697
- size = _ref6$size === void 0 ? "24" : _ref6$size,
25698
- _ref6$centerSpinner = _ref6.centerSpinner,
25699
- centerSpinner = _ref6$centerSpinner === void 0 ? false : _ref6$centerSpinner,
25700
- themeValues = _ref6.themeValues,
25701
- _ref6$color = _ref6.color,
25702
- color = _ref6$color === void 0 ? themeValues.color : _ref6$color,
25703
- _ref6$cx = _ref6.cx,
25704
- cx = _ref6$cx === void 0 ? "50" : _ref6$cx,
25705
- _ref6$cy = _ref6.cy,
25706
- cy = _ref6$cy === void 0 ? "50" : _ref6$cy,
25707
- _ref6$radius = _ref6.radius,
25708
- radius = _ref6$radius === void 0 ? "25" : _ref6$radius,
25709
- _ref6$strokeWidth = _ref6.strokeWidth,
25710
- strokeWidth = _ref6$strokeWidth === void 0 ? "6" : _ref6$strokeWidth;
25711
- return /*#__PURE__*/React__default.createElement(SpinnerContainer$2, {
25712
- centerSpinner: centerSpinner,
25713
- size: size
25714
- }, /*#__PURE__*/React__default.createElement(SpinnerSvgAnimation, {
25715
- size: size,
25716
- color: color,
25717
- centerSpinner: centerSpinner
25718
- }, /*#__PURE__*/React__default.createElement("circle", {
25719
- className: "path",
25720
- cx: cx,
25721
- cy: cy,
25722
- r: radius,
25723
- fill: "none",
25724
- strokeWidth: strokeWidth
25725
- })));
25726
- };
25727
- var Spinner$2 = themeComponent(Spinner$1, "Spinner", fallbackValues$s);
25728
-
25729
25694
  var Jumbo = function Jumbo(_ref) {
25730
25695
  var showButton = _ref.showButton,
25731
25696
  heading = _ref.heading,
25732
- _ref$isHeadingLoading = _ref.isHeadingLoading,
25733
- isHeadingLoading = _ref$isHeadingLoading === void 0 ? false : _ref$isHeadingLoading,
25734
25697
  buttonLink = _ref.buttonLink,
25735
25698
  subHeading = _ref.subHeading,
25736
25699
  buttonText = _ref.buttonText,
@@ -25772,20 +25735,12 @@ var Jumbo = function Jumbo(_ref) {
25772
25735
  }, /*#__PURE__*/React__default.createElement(Title$1, {
25773
25736
  variant: isMobile ? "small" : "large",
25774
25737
  as: "h1",
25775
- color: WHITE,
25738
+ color: "#ffffff",
25776
25739
  className: "themeJumboHeading",
25777
25740
  extraStyles: showCartStatus && isMobile && "max-width: 60%;"
25778
- }, isHeadingLoading ? /*#__PURE__*/React__default.createElement(Spinner$2, {
25779
- size: "50",
25780
- cx: "25",
25781
- cy: "25",
25782
- radius: "12.5",
25783
- strokeWidth: "3",
25784
- centerSpinner: true,
25785
- color: WHITE
25786
- }) : heading), subHeading && /*#__PURE__*/React__default.createElement(Heading$1, {
25741
+ }, heading), subHeading && /*#__PURE__*/React__default.createElement(Heading$1, {
25787
25742
  variant: isMobile ? "h6" : "h2",
25788
- color: WHITE,
25743
+ color: "#ffffff",
25789
25744
  className: "themeJumboSubheading"
25790
25745
  }, subHeading), showButton && /*#__PURE__*/React__default.createElement(ButtonWithLink, {
25791
25746
  url: buttonLink,
@@ -25816,7 +25771,7 @@ var fontWeight$4 = {
25816
25771
  // fontsize Detail regular
25817
25772
  large: "700" // fontsize Title small
25818
25773
  };
25819
- var fallbackValues$t = {
25774
+ var fallbackValues$s = {
25820
25775
  fontWeight: fontWeight$4
25821
25776
  };
25822
25777
 
@@ -25875,7 +25830,7 @@ var LabeledAmount = function LabeledAmount(_ref) {
25875
25830
  var LabeledAmountComponent = version === "v1" ? LabeledAmountV1 : LabeledAmountV2;
25876
25831
  return /*#__PURE__*/React__default.createElement(LabeledAmountComponent, rest);
25877
25832
  };
25878
- var LabeledAmount$1 = themeComponent(LabeledAmount, "LabeledAmount", fallbackValues$t, "default");
25833
+ var LabeledAmount$1 = themeComponent(LabeledAmount, "LabeledAmount", fallbackValues$s, "default");
25879
25834
 
25880
25835
  var weightTitle = {
25881
25836
  "default": "600",
@@ -25885,7 +25840,7 @@ var detailVariant = {
25885
25840
  "default": "large",
25886
25841
  small: "small"
25887
25842
  };
25888
- var fallbackValues$u = {
25843
+ var fallbackValues$t = {
25889
25844
  weightTitle: weightTitle,
25890
25845
  detailVariant: detailVariant
25891
25846
  };
@@ -25933,7 +25888,74 @@ var LineItem = function LineItem(_ref) {
25933
25888
  childGap: "0.25rem"
25934
25889
  }, visibleCustomAttrs));
25935
25890
  };
25936
- var LineItem$1 = themeComponent(LineItem, "LineItem", fallbackValues$u, "default");
25891
+ var LineItem$1 = themeComponent(LineItem, "LineItem", fallbackValues$t, "default");
25892
+
25893
+ var color$a = "#15749D";
25894
+ var fallbackValues$u = {
25895
+ color: color$a
25896
+ };
25897
+
25898
+ var SpinnerSvgAnimation = styled__default.svg.withConfig({
25899
+ displayName: "Spinner__SpinnerSvgAnimation",
25900
+ componentId: "sc-vhupl9-0"
25901
+ })(["animation:rotate 2s linear infinite;margin:-25px 0 0 -25px;width:", "px;height:", "px;& .path{stroke:", ";stroke-linecap:round;animation:dash 1.5s ease-in-out infinite;}@keyframes rotate{100%{transform:rotate(360deg);}}@keyframes dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0;}50%{stroke-dasharray:90,150;stroke-dashoffset:-35;}100%{stroke-dasharray:90,150;stroke-dashoffset:-124;}}", ""], function (_ref) {
25902
+ var size = _ref.size;
25903
+ return size;
25904
+ }, function (_ref2) {
25905
+ var size = _ref2.size;
25906
+ return size;
25907
+ }, function (_ref3) {
25908
+ var color = _ref3.color;
25909
+ return color;
25910
+ }, function (_ref4) {
25911
+ var centerSpinner = _ref4.centerSpinner;
25912
+ return centerSpinner ? styled.css(["margin:0;"]) : "";
25913
+ });
25914
+ var SpinnerContainer$2 = styled__default.div.withConfig({
25915
+ displayName: "Spinner__SpinnerContainer",
25916
+ componentId: "sc-vhupl9-1"
25917
+ })(["width:100%;display:flex;flex-direction:row;align-items:center;justify-content:center;line-height:1;", ""], function (_ref5) {
25918
+ var centerSpinner = _ref5.centerSpinner,
25919
+ size = _ref5.size;
25920
+ return centerSpinner ? styled.css(["width:", "px;height:", "px;"], size, size) : "";
25921
+ });
25922
+
25923
+ /*
25924
+ `centerSpinner` prop alters existing styling of spinner to allow it to properly center itself within
25925
+ containers. Default is false to preserve legacy behavior for past uses.
25926
+ */
25927
+
25928
+ var Spinner$1 = function Spinner(_ref6) {
25929
+ var _ref6$size = _ref6.size,
25930
+ size = _ref6$size === void 0 ? "24" : _ref6$size,
25931
+ _ref6$centerSpinner = _ref6.centerSpinner,
25932
+ centerSpinner = _ref6$centerSpinner === void 0 ? false : _ref6$centerSpinner,
25933
+ themeValues = _ref6.themeValues,
25934
+ _ref6$cx = _ref6.cx,
25935
+ cx = _ref6$cx === void 0 ? "50" : _ref6$cx,
25936
+ _ref6$cy = _ref6.cy,
25937
+ cy = _ref6$cy === void 0 ? "50" : _ref6$cy,
25938
+ _ref6$radius = _ref6.radius,
25939
+ radius = _ref6$radius === void 0 ? "25" : _ref6$radius,
25940
+ _ref6$strokeWidth = _ref6.strokeWidth,
25941
+ strokeWidth = _ref6$strokeWidth === void 0 ? "6" : _ref6$strokeWidth;
25942
+ return /*#__PURE__*/React__default.createElement(SpinnerContainer$2, {
25943
+ centerSpinner: centerSpinner,
25944
+ size: size
25945
+ }, /*#__PURE__*/React__default.createElement(SpinnerSvgAnimation, {
25946
+ size: size,
25947
+ color: themeValues.color,
25948
+ centerSpinner: centerSpinner
25949
+ }, /*#__PURE__*/React__default.createElement("circle", {
25950
+ className: "path",
25951
+ cx: cx,
25952
+ cy: cy,
25953
+ r: radius,
25954
+ fill: "none",
25955
+ strokeWidth: strokeWidth
25956
+ })));
25957
+ };
25958
+ var Spinner$2 = themeComponent(Spinner$1, "Spinner", fallbackValues$u);
25937
25959
 
25938
25960
  var Loading = function Loading() {
25939
25961
  return /*#__PURE__*/React__default.createElement(Box, {
@@ -49944,6 +49966,94 @@ var HeroImage = function HeroImage(_ref) {
49944
49966
  };
49945
49967
  var HeroImage$1 = withWindowSize(themeComponent(HeroImage, "HeroImage", fallbackValues$11, "v1"));
49946
49968
 
49969
+ var TurnstileWidgetContainer = styled__default(Box).withConfig({
49970
+ displayName: "TurnstileWidget__TurnstileWidgetContainer",
49971
+ componentId: "sc-btaugr-0"
49972
+ })(["display:flex;padding:", ";justify-content:", ";width:100%;"], function (_ref) {
49973
+ var padding = _ref.padding;
49974
+ return padding;
49975
+ }, function (_ref2) {
49976
+ var justify = _ref2.justify;
49977
+ return justify;
49978
+ });
49979
+ var TurnstileWidget = /*#__PURE__*/React.forwardRef(function (_ref3, ref) {
49980
+ var verifyURL = _ref3.verifyURL,
49981
+ siteKey = _ref3.siteKey,
49982
+ _ref3$onSuccess = _ref3.onSuccess,
49983
+ onSuccess = _ref3$onSuccess === void 0 ? noop$1 : _ref3$onSuccess,
49984
+ _ref3$onError = _ref3.onError,
49985
+ onError = _ref3$onError === void 0 ? noop$1 : _ref3$onError,
49986
+ _ref3$onExpired = _ref3.onExpired,
49987
+ onExpired = _ref3$onExpired === void 0 ? noop$1 : _ref3$onExpired,
49988
+ _ref3$padding = _ref3.padding,
49989
+ padding = _ref3$padding === void 0 ? "1rem" : _ref3$padding,
49990
+ _ref3$justify = _ref3.justify,
49991
+ justify = _ref3$justify === void 0 ? "flex-end" : _ref3$justify,
49992
+ _ref3$size = _ref3.size,
49993
+ size = _ref3$size === void 0 ? "normal" : _ref3$size,
49994
+ _ref3$tabindex = _ref3.tabindex,
49995
+ tabindex = _ref3$tabindex === void 0 ? 0 : _ref3$tabindex,
49996
+ _ref3$retry = _ref3.retry,
49997
+ retry = _ref3$retry === void 0 ? "auto" : _ref3$retry,
49998
+ _ref3$theme = _ref3.theme,
49999
+ theme = _ref3$theme === void 0 ? "auto" : _ref3$theme,
50000
+ _ref3$extraStyles = _ref3.extraStyles,
50001
+ extraStyles = _ref3$extraStyles === void 0 ? "" : _ref3$extraStyles;
50002
+ if (!verifyURL || !siteKey) return null;
50003
+ var containerRef = React.useRef(null);
50004
+ var _useState = React.useState(null),
50005
+ _useState2 = _slicedToArray(_useState, 2),
50006
+ widgetId = _useState2[0],
50007
+ setWidgetId = _useState2[1];
50008
+ var isTurnstileLoaded = useTurnstileScript(verifyURL);
50009
+
50010
+ // Allow the parent component to reset the Turnstile widget
50011
+ React.useImperativeHandle(ref, function () {
50012
+ return {
50013
+ reset: function reset() {
50014
+ if (widgetId !== null) {
50015
+ var _window$turnstile;
50016
+ (_window$turnstile = window.turnstile) === null || _window$turnstile === void 0 || _window$turnstile.reset(widgetId);
50017
+ }
50018
+ }
50019
+ };
50020
+ });
50021
+ React.useEffect(function () {
50022
+ if (window.turnstile && containerRef.current && widgetId === null) {
50023
+ var newWidgetId = window.turnstile.render(containerRef.current, {
50024
+ sitekey: siteKey,
50025
+ size: size,
50026
+ retry: retry,
50027
+ tabindex: tabindex,
50028
+ theme: theme,
50029
+ callback: function callback(token) {
50030
+ return onSuccess(token);
50031
+ },
50032
+ "error-callback": function errorCallback() {
50033
+ return onError();
50034
+ },
50035
+ "expired-callback": function expiredCallback() {
50036
+ return onExpired();
50037
+ }
50038
+ });
50039
+ setWidgetId(newWidgetId);
50040
+ }
50041
+ return function () {
50042
+ if (widgetId !== null) {
50043
+ var _window$turnstile2;
50044
+ (_window$turnstile2 = window.turnstile) === null || _window$turnstile2 === void 0 || _window$turnstile2.reset(widgetId);
50045
+ }
50046
+ };
50047
+ }, [isTurnstileLoaded, siteKey, widgetId]);
50048
+ return /*#__PURE__*/React__default.createElement(TurnstileWidgetContainer, {
50049
+ padding: padding,
50050
+ justify: justify,
50051
+ extraStyles: extraStyles
50052
+ }, /*#__PURE__*/React__default.createElement("div", {
50053
+ ref: containerRef
50054
+ }));
50055
+ });
50056
+
49947
50057
  var pageBackground = "#FBFCFD";
49948
50058
  var fallbackValues$12 = {
49949
50059
  pageBackground: pageBackground
@@ -50496,6 +50606,7 @@ exports.ToastNotification = ToastNotification;
50496
50606
  exports.ToggleSwitch = ToggleSwitch$1;
50497
50607
  exports.TrashIcon = TrashIcon$1;
50498
50608
  exports.TrashIconV2 = TrashIconV2$1;
50609
+ exports.TurnstileWidget = TurnstileWidget;
50499
50610
  exports.TypeaheadInput = TypeaheadInput;
50500
50611
  exports.VerifiedEmailIcon = VerifiedEmailIcon$1;
50501
50612
  exports.VoidedIcon = VoidedIcon;