@thecb/components 11.3.2 → 11.3.3-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
@@ -15942,7 +15942,9 @@ var TrashIcon = function TrashIcon(_ref) {
15942
15942
  };
15943
15943
  var TrashIcon$1 = themeComponent(TrashIcon, "Icons", fallbackValues$2, "primary");
15944
15944
 
15945
- var CustomerSearchIcon = function CustomerSearchIcon() {
15945
+ var CustomerSearchIcon = function CustomerSearchIcon(_ref) {
15946
+ var _ref$fillPrimary = _ref.fillPrimary,
15947
+ fillPrimary = _ref$fillPrimary === void 0 ? MATISSE_BLUE : _ref$fillPrimary;
15946
15948
  return /*#__PURE__*/React__default.createElement("svg", {
15947
15949
  xmlns: "http://www.w3.org/2000/svg",
15948
15950
  xmlnsXlink: "http://www.w3.org/1999/xlink",
@@ -16008,13 +16010,17 @@ var CustomerSearchIcon = function CustomerSearchIcon() {
16008
16010
  fill: "#E4F4FD",
16009
16011
  d: "M185 185c28.719 0 52 5.373 52 12s-23.281 12-52 12c-28.718 0-52-5.373-52-12s23.282-12 52-12zM97 44a2 2 0 012 2v52a2 2 0 01-2 2H45a2 2 0 01-2-2V46a2 2 0 012-2h52zM80 70c-3.535 0-6.145 1.941-7.827 5.824C70.192 73.274 67.633 72 64.5 72c-5.912 0-9.773 4.536-11.585 13.608a2 2 0 001.83 2.388l.13.004h19.25l.148-.005a2 2 0 001.812-2.387 37.807 37.807 0 00-.733-3.045L75.184 82h11.893l.15-.005a2 2 0 001.797-2.451C87.534 73.18 84.526 70 80 70zm136-26c10.493 0 19 8.507 19 19s-8.507 19-19 19-19-8.507-19-19 8.507-19 19-19zM64.5 56a7 7 0 100 14 7 7 0 000-14zM216 58c-4.206 0-7.903 2.689-9.348 6.641a2.5 2.5 0 004.635 1.87l.061-.152.083-.214c.786-1.896 2.575-3.145 4.57-3.145 1.994 0 3.782 1.249 4.568 3.145l.083.214.061.152a2.5 2.5 0 004.635-1.87C223.903 60.69 220.207 58 216.001 58zM80 57a5.5 5.5 0 100 11 5.5 5.5 0 000-11z"
16010
16012
  }), /*#__PURE__*/React__default.createElement("path", {
16011
- fill: "#15749D",
16013
+ fill: fillPrimary,
16012
16014
  fillRule: "nonzero",
16013
16015
  d: "M182 176v20a4 4 0 01-3.8 3.995l-.2.005h-14a4 4 0 01-.2-7.995l.2-.005h10v-16h8zm14 0v16h10a4 4 0 013.995 3.8l.005.2a4 4 0 01-3.8 3.995l-.2.005h-14a4 4 0 01-3.995-3.8L188 196v-20h8zM69 128.5v9l-7.875 4.429 32.876 6.953c1.81-4.055 5.877-6.882 10.604-6.882a4 4 0 01.2 7.995l-.2.005a3.605 3.605 0 00-3.605 3.593v.035-.023a3.606 3.606 0 003.414 3.601l.191.005h6.644a4 4 0 01.2 7.995l-.2.005h-6.644c-5.246 0-9.679-3.48-11.115-8.259l-44.708-9.457c-3.58-.757-4.322-5.493-1.242-7.336l.175-.1L69 128.5zM263.644 96c6.184 0 11.24 4.838 11.586 10.936l38.713 7.13c3.304.609 4.407 4.749 1.927 6.93l-.15.125L301 133v-10.5l2.891-2.151-31.014-5.712a11.586 11.586 0 01-8.881 4.569l-.352.005H257l-.2-.005a4 4 0 010-7.99l.2-.005h6.644l.191-.005a3.606 3.606 0 003.414-3.601c0-1.99-.358-3.259-2.403-5.238a361.04 361.04 0 00-4.65-4.395A3.998 3.998 0 01263.644 96zM97 40a6 6 0 016 6v52a6 6 0 01-6 6H45a6 6 0 01-6-6V46a6 6 0 016-6h52zm0 4H45a2 2 0 00-1.995 1.85L43 46v52a2 2 0 001.85 1.995L45 100h52a2 2 0 001.995-1.85L99 98V46a2 2 0 00-1.85-1.995L97 44zM80 70c4.526 0 7.534 3.181 9.024 9.544a2 2 0 01-1.798 2.45l-.149.006H75.184c.342 1.11.643 2.313.901 3.608a2 2 0 01-1.812 2.387l-.149.005H54.876a2 2 0 01-1.961-2.392C54.727 76.536 58.588 72 64.5 72c3.134 0 5.692 1.275 7.673 3.824C73.855 71.941 76.465 70 80 70zM64.5 56a7 7 0 110 14 7 7 0 010-14zM80 57a5.5 5.5 0 110 11 5.5 5.5 0 010-11z"
16014
16016
  }))))));
16015
16017
  };
16016
16018
 
16017
- var PaymentSearchIcon = function PaymentSearchIcon() {
16019
+ var PaymentSearchIcon = function PaymentSearchIcon(_ref) {
16020
+ var _ref$fillPrimary = _ref.fillPrimary,
16021
+ fillPrimary = _ref$fillPrimary === void 0 ? SEA_GREEN : _ref$fillPrimary,
16022
+ _ref$fillSecondary = _ref.fillSecondary,
16023
+ fillSecondary = _ref$fillSecondary === void 0 ? HINT_GREEN : _ref$fillSecondary;
16018
16024
  return /*#__PURE__*/React__default.createElement("svg", {
16019
16025
  xmlns: "http://www.w3.org/2000/svg",
16020
16026
  xmlnsXlink: "http://www.w3.org/1999/xlink",
@@ -16080,10 +16086,10 @@ var PaymentSearchIcon = function PaymentSearchIcon() {
16080
16086
  filter: "url(#payment-search-filter-2)",
16081
16087
  xlinkHref: "#payment-search-path-1"
16082
16088
  }), /*#__PURE__*/React__default.createElement("path", {
16083
- fill: "#E8FFEF",
16089
+ fill: fillSecondary,
16084
16090
  d: "M185 185c28.719 0 52 5.373 52 12s-23.281 12-52 12c-28.718 0-52-5.373-52-12s23.282-12 52-12zM97 44a2 2 0 012 2v52a2 2 0 01-2 2H45a2 2 0 01-2-2V46a2 2 0 012-2h52zM74.134 56h-5.268c-.441 0-.806.304-.86.696l-.006.1v2.456c-4.391.845-7.029 3.74-7.144 7.532l-.004.26v.072c0 5.135 4.208 6.644 9.66 7.865 3.408.801 4.302 1.333 4.351 2.348l.002.093v.073c0 1.077-1.025 1.723-2.963 1.723-2.717 0-5.28-.875-7.66-2.542a.896.896 0 00-1.112.082l-.078.081-2.845 3.336a.84.84 0 00.11 1.21c2.061 1.596 4.522 2.668 7.182 3.207l.5.095.001 2.581c0 .37.3.677.688.725l.108.007h5.407c.403 0 .737-.275.79-.632l.007-.1v-2.602c4.212-.902 6.88-3.587 6.996-7.58l.004-.273v-.072c0-4.705-3.659-6.572-9.513-7.83-3.483-.767-4.411-1.263-4.462-2.344l-.002-.097v-.072c0-.934.842-1.616 2.562-1.616 2.041 0 4.32.669 6.462 2.007a.9.9 0 001.13-.126l.073-.089 2.566-3.556a.841.841 0 00-.185-1.18 14.999 14.999 0 00-5.178-2.318l-.451-.103-.002-2.62c0-.44-.388-.797-.866-.797z"
16085
16091
  }), /*#__PURE__*/React__default.createElement("path", {
16086
- fill: "#317D4F",
16092
+ fill: fillPrimary,
16087
16093
  fillRule: "nonzero",
16088
16094
  d: "M182 176v20a4 4 0 01-3.8 3.995l-.2.005h-14a4 4 0 01-.2-7.995l.2-.005h10v-16h8zm14 0v16h10a4 4 0 013.995 3.8l.005.2a4 4 0 01-3.8 3.995l-.2.005h-14a4 4 0 01-3.995-3.8L188 196v-20h8zM69 128.5v9l-7.875 4.429 32.876 6.953c1.81-4.055 5.877-6.882 10.604-6.882a4 4 0 01.2 7.995l-.2.005a3.605 3.605 0 00-3.605 3.593v.035-.023a3.606 3.606 0 003.414 3.601l.191.005h6.644a4 4 0 01.2 7.995l-.2.005h-6.644c-5.246 0-9.679-3.48-11.115-8.259l-44.708-9.457c-3.58-.757-4.322-5.493-1.242-7.336l.175-.1L69 128.5zM263.644 96c6.184 0 11.24 4.838 11.586 10.936l38.713 7.13c3.304.609 4.407 4.749 1.927 6.93l-.15.125L301 133v-10.5l2.891-2.151-31.014-5.712a11.586 11.586 0 01-8.881 4.569l-.352.005H257l-.2-.005a4 4 0 010-7.99l.2-.005h6.644l.191-.005a3.606 3.606 0 003.414-3.601c0-1.99-.358-3.259-2.403-5.238a361.04 361.04 0 00-4.65-4.395A3.998 3.998 0 01263.644 96zM97 40a6 6 0 016 6v52a6 6 0 01-6 6H45a6 6 0 01-6-6V46a6 6 0 016-6h52zm0 4H45a2 2 0 00-1.995 1.85L43 46v52a2 2 0 001.85 1.995L45 100h52a2 2 0 001.995-1.85L99 98V46a2 2 0 00-1.85-1.995L97 44zM74.134 56c.478 0 .866.356.866.796l.002 2.621c2.128.452 3.983 1.265 5.629 2.42.383.27.457.804.185 1.181l-2.566 3.556c-.275.382-.801.466-1.203.215-2.142-1.338-4.42-2.007-6.462-2.007-1.72 0-2.562.682-2.562 1.616v.072c0 1.15.879 1.652 4.464 2.442C78.341 70.169 82 72.036 82 76.742v.07c0 4.144-2.692 6.932-7 7.854v2.602c0 .404-.357.732-.797.732h-5.407c-.44 0-.796-.328-.796-.732v-2.581c-2.852-.502-5.493-1.606-7.684-3.302a.84.84 0 01-.11-1.21l2.846-3.336a.898.898 0 011.19-.163c2.38 1.667 4.943 2.542 7.66 2.542 1.938 0 2.963-.646 2.963-1.723v-.073c0-1.076-.841-1.615-4.353-2.44-5.452-1.222-9.66-2.73-9.66-7.866v-.072c0-3.92 2.657-6.928 7.148-7.792v-2.456c0-.44.388-.796.866-.796h5.268z"
16089
16095
  }))))));
@@ -24412,47 +24418,29 @@ function useConditionallyAddValidator(condition, validatorFn, addValidator, remo
24412
24418
  var useTurnstileScript = function useTurnstileScript(verifyURL) {
24413
24419
  var _useState = React.useState(false),
24414
24420
  _useState2 = _slicedToArray(_useState, 2),
24415
- scriptLoaded = _useState2[0],
24416
- setScriptLoaded = _useState2[1];
24417
- var _useState3 = React.useState(false),
24418
- _useState4 = _slicedToArray(_useState3, 2),
24419
- scriptError = _useState4[0],
24420
- setScriptError = _useState4[1];
24421
- var handleScriptError = function handleScriptError() {
24422
- setScriptError(true);
24423
- setScriptLoaded(false);
24424
- };
24421
+ isLoaded = _useState2[0],
24422
+ setIsLoaded = _useState2[1];
24425
24423
  React.useEffect(function () {
24426
24424
  if (typeof window === "undefined") {
24427
- setScriptLoaded(false);
24425
+ setIsLoaded(false);
24428
24426
  return;
24429
24427
  }
24430
24428
  if (window.turnstile && window.turnstile.render) {
24431
- setScriptLoaded(true);
24429
+ setIsLoaded(true);
24432
24430
  return;
24433
24431
  }
24434
24432
  var script = document.createElement("script");
24435
24433
  script.src = "".concat(verifyURL, "?render=explicit");
24436
24434
  script.onload = function () {
24437
- setScriptLoaded(true);
24438
- };
24439
- script.onerror = function () {
24440
- handleScriptError();
24441
- };
24442
- script.onabort = function () {
24443
- handleScriptError();
24435
+ setIsLoaded(true);
24444
24436
  };
24445
24437
  script.defer = true;
24446
24438
  document.getElementsByTagName("head")[0].appendChild(script);
24447
24439
  return function () {
24448
- setScriptLoaded(false);
24449
- setScriptError(false);
24440
+ setIsLoaded(false);
24450
24441
  };
24451
24442
  }, [verifyURL]);
24452
- return {
24453
- scriptLoaded: scriptLoaded,
24454
- scriptError: scriptError
24455
- };
24443
+ return isLoaded;
24456
24444
  };
24457
24445
 
24458
24446
 
@@ -50006,142 +49994,89 @@ var HeroImage$1 = withWindowSize(themeComponent(HeroImage, "HeroImage", fallback
50006
49994
  var TurnstileWidgetContainer = styled__default(Box).withConfig({
50007
49995
  displayName: "TurnstileWidget__TurnstileWidgetContainer",
50008
49996
  componentId: "sc-btaugr-0"
50009
- })(["display:flex;flex-direction:column;padding:", ";justify-content:", ";align-items:", ";width:100%;"], function (_ref) {
49997
+ })(["display:flex;padding:", ";justify-content:", ";width:100%;"], function (_ref) {
50010
49998
  var padding = _ref.padding;
50011
49999
  return padding;
50012
50000
  }, function (_ref2) {
50013
50001
  var justify = _ref2.justify;
50014
50002
  return justify;
50015
- }, function (_ref3) {
50016
- var align = _ref3.align;
50017
- return align;
50018
50003
  });
50019
- var FATAL_ERROR_CODES = [
50020
- // Configuration errors
50021
- /^100/, /^105/, /^110100$/, /^110110$/, /^110200$/, /^110420$/, /^110430$/, /^400020$/, /^400030$/, /^400040$/,
50022
- // Browser/environment errors
50023
- /^110500$/, /^110510$/, /^200010$/, /^200100$/,
50024
- // Internal errors
50025
- /^120/];
50026
- var TurnstileWidget = /*#__PURE__*/React.forwardRef(function (_ref4, ref) {
50027
- var verifyURL = _ref4.verifyURL,
50028
- siteKey = _ref4.siteKey,
50029
- _ref4$onSuccess = _ref4.onSuccess,
50030
- onSuccess = _ref4$onSuccess === void 0 ? noop$1 : _ref4$onSuccess,
50031
- _ref4$onError = _ref4.onError,
50032
- onError = _ref4$onError === void 0 ? noop$1 : _ref4$onError,
50033
- _ref4$onExpired = _ref4.onExpired,
50034
- onExpired = _ref4$onExpired === void 0 ? noop$1 : _ref4$onExpired,
50035
- _ref4$padding = _ref4.padding,
50036
- padding = _ref4$padding === void 0 ? "1rem" : _ref4$padding,
50037
- _ref4$justify = _ref4.justify,
50038
- justify = _ref4$justify === void 0 ? "flex-end" : _ref4$justify,
50039
- _ref4$align = _ref4.align,
50040
- align = _ref4$align === void 0 ? "flex-end" : _ref4$align,
50041
- _ref4$size = _ref4.size,
50042
- size = _ref4$size === void 0 ? "normal" : _ref4$size,
50043
- _ref4$tabindex = _ref4.tabindex,
50044
- tabindex = _ref4$tabindex === void 0 ? 0 : _ref4$tabindex,
50045
- _ref4$retry = _ref4.retry,
50046
- retry = _ref4$retry === void 0 ? "never" : _ref4$retry,
50047
- _ref4$theme = _ref4.theme,
50048
- theme = _ref4$theme === void 0 ? "light" : _ref4$theme,
50049
- _ref4$extraStyles = _ref4.extraStyles,
50050
- extraStyles = _ref4$extraStyles === void 0 ? "" : _ref4$extraStyles;
50004
+ var TurnstileWidget = /*#__PURE__*/React.forwardRef(function (_ref3, ref) {
50005
+ var verifyURL = _ref3.verifyURL,
50006
+ siteKey = _ref3.siteKey,
50007
+ _ref3$onSuccess = _ref3.onSuccess,
50008
+ onSuccess = _ref3$onSuccess === void 0 ? noop$1 : _ref3$onSuccess,
50009
+ _ref3$onError = _ref3.onError,
50010
+ onError = _ref3$onError === void 0 ? noop$1 : _ref3$onError,
50011
+ _ref3$onExpired = _ref3.onExpired,
50012
+ onExpired = _ref3$onExpired === void 0 ? noop$1 : _ref3$onExpired,
50013
+ _ref3$padding = _ref3.padding,
50014
+ padding = _ref3$padding === void 0 ? "1rem" : _ref3$padding,
50015
+ _ref3$justify = _ref3.justify,
50016
+ justify = _ref3$justify === void 0 ? "flex-end" : _ref3$justify,
50017
+ _ref3$size = _ref3.size,
50018
+ size = _ref3$size === void 0 ? "normal" : _ref3$size,
50019
+ _ref3$tabindex = _ref3.tabindex,
50020
+ tabindex = _ref3$tabindex === void 0 ? 0 : _ref3$tabindex,
50021
+ _ref3$retry = _ref3.retry,
50022
+ retry = _ref3$retry === void 0 ? "auto" : _ref3$retry,
50023
+ _ref3$theme = _ref3.theme,
50024
+ theme = _ref3$theme === void 0 ? "auto" : _ref3$theme,
50025
+ _ref3$extraStyles = _ref3.extraStyles,
50026
+ extraStyles = _ref3$extraStyles === void 0 ? "" : _ref3$extraStyles;
50051
50027
  if (!verifyURL || !siteKey) return null;
50052
50028
  var widgetRef = React.useRef(null);
50053
- var widgetIdRef = React.useRef(null);
50054
50029
  var _useState = React.useState(null),
50055
50030
  _useState2 = _slicedToArray(_useState, 2),
50056
- error = _useState2[0],
50057
- setError = _useState2[1];
50058
- var _useTurnstileScript = useTurnstileScript(verifyURL),
50059
- scriptLoaded = _useTurnstileScript.scriptLoaded,
50060
- scriptError = _useTurnstileScript.scriptError;
50061
-
50062
- // Clear the error state
50063
- var clearError = function clearError() {
50064
- setError(null);
50065
- };
50066
-
50067
- // Handle errors based on the retry strategy
50068
- var handleError = function handleError(errorCode) {
50069
- if (!errorCode) return;
50070
- var isFatalError = FATAL_ERROR_CODES.some(function (pattern) {
50071
- return pattern.test(errorCode);
50072
- });
50073
- var errorMessage = getErrorMessage(isFatalError);
50074
- setError(errorMessage);
50075
- };
50076
- var getErrorMessage = function getErrorMessage(isFatalError) {
50077
- if (isFatalError) {
50078
- return "Browser or system error. Please refresh the page or try a different browser.";
50079
- }
50080
- return "Something went wrong. Please refresh and try again.";
50081
- };
50031
+ widgetId = _useState2[0],
50032
+ setWidgetId = _useState2[1];
50033
+ var isTurnstileLoaded = useTurnstileScript(verifyURL);
50082
50034
 
50083
50035
  // Allow the parent component to reset the Turnstile widget
50084
50036
  React.useImperativeHandle(ref, function () {
50085
50037
  return {
50086
50038
  reset: function reset() {
50087
- if (widgetIdRef.current && window.turnstile) {
50088
- window.turnstile.reset(widgetIdRef.current);
50089
- clearError();
50039
+ if (widgetId && window.turnstile) {
50040
+ window.turnstile.reset(widgetId);
50090
50041
  }
50091
50042
  }
50092
50043
  };
50093
- }, []);
50044
+ }, [widgetId]);
50094
50045
  React.useEffect(function () {
50095
- if (scriptError) {
50096
- setError("Unable to load security verification. Please refresh the page.");
50097
- onError === null || onError === void 0 || onError("script_load_failed");
50098
- return;
50099
- }
50100
- if (widgetIdRef.current || !window.turnstile || !scriptLoaded) return;
50101
- try {
50102
- widgetIdRef.current = window.turnstile.render(widgetRef.current, {
50046
+ if (!widgetRef.current || !window.turnstile) return;
50047
+ if (!widgetId) {
50048
+ var newWidgetId = window.turnstile.render(widgetRef.current, {
50103
50049
  sitekey: siteKey,
50104
50050
  size: size,
50105
50051
  retry: retry,
50106
50052
  tabindex: tabindex,
50107
50053
  theme: theme,
50108
50054
  callback: function callback(token) {
50109
- clearError();
50110
- onSuccess === null || onSuccess === void 0 || onSuccess(token);
50055
+ return onSuccess(token);
50111
50056
  },
50112
- "error-callback": function errorCallback(errorCode) {
50113
- handleError(errorCode);
50114
- onError === null || onError === void 0 || onError(errorCode);
50057
+ "error-callback": function errorCallback() {
50058
+ return onError();
50115
50059
  },
50116
50060
  "expired-callback": function expiredCallback() {
50117
- clearError();
50118
- onExpired === null || onExpired === void 0 || onExpired();
50061
+ return onExpired();
50119
50062
  }
50120
50063
  });
50121
- } catch (error) {
50122
- setError("Unable to load security verification. Please refresh the page.");
50123
- onError === null || onError === void 0 || onError("render_failed");
50064
+ setWidgetId(newWidgetId);
50124
50065
  }
50125
50066
  return function () {
50126
- if (widgetIdRef.current && window.turnstile) {
50127
- window.turnstile.remove(widgetIdRef.current);
50128
- widgetIdRef.current = null;
50129
- clearError();
50067
+ if (widgetId && window.turnstile) {
50068
+ window.turnstile.remove(widgetId);
50069
+ setWidgetId(null);
50130
50070
  }
50131
50071
  };
50132
- }, [scriptLoaded, scriptError, siteKey]);
50133
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(TurnstileWidgetContainer, {
50072
+ }, [isTurnstileLoaded, siteKey, widgetId]);
50073
+ return /*#__PURE__*/React__default.createElement(TurnstileWidgetContainer, {
50134
50074
  padding: padding,
50135
50075
  justify: justify,
50136
- align: align,
50137
50076
  extraStyles: extraStyles
50138
50077
  }, /*#__PURE__*/React__default.createElement("div", {
50139
50078
  ref: widgetRef
50140
- }), error && /*#__PURE__*/React__default.createElement(Text$1, {
50141
- color: ERROR_COLOR,
50142
- variant: "pXS",
50143
- extraStyles: "\n word-break: break-word;\n text-align: end;\n padding-top: 0.5rem;\n "
50144
- }, error)));
50079
+ }));
50145
50080
  });
50146
50081
 
50147
50082
  var pageBackground = "#FBFCFD";